From f1bede202a49c5c7edd95272f84672b375bcc582 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Fri, 13 Oct 2023 09:25:47 -0700 Subject: [PATCH] highlight unknown WebGPUReport wants to highlight when an avaiable limit is better than the default (or worse in the case of compat) To do that it needs to know the default limits. This PR highlights limits it is unaware so hopefull the defaults will be added. It doesn't error because we still want the site to be useful for unknown limits. --- index.html | 5 +++++ index.js | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 0289391..aae0877 100644 --- a/index.html +++ b/index.html @@ -42,6 +42,7 @@ --header-background-color: #DDD; --header-text-color: #00A; --different-text-color: magenta; + --unknown-text-color: #458; } @media (prefers-color-scheme: dark) { @@ -58,6 +59,7 @@ --header-background-color: #333; --header-text-color: lightgreen; --different-text-color: orange; + --unknown-text-color: #8AF; } } body { @@ -133,6 +135,9 @@ .different-worse { color: var(--error-text-color); } +.unknown { + color: var(--unknown-text-color); +} .limit>td:first-child, .feature>td:first-child, diff --git a/index.js b/index.js index 8cd7486..fdee523 100644 --- a/index.js +++ b/index.js @@ -244,15 +244,20 @@ function markDifferencesInLimits(adapter) { .map(([k, v]) => { const info = kLimitInfo[k]; const isDiff = info && info.default !== v; - const diffClass = isDiff - ? differenceWorse(info, v) ? 'different-worse' : 'different-better' - : ''; + const diffClass = info + ? (isDiff + ? differenceWorse(info, v) ? 'different-worse' : 'different-better' + : '') + : 'unknown'; const value = v > 1024 && info ? `${v} (${shortSizeByType(v, info.type)})` : v; return [ k, isDiff ? [value, {className: `${diffClass} nowrap`, title: `default${adapter.isCompatibilityMode ? ' in compat' : ''}: ${shortSizeByType(adapter.isCompatibilityMode ? info.compat : info.default, info.type)}`}] - : [value, {className: 'nowrap', title: 'same as default'}] + : info + ? [value, {className: 'nowrap', title: 'same as default'}] + : [value, {className: 'unknown nowrap', title: 'unknown limit (new?)'}] + ]; }) );