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

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

Issue 2784313002: Change hittest node to be scrollbar's parent when hittest include a scrollbar (Closed)
Patch Set: mustaq comments addressed Created 3 years, 8 months 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/LayoutView.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp
index 374293e898c154a038231f87d6e7e1010b63b406..59c75cbe0e324afc92cc8ba8606c96dfa8f1e5b6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutView.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -155,6 +155,23 @@ bool LayoutView::hitTestNoLifecycleUpdate(HitTestResult& result) {
frameView()->scrollbarAtFramePoint(framePoint))
result.setScrollbar(frameScrollbar);
+ // If hitTestResult include scrollbar, innerNode should be the parent of the
+ // scrollbar.
+ if (result.scrollbar()) {
+ // Clear innerNode if we hit a scrollbar whose ScrollableArea isn't
+ // associated with a LayoutBox so we aren't hitting some random element
+ // below too.
+ result.setInnerNode(nullptr);
+ result.setURLElement(nullptr);
+ ScrollableArea* scrollableArea = result.scrollbar()->getScrollableArea();
+ if (scrollableArea && scrollableArea->layoutBox() &&
+ scrollableArea->layoutBox()->node()) {
+ Node* node = scrollableArea->layoutBox()->node();
+ result.setInnerNode(node);
+ result.setURLElement(node->enclosingLinkEventParentOrSelf());
+ }
+ }
+
if (hitLayer)
m_hitTestCache->addCachedResult(result, domTreeVersion);
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/HitTestResult.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698