mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1082899 patch 2 - Add flags storage and accessors for nsCSSPseudoClasses. r=birtles
The code for this is basically copied from nsCSSPseudoElements.
This commit is contained in:
parent
82e1493c16
commit
815d094367
@ -25,6 +25,7 @@ using namespace mozilla;
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
|
||||
// Array of nsStaticAtom for each of the pseudo-classes.
|
||||
static const nsStaticAtom CSSPseudoClasses_info[] = {
|
||||
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
|
||||
NS_STATIC_ATOM(name_##_pseudo_class_buffer, &sPseudoClass_##name_),
|
||||
@ -32,6 +33,16 @@ static const nsStaticAtom CSSPseudoClasses_info[] = {
|
||||
#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
|
||||
// nsStaticAtom.
|
||||
static const uint32_t CSSPseudoClasses_flags[] = {
|
||||
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
|
||||
flags_,
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
};
|
||||
|
||||
static bool sPseudoClassEnabled[] = {
|
||||
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
|
||||
true,
|
||||
@ -99,3 +110,13 @@ nsCSSPseudoClasses::IsUserActionPseudoClass(Type aType)
|
||||
aType == ePseudoClass_active ||
|
||||
aType == ePseudoClass_focus;
|
||||
}
|
||||
|
||||
/* static */ uint32_t
|
||||
nsCSSPseudoClasses::FlagsForPseudoClass(const Type aType)
|
||||
{
|
||||
size_t index = static_cast<size_t>(aType);
|
||||
NS_ASSERTION(index < ArrayLength(CSSPseudoClasses_flags),
|
||||
"argument must be a pseudo-class");
|
||||
return CSSPseudoClasses_flags[index];
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,15 @@ public:
|
||||
|
||||
// Should only be used on types other than Count and NotPseudoClass
|
||||
static void PseudoTypeToString(Type aType, nsAString& aString);
|
||||
|
||||
private:
|
||||
static uint32_t FlagsForPseudoClass(const Type aType);
|
||||
|
||||
// Does the given pseudo-class have all of the flags given?
|
||||
static bool PseudoClassHasFlags(const Type aType, uint32_t aFlags)
|
||||
{
|
||||
return (FlagsForPseudoClass(aType) & aFlags) == aFlags;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* nsCSSPseudoClasses_h___ */
|
||||
|
@ -25,6 +25,7 @@ using namespace mozilla;
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
|
||||
// Array of nsStaticAtom for each of the pseudo-elements.
|
||||
static const nsStaticAtom CSSPseudoElements_info[] = {
|
||||
#define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
|
||||
NS_STATIC_ATOM(name_##_pseudo_element_buffer, (nsIAtom**)&nsCSSPseudoElements::name_),
|
||||
@ -32,11 +33,9 @@ static const nsStaticAtom CSSPseudoElements_info[] = {
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
};
|
||||
|
||||
// Separate from the array above so that we can have an array of
|
||||
// nsStaticAtom (to pass to NS_RegisterStaticAtoms and
|
||||
// nsAtomListUtils::IsMember), but with corresponding indices (so the
|
||||
// i-th element of this array is the flags for the i-th pseudo-element
|
||||
// in the previous array).
|
||||
// Flags data for each of the pseudo-elements, which must be separate
|
||||
// from the previous array since there's no place for it in
|
||||
// nsStaticAtom.
|
||||
static const uint32_t CSSPseudoElements_flags[] = {
|
||||
#define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
|
||||
flags_,
|
||||
|
Loading…
Reference in New Issue
Block a user