Index: Source/core/page/scrolling/ScrollingCoordinator.cpp |
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
index 1bfd1b4189819e4f7894d9705a92eafd8dfe18a5..edf1aa01487206103aa285aedebb9291f6c2325f 100644 |
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp |
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
@@ -355,7 +355,7 @@ void ScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea* |
removeWebScrollbarLayer(scrollableArea, orientation); |
} |
-bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea) |
+bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea, bool hasVisibleViewportConstrainedObjects) |
{ |
GraphicsLayer* scrollLayer = scrollableArea->layerForScrolling(); |
@@ -368,7 +368,20 @@ bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc |
WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer()); |
if (webLayer) { |
webLayer->setScrollClipLayer(containerLayer); |
- webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition())); |
+ // Viewport constrained objects, e.g. fixed position elements, are |
+ // positioned in Blink using integer coordinates. In that case, we |
+ // don't want to set the WebLayer's scroll position at fractional |
+ // precision otherwise the WebLayer's position after snapping to |
+ // device pixel can be off with regard to fixed position elements. |
+ // FIXME: fixed position elements which have their own compositing |
+ // layer can actually be positioned at device pixel boundary in |
+ // chromium compositor, so this should really be conditioned on |
+ // non-composited fixed position elements. crbug.com/414283. |
+ if (hasVisibleViewportConstrainedObjects) { |
Rick Byers
2014/12/05 19:01:41
Rather than taking this bit in from our caller (wh
|
+ webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scrollPosition() - scrollableArea->minimumScrollPosition())); |
+ } else { |
+ webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition())); |
+ } |
webLayer->setBounds(scrollableArea->contentsSize()); |
bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollbar); |
bool canScrollY = scrollableArea->userInputScrollable(VerticalScrollbar); |