Skip to content

Commit 95700cc

Browse files
pfaffeDevtools-frontend LUCI CQ
authored andcommitted
Remove expired devtools-css-value-tracing flag
Bug: 427388452 Change-Id: I6558960166e612847eda53d3d84e7d2102f0c612 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6679333 Auto-Submit: Philip Pfaffe <pfaffe@chromium.org> Commit-Queue: Philip Pfaffe <pfaffe@chromium.org> Reviewed-by: Changhao Han <changhaohan@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org>
1 parent fffd493 commit 95700cc

File tree

4 files changed

+27
-30
lines changed

4 files changed

+27
-30
lines changed

front_end/core/root/Runtime.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,6 @@ export interface HostConfigThirdPartyCookieControls {
429429
managedBlockThirdPartyCookies: string|boolean;
430430
}
431431

432-
interface CSSValueTracing {
433-
enabled: boolean;
434-
}
435-
436432
interface AiGeneratedTimelineLabels {
437433
enabled: boolean;
438434
}
@@ -470,7 +466,6 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
470466
devToolsEnableOriginBoundCookies: HostConfigEnableOriginBoundCookies,
471467
devToolsAnimationStylesInStylesTab: HostConfigAnimationStylesInStylesTab,
472468
thirdPartyCookieControls: HostConfigThirdPartyCookieControls,
473-
devToolsCssValueTracing: CSSValueTracing,
474469
devToolsAiGeneratedTimelineLabels: AiGeneratedTimelineLabels,
475470
}>;
476471

front_end/panels/elements/StylePropertyTreeElement.test.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as Protocol from '../../generated/protocol.js';
1010
import * as Bindings from '../../models/bindings/bindings.js';
1111
import * as Workspace from '../../models/workspace/workspace.js';
1212
import {renderElementIntoDOM} from '../../testing/DOMHelpers.js';
13-
import {createTarget, updateHostConfig} from '../../testing/EnvironmentHelpers.js';
13+
import {createTarget} from '../../testing/EnvironmentHelpers.js';
1414
import {spyCall} from '../../testing/ExpectStubCall.js';
1515
import {describeWithMockConnection, setMockConnectionResponseHandler} from '../../testing/MockConnection.js';
1616
import {
@@ -112,9 +112,11 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
112112

113113
function getTreeElement(name: string, value: string, longhandProperties: Protocol.CSS.CSSProperty[] = []) {
114114
const property = addProperty(name, value, longhandProperties);
115+
const section = new Elements.StylePropertiesSection.StylePropertiesSection(
116+
stylesSidebarPane, matchedStyles, property.ownerStyle, 0, null, null);
115117
return new Elements.StylePropertyTreeElement.StylePropertyTreeElement({
116118
stylesPane: stylesSidebarPane,
117-
section: sinon.createStubInstance(Elements.StylePropertiesSection.StylePropertiesSection),
119+
section,
118120
matchedStyles,
119121
property,
120122
isShorthand: longhandProperties.length > 0,
@@ -252,8 +254,8 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
252254
assert.exists(colorMixSwatch);
253255
renderElementIntoDOM(stylePropertyTreeElement.valueElement as HTMLElement);
254256

255-
const tooltip: Tooltips.Tooltip.Tooltip|null|undefined =
256-
stylePropertyTreeElement.valueElement?.querySelector('devtools-tooltip');
257+
const tooltip: Tooltips.Tooltip.Tooltip|null|undefined = stylePropertyTreeElement.valueElement?.querySelector(
258+
'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])');
257259
assert.exists(tooltip);
258260
tooltip.showPopover();
259261
assert.strictEqual(tooltip.textContent, '#ff8000');
@@ -267,7 +269,9 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
267269
assert.exists(colorMixSwatch);
268270
renderElementIntoDOM(stylePropertyTreeElement.valueElement as HTMLElement);
269271

270-
const tooltip = stylePropertyTreeElement.valueElement?.querySelector('devtools-tooltip');
272+
const tooltip = stylePropertyTreeElement.valueElement?.querySelector(
273+
'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])') as HTMLElement |
274+
null | undefined;
271275
tooltip?.showPopover();
272276
assert.strictEqual(tooltip?.textContent, 'color(srgb 1 0.24 0.17)');
273277
});
@@ -330,7 +334,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
330334
});
331335

