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

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

Issue 2383113003: Refactor ScrollableArea::setScrollPosition. (Closed)
Patch Set: nits and 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 7f1f1ea597075844a9a3a614a7a1dc63580c6326..38921fb6fea0b5796e5a0bbc80b01c473cd4abc7 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -310,51 +310,30 @@ class CORE_EXPORT PaintLayerScrollableArea final
ScrollBehavior scrollBehaviorStyle() const override;
CompositorAnimationTimeline* compositorAnimationTimeline() const override;
- double scrollXOffset() const {
- return m_scrollOffset.width() + scrollOrigin().x();
- }
- double scrollYOffset() const {
- return m_scrollOffset.height() + scrollOrigin().y();
- }
-
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 scrollToPosition(const DoublePoint& scrollPosition,
- ScrollOffsetClamping = ScrollOffsetUnclamped,
- ScrollBehavior = ScrollBehaviorInstant,
- ScrollType = ProgrammaticScroll);
-
void scrollToOffset(const DoubleSize& scrollOffset,
- ScrollOffsetClamping clamp = ScrollOffsetUnclamped,
ScrollBehavior scrollBehavior = ScrollBehaviorInstant,
ScrollType scrollType = ProgrammaticScroll) {
- scrollToPosition(-scrollOrigin() + scrollOffset, clamp, scrollBehavior,
- scrollType);
- }
-
- void scrollToXOffset(double x,
- ScrollOffsetClamping clamp = ScrollOffsetUnclamped,
- ScrollBehavior scrollBehavior = ScrollBehaviorInstant) {
- scrollToOffset(DoubleSize(x, scrollYOffset()), clamp, scrollBehavior);
- }
-
- void scrollToYOffset(double y,
- ScrollOffsetClamping clamp = ScrollOffsetUnclamped,
- ScrollBehavior scrollBehavior = ScrollBehaviorInstant) {
- scrollToOffset(DoubleSize(scrollXOffset(), y), clamp, scrollBehavior);
+ ScrollableArea::setScrollPosition(-scrollOrigin() + scrollOffset,
+ scrollType, scrollBehavior);
}
void setScrollPosition(
const DoublePoint& position,
ScrollType scrollType,
ScrollBehavior scrollBehavior = ScrollBehaviorInstant) override {
- scrollToOffset(toDoubleSize(position), ScrollOffsetClamped, scrollBehavior,
- scrollType);
+ 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 setScrollPositionUnconditionally(const DoublePoint&,
+ 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.
@@ -396,7 +375,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
DoubleSize adjustedScrollOffset() const {
- return DoubleSize(scrollXOffset(), scrollYOffset());
+ return toDoubleSize(DoublePoint(scrollOrigin()) + m_scrollOffset);
}
void positionOverflowControls();

Powered by Google App Engine
This is Rietveld 408576698