2015-05-03 22:32:37 +03: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 15:12:37 +04: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 12:03:04 +04:00
|
|
|
|
|
|
|
/*
|
2006-03-31 12:41:49 +04:00
|
|
|
* Base class for DOM Core's nsIDOMComment, nsIDOMDocumentType, nsIDOMText,
|
|
|
|
* nsIDOMCDATASection, and nsIDOMProcessingInstruction nodes.
|
2006-03-30 12:03:04 +04:00
|
|
|
*/
|
|
|
|
|
1998-09-06 08:16:22 +04:00
|
|
|
#ifndef nsGenericDOMDataNode_h___
|
|
|
|
#define nsGenericDOMDataNode_h___
|
1998-09-06 04:16:36 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2009-07-27 02:05:41 +04:00
|
|
|
#include "nsIContent.h"
|
2011-08-11 17:29:50 +04:00
|
|
|
|
1998-10-20 04:20:04 +04:00
|
|
|
#include "nsTextFragment.h"
|
2012-07-27 18:03:27 +04:00
|
|
|
#include "nsError.h"
|
2012-11-15 02:10:08 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
1998-09-06 04:16:36 +04:00
|
|
|
|
2009-01-15 07:38:07 +03:00
|
|
|
#include "nsISMILAttr.h"
|
2014-07-22 19:29:33 +04:00
|
|
|
#include "mozilla/dom/ShadowRoot.h"
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2014-08-18 18:44:50 +04:00
|
|
|
class nsIDocument;
|
1999-04-01 00:49:25 +04:00
|
|
|
class nsIDOMText;
|
1998-09-06 04:16:36 +04:00
|
|
|
|
2012-10-02 04:52:06 +04: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 07:23:52 +04: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 08:23:48 +04:00
|
|
|
NS_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(3),
|
2012-10-02 04:52:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Make sure we have enough space for those bits
|
2013-07-18 07:23:52 +04:00
|
|
|
ASSERT_NODE_FLAGS_SPACE(NODE_TYPE_SPECIFIC_BITS_OFFSET + 4);
|
2012-10-02 04:52:06 +04:00
|
|
|
|
2012-10-04 01:32:34 +04:00
|
|
|
#undef DATA_NODE_FLAG_BIT
|
|
|
|
|
2006-07-19 08:36:36 +04:00
|
|
|
class nsGenericDOMDataNode : public nsIContent
|
2001-12-16 09:59:31 +03:00
|
|
|
{
|
|
|
|
public:
|
2007-01-05 01:31:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2001-12-16 09:59:31 +03:00
|
|
|
|
2012-02-02 01:58:01 +04:00
|
|
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
2011-07-19 21:04:09 +04:00
|
|
|
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
|
|
|
explicit nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
1998-09-06 04:16:36 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void GetNodeValueInternal(nsAString& aNodeValue) override;
|
2012-10-09 16:31:24 +04:00
|
|
|
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::ErrorResult& aError) override;
|
2005-09-11 21:15:08 +04:00
|
|
|
|
1998-10-20 21:07:23 +04:00
|
|
|
// Implementation for nsIDOMCharacterData
|
2005-09-11 21:15:08 +04:00
|
|
|
nsresult GetData(nsAString& aData) const;
|
2002-03-24 02:54:46 +03:00
|
|
|
nsresult SetData(const nsAString& aData);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetLength(uint32_t* aLength);
|
|
|
|
nsresult SubstringData(uint32_t aOffset, uint32_t aCount,
|
2002-03-24 02:54:46 +03:00
|
|
|
nsAString& aReturn);
|
|
|
|
nsresult AppendData(const nsAString& aArg);
|
2012-08-22 19:56:38 +04: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-24 02:54:46 +03:00
|
|
|
const nsAString& aArg);
|
1999-03-29 02:22:54 +04:00
|
|
|
|
2006-01-19 06:34:18 +03:00
|
|
|
// nsINode methods
|
2015-03-21 19:28:04 +03: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 19:56:38 +04:00
|
|
|
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
|
2014-08-05 14:10:00 +04:00
|
|
|
virtual void GetTextContentInternal(nsAString& aTextContent,
|
2017-01-18 07:52:29 +03:00
|
|
|
mozilla::OOMReporter& aError) override
|
2010-04-19 19:41:33 +04:00
|
|
|
{
|
2012-10-09 16:31:24 +04:00
|
|
|
GetNodeValue(aTextContent);
|
2010-04-19 19:41:33 +04:00
|
|
|
}
|
2012-10-09 16:31:24 +04:00
|
|
|
virtual void SetTextContentInternal(const nsAString& aTextContent,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::ErrorResult& aError) override
|
2010-04-19 19:41:33 +04:00
|
|
|
{
|
|
|
|
// Batch possible DOMSubtreeModified events.
|
2012-07-30 18:20:58 +04:00
|
|
|
mozAutoSubtreeModified subtree(OwnerDoc(), nullptr);
|
2012-10-09 16:31:24 +04:00
|
|
|
return SetNodeValue(aTextContent, aError);
|
2010-04-19 19:41:33 +04:00
|
|
|
}
|
2006-01-19 06:34:18 +03:00
|
|
|
|
1998-09-06 04:16:36 +04:00
|
|
|
// Implementation for nsIContent
|
2005-04-06 03:54:35 +04:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
2004-08-10 20:16:58 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) override;
|
2010-02-11 20:34:01 +03:00
|
|
|
|
2013-07-24 11:39:46 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-09-29 10:19:26 +04:00
|
|
|
const nsAString& aValue, bool aNotify)
|
2004-01-15 20:07:27 +03:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2004-01-15 20:07:27 +03:00
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2004-01-15 20:07:27 +03:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual const nsAttrName* GetAttrNameAt(uint32_t aIndex) const override;
|
2016-07-23 00:11:41 +03:00
|
|
|
virtual mozilla::dom::BorrowedAttrInfo GetAttrInfoAt(uint32_t aIndex) const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetAttrCount() const override;
|
|
|
|
virtual const nsTextFragment *GetText() override;
|
|
|
|
virtual uint32_t TextLength() const override;
|
2014-01-04 19:02:17 +04:00
|
|
|
virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2006-07-19 08:36:36 +04:00
|
|
|
// Need to implement this here too to avoid hiding.
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult SetText(const nsAString& aStr, bool aNotify)
|
2006-07-19 08:36:36 +04:00
|
|
|
{
|
|
|
|
return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
|
|
|
|
}
|
2014-01-04 19:02:17 +04:00
|
|
|
virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual bool TextIsOnlyWhitespace() override;
|
2017-03-17 00:10:22 +03:00
|
|
|
virtual bool ThreadSafeTextIsOnlyWhitespace() const final;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool HasTextForTranslation() override;
|
|
|
|
virtual void AppendTextTo(nsAString& aResult) override;
|
2016-04-27 07:16:50 +03:00
|
|
|
MOZ_MUST_USE
|
2014-03-19 21:05:02 +04:00
|
|
|
virtual bool AppendTextTo(nsAString& aResult,
|
2015-03-19 10:46:40 +03:00
|
|
|
const mozilla::fallible_t&) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SaveSubtreeState() override;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2001-10-16 09:31:36 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03: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 09:31:36 +04:00
|
|
|
#endif
|
2006-03-07 20:08:51 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIContent *GetBindingParent() const override;
|
|
|
|
virtual nsXBLBinding *GetXBLBinding() const override;
|
2013-07-17 20:05:03 +04:00
|
|
|
virtual void SetXBLBinding(nsXBLBinding* aBinding,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsBindingManager* aOldBindingManager = nullptr) override;
|
|
|
|
virtual mozilla::dom::ShadowRoot *GetContainingShadow() 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;
|
|
|
|
|
|
|
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
2005-11-02 03:41:51 +03:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aModType) const;
|
2005-11-02 03:41:51 +03:00
|
|
|
|
2017-04-20 22:57:48 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
|
|
|
|
bool aPreallocateChildren) const override
|
2006-09-05 14:22:54 +04:00
|
|
|
{
|
2016-07-21 01:18:59 +03:00
|
|
|
nsCOMPtr<nsINode> result = CloneDataNode(aNodeInfo, true);
|
|
|
|
result.forget(aResult);
|
|
|
|
|
2006-09-05 14:22:54 +04:00
|
|
|
if (!*aResult) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-09-11 21:15:08 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SplitData(uint32_t aOffset, nsIContent** aReturn,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aCloneAfterOriginal = true);
|
2008-07-25 14:37:37 +04:00
|
|
|
|
2013-01-04 21:02:14 +04:00
|
|
|
// WebIDL API
|
|
|
|
// Our XPCOM GetData is just fine for WebIDL
|
2013-07-17 18:09:04 +04:00
|
|
|
virtual void SetData(const nsAString& aData, mozilla::ErrorResult& rv)
|
2013-01-04 21:02:14 +04: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 04:16:36 +04:00
|
|
|
//----------------------------------------
|
|
|
|
|
2001-12-16 09:59:31 +03:00
|
|
|
#ifdef DEBUG
|
2012-08-22 19:56:38 +04:00
|
|
|
void ToCString(nsAString& aBuf, int32_t aOffset, int32_t aLen) const;
|
2001-12-16 09:59:31 +03:00
|
|
|
#endif
|
|
|
|
|
2012-01-31 00:08:13 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsGenericDOMDataNode)
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2006-07-02 11:23:10 +04:00
|
|
|
protected:
|
2014-06-25 06:09:15 +04:00
|
|
|
virtual ~nsGenericDOMDataNode();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::dom::Element* GetNameSpaceElement() override
|
2010-04-19 19:40:16 +04:00
|
|
|
{
|
2012-10-09 16:31:24 +04:00
|
|
|
nsINode *parent = GetParentNode();
|
2010-04-19 19:40:16 +04:00
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
return parent && parent->IsElement() ? parent->AsElement() : nullptr;
|
2010-04-19 19:40:16 +04:00
|
|
|
}
|
|
|
|
|
2006-05-17 20:14:33 +04: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 14:26:11 +04:00
|
|
|
nsDataSlots();
|
2006-05-17 20:14:33 +04:00
|
|
|
|
2013-07-17 20:05:06 +04:00
|
|
|
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
|
|
|
void Unlink();
|
|
|
|
|
2006-05-17 20:14:33 +04:00
|
|
|
/**
|
|
|
|
* The nearest enclosing content node with a binding that created us.
|
|
|
|
* @see nsIContent::GetBindingParent
|
|
|
|
*/
|
|
|
|
nsIContent* mBindingParent; // [Weak]
|
2013-07-17 20:05:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see nsIContent::GetXBLInsertionParent
|
|
|
|
*/
|
|
|
|
nsCOMPtr<nsIContent> mXBLInsertionParent;
|
2013-12-02 14:26:11 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see nsIContent::GetContainingShadow
|
|
|
|
*/
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::ShadowRoot> mContainingShadow;
|
2014-05-22 10:11:53 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see nsIContent::GetDestInsertionPoints
|
|
|
|
*/
|
|
|
|
nsTArray<nsIContent*> mDestInsertionPoints;
|
2006-05-17 20:14:33 +04:00
|
|
|
};
|
|
|
|
|
2006-07-02 11:23:10 +04:00
|
|
|
// Override from nsINode
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsINode::nsSlots* CreateSlots() override;
|
2006-07-02 11:23:10 +04:00
|
|
|
|
2012-08-11 02:27:28 +04:00
|
|
|
nsDataSlots* DataSlots()
|
2006-05-17 20:14:33 +04:00
|
|
|
{
|
2012-08-11 02:27:28 +04:00
|
|
|
return static_cast<nsDataSlots*>(Slots());
|
2006-05-17 20:14:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsDataSlots *GetExistingDataSlots() const
|
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsDataSlots*>(GetExistingSlots());
|
2006-05-17 20:14:33 +04:00
|
|
|
}
|
2006-07-02 11:23:10 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SplitText(uint32_t aOffset, nsIDOMText** aReturn);
|
2004-05-08 00:55:17 +04:00
|
|
|
|
2011-05-21 09:21:28 +04:00
|
|
|
nsresult GetWholeText(nsAString& aWholeText);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t FirstLogicallyAdjacentTextNode(nsIContent* aParent,
|
|
|
|
int32_t aIndex);
|
2008-06-04 21:53:34 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t LastLogicallyAdjacentTextNode(nsIContent* aParent,
|
|
|
|
int32_t aIndex,
|
|
|
|
uint32_t aCount);
|
2008-06-04 21:53:34 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetTextInternal(uint32_t aOffset, uint32_t aCount,
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t* aBuffer, uint32_t aLength,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aNotify,
|
2012-07-30 18:20:58 +04:00
|
|
|
CharacterDataChangeInfo::Details* aDetails = nullptr);
|
2006-10-28 05:22:53 +04:00
|
|
|
|
2005-09-11 21:15:08 +04: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 06:01:40 +04:00
|
|
|
virtual nsGenericDOMDataNode *CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aCloneText) const = 0;
|
2005-09-11 21:15:08 +04:00
|
|
|
|
2001-12-16 09:59:31 +03:00
|
|
|
nsTextFragment mText;
|
|
|
|
|
2012-01-31 00:08:13 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool OwnedOnlyByTheDOMTree() override
|
2012-06-28 02:09:15 +04:00
|
|
|
{
|
|
|
|
return GetParent() && mRefCnt.get() == 1;
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsPurple() override
|
2012-01-31 00:08:13 +04:00
|
|
|
{
|
|
|
|
return mRefCnt.IsPurple();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RemovePurple() override
|
2012-01-31 00:08:13 +04:00
|
|
|
{
|
|
|
|
mRefCnt.RemovePurple();
|
|
|
|
}
|
2016-07-22 06:10:23 +03:00
|
|
|
|
2001-12-16 09:59:31 +03:00
|
|
|
private:
|
2004-02-25 02:10:38 +03:00
|
|
|
already_AddRefed<nsIAtom> GetCurrentValueAtom();
|
1998-09-06 04:16:36 +04:00
|
|
|
};
|
|
|
|
|
1998-09-06 08:16:22 +04:00
|
|
|
#endif /* nsGenericDOMDataNode_h___ */
|