332336
it('shows a value tracing tooltip on the var function', async () => {
333-
updateHostConfig({devToolsCssValueTracing: {enabled: true}});
334337
const stylePropertyTreeElement = getTreeElement('color', 'color-mix(in srgb, yellow, green)');
335338
stylePropertyTreeElement.updateTitle();
336339
assert.exists(stylePropertyTreeElement.valueElement);
@@ -803,7 +806,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
803806
});
804807

805808
it('shows a value tracing tooltip on the var function', async () => {
806-
updateHostConfig({devToolsCssValueTracing: {enabled: true}});
807809
const stylePropertyTreeElement = getTreeElement('color', 'var(--blue)');
808810
stylePropertyTreeElement.updateTitle();
809811
assert.exists(stylePropertyTreeElement.valueElement);
@@ -904,7 +906,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
904906
});
905907

906908
it('shows a value tracing tooltip on color functions', async () => {
907-
updateHostConfig({devToolsCssValueTracing: {enabled: true}});
908909
for (const property of ['rgb(255 0 0)', 'color(srgb 0.5 0.5 0.5)', 'oklch(from purple calc(l * 2) c h)']) {
909910
const stylePropertyTreeElement = getTreeElement('color', property);
910911
stylePropertyTreeElement.updateTitle();
@@ -924,14 +925,14 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
924925
const stylePropertyTreeElement = getTreeElement('color', 'rgb(from #ff0c0c calc(r / 2) g b)');
925926
stylePropertyTreeElement.updateTitle();
926927

927-
const tooltips = stylePropertyTreeElement.valueElement?.querySelectorAll('devtools-tooltip');
928+
const tooltips = stylePropertyTreeElement.valueElement?.querySelectorAll(
929+
'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])');
928930
assert.exists(tooltips);
929931
assert.lengthOf(tooltips, 3);
930932
assert.deepEqual(Array.from(tooltips).map(tooltip => tooltip.textContent), ['1.000', '0.047', '0.047']);
931933
});
932934

933935
it('evaluates relative color channels during tracing', async () => {
934-
updateHostConfig({devToolsCssValueTracing: {enabled: true}});
935936
setMockConnectionResponseHandler(
936937
'CSS.resolveValues',
937938
(request: Protocol.CSS.ResolveValuesRequest) =>
@@ -1927,7 +1928,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
19271928
});
19281929

19291930
it('uses the right longhand name in length shorthands inside of substitutions during tracing', async () => {
1930-
updateHostConfig({devToolsCssValueTracing: {enabled: true}});
19311931
const cssModel = stylesSidebarPane.cssModel();
19321932
assert.exists(cssModel);
19331933
const resolveValuesStub = sinon.stub(cssModel, 'resolveValues').callsFake((name, nodeId, ...values) => {
@@ -1971,15 +1971,14 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
19711971

19721972
sinon.assert.calledOnce(strikeOutSpy);
19731973
await strikeOutSpy.returnValues[0];
1974-
const args = stylePropertyTreeElement.valueElement?.querySelectorAll(':scope > span > span') as
1975-
NodeListOf<HTMLSpanElement>;
1974+
const args = stylePropertyTreeElement.valueElement?.querySelectorAll(
1975+
':scope > span > span:not(.tracing-anchor)') as NodeListOf<HTMLSpanElement>;
19761976
assert.lengthOf(args, 3);
19771977
assert.deepEqual(
19781978
Array.from(args.values()).map(arg => arg.classList.contains('inactive-value')), [true, false, true]);
19791979
});
19801980

19811981
it('shows a value tracing tooltip on the calc function', async () => {
1982-
updateHostConfig({devToolsCssValueTracing: {enabled: true}});
19831982
for (const property of ['calc(1px + 2px)', 'min(1px, 2px)', 'max(3px, 1px)']) {
19841983
const stylePropertyTreeElement = getTreeElement('width', property);
19851984
stylePropertyTreeElement.updateTitle();
@@ -1994,7 +1993,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
19941993
});
19951994

19961995
it('shows the original text during tracing when evaluation fails', async () => {
1997-
updateHostConfig({devToolsCssValueTracing: {enabled: true}});
19981996
setMockConnectionResponseHandler(
19991997
'CSS.resolveValues',
20001998
(request: Protocol.CSS.ResolveValuesRequest) => ({results: request.values.map(() => '')}));
@@ -2134,7 +2132,9 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
21342132
const openTooltipPromise1 = new Promise<void>(r => openTooltipStub.callsFake(r));
21352133
const stylePropertyTreeElement = getTreeElement('color', 'color-mix(in srgb, red, blue)');
21362134
stylePropertyTreeElement.updateTitle();
2137-
const tooltip = stylePropertyTreeElement.valueElement?.querySelector('devtools-tooltip');
2135+
const tooltip = stylePropertyTreeElement.valueElement?.querySelector(
2136+
'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])') as Tooltips.Tooltip.Tooltip |
2137+
null | undefined;
21382138
assert.exists(tooltip);
21392139
renderElementIntoDOM(tooltip);
21402140
tooltip.showTooltip();
@@ -2143,7 +2143,10 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
21432143

21442144
const openTooltipPromise2 = new Promise<void>(r => openTooltipStub.callsFake(r));
21452145
stylePropertyTreeElement.updateTitle();
2146-
const tooltip2 = stylePropertyTreeElement.valueElement?.querySelector('devtools-tooltip');
2146+
const tooltip2 =
2147+
stylePropertyTreeElement.valueElement?.querySelector(
2148+
'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])') as Tooltips.Tooltip.Tooltip |
2149+
null | undefined;
21472150
assert.exists(tooltip2);
21482151
renderElementIntoDOM(tooltip2);
21492152
await openTooltipPromise2;

front_end/panels/elements/StylePropertyTreeElement.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
23052305
getTracingTooltip(
23062306
functionName: string, node: CodeMirror.SyntaxNode, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
23072307
computedStyles: Map<string, string>, context: RenderingContext): Lit.TemplateResult {
2308-
if (!Root.Runtime.hostConfig.devToolsCssValueTracing?.enabled || context.tracing || !context.property) {
2308+
if (context.tracing || !context.property) {
23092309
return html`${functionName}`;
23102310
}
23112311
const text = context.ast.text(node);
@@ -2365,12 +2365,11 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
23652365
const tooltipKeyCount = this.#tooltipKeyCounts.get(key) ?? 0;
23662366
this.#tooltipKeyCounts.set(key, tooltipKeyCount + 1);
23672367
const propertyNameForCounting = this.getLonghand()?.name ?? this.name;
2368-
const ownIndex = this.treeOutline?.rootElement().children().indexOf(this) ?? -1;
2369-
const propertyCount = this.treeOutline?.rootElement().children().reduce<number>(
2370-
(value, element, index) => index < ownIndex && element instanceof StylePropertyTreeElement &&
2371-
element.name === propertyNameForCounting ?
2372-
value + 1 :
2373-
value,
2368+
const ownIndex = this.style.allProperties().indexOf(this.property);
2369+
const propertyCount = this.style.allProperties().reduce<number>(
2370+
(value, property, index) =>
2371+
index < ownIndex && (property.name === this.name || property.name === propertyNameForCounting) ? value + 1 :
2372+
value,
23742373
0);
23752374
return `swatch-tooltip-${sectionId}-${this.name}-${propertyCount}-${key}-${tooltipKeyCount}`;
23762375
}

scripts/npm_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function main() {
4242
'Ensure you have built a release version of `chrome` or use ' +
4343
'`--target=Debug`.');
4444
}
45-
const outDir = path.resolve(RELEASE_PATH, '..');
45+
const outDir = path.resolve(RELEASE_PATH);
4646

4747
runTests(outDir, IS_DEBUG_ENABLED);
4848
}

0 commit comments

Comments
 (0)