File: unified-extensions.css

package info (click to toggle)
firefox 141.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,550,588 kB
  • sloc: cpp: 7,426,506; javascript: 6,367,238; ansic: 3,707,351; python: 1,369,002; xml: 623,983; asm: 426,918; java: 184,324; sh: 64,488; makefile: 19,203; objc: 13,059; perl: 12,955; yacc: 4,583; cs: 3,846; pascal: 3,352; lex: 1,720; ruby: 1,071; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (295 lines) | stat: -rw-r--r-- 10,971 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

:root {
  /* uei = unified extensions item */
  --uei-icon-size: 32px;
  --uei-attention-dot-size: 8px;
  --uei-button-bgcolor: var(--button-background-color-ghost);
  --uei-button-color: var(--button-text-color-ghost);
  --uei-button-hover-bgcolor: var(--button-background-color-ghost-hover);
  --uei-button-hover-color: var(--button-text-color-ghost-hover);
  --uei-button-active-bgcolor: var(--button-background-color-ghost-active);
  --uei-button-active-color: var(--button-text-color-ghost-active);
  --uei-button-attention-dot-color: var(--attention-dot-color);

  &[uidensity="compact"] {
    --uei-icon-size: 24px;
  }
}

#unified-extensions-panel {
  --uei-dot-horizontal-position-in-panel: calc(var(--uei-icon-size) / 2 + var(--arrowpanel-menuitem-padding-inline) - var(--uei-attention-dot-size) / 2);
  --uei-dot-vertical-position-in-panel: max(0px, calc(var(--arrowpanel-menuitem-padding-block) / 2 - var(--uei-attention-dot-size) / 2));
}

#unified-extensions-view {
  width: var(--menu-panel-width-wide);
}

/* Align extensions rendered with custom elements. */
unified-extensions-item {
  display: flex;

  & > .unified-extensions-item-row-wrapper > .subviewbutton {
    flex-shrink: 1;
  }
}

#unified-extensions-panel .unified-extensions-item {
  -moz-context-properties: fill;
  fill: currentColor;
  /* Have some spacing between items in the panel; mainly useful for when HCM is enabled. */
  margin-block: 2px !important; /* override panelUI-shared.css */
}

/* Override the margin for the subviewbutton wrapped inside
* the row wrapper box */
.unified-extensions-item > .unified-extensions-item-row-wrapper > .subviewbutton {
  margin: 0;
}

/* The "attention UI" for the unified extensions is based on:
 * https://searchfox.org/mozilla-central/rev/560b7b1b17/browser/themes/shared/tabs.css#624 */

/* On the main unified extensions button, we draw the attention on the icon element. */
#unified-extensions-button[attention] > .toolbarbutton-icon,
/* For extension widgets placed in a toolbar, we use the stack element
 * (containing the icon) of the action button to draw the attention dot.
 * Otherwise (in the extensions panel), we use the action button itself. */
.unified-extensions-item[attention] > .unified-extensions-item-row-wrapper > .unified-extensions-item-action-button.toolbarbutton-1 > .toolbarbutton-badge-stack,
.unified-extensions-item[attention] > .unified-extensions-item-row-wrapper > .unified-extensions-item-action-button.subviewbutton {
  background-image: radial-gradient(circle, var(--uei-button-attention-dot-color), var(--uei-button-attention-dot-color) 2px, transparent 2px);
  background-size: var(--uei-attention-dot-size) var(--uei-attention-dot-size);
  background-repeat: no-repeat;

  /* Adjust attention dots position in the toolbar. */
  background-position: center bottom calc(var(--toolbarbutton-inner-padding) / 2 - var(--uei-attention-dot-size) / 2);

  /* Adjust attention dots position in the unified extensions panel. */
  &.subviewbutton {
    background-position: left var(--uei-dot-horizontal-position-in-panel) bottom var(--uei-dot-vertical-position-in-panel);

    &:-moz-locale-dir(rtl) {
      background-position-x: right var(--uei-dot-horizontal-position-in-panel);
    }
  }
}

