Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 } | 64 } |
| 65 | 65 |
| 66 // If we've reached an ancestor that supports panning, stop allowing | 66 // If we've reached an ancestor that supports panning, stop allowing |
| 67 // panning to be disabled. | 67 // panning to be disabled. |
| 68 if ((layout_object->IsBox() && | 68 if ((layout_object->IsBox() && |
| 69 ToLayoutBox(layout_object)->ScrollsOverflow()) || | 69 ToLayoutBox(layout_object)->ScrollsOverflow()) || |
| 70 layout_object->IsLayoutView()) | 70 layout_object->IsLayoutView()) |
| 71 handled_touch_actions |= TouchAction::kTouchActionPan; | 71 handled_touch_actions |= TouchAction::kTouchActionPan; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 // This code is to prevent failure when node does not have a layout object, in | |
|
wkorman
2017/06/02 03:07:05
Is this method planned to stay around? I had impre
sunxd
2017/06/05 20:12:04
So I'm a little worried about iframe's touch actio
flackr
2017/06/07 18:21:47
Yes, I think this is the right thing to do.
| |
| 75 // this case, we use the effective_touch_action of its nearest ancestor that | |
|
wkorman
2017/06/02 03:07:06
|effective_touch_action| (to make it easier to see
sunxd
2017/06/05 20:12:04
Acknowledged.
| |
| 76 // has a layout object. | |
| 77 TouchAction precomputed_touch_action; | |
| 78 for (const Node* cur_node = &node; cur_node; | |
| 79 cur_node = ParentNodeAcrossFrames(cur_node)) { | |
| 80 if (cur_node->GetLayoutObject()) { | |
| 81 precomputed_touch_action = | |
| 82 cur_node->GetLayoutObject()->Style()->GetEffectiveTouchAction(); | |
| 83 break; | |
| 84 } | |
| 85 } | |
| 86 DCHECK_EQ(effective_touch_action, precomputed_touch_action); | |
| 74 return effective_touch_action; | 87 return effective_touch_action; |
| 75 } | 88 } |
| 76 | 89 |
| 77 } // namespace TouchActionUtil | 90 } // namespace TouchActionUtil |
| 78 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |