Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (283571 => 283572)
--- trunk/Source/_javascript_Core/ChangeLog 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-10-05 22:12:56 UTC (rev 283572)
@@ -1,3 +1,15 @@
+2021-10-05 Patrick Angle <[email protected]>
+
+ Web Inspector: Show color space for canvases in the Graphics tab on the overview cards
+ https://bugs.webkit.org/show_bug.cgi?id=231205
+
+ Reviewed by Devin Rousso.
+
+ Use an enum instead of strings for color space values sent to the frontend.
+
+ * inspector/protocol/Canvas.json:
+ * inspector/scripts/codegen/generator.py:
+
2021-10-05 Mark Lam <[email protected]>
CodeBlock should not add/remove LoopHintExecutionCounters.
Modified: trunk/Source/_javascript_Core/inspector/protocol/Canvas.json (283571 => 283572)
--- trunk/Source/_javascript_Core/inspector/protocol/Canvas.json 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/_javascript_Core/inspector/protocol/Canvas.json 2021-10-05 22:12:56 UTC (rev 283572)
@@ -16,6 +16,11 @@
"description": "Unique shader program identifier."
},
{
+ "id": "ColorSpace",
+ "type": "string",
+ "enum": ["srgb", "display-p3"]
+ },
+ {
"id": "ContextType",
"type": "string",
"enum": ["canvas-2d", "bitmaprenderer", "webgl", "webgl2"],
@@ -39,7 +44,7 @@
"description": "Drawing surface attributes.",
"properties": [
{ "name": "alpha", "type": "boolean", "optional": true, "description": "WebGL, WebGL2, ImageBitmapRenderingContext" },
- { "name": "colorSpace", "type": "string", "optional": true, "description": "2D" },
+ { "name": "colorSpace", "$ref": "ColorSpace", "optional": true, "description": "2D" },
{ "name": "desynchronized", "type": "boolean", "optional": true, "description": "2D" },
{ "name": "depth", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
{ "name": "stencil", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py (283571 => 283572)
--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py 2021-10-05 22:12:56 UTC (rev 283572)
@@ -42,7 +42,8 @@
def ucfirst(str):
return str[:1].upper() + str[1:]
-_ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS = set(['2D', 'API', 'CSS', 'DOM', 'HTML', 'JIT', 'XHR', 'XML', 'IOS', 'MacOS', '_javascript_', 'ServiceWorker'])
+
+_ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS = set(['2D', 'API', 'CSS', 'DOM', 'HTML', 'JIT', 'SRGB', 'XHR', 'XML', 'IOS', 'MacOS', '_javascript_', 'ServiceWorker'])
_ALWAYS_SPECIALCASED_ENUM_VALUE_LOOKUP_TABLE = dict([(s.upper(), s) for s in _ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS])
_ENUM_IDENTIFIER_RENAME_MAP = {
Modified: trunk/Source/WebCore/ChangeLog (283571 => 283572)
--- trunk/Source/WebCore/ChangeLog 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/WebCore/ChangeLog 2021-10-05 22:12:56 UTC (rev 283572)
@@ -1,3 +1,15 @@
+2021-10-05 Patrick Angle <[email protected]>
+
+ Web Inspector: Show color space for canvases in the Graphics tab on the overview cards
+ https://bugs.webkit.org/show_bug.cgi?id=231205
+
+ Reviewed by Devin Rousso.
+
+ Use an enum instead of strings for color space values sent to the frontend.
+
+ * inspector/InspectorCanvas.cpp:
+ (WebCore::buildObjectForCanvasContextAttributes):
+
2021-10-05 Alan Bujtas <[email protected]>
Remove leftover ASSERT.
Modified: trunk/Source/WebCore/inspector/InspectorCanvas.cpp (283571 => 283572)
--- trunk/Source/WebCore/inspector/InspectorCanvas.cpp 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/WebCore/inspector/InspectorCanvas.cpp 2021-10-05 22:12:56 UTC (rev 283572)
@@ -821,12 +821,12 @@
.release();
switch (attributes.colorSpace) {
case PredefinedColorSpace::SRGB:
- contextAttributesPayload->setColorSpace("srgb"_s);
+ contextAttributesPayload->setColorSpace(Protocol::Canvas::ColorSpace::SRGB);
break;
#if ENABLE(PREDEFINED_COLOR_SPACE_DISPLAY_P3)
case PredefinedColorSpace::DisplayP3:
- contextAttributesPayload->setColorSpace("display-p3"_s);
+ contextAttributesPayload->setColorSpace(Protocol::Canvas::ColorSpace::DisplayP3);
break;
#endif
}
Modified: trunk/Source/WebInspectorUI/ChangeLog (283571 => 283572)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-10-05 22:12:56 UTC (rev 283572)
@@ -1,3 +1,21 @@
+2021-10-05 Patrick Angle <[email protected]>
+
+ Web Inspector: Show color space for canvases in the Graphics tab on the overview cards
+ https://bugs.webkit.org/show_bug.cgi?id=231205
+
+ Reviewed by Devin Rousso.
+
+ For canvas context's with a color space attribute, show the color space next to the context type in the header
+ of each context card in the Graphics tab.
+
+ * UserInterface/Models/Canvas.js:
+ (WI.Canvas.displayNameForColorSpace):
+ * UserInterface/Views/CanvasContentView.js:
+ (WI.CanvasContentView.prototype.initialLayout):
+ * UserInterface/Views/CanvasOverviewContentView.css:
+ (.content-view.canvas-overview > .content-view.canvas > header > .titles > :matches(.subtitle, .color-space),):
+ (.content-view.canvas-overview > .content-view.canvas > header .color-space::before):
+
2021-09-29 BJ Burg <[email protected]>
[Cocoa] add _WKInspectorExtension SPI to evaluate script on an extension tab
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js (283571 => 283572)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js 2021-10-05 22:12:56 UTC (rev 283572)
@@ -112,6 +112,19 @@
return null;
}
+ static displayNameForColorSpace(colorSpace)
+ {
+ switch(colorSpace) {
+ case WI.Canvas.ColorSpace.SRGB:
+ return WI.unlocalizedString("sRGB");
+ case WI.Canvas.ColorSpace.DisplayP3:
+ return WI.unlocalizedString("Display P3");
+ }
+
+ console.assert(false, "Unknown canvas color space", colorSpace);
+ return null;
+ }
+
static resetUniqueDisplayNameNumbers()
{
Canvas._nextContextUniqueDisplayNameNumber = 1;
@@ -454,6 +467,11 @@
WebMetal: "webmetal",
};
+WI.Canvas.ColorSpace = {
+ SRGB: "srgb",
+ DisplayP3: "display-p3",
+};
+
WI.Canvas.RecordingState = {
Inactive: "canvas-recording-state-inactive",
ActiveFrontend: "canvas-recording-state-active-frontend",
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js (283571 => 283572)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js 2021-10-05 22:12:56 UTC (rev 283572)
@@ -105,6 +105,12 @@
subtitle.className = "subtitle";
subtitle.textContent = WI.Canvas.displayNameForContextType(this.representedObject.contextType);
+ if (this.representedObject.contextAttributes.colorSpace) {
+ let subtitle = titles.appendChild(document.createElement("span"));
+ subtitle.className = "color-space";
+ subtitle.textContent = "(" + WI.Canvas.displayNameForColorSpace(this.representedObject.contextAttributes.colorSpace) + ")";
+ }
+
let navigationBar = new WI.NavigationBar;
if (this.representedObject.contextType === WI.Canvas.ContextType.Canvas2D || this.representedObject.contextType === WI.Canvas.ContextType.BitmapRenderer || this.representedObject.contextType === WI.Canvas.ContextType.WebGL || this.representedObject.contextType === WI.Canvas.ContextType.WebGL2) {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.css (283571 => 283572)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.css 2021-10-05 22:04:30 UTC (rev 283571)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.css 2021-10-05 22:12:56 UTC (rev 283572)
@@ -76,7 +76,7 @@
color: var(--text-color-gray-dark);
}
-.content-view.canvas-overview > .content-view.canvas > header > .titles > .subtitle,
+.content-view.canvas-overview > .content-view.canvas > header > .titles > :matches(.subtitle, .color-space),
.content-view.canvas-overview > .content-view.canvas > footer .memory-cost {
color: var(--text-color-gray-medium);
}
@@ -85,6 +85,10 @@
content: "\00A0\2014\00A0"; /* — */;
}
+.content-view.canvas-overview > .content-view.canvas > header .color-space::before {
+ content: "\00A0"; /* */;
+}
+
.content-view.canvas-overview > .content-view.canvas.recording-active > header > .titles > .title {
color: white;
}