Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| index c2506d5401a4a1841e96e1dbba5957325c013a08..82484a831d496118a4087a73fda62b14b3536b09 100644 |
| --- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| +++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| @@ -178,22 +178,28 @@ ScrollResult ScrollableArea::userScroll(ScrollGranularity granularity, |
| void ScrollableArea::setScrollPosition(const DoublePoint& position, |
| ScrollType scrollType, |
| ScrollBehavior behavior) { |
| + DoublePoint clampedPosition = clampScrollPosition(position); |
| + if (shouldUseIntegerScrollOffset()) |
| + clampedPosition = flooredIntPoint(clampedPosition); |
| + if (clampedPosition == scrollPositionDouble()) |
| + return; |
| + |
| if (behavior == ScrollBehaviorAuto) |
| behavior = scrollBehaviorStyle(); |
| switch (scrollType) { |
| case CompositorScroll: |
| - scrollPositionChanged(clampScrollPosition(position), scrollType); |
| + scrollPositionChanged(clampedPosition, scrollType); |
| break; |
| case AnchoringScroll: |
| - scrollAnimator().adjustAnimationAndSetScrollPosition(position, |
| + scrollAnimator().adjustAnimationAndSetScrollPosition(clampedPosition, |
|
bokan
2016/10/01 20:32:47
I think you can remove the clamps in ScrollAnimato
szager1
2016/10/02 19:35:28
Done.
|
| scrollType); |
| break; |
| case ProgrammaticScroll: |
| - programmaticScrollHelper(position, behavior); |
| + programmaticScrollHelper(clampedPosition, behavior); |
| break; |
| case UserScroll: |
| - userScrollHelper(position, behavior); |
| + userScrollHelper(clampedPosition, behavior); |
| break; |
| default: |
| ASSERT_NOT_REACHED(); |
| @@ -271,7 +277,7 @@ void ScrollableArea::scrollPositionChanged(const DoublePoint& position, |
| shouldUseIntegerScrollOffset() ? flooredIntPoint(position) : position; |
| // Tell the derived class to scroll its contents. |
| - setScrollOffset(truncatedPosition, scrollType); |
| + updateScrollPosition(truncatedPosition, scrollType); |
| // Tell the scrollbars to update their thumb postions. |
| // If the scrollbar does not have its own layer, it must always be |
| @@ -306,8 +312,9 @@ bool ScrollableArea::scrollBehaviorFromString(const String& behaviorString, |
| } |
| // NOTE: Only called from Internals for testing. |
| -void ScrollableArea::setScrollOffsetFromInternals(const IntPoint& offset) { |
| - scrollPositionChanged(DoublePoint(offset), ProgrammaticScroll); |
| +void ScrollableArea::updateScrollPositionFromInternals( |
| + const IntPoint& position) { |
| + scrollPositionChanged(DoublePoint(position), ProgrammaticScroll); |
| } |
| void ScrollableArea::contentAreaWillPaint() const { |