.unified-extensions-item-action-button {
  flex: 1;
  overflow: hidden;

  /* The padding-block for menuitems is set to 0 in compact mode which, with the
   * extension icon being 32px in this case, makes the item look crowded even for
   * compact mode. */
  :root[uidensity="compact"] panel:not([touchmode]) & {
    padding-block: 4px;
  }
}

.unified-extensions-item-action-button {
  list-style-image: var(--webextension-toolbar-image, inherit);

  toolbar[brighttext] & {
    list-style-image: var(--webextension-toolbar-image-light, inherit);
  }
  :root[lwtheme] toolbar:not([brighttext]) & {
    list-style-image: var(--webextension-toolbar-image-dark, inherit);
  }
  toolbaritem:is([overflowedItem="true"], [cui-areatype="panel"]) > .unified-extensions-item-row-wrapper > & {
    list-style-image: var(--webextension-menupanel-image, inherit);
    /* TODO: This feels a bit odd, why do we have three images? It feels we
     * should probably have only two (light/dark), and choose based on
     * prefers-color-scheme + lwt-popup */
    :root[lwt-popup="dark"] & {
      list-style-image: var(--webextension-menupanel-image-light, inherit);
    }
    :root[lwt-popup="light"] & {
      list-style-image: var(--webextension-menupanel-image-dark, inherit);
    }
  }

  > .toolbarbutton-badge-stack > .toolbarbutton-icon {
    height: 16px;
    width: 16px;
  }
}

.unified-extensions-item-icon,
.unified-extensions-item .webextension-browser-action.subviewbutton > .toolbarbutton-badge-stack > .toolbarbutton-icon {
  height: var(--uei-icon-size);
  width: var(--uei-icon-size);
}

/* The first selector is for the custom elements icon, which appears only in the UEP. */
.unified-extensions-item-icon,
.unified-extensions-item .webextension-browser-action.subviewbutton > .toolbarbutton-badge-stack {
  margin-inline-end: 6px;
}

.unified-extensions-item-icon,
.unified-extensions-item-contents {
  pointer-events: none;
}

.unified-extensions-item-name,
.unified-extensions-item-message {
  margin: 0;
  padding-inline-start: 0.5em;
  word-break: break-word;
}

.unified-extensions-item-message {
  color: var(--text-color-deemphasized);
}

.unified-extensions-item-menu-button.subviewbutton {
  list-style-image: url("chrome://global/skin/icons/settings.svg");
  /* subtract the child's ~1px border from the block padding */
  padding: calc(var(--arrowpanel-menuitem-margin-inline) - 1px) var(--arrowpanel-menuitem-margin-inline);
  padding-inline-end: 0;
  border-radius: 0;
  /* override panelUI-shared.css */
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;

  > .toolbarbutton-icon {
    box-sizing: content-box;
    padding: var(--arrowpanel-menuitem-padding-inline);
    border: 1px solid transparent;
    border-radius: var(--arrowpanel-menuitem-border-radius);
    color: var(--uei-button-color);
    background-color: var(--uei-button-bgcolor);
  }

  /* Background color, outline, and shadow on the icon to allow the clickable
   * padding on the button to remain invisible */
  &:hover > .toolbarbutton-icon {
    color: var(--uei-button-hover-color);
    background-color: var(--uei-button-hover-bgcolor);
  }

  &:hover:active > .toolbarbutton-icon {
    color: var(--uei-button-active-color);
    background-color: var(--uei-button-active-bgcolor);
    box-shadow: 0 1px 0 hsla(210, 4%, 10%, 0.03) inset;
  }

  &:focus-visible > .toolbarbutton-icon {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-inset);
  }
}

/* Hide subview label. */
.unified-extensions-item .toolbarbutton-text {
  display: none !important; /* override panelUI-shared.css */
}

