Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| index 6d5b7a1d6413667c0cf6b8b610cbe2324d75243e..1ddc3e7c2e6c48332b8b2ac4a6b84344ce7f13f3 100644 |
| --- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| +++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp |
| @@ -60,9 +60,12 @@ struct SameSizeAsScrollableArea { |
| static_assert(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), "ScrollableArea should stay small"); |
| -int ScrollableArea::pixelsPerLineStep() |
| +int ScrollableArea::pixelsPerLineStep(HostWindow* host) |
| { |
| - return kPixelsPerLineStep; |
| + if (!host) |
| + return kPixelsPerLineStep; |
| + FloatRect tmpRectInViewport = host->windowToViewport(FloatRect(1, 0, 0, 0)); |
|
skobes
2016/02/09 23:42:32
Can we introduce a clearer API that doesn't use re
oshima
2016/02/16 06:09:53
I was asked to either made this symmetric to viewp
|
| + return kPixelsPerLineStep * tmpRectInViewport.x(); |
| } |
| float ScrollableArea::minFractionToStepWhenPaging() |
| @@ -566,7 +569,7 @@ DoublePoint ScrollableArea::clampScrollPosition(const DoublePoint& scrollPositio |
| int ScrollableArea::lineStep(ScrollbarOrientation) const |
| { |
| - return pixelsPerLineStep(); |
| + return pixelsPerLineStep(hostWindow()); |
| } |
| int ScrollableArea::pageStep(ScrollbarOrientation orientation) const |
| @@ -586,6 +589,8 @@ int ScrollableArea::documentStep(ScrollbarOrientation orientation) const |
| float ScrollableArea::pixelStep(ScrollbarOrientation) const |
| { |
| + if (HostWindow* window = hostWindow()) |
| + return window->windowToViewport(FloatRect(1, 0, 0, 0)).x(); |
| return 1; |
| } |