Contents of composited overflow-scroll are missing when newly added
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Nov 2017 01:07:44 +0000 (01:07 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Nov 2017 01:07:44 +0000 (01:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179556
rdar://problem/20368294

Reviewed by Tim Horton.

Source/WebCore:

When content is appended to an oveflow:scroll, we do a subtree layout. That triggered
a compositing code path that failed to call updateAfterDescendants() which is where
we compute whether we can be a simple composited layer without backing store. Fix to
call that after the updateGeometry() call, as we do elsewhere.

Test: compositing/backing/overflow-gains-content.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterLayout):

LayoutTests:

* compositing/backing/overflow-gains-content-expected.html: Added.
* compositing/backing/overflow-gains-content.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224715 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/backing/overflow-gains-content-expected.html [new file with mode: 0644]
LayoutTests/compositing/backing/overflow-gains-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp

index b5f1e20..135517a 100644 (file)
@@ -1,3 +1,14 @@
+2017-11-10  Simon Fraser  <simon.fraser@apple.com>
+
+        Contents of composited overflow-scroll are missing when newly added
+        https://bugs.webkit.org/show_bug.cgi?id=179556
+        rdar://problem/20368294
+
+        Reviewed by Tim Horton.
+
+        * compositing/backing/overflow-gains-content-expected.html: Added.
+        * compositing/backing/overflow-gains-content.html: Added.
+
 2017-11-10  Chris Dumez  <cdumez@apple.com>
 
         [Service Workers] Implement better support for "Clear Registration" algorithm
diff --git a/LayoutTests/compositing/backing/overflow-gains-content-expected.html b/LayoutTests/compositing/backing/overflow-gains-content-expected.html
new file mode 100644 (file)
index 0000000..fcb543d
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #container {
+            width: 400px;
+            height: 500px;
+            overflow: scroll;
+            will-change: transform;
+        }
+        
+        #container > div {
+            background-color: green;
+            height: 100%;
+            width: 100%;
+        }
+    </style>
+</head>
+<body>
+    <div id="container">
+        <div></div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/compositing/backing/overflow-gains-content.html b/LayoutTests/compositing/backing/overflow-gains-content.html
new file mode 100644 (file)
index 0000000..5700bf0
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #container {
+            width: 400px;
+            height: 500px;
+            overflow: scroll;
+            will-change: transform;
+        }
+        
+        #container > div {
+            background-color: green;
+            height: 100%;
+            width: 100%;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+        function appendContent()
+        {
+            var container = document.getElementById('container');
+            container.appendChild(document.createElement('div'));
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+
+        function doTest()
+        {
+            window.setTimeout(appendContent, 0);
+        }
+        
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div id="container"></div>
+</body>
+</html>
index 28254ba..5aab599 100644 (file)
@@ -1,5 +1,23 @@
 2017-11-10  Simon Fraser  <simon.fraser@apple.com>
 
+        Contents of composited overflow-scroll are missing when newly added
+        https://bugs.webkit.org/show_bug.cgi?id=179556
+        rdar://problem/20368294
+
+        Reviewed by Tim Horton.
+
+        When content is appended to an oveflow:scroll, we do a subtree layout. That triggered
+        a compositing code path that failed to call updateAfterDescendants() which is where
+        we compute whether we can be a simple composited layer without backing store. Fix to
+        call that after the updateGeometry() call, as we do elsewhere.
+
+        Test: compositing/backing/overflow-gains-content.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateAfterLayout):
+
+2017-11-10  Simon Fraser  <simon.fraser@apple.com>
+
         Remove the 'CompositingChildrenOnly' flag which was always on
         https://bugs.webkit.org/show_bug.cgi?id=179546
 
index 834e072..62f1869 100644 (file)
@@ -646,6 +646,7 @@ void RenderLayerBacking::updateAfterLayout(OptionSet<UpdateAfterLayoutFlags> fla
         
         if (flags.contains(UpdateAfterLayoutFlags::IsUpdateRoot)) {
             updateGeometry();
+            updateAfterDescendants();
             compositor().updateRootLayerPosition();
             auto* stackingContainer = m_owningLayer.enclosingStackingContainer();
             if (!compositor().compositingLayersNeedRebuild() && stackingContainer && (stackingContainer != &m_owningLayer))