Skip to content

Commit 71e8691

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
[cleanup] Remove styles-pane-css-changes experiment.
The feature hasn't been actively developed and maintained, and is mostly broken by now. It also has unclear implications for how we think about Workspaces and the Patch Agent integration with Freestyler these days. Therefore I'm removing the support for the experiment. Later this year we will likely start investigating a solution which tracks changes to the CSSOM (by DevTools) and provides users with the ability to "sourcify" and persist them to their project. Fixed: 40803732 Bug: 406453050 Change-Id: I5f40617402f8f0efe53797b4e87f4a97680f575b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6394479 Auto-Submit: Benedikt Meurer <[email protected]> Commit-Queue: Changhao Han <[email protected]> Reviewed-by: Changhao Han <[email protected]>
1 parent 9f18c09 commit 71e8691

File tree

9 files changed

+1
-132
lines changed

9 files changed

+1
-132
lines changed

front_end/core/host/UserMetrics.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,6 @@ export enum DevtoolsExperiments {
967967
'full-accessibility-tree' = 42,
968968
'contrast-issues' = 44,
969969
'experimental-cookie-features' = 45,
970-
'styles-pane-css-changes' = 55,
971970
'instrumentation-breakpoints' = 61,
972971
'authored-deployed-grouping' = 63,
973972
'just-my-code' = 65,

front_end/core/root/Runtime.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ export const enum ExperimentName {
308308
ALL = '*',
309309
PROTOCOL_MONITOR = 'protocol-monitor',
310310
FULL_ACCESSIBILITY_TREE = 'full-accessibility-tree',
311-
STYLES_PANE_CSS_CHANGES = 'styles-pane-css-changes',
312311
HEADER_OVERRIDES = 'header-overrides',
313312
INSTRUMENTATION_BREAKPOINTS = 'instrumentation-breakpoints',
314313
AUTHORED_DEPLOYED_GROUPING = 'authored-deployed-grouping',

front_end/core/sdk/CSSStyleSheetHeader.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import * as TextUtils from '../../models/text_utils/text_utils.js';
77
import * as Common from '../common/common.js';
88
import * as i18n from '../i18n/i18n.js';
99
import * as Platform from '../platform/platform.js';
10-
import * as Root from '../root/root.js';
1110

1211
import type {CSSModel} from './CSSModel.js';
1312
import {DeferredDOMNode} from './DOMModel.js';
@@ -107,11 +106,7 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
107106
}
108107

109108
resourceURL(): Platform.DevToolsPath.UrlString {
110-
const url = this.isViaInspector() ? this.viaInspectorResourceURL() : this.sourceURL;
111-
if (!url && Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES)) {
112-
return this.dynamicStyleURL();
113-
}
114-
return url;
109+
return this.isViaInspector() ? this.viaInspectorResourceURL() : this.sourceURL;
115110
}
116111

117112
private getFrameURLPath(): string {
@@ -137,10 +132,6 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
137132
return `inspector:///inspector-stylesheet#${this.id}` as Platform.DevToolsPath.UrlString;
138133
}
139134

140-
private dynamicStyleURL(): Platform.DevToolsPath.UrlString {
141-
return `stylesheet://${this.getFrameURLPath()}style#${this.id}` as Platform.DevToolsPath.UrlString;
142-
}
143-
144135
lineNumberInSource(lineNumberInStyleSheet: number): number {
145136
return this.startLine + lineNumberInStyleSheet;
146137
}

front_end/entrypoints/main/MainImpl.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,6 @@ export class MainImpl {
330330
// New cookie features.
331331
Root.Runtime.experiments.register('experimental-cookie-features', 'Enable experimental cookie features');
332332

333-
// Integrate CSS changes in the Styles pane.
334-
Root.Runtime.experiments.register(
335-
Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES, 'Sync CSS changes in the Styles tab');
336-
337333
// Highlights a violating node or attribute by rendering a squiggly line under it and adding a tooltip linking to the issues panel.
338334
Root.Runtime.experiments.register(
339335
Root.Runtime.ExperimentName.HIGHLIGHT_ERRORS_ELEMENTS_PANEL,

front_end/panels/elements/StylePropertyTreeElement.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,6 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
16101610
private computedStyles: Map<string, string>|null = null;
16111611
private parentsComputedStyles: Map<string, string>|null = null;
16121612
private contextForTest!: Context|undefined;
1613-
#propertyTextFromSource: string;
16141613
#gridNames: Set<string>|undefined = undefined;
16151614

16161615
constructor(
@@ -1634,8 +1633,6 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
16341633
this.listItemElement.textContent = '';
16351634
}
16361635

1637-
this.#propertyTextFromSource = property.propertyText || '';
1638-
16391636
this.property.addEventListener(SDK.CSSProperty.Events.LOCAL_VALUE_UPDATED, () => {
16401637
this.updateTitle();
16411638
});
@@ -1800,8 +1797,6 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
18001797
} else {
18011798
this.listItemElement.classList.remove('disabled');
18021799
}
1803-
1804-
this.listItemElement.classList.toggle('changed', this.isPropertyChanged(this.property));
18051800
}
18061801