/* --- warning messages --- */

#unified-extensions-messages-container {
  margin: var(--arrowpanel-menuitem-margin);
}

.unified-extensions-message-bar {
  margin-bottom: var(--space-small);
}

/* Hide the menu button and the unified extensions content when the extension
 * item is placed on the toolbar. */
.unified-extensions-item-menu-button.toolbarbutton-1,
.unified-extensions-item-action-button.toolbarbutton-1 > .unified-extensions-item-contents {
  display: none;
}

.unified-extensions-item-messagebar {
  /* Keep the messagebar hidden when the extension item is placed
   * in the toolbar */
  display: none;

  /* Show the messagebar when the item is placed into the panel unless it is
   * explicitly hidden */
  toolbaritem:is([overflowedItem="true"], [cui-areatype="panel"]).unified-extensions-item > unified-extensions-item-messagebar-wrapper > &,
  unified-extensions-item > unified-extensions-item-messagebar-wrapper > & {
    display: block;
    margin-top: var(--space-xsmall);

    &[hidden] {
      display: none;
    }
  }
}

.unified-extensions-item-row-wrapper {
  display: flex;
  flex-direction: row;
  flex: 1;
}

/* Override .toolbaritem-combined-buttons rules applied from panelUI-shared.css
 * to make sure the extensions panel item row (the one including extension icon,
*  name, origin control message and gear menu button) and the messagebar that may
*  follow it (e.g. when the extension is soft-blocked) are going to be rendered
*  as two separate rows */
toolbaritem:is([overflowedItem="true"], [cui-areatype="panel"]).unified-extensions-item,
unified-extensions-item.unified-extensions-item {
  flex-direction: column;
  align-items: normal;
}

/* --- browser action CUI widget styles in the extensions panel --- */

@media (prefers-contrast) {
  :root:not([lwtheme]) {
    --uei-button-attention-dot-color: ButtonText;

    .unified-extensions-item-action-button.subviewbutton:not([disabled]),
    .unified-extensions-item-menu-button.subviewbutton > .toolbarbutton-icon {
      border-color: currentColor;
      background-color: ButtonFace;
      color: ButtonText;
      --uei-button-hover-bgcolor: SelectedItem;
      --uei-button-hover-color: SelectedItemText;
      --uei-button-active-bgcolor: ButtonFace;
      --uei-button-active-color: ButtonText;
    }

    .unified-extensions-item-action-button[disabled].subviewbutton {
      background-color: Canvas;
      color: GrayText !important; /* override panelUI-shared.css */
      opacity: 1 !important; /* override panelUI-shared.css */
    }

    .unified-extensions-item[attention] > .unified-extensions-item-action-button.subviewbutton:hover:not(:active) {
      --uei-button-attention-dot-color: ButtonFace;
    }

    .unified-extensions-item-message {
      color: inherit;
    }

    .unified-extensions-item > .unified-extensions-item-action-button.subviewbutton:hover:not([disabled]),
    .unified-extensions-item > .unified-extensions-item-menu-button.subviewbutton:hover > .toolbarbutton-icon {
      background-color: var(--uei-button-hover-bgcolor);
      color: var(--uei-button-hover-color);
      border-color: var(--uei-button-hover-bgcolor);
    }

    .unified-extensions-item > .unified-extensions-item-action-button.subviewbutton:hover:active:not([disabled]),
    .unified-extensions-item > .unified-extensions-item-menu-button.subviewbutton:hover:active > .toolbarbutton-icon {
      background-color: var(--uei-button-active-bgcolor);
      color: var(--uei-button-active-color);
      border-color: var(--uei-button-active-color);
    }

    .unified-extensions-item > .unified-extensions-item-menu-button.subviewbutton:focus-visible > .toolbarbutton-icon {
      /* The border would otherwise overlap with the focus outline, causing an
       * unsightly anti-aliasing artifact */
      border-color: transparent;
    }
  }
}