File: popup.css

package info (click to toggle)
firefox 147.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,683,484 kB
  • sloc: cpp: 7,607,246; javascript: 6,533,185; ansic: 3,775,227; python: 1,415,393; xml: 634,561; asm: 438,951; java: 186,241; sh: 62,752; makefile: 18,079; objc: 13,092; perl: 12,808; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10; exp: 6
file content (179 lines) | stat: -rw-r--r-- 5,389 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
/* 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 url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* ::::: menupopup ::::: */

menupopup,
panel {
  /* We can always render in the preferred color scheme (unless otherwise
   * overridden). */
  color-scheme: light dark;

  min-width: 1px;
  --panel-background: Menu;
  --panel-color: MenuText;
  --panel-padding: var(--panel-padding-block) 0;
  /* This should match GetMenuCornerRadius() on macOS, or be overridden below */
  --panel-border-radius: 6px;
  --panel-padding-block: 4px;
  --panel-border-color: ThreeDShadow;
  --panel-width: initial;

  --panel-shadow-margin: 4px;
  --panel-shadow: 0 0 var(--panel-shadow-margin) hsla(0, 0%, 0%, 0.2);
  -moz-window-input-region-margin: var(--panel-shadow-margin);
  margin: calc(-1 * var(--panel-shadow-margin));

  /* Panel design token theming */
  --background-color-canvas: var(--panel-background);

  @media (-moz-platform: linux) {
    @media (prefers-contrast) {
      --panel-border-color: color-mix(in srgb, currentColor 60%, transparent);
    }

    /* On some linux WMs we need to draw square and opaque menus because alpha
     * is not available */
    @media not (-moz-gtk-csd-transparency-available) {
      opacity: 1 !important;
      --panel-shadow-margin: 0px !important;
      --panel-border-radius: 0px !important;
    }
  }

  @media (-moz-platform: macos) {
    appearance: auto;
    -moz-default-appearance: menupopup;
    /* We set the default background here, rather than on ::part(content),
     * because otherwise it'd interfere with the native look. Non-native-looking
     * popups should get their background via --panel-background */
    background-color: Menu;
    --panel-background: none;
    --panel-border-color: transparent;
    /* -moz-window-shadow does the trick on macOS */
    --panel-shadow-margin: 0px;

    @media (-moz-mac-tahoe-theme) {
      /* GetMenuCornerRadius() returns a larger value on Tahoe */
      --panel-border-radius: 12px;
    }
  }

  &::part(content) {
    display: flex;
    box-sizing: border-box;

    padding: var(--panel-padding);
    color: var(--panel-color);
    background: var(--panel-background);
    border-radius: var(--panel-border-radius);
    border: 1px solid var(--panel-border-color);
    width: var(--panel-width);
    box-shadow: var(--panel-shadow);
    margin: var(--panel-shadow-margin);

    min-width: 0;
    min-height: 0;

    /* Makes popup constraints work. Round up to avoid subpixel rounding
     * causing overflow, see bug 1846050 */
    max-height: round(up, 100% - 2 * var(--panel-shadow-margin), 1px);
    max-width: round(up, 100% - 2 * var(--panel-shadow-margin), 1px);

    overflow: clip; /* Don't let panel content overflow the border */
  }

  &[orient="vertical"]::part(content) {
    flex-direction: column;
  }
}

/* ::::: arrow panel ::::: */

panel:where([type="arrow"]) {
  appearance: none;
  background-color: transparent;

  &.panel-no-padding::part(content) {
    padding: 0;
  }
}

/* ::::: panel animations ::::: */

.animatable-menupopup,
panel[type="arrow"] {
  transition-timing-function: var(--animation-easing-function), ease-out;

  &:not([animate="false"]) {
    transition-duration: 0.18s;
  }

  @media not (-moz-platform: macos) {
    transition-property: transform, opacity;
    will-change: transform, opacity;
    opacity: 0;
    @media not (prefers-reduced-motion) {
      transform: translateY(-70px);

      &:where([side="bottom"]) {
        transform: translateY(70px);
      }
      /* On some platforms we can't animate the panel position easily, see
       * bug 1385079, bug 1800368, bug 1800442 */
      @media not (-moz-panel-animations) {
        transform: none;
      }
    }
  }

  /* On Mac, use the properties "-moz-window-transform" and "-moz-window-opacity"
   * instead of "transform" and "opacity" for these animations.
   * The -moz-window* properties apply to the whole window including the
   * window's shadow, and they don't affect the window's "shape", so the
   * system doesn't have to recompute the shadow shape during the animation.
   * This makes them a lot faster. These properties are not implemented on
   * other platforms.
   */
  @media (-moz-platform: macos) {
    transition-property:
      -moz-window-transform,
      -moz-window-opacity;
    @media not (prefers-reduced-motion) {
      -moz-window-transform: translateY(-70px);

      &:where([side="bottom"]) {
        -moz-window-transform: translateY(70px);
      }
    }
    /* Only do the fade-in animation on pre-Big Sur to avoid missing shadows on
     * Big Sur+, see bug 1672091. */
    @media not (-moz-mac-big-sur-theme) {
      -moz-window-opacity: 0;
    }
    /* If the @media rule above is removed, then we can also remove this */
    &[animate="cancel"] {
      -moz-window-opacity: 0;
    }
  }

  &[animate="cancel"] {
    -moz-window-transform: none;
    transform: none;
  }

  &:is([animate="false"], [animate="open"]) {
    opacity: 1;
    transform: none;
    -moz-window-opacity: 1;
    -moz-window-transform: none;
    transition-timing-function: var(--animation-easing-function), ease-in-out;
  }

  &[animating] {
    pointer-events: none;
  }
}