Chromium Code Reviews| Index: third_party/WebKit/Source/core/input/TouchActionUtil.cpp |
| diff --git a/third_party/WebKit/Source/core/input/TouchActionUtil.cpp b/third_party/WebKit/Source/core/input/TouchActionUtil.cpp |
| index e482126c98af4e35d3c819b9410e3d3f779298b9..cef33f70206e3b136c89ab885b27237f681963a2 100644 |
| --- a/third_party/WebKit/Source/core/input/TouchActionUtil.cpp |
| +++ b/third_party/WebKit/Source/core/input/TouchActionUtil.cpp |
| @@ -71,6 +71,19 @@ TouchAction ComputeEffectiveTouchAction(const Node& node) { |
| handled_touch_actions |= TouchAction::kTouchActionPan; |
| } |
| } |
| + // 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.
|
| + // 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.
|
| + // has a layout object. |
| + TouchAction precomputed_touch_action; |
| + for (const Node* cur_node = &node; cur_node; |
| + cur_node = ParentNodeAcrossFrames(cur_node)) { |
| + if (cur_node->GetLayoutObject()) { |
| + precomputed_touch_action = |
| + cur_node->GetLayoutObject()->Style()->GetEffectiveTouchAction(); |
| + break; |
| + } |
| + } |
| + DCHECK_EQ(effective_touch_action, precomputed_touch_action); |
| return effective_touch_action; |
| } |