1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* atom list for CSS pseudo-classes */
9 * This file contains the list of nsIAtoms and their values for CSS
10 * pseudo-classes. It is designed to be used as inline input to
11 * nsCSSPseudoClasses.cpp *only* through the magic of C preprocessing.
12 * All entries must be enclosed in the macros CSS_PSEUDO_CLASS,
13 * CSS_STATE_DEPENDENT_PSEUDO_CLASS, or CSS_STATE_PSEUDO_CLASS which
14 * will have cruel and unusual things done to them. The entries should
15 * be kept in some sort of logical order. The common arguments to these
17 * name_ : The C++ identifier used for the atom (which will be a member
18 * of nsCSSPseudoClasses)
19 * value_ : The pseudo-class as a string, including the initial colon,
20 * used as the string value of the atom.
21 * flags_ : A bitfield containing flags defined in nsCSSPseudoClasses.h
22 * pref_ : The name of the preference controlling whether the
23 * pseudo-class is recognized by the parser, or the empty
24 * string if it's unconditional.
25 * CSS_STATE_PSEUDO_CLASS has an additional argument:
26 * bit_ : The event state bit or bits that corresponds to the
27 * pseudo-class, i.e., causes it to match (only one bit
29 * CSS_STATE_DEPENDENT_PSEUDO_CLASS has an additional argument:
30 * bit_ : The event state bits that affect whether the pseudo-class
31 * matches. Matching depends on a customized per-class
32 * algorithm which should be defined in SelectorMatches() in
33 * nsCSSRuleProcessor.cpp.
35 * If CSS_STATE_PSEUDO_CLASS is not defined, it'll be automatically
36 * defined to CSS_STATE_DEPENDENT_PSEUDO_CLASS;
37 * if CSS_STATE_DEPENDENT_PSEUDO_CLASS is not defined, it'll be
38 * automatically defined to CSS_PSEUDO_CLASS.
41 // OUTPUT_CLASS=nsCSSPseudoClasses
42 // MACRO_NAME=CSS_PSEUDO_CLASS
44 #ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
45 #error "CSS_STATE_DEPENDENT_PSEUDO_CLASS shouldn't be defined"
48 #ifndef CSS_STATE_DEPENDENT_PSEUDO_CLASS
49 #define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
50 CSS_PSEUDO_CLASS(_name, _value, _flags, _pref)
51 #define DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
54 #ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
55 #error "CSS_STATE_PSEUDO_CLASS shouldn't be defined"
58 #ifndef CSS_STATE_PSEUDO_CLASS
59 #define CSS_STATE_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
60 CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit)
61 #define DEFINED_CSS_STATE_PSEUDO_CLASS
64 // The CSS_PSEUDO_CLASS entries should all come before the
65 // CSS_STATE_PSEUDO_CLASS entries. The CSS_PSEUDO_CLASS entry order
66 // must be the same as the order of cases in SelectorMatches. :not
67 // must be the last CSS_PSEUDO_CLASS.
69 CSS_PSEUDO_CLASS(empty
, ":empty", 0, "")
70 CSS_PSEUDO_CLASS(mozOnlyWhitespace
, ":-moz-only-whitespace", 0, "")
71 CSS_PSEUDO_CLASS(mozEmptyExceptChildrenWithLocalname
, ":-moz-empty-except-children-with-localname", 0, "")
72 CSS_PSEUDO_CLASS(lang
, ":lang", 0, "")
73 CSS_PSEUDO_CLASS(mozBoundElement
, ":-moz-bound-element", 0, "")
74 CSS_PSEUDO_CLASS(root
, ":root", 0, "")
75 CSS_PSEUDO_CLASS(any
, ":-moz-any", 0, "")
77 CSS_PSEUDO_CLASS(firstChild
, ":first-child", 0, "")
78 CSS_PSEUDO_CLASS(firstNode
, ":-moz-first-node", 0, "")
79 CSS_PSEUDO_CLASS(lastChild
, ":last-child", 0, "")
80 CSS_PSEUDO_CLASS(lastNode
, ":-moz-last-node", 0, "")
81 CSS_PSEUDO_CLASS(onlyChild
, ":only-child", 0, "")
82 CSS_PSEUDO_CLASS(firstOfType
, ":first-of-type", 0, "")
83 CSS_PSEUDO_CLASS(lastOfType
, ":last-of-type", 0, "")
84 CSS_PSEUDO_CLASS(onlyOfType
, ":only-of-type", 0, "")
85 CSS_PSEUDO_CLASS(nthChild
, ":nth-child", 0, "")
86 CSS_PSEUDO_CLASS(nthLastChild
, ":nth-last-child", 0, "")
87 CSS_PSEUDO_CLASS(nthOfType
, ":nth-of-type", 0, "")
88 CSS_PSEUDO_CLASS(nthLastOfType
, ":nth-last-of-type", 0, "")
90 // Match nodes that are HTML but not XHTML
91 CSS_PSEUDO_CLASS(mozIsHTML
, ":-moz-is-html", 0, "")
93 // Matches nodes that are in a native-anonymous subtree (i.e., nodes in
94 // a subtree of C++ anonymous content constructed by Gecko for its own
96 CSS_PSEUDO_CLASS(mozNativeAnonymous
, ":-moz-native-anonymous",
97 CSS_PSEUDO_CLASS_UA_SHEET_ONLY
, "")
99 // Matches anything when the specified look-and-feel metric is set
100 CSS_PSEUDO_CLASS(mozSystemMetric
, ":-moz-system-metric", 0, "")
102 // -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
103 // to match based on the locale's chrome direction
104 CSS_PSEUDO_CLASS(mozLocaleDir
, ":-moz-locale-dir", 0, "")
106 // -moz-lwtheme may be used to match a document that has a lightweight theme
107 CSS_PSEUDO_CLASS(mozLWTheme
, ":-moz-lwtheme", 0, "")
109 // -moz-lwtheme-brighttext matches a document that has a dark lightweight theme
110 CSS_PSEUDO_CLASS(mozLWThemeBrightText
, ":-moz-lwtheme-brighttext", 0, "")
112 // -moz-lwtheme-darktext matches a document that has a bright lightweight theme
113 CSS_PSEUDO_CLASS(mozLWThemeDarkText
, ":-moz-lwtheme-darktext", 0, "")
115 // Matches anything when the containing window is inactive
116 CSS_PSEUDO_CLASS(mozWindowInactive
, ":-moz-window-inactive", 0, "")
118 // Matches any table elements that have a nonzero border attribute,
119 // according to HTML integer attribute parsing rules.
120 CSS_PSEUDO_CLASS(mozTableBorderNonzero
, ":-moz-table-border-nonzero", 0, "")
122 // Matches whatever the contextual reference elements are for the
123 // matching operation.
124 CSS_PSEUDO_CLASS(scope
, ":scope", 0, "layout.css.scope-pseudo.enabled")
126 // :not needs to come at the end of the non-bit pseudo-class list, since
127 // it doesn't actually get directly matched on in SelectorMatches.
128 CSS_PSEUDO_CLASS(notPseudo
, ":not", 0, "")
130 // :-moz-dir(ltr) and :-moz-dir(rtl) match elements whose resolved
131 // directionality in the markup language is ltr or rtl respectively
132 CSS_STATE_DEPENDENT_PSEUDO_CLASS(dir
, ":-moz-dir", 0, "",
133 NS_EVENT_STATE_LTR
| NS_EVENT_STATE_RTL
)
135 CSS_STATE_PSEUDO_CLASS(link
, ":link", 0, "", NS_EVENT_STATE_UNVISITED
)
136 // what matches :link or :visited
137 CSS_STATE_PSEUDO_CLASS(mozAnyLink
, ":-moz-any-link", 0, "",
138 NS_EVENT_STATE_VISITED
| NS_EVENT_STATE_UNVISITED
)
139 CSS_STATE_PSEUDO_CLASS(visited
, ":visited", 0, "", NS_EVENT_STATE_VISITED
)
141 CSS_STATE_PSEUDO_CLASS(active
, ":active", 0, "", NS_EVENT_STATE_ACTIVE
)
142 CSS_STATE_PSEUDO_CLASS(checked
, ":checked", 0, "", NS_EVENT_STATE_CHECKED
)
143 CSS_STATE_PSEUDO_CLASS(disabled
, ":disabled", 0, "", NS_EVENT_STATE_DISABLED
)
144 CSS_STATE_PSEUDO_CLASS(enabled
, ":enabled", 0, "", NS_EVENT_STATE_ENABLED
)
145 CSS_STATE_PSEUDO_CLASS(focus
, ":focus", 0, "", NS_EVENT_STATE_FOCUS
)
146 CSS_STATE_PSEUDO_CLASS(hover
, ":hover", 0, "", NS_EVENT_STATE_HOVER
)
147 CSS_STATE_PSEUDO_CLASS(mozDragOver
, ":-moz-drag-over", 0, "", NS_EVENT_STATE_DRAGOVER
)
148 CSS_STATE_PSEUDO_CLASS(target
, ":target", 0, "", NS_EVENT_STATE_URLTARGET
)
149 CSS_STATE_PSEUDO_CLASS(indeterminate
, ":indeterminate", 0, "",
150 NS_EVENT_STATE_INDETERMINATE
)
152 CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighlighted
, ":-moz-devtools-highlighted", 0, "",
153 NS_EVENT_STATE_DEVTOOLS_HIGHLIGHTED
)
155 // Matches the element which is being displayed full-screen, and
156 // any containing frames.
157 CSS_STATE_PSEUDO_CLASS(mozFullScreen
, ":-moz-full-screen", 0, "", NS_EVENT_STATE_FULL_SCREEN
)
159 // Matches any element which is an ancestor of the DOM full-screen element,
160 // or an ancestor of a containing frame of the full-screen element.
161 CSS_STATE_PSEUDO_CLASS(mozFullScreenAncestor
, ":-moz-full-screen-ancestor", 0, "", NS_EVENT_STATE_FULL_SCREEN_ANCESTOR
)
163 // Matches if the element is focused and should show a focus ring
164 CSS_STATE_PSEUDO_CLASS(mozFocusRing
, ":-moz-focusring", 0, "", NS_EVENT_STATE_FOCUSRING
)
166 // Image, object, etc state pseudo-classes
167 CSS_STATE_PSEUDO_CLASS(mozBroken
, ":-moz-broken", 0, "", NS_EVENT_STATE_BROKEN
)
168 CSS_STATE_PSEUDO_CLASS(mozUserDisabled
, ":-moz-user-disabled", 0, "",
169 NS_EVENT_STATE_USERDISABLED
)
170 CSS_STATE_PSEUDO_CLASS(mozSuppressed
, ":-moz-suppressed", 0, "",
171 NS_EVENT_STATE_SUPPRESSED
)
172 CSS_STATE_PSEUDO_CLASS(mozLoading
, ":-moz-loading", 0, "", NS_EVENT_STATE_LOADING
)
173 CSS_STATE_PSEUDO_CLASS(mozTypeUnsupported
, ":-moz-type-unsupported", 0, "",
174 NS_EVENT_STATE_TYPE_UNSUPPORTED
)
175 CSS_STATE_PSEUDO_CLASS(mozTypeUnsupportedPlatform
, ":-moz-type-unsupported-platform", 0, "",
176 NS_EVENT_STATE_TYPE_UNSUPPORTED_PLATFORM
)
177 CSS_STATE_PSEUDO_CLASS(mozHandlerClickToPlay
, ":-moz-handler-clicktoplay", 0, "",
178 NS_EVENT_STATE_TYPE_CLICK_TO_PLAY
)
179 CSS_STATE_PSEUDO_CLASS(mozHandlerPlayPreview
, ":-moz-handler-playpreview", 0, "",
180 NS_EVENT_STATE_TYPE_PLAY_PREVIEW
)
181 CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableUpdatable
, ":-moz-handler-vulnerable-updatable", 0, "",
182 NS_EVENT_STATE_VULNERABLE_UPDATABLE
)
183 CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableNoUpdate
, ":-moz-handler-vulnerable-no-update", 0, "",
184 NS_EVENT_STATE_VULNERABLE_NO_UPDATE
)
185 CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled
, ":-moz-handler-disabled", 0, "",
186 NS_EVENT_STATE_HANDLER_DISABLED
)
187 CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked
, ":-moz-handler-blocked", 0, "",
188 NS_EVENT_STATE_HANDLER_BLOCKED
)
189 CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed
, ":-moz-handler-crashed", 0, "",
190 NS_EVENT_STATE_HANDLER_CRASHED
)
192 CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel
,
193 ":-moz-math-increment-script-level", 0, "",
194 NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL
)
197 // http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
198 CSS_STATE_PSEUDO_CLASS(required
, ":required", 0, "", NS_EVENT_STATE_REQUIRED
)
199 CSS_STATE_PSEUDO_CLASS(optional
, ":optional", 0, "", NS_EVENT_STATE_OPTIONAL
)
200 CSS_STATE_PSEUDO_CLASS(valid
, ":valid", 0, "", NS_EVENT_STATE_VALID
)
201 CSS_STATE_PSEUDO_CLASS(invalid
, ":invalid", 0, "", NS_EVENT_STATE_INVALID
)
202 CSS_STATE_PSEUDO_CLASS(inRange
, ":in-range", 0, "", NS_EVENT_STATE_INRANGE
)
203 CSS_STATE_PSEUDO_CLASS(outOfRange
, ":out-of-range", 0, "", NS_EVENT_STATE_OUTOFRANGE
)
204 CSS_STATE_PSEUDO_CLASS(defaultPseudo
, ":default", 0, "", NS_EVENT_STATE_DEFAULT
)
205 CSS_STATE_PSEUDO_CLASS(mozReadOnly
, ":-moz-read-only", 0, "",
206 NS_EVENT_STATE_MOZ_READONLY
)
207 CSS_STATE_PSEUDO_CLASS(mozReadWrite
, ":-moz-read-write", 0, "",
208 NS_EVENT_STATE_MOZ_READWRITE
)
209 CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid
, ":-moz-submit-invalid", 0, "",
210 NS_EVENT_STATE_MOZ_SUBMITINVALID
)
211 CSS_STATE_PSEUDO_CLASS(mozUIInvalid
, ":-moz-ui-invalid", 0, "",
212 NS_EVENT_STATE_MOZ_UI_INVALID
)
213 CSS_STATE_PSEUDO_CLASS(mozUIValid
, ":-moz-ui-valid", 0, "",
214 NS_EVENT_STATE_MOZ_UI_VALID
)
215 CSS_STATE_PSEUDO_CLASS(mozMeterOptimum
, ":-moz-meter-optimum", 0, "",
216 NS_EVENT_STATE_OPTIMUM
)
217 CSS_STATE_PSEUDO_CLASS(mozMeterSubOptimum
, ":-moz-meter-sub-optimum", 0, "",
218 NS_EVENT_STATE_SUB_OPTIMUM
)
219 CSS_STATE_PSEUDO_CLASS(mozMeterSubSubOptimum
, ":-moz-meter-sub-sub-optimum", 0, "",
220 NS_EVENT_STATE_SUB_SUB_OPTIMUM
)
222 // Those values should be parsed but do nothing.
223 CSS_STATE_PSEUDO_CLASS(mozPlaceholder
, ":-moz-placeholder", 0, "", NS_EVENT_STATE_IGNORE
)
225 #ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
226 #undef DEFINED_CSS_STATE_PSEUDO_CLASS
227 #undef CSS_STATE_PSEUDO_CLASS
230 #ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
231 #undef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
232 #undef CSS_STATE_DEPENDENT_PSEUDO_CLASS