Title: [238269] trunk
Revision
238269
Author
[email protected]
Date
2018-11-15 21:29:45 -0800 (Thu, 15 Nov 2018)

Log Message

REGRESSION (r238090) Composited iframes that resize from zero don't show
https://bugs.webkit.org/show_bug.cgi?id=191733
rdar://problem/46107764

Reviewed by Zalan Bujtas.
Source/WebCore:

A zero-sized iframe whose contents are composited should not trigger compositing in the
parent document (see code in requiresCompositingForFrame()), but when the <iframe> element
was resized without a style change (e.g. because it's width: 100%, height: 100% and the
parent resizes), there was no code that triggered a compositing update.

Fix by having RenderLayer::updateLayerPosition() trigger an update when the size changes,
for a RenderWidget whose contents are composited.

Test: compositing/iframes/resize-from-zero-size.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPosition):

LayoutTests:

* compositing/iframes/resize-from-zero-size-expected.txt: Added.
* compositing/iframes/resize-from-zero-size.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238268 => 238269)


--- trunk/LayoutTests/ChangeLog	2018-11-16 05:23:00 UTC (rev 238268)
+++ trunk/LayoutTests/ChangeLog	2018-11-16 05:29:45 UTC (rev 238269)
@@ -1,5 +1,16 @@
 2018-11-15  Simon Fraser  <[email protected]>
 
+        REGRESSION (r238090) Composited iframes that resize from zero don't show
+        https://bugs.webkit.org/show_bug.cgi?id=191733
+        rdar://problem/46107764
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/iframes/resize-from-zero-size-expected.txt: Added.
+        * compositing/iframes/resize-from-zero-size.html: Added.
+
+2018-11-15  Simon Fraser  <[email protected]>
+
         Overlay with -webkit-overflow-scrolling:touch doesn't become scrollable after added text makes it taller
         https://bugs.webkit.org/show_bug.cgi?id=158342
         rdar://problem/26652811

Added: trunk/LayoutTests/compositing/iframes/resize-from-zero-size-expected.txt (0 => 238269)


--- trunk/LayoutTests/compositing/iframes/resize-from-zero-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/iframes/resize-from-zero-size-expected.txt	2018-11-16 05:29:45 UTC (rev 238269)
@@ -0,0 +1,53 @@
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 18.00 18.00)
+          (bounds 400.00 300.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 400.00 300.00)
+                  (children 1
+                    (GraphicsLayer
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 300.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 300.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 18.00 10.00)
+                                  (bounds 210.00 210.00)
+                                  (contentsOpaque 1)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/iframes/resize-from-zero-size.html (0 => 238269)


--- trunk/LayoutTests/compositing/iframes/resize-from-zero-size.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/iframes/resize-from-zero-size.html	2018-11-16 05:29:45 UTC (rev 238269)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #wrapper {
+            width: 0px;
+            height: 0px;
+            border: 10px solid gray;
+        }
+        iframe {
+            height: 100%;
+            width: 100%;
+            background-color: red;
+            border: none;
+        }
+
+        #wrapper.resized {
+            height: 300px;
+            width: 400px;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        window.addEventListener('load', () => {
+            setTimeout(() => {
+                document.getElementById('wrapper').classList.add('resized');
+                if (window.testRunner) {
+                     document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
+                     testRunner.notifyDone();
+                }
+            }, 0);
+        }, false);
+    </script>
+</head>
+<body>
+
+<div id="wrapper">
+    <iframe class="composited" src=""    
+</div>
+<pre id="layers"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (238268 => 238269)


--- trunk/Source/WebCore/ChangeLog	2018-11-16 05:23:00 UTC (rev 238268)
+++ trunk/Source/WebCore/ChangeLog	2018-11-16 05:29:45 UTC (rev 238269)
@@ -1,5 +1,26 @@
 2018-11-15  Simon Fraser  <[email protected]>
 
+        REGRESSION (r238090) Composited iframes that resize from zero don't show
+        https://bugs.webkit.org/show_bug.cgi?id=191733
+        rdar://problem/46107764
+
+        Reviewed by Zalan Bujtas.
+        
+        A zero-sized iframe whose contents are composited should not trigger compositing in the
+        parent document (see code in requiresCompositingForFrame()), but when the <iframe> element
+        was resized without a style change (e.g. because it's width: 100%, height: 100% and the
+        parent resizes), there was no code that triggered a compositing update.
+
+        Fix by having RenderLayer::updateLayerPosition() trigger an update when the size changes,
+        for a RenderWidget whose contents are composited.
+
+        Test: compositing/iframes/resize-from-zero-size.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPosition):
+
+2018-11-15  Simon Fraser  <[email protected]>
+
         Overlay with -webkit-overflow-scrolling:touch doesn't become scrollable after added text makes it taller
         https://bugs.webkit.org/show_bug.cgi?id=158342
         rdar://problem/26652811

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (238268 => 238269)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-11-16 05:23:00 UTC (rev 238268)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-11-16 05:29:45 UTC (rev 238269)
@@ -1515,7 +1515,15 @@
         localPoint += inlineBoundingBoxOffset;
     } else if (RenderBox* box = renderBox()) {
         // FIXME: Is snapping the size really needed here for the RenderBox case?
-        setSize(snappedIntRect(box->frameRect()).size());
+        auto newSize = snappedIntRect(box->frameRect()).size();
+        if (newSize != size()) {
+            if (is<RenderWidget>(*box) && downcast<RenderWidget>(*box).requiresAcceleratedCompositing()) {
+                // Trigger RenderLayerCompositor::requiresCompositingForFrame() which depends on the contentBoxRect size.
+                setNeedsPostLayoutCompositingUpdate();
+            }
+            setSize(newSize);
+        }
+        
         box->applyTopLeftLocationOffset(localPoint);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to