Pre-painting should not paint out-of-view fixed position elements
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 19:38:15 +0000 (19:38 +0000)
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 19:38:15 +0000 (19:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104724

Reviewed by James Robinson.

.:

New manual test.

* ManualTests/compositing/fixed-position-out-of-view-scroll-prepaint.html: Added.

Source/WebCore:

Test: ManualTests/compositing/fixed-position-out-of-view-scroll-prepaint.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayer): Don't paint out-of-view fixed position elements.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137492 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
ManualTests/compositing/fixed-position-out-of-view-scroll-prepaint.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp

index a978b1d..58cc8bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-12-12  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Pre-painting should not paint out-of-view fixed position elements
+        https://bugs.webkit.org/show_bug.cgi?id=104724
+
+        Reviewed by James Robinson.
+
+        New manual test.
+
+        * ManualTests/compositing/fixed-position-out-of-view-scroll-prepaint.html: Added.
+
 2012-12-12  Krzysztof Czech  <k.czech@samsung.com>
 
         [EFL] Possibility to turn off accessibility feature for WebKit-EFL.
diff --git a/ManualTests/compositing/fixed-position-out-of-view-scroll-prepaint.html b/ManualTests/compositing/fixed-position-out-of-view-scroll-prepaint.html
new file mode 100644 (file)
index 0000000..5b05548
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style>
+    body {
+      height: 2000px;
+      margin: 0px;
+      padding: 0px;
+    }
+    .main {
+      position: fixed;
+    }
+    .fixed {
+      position: fixed;
+      width: 100%;
+      height: 100px;
+      left: 0px;
+      bottom: -100px;
+      background-color: red;
+    }
+  </style>
+</head>
+
+<body>
+  <div class="main">
+    This test is applicable on platforms that do accelerated compositing, can prepaint out-of-view contents and can scroll the contents into the viewport without repainting them.<p>
+    The following settings need to be enabled:<p>
+    - acceleratedCompositingForFixedPositionEnabled<br>
+    - fixedPositionCreatesStackingContext<p>
+    To test, scroll the page up and down. The test passes if there is no temporary or permanent red in the page.
+  </div>
+
+  <!-- An out-of-view fixed element that should be never visible -->
+  <div class="fixed"></div>
+</body>
+</html>
+
index 0f39065..308ba32 100644 (file)
@@ -1,3 +1,15 @@
+2012-12-12  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Pre-painting should not paint out-of-view fixed position elements
+        https://bugs.webkit.org/show_bug.cgi?id=104724
+
+        Reviewed by James Robinson.
+
+        Test: ManualTests/compositing/fixed-position-out-of-view-scroll-prepaint.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayer): Don't paint out-of-view fixed position elements.
+
 2012-12-11  Roger Fong  <roger_fong@apple.com>
 
         Enable VIDEO_TRACK on Windows.
index ae81d6a..10de2fe 100644 (file)
@@ -3146,6 +3146,10 @@ void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
             // If this RenderLayer should paint into its backing, that will be done via RenderLayerBacking::paintIntoLayer().
             return;
         }
+    } else if (compositor()->fixedPositionLayerNotCompositedReason(this) == RenderLayerCompositor::LayerBoundsOutOfView) {
+        // Don't paint out-of-view fixed position layers (when doing prepainting) because they will never be visible
+        // unless their position or viewport size is changed.
+        return;
     }
 #endif