Web Inspector: provide method for recording CanvasRenderingContext2D from JavaScript
authorwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2017 21:40:55 +0000 (21:40 +0000)
committerwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2017 21:40:55 +0000 (21:40 +0000)
commit0fc79159dbecd23d96207daee6ee43997def1df2
tree4cf2ae11b572550ffcabc315ab3bc14d275141b0
parent77977805602317518a0041dab3126344d645280e
Web Inspector: provide method for recording CanvasRenderingContext2D from JavaScript
https://bugs.webkit.org/show_bug.cgi?id=175166
<rdar://problem/34040740>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Recording.json:
Add optional `name` that will be used by the frontend for uniquely identifying the Recording.

* inspector/JSGlobalObjectConsoleClient.h:
* inspector/JSGlobalObjectConsoleClient.cpp:
(Inspector::JSGlobalObjectConsoleClient::record):
(Inspector::JSGlobalObjectConsoleClient::recordEnd):

* runtime/ConsoleClient.h:
* runtime/ConsoleObject.cpp:
(JSC::ConsoleObject::finishCreation):
(JSC::consoleProtoFuncRecord):
(JSC::consoleProtoFuncRecordEnd):

Source/WebCore:

No new tests, updated existing tests.

* inspector/InspectorCanvas.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::resetRecordingData):

* inspector/InspectorCanvasAgent.h:
* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
(WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):

* inspector/InspectorInstrumentation.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
(WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):

* page/PageConsoleClient.h:
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::record):
(WebCore::PageConsoleClient::recordEnd):

* workers/WorkerConsoleClient.h:
* workers/WorkerConsoleClient.cpp:
(WebCore::WorkerConsoleClient::record):
(WebCore::WorkerConsoleClient::recordEnd):

Source/WebInspectorUI:

* UserInterface/Controllers/CanvasManager.js:
(WI.CanvasManager.prototype.recordingFinished):
If a `name` is sent with the payload, use it as the suggested name.

* UserInterface/Models/NativeFunctionParameters.js:
Add `console.record` and `console.recordEnd`.

* UserInterface/Views/CanvasTabContentView.js:
(WI.CanvasTabContentView.prototype.showRepresentedObject):
Drive-by: remove logic that toggled the collapsed state of the navigation sidebar, as this
was not very controllable by the user and often was aggravating.

(WI.CanvasTabContentView.prototype._recordingStopped):
Only show the recording if it was not started from the console. This can determined by
CanvasManager when it recieves a recording if the recording's source is not the same as the
current canvas being recorded.

LayoutTests:

* inspector/canvas/recording-2d-expected.txt:
* inspector/canvas/recording-2d.html:
(performConsoleRecording):
* inspector/canvas/recording-webgl-expected.txt:
* inspector/canvas/recording-webgl.html:
(performConsoleRecording):
* inspector/canvas/resources/recording-utilities.js:
(TestPage.registerInitializer):
* js/console-expected.txt:
* js/console.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
30 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/canvas/recording-2d-expected.txt
LayoutTests/inspector/canvas/recording-2d.html
LayoutTests/inspector/canvas/recording-webgl-expected.txt
LayoutTests/inspector/canvas/recording-webgl.html
LayoutTests/inspector/canvas/resources/recording-utilities.js
LayoutTests/js/console-expected.txt
LayoutTests/js/console.html
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h
Source/JavaScriptCore/inspector/protocol/Recording.json
Source/JavaScriptCore/runtime/ConsoleClient.h
Source/JavaScriptCore/runtime/ConsoleObject.cpp
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorCanvas.cpp
Source/WebCore/inspector/InspectorCanvas.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
Source/WebCore/inspector/agents/InspectorCanvasAgent.h
Source/WebCore/page/PageConsoleClient.cpp
Source/WebCore/page/PageConsoleClient.h
Source/WebCore/workers/WorkerConsoleClient.cpp
Source/WebCore/workers/WorkerConsoleClient.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js
Source/WebInspectorUI/UserInterface/Views/CanvasTabContentView.js
Source/WebInspectorUI/UserInterface/Views/RecordingNavigationSidebarPanel.js