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

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

Issue 747903005: Pass integer scroll position to CC if frameView has non-layered viewport constrained objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: restore to using ScrollingCoordinator::HasNonLayer Created 6 years 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
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);
}
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.h ('k') | Source/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698