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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 FrameView* parentView = toFrameView(parent()); | 784 FrameView* parentView = toFrameView(parent()); |
785 | 785 |
786 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); | 786 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); |
787 if (webEvent.type == WebInputEvent::Undefined) | 787 if (webEvent.type == WebInputEvent::Undefined) |
788 return; | 788 return; |
789 | 789 |
790 if (event->type() == EventTypeNames::mousedown) | 790 if (event->type() == EventTypeNames::mousedown) |
791 focusPlugin(); | 791 focusPlugin(); |
792 | 792 |
793 WebCursorInfo cursorInfo; | 793 WebCursorInfo cursorInfo; |
794 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) | 794 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu
lt::NotHandled) |
795 event->setDefaultHandled(); | 795 event->setDefaultHandled(); |
796 | 796 |
797 // A windowless plugin can change the cursor in response to a mouse move | 797 // A windowless plugin can change the cursor in response to a mouse move |
798 // event. We need to reflect the changed cursor in the frame view as the | 798 // event. We need to reflect the changed cursor in the frame view as the |
799 // mouse is moved in the boundaries of the windowless plugin. | 799 // mouse is moved in the boundaries of the windowless plugin. |
800 Page* page = parentView->frame().page(); | 800 Page* page = parentView->frame().page(); |
801 if (!page) | 801 if (!page) |
802 return; | 802 return; |
803 toChromeClientImpl(page->chromeClient()).setCursorForPlugin(cursorInfo); | 803 toChromeClientImpl(page->chromeClient()).setCursorForPlugin(cursorInfo); |
804 } | 804 } |
(...skipping 24 matching lines...) Expand all Loading... |
829 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask,
dragLocation, dragScreenLocation); | 829 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask,
dragLocation, dragScreenLocation); |
830 } | 830 } |
831 | 831 |
832 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) | 832 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) |
833 { | 833 { |
834 WebMouseWheelEventBuilder webEvent(this, m_element->layoutObject(), *event); | 834 WebMouseWheelEventBuilder webEvent(this, m_element->layoutObject(), *event); |
835 if (webEvent.type == WebInputEvent::Undefined) | 835 if (webEvent.type == WebInputEvent::Undefined) |
836 return; | 836 return; |
837 | 837 |
838 WebCursorInfo cursorInfo; | 838 WebCursorInfo cursorInfo; |
839 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) | 839 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu
lt::NotHandled) |
840 event->setDefaultHandled(); | 840 event->setDefaultHandled(); |
841 } | 841 } |
842 | 842 |
843 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) | 843 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) |
844 { | 844 { |
845 WebKeyboardEventBuilder webEvent(*event); | 845 WebKeyboardEventBuilder webEvent(*event); |
846 if (webEvent.type == WebInputEvent::Undefined) | 846 if (webEvent.type == WebInputEvent::Undefined) |
847 return; | 847 return; |
848 | 848 |
849 if (webEvent.type == WebInputEvent::KeyDown) { | 849 if (webEvent.type == WebInputEvent::KeyDown) { |
(...skipping 22 matching lines...) Expand all Loading... |
872 webEvent.modifiers |= currentInputEvent->modifiers & | 872 webEvent.modifiers |= currentInputEvent->modifiers & |
873 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn); | 873 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn); |
874 } | 874 } |
875 | 875 |
876 // Give the client a chance to issue edit comamnds. | 876 // Give the client a chance to issue edit comamnds. |
877 WebViewImpl* view = WebViewImpl::fromPage(m_element->document().frame()->pag
e()); | 877 WebViewImpl* view = WebViewImpl::fromPage(m_element->document().frame()->pag
e()); |
878 if (m_webPlugin->supportsEditCommands() && view->client()) | 878 if (m_webPlugin->supportsEditCommands() && view->client()) |
879 view->client()->handleCurrentKeyboardEvent(); | 879 view->client()->handleCurrentKeyboardEvent(); |
880 | 880 |
881 WebCursorInfo cursorInfo; | 881 WebCursorInfo cursorInfo; |
882 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) | 882 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu
lt::NotHandled) |
883 event->setDefaultHandled(); | 883 event->setDefaultHandled(); |
884 } | 884 } |
885 | 885 |
886 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) | 886 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) |
887 { | 887 { |
888 switch (m_touchEventRequestType) { | 888 switch (m_touchEventRequestType) { |
889 case TouchEventRequestTypeNone: | 889 case TouchEventRequestTypeNone: |
890 return; | 890 return; |
891 case TouchEventRequestTypeRaw: { | 891 case TouchEventRequestTypeRaw: { |
892 WebTouchEventBuilder webEvent(m_element->layoutObject(), *event); | 892 WebTouchEventBuilder webEvent(m_element->layoutObject(), *event); |
893 if (webEvent.type == WebInputEvent::Undefined) | 893 if (webEvent.type == WebInputEvent::Undefined) |
894 return; | 894 return; |
895 | 895 |
896 if (event->type() == EventTypeNames::touchstart) | 896 if (event->type() == EventTypeNames::touchstart) |
897 focusPlugin(); | 897 focusPlugin(); |
898 | 898 |
899 WebCursorInfo cursorInfo; | 899 WebCursorInfo cursorInfo; |
900 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) | 900 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEvent
Result::NotHandled) |
901 event->setDefaultHandled(); | 901 event->setDefaultHandled(); |
902 // FIXME: Can a plugin change the cursor from a touch-event callback? | 902 // FIXME: Can a plugin change the cursor from a touch-event callback? |
903 return; | 903 return; |
904 } | 904 } |
905 case TouchEventRequestTypeSynthesizedMouse: | 905 case TouchEventRequestTypeSynthesizedMouse: |
906 synthesizeMouseEventIfPossible(event); | 906 synthesizeMouseEventIfPossible(event); |
907 return; | 907 return; |
908 } | 908 } |
909 } | 909 } |
910 | 910 |
911 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) | 911 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) |
912 { | 912 { |
913 WebGestureEventBuilder webEvent(m_element->layoutObject(), *event); | 913 WebGestureEventBuilder webEvent(m_element->layoutObject(), *event); |
914 if (webEvent.type == WebInputEvent::Undefined) | 914 if (webEvent.type == WebInputEvent::Undefined) |
915 return; | 915 return; |
916 if (event->type() == EventTypeNames::gesturetapdown) | 916 if (event->type() == EventTypeNames::gesturetapdown) |
917 focusPlugin(); | 917 focusPlugin(); |
918 WebCursorInfo cursorInfo; | 918 WebCursorInfo cursorInfo; |
919 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { | 919 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu
lt::NotHandled) { |
920 event->setDefaultHandled(); | 920 event->setDefaultHandled(); |
921 return; | 921 return; |
922 } | 922 } |
923 | 923 |
924 // FIXME: Can a plugin change the cursor from a touch-event callback? | 924 // FIXME: Can a plugin change the cursor from a touch-event callback? |
925 } | 925 } |
926 | 926 |
927 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) | 927 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) |
928 { | 928 { |
929 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); | 929 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); |
930 if (webEvent.type == WebInputEvent::Undefined) | 930 if (webEvent.type == WebInputEvent::Undefined) |
931 return; | 931 return; |
932 | 932 |
933 WebCursorInfo cursorInfo; | 933 WebCursorInfo cursorInfo; |
934 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) | 934 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu
lt::NotHandled) |
935 event->setDefaultHandled(); | 935 event->setDefaultHandled(); |
936 } | 936 } |
937 | 937 |
938 void WebPluginContainerImpl::focusPlugin() | 938 void WebPluginContainerImpl::focusPlugin() |
939 { | 939 { |
940 LocalFrame& containingFrame = toFrameView(parent())->frame(); | 940 LocalFrame& containingFrame = toFrameView(parent())->frame(); |
941 if (Page* currentPage = containingFrame.page()) | 941 if (Page* currentPage = containingFrame.page()) |
942 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); | 942 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); |
943 else | 943 else |
944 containingFrame.document()->setFocusedElement(m_element, FocusParams(Sel
ectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr)); | 944 containingFrame.document()->setFocusedElement(m_element, FocusParams(Sel
ectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 // frame view. | 1003 // frame view. |
1004 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 1004 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
1005 } | 1005 } |
1006 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 1006 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
1007 // Convert to the plugin position. | 1007 // Convert to the plugin position. |
1008 for (size_t i = 0; i < cutOutRects.size(); i++) | 1008 for (size_t i = 0; i < cutOutRects.size(); i++) |
1009 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 1009 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
1010 } | 1010 } |
1011 | 1011 |
1012 } // namespace blinkf | 1012 } // namespace blinkf |
OLD | NEW |