18071802
node(): SDK.DOMModel.DOMNode|null {
@@ -1838,14 +1833,6 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
18381833
this.styleTextAppliedForTest();
18391834
}
18401835

1841-
private isPropertyChanged(property: SDK.CSSProperty.CSSProperty): boolean {
1842-
if (!Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES)) {
1843-
return false;
1844-
}
1845-
// Check local cache first, then check against diffs from the workspace.
1846-
return this.#propertyTextFromSource !== property.propertyText || this.parentPane().isPropertyChanged(property);
1847-
}
1848-
18491836
async #getLonghandProperties(): Promise<SDK.CSSProperty.CSSProperty[]> {
18501837
const staticLonghandProperties = this.property.getLonghandProperties();
18511838

@@ -2104,14 +2091,6 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
21042091
UI.ARIAUtils.setLabel(
21052092
enabledCheckboxElement, `${this.nameElement.textContent} ${this.valueElement.textContent}`);
21062093
}
2107-
2108-
const copyIcon = IconButton.Icon.create('copy', 'copy');
2109-
UI.Tooltip.Tooltip.install(copyIcon, i18nString(UIStrings.copyDeclaration));
2110-
copyIcon.addEventListener('click', () => {
2111-
const propertyText = `${this.property.name}: ${this.property.value};`;
2112-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(propertyText);
2113-
});
2114-
this.listItemElement.append(copyIcon);
21152094
this.listItemElement.insertBefore(enabledCheckboxElement, this.listItemElement.firstChild);
21162095
}
21172096
}
@@ -2922,10 +2901,6 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
29222901
this.styleTextAppliedForTest();
29232902
return;
29242903
}
2925-
if (updatedProperty) {
2926-
this.listItemElement.classList.toggle('changed', this.isPropertyChanged(updatedProperty));
2927-
this.parentPane().updateChangeStatus();
2928-
}
29292904

29302905
this.matchedStylesInternal.resetActiveProperties();
29312906
this.hasBeenEditedIncrementally = true;

front_end/panels/elements/StylesSidebarPane.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,6 @@ const UIStrings = {
122122
*@description Rendering emulation option for toggling the automatic dark mode
123123
*/
124124
automaticDarkMode: 'Automatic dark mode',
125-
/**
126-
*@description Tooltip text that appears when hovering over the css changes button in the Styles Sidebar Pane of the Elements panel
127-
*/
128-
copyAllCSSChanges: 'Copy CSS changes',
129-
/**
130-
*@description Tooltip text that appears after clicking on the copy CSS changes button
131-
*/
132-
copiedToClipboard: 'Copied to clipboard',
133125
/**
134126
*@description Text displayed on layer separators in the styles sidebar pane.
135127
*/
@@ -211,7 +203,6 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
211203

212204
activeCSSAngle: InlineEditor.CSSAngle.CSSAngle|null = null;
213205
#urlToChangeTracker = new Map<Platform.DevToolsPath.UrlString, ChangeTracker>();
214-
#copyChangesButton?: UI.Toolbar.ToolbarButton;
215206
#updateAbortController?: AbortController;
216207
#updateComputedStylesAbortController?: AbortController;
217208

@@ -586,11 +577,6 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
586577
if (!this.initialUpdateCompleted) {
587578
this.initialUpdateCompleted = true;
588579
this.appendToolbarItem(this.createRenderingShortcuts());
589-
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES)) {
590-
this.#copyChangesButton = this.createCopyAllChangesButton();
591-
this.appendToolbarItem(this.#copyChangesButton);
592-
this.#copyChangesButton.element.classList.add('hidden');
593-
}
594580
this.dispatchEventToListeners(Events.INITIAL_UPDATE_COMPLETED);
595581
}
596582

@@ -1057,16 +1043,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
10571043
// the matched styles we reenable the button.
10581044
LayersWidget.ButtonProvider.instance().item().setVisible(false);
10591045

