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 25 matching lines...) Expand all Loading... |
36 #include "bindings/core/v8/V8Element.h" | 36 #include "bindings/core/v8/V8Element.h" |
37 #include "bindings/core/v8/V8NPObject.h" | 37 #include "bindings/core/v8/V8NPObject.h" |
38 #include "core/HTMLNames.h" | 38 #include "core/HTMLNames.h" |
39 #include "core/clipboard/DataObject.h" | 39 #include "core/clipboard/DataObject.h" |
40 #include "core/clipboard/DataTransfer.h" | 40 #include "core/clipboard/DataTransfer.h" |
41 #include "core/events/GestureEvent.h" | 41 #include "core/events/GestureEvent.h" |
42 #include "core/events/KeyboardEvent.h" | 42 #include "core/events/KeyboardEvent.h" |
43 #include "core/events/MouseEvent.h" | 43 #include "core/events/MouseEvent.h" |
44 #include "core/events/TouchEvent.h" | 44 #include "core/events/TouchEvent.h" |
45 #include "core/events/WheelEvent.h" | 45 #include "core/events/WheelEvent.h" |
| 46 #include "core/frame/EventHandlerRegistry.h" |
46 #include "core/frame/FrameView.h" | 47 #include "core/frame/FrameView.h" |
47 #include "core/frame/LocalFrame.h" | 48 #include "core/frame/LocalFrame.h" |
48 #include "core/html/HTMLFormElement.h" | 49 #include "core/html/HTMLFormElement.h" |
49 #include "core/html/HTMLPlugInElement.h" | 50 #include "core/html/HTMLPlugInElement.h" |
50 #include "core/loader/FormState.h" | 51 #include "core/loader/FormState.h" |
51 #include "core/loader/FrameLoadRequest.h" | 52 #include "core/loader/FrameLoadRequest.h" |
52 #include "core/page/Chrome.h" | 53 #include "core/page/Chrome.h" |
53 #include "core/page/EventHandler.h" | 54 #include "core/page/EventHandler.h" |
54 #include "core/page/FocusController.h" | 55 #include "core/page/FocusController.h" |
55 #include "core/page/Page.h" | 56 #include "core/page/Page.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 if (nodes.size() != 1) | 511 if (nodes.size() != 1) |
511 return false; | 512 return false; |
512 return nodes.first().get() == m_element; | 513 return nodes.first().get() == m_element; |
513 } | 514 } |
514 | 515 |
515 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request
Type) | 516 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request
Type) |
516 { | 517 { |
517 if (m_touchEventRequestType == requestType) | 518 if (m_touchEventRequestType == requestType) |
518 return; | 519 return; |
519 | 520 |
520 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == T
ouchEventRequestTypeNone) | 521 if (m_element->document().frameHost()) { |
521 m_element->document().didAddTouchEventHandler(m_element); | 522 EventHandlerRegistry& registry = m_element->document().frameHost()->even
tHandlerRegistry(); |
522 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequestType
!= TouchEventRequestTypeNone) | 523 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType
== TouchEventRequestTypeNone) |
523 m_element->document().didRemoveTouchEventHandler(m_element); | 524 registry.didAddEventHandler(*m_element, EventHandlerRegistry::TouchE
vent); |
| 525 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequest
Type != TouchEventRequestTypeNone) |
| 526 registry.didRemoveEventHandler(*m_element, EventHandlerRegistry::Tou
chEvent); |
| 527 } |
524 m_touchEventRequestType = requestType; | 528 m_touchEventRequestType = requestType; |
525 } | 529 } |
526 | 530 |
527 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) | 531 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) |
528 { | 532 { |
529 if (m_wantsWheelEvents == wantsWheelEvents) | 533 if (m_wantsWheelEvents == wantsWheelEvents) |
530 return; | 534 return; |
531 m_wantsWheelEvents = wantsWheelEvents; | 535 m_wantsWheelEvents = wantsWheelEvents; |
532 if (Page* page = m_element->document().page()) { | 536 if (Page* page = m_element->document().page()) { |
533 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { | 537 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 // have been finalized by now; unsafe to unregister the touch | 690 // have been finalized by now; unsafe to unregister the touch |
687 // event handler at this stage. | 691 // event handler at this stage. |
688 // | 692 // |
689 // This is acceptable, as the widget will unregister itself if it | 693 // This is acceptable, as the widget will unregister itself if it |
690 // is cleanly detached. If an explicit detach doesn't happen, this | 694 // is cleanly detached. If an explicit detach doesn't happen, this |
691 // container is assumed to have died with the plugin element (and | 695 // container is assumed to have died with the plugin element (and |
692 // its document), hence no unregistration step is needed. | 696 // its document), hence no unregistration step is needed. |
693 // | 697 // |
694 m_element = 0; | 698 m_element = 0; |
695 #else | 699 #else |
696 if (m_touchEventRequestType != TouchEventRequestTypeNone) | 700 if (m_touchEventRequestType != TouchEventRequestTypeNone && m_element->docum
ent().frameHost()) |
697 m_element->document().didRemoveTouchEventHandler(m_element); | 701 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); |
698 #endif | 702 #endif |
699 | 703 |
700 ScriptForbiddenScope::AllowSuperUnsafeScript thisShouldBeRemoved; | 704 ScriptForbiddenScope::AllowSuperUnsafeScript thisShouldBeRemoved; |
701 | 705 |
702 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) | 706 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) |
703 m_pluginLoadObservers[i]->clearPluginContainer(); | 707 m_pluginLoadObservers[i]->clearPluginContainer(); |
704 m_webPlugin->destroy(); | 708 m_webPlugin->destroy(); |
705 if (m_webLayer) | 709 if (m_webLayer) |
706 GraphicsLayer::unregisterContentsLayer(m_webLayer); | 710 GraphicsLayer::unregisterContentsLayer(m_webLayer); |
707 } | 711 } |
708 | 712 |
709 #if ENABLE(OILPAN) | 713 #if ENABLE(OILPAN) |
710 void WebPluginContainerImpl::detach() | 714 void WebPluginContainerImpl::detach() |
711 { | 715 { |
712 if (m_touchEventRequestType != TouchEventRequestTypeNone) | 716 if (m_touchEventRequestType != TouchEventRequestTypeNone && m_element->docum
ent().frameHost()) |
713 m_element->document().didRemoveTouchEventHandler(m_element); | 717 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); |
714 | 718 |
715 setWebLayer(0); | 719 setWebLayer(0); |
716 } | 720 } |
717 #endif | 721 #endif |
718 | 722 |
719 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) | 723 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) |
720 { | 724 { |
721 ASSERT(parent()->isFrameView()); | 725 ASSERT(parent()->isFrameView()); |
722 | 726 |
723 if (event->isDragEvent()) { | 727 if (event->isDragEvent()) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 | 958 |
955 return clipRect; | 959 return clipRect; |
956 } | 960 } |
957 | 961 |
958 bool WebPluginContainerImpl::pluginShouldPersist() const | 962 bool WebPluginContainerImpl::pluginShouldPersist() const |
959 { | 963 { |
960 return m_webPlugin->shouldPersist(); | 964 return m_webPlugin->shouldPersist(); |
961 } | 965 } |
962 | 966 |
963 } // namespace blink | 967 } // namespace blink |
OLD | NEW |