Title: [160942] trunk/Source/WebCore
Revision
160942
Author
ander...@apple.com
Date
2013-12-20 16:12:39 -0800 (Fri, 20 Dec 2013)

Log Message

PostAttachCallbackDisabler should take a Document
https://bugs.webkit.org/show_bug.cgi?id=126090

Reviewed by Andreas Kling.

suspendPostAttachCallbacks and resumePostAttachCallbacks always only get the document from the
container node, so make them static member functions that take a Document&. Also, move PostAttachCallbackDisabler
to Element.h in preparation for moving post attach callback handling to Element.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::suspendPostAttachCallbacks):
(WebCore::ContainerNode::resumePostAttachCallbacks):
* dom/ContainerNode.h:
* dom/Element.h:
(WebCore::PostAttachCallbackDisabler::PostAttachCallbackDisabler):
(WebCore::PostAttachCallbackDisabler::~PostAttachCallbackDisabler):
* style/StyleResolveTree.cpp:
(WebCore::Style::attachRenderTree):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160941 => 160942)


--- trunk/Source/WebCore/ChangeLog	2013-12-21 00:05:40 UTC (rev 160941)
+++ trunk/Source/WebCore/ChangeLog	2013-12-21 00:12:39 UTC (rev 160942)
@@ -1,5 +1,26 @@
 2013-12-20  Anders Carlsson  <ander...@apple.com>
 
+        PostAttachCallbackDisabler should take a Document
+        https://bugs.webkit.org/show_bug.cgi?id=126090
+
+        Reviewed by Andreas Kling.
+
+        suspendPostAttachCallbacks and resumePostAttachCallbacks always only get the document from the
+        container node, so make them static member functions that take a Document&. Also, move PostAttachCallbackDisabler
+        to Element.h in preparation for moving post attach callback handling to Element.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::suspendPostAttachCallbacks):
+        (WebCore::ContainerNode::resumePostAttachCallbacks):
+        * dom/ContainerNode.h:
+        * dom/Element.h:
+        (WebCore::PostAttachCallbackDisabler::PostAttachCallbackDisabler):
+        (WebCore::PostAttachCallbackDisabler::~PostAttachCallbackDisabler):
+        * style/StyleResolveTree.cpp:
+        (WebCore::Style::attachRenderTree):
+
+2013-12-20  Anders Carlsson  <ander...@apple.com>
+
         Move scheduleSetNeedsStyleRecalc to HTMLFrameOwnerElement
         https://bugs.webkit.org/show_bug.cgi?id=126083
 

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (160941 => 160942)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2013-12-21 00:05:40 UTC (rev 160941)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2013-12-21 00:12:39 UTC (rev 160942)
@@ -763,11 +763,11 @@
     newChild->setNeedsStyleRecalc(ReconstructRenderTree);
 }
 
-void ContainerNode::suspendPostAttachCallbacks()
+void ContainerNode::suspendPostAttachCallbacks(Document& document)
 {
     if (!s_attachDepth) {
         ASSERT(!s_shouldReEnableMemoryCacheCallsAfterAttach);
-        if (Page* page = document().page()) {
+        if (Page* page = document.page()) {
             // FIXME: How can this call be specific to one Page, while the
             // s_attachDepth is a global? Doesn't make sense.
             if (page->areMemoryCacheClientCallsEnabled()) {
@@ -780,16 +780,16 @@
     ++s_attachDepth;
 }
 
-void ContainerNode::resumePostAttachCallbacks()
+void ContainerNode::resumePostAttachCallbacks(Document& document)
 {
     if (s_attachDepth == 1) {
-        Ref<ContainerNode> protect(*this);
+        Ref<Document> protect(document);
 
         if (s_postAttachCallbackQueue)
             dispatchPostAttachCallbacks();
         if (s_shouldReEnableMemoryCacheCallsAfterAttach) {
             s_shouldReEnableMemoryCacheCallsAfterAttach = false;
-            if (Page* page = document().page())
+            if (Page* page = document.page())
                 page->setMemoryCacheClientCallsEnabled(true);
         }
         platformStrategies()->loaderStrategy()->resourceLoadScheduler()->resumePendingRequests();

Modified: trunk/Source/WebCore/dom/ContainerNode.h (160941 => 160942)


--- trunk/Source/WebCore/dom/ContainerNode.h	2013-12-21 00:05:40 UTC (rev 160941)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2013-12-21 00:12:39 UTC (rev 160942)
@@ -158,8 +158,8 @@
     void insertBeforeCommon(Node& nextChild, Node& oldChild);
 
     static void dispatchPostAttachCallbacks();
-    void suspendPostAttachCallbacks();
-    void resumePostAttachCallbacks();
+    static void suspendPostAttachCallbacks(Document&);
+    static void resumePostAttachCallbacks(Document&);
 
     bool getUpperLeftCorner(FloatPoint&) const;
     bool getLowerRightCorner(FloatPoint&) const;
@@ -315,23 +315,6 @@
     ChildNodesLazySnapshot* m_nextSnapshot;
 };
 
-class PostAttachCallbackDisabler {
-public:
-    PostAttachCallbackDisabler(ContainerNode& node)
-        : m_node(node)
-    {
-        m_node.suspendPostAttachCallbacks();
-    }
-
-    ~PostAttachCallbackDisabler()
-    {
-        m_node.resumePostAttachCallbacks();
-    }
-
-private:
-    ContainerNode& m_node;
-};
-
 } // namespace WebCore
 
 #endif // ContainerNode_h

Modified: trunk/Source/WebCore/dom/Element.h (160941 => 160942)


--- trunk/Source/WebCore/dom/Element.h	2013-12-21 00:05:40 UTC (rev 160941)
+++ trunk/Source/WebCore/dom/Element.h	2013-12-21 00:12:39 UTC (rev 160942)
@@ -806,6 +806,23 @@
     return static_cast<UniqueElementData&>(*m_elementData);
 }
 
-} // namespace
+class PostAttachCallbackDisabler {
+public:
+    explicit PostAttachCallbackDisabler(Document& document)
+        : m_document(document)
+    {
+        Element::suspendPostAttachCallbacks(m_document);
+    }
 
+    ~PostAttachCallbackDisabler()
+    {
+        Element::resumePostAttachCallbacks(m_document);
+    }
+
+private:
+    Document& m_document;
+};
+
+} // namespace WebCore
+
 #endif

Modified: trunk/Source/WebCore/style/StyleResolveTree.cpp (160941 => 160942)


--- trunk/Source/WebCore/style/StyleResolveTree.cpp	2013-12-21 00:05:40 UTC (rev 160941)
+++ trunk/Source/WebCore/style/StyleResolveTree.cpp	2013-12-21 00:12:39 UTC (rev 160942)
@@ -515,7 +515,7 @@
 
 static void attachRenderTree(Element& current, PassRefPtr<RenderStyle> resolvedStyle)
 {
-    PostAttachCallbackDisabler callbackDisabler(current);
+    PostAttachCallbackDisabler callbackDisabler(current.document());
     WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
 
     if (current.hasCustomStyleResolveCallbacks())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to