Chromium Code Reviews| Index: Source/core/page/EventHandler.cpp |
| diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp |
| index 2da13ecbec963d691a431cbbcd55ad5c41b5b19f..3f78d51f18db61b32c3ffcc91a0bf2f04d572ed6 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()) { |
| @@ -2591,7 +2593,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)); |
| @@ -2603,7 +2605,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)); |
| @@ -2612,11 +2614,16 @@ bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu |
| bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode) |
| { |
| IntPoint hitTestPoint = m_frame->view()->windowToContents(touchCenter); |
| - HitTestResult result = hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, LayoutSize(touchRadius)); |
| + |
| + HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active; |
| + if (!touchRadius.isEmpty()) |
| + hitType |= HitTestRequest::ListBased; |
|
Rick Byers
2015/02/20 20:02:24
This function it intended to be used only with a n
pdr.
2015/02/22 23:28:13
Done
|
| + |
| + 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)); |
| @@ -2670,7 +2677,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); |
| @@ -2687,7 +2697,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 |