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

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

@ -5916,12 +5916,20 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
bool isTreePseudo = false;
CSSEnabledState enabledState = EnabledState();
CSSPseudoElementType pseudoElementType =
nsCSSPseudoElements::GetPseudoType(pseudo, enabledState);
nsCSSPseudoElements::GetPseudoType(pseudo);
CSSPseudoClassType pseudoClassType =
nsCSSPseudoClasses::GetPseudoType(pseudo, enabledState);
bool pseudoClassIsUserAction =
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)) {
// Non-element anonymous boxes should not match any rule.
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
// from the previous array since there's no place for it in
// nsStaticAtom.
/* static */ const uint32_t
nsCSSPseudoElements::kPseudoElementFlags[Type::Count] = {
static const uint32_t CSSPseudoElements_flags[] = {
#define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
flags_,
#include "nsCSSPseudoElementList.h"
@ -68,22 +67,20 @@ nsCSSPseudoElements::IsCSS2PseudoElement(nsIAtom *aAtom)
aAtom == nsCSSPseudoElements::firstLetter ||
aAtom == nsCSSPseudoElements::firstLine;
NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aAtom) ||
result == PseudoElementHasFlags(
GetPseudoType(aAtom, EnabledState::eIgnoreEnabledState),
CSS_PSEUDO_ELEMENT_IS_CSS2),
result == PseudoElementHasFlags(GetPseudoType(aAtom),
CSS_PSEUDO_ELEMENT_IS_CSS2),
"result doesn't match flags");
return result;
}
/* static */ CSSPseudoElementType
nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom, EnabledState aEnabledState)
nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
{
for (CSSPseudoElementTypeBase i = 0;
i < ArrayLength(CSSPseudoElements_info);
++i) {
if (*CSSPseudoElements_info[i].mAtom == aAtom) {
auto type = static_cast<Type>(i);
return IsEnabled(type, aEnabledState) ? type : Type::NotPseudo;
return static_cast<Type>(i);
}
}
@ -108,6 +105,15 @@ nsCSSPseudoElements::GetPseudoAtom(Type aType)
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
nsCSSPseudoElements::PseudoElementSupportsUserActionState(const Type aType)
{

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

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

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

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

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

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