Bug 922669 - Part 3: Add a flag to represent whether a pseudo-element supports user action pseudo-classes (currently :hover and :active). r=bz

This commit is contained in:
Cameron McCormack 2013-11-28 17:46:38 +11:00
Родитель 836792bdcf
Коммит f8487d13bf
3 изменённых файлов: 46 добавлений и 15 удалений

Просмотреть файл

@ -52,16 +52,28 @@ CSS_PSEUDO_ELEMENT(mozMathStretchy, ":-moz-math-stretchy", 0)
CSS_PSEUDO_ELEMENT(mozMathAnonymous, ":-moz-math-anonymous", 0)
// HTML5 Forms pseudo elements
CSS_PSEUDO_ELEMENT(mozNumberWrapper, ":-moz-number-wrapper", 0)
CSS_PSEUDO_ELEMENT(mozNumberText, ":-moz-number-text", 0)
CSS_PSEUDO_ELEMENT(mozNumberSpinBox, ":-moz-number-spin-box", 0)
CSS_PSEUDO_ELEMENT(mozNumberSpinUp, ":-moz-number-spin-up", 0)
CSS_PSEUDO_ELEMENT(mozNumberSpinDown, ":-moz-number-spin-down", 0)
CSS_PSEUDO_ELEMENT(mozProgressBar, ":-moz-progress-bar", 0)
CSS_PSEUDO_ELEMENT(mozRangeTrack, ":-moz-range-track", 0)
CSS_PSEUDO_ELEMENT(mozRangeProgress, ":-moz-range-progress", 0)
CSS_PSEUDO_ELEMENT(mozRangeThumb, ":-moz-range-thumb", 0)
CSS_PSEUDO_ELEMENT(mozMeterBar, ":-moz-meter-bar", 0)
CSS_PSEUDO_ELEMENT(mozPlaceholder, ":-moz-placeholder", 0)
CSS_PSEUDO_ELEMENT(mozNumberWrapper, ":-moz-number-wrapper",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozNumberText, ":-moz-number-text",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozNumberSpinBox, ":-moz-number-spin-box",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozNumberSpinUp, ":-moz-number-spin-up",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozNumberSpinDown, ":-moz-number-spin-down",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozProgressBar, ":-moz-progress-bar",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozRangeTrack, ":-moz-range-track",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozRangeProgress, ":-moz-range-progress",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozRangeThumb, ":-moz-range-thumb",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozMeterBar, ":-moz-meter-bar",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozPlaceholder, ":-moz-placeholder",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozColorSwatch, ":-moz-color-swatch",
CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE)
CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE |
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)

Просмотреть файл

@ -112,3 +112,10 @@ nsCSSPseudoElements::FlagsForPseudoElement(const Type aType)
"argument must be a pseudo-element");
return CSSPseudoElements_flags[index];
}
/* static */ bool
nsCSSPseudoElements::PseudoElementSupportsUserActionState(const Type aType)
{
return PseudoElementHasFlags(aType,
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE);
}

Просмотреть файл

@ -13,7 +13,7 @@
// Is this pseudo-element a CSS2 pseudo-element that can be specified
// with the single colon syntax (in addition to the double-colon syntax,
// which can be used for all pseudo-elements)?
#define CSS_PSEUDO_ELEMENT_IS_CSS2 (1<<0)
#define CSS_PSEUDO_ELEMENT_IS_CSS2 (1<<0)
// Is this pseudo-element a pseudo-element that can contain other
// elements?
// (Currently pseudo-elements are either leaves of the tree (relative to
@ -22,10 +22,16 @@
// possible that in the future there might be container pseudo-elements
// that form a properly nested tree structure. If that happens, we
// should probably split this flag into two.)
#define CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS (1<<1)
#define CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS (1<<1)
// Flag to add the ability to take into account style attribute set for the
// pseudo element (by default it's ignored).
#define CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE (1<<2)
#define CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE (1<<2)
// Flag that indicate the pseudo-element supports a user action pseudo-class
// following it, such as :active or :hover. This would normally correspond
// to whether the pseudo-element is tree-like, but we don't support these
// pseudo-classes on ::before and ::after generated content yet. See
// http://dev.w3.org/csswg/selectors4/#pseudo-elements.
#define CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE (1<<3)
// Empty class derived from nsIAtom so that function signatures can
// require an atom from this atom list.
@ -79,6 +85,12 @@ public:
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
}
static bool PseudoElementSupportsUserActionState(nsIAtom *aAtom) {
return PseudoElementSupportsUserActionState(GetPseudoType(aAtom));
}
static bool PseudoElementSupportsUserActionState(const Type aType);
private:
static uint32_t FlagsForPseudoElement(const Type aType);