1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 @namespace url
("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
7 /* ::::: menupopup ::::: */
11 /* We can always render in the preferred color scheme (unless otherwise
13 color-scheme: light dark
;
16 --panel-background: Menu
;
17 --panel-color: MenuText
;
18 --panel-padding-block: 4px;
19 --panel-padding: var
(--panel-padding-block
) 0;
20 --panel-border-radius: 4px;
21 --panel-border-color: ThreeDShadow
;
22 --panel-width: initial
;
24 --panel-shadow-margin: 0px;
25 --panel-shadow: 0 0 var
(--panel-shadow-margin
) hsla
(0,0%,0%,.2);
26 -moz-window-input-region-margin: var
(--panel-shadow-margin
);
27 margin: calc
(-1 * var
(--panel-shadow-margin
));
29 /* Panel design token theming */
30 --color-canvas: var
(--panel-background
);
32 @media
(-moz-platform: linux
) {
33 --panel-border-radius: 8px;
34 --panel-padding-block: 3px;
36 @media
(prefers-contrast
) {
37 --panel-border-color: color-mix
(in srgb
, currentColor
60%, transparent
);
41 @media
(-moz-platform: linux
) or
(-moz-platform: windows
) {
42 /* To account for the box-shadow below */
43 --panel-shadow-margin: 4px;
46 @media
(-moz-platform: macos
) {
48 -moz-default-appearance: menupopup
;
49 /* We set the default background here, rather than on ::part(content),
50 * because otherwise it'd interfere with the native look. Non-native-looking
51 * popups should get their background via --panel-background */
52 background-color: Menu
;
53 --panel-background: none
;
54 --panel-border-color: transparent
;
55 /* This should be kept in sync with GetMenuMaskImage() */
56 --panel-border-radius: 6px;
61 box-sizing: border-box
;
63 padding: var
(--panel-padding
);
64 color: var
(--panel-color
);
65 background: var
(--panel-background
);
66 border-radius: var
(--panel-border-radius
);
67 border: 1px solid var
(--panel-border-color
);
68 width: var
(--panel-width
);
69 box-shadow: var
(--panel-shadow
);
70 margin: var
(--panel-shadow-margin
);
75 /* Makes popup constraints work. Round up to avoid subpixel rounding
76 * causing overflow, see bug 1846050 */
77 max-height: round
(up
, 100% - 2 * var
(--panel-shadow-margin
), 1px);
78 max-width: round
(up
, 100% - 2 * var
(--panel-shadow-margin
), 1px);
80 overflow: clip
; /* Don't let panel content overflow the border */
83 &[orient
=vertical
]::part
(content
) {
84 flex-direction: column
;
89 /* Also apply the padding in the inline axis for menus */
90 --panel-padding: var
(--panel-padding-block
);
92 @media
(-moz-platform: windows
) {
96 padding-inline-start: 1em;
101 /* Vertically align nested menupopups: the shadow plus the top padding plus top border */
102 margin-top: calc
(-1 * (var
(--panel-shadow-margin
) + var
(--panel-padding-block
) + 1px));
106 /* Rules for popups associated with menulists */
107 menulist
> menupopup
{
110 @media
(-moz-platform: windows
) {
114 @media
(-moz-platform: macos
) {
116 margin-inline-start: -13px;
122 /* ::::: arrow panel ::::: */
124 panel:where
([type
="arrow"]) {
126 background-color: transparent
;
128 &.panel-no-padding::part
(content
) {
133 /* ::::: panel animations ::::: */
135 .animatable-menupopup
,
136 panel
[type
="arrow"] {
137 transition-timing-function: var
(--animation-easing-function
), ease-out
;
139 @media
(-moz-panel-animations
) and
(prefers-reduced-motion: no-preference
) {
140 &:not
([animate
="false"]) {
141 transition-duration: 0.18s;
145 @media not
(-moz-platform: macos
) {
146 transition-property: transform
, opacity
;
147 will-change: transform
, opacity
;
149 transform: translateY
(-70px);
152 transform: translateY
(70px);
156 /* On Mac, use the properties "-moz-window-transform" and "-moz-window-opacity"
157 * instead of "transform" and "opacity" for these animations.
158 * The -moz-window* properties apply to the whole window including the
159 * window's shadow, and they don't affect the window's "shape", so the
160 * system doesn't have to recompute the shadow shape during the animation.
161 * This makes them a lot faster. These properties are not implemented on
164 @media
(-moz-platform: macos
) {
165 transition-property: -moz-window-transform
, -moz-window-opacity
;
166 /* Only do the fade-in animation on pre-Big Sur to avoid missing shadows on
167 * Big Sur, see bug 1672091. */
168 @media not
(-moz-mac-big-sur-theme
) {
169 -moz-window-opacity: 0;
170 -moz-window-transform: translateY
(-70px);
173 -moz-window-transform: translateY
(70px);
176 /* If the @media rule above is removed, then we can also remove this */
177 &[animate
="cancel"] {
178 -moz-window-opacity: 0;
182 &[animate
="cancel"] {
183 -moz-window-transform: none
;
187 &:is
([animate
="false"], [animate
="open"]) {
190 -moz-window-opacity: 1;
191 -moz-window-transform: none
;
192 transition-timing-function: var
(--animation-easing-function
), ease-in-out
;
196 pointer-events: none
;