File: toolbarbuttons.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 (668 lines) | stat: -rw-r--r-- 19,403 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
/* 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/. */

@namespace html url("http://www.w3.org/1999/xhtml");

:root {
  --toolbar-start-end-padding: 8px;
  --toolbarbutton-outer-padding: 2px;
  --toolbarbutton-inner-padding: 8px;

  --toolbarbutton-hover-background: color-mix(in srgb, currentColor 17%, transparent);
  --toolbarbutton-active-background: color-mix(in srgb, currentColor 30%, transparent);
  --toolbarbutton-outline-color: transparent;
  --toolbarbutton-hover-outline-color: transparent;
  --toolbarbutton-active-outline-color: transparent;
  --toolbarbutton-selected-outline-color: var(--toolbarbutton-active-outline-color);
  --toolbarbutton-outline: 1px solid var(--toolbarbutton-outline-color);
  --toolbarbutton-outline-offset: -1px;

  @media (prefers-contrast) {
    --toolbarbutton-hover-outline-color: currentColor;
    --toolbarbutton-active-outline-color: currentColor;
  }

  @media (forced-colors) {
    --toolbarbutton-outline-color: ButtonText;
    --toolbarbutton-hover-outline-color: SelectedItem;
    --toolbarbutton-active-outline-color: ButtonText;
    --toolbarbutton-selected-outline-color: SelectedItem;

    &[lwtheme] {
      --toolbarbutton-outline-color: currentColor;
    }
  }

  --toolbarseparator-color: color-mix(in srgb, currentColor 60%, transparent);

  --bookmark-block-padding: 4px;

  &[uidensity="compact"] {
    --toolbarbutton-outer-padding: 3px;
    --toolbarbutton-inner-padding: 6px;
    --bookmark-block-padding: 1px;
  }

  &[uidensity="touch"] {
    --toolbarbutton-inner-padding: 9px;
    --bookmark-block-padding: 7px;
  }
}

#TabsToolbar {
  /* Override the inner padding to ensure the dimensions match the tabs, but also making sure
     different types of buttons (combined-buttons-dropmarker or text) still look correct. */
  --toolbarbutton-inner-padding: calc((var(--tab-min-height) - 16px) / 2);
}

/* Primary toolbar buttons */

.toolbarbutton-1 {
  :root:not([customizing]) &[disabled] {
    opacity: var(--toolbarbutton-disabled-opacity);
  }

  /* Special-case the overflow and the hamburger button so they show up disabled
     in customize mode. */
  &:is(#nav-bar-overflow-button, #PanelUI-menu-button)[disabled] {
    fill-opacity: var(--toolbarbutton-disabled-opacity);
  }

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

/* Taskbar Tab windows will hide all toolbar buttons that are not on the following list */

:root[taskbartab] {
  .chromeclass-toolbar-additional {
    display: none;
  }
  #back-button,
  #forward-button,
  #stop-reload-button,
  #customizableui-special-spring1,
  #vertical-spacer,
  #customizableui-special-spring2,
  #downloads-button,
  #unified-extensions-button,
  #save-page-button,
  #print-button,
  #find-button,
  #zoom-controls,
  #edit-controls,
  #characterencoding-button,
  #email-link-button,
  #screenshot-button,
  #fullscreen-button {
    display: revert;
  }
}

