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

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

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/paint/PaintLayerScrollableArea.h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
index 1912e6c3797b1e71edd403aa3f9521b19ab39d59..3dbebffcc004b8b14126ffbf7d94bd82c6775ae7 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -216,17 +216,17 @@ 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
+ // 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 DelayScrollPositionClampScope {
+ class DelayScrollOffsetClampScope {
STACK_ALLOCATED();
public:
- DelayScrollPositionClampScope();
- ~DelayScrollPositionClampScope();
+ DelayScrollOffsetClampScope();
+ ~DelayScrollOffsetClampScope();
static bool clampingIsDelayed() { return s_count; }
static void setNeedsClamp(PaintLayerScrollableArea*);
@@ -290,10 +290,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,24 +313,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.
@@ -341,7 +337,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
// 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();
@@ -392,7 +388,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,
@@ -455,13 +451,10 @@ class CORE_EXPORT PaintLayerScrollableArea final
}
void resetRebuildScrollbarLayerFlags();
- // Did DelayScrollPositionClampScope prevent us from running
- // clampScrollPositionsAfterLayout()
- // in updateAfterLayout()?
- bool needsScrollPositionClamp() const { return m_needsScrollPositionClamp; }
- void setNeedsScrollPositionClamp(bool val) {
- m_needsScrollPositionClamp = val;
- }
+ // Did DelayScrollOffsetClampScope prevent us from running
+ // clampScrollOffsetsAfterLayout() in updateAfterLayout()?
+ 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()?
@@ -511,7 +504,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;
@@ -560,7 +553,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;
@@ -574,8 +567,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