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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 // FIXME: Can a plugin change the cursor from a touch-event callback? | 839 // FIXME: Can a plugin change the cursor from a touch-event callback? |
841 return; | 840 return; |
842 } | 841 } |
843 case TouchEventRequestTypeSynthesizedMouse: | 842 case TouchEventRequestTypeSynthesizedMouse: |
844 synthesizeMouseEventIfPossible(event); | 843 synthesizeMouseEventIfPossible(event); |
845 return; | 844 return; |
846 } | 845 } |
847 } | 846 } |
848 | 847 |
849 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) { | 848 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) { |
850 WebGestureEventBuilder webEvent(LayoutItem(m_element->layoutObject()), | 849 if (event->originalEvent().type == WebInputEvent::Undefined) |
851 *event); | |
852 if (webEvent.type == WebInputEvent::Undefined) | |
853 return; | 850 return; |
854 if (event->type() == EventTypeNames::gesturetapdown) | 851 if (event->originalEvent().type == WebInputEvent::GestureTapDown) |
855 focusPlugin(); | 852 focusPlugin(); |
| 853 |
| 854 // Take a copy of the event and translate it into the coordinate |
| 855 // system of the plugin. |
| 856 WebGestureEvent translatedEvent = event->originalEvent(); |
| 857 WebFloatPoint absoluteRootFrameLocation = |
| 858 event->originalEvent().positionInRootFrame(); |
| 859 IntPoint localPoint = |
| 860 roundedIntPoint(m_element->layoutObject()->absoluteToLocal( |
| 861 absoluteRootFrameLocation, UseTransforms)); |
| 862 translatedEvent.flattenScale(); |
| 863 translatedEvent.x = localPoint.x(); |
| 864 translatedEvent.y = localPoint.y(); |
| 865 |
856 WebCursorInfo cursorInfo; | 866 WebCursorInfo cursorInfo; |
857 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 867 if (m_webPlugin->handleInputEvent(translatedEvent, cursorInfo) != |
858 WebInputEventResult::NotHandled) { | 868 WebInputEventResult::NotHandled) { |
859 event->setDefaultHandled(); | 869 event->setDefaultHandled(); |
860 return; | 870 return; |
861 } | 871 } |
862 | 872 |
863 // FIXME: Can a plugin change the cursor from a touch-event callback? | 873 // FIXME: Can a plugin change the cursor from a touch-event callback? |
864 } | 874 } |
865 | 875 |
866 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) { | 876 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) { |
867 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), | 877 WebMouseEventBuilder webEvent(this, LayoutItem(m_element->layoutObject()), |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 // frame view. | 982 // frame view. |
973 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); | 983 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); |
974 } | 984 } |
975 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 985 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
976 // Convert to the plugin position. | 986 // Convert to the plugin position. |
977 for (size_t i = 0; i < cutOutRects.size(); i++) | 987 for (size_t i = 0; i < cutOutRects.size(); i++) |
978 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 988 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
979 } | 989 } |
980 | 990 |
981 } // namespace blink | 991 } // namespace blink |
OLD | NEW |