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

Unified Diff: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 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
Index: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
index 4bb9943626ec9288e050239a16d38ba2be23d34b..2cb186f4a88714ce0117e7a4df4ae15cb01a0ee7 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
@@ -112,7 +112,7 @@ static LayoutRect relativeBounds(const LayoutObject* layoutObject,
// LayoutBox::scrolledContentOffset.
if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
scrollerBox->isLayoutView())
- relativeBounds.moveBy(-flooredIntPoint(scroller->scrollPositionDouble()));
+ relativeBounds.moveBy(IntPoint(-scroller->scrollOffsetInt()));
return relativeBounds;
}
@@ -216,12 +216,12 @@ void ScrollAnchor::save() {
return;
m_saved = true;
DCHECK(m_scroller);
-
- ScrollbarOrientation blockLayoutAxis =
+ ScrollOffset scrollOffset = m_scroller->scrollOffset();
+ float blockDirectionScrollOffset =
scrollerLayoutBox(m_scroller)->isHorizontalWritingMode()
- ? VerticalScrollbar
- : HorizontalScrollbar;
- if (m_scroller->scrollPosition(blockLayoutAxis) == 0) {
+ ? scrollOffset.height()
+ : scrollOffset.width();
+ if (blockDirectionScrollOffset == 0) {
clear();
return;
}
@@ -287,8 +287,8 @@ void ScrollAnchor::restore() {
return;
}
- m_scroller->setScrollPosition(m_scroller->scrollPositionDouble() + adjustment,
- AnchoringScroll);
+ m_scroller->setScrollOffset(
+ m_scroller->scrollOffset() + FloatSize(adjustment), AnchoringScroll);
// Update UMA metric.
DEFINE_STATIC_LOCAL(EnumerationHistogram, adjustedOffsetHistogram,
« no previous file with comments | « third_party/WebKit/Source/core/layout/README.md ('k') | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698