Index: Source/core/page/scrolling/ScrollingCoordinator.cpp |
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
index 9ef7d6404d86bb4d5e07d3449ddab67b5d2d70c6..c78ad0c3a68432d05a002a440c7372e9b131cbb8 100644 |
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp |
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
@@ -390,10 +390,18 @@ bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc |
// 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) |
+ if (m_lastMainThreadScrollingReasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects) { |
webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scrollPosition() - scrollableArea->minimumScrollPosition())); |
- else |
- webLayer->setScrollPositionDouble(DoublePoint(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition())); |
+ } else { |
+ DoublePoint scrollPosition(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition()); |
+ IntPoint flooredScrollPosition(flooredIntPoint(scrollPosition)); |
+ DoublePoint fractionalPart(scrollPosition.x() - flooredScrollPosition.x(), scrollPosition.y() - flooredScrollPosition.y()); |
+ webLayer->setScrollPositionDouble(scrollPosition); |
+ // Blink can only use the integer part of the scroll offset to position elements. |
+ // Sends the fractional part of the scroll offset to CC as scroll adjustment for |
+ // fixed-position layer. |
+ webLayer->setScrollCompensationAdjustment(fractionalPart); |
+ } |
webLayer->setBounds(scrollableArea->contentsSize()); |
bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollbar); |