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  -moz-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  scrollcorner:-moz-native-anonymous-no-specificity,
38  resizer:-moz-native-anonymous-no-specificity,
39  scrollbar:-moz-native-anonymous-no-specificity,
40  scrollbarbutton:-moz-native-anonymous-no-specificity,
41  slider:-moz-native-anonymous-no-specificity {
42    /* All scrollbar parts must not inherit any properties from the scrollable
43     * element (except for visibility and pointer-events), for the anonymous
44     * content style caching system to work.
45     */
46    all: initial;
47    visibility: inherit;
48    pointer-events: inherit;
49
50    /* These properties are not included in 'all'. */
51    -moz-list-reversed: initial;
52    -moz-font-smoothing-background-color: initial;
53    -moz-min-font-size-ratio: initial;
54
55    /* Using initial is not sufficient for direction, since its initial value can
56     * depend on the document's language.
57     *
58     * LTR is what we want for all scrollbar parts anyway, so that e.g. we don't
59     * reverse the rendering of a horizontal scrollbar.
60     */
61    direction: ltr;
62
63    /* Similarly for font properties, whose initial values depend on the
64     * document's language.  Scrollbar parts don't have any text or rely on
65     * font metrics.
66     */
67    font: 16px sans-serif;
68
69    /* The initial value of justify-items is `legacy`, which makes it depend on
70     * the parent style.
71     *
72     * Reset it to something else.
73     */
74    justify-items: start;
75
76    /* Avoid `object > *` rule in html.css from setting a useless, non-initial
77     * value of vertical-align.
78     */
79    vertical-align: initial !important;
80
81    /* Duplicate the rules from the '*' rule above, which were clobbered by the
82     * 'all: initial' declaration.
83     *
84     * The other zero specificity rules above are on :root, and scrollbar parts
85     * cannot match :root, so no need to duplicate them.
86     */
87    -moz-user-focus: ignore;
88    -moz-user-select: none;
89    display: -moz-box;
90    box-sizing: border-box;
91  }
92
93  /* There are other rules that set direction and cursor on scrollbar,
94   * expecting them to inherit into its children.  Explicitly inherit those,
95   * overriding the 'all: initial; direction: ltr;' declarations above.
96   */
97  scrollbarbutton:-moz-native-anonymous-no-specificity,
98  slider:-moz-native-anonymous-no-specificity,
99  thumb:-moz-native-anonymous-no-specificity {
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  -moz-appearance: resizer;
128
129  /* native resizer should never flip on its own;
130     we will flip it (or the SVG background) with CSS transform below. */
131  direction: ltr;
132  writing-mode: initial;
133
134  background: url("chrome://global/skin/icons/resizer.svg") no-repeat;
135  background-size: 100% 100%;
136  cursor: se-resize;
137  width: 15px;
138  height: 15px;
139}
140
141/* bottomstart/bottomend is supported in XUL window only */
142resizer[dir="bottom"][flip],
143resizer[dir="bottomleft"],
144resizer[dir="bottomstart"]:-moz-locale-dir(ltr),
145resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
146  transform: scaleX(-1);
147}
148
149resizer[dir="bottomleft"],
150resizer[dir="bottomstart"]:-moz-locale-dir(ltr),
151resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
152  cursor: sw-resize;
153}
154
155resizer[dir="top"],
156resizer[dir="bottom"] {
157  cursor: ns-resize;
158}
159
160resizer[dir="left"] {
161  transform: scaleX(-1);
162}
163
164resizer[dir="left"],
165resizer[dir="right"] {
166  cursor: ew-resize;
167}
168
169resizer[dir="topleft"] {
170  cursor: nw-resize;
171}
172
173resizer[dir="topright"] {
174  cursor: ne-resize;
175}
176
177/********** scrollbar **********/
178
179thumb {
180  display: -moz-box !important;
181}
182
183/* Don't collapse thumb when scrollbar is disabled. */
184thumb[collapsed="true"] {
185  visibility: hidden;
186}
187
188scrollbar, scrollbarbutton, scrollcorner, slider, thumb {
189  -moz-user-select: none;
190}
191
192scrollcorner {
193  display: -moz-box !important;
194}
195
196scrollcorner[hidden="true"] {
197  display: none !important;
198}
199
200scrollbar[value="hidden"] {
201  visibility: hidden;
202}
203
204@media (-moz-scrollbar-start-backward: 0) {
205  scrollbarbutton[sbattr="scrollbar-up-top"] {
206    display: none;
207  }
208}
209
210@media (-moz-scrollbar-start-forward: 0) {
211  scrollbarbutton[sbattr="scrollbar-down-top"] {
212    display: none;
213  }
214}
215
216@media (-moz-scrollbar-end-backward: 0) {
217  scrollbarbutton[sbattr="scrollbar-up-bottom"] {
218    display: none;
219  }
220}
221
222@media (-moz-scrollbar-end-forward: 0) {
223  scrollbarbutton[sbattr="scrollbar-down-bottom"] {
224    display: none;
225  }
226}
227
228@media (-moz-scrollbar-thumb-proportional) {
229  thumb {
230    -moz-box-flex: 1;
231  }
232}
233