1060-
const refreshedURLs = new Set<string>();
10611046
for (const style of matchedStyles.nodeStyles()) {
1062-
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES) && style.parentRule) {
1063-
const url = style.parentRule.resourceURL();
1064-
if (url && !refreshedURLs.has(url)) {
1065-
await this.trackURLForChanges(url);
1066-
refreshedURLs.add(url);
1067-
}
1068-
}
1069-
10701047
const parentNode = matchedStyles.isInherited(style) ? matchedStyles.nodeForStyle(style) : null;
10711048
if (parentNode && parentNode !== lastParentNode) {
10721049
lastParentNode = parentNode;
@@ -1394,22 +1371,6 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
13941371
return changedLines.has(formattedLineNumber + 1);
13951372
}
13961373

1397-
updateChangeStatus(): void {
1398-
if (!this.#copyChangesButton) {
1399-
return;
1400-
}
1401-
1402-
let hasChangedStyles = false;
1403-
for (const changeTracker of this.#urlToChangeTracker.values()) {
1404-
if (changeTracker.changedLines.size > 0) {
1405-
hasChangedStyles = true;
1406-
break;
1407-
}
1408-
}
1409-
1410-
this.#copyChangesButton.element.classList.toggle('hidden', !hasChangedStyles);
1411-
}
1412-
14131374
private async refreshChangedLines(uiSourceCode: Workspace.UISourceCode.UISourceCode): Promise<void> {
14141375
const changeTracker = this.#urlToChangeTracker.get(uiSourceCode.url());
14151376
if (!changeTracker) {
@@ -1586,27 +1547,6 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
15861547

15871548
return button;
15881549
}
1589-
1590-
private createCopyAllChangesButton(): UI.Toolbar.ToolbarButton {
1591-
const copyAllChangesButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.copyAllCSSChanges), 'copy');
1592-
// TODO(1296947): implement a dedicated component to share between all copy buttons
1593-
copyAllChangesButton.element.setAttribute('data-content', i18nString(UIStrings.copiedToClipboard));
1594-
let timeout: number|undefined;
1595-
copyAllChangesButton.addEventListener(UI.Toolbar.ToolbarButton.Events.CLICK, async () => {
1596-
const allChanges = await this.getFormattedChanges();
1597-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(allChanges);
1598-
if (timeout) {
1599-
clearTimeout(timeout);
1600-
timeout = undefined;
1601-
}
1602-
copyAllChangesButton.element.classList.add('copied-to-clipboard');
1603-
timeout = window.setTimeout(() => {
1604-
copyAllChangesButton.element.classList.remove('copied-to-clipboard');
1605-
timeout = undefined;
1606-
}, 2000);
1607-
});
1608-
return copyAllChangesButton;
1609-
}
16101550
}
16111551

16121552
export const enum Events {

front_end/panels/elements/stylePropertiesTreeOutline.css

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -148,35 +148,6 @@ input.enabled-button.small {
148148
opacity: 50%;
149149
}
150150

151-
.changed {
152-
background-color: var(--sys-color-tertiary-container);
153-
154-
&::after {
155-
content: "";
156-
position: absolute;
157-
left: -4px;
158-
top: 0;
159-
width: 2px;
160-
height: 100%;
161-
background-color: var(--sys-color-tertiary);
162-
}
163-
}
164-
165-
.copy {
166-
display: none;
167-
168-
.changed:hover & {
169-
position: absolute;
170-
right: -4px;
171-
top: 0;
172-
bottom: 0;
173-
margin: auto;
174-
display: inline-block;
175-
cursor: pointer;
176-
transform: scale(0.9);
177-
}
178-
}
179-
180151
.hint-wrapper {
181152
align-items: center;
182153
display: inline-block;

front_end/testing/EnvironmentHelpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ const REGISTERED_EXPERIMENTS = [
116116
'timeline-v8-runtime-call-stats',
117117
'timeline-invalidation-tracking',
118118
Root.Runtime.ExperimentName.INSTRUMENTATION_BREAKPOINTS,
119-
Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES,
120119
Root.Runtime.ExperimentName.HEADER_OVERRIDES,
121120
Root.Runtime.ExperimentName.HIGHLIGHT_ERRORS_ELEMENTS_PANEL,
122121
Root.Runtime.ExperimentName.USE_SOURCE_MAP_SCOPES,

front_end/ui/visual_logging/KnownContextValues.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3380,7 +3380,6 @@ export const knownContextValues = new Set([
33803380
'style-sheet-id',
33813381
'styles',
33823382
'styles-metrics',
3383-
'styles-pane-css-changes',
33843383
'stylesheet',
33853384
'subdomain',
33863385
'subgrid',

0 commit comments

Comments
 (0)