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 first argument to
16 * CSS_PSEUDO_CLASS is the C++ identifier of the atom. The second
17 * argument is the string value of the atom. The third argument is the
18 * name of the preference controlling whether the pseudo-class is
19 * recognized by the parser, or the empty string if it's unconditional.
21 * CSS_STATE_DEPENDENT_PSEUDO_CLASS and CSS_STATE_PSEUDO_CLASS also take
22 * the name of the state bits that the class corresponds to. Only one
23 * of the bits needs to match for a CSS_STATE_PSEUDO_CLASS to match;
24 * CSS_STATE_DEPENDENT_PSEUDO_CLASS matching depends on a customized per-class
25 * algorithm which should be defined in SelectorMatches() in
26 * nsCSSRuleProcessor.cpp.
28 * If CSS_STATE_PSEUDO_CLASS is not defined, it'll be automatically
29 * defined to CSS_STATE_DEPENDENT_PSEUDO_CLASS;
30 * if CSS_STATE_DEPENDENT_PSEUDO_CLASS is not defined, it'll be
31 * automatically defined to CSS_PSEUDO_CLASS.
34 // OUTPUT_CLASS=nsCSSPseudoClasses
35 // MACRO_NAME=CSS_PSEUDO_CLASS
37 #ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
38 #error "CSS_STATE_DEPENDENT_PSEUDO_CLASS shouldn't be defined"
41 #ifndef CSS_STATE_DEPENDENT_PSEUDO_CLASS
42 #define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _pref, _bit) \
43 CSS_PSEUDO_CLASS(_name, _value, _pref)
44 #define DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
47 #ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
48 #error "CSS_STATE_PSEUDO_CLASS shouldn't be defined"
51 #ifndef CSS_STATE_PSEUDO_CLASS
52 #define CSS_STATE_PSEUDO_CLASS(_name, _value, _pref, _bit) \
53 CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _pref, _bit)
54 #define DEFINED_CSS_STATE_PSEUDO_CLASS
57 // The CSS_PSEUDO_CLASS entries should all come before the
58 // CSS_STATE_PSEUDO_CLASS entries. The CSS_PSEUDO_CLASS entry order
59 // must be the same as the order of cases in SelectorMatches. :not
60 // must be the last CSS_PSEUDO_CLASS.
62 CSS_PSEUDO_CLASS(empty
, ":empty", "")
63 CSS_PSEUDO_CLASS(mozOnlyWhitespace
, ":-moz-only-whitespace", "")
64 CSS_PSEUDO_CLASS(mozEmptyExceptChildrenWithLocalname
, ":-moz-empty-except-children-with-localname", "")
65 CSS_PSEUDO_CLASS(lang
, ":lang", "")
66 CSS_PSEUDO_CLASS(mozBoundElement
, ":-moz-bound-element", "")
67 CSS_PSEUDO_CLASS(root
, ":root", "")
68 CSS_PSEUDO_CLASS(any
, ":-moz-any", "")
70 CSS_PSEUDO_CLASS(firstChild
, ":first-child", "")
71 CSS_PSEUDO_CLASS(firstNode
, ":-moz-first-node", "")
72 CSS_PSEUDO_CLASS(lastChild
, ":last-child", "")
73 CSS_PSEUDO_CLASS(lastNode
, ":-moz-last-node", "")
74 CSS_PSEUDO_CLASS(onlyChild
, ":only-child", "")
75 CSS_PSEUDO_CLASS(firstOfType
, ":first-of-type", "")
76 CSS_PSEUDO_CLASS(lastOfType
, ":last-of-type", "")
77 CSS_PSEUDO_CLASS(onlyOfType
, ":only-of-type", "")
78 CSS_PSEUDO_CLASS(nthChild
, ":nth-child", "")
79 CSS_PSEUDO_CLASS(nthLastChild
, ":nth-last-child", "")
80 CSS_PSEUDO_CLASS(nthOfType
, ":nth-of-type", "")
81 CSS_PSEUDO_CLASS(nthLastOfType
, ":nth-last-of-type", "")
83 // Match nodes that are HTML but not XHTML
84 CSS_PSEUDO_CLASS(mozIsHTML
, ":-moz-is-html", "")
86 // Matches anything when the specified look-and-feel metric is set
87 CSS_PSEUDO_CLASS(mozSystemMetric
, ":-moz-system-metric", "")
89 // -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
90 // to match based on the locale's chrome direction
91 CSS_PSEUDO_CLASS(mozLocaleDir
, ":-moz-locale-dir", "")
93 // -moz-lwtheme may be used to match a document that has a lightweight theme
94 CSS_PSEUDO_CLASS(mozLWTheme
, ":-moz-lwtheme", "")
96 // -moz-lwtheme-brighttext matches a document that has a dark lightweight theme
97 CSS_PSEUDO_CLASS(mozLWThemeBrightText
, ":-moz-lwtheme-brighttext", "")
99 // -moz-lwtheme-darktext matches a document that has a bright lightweight theme
100 CSS_PSEUDO_CLASS(mozLWThemeDarkText
, ":-moz-lwtheme-darktext", "")
102 // Matches anything when the containing window is inactive
103 CSS_PSEUDO_CLASS(mozWindowInactive
, ":-moz-window-inactive", "")
105 // Matches any table elements that have a nonzero border attribute,
106 // according to HTML integer attribute parsing rules.
107 CSS_PSEUDO_CLASS(mozTableBorderNonzero
, ":-moz-table-border-nonzero", "")
109 // Matches whatever the contextual reference elements are for the
110 // matching operation.
111 CSS_PSEUDO_CLASS(scope
, ":scope", "layout.css.scope-pseudo.enabled")
113 // :not needs to come at the end of the non-bit pseudo-class list, since
114 // it doesn't actually get directly matched on in SelectorMatches.
115 CSS_PSEUDO_CLASS(notPseudo
, ":not", "")
117 // :-moz-dir(ltr) and :-moz-dir(rtl) match elements whose resolved
118 // directionality in the markup language is ltr or rtl respectively
119 CSS_STATE_DEPENDENT_PSEUDO_CLASS(dir
, ":-moz-dir", "",
120 NS_EVENT_STATE_LTR
| NS_EVENT_STATE_RTL
)
122 CSS_STATE_PSEUDO_CLASS(link
, ":link", "", NS_EVENT_STATE_UNVISITED
)
123 // what matches :link or :visited
124 CSS_STATE_PSEUDO_CLASS(mozAnyLink
, ":-moz-any-link", "",
125 NS_EVENT_STATE_VISITED
| NS_EVENT_STATE_UNVISITED
)
126 CSS_STATE_PSEUDO_CLASS(visited
, ":visited", "", NS_EVENT_STATE_VISITED
)
128 CSS_STATE_PSEUDO_CLASS(active
, ":active", "", NS_EVENT_STATE_ACTIVE
)
129 CSS_STATE_PSEUDO_CLASS(checked
, ":checked", "", NS_EVENT_STATE_CHECKED
)
130 CSS_STATE_PSEUDO_CLASS(disabled
, ":disabled", "", NS_EVENT_STATE_DISABLED
)
131 CSS_STATE_PSEUDO_CLASS(enabled
, ":enabled", "", NS_EVENT_STATE_ENABLED
)
132 CSS_STATE_PSEUDO_CLASS(focus
, ":focus", "", NS_EVENT_STATE_FOCUS
)
133 CSS_STATE_PSEUDO_CLASS(hover
, ":hover", "", NS_EVENT_STATE_HOVER
)
134 CSS_STATE_PSEUDO_CLASS(mozDragOver
, ":-moz-drag-over", "", NS_EVENT_STATE_DRAGOVER
)
135 CSS_STATE_PSEUDO_CLASS(target
, ":target", "", NS_EVENT_STATE_URLTARGET
)
136 CSS_STATE_PSEUDO_CLASS(indeterminate
, ":indeterminate", "",
137 NS_EVENT_STATE_INDETERMINATE
)
139 CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighlighted
, ":-moz-devtools-highlighted", "",
140 NS_EVENT_STATE_DEVTOOLS_HIGHLIGHTED
)
142 // Matches the element which is being displayed full-screen, and
143 // any containing frames.
144 CSS_STATE_PSEUDO_CLASS(mozFullScreen
, ":-moz-full-screen", "", NS_EVENT_STATE_FULL_SCREEN
)
146 // Matches any element which is an ancestor of the DOM full-screen element,
147 // or an ancestor of a containing frame of the full-screen element.
148 CSS_STATE_PSEUDO_CLASS(mozFullScreenAncestor
, ":-moz-full-screen-ancestor", "", NS_EVENT_STATE_FULL_SCREEN_ANCESTOR
)
150 // Matches if the element is focused and should show a focus ring
151 CSS_STATE_PSEUDO_CLASS(mozFocusRing
, ":-moz-focusring", "", NS_EVENT_STATE_FOCUSRING
)
153 // Image, object, etc state pseudo-classes
154 CSS_STATE_PSEUDO_CLASS(mozBroken
, ":-moz-broken", "", NS_EVENT_STATE_BROKEN
)
155 CSS_STATE_PSEUDO_CLASS(mozUserDisabled
, ":-moz-user-disabled", "",
156 NS_EVENT_STATE_USERDISABLED
)
157 CSS_STATE_PSEUDO_CLASS(mozSuppressed
, ":-moz-suppressed", "",
158 NS_EVENT_STATE_SUPPRESSED
)
159 CSS_STATE_PSEUDO_CLASS(mozLoading
, ":-moz-loading", "", NS_EVENT_STATE_LOADING
)
160 CSS_STATE_PSEUDO_CLASS(mozTypeUnsupported
, ":-moz-type-unsupported", "",
161 NS_EVENT_STATE_TYPE_UNSUPPORTED
)
162 CSS_STATE_PSEUDO_CLASS(mozTypeUnsupportedPlatform
, ":-moz-type-unsupported-platform", "",
163 NS_EVENT_STATE_TYPE_UNSUPPORTED_PLATFORM
)
164 CSS_STATE_PSEUDO_CLASS(mozHandlerClickToPlay
, ":-moz-handler-clicktoplay", "",
165 NS_EVENT_STATE_TYPE_CLICK_TO_PLAY
)
166 CSS_STATE_PSEUDO_CLASS(mozHandlerPlayPreview
, ":-moz-handler-playpreview", "",
167 NS_EVENT_STATE_TYPE_PLAY_PREVIEW
)
168 CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableUpdatable
, ":-moz-handler-vulnerable-updatable", "",
169 NS_EVENT_STATE_VULNERABLE_UPDATABLE
)
170 CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableNoUpdate
, ":-moz-handler-vulnerable-no-update", "",
171 NS_EVENT_STATE_VULNERABLE_NO_UPDATE
)
172 CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled
, ":-moz-handler-disabled", "",
173 NS_EVENT_STATE_HANDLER_DISABLED
)
174 CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked
, ":-moz-handler-blocked", "",
175 NS_EVENT_STATE_HANDLER_BLOCKED
)
176 CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed
, ":-moz-handler-crashed", "",
177 NS_EVENT_STATE_HANDLER_CRASHED
)
179 CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel
,
180 ":-moz-math-increment-script-level", "",
181 NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL
)
184 // http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
185 CSS_STATE_PSEUDO_CLASS(required
, ":required", "", NS_EVENT_STATE_REQUIRED
)
186 CSS_STATE_PSEUDO_CLASS(optional
, ":optional", "", NS_EVENT_STATE_OPTIONAL
)
187 CSS_STATE_PSEUDO_CLASS(valid
, ":valid", "", NS_EVENT_STATE_VALID
)
188 CSS_STATE_PSEUDO_CLASS(invalid
, ":invalid", "", NS_EVENT_STATE_INVALID
)
189 CSS_STATE_PSEUDO_CLASS(inRange
, ":in-range", "", NS_EVENT_STATE_INRANGE
)
190 CSS_STATE_PSEUDO_CLASS(outOfRange
, ":out-of-range", "", NS_EVENT_STATE_OUTOFRANGE
)
191 CSS_STATE_PSEUDO_CLASS(defaultPseudo
, ":default", "", NS_EVENT_STATE_DEFAULT
)
192 CSS_STATE_PSEUDO_CLASS(mozReadOnly
, ":-moz-read-only", "",
193 NS_EVENT_STATE_MOZ_READONLY
)
194 CSS_STATE_PSEUDO_CLASS(mozReadWrite
, ":-moz-read-write", "",
195 NS_EVENT_STATE_MOZ_READWRITE
)
196 CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid
, ":-moz-submit-invalid", "",
197 NS_EVENT_STATE_MOZ_SUBMITINVALID
)
198 CSS_STATE_PSEUDO_CLASS(mozUIInvalid
, ":-moz-ui-invalid", "",
199 NS_EVENT_STATE_MOZ_UI_INVALID
)
200 CSS_STATE_PSEUDO_CLASS(mozUIValid
, ":-moz-ui-valid", "",
201 NS_EVENT_STATE_MOZ_UI_VALID
)
202 CSS_STATE_PSEUDO_CLASS(mozMeterOptimum
, ":-moz-meter-optimum", "",
203 NS_EVENT_STATE_OPTIMUM
)
204 CSS_STATE_PSEUDO_CLASS(mozMeterSubOptimum
, ":-moz-meter-sub-optimum", "",
205 NS_EVENT_STATE_SUB_OPTIMUM
)
206 CSS_STATE_PSEUDO_CLASS(mozMeterSubSubOptimum
, ":-moz-meter-sub-sub-optimum", "",
207 NS_EVENT_STATE_SUB_SUB_OPTIMUM
)
209 // Those values should be parsed but do nothing.
210 CSS_STATE_PSEUDO_CLASS(mozPlaceholder
, ":-moz-placeholder", "", NS_EVENT_STATE_IGNORE
)
212 #ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
213 #undef DEFINED_CSS_STATE_PSEUDO_CLASS
214 #undef CSS_STATE_PSEUDO_CLASS
217 #ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
218 #undef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
219 #undef CSS_STATE_DEPENDENT_PSEUDO_CLASS