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

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2484563003: Determine the layoutobject of middleClickAutoscroll by the scroll direction. (Closed)
Patch Set: Better tests. 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/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 8098447905d670f11e408c344c4b703a729d2ba7..eb30a1a12e65c1efdbf7d0520acc10500b031165 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -2171,11 +2171,17 @@ void Node::defaultEventHandler(Event* event) {
// LayoutTextControlSingleLine::scrollHeight
document().updateStyleAndLayoutIgnorePendingStylesheets();
LayoutObject* layoutObject = this->layoutObject();
- while (layoutObject &&
- (!layoutObject->isBox() ||
- !toLayoutBox(layoutObject)->canBeScrolledAndHasScrollableArea()))
- layoutObject = layoutObject->parent();
-
+ while (
+ layoutObject &&
+ (!layoutObject->isBox() ||
+ !toLayoutBox(layoutObject)->canBeScrolledAndHasScrollableArea())) {
+ if (layoutObject->node() && layoutObject->node()->isDocumentNode()) {
+ Element* owner = toDocument(layoutObject->node())->localOwner();
+ layoutObject = owner ? owner->layoutObject() : nullptr;
+ } else {
+ layoutObject = layoutObject->parent();
+ }
+ }
if (layoutObject) {
if (LocalFrame* frame = document().frame())
frame->eventHandler().startMiddleClickAutoscroll(layoutObject);

Powered by Google App Engine
This is Rietveld 408576698