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

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: 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
Index: Source/platform/scroll/ScrollView.h
diff --git a/Source/platform/scroll/ScrollView.h b/Source/platform/scroll/ScrollView.h
index b4a49a0d18d1361f435add1bc464db3c6260597a..84191b389abcfaa3434c4d77c74428999b95a605 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);
@@ -289,7 +291,7 @@ protected:
void updateScrollbarGeometry();
// 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;
@@ -310,7 +312,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;

Powered by Google App Engine
This is Rietveld 408576698