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

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

Issue 16982005: Allow objects without scrollbars to be scrollable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: CR fixes Created 7 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
Index: Source/core/platform/ScrollableArea.cpp
diff --git a/Source/core/platform/ScrollableArea.cpp b/Source/core/platform/ScrollableArea.cpp
index 0f02cf04bc2b3ff3a325ea00e11de5e29b5a5752..c2e6f3c60d461f1e9fec9aa094be7aeec37659b2 100644
--- a/Source/core/platform/ScrollableArea.cpp
+++ b/Source/core/platform/ScrollableArea.cpp
@@ -52,6 +52,12 @@ struct SameSizeAsScrollableArea {
COMPILE_ASSERT(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), ScrollableArea_should_stay_small);
+int ScrollableArea::maxOverlapBetweenPages()
+{
+ static int maxOverlapBetweenPages = ScrollbarTheme::theme()->maxOverlapBetweenPages();
+ return maxOverlapBetweenPages;
+}
+
ScrollableArea::ScrollableArea()
: m_constrainsScrollingToContentEdge(true)
, m_inLiveResize(false)
@@ -85,32 +91,29 @@ void ScrollableArea::setScrollOrigin(const IntPoint& origin)
bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
{
ScrollbarOrientation orientation;
- Scrollbar* scrollbar;
- if (direction == ScrollUp || direction == ScrollDown) {
+
+ if (direction == ScrollUp || direction == ScrollDown)
orientation = VerticalScrollbar;
- scrollbar = verticalScrollbar();
- } else {
+ else
orientation = HorizontalScrollbar;
- scrollbar = horizontalScrollbar();
- }
- if (!scrollbar)
+ if (!userInputScrollable(orientation))
return false;
float step = 0;
switch (granularity) {
case ScrollByLine:
- step = scrollbar->lineStep();
+ step = lineStep(orientation);
break;
case ScrollByPage:
- step = scrollbar->pageStep();
+ step = pageStep(orientation);
break;
case ScrollByDocument:
- step = scrollbar->totalSize();
+ step = documentStep(orientation);
break;
case ScrollByPixel:
case ScrollByPrecisePixel:
- step = scrollbar->pixelStep();
+ step = pixelStep(orientation);
break;
}
@@ -364,13 +367,6 @@ void ScrollableArea::serviceScrollAnimations()
scrollAnimator->serviceScrollAnimations();
}
-IntPoint ScrollableArea::scrollPosition() const
-{
- int x = horizontalScrollbar() ? horizontalScrollbar()->value() : 0;
- int y = verticalScrollbar() ? verticalScrollbar()->value() : 0;
- return IntPoint(x, y);
-}
-
IntPoint ScrollableArea::minimumScrollPosition() const
bokan 2013/06/20 19:00:16 Shouldn't the default min/maxScrollPositions here
trchen 2013/06/20 19:25:34 Yes. Better if we can make them pure virtual. ;)
{
return IntPoint();
@@ -410,4 +406,19 @@ void ScrollableArea::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_scrollAnimator, "scrollAnimator");
}
+int ScrollableArea::lineStep(ScrollbarOrientation) const
+{
+ return pixelsPerLineStep();
+}
+
+int ScrollableArea::documentStep(ScrollbarOrientation orientation) const
+{
+ return scrollSize(orientation);
+}
+
+float ScrollableArea::pixelStep(ScrollbarOrientation) const
+{
+ return 1.0f;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698