Title: [157942] trunk/Source/WebCore
Revision
157942
Author
[email protected]
Date
2013-10-24 12:10:48 -0700 (Thu, 24 Oct 2013)

Log Message

Web Inspector: Inspector doesn't show webkitTransitionEnd events in the timeline
https://bugs.webkit.org/show_bug.cgi?id=123263

Reviewed by Timothy Hatcher.

A legacy event type is only set on an event in EventTarget::fireEventListeners(Event*)
which is called after we used to call InspectorInstrumentation::willDispatchEvent(), the method
that would ultimately yield the creation of a TimelineRecord for the event in the Web Inspector
frontend, and as a result we would try to dispatch an event with an unprefixed event type to
the frontend, which wouldn't even happen because most likely it wouldn't have listeners for this
unprefixed type.

We now move the call to InspectorInstrumentation::willDispatchEvent() in
EventTarget::fireEventListeners(Event*, EventTargetData*, EventListenerVector&) such that the
correct event type and list of listeners is used to determine what event to dispatch to the frontend.

* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent):
Remove calls to InspectorInstrumentation::willDispatchEvent() and InspectorInstrumentation::didDispatchEvent().

* dom/EventTarget.cpp:
(WebCore::EventTarget::fireEventListeners):
Add call to InspectorInstrumentation::willDispatchEvent() before we go through each listener and
call InspectorInstrumentation::willHandleEvent(). Additionally, we refactor some code since we're
getting references to the ScriptExecutionContext and Document upfront now.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157941 => 157942)


--- trunk/Source/WebCore/ChangeLog	2013-10-24 18:58:47 UTC (rev 157941)
+++ trunk/Source/WebCore/ChangeLog	2013-10-24 19:10:48 UTC (rev 157942)
@@ -1,3 +1,31 @@
+2013-10-24  Antoine Quint  <[email protected]>
+
+        Web Inspector: Inspector doesn't show webkitTransitionEnd events in the timeline
+        https://bugs.webkit.org/show_bug.cgi?id=123263
+
+        Reviewed by Timothy Hatcher.
+
+        A legacy event type is only set on an event in EventTarget::fireEventListeners(Event*)
+        which is called after we used to call InspectorInstrumentation::willDispatchEvent(), the method
+        that would ultimately yield the creation of a TimelineRecord for the event in the Web Inspector
+        frontend, and as a result we would try to dispatch an event with an unprefixed event type to
+        the frontend, which wouldn't even happen because most likely it wouldn't have listeners for this
+        unprefixed type.
+
+        We now move the call to InspectorInstrumentation::willDispatchEvent() in
+        EventTarget::fireEventListeners(Event*, EventTargetData*, EventListenerVector&) such that the
+        correct event type and list of listeners is used to determine what event to dispatch to the frontend.
+
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::dispatchEvent):
+        Remove calls to InspectorInstrumentation::willDispatchEvent() and InspectorInstrumentation::didDispatchEvent().
+
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::fireEventListeners):
+        Add call to InspectorInstrumentation::willDispatchEvent() before we go through each listener and
+        call InspectorInstrumentation::willHandleEvent(). Additionally, we refactor some code since we're
+        getting references to the ScriptExecutionContext and Document upfront now.
+
 2013-10-24  Andreas Kling  <[email protected]>
 
         SVG: RenderElement-ize intersectRepaintRectWithResources().

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (157941 => 157942)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2013-10-24 18:58:47 UTC (rev 157941)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2013-10-24 19:10:48 UTC (rev 157942)
@@ -324,9 +324,6 @@
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
     ASSERT(event->target());
     WindowEventContext windowEventContext(node.get(), eventPath.lastContextIfExists());
-    bool hasEventListners = (windowEventContext.window() && windowEventContext.window()->hasEventListeners(event->type()))
-        || node->hasEventListeners(event->type()) || eventPath.hasEventListeners(event->type());
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(&node->document(), *event, hasEventListners);
 
     InputElementClickState clickHandlingState;
     if (isHTMLInputElement(node.get()))
@@ -352,7 +349,6 @@
     // outermost shadow DOM boundary.
     event->setTarget(windowEventContext.target());
     event->setCurrentTarget(0);
-    InspectorInstrumentation::didDispatchEvent(cookie);
 
     return !event->defaultPrevented();
 }

Modified: trunk/Source/WebCore/dom/EventTarget.cpp (157941 => 157942)


--- trunk/Source/WebCore/dom/EventTarget.cpp	2013-10-24 18:58:47 UTC (rev 157941)
+++ trunk/Source/WebCore/dom/EventTarget.cpp	2013-10-24 19:10:48 UTC (rev 157942)
@@ -258,6 +258,15 @@
     if (!d->firingEventIterators)
         d->firingEventIterators = adoptPtr(new FiringEventIteratorVector);
     d->firingEventIterators->append(FiringEventIterator(event->type(), i, size));
+
+    ScriptExecutionContext* context = scriptExecutionContext();
+    Document* document = nullptr;
+    InspectorInstrumentationCookie willDispatchEventCookie;
+    if (context && context->isDocument()) {
+        document = toDocument(context);
+        willDispatchEventCookie = InspectorInstrumentation::willDispatchEvent(document, *event, size > 0);
+    }
+
     for (; i < size; ++i) {
         RegisteredEventListener& registeredListener = entry[i];
         if (event->eventPhase() == Event::CAPTURING_PHASE && !registeredListener.useCapture)
@@ -270,7 +279,6 @@
         if (event->immediatePropagationStopped())
             break;
 
-        ScriptExecutionContext* context = scriptExecutionContext();
         InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(context, event);
         // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
         // event listeners, even though that violates some versions of the DOM spec.
@@ -280,13 +288,11 @@
         InspectorInstrumentation::didHandleEvent(cookie);
     }
     d->firingEventIterators->removeLast();
-    if (userEventWasHandled) {
-        ScriptExecutionContext* context = scriptExecutionContext();
-        if (context && context->isDocument()) {
-            Document* document = toDocument(context);
-            document->resetLastHandledUserGestureTimestamp();
-        }
-    }
+    if (userEventWasHandled && document)
+        document->resetLastHandledUserGestureTimestamp();
+
+    if (document)
+        InspectorInstrumentation::didDispatchEvent(willDispatchEventCookie);
 }
 
 const EventListenerVector& EventTarget::getEventListeners(const AtomicString& eventType)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to