Index: Source/core/page/EventHandler.cpp |
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp |
index b57bd6b7781c32867ea8956bc983dfefad51be64..80806dd7237d024f6c439967ec75745697dd8d36 100644 |
--- a/Source/core/page/EventHandler.cpp |
+++ b/Source/core/page/EventHandler.cpp |
@@ -3678,8 +3678,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) |
m_originatingTouchPointTargets.set(touchPointTargetKey, node); |
touchTarget = node; |
- // FIXME(rbyers): Should really be doing a second hit test that ignores inline elements - crbug.com/319479. |
- TouchAction effectiveTouchAction = computeEffectiveTouchAction(*node); |
+ TouchAction effectiveTouchAction = computeEffectiveTouchAction(pagePoint); |
if (effectiveTouchAction != TouchActionAuto) |
m_frame->page()->chrome().client().setTouchAction(effectiveTouchAction); |
@@ -3912,19 +3911,24 @@ TouchAction EventHandler::intersectTouchAction(TouchAction action1, TouchAction |
return action1 & action2; |
} |
-TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) |
+TouchAction EventHandler::computeEffectiveTouchAction(const LayoutPoint& point) |
{ |
// Optimization to minimize risk of this new feature (behavior should be identical |
// since there's no way to get non-default touch-action values). |
if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) |
return TouchActionAuto; |
+ HitTestResult taResult = hitTestResultAtPoint(point, HitTestRequest::TouchEvent | HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::TouchAction); |
+ Node* node = taResult.innerNode(); |
+ if (!node) |
+ return TouchActionAuto; |
+ |
// Start by permitting all actions, then walk the block level elements from |
// the target node up to the nearest scrollable ancestor and exclude any |
// prohibited actions. For now this is trivial, but when we add more types |
// of actions it'll get a little more complex. |
TouchAction effectiveTouchAction = TouchActionAuto; |
- for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal::parent(curNode)) { |
+ for (const Node* curNode = node; curNode; curNode = NodeRenderingTraversal::parent(curNode)) { |
// The spec says only block and SVG elements get touch-action. |
// FIXME(rbyers): Add correct support for SVG, crbug.com/247396. |
if (RenderObject* renderer = curNode->renderer()) { |