Changeset 143426 in webkit


Ignore:
Timestamp:
Feb 19, 2013 7:05:32 PM (11 years ago)
Author:
hayato@chromium.org
Message:

Calculate EventPath in EventDispatcher's constructor.
https://bugs.webkit.org/show_bug.cgi?id=109905

Reviewed by Dimitri Glazkov.

This patch calculates an EventPath in EventDispatcher's
constructor and removes EventDispatcher::ensureEventPath().
We don't have any reason to initialize an EventPath lazily.

No tests. No change in behavior.

  • dom/EventDispatcher.cpp:

(WebCore::EventDispatcher::EventDispatcher):
(WebCore::EventDispatcher::dispatch):

  • dom/EventDispatcher.h:

(WebCore::EventDispatcher::eventPath):
(EventDispatcher):

  • dom/FocusEvent.cpp:

(WebCore::FocusEventDispatchMediator::dispatchEvent):
(WebCore::BlurEventDispatchMediator::dispatchEvent):
(WebCore::FocusInEventDispatchMediator::dispatchEvent):
(WebCore::FocusOutEventDispatchMediator::dispatchEvent):

  • dom/MouseEvent.cpp:

(WebCore::MouseEventDispatchMediator::dispatchEvent):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143423 r143426  
     12013-02-19  Hayato Ito <hayato@chromium.org>
     2
     3        Calculate EventPath in EventDispatcher's constructor.
     4        https://bugs.webkit.org/show_bug.cgi?id=109905
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        This patch calculates an EventPath in EventDispatcher's
     9        constructor and removes EventDispatcher::ensureEventPath().
     10        We don't have any reason to initialize an EventPath lazily.
     11
     12        No tests. No change in behavior.
     13
     14        * dom/EventDispatcher.cpp:
     15        (WebCore::EventDispatcher::EventDispatcher):
     16        (WebCore::EventDispatcher::dispatch):
     17        * dom/EventDispatcher.h:
     18        (WebCore::EventDispatcher::eventPath):
     19        (EventDispatcher):
     20        * dom/FocusEvent.cpp:
     21        (WebCore::FocusEventDispatchMediator::dispatchEvent):
     22        (WebCore::BlurEventDispatchMediator::dispatchEvent):
     23        (WebCore::FocusInEventDispatchMediator::dispatchEvent):
     24        (WebCore::FocusOutEventDispatchMediator::dispatchEvent):
     25        * dom/MouseEvent.cpp:
     26        (WebCore::MouseEventDispatchMediator::dispatchEvent):
     27
    1282013-02-19  Simon Fraser  <simon.fraser@apple.com>
    229
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r143422 r143426  
    6060    : m_node(node)
    6161    , m_event(event)
    62     , m_eventPathInitialized(false)
    6362#ifndef NDEBUG
    6463    , m_eventDispatched(false)
     
    6968    ASSERT(!m_event->type().isNull()); // JavaScript code can create an event with an empty name, but not null.
    7069    m_view = node->document()->view();
    71 }
    72 
    73 EventPath& EventDispatcher::ensureEventPath()
    74 {
    75     if (m_eventPathInitialized)
    76         return m_eventPath;
    77     m_eventPathInitialized = true;
    7870    EventRetargeter::calculateEventPath(m_node.get(), m_event.get(), m_eventPath);
    79     return m_eventPath;
    8071}
    8172
     
    126117    ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
    127118    ASSERT(m_event->target());
    128     ensureEventPath();
    129119    WindowEventContext windowEventContext(m_event.get(), m_node.get(), topEventContext());
    130120    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(m_node->document(), *m_event, windowEventContext.window(), m_node.get(), m_eventPath);
  • trunk/Source/WebCore/dom/EventDispatcher.h

    r143303 r143426  
    6262    Node* node() const { return m_node.get(); }
    6363    Event* event() const { return m_event.get(); }
    64     EventPath& ensureEventPath();
     64    EventPath& eventPath() { return m_eventPath; }
    6565
    6666private:
     
    7878    RefPtr<Event> m_event;
    7979    RefPtr<FrameView> m_view;
    80     bool m_eventPathInitialized;
    8180#ifndef NDEBUG
    8281    bool m_eventDispatched;
  • trunk/Source/WebCore/dom/FocusEvent.cpp

    r143303 r143426  
    7878bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    7979{
    80     EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
     80    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
    8181    return EventDispatchMediator::dispatchEvent(dispatcher);
    8282}
     
    9494bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    9595{
    96     EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
     96    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
    9797    return EventDispatchMediator::dispatchEvent(dispatcher);
    9898}
     
    110110bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    111111{
    112     EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
     112    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
    113113    return EventDispatchMediator::dispatchEvent(dispatcher);
    114114}
     
    126126bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
    127127{
    128     EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
     128    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
    129129    return EventDispatchMediator::dispatchEvent(dispatcher);
    130130}
  • trunk/Source/WebCore/dom/MouseEvent.cpp

    r143303 r143426  
    263263{
    264264    if (isSyntheticMouseEvent()) {
    265         EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->ensureEventPath());
     265        EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->eventPath());
    266266        return dispatcher->dispatch();
    267267    }
     
    276276
    277277    EventTarget* relatedTarget = event()->relatedTarget();
    278     EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->ensureEventPath());
     278    EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->eventPath());
    279279
    280280    dispatcher->dispatch();
Note: See TracChangeset for help on using the changeset viewer.