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

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

Issue 2539283002: Remove PlatformGestureEvent in favour of using WebGestureEvent (Closed)
Patch Set: Add missing copyright on new file Created 4 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "core/layout/api/LayoutViewItem.h" 63 #include "core/layout/api/LayoutViewItem.h"
64 #include "core/loader/FrameLoadRequest.h" 64 #include "core/loader/FrameLoadRequest.h"
65 #include "core/page/FocusController.h" 65 #include "core/page/FocusController.h"
66 #include "core/page/Page.h" 66 #include "core/page/Page.h"
67 #include "core/page/scrolling/ScrollingCoordinator.h" 67 #include "core/page/scrolling/ScrollingCoordinator.h"
68 #include "core/paint/LayoutObjectDrawingRecorder.h" 68 #include "core/paint/LayoutObjectDrawingRecorder.h"
69 #include "core/paint/PaintLayer.h" 69 #include "core/paint/PaintLayer.h"
70 #include "modules/plugins/PluginOcclusionSupport.h" 70 #include "modules/plugins/PluginOcclusionSupport.h"
71 #include "platform/HostWindow.h" 71 #include "platform/HostWindow.h"
72 #include "platform/KeyboardCodes.h" 72 #include "platform/KeyboardCodes.h"
73 #include "platform/PlatformGestureEvent.h"
74 #include "platform/RuntimeEnabledFeatures.h" 73 #include "platform/RuntimeEnabledFeatures.h"
75 #include "platform/UserGestureIndicator.h" 74 #include "platform/UserGestureIndicator.h"
76 #include "platform/exported/WrappedResourceResponse.h" 75 #include "platform/exported/WrappedResourceResponse.h"
77 #include "platform/geometry/LayoutRect.h" 76 #include "platform/geometry/LayoutRect.h"
78 #include "platform/graphics/GraphicsContext.h" 77 #include "platform/graphics/GraphicsContext.h"
79 #include "platform/graphics/GraphicsLayer.h" 78 #include "platform/graphics/GraphicsLayer.h"
80 #include "platform/graphics/paint/CullRect.h" 79 #include "platform/graphics/paint/CullRect.h"
81 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" 80 #include "platform/graphics/paint/ForeignLayerDisplayItem.h"
82 #include "platform/scroll/ScrollAnimatorBase.h" 81 #include "platform/scroll/ScrollAnimatorBase.h"
83 #include "platform/scroll/ScrollbarTheme.h" 82 #include "platform/scroll/ScrollbarTheme.h"
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 // FIXME: Can a plugin change the cursor from a touch-event callback? 827 // FIXME: Can a plugin change the cursor from a touch-event callback?
829 return; 828 return;
830 } 829 }
831 case TouchEventRequestTypeSynthesizedMouse: 830 case TouchEventRequestTypeSynthesizedMouse:
832 synthesizeMouseEventIfPossible(event); 831 synthesizeMouseEventIfPossible(event);
833 return; 832 return;
834 } 833 }
835 } 834 }
836 835
837 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) { 836 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) {
838 WebGestureEventBuilder webEvent(LayoutItem(m_element->layoutObject()), 837 if (event->nativeEvent().type == WebInputEvent::Undefined)
839 *event);
840 if (webEvent.type == WebInputEvent::Undefined)
841 return; 838 return;
842 if (event->type() == EventTypeNames::gesturetapdown) 839 if (event->nativeEvent().type == WebInputEvent::GestureTapDown)
843 focusPlugin(); 840 focusPlugin();
841
842 // Take a copy of the event and translate it into the coordinate
843 // system of the plugin.
844 WebGestureEvent translatedEvent = event->nativeEvent();
845 WebFloatPoint absoluteRootFrameLocation =
846 event->nativeEvent().positionInRootFrame();
847 IntPoint localPoint =
848 roundedIntPoint(m_element->layoutObject()->absoluteToLocal(
849 absoluteRootFrameLocation, UseTransforms));
850 translatedEvent.flattenTransform();
851 translatedEvent.x = localPoint.x();
852 translatedEvent.y = localPoint.y();
853
844 WebCursorInfo cursorInfo; 854 WebCursorInfo cursorInfo;
845 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != 855 if (m_webPlugin->handleInputEvent(translatedEvent, cursorInfo) !=
846 WebInputEventResult::NotHandled) { 856 WebInputEventResult::NotHandled) {
847 event->setDefaultHandled(); 857 event->setDefaultHandled();
848 return; 858 return;
849 } 859 }
850 860
851 // FIXME: Can a plugin change the cursor from a touch-event callback? 861 // FIXME: Can a plugin change the cursor from a touch-event callback?
852 } 862 }
853 863
854 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) { 864 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) {
855 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), 865 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 // frame view. 970 // frame view.
961 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); 971 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect);
962 } 972 }
963 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 973 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
964 // Convert to the plugin position. 974 // Convert to the plugin position.
965 for (size_t i = 0; i < cutOutRects.size(); i++) 975 for (size_t i = 0; i < cutOutRects.size(); i++)
966 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 976 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
967 } 977 }
968 978
969 } // namespace blink 979 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebPagePopupImpl.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698