layout/style/nsCSSPseudoClassList.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/nsCSSPseudoClassList.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,220 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/* atom list for CSS pseudo-classes */
    1.10 +
    1.11 +/*
    1.12 + * This file contains the list of nsIAtoms and their values for CSS
    1.13 + * pseudo-classes.  It is designed to be used as inline input to
    1.14 + * nsCSSPseudoClasses.cpp *only* through the magic of C preprocessing.
    1.15 + * All entries must be enclosed in the macros CSS_PSEUDO_CLASS,
    1.16 + * CSS_STATE_DEPENDENT_PSEUDO_CLASS, or CSS_STATE_PSEUDO_CLASS which
    1.17 + * will have cruel and unusual things done to them.  The entries should
    1.18 + * be kept in some sort of logical order.  The first argument to
    1.19 + * CSS_PSEUDO_CLASS is the C++ identifier of the atom.  The second
    1.20 + * argument is the string value of the atom.  The third argument is the
    1.21 + * name of the preference controlling whether the pseudo-class is
    1.22 + * recognized by the parser, or the empty string if it's unconditional.
    1.23 + *
    1.24 + * CSS_STATE_DEPENDENT_PSEUDO_CLASS and CSS_STATE_PSEUDO_CLASS also take
    1.25 + * the name of the state bits that the class corresponds to.  Only one
    1.26 + * of the bits needs to match for a CSS_STATE_PSEUDO_CLASS to match;
    1.27 + * CSS_STATE_DEPENDENT_PSEUDO_CLASS matching depends on a customized per-class
    1.28 + * algorithm which should be defined in SelectorMatches() in
    1.29 + * nsCSSRuleProcessor.cpp.
    1.30 + *
    1.31 + * If CSS_STATE_PSEUDO_CLASS is not defined, it'll be automatically
    1.32 + * defined to CSS_STATE_DEPENDENT_PSEUDO_CLASS;
    1.33 + * if CSS_STATE_DEPENDENT_PSEUDO_CLASS is not defined, it'll be
    1.34 + * automatically defined to CSS_PSEUDO_CLASS.
    1.35 + */
    1.36 +
    1.37 +// OUTPUT_CLASS=nsCSSPseudoClasses
    1.38 +// MACRO_NAME=CSS_PSEUDO_CLASS
    1.39 +
    1.40 +#ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
    1.41 +#error "CSS_STATE_DEPENDENT_PSEUDO_CLASS shouldn't be defined"
    1.42 +#endif
    1.43 +
    1.44 +#ifndef CSS_STATE_DEPENDENT_PSEUDO_CLASS
    1.45 +#define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _pref, _bit)  \
    1.46 +  CSS_PSEUDO_CLASS(_name, _value, _pref)
    1.47 +#define DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
    1.48 +#endif
    1.49 +
    1.50 +#ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
    1.51 +#error "CSS_STATE_PSEUDO_CLASS shouldn't be defined"
    1.52 +#endif
    1.53 +
    1.54 +#ifndef CSS_STATE_PSEUDO_CLASS
    1.55 +#define CSS_STATE_PSEUDO_CLASS(_name, _value, _pref, _bit)      \
    1.56 +  CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _pref, _bit)
    1.57 +#define DEFINED_CSS_STATE_PSEUDO_CLASS
    1.58 +#endif
    1.59 +
    1.60 +// The CSS_PSEUDO_CLASS entries should all come before the
    1.61 +// CSS_STATE_PSEUDO_CLASS entries.  The CSS_PSEUDO_CLASS entry order
    1.62 +// must be the same as the order of cases in SelectorMatches.  :not
    1.63 +// must be the last CSS_PSEUDO_CLASS.
    1.64 +
    1.65 +CSS_PSEUDO_CLASS(empty, ":empty", "")
    1.66 +CSS_PSEUDO_CLASS(mozOnlyWhitespace, ":-moz-only-whitespace", "")
    1.67 +CSS_PSEUDO_CLASS(mozEmptyExceptChildrenWithLocalname, ":-moz-empty-except-children-with-localname", "")
    1.68 +CSS_PSEUDO_CLASS(lang, ":lang", "")
    1.69 +CSS_PSEUDO_CLASS(mozBoundElement, ":-moz-bound-element", "")
    1.70 +CSS_PSEUDO_CLASS(root, ":root", "")
    1.71 +CSS_PSEUDO_CLASS(any, ":-moz-any", "")
    1.72 +
    1.73 +CSS_PSEUDO_CLASS(firstChild, ":first-child", "")
    1.74 +CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node", "")
    1.75 +CSS_PSEUDO_CLASS(lastChild, ":last-child", "")
    1.76 +CSS_PSEUDO_CLASS(lastNode, ":-moz-last-node", "")
    1.77 +CSS_PSEUDO_CLASS(onlyChild, ":only-child", "")
    1.78 +CSS_PSEUDO_CLASS(firstOfType, ":first-of-type", "")
    1.79 +CSS_PSEUDO_CLASS(lastOfType, ":last-of-type", "")
    1.80 +CSS_PSEUDO_CLASS(onlyOfType, ":only-of-type", "")
    1.81 +CSS_PSEUDO_CLASS(nthChild, ":nth-child", "")
    1.82 +CSS_PSEUDO_CLASS(nthLastChild, ":nth-last-child", "")
    1.83 +CSS_PSEUDO_CLASS(nthOfType, ":nth-of-type", "")
    1.84 +CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type", "")
    1.85 +
    1.86 +// Match nodes that are HTML but not XHTML
    1.87 +CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html", "")
    1.88 +
    1.89 +// Matches anything when the specified look-and-feel metric is set
    1.90 +CSS_PSEUDO_CLASS(mozSystemMetric, ":-moz-system-metric", "")
    1.91 +
    1.92 +// -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
    1.93 +// to match based on the locale's chrome direction
    1.94 +CSS_PSEUDO_CLASS(mozLocaleDir, ":-moz-locale-dir", "")
    1.95 +
    1.96 +// -moz-lwtheme may be used to match a document that has a lightweight theme
    1.97 +CSS_PSEUDO_CLASS(mozLWTheme, ":-moz-lwtheme", "")
    1.98 +
    1.99 +// -moz-lwtheme-brighttext matches a document that has a dark lightweight theme
   1.100 +CSS_PSEUDO_CLASS(mozLWThemeBrightText, ":-moz-lwtheme-brighttext", "")
   1.101 +
   1.102 +// -moz-lwtheme-darktext matches a document that has a bright lightweight theme
   1.103 +CSS_PSEUDO_CLASS(mozLWThemeDarkText, ":-moz-lwtheme-darktext", "")
   1.104 +
   1.105 +// Matches anything when the containing window is inactive
   1.106 +CSS_PSEUDO_CLASS(mozWindowInactive, ":-moz-window-inactive", "")
   1.107 +
   1.108 +// Matches any table elements that have a nonzero border attribute,
   1.109 +// according to HTML integer attribute parsing rules.
   1.110 +CSS_PSEUDO_CLASS(mozTableBorderNonzero, ":-moz-table-border-nonzero", "")
   1.111 +
   1.112 +// Matches whatever the contextual reference elements are for the
   1.113 +// matching operation.
   1.114 +CSS_PSEUDO_CLASS(scope, ":scope", "layout.css.scope-pseudo.enabled")
   1.115 +
   1.116 +// :not needs to come at the end of the non-bit pseudo-class list, since
   1.117 +// it doesn't actually get directly matched on in SelectorMatches.
   1.118 +CSS_PSEUDO_CLASS(notPseudo, ":not", "")
   1.119 +
   1.120 +// :-moz-dir(ltr) and :-moz-dir(rtl) match elements whose resolved
   1.121 +// directionality in the markup language is ltr or rtl respectively
   1.122 +CSS_STATE_DEPENDENT_PSEUDO_CLASS(dir, ":-moz-dir", "",
   1.123 +                                 NS_EVENT_STATE_LTR | NS_EVENT_STATE_RTL)
   1.124 +
   1.125 +CSS_STATE_PSEUDO_CLASS(link, ":link", "", NS_EVENT_STATE_UNVISITED)
   1.126 +// what matches :link or :visited
   1.127 +CSS_STATE_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link", "",
   1.128 +                       NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
   1.129 +CSS_STATE_PSEUDO_CLASS(visited, ":visited", "", NS_EVENT_STATE_VISITED)
   1.130 +
   1.131 +CSS_STATE_PSEUDO_CLASS(active, ":active", "", NS_EVENT_STATE_ACTIVE)
   1.132 +CSS_STATE_PSEUDO_CLASS(checked, ":checked", "", NS_EVENT_STATE_CHECKED)
   1.133 +CSS_STATE_PSEUDO_CLASS(disabled, ":disabled", "", NS_EVENT_STATE_DISABLED)
   1.134 +CSS_STATE_PSEUDO_CLASS(enabled, ":enabled", "", NS_EVENT_STATE_ENABLED)
   1.135 +CSS_STATE_PSEUDO_CLASS(focus, ":focus", "", NS_EVENT_STATE_FOCUS)
   1.136 +CSS_STATE_PSEUDO_CLASS(hover, ":hover", "", NS_EVENT_STATE_HOVER)
   1.137 +CSS_STATE_PSEUDO_CLASS(mozDragOver, ":-moz-drag-over", "", NS_EVENT_STATE_DRAGOVER)
   1.138 +CSS_STATE_PSEUDO_CLASS(target, ":target", "", NS_EVENT_STATE_URLTARGET)
   1.139 +CSS_STATE_PSEUDO_CLASS(indeterminate, ":indeterminate", "",
   1.140 +                       NS_EVENT_STATE_INDETERMINATE)
   1.141 +
   1.142 +CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighlighted, ":-moz-devtools-highlighted", "",
   1.143 +                       NS_EVENT_STATE_DEVTOOLS_HIGHLIGHTED)
   1.144 +
   1.145 +// Matches the element which is being displayed full-screen, and
   1.146 +// any containing frames.
   1.147 +CSS_STATE_PSEUDO_CLASS(mozFullScreen, ":-moz-full-screen", "", NS_EVENT_STATE_FULL_SCREEN)
   1.148 +
   1.149 +// Matches any element which is an ancestor of the DOM full-screen element,
   1.150 +// or an ancestor of a containing frame of the full-screen element.
   1.151 +CSS_STATE_PSEUDO_CLASS(mozFullScreenAncestor, ":-moz-full-screen-ancestor", "", NS_EVENT_STATE_FULL_SCREEN_ANCESTOR)
   1.152 +
   1.153 +// Matches if the element is focused and should show a focus ring
   1.154 +CSS_STATE_PSEUDO_CLASS(mozFocusRing, ":-moz-focusring", "", NS_EVENT_STATE_FOCUSRING)
   1.155 +
   1.156 +// Image, object, etc state pseudo-classes
   1.157 +CSS_STATE_PSEUDO_CLASS(mozBroken, ":-moz-broken", "", NS_EVENT_STATE_BROKEN)
   1.158 +CSS_STATE_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled", "",
   1.159 +                       NS_EVENT_STATE_USERDISABLED)
   1.160 +CSS_STATE_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed", "",
   1.161 +                       NS_EVENT_STATE_SUPPRESSED)
   1.162 +CSS_STATE_PSEUDO_CLASS(mozLoading, ":-moz-loading", "", NS_EVENT_STATE_LOADING)
   1.163 +CSS_STATE_PSEUDO_CLASS(mozTypeUnsupported, ":-moz-type-unsupported", "",
   1.164 +                       NS_EVENT_STATE_TYPE_UNSUPPORTED)
   1.165 +CSS_STATE_PSEUDO_CLASS(mozTypeUnsupportedPlatform, ":-moz-type-unsupported-platform", "",
   1.166 +                       NS_EVENT_STATE_TYPE_UNSUPPORTED_PLATFORM)
   1.167 +CSS_STATE_PSEUDO_CLASS(mozHandlerClickToPlay, ":-moz-handler-clicktoplay", "",
   1.168 +                       NS_EVENT_STATE_TYPE_CLICK_TO_PLAY)
   1.169 +CSS_STATE_PSEUDO_CLASS(mozHandlerPlayPreview, ":-moz-handler-playpreview", "",
   1.170 +                       NS_EVENT_STATE_TYPE_PLAY_PREVIEW)
   1.171 +CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableUpdatable, ":-moz-handler-vulnerable-updatable", "",
   1.172 +                       NS_EVENT_STATE_VULNERABLE_UPDATABLE)
   1.173 +CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableNoUpdate, ":-moz-handler-vulnerable-no-update", "",
   1.174 +                       NS_EVENT_STATE_VULNERABLE_NO_UPDATE)
   1.175 +CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled", "",
   1.176 +                       NS_EVENT_STATE_HANDLER_DISABLED)
   1.177 +CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked", "",
   1.178 +                       NS_EVENT_STATE_HANDLER_BLOCKED)
   1.179 +CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed, ":-moz-handler-crashed", "",
   1.180 +                       NS_EVENT_STATE_HANDLER_CRASHED)
   1.181 +
   1.182 +CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel,
   1.183 +                       ":-moz-math-increment-script-level", "",
   1.184 +                       NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL)
   1.185 +
   1.186 +// CSS 3 UI
   1.187 +// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
   1.188 +CSS_STATE_PSEUDO_CLASS(required, ":required", "", NS_EVENT_STATE_REQUIRED)
   1.189 +CSS_STATE_PSEUDO_CLASS(optional, ":optional", "", NS_EVENT_STATE_OPTIONAL)
   1.190 +CSS_STATE_PSEUDO_CLASS(valid, ":valid", "", NS_EVENT_STATE_VALID)
   1.191 +CSS_STATE_PSEUDO_CLASS(invalid, ":invalid", "", NS_EVENT_STATE_INVALID)
   1.192 +CSS_STATE_PSEUDO_CLASS(inRange, ":in-range", "", NS_EVENT_STATE_INRANGE)
   1.193 +CSS_STATE_PSEUDO_CLASS(outOfRange, ":out-of-range", "", NS_EVENT_STATE_OUTOFRANGE)
   1.194 +CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", "", NS_EVENT_STATE_DEFAULT)
   1.195 +CSS_STATE_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only", "",
   1.196 +                       NS_EVENT_STATE_MOZ_READONLY)
   1.197 +CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write", "",
   1.198 +                       NS_EVENT_STATE_MOZ_READWRITE)
   1.199 +CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", "",
   1.200 +                       NS_EVENT_STATE_MOZ_SUBMITINVALID)
   1.201 +CSS_STATE_PSEUDO_CLASS(mozUIInvalid, ":-moz-ui-invalid", "",
   1.202 +                       NS_EVENT_STATE_MOZ_UI_INVALID)
   1.203 +CSS_STATE_PSEUDO_CLASS(mozUIValid, ":-moz-ui-valid", "",
   1.204 +                       NS_EVENT_STATE_MOZ_UI_VALID)
   1.205 +CSS_STATE_PSEUDO_CLASS(mozMeterOptimum, ":-moz-meter-optimum", "",
   1.206 +                       NS_EVENT_STATE_OPTIMUM)
   1.207 +CSS_STATE_PSEUDO_CLASS(mozMeterSubOptimum, ":-moz-meter-sub-optimum", "",
   1.208 +                       NS_EVENT_STATE_SUB_OPTIMUM)
   1.209 +CSS_STATE_PSEUDO_CLASS(mozMeterSubSubOptimum, ":-moz-meter-sub-sub-optimum", "",
   1.210 +                       NS_EVENT_STATE_SUB_SUB_OPTIMUM)
   1.211 +
   1.212 +// Those values should be parsed but do nothing.
   1.213 +CSS_STATE_PSEUDO_CLASS(mozPlaceholder, ":-moz-placeholder", "", NS_EVENT_STATE_IGNORE)
   1.214 +
   1.215 +#ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
   1.216 +#undef DEFINED_CSS_STATE_PSEUDO_CLASS
   1.217 +#undef CSS_STATE_PSEUDO_CLASS
   1.218 +#endif
   1.219 +
   1.220 +#ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
   1.221 +#undef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
   1.222 +#undef CSS_STATE_DEPENDENT_PSEUDO_CLASS
   1.223 +#endif

mercurial