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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: 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/paint/PaintLayerScrollableArea.h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
index bf2766edf1621bba431d124f46d26e1ef88a3701..672fbe857abddf6381fcfd72028808ffd2a7c010 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -214,16 +214,16 @@ class CORE_EXPORT PaintLayerScrollableArea final
static int s_count;
};
- // If a DelayScrollPositionClampScope object is alive, updateAfterLayout() will not
- // clamp scroll positions to ensure they are in the valid range. When
- // the last DelayScrollPositionClampScope object is destructed, all PaintLayerScrollableArea's
- // that delayed clamping their positions will immediately clamp them.
- class DelayScrollPositionClampScope {
+ // If a DelayScrollOffsetClampScope object is alive, updateAfterLayout() will not
+ // clamp scroll offsets to ensure they are in the valid range. When
+ // the last DelayScrollOffsetClampScope object is destructed, all PaintLayerScrollableArea's
+ // that delayed clamping their offsets will immediately clamp them.
+ class DelayScrollOffsetClampScope {
STACK_ALLOCATED();
public:
- DelayScrollPositionClampScope();
- ~DelayScrollPositionClampScope();
+ DelayScrollOffsetClampScope();
+ ~DelayScrollOffsetClampScope();
static bool clampingIsDelayed() { return s_count; }
static void setNeedsClamp(PaintLayerScrollableArea*);
@@ -287,10 +287,10 @@ class CORE_EXPORT PaintLayerScrollableArea final
const Scrollbar&,
const IntPoint&) const override;
int scrollSize(ScrollbarOrientation) const override;
- IntPoint scrollPosition() const override;
- DoublePoint scrollPositionDouble() const override;
- IntPoint minimumScrollPosition() const override;
- IntPoint maximumScrollPosition() const override;
+ IntSize scrollOffsetInt() const override;
+ ScrollOffset scrollOffset() const override;
+ IntSize minimumScrollOffsetInt() const override;
+ IntSize maximumScrollOffsetInt() const override;
IntRect visibleContentRect(
IncludeScrollbarsInRect = ExcludeScrollbars) const override;
int visibleHeight() const override;
@@ -313,27 +313,26 @@ class CORE_EXPORT PaintLayerScrollableArea final
// FIXME: We shouldn't allow access to m_overflowRect outside this class.
LayoutRect overflowRect() const { return m_overflowRect; }
- DoubleSize offsetFromOrigin() const {
- return toDoubleSize(DoublePoint(scrollOrigin())) + m_scrollPosition;
+ FloatPoint absolutePosition() const {
bokan 2016/10/02 19:47:51 Since scrollOrigin is a ScrollableArea concept, I
szager1 2016/10/05 07:43:36 Done.
+ return FloatPoint(scrollOrigin()) + m_scrollOffset;
}
- void scrollToOffsetFromOrigin(
- const DoubleSize& scrollOffset,
+ void scrollToAbsolutePosition(
+ const FloatPoint& position,
ScrollBehavior scrollBehavior = ScrollBehaviorInstant,
ScrollType scrollType = ProgrammaticScroll) {
- setScrollPosition(-scrollOrigin() + scrollOffset, scrollType,
- scrollBehavior);
+ setScrollOffset(position - scrollOrigin(), scrollType, scrollBehavior);
}
- // This will set the scroll position without clamping, and it will do all post-update
- // work even if the scroll position didn't change.
- void setScrollPositionUnconditionally(const DoublePoint&,
- ScrollType = ProgrammaticScroll);
+ // This will set the scroll offset without clamping, and it will do all post-update
+ // work even if the scroll offset didn't change.
+ void setScrollOffsetUnconditionally(const ScrollOffset&,
+ ScrollType = ProgrammaticScroll);
// TODO(szager): Actually run these after all of layout is finished. Currently, they
// run at the end of box()'es layout (or after all flexbox layout has finished) but while
// document layout is still happening.
void updateAfterLayout();
- void clampScrollPositionsAfterLayout();
+ void clampScrollOffsetsAfterLayout();
void updateAfterStyleChange(const ComputedStyle*);
void updateAfterOverflowRecalc();
@@ -380,7 +379,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
bool hitTestResizerInFragments(const PaintLayerFragments&,
const HitTestLocation&) const;
- // Returns the new position, after scrolling, of the given rect in absolute
+ // Returns the new offset, after scrolling, of the given rect in absolute
// coordinates, clipped by the parent's client rect.
LayoutRect scrollIntoView(const LayoutRect&,
const ScrollAlignment& alignX,
@@ -441,12 +440,10 @@ class CORE_EXPORT PaintLayerScrollableArea final
}
void resetRebuildScrollbarLayerFlags();
- // Did DelayScrollPositionClampScope prevent us from running clampScrollPositionsAfterLayout()
+ // Did DelayScrollOffsetClampScope prevent us from running clampScrollOffsetsAfterLayout()
// in updateAfterLayout()?
- bool needsScrollPositionClamp() const { return m_needsScrollPositionClamp; }
- void setNeedsScrollPositionClamp(bool val) {
- m_needsScrollPositionClamp = val;
- }
+ bool needsScrollOffsetClamp() const { return m_needsScrollOffsetClamp; }
+ void setNeedsScrollOffsetClamp(bool val) { m_needsScrollOffsetClamp = val; }
// Did PreventRelayoutScope prevent us from running re-layout due to adding/subtracting
// scrollbars in updateAfterLayout()?
@@ -496,7 +493,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
void updateScrollOrigin();
void updateScrollDimensions();
- void updateScrollPosition(const DoublePoint&, ScrollType) override;
+ void updateScrollOffset(const ScrollOffset&, ScrollType) override;
int verticalScrollbarStart(int minX, int maxX) const;
int horizontalScrollbarStart(int minX) const;
@@ -544,7 +541,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
unsigned m_rebuildHorizontalScrollbarLayer : 1;
unsigned m_rebuildVerticalScrollbarLayer : 1;
- unsigned m_needsScrollPositionClamp : 1;
+ unsigned m_needsScrollOffsetClamp : 1;
unsigned m_needsRelayout : 1;
unsigned m_hadHorizontalScrollbarBeforeRelayout : 1;
unsigned m_hadVerticalScrollbarBeforeRelayout : 1;
@@ -558,8 +555,8 @@ class CORE_EXPORT PaintLayerScrollableArea final
// ScrollbarManager holds the Scrollbar instances.
ScrollbarManager m_scrollbarManager;
- // This is the absolute scroll position, *not* relative to m_scrollOrigin.
- DoubleSize m_scrollPosition;
+ // This is the offset from the beginning of content flow.
+ ScrollOffset m_scrollOffset;
IntPoint m_cachedOverlayScrollbarOffset;

Powered by Google App Engine
This is Rietveld 408576698