Web Inspector: allow multiple canvases to be recorded at the same time
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2018 00:14:52 +0000 (00:14 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2018 00:14:52 +0000 (00:14 +0000)
commit9713f7e26ebff1a9937ca4f826ea5b1e3c72b944
treeb0e222954153e4fea5edf7d9103b8db60a06cb2b
parent6ba2eec781828a7ccf8b72a15730a5601e136f78
Web Inspector: allow multiple canvases to be recorded at the same time
https://bugs.webkit.org/show_bug.cgi?id=190305

Reviewed by Brian Burg.

Source/WebInspectorUI:

Moved the logic for maintaining whether a canvas is actively recording from
`WI.CanvasManager` to `WI.Canvas`, meaning that each canvas can now record independently of
every other canvas in the page. If multiple recordings are all finished simultaneously, only
show the first one to be recieved by the frontend.

* UserInterface/Controllers/CanvasManager.js:
(WI.CanvasManager):
(WI.CanvasManager.prototype.recordingProgress):
(WI.CanvasManager.prototype.recordingFinished):
(WI.CanvasManager.prototype.programCreated):
(WI.CanvasManager.prototype.programDeleted):
(WI.CanvasManager.prototype._removeCanvas):
(WI.CanvasManager.prototype._mainResourceDidChange):
(WI.CanvasManager.prototype.get recordingCanvas): Deleted.
(WI.CanvasManager.prototype.startRecording): Deleted.
(WI.CanvasManager.prototype.stopRecording): Deleted.
(WI.CanvasManager.prototype._dispatchShaderProgramRemoved): Deleted.

* UserInterface/Models/Canvas.js:
(WI.Canvas.prototype.get recordingFrameCount): Added.
(WI.Canvas.prototype.get recordingBufferUsed): Added.
(WI.Canvas.prototype.get recordingActive): Added.
(WI.Canvas.prototype.get isRecording): Deleted.
(WI.Canvas.prototype.startRecording): Added.
(WI.Canvas.prototype.stopRecording): Added.
(WI.Canvas.prototype.recordingProgress): Added.
(WI.Canvas.prototype.recordingFinished): Added.

* UserInterface/Views/CanvasTabContentView.js:
(WI.CanvasTabContentView.prototype.attached):
(WI.CanvasTabContentView.prototype.detached):
(WI.CanvasTabContentView.prototype._recordingImportedOrStopped):
(WI.CanvasTabContentView.prototype._handleSpace):
(WI.CanvasTabContentView):

* UserInterface/Views/CanvasOverviewContentView.css:
(.content-view.canvas-overview .content-view.canvas.recording-active): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > header): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > header > .titles > .title): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > header > .titles > .subtitle): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > header > .navigation-bar > .item): Added.
(.content-view.canvas-overview .content-view.canvas:matches(:hover, .recording-active) > header > .navigation-bar): Added.
(.content-view.canvas-overview .content-view.canvas:not(.recording-active) > header > .navigation-bar > .item.record-start-stop.disabled): Added.
(.content-view.canvas-overview .content-view.canvas:not(.recording-active) > header > .navigation-bar > .item.record-start-stop:not(.disabled):hover): Added.
(.content-view.canvas-overview .content-view.canvas:not(.recording-active) > header > .navigation-bar > .item.record-start-stop:not(.disabled):active): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > .progress-vie): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > .preview): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > header): Added.
(.content-view.canvas-overview .content-view.canvas.recording-active > header > .titles > .subtitle): Added.
(.content-view.canvas-overview .content-view.canvas.is-recording): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > header): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > header > .titles > .title): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > header > .titles > .subtitle): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > header > .navigation-bar > .item): Deleted.
(.content-view.canvas-overview .content-view.canvas:matches(:hover, .is-recording) > header > .navigation-bar): Deleted.
(.content-view.canvas-overview .content-view.canvas:not(.is-recording) > header > .navigation-bar > .item.record-start-stop.disabled): Deleted.
(.content-view.canvas-overview .content-view.canvas:not(.is-recording) > header > .navigation-bar > .item.record-start-stop:not(.disabled):hover): Deleted.
(.content-view.canvas-overview .content-view.canvas:not(.is-recording) > header > .navigation-bar > .item.record-start-stop:not(.disabled):active): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > .progress-vie): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > .preview): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > header): Deleted.
(.content-view.canvas-overview .content-view.canvas.is-recording > header > .titles > .subtitle): Deleted.

* UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView.prototype.attached):
(WI.CanvasContentView.prototype.detached):
(WI.CanvasContentView.prototype._toggleRecording):
(WI.CanvasContentView.prototype._recordingProgress):
(WI.CanvasContentView.prototype._recordingStopped):
(WI.CanvasContentView.prototype._shaderProgramAdded):
(WI.CanvasContentView.prototype._shaderProgramRemoved):
(WI.CanvasContentView.prototype._updateRecordNavigationItem):
(WI.CanvasContentView.prototype._updateProgressView):

* UserInterface/Views/CanvasSidebarPanel.js:
(WI.CanvasSidebarPanel):
(WI.CanvasSidebarPanel.prototype.set canvas):
(WI.CanvasSidebarPanel.prototype._toggleRecording):
(WI.CanvasSidebarPanel.prototype._updateRecordNavigationItem):

* UserInterface/Views/CanvasTreeElement.js:
(WI.CanvasTreeElement):
(WI.CanvasTreeElement.prototype._updateStatus):

LayoutTests:

* inspector/canvas/recording-2d.html:
* inspector/canvas/recording-bitmaprenderer.html:
* inspector/canvas/recording-expected.html:
* inspector/canvas/recording-webgl.html:
* inspector/canvas/recording.html:
* inspector/canvas/resources/recording-utilities.js:
(TestPage.registerInitializer.window.startRecording.handleRecordingProgress):
(TestPage.registerInitializer.window.startRecording):
(TestPage.registerInitializer.window.consoleRecord):
(TestPage.registerInitializer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/canvas/recording-2d.html
LayoutTests/inspector/canvas/recording-bitmaprenderer.html
LayoutTests/inspector/canvas/recording-expected.txt
LayoutTests/inspector/canvas/recording-webgl.html
LayoutTests/inspector/canvas/recording.html
LayoutTests/inspector/canvas/resources/recording-utilities.js
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
Source/WebInspectorUI/UserInterface/Models/Canvas.js
Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.css
Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/CanvasTabContentView.js
Source/WebInspectorUI/UserInterface/Views/CanvasTreeElement.js