Web Inspector: Timeline should show when events preventDefault() was called on an...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 18:09:09 +0000 (18:09 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 18:09:09 +0000 (18:09 +0000)
commit46fca7670e1bf9bfca4afb43d108767b48c03ff8
treec9b7ebe2c6accb3077ac75a2ddd3b8e881775d32
parente90a53ccf568b965183d39d587cbe8e3f8db5e92
Web Inspector: Timeline should show when events preventDefault() was called on an event or not
https://bugs.webkit.org/show_bug.cgi?id=176824
<rdar://problem/34290931>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-09-14
Reviewed by Devin Rousso.

Source/WebCore:

Test: inspector/timeline/timeline-event-EventDispatch.html

* dom/EventTarget.cpp:
(WebCore::EventTarget::fireEventListeners):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchEvent):
Include defaultPrevented when notifying inspector.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didDispatchEventImpl):
(WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didDispatchEvent):
(WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
Pass defaultPrevented on to agent.

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didDispatchEvent):
(WebCore::InspectorTimelineAgent::didLayout):
(WebCore::InspectorTimelineAgent::didPaint):
* inspector/InspectorTimelineAgent.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::appendLayoutRoot):
(WebCore::TimelineRecordFactory::appendDidDispatchEventData):
* inspector/TimelineRecordFactory.h:
Append a boolean defaultPrevented property on the EventDispatch timeline record's data.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New string.

* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype._processRecord):
Include the whole data object as extra details.

* UserInterface/Models/ScriptTimelineRecord.js:
(WI.ScriptTimelineRecord):
(WI.ScriptTimelineRecord.prototype.get extraDetails):
Wholesale copy of the extra data instead of just a single property.

* UserInterface/Views/ScriptDetailsTimelineView.js:
(WI.ScriptDetailsTimelineView):
Give the name column more initial space, there is still extra space
after this adjustment but name is comfortably larger (and the most
likely to be expanded).

* UserInterface/Views/ScriptTimelineDataGridNode.js:
(WI.ScriptTimelineDataGridNode.prototype.get subtitle):
Include "default prevented" as the event's subtitle if it was prevented.

* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackend.Agent.prototype.dispatchEvent):
(InspectorBackend.Agent):
* UserInterface/Test.html:
* UserInterface/Test/Test.js:
(WI.loaded):
Add the ScriptProfilerObserver to tests since it is on by default for Timelines.

LayoutTests:

* inspector/timeline/resources/timeline-event-utilities.js: Added.
(TestPage.registerInitializer.window.captureTimelineWithScript):
(TestPage.registerInitializer):
(finishRecording):
Helper code for creating a recording from a function.

* inspector/timeline/timeline-event-EventDispatch-expected.txt: Added.
* inspector/timeline/timeline-event-EventDispatch.html: Added.
Test for Timeline's EventDispatch records. Ensure it has
the new "defaultPrevented" details data.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/timeline/resources/timeline-event-utilities.js [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-EventDispatch-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-EventDispatch.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/EventTarget.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.h
Source/WebCore/inspector/TimelineRecordFactory.cpp
Source/WebCore/inspector/TimelineRecordFactory.h
Source/WebCore/page/DOMWindow.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
Source/WebInspectorUI/UserInterface/Test.html
Source/WebInspectorUI/UserInterface/Test/Test.js
Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js