Title: [237123] trunk/Source/WebCore
Revision
237123
Author
simon.fra...@apple.com
Date
2018-10-15 10:25:47 -0700 (Mon, 15 Oct 2018)

Log Message

Share some code to dirty z-order and normal flow lists when child layers are added or removed
https://bugs.webkit.org/show_bug.cgi?id=190585

Reviewed by Zalan Bujtas.

Factor code which dirties the normal flow list and child stacking context z-order lists
when a layer is added or removed.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::addChild):
(WebCore::RenderLayer::removeChild):
(WebCore::RenderLayer::dirtyPaintOrderListsOnChildChange):
* rendering/RenderLayer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237122 => 237123)


--- trunk/Source/WebCore/ChangeLog	2018-10-15 17:25:45 UTC (rev 237122)
+++ trunk/Source/WebCore/ChangeLog	2018-10-15 17:25:47 UTC (rev 237123)
@@ -1,5 +1,21 @@
 2018-10-15  Simon Fraser  <simon.fra...@apple.com>
 
+        Share some code to dirty z-order and normal flow lists when child layers are added or removed
+        https://bugs.webkit.org/show_bug.cgi?id=190585
+
+        Reviewed by Zalan Bujtas.
+
+        Factor code which dirties the normal flow list and child stacking context z-order lists
+        when a layer is added or removed.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::addChild):
+        (WebCore::RenderLayer::removeChild):
+        (WebCore::RenderLayer::dirtyPaintOrderListsOnChildChange):
+        * rendering/RenderLayer.h:
+
+2018-10-15  Simon Fraser  <simon.fra...@apple.com>
+
         Make a helper function to check for reflection layers
         https://bugs.webkit.org/show_bug.cgi?id=190584
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (237122 => 237123)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-10-15 17:25:45 UTC (rev 237122)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-10-15 17:25:47 UTC (rev 237123)
@@ -394,16 +394,8 @@
 
     child.setParent(this);
 
-    if (child.isNormalFlowOnly())
-        dirtyNormalFlowList();
+    dirtyPaintOrderListsOnChildChange(child);
 
-    if (!child.isNormalFlowOnly() || child.firstChild()) {
-        // Dirty the z-order list in which we are contained. The stackingContext() can be null in the
-        // case where we're building up generated content layers. This is ok, since the lists will start
-        // off dirty in that case anyway.
-        child.dirtyStackingContextZOrderLists();
-    }
-
     child.updateDescendantDependentFlags();
     if (child.m_hasVisibleContent || child.m_hasVisibleDescendant)
         setAncestorChainHasVisibleDescendant();
@@ -413,7 +405,7 @@
 
 #if ENABLE(CSS_COMPOSITING)
     if (child.hasBlendMode() || (child.hasNotIsolatedBlendingDescendants() && !child.isolatesBlending()))
-        updateAncestorChainHasBlendingDescendants();
+        updateAncestorChainHasBlendingDescendants(); // Why not just dirty?
 #endif
 
     compositor().layerWasAdded(*this, child);
@@ -435,14 +427,7 @@
     if (m_last == &oldChild)
         m_last = oldChild.previousSibling();
 
-    if (oldChild.isNormalFlowOnly())
-        dirtyNormalFlowList();
-    if (!oldChild.isNormalFlowOnly() || oldChild.firstChild()) {
-        // Dirty the z-order list in which we are contained. When called via the
-        // reattachment process in removeOnlyThisLayer, the layer may already be disconnected
-        // from the main layer tree, so we need to null-check the |stackingContext| value.
-        oldChild.dirtyStackingContextZOrderLists();
-    }
+    dirtyPaintOrderListsOnChildChange(oldChild);
 
     oldChild.setPreviousSibling(nullptr);
     oldChild.setNextSibling(nullptr);
@@ -461,6 +446,19 @@
 #endif
 }
 
+void RenderLayer::dirtyPaintOrderListsOnChildChange(RenderLayer& child)
+{
+    if (child.isNormalFlowOnly())
+        dirtyNormalFlowList();
+
+    if (!child.isNormalFlowOnly() || child.firstChild()) {
+        // Dirty the z-order list in which we are contained. The stackingContext() can be null in the
+        // case where we're building up generated content layers. This is ok, since the lists will start
+        // off dirty in that case anyway.
+        child.dirtyStackingContextZOrderLists();
+    }
+}
+
 void RenderLayer::insertOnlyThisLayer()
 {
     if (!m_parent && renderer().parent()) {

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (237122 => 237123)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2018-10-15 17:25:45 UTC (rev 237122)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2018-10-15 17:25:47 UTC (rev 237123)
@@ -745,6 +745,8 @@
     void setParent(RenderLayer*);
     void setFirstChild(RenderLayer* first) { m_first = first; }
     void setLastChild(RenderLayer* last) { m_last = last; }
+    
+    void dirtyPaintOrderListsOnChildChange(RenderLayer&);
 
     bool shouldBeNormalFlowOnly() const;
     bool shouldBeStackingContext() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to