Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #include "web/CompositionUnderlineVectorBuilder.h" | 64 #include "web/CompositionUnderlineVectorBuilder.h" |
| 65 #include "web/CompositorMutatorImpl.h" | 65 #include "web/CompositorMutatorImpl.h" |
| 66 #include "web/CompositorWorkerProxyClientImpl.h" | 66 #include "web/CompositorWorkerProxyClientImpl.h" |
| 67 #include "web/ContextMenuAllowedScope.h" | 67 #include "web/ContextMenuAllowedScope.h" |
| 68 #include "web/InspectorOverlay.h" | 68 #include "web/InspectorOverlay.h" |
| 69 #include "web/PageOverlay.h" | 69 #include "web/PageOverlay.h" |
| 70 #include "web/WebDevToolsAgentImpl.h" | 70 #include "web/WebDevToolsAgentImpl.h" |
| 71 #include "web/WebInputEventConversion.h" | 71 #include "web/WebInputEventConversion.h" |
| 72 #include "web/WebInputMethodControllerImpl.h" | 72 #include "web/WebInputMethodControllerImpl.h" |
| 73 #include "web/WebLocalFrameImpl.h" | 73 #include "web/WebLocalFrameImpl.h" |
| 74 #include "web/WebPagePopupImpl.h" | |
| 74 #include "web/WebPluginContainerImpl.h" | 75 #include "web/WebPluginContainerImpl.h" |
| 75 #include "web/WebRemoteFrameImpl.h" | 76 #include "web/WebRemoteFrameImpl.h" |
| 76 #include "web/WebViewFrameWidget.h" | 77 #include "web/WebViewFrameWidget.h" |
| 77 #include "wtf/AutoReset.h" | 78 #include "wtf/AutoReset.h" |
| 78 #include "wtf/PtrUtil.h" | 79 #include "wtf/PtrUtil.h" |
| 79 | 80 |
| 80 namespace blink { | 81 namespace blink { |
| 81 | 82 |
| 82 // WebFrameWidget ------------------------------------------------------------ | 83 // WebFrameWidget ------------------------------------------------------------ |
| 83 | 84 |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 | 762 |
| 762 void WebFrameWidgetImpl::handleMouseLeave(LocalFrame& mainFrame, | 763 void WebFrameWidgetImpl::handleMouseLeave(LocalFrame& mainFrame, |
| 763 const WebMouseEvent& event) { | 764 const WebMouseEvent& event) { |
| 764 // FIXME: WebWidget doesn't have the method below. | 765 // FIXME: WebWidget doesn't have the method below. |
| 765 // m_client->setMouseOverURL(WebURL()); | 766 // m_client->setMouseOverURL(WebURL()); |
| 766 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); | 767 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); |
| 767 } | 768 } |
| 768 | 769 |
| 769 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, | 770 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, |
| 770 const WebMouseEvent& event) { | 771 const WebMouseEvent& event) { |
| 772 RefPtr<WebPagePopupImpl> pagePopup; | |
| 773 if (event.button == WebMouseEvent::Button::Left) { | |
| 774 // The mouse down has been outside of any open popups so we should cancel | |
| 775 // the current page popup for this process. | |
|
dcheng
2017/04/07 06:32:01
Nit: I prefer the original comment (since it also
EhsanK
2017/04/07 16:16:12
Acknowledged.
| |
| 776 pagePopup = static_cast<WebPagePopupImpl*>(view()->pagePopup()); | |
|
dcheng
2017/04/07 06:32:01
Let's take advantage of the fact that view() alrea
EhsanK
2017/04/07 16:16:12
Yes good idea. Thanks!
| |
| 777 view()->hidePopups(); | |
| 778 } | |
| 779 | |
| 771 // Take capture on a mouse down on a plugin so we can send it mouse events. | 780 // Take capture on a mouse down on a plugin so we can send it mouse events. |
| 772 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 781 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
| 773 // capture because it will interfere with the scrollbar receiving events. | 782 // capture because it will interfere with the scrollbar receiving events. |
| 774 IntPoint point(event.positionInWidget().x, event.positionInWidget().y); | 783 IntPoint point(event.positionInWidget().x, event.positionInWidget().y); |
| 775 if (event.button == WebMouseEvent::Button::Left) { | 784 if (event.button == WebMouseEvent::Button::Left) { |
| 776 point = m_localRoot->frameView()->rootFrameToContents(point); | 785 point = m_localRoot->frameView()->rootFrameToContents(point); |
| 777 HitTestResult result( | 786 HitTestResult result( |
| 778 m_localRoot->frame()->eventHandler().hitTestResultAtPoint(point)); | 787 m_localRoot->frame()->eventHandler().hitTestResultAtPoint(point)); |
| 779 result.setToShadowHostIfInRestrictedShadowRoot(); | 788 result.setToShadowHostIfInRestrictedShadowRoot(); |
| 780 Node* hitNode = result.innerNode(); | 789 Node* hitNode = result.innerNode(); |
| 781 | 790 |
| 782 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && | 791 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && |
| 783 hitNode->layoutObject()->isEmbeddedObject()) { | 792 hitNode->layoutObject()->isEmbeddedObject()) { |
| 784 m_mouseCaptureNode = hitNode; | 793 m_mouseCaptureNode = hitNode; |
| 785 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); | 794 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); |
| 786 } | 795 } |
| 787 } | 796 } |
| 788 | 797 |
| 789 PageWidgetEventHandler::handleMouseDown(mainFrame, event); | 798 PageWidgetEventHandler::handleMouseDown(mainFrame, event); |
| 790 | 799 |
| 791 if (event.button == WebMouseEvent::Button::Left && m_mouseCaptureNode) | 800 if (event.button == WebMouseEvent::Button::Left && m_mouseCaptureNode) |
| 792 m_mouseCaptureGestureToken = | 801 m_mouseCaptureGestureToken = |
| 793 mainFrame.eventHandler().takeLastMouseDownGestureToken(); | 802 mainFrame.eventHandler().takeLastMouseDownGestureToken(); |
| 794 | 803 |
| 804 WebPagePopupImpl* pagePopupImpl = | |
|
dcheng
2017/04/07 06:32:01
Nit: Call this currentPagePopup
EhsanK
2017/04/07 16:16:12
Or I can just remove it now that view()->pagePopup
| |
| 805 static_cast<WebPagePopupImpl*>(view()->pagePopup()); | |
| 806 if (pagePopupImpl && pagePopupImpl == pagePopup && | |
| 807 pagePopupImpl->hasSamePopupClient(pagePopup.get())) { | |
| 808 // That click triggered a page popup that is the same as the one we just | |
| 809 // closed. It needs to be closed. | |
| 810 view()->hidePopups(); | |
|
dcheng
2017/04/07 06:32:01
The logic in WebViewImpl calls cancel() -- is it O
EhsanK
2017/04/07 16:16:12
hidePopups() simply calls cancelPagePopup(). That
| |
| 811 } | |
| 812 | |
| 795 // Dispatch the contextmenu event regardless of if the click was swallowed. | 813 // Dispatch the contextmenu event regardless of if the click was swallowed. |
| 796 if (!page()->settings().getShowContextMenuOnMouseUp()) { | 814 if (!page()->settings().getShowContextMenuOnMouseUp()) { |
| 797 #if OS(MACOSX) | 815 #if OS(MACOSX) |
| 798 if (event.button == WebMouseEvent::Button::Right || | 816 if (event.button == WebMouseEvent::Button::Right || |
| 799 (event.button == WebMouseEvent::Button::Left && | 817 (event.button == WebMouseEvent::Button::Left && |
| 800 event.modifiers() & WebMouseEvent::ControlKey)) | 818 event.modifiers() & WebMouseEvent::ControlKey)) |
| 801 mouseContextMenu(event); | 819 mouseContextMenu(event); |
| 802 #else | 820 #else |
| 803 if (event.button == WebMouseEvent::Button::Right) | 821 if (event.button == WebMouseEvent::Button::Right) |
| 804 mouseContextMenu(event); | 822 mouseContextMenu(event); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1158 return nullptr; | 1176 return nullptr; |
| 1159 } | 1177 } |
| 1160 | 1178 |
| 1161 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { | 1179 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { |
| 1162 if (!m_imeAcceptEvents) | 1180 if (!m_imeAcceptEvents) |
| 1163 return nullptr; | 1181 return nullptr; |
| 1164 return focusedLocalFrameInWidget(); | 1182 return focusedLocalFrameInWidget(); |
| 1165 } | 1183 } |
| 1166 | 1184 |
| 1167 } // namespace blink | 1185 } // namespace blink |
| OLD | NEW |