Non-paintsContent fixed position layer should not cause slow scrolling
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Mar 2013 22:12:00 +0000 (22:12 +0000)
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Mar 2013 22:12:00 +0000 (22:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113238

Reviewed by James Robinson.

Source/WebCore:

Added NotCompositedForNoVisibleContent in ViewportConstrainedNotCompositedReason and set it in RLC.

Test: compositing/layer-creation/fixed-position-no-content-scroll-reason.html

* rendering/RenderLayer.h: Add NotCompositedForNoVisibleContent.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPosition): Set NotCompositedForNoVisibleContent reason when the fixed position layer has no visible content.

LayoutTests:

* compositing/layer-creation/fixed-position-no-content-scroll-reason-expected.txt: Added.
* compositing/layer-creation/fixed-position-no-content-scroll-reason.html: Copied from LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scroll-reason.html. Test case for the bug.
* compositing/layer-creation/fixed-position-in-view-dynamic.html: Set background of fixed layer to distinguish out-of-view case from no-content case.
* compositing/layer-creation/fixed-position-out-of-view-dynamic.html: Ditto.
* compositing/layer-creation/fixed-position-out-of-view-scroll-reason.html: Ditto.
* platform/chromium/compositing/layer-creation/fixed-position-in-view-dynamic-expected.txt: Removed. This was a wrong rebaseline related to this bug.
* platform/chromium/platform/chromium/virtual/softwarecompositing/layer-creation/fixed-position-in-view-dynamic-expected.txt: Removed. This was a wrong rebaseline related to this bug.

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

LayoutTests/ChangeLog
LayoutTests/compositing/layer-creation/fixed-position-in-view-dynamic.html
LayoutTests/compositing/layer-creation/fixed-position-no-content-scroll-reason-expected.txt [new file with mode: 0644]
LayoutTests/compositing/layer-creation/fixed-position-no-content-scroll-reason.html [new file with mode: 0644]
LayoutTests/compositing/layer-creation/fixed-position-out-of-view-dynamic.html
LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scroll-reason.html
LayoutTests/platform/chromium/compositing/layer-creation/fixed-position-in-view-dynamic-expected.txt [deleted file]
LayoutTests/platform/chromium/platform/chromium/virtual/softwarecompositing/layer-creation/fixed-position-in-view-dynamic-expected.txt [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerCompositor.cpp

index 333e83f..ae1f655 100644 (file)
@@ -1,3 +1,18 @@
+2013-03-26  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Non-paintsContent fixed position layer should not cause slow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=113238
+
+        Reviewed by James Robinson.
+
+        * compositing/layer-creation/fixed-position-no-content-scroll-reason-expected.txt: Added.
+        * compositing/layer-creation/fixed-position-no-content-scroll-reason.html: Copied from LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scroll-reason.html. Test case for the bug.
+        * compositing/layer-creation/fixed-position-in-view-dynamic.html: Set background of fixed layer to distinguish out-of-view case from no-content case.
+        * compositing/layer-creation/fixed-position-out-of-view-dynamic.html: Ditto.
+        * compositing/layer-creation/fixed-position-out-of-view-scroll-reason.html: Ditto.
+        * platform/chromium/compositing/layer-creation/fixed-position-in-view-dynamic-expected.txt: Removed. This was a wrong rebaseline related to this bug.
+        * platform/chromium/platform/chromium/virtual/softwarecompositing/layer-creation/fixed-position-in-view-dynamic-expected.txt: Removed. This was a wrong rebaseline related to this bug.
+
 2013-03-26  Alok Priyadarshi  <alokp@chromium.org>
 
         Unreviewed gardening.
diff --git a/LayoutTests/compositing/layer-creation/fixed-position-no-content-scroll-reason-expected.txt b/LayoutTests/compositing/layer-creation/fixed-position-no-content-scroll-reason-expected.txt
new file mode 100644 (file)
index 0000000..c927bfb
--- /dev/null
@@ -0,0 +1,2 @@
+Main thread scrolling reasons should be blank:
+
diff --git a/LayoutTests/compositing/layer-creation/fixed-position-no-content-scroll-reason.html b/LayoutTests/compositing/layer-creation/fixed-position-no-content-scroll-reason.html
new file mode 100644 (file)
index 0000000..67c0c00
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<style>
+  .fixed {
+    position: fixed;
+    width: 50px;
+    height: 50px;
+    top: 10px;
+    left: 10px;
+    z-index: -1;
+  }
+</style>
+
+<script type="text/javascript">
+  if (window.internals)
+    window.internals.settings.setAcceleratedCompositingForFixedPositionEnabled(true);
+
+  if (window.testRunner) {
+    testRunner.dumpAsText();
+
+    window.addEventListener("load", function() {
+      document.getElementById("mainThreadScrollingReasons").innerText = window.internals.mainThreadScrollingReasons(document);
+    }, false);
+  }
+</script>
+</head>
+
+<body>
+<div style="height: 1000px">
+  Main thread scrolling reasons should be blank:
+  <pre id="mainThreadScrollingReasons"></pre>
+</div>
+<div class="fixed"></div>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/compositing/layer-creation/fixed-position-in-view-dynamic-expected.txt b/LayoutTests/platform/chromium/compositing/layer-creation/fixed-position-in-view-dynamic-expected.txt
deleted file mode 100644 (file)
index 0af0728..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-FAIL: Has non-layer viewport-constrained objects
-
diff --git a/LayoutTests/platform/chromium/platform/chromium/virtual/softwarecompositing/layer-creation/fixed-position-in-view-dynamic-expected.txt b/LayoutTests/platform/chromium/platform/chromium/virtual/softwarecompositing/layer-creation/fixed-position-in-view-dynamic-expected.txt
deleted file mode 100644 (file)
index 0af0728..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-FAIL: Has non-layer viewport-constrained objects
-
index d2ece40..be36a56 100644 (file)
@@ -1,3 +1,18 @@
+2013-03-26  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Non-paintsContent fixed position layer should not cause slow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=113238
+
+        Reviewed by James Robinson.
+
+        Added NotCompositedForNoVisibleContent in ViewportConstrainedNotCompositedReason and set it in RLC.
+
+        Test: compositing/layer-creation/fixed-position-no-content-scroll-reason.html
+
+        * rendering/RenderLayer.h: Add NotCompositedForNoVisibleContent.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForPosition): Set NotCompositedForNoVisibleContent reason when the fixed position layer has no visible content.
+
 2013-03-26  Zoltan Horvath  <zoltan@webkit.org>
 
         [CSS Exclusions] The radius of a circle should be computed based on the shorter available dimension
index 0b8945d..4b05e4c 100644 (file)
@@ -838,6 +838,7 @@ public:
         NoNotCompositedReason,
         NotCompositedForBoundsOutOfView,
         NotCompositedForNonViewContainer,
+        NotCompositedForNoVisibleContent,
     };
 
     void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotCompositedReason reason) { m_viewportConstrainedNotCompositedReason = reason; }
index 42ce676..2cd1a1d 100644 (file)
@@ -2207,8 +2207,11 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere
     }
     
     bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescendant();
-    if (!paintsContent)
+    if (!paintsContent) {
+        if (viewportConstrainedNotCompositedReason)
+            *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForNoVisibleContent;
         return false;
+    }
 
     return true;
 }