Skip to content

Commit c52c058

Browse files
hanselfmu-chromiumDevtools-frontend LUCI CQ
authored andcommitted
Apply style change after dragging is finished for CSSLength
Previously we did not apply style text after dragging is finished, which means we did not "commit" the change and therefore lost important calls to update the status of the changed declaration. This CL ensures this, which is consistent with other style widgets' behaviors. Fixed: 356039089 Change-Id: I8650031d4df3cc6a07f564aebd38ed53edc66d22 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6124760 Auto-Submit: Changhao Han <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]>
1 parent 8f96d8b commit c52c058

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

front_end/panels/elements/StylePropertyTreeElement.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,7 @@ export class LengthRenderer implements MatchRenderer<LengthMatch> {
11861186

11871187
const onDraggingFinished = (): void => {
11881188
this.#treeElement.parentPane().setEditingStyle(false);
1189+
void this.#treeElement.applyStyleText(this.#treeElement.renderedPropertyText(), true);
11891190
};
11901191

11911192
cssLength.addEventListener('valuechanged', onValueChanged);
@@ -2189,7 +2190,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
21892190

21902191
this.originalPropertyText = this.property.propertyText || '';
21912192

2192-
this.parentPaneInternal.setEditingStyle(true, this);
2193+
this.parentPaneInternal.setEditingStyle(true);
21932194
selectedElement.parentElement?.scrollIntoViewIfNeeded(false);
21942195

21952196
this.prompt = new CSSPropertyPrompt(this, context.isEditingName, Array.from(this.#gridNames ?? []));
@@ -2586,7 +2587,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
25862587

25872588
private async innerApplyStyleText(
25882589
styleText: string, majorChange: boolean, property?: SDK.CSSProperty.CSSProperty|null): Promise<void> {
2589-
// this.property might have been nulled at the end of the last innerApplyStyleText
2590+
// this.property might have been nulled at the end of the last innerApplyStyleText.
25902591
if (!this.treeOutline || !this.property) {
25912592
return;
25922593
}

front_end/panels/elements/StylesSidebarPane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
808808
}
809809
}
810810

811-
setEditingStyle(editing: boolean, _treeElement?: StylePropertyTreeElement): void {
811+
setEditingStyle(editing: boolean): void {
812812
if (this.isEditingStyle === editing) {
813813
return;
814814
}

0 commit comments

Comments
 (0)