Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 889453002: Add a WebLayer:setScrollCompensationAdjustment between Blink and CC (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | public/platform/WebLayer.h » ('j') | public/platform/WebLayer.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0298446ffbbea595f0d6fa5a1203055e738cf312 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -390,10 +390,20 @@ 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 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 this call.
+ DoublePoint scrollPosition(scrollableArea->scrollPositionDouble() - scrollableArea->minimumScrollPosition());
+ IntPoint flooredScrollPosition(flooredIntPoint(scrollPosition));
+ DoublePoint fractionalPart(scrollPosition.x() - flooredScrollPosition.x(), scrollPosition.y() - flooredScrollPosition.y());
+ webLayer->setScrollPositionDouble(scrollPosition);
Rick Byers 2015/01/29 20:53:13 You don't want flooredScrollPosition here? If the
+ webLayer->setScrollPositionFractionalPart(fractionalPart);
+ }
webLayer->setBounds(scrollableArea->contentsSize());
bool canScrollX = scrollableArea->userInputScrollable(HorizontalScrollbar);
« no previous file with comments | « no previous file | public/platform/WebLayer.h » ('j') | public/platform/WebLayer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698