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

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: Rebased. Created 6 years, 6 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 "HTMLNames.h" 47 #include "HTMLNames.h"
48 #include "bindings/v8/ScriptController.h" 48 #include "bindings/v8/ScriptController.h"
49 #include "core/clipboard/Clipboard.h" 49 #include "core/clipboard/Clipboard.h"
50 #include "core/clipboard/DataObject.h" 50 #include "core/clipboard/DataObject.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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 if (nodes.size() != 1) 504 if (nodes.size() != 1)
504 return false; 505 return false;
505 return nodes.first().get() == m_element; 506 return nodes.first().get() == m_element;
506 } 507 }
507 508
508 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type) 509 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type)
509 { 510 {
510 if (m_touchEventRequestType == requestType) 511 if (m_touchEventRequestType == requestType)
511 return; 512 return;
512 513
513 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == T ouchEventRequestTypeNone) 514 if (m_element->document().frameHost()) {
514 m_element->document().didAddTouchEventHandler(m_element); 515 EventHandlerRegistry* registry = &m_element->document().frameHost()->eve ntHandlerRegistry();
Rick Byers 2014/06/19 17:10:36 nit again: ref instead of pointer?
Sami 2014/06/27 17:58:51 Done.
515 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequestType != TouchEventRequestTypeNone) 516 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == TouchEventRequestTypeNone)
516 m_element->document().didRemoveTouchEventHandler(m_element); 517 registry->didAddEventHandler(*m_element, EventHandlerRegistry::Touch Event);
518 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequest Type != TouchEventRequestTypeNone)
519 registry->didRemoveEventHandler(*m_element, EventHandlerRegistry::To uchEvent);
520 }
517 m_touchEventRequestType = requestType; 521 m_touchEventRequestType = requestType;
518 } 522 }
519 523
520 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) 524 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents)
521 { 525 {
522 if (m_wantsWheelEvents == wantsWheelEvents) 526 if (m_wantsWheelEvents == wantsWheelEvents)
523 return; 527 return;
524 m_wantsWheelEvents = wantsWheelEvents; 528 m_wantsWheelEvents = wantsWheelEvents;
525 if (Page* page = m_element->document().page()) { 529 if (Page* page = m_element->document().page()) {
526 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) { 530 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 : m_element(element) 660 : m_element(element)
657 , m_webPlugin(webPlugin) 661 , m_webPlugin(webPlugin)
658 , m_webLayer(0) 662 , m_webLayer(0)
659 , m_touchEventRequestType(TouchEventRequestTypeNone) 663 , m_touchEventRequestType(TouchEventRequestTypeNone)
660 , m_wantsWheelEvents(false) 664 , m_wantsWheelEvents(false)
661 { 665 {
662 } 666 }
663 667
664 WebPluginContainerImpl::~WebPluginContainerImpl() 668 WebPluginContainerImpl::~WebPluginContainerImpl()
665 { 669 {
666 if (m_touchEventRequestType != TouchEventRequestTypeNone) 670 if (m_touchEventRequestType != TouchEventRequestTypeNone && m_element->docum ent().frameHost())
667 m_element->document().didRemoveTouchEventHandler(m_element); 671 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent Handler(*m_element, EventHandlerRegistry::TouchEvent);
668 672
669 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) 673 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
670 m_pluginLoadObservers[i]->clearPluginContainer(); 674 m_pluginLoadObservers[i]->clearPluginContainer();
671 m_webPlugin->destroy(); 675 m_webPlugin->destroy();
672 if (m_webLayer) 676 if (m_webLayer)
673 GraphicsLayer::unregisterContentsLayer(m_webLayer); 677 GraphicsLayer::unregisterContentsLayer(m_webLayer);
674 } 678 }
675 679
676 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) 680 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
677 { 681 {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 915
912 return clipRect; 916 return clipRect;
913 } 917 }
914 918
915 bool WebPluginContainerImpl::pluginShouldPersist() const 919 bool WebPluginContainerImpl::pluginShouldPersist() const
916 { 920 {
917 return m_webPlugin->shouldPersist(); 921 return m_webPlugin->shouldPersist();
918 } 922 }
919 923
920 } // namespace blink 924 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698