[webkit-changes] [WebKit/WebKit] 78a437: Web Inspector: Canvas: expand OffscreenCanvas support

Devin Rousso noreply at github.com
Wed Nov 29 13:29:26 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 78a437817ab22672737ec12685469f4bc84275f3
      https://github.com/WebKit/WebKit/commit/78a437817ab22672737ec12685469f4bc84275f3
  Author: Devin Rousso <hi at devinrousso.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    A LayoutTests/inspector/canvas/console-record-offscreen-bitmaprenderer-expected.txt
    A LayoutTests/inspector/canvas/console-record-offscreen-bitmaprenderer.html
    M LayoutTests/inspector/canvas/console-record-offscreen-canvas-2d-expected.txt
    M LayoutTests/inspector/canvas/console-record-offscreen-canvas-2d.html
    A LayoutTests/inspector/canvas/console-record-offscreen-webgl-expected.txt
    A LayoutTests/inspector/canvas/console-record-offscreen-webgl.html
    A LayoutTests/inspector/canvas/console-record-offscreen-webgl2-expected.txt
    A LayoutTests/inspector/canvas/console-record-offscreen-webgl2.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
    A LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-frameCount-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-frameCount.html
    A LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-full-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-full.html
    A LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-memoryLimit-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-memoryLimit.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-frameCount-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-frameCount.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-full-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-full.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-memoryLimit-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-memoryLimit.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-snapshots-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl-snapshots.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-frameCount-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-frameCount.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-full-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-full.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-memoryLimit-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-memoryLimit.html
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-snapshots-expected.txt
    A LayoutTests/inspector/canvas/recording-offscreen-webgl2-snapshots.html
    M LayoutTests/inspector/canvas/resources/recording-2d.js
    M LayoutTests/inspector/canvas/resources/recording-bitmaprenderer.js
    M LayoutTests/inspector/canvas/resources/recording-webgl.js
    M LayoutTests/inspector/canvas/resources/recording-webgl2.js
    M LayoutTests/inspector/canvas/resources/shaderProgram-utilities-webgl.js
    M LayoutTests/platform/gtk/TestExpectations
    M LayoutTests/platform/mac-wk1/TestExpectations
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-frameCount-expected.txt
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-full-expected.txt
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-memoryLimit-expected.txt
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-snapshots-expected.txt
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-frameCount-expected.txt
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-full-expected.txt
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-memoryLimit-expected.txt
    A LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-snapshots-expected.txt
    M LayoutTests/platform/mac-wk2/TestExpectations
    M LayoutTests/platform/mac/TestExpectations
    M Source/JavaScriptCore/inspector/protocol/Canvas.json
    M Source/JavaScriptCore/inspector/protocol/Recording.json
    M Source/JavaScriptCore/inspector/scripts/codegen/generator.py
    M Source/WebCore/inspector/InspectorCanvas.cpp
    M Source/WebCore/inspector/InspectorFrontendHost.cpp
    M Source/WebCore/inspector/InspectorFrontendHost.h
    M Source/WebCore/inspector/InspectorFrontendHost.idl
    M Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
    M Source/WebInspectorUI/UserInterface/Base/IDLExtensions.js
    M Source/WebInspectorUI/UserInterface/Models/Canvas.js
    M Source/WebInspectorUI/UserInterface/Models/Recording.js
    M Source/WebInspectorUI/UserInterface/Models/RecordingAction.js
    M Source/WebInspectorUI/UserInterface/Models/RecordingState.js
    M Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js
    M Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
    M Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js
    M Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js
    M Source/WebInspectorUI/UserInterface/Views/RecordingStateDetailsSidebarPanel.js
    M Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js
    M Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.js

  Log Message:
  -----------
  Web Inspector: Canvas: expand OffscreenCanvas support
https://bugs.webkit.org/show_bug.cgi?id=256747

Reviewed by Patrick Angle.

`OffscreenCanvas` currently supports more than just `"2d"`, so Web Inspector should too.

* Source/JavaScriptCore/inspector/protocol/Canvas.json:
* Source/JavaScriptCore/inspector/protocol/Recording.json:
* Source/JavaScriptCore/inspector/scripts/codegen/generator.py:
* Source/WebCore/inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildObjectForCanvas):
(WebCore::InspectorCanvas::releaseObjectForRecording):
Add `offscreen-*` variants for `bitmaprenderer`, `webgl`, and `webgl2`.
Drive-by: Fix an issue that prevented getting the content of an `OffscreenCanvas`.

* Source/WebInspectorUI/UserInterface/Models/Canvas.js:
(WI.Canvas.fromPayload):
(WI.Canvas.displayNameForContextType):
(WI.Canvas.displayNameForColorSpace):
(WI.Canvas.prototype.get supportsRecording): Added.
(WI.Canvas.prototype.get is2D): Added.
(WI.Canvas.prototype.get isBitmapRender): Added.
(WI.Canvas.prototype.get isWebGL): Added.
(WI.Canvas.prototype.get isWebGL2): Added.
(WI.Canvas.prototype.is2D): Deleted.
* Source/WebInspectorUI/UserInterface/Models/Recording.js:
(WI.Recording):
(WI.Recording.fromPayload):
(WI.Recording.displayNameForRecordingType):
(WI.Recording.prototype.get isCanvas): Added.
(WI.Recording.prototype.get isCanvas2D): Added.
(WI.Recording.prototype.get isCanvasBitmapRender): Added.
(WI.Recording.prototype.get isCanvasWebGL): Added.
(WI.Recording.prototype.get isCanvasWebGL2): Added.
(WI.Recording.prototype.createContext):
(WI.Recording.prototype.async _process):
(WI.Recording.is2D): Deleted.
Add helpers for identifying the context type regardless of whether it's from `HTMLCanvasElement` or `OffscreenCanvas` (since the API of the rendering context is (almost) identical in most cases).

