Changeset 125133 in webkit


Ignore:
Timestamp:
Aug 8, 2012 6:11:35 PM (12 years ago)
Author:
hayato@chromium.org
Message:

EventDispatcher::dispatchSimulatedClick should not reuse the same EventDispatcher instance.
https://bugs.webkit.org/show_bug.cgi?id=93452

Reviewed by Dimitri Glazkov.

This is a follow up patch after r124975. There is yet another
place where the same EventDispatcher instance is reused across
event dispatching.

In addition to that, in order to simulate a real click, we must
different dispatchers because we must recalculate event ancestors
each time. Current implementation wrongly freezes event ancestors
at the first event dispatching.

No new tests, no change in functionality.

  • dom/EventDispatcher.cpp:

(WebCore::EventDispatcher::dispatchSimulatedClick):
(WebCore::EventDispatcher::EventDispatcher):
(WebCore::EventDispatcher::dispatchEvent):

  • dom/EventDispatcher.h:

(EventDispatcher):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r125132 r125133  
     12012-08-08  Hayato Ito  <hayato@chromium.org>
     2
     3        EventDispatcher::dispatchSimulatedClick should not reuse the same EventDispatcher instance.
     4        https://bugs.webkit.org/show_bug.cgi?id=93452
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        This is a follow up patch after r124975.  There is yet another
     9        place where the same EventDispatcher instance is reused across
     10        event dispatching.
     11
     12        In addition to that, in order to simulate a real click, we must
     13        different dispatchers because we must recalculate event ancestors
     14        each time.  Current implementation wrongly freezes event ancestors
     15        at the first event dispatching.
     16
     17        No new tests, no change in functionality.
     18
     19        * dom/EventDispatcher.cpp:
     20        (WebCore::EventDispatcher::dispatchSimulatedClick):
     21        (WebCore::EventDispatcher::EventDispatcher):
     22        (WebCore::EventDispatcher::dispatchEvent):
     23        * dom/EventDispatcher.h:
     24        (EventDispatcher):
     25
    1262012-08-08  Jae Hyun Park  <jae.park@company100.net>
    227
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r124992 r125133  
    164164        return;
    165165
    166     EventDispatcher dispatcher(node);
    167 
    168166    if (!gNodesDispatchingSimulatedClicks)
    169167        gNodesDispatchingSimulatedClicks = new HashSet<Node*>;
     
    175173    // send mousedown and mouseup before the click, if requested
    176174    if (sendMouseEvents)
    177         dispatcher.dispatchEvent(SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent));
     175        EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent));
    178176    node->setActive(true, showPressedLook);
    179177    if (sendMouseEvents)
    180         dispatcher.dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent));
     178        EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent));
    181179    node->setActive(false);
    182180
    183181    // always send click
    184     dispatcher.dispatchEvent(SimulatedMouseEvent::create(eventNames().clickEvent, node->document()->defaultView(), underlyingEvent));
     182    EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().clickEvent, node->document()->defaultView(), underlyingEvent));
    185183
    186184    gNodesDispatchingSimulatedClicks->remove(node);
     
    203201    : m_node(node)
    204202    , m_ancestorsInitialized(false)
     203#ifndef NDEBUG
     204    , m_eventDispatched(false)
     205#endif
    205206{
    206207    ASSERT(node);
     
    240241bool EventDispatcher::dispatchEvent(PassRefPtr<Event> prpEvent)
    241242{
     243#ifndef NDEBUG
     244    ASSERT(!m_eventDispatched);
     245    m_eventDispatched = true;
     246#endif
    242247    RefPtr<Event> event = prpEvent;
    243248    ChildNodesLazySnapshot::takeChildNodesLazySnapshot();
  • trunk/Source/WebCore/dom/EventDispatcher.h

    r124992 r125133  
    9797    RefPtr<FrameView> m_view;
    9898    bool m_ancestorsInitialized;
     99#ifndef NDEBUG
     100    bool m_eventDispatched;
     101#endif
    99102};
    100103
Note: See TracChangeset for help on using the changeset viewer.