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

Unified Diff: Source/platform/scroll/ScrollView.h

Issue 610423004: Preserve fractional scroll offset for JS scrolling API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « Source/platform/geometry/DoubleSize.h ('k') | Source/platform/scroll/ScrollView.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollView.h
diff --git a/Source/platform/scroll/ScrollView.h b/Source/platform/scroll/ScrollView.h
index 78032d2e4771a3ddbab900f43846bd28e3221e26..37ae91a82f1ecd670408102e756f491f83c9695a 100644
--- a/Source/platform/scroll/ScrollView.h
+++ b/Source/platform/scroll/ScrollView.h
@@ -134,7 +134,9 @@ public:
// FIXME: Remove the IntPoint version. crbug.com/414283.
virtual IntPoint scrollPosition() const override { return visibleContentRect().location(); }
virtual DoublePoint scrollPositionDouble() const override { return m_scrollPosition; }
+ // FIXME: Remove scrollOffset(). crbug.com/414283.
IntSize scrollOffset() const { return toIntSize(visibleContentRect().location()); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
+ DoubleSize scrollOffsetDouble() const { return DoubleSize(m_scrollPosition.x(), m_scrollPosition.y()); }
DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; }
virtual IntPoint maximumScrollPosition() const override; // The maximum position we can be scrolled to.
virtual IntPoint minimumScrollPosition() const override; // The minimum position we can be scrolled to.
@@ -150,10 +152,10 @@ public:
DoublePoint cachedScrollPosition() const { return m_cachedScrollPosition; }
// Functions for scrolling the view.
- virtual void setScrollPosition(const IntPoint&, ScrollBehavior = ScrollBehaviorInstant);
- void scrollBy(const IntSize& s, ScrollBehavior behavior = ScrollBehaviorInstant)
+ virtual void setScrollPosition(const DoublePoint&, ScrollBehavior = ScrollBehaviorInstant);
+ void scrollBy(const DoubleSize& s, ScrollBehavior behavior = ScrollBehaviorInstant)
{
- return setScrollPosition(scrollPosition() + s, behavior);
+ return setScrollPosition(scrollPositionDouble() + s, behavior);
}
bool scroll(ScrollDirection, ScrollGranularity);
@@ -290,7 +292,7 @@ protected:
IntRect adjustScrollbarRectForResizer(const IntRect&, Scrollbar*);
// Called to update the scrollbars to accurately reflect the state of the view.
- void updateScrollbars(const IntSize& desiredOffset);
+ void updateScrollbars(const DoubleSize& desiredOffset);
IntSize excludeScrollbars(const IntSize&) const;
@@ -311,7 +313,7 @@ private:
// FIXME(bokan): setScrollOffset, setScrollPosition, scrollTo, scrollToOffsetWithoutAnimation,
// notifyScrollPositionChanged...there's too many ways to scroll this class. This needs
// some cleanup.
- void setScrollOffsetFromUpdateScrollbars(const IntSize&);
+ void setScrollOffsetFromUpdateScrollbars(const DoubleSize&);
RefPtr<Scrollbar> m_horizontalScrollbar;
RefPtr<Scrollbar> m_verticalScrollbar;
« no previous file with comments | « Source/platform/geometry/DoubleSize.h ('k') | Source/platform/scroll/ScrollView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698