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

Unified Diff: Source/core/page/EventHandler.cpp

Issue 869813003: Implement elementsFromPoint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix typeo Created 5 years, 11 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: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 850bdba7fad1bcaa7d325a5bc7ea2e38d98a7b02..84eb2b6520809f90b47a33216197fe7aac3242ea 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -889,6 +889,9 @@ HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe
if (!m_frame->contentRenderer() || !m_frame->view() || !m_frame->view()->didFirstLayout())
return result;
+ if (padding.width() || padding.height())
+ hitType |= HitTestRequest::ListBased;
Rick Byers 2015/02/04 10:34:03 Perhaps we should require callers to opt-in to lis
pdr. 2015/02/17 04:10:13 Added back! I took this out thinking it would be e
+
// hitTestResultAtPoint is specifically used to hitTest into all frames, thus it always allows child frame content.
HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent);
m_frame->contentRenderer()->hitTest(request, result);
@@ -2600,7 +2603,7 @@ bool EventHandler::bestClickableNodeForHitTestResult(const HitTestResult& result
IntRect touchRect = m_frame->view()->contentsToWindow(result.hitTestLocation().boundingBox());
WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes;
- copyToVector(result.rectBasedTestResult(), nodes);
+ copyToVector(result.listBasedTestResult(), nodes);
// FIXME: the explicit Vector conversion copies into a temporary and is wasteful.
return findBestClickableCandidate(targetNode, targetPoint, touchCenter, touchRect, WillBeHeapVector<RefPtrWillBeMember<Node>> (nodes));
@@ -2612,7 +2615,7 @@ bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu
IntPoint touchCenter = m_frame->view()->contentsToWindow(result.roundedPointInMainFrame());
IntRect touchRect = m_frame->view()->contentsToWindow(result.hitTestLocation().boundingBox());
WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes;
- copyToVector(result.rectBasedTestResult(), nodes);
+ copyToVector(result.listBasedTestResult(), nodes);
// FIXME: the explicit Vector conversion copies into a temporary and is wasteful.
return findBestContextMenuCandidate(targetNode, targetPoint, touchCenter, touchRect, WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes));
@@ -2625,7 +2628,7 @@ bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co
IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes;
- copyToVector(result.rectBasedTestResult(), nodes);
+ copyToVector(result.listBasedTestResult(), nodes);
// FIXME: the explicit Vector conversion copies into a temporary and is wasteful.
return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes));
@@ -2696,7 +2699,7 @@ GestureEventWithHitTestResults EventHandler::hitTestResultForGestureEvent(const
LocalFrame* hitFrame = hitTestResult.innerNodeFrame();
if (!hitFrame)
hitFrame = m_frame;
- hitTestResult = hitTestResultInFrame(hitFrame, hitFrame->view()->windowToContents(adjustedEvent.position()), hitType | HitTestRequest::ReadOnly);
+ hitTestResult = hitTestResultInFrame(hitFrame, hitFrame->view()->windowToContents(adjustedEvent.position()), (hitType | HitTestRequest::ReadOnly) & ~HitTestRequest::ListBased);
}
// If we did a rect-based hit test it must be resolved to the best single node by now to

Powered by Google App Engine
This is Rietveld 408576698