Web Inspector: Timeline should show when events preventDefault() was called on an...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 00:55:40 +0000 (00:55 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 00:55:40 +0000 (00:55 +0000)
commit65a9d233caf83244fbab2a5d83d8bd6be5b78401
tree4a64f62a05b068b82549114787e000052db836d9
parente68f49a19960e2bd83060ed897c590a0c08c0d41
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>

Reviewed by Timothy Hatcher.

Original patch by Joseph Pecoraro <pecoraro@apple.com>.

Source/WebCore:

Tests: inspector/timeline/timeline-event-CancelAnimationFrame.html
       inspector/timeline/timeline-event-EventDispatch.html
       inspector/timeline/timeline-event-FireAnimationFrame.html
       inspector/timeline/timeline-event-RequestAnimationFrame.html
       inspector/timeline/timeline-event-TimerFire.html
       inspector/timeline/timeline-event-TimerInstall.html
       inspector/timeline/timeline-event-TimerRemove.html

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

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

* inspector/agents/InspectorTimelineAgent.h:
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didDispatchEvent):
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 eventType):
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.

LayoutTests:

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

* inspector/timeline/timeline-event-CancelAnimationFrame.html: Added.
* inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt: Added.
* inspector/timeline/timeline-event-EventDispatch.html: Added.
* inspector/timeline/timeline-event-EventDispatch-expected.txt: Added.
* inspector/timeline/timeline-event-FireAnimationFrame.html: Added.
* inspector/timeline/timeline-event-FireAnimationFrame-expected.txt: Added.
* inspector/timeline/timeline-event-RequestAnimationFrame.html: Added.
* inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt: Added.
* inspector/timeline/timeline-event-TimerFire.html: Added.
* inspector/timeline/timeline-event-TimerFire-expected.txt: Added.
* inspector/timeline/timeline-event-TimerInstall.html: Added.
* inspector/timeline/timeline-event-TimerInstall-expected.txt: Added.
* inspector/timeline/timeline-event-TimerRemove.html: Added.
* inspector/timeline/timeline-event-TimerRemove-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/timeline/resources/timeline-event-utilities.js [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame.html [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]
LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame.html [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame.html [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-TimerFire-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-TimerFire.html [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-TimerInstall-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-TimerInstall.html [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-TimerRemove-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-event-TimerRemove.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/agents/InspectorTimelineAgent.cpp
Source/WebCore/inspector/agents/InspectorTimelineAgent.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/Views/ScriptDetailsTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js