Index: Source/core/page/scrolling/ScrollingCoordinator.cpp |
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
index 44fbbae5397b24ac98946e33c61e9abf4e37baa7..b86590a19cc5de006a1f84c56aab1321de50ddea 100644 |
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp |
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
@@ -368,7 +368,16 @@ bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc |
WebLayer* containerLayer = toWebLayer(scrollableArea->layerForContainer()); |
if (webLayer) { |
webLayer->setScrollClipLayer(containerLayer); |
- webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition())); |
+ // Non-layered 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. |
+ if (m_lastMainThreadScrollingReasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects) |
+ 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); |
@@ -543,7 +552,6 @@ void ScrollingCoordinator::reset() |
m_layersWithTouchRects.clear(); |
m_wasFrameScrollable = false; |
- // This is retained for testing. |
m_lastMainThreadScrollingReasons = 0; |
setShouldUpdateScrollLayerPositionOnMainThread(m_lastMainThreadScrollingReasons); |
} |