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

Unified Diff: Source/web/ScrollbarGroup.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/web/ScrollbarGroup.h ('k') | Source/web/WebPluginScrollbarImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/ScrollbarGroup.cpp
diff --git a/Source/web/ScrollbarGroup.cpp b/Source/web/ScrollbarGroup.cpp
index 3fa766eb82ec47b613fa053f8b428a105ef5bd5e..f44ec53d67af4d33f50ec5c4575114ebedd6ea9f 100644
--- a/Source/web/ScrollbarGroup.cpp
+++ b/Source/web/ScrollbarGroup.cpp
@@ -100,14 +100,6 @@ int ScrollbarGroup::scrollSize(WebCore::ScrollbarOrientation orientation) const
return scrollbar->totalSize() - scrollbar->visibleSize();
}
-int ScrollbarGroup::scrollPosition(Scrollbar* scrollbar) const
-{
- WebPluginScrollbarImpl* webScrollbar = scrollbar->orientation() == HorizontalScrollbar ? m_horizontalScrollbar : m_verticalScrollbar;
- if (!webScrollbar)
- return 0;
- return webScrollbar->scrollOffset();
-}
-
void ScrollbarGroup::setScrollOffset(const IntPoint& offset)
{
if (m_horizontalScrollbar && m_horizontalScrollbar->scrollOffset() != offset.x())
@@ -268,4 +260,31 @@ bool ScrollbarGroup::scrollbarsCanBeActive() const
return true;
}
+bool ScrollbarGroup::userInputScrollable(ScrollbarOrientation orientation) const
+{
+ return orientation == HorizontalScrollbar ? horizontalScrollbar() : verticalScrollbar();
+}
+
+int ScrollbarGroup::pageStep(ScrollbarOrientation orientation) const
+{
+ int length;
+ if (orientation == VerticalScrollbar) {
+ if (!m_verticalScrollbar)
+ return 0;
+
+ length = m_verticalScrollbar->scrollbar()->height();
+ } else {
+ if (!m_horizontalScrollbar)
+ return 0;
+
+ length = m_horizontalScrollbar->scrollbar()->width();
+ }
+
+ int pageStep = std::max(
+ static_cast<int>(static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging()),
+ length - ScrollableArea::maxOverlapBetweenPages());
+
+ return std::max(pageStep, 1);
+}
+
} // namespace WebKit
« no previous file with comments | « Source/web/ScrollbarGroup.h ('k') | Source/web/WebPluginScrollbarImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698