diff --git a/browser/components/safebrowsing/content/test/browser.ini b/browser/components/safebrowsing/content/test/browser.ini index b20c45360d97..edf8861867a6 100644 --- a/browser/components/safebrowsing/content/test/browser.ini +++ b/browser/components/safebrowsing/content/test/browser.ini @@ -3,6 +3,8 @@ support-files = head.js [browser_bug400731.js] [browser_bug415846.js] -skip-if = os == "mac" +skip-if = true +# Disabled because it seems to now touch network resources +# skip-if = os == "mac" # Disabled on Mac because of its bizarre special-and-unique # snowflake of a help menu. diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index 830eed154b5f..64e9e8b4ab3b 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -1205,7 +1205,7 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName, // Get the nsCSSProperty ID for our mapped attribute. nsCSSProperty propertyID = nsCSSProps::LookupProperty(nsDependentAtomString(aMappedAttrName), - nsCSSProps::eEnabled); + nsCSSProps::eEnabledForAllContent); if (propertyID != eCSSProperty_UNKNOWN) { bool changed; // outparam for ParseProperty. (ignored) mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI, @@ -2539,7 +2539,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName) if (IsAttributeMapped(aName)) { nsCSSProperty prop = nsCSSProps::LookupProperty(nsDependentAtomString(aName), - nsCSSProps::eEnabled); + nsCSSProps::eEnabledForAllContent); // Check IsPropertyAnimatable to avoid attributes that... // - map to explicitly unanimatable properties (e.g. 'direction') // - map to unsupported attributes (e.g. 'glyph-orientation-horizontal') diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 161f10dcf170..7579022cfcbf 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2667,8 +2667,8 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement, // Convert direction-dependent properties as appropriate, e.g., // border-left to border-left-value. - nsCSSProperty property = nsCSSProps::LookupProperty(aProperty, - nsCSSProps::eAny); + nsCSSProperty property = + nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState); if (property != eCSSProperty_UNKNOWN && nsCSSProps::IsShorthand(property)) { nsCSSProperty subprop0 = *nsCSSProps::SubpropertyEntryFor(property); if (nsCSSProps::PropHasFlags(subprop0, CSS_PROPERTY_REPORT_OTHER_NAME) && diff --git a/dom/bindings/GenerateCSS2PropertiesWebIDL.py b/dom/bindings/GenerateCSS2PropertiesWebIDL.py index 4be12b72cd1b..e1e4a3a56e34 100644 --- a/dom/bindings/GenerateCSS2PropertiesWebIDL.py +++ b/dom/bindings/GenerateCSS2PropertiesWebIDL.py @@ -7,9 +7,18 @@ import string propList = eval(sys.stdin.read()) props = "" -for [prop, pref] in propList: +for [prop, id, flags, pref] in propList: extendedAttrs = ["Throws", "TreatNullAs=EmptyString"] - if pref is not "": + # To limit the overhead of Func= annotations, we only generate them when + # necessary, which is when the + # CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP flag is set. + # Otherwise, we try to get by with just a Pref= annotation or no annotation + # at all. + if "CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP" in flags: + extendedAttrs.append('Func="IsCSSPropertyExposedToJS"' % id) + # The following is an 'elif' because it is the responsibility of + # IsCSSPropertyExposedToJS to handle the pref if there is one. + elif pref is not "": extendedAttrs.append('Pref="%s"' % pref) if not prop.startswith("Moz"): prop = prop[0].lower() + prop[1:] diff --git a/dom/smil/nsSMILAnimationController.cpp b/dom/smil/nsSMILAnimationController.cpp index 9d9d1c15712c..28400546ebfb 100644 --- a/dom/smil/nsSMILAnimationController.cpp +++ b/dom/smil/nsSMILAnimationController.cpp @@ -794,7 +794,7 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation( } else { nsCSSProperty prop = nsCSSProps::LookupProperty(nsDependentAtomString(attributeName), - nsCSSProps::eEnabled); + nsCSSProps::eEnabledForAllContent); isCSS = nsSMILCSSProperty::IsPropertyAnimatable(prop); } } diff --git a/dom/smil/nsSMILCompositor.cpp b/dom/smil/nsSMILCompositor.cpp index 2efe6ae589e4..36a4f87b2029 100644 --- a/dom/smil/nsSMILCompositor.cpp +++ b/dom/smil/nsSMILCompositor.cpp @@ -125,7 +125,7 @@ nsSMILCompositor::CreateSMILAttr() if (mKey.mIsCSS) { nsCSSProperty propId = nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName), - nsCSSProps::eEnabled); + nsCSSProps::eEnabledForAllContent); if (nsSMILCSSProperty::IsPropertyAnimatable(propId)) { return new nsSMILCSSProperty(propId, mKey.mElement.get()); } diff --git a/dom/webidl/CSS2PropertiesProps.h b/dom/webidl/CSS2PropertiesProps.h index b799db07295e..63d5f5eff876 100644 --- a/dom/webidl/CSS2PropertiesProps.h +++ b/dom/webidl/CSS2PropertiesProps.h @@ -5,13 +5,16 @@ [ -#define DO_PROP(method, pref) \ - [ #method, pref ], +#define PROP_STRINGIFY_INTERNAL(X) #X +#define PROP_STRINGIFY(X) PROP_STRINGIFY_INTERNAL(X) + +#define DO_PROP(method, id, flags, pref) \ + [ #method, #id, PROP_STRINGIFY(flags), pref ], #define CSS_PROP(name, id, method, flags, pref, parsevariant, kwtable, \ stylestruct, stylestructofset, animtype) \ - DO_PROP(method, pref) + DO_PROP(method, id, flags, pref) #define CSS_PROP_SHORTHAND(name, id, method, flags, pref) \ - DO_PROP(method, pref) + DO_PROP(method, id, flags, pref) #define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_ #define CSS_PROP_LIST_EXCLUDE_INTERNAL @@ -23,12 +26,14 @@ #undef CSS_PROP #define CSS_PROP_ALIAS(name, id, method, pref) \ - DO_PROP(method, pref) + DO_PROP(method, id, 0, pref) #include "nsCSSPropAliasList.h" #undef CSS_PROP_ALIAS #undef DO_PROP +#undef PROP_STRINGIFY +#undef PROP_STRINGIFY_INTERNAL ] diff --git a/editor/libeditor/html/nsHTMLCSSUtils.cpp b/editor/libeditor/html/nsHTMLCSSUtils.cpp index b53b6690d02a..e3a7e0940140 100644 --- a/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -565,7 +565,7 @@ nsHTMLCSSUtils::GetCSSInlinePropertyBase(nsINode* aNode, nsIAtom* aProperty, } nsCSSProperty prop = nsCSSProps::LookupProperty(nsDependentAtomString(aProperty), - nsCSSProps::eEnabled); + nsCSSProps::eEnabledForAllContent); MOZ_ASSERT(prop != eCSSProperty_UNKNOWN); rule->GetDeclaration()->GetValue(prop, aValue); diff --git a/layout/inspector/inCSSValueSearch.cpp b/layout/inspector/inCSSValueSearch.cpp index a00a81d9f6c1..dd159affe555 100644 --- a/layout/inspector/inCSSValueSearch.cpp +++ b/layout/inspector/inCSSValueSearch.cpp @@ -227,7 +227,7 @@ inCSSValueSearch::AddPropertyCriteria(const char16_t *aPropName) { nsCSSProperty prop = nsCSSProps::LookupProperty(nsDependentString(aPropName), - nsCSSProps::eAny); + nsCSSProps::eIgnoreEnabledState); mProperties[mPropertyCount] = prop; mPropertyCount++; return NS_OK; diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index 47448f282620..6654c5f128ef 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -383,8 +383,8 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement, NS_IMETHODIMP inDOMUtils::IsInheritedProperty(const nsAString &aPropertyName, bool *_retval) { - nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName, - nsCSSProps::eAny); + nsCSSProperty prop = + nsCSSProps::LookupProperty(aPropertyName, nsCSSProps::eIgnoreEnabledState); if (prop == eCSSProperty_UNKNOWN) { *_retval = false; return NS_OK; @@ -565,7 +565,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty, char16_t*** aValues) { nsCSSProperty propertyID = nsCSSProps::LookupProperty(aProperty, - nsCSSProps::eEnabled); + nsCSSProps::eEnabledForAllContent); if (propertyID == eCSSProperty_UNKNOWN) { return NS_ERROR_FAILURE; } diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 8c79e8003ef4..d77ac5c9f5aa 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -959,7 +959,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, bool Declaration::GetValueIsImportant(const nsAString& aProperty) const { - nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty, nsCSSProps::eAny); + nsCSSProperty propID = + nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState); if (propID == eCSSProperty_UNKNOWN) { return false; } diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index d8cd920db990..da659e274bd8 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -45,6 +45,7 @@ #include "mozilla/Preferences.h" #include "nsRuleData.h" #include "mozilla/CSSVariableValues.h" +#include "mozilla/dom/URL.h" using namespace mozilla; @@ -248,9 +249,17 @@ public: uint32_t aLineOffset); nsCSSProperty LookupEnabledProperty(const nsAString& aProperty) { - return nsCSSProps::LookupProperty(aProperty, mUnsafeRulesEnabled ? - nsCSSProps::eEnabledInUASheets : - nsCSSProps::eEnabled); + static_assert(nsCSSProps::eEnabledForAllContent == 0, + "nsCSSProps::eEnabledForAllContent should be zero for " + "this bitfield to work"); + nsCSSProps::EnabledState enabledState = nsCSSProps::eEnabledForAllContent; + if (mUnsafeRulesEnabled) { + enabledState |= nsCSSProps::eEnabledInUASheets; + } + if (mIsChromeOrCertifiedApp) { + enabledState |= nsCSSProps::eEnabledInChromeOrCertifiedApp; + } + return nsCSSProps::LookupProperty(aProperty, enabledState); } protected: @@ -913,6 +922,12 @@ protected: // True if unsafe rules should be allowed bool mUnsafeRulesEnabled : 1; + // True if we are in parsing rules for Chrome or Certified App content, + // in which case CSS properties with the + // CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP + // flag should be allowed. + bool mIsChromeOrCertifiedApp : 1; + // True if viewport units should be allowed. bool mViewportUnitsEnabled : 1; @@ -1007,6 +1022,7 @@ CSSParserImpl::CSSParserImpl() mHashlessColorQuirk(false), mUnitlessLengthQuirk(false), mUnsafeRulesEnabled(false), + mIsChromeOrCertifiedApp(false), mViewportUnitsEnabled(true), mHTMLMediaMode(false), mParsingCompoundProperty(false), @@ -1147,6 +1163,9 @@ CSSParserImpl::ParseSheet(const nsAString& aInput, } mUnsafeRulesEnabled = aAllowUnsafeRules; + mIsChromeOrCertifiedApp = + dom::IsChromeURI(aSheetURI) || + aSheetPrincipal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED; nsCSSToken* tk = &mToken; for (;;) { @@ -1170,6 +1189,7 @@ CSSParserImpl::ParseSheet(const nsAString& aInput, ReleaseScanner(); mUnsafeRulesEnabled = false; + mIsChromeOrCertifiedApp = false; // XXX check for low level errors return NS_OK; diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 293d2cdff449..fefa229386f4 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -3907,7 +3907,8 @@ CSS_PROP_DISPLAY( will_change, WillChange, CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_VALUE_LIST_USES_COMMAS, + CSS_PROPERTY_VALUE_LIST_USES_COMMAS | + CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP, "layout.css.will-change.enabled", 0, nullptr, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index ec3f49223075..773aa933c2ef 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -395,13 +395,13 @@ nsCSSProps::LookupProperty(const nsACString& aProperty, } MOZ_ASSERT(eCSSAliasCount != 0, "'res' must be an alias at this point so we better have some!"); - // We intentionally don't support eEnabledInUASheets for aliases yet - // because it's unlikely there will be a need for it. - if (IsEnabled(res) || aEnabled == eAny) { + // We intentionally don't support eEnabledInUASheets or eEnabledInChromeOrCertifiedApp + // for aliases yet because it's unlikely there will be a need for it. + if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { res = gAliases[res - eCSSProperty_COUNT]; NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT, "aliases must not point to other aliases"); - if (IsEnabled(res) || aEnabled == eAny) { + if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { return res; } } @@ -431,11 +431,11 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled) "'res' must be an alias at this point so we better have some!"); // We intentionally don't support eEnabledInUASheets for aliases yet // because it's unlikely there will be a need for it. - if (IsEnabled(res) || aEnabled == eAny) { + if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { res = gAliases[res - eCSSProperty_COUNT]; NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT, "aliases must not point to other aliases"); - if (IsEnabled(res) || aEnabled == eAny) { + if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { return res; } } diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index d07e254b4da7..5c4c3fc31881 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -201,6 +201,14 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK & // In other words, this bit has no effect on the use of aliases. #define CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS (1<<22) +// This property is always enabled in chrome and in certified apps. This is +// meant to be used together with a pref that enables the property for +// non-privileged content. Note that if such a property has an alias, then any +// use of that alias in privileged content will still be ignored unless the +// pref is enabled. In other words, this bit has no effect on the use of +// aliases. +#define CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP (1<<23) + /** * Types of animatable values. */ @@ -258,12 +266,21 @@ public: static void AddRefTable(void); static void ReleaseTable(void); - // Given a property string, return the enum value enum EnabledState { - eEnabled, - eEnabledInUASheets, - eAny + // The default EnabledState: only enable what's enabled for all content, + // given the current values of preferences. + eEnabledForAllContent = 0, + // Enable a property in UA sheets. + eEnabledInUASheets = 0x01, + // Enable a property in privileged content, i.e. chrome or Certified Apps + eEnabledInChromeOrCertifiedApp = 0x02, + // Special value to unconditionally enable a property. This implies all the + // bits above, but is strictly more than just their OR-ed union. + // This just skips any test so a property will be enabled even if it would + // have been disabled with all the bits above set. + eIgnoreEnabledState = 0xff }; + // Looks up the property with name aProperty and returns its corresponding // nsCSSProperty value. If aProperty is the name of a custom property, // then eCSSPropertyExtra_variable will be returned. @@ -447,11 +464,25 @@ 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; + static bool IsEnabled(nsCSSProperty aProperty, EnabledState aEnabled) + { + if (IsEnabled(aProperty)) { + return true; + } + if (aEnabled == eIgnoreEnabledState) { + return true; + } + if ((aEnabled & eEnabledInUASheets) && + PropHasFlags(aProperty, CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS)) + { + return true; + } + if ((aEnabled & eEnabledInChromeOrCertifiedApp) && + PropHasFlags(aProperty, CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP)) + { + return true; + } + return false; } public: @@ -609,4 +640,28 @@ public: static const KTableValue kHyphensKTable[]; }; +inline nsCSSProps::EnabledState operator|(nsCSSProps::EnabledState a, + nsCSSProps::EnabledState b) +{ + return nsCSSProps::EnabledState(int(a) | int(b)); +} + +inline nsCSSProps::EnabledState operator&(nsCSSProps::EnabledState a, + nsCSSProps::EnabledState b) +{ + return nsCSSProps::EnabledState(int(a) & int(b)); +} + +inline nsCSSProps::EnabledState& operator|=(nsCSSProps::EnabledState& a, + nsCSSProps::EnabledState b) +{ + return a = a | b; +} + +inline nsCSSProps::EnabledState& operator&=(nsCSSProps::EnabledState& a, + nsCSSProps::EnabledState b) +{ + return a = a & b; +} + #endif /* nsCSSProps_h___ */ diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 7bb2f5c3b595..e5074886ff64 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -718,7 +718,7 @@ already_AddRefed nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv) { nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName, - nsCSSProps::eEnabled); + nsCSSProps::eEnabledForAllContent); bool needsLayoutFlush; nsComputedStyleMap::Entry::ComputeMethod getter; diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index b358b2d75376..d438918473e8 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -16,6 +16,8 @@ #include "nsCOMPtr.h" #include "mozAutoDocUpdate.h" #include "nsIURI.h" +#include "mozilla/dom/BindingUtils.h" +#include "nsContentUtils.h" using namespace mozilla; @@ -169,8 +171,9 @@ NS_IMETHODIMP nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName, nsAString& aReturn) { - const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName, - nsCSSProps::eEnabled); + const nsCSSProperty propID = + nsCSSProps::LookupProperty(aPropertyName, + nsCSSProps::eEnabledForAllContent); if (propID == eCSSProperty_UNKNOWN) { aReturn.Truncate(); return NS_OK; @@ -188,8 +191,9 @@ NS_IMETHODIMP nsDOMCSSDeclaration::GetAuthoredPropertyValue(const nsAString& aPropertyName, nsAString& aReturn) { - const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName, - nsCSSProps::eEnabled); + const nsCSSProperty propID = + nsCSSProps::LookupProperty(aPropertyName, + nsCSSProps::eEnabledForAllContent); if (propID == eCSSProperty_UNKNOWN) { aReturn.Truncate(); return NS_OK; @@ -229,8 +233,9 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName, const nsAString& aPriority) { // In the common (and fast) cases we can use the property id - nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName, - nsCSSProps::eEnabled); + nsCSSProperty propID = + nsCSSProps::LookupProperty(aPropertyName, + nsCSSProps::eEnabledForAllContent); if (propID == eCSSProperty_UNKNOWN) { return NS_OK; } @@ -265,8 +270,9 @@ NS_IMETHODIMP nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName, nsAString& aReturn) { - const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName, - nsCSSProps::eEnabled); + const nsCSSProperty propID = + nsCSSProps::LookupProperty(aPropertyName, + nsCSSProps::eEnabledForAllContent); if (propID == eCSSProperty_UNKNOWN) { aReturn.Truncate(); return NS_OK; @@ -425,3 +431,24 @@ nsDOMCSSDeclaration::RemoveCustomProperty(const nsAString& aPropertyName) decl->RemoveVariableDeclaration(Substring(aPropertyName, VAR_PREFIX_LENGTH)); return SetCSSDeclaration(decl); } + +bool IsCSSPropertyExposedToJS(nsCSSProperty aProperty, JSContext* cx, JSObject* obj) +{ + nsCSSProps::EnabledState enabledState = nsCSSProps::eEnabledForAllContent; + + // Optimization: we skip checking properties of the JSContext + // in the majority case where the property does not have the + // CSS_PROPERTY_ALWAYS_ENABLED_IN_PRIVILEGED_CONTENT flag. + bool isEnabledInChromeOrCertifiedApp + = nsCSSProps::PropHasFlags(aProperty, + CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP); + + if (isEnabledInChromeOrCertifiedApp) { + if (dom::IsInCertifiedApp(cx, obj) || + nsContentUtils::ThreadsafeIsCallerChrome()) + { + enabledState |= nsCSSProps::eEnabledInChromeOrCertifiedApp; + } + } + return nsCSSProps::IsEnabled(aProperty, enabledState); +} diff --git a/layout/style/nsDOMCSSDeclaration.h b/layout/style/nsDOMCSSDeclaration.h index 4ea076716a0f..8cb35708aae8 100644 --- a/layout/style/nsDOMCSSDeclaration.h +++ b/layout/style/nsDOMCSSDeclaration.h @@ -15,6 +15,8 @@ class nsIPrincipal; class nsIDocument; +struct JSContext; +class JSObject; namespace mozilla { namespace css { @@ -152,4 +154,12 @@ protected: } }; +bool IsCSSPropertyExposedToJS(nsCSSProperty aProperty, JSContext* cx, JSObject* obj); + +template +MOZ_ALWAYS_INLINE bool IsCSSPropertyExposedToJS(JSContext* cx, JSObject* obj) +{ + return IsCSSPropertyExposedToJS(Property, cx, obj); +} + #endif // nsDOMCSSDeclaration_h___ diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index aa07686a206e..32096ce8e1ce 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -4859,8 +4859,9 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (val.GetUnit() == eCSSUnit_Ident) { nsDependentString propertyStr(property.list->mValue.GetStringBufferValue()); - nsCSSProperty prop = nsCSSProps::LookupProperty(propertyStr, - nsCSSProps::eEnabled); + nsCSSProperty prop = + nsCSSProps::LookupProperty(propertyStr, + nsCSSProps::eEnabledForAllContent); if (prop == eCSSProperty_UNKNOWN) { transition->SetUnknownProperty(propertyStr); } else { @@ -5503,7 +5504,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, } nsCSSProperty prop = - nsCSSProps::LookupProperty(buffer, nsCSSProps::eEnabled); + nsCSSProps::LookupProperty(buffer, + nsCSSProps::eEnabledForAllContent); if (prop != eCSSProperty_UNKNOWN && nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_CREATES_STACKING_CONTEXT)) diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 327291785de9..b35e0b98081f 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2303,7 +2303,7 @@ void nsTransition::SetInitialValues() void nsTransition::SetUnknownProperty(const nsAString& aUnknownProperty) { NS_ASSERTION(nsCSSProps::LookupProperty(aUnknownProperty, - nsCSSProps::eEnabled) == + nsCSSProps::eEnabledForAllContent) == eCSSProperty_UNKNOWN, "should be unknown property"); mProperty = eCSSProperty_UNKNOWN; diff --git a/layout/style/test/TestCSSPropertyLookup.cpp b/layout/style/test/TestCSSPropertyLookup.cpp index e097787ade57..30e265888831 100644 --- a/layout/style/test/TestCSSPropertyLookup.cpp +++ b/layout/style/test/TestCSSPropertyLookup.cpp @@ -40,7 +40,8 @@ TestProps() PL_strcpy(tagName, *et); index = nsCSSProperty(int32_t(index) + 1); - id = nsCSSProps::LookupProperty(nsCString(tagName), nsCSSProps::eAny); + id = nsCSSProps::LookupProperty(nsCString(tagName), + nsCSSProps::eIgnoreEnabledState); if (id == eCSSProperty_UNKNOWN) { printf("bug: can't find '%s'\n", tagName); success = false; @@ -55,7 +56,7 @@ TestProps() tagName[0] = tagName[0] - 32; } id = nsCSSProps::LookupProperty(NS_ConvertASCIItoUTF16(tagName), - nsCSSProps::eAny); + nsCSSProps::eIgnoreEnabledState); if (id < 0) { printf("bug: can't find '%s'\n", tagName); success = false; @@ -70,7 +71,8 @@ TestProps() // Now make sure we don't find some garbage for (int i = 0; i < (int) (sizeof(kJunkNames) / sizeof(const char*)); i++) { const char* const tag = kJunkNames[i]; - id = nsCSSProps::LookupProperty(nsAutoCString(tag), nsCSSProps::eAny); + id = nsCSSProps::LookupProperty(nsAutoCString(tag), + nsCSSProps::eIgnoreEnabledState); if (id >= 0) { printf("bug: found '%s'\n", tag ? tag : "(null)"); success = false;