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

Unified Diff: Source/core/testing/Internals.cpp

Issue 338543003: Gesture event hit test refactoring and reduction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix release build Created 6 years, 6 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/HitTestResult.cpp ('k') | Source/platform/PlatformGestureEvent.h » ('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 8ac6035cd745a735079c9459a97ae454b111feb7..719c0b8a2d1b99f3c3f5b647c079908d398db9e3 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -1098,6 +1098,9 @@ String Internals::rangeAsText(const Range* range, ExceptionState& exceptionState
return range->text();
}
+// FIXME: The next four functions are very similar - combine them once
+// bestClickableNode/bestContextMenuNode have been combined..
+
PassRefPtrWillBeRawPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionState& exceptionState)
{
if (!document || !document->frame()) {
@@ -1110,10 +1113,14 @@ PassRefPtrWillBeRawPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickable
IntSize radius(width / 2, height / 2);
IntPoint point(x + radius.width(), y + radius.height());
+ EventHandler& eventHandler = document->frame()->eventHandler();
+ IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, radius);
+
Node* targetNode;
IntPoint adjustedPoint;
- bool foundNode = document->frame()->eventHandler().bestClickableNodeForTouchPoint(point, radius, adjustedPoint, targetNode);
+ bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adjustedPoint, targetNode);
if (foundNode)
return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
@@ -1132,9 +1139,13 @@ Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
IntSize radius(width / 2, height / 2);
IntPoint point(x + radius.width(), y + radius.height());
+ EventHandler& eventHandler = document->frame()->eventHandler();
+ IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, radius);
+
Node* targetNode;
IntPoint adjustedPoint;
- document->frame()->eventHandler().bestClickableNodeForTouchPoint(point, radius, adjustedPoint, targetNode);
+ document->frame()->eventHandler().bestClickableNodeForHitTestResult(result, adjustedPoint, targetNode);
return targetNode;
}
@@ -1150,10 +1161,14 @@ PassRefPtrWillBeRawPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMe
IntSize radius(width / 2, height / 2);
IntPoint point(x + radius.width(), y + radius.height());
+ EventHandler& eventHandler = document->frame()->eventHandler();
+ IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, radius);
+
Node* targetNode = 0;
IntPoint adjustedPoint;
- bool foundNode = document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, radius, adjustedPoint, targetNode);
+ bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targetNode);
if (foundNode)
return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
@@ -1172,9 +1187,13 @@ Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
IntSize radius(width / 2, height / 2);
IntPoint point(x + radius.width(), y + radius.height());
+ EventHandler& eventHandler = document->frame()->eventHandler();
+ IntPoint hitTestPoint = document->frame()->view()->windowToContents(point);
+ HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, radius);
+
Node* targetNode = 0;
IntPoint adjustedPoint;
- document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, radius, adjustedPoint, targetNode);
+ eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targetNode);
return targetNode;
}
« no previous file with comments | « Source/core/rendering/HitTestResult.cpp ('k') | Source/platform/PlatformGestureEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698