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
|
/* 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/. */
menupopup,
panel {
--menu-arrow-opacity: 1;
--menu-arrow-size: 1em;
--menuitem-border-radius: 3px;
--menuitem-margin: 0px;
--menuitem-padding: 0.5em 1em;
--menuitem-max-width: 42em;
--badge-text-color: var(--text-color-deemphasized);
--badge-background-color: transparent;
--badge-border-color: currentColor;
--badge-filled-text-color: light-dark(var(--color-white), var(--color-gray-100));
--badge-filled-background-color: light-dark(var(--color-green-70), var(--color-green-40));
--badge-filled-border-color: light-dark(rgba(251, 251, 254, 0.4), rgba(21, 20, 26, 0.4));
@media (forced-colors) {
--badge-text-color: CanvasText;
--badge-background-color: Canvas;
--badge-filled-border-color: CanvasText;
--badge-filled-text-color: AccentColorText;
--badge-filled-background-color: AccentColor;
}
@media (-moz-platform: linux) {
--menuitem-padding: 0.25em 0.5em;
}
@media (-moz-platform: macos) {
--menuitem-padding: 3px 9px;
@media (-moz-mac-tahoe-theme) {
--menuitem-padding: 4px 11px;
--menuitem-border-radius: 7px;
}
}
@media (-moz-platform: windows) {
--menu-arrow-size: max(1em, 16px);
@media (prefers-color-scheme: light) {
--menu-arrow-opacity: 0.7;
}
}
}
menupopup {
font: menu;
/* Also apply the padding in the inline axis for menus */
--panel-padding: var(--panel-padding-block);
@media (-moz-windows-mica-popups) {
appearance: auto;
-moz-default-appearance: menupopup;
/* The mica backdrop takes care of our shadow, border, and border-radius */
--panel-border-color: transparent;
--panel-shadow-margin: 0px;
--panel-border-radius: 0px;
}
@media (-moz-platform: macos) {
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font: -moz-pull-down-menu;
}
> menu > menupopup {
/* Vertically align nested menupopups: the shadow plus the top padding plus top border */
margin-top: calc(-1 * (var(--panel-shadow-margin) + var(--panel-padding-block) + 1px));
}
}
/* Rules for popups associated with menulists */
menulist > menupopup {
min-width: 0;
font: inherit;
@media (-moz-platform: macos) {
color: FieldText;
&:not([position]) {
margin-inline-start: -13px;
margin-top: -1px;
}
}
> menuitem,
> menucaption,
> menu {
max-width: none;
@media (-moz-platform: windows) {
> label {
padding-block: 0;
}
}
}
@media (-moz-platform: windows) {
> menuitem[_moz-menuactive][disabled="true"] {
color: GrayText;
}
}
}
/* Menu separator */
menuseparator {
/* Using padding instead of margin to increase the hit area, as some
separators (e.g. in bookmarks menus) can be dragged or have a context
menu. */
padding-block: 4px;
@media (-moz-platform: macos) {
padding-block: 5px;
margin-inline: 9px;
}
@media (-moz-platform: windows) {
/* The side padding should align with the start of the menu item text. */
padding-inline: 1em;
}
&::before {
border-top: 1px solid var(--panel-separator-color);
content: "";
display: block;
flex: 1;
}
}
/* Scroll buttons */
/* Hide arrow buttons when there's nothing to scroll in that direction */
.menupopup-arrowscrollbox[scrolledtostart]::part(scrollbutton-up),
.menupopup-arrowscrollbox[scrolledtoend]::part(scrollbutton-down) {
display: none;
}
/* Prevent the scrolled contents of the menupopup from jumping vertically when
* the arrow buttons appear / disappear, by positioning ::part(scrollbox) in
* such a way that its edges are at the same position as the edges of
* arrowscrollbox regardless of scroll button visibility.
*/
.menupopup-arrowscrollbox:not([scrolledtostart])::part(scrollbox) {
/* scrollbutton-up is visible; shift our top edge up by its height. */
margin-top: -16px;
border-top: 16px solid transparent;
}
.menupopup-arrowscrollbox:not([scrolledtoend])::part(scrollbox) {
/* scrollbutton-down is visible; shift our bottom edge down by its height. */
margin-bottom: -16px;
border-bottom: 16px solid transparent;
}
menubar {
font: menu;
}
menubar > menu {
@media (-moz-platform: linux) {
color: inherit;
background-color: transparent;
border-radius: 0;
padding: 0.25em 0.5em;
padding-bottom: 1px;
border-bottom: 3px solid transparent;
&[open] {
border-bottom-color: AccentColor;
}
}
@media (-moz-platform: macos) {
padding-block: 2px;
padding-inline: 7px 5px;
margin: 1px 0;
}
@media (-moz-platform: windows) {
padding: 1px 6px 2px;
&:-moz-window-inactive {
color: ThreeDShadow;
}
&:not([disabled="true"]) {
color: inherit;
}
&[_moz-menuactive]:not([disabled="true"]) {
color: -moz-menubarhovertext;
*|*:root[lwtheme] & {
/* FIXME: This feels out of place, maybe we can just use the lwtheme
* rules everywhere? */
background-color: SelectedItem;
color: SelectedItemText;
text-shadow: none;
}
}
}
> .menu-text {
margin: 0;
}
}
menu,
menuitem,
menucaption {
border-radius: var(--menuitem-border-radius);
padding: var(--menuitem-padding);
margin: var(--menuitem-margin);
align-items: center;
flex-shrink: 0;
list-style-image: none;
max-width: var(--menuitem-max-width);
/* Prevents the icon from being inherited to submenus. */
--menuitem-icon: normal;
}
menu,
menuitem {
&:where([disabled="true"]) {
color: var(--text-color-disabled);
text-shadow: none;
}
&:where([_moz-menuactive]:not([disabled="true"])) {
color: -moz-menuhovertext;
background-color: -moz-menuhover;
}
&:where([_moz-menuactive][disabled="true"]) {
background-color: -moz-menuhoverdisabled;
}
}
menuitem:is([default="true"], .spell-suggestion),
menucaption {
font-weight: var(--font-weight-bold);
}
.menu-icon,
.menu-text,
.menu-highlightable-text,
.menu-accel {
pointer-events: none;
}
/* ..... menu arrow box ..... */
menupopup > menu::after {
content: "";
display: block;
width: var(--menu-arrow-size);
height: var(--menu-arrow-size);
background-image: url("chrome://global/skin/icons/arrow-right.svg");
background-size: var(--menu-arrow-size);
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
fill-opacity: var(--menu-arrow-opacity);
margin-inline: 1em 0;
@media (-moz-platform: linux) {
margin-inline: 0.5em 0;
}
@media (-moz-platform: macos) {
margin-inline: 22px -3px;
}
}
menupopup > menu:-moz-locale-dir(rtl)::after {
background-image: url("chrome://global/skin/icons/arrow-left.svg");
}
.menu-text,
.menu-accel {
margin: 0;
@media (-moz-platform: windows) {
padding: 1px 0;
}
@media (-moz-platform: linux) {
margin-inline: 0 2px;
}
}
/* Accel text */
.menu-accel {
margin-inline: 0.74em 0.35em;
@media (-moz-platform: macos) {
margin-inline: 25px 0;
}
@media (-moz-platform: linux) {
/* Matches the margin-inline-end on iconic-left */
margin-inline: 0.5em 0;
}
@media not (prefers-contrast) {
menuitem:not([disabled]) > & {
color: var(--text-color-disabled);
}
}
:is(menu, menuitem):not([acceltext]) > & {
display: none;
}
}
menuitem:not([highlightable]) > .menu-highlightable-text,
menuitem[highlightable] > .menu-text {
display: none;
}
.menu-highlightable-text,
.menu-text {
flex: 1;
}
.menu-icon {
width: 16px;
height: 16px;
box-sizing: border-box;
/* Empty icons shouldn't take up any space */
display: none;
/* This avoids showing the broken image border for non-iconic items when
* adding a gutter */
visibility: hidden;
@media (-moz-platform: linux) {
/* Matches inline menuitem padding */
margin-inline-end: 0.5em;
}
@media (-moz-platform: windows) {
margin-top: 2px;
margin-inline-end: 8px;
}
@media (-moz-platform: macos) {
margin-block: -2px;
margin-inline-end: 6px;
}
menuitem:where(.menuitem-iconic, [image]) > &,
menu:where(.menu-iconic) > & {
&:where(:not([srcset])) {
content: var(--menuitem-icon);
}
display: revert;
visibility: inherit;
}
}
/* checkbox / radio rendering */
/* On linux, we use regular checkboxes and radio buttons */
@media (-moz-platform: linux) {
menuitem:is([type="checkbox"], [checked="true"]) > .menu-icon {
visibility: inherit;
appearance: auto;
-moz-default-appearance: checkbox;
}
menuitem[type="radio"] > .menu-icon {
visibility: inherit;
appearance: auto;
-moz-default-appearance: radio;
}
}
/* On windows we use a checkmark */
@media (-moz-platform: windows) {
/* We need to do something to override the default style for selected
checkboxes and radio buttons because the native drawing we use on other
Windows versions looks pretty bad with the Win10 styles, so for now we'll
insert a generic checkmark icon for both types. */
menuitem[checked="true"] > .menu-icon {
visibility: inherit;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
fill-opacity: var(--menu-arrow-opacity);
content: url("chrome://global/skin/icons/menu-check.svg");
}
}
menupopup[needsgutter] {
@media (-moz-platform: linux) or (-moz-platform: windows) {
> :is(menu, menuitem) > .menu-icon {
display: revert;
}
}
@media (-moz-platform: macos) {
/* although only menuitems may be checked, apply this to
menus and menucaptions as well to maintain alignment */
> menu,
> menuitem,
> menucaption {
padding-inline-start: 0;
&::before {
content: "\2713"; /* a checkmark */
display: inline-block;
vertical-align: middle;
line-height: 0;
visibility: hidden;
padding-inline: 4px;
font-weight: var(--font-weight-bold);
}
}
> menuitem:is([checked="true"], [selected="true"])::before {
visibility: inherit;
}
}
}
menuitem[badge]::after {
border-radius: var(--border-radius-small);
border: 1px solid var(--badge-border-color);
color: var(--badge-text-color);
background-color: var(--badge-background-color);
content: attr(badge);
margin-inline-start: var(--space-small);
padding: var(--space-xxsmall) var(--space-small);
}
menuitem.badge-new::after {
border-color: var(--badge-filled-border-color);
color: var(--badge-filled-text-color);
background-color: var(--badge-filled-background-color);
}
|