toolbar .toolbarbutton-1 {
  appearance: none;
  margin: 0;
  padding: 0 var(--toolbarbutton-outer-padding);
  justify-content: center;

  > .toolbarbutton-icon,
  > .toolbarbutton-text,
  > .toolbarbutton-badge-stack {
    padding: var(--toolbarbutton-inner-padding);
    border-radius: var(--toolbarbutton-border-radius);
    outline: var(--toolbarbutton-outline);
    outline-offset: var(--toolbarbutton-outline-offset);
  }

  &:focus-visible {
    outline: none;

    > .toolbarbutton-icon,
    > .toolbarbutton-text,
    > .toolbarbutton-badge-stack {
      outline: var(--focus-outline);
      outline-offset: var(--focus-outline-inset);
    }
  }

  > .toolbarbutton-icon {
    /* horizontal padding + actual icon width */
    width: calc(2 * var(--toolbarbutton-inner-padding) + 16px);
    height: calc(2 * var(--toolbarbutton-inner-padding) + 16px);
  }

  > .toolbarbutton-text {
    padding-top: calc(var(--toolbarbutton-inner-padding) - 1px);
    padding-bottom: 0;
    /* To make the hover feedback line up with sibling buttons, it needs the same
     * height as the button icons and the same vertical padding, but as a minimum,
     * because otherwise an increase in text sizes would break things.
     */
    min-height: calc(16px + 2 * var(--toolbarbutton-inner-padding));

    @media (-moz-platform: macos) {
      padding-top: calc(var(--toolbarbutton-inner-padding) + 1px);
    }
  }

  &:not([disabled]) {
    &:hover > :is(.toolbarbutton-icon, .toolbarbutton-text, .toolbarbutton-badge-stack) {
      background-color: var(--toolbarbutton-hover-background);
      color: inherit;
    }

    &:is(:hover:active, [open], [checked]) > :is(.toolbarbutton-icon, .toolbarbutton-text, .toolbarbutton-badge-stack) {
      background-color: var(--toolbarbutton-active-background);
      color: inherit;
    }

    &:not(:focus-visible) {
      &:hover > :is(.toolbarbutton-icon, .toolbarbutton-text, .toolbarbutton-badge-stack) {
        outline-color: var(--toolbarbutton-hover-outline-color);
      }

      &:hover:active > :is(.toolbarbutton-icon, .toolbarbutton-text, .toolbarbutton-badge-stack) {
        outline-color: var(--toolbarbutton-active-outline-color);
      }

      &:is([open], [checked]) > :is(.toolbarbutton-icon, .toolbarbutton-text, .toolbarbutton-badge-stack) {
        outline-color: var(--toolbarbutton-selected-outline-color);
      }
    }
  }

  &.avatar-button-background > .toolbarbutton-badge-stack {
    border: 1px solid var(--border-color-card);
  }
}

#TabsToolbar .toolbarbutton-1 {
  margin: 0;

  > .toolbarbutton-icon,
  > .toolbarbutton-text,
  > .toolbarbutton-badge-stack {
    border-radius: var(--tab-border-radius);
  }
}

#PanelUI-menu-button {
  /* Adds padding to end of toolbar while making that space click the first button */
  padding-inline-end: var(--toolbar-start-end-padding);
}

toolbar .toolbaritem-combined-buttons {
  margin-inline: 2px;

  > .toolbarbutton-1 {
    padding-inline: 0;
  }

  > .toolbarbutton-combined-buttons-dropmarker > .toolbarbutton-icon {
    /* same height as regular buttons, but narrower, and for a 12x12 image */
    padding-inline: 2px;
    padding-block: calc(var(--toolbarbutton-inner-padding) + (16px - 12px) / 2);
    width: calc(2 * 2px + 12px);
  }
}

.toolbaritem-combined-buttons {
  > separator {
    width: 0;
    height: 16px;
    pointer-events: none;

    /* place the border on a pseudo-element so that
       the separator doesn't take up any space */
    &::before {
      content: "";
      border-inline-start: 1px solid currentColor;
    }
  }

  > separator:has(+ toolbarbutton:not([disabled]):hover),
  > toolbarbutton:not([disabled]):hover + separator {
    opacity: 0;
  }
}

toolbar .toolbaritem-combined-buttons > separator {
  color: light-dark(color-mix(in srgb, currentColor 20%, transparent), color-mix(in srgb, currentColor 30%, transparent));
}

/* Toolbar button animations */

.toolbarbutton-animatable-box {
  display: block;
  position: absolute;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;

  > .toolbarbutton-animatable-image {
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
    list-style-image: none;
  }
}

/* Navigation toolbar overflow button with animation */

