Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 1463823003: Return a enumeration of the state of handling of InputEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build failures and disabled click test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 FrameView* parentView = toFrameView(parent()); 791 FrameView* parentView = toFrameView(parent());
792 792
793 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); 793 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event);
794 if (webEvent.type == WebInputEvent::Undefined) 794 if (webEvent.type == WebInputEvent::Undefined)
795 return; 795 return;
796 796
797 if (event->type() == EventTypeNames::mousedown) 797 if (event->type() == EventTypeNames::mousedown)
798 focusPlugin(); 798 focusPlugin();
799 799
800 WebCursorInfo cursorInfo; 800 WebCursorInfo cursorInfo;
801 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) 801 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu lt::NotHandled)
802 event->setDefaultHandled(); 802 event->setDefaultHandled();
803 803
804 // A windowless plugin can change the cursor in response to a mouse move 804 // A windowless plugin can change the cursor in response to a mouse move
805 // event. We need to reflect the changed cursor in the frame view as the 805 // event. We need to reflect the changed cursor in the frame view as the
806 // mouse is moved in the boundaries of the windowless plugin. 806 // mouse is moved in the boundaries of the windowless plugin.
807 Page* page = parentView->frame().page(); 807 Page* page = parentView->frame().page();
808 if (!page) 808 if (!page)
809 return; 809 return;
810 toChromeClientImpl(page->chromeClient()).setCursorForPlugin(cursorInfo); 810 toChromeClientImpl(page->chromeClient()).setCursorForPlugin(cursorInfo);
811 } 811 }
(...skipping 24 matching lines...) Expand all
836 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask, dragLocation, dragScreenLocation); 836 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask, dragLocation, dragScreenLocation);
837 } 837 }
838 838
839 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) 839 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event)
840 { 840 {
841 WebMouseWheelEventBuilder webEvent(this, m_element->layoutObject(), *event); 841 WebMouseWheelEventBuilder webEvent(this, m_element->layoutObject(), *event);
842 if (webEvent.type == WebInputEvent::Undefined) 842 if (webEvent.type == WebInputEvent::Undefined)
843 return; 843 return;
844 844
845 WebCursorInfo cursorInfo; 845 WebCursorInfo cursorInfo;
846 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) 846 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu lt::NotHandled)
847 event->setDefaultHandled(); 847 event->setDefaultHandled();
848 } 848 }
849 849
850 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) 850 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event)
851 { 851 {
852 WebKeyboardEventBuilder webEvent(*event); 852 WebKeyboardEventBuilder webEvent(*event);
853 if (webEvent.type == WebInputEvent::Undefined) 853 if (webEvent.type == WebInputEvent::Undefined)
854 return; 854 return;
855 855
856 if (webEvent.type == WebInputEvent::KeyDown) { 856 if (webEvent.type == WebInputEvent::KeyDown) {
(...skipping 22 matching lines...) Expand all
879 webEvent.modifiers |= currentInputEvent->modifiers & 879 webEvent.modifiers |= currentInputEvent->modifiers &
880 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn); 880 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn);
881 } 881 }
882 882
883 // Give the client a chance to issue edit comamnds. 883 // Give the client a chance to issue edit comamnds.
884 WebViewImpl* view = WebViewImpl::fromPage(m_element->document().frame()->pag e()); 884 WebViewImpl* view = WebViewImpl::fromPage(m_element->document().frame()->pag e());
885 if (m_webPlugin->supportsEditCommands() && view->client()) 885 if (m_webPlugin->supportsEditCommands() && view->client())
886 view->client()->handleCurrentKeyboardEvent(); 886 view->client()->handleCurrentKeyboardEvent();
887 887
888 WebCursorInfo cursorInfo; 888 WebCursorInfo cursorInfo;
889 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) 889 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu lt::NotHandled)
890 event->setDefaultHandled(); 890 event->setDefaultHandled();
891 } 891 }
892 892
893 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) 893 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event)
894 { 894 {
895 switch (m_touchEventRequestType) { 895 switch (m_touchEventRequestType) {
896 case TouchEventRequestTypeNone: 896 case TouchEventRequestTypeNone:
897 return; 897 return;
898 case TouchEventRequestTypeRaw: { 898 case TouchEventRequestTypeRaw: {
899 WebTouchEventBuilder webEvent(m_element->layoutObject(), *event); 899 WebTouchEventBuilder webEvent(m_element->layoutObject(), *event);
900 if (webEvent.type == WebInputEvent::Undefined) 900 if (webEvent.type == WebInputEvent::Undefined)
901 return; 901 return;
902 902
903 if (event->type() == EventTypeNames::touchstart) 903 if (event->type() == EventTypeNames::touchstart)
904 focusPlugin(); 904 focusPlugin();
905 905
906 WebCursorInfo cursorInfo; 906 WebCursorInfo cursorInfo;
907 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) 907 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEvent Result::NotHandled)
908 event->setDefaultHandled(); 908 event->setDefaultHandled();
909 // FIXME: Can a plugin change the cursor from a touch-event callback? 909 // FIXME: Can a plugin change the cursor from a touch-event callback?
910 return; 910 return;
911 } 911 }
912 case TouchEventRequestTypeSynthesizedMouse: 912 case TouchEventRequestTypeSynthesizedMouse:
913 synthesizeMouseEventIfPossible(event); 913 synthesizeMouseEventIfPossible(event);
914 return; 914 return;
915 } 915 }
916 } 916 }
917 917
918 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) 918 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event)
919 { 919 {
920 WebGestureEventBuilder webEvent(m_element->layoutObject(), *event); 920 WebGestureEventBuilder webEvent(m_element->layoutObject(), *event);
921 if (webEvent.type == WebInputEvent::Undefined) 921 if (webEvent.type == WebInputEvent::Undefined)
922 return; 922 return;
923 if (event->type() == EventTypeNames::gesturetapdown) 923 if (event->type() == EventTypeNames::gesturetapdown)
924 focusPlugin(); 924 focusPlugin();
925 WebCursorInfo cursorInfo; 925 WebCursorInfo cursorInfo;
926 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { 926 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu lt::NotHandled) {
927 event->setDefaultHandled(); 927 event->setDefaultHandled();
928 return; 928 return;
929 } 929 }
930 930
931 // FIXME: Can a plugin change the cursor from a touch-event callback? 931 // FIXME: Can a plugin change the cursor from a touch-event callback?
932 } 932 }
933 933
934 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) 934 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event)
935 { 935 {
936 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); 936 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event);
937 if (webEvent.type == WebInputEvent::Undefined) 937 if (webEvent.type == WebInputEvent::Undefined)
938 return; 938 return;
939 939
940 WebCursorInfo cursorInfo; 940 WebCursorInfo cursorInfo;
941 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) 941 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != WebInputEventResu lt::NotHandled)
942 event->setDefaultHandled(); 942 event->setDefaultHandled();
943 } 943 }
944 944
945 void WebPluginContainerImpl::focusPlugin() 945 void WebPluginContainerImpl::focusPlugin()
946 { 946 {
947 LocalFrame& containingFrame = toFrameView(parent())->frame(); 947 LocalFrame& containingFrame = toFrameView(parent())->frame();
948 if (Page* currentPage = containingFrame.page()) 948 if (Page* currentPage = containingFrame.page())
949 currentPage->focusController().setFocusedElement(m_element, &containingF rame); 949 currentPage->focusController().setFocusedElement(m_element, &containingF rame);
950 else 950 else
951 containingFrame.document()->setFocusedElement(m_element, FocusParams(Sel ectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr)); 951 containingFrame.document()->setFocusedElement(m_element, FocusParams(Sel ectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 // frame view. 1010 // frame view.
1011 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t); 1011 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t);
1012 } 1012 }
1013 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 1013 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
1014 // Convert to the plugin position. 1014 // Convert to the plugin position.
1015 for (size_t i = 0; i < cutOutRects.size(); i++) 1015 for (size_t i = 0; i < cutOutRects.size(); i++)
1016 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 1016 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
1017 } 1017 }
1018 1018
1019 } // namespace blinkf 1019 } // namespace blinkf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698