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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: rebase 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 38921fb6fea0b5796e5a0bbc80b01c473cd4abc7..8f7bb27588f9bf2b043230094be6efc00fc6a875 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;
@@ -310,24 +310,20 @@ class CORE_EXPORT PaintLayerScrollableArea final
ScrollBehavior scrollBehaviorStyle() const override;
CompositorAnimationTimeline* compositorAnimationTimeline() const override;
- DoubleSize scrollOffset() const { return m_scrollOffset; }
-
// FIXME: We shouldn't allow access to m_overflowRect outside this class.
LayoutRect overflowRect() const { return m_overflowRect; }
- void scrollToOffset(const DoubleSize& scrollOffset,
- ScrollBehavior scrollBehavior = ScrollBehaviorInstant,
- ScrollType scrollType = ProgrammaticScroll) {
- ScrollableArea::setScrollPosition(-scrollOrigin() + scrollOffset,
- scrollType, scrollBehavior);
+ void scrollToAbsolutePosition(
+ const FloatPoint& position,
+ ScrollBehavior scrollBehavior = ScrollBehaviorInstant,
+ ScrollType scrollType = ProgrammaticScroll) {
+ setScrollOffset(position - scrollOrigin(), scrollType, scrollBehavior);
}
- void setScrollPosition(
- const DoublePoint& position,
- ScrollType scrollType,
- ScrollBehavior scrollBehavior = ScrollBehaviorInstant) override {
- scrollToOffset(toDoubleSize(position), scrollBehavior, scrollType);
- }
+ // 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 setScrollOffsetUnconditionally(const ScrollOffset&,
+ ScrollType = ProgrammaticScroll);
// This will set the scroll position without clamping, and it will do all
// post-update work even if the scroll position didn't change.
@@ -338,7 +334,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
// 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();
@@ -389,7 +385,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,
@@ -450,12 +446,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()?
@@ -505,7 +499,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
void updateScrollOrigin();
void updateScrollDimensions();
- void setScrollOffset(const DoublePoint&, ScrollType) override;
+ void updateScrollOffset(const ScrollOffset&, ScrollType) override;
int verticalScrollbarStart(int minX, int maxX) const;
int horizontalScrollbarStart(int minX) const;
@@ -553,7 +547,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;
@@ -567,8 +561,8 @@ class CORE_EXPORT PaintLayerScrollableArea final
// ScrollbarManager holds the Scrollbar instances.
ScrollbarManager m_scrollbarManager;
- // This is the (scroll) offset from scrollOrigin().
- DoubleSize m_scrollOffset;
+ // 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