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

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

Issue 16982005: Allow objects without scrollbars to be scrollable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed ScrollbarGroup pageStep Created 7 years, 5 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/page/SpatialNavigation.cpp ('k') | Source/core/platform/ScrollView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/ScrollAnimator.cpp
diff --git a/Source/core/platform/ScrollAnimator.cpp b/Source/core/platform/ScrollAnimator.cpp
index 29379130be7d08d38225d239c3c11ed3dccafbab..a503f6960af26313886728a769e045ea4c1fdda4 100644
--- a/Source/core/platform/ScrollAnimator.cpp
+++ b/Source/core/platform/ScrollAnimator.cpp
@@ -76,13 +76,13 @@ void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
{
- Scrollbar* horizontalScrollbar = m_scrollableArea->horizontalScrollbar();
- Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar();
+ bool canScrollX = m_scrollableArea->userInputScrollable(HorizontalScrollbar);
+ bool canScrollY = m_scrollableArea->userInputScrollable(VerticalScrollbar);
- // Accept the event if we have a scrollbar in that direction and can still
+ // Accept the event if we are scrollable in that direction and can still
// scroll any further.
- float deltaX = horizontalScrollbar ? e.deltaX() : 0;
- float deltaY = verticalScrollbar ? e.deltaY() : 0;
+ float deltaX = canScrollX ? e.deltaX() : 0;
+ float deltaY = canScrollY ? e.deltaY() : 0;
bool handled = false;
@@ -103,21 +103,23 @@ bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
if (deltaY) {
if (e.granularity() == ScrollByPageWheelEvent) {
bool negative = deltaY < 0;
- deltaY = max(max(static_cast<float>(m_scrollableArea->visibleHeight()) * Scrollbar::minFractionToStepWhenPaging(), static_cast<float>(m_scrollableArea->visibleHeight() - Scrollbar::maxOverlapBetweenPages())), 1.0f);
+ deltaY = m_scrollableArea->pageStep(VerticalScrollbar);
if (negative)
deltaY = -deltaY;
}
- scroll(VerticalScrollbar, granularity, verticalScrollbar->pixelStep(), -deltaY);
+
+ scroll(VerticalScrollbar, granularity, m_scrollableArea->pixelStep(VerticalScrollbar), -deltaY);
}
if (deltaX) {
if (e.granularity() == ScrollByPageWheelEvent) {
bool negative = deltaX < 0;
- deltaX = max(max(static_cast<float>(m_scrollableArea->visibleWidth()) * Scrollbar::minFractionToStepWhenPaging(), static_cast<float>(m_scrollableArea->visibleWidth() - Scrollbar::maxOverlapBetweenPages())), 1.0f);
+ deltaX = m_scrollableArea->pageStep(HorizontalScrollbar);
if (negative)
deltaX = -deltaX;
}
- scroll(HorizontalScrollbar, granularity, horizontalScrollbar->pixelStep(), -deltaX);
+
+ scroll(HorizontalScrollbar, granularity, m_scrollableArea->pixelStep(HorizontalScrollbar), -deltaX);
}
}
return handled;
« no previous file with comments | « Source/core/page/SpatialNavigation.cpp ('k') | Source/core/platform/ScrollView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698