Skip to content

Commit

Permalink
Bug 1069192 part 1 - Force users of nsCSSProps::IsEnabled() to pass i…
Browse files Browse the repository at this point in the history
…n the enabled state. r=dbaron
  • Loading branch information
upsuper committed Oct 3, 2015
1 parent 1c377dc commit 3d205f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
16 changes: 8 additions & 8 deletions layout/inspector/inDOMUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion layout/style/Declaration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ Declaration::ToString(nsAString& aString) const
continue;
}

if (!nsCSSProps::IsEnabled(property)) {
if (!nsCSSProps::IsEnabled(property, nsCSSProps::eEnabledForAllContent)) {
continue;
}
bool doneProperty = false;
Expand Down
8 changes: 3 additions & 5 deletions layout/style/nsCSSParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions layout/style/nsCSSProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,15 +543,12 @@ class nsCSSProps {
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|.
Expand Down
3 changes: 2 additions & 1 deletion layout/style/nsComputedDOMStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ struct nsComputedStyleMap

bool IsEnabled() const
{
return nsCSSProps::IsEnabled(mProperty);
return nsCSSProps::IsEnabled(mProperty,
nsCSSProps::eEnabledForAllContent);
}
};

Expand Down

0 comments on commit 3d205f6

Please sign in to comment.