Changeset 92256 in webkit


Ignore:
Timestamp:
Aug 2, 2011 8:25:57 PM (13 years ago)
Author:
hayato@chromium.org
Message:

Make EventDispatchMediator RefCounted.
https://bugs.webkit.org/show_bug.cgi?id=65529

Reviewed by Dimitri Glazkov.

Make EventDispatchMediator RefCounted so that it can be enqueued into a
ScopedEventQueue and called later.
A necessary change for ScopedEventQueue should be addressed in another patch.

No changes to functionality so no new tests.

  • dom/Event.cpp:

(WebCore::EventDispatchMediator::create):

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

(WebCore::EventDispatcher::dispatchEvent):

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

(WebCore::KeyboardEventDispatchMediator::create):

  • dom/KeyboardEvent.h:
  • dom/MouseEvent.cpp:

(WebCore::MouseEventDispatchMediator::create):

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

(WebCore::Node::dispatchEvent):
(WebCore::Node::dispatchKeyEvent):
(WebCore::Node::dispatchMouseEvent):
(WebCore::Node::dispatchWheelEvent):

  • dom/WheelEvent.cpp:

(WebCore::WheelEventDispatchMediator::create):

  • dom/WheelEvent.h:
Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r92255 r92256  
     12011-08-02  Hayato Ito  <hayato@chromium.org>
     2
     3        Make EventDispatchMediator RefCounted.
     4        https://bugs.webkit.org/show_bug.cgi?id=65529
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        Make EventDispatchMediator RefCounted so that it can be enqueued into a
     9        ScopedEventQueue and called later.
     10        A necessary change for ScopedEventQueue should be addressed in another patch.
     11
     12        No changes to functionality so no new tests.
     13
     14        * dom/Event.cpp:
     15        (WebCore::EventDispatchMediator::create):
     16        * dom/Event.h:
     17        * dom/EventDispatcher.cpp:
     18        (WebCore::EventDispatcher::dispatchEvent):
     19        * dom/EventDispatcher.h:
     20        * dom/KeyboardEvent.cpp:
     21        (WebCore::KeyboardEventDispatchMediator::create):
     22        * dom/KeyboardEvent.h:
     23        * dom/MouseEvent.cpp:
     24        (WebCore::MouseEventDispatchMediator::create):
     25        * dom/MouseEvent.h:
     26        * dom/Node.cpp:
     27        (WebCore::Node::dispatchEvent):
     28        (WebCore::Node::dispatchKeyEvent):
     29        (WebCore::Node::dispatchMouseEvent):
     30        (WebCore::Node::dispatchWheelEvent):
     31        * dom/WheelEvent.cpp:
     32        (WebCore::WheelEventDispatchMediator::create):
     33        * dom/WheelEvent.h:
     34
    1352011-08-02  David Reveman  <reveman@chromium.org>
    236
  • trunk/Source/WebCore/dom/Event.cpp

    r89044 r92256  
    290290}
    291291
     292PassRefPtr<EventDispatchMediator> EventDispatchMediator::create(PassRefPtr<Event> event)
     293{
     294    return adoptRef(new EventDispatchMediator(event));
     295}
     296
    292297EventDispatchMediator::EventDispatchMediator(PassRefPtr<Event> event)
    293298    : m_event(event)
  • trunk/Source/WebCore/dom/Event.h

    r90972 r92256  
    200200    };
    201201
    202 class EventDispatchMediator {
     202class EventDispatchMediator : public RefCounted<Event> {
    203203public:
     204    static PassRefPtr<EventDispatchMediator> create(PassRefPtr<Event>);
     205    virtual ~EventDispatchMediator();
     206
     207    virtual bool dispatchEvent(EventDispatcher*) const;
     208
     209protected:
    204210    explicit EventDispatchMediator(PassRefPtr<Event>);
    205     virtual ~EventDispatchMediator();
    206 
    207     virtual bool dispatchEvent(EventDispatcher*) const;
    208 
    209 protected:
    210211    EventDispatchMediator();
    211212
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r92098 r92256  
    4747static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0;
    4848
    49 bool EventDispatcher::dispatchEvent(Node* node, const EventDispatchMediator& mediator)
     49bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
    5050{
    5151    ASSERT(!eventDispatchForbidden());
    5252
    5353    EventDispatcher dispatcher(node);
    54     return mediator.dispatchEvent(&dispatcher);
     54    return mediator->dispatchEvent(&dispatcher);
    5555}
    5656
  • trunk/Source/WebCore/dom/EventDispatcher.h

    r88026 r92256  
    4949class EventDispatcher {
    5050public:
    51     static bool dispatchEvent(Node*, const EventDispatchMediator&);
     51    static bool dispatchEvent(Node*, PassRefPtr<EventDispatchMediator>);
    5252    static void dispatchScopedEvent(Node*, PassRefPtr<Event>);
     53    static void dispatchScopedEventDispatchMediator(Node*, PassRefPtr<EventDispatchMediator>);
    5354
    5455    static void dispatchSimulatedClick(Node*, PassRefPtr<Event> underlyingEvent, bool sendMouseEvents, bool showPressedLook);
  • trunk/Source/WebCore/dom/KeyboardEvent.cpp

    r84879 r92256  
    160160}
    161161
     162PassRefPtr<KeyboardEventDispatchMediator> KeyboardEventDispatchMediator::create(PassRefPtr<KeyboardEvent> event)
     163{
     164    return adoptRef(new KeyboardEventDispatchMediator(event));
     165}
     166
    162167KeyboardEventDispatchMediator::KeyboardEventDispatchMediator(PassRefPtr<KeyboardEvent> event)
    163168    : EventDispatchMediator(event)
  • trunk/Source/WebCore/dom/KeyboardEvent.h

    r82891 r92256  
    118118class KeyboardEventDispatchMediator : public EventDispatchMediator {
    119119public:
     120    static PassRefPtr<KeyboardEventDispatchMediator> create(PassRefPtr<KeyboardEvent>);
     121private:
    120122    explicit KeyboardEventDispatchMediator(PassRefPtr<KeyboardEvent>);
    121 
    122 private:
    123123    virtual bool dispatchEvent(EventDispatcher*) const;
    124124};
  • trunk/Source/WebCore/dom/MouseEvent.cpp

    r91416 r92256  
    160160}
    161161
     162PassRefPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRefPtr<MouseEvent> mouseEvent)
     163{
     164    return adoptRef(new MouseEventDispatchMediator(mouseEvent));
     165}
     166
    162167MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtr<MouseEvent> mouseEvent)
    163168    : EventDispatchMediator(mouseEvent)
  • trunk/Source/WebCore/dom/MouseEvent.h

    r82948 r92256  
    101101class MouseEventDispatchMediator : public EventDispatchMediator {
    102102public:
    103     explicit MouseEventDispatchMediator(PassRefPtr<MouseEvent>);
     103    static PassRefPtr<MouseEventDispatchMediator> create(PassRefPtr<MouseEvent>);
    104104
    105105private:
     106    explicit MouseEventDispatchMediator(PassRefPtr<MouseEvent>);
    106107    MouseEvent* event() const;
    107108
  • trunk/Source/WebCore/dom/Node.cpp

    r92139 r92256  
    27152715bool Node::dispatchEvent(PassRefPtr<Event> event)
    27162716{
    2717     return EventDispatcher::dispatchEvent(this, EventDispatchMediator(event));
     2717    return EventDispatcher::dispatchEvent(this, EventDispatchMediator::create(event));
    27182718}
    27192719
     
    27472747bool Node::dispatchKeyEvent(const PlatformKeyboardEvent& event)
    27482748{
    2749     return EventDispatcher::dispatchEvent(this, KeyboardEventDispatchMediator(KeyboardEvent::create(event, document()->defaultView())));
     2749    return EventDispatcher::dispatchEvent(this, KeyboardEventDispatchMediator::create(KeyboardEvent::create(event, document()->defaultView())));
    27502750}
    27512751
     
    27532753    int detail, Node* relatedTarget)
    27542754{
    2755     return EventDispatcher::dispatchEvent(this, MouseEventDispatchMediator(MouseEvent::create(eventType, document()->defaultView(), event, detail, relatedTarget)));
     2755    return EventDispatcher::dispatchEvent(this, MouseEventDispatchMediator::create(MouseEvent::create(eventType, document()->defaultView(), event, detail, relatedTarget)));
    27562756}
    27572757
     
    27632763bool Node::dispatchWheelEvent(const PlatformWheelEvent& event)
    27642764{
    2765     return EventDispatcher::dispatchEvent(this, WheelEventDispatchMediator(event, document()->defaultView()));
     2765    return EventDispatcher::dispatchEvent(this, WheelEventDispatchMediator::create(event, document()->defaultView()));
    27662766}
    27672767
  • trunk/Source/WebCore/dom/WheelEvent.cpp

    r92234 r92256  
    9292}
    9393
     94PassRefPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::create(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
     95{
     96    return adoptRef(new WheelEventDispatchMediator(event, view));
     97}
     98
    9499WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
    95100{
  • trunk/Source/WebCore/dom/WheelEvent.h

    r92234 r92256  
    8484class WheelEventDispatchMediator : public EventDispatchMediator {
    8585public:
     86    static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
     87private:
    8688    WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
    87 
    88 private:
    8989    WheelEvent* event() const;
    9090    virtual bool dispatchEvent(EventDispatcher*) const;
Note: See TracChangeset for help on using the changeset viewer.