Backed out changesets 4e949692600a and 6f7ecae8e663 (bug 1269976) for bustage.

This commit is contained in:
Ryan VanderMeulen 2016-05-09 23:58:49 -04:00
Родитель 05db7e1bc8
Коммит 937594f842
6 изменённых файлов: 36 добавлений и 28 удалений

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

@ -459,8 +459,8 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement,
// We need to make sure that the requested pseudo element type // We need to make sure that the requested pseudo element type
// matches the selector pseudo element type before proceeding. // matches the selector pseudo element type before proceeding.
nsCOMPtr<nsIAtom> pseudoElt = NS_Atomize(aPseudo); nsCOMPtr<nsIAtom> pseudoElt = NS_Atomize(aPseudo);
if (sel->mSelectors->PseudoType() != nsCSSPseudoElements:: if (sel->mSelectors->PseudoType() !=
GetPseudoType(pseudoElt, CSSEnabledState::eIgnoreEnabledState)) { nsCSSPseudoElements::GetPseudoType(pseudoElt)) {
*aMatches = false; *aMatches = false;
return NS_OK; return NS_OK;
} }
@ -1233,7 +1233,7 @@ inDOMUtils::GetCSSPseudoElementNames(uint32_t* aLength, char16_t*** aNames)
static_cast<CSSPseudoElementTypeBase>(CSSPseudoElementType::Count); static_cast<CSSPseudoElementTypeBase>(CSSPseudoElementType::Count);
for (CSSPseudoElementTypeBase i = 0; i < pseudoCount; ++i) { for (CSSPseudoElementTypeBase i = 0; i < pseudoCount; ++i) {
CSSPseudoElementType type = static_cast<CSSPseudoElementType>(i); CSSPseudoElementType type = static_cast<CSSPseudoElementType>(i);
if (nsCSSPseudoElements::IsEnabled(type, CSSEnabledState::eForAllContent)) { if (!nsCSSPseudoElements::PseudoElementIsUASheetOnly(type)) {
nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type); nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type);
array.AppendElement(atom); array.AppendElement(atom);
} }

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

