зеркало из https://github.com/mozilla/gecko-dev.git
Bug 938334 - Use "Type" as parameter in nsCSSPseudoElements methods instead of "nsIAtom*" when it makes sense to do so. r=dbaron
This commit is contained in:
Родитель
1ee69e25d6
Коммит
639a9f2efd
|
@ -69,7 +69,7 @@ nsCSSPseudoElements::IsCSS2PseudoElement(nsIAtom *aAtom)
|
|||
aAtom == nsCSSPseudoElements::firstLine;
|
||||
NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aAtom) ||
|
||||
result ==
|
||||
PseudoElementHasFlags(aAtom, CSS_PSEUDO_ELEMENT_IS_CSS2),
|
||||
PseudoElementHasFlags(GetPseudoType(aAtom), CSS_PSEUDO_ELEMENT_IS_CSS2),
|
||||
"result doesn't match flags");
|
||||
return result;
|
||||
}
|
||||
|
@ -105,15 +105,10 @@ nsCSSPseudoElements::GetPseudoAtom(Type aType)
|
|||
}
|
||||
|
||||
/* static */ uint32_t
|
||||
nsCSSPseudoElements::FlagsForPseudoElement(nsIAtom *aAtom)
|
||||
nsCSSPseudoElements::FlagsForPseudoElement(const Type aType)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
|
||||
if (*CSSPseudoElements_info[i].mAtom == aAtom) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(i < ArrayLength(CSSPseudoElements_info),
|
||||
size_t index = static_cast<size_t>(aType);
|
||||
NS_ASSERTION(index < ArrayLength(CSSPseudoElements_flags),
|
||||
"argument must be a pseudo-element");
|
||||
return CSSPseudoElements_flags[i];
|
||||
return CSSPseudoElements_flags[index];
|
||||
}
|
||||
|
|
|
@ -40,10 +40,6 @@ public:
|
|||
|
||||
static bool IsCSS2PseudoElement(nsIAtom *aAtom);
|
||||
|
||||
static bool PseudoElementContainsElements(nsIAtom *aAtom) {
|
||||
return PseudoElementHasFlags(aAtom, CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS);
|
||||
}
|
||||
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value, _flags) \
|
||||
static nsICSSPseudoElement* _name;
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
|
@ -70,22 +66,26 @@ public:
|
|||
// Get the atom for a given Type. aType must be < ePseudo_PseudoElementCount
|
||||
static nsIAtom* GetPseudoAtom(Type aType);
|
||||
|
||||
static bool PseudoElementContainsElements(const Type aType) {
|
||||
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS);
|
||||
}
|
||||
|
||||
static bool PseudoElementSupportsStyleAttribute(nsIAtom *aAtom) {
|
||||
return PseudoElementHasFlags(aAtom, CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
|
||||
return PseudoElementHasFlags(GetPseudoType(aAtom), CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
|
||||
}
|
||||
|
||||
static bool PseudoElementSupportsStyleAttribute(const Type aType) {
|
||||
MOZ_ASSERT(aType < ePseudo_PseudoElementCount);
|
||||
return PseudoElementHasFlags(GetPseudoAtom(aType), CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
|
||||
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
|
||||
}
|
||||
|
||||
private:
|
||||
static uint32_t FlagsForPseudoElement(nsIAtom *aAtom);
|
||||
static uint32_t FlagsForPseudoElement(const Type aType);
|
||||
|
||||
// Does the given pseudo-element have all of the flags given?
|
||||
static bool PseudoElementHasFlags(nsIAtom *aAtom, uint32_t aFlags)
|
||||
static bool PseudoElementHasFlags(const Type aType, uint32_t aFlags)
|
||||
{
|
||||
return (FlagsForPseudoElement(aAtom) & aFlags) == aFlags;
|
||||
return (FlagsForPseudoElement(aType) & aFlags) == aFlags;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -673,7 +673,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorRes
|
|||
topWithPseudoElementData = topWithPseudoElementData->GetParent();
|
||||
}
|
||||
NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(
|
||||
topWithPseudoElementData->GetPseudo()),
|
||||
topWithPseudoElementData->GetPseudoType()),
|
||||
"we should be in a pseudo-element that is expected to "
|
||||
"contain elements");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче