- Revision
- 131393
- Author
- [email protected]
- Date
- 2012-10-15 18:17:47 -0700 (Mon, 15 Oct 2012)
Log Message
Fix GraphicsLayer visible rect computation when scrolling in WebKit1
https://bugs.webkit.org/show_bug.cgi?id=99385
Reviewed by Dean Jackson, Tim Horton.
Source/WebCore:
RenderLayerCompositor always used frameView->frameRect() as the visible
rect on the root used for GraphicsLayer visibleRect computation. This
was wrong for subframes, which require a rect with an origin of (0,0)
and size of the contentsSize().
It was also wrong when the scrolling is not represented in the GraphicsLayer
tree. When scrolling is done elsewhere, we need to use the ScrollView's
visibleContentRect().
Tests: compositing/visible-rect/scrolled.html
compositing/visible-rect/iframe-and-layers.html
compositing/visible-rect/iframe-no-layers.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
LayoutTests:
scrolled.html tests the visible rect after scrolling. The other tests
are for visibleRect in iframes, with and without compositing layers
in the parent document (which exercises different code paths in WebKit1).
* compositing/visible-rect/iframe-and-layers-expected.txt: Added.
* compositing/visible-rect/iframe-and-layers.html: Added.
* compositing/visible-rect/iframe-no-layers-expected.txt: Added.
* compositing/visible-rect/iframe-no-layers.html: Added.
* compositing/visible-rect/resources/subframe-with-layers.html: Added.
* compositing/visible-rect/scrolled-expected.txt: Added.
* compositing/visible-rect/scrolled.html: Added.
* platform/mac-wk2/compositing/visible-rect/iframe-no-layers-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (131392 => 131393)
--- trunk/LayoutTests/ChangeLog 2012-10-16 01:13:14 UTC (rev 131392)
+++ trunk/LayoutTests/ChangeLog 2012-10-16 01:17:47 UTC (rev 131393)
@@ -1,3 +1,23 @@
+2012-10-15 Simon Fraser <[email protected]>
+
+ Fix GraphicsLayer visible rect computation when scrolling in WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=99385
+
+ Reviewed by Dean Jackson, Tim Horton.
+
+ scrolled.html tests the visible rect after scrolling. The other tests
+ are for visibleRect in iframes, with and without compositing layers
+ in the parent document (which exercises different code paths in WebKit1).
+
+ * compositing/visible-rect/iframe-and-layers-expected.txt: Added.
+ * compositing/visible-rect/iframe-and-layers.html: Added.
+ * compositing/visible-rect/iframe-no-layers-expected.txt: Added.
+ * compositing/visible-rect/iframe-no-layers.html: Added.
+ * compositing/visible-rect/resources/subframe-with-layers.html: Added.
+ * compositing/visible-rect/scrolled-expected.txt: Added.
+ * compositing/visible-rect/scrolled.html: Added.
+ * platform/mac-wk2/compositing/visible-rect/iframe-no-layers-expected.txt: Added.
+
2012-10-14 Kent Tamura <[email protected]>
Input elements with multiple fields UI should set appropriate direction for browser locale automatically
Added: trunk/LayoutTests/compositing/visible-rect/iframe-and-layers-expected.txt (0 => 131393)
--- trunk/LayoutTests/compositing/visible-rect/iframe-and-layers-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/visible-rect/iframe-and-layers-expected.txt 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,66 @@
+
+(GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (visible rect 0.00, 0.00 785.00 x 585.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (visible rect 0.00, 0.00 785.00 x 585.00)
+ (children 2
+ (GraphicsLayer
+ (position 18.00 18.00)
+ (bounds 344.00 194.00)
+ (drawsContent 1)
+ (visible rect 0.00, 0.00 344.00 x 194.00)
+ (children 1
+ (GraphicsLayer
+ (position 22.00 22.00)
+ (visible rect 0.00, 0.00 0.00 x 0.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 285.00 135.00)
+ (visible rect 0.00, 0.00 285.00 x 135.00)
+ (children 1
+ (GraphicsLayer
+ (visible rect 0.00, 0.00 0.00 x 0.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (visible rect 0.00, 0.00 285.00 x 135.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (drawsContent 1)
+ (visible rect 0.00, 0.00 285.00 x 135.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 300.00)
+ (drawsContent 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
+ (visible rect 0.00, 0.00 100.00 x 127.00)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 8.00 226.00)
+ (bounds 200.00 200.00)
+ (drawsContent 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
+ (visible rect 0.00, 0.00 200.00 x 200.00)
+ )
+ )
+ )
+ )
+)
+
Property changes on: trunk/LayoutTests/compositing/visible-rect/iframe-and-layers-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/visible-rect/iframe-and-layers.html (0 => 131393)
--- trunk/LayoutTests/compositing/visible-rect/iframe-and-layers.html (rev 0)
+++ trunk/LayoutTests/compositing/visible-rect/iframe-and-layers.html 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 1500px;
+ width: 1500px;
+ }
+
+ .container {
+ position: relative;
+ height: 200px;
+ width: 500px;
+ border: 1px solid black;
+ overflow: hidden;
+ z-index: 0;
+ }
+
+ .box {
+ width: 200px;
+ height: 200px;
+ background-color: blue;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(1px);
+ }
+
+ iframe {
+ margin: 30px;
+ box-shadow: 0 0 20px black;
+ }
+
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function dumpLayers()
+ {
+ // window.scrollTo(40, 40);
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS)
+ }
+ window.addEventListener('load', dumpLayers, false);
+ </script>
+</head>
+<body>
+
+ <iframe src="" scrolling="nso"></iframe>
+ <div class="composited box" style="top: 0;"></div>
+
+<pre id="layers">Layer tree goes here when testing</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/visible-rect/iframe-and-layers.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/visible-rect/iframe-no-layers-expected.txt (0 => 131393)
--- trunk/LayoutTests/compositing/visible-rect/iframe-no-layers-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/visible-rect/iframe-no-layers-expected.txt 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,21 @@
+
+(GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (visible rect 0.00, 0.00 285.00 x 135.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (visible rect 0.00, 0.00 285.00 x 135.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 300.00)
+ (drawsContent 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
+ (visible rect 0.00, 0.00 100.00 x 127.00)
+ )
+ )
+ )
+ )
+)
+
Property changes on: trunk/LayoutTests/compositing/visible-rect/iframe-no-layers-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/visible-rect/iframe-no-layers.html (0 => 131393)
--- trunk/LayoutTests/compositing/visible-rect/iframe-no-layers.html (rev 0)
+++ trunk/LayoutTests/compositing/visible-rect/iframe-no-layers.html 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 1500px;
+ width: 1500px;
+ }
+
+ .container {
+ position: relative;
+ height: 200px;
+ width: 500px;
+ border: 1px solid black;
+ overflow: hidden;
+ z-index: 0;
+ }
+
+ .box {
+ width: 200px;
+ height: 200px;
+ background-color: blue;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(1px);
+ }
+
+ iframe {
+ margin: 10px;
+ }
+
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function dumpLayers()
+ {
+ window.scrollTo(40, 40);
+ if (window.internals) {
+ // Dump the iframe's layers.
+ var iframe = document.getElementById('iframe');
+ document.getElementById('layers').innerText = internals.layerTreeAsText(iframe.contentDocument, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS)
+ }
+ }
+ window.addEventListener('load', dumpLayers, false);
+ </script>
+</head>
+<body>
+
+ <iframe id="iframe" src="" scrolling="nadso"></iframe>
+
+<pre id="layers">Layer tree goes here when testing</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/visible-rect/iframe-no-layers.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/visible-rect/resources/subframe-with-layers.html (0 => 131393)
--- trunk/LayoutTests/compositing/visible-rect/resources/subframe-with-layers.html (rev 0)
+++ trunk/LayoutTests/compositing/visible-rect/resources/subframe-with-layers.html 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 1500px;
+ width: 1500px;
+ }
+ .box {
+ height: 300px;
+ width: 100px;
+ background-color: blue;
+ -webkit-transform: translateZ(1px);
+ }
+ </style>
+ <script>
+ function scroll()
+ {
+ window.setTimeout(function() {
+ window.scrollTo(10, 100);
+ }, 2000);
+ }
+ window.addEventListener('load', scroll, false);
+ </script>
+</head>
+<body>
+ <div class="box">asdf</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/visible-rect/resources/subframe-with-layers.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/visible-rect/scrolled-expected.txt (0 => 131393)
--- trunk/LayoutTests/compositing/visible-rect/scrolled-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/visible-rect/scrolled-expected.txt 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,20 @@
+(GraphicsLayer
+ (bounds 1508.00 2008.00)
+ (visible rect 25.00, 200.00 785.00 x 585.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1508.00 2008.00)
+ (visible rect 25.00, 200.00 785.00 x 585.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 0.00)
+ (bounds 200.00 500.00)
+ (drawsContent 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
+ (visible rect 17.00, 200.00 183.00 x 300.00)
+ )
+ )
+ )
+ )
+)
+
Property changes on: trunk/LayoutTests/compositing/visible-rect/scrolled-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/visible-rect/scrolled.html (0 => 131393)
--- trunk/LayoutTests/compositing/visible-rect/scrolled.html (rev 0)
+++ trunk/LayoutTests/compositing/visible-rect/scrolled.html 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 1500px;
+ width: 1500px;
+ }
+
+ .container {
+ position: relative;
+ height: 200px;
+ width: 500px;
+ border: 1px solid black;
+ overflow: hidden;
+ z-index: 0;
+ }
+
+ .box {
+ position: absolute;
+ width: 200px;
+ height: 500px;
+ background-color: blue;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(1px);
+ }
+
+ pre {
+ margin-top: 500px;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function dumpLayers()
+ {
+ window.scrollTo(25, 200);
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS)
+ }
+ window.addEventListener('load', dumpLayers, false);
+ </script>
+</head>
+<body>
+
+<div class="composited box" style="top: 0;"></div>
+
+<pre id="layers">Layer tree goes here when testing</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/visible-rect/scrolled.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/platform/mac-wk2/compositing/visible-rect/iframe-no-layers-expected.txt (0 => 131393)
--- trunk/LayoutTests/platform/mac-wk2/compositing/visible-rect/iframe-no-layers-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/compositing/visible-rect/iframe-no-layers-expected.txt 2012-10-16 01:17:47 UTC (rev 131393)
@@ -0,0 +1,22 @@
+
+(GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (visible rect 0.00, 0.00 285.00 x 135.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1508.00 1516.00)
+ (drawsContent 1)
+ (visible rect 0.00, 0.00 285.00 x 135.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 300.00)
+ (drawsContent 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
+ (visible rect 0.00, 0.00 100.00 x 127.00)
+ )
+ )
+ )
+ )
+)
+
Property changes on: trunk/LayoutTests/platform/mac-wk2/compositing/visible-rect/iframe-no-layers-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (131392 => 131393)
--- trunk/Source/WebCore/ChangeLog 2012-10-16 01:13:14 UTC (rev 131392)
+++ trunk/Source/WebCore/ChangeLog 2012-10-16 01:17:47 UTC (rev 131393)
@@ -1,3 +1,26 @@
+2012-10-15 Simon Fraser <[email protected]>
+
+ Fix GraphicsLayer visible rect computation when scrolling in WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=99385
+
+ Reviewed by Dean Jackson, Tim Horton.
+
+ RenderLayerCompositor always used frameView->frameRect() as the visible
+ rect on the root used for GraphicsLayer visibleRect computation. This
+ was wrong for subframes, which require a rect with an origin of (0,0)
+ and size of the contentsSize().
+
+ It was also wrong when the scrolling is not represented in the GraphicsLayer
+ tree. When scrolling is done elsewhere, we need to use the ScrollView's
+ visibleContentRect().
+
+ Tests: compositing/visible-rect/scrolled.html
+ compositing/visible-rect/iframe-and-layers.html
+ compositing/visible-rect/iframe-no-layers.html
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+
2012-10-15 Julien Chaffraix <[email protected]>
Remove page visibility hidden histograms
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (131392 => 131393)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-10-16 01:13:14 UTC (rev 131392)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-10-16 01:17:47 UTC (rev 131393)
@@ -295,9 +295,9 @@
if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
if (frameView) {
- // FIXME: Passing frameRect() is correct only when RenderLayerCompositor uses a ScrollLayer (as in WebKit2)
- // otherwise, the passed clip rect needs to take scrolling into account
- rootLayer->flushCompositingState(frameView->frameRect());
+ // Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
+ IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView->contentsSize()) : frameView->visibleContentRect();
+ rootLayer->flushCompositingState(visibleRect);
}
}