Chromium Code Reviews| 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..ad33dfbe3f723d48846554b486aa18b6cae19400 100644 |
| --- a/Source/core/page/scrolling/ScrollingCoordinator.cpp |
| +++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
| @@ -390,10 +390,21 @@ 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 { |
| + // Blink can only use the integer part of the scroll offset to position elements. |
| + // So it sends the integer and fractional part of the scroll offset to CC |
| + // separately to be clear that CC needs to take special care of the fractional |
| + // part, e.g. compensating for fixed-position layer's position. Once Blink can |
| + // fully position elements at fractional boundary, we can get rid of these separate |
| + // calls. |
| + DoublePoint scrollPosition(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition()); |
| + IntPoint flooredScrollPosition(flooredIntPoint(scrollPosition)); |
| + DoublePoint fractionalPart(scrollPosition.x() - flooredScrollPosition.x(), scrollPosition.y() - flooredScrollPosition.y()); |
| + webLayer->setScrollPositionDouble(DoublePoint(flooredScrollPosition)); |
|
aelias_OOO_until_Jul13
2015/01/28 22:31:34
Let's send the full nonfloored position here. The
Yufeng Shen (Slow to review)
2015/01/28 22:49:33
Done.
Rick Byers
2015/01/29 20:55:07
Just saw this - sorry. Maybe I just need an conci
|
| + webLayer->setScrollPositionFractionalPart(fractionalPart); |
| + } |
| webLayer->setBounds(scrollableArea->contentsSize()); |
| bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollbar); |