Index: Source/core/page/EventHandler.cpp |
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp |
old mode 100644 |
new mode 100755 |
index c0466e38edf8f049f52f8cc888c43ae3f00f1842..08894ef41568cf8413482137d9f7f7e435d99cbc |
--- a/Source/core/page/EventHandler.cpp |
+++ b/Source/core/page/EventHandler.cpp |
@@ -3979,13 +3979,35 @@ TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) |
// 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)) { |
// 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()) { |
if (renderer->isRenderBlockFlow()) { |
- if (renderer->style()->touchAction() == TouchActionNone) |
- return TouchActionNone; |
+ TouchAction action = renderer->style()->touchAction(); |
+ if (action == TouchActionNone) { |
+ effectiveTouchAction = action; |
Rick Byers
2013/12/12 20:47:24
As esprehn pointed out reviewing my CL for this, w
gnana
2013/12/13 16:52:53
Done.
|
+ } else if (action == TouchActionPanX) { |
Rick Byers
2013/12/12 20:47:24
This seems correct, but it's pretty verbose and ha
gnana
2013/12/13 16:52:53
Done.
|
+ if (effectiveTouchAction == TouchActionPanY) { |
+ effectiveTouchAction = TouchActionNone; |
+ } else if (effectiveTouchAction == TouchActionAuto || effectiveTouchAction == (TouchActionPanX | TouchActionPanY)) { |
+ effectiveTouchAction = TouchActionPanX; |
+ } |
+ } else if (action == TouchActionPanY) { |
+ if (effectiveTouchAction == TouchActionPanX) { |
+ effectiveTouchAction = TouchActionNone; |
+ } else if (effectiveTouchAction == TouchActionAuto || effectiveTouchAction == (TouchActionPanX | TouchActionPanY)) { |
+ effectiveTouchAction = TouchActionPanY; |
+ } |
+ } else if (action == (TouchActionPanX | TouchActionPanY)) { |
+ if (effectiveTouchAction == TouchActionPanX) |
+ effectiveTouchAction = TouchActionPanX; |
+ else if (effectiveTouchAction == TouchActionPanY) |
+ effectiveTouchAction = TouchActionPanY; |
+ else if (effectiveTouchAction == TouchActionAuto) |
+ effectiveTouchAction = TouchActionPanX | TouchActionPanY; |
+ } |
} |
// If we've reached an ancestor that supports a touch action, search no further. |
@@ -3993,7 +4015,7 @@ TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) |
break; |
} |
} |
- return TouchActionAuto; |
+ return effectiveTouchAction; |
} |
void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) |