Title: [110207] trunk/Source/WebCore
Revision
110207
Author
[email protected]
Date
2012-03-08 14:47:44 -0800 (Thu, 08 Mar 2012)

Log Message

Remove InDocumentFlag manipulation methods from Node interface
https://bugs.webkit.org/show_bug.cgi?id=80612

Reviewed by Ryosuke Niwa.

This is a first step towards tightening up Node::inDocument() to match
the actual in-document-tree state (see r108152 for the sort of bug
resulting from those not matching).

No new tests, refactoring only.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removedFromDocument): Remove duplicate call to clearInDocument:
the call to Node::removedFromDocument three lines above will clear the flag.
* dom/Document.cpp:
(WebCore::Document::Document): Call ContainerNode constructor with InDocumentFlag always set
instead of calling setInDocument.
* dom/Node.cpp:
(WebCore::Node::insertedIntoDocument): Inline setInDocument (now the only caller).
(WebCore::Node::removedFromDocument): Inline clearInDocument (now the only caller).
* dom/Node.h: Remove setInDocument & clearInDocument, add new CreateDocument ConstructionType.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110206 => 110207)


--- trunk/Source/WebCore/ChangeLog	2012-03-08 22:29:09 UTC (rev 110206)
+++ trunk/Source/WebCore/ChangeLog	2012-03-08 22:47:44 UTC (rev 110207)
@@ -1,3 +1,27 @@
+2012-03-08  Adam Klein  <[email protected]>
+
+        Remove InDocumentFlag manipulation methods from Node interface
+        https://bugs.webkit.org/show_bug.cgi?id=80612
+
+        Reviewed by Ryosuke Niwa.
+
+        This is a first step towards tightening up Node::inDocument() to match
+        the actual in-document-tree state (see r108152 for the sort of bug
+        resulting from those not matching).
+
+        No new tests, refactoring only.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removedFromDocument): Remove duplicate call to clearInDocument:
+        the call to Node::removedFromDocument three lines above will clear the flag.
+        * dom/Document.cpp:
+        (WebCore::Document::Document): Call ContainerNode constructor with InDocumentFlag always set
+        instead of calling setInDocument.
+        * dom/Node.cpp:
+        (WebCore::Node::insertedIntoDocument): Inline setInDocument (now the only caller).
+        (WebCore::Node::removedFromDocument): Inline clearInDocument (now the only caller).
+        * dom/Node.h: Remove setInDocument & clearInDocument, add new CreateDocument ConstructionType.
+
 2012-03-08  Tor Arne Vestbø  <[email protected]>
 
         [Qt] Try to fix the Snow Leopard build

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (110206 => 110207)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2012-03-08 22:29:09 UTC (rev 110206)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2012-03-08 22:47:44 UTC (rev 110207)
@@ -804,7 +804,6 @@
     Node::removedFromDocument();
     if (document()->cssTarget() == this) 
         document()->setCSSTarget(0); 
-    clearInDocument();
     removedFromTree(false);
 
     NodeVector children;

Modified: trunk/Source/WebCore/dom/Document.cpp (110206 => 110207)


--- trunk/Source/WebCore/dom/Document.cpp	2012-03-08 22:29:09 UTC (rev 110206)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-03-08 22:47:44 UTC (rev 110207)
@@ -380,7 +380,7 @@
 uint64_t Document::s_globalTreeVersion = 0;
 
 Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
-    : ContainerNode(0)
+    : ContainerNode(0, CreateDocument)
     , TreeScope(this)
     , m_guardRefCount(0)
     , m_compatibilityMode(NoQuirksMode)
@@ -471,7 +471,6 @@
 
     m_textColor = Color::black;
     m_listenerTypes = 0;
-    setInDocument();
     m_inStyleRecalc = false;
     m_closeAfterStyleRecalc = false;
 

Modified: trunk/Source/WebCore/dom/Node.cpp (110206 => 110207)


--- trunk/Source/WebCore/dom/Node.cpp	2012-03-08 22:29:09 UTC (rev 110206)
+++ trunk/Source/WebCore/dom/Node.cpp	2012-03-08 22:47:44 UTC (rev 110207)
@@ -2441,12 +2441,12 @@
 
 void Node::insertedIntoDocument()
 {
-    setInDocument();
+    setFlag(InDocumentFlag);
 }
 
 void Node::removedFromDocument()
 {
-    clearInDocument();
+    clearFlag(InDocumentFlag);
 }
 
 void Node::didMoveToNewDocument(Document* oldDocument)

Modified: trunk/Source/WebCore/dom/Node.h (110206 => 110207)


--- trunk/Source/WebCore/dom/Node.h	2012-03-08 22:29:09 UTC (rev 110206)
+++ trunk/Source/WebCore/dom/Node.h	2012-03-08 22:47:44 UTC (rev 110207)
@@ -314,8 +314,6 @@
     void setHasName(bool f) { setFlag(f, HasNameFlag); }
     void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
     void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); }
-    void setInDocument() { setFlag(InDocumentFlag); }
-    void clearInDocument() { clearFlag(InDocumentFlag); }
 
     void setInActiveChain() { setFlag(InActiveChainFlag); }
     void clearInActiveChain() { clearFlag(InActiveChainFlag); }
@@ -693,7 +691,8 @@
         CreateShadowRoot = CreateContainer | IsShadowRootFlag,
         CreateStyledElement = CreateElement | IsStyledElementFlag, 
         CreateHTMLElement = CreateStyledElement | IsHTMLFlag, 
-        CreateSVGElement = CreateStyledElement | IsSVGFlag
+        CreateSVGElement = CreateStyledElement | IsSVGFlag,
+        CreateDocument = CreateContainer | InDocumentFlag
     };
     Node(Document*, ConstructionType);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to