Diff
Modified: trunk/LayoutTests/ChangeLog (137696 => 137697)
--- trunk/LayoutTests/ChangeLog 2012-12-14 02:24:13 UTC (rev 137696)
+++ trunk/LayoutTests/ChangeLog 2012-12-14 02:58:39 UTC (rev 137697)
@@ -1,3 +1,19 @@
+2012-12-13 Xianzhu Wang <[email protected]>
+
+ Out-of-view check of fixed position element in frame is incorrect when page is scaled
+ https://bugs.webkit.org/show_bug.cgi?id=104943
+
+ Reviewed by Simon Fraser.
+
+ Test cases.
+
+ * compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-expected.txt: Added.
+ * compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll-expected.txt: Added.
+ * compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll.html: Added.
+ * compositing/layer-creation/fixed-position-out-of-view-scaled-iframe.html: Added.
+ * compositing/layer-creation/resources/fixed-position-out-of-view-frame-scroll.html: Added.
+ * compositing/layer-creation/resources/fixed-position-out-of-view-frame.html: Added.
+
2012-12-13 Bear Travis <[email protected]>
Positioned replaced elements should resolve vertical margins against their
Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-expected.txt (0 => 137697)
--- trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-expected.txt 2012-12-14 02:58:39 UTC (rev 137697)
@@ -0,0 +1,2 @@
+
+PASS
Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll-expected.txt (0 => 137697)
--- trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll-expected.txt 2012-12-14 02:58:39 UTC (rev 137697)
@@ -0,0 +1,2 @@
+
+PASS
Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll.html (0 => 137697)
--- trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll.html 2012-12-14 02:58:39 UTC (rev 137697)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+ if (window.internals) {
+ window.internals.settings.setEnableCompositingForFixedPosition(true);
+ window.internals.settings.setFixedPositionCreatesStackingContext(true);
+
+ addEventListener("load", function() {
+ window.internals.setPageScaleFactor(0.5, 0, 0);
+ setTimeout(function() {
+ var layerTreeScaledDown = internals.layerTreeAsText(document.getElementById("iframe").contentDocument);
+
+ window.internals.setPageScaleFactor(1.5, 0, 0);
+ setTimeout(function() {
+ var layerTreeScaledUp = internals.layerTreeAsText(document.getElementById("iframe").contentDocument);
+ // Because logical size of the frame is unchanged, the layer tree in the frame should not be affected by the page scale.
+ document.getElementById("result").innerText =
+ layerTreeScaledUp == layerTreeScaledDown ? "PASS" : "FAIL";
+ testRunner.notifyDone();
+ }, 0);
+ }, 0);
+ }, false);
+ }
+</script>
+</head>
+<body>
+<iframe id="iframe" src="" style="width: 800px; height: 600px"></iframe>
+<pre id="result"></pre>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe.html (0 => 137697)
--- trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-out-of-view-scaled-iframe.html 2012-12-14 02:58:39 UTC (rev 137697)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+ if (window.internals) {
+ window.internals.settings.setEnableCompositingForFixedPosition(true);
+ window.internals.settings.setFixedPositionCreatesStackingContext(true);
+
+ addEventListener("load", function() {
+ window.internals.setPageScaleFactor(0.5, 0, 0);
+ setTimeout(function() {
+ var layerTreeScaledDown = internals.layerTreeAsText(document.getElementById("iframe").contentDocument);
+
+ window.internals.setPageScaleFactor(1.5, 0, 0);
+ setTimeout(function() {
+ var layerTreeScaledUp = internals.layerTreeAsText(document.getElementById("iframe").contentDocument);
+ // Because logical size of the frame is unchanged, the layer tree in the frame should not be affected by the page scale.
+ document.getElementById("result").innerText =
+ layerTreeScaledUp == layerTreeScaledDown ? "PASS" : "FAIL";
+ testRunner.notifyDone();
+ }, 0);
+ }, 0);
+ }, false);
+ }
+</script>
+</head>
+<body>
+<iframe id="iframe" src="" style="width: 800px; height: 600px"></iframe>
+<pre id="result"></pre>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/layer-creation/resources/fixed-position-out-of-view-frame-scroll.html (0 => 137697)
--- trunk/LayoutTests/compositing/layer-creation/resources/fixed-position-out-of-view-frame-scroll.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/resources/fixed-position-out-of-view-frame-scroll.html 2012-12-14 02:58:39 UTC (rev 137697)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .fixed {
+ position: fixed;
+ width: 10px;
+ height: 10px;
+ }
+ </style>
+</head>
+<body _onload_="window.scrollTo(300, 600)">
+ <div style="width: 1500px; height: 1500px"></div>
+ <!-- When the size of the frame is 800x600, the first 3 divs are out-of-view and should not be composited, and the last 2 divs should be composited. -->
+ <div class="fixed" style="top: -100px"></div>
+ <div class="fixed"></div>
+ <div class="fixed" style="top: 0px; left: 1000px"></div>
+ <div class="fixed" style="top: 0px; left: 600px"></div>
+ <div class="fixed" style="top: 0px; left: 0px"></div>
+</body>
+</html>
+
Added: trunk/LayoutTests/compositing/layer-creation/resources/fixed-position-out-of-view-frame.html (0 => 137697)
--- trunk/LayoutTests/compositing/layer-creation/resources/fixed-position-out-of-view-frame.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/resources/fixed-position-out-of-view-frame.html 2012-12-14 02:58:39 UTC (rev 137697)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .fixed {
+ position: fixed;
+ width: 10px;
+ height: 10px;
+ }
+ </style>
+</head>
+<body>
+ <div style="width: 1500px; height: 1500px"></div>
+ <!-- When the size of the frame is 800x600, the first 3 divs are out-of-view and should not be composited, and the last 2 divs should be composited. -->
+ <div class="fixed" style="top: -100px"></div>
+ <div class="fixed"></div>
+ <div class="fixed" style="top: 0px; left: 1000px"></div>
+ <div class="fixed" style="top: 0px; left: 600px"></div>
+ <div class="fixed" style="top: 0px; left: 0px"></div>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (137696 => 137697)
--- trunk/Source/WebCore/ChangeLog 2012-12-14 02:24:13 UTC (rev 137696)
+++ trunk/Source/WebCore/ChangeLog 2012-12-14 02:58:39 UTC (rev 137697)
@@ -1,3 +1,18 @@
+2012-12-13 Xianzhu Wang <[email protected]>
+
+ Out-of-view check of fixed position element in frame is incorrect when page is scaled
+ https://bugs.webkit.org/show_bug.cgi?id=104943
+
+ Reviewed by Simon Fraser.
+
+ Use frameScaleFactor instead of pageScaleFactor to scale the layer bounds.
+
+ Tests: compositing/layer-creation/fixed-position-out-of-view-scaled-iframe-scroll.html
+ compositing/layer-creation/fixed-position-out-of-view-scaled-iframe.html
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
+
2012-12-13 Bear Travis <[email protected]>
Positioned replaced elements should resolve vertical margins against their containing
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (137696 => 137697)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-12-14 02:24:13 UTC (rev 137696)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-12-14 02:58:39 UTC (rev 137697)
@@ -1998,7 +1998,7 @@
IntRect viewBounds = frameView->visibleContentRect();
LayoutRect layerBounds = layer->calculateLayerBounds(rootRenderLayer(), 0, RenderLayer::DefaultCalculateLayerBoundsFlags
| RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask | RenderLayer::IncludeCompositedDescendants);
- layerBounds.scale(pageScaleFactor());
+ layerBounds.scale(frameView->frame()->frameScaleFactor());
if (!viewBounds.intersects(enclosingIntRect(layerBounds))) {
if (fixedPositionLayerNotCompositedReason)
*fixedPositionLayerNotCompositedReason = LayerBoundsOutOfView;