| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/input/TouchActionUtil.h" | 5 #include "core/input/TouchActionUtil.h" |
| 6 | 6 |
| 7 #include "core/dom/Node.h" | 7 #include "core/dom/Node.h" |
| 8 #include "core/html/HTMLFrameOwnerElement.h" | 8 #include "core/html/HTMLFrameOwnerElement.h" |
| 9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
| 10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Start by permitting all actions, then walk the elements supporting | 49 // Start by permitting all actions, then walk the elements supporting |
| 50 // touch-action from the target node up to root document, exclude any | 50 // touch-action from the target node up to root document, exclude any |
| 51 // prohibited actions at or below the element that supports them. | 51 // prohibited actions at or below the element that supports them. |
| 52 // I.e. pan-related actions are considered up to the nearest scroller, | 52 // I.e. pan-related actions are considered up to the nearest scroller, |
| 53 // and zoom related actions are considered up to the root. | 53 // and zoom related actions are considered up to the root. |
| 54 TouchAction effectiveTouchAction = TouchActionAuto; | 54 TouchAction effectiveTouchAction = TouchActionAuto; |
| 55 TouchAction handledTouchActions = TouchActionNone; | 55 TouchAction handledTouchActions = TouchActionNone; |
| 56 for (const Node* curNode = &node; curNode; curNode = parentNodeAcrossFrames(
curNode)) { | 56 for (const Node* curNode = &node; curNode; curNode = parentNodeAcrossFrames(
curNode)) { |
| 57 if (LayoutObject* layoutObject = curNode->layoutObject()) { | 57 if (LayoutObject* layoutObject = curNode->layoutObject()) { |
| 58 if (supportsTouchAction(*layoutObject)) { | 58 if (supportsTouchAction(*layoutObject)) { |
| 59 TouchAction action = layoutObject->style()->touchAction(); | 59 TouchAction action = layoutObject->style()->getTouchAction(); |
| 60 action |= handledTouchActions; | 60 action |= handledTouchActions; |
| 61 effectiveTouchAction &= action; | 61 effectiveTouchAction &= action; |
| 62 if (effectiveTouchAction == TouchActionNone) | 62 if (effectiveTouchAction == TouchActionNone) |
| 63 break; | 63 break; |
| 64 } | 64 } |
| 65 | 65 |
| 66 // If we've reached an ancestor that supports panning, stop allowing
panning to be disabled. | 66 // If we've reached an ancestor that supports panning, stop allowing
panning to be disabled. |
| 67 if ((layoutObject->isBox() && toLayoutBox(layoutObject)->scrollsOver
flow()) | 67 if ((layoutObject->isBox() && toLayoutBox(layoutObject)->scrollsOver
flow()) |
| 68 || layoutObject->isLayoutView()) | 68 || layoutObject->isLayoutView()) |
| 69 handledTouchActions |= TouchActionPan; | 69 handledTouchActions |= TouchActionPan; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 return effectiveTouchAction; | 72 return effectiveTouchAction; |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace TouchActionUtil | 75 } // namespace TouchActionUtil |
| 76 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |