2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-03-30 08:03:04 +00:00
|
|
|
|
|
|
|
/*
|
2006-03-31 08:41:49 +00:00
|
|
|
* Base class for DOM Core's nsIDOMComment, nsIDOMDocumentType, nsIDOMText,
|
|
|
|
* nsIDOMCDATASection, and nsIDOMProcessingInstruction nodes.
|
2006-03-30 08:03:04 +00:00
|
|
|
*/
|
|
|
|
|
1998-09-06 04:16:22 +00:00
|
|
|
#ifndef nsGenericDOMDataNode_h___
|
|
|
|
#define nsGenericDOMDataNode_h___
|
1998-09-06 00:16:36 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2009-07-26 22:05:41 +00:00
|
|
|
#include "nsIContent.h"
|
2011-08-11 13:29:50 +00:00
|
|
|
|
1998-10-20 00:20:04 +00:00
|
|
|
#include "nsTextFragment.h"
|
2012-07-27 14:03:27 +00:00
|
|
|
#include "nsError.h"
|
2012-11-14 22:10:08 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
2007-01-04 22:31:26 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
1998-09-06 00:16:36 +00:00
|
|
|
|
2009-01-15 04:38:07 +00:00
|
|
|
#include "nsISMILAttr.h"
|
2014-07-22 15:29:33 +00:00
|
|
|
#include "mozilla/dom/ShadowRoot.h"
|
2009-01-15 04:38:07 +00:00
|
|
|
|
2014-08-18 14:44:50 +00:00
|
|
|
class nsIDocument;
|
1999-03-31 20:49:25 +00:00
|
|
|
class nsIDOMText;
|
1998-09-06 00:16:36 +00:00
|
|
|
|
2012-10-02 00:52:06 +00:00
|
|
|
#define DATA_NODE_FLAG_BIT(n_) NODE_FLAG_BIT(NODE_TYPE_SPECIFIC_BITS_OFFSET + (n_))
|
|
|
|
|
|
|
|
// Data node specific flags
|
|
|
|
enum {
|
|
|
|
// This bit is set to indicate that if the text node changes to
|
|
|
|
// non-whitespace, we may need to create a frame for it. This bit must
|
|
|
|
// not be set on nodes that already have a frame.
|
|
|
|
NS_CREATE_FRAME_IF_NON_WHITESPACE = DATA_NODE_FLAG_BIT(0),
|
|
|
|
|
|
|
|
// This bit is set to indicate that if the text node changes to
|
|
|
|
// whitespace, we may need to reframe it (or its ancestors).
|
2013-07-18 03:23:52 +00:00
|
|
|
NS_REFRAME_IF_WHITESPACE = DATA_NODE_FLAG_BIT(1),
|
|
|
|
|
|
|
|
// This bit is set to indicate that we have a cached
|
|
|
|
// TextIsOnlyWhitespace value
|
|
|
|
NS_CACHED_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(2),
|
|
|
|
|
|
|
|
// This bit is only meaningful if the NS_CACHED_TEXT_IS_ONLY_WHITESPACE
|
|
|
|
// bit is set, and if so it indicates whether we're only whitespace or
|
|
|
|
// not.
|
2013-09-19 04:23:48 +00:00
|
|
|
NS_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(3),
|
2012-10-02 00:52:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Make sure we have enough space for those bits
|
2013-07-18 03:23:52 +00:00
|
|
|
ASSERT_NODE_FLAGS_SPACE(NODE_TYPE_SPECIFIC_BITS_OFFSET + 4);
|
2012-10-02 00:52:06 +00:00
|
|
|
|
2012-10-03 21:32:34 +00:00
|
|
|
#undef DATA_NODE_FLAG_BIT
|
|
|
|
|
2006-07-19 04:36:36 +00:00
|
|
|
class nsGenericDOMDataNode : public nsIContent
|
2001-12-16 06:59:31 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2001-12-16 06:59:31 +00:00
|
|
|
|
2012-02-01 21:58:01 +00:00
|
|
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
2011-07-19 17:04:09 +00:00
|
|
|
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
|
|
|
explicit nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
1998-09-06 00:16:36 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void GetNodeValueInternal(nsAString& aNodeValue) override;
|
2012-10-09 12:31:24 +00:00
|
|
|
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
|
2015-03-21 16:28:04 +00:00
|
|
|
mozilla::ErrorResult& aError) override;
|
2005-09-11 17:15:08 +00:00
|
|
|
|
1998-10-20 17:07:23 +00:00
|
|
|
// Implementation for nsIDOMCharacterData
|
2005-09-11 17:15:08 +00:00
|
|
|
nsresult GetData(nsAString& aData) const;
|
2002-03-23 23:54:46 +00:00
|
|
|
nsresult SetData(const nsAString& aData);
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult GetLength(uint32_t* aLength);
|
|
|
|
nsresult SubstringData(uint32_t aOffset, uint32_t aCount,
|
2002-03-23 23:54:46 +00:00
|
|
|
nsAString& aReturn);
|
|
|
|
nsresult AppendData(const nsAString& aArg);
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult InsertData(uint32_t aOffset, const nsAString& aArg);
|
|
|
|
nsresult DeleteData(uint32_t aOffset, uint32_t aCount);
|
|
|
|
nsresult ReplaceData(uint32_t aOffset, uint32_t aCount,
|
2002-03-23 23:54:46 +00:00
|
|
|
const nsAString& aArg);
|
2013-04-13 07:08:47 +00:00
|
|
|
NS_IMETHOD MozRemove();
|
1999-03-28 22:22:54 +00:00
|
|
|
|
2006-01-19 03:34:18 +00:00
|
|
|
// nsINode methods
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual uint32_t GetChildCount() const override;
|
|
|
|
virtual nsIContent *GetChildAt(uint32_t aIndex) const override;
|
|
|
|
virtual nsIContent * const * GetChildArray(uint32_t* aChildCount) const override;
|
|
|
|
virtual int32_t IndexOf(const nsINode* aPossibleChild) const override;
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
|
2014-08-05 10:10:00 +00:00
|
|
|
virtual void GetTextContentInternal(nsAString& aTextContent,
|
2015-03-21 16:28:04 +00:00
|
|
|
mozilla::ErrorResult& aError) override
|
2010-04-19 15:41:33 +00:00
|
|
|
{
|
2012-10-09 12:31:24 +00:00
|
|
|
GetNodeValue(aTextContent);
|
2010-04-19 15:41:33 +00:00
|
|
|
}
|
2012-10-09 12:31:24 +00:00
|
|
|
virtual void SetTextContentInternal(const nsAString& aTextContent,
|
2015-03-21 16:28:04 +00:00
|
|
|
mozilla::ErrorResult& aError) override
|
2010-04-19 15:41:33 +00:00
|
|
|
{
|
|
|
|
// Batch possible DOMSubtreeModified events.
|
2012-07-30 14:20:58 +00:00
|
|
|
mozAutoSubtreeModified subtree(OwnerDoc(), nullptr);
|
2012-10-09 12:31:24 +00:00
|
|
|
return SetNodeValue(aTextContent, aError);
|
2010-04-19 15:41:33 +00:00
|
|
|
}
|
2006-01-19 03:34:18 +00:00
|
|
|
|
1998-09-06 00:16:36 +00:00
|
|
|
// Implementation for nsIContent
|
2005-04-05 23:54:35 +00:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aCompileEventHandlers) override;
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNullParent = true) override;
|
2004-08-10 16:16:58 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) override;
|
2010-02-11 17:34:01 +00:00
|
|
|
|
2013-07-24 07:39:46 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-09-29 06:19:26 +00:00
|
|
|
const nsAString& aValue, bool aNotify)
|
2004-01-15 17:07:27 +00:00
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2004-01-15 17:07:27 +00:00
|
|
|
}
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2004-01-15 17:07:27 +00:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual const nsAttrName* GetAttrNameAt(uint32_t aIndex) const override;
|
|
|
|
virtual uint32_t GetAttrCount() const override;
|
|
|
|
virtual const nsTextFragment *GetText() override;
|
|
|
|
virtual uint32_t TextLength() const override;
|
2014-01-04 15:02:17 +00:00
|
|
|
virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
2006-07-19 04:36:36 +00:00
|
|
|
// Need to implement this here too to avoid hiding.
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult SetText(const nsAString& aStr, bool aNotify)
|
2006-07-19 04:36:36 +00:00
|
|
|
{
|
|
|
|
return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
|
|
|
|
}
|
2014-01-04 15:02:17 +00:00
|
|
|
virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual bool TextIsOnlyWhitespace() override;
|
|
|
|
virtual bool HasTextForTranslation() override;
|
|
|
|
virtual void AppendTextTo(nsAString& aResult) override;
|
2016-04-27 04:16:50 +00:00
|
|
|
MOZ_MUST_USE
|
2014-03-19 17:05:02 +00:00
|
|
|
virtual bool AppendTextTo(nsAString& aResult,
|
2015-03-19 07:46:40 +00:00
|
|
|
const mozilla::fallible_t&) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void SaveSubtreeState() override;
|
2009-01-15 04:38:07 +00:00
|
|
|
|
2001-10-16 05:31:36 +00:00
|
|
|
#ifdef DEBUG
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void List(FILE* out, int32_t aIndent) const override;
|
|
|
|
virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;
|
2001-10-16 05:31:36 +00:00
|
|
|
#endif
|
2006-03-07 17:08:51 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIContent *GetBindingParent() const override;
|
|
|
|
virtual nsXBLBinding *GetXBLBinding() const override;
|
2013-07-17 16:05:03 +00:00
|
|
|
virtual void SetXBLBinding(nsXBLBinding* aBinding,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsBindingManager* aOldBindingManager = nullptr) override;
|
|
|
|
virtual mozilla::dom::ShadowRoot *GetContainingShadow() const override;
|
|
|
|
virtual mozilla::dom::ShadowRoot *GetShadowRoot() const override;
|
|
|
|
virtual nsTArray<nsIContent*> &DestInsertionPoints() override;
|
|
|
|
virtual nsTArray<nsIContent*> *GetExistingDestInsertionPoints() const override;
|
|
|
|
virtual void SetShadowRoot(mozilla::dom::ShadowRoot* aShadowRoot) override;
|
|
|
|
virtual nsIContent *GetXBLInsertionParent() const override;
|
|
|
|
virtual void SetXBLInsertionParent(nsIContent* aContent) override;
|
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
|
|
|
virtual bool IsLink(nsIURI** aURI) const override;
|
|
|
|
|
|
|
|
virtual mozilla::dom::CustomElementData* GetCustomElementData() const override;
|
|
|
|
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) override;
|
|
|
|
|
|
|
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
2005-11-02 00:41:51 +00:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aModType) const;
|
2005-11-02 00:41:51 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override
|
2006-09-05 10:22:54 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
*aResult = CloneDataNode(aNodeInfo, true);
|
2006-09-05 10:22:54 +00:00
|
|
|
if (!*aResult) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ADDREF(*aResult);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-09-11 17:15:08 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SplitData(uint32_t aOffset, nsIContent** aReturn,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCloneAfterOriginal = true);
|
2008-07-25 10:37:37 +00:00
|
|
|
|
2013-01-04 17:02:14 +00:00
|
|
|
// WebIDL API
|
|
|
|
// Our XPCOM GetData is just fine for WebIDL
|
2013-07-17 14:09:04 +00:00
|
|
|
virtual void SetData(const nsAString& aData, mozilla::ErrorResult& rv)
|
2013-01-04 17:02:14 +00:00
|
|
|
{
|
|
|
|
rv = SetData(aData);
|
|
|
|
}
|
|
|
|
// nsINode::Length() returns the right thing for our length attribute
|
|
|
|
void SubstringData(uint32_t aStart, uint32_t aCount, nsAString& aReturn,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
void AppendData(const nsAString& aData, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
rv = AppendData(aData);
|
|
|
|
}
|
|
|
|
void InsertData(uint32_t aOffset, const nsAString& aData,
|
|
|
|
mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
rv = InsertData(aOffset, aData);
|
|
|
|
}
|
|
|
|
void DeleteData(uint32_t aOffset, uint32_t aCount, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
rv = DeleteData(aOffset, aCount);
|
|
|
|
}
|
|
|
|
void ReplaceData(uint32_t aOffset, uint32_t aCount, const nsAString& aData,
|
|
|
|
mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
rv = ReplaceData(aOffset, aCount, aData);
|
|
|
|
}
|
|
|
|
|
1998-09-06 00:16:36 +00:00
|
|
|
//----------------------------------------
|
|
|
|
|
2001-12-16 06:59:31 +00:00
|
|
|
#ifdef DEBUG
|
2012-08-22 15:56:38 +00:00
|
|
|
void ToCString(nsAString& aBuf, int32_t aOffset, int32_t aLen) const;
|
2001-12-16 06:59:31 +00:00
|
|
|
#endif
|
|
|
|
|
2012-01-30 20:08:13 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsGenericDOMDataNode)
|
2007-01-04 22:31:26 +00:00
|
|
|
|
2006-07-02 07:23:10 +00:00
|
|
|
protected:
|
2014-06-25 02:09:15 +00:00
|
|
|
virtual ~nsGenericDOMDataNode();
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual mozilla::dom::Element* GetNameSpaceElement() override
|
2010-04-19 15:40:16 +00:00
|
|
|
{
|
2012-10-09 12:31:24 +00:00
|
|
|
nsINode *parent = GetParentNode();
|
2010-04-19 15:40:16 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
return parent && parent->IsElement() ? parent->AsElement() : nullptr;
|
2010-04-19 15:40:16 +00:00
|
|
|
}
|
|
|
|
|
2006-05-17 16:14:33 +00:00
|
|
|
/**
|
|
|
|
* There are a set of DOM- and scripting-specific instance variables
|
|
|
|
* that may only be instantiated when a content object is accessed
|
|
|
|
* through the DOM. Rather than burn actual slots in the content
|
|
|
|
* objects for each of these instance variables, we put them off
|
|
|
|
* in a side structure that's only allocated when the content is
|
|
|
|
* accessed through the DOM.
|
|
|
|
*/
|
|
|
|
class nsDataSlots : public nsINode::nsSlots
|
|
|
|
{
|
|
|
|
public:
|
2013-12-02 10:26:11 +00:00
|
|
|
nsDataSlots();
|
2006-05-17 16:14:33 +00:00
|
|
|
|
2013-07-17 16:05:06 +00:00
|
|
|
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
|
|
|
void Unlink();
|
|
|
|
|
2006-05-17 16:14:33 +00:00
|
|
|
/**
|
|
|
|
* The nearest enclosing content node with a binding that created us.
|
|
|
|
* @see nsIContent::GetBindingParent
|
|
|
|
*/
|
|
|
|
nsIContent* mBindingParent; // [Weak]
|
2013-07-17 16:05:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see nsIContent::GetXBLInsertionParent
|
|
|
|
*/
|
|
|
|
nsCOMPtr<nsIContent> mXBLInsertionParent;
|
2013-12-02 10:26:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see nsIContent::GetContainingShadow
|
|
|
|
*/
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<mozilla::dom::ShadowRoot> mContainingShadow;
|
2014-05-22 06:11:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see nsIContent::GetDestInsertionPoints
|
|
|
|
*/
|
|
|
|
nsTArray<nsIContent*> mDestInsertionPoints;
|
2006-05-17 16:14:33 +00:00
|
|
|
};
|
|
|
|
|
2006-07-02 07:23:10 +00:00
|
|
|
// Override from nsINode
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsINode::nsSlots* CreateSlots() override;
|
2006-07-02 07:23:10 +00:00
|
|
|
|
2012-08-10 22:27:28 +00:00
|
|
|
nsDataSlots* DataSlots()
|
2006-05-17 16:14:33 +00:00
|
|
|
{
|
2012-08-10 22:27:28 +00:00
|
|
|
return static_cast<nsDataSlots*>(Slots());
|
2006-05-17 16:14:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsDataSlots *GetExistingDataSlots() const
|
|
|
|
{
|
2007-07-08 07:08:04 +00:00
|
|
|
return static_cast<nsDataSlots*>(GetExistingSlots());
|
2006-05-17 16:14:33 +00:00
|
|
|
}
|
2006-07-02 07:23:10 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SplitText(uint32_t aOffset, nsIDOMText** aReturn);
|
2004-05-07 20:55:17 +00:00
|
|
|
|
2011-05-21 05:21:28 +00:00
|
|
|
nsresult GetWholeText(nsAString& aWholeText);
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
static int32_t FirstLogicallyAdjacentTextNode(nsIContent* aParent,
|
|
|
|
int32_t aIndex);
|
2008-06-04 17:53:34 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
static int32_t LastLogicallyAdjacentTextNode(nsIContent* aParent,
|
|
|
|
int32_t aIndex,
|
|
|
|
uint32_t aCount);
|
2008-06-04 17:53:34 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SetTextInternal(uint32_t aOffset, uint32_t aCount,
|
2014-01-04 15:02:17 +00:00
|
|
|
const char16_t* aBuffer, uint32_t aLength,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify,
|
2012-07-30 14:20:58 +00:00
|
|
|
CharacterDataChangeInfo::Details* aDetails = nullptr);
|
2006-10-28 01:22:53 +00:00
|
|
|
|
2005-09-11 17:15:08 +00:00
|
|
|
/**
|
|
|
|
* Method to clone this node. This needs to be overriden by all derived
|
|
|
|
* classes. If aCloneText is true the text content will be cloned too.
|
|
|
|
*
|
|
|
|
* @param aOwnerDocument the ownerDocument of the clone
|
|
|
|
* @param aCloneText if true the text content will be cloned too
|
|
|
|
* @return the clone
|
|
|
|
*/
|
2014-06-20 02:01:40 +00:00
|
|
|
virtual nsGenericDOMDataNode *CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCloneText) const = 0;
|
2005-09-11 17:15:08 +00:00
|
|
|
|
2001-12-16 06:59:31 +00:00
|
|
|
nsTextFragment mText;
|
|
|
|
|
2012-01-30 20:08:13 +00:00
|
|
|
public:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool OwnedOnlyByTheDOMTree() override
|
2012-06-27 22:09:15 +00:00
|
|
|
{
|
|
|
|
return GetParent() && mRefCnt.get() == 1;
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsPurple() override
|
2012-01-30 20:08:13 +00:00
|
|
|
{
|
|
|
|
return mRefCnt.IsPurple();
|
|
|
|
}
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void RemovePurple() override
|
2012-01-30 20:08:13 +00:00
|
|
|
{
|
|
|
|
mRefCnt.RemovePurple();
|
|
|
|
}
|
|
|
|
|
2001-12-16 06:59:31 +00:00
|
|
|
private:
|
2004-02-24 23:10:38 +00:00
|
|
|
already_AddRefed<nsIAtom> GetCurrentValueAtom();
|
1998-09-06 00:16:36 +00:00
|
|
|
};
|
|
|
|
|
1998-09-06 04:16:22 +00:00
|
|
|
#endif /* nsGenericDOMDataNode_h___ */
|