| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 break; | 365 break; |
| 366 case WebInputEvent::MouseUp: | 366 case WebInputEvent::MouseUp: |
| 367 eventType = EventTypeNames::mouseup; | 367 eventType = EventTypeNames::mouseup; |
| 368 gestureIndicator = WTF::wrapUnique( | 368 gestureIndicator = WTF::wrapUnique( |
| 369 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); | 369 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); |
| 370 break; | 370 break; |
| 371 default: | 371 default: |
| 372 NOTREACHED(); | 372 NOTREACHED(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 node->dispatchMouseEvent( | 375 WebMouseEvent transformedEvent = |
| 376 PlatformMouseEventBuilder( | 376 TransformWebMouseEvent(m_localRoot->frameView(), |
| 377 m_localRoot->frameView(), | 377 static_cast<const WebMouseEvent&>(inputEvent)); |
| 378 static_cast<const WebMouseEvent&>(inputEvent)), | 378 node->dispatchMouseEvent(transformedEvent, eventType, |
| 379 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount); | 379 transformedEvent.clickCount); |
| 380 return WebInputEventResult::HandledSystem; | 380 return WebInputEventResult::HandledSystem; |
| 381 } | 381 } |
| 382 | 382 |
| 383 return PageWidgetDelegate::handleInputEvent(*this, coalescedEvent, | 383 return PageWidgetDelegate::handleInputEvent(*this, coalescedEvent, |
| 384 m_localRoot->frame()); | 384 m_localRoot->frame()); |
| 385 } | 385 } |
| 386 | 386 |
| 387 void WebFrameWidgetImpl::setCursorVisibilityState(bool isVisible) { | 387 void WebFrameWidgetImpl::setCursorVisibilityState(bool isVisible) { |
| 388 page()->setIsCursorVisible(isVisible); | 388 page()->setIsCursorVisible(isVisible); |
| 389 } | 389 } |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 #else | 769 #else |
| 770 if (event.button == WebMouseEvent::Button::Right) | 770 if (event.button == WebMouseEvent::Button::Right) |
| 771 mouseContextMenu(event); | 771 mouseContextMenu(event); |
| 772 #endif | 772 #endif |
| 773 } | 773 } |
| 774 } | 774 } |
| 775 | 775 |
| 776 void WebFrameWidgetImpl::mouseContextMenu(const WebMouseEvent& event) { | 776 void WebFrameWidgetImpl::mouseContextMenu(const WebMouseEvent& event) { |
| 777 page()->contextMenuController().clearContextMenu(); | 777 page()->contextMenuController().clearContextMenu(); |
| 778 | 778 |
| 779 PlatformMouseEventBuilder pme(m_localRoot->frameView(), event); | 779 WebMouseEvent transformedEvent = |
| 780 TransformWebMouseEvent(m_localRoot->frameView(), event); |
| 781 IntPoint positionInRootFrame = |
| 782 flooredIntPoint(transformedEvent.positionInRootFrame()); |
| 780 | 783 |
| 781 // Find the right target frame. See issue 1186900. | 784 // Find the right target frame. See issue 1186900. |
| 782 HitTestResult result = hitTestResultForRootFramePos(pme.position()); | 785 HitTestResult result = hitTestResultForRootFramePos(positionInRootFrame); |
| 783 Frame* targetFrame; | 786 Frame* targetFrame; |
| 784 if (result.innerNodeOrImageMapImage()) | 787 if (result.innerNodeOrImageMapImage()) |
| 785 targetFrame = result.innerNodeOrImageMapImage()->document().frame(); | 788 targetFrame = result.innerNodeOrImageMapImage()->document().frame(); |
| 786 else | 789 else |
| 787 targetFrame = page()->focusController().focusedOrMainFrame(); | 790 targetFrame = page()->focusController().focusedOrMainFrame(); |
| 788 | 791 |
| 789 // This will need to be changed to a nullptr check when focus control | 792 // This will need to be changed to a nullptr check when focus control |
| 790 // is refactored, at which point focusedOrMainFrame will never return a | 793 // is refactored, at which point focusedOrMainFrame will never return a |
| 791 // RemoteFrame. | 794 // RemoteFrame. |
| 792 // See https://crbug.com/341918. | 795 // See https://crbug.com/341918. |
| 793 if (!targetFrame->isLocalFrame()) | 796 if (!targetFrame->isLocalFrame()) |
| 794 return; | 797 return; |
| 795 | 798 |
| 796 LocalFrame* targetLocalFrame = toLocalFrame(targetFrame); | 799 LocalFrame* targetLocalFrame = toLocalFrame(targetFrame); |
| 797 | 800 |
| 798 #if OS(WIN) | 801 #if OS(WIN) |
| 799 targetLocalFrame->view()->setCursor(pointerCursor()); | 802 targetLocalFrame->view()->setCursor(pointerCursor()); |
| 800 #endif | 803 #endif |
| 801 | 804 |
| 802 { | 805 { |
| 803 ContextMenuAllowedScope scope; | 806 ContextMenuAllowedScope scope; |
| 804 targetLocalFrame->eventHandler().sendContextMenuEvent(pme, nullptr); | 807 targetLocalFrame->eventHandler().sendContextMenuEvent(transformedEvent, |
| 808 nullptr); |
| 805 } | 809 } |
| 806 // Actually showing the context menu is handled by the ContextMenuClient | 810 // Actually showing the context menu is handled by the ContextMenuClient |
| 807 // implementation... | 811 // implementation... |
| 808 } | 812 } |
| 809 | 813 |
| 810 void WebFrameWidgetImpl::handleMouseUp(LocalFrame& mainFrame, | 814 void WebFrameWidgetImpl::handleMouseUp(LocalFrame& mainFrame, |
| 811 const WebMouseEvent& event) { | 815 const WebMouseEvent& event) { |
| 812 PageWidgetEventHandler::handleMouseUp(mainFrame, event); | 816 PageWidgetEventHandler::handleMouseUp(mainFrame, event); |
| 813 | 817 |
| 814 if (page()->settings().getShowContextMenuOnMouseUp()) { | 818 if (page()->settings().getShowContextMenuOnMouseUp()) { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 return nullptr; | 1141 return nullptr; |
| 1138 } | 1142 } |
| 1139 | 1143 |
| 1140 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { | 1144 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { |
| 1141 if (!m_imeAcceptEvents) | 1145 if (!m_imeAcceptEvents) |
| 1142 return nullptr; | 1146 return nullptr; |
| 1143 return focusedLocalFrameInWidget(); | 1147 return focusedLocalFrameInWidget(); |
| 1144 } | 1148 } |
| 1145 | 1149 |
| 1146 } // namespace blink | 1150 } // namespace blink |
| OLD | NEW |