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

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

Issue 869813003: Implement elementsFromPoint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanup, add a better test for tables Created 5 years, 10 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 | « Source/core/layout/svg/line/SVGInlineTextBox.cpp ('k') | Source/core/page/TouchDisambiguation.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index e985e5c454174c1a0c3055dca1651d99eabafe33..a26631e03a0feb47f561bdc8b32b4f2731c1f10d 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -864,6 +864,8 @@ HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe
{
TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint");
+ ASSERT((hitType & HitTestRequest::ListBased) || padding.isEmpty());
+
// We always send hitTestResultAtPoint to the main frame if we have one,
// otherwise we might hit areas that are obscured by higher frames.
if (m_frame->page()) {
@@ -2607,7 +2609,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));
@@ -2619,7 +2621,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));
@@ -2627,12 +2629,17 @@ bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu
bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode)
{
+ if (touchRadius.isEmpty())
+ return false;
+
IntPoint hitTestPoint = m_frame->view()->windowToContents(touchCenter);
- HitTestResult result = hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, LayoutSize(touchRadius));
+
+ HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased;
+ HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType, LayoutSize(touchRadius));
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));
@@ -2686,7 +2693,10 @@ GestureEventWithHitTestResults EventHandler::hitTestResultForGestureEvent(const
LayoutSize padding;
if (shouldApplyTouchAdjustment(gestureEvent)) {
padding = LayoutSize(gestureEvent.area());
- padding.scale(1.f / 2);
+ if (!padding.isEmpty()) {
+ padding.scale(1.f / 2);
+ hitType |= HitTestRequest::ListBased;
+ }
}
HitTestResult hitTestResult = hitTestResultAtPoint(hitTestPoint, hitType | HitTestRequest::ReadOnly, padding);
@@ -2703,7 +2713,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
« no previous file with comments | « Source/core/layout/svg/line/SVGInlineTextBox.cpp ('k') | Source/core/page/TouchDisambiguation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698