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 21 matching lines...) Expand all Loading... |
32 #include "config.h" | 32 #include "config.h" |
33 #include "web/WebPluginContainerImpl.h" | 33 #include "web/WebPluginContainerImpl.h" |
34 | 34 |
35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
36 #include "bindings/core/v8/ScriptSourceCode.h" | 36 #include "bindings/core/v8/ScriptSourceCode.h" |
37 #include "bindings/core/v8/V8Element.h" | 37 #include "bindings/core/v8/V8Element.h" |
38 #include "bindings/core/v8/V8NPObject.h" | 38 #include "bindings/core/v8/V8NPObject.h" |
39 #include "core/HTMLNames.h" | 39 #include "core/HTMLNames.h" |
40 #include "core/clipboard/DataObject.h" | 40 #include "core/clipboard/DataObject.h" |
41 #include "core/clipboard/DataTransfer.h" | 41 #include "core/clipboard/DataTransfer.h" |
| 42 #include "core/events/DragEvent.h" |
42 #include "core/events/GestureEvent.h" | 43 #include "core/events/GestureEvent.h" |
43 #include "core/events/KeyboardEvent.h" | 44 #include "core/events/KeyboardEvent.h" |
44 #include "core/events/MouseEvent.h" | 45 #include "core/events/MouseEvent.h" |
45 #include "core/events/TouchEvent.h" | 46 #include "core/events/TouchEvent.h" |
46 #include "core/events/WheelEvent.h" | 47 #include "core/events/WheelEvent.h" |
47 #include "core/frame/EventHandlerRegistry.h" | 48 #include "core/frame/EventHandlerRegistry.h" |
48 #include "core/frame/FrameView.h" | 49 #include "core/frame/FrameView.h" |
49 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
50 #include "core/html/HTMLFormElement.h" | 51 #include "core/html/HTMLFormElement.h" |
51 #include "core/html/HTMLPlugInElement.h" | 52 #include "core/html/HTMLPlugInElement.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (event->isMouseEvent()) | 194 if (event->isMouseEvent()) |
194 handleMouseEvent(toMouseEvent(event)); | 195 handleMouseEvent(toMouseEvent(event)); |
195 else if (event->isWheelEvent()) | 196 else if (event->isWheelEvent()) |
196 handleWheelEvent(toWheelEvent(event)); | 197 handleWheelEvent(toWheelEvent(event)); |
197 else if (event->isKeyboardEvent()) | 198 else if (event->isKeyboardEvent()) |
198 handleKeyboardEvent(toKeyboardEvent(event)); | 199 handleKeyboardEvent(toKeyboardEvent(event)); |
199 else if (event->isTouchEvent()) | 200 else if (event->isTouchEvent()) |
200 handleTouchEvent(toTouchEvent(event)); | 201 handleTouchEvent(toTouchEvent(event)); |
201 else if (event->isGestureEvent()) | 202 else if (event->isGestureEvent()) |
202 handleGestureEvent(toGestureEvent(event)); | 203 handleGestureEvent(toGestureEvent(event)); |
| 204 else if (event->isDragEvent() && m_webPlugin->canProcessDrag()) |
| 205 handleDragEvent(toDragEvent(event)); |
203 | 206 |
204 // FIXME: it would be cleaner if Widget::handleEvent returned true/false and | 207 // FIXME: it would be cleaner if Widget::handleEvent returned true/false and |
205 // HTMLPluginElement called setDefaultHandled or defaultEventHandler. | 208 // HTMLPluginElement called setDefaultHandled or defaultEventHandler. |
206 if (!event->defaultHandled()) | 209 if (!event->defaultHandled()) |
207 m_element->Node::defaultEventHandler(event); | 210 m_element->Node::defaultEventHandler(event); |
208 } | 211 } |
209 | 212 |
210 void WebPluginContainerImpl::frameRectsChanged() | 213 void WebPluginContainerImpl::frameRectsChanged() |
211 { | 214 { |
212 Widget::frameRectsChanged(); | 215 Widget::frameRectsChanged(); |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 { | 751 { |
749 visitor->trace(m_element); | 752 visitor->trace(m_element); |
750 LocalFrameLifecycleObserver::trace(visitor); | 753 LocalFrameLifecycleObserver::trace(visitor); |
751 PluginView::trace(visitor); | 754 PluginView::trace(visitor); |
752 } | 755 } |
753 | 756 |
754 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) | 757 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) |
755 { | 758 { |
756 ASSERT(parent()->isFrameView()); | 759 ASSERT(parent()->isFrameView()); |
757 | 760 |
758 if (event->isDragEvent()) { | |
759 if (m_webPlugin->canProcessDrag()) | |
760 handleDragEvent(event); | |
761 return; | |
762 } | |
763 | |
764 // We cache the parent FrameView here as the plugin widget could be deleted | 761 // We cache the parent FrameView here as the plugin widget could be deleted |
765 // in the call to HandleEvent. See http://b/issue?id=1362948 | 762 // in the call to HandleEvent. See http://b/issue?id=1362948 |
766 FrameView* parentView = toFrameView(parent()); | 763 FrameView* parentView = toFrameView(parent()); |
767 | 764 |
768 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); | 765 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); |
769 if (webEvent.type == WebInputEvent::Undefined) | 766 if (webEvent.type == WebInputEvent::Undefined) |
770 return; | 767 return; |
771 | 768 |
772 if (event->type() == EventTypeNames::mousedown) | 769 if (event->type() == EventTypeNames::mousedown) |
773 focusPlugin(); | 770 focusPlugin(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 for (size_t i = 0; i < cutOutRects.size(); i++) | 964 for (size_t i = 0; i < cutOutRects.size(); i++) |
968 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 965 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
969 } | 966 } |
970 | 967 |
971 bool WebPluginContainerImpl::pluginShouldPersist() const | 968 bool WebPluginContainerImpl::pluginShouldPersist() const |
972 { | 969 { |
973 return m_webPlugin->shouldPersist(); | 970 return m_webPlugin->shouldPersist(); |
974 } | 971 } |
975 | 972 |
976 } // namespace blink | 973 } // namespace blink |
OLD | NEW |