OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
35 #include "core/HTMLNames.h" | 35 #include "core/HTMLNames.h" |
36 #include "core/clipboard/DataObject.h" | 36 #include "core/clipboard/DataObject.h" |
37 #include "core/clipboard/DataTransfer.h" | 37 #include "core/clipboard/DataTransfer.h" |
38 #include "core/events/GestureEvent.h" | 38 #include "core/events/GestureEvent.h" |
39 #include "core/events/KeyboardEvent.h" | 39 #include "core/events/KeyboardEvent.h" |
40 #include "core/events/MouseEvent.h" | 40 #include "core/events/MouseEvent.h" |
41 #include "core/events/TouchEvent.h" | 41 #include "core/events/TouchEvent.h" |
42 #include "core/events/WheelEvent.h" | 42 #include "core/events/WheelEvent.h" |
43 #include "core/frame/EventHandlerRegistry.h" | |
44 #include "core/frame/FrameView.h" | 43 #include "core/frame/FrameView.h" |
45 #include "core/frame/LocalFrame.h" | 44 #include "core/frame/LocalFrame.h" |
46 #include "core/html/HTMLFormElement.h" | 45 #include "core/html/HTMLFormElement.h" |
47 #include "core/html/HTMLPlugInElement.h" | 46 #include "core/html/HTMLPlugInElement.h" |
48 #include "core/loader/FormState.h" | 47 #include "core/loader/FormState.h" |
49 #include "core/loader/FrameLoadRequest.h" | 48 #include "core/loader/FrameLoadRequest.h" |
50 #include "core/page/Chrome.h" | 49 #include "core/page/Chrome.h" |
51 #include "core/page/EventHandler.h" | 50 #include "core/page/EventHandler.h" |
52 #include "core/page/FocusController.h" | 51 #include "core/page/FocusController.h" |
53 #include "core/page/Page.h" | 52 #include "core/page/Page.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (nodes.size() != 1) | 507 if (nodes.size() != 1) |
509 return false; | 508 return false; |
510 return nodes.first().get() == m_element; | 509 return nodes.first().get() == m_element; |
511 } | 510 } |
512 | 511 |
513 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request
Type) | 512 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request
Type) |
514 { | 513 { |
515 if (m_touchEventRequestType == requestType) | 514 if (m_touchEventRequestType == requestType) |
516 return; | 515 return; |
517 | 516 |
518 if (m_element->document().frameHost()) { | 517 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == T
ouchEventRequestTypeNone) |
519 EventHandlerRegistry& registry = m_element->document().frameHost()->even
tHandlerRegistry(); | 518 m_element->document().didAddTouchEventHandler(m_element); |
520 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType
== TouchEventRequestTypeNone) | 519 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequestType
!= TouchEventRequestTypeNone) |
521 registry.didAddEventHandler(*m_element, EventHandlerRegistry::TouchE
vent); | 520 m_element->document().didRemoveTouchEventHandler(m_element); |
522 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequest
Type != TouchEventRequestTypeNone) | |
523 registry.didRemoveEventHandler(*m_element, EventHandlerRegistry::Tou
chEvent); | |
524 } | |
525 m_touchEventRequestType = requestType; | 521 m_touchEventRequestType = requestType; |
526 } | 522 } |
527 | 523 |
528 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) | 524 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) |
529 { | 525 { |
530 if (m_wantsWheelEvents == wantsWheelEvents) | 526 if (m_wantsWheelEvents == wantsWheelEvents) |
531 return; | 527 return; |
532 m_wantsWheelEvents = wantsWheelEvents; | 528 m_wantsWheelEvents = wantsWheelEvents; |
533 if (Page* page = m_element->document().page()) { | 529 if (Page* page = m_element->document().page()) { |
534 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { | 530 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 // have been finalized by now; unsafe to unregister the touch | 673 // have been finalized by now; unsafe to unregister the touch |
678 // event handler at this stage. | 674 // event handler at this stage. |
679 // | 675 // |
680 // This is acceptable, as the widget will unregister itself if it | 676 // This is acceptable, as the widget will unregister itself if it |
681 // is cleanly detached. If an explicit detach doesn't happen, this | 677 // is cleanly detached. If an explicit detach doesn't happen, this |
682 // container is assumed to have died with the plugin element (and | 678 // container is assumed to have died with the plugin element (and |
683 // its document), hence no unregistration step is needed. | 679 // its document), hence no unregistration step is needed. |
684 // | 680 // |
685 m_element = 0; | 681 m_element = 0; |
686 #else | 682 #else |
687 if (m_touchEventRequestType != TouchEventRequestTypeNone && m_element->docum
ent().frameHost()) | 683 if (m_touchEventRequestType != TouchEventRequestTypeNone) |
688 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); | 684 m_element->document().didRemoveTouchEventHandler(m_element); |
689 #endif | 685 #endif |
690 | 686 |
691 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) | 687 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) |
692 m_pluginLoadObservers[i]->clearPluginContainer(); | 688 m_pluginLoadObservers[i]->clearPluginContainer(); |
693 m_webPlugin->destroy(); | 689 m_webPlugin->destroy(); |
694 if (m_webLayer) | 690 if (m_webLayer) |
695 GraphicsLayer::unregisterContentsLayer(m_webLayer); | 691 GraphicsLayer::unregisterContentsLayer(m_webLayer); |
696 } | 692 } |
697 | 693 |
698 #if ENABLE(OILPAN) | 694 #if ENABLE(OILPAN) |
699 void WebPluginContainerImpl::detach() | 695 void WebPluginContainerImpl::detach() |
700 { | 696 { |
701 if (m_touchEventRequestType != TouchEventRequestTypeNone && m_element->docum
ent().frameHost()) | 697 if (m_touchEventRequestType != TouchEventRequestTypeNone) |
702 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); | 698 m_element->document().didRemoveTouchEventHandler(m_element); |
703 | 699 |
704 setWebLayer(0); | 700 setWebLayer(0); |
705 } | 701 } |
706 #endif | 702 #endif |
707 | 703 |
708 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) | 704 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) |
709 { | 705 { |
710 ASSERT(parent()->isFrameView()); | 706 ASSERT(parent()->isFrameView()); |
711 | 707 |
712 if (event->isDragEvent()) { | 708 if (event->isDragEvent()) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 939 |
944 return clipRect; | 940 return clipRect; |
945 } | 941 } |
946 | 942 |
947 bool WebPluginContainerImpl::pluginShouldPersist() const | 943 bool WebPluginContainerImpl::pluginShouldPersist() const |
948 { | 944 { |
949 return m_webPlugin->shouldPersist(); | 945 return m_webPlugin->shouldPersist(); |
950 } | 946 } |
951 | 947 |
952 } // namespace blink | 948 } // namespace blink |
OLD | NEW |