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

Unified Diff: Source/core/layout/LayoutPart.cpp

Issue 1302583002: Hit-test should not descend into iframe unnecessarily (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « LayoutTests/fast/events/hit-test-counts-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutPart.cpp
diff --git a/Source/core/layout/LayoutPart.cpp b/Source/core/layout/LayoutPart.cpp
index 3bd9e7fbba2e5aafaf2d74491450b2ac38532fee..7c06c2691ad27befcc59579db36081c3b927dc9b 100644
--- a/Source/core/layout/LayoutPart.cpp
+++ b/Source/core/layout/LayoutPart.cpp
@@ -160,31 +160,33 @@ bool LayoutPart::nodeAtPoint(HitTestResult& result, const HitTestLocation& locat
if (!widget() || !widget()->isFrameView() || !result.hitTestRequest().allowsChildFrameContent())
return nodeAtPointOverWidget(result, locationInContainer, accumulatedOffset, action);
- FrameView* childFrameView = toFrameView(widget());
- LayoutView* childRoot = childFrameView->layoutView();
-
- if (visibleToHitTestRequest(result.hitTestRequest()) && childRoot) {
- LayoutPoint adjustedLocation = accumulatedOffset + location();
- LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - LayoutSize(childFrameView->scrollOffset());
- HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset);
- HitTestRequest newHitTestRequest(result.hitTestRequest().type() | HitTestRequest::ChildFrameHitTest);
- HitTestResult childFrameResult(newHitTestRequest, newHitTestLocation);
-
- // The frame's layout and style must be up-to-date if we reach here.
- bool isInsideChildFrame = childRoot->hitTestNoLifecycleUpdate(childFrameResult);
-
- if (result.hitTestRequest().listBased()) {
- result.append(childFrameResult);
- } else if (isInsideChildFrame) {
- // Force the result not to be cacheable because the parent
- // frame should not cache this result; as it won't be notified of
- // changes in the child.
- childFrameResult.setCacheable(false);
- result = childFrameResult;
+ if (action == HitTestForeground) {
+ FrameView* childFrameView = toFrameView(widget());
+ LayoutView* childRoot = childFrameView->layoutView();
+
+ if (visibleToHitTestRequest(result.hitTestRequest()) && childRoot) {
+ LayoutPoint adjustedLocation = accumulatedOffset + location();
+ LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - LayoutSize(childFrameView->scrollOffset());
+ HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset);
+ HitTestRequest newHitTestRequest(result.hitTestRequest().type() | HitTestRequest::ChildFrameHitTest);
+ HitTestResult childFrameResult(newHitTestRequest, newHitTestLocation);
+
+ // The frame's layout and style must be up-to-date if we reach here.
+ bool isInsideChildFrame = childRoot->hitTestNoLifecycleUpdate(childFrameResult);
+
+ if (result.hitTestRequest().listBased()) {
+ result.append(childFrameResult);
+ } else if (isInsideChildFrame) {
+ // Force the result not to be cacheable because the parent
+ // frame should not cache this result; as it won't be notified of
+ // changes in the child.
+ childFrameResult.setCacheable(false);
+ result = childFrameResult;
+ }
+
+ if (isInsideChildFrame)
+ return true;
}
-
- if (isInsideChildFrame)
- return true;
}
return nodeAtPointOverWidget(result, locationInContainer, accumulatedOffset, action);
« no previous file with comments | « LayoutTests/fast/events/hit-test-counts-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698