Chromium Code Reviews| 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 24b02a8368b3bdeed6d7d9d685d4feb0c5e91130..92c5fb8b3023b211ce90afc731b597c5499bbc00 |
| --- a/Source/core/page/EventHandler.cpp |
| +++ b/Source/core/page/EventHandler.cpp |
| @@ -3903,6 +3903,19 @@ bool EventHandler::handleWheelEventAsEmulatedGesture(const PlatformWheelEvent& e |
| return true; |
| } |
| +TouchAction EventHandler::intersectTouchAction(TouchAction action, TouchAction effectiveTouchAction) |
|
Rick Byers
2013/12/13 22:17:35
nit: since the two parameters are equivalent (the
gnana
2013/12/16 11:41:09
Done.
|
| +{ |
| + if (action == TouchActionNone || effectiveTouchAction == TouchActionNone) |
| + return TouchActionNone; |
| + if (action == TouchActionAuto) |
| + return effectiveTouchAction; |
| + if (effectiveTouchAction == TouchActionAuto) |
| + return action; |
| + if (!(action & effectiveTouchAction)) |
| + return TouchActionNone; |
| + return action & effectiveTouchAction; |
| +} |
| + |
| TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) |
| { |
| // Optimization to minimize risk of this new feature (behavior should be identical |
| @@ -3914,13 +3927,16 @@ 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(); |
| + effectiveTouchAction = intersectTouchAction(action, effectiveTouchAction); |
| + if (effectiveTouchAction == TouchActionNone) |
| + break; |
| } |
| // If we've reached an ancestor that supports a touch action, search no further. |
| @@ -3928,7 +3944,7 @@ TouchAction EventHandler::computeEffectiveTouchAction(const Node& node) |
| break; |
| } |
| } |
| - return TouchActionAuto; |
| + return effectiveTouchAction; |
| } |
| void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) |