* Source/WebInspectorUI/UserInterface/Models/RecordingAction.js:
(WI.RecordingAction._prototypeForType):
(WI.RecordingAction.prototype.process):
(WI.RecordingAction.prototype.process.getContent):
(WI.RecordingAction.prototype.async swizzle):
* Source/WebInspectorUI/UserInterface/Models/RecordingState.js:
(WI.RecordingState.prototype.fromCanvasContext2D): Renamed from `fromContext`.
(WI.RecordingState.async swizzleInitialState):
* Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js:
(WI.ShaderProgram):
(WI.ShaderProgram.contextTypeSupportsProgramType):
(WI.ShaderProgram.prototype.get displayName):
(WI.ShaderProgram.prototype.set disabled):
(WI.ShaderProgram.prototype.showHighlight):
(WI.ShaderProgram.prototype.hideHighlight):
* Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView.prototype.initialLayout):
* Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js:
(WI.CanvasSidebarPanel.prototype._canvasChanged):
(WI.CanvasSidebarPanel.prototype._updateRecordNavigationItem):
* Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js:
(WI.RecordingContentView):
(WI.RecordingContentView.prototype.get navigationItems):
(WI.RecordingContentView.prototype.attached):
(WI.RecordingContentView.prototype._export):
(WI.RecordingContentView.prototype._updateExportButton):
(WI.RecordingContentView.prototype._handleExportNavigationItemClicked):
* Source/WebInspectorUI/UserInterface/Views/RecordingStateDetailsSidebarPanel.js:
(WI.RecordingStateDetailsSidebarPanel.prototype.inspect):
(WI.RecordingStateDetailsSidebarPanel.prototype.set action):
* Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:
(WI.ShaderProgramContentView.prototype.get saveData):
* Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.js:
(WI.ShaderProgramTreeElement):
(WI.ShaderProgramTreeElement.prototype.onattach):
(WI.ShaderProgramTreeElement.prototype.ondetach):
(WI.ShaderProgramTreeElement.prototype.populateContextMenu):
Use the new helpers instead of directly checking the `contextType`/`type` where able.

* Source/WebCore/inspector/InspectorFrontendHost.idl:
* Source/WebCore/inspector/InspectorFrontendHost.h:
* Source/WebCore/inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::getCurrentX const):
(WebCore::InspectorFrontendHost::getCurrentY const):
(WebCore::InspectorFrontendHost::getPath const):
(WebCore::InspectorFrontendHost::setPath const):
* Source/WebInspectorUI/UserInterface/Base/IDLExtensions.js:
Add IDL extensions for `OffscreenCanvasRenderingContext2D`.

* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:

* LayoutTests/inspector/canvas/resources/recording-2d.js:
(async load):
* LayoutTests/inspector/canvas/resources/recording-bitmaprenderer.js:
(load):
* LayoutTests/inspector/canvas/resources/recording-webgl.js:
(load):
* LayoutTests/inspector/canvas/resources/recording-webgl2.js:
(load):
* LayoutTests/inspector/canvas/resources/shaderProgram-utilities-webgl.js:
(createProgram):
* LayoutTests/inspector/canvas/console-record-offscreen-bitmaprenderer.html: Added.
* LayoutTests/inspector/canvas/console-record-offscreen-bitmaprenderer-expected.txt: Added.
* LayoutTests/inspector/canvas/console-record-offscreen-canvas-2d.html:
* LayoutTests/inspector/canvas/console-record-offscreen-canvas-2d-expected.txt:
* LayoutTests/inspector/canvas/console-record-offscreen-webgl.html: Added.
* LayoutTests/inspector/canvas/console-record-offscreen-webgl-expected.txt: Added.
* LayoutTests/inspector/canvas/console-record-offscreen-webgl2.html: Added.
* LayoutTests/inspector/canvas/console-record-offscreen-webgl2-expected.txt: Added.
* 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:
* LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-frameCount.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-frameCount-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-full.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-full-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-memoryLimit.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-bitmaprenderer-memoryLimit-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-frameCount.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-frameCount-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-frameCount-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-full.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-full-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-full-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-memoryLimit.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-memoryLimit-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-memoryLimit-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-snapshots.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl-snapshots-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl-snapshots-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-frameCount.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-frameCount-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-frameCount-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-full.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-full-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-full-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-memoryLimit.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-memoryLimit-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-memoryLimit-expected.txt: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-snapshots.html: Added.
* LayoutTests/inspector/canvas/recording-offscreen-webgl2-snapshots-expected.txt: Added.
* LayoutTests/platform/mac-wk1/inspector/canvas/recording-offscreen-webgl2-snapshots-expected.txt: Added.
* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/mac-wk1/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:

Canonical link: https://commits.webkit.org/271300@main




More information about the webkit-changes mailing list