Changeset 150714 in webkit


Ignore:
Timestamp:
May 26, 2013 6:32:36 AM (11 years ago)
Author:
akling@apple.com
Message:

Move Node::dispatchSimulatedClick() to Element.
<http://webkit.org/b/116784>

Reviewed by Antti Koivisto.

Only Elements use the dispatchSimulatedClick() functionality, so move it there.

  • dom/Node.cpp:
  • dom/Node.h:
  • dom/Element.h:
  • dom/Element.cpp:

(WebCore::Element::dispatchSimulatedClick):

  • dom/EventDispatcher.h:
  • dom/EventDispatcher.cpp:

(WebCore::EventDispatcher::dispatchSimulatedClick):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150713 r150714  
     12013-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
    1192013-05-26  Andreas Kling  <akling@apple.com>
    220
  • trunk/Source/WebCore/dom/Element.cpp

    r150712 r150714  
    4141#include "DocumentSharedObjectPool.h"
    4242#include "ElementRareData.h"
     43#include "EventDispatcher.h"
    4344#include "ExceptionCode.h"
    4445#include "FlowThreadController.h"
     
    265266}
    266267
     268void Element::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions eventOptions, SimulatedClickVisualOptions visualOptions)
     269{
     270    EventDispatcher::dispatchSimulatedClick(this, underlyingEvent, eventOptions, visualOptions);
     271}
     272
    267273DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(Element, blur);
    268274DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(Element, error);
  • trunk/Source/WebCore/dom/Element.h

    r150711 r150714  
    633633    void setSavedLayerScrollOffset(const IntSize&);
    634634
     635    void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions = SendNoEvents, SimulatedClickVisualOptions = ShowPressedLook);
     636
    635637protected:
    636638    Element(const QualifiedName& tagName, Document* document, ConstructionType type)
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r149980 r150714  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (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.
    66 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
    77 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
     
    4545namespace WebCore {
    4646
    47 static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0;
    48 
    4947bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
    5048{
     
    7775}
    7876
    79 void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions)
    80 {
    81     if (isDisabledFormControl(node))
     77void EventDispatcher::dispatchSimulatedClick(Element* element, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions)
     78{
     79    if (element->isDisabledFormControl())
    8280        return;
    8381
    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)
    8784        return;
    8885
    89     gNodesDispatchingSimulatedClicks->add(node);
    90 
    9186    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();
    9388
    9489    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);
    9792    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);
    10095
    10196    // 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);
    105100}
    106101
  • trunk/Source/WebCore/dom/EventDispatcher.h

    r147371 r150714  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (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.
    66 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
    77 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
     
    5757    static void dispatchScopedEvent(Node*, PassRefPtr<EventDispatchMediator>);
    5858
    59     static void dispatchSimulatedClick(Node*, Event* underlyingEvent, SimulatedClickMouseEventOptions, SimulatedClickVisualOptions);
     59    static void dispatchSimulatedClick(Element*, Event* underlyingEvent, SimulatedClickMouseEventOptions, SimulatedClickVisualOptions);
    6060
    6161    bool dispatch();
  • trunk/Source/WebCore/dom/Node.cpp

    r150713 r150714  
    24052405#endif
    24062406
    2407 void Node::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions eventOptions, SimulatedClickVisualOptions visualOptions)
    2408 {
    2409     EventDispatcher::dispatchSimulatedClick(this, underlyingEvent, eventOptions, visualOptions);
    2410 }
    2411 
    24122407bool Node::dispatchBeforeLoadEvent(const String& sourceURL)
    24132408{
  • trunk/Source/WebCore/dom/Node.h

    r150713 r150714  
    634634#endif
    635635
    636     void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions = SendNoEvents, SimulatedClickVisualOptions = ShowPressedLook);
    637636    bool dispatchBeforeLoadEvent(const String& sourceURL);
    638637
Note: See TracChangeset for help on using the changeset viewer.