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..0bd73b2f0a8b9761ce9b7fa75b10874f27006816 100644 |
| --- a/Source/core/platform/ScrollableArea.cpp |
| +++ b/Source/core/platform/ScrollableArea.cpp |
| @@ -94,24 +94,38 @@ bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granula |
| scrollbar = horizontalScrollbar(); |
| } |
| - if (!scrollbar) |
| + if (!isScrollable(orientation)) |
| return false; |
| float step = 0; |
| - switch (granularity) { |
| - case ScrollByLine: |
| - step = scrollbar->lineStep(); |
| - break; |
| - case ScrollByPage: |
| - step = scrollbar->pageStep(); |
| - break; |
| - case ScrollByDocument: |
| - step = scrollbar->totalSize(); |
| - break; |
| - case ScrollByPixel: |
| - case ScrollByPrecisePixel: |
| - step = scrollbar->pixelStep(); |
| - break; |
| + |
| + if (scrollbar) { |
| + switch (granularity) { |
| + case ScrollByLine: |
| + step = scrollbar->lineStep(); |
| + break; |
| + case ScrollByPage: |
| + step = scrollbar->pageStep(); |
| + break; |
| + case ScrollByDocument: |
| + step = scrollbar->totalSize(); |
| + break; |
| + case ScrollByPixel: |
| + case ScrollByPrecisePixel: |
| + step = scrollbar->pixelStep(); |
| + break; |
| + } |
| + } else { |
| + // TODO: Where should we get the step sizes here? |
|
aelias_OOO_until_Jul13
2013/06/18 00:54:47
It looks like the step sizes should be moved out o
bokan
2013/06/18 23:03:27
Done, though ScrollableArea has a compile time ass
aelias_OOO_until_Jul13
2013/06/19 02:55:24
Ah, no, that's not okay, sorry about that suggesti
bokan
2013/06/19 18:57:00
Done.
|
| + switch (granularity) { |
| + case ScrollByLine: |
| + case ScrollByPage: |
| + case ScrollByDocument: |
| + case ScrollByPixel: |
| + case ScrollByPrecisePixel: |
| + step = 1.0f; |
| + break; |
| + } |
| } |
| if (direction == ScrollUp || direction == ScrollLeft) |
| @@ -364,13 +378,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(); |