diff options
Diffstat (limited to 'WebCore/dom/Node.h')
-rw-r--r-- | WebCore/dom/Node.h | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index d1f58dc..f10e830 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -25,6 +25,7 @@ #ifndef Node_h #define Node_h +#include "DocPtr.h" #include "EventTarget.h" #include "KURLHash.h" #include "PlatformString.h" @@ -107,6 +108,7 @@ public: enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force }; static StyleChange diff(const RenderStyle*, const RenderStyle*); + Node(Document*, bool isElement = false, bool isContainer = false, bool isText = false); virtual ~Node(); // DOM methods & attributes for Node @@ -314,7 +316,7 @@ public: { ASSERT(this); ASSERT(m_document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument())); - return m_document; + return m_document.get(); } void setDocument(Document*); @@ -671,35 +673,14 @@ public: using TreeShared<Node>::ref; using TreeShared<Node>::deref; - -protected: - // CreateElementZeroRefCount is deprecated and can be removed once we convert all element - // classes to start with a reference count of 1. - enum ConstructionType { CreateContainer, CreateElement, CreateOther, CreateText, CreateElementZeroRefCount }; - Node(Document*, ConstructionType); - - virtual void willMoveToNewOwnerDocument(); - virtual void didMoveToNewOwnerDocument(); - - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { } - void setTabIndexExplicitly(short); - - bool hasRareData() const { return m_hasRareData; } - - NodeRareData* rareData() const; - NodeRareData* ensureRareData(); - + private: - static bool initialRefCount(ConstructionType); - static bool isContainer(ConstructionType); - static bool isElement(ConstructionType); - static bool isText(ConstructionType); - virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } void removeAllEventListenersSlowCase(); +private: virtual NodeRareData* createRareData(); Node* containerChildNode(unsigned index) const; unsigned containerChildNodeCount() const; @@ -717,7 +698,7 @@ private: void appendTextContent(bool convertBRsToNewlines, StringBuilder&) const; - Document* m_document; + DocPtr<Document> m_document; Node* m_previous; Node* m_next; RenderObject* m_renderer; @@ -740,16 +721,22 @@ private: const bool m_isText : 1; protected: - // These bits are used by derived classes, pulled up here so they can + // These bits are used by the Element derived class, pulled up here so they can // be stored in the same memory word as the Node bits above. + bool m_parsingChildrenFinished : 1; +#if ENABLE(SVG) + mutable bool m_areSVGAttributesValid : 1; +#endif - bool m_parsingChildrenFinished : 1; // Element - mutable bool m_isStyleAttributeValid : 1; // StyledElement - mutable bool m_synchronizingStyleAttribute : 1; // StyledElement + // These bits are used by the StyledElement derived class, and live here for the + // same reason as above. + mutable bool m_isStyleAttributeValid : 1; + mutable bool m_synchronizingStyleAttribute : 1; #if ENABLE(SVG) - mutable bool m_areSVGAttributesValid : 1; // Element - mutable bool m_synchronizingSVGAttributes : 1; // SVGElement + // This bit is used by the SVGElement derived class, and lives here for the same + // reason as above. + mutable bool m_synchronizingSVGAttributes : 1; #endif // 11 bits remaining |