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

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

Issue 212893005: Revert "Change event handling order in HTMLPlugInElement." (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months 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
« no previous file with comments | « Source/core/html/HTMLPlugInElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 m_scrollbarGroup->setLastMousePosition(IntPoint(event->x(), event->y())) ; 706 m_scrollbarGroup->setLastMousePosition(IntPoint(event->x(), event->y())) ;
707 if (event->type() == EventTypeNames::mousemove) 707 if (event->type() == EventTypeNames::mousemove)
708 m_scrollbarGroup->scrollAnimator()->mouseMovedInContentArea(); 708 m_scrollbarGroup->scrollAnimator()->mouseMovedInContentArea();
709 else if (event->type() == EventTypeNames::mouseover) 709 else if (event->type() == EventTypeNames::mouseover)
710 m_scrollbarGroup->scrollAnimator()->mouseEnteredContentArea(); 710 m_scrollbarGroup->scrollAnimator()->mouseEnteredContentArea();
711 else if (event->type() == EventTypeNames::mouseout) 711 else if (event->type() == EventTypeNames::mouseout)
712 m_scrollbarGroup->scrollAnimator()->mouseExitedContentArea(); 712 m_scrollbarGroup->scrollAnimator()->mouseExitedContentArea();
713 } 713 }
714 714
715 WebCursorInfo cursorInfo; 715 WebCursorInfo cursorInfo;
716 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { 716 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
717 event->stopPropagation();
718 event->setDefaultHandled(); 717 event->setDefaultHandled();
719 }
720 718
721 // A windowless plugin can change the cursor in response to a mouse move 719 // A windowless plugin can change the cursor in response to a mouse move
722 // event. We need to reflect the changed cursor in the frame view as the 720 // event. We need to reflect the changed cursor in the frame view as the
723 // mouse is moved in the boundaries of the windowless plugin. 721 // mouse is moved in the boundaries of the windowless plugin.
724 Page* page = parentView->frame().page(); 722 Page* page = parentView->frame().page();
725 if (!page) 723 if (!page)
726 return; 724 return;
727 toChromeClientImpl(page->chrome().client()).setCursorForPlugin(cursorInfo); 725 toChromeClientImpl(page->chrome().client()).setCursorForPlugin(cursorInfo);
728 } 726 }
729 727
(...skipping 23 matching lines...) Expand all
753 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask, dragLocation, dragScreenLocation); 751 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask, dragLocation, dragScreenLocation);
754 } 752 }
755 753
756 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) 754 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event)
757 { 755 {
758 WebMouseWheelEventBuilder webEvent(this, m_element->renderer(), *event); 756 WebMouseWheelEventBuilder webEvent(this, m_element->renderer(), *event);
759 if (webEvent.type == WebInputEvent::Undefined) 757 if (webEvent.type == WebInputEvent::Undefined)
760 return; 758 return;
761 759
762 WebCursorInfo cursorInfo; 760 WebCursorInfo cursorInfo;
763 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { 761 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
764 event->stopPropagation();
765 event->setDefaultHandled(); 762 event->setDefaultHandled();
766 }
767 } 763 }
768 764
769 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) 765 void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event)
770 { 766 {
771 WebKeyboardEventBuilder webEvent(*event); 767 WebKeyboardEventBuilder webEvent(*event);
772 if (webEvent.type == WebInputEvent::Undefined) 768 if (webEvent.type == WebInputEvent::Undefined)
773 return; 769 return;
774 770
775 if (webEvent.type == WebInputEvent::KeyDown) { 771 if (webEvent.type == WebInputEvent::KeyDown) {
776 #if OS(MACOSX) 772 #if OS(MACOSX)
(...skipping 21 matching lines...) Expand all
798 webEvent.modifiers |= currentInputEvent->modifiers & 794 webEvent.modifiers |= currentInputEvent->modifiers &
799 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn); 795 (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn);
800 } 796 }
801 797
802 // Give the client a chance to issue edit comamnds. 798 // Give the client a chance to issue edit comamnds.
803 WebViewImpl* view = WebViewImpl::fromPage(m_element->document().frame()->pag e()); 799 WebViewImpl* view = WebViewImpl::fromPage(m_element->document().frame()->pag e());
804 if (m_webPlugin->supportsEditCommands() && view->client()) 800 if (m_webPlugin->supportsEditCommands() && view->client())
805 view->client()->handleCurrentKeyboardEvent(); 801 view->client()->handleCurrentKeyboardEvent();
806 802
807 WebCursorInfo cursorInfo; 803 WebCursorInfo cursorInfo;
808 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { 804 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
809 event->stopPropagation();
810 event->setDefaultHandled(); 805 event->setDefaultHandled();
811 }
812 } 806 }
813 807
814 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) 808 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event)
815 { 809 {
816 switch (m_touchEventRequestType) { 810 switch (m_touchEventRequestType) {
817 case TouchEventRequestTypeNone: 811 case TouchEventRequestTypeNone:
818 return; 812 return;
819 case TouchEventRequestTypeRaw: { 813 case TouchEventRequestTypeRaw: {
820 WebTouchEventBuilder webEvent(this, m_element->renderer(), *event); 814 WebTouchEventBuilder webEvent(this, m_element->renderer(), *event);
821 if (webEvent.type == WebInputEvent::Undefined) 815 if (webEvent.type == WebInputEvent::Undefined)
822 return; 816 return;
823 817
824 if (event->type() == EventTypeNames::touchstart) 818 if (event->type() == EventTypeNames::touchstart)
825 focusPlugin(); 819 focusPlugin();
826 820
827 WebCursorInfo cursorInfo; 821 WebCursorInfo cursorInfo;
828 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { 822 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
829 event->stopPropagation();
830 event->setDefaultHandled(); 823 event->setDefaultHandled();
831 }
832 // FIXME: Can a plugin change the cursor from a touch-event callback? 824 // FIXME: Can a plugin change the cursor from a touch-event callback?
833 return; 825 return;
834 } 826 }
835 case TouchEventRequestTypeSynthesizedMouse: 827 case TouchEventRequestTypeSynthesizedMouse:
836 synthesizeMouseEventIfPossible(event); 828 synthesizeMouseEventIfPossible(event);
837 return; 829 return;
838 } 830 }
839 } 831 }
840 832
841 static inline bool gestureScrollHelper(ScrollbarGroup* scrollbarGroup, ScrollDir ection positiveDirection, ScrollDirection negativeDirection, float delta) 833 static inline bool gestureScrollHelper(ScrollbarGroup* scrollbarGroup, ScrollDir ection positiveDirection, ScrollDirection negativeDirection, float delta)
842 { 834 {
843 if (!delta) 835 if (!delta)
844 return false; 836 return false;
845 float absDelta = delta > 0 ? delta : -delta; 837 float absDelta = delta > 0 ? delta : -delta;
846 return scrollbarGroup->scroll(delta < 0 ? negativeDirection : positiveDirect ion, ScrollByPrecisePixel, absDelta); 838 return scrollbarGroup->scroll(delta < 0 ? negativeDirection : positiveDirect ion, ScrollByPrecisePixel, absDelta);
847 } 839 }
848 840
849 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) 841 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event)
850 { 842 {
851 WebGestureEventBuilder webEvent(this, m_element->renderer(), *event); 843 WebGestureEventBuilder webEvent(this, m_element->renderer(), *event);
852 if (webEvent.type == WebInputEvent::Undefined) 844 if (webEvent.type == WebInputEvent::Undefined)
853 return; 845 return;
854 WebCursorInfo cursorInfo; 846 WebCursorInfo cursorInfo;
855 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { 847 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) {
856 event->stopPropagation();
857 event->setDefaultHandled(); 848 event->setDefaultHandled();
858 return; 849 return;
859 } 850 }
860 851
861 if (webEvent.type == WebInputEvent::GestureScrollUpdate || webEvent.type == WebInputEvent::GestureScrollUpdateWithoutPropagation) { 852 if (webEvent.type == WebInputEvent::GestureScrollUpdate || webEvent.type == WebInputEvent::GestureScrollUpdateWithoutPropagation) {
862 if (!m_scrollbarGroup) 853 if (!m_scrollbarGroup)
863 return; 854 return;
864 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollLeft, ScrollRight, webEvent.data.scrollUpdate.deltaX)) 855 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollLeft, ScrollRight, webEvent.data.scrollUpdate.deltaX))
865 event->setDefaultHandled(); 856 event->setDefaultHandled();
866 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollUp, ScrollDown, we bEvent.data.scrollUpdate.deltaY)) 857 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollUp, ScrollDown, we bEvent.data.scrollUpdate.deltaY))
867 event->setDefaultHandled(); 858 event->setDefaultHandled();
868 } 859 }
869 // FIXME: Can a plugin change the cursor from a touch-event callback? 860 // FIXME: Can a plugin change the cursor from a touch-event callback?
870 } 861 }
871 862
872 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) 863 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event)
873 { 864 {
874 WebMouseEventBuilder webEvent(this, m_element->renderer(), *event); 865 WebMouseEventBuilder webEvent(this, m_element->renderer(), *event);
875 if (webEvent.type == WebInputEvent::Undefined) 866 if (webEvent.type == WebInputEvent::Undefined)
876 return; 867 return;
877 868
878 WebCursorInfo cursorInfo; 869 WebCursorInfo cursorInfo;
879 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { 870 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
880 event->stopPropagation();
881 event->setDefaultHandled(); 871 event->setDefaultHandled();
882 }
883 } 872 }
884 873
885 void WebPluginContainerImpl::focusPlugin() 874 void WebPluginContainerImpl::focusPlugin()
886 { 875 {
887 LocalFrame& containingFrame = toFrameView(parent())->frame(); 876 LocalFrame& containingFrame = toFrameView(parent())->frame();
888 if (Page* currentPage = containingFrame.page()) 877 if (Page* currentPage = containingFrame.page())
889 currentPage->focusController().setFocusedElement(m_element, &containingF rame); 878 currentPage->focusController().setFocusedElement(m_element, &containingF rame);
890 else 879 else
891 containingFrame.document()->setFocusedElement(m_element); 880 containingFrame.document()->setFocusedElement(m_element);
892 } 881 }
(...skipping 28 matching lines...) Expand all
921 // Take our element and get the clip rect from the enclosing layer and 910 // Take our element and get the clip rect from the enclosing layer and
922 // frame view. 911 // frame view.
923 clipRect.intersect( 912 clipRect.intersect(
924 m_element->document().view()->windowClipRectForFrameOwner(m_element) ); 913 m_element->document().view()->windowClipRectForFrameOwner(m_element) );
925 } 914 }
926 915
927 return clipRect; 916 return clipRect;
928 } 917 }
929 918
930 } // namespace blink 919 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLPlugInElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698