Backed out changeset 5a2ea27885f0 (bug 1850738) for causing build bustages on gfxUser...
[gecko.git] / toolkit / content / xul.css
blob7a5af54b4e3a2e09f2c2c65cde5bd9c0737ae77a
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 /**
6 * Rules for everything related to XUL except scrollbars can be found in this
7 * file.
9 * This file should also not contain any app specific styling. Defaults for
10 * widgets of a particular application should be in that application's style
11 * sheet. For example, style definitions for browser can be found in
12 * browser.css.
15 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
16 @namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
18 * {
19 -moz-user-focus: ignore;
20 display: flex;
21 box-sizing: border-box;
24 /* hide the content and destroy the frame */
25 [hidden="true"] {
26 display: none;
29 /* hide the content, but don't destroy the frames */
30 [collapsed="true"] {
31 visibility: collapse;
34 /* TODO: investigate unifying these two root selectors
35 * https://bugzilla.mozilla.org/show_bug.cgi?id=1592344
37 *|*:root {
38 --animation-easing-function: cubic-bezier(.07, .95, 0, 1);
39 flex: 1;
40 -moz-box-collapse: legacy;
43 :root {
44 text-rendering: optimizeLegibility;
45 -moz-control-character-visibility: visible;
46 width: 100%;
47 height: 100%;
48 user-select: none;
51 :root:-moz-locale-dir(rtl) {
52 direction: rtl;
55 /* XUL doesn't show outlines by default */
56 :focus-visible {
57 outline: initial;
61 * Native anonymous popups and tooltips in html are document-level, which means
62 * that they don't inherit from the root, so this is needed.
64 popupgroup:-moz-native-anonymous:-moz-locale-dir(rtl),
65 tooltip:-moz-native-anonymous:-moz-locale-dir(rtl) {
66 direction: rtl;
69 /* ::::::::::
70 :: Rules for 'hiding' portions of the chrome for special
71 :: kinds of windows (not JUST browser windows) with toolbars
72 ::::: */
74 *|*:root[chromehidden~="menubar"] .chromeclass-menubar,
75 *|*:root[chromehidden~="directories"] .chromeclass-directories,
76 *|*:root[chromehidden~="status"] .chromeclass-status,
77 *|*:root[chromehidden~="extrachrome"] .chromeclass-extrachrome,
78 *|*:root[chromehidden~="location"] .chromeclass-location,
79 *|*:root[chromehidden~="location"][chromehidden~="toolbar"] .chromeclass-toolbar,
80 *|*:root[chromehidden~="toolbar"] .chromeclass-toolbar-additional {
81 display: none;
84 /* ::::::::::
85 :: Rules for forcing direction for entry and display of URIs
86 :: or URI elements
87 ::::: */
89 .uri-element {
90 direction: ltr !important;
93 /****** elements that have no visual representation ******/
95 script, data, commandset, command,
96 broadcasterset, broadcaster, observes,
97 keyset, key, toolbarpalette, template,
98 treeitem, treeseparator, treerow, treecell {
99 display: none;
102 /********** focus rules **********/
104 button,
105 checkbox,
106 menulist,
107 radiogroup,
108 richlistbox,
109 tree,
110 browser,
111 editor,
112 iframe,
113 label:is(.text-link, [onclick]),
114 tab[selected="true"]:not([ignorefocus="true"]) {
115 -moz-user-focus: normal;
118 /* Avoid losing focus on tabs by keeping them focusable, since some browser
119 * tests rely on this.
121 * TODO(emilio): Remove this and fix the tests / front-end code:
122 * * browser/base/content/test/general/browser_tabfocus.js
124 tab:focus {
125 -moz-user-focus: normal;
128 /******** window & page ******/
130 window {
131 overflow: clip;
132 flex-direction: column;
135 /******** box *******/
137 vbox {
138 flex-direction: column;
141 /********** label **********/
143 label {
144 display: inline-block;
147 description {
148 display: flow-root;
151 label html|span.accesskey {
152 text-decoration: underline;
153 text-decoration-skip-ink: none;
156 description:where([value]) {
157 /* Preserves legacy behavior, maybe could be removed */
158 display: flex;
161 label:where([value]) {
162 /* Preserves legacy behavior, maybe could be removed */
163 display: inline-flex;
166 :is(label, description)[value] {
167 white-space: nowrap;
170 :is(label, description)[value]::before {
171 /* This displays the value attribute, along with the underlined
172 * accesskey if needed */
173 content: -moz-label-content;
174 display: block;
177 label[value=""]::before {
178 content: "\200b" !important; /* zwsp */
181 :is(label, description)[value][crop] {
182 min-width: 0;
185 :is(label, description)[value][crop]::before {
186 min-width: 0;
187 max-width: 100%;
188 /* This implements crop=end */
189 overflow: hidden;
190 text-overflow: ellipsis;
193 /* Invert the direction to clip at the start rather than end */
194 :is(label, description)[value][crop="start"]::before {
195 direction: rtl;
196 /* Mark text as ltr to preserve punctuation/numeric order */
197 content: "\200e" -moz-label-content;
200 :is(label, description)[value][crop="start"]:-moz-locale-dir(rtl)::before {
201 direction: ltr;
202 /* Mark text as rtl to preserve punctuation/numeric order */
203 content: "\200f" -moz-label-content;
206 .checkbox-label-box,
207 .radio-label-box {
208 min-width: 0;
211 /********** toolbarbutton **********/
213 toolbarbutton {
214 align-items: center;
215 justify-content: center;
218 toolbarbutton.tabbable {
219 -moz-user-focus: normal !important;
222 toolbarbutton[crop] {
223 min-width: 0;
226 .toolbarbutton-text {
227 display: block;
228 text-align: center;
231 toolbar[mode="icons"] .toolbarbutton-text,
232 toolbar[mode="text"] .toolbarbutton-icon,
233 html|label.toolbarbutton-badge:empty {
234 display: none;
237 .toolbarbutton-icon,
238 .toolbarbutton-text,
239 .toolbarbutton-badge-stack,
240 .toolbarbutton-menu-dropmarker,
241 .treecol-text,
242 .treecol-sortdirection,
243 .menubar-left,
244 .menubar-text,
245 .menu-text,
246 .menu-iconic-text,
247 .menu-iconic-highlightable-text,
248 .menu-iconic-left,
249 .menu-right,
250 .menu-accel-container,
251 .button-box {
252 /* Preserves legacy behavior */
253 pointer-events: none;
256 /********** button **********/
258 button {
259 -moz-default-appearance: button;
260 appearance: auto;
263 /******** browser, editor, iframe ********/
265 browser,
266 editor,
267 iframe {
268 display: inline;
271 /* Allow the browser to shrink below its intrinsic size, to match legacy
272 * behavior */
273 browser {
274 align-self: stretch;
275 justify-self: stretch;
276 min-height: 0;
277 min-width: 0;
278 contain: size;
281 /*********** popup notification ************/
282 popupnotification {
283 flex-direction: column;
286 .popup-notification-menubutton:not([label]) {
287 display: none;
290 /********** radio **********/
292 radiogroup {
293 flex-direction: column;
296 /******** groupbox *********/
298 groupbox {
299 flex-direction: column;
302 /******** draggable elements *********/
304 toolbar:not([nowindowdrag="true"], [customizing="true"]) {
305 -moz-window-dragging: drag;
308 /* The list below is non-comprehensive and will probably need some tweaking. */
309 toolbaritem,
310 toolbarbutton,
311 toolbarseparator,
312 button,
313 search-textbox,
314 html|input,
315 tab,
316 radio,
317 splitter,
318 menu,
319 menulist {
320 -moz-window-dragging: no-drag;
323 titlebar {
324 pointer-events: auto !important;
327 /******* toolbar *******/
329 toolbox {
330 flex-direction: column;
333 @media (-moz-platform: macos) {
334 toolbar[type="menubar"] {
335 min-height: 0 !important;
336 border: 0 !important;
340 toolbarspring {
341 flex: 1000 1000;
344 /********* menu ***********/
346 menubar > menu:empty {
347 visibility: collapse;
350 .menu-text {
351 flex: 1;
354 /********* menupopup, panel, & tooltip ***********/
356 menupopup,
357 panel {
358 flex-direction: column;
361 menupopup,
362 panel,
363 tooltip {
364 position: fixed;
365 -moz-top-layer: top;
366 width: fit-content;
367 height: fit-content;
368 /* Popups can't have overflow */
369 contain: paint;
370 z-index: 2147483647;
371 text-shadow: none;
374 tooltip {
375 appearance: auto;
376 -moz-default-appearance: tooltip;
377 -moz-font-smoothing-background-color: -moz-mac-tooltip;
379 white-space: pre-wrap;
381 background-color: InfoBackground;
382 color: InfoText;
383 font: message-box;
384 padding: 2px 3px;
385 max-width: 40em;
386 overflow: clip;
387 pointer-events: none;
390 tooltip:not([position]) {
391 margin-top: 21px;
395 * It's important that these styles are in a UA sheet, because the default
396 * tooltip is native anonymous content
398 @media (-moz-platform: linux) {
399 tooltip {
400 padding: 6px 10px; /* Matches Adwaita. */
401 line-height: 1.4; /* For Noto Sans; note that 1.2 may clip descenders. */
405 @media (-moz-platform: windows) {
406 tooltip {
407 appearance: none;
408 border: 1px solid;
411 /* TODO(emilio): Probably make InfoText/InfoBackground do the right thing and
412 * remove this? */
413 @media not (prefers-contrast) {
414 tooltip {
415 background-color: #f9f9fb;
416 color: black;
417 border-color: #67676c;
418 border-radius: 4px;
421 @media (prefers-color-scheme: dark) {
422 tooltip {
423 background-color: #2b2a33;
424 color: white;
425 border-color: #f9f9fb;
431 @media (-moz-panel-animations) and (prefers-reduced-motion: no-preference) {
432 @media (-moz-platform: macos) {
433 /* On Mac, use the properties "-moz-window-transform" and "-moz-window-opacity"
434 instead of "transform" and "opacity" for these animations.
435 The -moz-window* properties apply to the whole window including the window's
436 shadow, and they don't affect the window's "shape", so the system doesn't
437 have to recompute the shadow shape during the animation. This makes them a
438 lot faster. In fact, Gecko no longer triggers shadow shape recomputations
439 for repaints.
440 These properties are not implemented on other platforms. */
441 panel[type="arrow"]:not([animate="false"]) {
442 transition-property: -moz-window-transform, -moz-window-opacity;
443 transition-duration: 0.18s, 0.18s;
444 transition-timing-function:
445 var(--animation-easing-function), ease-out;
448 /* Only do the fade-in animation on pre-Big Sur to avoid missing shadows on
449 * Big Sur, see bug 1672091. */
450 @media (-moz-mac-big-sur-theme: 0) {
451 panel[type="arrow"]:not([animate="false"]) {
452 -moz-window-opacity: 0;
453 -moz-window-transform: translateY(-70px);
456 panel[type="arrow"][side="bottom"]:not([animate="false"]) {
457 -moz-window-transform: translateY(70px);
461 /* [animate] is here only so that this rule has greater specificity than the
462 * rule right above */
463 panel[type="arrow"][animate][animate="open"] {
464 -moz-window-opacity: 1.0;
465 transition-duration: 0.18s, 0.18s;
466 -moz-window-transform: none;
467 transition-timing-function:
468 var(--animation-easing-function), ease-in-out;
471 panel[type="arrow"][animate][animate="cancel"] {
472 -moz-window-opacity: 0;
473 -moz-window-transform: none;
475 } /* end of macOS rules */
477 @media not (-moz-platform: macos) {
478 panel[type="arrow"]:not([animate="false"]) {
479 opacity: 0;
480 transform: translateY(-70px);
481 transition-property: transform, opacity;
482 transition-duration: 0.18s, 0.18s;
483 transition-timing-function:
484 var(--animation-easing-function), ease-out;
485 will-change: transform, opacity;
488 panel[type="arrow"][side="bottom"]:not([animate="false"]) {
489 transform: translateY(70px);
492 /* [animate] is here only so that this rule has greater specificity than the
493 * rule right above */
494 panel[type="arrow"][animate][animate="open"] {
495 opacity: 1.0;
496 transition-duration: 0.18s, 0.18s;
497 transform: none;
498 transition-timing-function:
499 var(--animation-easing-function), ease-in-out;
502 panel[type="arrow"][animate][animate="cancel"] {
503 transform: none;
505 } /* end of non-macOS rules */
508 panel[type="arrow"][animating] {
509 pointer-events: none;
512 /******** tree ******/
514 treecolpicker {
515 order: 2147483646;
518 treechildren {
519 display: flex;
520 flex: 1;
523 tree {
524 flex-direction: column;
527 tree[hidecolumnpicker="true"] treecolpicker {
528 display: none;
531 treecol {
532 min-width: 16px;
533 /* This preserves the behavior of -moz-box-ordinal-group. To change this we'd
534 * need to migrate the persisted ordinal values etc. */
535 order: 1;
538 treecol[hidden="true"] {
539 visibility: collapse;
540 display: flex;
543 /* ::::: lines connecting cells ::::: */
544 tree:not([treelines="true"]) treechildren::-moz-tree-line {
545 visibility: hidden;
548 treechildren::-moz-tree-cell(ltr) {
549 direction: ltr !important;
552 /********** deck, tabpanels & stack *********/
554 tabpanels > *|*:not(:-moz-native-anonymous) {
555 /* tabpanels is special: we want to avoid displaying them, but we still want
556 * the hidden children to be accessible */
557 -moz-subtree-hidden-only-visually: 1;
560 deck > *|*:not(:-moz-native-anonymous) {
561 visibility: hidden;
564 tabpanels > .deck-selected,
565 deck > .deck-selected {
566 -moz-subtree-hidden-only-visually: 0;
567 visibility: inherit;
570 tabpanels,
571 deck,
572 stack {
573 display: grid;
574 position: relative;
577 /* We shouldn't style native anonymous children like scrollbars or what not. */
578 tabpanels > *|*:not(:-moz-native-anonymous),
579 deck > *|*:not(:-moz-native-anonymous),
580 stack > *|*:not(:-moz-native-anonymous) {
581 grid-area: 1 / 1;
582 z-index: 0;
585 The default `min-height: auto` value makes grid items refuse to be smaller
586 than their content. This doesn't match the traditional behavior of XUL stack,
587 which often shoehorns tall content into a smaller stack and allows the content
588 to decide how to handle overflow (e.g. by scaling down if it's an image, or
589 by adding scrollbars if it's scrollable).
591 min-height: 0;
594 /********** tabbox *********/
596 tabbox {
597 flex-direction: column;
598 min-height: 0;
601 tabpanels {
602 min-height: 0;
605 tabs {
606 flex-direction: row;
609 tab {
610 align-items: center;
611 justify-content: center;
614 /********** tooltip *********/
616 tooltip[titletip="true"] {
617 /* The width of the tooltip isn't limited on cropped <tree> cells. */
618 max-width: none;
621 /********** basic rule for anonymous content that needs to pass box properties through
622 ********** to an insertion point parent that holds the real kids **************/
624 .box-inherit {
625 align-items: inherit;
626 justify-content: inherit;
627 flex-grow: inherit;
628 flex-shrink: inherit;
629 flex-direction: inherit;
632 /********** textbox **********/
634 search-textbox {
635 text-shadow: none;
638 /* Prefix with (xul|*):root to workaround HTML tests loading xul.css */
639 :root html|textarea:not([resizable="true"]) {
640 resize: none;
643 /********** autocomplete textbox **********/
645 .autocomplete-richlistbox {
646 -moz-user-focus: ignore;
647 overflow-x: hidden !important;
648 flex: 1;
651 .autocomplete-richlistitem {
652 flex-direction: column;
653 align-items: center;
654 overflow: clip;
657 /* The following rule is here to fix bug 96899 (and now 117952).
658 Somehow trees create a situation
659 in which a popupset flows itself as if its popup child is directly within it
660 instead of the placeholder child that should actually be inside the popupset.
661 This is a stopgap measure, and it does not address the real bug. */
662 .autocomplete-result-popupset {
663 max-width: 0px;
664 width: 0 !important;
665 min-width: 0%;
666 min-height: 0%;
669 /********** menulist **********/
671 menulist[popuponly] {
672 appearance: none !important;
673 margin: 0 !important;
674 height: 0 !important;
675 min-height: 0 !important;
676 border: 0 !important;
677 padding: 0 !important;
680 /********** splitter **********/
682 .tree-splitter {
683 margin-inline: -4px;
684 width: 8px;
685 max-width: 8px;
686 min-width: 8px;
687 appearance: none !important;
688 border: none !important;
689 background: none !important;
690 order: 2147483646;
691 z-index: 2147483646;
694 /******** scrollbar ********/
696 slider {
697 /* This is a hint to layerization that the scrollbar thumb can never leave
698 the scrollbar track. */
699 overflow: hidden;
702 /******** scrollbox ********/
704 scrollbox {
705 /* This makes it scrollable! */
706 overflow: hidden;
709 @media (prefers-reduced-motion: no-preference) {
710 scrollbox[smoothscroll=true] {
711 scroll-behavior: smooth;
715 /********** stringbundle **********/
717 stringbundle,
718 stringbundleset {
719 display: none;
722 /********** dialog **********/
724 dialog {
725 flex: 1;
726 flex-direction: column;
729 /********** wizard **********/
731 wizard {
732 flex: 1;
733 flex-direction: column;
734 contain: inline-size;
735 min-width: 40em;
736 min-height: 30em;
739 wizard > wizardpage {
740 grid-area: 1 / 1;
741 min-height: 0;
744 wizard > wizardpage:not(.selected) {
745 visibility: hidden;
748 wizardpage {
749 flex-direction: column;
750 overflow: auto;
753 /********** Rich Listbox ********/
755 richlistbox {
756 flex-direction: column;
757 overflow: auto;
758 min-width: 0;
759 min-height: 0;
762 richlistitem {
763 flex-shrink: 0;
766 /*********** findbar ************/
767 findbar {
768 overflow-x: hidden;
769 contain: inline-size;
772 /* Some elements that in HTML blocks should be inline-level by default */
773 button, image {
774 display: inline-flex;
777 .menu-iconic-highlightable-text:not([highlightable="true"]),
778 .menu-iconic-text[highlightable="true"] {
779 display: none;
782 [orient="vertical"] { flex-direction: column !important; }
783 [orient="horizontal"] { flex-direction: row !important; }
785 [align="start"] { align-items: flex-start !important; }
786 [align="center"] { align-items: center !important; }
787 [align="end"] { align-items: flex-end !important; }
788 [align="baseline"] { align-items: baseline !important; }
789 [align="stretch"] { align-items: stretch !important; }
791 [pack="start"] { justify-content: start !important; }
792 [pack="center"] { justify-content: center !important; }
793 [pack="end"] { justify-content: flex-end !important; }
795 [flex="0"] { flex: none !important; }
796 [flex="1"] { flex: 1 !important; }