зеркало из https://github.com/mozilla/gecko-dev.git
Bug 966992 - Add a CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS bit for properties that are enabled by a pref but that are always enabled in UA sheets. r=cam
This commit is contained in:
Родитель
c1dc0a9245
Коммит
3c71ab792b
|
@ -247,6 +247,12 @@ public:
|
|||
uint32_t aLineNumber,
|
||||
uint32_t aLineOffset);
|
||||
|
||||
nsCSSProperty LookupEnabledProperty(const nsAString& aProperty) {
|
||||
return nsCSSProps::LookupProperty(aProperty, mUnsafeRulesEnabled ?
|
||||
nsCSSProps::eEnabledInUASheets :
|
||||
nsCSSProps::eEnabled);
|
||||
}
|
||||
|
||||
protected:
|
||||
class nsAutoParseCompoundProperty;
|
||||
friend class nsAutoParseCompoundProperty;
|
||||
|
@ -1305,7 +1311,11 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
|||
*aChanged = false;
|
||||
|
||||
// Check for unknown or preffed off properties
|
||||
if (eCSSProperty_UNKNOWN == aPropID || !nsCSSProps::IsEnabled(aPropID)) {
|
||||
if (eCSSProperty_UNKNOWN == aPropID ||
|
||||
!(nsCSSProps::IsEnabled(aPropID) ||
|
||||
(mUnsafeRulesEnabled &&
|
||||
nsCSSProps::PropHasFlags(aPropID,
|
||||
CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS)))) {
|
||||
NS_ConvertASCIItoUTF16 propName(nsCSSProps::GetStringValue(aPropID));
|
||||
REPORT_UNEXPECTED_P(PEUnknownProperty, propName);
|
||||
REPORT_UNEXPECTED(PEDeclDropped);
|
||||
|
@ -1560,8 +1570,7 @@ CSSParserImpl::EvaluateSupportsDeclaration(const nsAString& aProperty,
|
|||
nsIURI* aBaseURL,
|
||||
nsIPrincipal* aDocPrincipal)
|
||||
{
|
||||
nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty,
|
||||
nsCSSProps::eEnabled);
|
||||
nsCSSProperty propID = LookupEnabledProperty(aProperty);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3701,8 +3710,7 @@ CSSParserImpl::ParseSupportsConditionInParensInsideParens(bool& aConditionMet)
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCSSProperty propID = nsCSSProps::LookupProperty(propertyName,
|
||||
nsCSSProps::eEnabled);
|
||||
nsCSSProperty propID = LookupEnabledProperty(propertyName);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
if (ExpectSymbol(')', true)) {
|
||||
UngetToken();
|
||||
|
@ -5743,7 +5751,7 @@ CSSParserImpl::ParseDeclaration(css::Declaration* aDeclaration,
|
|||
}
|
||||
} else {
|
||||
// Map property name to its ID.
|
||||
propID = nsCSSProps::LookupProperty(propertyName, nsCSSProps::eEnabled);
|
||||
propID = LookupEnabledProperty(propertyName);
|
||||
if (eCSSProperty_UNKNOWN == propID ||
|
||||
(aContext == eCSSContext_Page &&
|
||||
!nsCSSProps::PropHasFlags(propID,
|
||||
|
|
|
@ -392,7 +392,7 @@ nsCSSProps::LookupProperty(const nsACString& aProperty,
|
|||
if (eCSSAliasCount != 0 && res >= eCSSProperty_COUNT) {
|
||||
static_assert(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
|
||||
"assuming eCSSProperty_UNKNOWN doesn't hit this code");
|
||||
if (IsEnabled(res) || aEnabled == eAny) {
|
||||
if (IsEnabled(res, aEnabled)) {
|
||||
res = gAliases[res - eCSSProperty_COUNT];
|
||||
NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT,
|
||||
"aliases must not point to other aliases");
|
||||
|
@ -400,7 +400,7 @@ nsCSSProps::LookupProperty(const nsACString& aProperty,
|
|||
res = eCSSProperty_UNKNOWN;
|
||||
}
|
||||
}
|
||||
if (res != eCSSProperty_UNKNOWN && aEnabled == eEnabled && !IsEnabled(res)) {
|
||||
if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
|
||||
res = eCSSProperty_UNKNOWN;
|
||||
}
|
||||
return res;
|
||||
|
@ -424,7 +424,7 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
|
|||
if (eCSSAliasCount != 0 && res >= eCSSProperty_COUNT) {
|
||||
static_assert(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
|
||||
"assuming eCSSProperty_UNKNOWN doesn't hit this code");
|
||||
if (IsEnabled(res) || aEnabled == eAny) {
|
||||
if (IsEnabled(res, aEnabled)) {
|
||||
res = gAliases[res - eCSSProperty_COUNT];
|
||||
NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT,
|
||||
"aliases must not point to other aliases");
|
||||
|
@ -432,7 +432,7 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
|
|||
res = eCSSProperty_UNKNOWN;
|
||||
}
|
||||
}
|
||||
if (res != eCSSProperty_UNKNOWN && aEnabled == eEnabled && !IsEnabled(res)) {
|
||||
if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
|
||||
res = eCSSProperty_UNKNOWN;
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -191,6 +191,10 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
|
|||
// flushed.
|
||||
#define CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH (1<<20)
|
||||
|
||||
// This property is always enabled in UA sheets. This is meant to be used
|
||||
// together with a pref that enables the property for non-UA sheets.
|
||||
#define CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS (1<<21)
|
||||
|
||||
/**
|
||||
* Types of animatable values.
|
||||
*/
|
||||
|
@ -251,6 +255,7 @@ public:
|
|||
// Given a property string, return the enum value
|
||||
enum EnabledState {
|
||||
eEnabled,
|
||||
eEnabledInUASheets,
|
||||
eAny
|
||||
};
|
||||
// Looks up the property with name aProperty and returns its corresponding
|
||||
|
@ -436,6 +441,13 @@ public:
|
|||
return gPropertyEnabled[aProperty];
|
||||
}
|
||||
|
||||
static bool IsEnabled(nsCSSProperty aProperty, EnabledState aEnabled) {
|
||||
return IsEnabled(aProperty) ||
|
||||
(aEnabled == eEnabledInUASheets &&
|
||||
PropHasFlags(aProperty, CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS)) ||
|
||||
aEnabled == eAny;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
#define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(iter_, prop_) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче