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

Unified Diff: Source/core/testing/Internals.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/rendering/RenderView.cpp ('k') | Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index d7660f7e23f465dbdfd615f0d8232b9421c083bd..b47cf12803d256a748b4b5965cb1806555788032 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -980,7 +980,7 @@ DOMPoint* Internals::touchPositionAdjustedToBestClickableNode(long x, long y, lo
EventHandler& eventHandler = document->frame()->eventHandler();
IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
- HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius));
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, LayoutSize(radius));
Node* targetNode = 0;
IntPoint adjustedPoint;
@@ -1007,7 +1007,7 @@ Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
EventHandler& eventHandler = document->frame()->eventHandler();
IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
- HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius));
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, LayoutSize(radius));
Node* targetNode = 0;
IntPoint adjustedPoint;
@@ -1030,7 +1030,7 @@ DOMPoint* Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y,
EventHandler& eventHandler = document->frame()->eventHandler();
IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
- HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius));
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, LayoutSize(radius));
Node* targetNode = 0;
IntPoint adjustedPoint;
@@ -1057,7 +1057,7 @@ Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
EventHandler& eventHandler = document->frame()->eventHandler();
IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
- HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius));
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, LayoutSize(radius));
Node* targetNode = 0;
IntPoint adjustedPoint;
@@ -1361,7 +1361,7 @@ PassRefPtrWillBeRawPtr<StaticNodeList> Internals::nodesFromRect(Document* docume
float zoomFactor = frame->pageZoomFactor();
LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + frameView->scrollX(), centerY * zoomFactor + frameView->scrollY()));
- HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
+ HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased;
if (ignoreClipping)
hitType |= HitTestRequest::IgnoreClipping;
if (allowChildFrameContent)
@@ -1374,23 +1374,9 @@ PassRefPtrWillBeRawPtr<StaticNodeList> Internals::nodesFromRect(Document* docume
return nullptr;
WillBeHeapVector<RefPtrWillBeMember<Node> > matches;
-
- // Need padding to trigger a rect based hit test, but we want to return a NodeList
- // so we special case this.
- if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) {
- HitTestResult result(point);
- renderView->hitTest(request, result);
-
- if (Node* innerNode = result.innerNode()) {
- if (innerNode->isInShadowTree())
- innerNode = innerNode->shadowHost();
- matches.append(innerNode);
- }
- } else {
- HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding);
- renderView->hitTest(request, result);
- copyToVector(result.rectBasedTestResult(), matches);
- }
+ HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding);
+ renderView->hitTest(request, result);
+ copyToVector(result.listBasedTestResult(), matches);
return StaticNodeList::adopt(matches);
}
« no previous file with comments | « Source/core/rendering/RenderView.cpp ('k') | Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698