| 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/FrameHost.h" |
| 7 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 9 #include "core/layout/api/LayoutViewItem.h" | 10 #include "core/layout/api/LayoutViewItem.h" |
| 11 #include "core/page/scrolling/TopDocumentRootScrollerController.h" |
| 10 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 11 #include "platform/scroll/ScrollableArea.h" | 13 #include "platform/scroll/ScrollableArea.h" |
| 12 | 14 |
| 13 namespace blink { | 15 namespace blink { |
| 14 namespace EventHandlingUtil { | 16 namespace EventHandlingUtil { |
| 15 | 17 |
| 16 HitTestResult hitTestResultInFrame(LocalFrame* frame, | 18 HitTestResult hitTestResultInFrame(LocalFrame* frame, |
| 17 const LayoutPoint& point, | 19 const LayoutPoint& point, |
| 18 HitTestRequest::HitTestRequestType hitType) { | 20 HitTestRequest::HitTestRequestType hitType) { |
| 19 HitTestResult result(HitTestRequest(hitType), point); | 21 HitTestResult result(HitTestRequest(hitType), point); |
| 20 | 22 |
| 21 if (!frame || frame->contentLayoutItem().isNull()) | 23 if (!frame || frame->contentLayoutItem().isNull() || !frame->view()) |
| 22 return result; | 24 return result; |
| 23 if (frame->view()) { | 25 |
| 24 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); | 26 IntRect frameRect = frame->view()->visibleContentRect(IncludeScrollbars); |
| 25 if (!rect.contains(roundedIntPoint(point))) | 27 |
| 26 return result; | 28 DCHECK(frame->host()); |
| 29 DCHECK(frame->document()); |
| 30 TopDocumentRootScrollerController& rootScrollerController = |
| 31 frame->host()->globalRootScrollerController(); |
| 32 if (rootScrollerController.isRootScrollerAncestor(*frame->document())) { |
| 33 frameRect.setSize( |
| 34 rootScrollerController.visibleContentRect(IncludeScrollbars).size()); |
| 27 } | 35 } |
| 36 |
| 37 if (!frameRect.contains(roundedIntPoint(point))) |
| 38 return result; |
| 39 |
| 28 frame->contentLayoutItem().hitTest(result); | 40 frame->contentLayoutItem().hitTest(result); |
| 29 return result; | 41 return result; |
| 30 } | 42 } |
| 31 | 43 |
| 32 WebInputEventResult mergeEventResult(WebInputEventResult resultA, | 44 WebInputEventResult mergeEventResult(WebInputEventResult resultA, |
| 33 WebInputEventResult resultB) { | 45 WebInputEventResult resultB) { |
| 34 // The ordering of the enumeration is specific. There are times that | 46 // The ordering of the enumeration is specific. There are times that |
| 35 // multiple events fire and we need to combine them into a single | 47 // multiple events fire and we need to combine them into a single |
| 36 // result code. The enumeration is based on the level of consumption that | 48 // result code. The enumeration is based on the level of consumption that |
| 37 // is most significant. The enumeration is ordered with smaller specified | 49 // is most significant. The enumeration is ordered with smaller specified |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 const PlatformMouseEvent& mev) { | 125 const PlatformMouseEvent& mev) { |
| 114 DCHECK(frame); | 126 DCHECK(frame); |
| 115 DCHECK(frame->document()); | 127 DCHECK(frame->document()); |
| 116 | 128 |
| 117 return frame->document()->performMouseEventHitTest( | 129 return frame->document()->performMouseEventHitTest( |
| 118 request, contentPointFromRootFrame(frame, mev.position()), mev); | 130 request, contentPointFromRootFrame(frame, mev.position()), mev); |
| 119 } | 131 } |
| 120 | 132 |
| 121 } // namespace EventHandlingUtil | 133 } // namespace EventHandlingUtil |
| 122 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |