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/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
8 #include "core/frame/LocalFrameView.h" | 8 #include "core/frame/LocalFrameView.h" |
| 9 #include "core/layout/LayoutEmbeddedContent.h" |
9 #include "core/layout/api/LayoutViewItem.h" | 10 #include "core/layout/api/LayoutViewItem.h" |
10 #include "core/paint/PaintLayer.h" | 11 #include "core/paint/PaintLayer.h" |
11 #include "platform/scroll/ScrollableArea.h" | 12 #include "platform/scroll/ScrollableArea.h" |
12 #include "public/platform/WebMouseEvent.h" | 13 #include "public/platform/WebMouseEvent.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 namespace EventHandlingUtil { | 16 namespace EventHandlingUtil { |
16 | 17 |
17 HitTestResult HitTestResultInFrame( | 18 HitTestResult HitTestResultInFrame( |
18 LocalFrame* frame, | 19 LocalFrame* frame, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 DCHECK(frame); | 122 DCHECK(frame); |
122 DCHECK(frame->GetDocument()); | 123 DCHECK(frame->GetDocument()); |
123 | 124 |
124 return frame->GetDocument()->PerformMouseEventHitTest( | 125 return frame->GetDocument()->PerformMouseEventHitTest( |
125 request, | 126 request, |
126 ContentPointFromRootFrame(frame, | 127 ContentPointFromRootFrame(frame, |
127 FlooredIntPoint(mev.PositionInRootFrame())), | 128 FlooredIntPoint(mev.PositionInRootFrame())), |
128 mev); | 129 mev); |
129 } | 130 } |
130 | 131 |
| 132 LocalFrame* SubframeForTargetNode(Node* node) { |
| 133 if (!node) |
| 134 return nullptr; |
| 135 |
| 136 LayoutObject* layout_object = node->GetLayoutObject(); |
| 137 if (!layout_object || !layout_object->IsLayoutEmbeddedContent()) |
| 138 return nullptr; |
| 139 |
| 140 LocalFrameView* frame_view = |
| 141 ToLayoutEmbeddedContent(layout_object)->ChildFrameView(); |
| 142 if (!frame_view) |
| 143 return nullptr; |
| 144 |
| 145 return &frame_view->GetFrame(); |
| 146 } |
| 147 |
| 148 LocalFrame* SubframeForHitTestResult( |
| 149 const MouseEventWithHitTestResults& hit_test_result) { |
| 150 if (!hit_test_result.IsOverEmbeddedContentView()) |
| 151 return nullptr; |
| 152 return SubframeForTargetNode(hit_test_result.InnerNode()); |
| 153 } |
| 154 |
131 } // namespace EventHandlingUtil | 155 } // namespace EventHandlingUtil |
132 } // namespace blink | 156 } // namespace blink |
OLD | NEW |