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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2484563003: Determine the layoutobject of middleClickAutoscroll by the scroll direction. (Closed)
Patch Set: Rename Created 4 years, 1 month 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: 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) {

Powered by Google App Engine
This is Rietveld 408576698