- Revision
- 141330
- Author
- simon.fra...@apple.com
- Date
- 2013-01-30 15:22:25 -0800 (Wed, 30 Jan 2013)
Log Message
Elements that dynamically become fixed sometimes jump to the top left on scrolling
https://bugs.webkit.org/show_bug.cgi?id=108389
Source/WebCore:
Reviewed by Beth Dakin.
When an element became position:fixed and gained a compositing layer
as a result, we would compute its viewport constraints (including the
last GraphicsLayer position) before we had actually updated the GraphicsLayer
geometry for the first time. This would cause a jump to 0,0 on scrolling.
Fix by removing the call to updateViewportConstraintStatus() just after
creating the backing. Instead, hook in to registerScrollingLayers(),
which is called on every geometry update, to update the viewport
constraints for this layer.
Tested via existing tests, which now show correct positions at last
layout.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::registerScrollingLayers):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking):
LayoutTests:
Reviewed by Beth Dakin.
Update test results; these results now correctly reflect the last layout
positions.
* platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt:
* platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt:
* platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt:
* platform/mac/tiled-drawing/fixed/four-bars-expected.txt:
* platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt:
* platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt:
* platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt:
* platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (141329 => 141330)
--- trunk/LayoutTests/ChangeLog 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/ChangeLog 2013-01-30 23:22:25 UTC (rev 141330)
@@ -1,3 +1,22 @@
+2013-01-30 Simon Fraser <simon.fra...@apple.com>
+
+ Elements that dynamically become fixed sometimes jump to the top left on scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=108389
+
+ Reviewed by Beth Dakin.
+
+ Update test results; these results now correctly reflect the last layout
+ positions.
+
+ * platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt:
+ * platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt:
+ * platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt:
+ * platform/mac/tiled-drawing/fixed/four-bars-expected.txt:
+ * platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt:
+ * platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt:
+ * platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt:
+ * platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt:
+
2013-01-30 Jessie Berlin <jber...@apple.com>
Revert r138912, the right fix for https://bugs.webkit.org/show_bug.cgi?id=106187 is in
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -6,7 +6,7 @@
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
- (layer position at last layout 8.00 8.00)
+ (layer position at last layout 8.00 208.00)
)
)
)
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -6,6 +6,7 @@
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
+ (layer position at last layout 0.00 200.00)
)
)
)
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -6,7 +6,7 @@
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
- (layer position at last layout 2.00 15.00)
+ (layer position at last layout 2.00 215.00)
)
)
)
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/fixed/four-bars-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/fixed/four-bars-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/fixed/four-bars-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -6,21 +6,22 @@
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
+ (layer position at last layout 0.00 200.00)
)
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
- (layer position at last layout 10.00 200.00)
+ (layer position at last layout 10.00 400.00)
)
(Fixed node
(anchor edges: AnchorEdgeRight AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
- (layer position at last layout 601.00 200.00)
+ (layer position at last layout 601.00 400.00)
)
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeBottom)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
- (layer position at last layout 0.00 516.00)
+ (layer position at last layout 0.00 716.00)
)
)
)
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -6,8 +6,7 @@
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
- (children 0
- )
+ (layer position at last layout 0.00 200.00)
)
)
)
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -6,7 +6,7 @@
(Fixed node
(anchor edges: AnchorEdgeLeft AnchorEdgeTop)
(viewport rect at last layout: 0.00 200.00 785.00 600.00)
- (layer position at last layout 0.00 13.00)
+ (layer position at last layout 0.00 213.00)
)
)
)
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -11,7 +11,7 @@
(sticky box rect 812.00 25.00 300.00 60.00)
(sticky box rect 812.00 25.00 300.00 60.00)
(sticky offset at last layout 8.00 0.00)
- (layer position at last layout 812.00 25.00)
+ (layer position at last layout 820.00 25.00)
)
(Sticky node
(anchor edges: AnchorEdgeRight )
@@ -20,7 +20,7 @@
(sticky box rect 812.00 93.00 300.00 60.00)
(sticky box rect 812.00 93.00 300.00 60.00)
(sticky offset at last layout 0.00 0.00)
- (layer position at last layout 612.00 93.00)
+ (layer position at last layout 812.00 93.00)
)
(Sticky node
(anchor edges: AnchorEdgeLeft )
@@ -29,7 +29,7 @@
(sticky box rect 812.00 161.00 300.00 60.00)
(sticky box rect 812.00 161.00 300.00 60.00)
(sticky offset at last layout 148.00 0.00)
- (layer position at last layout 812.00 161.00)
+ (layer position at last layout 960.00 161.00)
)
(Sticky node
(anchor edges: AnchorEdgeRight )
@@ -38,7 +38,7 @@
(sticky box rect 812.00 229.00 300.00 60.00)
(sticky box rect 812.00 229.00 300.00 60.00)
(sticky offset at last layout 0.00 0.00)
- (layer position at last layout 612.00 229.00)
+ (layer position at last layout 812.00 229.00)
)
(Sticky node
(anchor edges: AnchorEdgeLeft AnchorEdgeRight )
@@ -48,7 +48,7 @@
(sticky box rect 812.00 297.00 300.00 60.00)
(sticky box rect 812.00 297.00 300.00 60.00)
(sticky offset at last layout 8.00 0.00)
- (layer position at last layout 612.00 297.00)
+ (layer position at last layout 820.00 297.00)
)
(Sticky node
(anchor edges: AnchorEdgeLeft AnchorEdgeRight )
@@ -58,7 +58,7 @@
(sticky box rect 812.00 365.00 300.00 60.00)
(sticky box rect 812.00 365.00 300.00 60.00)
(sticky offset at last layout 148.00 0.00)
- (layer position at last layout 612.00 365.00)
+ (layer position at last layout 960.00 365.00)
)
)
)
Modified: trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt (141329 => 141330)
--- trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt 2013-01-30 23:22:25 UTC (rev 141330)
@@ -15,7 +15,7 @@
(sticky box rect 73.00 558.00 80.00 300.00)
(sticky box rect 73.00 558.00 80.00 300.00)
(sticky offset at last layout 0.00 42.00)
- (layer position at last layout 73.00 558.00)
+ (layer position at last layout 73.00 600.00)
)
(Sticky node
(anchor edges: AnchorEdgeBottom)
@@ -24,7 +24,7 @@
(sticky box rect 163.00 558.00 80.00 300.00)
(sticky box rect 163.00 558.00 80.00 300.00)
(sticky offset at last layout 0.00 0.00)
- (layer position at last layout 163.00 406.00)
+ (layer position at last layout 163.00 558.00)
)
(Sticky node
(anchor edges: AnchorEdgeTop )
@@ -33,7 +33,7 @@
(sticky box rect 253.00 558.00 80.00 300.00)
(sticky box rect 253.00 558.00 80.00 300.00)
(sticky offset at last layout 0.00 142.00)
- (layer position at last layout 253.00 558.00)
+ (layer position at last layout 253.00 700.00)
)
(Sticky node
(anchor edges: AnchorEdgeBottom)
@@ -42,7 +42,7 @@
(sticky box rect 343.00 558.00 80.00 300.00)
(sticky box rect 343.00 558.00 80.00 300.00)
(sticky offset at last layout 0.00 0.00)
- (layer position at last layout 343.00 406.00)
+ (layer position at last layout 343.00 558.00)
)
(Sticky node
(anchor edges: AnchorEdgeTop AnchorEdgeBottom)
@@ -52,7 +52,7 @@
(sticky box rect 433.00 558.00 80.00 300.00)
(sticky box rect 433.00 558.00 80.00 300.00)
(sticky offset at last layout 0.00 42.00)
- (layer position at last layout 433.00 406.00)
+ (layer position at last layout 433.00 600.00)
)
(Sticky node
(anchor edges: AnchorEdgeTop AnchorEdgeBottom)
@@ -62,7 +62,7 @@
(sticky box rect 523.00 558.00 80.00 300.00)
(sticky box rect 523.00 558.00 80.00 300.00)
(sticky offset at last layout 0.00 142.00)
- (layer position at last layout 523.00 406.00)
+ (layer position at last layout 523.00 700.00)
)
)
)
Modified: trunk/Source/WebCore/ChangeLog (141329 => 141330)
--- trunk/Source/WebCore/ChangeLog 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/Source/WebCore/ChangeLog 2013-01-30 23:22:25 UTC (rev 141330)
@@ -1,3 +1,28 @@
+2013-01-30 Simon Fraser <simon.fra...@apple.com>
+
+ Elements that dynamically become fixed sometimes jump to the top left on scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=108389
+
+ Reviewed by Beth Dakin.
+
+ When an element became position:fixed and gained a compositing layer
+ as a result, we would compute its viewport constraints (including the
+ last GraphicsLayer position) before we had actually updated the GraphicsLayer
+ geometry for the first time. This would cause a jump to 0,0 on scrolling.
+
+ Fix by removing the call to updateViewportConstraintStatus() just after
+ creating the backing. Instead, hook in to registerScrollingLayers(),
+ which is called on every geometry update, to update the viewport
+ constraints for this layer.
+
+ Tested via existing tests, which now show correct positions at last
+ layout.
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::registerScrollingLayers):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateBacking):
+
2013-01-30 Adam Barth <aba...@webkit.org>
HTMLDocumentParser::insert should be aware of threaded parsing
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (141329 => 141330)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-01-30 23:22:25 UTC (rev 141330)
@@ -823,6 +823,8 @@
if (!scrollingCoordinator)
return;
+ compositor()->updateViewportConstraintStatus(m_owningLayer);
+
// FIXME: it would be nice to avoid all this work if the platform doesn't implement setLayerIsFixedToContainerLayer().
if (renderer()->style()->position() == FixedPosition || compositor()->fixedPositionedByAncestor(m_owningLayer))
scrollingCoordinator->setLayerIsFixedToContainerLayer(childForSuperlayers(), true);
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (141329 => 141330)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-01-30 23:19:21 UTC (rev 141329)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-01-30 23:22:25 UTC (rev 141330)
@@ -591,9 +591,6 @@
layerChanged = true;
}
-
- // Need to add for every compositing layer, because a composited layer may change from being non-fixed to fixed.
- updateViewportConstraintStatus(layer);
} else {
if (layer->backing()) {
// If we're removing backing on a reflection, clear the source GraphicsLayer's pointer to