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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 void scrollbarVisibilityChanged() override; 303 void scrollbarVisibilityChanged() override;
304 IntRect scrollableAreaBoundingBox() const override; 304 IntRect scrollableAreaBoundingBox() const override;
305 void registerForAnimation() override; 305 void registerForAnimation() override;
306 void deregisterForAnimation() override; 306 void deregisterForAnimation() override;
307 bool userInputScrollable(ScrollbarOrientation) const override; 307 bool userInputScrollable(ScrollbarOrientation) const override;
308 bool shouldPlaceVerticalScrollbarOnLeft() const override; 308 bool shouldPlaceVerticalScrollbarOnLeft() const override;
309 int pageStep(ScrollbarOrientation) const override; 309 int pageStep(ScrollbarOrientation) const override;
310 ScrollBehavior scrollBehaviorStyle() const override; 310 ScrollBehavior scrollBehaviorStyle() const override;
311 CompositorAnimationTimeline* compositorAnimationTimeline() const override; 311 CompositorAnimationTimeline* compositorAnimationTimeline() const override;
312 312
313 double scrollXOffset() const {
314 return m_scrollOffset.width() + scrollOrigin().x();
315 }
316 double scrollYOffset() const {
317 return m_scrollOffset.height() + scrollOrigin().y();
318 }
319
313 DoubleSize scrollOffset() const { return m_scrollOffset; } 320 DoubleSize scrollOffset() const { return m_scrollOffset; }
314 321
315 // FIXME: We shouldn't allow access to m_overflowRect outside this class. 322 // FIXME: We shouldn't allow access to m_overflowRect outside this class.
316 LayoutRect overflowRect() const { return m_overflowRect; } 323 LayoutRect overflowRect() const { return m_overflowRect; }
317 324
325 void scrollToPosition(const DoublePoint& scrollPosition,
326 ScrollOffsetClamping = ScrollOffsetUnclamped,
327 ScrollBehavior = ScrollBehaviorInstant,
328 ScrollType = ProgrammaticScroll);
329
318 void scrollToOffset(const DoubleSize& scrollOffset, 330 void scrollToOffset(const DoubleSize& scrollOffset,
331 ScrollOffsetClamping clamp = ScrollOffsetUnclamped,
319 ScrollBehavior scrollBehavior = ScrollBehaviorInstant, 332 ScrollBehavior scrollBehavior = ScrollBehaviorInstant,
320 ScrollType scrollType = ProgrammaticScroll) { 333 ScrollType scrollType = ProgrammaticScroll) {
321 ScrollableArea::setScrollPosition(-scrollOrigin() + scrollOffset, 334 scrollToPosition(-scrollOrigin() + scrollOffset, clamp, scrollBehavior,
322 scrollType, scrollBehavior); 335 scrollType);
336 }
337
338 void scrollToXOffset(double x,
339 ScrollOffsetClamping clamp = ScrollOffsetUnclamped,
340 ScrollBehavior scrollBehavior = ScrollBehaviorInstant) {
341 scrollToOffset(DoubleSize(x, scrollYOffset()), clamp, scrollBehavior);
342 }
343
344 void scrollToYOffset(double y,
345 ScrollOffsetClamping clamp = ScrollOffsetUnclamped,
346 ScrollBehavior scrollBehavior = ScrollBehaviorInstant) {
347 scrollToOffset(DoubleSize(scrollXOffset(), y), clamp, scrollBehavior);
323 } 348 }
324 349
325 void setScrollPosition( 350 void setScrollPosition(
326 const DoublePoint& position, 351 const DoublePoint& position,
327 ScrollType scrollType, 352 ScrollType scrollType,
328 ScrollBehavior scrollBehavior = ScrollBehaviorInstant) override { 353 ScrollBehavior scrollBehavior = ScrollBehaviorInstant) override {
329 scrollToOffset(toDoubleSize(position), scrollBehavior, scrollType); 354 scrollToOffset(toDoubleSize(position), ScrollOffsetClamped, scrollBehavior,
355 scrollType);
330 } 356 }
331 357
332 // This will set the scroll position without clamping, and it will do all
333 // post-update work even if the scroll position didn't change.
334 void setScrollPositionUnconditionally(const DoublePoint&,
335 ScrollType = ProgrammaticScroll);
336
337 // TODO(szager): Actually run these after all of layout is finished. Currentl y, they 358 // TODO(szager): Actually run these after all of layout is finished. Currentl y, they
338 // run at the end of box()'es layout (or after all flexbox layout has finished ) but while 359 // run at the end of box()'es layout (or after all flexbox layout has finished ) but while
339 // document layout is still happening. 360 // document layout is still happening.
340 void updateAfterLayout(); 361 void updateAfterLayout();
341 void clampScrollPositionsAfterLayout(); 362 void clampScrollPositionsAfterLayout();
342 363
343 void updateAfterStyleChange(const ComputedStyle*); 364 void updateAfterStyleChange(const ComputedStyle*);
344 void updateAfterOverflowRecalc(); 365 void updateAfterOverflowRecalc();
345 366
346 bool updateAfterCompositingChange() override; 367 bool updateAfterCompositingChange() override;
(...skipping 21 matching lines...) Expand all
368 LayoutUnit scrollHeight() const; 389 LayoutUnit scrollHeight() const;
369 int pixelSnappedScrollWidth() const; 390 int pixelSnappedScrollWidth() const;
370 int pixelSnappedScrollHeight() const; 391 int pixelSnappedScrollHeight() const;
371 392
372 int verticalScrollbarWidth( 393 int verticalScrollbarWidth(
373 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const; 394 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
374 int horizontalScrollbarHeight( 395 int horizontalScrollbarHeight(
375 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const; 396 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
376 397
377 DoubleSize adjustedScrollOffset() const { 398 DoubleSize adjustedScrollOffset() const {
378 return toDoubleSize(DoublePoint(scrollOrigin()) + m_scrollOffset); 399 return DoubleSize(scrollXOffset(), scrollYOffset());
379 } 400 }
380 401
381 void positionOverflowControls(); 402 void positionOverflowControls();
382 403
383 // isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control 404 // isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control
384 // area. 405 // area.
385 bool isPointInResizeControl(const IntPoint& absolutePoint, 406 bool isPointInResizeControl(const IntPoint& absolutePoint,
386 ResizerHitTestType) const; 407 ResizerHitTestType) const;
387 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); 408 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
388 409
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 610
590 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, 611 DEFINE_TYPE_CASTS(PaintLayerScrollableArea,
591 ScrollableArea, 612 ScrollableArea,
592 scrollableArea, 613 scrollableArea,
593 scrollableArea->isPaintLayerScrollableArea(), 614 scrollableArea->isPaintLayerScrollableArea(),
594 scrollableArea.isPaintLayerScrollableArea()); 615 scrollableArea.isPaintLayerScrollableArea());
595 616
596 } // namespace blink 617 } // namespace blink
597 618
598 #endif // LayerScrollableArea_h 619 #endif // LayerScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698