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

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: rebase to trunk and Incorporated 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
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/rendering/HitTestRequest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()) {
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/rendering/HitTestRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698