Title: [143073] trunk
Revision
143073
Author
simon.fra...@apple.com
Date
2013-02-15 17:05:20 -0800 (Fri, 15 Feb 2013)

Log Message

Constrain fixed layers to the viewport, not the document
https://bugs.webkit.org/show_bug.cgi?id=109646

Source/WebCore:

Reviewed by Beth Dakin.

It's bad to constrain position:fixed compositing layers to the
document rect, because their bounds will change every time the scroll
position changes, and we're not good currently at synchronizing scrolling
thread layer updates with main thread layer updates, so jiggles ensue.

Fix by constraining position:fixed layers to the viewport.

Test: compositing/geometry/limit-layer-bounds-fixed.html

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

LayoutTests:

Reviewed by Beth Dakin.

Test with a big fixed element in a compositing layer.

* compositing/geometry/limit-layer-bounds-fixed-expected.txt: Added.
* compositing/geometry/limit-layer-bounds-fixed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143072 => 143073)


--- trunk/LayoutTests/ChangeLog	2013-02-16 01:03:29 UTC (rev 143072)
+++ trunk/LayoutTests/ChangeLog	2013-02-16 01:05:20 UTC (rev 143073)
@@ -1,5 +1,17 @@
 2013-02-15  Simon Fraser  <simon.fra...@apple.com>
 
+        Constrain fixed layers to the viewport, not the document
+        https://bugs.webkit.org/show_bug.cgi?id=109646
+
+        Reviewed by Beth Dakin.
+        
+        Test with a big fixed element in a compositing layer.
+
+        * compositing/geometry/limit-layer-bounds-fixed-expected.txt: Added.
+        * compositing/geometry/limit-layer-bounds-fixed.html: Added.
+
+2013-02-15  Simon Fraser  <simon.fra...@apple.com>
+
         drop-shadow filter with overflow:hidden child misbehaves
         https://bugs.webkit.org/show_bug.cgi?id=109783
 

Added: trunk/LayoutTests/compositing/geometry/limit-layer-bounds-fixed-expected.txt (0 => 143073)


--- trunk/LayoutTests/compositing/geometry/limit-layer-bounds-fixed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/geometry/limit-layer-bounds-fixed-expected.txt	2013-02-16 01:05:20 UTC (rev 143073)
@@ -0,0 +1,21 @@
+(GraphicsLayer
+  (bounds 785.00 5013.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 5013.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 100.00 3100.00)
+          (bounds 100.00 100.00)
+        )
+        (GraphicsLayer
+          (position 0.00 3000.00)
+          (bounds 300.00 200.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/geometry/limit-layer-bounds-fixed.html (0 => 143073)


--- trunk/LayoutTests/compositing/geometry/limit-layer-bounds-fixed.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/geometry/limit-layer-bounds-fixed.html	2013-02-16 01:05:20 UTC (rev 143073)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style>
+    body {
+      height: 5000px;
+      margin: 0;
+    }
+    .fixed {
+        position: fixed;
+        left: 100px;
+        top: 100px;
+        width: 200px;
+        height: 100px;
+        background-color: green;
+    }
+    
+    .forcer {
+        position: absolute;
+        top: 3100px;
+        left: 100px;
+        height: 100px;
+        width: 100px;
+        background-color: red;
+        -webkit-transform: translateZ(0);
+    }
+    
+    .child {
+        position: absolute;
+        left: -9000px;
+        top: -9000px;
+        height: 10px;
+        width: 10px;
+        background-color: red;
+    }
+  </style>
+  <script>
+    if (window.testRunner) {
+      testRunner.dumpAsText();
+      testRunner.waitUntilDone();
+    }
+
+    function doTest()
+    {
+        window.scrollTo(0, 3000);
+        // Force layout, which updates the fixed layer bounds.
+        document.getElementById('layers').innerText = '';
+        if (window.testRunner) {
+            document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
+            testRunner.notifyDone();
+        }
+    }
+
+    window.addEventListener('load', doTest, false);
+  </script>
+</head>
+
+<body>
+  <div class="forcer"></div>
+
+  <div class="fixed">
+      <div class="child"></div>
+  </div>
+  
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (143072 => 143073)


--- trunk/Source/WebCore/ChangeLog	2013-02-16 01:03:29 UTC (rev 143072)
+++ trunk/Source/WebCore/ChangeLog	2013-02-16 01:05:20 UTC (rev 143073)
@@ -1,3 +1,22 @@
+2013-02-15  Simon Fraser  <simon.fra...@apple.com>
+
+        Constrain fixed layers to the viewport, not the document
+        https://bugs.webkit.org/show_bug.cgi?id=109646
+
+        Reviewed by Beth Dakin.
+        
+        It's bad to constrain position:fixed compositing layers to the
+        document rect, because their bounds will change every time the scroll
+        position changes, and we're not good currently at synchronizing scrolling
+        thread layer updates with main thread layer updates, so jiggles ensue.
+        
+        Fix by constraining position:fixed layers to the viewport.
+
+        Test: compositing/geometry/limit-layer-bounds-fixed.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateCompositedBounds):
+
 2013-02-13  Jer Noble  <jer.no...@apple.com>
 
         Add a CDMClient class which allows the CDM to query for the currently attached MediaPlayer.

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (143072 => 143073)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-02-16 01:03:29 UTC (rev 143072)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-02-16 01:05:20 UTC (rev 143073)
@@ -405,8 +405,11 @@
         RenderView* view = m_owningLayer->renderer()->view();
         RenderLayer* rootLayer = view->layer();
 
-        // Start by clipping to the document's bounds.
-        LayoutRect clippingBounds = view->unscaledDocumentRect();
+        LayoutRect clippingBounds;
+        if (renderer()->style()->position() == FixedPosition && renderer()->container() == view)
+            clippingBounds = view->frameView()->viewportConstrainedVisibleContentRect();
+        else
+            clippingBounds = view->unscaledDocumentRect();
 
         if (m_owningLayer != rootLayer)
             clippingBounds.intersect(m_owningLayer->backgroundClipRect(RenderLayer::ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to