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

Unified Diff: Source/platform/scroll/ScrollAnimator.cpp

Issue 1195803003: Report accurate Overscroll on handleWheel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed unittest failures Created 5 years, 6 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
« no previous file with comments | « Source/core/input/EventHandler.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollAnimator.cpp
diff --git a/Source/platform/scroll/ScrollAnimator.cpp b/Source/platform/scroll/ScrollAnimator.cpp
index 0f9fafd0f2ff09292baff98683783bfc9fd0ef2b..91bece5f83cf7b1eedecf4afba18e50cdf6fe9cf 100644
--- a/Source/platform/scroll/ScrollAnimator.cpp
+++ b/Source/platform/scroll/ScrollAnimator.cpp
@@ -92,54 +92,43 @@ ScrollResult ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
ScrollGranularity granularity = ScrollByPixel;
#endif
- IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition();
- IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scrollableArea->minimumScrollPosition();
- if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
- || (deltaX > 0 && maxBackwardScrollDelta.width() > 0))
- result.didScrollX = true;
- if ((deltaY < 0 && maxForwardScrollDelta.height() > 0)
- || (deltaY > 0 && maxBackwardScrollDelta.height() > 0))
- result.didScrollY = true;
- if (result.didScroll()) {
- if (deltaY) {
- if (e.granularity() == ScrollByPageWheelEvent) {
- bool negative = deltaY < 0;
- deltaY = m_scrollableArea->pageStep(VerticalScrollbar);
- if (negative)
- deltaY = -deltaY;
- }
-
- ScrollResultOneDimensional resultY = userScroll(
- VerticalScrollbar, granularity, m_scrollableArea->pixelStep(VerticalScrollbar), -deltaY);
-
- if (e.granularity() != ScrollByPageWheelEvent) {
- if (resultY.didScroll)
- result.unusedScrollDeltaY = -resultY.unusedScrollDelta;
- else
- result.unusedScrollDeltaY = deltaY;
- }
+ if (deltaY) {
+ if (e.granularity() == ScrollByPageWheelEvent) {
+ bool negative = deltaY < 0;
+ deltaY = m_scrollableArea->pageStep(VerticalScrollbar);
+ if (negative)
+ deltaY = -deltaY;
}
- if (deltaX) {
- if (e.granularity() == ScrollByPageWheelEvent) {
- bool negative = deltaX < 0;
- deltaX = m_scrollableArea->pageStep(HorizontalScrollbar);
- if (negative)
- deltaX = -deltaX;
- }
-
- ScrollResultOneDimensional resultX = userScroll(
- HorizontalScrollbar, granularity, m_scrollableArea->pixelStep(HorizontalScrollbar), -deltaX);
-
- if (e.granularity() != ScrollByPageWheelEvent) {
- if (resultX.didScroll)
- result.unusedScrollDeltaX = -resultX.unusedScrollDelta;
- else
- result.unusedScrollDeltaX = deltaX;
- }
+ ScrollResultOneDimensional resultY = userScroll(
+ VerticalScrollbar, granularity, m_scrollableArea->pixelStep(VerticalScrollbar), -deltaY);
+ result.didScrollY = resultY.didScroll;
+ if (e.granularity() != ScrollByPageWheelEvent) {
+ if (resultY.didScroll)
+ result.unusedScrollDeltaY = -resultY.unusedScrollDelta;
+ else
+ result.unusedScrollDeltaY = deltaY;
}
}
+ if (deltaX) {
+ if (e.granularity() == ScrollByPageWheelEvent) {
+ bool negative = deltaX < 0;
+ deltaX = m_scrollableArea->pageStep(HorizontalScrollbar);
+ if (negative)
+ deltaX = -deltaX;
+ }
+
+ ScrollResultOneDimensional resultX = userScroll(
+ HorizontalScrollbar, granularity, m_scrollableArea->pixelStep(HorizontalScrollbar), -deltaX);
+ result.didScrollX = resultX.didScroll;
+ if (e.granularity() != ScrollByPageWheelEvent) {
+ if (resultX.didScroll)
+ result.unusedScrollDeltaX = -resultX.unusedScrollDelta;
+ else
+ result.unusedScrollDeltaX = deltaX;
+ }
+ }
return result;
}
« no previous file with comments | « Source/core/input/EventHandler.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698