Chromium Code Reviews| Index: Source/platform/scroll/ScrollAnimator.cpp |
| diff --git a/Source/platform/scroll/ScrollAnimator.cpp b/Source/platform/scroll/ScrollAnimator.cpp |
| index 0f9fafd0f2ff09292baff98683783bfc9fd0ef2b..bfcdc9704c301d187c292b89906c53f19d9c445a 100644 |
| --- a/Source/platform/scroll/ScrollAnimator.cpp |
| +++ b/Source/platform/scroll/ScrollAnimator.cpp |
| @@ -94,49 +94,44 @@ ScrollResult ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e) |
| 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; |
| - } |
| + result.didScrollX = (deltaX < 0 && maxForwardScrollDelta.width() > 0) || (deltaX > 0 && maxBackwardScrollDelta.width() > 0); |
| + result.didScrollY = (deltaY < 0 && maxForwardScrollDelta.height() > 0) || (deltaY > 0 && maxBackwardScrollDelta.height() > 0); |
|
bokan
2015/06/23 16:20:45
Since we're going to try to scroll now anyways, it
MuVen
2015/06/25 12:55:51
Done.
|
| + |
| + 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); |
| + |
| + 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); |
| + |
| + if (e.granularity() != ScrollByPageWheelEvent) { |
| + if (resultX.didScroll) |
| + result.unusedScrollDeltaX = -resultX.unusedScrollDelta; |
| + else |
| + result.unusedScrollDeltaX = deltaX; |
| } |
| } |