#nav-bar-overflow-button {
  list-style-image: url("chrome://global/skin/icons/chevron.svg");

  #nav-bar:not([overflowing], [nonemptyoverflow], [customizing]) > & {
    display: none;
  }

  /* The button should look both disabled and open in customize mode. */
  #nav-bar[customizing] > & > .toolbarbutton-icon {
    background-color: var(--toolbarbutton-active-background);
  }

  > .toolbarbutton-animatable-box {
    visibility: hidden;
    top: calc(50% - 8px); /* Vertically center the 16px tall animatable image */
    width: 16px; /* Width of each frame within the SVG sprite */
    height: 16px; /* Height of each frame within the SVG sprite */
    -moz-context-properties: fill, stroke;
    fill: var(--toolbarbutton-icon-fill);
    stroke: var(--toolbarbutton-icon-fill-attention);

    > .toolbarbutton-animatable-image {
      background-image: url("chrome://browser/skin/chevron-animation.svg");
      width: 848px;
      height: 16px;
      transform: translateX(0);
    }
  }

  &[animate] {
    > .toolbarbutton-icon {
      fill: transparent;
    }

    > .toolbarbutton-animatable-box {
      visibility: visible;

      > .toolbarbutton-animatable-image {
        animation-name: overflow-animation;
        animation-timing-function: steps(52);
        animation-duration: calc(52 * 16.667ms);
      }
    }
  }
}

@keyframes overflow-animation {
  from {
    transform: translateX(0);
  }
  /* Bug 1831300 is on file for this. */
  /* stylelint-disable-next-line keyframe-block-no-duplicate-selectors */
  from {
    transform: translateX(-832px);
  }
}

/* Combined Stop and Reload button with animation */

#reload-button:not([displaystop]) + #stop-button,
#reload-button[displaystop] {
  display: none;
}

/* The reload-button is only disabled temporarily when it becomes visible
   to prevent users from accidentally clicking it. We don't however need
   to show this disabled state, as the flicker that it generates is short
   enough to be visible but not long enough to explain anything to users. */
#reload-button[disabled]:not(:-moz-window-inactive) > .toolbarbutton-icon {
  opacity: 1 !important;
}

@keyframes stop-to-reload {
  /* pause on the first frame (step 0) for 6 frames of time */
  from {
    /* 0 */
    transform: translateX(0);
  }
  /* resume at 7/35 and animate across the next 14 frames */
  17.14% {
    animation-timing-function: steps(14);
    transform: translateX(calc(0 * -20px));
  }
  /* pause on the last frame for the remainder of the duration */
  54.29% {
    transform: translateX(calc(14 * -20px));
  }
  to {
    /* end state for animation: */
    transform: translateX(calc(var(--anim-frames) * -20px));
  }
}

@keyframes reload-to-stop {
  /* pause on the first frame (step 0) for 6 frames of time */
  from {
    /* 0 */
    transform: translateX(0);
    animation-timing-function: steps(12);
  }
  /* pause at 13/15 for 3 frames */
  86.67% {
    transform: translateX(calc(var(--anim-frames) * -20px));
  }
  to {
    /* end state for animation: */
    transform: translateX(calc(var(--anim-frames) * -20px));
  }
}

:is(#reload-button, #stop-button) > .toolbarbutton-animatable-box {
  top: calc(50% - 10px); /* Vertically center the 20px tall animatable image */
  width: 20px; /* Width of each frame within the SVG sprite */
  height: 20px; /* Height of each frame within the SVG sprite */

  /* The animations for the reload-button and stop-button are disabled
     outside of the nav-bar due to bug 1382894. */
  :not(#nav-bar-customization-target) > #stop-reload-button > & {
    display: none;
  }
}

