Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| index eadfef9c82765fe03c6eccf06e10c2f8e1529a44..95dc7c430ea238ea7ac7313dbe2126a698c8004d 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| @@ -1083,7 +1083,36 @@ void LayoutBox::middleClickAutoscroll(const IntPoint& sourcePoint) { |
| if (abs(delta.height()) <= |
| AutoscrollController::noMiddleClickAutoscrollRadius) |
| delta.setHeight(0); |
| - scroll(ScrollByPixel, FloatSize(adjustedScrollDelta(delta))); |
| + ScrollResult result = |
| + scroll(ScrollByPixel, FloatSize(adjustedScrollDelta(delta))); |
| + AutoscrollController& autoscrollController = |
| + frame->page()->autoscrollController(); |
| + |
| + if (!delta.isZero() && !result.didScroll()) { |
|
bokan
2016/11/09 15:34:10
We should put all this logic inside AutoscrollCont
|
| + LayoutObject* layoutObject = this; |
| + if (node() && node()->isDocumentNode()) { |
| + Element* owner = toDocument(layoutObject->node())->localOwner(); |
| + layoutObject = owner ? owner->layoutObject() : nullptr; |
| + } else { |
| + layoutObject = parent(); |
| + } |
| + while (layoutObject && |
| + (!layoutObject->isBox() || |
| + !toLayoutBox(layoutObject)->canBeScrolledAndHasScrollableArea())) { |
| + if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { |
|
bokan
2016/11/09 15:34:10
This will just pick the next scroller up in the hi
|
| + Element* owner = toDocument(layoutObject->node())->localOwner(); |
| + layoutObject = owner ? owner->layoutObject() : nullptr; |
| + } else { |
| + layoutObject = layoutObject->parent(); |
| + } |
| + } |
| + if (autoscrollController.setMiddleClickAutoscrollLayoutObject( |
| + toLayoutBox(layoutObject))) { |
| + toLayoutBox(layoutObject)->middleClickAutoscroll(sourcePoint); |
| + } |
| + } else if (result.didScroll()) { |
| + autoscrollController.setMiddleClickAutoscrolled(true); |
| + } |
| } |
| void LayoutBox::scrollByRecursively(const ScrollOffset& delta) { |