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

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

Issue 137123009: Add hittest mode for Touch-action which ignore inline elements and svg elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incoporated review comments Created 6 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
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 43d96fa010d3d273a657f943bb249de7923a33aa..68ebf32f6765797935552e885e61df409ea13060 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -3668,8 +3668,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);
@@ -3902,19 +3901,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()) {

Powered by Google App Engine
This is Rietveld 408576698