Title: [172534] trunk
Revision
172534
Author
simon.fra...@apple.com
Date
2014-08-13 13:21:31 -0700 (Wed, 13 Aug 2014)

Log Message

[WK1] A fixed-position <img> may not show on page load
https://bugs.webkit.org/show_bug.cgi?id=135893

Reviewed by Tim Horton.

Source/WebCore:

A position:fixed image could fail to display because we didn't make a
compositing layer for it under some circumstances. This can happen if
RenderLayerCompositor::requiresCompositingForPosition() runs before the
image is loaded, in which cause the layer is zero-sized, so does not get
composited.

When the image loads, there was no code path that ensured that compositing
would be re-evaluated (unlike size changes due to style updates). Fix by
having RenderLayer::contentChanged() also check for ImageChanged.

Test: compositing/fixed-image-loading.html

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

LayoutTests:

Test with a position:fixed image. Note that the test has to force layout
early on to test the bug.

* compositing/fixed-image-loading-expected.txt: Added.
* compositing/fixed-image-loading.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (172533 => 172534)


--- trunk/LayoutTests/ChangeLog	2014-08-13 20:14:47 UTC (rev 172533)
+++ trunk/LayoutTests/ChangeLog	2014-08-13 20:21:31 UTC (rev 172534)
@@ -1,3 +1,16 @@
+2014-08-13  Simon Fraser  <simon.fra...@apple.com>
+
+        [WK1] A fixed-position <img> may not show on page load
+        https://bugs.webkit.org/show_bug.cgi?id=135893
+
+        Reviewed by Tim Horton.
+        
+        Test with a position:fixed image. Note that the test has to force layout
+        early on to test the bug.
+
+        * compositing/fixed-image-loading-expected.txt: Added.
+        * compositing/fixed-image-loading.html: Added.
+
 2014-08-13  Zoltan Horvath  <zol...@webkit.org>
 
         [CSS3-Text] Add rendering support for the none value of text-justify property

Added: trunk/LayoutTests/compositing/fixed-image-loading-expected.txt (0 => 172534)


--- trunk/LayoutTests/compositing/fixed-image-loading-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-image-loading-expected.txt	2014-08-13 20:21:31 UTC (rev 172534)
@@ -0,0 +1,18 @@
+
+(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 8.00 13.00)
+          (bounds 214.00 232.00)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/fixed-image-loading.html (0 => 172534)


--- trunk/LayoutTests/compositing/fixed-image-loading.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-image-loading.html	2014-08-13 20:21:31 UTC (rev 172534)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function imageLoaded()
+        {
+            if (window.internals)
+                document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+    </script>
+</head>
+<body>
+<img id="image" src="" _onload_="imageLoaded()" style="position: fixed;"></img>
+<pre id="layers"></pre>
+<script>
+document.body.offsetWidth; // Force layout before the image loads.
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (172533 => 172534)


--- trunk/Source/WebCore/ChangeLog	2014-08-13 20:14:47 UTC (rev 172533)
+++ trunk/Source/WebCore/ChangeLog	2014-08-13 20:21:31 UTC (rev 172534)
@@ -1,3 +1,25 @@
+2014-08-13  Simon Fraser  <simon.fra...@apple.com>
+
+        [WK1] A fixed-position <img> may not show on page load
+        https://bugs.webkit.org/show_bug.cgi?id=135893
+
+        Reviewed by Tim Horton.
+        
+        A position:fixed image could fail to display because we didn't make a
+        compositing layer for it under some circumstances. This can happen if
+        RenderLayerCompositor::requiresCompositingForPosition() runs before the
+        image is loaded, in which cause the layer is zero-sized, so does not get
+        composited.
+        
+        When the image loads, there was no code path that ensured that compositing
+        would be re-evaluated (unlike size changes due to style updates). Fix by
+        having RenderLayer::contentChanged() also check for ImageChanged.
+
+        Test: compositing/fixed-image-loading.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::contentChanged):
+
 2014-08-13  Bem Jones-Bey  <bjone...@adobe.com>
 
         Refactor ShapeOutsideInfo so it isn't mutated for each line

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (172533 => 172534)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-08-13 20:14:47 UTC (rev 172533)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-08-13 20:21:31 UTC (rev 172534)
@@ -298,8 +298,7 @@
 
 void RenderLayer::contentChanged(ContentChangeType changeType)
 {
-    // This can get called when video becomes accelerated, so the layers may change.
-    if ((changeType == CanvasChanged || changeType == VideoChanged || changeType == FullScreenChanged) && compositor().updateLayerCompositingState(*this))
+    if ((changeType == CanvasChanged || changeType == VideoChanged || changeType == FullScreenChanged || changeType == ImageChanged) && compositor().updateLayerCompositingState(*this))
         compositor().setCompositingLayersNeedRebuild();
 
     if (m_backing)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to