Title: [107364] trunk
Revision
107364
Author
[email protected]
Date
2012-02-09 22:34:52 -0800 (Thu, 09 Feb 2012)

Log Message

Avoid compositing invisible fixed positioned elements
https://bugs.webkit.org/show_bug.cgi?id=78186

Reviewed by James Robinson.

Source/WebCore:

Test: compositing/layer-creation/fixed-position-out-of-view.html

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

LayoutTests:

* compositing/layer-creation/fixed-position-out-of-view-expected.txt: Added.
* compositing/layer-creation/fixed-position-out-of-view.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107363 => 107364)


--- trunk/LayoutTests/ChangeLog	2012-02-10 06:26:38 UTC (rev 107363)
+++ trunk/LayoutTests/ChangeLog	2012-02-10 06:34:52 UTC (rev 107364)
@@ -1,3 +1,13 @@
+2012-02-09  Xianzhu Wang  <[email protected]>
+
+        Avoid compositing invisible fixed positioned elements
+        https://bugs.webkit.org/show_bug.cgi?id=78186
+
+        Reviewed by James Robinson.
+
+        * compositing/layer-creation/fixed-position-out-of-view-expected.txt: Added.
+        * compositing/layer-creation/fixed-position-out-of-view.html: Added.
+
 2012-02-09  James Robinson  <[email protected]>
 
         [chromium] Update compositing test baselines for mock scrollbars

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-expected.txt (0 => 107364)


--- trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-expected.txt	2012-02-10 06:34:52 UTC (rev 107364)
@@ -0,0 +1,24 @@
+(GraphicsLayer
+  (bounds 785.00 1021.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (bounds 785.00 1021.00)
+          (drawsContent 1)
+          (children 2
+            (GraphicsLayer
+              (bounds 10.00 10.00)
+            )
+            (GraphicsLayer
+              (bounds 785.00 1021.00)
+              (drawsContent 1)
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view.html (0 => 107364)


--- trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view.html	2012-02-10 06:34:52 UTC (rev 107364)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style>
+    .fixed {
+      position: fixed;
+      width: 10px;
+      height: 10px;
+    }
+  </style>
+
+  <script type="text/_javascript_">
+    if (window.internals)
+      window.internals.settings.setEnableCompositingForFixedPosition(true);
+
+    if (window.layoutTestController) {
+      layoutTestController.dumpAsText();
+
+      window.addEventListener("load", function() {
+        document.getElementById("layertree").innerText = layoutTestController.layerTreeAsText();
+      }, false);
+    }
+  </script>
+</head>
+
+<body>
+  <div style="height: 1000px">
+    <pre id="layertree"></pre>
+  </div>
+
+  <!-- Neither of the following elements gets its own layer. -->
+  <div class="fixed" style="z-index: -1"></div>
+  <div class="fixed" style="z-index: -1; top: -100px"></div>
+  <div class="fixed" style="z-index: -1; top: 0px; left: 1000px"></div>
+
+  <!-- This element gets its own layer because it intersects with the viewport. -->
+  <div class="fixed" style="z-index: -1; top: 0px; left: 0px"></div>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (107363 => 107364)


--- trunk/Source/WebCore/ChangeLog	2012-02-10 06:26:38 UTC (rev 107363)
+++ trunk/Source/WebCore/ChangeLog	2012-02-10 06:34:52 UTC (rev 107364)
@@ -1,3 +1,15 @@
+2012-02-09  Xianzhu Wang  <[email protected]>
+
+        Avoid compositing invisible fixed positioned elements
+        https://bugs.webkit.org/show_bug.cgi?id=78186
+
+        Reviewed by James Robinson.
+
+        Test: compositing/layer-creation/fixed-position-out-of-view.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
+
 2012-02-09  Timothy Hatcher  <[email protected]>
 
         Prevent attaching when inspecting the Web Inspector.

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (107363 => 107364)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-02-10 06:26:38 UTC (rev 107363)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-02-10 06:34:52 UTC (rev 107364)
@@ -1567,6 +1567,11 @@
     if (container != m_renderView)
         return false;
 
+    // Fixed position elements that are invisible in the current view don't get their own layer.
+    FrameView* frameView = m_renderView->frameView();
+    if (frameView && !layer->absoluteBoundingBox().intersects(LayoutRect(frameView->scrollXForFixedPosition(), frameView->scrollYForFixedPosition(), frameView->layoutWidth(), frameView->layoutHeight())))
+        return false;
+
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to