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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 // m_client->setMouseOverURL(WebURL()); | 910 // m_client->setMouseOverURL(WebURL()); |
911 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); | 911 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); |
912 } | 912 } |
913 | 913 |
914 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv
ent& event) | 914 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv
ent& event) |
915 { | 915 { |
916 // Take capture on a mouse down on a plugin so we can send it mouse events. | 916 // Take capture on a mouse down on a plugin so we can send it mouse events. |
917 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 917 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
918 // capture because it will interfere with the scrollbar receiving events. | 918 // capture because it will interfere with the scrollbar receiving events. |
919 IntPoint point(event.x, event.y); | 919 IntPoint point(event.x, event.y); |
920 if (event.button == WebMouseEvent::ButtonLeft) { | 920 if (event.button == WebMouseEvent::Button::Left) { |
921 point = m_localRoot->frameView()->rootFrameToContents(point); | 921 point = m_localRoot->frameView()->rootFrameToContents(point); |
922 HitTestResult result(m_localRoot->frame()->eventHandler().hitTestResultA
tPoint(point)); | 922 HitTestResult result(m_localRoot->frame()->eventHandler().hitTestResultA
tPoint(point)); |
923 result.setToShadowHostIfInUserAgentShadowRoot(); | 923 result.setToShadowHostIfInUserAgentShadowRoot(); |
924 Node* hitNode = result.innerNode(); | 924 Node* hitNode = result.innerNode(); |
925 | 925 |
926 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && hitNode
->layoutObject()->isEmbeddedObject()) { | 926 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && hitNode
->layoutObject()->isEmbeddedObject()) { |
927 m_mouseCaptureNode = hitNode; | 927 m_mouseCaptureNode = hitNode; |
928 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); | 928 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); |
929 } | 929 } |
930 } | 930 } |
931 | 931 |
932 PageWidgetEventHandler::handleMouseDown(mainFrame, event); | 932 PageWidgetEventHandler::handleMouseDown(mainFrame, event); |
933 | 933 |
934 if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode) | 934 if (event.button == WebMouseEvent::Button::Left && m_mouseCaptureNode) |
935 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG
estureToken(); | 935 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG
estureToken(); |
936 | 936 |
937 // Dispatch the contextmenu event regardless of if the click was swallowed. | 937 // Dispatch the contextmenu event regardless of if the click was swallowed. |
938 if (!page()->settings().showContextMenuOnMouseUp()) { | 938 if (!page()->settings().showContextMenuOnMouseUp()) { |
939 #if OS(MACOSX) | 939 #if OS(MACOSX) |
940 if (event.button == WebMouseEvent::ButtonRight || (event.button == WebMo
useEvent::ButtonLeft && event.modifiers & WebMouseEvent::ControlKey)) | 940 if (event.button == WebMouseEvent::Button::Right || (event.button == Web
MouseEvent::Button::Left && event.modifiers & WebMouseEvent::ControlKey)) |
941 mouseContextMenu(event); | 941 mouseContextMenu(event); |
942 #else | 942 #else |
943 if (event.button == WebMouseEvent::ButtonRight) | 943 if (event.button == WebMouseEvent::Button::Right) |
944 mouseContextMenu(event); | 944 mouseContextMenu(event); |
945 #endif | 945 #endif |
946 } | 946 } |
947 } | 947 } |
948 | 948 |
949 void WebFrameWidgetImpl::mouseContextMenu(const WebMouseEvent& event) | 949 void WebFrameWidgetImpl::mouseContextMenu(const WebMouseEvent& event) |
950 { | 950 { |
951 page()->contextMenuController().clearContextMenu(); | 951 page()->contextMenuController().clearContextMenu(); |
952 | 952 |
953 PlatformMouseEventBuilder pme(m_localRoot->frameView(), event); | 953 PlatformMouseEventBuilder pme(m_localRoot->frameView(), event); |
(...skipping 27 matching lines...) Expand all Loading... |
981 // implementation... | 981 // implementation... |
982 } | 982 } |
983 | 983 |
984 void WebFrameWidgetImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEven
t& event) | 984 void WebFrameWidgetImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEven
t& event) |
985 { | 985 { |
986 PageWidgetEventHandler::handleMouseUp(mainFrame, event); | 986 PageWidgetEventHandler::handleMouseUp(mainFrame, event); |
987 | 987 |
988 if (page()->settings().showContextMenuOnMouseUp()) { | 988 if (page()->settings().showContextMenuOnMouseUp()) { |
989 // Dispatch the contextmenu event regardless of if the click was swallow
ed. | 989 // Dispatch the contextmenu event regardless of if the click was swallow
ed. |
990 // On Mac/Linux, we handle it on mouse down, not up. | 990 // On Mac/Linux, we handle it on mouse down, not up. |
991 if (event.button == WebMouseEvent::ButtonRight) | 991 if (event.button == WebMouseEvent::Button::Right) |
992 mouseContextMenu(event); | 992 mouseContextMenu(event); |
993 } | 993 } |
994 } | 994 } |
995 | 995 |
996 WebInputEventResult WebFrameWidgetImpl::handleMouseWheel(LocalFrame& mainFrame,
const WebMouseWheelEvent& event) | 996 WebInputEventResult WebFrameWidgetImpl::handleMouseWheel(LocalFrame& mainFrame,
const WebMouseWheelEvent& event) |
997 { | 997 { |
998 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 998 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
999 } | 999 } |
1000 | 1000 |
1001 WebInputEventResult WebFrameWidgetImpl::handleGestureEvent(const WebGestureEvent
& event) | 1001 WebInputEventResult WebFrameWidgetImpl::handleGestureEvent(const WebGestureEvent
& event) |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 } | 1457 } |
1458 | 1458 |
1459 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const | 1459 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const |
1460 { | 1460 { |
1461 if (!m_imeAcceptEvents) | 1461 if (!m_imeAcceptEvents) |
1462 return nullptr; | 1462 return nullptr; |
1463 return focusedLocalFrameInWidget(); | 1463 return focusedLocalFrameInWidget(); |
1464 } | 1464 } |
1465 | 1465 |
1466 } // namespace blink | 1466 } // namespace blink |
OLD | NEW |