OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 499 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
500 // capture because it will interfere with the scrollbar receiving events. | 500 // capture because it will interfere with the scrollbar receiving events. |
501 IntPoint point(event.x, event.y); | 501 IntPoint point(event.x, event.y); |
502 if (event.button == WebMouseEvent::Button::Left && | 502 if (event.button == WebMouseEvent::Button::Left && |
503 m_page->mainFrame()->isLocalFrame()) { | 503 m_page->mainFrame()->isLocalFrame()) { |
504 point = | 504 point = |
505 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(point); | 505 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(point); |
506 HitTestResult result( | 506 HitTestResult result( |
507 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( | 507 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( |
508 point)); | 508 point)); |
509 result.setToShadowHostIfInUserAgentShadowRoot(); | 509 result.setToShadowHostIfInRestrictedShadowRoot(); |
510 Node* hitNode = result.innerNodeOrImageMapImage(); | 510 Node* hitNode = result.innerNodeOrImageMapImage(); |
511 | 511 |
512 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && | 512 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && |
513 hitNode->layoutObject()->isEmbeddedObject()) { | 513 hitNode->layoutObject()->isEmbeddedObject()) { |
514 m_mouseCaptureNode = hitNode; | 514 m_mouseCaptureNode = hitNode; |
515 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); | 515 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 PageWidgetEventHandler::handleMouseDown(mainFrame, event); | 519 PageWidgetEventHandler::handleMouseDown(mainFrame, event); |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 | 1257 |
1258 // Use the point-based hit test to find the node. | 1258 // Use the point-based hit test to find the node. |
1259 IntPoint point = mainFrameImpl()->frameView()->rootFrameToContents( | 1259 IntPoint point = mainFrameImpl()->frameView()->rootFrameToContents( |
1260 IntPoint(pointInRootFrame.x, pointInRootFrame.y)); | 1260 IntPoint(pointInRootFrame.x, pointInRootFrame.y)); |
1261 HitTestRequest::HitTestRequestType hitType = | 1261 HitTestRequest::HitTestRequestType hitType = |
1262 HitTestRequest::ReadOnly | HitTestRequest::Active | | 1262 HitTestRequest::ReadOnly | HitTestRequest::Active | |
1263 (ignoreClipping ? HitTestRequest::IgnoreClipping : 0); | 1263 (ignoreClipping ? HitTestRequest::IgnoreClipping : 0); |
1264 HitTestResult result = | 1264 HitTestResult result = |
1265 mainFrameImpl()->frame()->eventHandler().hitTestResultAtPoint(point, | 1265 mainFrameImpl()->frame()->eventHandler().hitTestResultAtPoint(point, |
1266 hitType); | 1266 hitType); |
1267 result.setToShadowHostIfInUserAgentShadowRoot(); | 1267 result.setToShadowHostIfInRestrictedShadowRoot(); |
1268 | 1268 |
1269 Node* node = result.innerNodeOrImageMapImage(); | 1269 Node* node = result.innerNodeOrImageMapImage(); |
1270 if (!node) | 1270 if (!node) |
1271 return WebRect(); | 1271 return WebRect(); |
1272 | 1272 |
1273 // Find the block type node based on the hit node. | 1273 // Find the block type node based on the hit node. |
1274 // FIXME: This wants to walk flat tree with | 1274 // FIXME: This wants to walk flat tree with |
1275 // LayoutTreeBuilderTraversal::parent(). | 1275 // LayoutTreeBuilderTraversal::parent(). |
1276 while (node && (!node->layoutObject() || node->layoutObject()->isInline())) | 1276 while (node && (!node->layoutObject() || node->layoutObject()->isInline())) |
1277 node = LayoutTreeBuilderTraversal::parent(*node); | 1277 node = LayoutTreeBuilderTraversal::parent(*node); |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3769 HitTestResult WebViewImpl::hitTestResultForRootFramePos( | 3769 HitTestResult WebViewImpl::hitTestResultForRootFramePos( |
3770 const IntPoint& posInRootFrame) { | 3770 const IntPoint& posInRootFrame) { |
3771 if (!m_page->mainFrame()->isLocalFrame()) | 3771 if (!m_page->mainFrame()->isLocalFrame()) |
3772 return HitTestResult(); | 3772 return HitTestResult(); |
3773 IntPoint docPoint( | 3773 IntPoint docPoint( |
3774 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents( | 3774 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents( |
3775 posInRootFrame)); | 3775 posInRootFrame)); |
3776 HitTestResult result = | 3776 HitTestResult result = |
3777 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( | 3777 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( |
3778 docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); | 3778 docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); |
3779 result.setToShadowHostIfInUserAgentShadowRoot(); | 3779 result.setToShadowHostIfInRestrictedShadowRoot(); |
3780 return result; | 3780 return result; |
3781 } | 3781 } |
3782 | 3782 |
3783 WebHitTestResult WebViewImpl::hitTestResultForTap( | 3783 WebHitTestResult WebViewImpl::hitTestResultForTap( |
3784 const WebPoint& tapPointWindowPos, | 3784 const WebPoint& tapPointWindowPos, |
3785 const WebSize& tapArea) { | 3785 const WebSize& tapArea) { |
3786 if (!m_page->mainFrame()->isLocalFrame()) | 3786 if (!m_page->mainFrame()->isLocalFrame()) |
3787 return HitTestResult(); | 3787 return HitTestResult(); |
3788 | 3788 |
3789 WebGestureEvent tapEvent(WebInputEvent::GestureTap, | 3789 WebGestureEvent tapEvent(WebInputEvent::GestureTap, |
(...skipping 10 matching lines...) Expand all Loading... |
3800 WebGestureEvent scaledEvent = | 3800 WebGestureEvent scaledEvent = |
3801 TransformWebGestureEvent(mainFrameImpl()->frameView(), tapEvent); | 3801 TransformWebGestureEvent(mainFrameImpl()->frameView(), tapEvent); |
3802 | 3802 |
3803 HitTestResult result = | 3803 HitTestResult result = |
3804 m_page->deprecatedLocalMainFrame() | 3804 m_page->deprecatedLocalMainFrame() |
3805 ->eventHandler() | 3805 ->eventHandler() |
3806 .hitTestResultForGestureEvent( | 3806 .hitTestResultForGestureEvent( |
3807 scaledEvent, HitTestRequest::ReadOnly | HitTestRequest::Active) | 3807 scaledEvent, HitTestRequest::ReadOnly | HitTestRequest::Active) |
3808 .hitTestResult(); | 3808 .hitTestResult(); |
3809 | 3809 |
3810 result.setToShadowHostIfInUserAgentShadowRoot(); | 3810 result.setToShadowHostIfInRestrictedShadowRoot(); |
3811 return result; | 3811 return result; |
3812 } | 3812 } |
3813 | 3813 |
3814 void WebViewImpl::setTabsToLinks(bool enable) { | 3814 void WebViewImpl::setTabsToLinks(bool enable) { |
3815 m_tabsToLinks = enable; | 3815 m_tabsToLinks = enable; |
3816 } | 3816 } |
3817 | 3817 |
3818 bool WebViewImpl::tabsToLinks() const { | 3818 bool WebViewImpl::tabsToLinks() const { |
3819 return m_tabsToLinks; | 3819 return m_tabsToLinks; |
3820 } | 3820 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4057 } | 4057 } |
4058 | 4058 |
4059 bool WebViewImpl::detectContentOnTouch( | 4059 bool WebViewImpl::detectContentOnTouch( |
4060 const GestureEventWithHitTestResults& targetedEvent) { | 4060 const GestureEventWithHitTestResults& targetedEvent) { |
4061 if (!m_page->mainFrame()->isLocalFrame()) | 4061 if (!m_page->mainFrame()->isLocalFrame()) |
4062 return false; | 4062 return false; |
4063 | 4063 |
4064 // Need a local copy of the hit test as | 4064 // Need a local copy of the hit test as |
4065 // setToShadowHostIfInUserAgentShadowRoot() will modify it. | 4065 // setToShadowHostIfInUserAgentShadowRoot() will modify it. |
4066 HitTestResult touchHit = targetedEvent.hitTestResult(); | 4066 HitTestResult touchHit = targetedEvent.hitTestResult(); |
4067 touchHit.setToShadowHostIfInUserAgentShadowRoot(); | 4067 touchHit.setToShadowHostIfInRestrictedShadowRoot(); |
4068 | 4068 |
4069 if (touchHit.isContentEditable()) | 4069 if (touchHit.isContentEditable()) |
4070 return false; | 4070 return false; |
4071 | 4071 |
4072 Node* node = touchHit.innerNode(); | 4072 Node* node = touchHit.innerNode(); |
4073 if (!node || !node->isTextNode()) | 4073 if (!node || !node->isTextNode()) |
4074 return false; | 4074 return false; |
4075 | 4075 |
4076 // Ignore when tapping on links or nodes listening to click events, unless | 4076 // Ignore when tapping on links or nodes listening to click events, unless |
4077 // the click event is on the body element, in which case it's unlikely that | 4077 // the click event is on the body element, in which case it's unlikely that |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4179 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4179 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4180 return nullptr; | 4180 return nullptr; |
4181 return focusedFrame; | 4181 return focusedFrame; |
4182 } | 4182 } |
4183 | 4183 |
4184 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4184 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4185 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4185 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4186 } | 4186 } |
4187 | 4187 |
4188 } // namespace blink | 4188 } // namespace blink |
OLD | NEW |