Elements that dynamically become fixed sometimes jump to the top left on scrolling
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 23:22:25 +0000 (23:22 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 23:22:25 +0000 (23:22 +0000)
commit61cad95b2c40f0ba2908ca4ddbc8cfb9cd5b7ce5
treeaedaa9c299733124cc8fd30715530dcf7d779a76
parent00a8d3d444a3d5e92087f67f17134e2cbc67bbd2
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt
LayoutTests/platform/mac/tiled-drawing/fixed/absolute-inside-out-of-view-fixed-expected.txt
LayoutTests/platform/mac/tiled-drawing/fixed/fixed-in-overflow-expected.txt
LayoutTests/platform/mac/tiled-drawing/fixed/four-bars-expected.txt
LayoutTests/platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt
LayoutTests/platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt
LayoutTests/platform/mac/tiled-drawing/sticky/sticky-horizontal-expected.txt
LayoutTests/platform/mac/tiled-drawing/sticky/sticky-vertical-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp