Title: [186911] trunk
Revision
186911
Author
[email protected]
Date
2015-07-16 14:54:06 -0700 (Thu, 16 Jul 2015)

Log Message

Fix disappearing position:fixed elements in fixed layout mode
https://bugs.webkit.org/show_bug.cgi?id=147019

Reviewed by Tim Horton.
Source/WebCore:

Test: compositing/fixed-with-fixed-layout.html

When in fixed layout mode, and being scaled down, viewportConstrainedVisibleContentRect() is
the wrong thing to use to determine if position:fixed elements are clipped out. In this case,
use the simpler document bounds (before scaling).

In the long term,  there needs to be an equivalent of viewportConstrainedVisibleContentRect()
that gives an appropriate rect that can be used here.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):

LayoutTests:

Test with four fixed elements in fixed layout mode.

* compositing/fixed-with-fixed-layout-expected.txt: Added.
* compositing/fixed-with-fixed-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (186910 => 186911)


--- trunk/LayoutTests/ChangeLog	2015-07-16 21:51:08 UTC (rev 186910)
+++ trunk/LayoutTests/ChangeLog	2015-07-16 21:54:06 UTC (rev 186911)
@@ -1,3 +1,15 @@
+2015-07-16  Simon Fraser  <[email protected]>
+
+        Fix disappearing position:fixed elements in fixed layout mode
+        https://bugs.webkit.org/show_bug.cgi?id=147019
+
+        Reviewed by Tim Horton.
+        
+        Test with four fixed elements in fixed layout mode.
+
+        * compositing/fixed-with-fixed-layout-expected.txt: Added.
+        * compositing/fixed-with-fixed-layout.html: Added.
+
 2015-07-16  Filip Pizlo  <[email protected]>
 
         Unreviewed, roll out http://trac.webkit.org/changeset/186903. It broke the build.

Added: trunk/LayoutTests/compositing/fixed-with-fixed-layout-expected.txt (0 => 186911)


--- trunk/LayoutTests/compositing/fixed-with-fixed-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-with-fixed-layout-expected.txt	2015-07-16 21:54:06 UTC (rev 186911)
@@ -0,0 +1,35 @@
+Top Left Right bottom
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 806.00 1616.00)
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 1008.00 2021.00)
+      (contentsOpaque 1)
+      (transform [0.80 0.00 0.00 0.00] [0.00 0.80 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
+      (children 4
+        (GraphicsLayer
+          (bounds 1000.00 100.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 0.00 200.00)
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 900.00 200.00)
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 0.00 1900.00)
+          (bounds 1000.00 100.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/fixed-with-fixed-layout.html (0 => 186911)


--- trunk/LayoutTests/compositing/fixed-with-fixed-layout.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-with-fixed-layout.html	2015-07-16 21:54:06 UTC (rev 186911)
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            width: 1000px;
+        }
+        
+        .fixed {
+            position: fixed;
+            height: 100px;
+            width: 100px;
+            background-color: rgba(0, 0, 0, 0.5);
+        }
+        
+        .top, .bottom {
+            left: 0;
+            width: 100%;
+        }
+        
+        .left, .right {
+            top: 200px;
+        }
+        
+        .top {
+            top: 0;
+        }
+        
+        .bottom {
+            bottom: 0;
+        }
+        .left {
+            left: 0;
+        }
+        .right {
+            right: 0;
+        }
+    </style>
+    <script>
+        
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        if (window.internals) {
+            internals.settings.setAcceleratedCompositingForFixedPositionEnabled(true);
+            internals.setUseFixedLayout(true);
+            internals.setFixedLayoutSize(1000, 2000);
+            var scale = 800 / 1000;
+            eventSender.scalePageBy(scale, scale);
+        }
+        
+        function doTest()
+        {
+            window.setTimeout(function() {
+                document.getElementById("layerTree").innerText = window.internals.layerTreeAsText(document);
+                testRunner.notifyDone();
+            }, 0);
+        }
+        
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+
+<div class="top fixed">
+    Top
+</div>
+
+<div class="left fixed">
+    Left
+</div>
+
+<div class="right fixed">
+    Right
+</div>
+
+<div class="bottom fixed">
+    bottom
+</div>
+
+<pre id="layerTree"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (186910 => 186911)


--- trunk/Source/WebCore/ChangeLog	2015-07-16 21:51:08 UTC (rev 186910)
+++ trunk/Source/WebCore/ChangeLog	2015-07-16 21:54:06 UTC (rev 186911)
@@ -1,3 +1,22 @@
+2015-07-16  Simon Fraser  <[email protected]>
+
+        Fix disappearing position:fixed elements in fixed layout mode
+        https://bugs.webkit.org/show_bug.cgi?id=147019
+
+        Reviewed by Tim Horton.
+
+        Test: compositing/fixed-with-fixed-layout.html
+        
+        When in fixed layout mode, and being scaled down, viewportConstrainedVisibleContentRect() is
+        the wrong thing to use to determine if position:fixed elements are clipped out. In this case,
+        use the simpler document bounds (before scaling).
+        
+        In the long term,  there needs to be an equivalent of viewportConstrainedVisibleContentRect()
+        that gives an appropriate rect that can be used here.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
+
 2015-07-16  Benjamin Poulain  <[email protected]>
 
         [Content extensions] Combine suffixes when generating NFAs

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (186910 => 186911)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-07-16 21:51:08 UTC (rev 186910)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-07-16 21:54:06 UTC (rev 186911)
@@ -2739,7 +2739,12 @@
     }
 
     // Fixed position elements that are invisible in the current view don't get their own layer.
-    LayoutRect viewBounds = m_renderView.frameView().viewportConstrainedVisibleContentRect();
+    // FIXME: We shouldn't have to check useFixedLayout() here; one of the viewport rects needs to give the correct answer.
+    LayoutRect viewBounds;
+    if (m_renderView.frameView().useFixedLayout())
+        viewBounds = m_renderView.unscaledDocumentRect();
+    else
+        viewBounds = m_renderView.frameView().viewportConstrainedVisibleContentRect();
     LayoutRect layerBounds = layer.calculateLayerBounds(&layer, LayoutSize(), RenderLayer::UseLocalClipRectIfPossible | RenderLayer::IncludeLayerFilterOutsets | RenderLayer::UseFragmentBoxesExcludingCompositing
         | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask | RenderLayer::IncludeCompositedDescendants);
     // Map to m_renderView to ignore page scale.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to