Bug 1069192 part 1 - Force users of nsCSSProps::IsEnabled() to pass in the enabled state. r=dbaron

This commit is contained in:
Xidorn Quan 2015-10-03 11:12:09 +10:00
parent 84007f05ef
commit 3e8a543b24
5 changed files with 14 additions and 18 deletions

View File

@ -511,14 +511,14 @@ inDOMUtils::GetCSSPropertyNames(uint32_t aFlags, uint32_t* aCount,
char16_t** props =
static_cast<char16_t**>(moz_xmalloc(maxCount * sizeof(char16_t*)));
#define DO_PROP(_prop) \
PR_BEGIN_MACRO \
nsCSSProperty cssProp = nsCSSProperty(_prop); \
if (nsCSSProps::IsEnabled(cssProp)) { \
props[propCount] = \
ToNewUnicode(nsDependentCString(kCSSRawProperties[_prop])); \
++propCount; \
} \
#define DO_PROP(_prop) \
PR_BEGIN_MACRO \
nsCSSProperty cssProp = nsCSSProperty(_prop); \
if (nsCSSProps::IsEnabled(cssProp, nsCSSProps::eEnabledForAllContent)) { \
props[propCount] = \
ToNewUnicode(nsDependentCString(kCSSRawProperties[_prop])); \
++propCount; \
} \
PR_END_MACRO
// prop is the property id we're considering; propCount is how many properties

View File

@ -1252,7 +1252,7 @@ Declaration::ToString(nsAString& aString) const
continue;
}
if (!nsCSSProps::IsEnabled(property)) {
if (!nsCSSProps::IsEnabled(property, nsCSSProps::eEnabledForAllContent)) {
continue;
}
bool doneProperty = false;

View File

@ -1684,10 +1684,7 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
// Check for unknown or preffed off properties
if (eCSSProperty_UNKNOWN == aPropID ||
!(nsCSSProps::IsEnabled(aPropID) ||
(mUnsafeRulesEnabled &&
nsCSSProps::PropHasFlags(aPropID,
CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS)))) {
!nsCSSProps::IsEnabled(aPropID, PropertyEnabledState())) {
NS_ConvertASCIItoUTF16 propName(nsCSSProps::GetStringValue(aPropID));
REPORT_UNEXPECTED_P(PEUnknownProperty, propName);
REPORT_UNEXPECTED(PEDeclDropped);
@ -2991,7 +2988,8 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
parseFunc = &CSSParserImpl::ParsePageRule;
newSection = eCSSSection_General;
} else if ((nsCSSProps::IsEnabled(eCSSPropertyAlias_MozAnimation) &&
} else if ((nsCSSProps::IsEnabled(eCSSPropertyAlias_MozAnimation,
PropertyEnabledState()) &&
mToken.mIdent.LowerCaseEqualsLiteral("-moz-keyframes")) ||
mToken.mIdent.LowerCaseEqualsLiteral("keyframes")) {
parseFunc = &CSSParserImpl::ParseKeyframesRule;

View File

@ -543,15 +543,12 @@ public:
return kIDLNameSortPositionTable[aProperty];
}
public:
static bool IsEnabled(nsCSSProperty aProperty) {
MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_with_aliases,
"out of range");
return gPropertyEnabled[aProperty];
}
private:
// A table for the use counter associated with each CSS property. If a
// property does not have a use counter defined in UseCounters.conf, then
// its associated entry is |eUseCounter_UNKNOWN|.

View File

@ -96,7 +96,8 @@ struct nsComputedStyleMap
bool IsEnabled() const
{
return nsCSSProps::IsEnabled(mProperty);
return nsCSSProps::IsEnabled(mProperty,
nsCSSProps::eEnabledForAllContent);
}
};