Title: [143426] trunk/Source/WebCore
Revision
143426
Author
[email protected]
Date
2013-02-19 19:05:32 -0800 (Tue, 19 Feb 2013)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143425 => 143426)


--- trunk/Source/WebCore/ChangeLog	2013-02-20 02:49:15 UTC (rev 143425)
+++ trunk/Source/WebCore/ChangeLog	2013-02-20 03:05:32 UTC (rev 143426)
@@ -1,3 +1,30 @@
+2013-02-19  Hayato Ito <[email protected]>
+
+        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):
+
 2013-02-19  Simon Fraser  <[email protected]>
 
         Fix TileCache tile size when zoomed on slow-scrolling site

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (143425 => 143426)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2013-02-20 02:49:15 UTC (rev 143425)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2013-02-20 03:05:32 UTC (rev 143426)
@@ -59,7 +59,6 @@
 EventDispatcher::EventDispatcher(Node* node, PassRefPtr<Event> event)
     : m_node(node)
     , m_event(event)
-    , m_eventPathInitialized(false)
 #ifndef NDEBUG
     , m_eventDispatched(false)
 #endif
@@ -68,15 +67,7 @@
     ASSERT(m_event.get());
     ASSERT(!m_event->type().isNull()); // _javascript_ code can create an event with an empty name, but not null.
     m_view = node->document()->view();
-}
-
-EventPath& EventDispatcher::ensureEventPath()
-{
-    if (m_eventPathInitialized)
-        return m_eventPath;
-    m_eventPathInitialized = true;
     EventRetargeter::calculateEventPath(m_node.get(), m_event.get(), m_eventPath);
-    return m_eventPath;
 }
 
 void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
@@ -125,7 +116,6 @@
     m_event->setTarget(EventRetargeter::eventTargetRespectingTargetRules(m_node.get()));
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
     ASSERT(m_event->target());
-    ensureEventPath();
     WindowEventContext windowEventContext(m_event.get(), m_node.get(), topEventContext());
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(m_node->document(), *m_event, windowEventContext.window(), m_node.get(), m_eventPath);
 

Modified: trunk/Source/WebCore/dom/EventDispatcher.h (143425 => 143426)


--- trunk/Source/WebCore/dom/EventDispatcher.h	2013-02-20 02:49:15 UTC (rev 143425)
+++ trunk/Source/WebCore/dom/EventDispatcher.h	2013-02-20 03:05:32 UTC (rev 143426)
@@ -61,7 +61,7 @@
     bool dispatch();
     Node* node() const { return m_node.get(); }
     Event* event() const { return m_event.get(); }
-    EventPath& ensureEventPath();
+    EventPath& eventPath() { return m_eventPath; }
 
 private:
     EventDispatcher(Node*, PassRefPtr<Event>);
@@ -77,7 +77,6 @@
     RefPtr<Node> m_node;
     RefPtr<Event> m_event;
     RefPtr<FrameView> m_view;
-    bool m_eventPathInitialized;
 #ifndef NDEBUG
     bool m_eventDispatched;
 #endif

Modified: trunk/Source/WebCore/dom/FocusEvent.cpp (143425 => 143426)


--- trunk/Source/WebCore/dom/FocusEvent.cpp	2013-02-20 02:49:15 UTC (rev 143425)
+++ trunk/Source/WebCore/dom/FocusEvent.cpp	2013-02-20 03:05:32 UTC (rev 143426)
@@ -77,7 +77,7 @@
 
 bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
 {
-    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
     return EventDispatchMediator::dispatchEvent(dispatcher);
 }
 
@@ -93,7 +93,7 @@
 
 bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
 {
-    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
     return EventDispatchMediator::dispatchEvent(dispatcher);
 }
 
@@ -109,7 +109,7 @@
 
 bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
 {
-    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
     return EventDispatchMediator::dispatchEvent(dispatcher);
 }
 
@@ -125,7 +125,7 @@
 
 bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
 {
-    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+    EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->eventPath());
     return EventDispatchMediator::dispatchEvent(dispatcher);
 }
 

Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (143425 => 143426)


--- trunk/Source/WebCore/dom/MouseEvent.cpp	2013-02-20 02:49:15 UTC (rev 143425)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp	2013-02-20 03:05:32 UTC (rev 143426)
@@ -262,7 +262,7 @@
 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
 {
     if (isSyntheticMouseEvent()) {
-        EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->ensureEventPath());
+        EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->eventPath());
         return dispatcher->dispatch();
     }
 
@@ -275,7 +275,7 @@
     ASSERT(!event()->target() || event()->target() != event()->relatedTarget());
 
     EventTarget* relatedTarget = event()->relatedTarget();
-    EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->ensureEventPath());
+    EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(),  dispatcher->eventPath());
 
     dispatcher->dispatch();
     bool swallowEvent = event()->defaultHandled() || event()->defaultPrevented();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to