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

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

Issue 225903009: Migrate touch events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed HTMLInputElement adding handler at document destruction and removed dead oilpan code. Created 6 years, 5 months 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 | Annotate | Revision Log
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 #include "bindings/v8/ScriptController.h" 47 #include "bindings/v8/ScriptController.h"
48 #include "core/HTMLNames.h" 48 #include "core/HTMLNames.h"
49 #include "core/clipboard/DataObject.h" 49 #include "core/clipboard/DataObject.h"
50 #include "core/clipboard/DataTransfer.h" 50 #include "core/clipboard/DataTransfer.h"
51 #include "core/events/GestureEvent.h" 51 #include "core/events/GestureEvent.h"
52 #include "core/events/KeyboardEvent.h" 52 #include "core/events/KeyboardEvent.h"
53 #include "core/events/MouseEvent.h" 53 #include "core/events/MouseEvent.h"
54 #include "core/events/TouchEvent.h" 54 #include "core/events/TouchEvent.h"
55 #include "core/events/WheelEvent.h" 55 #include "core/events/WheelEvent.h"
56 #include "core/frame/EventHandlerRegistry.h"
56 #include "core/frame/FrameView.h" 57 #include "core/frame/FrameView.h"
57 #include "core/frame/LocalFrame.h" 58 #include "core/frame/LocalFrame.h"
58 #include "core/html/HTMLFormElement.h" 59 #include "core/html/HTMLFormElement.h"
59 #include "core/html/HTMLPlugInElement.h" 60 #include "core/html/HTMLPlugInElement.h"
60 #include "core/loader/FormState.h" 61 #include "core/loader/FormState.h"
61 #include "core/loader/FrameLoadRequest.h" 62 #include "core/loader/FrameLoadRequest.h"
62 #include "core/page/FocusController.h" 63 #include "core/page/FocusController.h"
63 #include "core/page/Page.h" 64 #include "core/page/Page.h"
64 #include "core/page/scrolling/ScrollingCoordinator.h" 65 #include "core/page/scrolling/ScrollingCoordinator.h"
65 #include "core/plugins/PluginOcclusionSupport.h" 66 #include "core/plugins/PluginOcclusionSupport.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (nodes.size() != 1) 507 if (nodes.size() != 1)
507 return false; 508 return false;
508 return nodes.first().get() == m_element; 509 return nodes.first().get() == m_element;
509 } 510 }
510 511
511 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type) 512 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type)
512 { 513 {
513 if (m_touchEventRequestType == requestType) 514 if (m_touchEventRequestType == requestType)
514 return; 515 return;
515 516
516 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == T ouchEventRequestTypeNone) 517 if (m_element->document().frameHost()) {
517 m_element->document().didAddTouchEventHandler(m_element); 518 EventHandlerRegistry& registry = m_element->document().frameHost()->even tHandlerRegistry();
518 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequestType != TouchEventRequestTypeNone) 519 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == TouchEventRequestTypeNone)
519 m_element->document().didRemoveTouchEventHandler(m_element); 520 registry.didAddEventHandler(*m_element, EventHandlerRegistry::TouchE vent);
521 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequest Type != TouchEventRequestTypeNone)
522 registry.didRemoveEventHandler(*m_element, EventHandlerRegistry::Tou chEvent);
523 }
520 m_touchEventRequestType = requestType; 524 m_touchEventRequestType = requestType;
521 } 525 }
522 526
523 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) 527 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents)
524 { 528 {
525 if (m_wantsWheelEvents == wantsWheelEvents) 529 if (m_wantsWheelEvents == wantsWheelEvents)
526 return; 530 return;
527 m_wantsWheelEvents = wantsWheelEvents; 531 m_wantsWheelEvents = wantsWheelEvents;
528 if (Page* page = m_element->document().page()) { 532 if (Page* page = m_element->document().page()) {
529 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) { 533 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // have been finalized by now; unsafe to unregister the touch 676 // have been finalized by now; unsafe to unregister the touch
673 // event handler at this stage. 677 // event handler at this stage.
674 // 678 //
675 // This is acceptable, as the widget will unregister itself if it 679 // This is acceptable, as the widget will unregister itself if it
676 // is cleanly detached. If an explicit detach doesn't happen, this 680 // is cleanly detached. If an explicit detach doesn't happen, this
677 // container is assumed to have died with the plugin element (and 681 // container is assumed to have died with the plugin element (and
678 // its document), hence no unregistration step is needed. 682 // its document), hence no unregistration step is needed.
679 // 683 //
680 m_element = 0; 684 m_element = 0;
681 #else 685 #else
682 if (m_touchEventRequestType != TouchEventRequestTypeNone) 686 if (m_touchEventRequestType != TouchEventRequestTypeNone && m_element->docum ent().frameHost())
683 m_element->document().didRemoveTouchEventHandler(m_element); 687 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent Handler(*m_element, EventHandlerRegistry::TouchEvent);
684 #endif 688 #endif
685 689
686 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) 690 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
687 m_pluginLoadObservers[i]->clearPluginContainer(); 691 m_pluginLoadObservers[i]->clearPluginContainer();
688 m_webPlugin->destroy(); 692 m_webPlugin->destroy();
689 if (m_webLayer) 693 if (m_webLayer)
690 GraphicsLayer::unregisterContentsLayer(m_webLayer); 694 GraphicsLayer::unregisterContentsLayer(m_webLayer);
691 } 695 }
692 696
693 #if ENABLE(OILPAN) 697 #if ENABLE(OILPAN)
694 void WebPluginContainerImpl::detach() 698 void WebPluginContainerImpl::detach()
695 { 699 {
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 702
699 setWebLayer(0); 703 setWebLayer(0);
700 } 704 }
701 #endif 705 #endif
702 706
703 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) 707 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
704 { 708 {
705 ASSERT(parent()->isFrameView()); 709 ASSERT(parent()->isFrameView());
706 710
707 if (event->isDragEvent()) { 711 if (event->isDragEvent()) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 942
939 return clipRect; 943 return clipRect;
940 } 944 }
941 945
942 bool WebPluginContainerImpl::pluginShouldPersist() const 946 bool WebPluginContainerImpl::pluginShouldPersist() const
943 { 947 {
944 return m_webPlugin->shouldPersist(); 948 return m_webPlugin->shouldPersist();
945 } 949 }
946 950
947 } // namespace blink 951 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698