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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp

Issue 1738243002: Removed main-thread one dimensional scrolling paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removeStepFromUserScroll
Patch Set: Removed TODO that was already fixed Created 4 years, 10 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/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 250f367fa21b335a07803e0e95c4c3c8ce90180e..84770d2f3f086850c1936132aa4949576994ac0e 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -157,20 +157,25 @@ float ScrollableArea::scrollStep(ScrollGranularity granularity, ScrollbarOrienta
}
}
-ScrollResultOneDimensional ScrollableArea::userScroll(ScrollDirectionPhysical direction, ScrollGranularity granularity, float delta)
+ScrollResult ScrollableArea::userScroll(ScrollGranularity granularity, const FloatSize& delta)
{
- ScrollbarOrientation orientation = scrollbarOrientationFromDirection(direction);
- if (!userInputScrollable(orientation))
- return ScrollResultOneDimensional(false, delta);
+ float stepX = scrollStep(granularity, HorizontalScrollbar);
+ float stepY = scrollStep(granularity, VerticalScrollbar);
- cancelProgrammaticScrollAnimation();
+ FloatSize pixelDelta(delta);
+ pixelDelta.scale(stepX, stepY);
+
+ if (!userInputScrollable(HorizontalScrollbar))
+ pixelDelta.setWidth(0);
+ if (!userInputScrollable(VerticalScrollbar))
+ pixelDelta.setHeight(0);
- float step = scrollStep(granularity, orientation);
+ if (pixelDelta.isZero())
+ return ScrollResult(false, false, delta.width(), delta.height());
- if (direction == ScrollUp || direction == ScrollLeft)
- delta = -delta;
+ cancelProgrammaticScrollAnimation();
- return scrollAnimator().userScroll(orientation, granularity, step * delta);
+ return scrollAnimator().userScroll(granularity, pixelDelta);
}
void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollType scrollType, ScrollBehavior behavior)

Powered by Google App Engine
This is Rietveld 408576698