--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -16,17 +16,16 @@
#include "nsComputedDOMStyle.h"
#include "nsContentDLF.h"
#include "nsContentUtils.h"
#include "nsCSSAnonBoxes.h"
#include "mozilla/css/ErrorReporter.h"
#include "nsCSSKeywords.h"
#include "nsCSSParser.h"
#include "nsCSSProps.h"
-#include "nsCSSPseudoClasses.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRendering.h"
#include "nsGenericHTMLFrameElement.h"
#include "mozilla/dom/Attr.h"
#include "nsDOMClassInfo.h"
#include "mozilla/EventListenerManager.h"
#include "nsFrame.h"
#include "nsGlobalWindow.h"
@@ -139,17 +138,16 @@ nsLayoutStatics::Initialize()
nsresult rv;
ContentParent::StartUp();
// Register static atoms. Note that nsGkAtoms must be initialized earlier
// than here, so it's done in NS_InitAtomTable() instead.
nsCSSAnonBoxes::RegisterStaticAtoms();
- nsCSSPseudoClasses::RegisterStaticAtoms();
nsCSSPseudoElements::RegisterStaticAtoms();
nsCSSKeywords::AddRefTable();
nsCSSProps::AddRefTable();
nsColorNames::AddRefTable();
NS_SetStaticAtomsDone();
StartupJSEnvironment();
--- a/layout/inspector/InspectorUtils.cpp
+++ b/layout/inspector/InspectorUtils.cpp
@@ -27,17 +27,16 @@
#include "ChildIterator.h"
#include "nsComputedDOMStyle.h"
#include "mozilla/EventStateManager.h"
#include "nsAtom.h"
#include "nsRange.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/CharacterData.h"
#include "mozilla/dom/Element.h"
-#include "nsCSSPseudoClasses.h"
#include "mozilla/dom/CSSLexer.h"
#include "mozilla/dom/InspectorUtilsBinding.h"
#include "mozilla/dom/ToJSValue.h"
#include "nsCSSParser.h"
#include "nsCSSProps.h"
#include "nsCSSValue.h"
#include "nsColor.h"
#include "mozilla/StyleSetHandleInlines.h"
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -14,17 +14,16 @@
#include "mozilla/ServoBindingTypes.h"
#include "mozilla/ServoElementSnapshot.h"
#include "mozilla/css/SheetLoadData.h"
#include "mozilla/css/SheetParsingMode.h"
#include "mozilla/css/URLMatchingFunction.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/ComputedTimingFunction.h"
#include "nsChangeHint.h"
-#include "nsCSSPseudoClasses.h"
#include "nsIDocument.h"
#include "nsStyleStruct.h"
/*
* API for Servo to access Gecko data structures.
*
* Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
* Functions beginning with Servo_ are implemented in Servo and invoked from Gecko.
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -182,17 +182,16 @@ rusty-enums = [
"mozilla::StyleGridTrackBreadth",
"mozilla::StyleOverscrollBehavior",
"mozilla::StyleWhiteSpace",
"nsStyleImageType",
"nsStyleSVGPaintType",
"nsStyleSVGFallbackType",
"nsINode_BooleanFlag",
"mozilla::CSSPseudoElementType",
- "mozilla::CSSPseudoClassType",
"mozilla::LookAndFeel_ColorID",
"mozilla::LookAndFeel_FontID",
"nsStyleTransformMatrix::MatrixTransformOperator",
"mozilla::StyleGeometryBox",
"mozilla::SystemColor",
]
constified-enum-variants = [
{ enum = "nsCSSPropertyID", variants = ["eCSSProperty_COUNT.*"] },
@@ -227,17 +226,16 @@ whitelist-types = [
"mozilla::ComputedTimingFunction::BeforeFlag",
"mozilla::SeenPtrs",
"mozilla::ServoElementSnapshot.*",
"mozilla::ComputedStyle",
"mozilla::ServoStyleSheet",
"mozilla::ServoStyleSheetInner",
"mozilla::ServoStyleSetSizes",
"mozilla::ServoTraversalStatistics",
- "mozilla::CSSPseudoClassType",
"mozilla::css::ErrorReporter",
"mozilla::css::LoaderReusableStyleSheets",
"mozilla::css::SheetLoadData",
"mozilla::css::SheetParsingMode",
"mozilla::css::URLMatchingFunction",
"mozilla::dom::IterationCompositeOperation",
"mozilla::dom::StyleChildrenIterator",
"mozilla::HalfCorner",
--- a/layout/style/ServoStyleRule.cpp
+++ b/layout/style/ServoStyleRule.cpp
@@ -7,17 +7,16 @@
/* representation of CSSStyleRule for stylo */
#include "mozilla/ServoStyleRule.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoDeclarationBlock.h"
#include "mozilla/dom/CSSStyleRuleBinding.h"
-#include "nsCSSPseudoClasses.h"
#include "mozAutoDocUpdate.h"
using namespace mozilla::dom;
namespace mozilla {
// -- ServoStyleRuleDeclaration ---------------------------------------
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -37,18 +37,16 @@ EXPORTS += [
'nsCSSKeywords.h',
'nsCSSParser.h',
'nsCSSPropAliasList.h',
'nsCSSPropertyID.h',
'nsCSSPropertyIDSet.h',
'nsCSSPropList.h',
'nsCSSPropLogicalGroupList.h',
'nsCSSProps.h',
- 'nsCSSPseudoClasses.h',
- 'nsCSSPseudoClassList.h',
'nsCSSPseudoElementList.h',
'nsCSSPseudoElements.h',
'nsCSSScanner.h',
'nsCSSValue.h',
'nsDOMCSSAttrDeclaration.h',
'nsDOMCSSDeclaration.h',
'nsDOMCSSRGBColor.h',
'nsICSSDeclaration.h',
@@ -185,17 +183,16 @@ UNIFIED_SOURCES += [
'MediaList.cpp',
'MediaQueryList.cpp',
'nsAnimationManager.cpp',
'nsComputedDOMStyle.cpp',
'nsCSSCounterStyleRule.cpp',
'nsCSSFontFaceRule.cpp',
'nsCSSKeywords.cpp',
'nsCSSProps.cpp',
- 'nsCSSPseudoClasses.cpp',
'nsCSSScanner.cpp',
'nsCSSValue.cpp',
'nsDOMCSSAttrDeclaration.cpp',
'nsDOMCSSDeclaration.cpp',
'nsDOMCSSRect.cpp',
'nsDOMCSSRGBColor.cpp',
'nsDOMCSSValueList.cpp',
'nsFontFaceLoader.cpp',
@@ -236,18 +233,16 @@ UNIFIED_SOURCES += [
'StyleAnimationValue.cpp',
'StylePrefs.cpp',
'StyleSheet.cpp',
'URLExtraData.cpp',
]
SOURCES += [
'nsCSSAnonBoxes.cpp',
- # Both nsCSSPseudoElements.cpp and nsCSSPseudoClasses.cpp defined a
- # 'mozPlaceholder' static atom.
'nsCSSPseudoElements.cpp',
# nsLayoutStylesheetCache.cpp uses nsExceptionHandler.h, which includes
# windows.h.
'nsLayoutStylesheetCache.cpp',
]
if CONFIG['CC_TYPE'] == 'msvc':
# Needed for gCSSAnonBoxAtoms.
SOURCES['nsCSSAnonBoxes.cpp'].flags += ['-Zc:externConstexpr']
deleted file mode 100644
--- a/layout/style/nsCSSPseudoClassList.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* atom list for CSS pseudo-classes */
-
-/*
- * This file contains the list of nsAtoms and their values for CSS
- * pseudo-classes. It is designed to be used as inline input to
- * nsCSSPseudoClasses.cpp *only* through the magic of C preprocessing.
- * All entries must be enclosed in the macros CSS_PSEUDO_CLASS,
- * CSS_STATE_DEPENDENT_PSEUDO_CLASS, or CSS_STATE_PSEUDO_CLASS which
- * will have cruel and unusual things done to them. The entries should
- * be kept in some sort of logical order. The common arguments to these
- * macros are:
- * name_ : The C++ identifier used for the atom (which will be a member
- * of nsCSSPseudoClasses)
- * value_ : The pseudo-class as a string, including the initial colon,
- * used as the string value of the atom.
- * flags_ : A bitfield containing flags defined in nsCSSPseudoClasses.h
- * pref_ : The name of the preference controlling whether the
- * pseudo-class is recognized by the parser, or the empty
- * string if it's unconditional.
- * CSS_STATE_PSEUDO_CLASS has an additional argument:
- * bit_ : The event state bit or bits that corresponds to the
- * pseudo-class, i.e., causes it to match (only one bit
- * required to match).
- * CSS_STATE_DEPENDENT_PSEUDO_CLASS has an additional argument:
- * bit_ : The event state bits that affect whether the pseudo-class
- * matches. Matching depends on a customized per-class
- * algorithm which should be defined in SelectorMatches() in
- * nsCSSRuleProcessor.cpp.
- *
- * If CSS_STATE_PSEUDO_CLASS is not defined, it'll be automatically
- * defined to CSS_STATE_DEPENDENT_PSEUDO_CLASS;
- * if CSS_STATE_DEPENDENT_PSEUDO_CLASS is not defined, it'll be
- * automatically defined to CSS_PSEUDO_CLASS.
- */
-
-// OUTPUT_CLASS=nsCSSPseudoClasses
-// MACRO_NAME=CSS_PSEUDO_CLASS
-
-#ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
-#error "CSS_STATE_DEPENDENT_PSEUDO_CLASS shouldn't be defined"
-#endif
-
-#ifndef CSS_STATE_DEPENDENT_PSEUDO_CLASS
-#define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
- CSS_PSEUDO_CLASS(_name, _value, _flags, _pref)
-#define DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
-#endif
-
-#ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
-#error "CSS_STATE_PSEUDO_CLASS shouldn't be defined"
-#endif
-
-#ifndef CSS_STATE_PSEUDO_CLASS
-#define CSS_STATE_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
- CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit)
-#define DEFINED_CSS_STATE_PSEUDO_CLASS
-#endif
-
-// The CSS_PSEUDO_CLASS entries should all come before the
-// CSS_STATE_PSEUDO_CLASS entries. The CSS_PSEUDO_CLASS entry order
-// must be the same as the order of cases in SelectorMatches. :not
-// must be the last CSS_PSEUDO_CLASS.
-
-CSS_PSEUDO_CLASS(empty, ":empty", 0, "")
-CSS_PSEUDO_CLASS(mozOnlyWhitespace, ":-moz-only-whitespace", 0, "")
-CSS_PSEUDO_CLASS(lang, ":lang", 0, "")
-CSS_PSEUDO_CLASS(root, ":root", 0, "")
-CSS_PSEUDO_CLASS(any, ":-moz-any", 0, "")
-
-CSS_PSEUDO_CLASS(firstChild, ":first-child", 0, "")
-CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node", 0, "")
-CSS_PSEUDO_CLASS(lastChild, ":last-child", 0, "")
-CSS_PSEUDO_CLASS(lastNode, ":-moz-last-node", 0, "")
-CSS_PSEUDO_CLASS(onlyChild, ":only-child", 0, "")
-CSS_PSEUDO_CLASS(firstOfType, ":first-of-type", 0, "")
-CSS_PSEUDO_CLASS(lastOfType, ":last-of-type", 0, "")
-CSS_PSEUDO_CLASS(onlyOfType, ":only-of-type", 0, "")
-CSS_PSEUDO_CLASS(nthChild, ":nth-child", 0, "")
-CSS_PSEUDO_CLASS(nthLastChild, ":nth-last-child", 0, "")
-CSS_PSEUDO_CLASS(nthOfType, ":nth-of-type", 0, "")
-CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type", 0, "")
-
-// Match nodes that are HTML but not XHTML
-CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html", 0, "")
-
-// Matches nodes that are in a native-anonymous subtree (i.e., nodes in
-// a subtree of C++ anonymous content constructed by Gecko for its own
-// purposes).
-CSS_PSEUDO_CLASS(mozNativeAnonymous, ":-moz-native-anonymous",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
-
-CSS_PSEUDO_CLASS(mozUseShadowTreeRoot, ":-moz-use-shadow-tree-root",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
-
-// -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
-// to match based on the locale's chrome direction
-CSS_PSEUDO_CLASS(mozLocaleDir, ":-moz-locale-dir", 0, "")
-
-// -moz-lwtheme may be used to match a document that has a lightweight theme
-CSS_PSEUDO_CLASS(mozLWTheme, ":-moz-lwtheme", 0, "")
-
-// -moz-lwtheme-brighttext matches a document that has a dark lightweight theme
-CSS_PSEUDO_CLASS(mozLWThemeBrightText, ":-moz-lwtheme-brighttext", 0, "")
-
-// -moz-lwtheme-darktext matches a document that has a bright lightweight theme
-CSS_PSEUDO_CLASS(mozLWThemeDarkText, ":-moz-lwtheme-darktext", 0, "")
-
-// Matches anything when the containing window is inactive
-CSS_PSEUDO_CLASS(mozWindowInactive, ":-moz-window-inactive", 0, "")
-
-// Matches any table elements that have a nonzero border attribute,
-// according to HTML integer attribute parsing rules.
-CSS_PSEUDO_CLASS(mozTableBorderNonzero, ":-moz-table-border-nonzero",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "")
-
-// Matches HTML frame/iframe elements which are mozbrowser.
-CSS_PSEUDO_CLASS(mozBrowserFrame, ":-moz-browser-frame",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "")
-
-// Matches whatever the contextual reference elements are for the
-// matching operation.
-CSS_PSEUDO_CLASS(scope, ":scope", 0, "")
-
-// :not needs to come at the end of the non-bit pseudo-class list, since
-// it doesn't actually get directly matched on in SelectorMatches.
-CSS_PSEUDO_CLASS(negation, ":not", 0, "")
-
-// :dir(ltr) and :dir(rtl) match elements whose resolved
-// directionality in the markup language is ltr or rtl respectively.
-CSS_STATE_DEPENDENT_PSEUDO_CLASS(dir, ":dir", 0, "",
- NS_EVENT_STATE_LTR | NS_EVENT_STATE_RTL)
-
-CSS_STATE_PSEUDO_CLASS(link, ":link", 0, "", NS_EVENT_STATE_UNVISITED)
-// what matches :link or :visited
-CSS_STATE_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link", 0, "",
- NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
-CSS_STATE_PSEUDO_CLASS(anyLink, ":any-link", 0, "",
- NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
-CSS_STATE_PSEUDO_CLASS(visited, ":visited", 0, "", NS_EVENT_STATE_VISITED)
-
-CSS_STATE_PSEUDO_CLASS(active, ":active", 0, "", NS_EVENT_STATE_ACTIVE)
-CSS_STATE_PSEUDO_CLASS(checked, ":checked", 0, "", NS_EVENT_STATE_CHECKED)
-CSS_STATE_PSEUDO_CLASS(disabled, ":disabled", 0, "", NS_EVENT_STATE_DISABLED)
-CSS_STATE_PSEUDO_CLASS(enabled, ":enabled", 0, "", NS_EVENT_STATE_ENABLED)
-CSS_STATE_PSEUDO_CLASS(focus, ":focus", 0, "", NS_EVENT_STATE_FOCUS)
-CSS_STATE_PSEUDO_CLASS(focusWithin, ":focus-within", 0, "", NS_EVENT_STATE_FOCUS_WITHIN)
-CSS_STATE_PSEUDO_CLASS(hover, ":hover", 0, "", NS_EVENT_STATE_HOVER)
-CSS_STATE_PSEUDO_CLASS(mozDragOver, ":-moz-drag-over", 0, "", NS_EVENT_STATE_DRAGOVER)
-CSS_STATE_PSEUDO_CLASS(target, ":target", 0, "", NS_EVENT_STATE_URLTARGET)
-CSS_STATE_PSEUDO_CLASS(indeterminate, ":indeterminate", 0, "",
- NS_EVENT_STATE_INDETERMINATE)
-
-CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighlighted, ":-moz-devtools-highlighted",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
- NS_EVENT_STATE_DEVTOOLS_HIGHLIGHTED)
-CSS_STATE_PSEUDO_CLASS(mozStyleeditorTransitioning, ":-moz-styleeditor-transitioning",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
- NS_EVENT_STATE_STYLEEDITOR_TRANSITIONING)
-
-// Matches the element which is being displayed full-screen, and
-// any containing frames.
-CSS_STATE_PSEUDO_CLASS(fullscreen, ":fullscreen",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME,
- "full-screen-api.unprefix.enabled",
- NS_EVENT_STATE_FULL_SCREEN)
-CSS_STATE_PSEUDO_CLASS(mozFullScreen, ":-moz-full-screen", 0, "", NS_EVENT_STATE_FULL_SCREEN)
-
-// Matches if the element is focused and should show a focus ring
-CSS_STATE_PSEUDO_CLASS(mozFocusRing, ":-moz-focusring", 0, "", NS_EVENT_STATE_FOCUSRING)
-
-// Image, object, etc state pseudo-classes
-CSS_STATE_PSEUDO_CLASS(mozBroken, ":-moz-broken", 0, "", NS_EVENT_STATE_BROKEN)
-CSS_STATE_PSEUDO_CLASS(mozLoading, ":-moz-loading", 0, "", NS_EVENT_STATE_LOADING)
-
-CSS_STATE_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_USERDISABLED)
-CSS_STATE_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_SUPPRESSED)
-CSS_STATE_PSEUDO_CLASS(mozHandlerClickToPlay, ":-moz-handler-clicktoplay",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_TYPE_CLICK_TO_PLAY)
-CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableUpdatable, ":-moz-handler-vulnerable-updatable",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_VULNERABLE_UPDATABLE)
-CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableNoUpdate, ":-moz-handler-vulnerable-no-update",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_VULNERABLE_NO_UPDATE)
-CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_HANDLER_DISABLED)
-CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_HANDLER_BLOCKED)
-CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed, ":-moz-handler-crashed",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_HANDLER_CRASHED)
-
-CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel,
- ":-moz-math-increment-script-level", 0, "",
- NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL)
-
-CSS_STATE_PSEUDO_CLASS(mozHasDirAttr, ":-moz-has-dir-attr",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
- NS_EVENT_STATE_HAS_DIR_ATTR)
-CSS_STATE_PSEUDO_CLASS(mozDirAttrLTR, ":-moz-dir-attr-ltr",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
- NS_EVENT_STATE_DIR_ATTR_LTR)
-CSS_STATE_PSEUDO_CLASS(mozDirAttrRTL, ":-moz-dir-attr-rtl",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
- NS_EVENT_STATE_DIR_ATTR_RTL)
-CSS_STATE_PSEUDO_CLASS(mozDirAttrLikeAuto, ":-moz-dir-attr-like-auto",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS, "",
- NS_EVENT_STATE_DIR_ATTR_LIKE_AUTO)
-
-CSS_STATE_PSEUDO_CLASS(mozAutofill, ":-moz-autofill",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_AUTOFILL)
-CSS_STATE_PSEUDO_CLASS(mozAutofillPreview, ":-moz-autofill-preview",
- CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
- NS_EVENT_STATE_AUTOFILL_PREVIEW)
-
-// CSS 3 UI
-// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
-CSS_STATE_PSEUDO_CLASS(required, ":required", 0, "", NS_EVENT_STATE_REQUIRED)
-CSS_STATE_PSEUDO_CLASS(optional, ":optional", 0, "", NS_EVENT_STATE_OPTIONAL)
-CSS_STATE_PSEUDO_CLASS(valid, ":valid", 0, "", NS_EVENT_STATE_VALID)
-CSS_STATE_PSEUDO_CLASS(invalid, ":invalid", 0, "", NS_EVENT_STATE_INVALID)
-CSS_STATE_PSEUDO_CLASS(inRange, ":in-range", 0, "", NS_EVENT_STATE_INRANGE)
-CSS_STATE_PSEUDO_CLASS(outOfRange, ":out-of-range", 0, "", NS_EVENT_STATE_OUTOFRANGE)
-CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", 0, "", NS_EVENT_STATE_DEFAULT)
-CSS_STATE_PSEUDO_CLASS(placeholderShown, ":placeholder-shown", 0, "",
- NS_EVENT_STATE_PLACEHOLDERSHOWN)
-CSS_STATE_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only", 0, "",
- NS_EVENT_STATE_MOZ_READONLY)
-CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write", 0, "",
- NS_EVENT_STATE_MOZ_READWRITE)
-CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", 0, "",
- NS_EVENT_STATE_MOZ_SUBMITINVALID)
-CSS_STATE_PSEUDO_CLASS(mozUIInvalid, ":-moz-ui-invalid", 0, "",
- NS_EVENT_STATE_MOZ_UI_INVALID)
-CSS_STATE_PSEUDO_CLASS(mozUIValid, ":-moz-ui-valid", 0, "",
- NS_EVENT_STATE_MOZ_UI_VALID)
-CSS_STATE_PSEUDO_CLASS(mozMeterOptimum, ":-moz-meter-optimum", 0, "",
- NS_EVENT_STATE_OPTIMUM)
-CSS_STATE_PSEUDO_CLASS(mozMeterSubOptimum, ":-moz-meter-sub-optimum", 0, "",
- NS_EVENT_STATE_SUB_OPTIMUM)
-CSS_STATE_PSEUDO_CLASS(mozMeterSubSubOptimum, ":-moz-meter-sub-sub-optimum", 0, "",
- NS_EVENT_STATE_SUB_SUB_OPTIMUM)
-
-// Those values should be parsed but do nothing.
-CSS_STATE_PSEUDO_CLASS(mozPlaceholder, ":-moz-placeholder", 0, "", NS_EVENT_STATE_IGNORE)
-
-#ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
-#undef DEFINED_CSS_STATE_PSEUDO_CLASS
-#undef CSS_STATE_PSEUDO_CLASS
-#endif
-
-#ifdef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
-#undef DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
-#undef CSS_STATE_DEPENDENT_PSEUDO_CLASS
-#endif
deleted file mode 100644
--- a/layout/style/nsCSSPseudoClasses.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* atom list for CSS pseudo-classes */
-
-#include "mozilla/ArrayUtils.h"
-
-#include "nsCSSPseudoClasses.h"
-#include "nsCSSPseudoElements.h"
-#include "nsStaticAtom.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/dom/Element.h"
-#include "nsString.h"
-#include "nsAttrValueInlines.h"
-#include "nsIMozBrowserFrame.h"
-#include "nsStyleUtil.h"
-
-using namespace mozilla;
-
-#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- static_assert(!((flags_) & CSS_PSEUDO_CLASS_ENABLED_IN_CHROME) || \
- ((flags_) & CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS), \
- "Pseudo-class '" #name_ "' is enabled in chrome, so it " \
- "should also be enabled in UA sheets");
-#include "nsCSSPseudoClassList.h"
-#undef CSS_PSEUDO_CLASS
-
-namespace detail {
-
-struct CSSPseudoClassAtoms
-{
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- NS_STATIC_ATOM_DECL_STRING(name_, value_)
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- NS_STATIC_ATOM_DECL_ATOM(name_)
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-};
-
-MOZ_PUSH_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
-static constexpr CSSPseudoClassAtoms sCSSPseudoClassAtoms = {
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- NS_STATIC_ATOM_INIT_STRING(value_)
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- NS_STATIC_ATOM_INIT_ATOM(CSSPseudoClassAtoms, name_, value_)
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-};
-MOZ_POP_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
-
-} // namespace detail
-
-class CSSPseudoClassAtoms
-{
-public:
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- NS_STATIC_ATOM_DECL_PTR(name_)
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-};
-
-#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- NS_STATIC_ATOM_DEFN_PTR(CSSPseudoClassAtoms, name_)
-#include "nsCSSPseudoClassList.h"
-#undef CSS_PSEUDO_CLASS
-
-static const nsStaticAtomSetup sCSSPseudoClassAtomSetup[] = {
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- NS_STATIC_ATOM_SETUP( \
- ::detail::sCSSPseudoClassAtoms, CSSPseudoClassAtoms, name_)
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-};
-
-// Flags data for each of the pseudo-classes, which must be separate
-// from the previous array since there's no place for it in
-// nsStaticAtomSetup.
-/* static */ const uint32_t
-nsCSSPseudoClasses::kPseudoClassFlags[] = {
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- flags_,
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-};
-
-/* static */ bool
-nsCSSPseudoClasses::sPseudoClassEnabled[] = {
- // If the pseudo class has any "ENABLED_IN" flag set, it is disabled by
- // default. Note that, if a pseudo class has pref, whatever its default value
- // is, it'll later be changed in nsCSSPseudoClasses::RegisterStaticAtoms() If
- // the pseudo class has "ENABLED_IN" flags but doesn't have a pref, it is an
- // internal pseudo class which is disabled elsewhere.
- #define IS_ENABLED_BY_DEFAULT(flags_) \
- (!((flags_) & CSS_PSEUDO_CLASS_ENABLED_MASK))
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- IS_ENABLED_BY_DEFAULT(flags_),
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
- #undef IS_ENABLED_BY_DEFAULT
-};
-
-void nsCSSPseudoClasses::RegisterStaticAtoms()
-{
- NS_RegisterStaticAtoms(sCSSPseudoClassAtomSetup);
-
- #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
- if (pref_[0]) { \
- auto idx = static_cast<CSSPseudoElementTypeBase>(Type::name_); \
- Preferences::AddBoolVarCache(&sPseudoClassEnabled[idx], pref_); \
- }
- #include "nsCSSPseudoClassList.h"
- #undef CSS_PSEUDO_CLASS
-}
-
-bool
-nsCSSPseudoClasses::HasStringArg(Type aType)
-{
- return aType == Type::lang ||
- aType == Type::mozLocaleDir ||
- aType == Type::dir;
-}
-
-bool
-nsCSSPseudoClasses::HasNthPairArg(Type aType)
-{
- return aType == Type::nthChild ||
- aType == Type::nthLastChild ||
- aType == Type::nthOfType ||
- aType == Type::nthLastOfType;
-}
-
-void
-nsCSSPseudoClasses::PseudoTypeToString(Type aType, nsAString& aString)
-{
- MOZ_ASSERT(aType < Type::Count, "Unexpected type");
- auto idx = static_cast<CSSPseudoClassTypeBase>(aType);
- (*sCSSPseudoClassAtomSetup[idx].mAtomp)->ToString(aString);
-}
-
-/* static */ CSSPseudoClassType
-nsCSSPseudoClasses::GetPseudoType(nsAtom* aAtom, EnabledState aEnabledState)
-{
- Maybe<uint32_t> index =
- nsStaticAtomUtils::Lookup(aAtom, sCSSPseudoClassAtomSetup);
- if (index.isSome()) {
- Type type = Type(*index);
- if (IsEnabled(type, aEnabledState)) {
- return type;
- }
- }
- return Type::NotPseudo;
-}
-
-/* static */ bool
-nsCSSPseudoClasses::IsUserActionPseudoClass(Type aType)
-{
- // See http://dev.w3.org/csswg/selectors4/#useraction-pseudos
- return aType == Type::hover ||
- aType == Type::active ||
- aType == Type::focus;
-}
-
-/* static */ bool
-nsCSSPseudoClasses::StringPseudoMatches(const mozilla::dom::Element* aElement,
- CSSPseudoClassType aPseudo,
- const char16_t* aString,
- const nsIDocument* aDocument,
- EventStates aStateMask,
- bool* const aDependence)
-{
-
- switch (aPseudo) {
- case CSSPseudoClassType::mozLocaleDir:
- {
- const bool docIsRTL =
- aDocument->GetDocumentState().HasState(NS_DOCUMENT_STATE_RTL_LOCALE);
- nsDependentString dirString(aString);
-
- if (dirString.EqualsLiteral("rtl")) {
- if (!docIsRTL) {
- return false;
- }
- } else if (dirString.EqualsLiteral("ltr")) {
- if (docIsRTL) {
- return false;
- }
- } else {
- // Selectors specifying other directions never match.
- return false;
- }
- }
- break;
-
- case CSSPseudoClassType::dir:
- {
- if (aDependence) {
- EventStates states = sPseudoClassStateDependences[
- static_cast<CSSPseudoClassTypeBase>(aPseudo)];
- if (aStateMask.HasAtLeastOneOfStates(states)) {
- *aDependence = true;
- return false;
- }
- }
-
- // If we only had to consider HTML, directionality would be
- // exclusively LTR or RTL.
- //
- // However, in markup languages where there is no direction attribute
- // we have to consider the possibility that neither dir(rtl) nor
- // dir(ltr) matches.
- EventStates state = aElement->StyleState();
- nsDependentString dirString(aString);
-
- if (dirString.EqualsLiteral("rtl")) {
- if (!state.HasState(NS_EVENT_STATE_RTL)) {
- return false;
- }
- } else if (dirString.EqualsLiteral("ltr")) {
- if (!state.HasState(NS_EVENT_STATE_LTR)) {
- return false;
- }
- } else {
- // Selectors specifying other directions never match.
- return false;
- }
- }
- break;
-
- default: MOZ_ASSERT_UNREACHABLE("Called StringPseudoMatches() with unknown string-like pseudo");
- }
- return true;
-}
-
-/* static */ Maybe<bool>
-nsCSSPseudoClasses::MatchesElement(Type aType, const dom::Element* aElement)
-{
- return Nothing();
-}
-
-// The dependencies for all state dependent pseudo-classes (i.e. those declared
-// using CSS_STATE_DEPENDENT_PSEUDO_CLASS, the only one of which is :dir(...)).
-const EventStates
-nsCSSPseudoClasses::sPseudoClassStateDependences[size_t(CSSPseudoClassType::Count) + 2] = {
-#define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
- EventStates(),
-#define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _states) \
- _states,
-#include "nsCSSPseudoClassList.h"
-#undef CSS_STATE_DEPENDENT_PSEUDO_CLASS
-#undef CSS_PSEUDO_CLASS
- // Add more entries for our fake values to make sure we can't
- // index out of bounds into this array no matter what.
- EventStates(),
- EventStates()
-};
deleted file mode 100644
--- a/layout/style/nsCSSPseudoClasses.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* atom list for CSS pseudo-classes */
-
-#ifndef nsCSSPseudoClasses_h___
-#define nsCSSPseudoClasses_h___
-
-#include "nsStringFwd.h"
-#include "mozilla/CSSEnabledState.h"
-#include "mozilla/EventStates.h"
-#include "mozilla/Maybe.h"
-
-// The following two flags along with the pref defines where this pseudo
-// class can be used:
-// * If none of the two flags is presented, the pref completely controls
-// the availability of this pseudo class. And in that case, if it has
-// no pref, this property is usable everywhere.
-// * If any of the flags is set, this pseudo class is always enabled in
-// the specific contexts regardless of the value of the pref. If there
-// is no pref for this pseudo class at all in this case, it is an
-// internal-only pseudo class, which cannot be used anywhere else.
-#define CSS_PSEUDO_CLASS_ENABLED_MASK (3<<0)
-#define CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS (1<<0)
-#define CSS_PSEUDO_CLASS_ENABLED_IN_CHROME (1<<1)
-#define CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME \
- (CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS | CSS_PSEUDO_CLASS_ENABLED_IN_CHROME)
-
-class nsAtom;
-class nsIDocument;
-
-namespace mozilla {
-namespace dom {
-class Element;
-} // namespace dom
-
-// The total count of CSSPseudoClassType is less than 256,
-// so use uint8_t as its underlying type.
-typedef uint8_t CSSPseudoClassTypeBase;
-enum class CSSPseudoClassType : CSSPseudoClassTypeBase
-{
-#define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
- _name,
-#include "nsCSSPseudoClassList.h"
-#undef CSS_PSEUDO_CLASS
- Count,
- NotPseudo, // This value MUST be second last! SelectorMatches depends on it.
- MAX
-};
-
-} // namespace mozilla
-
-class nsCSSPseudoClasses
-{
- typedef mozilla::CSSPseudoClassType Type;
- typedef mozilla::CSSEnabledState EnabledState;
-
-public:
- static void RegisterStaticAtoms();
-
- static Type GetPseudoType(nsAtom* aAtom, EnabledState aEnabledState);
- static bool HasStringArg(Type aType);
- static bool HasNthPairArg(Type aType);
- static bool HasSelectorListArg(Type aType) {
- return aType == Type::any;
- }
- static bool IsUserActionPseudoClass(Type aType);
-
- // Should only be used on types other than Count and NotPseudoClass
- static void PseudoTypeToString(Type aType, nsAString& aString);
-
- static bool IsEnabled(Type aType, EnabledState aEnabledState)
- {
- auto index = static_cast<size_t>(aType);
- MOZ_ASSERT(index < static_cast<size_t>(Type::Count));
- if (sPseudoClassEnabled[index] ||
- aEnabledState == EnabledState::eIgnoreEnabledState) {
- return true;
- }
- auto flags = kPseudoClassFlags[index];
- if (((aEnabledState & EnabledState::eInChrome) &&
- (flags & CSS_PSEUDO_CLASS_ENABLED_IN_CHROME)) ||
- ((aEnabledState & EnabledState::eInUASheets) &&
- (flags & CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS))) {
- return true;
- }
- return false;
- }
-
- // Checks whether the given pseudo class matches the element.
- // It returns Some(result) if this function is able to check
- // the pseudo-class, Nothing() otherwise.
- static mozilla::Maybe<bool>
- MatchesElement(Type aType, const mozilla::dom::Element* aElement);
-
- /**
- * Checks if a function-like ident-containing pseudo (:pseudo(ident))
- * matches a given element.
- *
- * Returns true if it parses and matches, Some(false) if it
- * parses but does not match. Asserts if it fails to parse; only
- * call this when you're sure it's a string-like pseudo.
- *
- * In Servo mode, please ensure that UpdatePossiblyStaleDocumentState()
- * has been called first.
- *
- * @param aElement The element we are trying to match
- * @param aPseudo The name of the pseudoselector
- * @param aString The identifier inside the pseudoselector (cannot be null)
- * @param aDocument The document
- * @param aStateMask Mask containing states which we should exclude.
- * Ignored if aDependence is null
- * @param aDependence Pointer to be set to true if we ignored a state due to
- * aStateMask. Can be null.
- */
- static bool StringPseudoMatches(const mozilla::dom::Element* aElement,
- mozilla::CSSPseudoClassType aPseudo,
- const char16_t* aString,
- const nsIDocument* aDocument,
- mozilla::EventStates aStateMask,
- bool* const aDependence = nullptr);
-
- static const mozilla::EventStates sPseudoClassStateDependences[size_t(Type::Count) + 2];
-
-private:
- static const uint32_t kPseudoClassFlags[size_t(Type::Count)];
- static bool sPseudoClassEnabled[size_t(Type::Count)];
-};
-
-#endif /* nsCSSPseudoClasses_h___ */
--- a/servo/components/style/gecko/generated/structs.rs
+++ b/servo/components/style/gecko/generated/structs.rs
@@ -12262,107 +12262,16 @@ pub mod root {
concat!(
"Offset of field: ",
stringify!(EffectCompositor),
"::",
stringify!(mIsInPreTraverse)
)
);
}
- pub type CSSPseudoClassTypeBase = u8;
- #[repr(u8)]
- #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
- pub enum CSSPseudoClassType {
- empty = 0,
- mozOnlyWhitespace = 1,
- lang = 2,
- root = 3,
- any = 4,
- firstChild = 5,
- firstNode = 6,
- lastChild = 7,
- lastNode = 8,
- onlyChild = 9,
- firstOfType = 10,
- lastOfType = 11,
- onlyOfType = 12,
- nthChild = 13,
- nthLastChild = 14,
- nthOfType = 15,
- nthLastOfType = 16,
- mozIsHTML = 17,
- mozNativeAnonymous = 18,
- mozUseShadowTreeRoot = 19,
- mozLocaleDir = 20,
- mozLWTheme = 21,
- mozLWThemeBrightText = 22,
- mozLWThemeDarkText = 23,
- mozWindowInactive = 24,
- mozTableBorderNonzero = 25,
- mozBrowserFrame = 26,
- scope = 27,
- negation = 28,
- dir = 29,
- link = 30,
- mozAnyLink = 31,
- anyLink = 32,
- visited = 33,
- active = 34,
- checked = 35,
- disabled = 36,
- enabled = 37,
- focus = 38,
- focusWithin = 39,
- hover = 40,
- mozDragOver = 41,
- target = 42,
- indeterminate = 43,
- mozDevtoolsHighlighted = 44,
- mozStyleeditorTransitioning = 45,
- fullscreen = 46,
- mozFullScreen = 47,
- mozFocusRing = 48,
- mozBroken = 49,
- mozLoading = 50,
- mozUserDisabled = 51,
- mozSuppressed = 52,
- mozHandlerClickToPlay = 53,
- mozHandlerVulnerableUpdatable = 54,
- mozHandlerVulnerableNoUpdate = 55,
- mozHandlerDisabled = 56,
- mozHandlerBlocked = 57,
- mozHandlerCrashed = 58,
- mozMathIncrementScriptLevel = 59,
- mozHasDirAttr = 60,
- mozDirAttrLTR = 61,
- mozDirAttrRTL = 62,
- mozDirAttrLikeAuto = 63,
- mozAutofill = 64,
- mozAutofillPreview = 65,
- required = 66,
- optional = 67,
- valid = 68,
- invalid = 69,
- inRange = 70,
- outOfRange = 71,
- defaultPseudo = 72,
- placeholderShown = 73,
- mozReadOnly = 74,
- mozReadWrite = 75,
- mozSubmitInvalid = 76,
- mozUIInvalid = 77,
- mozUIValid = 78,
- mozMeterOptimum = 79,
- mozMeterSubOptimum = 80,
- mozMeterSubSubOptimum = 81,
- mozPlaceholder = 82,
- Count = 83,
- NotPseudo = 84,
- MAX = 85,
- }
#[repr(C)]
pub struct GeckoFont {
pub gecko: root::nsStyleFont,
}
#[test]
fn bindgen_test_layout_GeckoFont() {
assert_eq!(
::std::mem::size_of::<GeckoFont>(),
--- a/servo/components/style/gecko/non_ts_pseudo_class_list.rs
+++ b/servo/components/style/gecko/non_ts_pseudo_class_list.rs
@@ -23,19 +23,16 @@
*
* The `string` and `keyword` variables will be applied to pseudoclasses that are of the form of
* functions with string or keyword arguments.
*
* Pending pseudo-classes:
*
* :scope -> <style scoped>, pending discussion.
*
- * This follows the order defined in layout/style/nsCSSPseudoClassList.h when
- * possible.
- *
* $gecko_type can be either "_" or an ident in Gecko's CSSPseudoClassType.
* $state can be either "_" or an expression of type ElementState. If present,
* the semantics are that the pseudo-class matches if any of the bits in
* $state are set on the element.
* $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
* see selector_parser.rs for more details.
*/
--- a/servo/components/style/gecko/selector_parser.rs
+++ b/servo/components/style/gecko/selector_parser.rs
@@ -1,17 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Gecko-specific bits for selector-parsing.
use cssparser::{BasicParseError, BasicParseErrorKind, Parser, ToCss, Token, CowRcStr, SourceLocation};
use element_state::{DocumentState, ElementState};
-use gecko_bindings::structs::{self, CSSPseudoClassType};
+use gecko_bindings::structs;
use gecko_bindings::structs::RawServoSelectorList;
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use invalidation::element::document_state::InvalidationMatchingData;
use selector_parser::{Direction, SelectorParser};
use selectors::SelectorList;
use selectors::parser::{self as selector_parser, Selector, Visit, SelectorParseErrorKind};
use selectors::visitor::SelectorVisitor;
use std::fmt;
@@ -253,38 +253,16 @@ impl NonTSPseudoClass {
NonTSPseudoClass::MozWindowInactive |
// Similar for the document themes.
NonTSPseudoClass::MozLWTheme |
NonTSPseudoClass::MozLWThemeBrightText |
NonTSPseudoClass::MozLWThemeDarkText
)
}
- /// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType.
- pub fn to_gecko_pseudoclasstype(&self) -> Option<CSSPseudoClassType> {
- macro_rules! gecko_type {
- (_) => (None);
- ($gecko_type:ident) =>
- (Some(::gecko_bindings::structs::CSSPseudoClassType::$gecko_type));
- }
- macro_rules! pseudo_class_geckotype {
- (bare: [$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*],
- string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => {
- match *self {
- $(NonTSPseudoClass::$name => gecko_type!($gecko_type),)*
- $(NonTSPseudoClass::$s_name(..) => gecko_type!($s_gecko_type),)*
- NonTSPseudoClass::MozLocaleDir(_) => gecko_type!(mozLocaleDir),
- NonTSPseudoClass::Dir(_) => gecko_type!(dir),
- NonTSPseudoClass::MozAny(_) => gecko_type!(any),
- }
- }
- }
- apply_non_ts_list!(pseudo_class_geckotype)
- }
-
/// Returns true if the evaluation of the pseudo-class depends on the
/// element's attributes.
pub fn is_attr_based(&self) -> bool {
matches!(*self,
NonTSPseudoClass::MozTableBorderNonzero |
NonTSPseudoClass::MozBrowserFrame |
NonTSPseudoClass::Lang(..))
}