--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -96,17 +96,17 @@ public:
{
if (!mSubpropertyCountInitialized) {
PodZero(&mSubpropertyCount);
mSubpropertyCountInitialized = true;
}
if (mSubpropertyCount[aProperty] == 0) {
uint32_t count = 0;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
- p, aProperty, nsCSSProps::eEnabledForAllContent) {
+ p, aProperty, CSSEnabledState::eAllContent) {
++count;
}
mSubpropertyCount[aProperty] = count;
}
return mSubpropertyCount[aProperty];
}
private:
@@ -487,23 +487,23 @@ KeyframeUtils::GetAnimationPropertiesFro
// a KeyframeValueEntry for each value.
nsTArray<PropertyStyleAnimationValuePair> values;
// For shorthands, we store the string as a token stream so we need to
// extract that first.
if (nsCSSProps::IsShorthand(pair.mProperty)) {
nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue();
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
- nsCSSProps::eEnabledForAllContent, aElement, aStyleContext,
+ CSSEnabledState::eAllContent, aElement, aStyleContext,
tokenStream->mTokenStream, /* aUseSVGMode */ false, values)) {
continue;
}
} else {
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
- nsCSSProps::eEnabledForAllContent, aElement, aStyleContext,
+ CSSEnabledState::eAllContent, aElement, aStyleContext,
pair.mValue, /* aUseSVGMode */ false, values)) {
continue;
}
MOZ_ASSERT(values.Length() == 1,
"Longhand properties should produce a single"
" StyleAnimationValue");
}
@@ -690,17 +690,17 @@ GetPropertyValuesPairs(JSContext* aCx,
}
for (size_t i = 0, n = ids.length(); i < n; i++) {
nsAutoJSString propName;
if (!propName.init(aCx, ids[i])) {
return false;
}
nsCSSProperty property =
nsCSSProps::LookupPropertyByIDLName(propName,
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
if (property != eCSSProperty_UNKNOWN &&
(nsCSSProps::IsShorthand(property) ||
nsCSSProps::kAnimTypeTable[property] != eStyleAnimType_None)) {
// Only need to check for longhands being animatable, as the
// StyleAnimationValue::ComputeValues calls later on will check for
// a shorthand's components being animatable.
AdditionalProperty* p = properties.AppendElement();
p->mProperty = property;
@@ -1105,17 +1105,17 @@ RequiresAdditiveAnimation(const nsTArray
if (nsCSSProps::IsShorthand(pair.mProperty)) {
nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue();
nsCSSParser parser(aDocument->CSSLoader());
if (!parser.IsValueValidForProperty(pair.mProperty,
tokenStream->mTokenStream)) {
continue;
}
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
- prop, pair.mProperty, nsCSSProps::eEnabledForAllContent) {
+ prop, pair.mProperty, CSSEnabledState::eAllContent) {
addToPropertySets(*prop, offsetToUse);
}
} else {
if (pair.mValue.GetUnit() == eCSSUnit_TokenStream) {
continue;
}
addToPropertySets(pair.mProperty, offsetToUse);
}
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2498,17 +2498,17 @@ nsDOMWindowUtils::ComputeAnimationDistan
const nsAString& aValue2,
double* aResult)
{
nsresult rv;
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCSSProperty property =
- nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState);
+ nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eIgnore);
if (property != eCSSProperty_UNKNOWN && nsCSSProps::IsShorthand(property)) {
property = eCSSProperty_UNKNOWN;
}
MOZ_ASSERT(property == eCSSProperty_UNKNOWN ||
!nsCSSProps::IsShorthand(property),
"should not have shorthand");
--- a/dom/smil/nsSMILAnimationController.cpp
+++ b/dom/smil/nsSMILAnimationController.cpp
@@ -681,17 +681,17 @@ nsSMILAnimationController::GetTargetIden
// width/height are special as they may be attributes or for
// outer-<svg> elements, mapped into style.
if (attributeName == nsGkAtoms::width ||
attributeName == nsGkAtoms::height) {
isCSS = targetElem->GetNameSpaceID() != kNameSpaceID_SVG;
} else {
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(attributeName),
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
isCSS = nsSMILCSSProperty::IsPropertyAnimatable(prop);
}
}
} else {
isCSS = (attributeType == eSMILTargetAttrType_CSS);
}
// Construct the key
--- a/dom/smil/nsSMILCompositor.cpp
+++ b/dom/smil/nsSMILCompositor.cpp
@@ -121,17 +121,17 @@ nsSMILCompositor::ClearAnimationEffects(
// Protected Helper Functions
// --------------------------
nsISMILAttr*
nsSMILCompositor::CreateSMILAttr()
{
if (mKey.mIsCSS) {
nsCSSProperty propId =
nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName),
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
if (nsSMILCSSProperty::IsPropertyAnimatable(propId)) {
return new nsSMILCSSProperty(propId, mKey.mElement.get());
}
} else {
return mKey.mElement->GetAnimatedAttr(mKey.mAttributeNamespaceID,
mKey.mAttributeName);
}
return nullptr;
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -1181,27 +1181,27 @@ MappedAttrParser::ParseMappedAttrValue(n
if (!mDecl) {
mDecl = new css::Declaration();
mDecl->InitializeEmpty();
}
// Get the nsCSSProperty ID for our mapped attribute.
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(nsDependentAtomString(aMappedAttrName),
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
if (propertyID != eCSSProperty_UNKNOWN) {
bool changed = false; // outparam for ParseProperty.
mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
mElement->NodePrincipal(), mDecl, &changed, false, true);
if (changed) {
// The normal reporting of use counters by the nsCSSParser won't happen
// since it doesn't have a sheet.
if (nsCSSProps::IsShorthand(propertyID)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, propertyID,
- nsCSSProps::eEnabledForAllContent) {
+ CSSEnabledState::eAllContent) {
UseCounter useCounter = nsCSSProps::UseCounterFor(*subprop);
if (useCounter != eUseCounter_UNKNOWN) {
mElement->OwnerDoc()->SetDocumentAndPageUseCounter(useCounter);
}
}
} else {
UseCounter useCounter = nsCSSProps::UseCounterFor(propertyID);
if (useCounter != eUseCounter_UNKNOWN) {
@@ -2539,17 +2539,17 @@ nsSVGElement::GetAnimatedAttr(int32_t aN
// targeting width/height on outer-<svg> don't appear to be ignored
// because we returned a nsISMILAttr for the corresponding
// SVGAnimatedLength.
// Mapped attributes:
if (IsAttributeMapped(aName)) {
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(aName),
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
// Check IsPropertyAnimatable to avoid attributes that...
// - map to explicitly unanimatable properties (e.g. 'direction')
// - map to unsupported attributes (e.g. 'glyph-orientation-horizontal')
if (nsSMILCSSProperty::IsPropertyAnimatable(prop)) {
return new nsSMILMappedAttribute(prop, this);
}
}
--- a/editor/libeditor/nsHTMLCSSUtils.cpp
+++ b/editor/libeditor/nsHTMLCSSUtils.cpp
@@ -517,17 +517,17 @@ nsHTMLCSSUtils::GetCSSInlinePropertyBase
MOZ_ASSERT(aStyleType == eSpecified);
RefPtr<css::Declaration> decl = element->GetInlineStyleDeclaration();
if (!decl) {
return NS_OK;
}
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(aProperty),
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
MOZ_ASSERT(prop != eCSSProperty_UNKNOWN);
decl->GetValue(prop, aValue);
return NS_OK;
}
already_AddRefed<nsComputedDOMStyle>
nsHTMLCSSUtils::GetComputedStyle(dom::Element* aElement)
--- a/layout/inspector/inCSSValueSearch.cpp
+++ b/layout/inspector/inCSSValueSearch.cpp
@@ -219,17 +219,17 @@ inCSSValueSearch::SetNormalizeChromeURLs
return NS_OK;
}
NS_IMETHODIMP
inCSSValueSearch::AddPropertyCriteria(const char16_t *aPropName)
{
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentString(aPropName),
- nsCSSProps::eIgnoreEnabledState);
+ CSSEnabledState::eIgnore);
mProperties[mPropertyCount] = prop;
mPropertyCount++;
return NS_OK;
}
NS_IMETHODIMP
inCSSValueSearch::GetTextCriteria(char16_t** aTextCriteria)
{
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -481,17 +481,17 @@ inDOMUtils::SelectorMatchesElement(nsIDO
sel);
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::IsInheritedProperty(const nsAString &aPropertyName, bool *_retval)
{
nsCSSProperty prop =
- nsCSSProps::LookupProperty(aPropertyName, nsCSSProps::eIgnoreEnabledState);
+ nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eIgnore);
if (prop == eCSSProperty_UNKNOWN) {
*_retval = false;
return NS_OK;
}
if (prop == eCSSPropertyExtra_variable) {
*_retval = true;
return NS_OK;
@@ -523,24 +523,24 @@ inDOMUtils::GetCSSPropertyNames(uint32_t
if (aFlags & INCLUDE_ALIASES) {
maxCount += (eCSSProperty_COUNT_with_aliases - eCSSProperty_COUNT);
}
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, nsCSSProps::eEnabledForAllContent)) { \
- props[propCount] = \
- ToNewUnicode(nsDependentCString(kCSSRawProperties[_prop])); \
- ++propCount; \
- } \
+#define DO_PROP(_prop) \
+ PR_BEGIN_MACRO \
+ nsCSSProperty cssProp = nsCSSProperty(_prop); \
+ if (nsCSSProps::IsEnabled(cssProp, CSSEnabledState::eAllContent)) { \
+ props[propCount] = \
+ ToNewUnicode(nsDependentCString(kCSSRawProperties[_prop])); \
+ ++propCount; \
+ } \
PR_END_MACRO
// prop is the property id we're considering; propCount is how many properties
// we've put into props so far.
uint32_t prop = 0, propCount = 0;
for ( ; prop < eCSSProperty_COUNT_no_shorthands; ++prop) {
if (nsCSSProps::PropertyParseType(nsCSSProperty(prop)) !=
CSS_PROPERTY_PARSE_INACCESSIBLE) {
@@ -669,17 +669,17 @@ static void GetOtherValuesForProperty(co
}
NS_IMETHODIMP
inDOMUtils::GetSubpropertiesForCSSProperty(const nsAString& aProperty,
uint32_t* aLength,
char16_t*** aValues)
{
nsCSSProperty propertyID =
- nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}
if (propertyID == eCSSPropertyExtra_variable) {
*aValues = static_cast<char16_t**>(moz_xmalloc(sizeof(char16_t*)));
(*aValues)[0] = ToNewUnicode(aProperty);
@@ -711,17 +711,17 @@ inDOMUtils::GetSubpropertiesForCSSProper
}
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::CssPropertyIsShorthand(const nsAString& aProperty, bool *_retval)
{
nsCSSProperty propertyID =
- nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}
if (propertyID == eCSSPropertyExtra_variable) {
*_retval = false;
} else {
*_retval = nsCSSProps::IsShorthand(propertyID);
@@ -856,17 +856,17 @@ PropertySupportsVariant(nsCSSProperty aP
return (nsCSSProps::ParserVariant(aPropertyID) & aVariant) != 0;
}
NS_IMETHODIMP
inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType,
bool *_retval)
{
nsCSSProperty propertyID =
- nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}
if (propertyID >= eCSSProperty_COUNT) {
*_retval = false;
return NS_OK;
}
@@ -917,17 +917,17 @@ inDOMUtils::CssPropertySupportsType(cons
}
NS_IMETHODIMP
inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
uint32_t* aLength,
char16_t*** aValues)
{
nsCSSProperty propertyID = nsCSSProps::LookupProperty(aProperty,
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}
nsTArray<nsString> array;
// We start collecting the values, BUT colors need to go in first, because array
// needs to stay sorted, and the colors are sorted, so we just append them.
if (propertyID == eCSSPropertyExtra_variable) {
@@ -939,26 +939,26 @@ inDOMUtils::GetCSSValuesForProperty(cons
GetColorsForProperty(propertyParserVariant, array);
if (propertyParserVariant & VARIANT_KEYWORD) {
GetKeywordsForProperty(propertyID, array);
}
GetOtherValuesForProperty(propertyParserVariant, array);
} else {
// Property is shorthand.
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subproperty, propertyID,
- nsCSSProps::eEnabledForAllContent) {
+ CSSEnabledState::eAllContent) {
// Get colors (once) first.
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(*subproperty);
if (propertyParserVariant & VARIANT_COLOR) {
GetColorsForProperty(propertyParserVariant, array);
break;
}
}
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subproperty, propertyID,
- nsCSSProps::eEnabledForAllContent) {
+ CSSEnabledState::eAllContent) {
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(*subproperty);
if (propertyParserVariant & VARIANT_KEYWORD) {
GetKeywordsForProperty(*subproperty, array);
}
GetOtherValuesForProperty(propertyParserVariant, array);
}
}
// All CSS properties take initial, inherit and unset.
@@ -1052,17 +1052,17 @@ inDOMUtils::IsValidCSSColor(const nsAStr
}
NS_IMETHODIMP
inDOMUtils::CssPropertyIsValid(const nsAString& aPropertyName,
const nsAString& aPropertyValue,
bool *_retval)
{
nsCSSProperty propertyID =
- nsCSSProps::LookupProperty(aPropertyName, nsCSSProps::eIgnoreEnabledState);
+ nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eIgnore);
if (propertyID == eCSSProperty_UNKNOWN) {
*_retval = false;
return NS_OK;
}
if (propertyID == eCSSPropertyExtra_variable) {
*_retval = true;
new file mode 100644
--- /dev/null
+++ b/layout/style/CSSEnabledState.h
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * enum for whether a CSS feature (property, pseudo-class, etc.) is
+ * enabled in a specific context
+ */
+
+#ifndef mozilla_CSSEnabledState_h
+#define mozilla_CSSEnabledState_h
+
+#include "mozilla/TypedEnumBits.h"
+
+namespace mozilla {
+
+enum class CSSEnabledState
+{
+ // The default CSSEnabledState: only enable what's enabled for all
+ // content, given the current values of preferences.
+ eAllContent = 0,
+ // Enable features available in UA sheets.
+ eUASheets = 0x01,
+ // Enable features available in chrome code.
+ eChrome = 0x02,
+ // Special value to unconditionally enable everything. This implies
+ // all the bits above, but is strictly more than just their OR-ed
+ // union. This just skips any test so a feature will be enabled even
+ // if it would have been disabled with all the bits above set.
+ eIgnore = 0xff
+};
+
+MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSEnabledState)
+
+} // namespace mozilla
+
+#endif // mozilla_CSSEnabledState_h
--- a/layout/style/Declaration.cpp
+++ b/layout/style/Declaration.cpp
@@ -141,17 +141,17 @@ Declaration::RemoveProperty(nsCSSPropert
MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT);
nsCSSExpandedDataBlock data;
ExpandTo(&data);
MOZ_ASSERT(!mData && !mImportantData, "Expand didn't null things out");
if (nsCSSProps::IsShorthand(aProperty)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty,
- nsCSSProps::eEnabledForAllContent) {
+ CSSEnabledState::eAllContent) {
data.ClearLonghandProperty(*p);
mOrder.RemoveElement(static_cast<uint32_t>(*p));
}
} else {
data.ClearLonghandProperty(aProperty);
mOrder.RemoveElement(static_cast<uint32_t>(aProperty));
}
@@ -507,17 +507,17 @@ Declaration::GetValue(nsCSSProperty aPro
// variable reference and none of its component longhand properties were
// then overridden on the declaration, we return the token stream
// assigned to the shorthand.
const nsCSSValue* tokenStream = nullptr;
uint32_t totalCount = 0, importantCount = 0,
initialCount = 0, inheritCount = 0, unsetCount = 0,
matchingTokenStreamCount = 0, nonMatchingTokenStreamCount = 0;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty,
- nsCSSProps::eEnabledForAllContent) {
+ CSSEnabledState::eAllContent) {
if (*p == eCSSProperty__x_system_font) {
// The system-font subproperty doesn't count.
continue;
}
++totalCount;
const nsCSSValue *val = mData->ValueFor(*p);
MOZ_ASSERT(!val || !mImportantData || !mImportantData->ValueFor(*p),
"can't be in both blocks");
@@ -1428,17 +1428,17 @@ Declaration::GetValue(nsCSSProperty aPro
break;
}
}
bool
Declaration::GetValueIsImportant(const nsAString& aProperty) const
{
nsCSSProperty propID =
- nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState);
+ nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eIgnore);
if (propID == eCSSProperty_UNKNOWN) {
return false;
}
if (propID == eCSSPropertyExtra_variable) {
const nsSubstring& variableName =
Substring(aProperty, CSS_CUSTOM_NAME_PREFIX_LENGTH);
return GetVariableValueIsImportant(variableName);
}
@@ -1453,17 +1453,17 @@ Declaration::GetValueIsImportant(nsCSSPr
// Calling ValueFor is inefficient, but we can assume '!important' is rare.
if (!nsCSSProps::IsShorthand(aProperty)) {
return mImportantData->ValueFor(aProperty) != nullptr;
}
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty,
- nsCSSProps::eEnabledForAllContent) {
+ CSSEnabledState::eAllContent) {
if (*p == eCSSProperty__x_system_font) {
// The system_font subproperty doesn't count.
continue;
}
if (!mImportantData->ValueFor(*p)) {
return false;
}
}
@@ -1567,17 +1567,17 @@ Declaration::ToString(nsAString& aString
nsCSSProperty property = GetPropertyAt(index);
if (property == eCSSPropertyExtra_variable) {
uint32_t variableIndex = mOrder[index] - eCSSProperty_COUNT;
AppendVariableAndValueToString(mVariableOrder[variableIndex], aString);
continue;
}
- if (!nsCSSProps::IsEnabled(property, nsCSSProps::eEnabledForAllContent)) {
+ if (!nsCSSProps::IsEnabled(property, CSSEnabledState::eAllContent)) {
continue;
}
bool doneProperty = false;
// If we already used this property in a shorthand, skip it.
if (shorthandsUsed.Length() > 0) {
for (const nsCSSProperty *shorthands =
nsCSSProps::ShorthandsContaining(property);
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -2816,17 +2816,17 @@ BuildStyleRule(nsCSSProperty aProperty,
declaration->CompressFrom(&block);
RefPtr<css::StyleRule> rule = new css::StyleRule(nullptr, declaration, 0, 0);
return rule.forget();
}
static bool
ComputeValuesFromStyleRule(nsCSSProperty aProperty,
- nsCSSProps::EnabledState aEnabledState,
+ CSSEnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
css::StyleRule* aStyleRule,
nsTArray<PropertyStyleAnimationValuePair>& aValues,
bool* aIsContextSensitive)
{
MOZ_ASSERT(aStyleContext);
if (!nsCSSProps::IsEnabled(aProperty, aEnabledState)) {
@@ -2937,17 +2937,17 @@ StyleAnimationValue::ComputeValue(nsCSSP
// to change depending on the context
*aIsContextSensitive = false;
}
return true;
}
AutoTArray<PropertyStyleAnimationValuePair,1> values;
bool ok = ComputeValuesFromStyleRule(aProperty,
- nsCSSProps::eIgnoreEnabledState,
+ CSSEnabledState::eIgnore,
aTargetElement, aStyleContext, styleRule,
values, aIsContextSensitive);
if (!ok) {
return false;
}
MOZ_ASSERT(values.Length() == 1);
MOZ_ASSERT(values[0].mProperty == aProperty);
@@ -2955,17 +2955,17 @@ StyleAnimationValue::ComputeValue(nsCSSP
aComputedValue = values[0].mValue;
return true;
}
template <class T>
bool
ComputeValuesFromSpecifiedValue(
nsCSSProperty aProperty,
- nsCSSProps::EnabledState aEnabledState,
+ CSSEnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
T& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult)
{
MOZ_ASSERT(aTargetElement, "null target element");
@@ -2983,33 +2983,33 @@ ComputeValuesFromSpecifiedValue(
return ComputeValuesFromStyleRule(aProperty, aEnabledState, aTargetElement,
aStyleContext, styleRule, aResult,
/* aIsContextSensitive */ nullptr);
}
/* static */ bool
StyleAnimationValue::ComputeValues(
nsCSSProperty aProperty,
- nsCSSProps::EnabledState aEnabledState,
+ CSSEnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsAString& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult)
{
return ComputeValuesFromSpecifiedValue(aProperty, aEnabledState,
aTargetElement, aStyleContext,
aSpecifiedValue, aUseSVGMode,
aResult);
}
/* static */ bool
StyleAnimationValue::ComputeValues(
nsCSSProperty aProperty,
- nsCSSProps::EnabledState aEnabledState,
+ CSSEnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsCSSValue& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult)
{
return ComputeValuesFromSpecifiedValue(aProperty, aEnabledState,
aTargetElement, aStyleContext,
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -171,29 +171,29 @@ public:
* On success, when aProperty is a longhand, aResult will have a single
* value in it. When aProperty is a shorthand, aResult will be filled with
* values for all of aProperty's longhand components. aEnabledState
* is used to filter the longhand components that will be appended
* to aResult. On failure, aResult might still have partial results
* in it.
*/
static bool ComputeValues(nsCSSProperty aProperty,
- nsCSSProps::EnabledState aEnabledState,
+ mozilla::CSSEnabledState aEnabledState,
mozilla::dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsAString& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult);
/**
* A variant on ComputeValues that takes an nsCSSValue as the specified
* value. Only longhand properties are supported.
*/
static bool ComputeValues(nsCSSProperty aProperty,
- nsCSSProps::EnabledState aEnabledState,
+ mozilla::CSSEnabledState aEnabledState,
mozilla::dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsCSSValue& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult);
/**
* Creates a specified value for the given computed value.
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -76,16 +76,17 @@ EXPORTS += [
'nsStyleStructFwd.h',
'nsStyleStructInlines.h',
'nsStyleTransformMatrix.h',
'nsStyleUtil.h',
]
EXPORTS.mozilla += [
'AnimationCollection.h',
+ 'CSSEnabledState.h',
'CSSStyleSheet.h',
'CSSVariableDeclarations.h',
'CSSVariableResolver.h',
'CSSVariableValues.h',
'HandleRefPtr.h',
'IncrementalClearCOMRuleArray.h',
'LayerAnimationInfo.h',
'RuleNodeCacheConditions.h',
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -619,17 +619,17 @@ nsCSSExpandedDataBlock::Clear()
AssertInitialState();
}
void
nsCSSExpandedDataBlock::ClearProperty(nsCSSProperty aPropID)
{
if (nsCSSProps::IsShorthand(aPropID)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aPropID,
- nsCSSProps::eIgnoreEnabledState) {
+ CSSEnabledState::eIgnore) {
ClearLonghandProperty(*p);
}
} else {
ClearLonghandProperty(aPropID);
}
}
void
@@ -640,35 +640,35 @@ nsCSSExpandedDataBlock::ClearLonghandPro
ClearPropertyBit(aPropID);
ClearImportantBit(aPropID);
PropertyAt(aPropID)->Reset();
}
bool
nsCSSExpandedDataBlock::TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock,
nsCSSProperty aPropID,
- nsCSSProps::EnabledState aEnabledState,
+ CSSEnabledState aEnabledState,
bool aIsImportant,
bool aOverrideImportant,
bool aMustCallValueAppended,
css::Declaration* aDeclaration,
nsIDocument* aSheetDocument)
{
if (!nsCSSProps::IsShorthand(aPropID)) {
return DoTransferFromBlock(aFromBlock, aPropID,
aIsImportant, aOverrideImportant,
aMustCallValueAppended, aDeclaration,
aSheetDocument);
}
- // We can pass eIgnoreEnabledState (here, and in ClearProperty above) rather
- // than a value corresponding to whether we're parsing a UA style sheet or
- // certified app because we assert in nsCSSProps::AddRefTable that shorthand
- // properties available in these contexts also have all of their
- // subproperties available in these contexts.
+ // We can pass CSSEnabledState::eIgnore (here, and in ClearProperty
+ // above) rather than a value corresponding to whether we're parsing
+ // a UA style sheet or certified app because we assert in nsCSSProps::
+ // AddRefTable that shorthand properties available in these contexts
+ // also have all of their subproperties available in these contexts.
bool changed = false;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aPropID, aEnabledState) {
changed |= DoTransferFromBlock(aFromBlock, *p,
aIsImportant, aOverrideImportant,
aMustCallValueAppended, aDeclaration,
aSheetDocument);
}
return changed;
--- a/layout/style/nsCSSDataBlock.h
+++ b/layout/style/nsCSSDataBlock.h
@@ -259,17 +259,17 @@ public:
* Returns true if something changed, false otherwise. Calls
* |ValueAppended| on |aDeclaration| if the property was not
* previously set, or in any case if |aMustCallValueAppended| is true.
* Calls |SetDocumentAndPageUseCounter| on |aSheetDocument| if it is
* non-null and |aPropID| has a use counter.
*/
bool TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock,
nsCSSProperty aPropID,
- nsCSSProps::EnabledState aEnabledState,
+ mozilla::CSSEnabledState aEnabledState,
bool aIsImportant,
bool aOverrideImportant,
bool aMustCallValueAppended,
mozilla::css::Declaration* aDeclaration,
nsIDocument* aSheetDocument);
/**
* Copies the values for aPropID into the specified aRuleData object.
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -351,26 +351,26 @@ public:
bool ChromeRulesEnabled() const {
return mIsChrome;
}
bool UserRulesEnabled() const {
return mParsingMode == css::eAgentSheetFeatures ||
mParsingMode == css::eUserSheetFeatures;
}
- nsCSSProps::EnabledState PropertyEnabledState() const {
- static_assert(nsCSSProps::eEnabledForAllContent == 0,
- "nsCSSProps::eEnabledForAllContent should be zero for "
+ CSSEnabledState PropertyEnabledState() const {
+ static_assert(int(CSSEnabledState::eAllContent) == 0,
+ "CSSEnabledState::eAllContent should be zero for "
"this bitfield to work");
- nsCSSProps::EnabledState enabledState = nsCSSProps::eEnabledForAllContent;
+ CSSEnabledState enabledState = CSSEnabledState::eAllContent;
if (AgentRulesEnabled()) {
- enabledState |= nsCSSProps::eEnabledInUASheets;
+ enabledState |= CSSEnabledState::eUASheets;
}
if (mIsChrome) {
- enabledState |= nsCSSProps::eEnabledInChrome;
+ enabledState |= CSSEnabledState::eChrome;
}
return enabledState;
}
nsCSSProperty LookupEnabledProperty(const nsAString& aProperty) {
return nsCSSProps::LookupProperty(aProperty, PropertyEnabledState());
}
@@ -16998,17 +16998,17 @@ CSSParserImpl::ParseAll()
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
return false;
}
// It's unlikely we'll want to use 'all' from within a UA style sheet, so
// instead of computing the correct EnabledState value we just expand out
// to all content-visible properties.
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, eCSSProperty_all,
- nsCSSProps::eEnabledForAllContent) {
+ CSSEnabledState::eAllContent) {
AppendValue(*p, value);
}
return true;
}
bool
CSSParserImpl::ParseVariableDeclaration(CSSVariableDeclarations::Type* aType,
nsString& aValue)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -533,23 +533,24 @@ nsCSSProps::LookupProperty(const nsACStr
if (MOZ_LIKELY(res < eCSSProperty_COUNT)) {
if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
res = eCSSProperty_UNKNOWN;
}
return res;
}
MOZ_ASSERT(eCSSAliasCount != 0,
"'res' must be an alias at this point so we better have some!");
- // We intentionally don't support eEnabledInUASheets or eEnabledInChrome
- // for aliases yet because it's unlikely there will be a need for it.
- if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
+ // We intentionally don't support CSSEnabledState::eUASheets or
+ // CSSEnabledState::Chrome for aliases yet because it's unlikely
+ // there will be a need for it.
+ if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnore) {
res = gAliases[res - eCSSProperty_COUNT];
MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
- if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
+ if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnore) {
return res;
}
}
return eCSSProperty_UNKNOWN;
}
nsCSSProperty
nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
@@ -567,23 +568,24 @@ nsCSSProps::LookupProperty(const nsAStri
if (MOZ_LIKELY(res < eCSSProperty_COUNT)) {
if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
res = eCSSProperty_UNKNOWN;
}
return res;
}
MOZ_ASSERT(eCSSAliasCount != 0,
"'res' must be an alias at this point so we better have some!");
- // We intentionally don't support eEnabledInUASheets or eEnabledInChrome
- // for aliases yet because it's unlikely there will be a need for it.
- if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
+ // We intentionally don't support CSSEnabledState::eUASheets or
+ // CSSEnabledState::Chrome for aliases yet because it's unlikely
+ // there will be a need for it.
+ if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnore) {
res = gAliases[res - eCSSProperty_COUNT];
MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
- if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
+ if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnore) {
return res;
}
}
return eCSSProperty_UNKNOWN;
}
nsCSSProperty
nsCSSProps::LookupPropertyByIDLName(const nsACString& aPropertyIDLName,
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -10,16 +10,17 @@
#ifndef nsCSSProps_h___
#define nsCSSProps_h___
#include "nsString.h"
#include "nsCSSProperty.h"
#include "nsStyleStructFwd.h"
#include "nsCSSKeywords.h"
+#include "mozilla/CSSEnabledState.h"
#include "mozilla/UseCounter.h"
// Length of the "--" prefix on custom names (such as custom property names,
// and, in the future, custom media query names).
#define CSS_CUSTOM_NAME_PREFIX_LENGTH 2
// Flags for ParseVariant method
#define VARIANT_KEYWORD 0x000001 // K
@@ -325,39 +326,26 @@ enum nsStyleAnimType {
eStyleAnimType_Shadow,
// property not animatable
eStyleAnimType_None
};
class nsCSSProps {
public:
+ typedef mozilla::CSSEnabledState EnabledState;
+
struct KTableEntry {
nsCSSKeyword mKeyword;
int16_t mValue;
};
static void AddRefTable(void);
static void ReleaseTable(void);
- enum EnabledState {
- // 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 chrome code.
- eEnabledInChrome = 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.
static nsCSSProperty LookupProperty(const nsAString& aProperty,
EnabledState aEnabled);
static nsCSSProperty LookupProperty(const nsACString& aProperty,
EnabledState aEnabled);
// As above, but looked up using a property's IDL name.
@@ -619,43 +607,43 @@ public:
return gPropertyUseCounter[aProperty];
}
static bool IsEnabled(nsCSSProperty aProperty, EnabledState aEnabled)
{
if (IsEnabled(aProperty)) {
return true;
}
- if (aEnabled == eIgnoreEnabledState) {
+ if (aEnabled == EnabledState::eIgnore) {
return true;
}
- if ((aEnabled & eEnabledInUASheets) &&
+ if ((aEnabled & EnabledState::eUASheets) &&
PropHasFlags(aProperty, CSS_PROPERTY_ENABLED_IN_UA_SHEETS))
{
return true;
}
- if ((aEnabled & eEnabledInChrome) &&
+ if ((aEnabled & EnabledState::eChrome) &&
PropHasFlags(aProperty, CSS_PROPERTY_ENABLED_IN_CHROME))
{
return true;
}
return false;
}
public:
// Storing the enabledstate_ value in an nsCSSProperty variable is a small hack
// to avoid needing a separate variable declaration for its real type
-// (nsCSSProps::EnabledState), which would then require using a block and
+// (CSSEnabledState), which would then require using a block and
// therefore a pair of macros by consumers for the start and end of the loop.
#define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(it_, prop_, enabledstate_) \
for (const nsCSSProperty *it_ = nsCSSProps::SubpropertyEntryFor(prop_), \
es_ = (nsCSSProperty) (enabledstate_); \
*it_ != eCSSProperty_UNKNOWN; ++it_) \
- if (nsCSSProps::IsEnabled(*it_, (nsCSSProps::EnabledState) es_))
+ if (nsCSSProps::IsEnabled(*it_, (mozilla::CSSEnabledState) es_))
// Keyword/Enum value tables
static const KTableEntry kAnimationDirectionKTable[];
static const KTableEntry kAnimationFillModeKTable[];
static const KTableEntry kAnimationIterationCountKTable[];
static const KTableEntry kAnimationPlayStateKTable[];
static const KTableEntry kAnimationTimingFunctionKTable[];
static const KTableEntry kAppearanceKTable[];
@@ -835,33 +823,9 @@ public:
static const KTableEntry kWidthKTable[]; // also min-width, max-width
static const KTableEntry kWindowDraggingKTable[];
static const KTableEntry kWindowShadowKTable[];
static const KTableEntry kWordBreakKTable[];
static const KTableEntry kWordWrapKTable[];
static const KTableEntry kWritingModeKTable[];
};
-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___ */
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -93,18 +93,17 @@ struct nsComputedStyleMap
bool IsLayoutFlushNeeded() const
{
return nsCSSProps::PropHasFlags(mProperty,
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH);
}
bool IsEnabled() const
{
- return nsCSSProps::IsEnabled(mProperty,
- nsCSSProps::eEnabledForAllContent);
+ return nsCSSProps::IsEnabled(mProperty, CSSEnabledState::eAllContent);
}
};
// We define this enum just to count the total number of properties that can
// be exposed on an nsComputedDOMStyle, including properties that may be
// disabled.
enum {
#define COMPUTED_STYLE_PROP(prop_, method_) \
@@ -760,18 +759,18 @@ nsComputedDOMStyle::ClearCurrentStyleSou
if (!mResolvedStyleContext) {
mStyleContext = nullptr;
}
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
{
- nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName,
- nsCSSProps::eEnabledForAllContent);
+ nsCSSProperty prop =
+ nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eAllContent);
bool needsLayoutFlush;
nsComputedStyleMap::Entry::ComputeMethod getter;
if (prop == eCSSPropertyExtra_variable) {
needsLayoutFlush = false;
getter = nullptr;
} else {
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -191,18 +191,17 @@ nsDOMCSSDeclaration::IndexedGetter(uint3
aFound = decl && decl->GetNthProperty(aIndex, aPropName);
}
NS_IMETHODIMP
nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID =
- nsCSSProps::LookupProperty(aPropertyName,
- nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
}
if (propID == eCSSPropertyExtra_variable) {
GetCustomPropertyValue(aPropertyName, aReturn);
return NS_OK;
@@ -211,18 +210,17 @@ nsDOMCSSDeclaration::GetPropertyValue(co
return GetPropertyValue(propID, aReturn);
}
NS_IMETHODIMP
nsDOMCSSDeclaration::GetAuthoredPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID =
- nsCSSProps::LookupProperty(aPropertyName,
- nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
}
if (propID == eCSSPropertyExtra_variable) {
GetCustomPropertyValue(aPropertyName, aReturn);
return NS_OK;
@@ -253,18 +251,17 @@ nsDOMCSSDeclaration::GetPropertyPriority
NS_IMETHODIMP
nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
const nsAString& aValue,
const nsAString& aPriority)
{
// In the common (and fast) cases we can use the property id
nsCSSProperty propID =
- nsCSSProps::LookupProperty(aPropertyName,
- nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eAllContent);
if (propID == eCSSProperty_UNKNOWN) {
return NS_OK;
}
if (aValue.IsEmpty()) {
// If the new value of the property is an empty string we remove the
// property.
// XXX this ignores the priority string, should it?
@@ -290,18 +287,17 @@ nsDOMCSSDeclaration::SetProperty(const n
return ParsePropertyValue(propID, aValue, important);
}
NS_IMETHODIMP
nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID =
- nsCSSProps::LookupProperty(aPropertyName,
- nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
}
if (propID == eCSSPropertyExtra_variable) {
RemoveCustomProperty(aPropertyName);
return NS_OK;
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -5385,17 +5385,17 @@ nsRuleNode::ComputeDisplayData(void* aSt
} else if (property.list) {
const nsCSSValue &val = property.list->mValue;
if (val.GetUnit() == eCSSUnit_Ident) {
nsDependentString
propertyStr(property.list->mValue.GetStringBufferValue());
nsCSSProperty prop =
nsCSSProps::LookupProperty(propertyStr,
- nsCSSProps::eEnabledForAllContent);
+ CSSEnabledState::eAllContent);
if (prop == eCSSProperty_UNKNOWN ||
prop == eCSSPropertyExtra_variable) {
transition->SetUnknownProperty(prop, propertyStr);
} else {
transition->SetProperty(prop);
}
} else {
MOZ_ASSERT(val.GetUnit() == eCSSUnit_All,
@@ -6175,18 +6175,17 @@ nsRuleNode::ComputeDisplayData(void* aSt
if (buffer.EqualsLiteral("opacity")) {
display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_OPACITY;
}
if (buffer.EqualsLiteral("scroll-position")) {
display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_SCROLL;
}
nsCSSProperty prop =
- nsCSSProps::LookupProperty(buffer,
- nsCSSProps::eEnabledForAllContent);
+ nsCSSProps::LookupProperty(buffer, CSSEnabledState::eAllContent);
if (prop != eCSSProperty_UNKNOWN &&
prop != eCSSPropertyExtra_variable) {
// If the property given is a shorthand, it indicates the expectation
// for all the longhands the shorthand expands to.
if (nsCSSProps::IsShorthand(prop)) {
for (const nsCSSProperty* shorthands =
nsCSSProps::SubpropertyEntryFor(prop);
*shorthands != eCSSProperty_UNKNOWN; ++shorthands) {
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2778,17 +2778,17 @@ mozilla::StyleTransition::SetInitialValu
mProperty = eCSSPropertyExtra_all_properties;
}
void
mozilla::StyleTransition::SetUnknownProperty(nsCSSProperty aProperty,
const nsAString& aPropertyString)
{
MOZ_ASSERT(nsCSSProps::LookupProperty(aPropertyString,
- nsCSSProps::eEnabledForAllContent) ==
+ CSSEnabledState::eAllContent) ==
aProperty,
"property and property string should match");
MOZ_ASSERT(aProperty == eCSSProperty_UNKNOWN ||
aProperty == eCSSPropertyExtra_variable,
"should be either unknown or custom property");
mProperty = aProperty;
mUnknownProperty = NS_Atomize(aPropertyString);
}
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -409,17 +409,17 @@ nsTransitionManager::UpdateTransitions(
p < eCSSProperty_COUNT_no_shorthands;
p = nsCSSProperty(p + 1)) {
ConsiderStartingTransition(p, t, aElement, aElementTransitions,
aOldStyleContext, aNewStyleContext,
&startedAny, &whichStarted);
}
} else if (nsCSSProps::IsShorthand(property)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, property,
- nsCSSProps::eEnabledForAllContent)
+ CSSEnabledState::eAllContent)
{
ConsiderStartingTransition(*subprop, t, aElement, aElementTransitions,
aOldStyleContext, aNewStyleContext,
&startedAny, &whichStarted);
}
} else {
ConsiderStartingTransition(property, t, aElement, aElementTransitions,
aOldStyleContext, aNewStyleContext,
@@ -454,17 +454,17 @@ nsTransitionManager::UpdateTransitions(
} else if (property == eCSSPropertyExtra_all_properties) {
for (nsCSSProperty p = nsCSSProperty(0);
p < eCSSProperty_COUNT_no_shorthands;
p = nsCSSProperty(p + 1)) {
allTransitionProperties.AddProperty(p);
}
} else if (nsCSSProps::IsShorthand(property)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
- subprop, property, nsCSSProps::eEnabledForAllContent) {
+ subprop, property, CSSEnabledState::eAllContent) {
allTransitionProperties.AddProperty(*subprop);
}
} else {
allTransitionProperties.AddProperty(property);
}
}
}
@@ -525,17 +525,17 @@ nsTransitionManager::ConsiderStartingTra
MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty),
"property out of range");
NS_ASSERTION(!aElementTransitions ||
aElementTransitions->mElement == aElement, "Element mismatch");
// Ignore disabled properties. We can arrive here if the transition-property
// is 'all' and the disabled property has a default value which derives value
// from another property, e.g. color.
- if (!nsCSSProps::IsEnabled(aProperty, nsCSSProps::eEnabledForAllContent)) {
+ if (!nsCSSProps::IsEnabled(aProperty, CSSEnabledState::eAllContent)) {
return;
}
if (aWhichStarted->HasProperty(aProperty)) {
// A later item in transition-property already started a
// transition for this property, so we ignore this one.
// See comment above and
// http://lists.w3.org/Archives/Public/www-style/2009Aug/0109.html .
--- a/layout/style/test/TestCSSPropertyLookup.cpp
+++ b/layout/style/test/TestCSSPropertyLookup.cpp
@@ -4,16 +4,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdio.h>
#include "plstr.h"
#include "nsCSSProps.h"
#include "nsCSSKeywords.h"
#include "nsString.h"
#include "nsXPCOM.h"
+using namespace mozilla;
+
static const char* const kJunkNames[] = {
nullptr,
"",
"123",
"backgroundz",
"zzzzzz",
"#@$&@#*@*$@$#"
};
@@ -36,48 +38,48 @@ TestProps()
const char*const* end = &kCSSRawProperties[eCSSProperty_COUNT];
index = eCSSProperty_UNKNOWN;
while (et < end) {
char tagName[100];
PL_strcpy(tagName, *et);
index = nsCSSProperty(int32_t(index) + 1);
id = nsCSSProps::LookupProperty(nsCString(tagName),
- nsCSSProps::eIgnoreEnabledState);
+ CSSEnabledState::eIgnore);
if (id == eCSSProperty_UNKNOWN) {
printf("bug: can't find '%s'\n", tagName);
success = false;
}
if (id != index) {
printf("bug: name='%s' id=%d index=%d\n", tagName, id, index);
success = false;
}
// fiddle with the case to make sure we can still find it
if (('a' <= tagName[0]) && (tagName[0] <= 'z')) {
tagName[0] = tagName[0] - 32;
}
id = nsCSSProps::LookupProperty(NS_ConvertASCIItoUTF16(tagName),
- nsCSSProps::eIgnoreEnabledState);
+ CSSEnabledState::eIgnore);
if (id < 0) {
printf("bug: can't find '%s'\n", tagName);
success = false;
}
if (index != id) {
printf("bug: name='%s' id=%d index=%d\n", tagName, id, index);
success = false;
}
et++;
}
// 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::eIgnoreEnabledState);
+ CSSEnabledState::eIgnore);
if (id >= 0) {
printf("bug: found '%s'\n", tag ? tag : "(null)");
success = false;
}
}
nsCSSProps::ReleaseTable();
return success;