#stop-reload-button[animate] {
  > #reload-button > .toolbarbutton-icon,
  > #reload-button[displaystop] + #stop-button > .toolbarbutton-icon {
    fill: transparent;
  }

  > #reload-button,
  > #stop-button {
    position: relative;
  }

  > #reload-button > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
    background-image: url("chrome://browser/skin/stop-to-reload.svg");
    /* transition from stop icon to reload icon
       pause at frame 0 for 6 ticks,
       pause at frame 15 for 16 ticks
       total 35 steps */
    --anim-frames: 14;
    --anim-steps: calc(var(--anim-frames) + 21); /* Add steps for doing the pause at the start and end */
    width: calc(20px * (var(--anim-frames) + 1));
    height: 20px;

    /* initial state for animation */
    transform: translateX(0);
  }

  > #reload-button:not([displaystop]) > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
    animation-name: stop-to-reload;
  }

  > #reload-button[displaystop] + #stop-button > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
    background-image: url("chrome://browser/skin/reload-to-stop.svg");
    /* transition from reload icon to stop icon
       pause at end for 3 frames of time
       pause at ...
       total 15 steps */
    --anim-frames: 12;
    --anim-steps: calc(var(--anim-frames) + 3); /* Add steps for doing the pause at the start and end */
    width: calc(20px * (var(--anim-frames) + 1));
    height: 20px;

    /* initial state for animation */
    transform: translateX(0);

    animation-name: reload-to-stop;
    animation-duration: calc(var(--anim-steps) * 16.667ms);
  }
}

#reload-button:not([displaystop]) > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
  animation-duration: calc(var(--anim-steps) * 16.667ms);
}

#reload-button > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
  transform: translateX(-700px);
}

#reload-button[displaystop] + #stop-button > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
  animation-timing-function: steps(15);
  animation-duration: 0.25s;
  transform: translateX(-300px);
}

/* Bookmark buttons */

#personal-toolbar-empty-description,
toolbarbutton.bookmark-item:not(.subviewbutton) {
  margin: 2px;
  padding: var(--bookmark-block-padding) 4px;
}

#PersonalToolbar {
  /* These should match the sizing of the bookmark-items in the inline axis
   * (padding and margin, respectively) */
  --toolbarbutton-inner-padding: 4px;
  --toolbarbutton-outer-padding: 2px;

  :root[uidensity="compact"] & {
    --toolbarbutton-outer-padding: 1px;
  }

  .toolbarbutton-1 {
    margin-block: 2px;

    /* Allow icons to grow with the toolbar to match bookmark item heights
     *
     * NOTE(emilio): This matches pre-existing behavior but it's inconsistent with
     * how e.g. combined items work, and maybe we should just remove this.
     */
    align-items: stretch;
    > .toolbarbutton-icon {
      height: auto;
    }
    > .toolbarbutton-badge-stack {
      align-items: center;
    }
  }
}

toolbarbutton.bookmark-item:not(.subviewbutton) {
  border-radius: var(--toolbarbutton-border-radius);
  max-width: 13em;
  appearance: none;
  outline: var(--toolbarbutton-outline);
  outline-offset: var(--toolbarbutton-outline-offset);

  &:not([disabled], [open]):hover {
    background-color: var(--toolbarbutton-hover-background);
    color: inherit;
    outline-color: var(--toolbarbutton-hover-outline-color);
  }

  &:hover:active:not([disabled]),
  &[open="true"] {
    background-color: var(--toolbarbutton-active-background);
    color: inherit;
    outline-color: var(--toolbarbutton-active-outline-color);
  }

  &:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-inset);
  }

  :root[uidensity="compact"] & {
    margin-inline: 1px;
  }
}

.bookmark-item > .toolbarbutton-icon {
  width: 16px;
  height: 16px;

  #PlacesToolbarItems > & {
    margin-inline-end: 0;
  }
}

/* This rule applies to bookmark menu items too */
.bookmark-item > label {
  /* Ensure we use the direction of the bookmarks label instead of the
     browser locale. */
  unicode-bidi: plaintext;
  /* Preserve whitespace in bookmark names. */
  white-space: pre;
}

#personal-toolbar-empty-description {
  -moz-window-dragging: no-drag;

  /* Ensure that the description is always at least as big as a bookmarks item,
   * where its icon is 16px (which may be more than inline text height); */
  min-height: calc(16px + 2 * var(--bookmark-block-padding));
}

#bookmarks-toolbar-placeholder {
  max-width: unset;
}

#bookmarks-toolbar-placeholder,
#bookmarks-toolbar-button {
  display: none;
}

toolbarpaletteitem[place="toolbar"] > #personal-bookmarks > #bookmarks-toolbar-placeholder,
toolbarpaletteitem[place="palette"] > #personal-bookmarks > #bookmarks-toolbar-button,
#personal-bookmarks:is([overflowedItem="true"], [cui-areatype="panel"]) > #bookmarks-toolbar-button {
  display: flex;
}

