| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 | 711 |
| 712 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), | 712 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), |
| 713 *event); | 713 *event); |
| 714 if (webEvent.type == WebInputEvent::Undefined) | 714 if (webEvent.type == WebInputEvent::Undefined) |
| 715 return; | 715 return; |
| 716 | 716 |
| 717 if (event->type() == EventTypeNames::mousedown) | 717 if (event->type() == EventTypeNames::mousedown) |
| 718 focusPlugin(); | 718 focusPlugin(); |
| 719 | 719 |
| 720 WebCursorInfo cursorInfo; | 720 WebCursorInfo cursorInfo; |
| 721 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 721 // TODO(nzolghadr): We need to plumb the coalesced event here. |
| 722 if (m_webPlugin->handleInputEvent( |
| 723 webEvent, std::vector<const WebInputEvent*>(), cursorInfo) != |
| 722 WebInputEventResult::NotHandled) | 724 WebInputEventResult::NotHandled) |
| 723 event->setDefaultHandled(); | 725 event->setDefaultHandled(); |
| 724 | 726 |
| 725 // A windowless plugin can change the cursor in response to a mouse move | 727 // A windowless plugin can change the cursor in response to a mouse move |
| 726 // event. We need to reflect the changed cursor in the frame view as the | 728 // event. We need to reflect the changed cursor in the frame view as the |
| 727 // mouse is moved in the boundaries of the windowless plugin. | 729 // mouse is moved in the boundaries of the windowless plugin. |
| 728 Page* page = parentView->frame().page(); | 730 Page* page = parentView->frame().page(); |
| 729 if (!page) | 731 if (!page) |
| 730 return; | 732 return; |
| 731 toChromeClientImpl(page->chromeClient()) | 733 toChromeClientImpl(page->chromeClient()) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 761 dragLocation, dragScreenLocation); | 763 dragLocation, dragScreenLocation); |
| 762 } | 764 } |
| 763 | 765 |
| 764 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) { | 766 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) { |
| 765 WebMouseWheelEventBuilder webEvent( | 767 WebMouseWheelEventBuilder webEvent( |
| 766 this, LayoutItem(m_element->layoutObject()), *event); | 768 this, LayoutItem(m_element->layoutObject()), *event); |
| 767 if (webEvent.type == WebInputEvent::Undefined) | 769 if (webEvent.type == WebInputEvent::Undefined) |
| 768 return; | 770 return; |
| 769 | 771 |
| 770 WebCursorInfo cursorInfo; | 772 WebCursorInfo cursorInfo; |
| 771 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 773 if (m_webPlugin->handleInputEvent( |
| 774 webEvent, std::vector<const WebInputEvent*>(), cursorInfo) != |
| 772 WebInputEventResult::NotHandled) | 775 WebInputEventResult::NotHandled) |
| 773 event->setDefaultHandled(); | 776 event->setDefaultHandled(); |
| 774 } | 777 } |
| 775 | 778 |
| 776 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) { | 779 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) { |
| 777 WebKeyboardEventBuilder webEvent(*event); | 780 WebKeyboardEventBuilder webEvent(*event); |
| 778 if (webEvent.type == WebInputEvent::Undefined) | 781 if (webEvent.type == WebInputEvent::Undefined) |
| 779 return; | 782 return; |
| 780 | 783 |
| 781 if (webEvent.type == WebInputEvent::KeyDown) { | 784 if (webEvent.type == WebInputEvent::KeyDown) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 809 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn); | 812 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn); |
| 810 } | 813 } |
| 811 | 814 |
| 812 // Give the client a chance to issue edit comamnds. | 815 // Give the client a chance to issue edit comamnds. |
| 813 WebLocalFrameImpl* webFrame = | 816 WebLocalFrameImpl* webFrame = |
| 814 WebLocalFrameImpl::fromFrame(m_element->document().frame()); | 817 WebLocalFrameImpl::fromFrame(m_element->document().frame()); |
| 815 if (m_webPlugin->supportsEditCommands()) | 818 if (m_webPlugin->supportsEditCommands()) |
| 816 webFrame->client()->handleCurrentKeyboardEvent(); | 819 webFrame->client()->handleCurrentKeyboardEvent(); |
| 817 | 820 |
| 818 WebCursorInfo cursorInfo; | 821 WebCursorInfo cursorInfo; |
| 819 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 822 if (m_webPlugin->handleInputEvent( |
| 823 webEvent, std::vector<const WebInputEvent*>(), cursorInfo) != |
| 820 WebInputEventResult::NotHandled) | 824 WebInputEventResult::NotHandled) |
| 821 event->setDefaultHandled(); | 825 event->setDefaultHandled(); |
| 822 } | 826 } |
| 823 | 827 |
| 824 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) { | 828 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) { |
| 825 switch (m_touchEventRequestType) { | 829 switch (m_touchEventRequestType) { |
| 826 case TouchEventRequestTypeNone: | 830 case TouchEventRequestTypeNone: |
| 827 return; | 831 return; |
| 828 case TouchEventRequestTypeRaw: { | 832 case TouchEventRequestTypeRaw: { |
| 829 WebTouchEventBuilder webEvent(LayoutItem(m_element->layoutObject()), | 833 WebTouchEventBuilder webEvent(LayoutItem(m_element->layoutObject()), |
| 830 *event); | 834 *event); |
| 831 if (webEvent.type == WebInputEvent::Undefined) | 835 if (webEvent.type == WebInputEvent::Undefined) |
| 832 return; | 836 return; |
| 833 | 837 |
| 834 if (event->type() == EventTypeNames::touchstart) | 838 if (event->type() == EventTypeNames::touchstart) |
| 835 focusPlugin(); | 839 focusPlugin(); |
| 836 | 840 |
| 837 WebCursorInfo cursorInfo; | 841 WebCursorInfo cursorInfo; |
| 838 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 842 // TODO(nzolghadr): We need to plumb the coalesced event here. |
| 843 if (m_webPlugin->handleInputEvent( |
| 844 webEvent, std::vector<const WebInputEvent*>(), cursorInfo) != |
| 839 WebInputEventResult::NotHandled) | 845 WebInputEventResult::NotHandled) |
| 840 event->setDefaultHandled(); | 846 event->setDefaultHandled(); |
| 841 // FIXME: Can a plugin change the cursor from a touch-event callback? | 847 // FIXME: Can a plugin change the cursor from a touch-event callback? |
| 842 return; | 848 return; |
| 843 } | 849 } |
| 844 case TouchEventRequestTypeSynthesizedMouse: | 850 case TouchEventRequestTypeSynthesizedMouse: |
| 845 synthesizeMouseEventIfPossible(event); | 851 synthesizeMouseEventIfPossible(event); |
| 846 return; | 852 return; |
| 847 } | 853 } |
| 848 } | 854 } |
| 849 | 855 |
| 850 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) { | 856 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) { |
| 851 WebGestureEventBuilder webEvent(LayoutItem(m_element->layoutObject()), | 857 WebGestureEventBuilder webEvent(LayoutItem(m_element->layoutObject()), |
| 852 *event); | 858 *event); |
| 853 if (webEvent.type == WebInputEvent::Undefined) | 859 if (webEvent.type == WebInputEvent::Undefined) |
| 854 return; | 860 return; |
| 855 if (event->type() == EventTypeNames::gesturetapdown) | 861 if (event->type() == EventTypeNames::gesturetapdown) |
| 856 focusPlugin(); | 862 focusPlugin(); |
| 857 WebCursorInfo cursorInfo; | 863 WebCursorInfo cursorInfo; |
| 858 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 864 if (m_webPlugin->handleInputEvent( |
| 865 webEvent, std::vector<const WebInputEvent*>(), cursorInfo) != |
| 859 WebInputEventResult::NotHandled) { | 866 WebInputEventResult::NotHandled) { |
| 860 event->setDefaultHandled(); | 867 event->setDefaultHandled(); |
| 861 return; | 868 return; |
| 862 } | 869 } |
| 863 | 870 |
| 864 // FIXME: Can a plugin change the cursor from a touch-event callback? | 871 // FIXME: Can a plugin change the cursor from a touch-event callback? |
| 865 } | 872 } |
| 866 | 873 |
| 867 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) { | 874 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) { |
| 868 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), | 875 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), |
| 869 *event); | 876 *event); |
| 870 if (webEvent.type == WebInputEvent::Undefined) | 877 if (webEvent.type == WebInputEvent::Undefined) |
| 871 return; | 878 return; |
| 872 | 879 |
| 873 WebCursorInfo cursorInfo; | 880 WebCursorInfo cursorInfo; |
| 874 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 881 if (m_webPlugin->handleInputEvent( |
| 882 webEvent, std::vector<const WebInputEvent*>(), cursorInfo) != |
| 875 WebInputEventResult::NotHandled) | 883 WebInputEventResult::NotHandled) |
| 876 event->setDefaultHandled(); | 884 event->setDefaultHandled(); |
| 877 } | 885 } |
| 878 | 886 |
| 879 void WebPluginContainerImpl::focusPlugin() { | 887 void WebPluginContainerImpl::focusPlugin() { |
| 880 LocalFrame& containingFrame = toFrameView(parent())->frame(); | 888 LocalFrame& containingFrame = toFrameView(parent())->frame(); |
| 881 if (Page* currentPage = containingFrame.page()) | 889 if (Page* currentPage = containingFrame.page()) |
| 882 currentPage->focusController().setFocusedElement(m_element, | 890 currentPage->focusController().setFocusedElement(m_element, |
| 883 &containingFrame); | 891 &containingFrame); |
| 884 else | 892 else |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 // frame view. | 981 // frame view. |
| 974 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); | 982 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); |
| 975 } | 983 } |
| 976 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 984 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 977 // Convert to the plugin position. | 985 // Convert to the plugin position. |
| 978 for (size_t i = 0; i < cutOutRects.size(); i++) | 986 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 979 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 987 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 980 } | 988 } |
| 981 | 989 |
| 982 } // namespace blink | 990 } // namespace blink |
| OLD | NEW |