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

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

Issue 2387393003: Revert of Refactor ScrollableArea::setScrollPosition. (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 38921fb6fea0b5796e5a0bbc80b01c473cd4abc7..7f1f1ea597075844a9a3a614a7a1dc63580c6326 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -310,29 +310,50 @@
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) {
- ScrollableArea::setScrollPosition(-scrollOrigin() + scrollOffset,
- scrollType, scrollBehavior);
+ 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);
}
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 setScrollPositionUnconditionally(const DoublePoint&,
- ScrollType = ProgrammaticScroll);
+ scrollToOffset(toDoubleSize(position), ScrollOffsetClamped, scrollBehavior,
+ scrollType);
+ }
// 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
@@ -375,7 +396,7 @@
OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
DoubleSize adjustedScrollOffset() const {
- return toDoubleSize(DoublePoint(scrollOrigin()) + m_scrollOffset);
+ return DoubleSize(scrollXOffset(), scrollYOffset());
}
void positionOverflowControls();

Powered by Google App Engine
This is Rietveld 408576698