#nav-bar-customization-target > #personal-bookmarks,
toolbar:not(#TabsToolbar) > #wrapper-personal-bookmarks,
toolbar:not(#TabsToolbar) > #personal-bookmarks {
  flex: 1 auto;
}

/* Force the display of the label for bookmarks */
.bookmark-item > .toolbarbutton-text {
  display: flex !important;
}

#PlacesToolbar,
#PlacesToolbarItems {
  min-width: 0;
}

#personal-bookmarks {
  /* Make sure there's at least space for the chevron */
  min-width: calc(16px + 2 * var(--toolbarbutton-inner-padding) + 2 * var(--toolbarbutton-outer-padding));
}

#managed-bookmarks > .toolbarbutton-icon,
#bookmarks-toolbar-placeholder > .toolbarbutton-icon,
#PlacesToolbarItems > .bookmark-item > .toolbarbutton-icon[label]:not([label=""]),
#PersonalToolbar #import-button > .toolbarbutton-icon,
#PersonalToolbar #aboutwelcome-button > .toolbarbutton-icon,
#PersonalToolbar #fxms-bmb-button > .toolbarbutton-icon,
#OtherBookmarks.bookmark-item[container] > .toolbarbutton-icon {
  margin-inline-end: 4px;
}

/* Separators */

/* Override the toolkit styles, and make sure separators are draggable by
 * making them wider, and using a pseudo-element for the visual separator.
 * TODO(bug 1971526): consider actually pushing this down to toolkit */
#PlacesToolbarItems > toolbarseparator {
  margin: 0;
  padding-inline: 4px;

  /* When adjacent to the bookmarks items, give the bookmarks items a leading separator. */
  &::before {
    content: "";
    display: block;
    border-inline-start: 1px solid;
    border-image-source: linear-gradient(
      transparent 3.75px,
      var(--toolbarseparator-color) 3.75px,
      var(--toolbarseparator-color) calc(100% - 3.75px),
      transparent calc(100% - 3.75px)
    );
    border-image-slice: 1;
  }

  @media (resolution >= 2x) {
    &::before {
      border-inline-start-width: 0.5px;
    }
  }
}

/* Toolbarbutton badge */

.toolbarbutton-badge {
  /* The bookmarks toolbar is smaller than the other toolbars, so we
   * need to override the badge position to not be cut off. */
  #PersonalToolbar & {
    margin-top: -1px !important;

    :root[uidensity="touch"] & {
      margin-top: -4px !important;
    }
  }

  /* Remove a pixel of margin on the end so that the badge doesn't
   * overflow the toolbar and push the button into the overflow menu. */
  :root[uidensity="compact"] & {
    margin-inline-end: -7px !important;
  }

  /* Alternative style for .toolbarbutton-badge used by CFR notifications */
  &.feature-callout {
    width: 14px;
    height: 14px;
    min-width: auto;
    box-shadow: none;
    border: none;
    padding: 0;
    display: block;
    margin: -7px 0 0 !important;
    margin-inline-end: -6px !important;
    background: url(chrome://global/skin/icons/badge-blue.svg);
  }
}

/* Flexible spacer sizing */

toolbarpaletteitem[place="toolbar"][id^="wrapper-customizableui-special-spring"],
toolbarspring {
  flex: 1;
  min-width: 28px;
  max-width: 112px;

  #nav-bar &:not(#vertical-spacer) {
    flex: 80 80;
    /* Ensure flexible spacers don't shrink to nothing so they can be
     * manipulated in customize mode. */
    min-width: 10px;
  }
}

#nav-bar:not([customizing]) toolbarspring:not(#vertical-spacer) {
  /* Allow flexible spacers to shrink further outside of customize mode. */
  min-width: 1px;
}

/* Keyboard navigation */

toolbar[keyNav]:not([collapsed="true"], [customizing]) toolbartabstop,
#tabbrowser-tabs[orient="vertical"] #tabs-newtab-button,
#vertical-tabs-newtab-button {
  -moz-user-focus: normal;
}