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

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

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: Creating CoalescedWebInputEvent Created 4 years, 1 month 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "platform/RuntimeEnabledFeatures.h" 74 #include "platform/RuntimeEnabledFeatures.h"
75 #include "platform/UserGestureIndicator.h" 75 #include "platform/UserGestureIndicator.h"
76 #include "platform/exported/WrappedResourceResponse.h" 76 #include "platform/exported/WrappedResourceResponse.h"
77 #include "platform/geometry/LayoutRect.h" 77 #include "platform/geometry/LayoutRect.h"
78 #include "platform/graphics/GraphicsContext.h" 78 #include "platform/graphics/GraphicsContext.h"
79 #include "platform/graphics/GraphicsLayer.h" 79 #include "platform/graphics/GraphicsLayer.h"
80 #include "platform/graphics/paint/CullRect.h" 80 #include "platform/graphics/paint/CullRect.h"
81 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" 81 #include "platform/graphics/paint/ForeignLayerDisplayItem.h"
82 #include "platform/scroll/ScrollAnimatorBase.h" 82 #include "platform/scroll/ScrollAnimatorBase.h"
83 #include "platform/scroll/ScrollbarTheme.h" 83 #include "platform/scroll/ScrollbarTheme.h"
84 #include "public/platform/CoalescedWebInputEvent.h"
84 #include "public/platform/Platform.h" 85 #include "public/platform/Platform.h"
85 #include "public/platform/WebClipboard.h" 86 #include "public/platform/WebClipboard.h"
86 #include "public/platform/WebCompositorSupport.h" 87 #include "public/platform/WebCompositorSupport.h"
87 #include "public/platform/WebCursorInfo.h" 88 #include "public/platform/WebCursorInfo.h"
88 #include "public/platform/WebDragData.h" 89 #include "public/platform/WebDragData.h"
89 #include "public/platform/WebExternalTextureLayer.h" 90 #include "public/platform/WebExternalTextureLayer.h"
90 #include "public/platform/WebInputEvent.h" 91 #include "public/platform/WebInputEvent.h"
91 #include "public/platform/WebRect.h" 92 #include "public/platform/WebRect.h"
92 #include "public/platform/WebString.h" 93 #include "public/platform/WebString.h"
93 #include "public/platform/WebURL.h" 94 #include "public/platform/WebURL.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 712
712 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), 713 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()),
713 *event); 714 *event);
714 if (webEvent.type == WebInputEvent::Undefined) 715 if (webEvent.type == WebInputEvent::Undefined)
715 return; 716 return;
716 717
717 if (event->type() == EventTypeNames::mousedown) 718 if (event->type() == EventTypeNames::mousedown)
718 focusPlugin(); 719 focusPlugin();
719 720
720 WebCursorInfo cursorInfo; 721 WebCursorInfo cursorInfo;
721 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != 722 // TODO(nzolghadr): We need to plumb the coalesced event here.
723 if (m_webPlugin->handleInputEvent(CoalescedWebInputEvent(webEvent),
724 cursorInfo) !=
722 WebInputEventResult::NotHandled) 725 WebInputEventResult::NotHandled)
723 event->setDefaultHandled(); 726 event->setDefaultHandled();
724 727
725 // A windowless plugin can change the cursor in response to a mouse move 728 // 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 729 // 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. 730 // mouse is moved in the boundaries of the windowless plugin.
728 Page* page = parentView->frame().page(); 731 Page* page = parentView->frame().page();
729 if (!page) 732 if (!page)
730 return; 733 return;
731 toChromeClientImpl(page->chromeClient()) 734 toChromeClientImpl(page->chromeClient())
(...skipping 29 matching lines...) Expand all
761 dragLocation, dragScreenLocation); 764 dragLocation, dragScreenLocation);
762 } 765 }
763 766
764 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) { 767 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) {
765 WebMouseWheelEventBuilder webEvent( 768 WebMouseWheelEventBuilder webEvent(
766 this, LayoutItem(m_element->layoutObject()), *event); 769 this, LayoutItem(m_element->layoutObject()), *event);
767 if (webEvent.type == WebInputEvent::Undefined) 770 if (webEvent.type == WebInputEvent::Undefined)
768 return; 771 return;
769 772
770 WebCursorInfo cursorInfo; 773 WebCursorInfo cursorInfo;
771 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != 774 if (m_webPlugin->handleInputEvent(CoalescedWebInputEvent(webEvent),
775 cursorInfo) !=
772 WebInputEventResult::NotHandled) 776 WebInputEventResult::NotHandled)
773 event->setDefaultHandled(); 777 event->setDefaultHandled();
774 } 778 }
775 779
776 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) { 780 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) {
777 WebKeyboardEventBuilder webEvent(*event); 781 WebKeyboardEventBuilder webEvent(*event);
778 if (webEvent.type == WebInputEvent::Undefined) 782 if (webEvent.type == WebInputEvent::Undefined)
779 return; 783 return;
780 784
781 if (webEvent.type == WebInputEvent::KeyDown) { 785 if (webEvent.type == WebInputEvent::KeyDown) {
(...skipping 27 matching lines...) Expand all
809 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn); 813 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn);
810 } 814 }
811 815
812 // Give the client a chance to issue edit comamnds. 816 // Give the client a chance to issue edit comamnds.
813 WebLocalFrameImpl* webFrame = 817 WebLocalFrameImpl* webFrame =
814 WebLocalFrameImpl::fromFrame(m_element->document().frame()); 818 WebLocalFrameImpl::fromFrame(m_element->document().frame());
815 if (m_webPlugin->supportsEditCommands()) 819 if (m_webPlugin->supportsEditCommands())
816 webFrame->client()->handleCurrentKeyboardEvent(); 820 webFrame->client()->handleCurrentKeyboardEvent();
817 821
818 WebCursorInfo cursorInfo; 822 WebCursorInfo cursorInfo;
819 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != 823 if (m_webPlugin->handleInputEvent(CoalescedWebInputEvent(webEvent),
824 cursorInfo) !=
820 WebInputEventResult::NotHandled) 825 WebInputEventResult::NotHandled)
821 event->setDefaultHandled(); 826 event->setDefaultHandled();
822 } 827 }
823 828
824 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) { 829 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) {
825 switch (m_touchEventRequestType) { 830 switch (m_touchEventRequestType) {
826 case TouchEventRequestTypeNone: 831 case TouchEventRequestTypeNone:
827 return; 832 return;
828 case TouchEventRequestTypeRaw: { 833 case TouchEventRequestTypeRaw: {
829 WebTouchEventBuilder webEvent(LayoutItem(m_element->layoutObject()), 834 WebTouchEventBuilder webEvent(LayoutItem(m_element->layoutObject()),
830 *event); 835 *event);
831 if (webEvent.type == WebInputEvent::Undefined) 836 if (webEvent.type == WebInputEvent::Undefined)
832 return; 837 return;
833 838
834 if (event->type() == EventTypeNames::touchstart) 839 if (event->type() == EventTypeNames::touchstart)
835 focusPlugin(); 840 focusPlugin();
836 841
837 WebCursorInfo cursorInfo; 842 WebCursorInfo cursorInfo;
838 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != 843 // TODO(nzolghadr): We need to plumb the coalesced event here.
844 if (m_webPlugin->handleInputEvent(CoalescedWebInputEvent(webEvent),
845 cursorInfo) !=
839 WebInputEventResult::NotHandled) 846 WebInputEventResult::NotHandled)
840 event->setDefaultHandled(); 847 event->setDefaultHandled();
841 // FIXME: Can a plugin change the cursor from a touch-event callback? 848 // FIXME: Can a plugin change the cursor from a touch-event callback?
842 return; 849 return;
843 } 850 }
844 case TouchEventRequestTypeSynthesizedMouse: 851 case TouchEventRequestTypeSynthesizedMouse:
845 synthesizeMouseEventIfPossible(event); 852 synthesizeMouseEventIfPossible(event);
846 return; 853 return;
847 } 854 }
848 } 855 }
849 856
850 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) { 857 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) {
851 WebGestureEventBuilder webEvent(LayoutItem(m_element->layoutObject()), 858 WebGestureEventBuilder webEvent(LayoutItem(m_element->layoutObject()),
852 *event); 859 *event);
853 if (webEvent.type == WebInputEvent::Undefined) 860 if (webEvent.type == WebInputEvent::Undefined)
854 return; 861 return;
855 if (event->type() == EventTypeNames::gesturetapdown) 862 if (event->type() == EventTypeNames::gesturetapdown)
856 focusPlugin(); 863 focusPlugin();
857 WebCursorInfo cursorInfo; 864 WebCursorInfo cursorInfo;
858 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != 865 if (m_webPlugin->handleInputEvent(CoalescedWebInputEvent(webEvent),
866 cursorInfo) !=
859 WebInputEventResult::NotHandled) { 867 WebInputEventResult::NotHandled) {
860 event->setDefaultHandled(); 868 event->setDefaultHandled();
861 return; 869 return;
862 } 870 }
863 871
864 // FIXME: Can a plugin change the cursor from a touch-event callback? 872 // FIXME: Can a plugin change the cursor from a touch-event callback?
865 } 873 }
866 874
867 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) { 875 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) {
868 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), 876 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()),
869 *event); 877 *event);
870 if (webEvent.type == WebInputEvent::Undefined) 878 if (webEvent.type == WebInputEvent::Undefined)
871 return; 879 return;
872 880
873 WebCursorInfo cursorInfo; 881 WebCursorInfo cursorInfo;
874 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != 882 if (m_webPlugin->handleInputEvent(CoalescedWebInputEvent(webEvent),
883 cursorInfo) !=
875 WebInputEventResult::NotHandled) 884 WebInputEventResult::NotHandled)
876 event->setDefaultHandled(); 885 event->setDefaultHandled();
877 } 886 }
878 887
879 void WebPluginContainerImpl::focusPlugin() { 888 void WebPluginContainerImpl::focusPlugin() {
880 LocalFrame& containingFrame = toFrameView(parent())->frame(); 889 LocalFrame& containingFrame = toFrameView(parent())->frame();
881 if (Page* currentPage = containingFrame.page()) 890 if (Page* currentPage = containingFrame.page())
882 currentPage->focusController().setFocusedElement(m_element, 891 currentPage->focusController().setFocusedElement(m_element,
883 &containingFrame); 892 &containingFrame);
884 else 893 else
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 // frame view. 982 // frame view.
974 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); 983 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect);
975 } 984 }
976 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 985 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
977 // Convert to the plugin position. 986 // Convert to the plugin position.
978 for (size_t i = 0; i < cutOutRects.size(); i++) 987 for (size_t i = 0; i < cutOutRects.size(); i++)
979 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 988 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
980 } 989 }
981 990
982 } // namespace blink 991 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698