[webkit-changes] [WebKit/WebKit] b5959d: Web Inspector: support OffscreenCanvas for Canvas ...
Devin Rousso
noreply at github.com
Thu Aug 31 00:33:36 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b5959d78adc403bde81fdad57864ec9fcf73fa21
https://github.com/WebKit/WebKit/commit/b5959d78adc403bde81fdad57864ec9fcf73fa21
Author: Devin Rousso <hi at devinrousso.com>
Date: 2023-08-31 (Thu, 31 Aug 2023)
Changed paths:
M LayoutTests/inspector/canvas/create-context-2d-expected.txt
M LayoutTests/inspector/canvas/create-context-2d.html
M LayoutTests/inspector/canvas/create-context-bitmaprenderer-expected.txt
M LayoutTests/inspector/canvas/create-context-bitmaprenderer.html
M LayoutTests/inspector/canvas/create-context-webgl-expected.txt
M LayoutTests/inspector/canvas/create-context-webgl.html
M LayoutTests/inspector/canvas/create-context-webgl2-expected.txt
M LayoutTests/inspector/canvas/create-context-webgl2.html
M LayoutTests/inspector/canvas/resources/create-context-utilities.js
A LayoutTests/inspector/canvas/resources/worker.js
M Source/JavaScriptCore/inspector/protocol/Canvas.json
M Source/JavaScriptCore/inspector/protocol/Recording.json
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/html/CanvasBase.cpp
M Source/WebCore/html/CanvasBase.h
M Source/WebCore/inspector/InspectorCanvas.cpp
M Source/WebCore/inspector/InspectorController.cpp
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebCore/inspector/InspectorInstrumentation.h
M Source/WebCore/inspector/InstrumentingAgents.h
M Source/WebCore/inspector/WorkerInspectorController.cpp
M Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
M Source/WebCore/inspector/agents/InspectorCanvasAgent.h
A Source/WebCore/inspector/agents/page/PageCanvasAgent.cpp
A Source/WebCore/inspector/agents/page/PageCanvasAgent.h
A Source/WebCore/inspector/agents/worker/WorkerCanvasAgent.cpp
A Source/WebCore/inspector/agents/worker/WorkerCanvasAgent.h
M Source/WebCore/workers/WorkerConsoleClient.cpp
M Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
M Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
M Source/WebInspectorUI/UserInterface/Models/Canvas.js
M Source/WebInspectorUI/UserInterface/Models/Geometry.js
M Source/WebInspectorUI/UserInterface/Models/Recording.js
M Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js
M Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js
M Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
M Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
Log Message:
-----------
Web Inspector: support OffscreenCanvas for Canvas related operations
https://bugs.webkit.org/show_bug.cgi?id=180833
<rdar://problem/36059660>
Reviewed by Patrick Angle.
* Source/JavaScriptCore/inspector/protocol/Canvas.json:
* Source/JavaScriptCore/inspector/protocol/Recording.json:
Expose the entire domain (minus a few commands/events) to the `"worker"` target.
* Source/WebCore/inspector/InspectorController.cpp:
(WebCore::InspectorController::createLazyAgents):
* Source/WebCore/inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::createLazyAgents):
* Source/WebCore/inspector/agents/InspectorCanvasAgent.h:
* Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
(WebCore::InspectorCanvasAgent::enable):
(WebCore::InspectorCanvasAgent::disable):
(WebCore::InspectorCanvasAgent::enabled const): Added.
(WebCore::InspectorCanvasAgent::internalEnable): Added.
(WebCore::InspectorCanvasAgent::internalDisable): Added.
(WebCore::InspectorCanvasAgent::didChangeCanvasSize): Added.
(WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
(WebCore::InspectorCanvasAgent::unbindCanvas):
(WebCore::InspectorCanvasAgent::requestNode): Deleted.
(WebCore::InspectorCanvasAgent::requestClientNodes): Deleted.
(WebCore::InspectorCanvasAgent::frameNavigated): Deleted.
(WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes): Deleted.
* Source/WebCore/inspector/agents/page/PageCanvasAgent.h: Added.
* Source/WebCore/inspector/agents/page/PageCanvasAgent.cpp: Added.
(WebCore::PageCanvasAgent::PageCanvasAgent):
(WebCore::PageCanvasAgent::enabled const):
(WebCore::PageCanvasAgent::internalEnable):
(WebCore::PageCanvasAgent::internalDisable):
(WebCore::PageCanvasAgent::requestNode):
(WebCore::PageCanvasAgent::requestClientNodes):
(WebCore::PageCanvasAgent::frameNavigated):
(WebCore::PageCanvasAgent::didChangeCSSCanvasClientNodes):
(WebCore::PageCanvasAgent::matchesCurrentContext const):
* Source/WebCore/inspector/agents/worker/WorkerCanvasAgent.h: Added.
* Source/WebCore/inspector/agents/worker/WorkerCanvasAgent.cpp: Added.
(WebCore::WorkerCanvasAgent::WorkerCanvasAgent):
(WebCore::WorkerCanvasAgent::requestNode):
(WebCore::WorkerCanvasAgent::requestClientNodes):
(WebCore::WorkerCanvasAgent::matchesCurrentContext const):
Split `InspectorCanvasAgent` into `PageCanvasAgent` and `WorkerCanvasAgent`.
* Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js:
(WI.CanvasObserver.prototype.canvasAdded):
(WI.CanvasObserver.prototype.canvasRemoved):
(WI.CanvasObserver.prototype.canvasSizeChanged):
(WI.CanvasObserver.prototype.canvasMemoryChanged):
(WI.CanvasObserver.prototype.clientNodesChanged):
(WI.CanvasObserver.prototype.recordingStarted):
(WI.CanvasObserver.prototype.recordingProgress):
(WI.CanvasObserver.prototype.recordingFinished):
(WI.CanvasObserver.prototype.extensionEnabled):
(WI.CanvasObserver.prototype.programCreated):
(WI.CanvasObserver.prototype.programDeleted):
(WI.CanvasObserver.prototype.cssCanvasClientNodesChanged):
Pass along the `WI.Target`.
* Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js:
(WI.CanvasManager):
(WI.CanvasManager.prototype.disable):
(WI.CanvasManager.prototype.canvasAdded):
(WI.CanvasManager.prototype.canvasRemoved):
(WI.CanvasManager.prototype.canvasSizeChanged): Added.
(WI.CanvasManager.prototype.canvasMemoryChanged):
(WI.CanvasManager.prototype.clientNodesChanged):
(WI.CanvasManager.prototype.recordingStarted):
(WI.CanvasManager.prototype.recordingProgress):
(WI.CanvasManager.prototype.recordingFinished):
(WI.CanvasManager.prototype.extensionEnabled):
(WI.CanvasManager.prototype.programCreated):
(WI.CanvasManager.prototype.programDeleted):
(WI.CanvasManager.prototype._canvasForIdentifier): Added.
(WI.CanvasManager.prototype._handleTargetRemoved): Added.
(WI.CanvasManager.prototype._mainResourceDidChange):
(WI.CanvasManager.prototype.get shaderPrograms):
`WI.Canvas`/`WI.ShaderProgram` now need to be keyed by a `WI.Target` -> identifier combo since the same identifier could be used by two different `WI.Target` (e.g. main page and `Worker`).
* Source/WebInspectorUI/UserInterface/Models/Canvas.js:
(WI.Canvas):
(WI.Canvas.fromPayload):
(WI.Canvas.prototype.get target): Added.
(WI.Canvas.prototype.get size): Added.
(WI.Canvas.prototype.get memoryCost):
(WI.Canvas.prototype.requestNode):
(WI.Canvas.prototype.requestContent):
(WI.Canvas.prototype.requestClientNodes):
(WI.Canvas.prototype.startRecording):
(WI.Canvas.prototype.stopRecording):
(WI.Canvas.prototype.sizeChanged): Added.
(WI.Canvas.prototype.memoryChanged): Renamed from `set memoryCost`.
(WI.Canvas.prototype.async _calculateSize): Added.
(WI.Canvas.prototype.requestSize): Deleted.
* Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js:
(WI.ShaderProgram):
(WI.ShaderProgram.prototype.get target): Added.
(WI.ShaderProgram.prototype.set disabled):
(WI.ShaderProgram.prototype.requestShaderSource):
(WI.ShaderProgram.prototype.updateShader):
(WI.ShaderProgram.prototype.showHighlight):
(WI.ShaderProgram.prototype.hideHighlight):
Use the `this._target` instead of `WI.assumingMainTarget()`.
* Source/WebCore/html/CanvasBase.h:
(WebCore::CanvasBase::setSize): Deleted.
* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::setSize): Added.
(WebCore::CanvasBase::setImageBuffer const):
* Source/WebCore/inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildObjectForCanvas):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didChangeCanvasSize): Added.
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
(WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
(WebCore::InspectorInstrumentation::didChangeCanvasSizeImpl): Added.
* Source/WebCore/inspector/InstrumentingAgents.h:
* Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView):
(WI.CanvasContentView.prototype.initialLayout):
(WI.CanvasContentView.prototype.attached):
(WI.CanvasContentView.prototype.detached):
(WI.CanvasContentView.prototype._populateCanvasElementButtonContextMenu):
(WI.CanvasContentView.prototype._updateSize): Added.
(WI.CanvasContentView.prototype._refreshPixelSize): Deleted.
Now that `Canvas.requestNode` won't always work, we need a different way of getting the owner to find it's size.
Additionally, since the owner might not be a `Element`, we can't leverage `WI.DOMNode.Event.AttributeModified` to listen for changes in the size.
Instead, add instrumentation for when the size changes in C++ and notify the frontend as such (as well as adding logic to grab the `context.canvas.{width,height}` from the `Canvas.resolveCanvasContext` instead since that will always work).
* Source/WebInspectorUI/UserInterface/Models/Geometry.js:
(WI.Size.fromJSON):
Drive-by: Add a helper to make some logic slightly easier.
* Source/WebInspectorUI/UserInterface/Models/Recording.js:
(WI.Recording.displayNameForRecordingType):
(WI.Recording.prototype.is2D):
Drive-by: Fix display name to be consistent with `WI.Canvas.displayNameForContextType`.
Drive-by: Add missing method.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
* LayoutTests/inspector/canvas/resources/create-context-utilities.js:
(destroyCanvases):
(InspectorTest.CreateContextUtilities.addSimpleTestCase):
* LayoutTests/inspector/canvas/resources/worker.js: Added.
(createContext):
(destroyContexts):
* LayoutTests/inspector/canvas/create-context-2d.html:
* LayoutTests/inspector/canvas/create-context-2d-expected.txt:
* LayoutTests/inspector/canvas/create-context-bitmaprenderer.html:
* LayoutTests/inspector/canvas/create-context-bitmaprenderer-expected.txt:
* LayoutTests/inspector/canvas/create-context-webgl.html:
* LayoutTests/inspector/canvas/create-context-webgl-expected.txt:
* LayoutTests/inspector/canvas/create-context-webgl2.html:
* LayoutTests/inspector/canvas/create-context-webgl2-expected.txt:
Canonical link: https://commits.webkit.org/267488@main
More information about the webkit-changes
mailing list