@ -5916,12 +5916,20 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
bool isTreePseudo = false; bool isTreePseudo = false;
CSSEnabledState enabledState = EnabledState(); CSSEnabledState enabledState = EnabledState();
CSSPseudoElementType pseudoElementType = CSSPseudoElementType pseudoElementType =
nsCSSPseudoElements::GetPseudoType(pseudo, enabledState); nsCSSPseudoElements::GetPseudoType(pseudo);
CSSPseudoClassType pseudoClassType = CSSPseudoClassType pseudoClassType =
nsCSSPseudoClasses::GetPseudoType(pseudo, enabledState); nsCSSPseudoClasses::GetPseudoType(pseudo, enabledState);
bool pseudoClassIsUserAction = bool pseudoClassIsUserAction =
nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType); nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType);
if (pseudoElementType < CSSPseudoElementType::Count && !AgentRulesEnabled() &&
nsCSSPseudoElements::PseudoElementIsUASheetOnly(pseudoElementType)) {
// This pseudo-element is not exposed to content.
REPORT_UNEXPECTED_TOKEN(PEPseudoSelUnknown);
UngetToken();
return eSelectorParsingStatus_Error;
}
if (nsCSSAnonBoxes::IsNonElement(pseudo)) { if (nsCSSAnonBoxes::IsNonElement(pseudo)) {
// Non-element anonymous boxes should not match any rule. // Non-element anonymous boxes should not match any rule.
REPORT_UNEXPECTED_TOKEN(PEPseudoSelUnknown); REPORT_UNEXPECTED_TOKEN(PEPseudoSelUnknown);

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

@ -36,8 +36,7 @@ static const nsStaticAtom CSSPseudoElements_info[] = {
// Flags data for each of the pseudo-elements, which must be separate // Flags data for each of the pseudo-elements, which must be separate
// from the previous array since there's no place for it in // from the previous array since there's no place for it in
// nsStaticAtom. // nsStaticAtom.
/* static */ const uint32_t static const uint32_t CSSPseudoElements_flags[] = {
nsCSSPseudoElements::kPseudoElementFlags[Type::Count] = {
#define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \ #define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
flags_, flags_,
#include "nsCSSPseudoElementList.h" #include "nsCSSPseudoElementList.h"
@ -68,22 +67,20 @@ nsCSSPseudoElements::IsCSS2PseudoElement(nsIAtom *aAtom)
aAtom == nsCSSPseudoElements::firstLetter || aAtom == nsCSSPseudoElements::firstLetter ||
aAtom == nsCSSPseudoElements::firstLine; aAtom == nsCSSPseudoElements::firstLine;
NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aAtom) || NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aAtom) ||
result == PseudoElementHasFlags( result == PseudoElementHasFlags(GetPseudoType(aAtom),
GetPseudoType(aAtom, EnabledState::eIgnoreEnabledState), CSS_PSEUDO_ELEMENT_IS_CSS2),
CSS_PSEUDO_ELEMENT_IS_CSS2),
"result doesn't match flags"); "result doesn't match flags");
return result; return result;
} }
/* static */ CSSPseudoElementType /* static */ CSSPseudoElementType
nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom, EnabledState aEnabledState) nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
{ {
for (CSSPseudoElementTypeBase i = 0; for (CSSPseudoElementTypeBase i = 0;
i < ArrayLength(CSSPseudoElements_info); i < ArrayLength(CSSPseudoElements_info);
++i) { ++i) {
if (*CSSPseudoElements_info[i].mAtom == aAtom) { if (*CSSPseudoElements_info[i].mAtom == aAtom) {
auto type = static_cast<Type>(i); return static_cast<Type>(i);
return IsEnabled(type, aEnabledState) ? type : Type::NotPseudo;
} }
} }
@ -108,6 +105,15 @@ nsCSSPseudoElements::GetPseudoAtom(Type aType)
static_cast<CSSPseudoElementTypeBase>(aType)].mAtom; static_cast<CSSPseudoElementTypeBase>(aType)].mAtom;
} }
/* static */ uint32_t
nsCSSPseudoElements::FlagsForPseudoElement(const Type aType)
{
CSSPseudoElementTypeBase index = static_cast<CSSPseudoElementTypeBase>(aType);
NS_ASSERTION(index < ArrayLength(CSSPseudoElements_flags),
"argument must be a pseudo-element");
return CSSPseudoElements_flags[index];
}
/* static */ bool /* static */ bool
nsCSSPseudoElements::PseudoElementSupportsUserActionState(const Type aType) nsCSSPseudoElements::PseudoElementSupportsUserActionState(const Type aType)
{ {

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

@ -9,7 +9,6 @@
#define nsCSSPseudoElements_h___ #define nsCSSPseudoElements_h___
#include "nsIAtom.h" #include "nsIAtom.h"
#include "mozilla/CSSEnabledState.h"
// Is this pseudo-element a CSS2 pseudo-element that can be specified // Is this pseudo-element a CSS2 pseudo-element that can be specified
// with the single colon syntax (in addition to the double-colon syntax, // with the single colon syntax (in addition to the double-colon syntax,
@ -66,7 +65,6 @@ class nsICSSPseudoElement : public nsIAtom {};
class nsCSSPseudoElements class nsCSSPseudoElements
{ {
typedef mozilla::CSSPseudoElementType Type; typedef mozilla::CSSPseudoElementType Type;
typedef mozilla::CSSEnabledState EnabledState;
public: public:
static void AddRefAtoms(); static void AddRefAtoms();
@ -80,7 +78,7 @@ public:
#include "nsCSSPseudoElementList.h" #include "nsCSSPseudoElementList.h"
#undef CSS_PSEUDO_ELEMENT #undef CSS_PSEUDO_ELEMENT
static Type GetPseudoType(nsIAtom* aAtom, EnabledState aEnabledState); static Type GetPseudoType(nsIAtom* aAtom);
// Get the atom for a given Type. aType must be < CSSPseudoElementType::Count // Get the atom for a given Type. aType must be < CSSPseudoElementType::Count
static nsIAtom* GetPseudoAtom(Type aType); static nsIAtom* GetPseudoAtom(Type aType);
@ -97,21 +95,19 @@ public:
static bool PseudoElementSupportsUserActionState(const Type aType); static bool PseudoElementSupportsUserActionState(const Type aType);
static bool IsEnabled(Type aType, EnabledState aEnabledState) static bool PseudoElementIsUASheetOnly(const Type aType) {
{ MOZ_ASSERT(aType < Type::Count);
return !PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY) || return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY);
(aEnabledState & EnabledState::eInUASheets);
} }
private: private:
static uint32_t FlagsForPseudoElement(const Type aType);
// Does the given pseudo-element have all of the flags given? // Does the given pseudo-element have all of the flags given?
static bool PseudoElementHasFlags(const Type aType, uint32_t aFlags) static bool PseudoElementHasFlags(const Type aType, uint32_t aFlags)
{ {
MOZ_ASSERT(aType < Type::Count); return (FlagsForPseudoElement(aType) & aFlags) == aFlags;
return (kPseudoElementFlags[size_t(aType)] & aFlags) == aFlags;
} }
static const uint32_t kPseudoElementFlags[Type::Count];
}; };
#endif /* nsCSSPseudoElements_h___ */ #endif /* nsCSSPseudoElements_h___ */

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

@ -488,8 +488,7 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
RefPtr<nsStyleContext> sc; RefPtr<nsStyleContext> sc;
if (aPseudo) { if (aPseudo) {
CSSPseudoElementType type = nsCSSPseudoElements:: CSSPseudoElementType type = nsCSSPseudoElements::GetPseudoType(aPseudo);
GetPseudoType(aPseudo, CSSEnabledState::eIgnoreEnabledState);
if (type >= CSSPseudoElementType::Count) { if (type >= CSSPseudoElementType::Count) {
return nullptr; return nullptr;
} }

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

@ -865,9 +865,8 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
aPseudoType == aPseudoType ==
CSSPseudoElementType::NotPseudo) || CSSPseudoElementType::NotPseudo) ||
(aPseudoTag && (aPseudoTag &&
nsCSSPseudoElements::GetPseudoType( nsCSSPseudoElements::GetPseudoType(aPseudoTag) ==
aPseudoTag, CSSEnabledState::eIgnoreEnabledState) == aPseudoType),
aPseudoType),
"Pseudo mismatch"); "Pseudo mismatch");
if (aVisitedRuleNode == aRuleNode) { if (aVisitedRuleNode == aRuleNode) {