Title: [116927] trunk/Source/WebCore
Revision
116927
Author
[email protected]
Date
2012-05-14 00:49:59 -0700 (Mon, 14 May 2012)

Log Message

Should have Node::inDetach() for assertion purposes.
https://bugs.webkit.org/show_bug.cgi?id=86157

Reviewed by Darin Adler.

Implemented Node::inDetach() and added an assertio in Document::setFocusedNode().
This is a follow up of r116644 which removes inDetach() checking.

No new tests. Just adding an asssertion.

* dom/Document.cpp:
(WebCore::Document::setFocusedNode):
* dom/Node.cpp:
(WebCore):
(WebCore::Node::inDetach):
(WebCore::Node::detach):
* dom/Node.h:
(Node):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116926 => 116927)


--- trunk/Source/WebCore/ChangeLog	2012-05-14 07:26:14 UTC (rev 116926)
+++ trunk/Source/WebCore/ChangeLog	2012-05-14 07:49:59 UTC (rev 116927)
@@ -1,3 +1,24 @@
+2012-05-14  MORITA Hajime  <[email protected]>
+
+        Should have Node::inDetach() for assertion purposes.
+        https://bugs.webkit.org/show_bug.cgi?id=86157
+
+        Reviewed by Darin Adler.
+
+        Implemented Node::inDetach() and added an assertio in Document::setFocusedNode().
+        This is a follow up of r116644 which removes inDetach() checking.
+
+        No new tests. Just adding an asssertion.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFocusedNode):
+        * dom/Node.cpp:
+        (WebCore):
+        (WebCore::Node::inDetach):
+        (WebCore::Node::detach):
+        * dom/Node.h:
+        (Node):
+
 2012-05-13  Noel Gordon  <[email protected]>
 
         [chromium] Remove platform/image-decoders/xbm from WebCore.gyp

Modified: trunk/Source/WebCore/dom/Document.cpp (116926 => 116927)


--- trunk/Source/WebCore/dom/Document.cpp	2012-05-14 07:26:14 UTC (rev 116926)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-05-14 07:49:59 UTC (rev 116927)
@@ -3655,6 +3655,8 @@
 
     // Remove focus from the existing focus node (if any)
     if (oldFocusedNode) {
+        ASSERT(!oldFocusedNode->inDetach());
+
         if (oldFocusedNode->active())
             oldFocusedNode->setActive(false);
 

Modified: trunk/Source/WebCore/dom/Node.cpp (116926 => 116927)


--- trunk/Source/WebCore/dom/Node.cpp	2012-05-14 07:26:14 UTC (rev 116926)
+++ trunk/Source/WebCore/dom/Node.cpp	2012-05-14 07:49:59 UTC (rev 116927)
@@ -1339,8 +1339,22 @@
     clearNeedsStyleRecalc();
 }
 
+#ifndef NDEBUG
+static Node* detachingNode;
+
+bool Node::inDetach() const
+{
+    return detachingNode == this;
+}
+#endif
+
 void Node::detach()
 {
+#ifndef NDEBUG
+    ASSERT(!detachingNode);
+    detachingNode = this;
+#endif
+
     if (renderer())
         renderer()->destroyAndCleanupAnonymousWrappers();
     setRenderer(0);
@@ -1355,6 +1369,10 @@
     clearFlag(IsHoveredFlag);
     clearFlag(InActiveChainFlag);
     clearFlag(IsAttachedFlag);
+
+#ifndef NDEBUG
+    detachingNode = 0;
+#endif
 }
 
 // FIXME: This code is used by editing.  Seems like it could move over there and not pollute Node.

Modified: trunk/Source/WebCore/dom/Node.h (116926 => 116927)


--- trunk/Source/WebCore/dom/Node.h	2012-05-14 07:26:14 UTC (rev 116926)
+++ trunk/Source/WebCore/dom/Node.h	2012-05-14 07:49:59 UTC (rev 116927)
@@ -496,6 +496,10 @@
     // the node's rendering object from the rendering tree and delete it.
     virtual void detach();
 
+#ifndef NDEBUG
+    bool inDetach() const;
+#endif
+
     void reattach();
     void reattachIfAttached();
     void createRendererIfNeeded();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to