Skip to content

Commit 7de602a

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Update swatch popover helper and CSSPlugin
Both open the color picker in different environments (GlassPane, and Codemirror Tooltips). Screenshots: https://imgur.com/a/js6wjcU Bug: 406706611 Change-Id: I14e78949c6246dada6897604e9d1f5c6169d398e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6400616 Reviewed-by: Kateryna Prokopenko <[email protected]> Commit-Queue: Kim-Anh Tran <[email protected]>
1 parent 3dffede commit 7de602a

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

front_end/panels/sources/CSSPlugin.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ type ActiveTooltip = {
245245
function createCSSTooltip(active: ActiveTooltip): CodeMirror.Tooltip {
246246
return {
247247
pos: active.pos,
248-
arrow: true,
248+
arrow: false,
249249
create(view): CodeMirror.TooltipView {
250250
let text = active.text;
251251
let widget: UI.Widget.VBox, addListener: (handler: (event: {data: string}) => void) => void;
@@ -365,7 +365,7 @@ decorations:
365365
});
366366

367367
function cssSwatches(): CodeMirror.Extension {
368-
return [cssSwatchPlugin, cssTooltipState];
368+
return [cssSwatchPlugin, cssTooltipState, theme];
369369
}
370370

371371
function getNumberAt(node: CodeMirror.SyntaxNode): {from: number, to: number}|null {
@@ -487,3 +487,12 @@ export class CSSPlugin extends Plugin implements SDK.TargetManager.SDKModelObser
487487
}
488488
}
489489
}
490+
491+
const theme = CodeMirror.EditorView.baseTheme({
492+
'.cm-tooltip.cm-tooltip-swatchEdit': {
493+
'box-shadow': 'var(--sys-elevation-level2)',
494+
'background-color': 'var(--sys-color-base-container-elevated)',
495+
'border-radius': 'var(--sys-shape-corner-small)',
496+
padding: 'var(--sys-size-6) var(--sys-size-8)',
497+
},
498+
});

front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class SwatchPopoverHelper extends Common.ObjectWrapper.ObjectWrapper<Even
2525
super();
2626
this.popover = new UI.GlassPane.GlassPane();
2727
this.popover.setSizeBehavior(UI.GlassPane.SizeBehavior.MEASURE_CONTENT);
28-
this.popover.setMarginBehavior(UI.GlassPane.MarginBehavior.ARROW);
28+
this.popover.setMarginBehavior(UI.GlassPane.MarginBehavior.DEFAULT_MARGIN);
2929
this.popover.element.addEventListener('mousedown', e => e.consume(), false);
3030

3131
this.hideProxy = this.hide.bind(this, true);

front_end/ui/legacy/components/inline_editor/swatchPopover.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
.widget {
88
display: flex;
9-
background: var(--sys-color-cdt-base-container);
10-
box-shadow: var(--drop-shadow);
11-
border-radius: 2px;
129
overflow: auto;
1310
user-select: text;
11+
font: var(--sys-typescale-body4-regular);
1412
line-height: 11px;
13+
box-shadow: var(--sys-elevation-level2);
14+
background-color: var(--sys-color-base-container-elevated);
15+
border-radius: var(--sys-shape-corner-small);
16+
padding: var(--sys-size-6) var(--sys-size-8);
1517
}

0 commit comments

Comments
 (0)