Chromium Code Reviews| Index: Source/core/platform/ScrollableArea.cpp |
| diff --git a/Source/core/platform/ScrollableArea.cpp b/Source/core/platform/ScrollableArea.cpp |
| index 0f02cf04bc2b3ff3a325ea00e11de5e29b5a5752..dd9ed26df88a09fe21763fcb4a26bfee4362b297 100644 |
| --- a/Source/core/platform/ScrollableArea.cpp |
| +++ b/Source/core/platform/ScrollableArea.cpp |
| @@ -52,6 +52,22 @@ struct SameSizeAsScrollableArea { |
| COMPILE_ASSERT(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), ScrollableArea_should_stay_small); |
| +int ScrollableArea::pixelsPerLineStep() |
| +{ |
| + return 40; |
| +} |
| + |
| +float ScrollableArea::minFractionToStepWhenPaging() |
| +{ |
| + return 0.875f; |
|
tdanderson
2013/07/15 23:17:44
I don't think the style guide explicitly mentions
bokan
2013/07/22 15:08:47
Done.
|
| +} |
| + |
| +int ScrollableArea::maxOverlapBetweenPages() |
| +{ |
| + static int maxOverlapBetweenPages = ScrollbarTheme::theme()->maxOverlapBetweenPages(); |
| + return maxOverlapBetweenPages; |
| +} |
| + |
| ScrollableArea::ScrollableArea() |
| : m_constrainsScrollingToContentEdge(true) |
| , m_inLiveResize(false) |
| @@ -85,32 +101,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,23 +377,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 |
| -{ |
| - return IntPoint(); |
| -} |
| - |
| -IntPoint ScrollableArea::maximumScrollPosition() const |
| -{ |
| - return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().height() - visibleHeight()); |
| -} |
| - |
| IntRect ScrollableArea::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const |
| { |
| int verticalScrollbarWidth = 0; |
| @@ -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; |
|
tdanderson
2013/07/15 23:17:44
The style guide says to omit the .0f since you're
bokan
2013/07/22 15:08:47
Done.
|
| +} |
| + |
| } // namespace WebCore |