OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/EventHandlingUtil.h" | 5 #include "core/input/EventHandlingUtil.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/layout/api/LayoutViewItem.h" | 9 #include "core/layout/api/LayoutViewItem.h" |
10 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 ScrollableArea* AssociatedScrollableArea(const PaintLayer* layer) { | 86 ScrollableArea* AssociatedScrollableArea(const PaintLayer* layer) { |
87 if (PaintLayerScrollableArea* scrollable_area = layer->GetScrollableArea()) { | 87 if (PaintLayerScrollableArea* scrollable_area = layer->GetScrollableArea()) { |
88 if (scrollable_area->ScrollsOverflow()) | 88 if (scrollable_area->ScrollsOverflow()) |
89 return scrollable_area; | 89 return scrollable_area; |
90 } | 90 } |
91 | 91 |
92 return nullptr; | 92 return nullptr; |
93 } | 93 } |
94 | 94 |
| 95 Element* ParentElementIfNeeded(Node* node) { |
| 96 if (!node) |
| 97 return nullptr; |
| 98 if (node->IsElementNode()) |
| 99 return ToElement(node); |
| 100 return FlatTreeTraversal::ParentElement(*node); |
| 101 } |
| 102 |
95 ContainerNode* ParentForClickEvent(const Node& node) { | 103 ContainerNode* ParentForClickEvent(const Node& node) { |
96 // IE doesn't dispatch click events for mousedown/mouseup events across form | 104 // IE doesn't dispatch click events for mousedown/mouseup events across form |
97 // controls. | 105 // controls. |
98 if (node.IsHTMLElement() && ToHTMLElement(node).IsInteractiveContent()) | 106 if (node.IsHTMLElement() && ToHTMLElement(node).IsInteractiveContent()) |
99 return nullptr; | 107 return nullptr; |
100 | 108 |
101 return FlatTreeTraversal::Parent(node); | 109 return FlatTreeTraversal::Parent(node); |
102 } | 110 } |
103 | 111 |
104 LayoutPoint ContentPointFromRootFrame(LocalFrame* frame, | 112 LayoutPoint ContentPointFromRootFrame(LocalFrame* frame, |
(...skipping 14 matching lines...) Expand all Loading... |
119 | 127 |
120 return frame->GetDocument()->PerformMouseEventHitTest( | 128 return frame->GetDocument()->PerformMouseEventHitTest( |
121 request, | 129 request, |
122 ContentPointFromRootFrame(frame, | 130 ContentPointFromRootFrame(frame, |
123 FlooredIntPoint(mev.PositionInRootFrame())), | 131 FlooredIntPoint(mev.PositionInRootFrame())), |
124 mev); | 132 mev); |
125 } | 133 } |
126 | 134 |
127 } // namespace EventHandlingUtil | 135 } // namespace EventHandlingUtil |
128 } // namespace blink | 136 } // namespace blink |
OLD | NEW |