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" |
11 #include "platform/scroll/ScrollableArea.h" | 11 #include "platform/scroll/ScrollableArea.h" |
| 12 #include "public/platform/WebMouseEvent.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 namespace EventHandlingUtil { | 15 namespace EventHandlingUtil { |
15 | 16 |
16 HitTestResult hitTestResultInFrame(LocalFrame* frame, | 17 HitTestResult hitTestResultInFrame(LocalFrame* frame, |
17 const LayoutPoint& point, | 18 const LayoutPoint& point, |
18 HitTestRequest::HitTestRequestType hitType) { | 19 HitTestRequest::HitTestRequestType hitType) { |
19 HitTestResult result(HitTestRequest(hitType), point); | 20 HitTestResult result(HitTestRequest(hitType), point); |
20 | 21 |
21 if (!frame || frame->contentLayoutItem().isNull()) | 22 if (!frame || frame->contentLayoutItem().isNull()) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const IntPoint& pointInRootFrame) { | 104 const IntPoint& pointInRootFrame) { |
104 FrameView* view = frame->view(); | 105 FrameView* view = frame->view(); |
105 // FIXME: Is it really OK to use the wrong coordinates here when view is 0? | 106 // FIXME: Is it really OK to use the wrong coordinates here when view is 0? |
106 // Historically the code would just crash; this is clearly no worse than that. | 107 // Historically the code would just crash; this is clearly no worse than that. |
107 return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame; | 108 return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame; |
108 } | 109 } |
109 | 110 |
110 MouseEventWithHitTestResults performMouseEventHitTest( | 111 MouseEventWithHitTestResults performMouseEventHitTest( |
111 LocalFrame* frame, | 112 LocalFrame* frame, |
112 const HitTestRequest& request, | 113 const HitTestRequest& request, |
113 const PlatformMouseEvent& mev) { | 114 const WebMouseEvent& mev) { |
114 DCHECK(frame); | 115 DCHECK(frame); |
115 DCHECK(frame->document()); | 116 DCHECK(frame->document()); |
116 | 117 |
117 return frame->document()->performMouseEventHitTest( | 118 return frame->document()->performMouseEventHitTest( |
118 request, contentPointFromRootFrame(frame, mev.position()), mev); | 119 request, contentPointFromRootFrame( |
| 120 frame, flooredIntPoint(mev.positionInRootFrame())), |
| 121 mev); |
119 } | 122 } |
120 | 123 |
121 } // namespace EventHandlingUtil | 124 } // namespace EventHandlingUtil |
122 } // namespace blink | 125 } // namespace blink |
OLD | NEW |