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/. */ 4 5/** 6 * This file should only contain a minimal set of rules for the XUL elements 7 * that may be implicitly created as part of HTML/SVG documents (e.g. 8 * scrollbars). Rules for everything else related to XUL can be found in 9 * xul.css. (This split of the XUL rules is to minimize memory use and improve 10 * performance in HTML/SVG documents.) 11 * 12 * ANYTHING ADDED TO THIS FILE WILL APPLY TO ALL DOCUMENTS, INCLUDING WEB CONTENT. 13 * IF UA RULES ARE ONLY NEEDED IN CHROME, THEY SHOULD BE ADDED TO xul.css. 14 */ 15 16@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */ 17 18* { 19 -moz-user-focus: ignore; 20 user-select: none; 21 display: -moz-box; 22 box-sizing: border-box; 23} 24 25/* hide the content and destroy the frame */ 26[hidden="true"] { 27 display: none; 28} 29 30/* hide the content, but don't destroy the frames */ 31[collapsed="true"] { 32 visibility: collapse; 33} 34 35/* Rules required for style caching of anonymous content scrollbar parts */ 36@supports -moz-bool-pref("layout.css.cached-scrollbar-styles.enabled") { 37 :is(scrollcorner, resizer, scrollbar, scrollbarbutton, slider):where(:-moz-native-anonymous) { 38 /* All scrollbar parts must not inherit any properties from the scrollable 39 * element (except for visibility and pointer-events), for the anonymous 40 * content style caching system to work. 41 */ 42 all: initial; 43 visibility: inherit; 44 pointer-events: inherit; 45 46 /* These properties are not included in 'all'. */ 47 -moz-list-reversed: initial; 48 -moz-context-properties: initial; 49 -moz-control-character-visibility: initial; 50 -moz-font-smoothing-background-color: initial; 51 -moz-min-font-size-ratio: initial; 52 math-depth: initial; 53 /* As long as inert implies pointer-events: none as it does now, we're 54 * good. */ 55 -moz-inert: initial; 56 57 /* Using initial is not sufficient for direction, since its initial value can 58 * depend on the document's language. 59 * 60 * LTR is what we want for all scrollbar parts anyway, so that e.g. we don't 61 * reverse the rendering of a horizontal scrollbar. 62 */ 63 direction: ltr; 64 65 /* Similarly for font properties, whose initial values depend on the 66 * document's language. Scrollbar parts don't have any text or rely on 67 * font metrics. 68 */ 69 font: 16px sans-serif; 70 71 /* The initial value of justify-items is `legacy`, which makes it depend on 72 * the parent style. 73 * 74 * Reset it to something else. 75 */ 76 justify-items: start; 77 78 /* Avoid `object > *` rule in html.css from setting a useless, non-initial 79 * value of vertical-align. 80 */ 81 vertical-align: initial !important; 82 83 /* Duplicate the rules from the '*' rule above, which were clobbered by the 84 * 'all: initial' declaration. 85 * 86 * The other zero specificity rules above are on :root, and scrollbar parts 87 * cannot match :root, so no need to duplicate them. 88 */ 89 -moz-user-focus: ignore; 90 user-select: none; 91 display: -moz-box; 92 box-sizing: border-box; 93 } 94 95 /* There are other rules that set direction and cursor on scrollbar, 96 * expecting them to inherit into its children. Explicitly inherit those, 97 * overriding the 'all: initial; direction: ltr;' declarations above. 98 */ 99 :is(scrollbarbutton, slider, thumb):where(:-moz-native-anonymous) { 100 direction: inherit; 101 cursor: inherit; 102 } 103} 104 105scrollbar[orient="vertical"], 106slider[orient="vertical"], 107thumb[orient="vertical"] { 108 -moz-box-orient: vertical; 109} 110 111thumb { 112 /* Prevent -moz-user-modify declaration from designmode.css having an 113 * effect. */ 114 -moz-user-modify: initial; 115 116 -moz-box-align: center; 117 -moz-box-pack: center; 118} 119 120/********** resizer **********/ 121 122resizer { 123 position: relative; 124 z-index: 2147483647; 125 /* Widget gets decide on its own whether or not the native theme should apply, 126 based on the context/OS theme. If it does not, SVG background will kick in. */ 127 appearance: auto; 128 -moz-default-appearance: resizer; 129 130 /* native resizer should never flip on its own; 131 we will flip it (or the SVG background) with CSS transform below. */ 132 direction: ltr; 133 writing-mode: initial; 134 135 background: url("chrome://global/skin/icons/resizer.svg") no-repeat; 136 background-size: 100% 100%; 137 cursor: se-resize; 138 width: 15px; 139 height: 15px; 140} 141 142/* bottomstart/bottomend is supported in XUL window only */ 143resizer[dir="bottom"][flip], 144resizer[dir="bottomleft"], 145resizer[dir="bottomstart"]:-moz-locale-dir(ltr), 146resizer[dir="bottomend"]:-moz-locale-dir(rtl) { 147 transform: scaleX(-1); 148} 149 150resizer[dir="bottomleft"], 151resizer[dir="bottomstart"]:-moz-locale-dir(ltr), 152resizer[dir="bottomend"]:-moz-locale-dir(rtl) { 153 cursor: sw-resize; 154} 155 156resizer[dir="top"], 157resizer[dir="bottom"] { 158 cursor: ns-resize; 159} 160 161resizer[dir="left"] { 162 transform: scaleX(-1); 163} 164 165resizer[dir="left"], 166resizer[dir="right"] { 167 cursor: ew-resize; 168} 169 170resizer[dir="topleft"] { 171 cursor: nw-resize; 172} 173 174resizer[dir="topright"] { 175 cursor: ne-resize; 176} 177 178/********** scrollbar **********/ 179 180thumb { 181 display: -moz-box !important; 182} 183 184/* Don't collapse thumb when scrollbar is disabled. */ 185thumb[collapsed="true"] { 186 visibility: hidden; 187} 188 189scrollbar, scrollbarbutton, scrollcorner, slider, thumb { 190 user-select: none; 191} 192 193scrollcorner { 194 display: -moz-box !important; 195} 196 197scrollcorner[hidden="true"] { 198 display: none !important; 199} 200 201scrollbar[value="hidden"] { 202 visibility: hidden; 203} 204 205@media (-moz-scrollbar-start-backward: 0) { 206 scrollbarbutton[sbattr="scrollbar-up-top"] { 207 display: none; 208 } 209} 210 211@media (-moz-scrollbar-start-forward: 0) { 212 scrollbarbutton[sbattr="scrollbar-down-top"] { 213 display: none; 214 } 215} 216 217@media (-moz-scrollbar-end-backward: 0) { 218 scrollbarbutton[sbattr="scrollbar-up-bottom"] { 219 display: none; 220 } 221} 222 223@media (-moz-scrollbar-end-forward: 0) { 224 scrollbarbutton[sbattr="scrollbar-down-bottom"] { 225 display: none; 226 } 227} 228 229@media (-moz-scrollbar-thumb-proportional) { 230 thumb { 231 -moz-box-flex: 1; 232 } 233} 234