1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 /* atom list for CSS pseudo-classes */
8 
9 /*
10  * This file contains the list of nsAtoms and their values for CSS
11  * pseudo-classes.  It is designed to be used as inline input to
12  * nsCSSPseudoClasses.cpp *only* through the magic of C preprocessing.
13  * All entries must be enclosed in the macros CSS_PSEUDO_CLASS,
14  * CSS_STATE_DEPENDENT_PSEUDO_CLASS, or CSS_STATE_PSEUDO_CLASS which
15  * will have cruel and unusual things done to them.  The entries should
16  * be kept in some sort of logical order.  The common arguments to these
17  * macros are:
18  * name_  : The C++ identifier used for the atom (which will be a member
19  *          of nsCSSPseudoClasses)
20  * value_ : The pseudo-class as a string, including the initial colon,
21  *          used as the string value of the atom.
22  * flags_ : A bitfield containing flags defined in nsCSSPseudoClasses.h
23  * pref_  : The name of the preference controlling whether the
24  *          pseudo-class is recognized by the parser, or the empty
25  *          string if it's unconditional.
26  * CSS_STATE_PSEUDO_CLASS has an additional argument:
27  * bit_   : The event state bit or bits that corresponds to the
28  *          pseudo-class, i.e., causes it to match (only one bit
29  *          required to match).
30  * CSS_STATE_DEPENDENT_PSEUDO_CLASS has an additional argument:
31  * bit_   : The event state bits that affect whether the pseudo-class
32  *          matches.  Matching depends on a customized per-class
33  *          algorithm which should be defined in SelectorMatches() in
34  *          nsCSSRuleProcessor.cpp.
35  *
36  * If CSS_STATE_PSEUDO_CLASS is not defined, it'll be automatically
37  * defined to CSS_STATE_DEPENDENT_PSEUDO_CLASS;
38  * if CSS_STATE_DEPENDENT_PSEUDO_CLASS is not defined, it'll be
39  * automatically defined to CSS_PSEUDO_CLASS.
40  */
41 
42 // OUTPUT_CLASS=nsCSSPseudoClasses
43 // MACRO_NAME=CSS_PSEUDO_CLASS
44 
45 #ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
46 #error "CSS_STATE_DEPENDENT_PSEUDO_CLASS shouldn't be defined"
47 #endif
48 
49 #ifndef CSS_STATE_DEPENDENT_PSEUDO_CLASS
50 #define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
51   CSS_PSEUDO_CLASS(_name, _value, _flags, _pref)
52 #define DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
53 #endif
54 
55 #ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
56 #error "CSS_STATE_PSEUDO_CLASS shouldn't be defined"
57 #endif
58 
59 #ifndef CSS_STATE_PSEUDO_CLASS
60 #define CSS_STATE_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
61   CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit)
62 #define DEFINED_CSS_STATE_PSEUDO_CLASS
63 #endif
64 
65 // The CSS_PSEUDO_CLASS entries should all come before the
66 // CSS_STATE_PSEUDO_CLASS entries.  The CSS_PSEUDO_CLASS entry order
67 // must be the same as the order of cases in SelectorMatches.  :not
68 // must be the last CSS_PSEUDO_CLASS.
69 
70 CSS_PSEUDO_CLASS(empty, ":empty", 0, "")
71 CSS_PSEUDO_CLASS(mozOnlyWhitespace, ":-moz-only-whitespace", 0, "")
72 CSS_PSEUDO_CLASS(lang, ":lang", 0, "")
73 CSS_PSEUDO_CLASS(root, ":root", 0, "")
74 CSS_PSEUDO_CLASS(any, ":-moz-any", 0, "")
75 
76 CSS_PSEUDO_CLASS(firstChild, ":first-child", 0, "")
77 CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node", 0, "")
78 CSS_PSEUDO_CLASS(lastChild, ":last-child", 0, "")
79 CSS_PSEUDO_CLASS(lastNode, ":-moz-last-node", 0, "")
80 CSS_PSEUDO_CLASS(onlyChild, ":only-child", 0, "")
81 CSS_PSEUDO_CLASS(firstOfType, ":first-of-type", 0, "")
82 CSS_PSEUDO_CLASS(lastOfType, ":last-of-type", 0, "")
83 CSS_PSEUDO_CLASS(onlyOfType, ":only-of-type", 0, "")
84 CSS_PSEUDO_CLASS(nthChild, ":nth-child", 0, "")
85 CSS_PSEUDO_CLASS(nthLastChild, ":nth-last-child", 0, "")
86 CSS_PSEUDO_CLASS(nthOfType, ":nth-of-type", 0, "")
87 CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type", 0, "")
88 
89 // Match nodes that are HTML but not XHTML
90 CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html", 0, "")
91 
92 // Matches nodes that are in a native-anonymous subtree (i.e., nodes in
93 // a subtree of C++ anonymous content constructed by Gecko for its own
94 // purposes).
95 CSS_PSEUDO_CLASS(mozNativeAnonymous, ":-moz-native-anonymous",
96                  CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
97 
98 CSS_PSEUDO_CLASS(mozUseShadowTreeRoot, ":-moz-use-shadow-tree-root",
99                  CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
100 
101 // -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
102 // to match based on the locale's chrome direction
103 CSS_PSEUDO_CLASS(mozLocaleDir, ":-moz-locale-dir", 0, "")
104 
105 // -moz-lwtheme may be used to match a document that has a lightweight theme
106 CSS_PSEUDO_CLASS(mozLWTheme, ":-moz-lwtheme", 0, "")
107 
108 // -moz-lwtheme-brighttext matches a document that has a dark lightweight theme
109 CSS_PSEUDO_CLASS(mozLWThemeBrightText, ":-moz-lwtheme-brighttext", 0, "")
110 
111 // -moz-lwtheme-darktext matches a document that has a bright lightweight theme
112 CSS_PSEUDO_CLASS(mozLWThemeDarkText, ":-moz-lwtheme-darktext", 0, "")
113 
114 // Matches anything when the containing window is inactive
115 CSS_PSEUDO_CLASS(mozWindowInactive, ":-moz-window-inactive", 0, "")
116 
117 // Matches any table elements that have a nonzero border attribute,
118 // according to HTML integer attribute parsing rules.
119 CSS_PSEUDO_CLASS(mozTableBorderNonzero, ":-moz-table-border-nonzero",
120                  CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
121 
122 // Matches HTML frame/iframe elements which are mozbrowser.
123 CSS_PSEUDO_CLASS(mozBrowserFrame, ":-moz-browser-frame",
124                  CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "")
125 
126 // Matches whatever the contextual reference elements are for the
127 // matching operation.
128 CSS_PSEUDO_CLASS(scope, ":scope", 0, "layout.css.scope-pseudo.enabled")
129 
130 // :not needs to come at the end of the non-bit pseudo-class list, since
131 // it doesn't actually get directly matched on in SelectorMatches.
132 CSS_PSEUDO_CLASS(negation, ":not", 0, "")
133 
134 // :dir(ltr) and :dir(rtl) match elements whose resolved
135 // directionality in the markup language is ltr or rtl respectively.
136 CSS_STATE_DEPENDENT_PSEUDO_CLASS(dir, ":dir", 0, "",
137                                  NS_EVENT_STATE_LTR | NS_EVENT_STATE_RTL)
138 
139 CSS_STATE_PSEUDO_CLASS(link, ":link", 0, "", NS_EVENT_STATE_UNVISITED)
140 // what matches :link or :visited
141 CSS_STATE_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link", 0, "",
142                        NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
143 CSS_STATE_PSEUDO_CLASS(anyLink, ":any-link", 0, "",
144                        NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
145 CSS_STATE_PSEUDO_CLASS(visited, ":visited", 0, "", NS_EVENT_STATE_VISITED)
146 
147 CSS_STATE_PSEUDO_CLASS(active, ":active", 0, "", NS_EVENT_STATE_ACTIVE)
148 CSS_STATE_PSEUDO_CLASS(checked, ":checked", 0, "", NS_EVENT_STATE_CHECKED)
149 CSS_STATE_PSEUDO_CLASS(disabled, ":disabled", 0, "", NS_EVENT_STATE_DISABLED)
150 CSS_STATE_PSEUDO_CLASS(enabled, ":enabled", 0, "", NS_EVENT_STATE_ENABLED)
151 CSS_STATE_PSEUDO_CLASS(focus, ":focus", 0, "", NS_EVENT_STATE_FOCUS)
152 CSS_STATE_PSEUDO_CLASS(focusWithin, ":focus-within", 0, "",
153                        NS_EVENT_STATE_FOCUS_WITHIN)
154 CSS_STATE_PSEUDO_CLASS(hover, ":hover", 0, "", NS_EVENT_STATE_HOVER)
155 CSS_STATE_PSEUDO_CLASS(mozDragOver, ":-moz-drag-over", 0, "",
156                        NS_EVENT_STATE_DRAGOVER)
157 CSS_STATE_PSEUDO_CLASS(target, ":target", 0, "", NS_EVENT_STATE_URLTARGET)
158 CSS_STATE_PSEUDO_CLASS(indeterminate, ":indeterminate", 0, "",
159                        NS_EVENT_STATE_INDETERMINATE)
160 
161 CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighlighted, ":-moz-devtools-highlighted",
162                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
163                        NS_EVENT_STATE_DEVTOOLS_HIGHLIGHTED)
164 CSS_STATE_PSEUDO_CLASS(mozStyleeditorTransitioning,
165                        ":-moz-styleeditor-transitioning",
166                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
167                        NS_EVENT_STATE_STYLEEDITOR_TRANSITIONING)
168 
169 // Matches the element which is being displayed full-screen, and
170 // any containing frames.
171 CSS_STATE_PSEUDO_CLASS(fullscreen, ":fullscreen",
172                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME,
173                        "full-screen-api.unprefix.enabled",
174                        NS_EVENT_STATE_FULL_SCREEN)
175 CSS_STATE_PSEUDO_CLASS(mozFullScreen, ":-moz-full-screen", 0, "",
176                        NS_EVENT_STATE_FULL_SCREEN)
177 
178 // Matches if the element is focused and should show a focus ring
179 CSS_STATE_PSEUDO_CLASS(mozFocusRing, ":-moz-focusring", 0, "",
180                        NS_EVENT_STATE_FOCUSRING)
181 
182 // Image, object, etc state pseudo-classes
183 CSS_STATE_PSEUDO_CLASS(mozBroken, ":-moz-broken", 0, "", NS_EVENT_STATE_BROKEN)
184 CSS_STATE_PSEUDO_CLASS(mozLoading, ":-moz-loading", 0, "",
185                        NS_EVENT_STATE_LOADING)
186 
187 CSS_STATE_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled",
188                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
189                        NS_EVENT_STATE_USERDISABLED)
190 CSS_STATE_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed",
191                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
192                        NS_EVENT_STATE_SUPPRESSED)
193 CSS_STATE_PSEUDO_CLASS(mozHandlerClickToPlay, ":-moz-handler-clicktoplay",
194                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
195                        NS_EVENT_STATE_TYPE_CLICK_TO_PLAY)
196 CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableUpdatable,
197                        ":-moz-handler-vulnerable-updatable",
198                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
199                        NS_EVENT_STATE_VULNERABLE_UPDATABLE)
200 CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableNoUpdate,
201                        ":-moz-handler-vulnerable-no-update",
202                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
203                        NS_EVENT_STATE_VULNERABLE_NO_UPDATE)
204 CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled",
205                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
206                        NS_EVENT_STATE_HANDLER_DISABLED)
207 CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked",
208                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
209                        NS_EVENT_STATE_HANDLER_BLOCKED)
210 CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed, ":-moz-handler-crashed",
211                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
212                        NS_EVENT_STATE_HANDLER_CRASHED)
213 
214 CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel,
215                        ":-moz-math-increment-script-level", 0, "",
216                        NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL)
217 
218 CSS_STATE_PSEUDO_CLASS(mozHasDirAttr, ":-moz-has-dir-attr",
219                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
220                        NS_EVENT_STATE_HAS_DIR_ATTR)
221 CSS_STATE_PSEUDO_CLASS(mozDirAttrLTR, ":-moz-dir-attr-ltr",
222                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
223                        NS_EVENT_STATE_DIR_ATTR_LTR)
224 CSS_STATE_PSEUDO_CLASS(mozDirAttrRTL, ":-moz-dir-attr-rtl",
225                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
226                        NS_EVENT_STATE_DIR_ATTR_RTL)
227 CSS_STATE_PSEUDO_CLASS(mozDirAttrLikeAuto, ":-moz-dir-attr-like-auto",
228                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
229                        NS_EVENT_STATE_DIR_ATTR_LIKE_AUTO)
230 
231 CSS_STATE_PSEUDO_CLASS(mozAutofill, ":-moz-autofill",
232                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
233                        NS_EVENT_STATE_AUTOFILL)
234 CSS_STATE_PSEUDO_CLASS(mozAutofillPreview, ":-moz-autofill-preview",
235                        CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
236                        NS_EVENT_STATE_AUTOFILL_PREVIEW)
237 
238 // CSS 3 UI
239 // http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
240 CSS_STATE_PSEUDO_CLASS(required, ":required", 0, "", NS_EVENT_STATE_REQUIRED)
241 CSS_STATE_PSEUDO_CLASS(optional, ":optional", 0, "", NS_EVENT_STATE_OPTIONAL)
242 CSS_STATE_PSEUDO_CLASS(valid, ":valid", 0, "", NS_EVENT_STATE_VALID)
243 CSS_STATE_PSEUDO_CLASS(invalid, ":invalid", 0, "", NS_EVENT_STATE_INVALID)
244 CSS_STATE_PSEUDO_CLASS(inRange, ":in-range", 0, "", NS_EVENT_STATE_INRANGE)
245 CSS_STATE_PSEUDO_CLASS(outOfRange, ":out-of-range", 0, "",
246                        NS_EVENT_STATE_OUTOFRANGE)
247 CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", 0, "", NS_EVENT_STATE_DEFAULT)
248 CSS_STATE_PSEUDO_CLASS(placeholderShown, ":placeholder-shown", 0, "",
249                        NS_EVENT_STATE_PLACEHOLDERSHOWN)
250 CSS_STATE_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only", 0, "",
251                        NS_EVENT_STATE_MOZ_READONLY)
252 CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write", 0, "",
253                        NS_EVENT_STATE_MOZ_READWRITE)
254 CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", 0, "",
255                        NS_EVENT_STATE_MOZ_SUBMITINVALID)
256 CSS_STATE_PSEUDO_CLASS(mozUIInvalid, ":-moz-ui-invalid", 0, "",
257                        NS_EVENT_STATE_MOZ_UI_INVALID)
258 CSS_STATE_PSEUDO_CLASS(mozUIValid, ":-moz-ui-valid", 0, "",
259                        NS_EVENT_STATE_MOZ_UI_VALID)
260 CSS_STATE_PSEUDO_CLASS(mozMeterOptimum, ":-moz-meter-optimum", 0, "",
261                        NS_EVENT_STATE_OPTIMUM)
262 CSS_STATE_PSEUDO_CLASS(mozMeterSubOptimum, ":-moz-meter-sub-optimum", 0, "",
263                        NS_EVENT_STATE_SUB_OPTIMUM)
264 CSS_STATE_PSEUDO_CLASS(mozMeterSubSubOptimum, ":-moz-meter-sub-sub-optimum", 0,
265                        "", NS_EVENT_STATE_SUB_SUB_OPTIMUM)
266 
267 // Those values should be parsed but do nothing.
268 CSS_STATE_PSEUDO_CLASS(mozPlaceholder, ":-moz-placeholder", 0, "",
269                        NS_EVENT_STATE_IGNORE)
270 
271 #ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
272 #undef DEFINED_CSS_STATE_PSEUDO_CLASS
273 #undef CSS_STATE_PSEUDO_CLASS
274 #endif
275 
276 #ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
277 #undef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
278 #undef CSS_STATE_DEPENDENT_PSEUDO_CLASS
279 #endif
280