Changeset 150714 in webkit
- Timestamp:
- May 26, 2013 6:32:36 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150713 r150714 1 2013-05-26 Andreas Kling <akling@apple.com> 2 3 Move Node::dispatchSimulatedClick() to Element. 4 <http://webkit.org/b/116784> 5 6 Reviewed by Antti Koivisto. 7 8 Only Elements use the dispatchSimulatedClick() functionality, so move it there. 9 10 * dom/Node.cpp: 11 * dom/Node.h: 12 * dom/Element.h: 13 * dom/Element.cpp: 14 (WebCore::Element::dispatchSimulatedClick): 15 * dom/EventDispatcher.h: 16 * dom/EventDispatcher.cpp: 17 (WebCore::EventDispatcher::dispatchSimulatedClick): 18 1 19 2013-05-26 Andreas Kling <akling@apple.com> 2 20 -
trunk/Source/WebCore/dom/Element.cpp
r150712 r150714 41 41 #include "DocumentSharedObjectPool.h" 42 42 #include "ElementRareData.h" 43 #include "EventDispatcher.h" 43 44 #include "ExceptionCode.h" 44 45 #include "FlowThreadController.h" … … 265 266 } 266 267 268 void Element::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions eventOptions, SimulatedClickVisualOptions visualOptions) 269 { 270 EventDispatcher::dispatchSimulatedClick(this, underlyingEvent, eventOptions, visualOptions); 271 } 272 267 273 DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(Element, blur); 268 274 DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(Element, error); -
trunk/Source/WebCore/dom/Element.h
r150711 r150714 633 633 void setSavedLayerScrollOffset(const IntSize&); 634 634 635 void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions = SendNoEvents, SimulatedClickVisualOptions = ShowPressedLook); 636 635 637 protected: 636 638 Element(const QualifiedName& tagName, Document* document, ConstructionType type) -
trunk/Source/WebCore/dom/EventDispatcher.cpp
r149980 r150714 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) … … 45 45 namespace WebCore { 46 46 47 static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0;48 49 47 bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator) 50 48 { … … 77 75 } 78 76 79 void EventDispatcher::dispatchSimulatedClick( Node* node, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions)80 { 81 if ( isDisabledFormControl(node))77 void EventDispatcher::dispatchSimulatedClick(Element* element, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions) 78 { 79 if (element->isDisabledFormControl()) 82 80 return; 83 81 84 if (!gNodesDispatchingSimulatedClicks) 85 gNodesDispatchingSimulatedClicks = new HashSet<Node*>; 86 else if (gNodesDispatchingSimulatedClicks->contains(node)) 82 DEFINE_STATIC_LOCAL(HashSet<Element*>, elementsDispatchingSimulatedClicks, ()); 83 if (!elementsDispatchingSimulatedClicks.add(element).isNewEntry) 87 84 return; 88 85 89 gNodesDispatchingSimulatedClicks->add(node);90 91 86 if (mouseEventOptions == SendMouseOverUpDownEvents) 92 EventDispatcher( node, SimulatedMouseEvent::create(eventNames().mouseoverEvent, node->document()->defaultView(), underlyingEvent)).dispatch();87 EventDispatcher(element, SimulatedMouseEvent::create(eventNames().mouseoverEvent, element->document()->defaultView(), underlyingEvent)).dispatch(); 93 88 94 89 if (mouseEventOptions != SendNoEvents) 95 EventDispatcher( node, SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent)).dispatch();96 node->setActive(true, visualOptions == ShowPressedLook);90 EventDispatcher(element, SimulatedMouseEvent::create(eventNames().mousedownEvent, element->document()->defaultView(), underlyingEvent)).dispatch(); 91 element->setActive(true, visualOptions == ShowPressedLook); 97 92 if (mouseEventOptions != SendNoEvents) 98 EventDispatcher( node, SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent)).dispatch();99 node->setActive(false);93 EventDispatcher(element, SimulatedMouseEvent::create(eventNames().mouseupEvent, element->document()->defaultView(), underlyingEvent)).dispatch(); 94 element->setActive(false); 100 95 101 96 // always send click 102 EventDispatcher( node, SimulatedMouseEvent::create(eventNames().clickEvent, node->document()->defaultView(), underlyingEvent)).dispatch();103 104 gNodesDispatchingSimulatedClicks->remove(node);97 EventDispatcher(element, SimulatedMouseEvent::create(eventNames().clickEvent, element->document()->defaultView(), underlyingEvent)).dispatch(); 98 99 elementsDispatchingSimulatedClicks.remove(element); 105 100 } 106 101 -
trunk/Source/WebCore/dom/EventDispatcher.h
r147371 r150714 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) … … 57 57 static void dispatchScopedEvent(Node*, PassRefPtr<EventDispatchMediator>); 58 58 59 static void dispatchSimulatedClick( Node*, Event* underlyingEvent, SimulatedClickMouseEventOptions, SimulatedClickVisualOptions);59 static void dispatchSimulatedClick(Element*, Event* underlyingEvent, SimulatedClickMouseEventOptions, SimulatedClickVisualOptions); 60 60 61 61 bool dispatch(); -
trunk/Source/WebCore/dom/Node.cpp
r150713 r150714 2405 2405 #endif 2406 2406 2407 void Node::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions eventOptions, SimulatedClickVisualOptions visualOptions)2408 {2409 EventDispatcher::dispatchSimulatedClick(this, underlyingEvent, eventOptions, visualOptions);2410 }2411 2412 2407 bool Node::dispatchBeforeLoadEvent(const String& sourceURL) 2413 2408 { -
trunk/Source/WebCore/dom/Node.h
r150713 r150714 634 634 #endif 635 635 636 void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions = SendNoEvents, SimulatedClickVisualOptions = ShowPressedLook);637 636 bool dispatchBeforeLoadEvent(const String& sourceURL); 638 637
Note: See TracChangeset
for help on using the changeset viewer.