diff --git a/dom/animation/AnimValuesStyleRule.h b/dom/animation/AnimValuesStyleRule.h index 97f7d4f5309a..2492ad89a345 100644 --- a/dom/animation/AnimValuesStyleRule.h +++ b/dom/animation/AnimValuesStyleRule.h @@ -8,7 +8,7 @@ #define mozilla_AnimValuesStyleRule_h #include "mozilla/StyleAnimationValue.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSPropertySet.h" #include "nsIStyleRule.h" #include "nsISupportsImpl.h" // For NS_DECL_ISUPPORTS @@ -36,7 +36,7 @@ public: void List(FILE* out = stdout, int32_t aIndent = 0) const override; #endif - void AddValue(nsCSSProperty aProperty, const StyleAnimationValue &aStartValue) + void AddValue(nsCSSPropertyID aProperty, const StyleAnimationValue &aStartValue) { PropertyStyleAnimationValuePair pair = { aProperty, aStartValue }; mPropertyValuePairs.AppendElement(pair); @@ -44,7 +44,7 @@ public: nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]); } - void AddValue(nsCSSProperty aProperty, StyleAnimationValue&& aStartValue) + void AddValue(nsCSSPropertyID aProperty, StyleAnimationValue&& aStartValue) { PropertyStyleAnimationValuePair* pair = mPropertyValuePairs.AppendElement(); pair->mProperty = aProperty; diff --git a/dom/animation/Animation.h b/dom/animation/Animation.h index 6cefb33a1e78..03536a3d7477 100644 --- a/dom/animation/Animation.h +++ b/dom/animation/Animation.h @@ -18,7 +18,7 @@ #include "mozilla/DOMEventTargetHelper.h" // for DOMEventTargetHelper #include "mozilla/dom/KeyframeEffect.h" // for KeyframeEffectReadOnly #include "mozilla/dom/Promise.h" // for Promise -#include "nsCSSProperty.h" // for nsCSSProperty +#include "nsCSSPropertyID.h" // for nsCSSPropertyID #include "nsIGlobalObject.h" // X11 has a #define for CurrentTime. diff --git a/dom/animation/EffectCompositor.cpp b/dom/animation/EffectCompositor.cpp index a4fa81226b6b..0401dd8ba389 100644 --- a/dom/animation/EffectCompositor.cpp +++ b/dom/animation/EffectCompositor.cpp @@ -61,7 +61,7 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(EffectCompositor, Release) // Returns true if there are eligible animations, false otherwise. bool FindAnimationsForCompositor(const nsIFrame* aFrame, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, nsTArray>* aMatches /*out*/) { MOZ_ASSERT(!aMatches || aMatches->IsEmpty(), @@ -433,14 +433,14 @@ EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker) /* static */ bool EffectCompositor::HasAnimationsForCompositor(const nsIFrame* aFrame, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { return FindAnimationsForCompositor(aFrame, aProperty, nullptr); } /* static */ nsTArray> EffectCompositor::GetAnimationsForCompositor(const nsIFrame* aFrame, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { nsTArray> result; @@ -456,7 +456,7 @@ EffectCompositor::GetAnimationsForCompositor(const nsIFrame* aFrame, /* static */ void EffectCompositor::ClearIsRunningOnCompositor(const nsIFrame *aFrame, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { EffectSet* effects = EffectSet::GetEffectSet(aFrame); if (!effects) { @@ -616,7 +616,7 @@ EffectCompositor::GetOverriddenProperties(nsStyleContext* aStyleContext, nsCSSPropertySet& aPropertiesOverridden) { - AutoTArray propertiesToTrack; + AutoTArray propertiesToTrack; { nsCSSPropertySet propertiesToTrackAsSet; for (KeyframeEffectReadOnly* effect : aEffectSet) { @@ -748,7 +748,7 @@ EffectCompositor::GetPresContext(Element* aElement) /* static */ void EffectCompositor::SetPerformanceWarning( const nsIFrame *aFrame, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, const AnimationPerformanceWarning& aWarning) { EffectSet* effects = EffectSet::GetEffectSet(aFrame); diff --git a/dom/animation/EffectCompositor.h b/dom/animation/EffectCompositor.h index d9a6f68f6dd7..726b63173649 100644 --- a/dom/animation/EffectCompositor.h +++ b/dom/animation/EffectCompositor.h @@ -12,7 +12,7 @@ #include "mozilla/OwningNonNull.h" #include "mozilla/PseudoElementHashEntry.h" #include "mozilla/RefPtr.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCycleCollectionParticipant.h" #include "nsDataHashtable.h" #include "nsIStyleRuleProcessor.h" @@ -162,14 +162,14 @@ public: } static bool HasAnimationsForCompositor(const nsIFrame* aFrame, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); static nsTArray> GetAnimationsForCompositor(const nsIFrame* aFrame, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); static void ClearIsRunningOnCompositor(const nsIFrame* aFrame, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); // Update animation cascade results for the specified (pseudo-)element // but only if we have marked the cascade as needing an update due a @@ -212,7 +212,7 @@ public: // |aProperty|. static void SetPerformanceWarning( const nsIFrame* aFrame, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, const AnimationPerformanceWarning& aWarning); private: diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index 955e4e30b566..a283b9402074 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -492,7 +492,7 @@ KeyframeEffectReadOnly::SetKeyframes(nsTArray&& aKeyframes, } const AnimationProperty* -KeyframeEffectReadOnly::GetAnimationOfProperty(nsCSSProperty aProperty) const +KeyframeEffectReadOnly::GetAnimationOfProperty(nsCSSPropertyID aProperty) const { for (size_t propIdx = 0, propEnd = mProperties.Length(); propIdx != propEnd; ++propIdx) { @@ -725,7 +725,7 @@ KeyframeEffectReadOnly::IsRunningOnCompositor() const } void -KeyframeEffectReadOnly::SetIsRunningOnCompositor(nsCSSProperty aProperty, +KeyframeEffectReadOnly::SetIsRunningOnCompositor(nsCSSPropertyID aProperty, bool aIsRunning) { MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty, @@ -1005,7 +1005,7 @@ KeyframeEffectReadOnly::GetTarget( } static void -CreatePropertyValue(nsCSSProperty aProperty, +CreatePropertyValue(nsCSSPropertyID aProperty, float aOffset, const Maybe& aTimingFunction, const StyleAnimationValue& aValue, @@ -1132,7 +1132,7 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx, // nsCSSValue::AppendToString does not accept shorthands properties but // works with token stream values if we pass eCSSProperty_UNKNOWN as // the property. - nsCSSProperty propertyForSerializing = + nsCSSPropertyID propertyForSerializing = nsCSSProps::IsShorthand(propertyValue.mProperty) ? eCSSProperty_UNKNOWN : propertyValue.mProperty; @@ -1352,7 +1352,7 @@ KeyframeEffectReadOnly::GetPresContext() const /* static */ bool KeyframeEffectReadOnly::IsGeometricProperty( - const nsCSSProperty aProperty) + const nsCSSPropertyID aProperty) { switch (aProperty) { case eCSSProperty_bottom: @@ -1438,7 +1438,7 @@ KeyframeEffectReadOnly::ShouldBlockAsyncTransformAnimations( void KeyframeEffectReadOnly::SetPerformanceWarning( - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, const AnimationPerformanceWarning& aWarning) { for (AnimationProperty& property : mProperties) { @@ -1459,7 +1459,7 @@ KeyframeEffectReadOnly::SetPerformanceWarning( } static already_AddRefed -CreateStyleContextForAnimationValue(nsCSSProperty aProperty, +CreateStyleContextForAnimationValue(nsCSSPropertyID aProperty, StyleAnimationValue aValue, nsStyleContext* aBaseStyleContext) { diff --git a/dom/animation/KeyframeEffect.h b/dom/animation/KeyframeEffect.h index c21641a93f17..d20d9a03687c 100644 --- a/dom/animation/KeyframeEffect.h +++ b/dom/animation/KeyframeEffect.h @@ -8,7 +8,7 @@ #define mozilla_dom_KeyframeEffect_h #include "nsChangeHint.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSValue.h" #include "nsCycleCollectionParticipant.h" #include "nsTArray.h" @@ -59,7 +59,7 @@ struct AnimationPropertyDetails; */ struct PropertyValuePair { - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; // The specified value for the property. For shorthand properties or invalid // property values, we store the specified property value as a token stream // (string). @@ -134,7 +134,7 @@ struct AnimationPropertySegment struct AnimationProperty { - nsCSSProperty mProperty = eCSSProperty_UNKNOWN; + nsCSSPropertyID mProperty = eCSSProperty_UNKNOWN; // Does this property win in the CSS Cascade? // @@ -290,8 +290,8 @@ public: void SetKeyframes(nsTArray&& aKeyframes, nsStyleContext* aStyleContext); const AnimationProperty* - GetAnimationOfProperty(nsCSSProperty aProperty) const; - bool HasAnimationOfProperty(nsCSSProperty aProperty) const { + GetAnimationOfProperty(nsCSSPropertyID aProperty) const; + bool HasAnimationOfProperty(nsCSSPropertyID aProperty) const { return GetAnimationOfProperty(aProperty) != nullptr; } const InfallibleTArray& Properties() const { @@ -313,7 +313,7 @@ public: nsCSSPropertySet& aSetProperties); // Returns true if at least one property is being animated on compositor. bool IsRunningOnCompositor() const; - void SetIsRunningOnCompositor(nsCSSProperty aProperty, bool aIsRunning); + void SetIsRunningOnCompositor(nsCSSPropertyID aProperty, bool aIsRunning); void ResetIsRunningOnCompositor(); // Returns true if this effect, applied to |aFrame|, contains properties @@ -338,7 +338,7 @@ public: // compositor. |aParams| and |aParamsLength| are optional parameters which // will be used to generate a localized message for devtools. void SetPerformanceWarning( - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, const AnimationPerformanceWarning& aWarning); // Cumulative change hint on each segment for each property. @@ -434,7 +434,7 @@ private: static bool CanAnimateTransformOnCompositor( const nsIFrame* aFrame, AnimationPerformanceWarning::Type& aPerformanceWarning); - static bool IsGeometricProperty(const nsCSSProperty aProperty); + static bool IsGeometricProperty(const nsCSSPropertyID aProperty); static const TimeDuration OverflowRegionRefreshInterval(); }; diff --git a/dom/animation/KeyframeEffectParams.cpp b/dom/animation/KeyframeEffectParams.cpp index f87debc997e6..f1bc39674668 100644 --- a/dom/animation/KeyframeEffectParams.cpp +++ b/dom/animation/KeyframeEffectParams.cpp @@ -105,7 +105,7 @@ ConsumeIdentToken(RangedPtr& aIter, /* static */ void KeyframeEffectParams::ParseSpacing(const nsAString& aSpacing, SpacingMode& aSpacingMode, - nsCSSProperty& aPacedProperty, + nsCSSPropertyID& aPacedProperty, nsAString& aInvalidPacedProperty, ErrorResult& aRv) { diff --git a/dom/animation/KeyframeEffectParams.h b/dom/animation/KeyframeEffectParams.h index 53e438b89624..fd7d3e1009f6 100644 --- a/dom/animation/KeyframeEffectParams.h +++ b/dom/animation/KeyframeEffectParams.h @@ -45,14 +45,14 @@ struct KeyframeEffectParams */ static void ParseSpacing(const nsAString& aSpacing, SpacingMode& aSpacingMode, - nsCSSProperty& aPacedProperty, + nsCSSPropertyID& aPacedProperty, nsAString& aInvalidPacedProperty, ErrorResult& aRv); // FIXME: Bug 1216843: Add IterationCompositeOperations and // Bug 1216844: Add CompositeOperation SpacingMode mSpacingMode = SpacingMode::distribute; - nsCSSProperty mPacedProperty = eCSSProperty_UNKNOWN; + nsCSSPropertyID mPacedProperty = eCSSProperty_UNKNOWN; }; } // namespace mozilla diff --git a/dom/animation/KeyframeUtils.cpp b/dom/animation/KeyframeUtils.cpp index e28d34775cf1..422bda9e9cdc 100644 --- a/dom/animation/KeyframeUtils.cpp +++ b/dom/animation/KeyframeUtils.cpp @@ -39,7 +39,7 @@ const double kNotPaceable = -1.0; enum class ListAllowance { eDisallow, eAllow }; /** - * A comparator to sort nsCSSProperty values such that longhands are sorted + * A comparator to sort nsCSSPropertyID values such that longhands are sorted * before shorthands, and shorthands with fewer components are sorted before * shorthands with more components. * @@ -61,13 +61,13 @@ public: PropertyPriorityComparator() : mSubpropertyCountInitialized(false) {} - bool Equals(nsCSSProperty aLhs, nsCSSProperty aRhs) const + bool Equals(nsCSSPropertyID aLhs, nsCSSPropertyID aRhs) const { return aLhs == aRhs; } - bool LessThan(nsCSSProperty aLhs, - nsCSSProperty aRhs) const + bool LessThan(nsCSSPropertyID aLhs, + nsCSSPropertyID aRhs) const { bool isShorthandLhs = nsCSSProps::IsShorthand(aLhs); bool isShorthandRhs = nsCSSProps::IsShorthand(aRhs); @@ -97,7 +97,7 @@ public: nsCSSProps::PropertyIDLNameSortPosition(aRhs); } - uint32_t SubpropertyCount(nsCSSProperty aProperty) const + uint32_t SubpropertyCount(nsCSSPropertyID aProperty) const { if (!mSubpropertyCountInitialized) { PodZero(&mSubpropertyCount); @@ -205,7 +205,7 @@ public: private: struct PropertyAndIndex { - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; size_t mIndex; // Index of mProperty within mProperties typedef TPropertyPriorityComparator Comparator; @@ -225,7 +225,7 @@ private: */ struct PropertyValuesPair { - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; nsTArray mValues; typedef TPropertyPriorityComparator Comparator; @@ -237,7 +237,7 @@ struct PropertyValuesPair */ struct AdditionalProperty { - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; size_t mJsidIndex; // Index into |ids| in GetPropertyValuesPairs. struct PropertyComparator @@ -265,7 +265,7 @@ struct AdditionalProperty */ struct KeyframeValueEntry { - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; StyleAnimationValue mValue; float mOffset; Maybe mTimingFunction; @@ -370,7 +370,7 @@ AppendValueAsString(JSContext* aCx, JS::Handle aValue); static PropertyValuePair -MakePropertyValuePair(nsCSSProperty aProperty, const nsAString& aStringValue, +MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue, nsCSSParser& aParser, nsIDocument* aDocument); static bool @@ -411,7 +411,7 @@ PaceRange(const Range& aKeyframes, static nsTArray GetCumulativeDistances(const nsTArray& aValues, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); // ------------------------------------------------------------------ // @@ -474,7 +474,7 @@ KeyframeUtils::GetKeyframesFromObject(JSContext* aCx, /* static */ void KeyframeUtils::ApplySpacing(nsTArray& aKeyframes, SpacingMode aSpacingMode, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, nsTArray& aComputedValues) { if (aKeyframes.IsEmpty()) { @@ -672,7 +672,7 @@ KeyframeUtils::GetAnimationPropertiesFromKeyframes( } /* static */ bool -KeyframeUtils::IsAnimatableProperty(nsCSSProperty aProperty) +KeyframeUtils::IsAnimatableProperty(nsCSSPropertyID aProperty) { if (aProperty == eCSSProperty_UNKNOWN) { return false; @@ -863,7 +863,7 @@ GetPropertyValuesPairs(JSContext* aCx, if (!propName.init(aCx, ids[i])) { return false; } - nsCSSProperty property = + nsCSSPropertyID property = nsCSSProps::LookupPropertyByIDLName(propName, CSSEnabledState::eForAllContent); if (KeyframeUtils::IsAnimatableProperty(property)) { @@ -964,7 +964,7 @@ AppendValueAsString(JSContext* aCx, * @return The constructed PropertyValuePair object. */ static PropertyValuePair -MakePropertyValuePair(nsCSSProperty aProperty, const nsAString& aStringValue, +MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue, nsCSSParser& aParser, nsIDocument* aDocument) { MOZ_ASSERT(aDocument); @@ -1116,7 +1116,7 @@ BuildSegmentsFromValueEntries(nsStyleContext* aStyleContext, // following loop takes care to identify properties that lack a value at // offset 0.0/1.0 and drops those properties from |aResult|. - nsCSSProperty lastProperty = eCSSProperty_UNKNOWN; + nsCSSPropertyID lastProperty = eCSSProperty_UNKNOWN; AnimationProperty* animationProperty = nullptr; size_t i = 0, n = aEntries.Length(); @@ -1335,7 +1335,7 @@ RequiresAdditiveAnimation(const nsTArray& aKeyframes, nsCSSPropertySet propertiesWithFromValue; // Those with a defined 0% value. nsCSSPropertySet propertiesWithToValue; // Those with a defined 100% value. - auto addToPropertySets = [&](nsCSSProperty aProperty, double aOffset) { + auto addToPropertySets = [&](nsCSSPropertyID aProperty, double aOffset) { properties.AddProperty(aProperty); if (aOffset == 0.0) { propertiesWithFromValue.AddProperty(aProperty); @@ -1500,7 +1500,7 @@ PaceRange(const Range& aKeyframes, */ static nsTArray GetCumulativeDistances(const nsTArray& aValues, - nsCSSProperty aPacedProperty) + nsCSSPropertyID aPacedProperty) { // a) If aPacedProperty is a shorthand property, get its components. // Otherwise, just add the longhand property into the set. @@ -1552,7 +1552,7 @@ GetCumulativeDistances(const nsTArray& aValues, // Apply the distance by the square root of the sum of squares of // longhand component distances. for (size_t propIdx = 0; propIdx < pacedPropertyCount; ++propIdx) { - nsCSSProperty prop = prevPacedValues[propIdx].mProperty; + nsCSSPropertyID prop = prevPacedValues[propIdx].mProperty; MOZ_ASSERT(pacedValues[propIdx].mProperty == prop, "Property mismatch"); diff --git a/dom/animation/KeyframeUtils.h b/dom/animation/KeyframeUtils.h index ff2e73d1211c..993aed790e73 100644 --- a/dom/animation/KeyframeUtils.h +++ b/dom/animation/KeyframeUtils.h @@ -98,7 +98,7 @@ public: */ static void ApplySpacing(nsTArray& aKeyframes, SpacingMode aSpacingMode, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, nsTArray& aComputedValues); /** @@ -137,7 +137,7 @@ public: * @param aProperty The property to check. * @return true if |aProperty| is animatable. */ - static bool IsAnimatableProperty(nsCSSProperty aProperty); + static bool IsAnimatableProperty(nsCSSPropertyID aProperty); }; } // namespace mozilla diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index a12d872a6004..97e67a8b0439 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2415,7 +2415,7 @@ nsDOMWindowUtils::BeginTabSwitch() } static bool -ComputeAnimationValue(nsCSSProperty aProperty, +ComputeAnimationValue(nsCSSPropertyID aProperty, Element* aElement, const nsAString& aInput, StyleAnimationValue& aOutput) @@ -2675,7 +2675,7 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement, nsCOMPtr content = do_QueryInterface(aElement, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCSSProperty property = + nsCSSPropertyID property = nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eIgnoreEnabledState); if (property != eCSSProperty_UNKNOWN && nsCSSProps::IsShorthand(property)) { property = eCSSProperty_UNKNOWN; diff --git a/dom/base/nsTreeSanitizer.cpp b/dom/base/nsTreeSanitizer.cpp index a7eb99b20211..1797f85b165c 100644 --- a/dom/base/nsTreeSanitizer.cpp +++ b/dom/base/nsTreeSanitizer.cpp @@ -12,7 +12,7 @@ #include "mozilla/css/StyleRule.h" #include "mozilla/css/Rule.h" #include "nsCSSParser.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsUnicharInputStream.h" #include "nsIDOMCSSRule.h" #include "nsAttrName.h" diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index a1a893c76ac9..481c955a2c42 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -2403,8 +2403,8 @@ CanvasRenderingContext2D::SetShadowColor(const nsAString& aShadowColor) static already_AddRefed CreateDeclaration(nsINode* aNode, - const nsCSSProperty aProp1, const nsAString& aValue1, bool* aChanged1, - const nsCSSProperty aProp2, const nsAString& aValue2, bool* aChanged2) + const nsCSSPropertyID aProp1, const nsAString& aValue1, bool* aChanged1, + const nsCSSPropertyID aProp2, const nsAString& aValue2, bool* aChanged2) { nsIPrincipal* principal = aNode->NodePrincipal(); nsIDocument* document = aNode->OwnerDoc(); @@ -2489,7 +2489,7 @@ GetFontParentStyleContext(Element* aElement, nsIPresShell* aPresShell, } static bool -PropertyIsInheritOrInitial(Declaration* aDeclaration, const nsCSSProperty aProperty) +PropertyIsInheritOrInitial(Declaration* aDeclaration, const nsCSSPropertyID aProperty) { // We know the declaration is not !important, so we can use // GetNormalBlock(). diff --git a/dom/html/HTMLHRElement.cpp b/dom/html/HTMLHRElement.cpp index 62c40154ee64..5ae7acc28d66 100644 --- a/dom/html/HTMLHRElement.cpp +++ b/dom/html/HTMLHRElement.cpp @@ -206,7 +206,7 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes, // 10000px on all corners; this triggers the clamping to make // circular ends. This assumes the
isn't larger than // that in *both* dimensions. - for (const nsCSSProperty* props = + for (const nsCSSPropertyID* props = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius); *props != eCSSProperty_UNKNOWN; ++props) { nsCSSValue* dimen = aData->ValueFor(*props); diff --git a/dom/smil/nsSMILAnimationController.cpp b/dom/smil/nsSMILAnimationController.cpp index 26df81568fdf..965143c15dd0 100644 --- a/dom/smil/nsSMILAnimationController.cpp +++ b/dom/smil/nsSMILAnimationController.cpp @@ -693,7 +693,7 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation( attributeName == nsGkAtoms::height) { isCSS = targetElem->GetNameSpaceID() != kNameSpaceID_SVG; } else { - nsCSSProperty prop = + nsCSSPropertyID prop = nsCSSProps::LookupProperty(nsDependentAtomString(attributeName), CSSEnabledState::eForAllContent); isCSS = nsSMILCSSProperty::IsPropertyAnimatable(prop); diff --git a/dom/smil/nsSMILCSSProperty.cpp b/dom/smil/nsSMILCSSProperty.cpp index 72225399d42e..53f3e0fbf754 100644 --- a/dom/smil/nsSMILCSSProperty.cpp +++ b/dom/smil/nsSMILCSSProperty.cpp @@ -22,7 +22,7 @@ using namespace mozilla::dom; // Helper function static bool GetCSSComputedValue(Element* aElem, - nsCSSProperty aPropID, + nsCSSPropertyID aPropID, nsAString& aResult) { MOZ_ASSERT(!nsCSSProps::IsShorthand(aPropID), @@ -52,7 +52,7 @@ GetCSSComputedValue(Element* aElem, } // Class Methods -nsSMILCSSProperty::nsSMILCSSProperty(nsCSSProperty aPropID, +nsSMILCSSProperty::nsSMILCSSProperty(nsCSSPropertyID aPropID, Element* aElement) : mPropID(aPropID), mElement(aElement) { @@ -186,7 +186,7 @@ nsSMILCSSProperty::ClearAnimValue() // Based on http://www.w3.org/TR/SVG/propidx.html // static bool -nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID) +nsSMILCSSProperty::IsPropertyAnimatable(nsCSSPropertyID aPropID) { // NOTE: Right now, Gecko doesn't recognize the following properties from // the SVG Property Index: diff --git a/dom/smil/nsSMILCSSProperty.h b/dom/smil/nsSMILCSSProperty.h index ff532dc54605..028a9aaa2de3 100644 --- a/dom/smil/nsSMILCSSProperty.h +++ b/dom/smil/nsSMILCSSProperty.h @@ -12,7 +12,7 @@ #include "mozilla/Attributes.h" #include "nsISMILAttr.h" #include "nsIAtom.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSValue.h" namespace mozilla { @@ -34,7 +34,7 @@ public: * @param aPropID The CSS property we're interested in animating. * @param aElement The element whose CSS property is being animated. */ - nsSMILCSSProperty(nsCSSProperty aPropID, mozilla::dom::Element* aElement); + nsSMILCSSProperty(nsCSSPropertyID aPropID, mozilla::dom::Element* aElement); // nsISMILAttr methods virtual nsresult ValueFromString(const nsAString& aStr, @@ -53,10 +53,10 @@ public: * @return true if the given property is supported for SMIL animation, or * false otherwise */ - static bool IsPropertyAnimatable(nsCSSProperty aPropID); + static bool IsPropertyAnimatable(nsCSSPropertyID aPropID); protected: - nsCSSProperty mPropID; + nsCSSPropertyID mPropID; // Using non-refcounted pointer for mElement -- we know mElement will stay // alive for my lifetime because a nsISMILAttr (like me) only lives as long // as the Compositing step, and DOM elements don't get a chance to die during diff --git a/dom/smil/nsSMILCSSValueType.cpp b/dom/smil/nsSMILCSSValueType.cpp index 1197bbc63b5e..071633c1905e 100644 --- a/dom/smil/nsSMILCSSValueType.cpp +++ b/dom/smil/nsSMILCSSValueType.cpp @@ -25,10 +25,10 @@ using mozilla::StyleAnimationValue; /*static*/ nsSMILCSSValueType nsSMILCSSValueType::sSingleton; struct ValueWrapper { - ValueWrapper(nsCSSProperty aPropID, const StyleAnimationValue& aValue) : + ValueWrapper(nsCSSPropertyID aPropID, const StyleAnimationValue& aValue) : mPropID(aPropID), mCSSValue(aValue) {} - nsCSSProperty mPropID; + nsCSSPropertyID mPropID; StyleAnimationValue mCSSValue; }; @@ -223,7 +223,7 @@ nsSMILCSSValueType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, MOZ_ASSERT(destWrapper || valueToAddWrapper, "need at least one fully-initialized value"); - nsCSSProperty property = (valueToAddWrapper ? valueToAddWrapper->mPropID : + nsCSSPropertyID property = (valueToAddWrapper ? valueToAddWrapper->mPropID : destWrapper->mPropID); // Special case: font-size-adjust and stroke-dasharray are explicitly // non-additive (even though StyleAnimationValue *could* support adding them) @@ -335,7 +335,7 @@ GetPresContextForElement(Element* aElem) // Helper function to parse a string into a StyleAnimationValue static bool -ValueFromStringHelper(nsCSSProperty aPropID, +ValueFromStringHelper(nsCSSPropertyID aPropID, Element* aTargetElement, nsPresContext* aPresContext, const nsAString& aString, @@ -387,7 +387,7 @@ ValueFromStringHelper(nsCSSProperty aPropID, // static void -nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID, +nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID, Element* aTargetElement, const nsAString& aString, nsSMILValue& aValue, @@ -430,7 +430,7 @@ nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue, } // static -nsCSSProperty +nsCSSPropertyID nsSMILCSSValueType::PropertyFromValue(const nsSMILValue& aValue) { if (aValue.mType != &nsSMILCSSValueType::sSingleton) { diff --git a/dom/smil/nsSMILCSSValueType.h b/dom/smil/nsSMILCSSValueType.h index 3fb237d7809f..0c71605f0576 100644 --- a/dom/smil/nsSMILCSSValueType.h +++ b/dom/smil/nsSMILCSSValueType.h @@ -10,7 +10,7 @@ #define NS_SMILCSSVALUETYPE_H_ #include "nsISMILType.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "mozilla/Attributes.h" class nsAString; @@ -78,7 +78,7 @@ public: * @pre aValue.IsNull() * @post aValue.IsNull() || aValue.mType == nsSMILCSSValueType::sSingleton */ - static void ValueFromString(nsCSSProperty aPropID, + static void ValueFromString(nsCSSPropertyID aPropID, Element* aTargetElement, const nsAString& aString, nsSMILValue& aValue, @@ -102,11 +102,11 @@ public: * Return the CSS property animated by the specified value. * * @param aValue The nsSMILValue to examine. - * @return The nsCSSProperty enum value of the property animated + * @return The nsCSSPropertyID enum value of the property animated * by |aValue|, or eCSSProperty_UNKNOWN if the type of * |aValue| is not nsSMILCSSValueType. */ - static nsCSSProperty PropertyFromValue(const nsSMILValue& aValue); + static nsCSSPropertyID PropertyFromValue(const nsSMILValue& aValue); private: // Private constructor: prevent instances beyond my singleton. diff --git a/dom/smil/nsSMILCompositor.cpp b/dom/smil/nsSMILCompositor.cpp index e2735ced02da..4b2e4cb8344a 100644 --- a/dom/smil/nsSMILCompositor.cpp +++ b/dom/smil/nsSMILCompositor.cpp @@ -127,7 +127,7 @@ nsISMILAttr* nsSMILCompositor::CreateSMILAttr() { if (mKey.mIsCSS) { - nsCSSProperty propId = + nsCSSPropertyID propId = nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName), CSSEnabledState::eForAllContent); if (nsSMILCSSProperty::IsPropertyAnimatable(propId)) { diff --git a/dom/smil/nsSMILMappedAttribute.h b/dom/smil/nsSMILMappedAttribute.h index 53cdc5489318..212b65c92030 100644 --- a/dom/smil/nsSMILMappedAttribute.h +++ b/dom/smil/nsSMILMappedAttribute.h @@ -36,7 +36,7 @@ public: * interested in animating. * @param aElement The element whose attribute is being animated. */ - nsSMILMappedAttribute(nsCSSProperty aPropID, mozilla::dom::Element* aElement) : + nsSMILMappedAttribute(nsCSSPropertyID aPropID, mozilla::dom::Element* aElement) : nsSMILCSSProperty(aPropID, aElement) {} // nsISMILAttr methods diff --git a/dom/svg/nsSVGElement.cpp b/dom/svg/nsSVGElement.cpp index 167051d828a5..3057911b3483 100644 --- a/dom/svg/nsSVGElement.cpp +++ b/dom/svg/nsSVGElement.cpp @@ -1199,8 +1199,8 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName, mDecl->InitializeEmpty(); } - // Get the nsCSSProperty ID for our mapped attribute. - nsCSSProperty propertyID = + // Get the nsCSSPropertyID ID for our mapped attribute. + nsCSSPropertyID propertyID = nsCSSProps::LookupProperty(nsDependentAtomString(aMappedAttrName), CSSEnabledState::eForAllContent); if (propertyID != eCSSProperty_UNKNOWN) { @@ -2558,7 +2558,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName) // Mapped attributes: if (IsAttributeMapped(aName)) { - nsCSSProperty prop = + nsCSSPropertyID prop = nsCSSProps::LookupProperty(nsDependentAtomString(aName), CSSEnabledState::eForAllContent); // Check IsPropertyAnimatable to avoid attributes that... diff --git a/editor/libeditor/CSSEditUtils.cpp b/editor/libeditor/CSSEditUtils.cpp index d52138c27b47..871b374f2903 100644 --- a/editor/libeditor/CSSEditUtils.cpp +++ b/editor/libeditor/CSSEditUtils.cpp @@ -548,7 +548,7 @@ CSSEditUtils::GetCSSInlinePropertyBase(nsINode* aNode, if (!decl) { return NS_OK; } - nsCSSProperty prop = + nsCSSPropertyID prop = nsCSSProps::LookupProperty(nsDependentAtomString(aProperty), CSSEnabledState::eForAllContent); MOZ_ASSERT(prop != eCSSProperty_UNKNOWN); diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 21f57959a584..834f33abff8e 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -36,7 +36,7 @@ #include "mozilla/mozalloc.h" // for operator delete, etc #include "nsAutoPtr.h" // for nsAutoPtr, nsRefPtr, etc #include "nsCOMPtr.h" // for already_AddRefed -#include "nsCSSProperty.h" // for nsCSSProperty +#include "nsCSSPropertyID.h" // for nsCSSPropertyID #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsImpl.h" // for Layer::Release, etc #include "nsRect.h" // for mozilla::gfx::IntRect diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index 8ad5cf66c17d..cc1279b4a9c5 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -28,7 +28,7 @@ using struct nsPoint from "nsPoint.h"; using class mozilla::TimeDuration from "mozilla/TimeStamp.h"; using class mozilla::TimeStamp from "mozilla/TimeStamp.h"; using mozilla::ScreenRotation from "mozilla/WidgetUtils.h"; -using nsCSSProperty from "nsCSSProperty.h"; +using nsCSSPropertyID from "nsCSSPropertyID.h"; using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h"; using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; using mozilla::LayerMargin from "Units.h"; @@ -199,7 +199,7 @@ struct Animation { float iterationStart; // This uses the NS_STYLE_ANIMATION_DIRECTION_* constants. int32_t direction; - nsCSSProperty property; + nsCSSPropertyID property; AnimationData data; float playbackRate; // This is used in the transformed progress calculation. diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index 3e055b6223f2..1aa757b71703 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -34,7 +34,7 @@ #include "nsString.h" #include "nsTArray.h" #include "js/StructuredClone.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #ifdef _MSC_VER #pragma warning( disable : 4800 ) @@ -540,8 +540,8 @@ struct ParamTraits }; template <> -struct ParamTraits - : public ContiguousEnumSerializer + : public ContiguousEnumSerializer {}; diff --git a/layout/base/ActiveLayerTracker.cpp b/layout/base/ActiveLayerTracker.cpp index 57773d985ae4..89aad90cfc4f 100644 --- a/layout/base/ActiveLayerTracker.cpp +++ b/layout/base/ActiveLayerTracker.cpp @@ -66,12 +66,12 @@ public: } ~LayerActivity(); nsExpirationState* GetExpirationState() { return &mState; } - uint8_t& RestyleCountForProperty(nsCSSProperty aProperty) + uint8_t& RestyleCountForProperty(nsCSSPropertyID aProperty) { return mRestyleCounts[GetActivityIndexForProperty(aProperty)]; } - static ActivityIndex GetActivityIndexForProperty(nsCSSProperty aProperty) + static ActivityIndex GetActivityIndexForProperty(nsCSSPropertyID aProperty) { switch (aProperty) { case eCSSProperty_opacity: return ACTIVITY_OPACITY; @@ -292,7 +292,7 @@ IncrementScaleRestyleCountIfNeeded(nsIFrame* aFrame, LayerActivity* aActivity) } /* static */ void -ActiveLayerTracker::NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty) +ActiveLayerTracker::NotifyRestyle(nsIFrame* aFrame, nsCSSPropertyID aProperty) { LayerActivity* layerActivity = GetLayerActivityForUpdate(aFrame); uint8_t& mutationCount = layerActivity->RestyleCountForProperty(aProperty); @@ -315,7 +315,7 @@ ActiveLayerTracker::NotifyOffsetRestyle(nsIFrame* aFrame) /* static */ void ActiveLayerTracker::NotifyAnimated(nsIFrame* aFrame, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, const nsAString& aNewValue, nsDOMCSSDeclaration* aDOMCSSDecl) { @@ -332,7 +332,7 @@ ActiveLayerTracker::NotifyAnimated(nsIFrame* aFrame, } /* static */ void -ActiveLayerTracker::NotifyAnimatedFromScrollHandler(nsIFrame* aFrame, nsCSSProperty aProperty, +ActiveLayerTracker::NotifyAnimatedFromScrollHandler(nsIFrame* aFrame, nsCSSPropertyID aProperty, nsIFrame* aScrollFrame) { if (aFrame->PresContext() != aScrollFrame->PresContext()) { @@ -366,7 +366,7 @@ IsPresContextInScriptAnimationCallback(nsPresContext* aPresContext) /* static */ void ActiveLayerTracker::NotifyInlineStyleRuleModified(nsIFrame* aFrame, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, const nsAString& aNewValue, nsDOMCSSDeclaration* aDOMCSSDecl) { @@ -381,7 +381,7 @@ ActiveLayerTracker::NotifyInlineStyleRuleModified(nsIFrame* aFrame, } /* static */ bool -ActiveLayerTracker::IsStyleMaybeAnimated(nsIFrame* aFrame, nsCSSProperty aProperty) +ActiveLayerTracker::IsStyleMaybeAnimated(nsIFrame* aFrame, nsCSSPropertyID aProperty) { return IsStyleAnimated(nullptr, aFrame, aProperty); } @@ -419,7 +419,7 @@ CheckScrollInducedActivity(LayerActivity* aLayerActivity, /* static */ bool ActiveLayerTracker::IsStyleAnimated(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, nsCSSProperty aProperty) + nsIFrame* aFrame, nsCSSPropertyID aProperty) { // TODO: Add some abuse restrictions if ((aFrame->StyleDisplay()->mWillChangeBitField & NS_STYLE_WILL_CHANGE_TRANSFORM) && diff --git a/layout/base/ActiveLayerTracker.h b/layout/base/ActiveLayerTracker.h index 5e51875e715f..145f5481efd6 100644 --- a/layout/base/ActiveLayerTracker.h +++ b/layout/base/ActiveLayerTracker.h @@ -5,7 +5,7 @@ #ifndef ACTIVELAYERTRACKER_H_ #define ACTIVELAYERTRACKER_H_ -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" class nsIFrame; class nsIContent; @@ -38,7 +38,7 @@ public: * Any such marking will time out after a short period. * @param aProperty the property that has changed */ - static void NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty); + static void NotifyRestyle(nsIFrame* aFrame, nsCSSPropertyID aProperty); /** * Notify aFrame's left/top/right/bottom properties as having (maybe) * changed due to a restyle, and therefore possibly wanting an active layer @@ -51,14 +51,14 @@ public: * aNewValue and aDOMCSSDecl are used to determine whether the property's * value has changed. */ - static void NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty, + static void NotifyAnimated(nsIFrame* aFrame, nsCSSPropertyID aProperty, const nsAString& aNewValue, nsDOMCSSDeclaration* aDOMCSSDecl); /** * Notify aFrame as being known to have an animation of aProperty through an * inline style modification during aScrollFrame's scroll event handler. */ - static void NotifyAnimatedFromScrollHandler(nsIFrame* aFrame, nsCSSProperty aProperty, + static void NotifyAnimatedFromScrollHandler(nsIFrame* aFrame, nsCSSPropertyID aProperty, nsIFrame* aScrollFrame); /** * Notify that a property in the inline style rule of aFrame's element @@ -68,20 +68,20 @@ public: * aNewValue and aDOMCSSDecl are used to determine whether the property's * value has changed. */ - static void NotifyInlineStyleRuleModified(nsIFrame* aFrame, nsCSSProperty aProperty, + static void NotifyInlineStyleRuleModified(nsIFrame* aFrame, nsCSSPropertyID aProperty, const nsAString& aNewValue, nsDOMCSSDeclaration* aDOMCSSDecl); /** * Return true if aFrame's aProperty style should be considered as being animated * for pre-rendering. */ - static bool IsStyleMaybeAnimated(nsIFrame* aFrame, nsCSSProperty aProperty); + static bool IsStyleMaybeAnimated(nsIFrame* aFrame, nsCSSPropertyID aProperty); /** * Return true if aFrame's aProperty style should be considered as being animated * for constructing active layers. */ static bool IsStyleAnimated(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); /** * Return true if any of aFrame's offset property styles should be considered * as being animated for constructing active layers. diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index ffdc3d87deea..3b6d8dd6bedc 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -283,7 +283,7 @@ FrameLayerBuilder::DisplayItemData::ClearAnimationCompositorState() } for (nsIFrame* frame : mFrameList) { - nsCSSProperty prop = mDisplayItemKey == nsDisplayItem::TYPE_TRANSFORM ? + nsCSSPropertyID prop = mDisplayItemKey == nsDisplayItem::TYPE_TRANSFORM ? eCSSProperty_transform : eCSSProperty_opacity; EffectCompositor::ClearIsRunningOnCompositor(frame, prop); } diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 2a0186b21ef6..5392998d19a7 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -458,7 +458,7 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty, } static void -AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty, +AddAnimationsForProperty(nsIFrame* aFrame, nsCSSPropertyID aProperty, nsTArray>& aAnimations, Layer* aLayer, AnimationData& aData, bool aPending) @@ -599,7 +599,7 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer, nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsIFrame* aFrame, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR), @@ -4436,7 +4436,7 @@ IsItemTooSmallForActiveLayer(nsIFrame* aFrame) static void SetAnimationPerformanceWarningForTooSmallItem(nsIFrame* aFrame, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { // We use ToNearestPixels() here since ToOutsidePixels causes some sort of // errors. See https://bugzilla.mozilla.org/show_bug.cgi?id=1258904#c19 diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 960c817f357a..259d5efb45c7 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -693,7 +693,7 @@ public: nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsIFrame* aFrame, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); /** * A helper class to temporarily set the value of diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index d42209206bb1..b56a6e1f21b9 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -476,7 +476,7 @@ HasMatchingAnimations(const nsIFrame* aFrame, TestType&& aTest) bool nsLayoutUtils::HasCurrentAnimationOfProperty(const nsIFrame* aFrame, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { return HasMatchingAnimations(aFrame, [&aProperty](KeyframeEffectReadOnly& aEffect) @@ -501,7 +501,7 @@ nsLayoutUtils::HasCurrentTransitions(const nsIFrame* aFrame) bool nsLayoutUtils::HasRelevantAnimationOfProperty(const nsIFrame* aFrame, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { return HasMatchingAnimations(aFrame, [&aProperty](KeyframeEffectReadOnly& aEffect) @@ -5807,7 +5807,7 @@ ShouldDarkenColors(nsPresContext* aPresContext) } nscolor -nsLayoutUtils::GetColor(nsIFrame* aFrame, nsCSSProperty aProperty) +nsLayoutUtils::GetColor(nsIFrame* aFrame, nsCSSPropertyID aProperty) { nscolor color = aFrame->GetVisitedDependentColor(aProperty); if (ShouldDarkenColors(aFrame->PresContext())) { diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index eda77eb35527..cea7e4aa7887 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -18,7 +18,7 @@ #include "nsIPrincipal.h" #include "FrameMetrics.h" #include "nsIWidget.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsStyleCoord.h" #include "nsStyleConsts.h" #include "nsGkAtoms.h" @@ -1556,7 +1556,7 @@ public: nsRenderingContext* aRenderingContext); // Get a suitable foreground color for painting aProperty for aFrame. - static nscolor GetColor(nsIFrame* aFrame, nsCSSProperty aProperty); + static nscolor GetColor(nsIFrame* aFrame, nsCSSPropertyID aProperty); // Get a baseline y position in app units that is snapped to device pixels. static gfxFloat GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext, @@ -2236,7 +2236,7 @@ public: * animations or transitions for the property. */ static bool HasCurrentAnimationOfProperty(const nsIFrame* aFrame, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); /** * Returns true if the frame has any current CSS transitions. @@ -2251,7 +2251,7 @@ public: * property. */ static bool HasRelevantAnimationOfProperty(const nsIFrame* aFrame, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); /** * Checks if off-main-thread animations are enabled. diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index c787315434a6..5b52e0f75ea5 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -214,7 +214,7 @@ void nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) { - nsCSSProperty colorProp = mFrame->StyleContext()->GetTextFillColorProp(); + nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp(); nscolor foregroundColor = nsLayoutUtils::GetColor(mFrame, colorProp); // Paint the text-shadows for the overflow marker diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index ad16d70607a4..05f7475f589a 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -617,7 +617,7 @@ public: #undef STYLE_STRUCT /** Also forward GetVisitedDependentColor to the style context */ - nscolor GetVisitedDependentColor(nsCSSProperty aProperty) + nscolor GetVisitedDependentColor(nsCSSPropertyID aProperty) { return mStyleContext->GetVisitedDependentColor(aProperty); } /** diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 90dd648d190e..8f2b41afdfea 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -3940,13 +3940,13 @@ nsTextPaintStyle::InitSelectionColorsAndShadow() if (mResolveColors) { // On MacOS X, we don't exchange text color and BG color. if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) { - nsCSSProperty property = mFrame->IsSVGText() + nsCSSPropertyID property = mFrame->IsSVGText() ? eCSSProperty_fill : mFrame->StyleContext()->GetTextFillColorProp(); nscoord frameColor = mFrame->GetVisitedDependentColor(property); mSelectionTextColor = EnsureDifferentColors(frameColor, mSelectionBGColor); } else if (mSelectionTextColor == NS_CHANGE_COLOR_IF_SAME_AS_BG) { - nsCSSProperty property = mFrame->IsSVGText() + nsCSSPropertyID property = mFrame->IsSVGText() ? eCSSProperty_fill : mFrame->StyleContext()->GetTextFillColorProp(); nscolor frameColor = mFrame->GetVisitedDependentColor(property); diff --git a/layout/inspector/inCSSValueSearch.cpp b/layout/inspector/inCSSValueSearch.cpp index 3beb3789a595..41408f872f8d 100644 --- a/layout/inspector/inCSSValueSearch.cpp +++ b/layout/inspector/inCSSValueSearch.cpp @@ -36,7 +36,7 @@ inCSSValueSearch::inCSSValueSearch() mNormalizeChromeURLs(false) { nsCSSProps::AddRefTable(); - mProperties = new nsCSSProperty[100]; + mProperties = new nsCSSPropertyID[100]; } inCSSValueSearch::~inCSSValueSearch() @@ -222,7 +222,7 @@ inCSSValueSearch::SetNormalizeChromeURLs(bool aNormalizeChromeURLs) NS_IMETHODIMP inCSSValueSearch::AddPropertyCriteria(const char16_t *aPropName) { - nsCSSProperty prop = + nsCSSPropertyID prop = nsCSSProps::LookupProperty(nsDependentString(aPropName), CSSEnabledState::eIgnoreEnabledState); mProperties[mPropertyCount] = prop; diff --git a/layout/inspector/inCSSValueSearch.h b/layout/inspector/inCSSValueSearch.h index bf831f9724c8..3741fd33197b 100644 --- a/layout/inspector/inCSSValueSearch.h +++ b/layout/inspector/inCSSValueSearch.h @@ -33,7 +33,7 @@ protected: nsCOMPtr mObserver; nsCOMPtr mDocument; nsTArray* mResults; - nsCSSProperty* mProperties; + nsCSSPropertyID* mProperties; nsString mLastResult; nsString mBaseURL; nsString mTextCriteria; diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index 55ff06cea59d..8a9fed8a13be 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -486,7 +486,7 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement, NS_IMETHODIMP inDOMUtils::IsInheritedProperty(const nsAString &aPropertyName, bool *_retval) { - nsCSSProperty prop = nsCSSProps:: + nsCSSPropertyID prop = nsCSSProps:: LookupProperty(aPropertyName, CSSEnabledState::eIgnoreEnabledState); if (prop == eCSSProperty_UNKNOWN) { *_retval = false; @@ -531,7 +531,7 @@ inDOMUtils::GetCSSPropertyNames(uint32_t aFlags, uint32_t* aCount, #define DO_PROP(_prop) \ PR_BEGIN_MACRO \ - nsCSSProperty cssProp = nsCSSProperty(_prop); \ + nsCSSPropertyID cssProp = nsCSSPropertyID(_prop); \ if (nsCSSProps::IsEnabled(cssProp, CSSEnabledState::eForAllContent)) { \ props[propCount] = \ ToNewUnicode(nsDependentCString(kCSSRawProperties[_prop])); \ @@ -543,7 +543,7 @@ inDOMUtils::GetCSSPropertyNames(uint32_t aFlags, uint32_t* aCount, // 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)) != + if (nsCSSProps::PropertyParseType(nsCSSPropertyID(prop)) != CSS_PROPERTY_PARSE_INACCESSIBLE) { DO_PROP(prop); } @@ -553,7 +553,7 @@ inDOMUtils::GetCSSPropertyNames(uint32_t aFlags, uint32_t* aCount, for ( ; prop < eCSSProperty_COUNT; ++prop) { // Some shorthands are also aliases if ((aFlags & INCLUDE_ALIASES) || - !nsCSSProps::PropHasFlags(nsCSSProperty(prop), + !nsCSSProps::PropHasFlags(nsCSSPropertyID(prop), CSS_PROPERTY_IS_ALIAS)) { DO_PROP(prop); } @@ -584,7 +584,7 @@ static void InsertNoDuplicates(nsTArray& aArray, aArray.InsertElementAt(i, aString); } -static void GetKeywordsForProperty(const nsCSSProperty aProperty, +static void GetKeywordsForProperty(const nsCSSPropertyID aProperty, nsTArray& aArray) { if (nsCSSProps::IsShorthand(aProperty)) { @@ -675,7 +675,7 @@ inDOMUtils::GetSubpropertiesForCSSProperty(const nsAString& aProperty, uint32_t* aLength, char16_t*** aValues) { - nsCSSProperty propertyID = + nsCSSPropertyID propertyID = nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eForAllContent); if (propertyID == eCSSProperty_UNKNOWN) { @@ -698,7 +698,7 @@ inDOMUtils::GetSubpropertiesForCSSProperty(const nsAString& aProperty, // Count up how many subproperties we have. size_t subpropCount = 0; - for (const nsCSSProperty *props = nsCSSProps::SubpropertyEntryFor(propertyID); + for (const nsCSSPropertyID *props = nsCSSProps::SubpropertyEntryFor(propertyID); *props != eCSSProperty_UNKNOWN; ++props) { ++subpropCount; } @@ -706,7 +706,7 @@ inDOMUtils::GetSubpropertiesForCSSProperty(const nsAString& aProperty, *aValues = static_cast(moz_xmalloc(subpropCount * sizeof(char16_t*))); *aLength = subpropCount; - for (const nsCSSProperty *props = nsCSSProps::SubpropertyEntryFor(propertyID), + for (const nsCSSPropertyID *props = nsCSSProps::SubpropertyEntryFor(propertyID), *props_start = props; *props != eCSSProperty_UNKNOWN; ++props) { (*aValues)[props-props_start] = ToNewUnicode(nsCSSProps::GetStringValue(*props)); @@ -717,7 +717,7 @@ inDOMUtils::GetSubpropertiesForCSSProperty(const nsAString& aProperty, NS_IMETHODIMP inDOMUtils::CssPropertyIsShorthand(const nsAString& aProperty, bool *_retval) { - nsCSSProperty propertyID = + nsCSSPropertyID propertyID = nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eForAllContent); if (propertyID == eCSSProperty_UNKNOWN) { return NS_ERROR_FAILURE; @@ -734,7 +734,7 @@ inDOMUtils::CssPropertyIsShorthand(const nsAString& aProperty, bool *_retval) // A helper function that determines whether the given property // supports the given type. static bool -PropertySupportsVariant(nsCSSProperty aPropertyID, uint32_t aVariant) +PropertySupportsVariant(nsCSSPropertyID aPropertyID, uint32_t aVariant) { if (nsCSSProps::IsShorthand(aPropertyID)) { // We need a special case for border here, because while it resets @@ -743,7 +743,7 @@ PropertySupportsVariant(nsCSSProperty aPropertyID, uint32_t aVariant) return (aVariant & (VARIANT_COLOR | VARIANT_LENGTH)) != 0; } - for (const nsCSSProperty* props = nsCSSProps::SubpropertyEntryFor(aPropertyID); + for (const nsCSSPropertyID* props = nsCSSProps::SubpropertyEntryFor(aPropertyID); *props != eCSSProperty_UNKNOWN; ++props) { if (PropertySupportsVariant(*props, aVariant)) { return true; @@ -864,7 +864,7 @@ NS_IMETHODIMP inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType, bool *_retval) { - nsCSSProperty propertyID = + nsCSSPropertyID propertyID = nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eForAllContent); if (propertyID == eCSSProperty_UNKNOWN) { return NS_ERROR_FAILURE; @@ -925,7 +925,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty, uint32_t* aLength, char16_t*** aValues) { - nsCSSProperty propertyID = nsCSSProps:: + nsCSSPropertyID propertyID = nsCSSProps:: LookupProperty(aProperty, CSSEnabledState::eForAllContent); if (propertyID == eCSSProperty_UNKNOWN) { return NS_ERROR_FAILURE; @@ -1060,7 +1060,7 @@ inDOMUtils::CssPropertyIsValid(const nsAString& aPropertyName, const nsAString& aPropertyValue, bool *_retval) { - nsCSSProperty propertyID = nsCSSProps:: + nsCSSPropertyID propertyID = nsCSSProps:: LookupProperty(aPropertyName, CSSEnabledState::eIgnoreEnabledState); if (propertyID == eCSSProperty_UNKNOWN) { diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index d97ce52e4102..a3cc01f541d2 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -2124,7 +2124,7 @@ nsMathMLChar::PaintForeground(nsPresContext* aPresContext, RefPtr thebesContext = aRenderingContext.ThebesContext(); // Set color ... - nsCSSProperty colorProp = styleContext->GetTextFillColorProp(); + nsCSSPropertyID colorProp = styleContext->GetTextFillColorProp(); nscolor fgColor = styleContext->GetVisitedDependentColor(colorProp); if (aIsSelected) { // get color to use for selection from the look&feel object diff --git a/layout/mathml/nsMathMLFrame.cpp b/layout/mathml/nsMathMLFrame.cpp index 8b0dbabaefad..0b7d4fe5bbfe 100644 --- a/layout/mathml/nsMathMLFrame.cpp +++ b/layout/mathml/nsMathMLFrame.cpp @@ -364,7 +364,7 @@ void nsDisplayMathMLBar::Paint(nsDisplayListBuilder* aBuilder, NSRectToNonEmptySnappedRect(mRect + ToReferenceFrame(), mFrame->PresContext()->AppUnitsPerDevPixel(), *drawTarget); - nsCSSProperty colorProp = mFrame->StyleContext()->GetTextFillColorProp(); + nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp(); ColorPattern color(ToDeviceColor( mFrame->GetVisitedDependentColor(colorProp))); drawTarget->FillRect(rect, color); diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index ab4ae4784df2..1b463299171a 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -779,7 +779,7 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder, presContext->AppUnitsPerDevPixel()); rect.Deflate(strokeWidth / 2.f); - nsCSSProperty colorProp = mFrame->StyleContext()->GetTextFillColorProp(); + nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp(); ColorPattern color(ToDeviceColor( mFrame->GetVisitedDependentColor(colorProp))); diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index 0b76df0ccaeb..1e19aec87f9a 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -629,7 +629,7 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder, Rect rect = NSRectToRect(mRect + ToReferenceFrame(), presContext->AppUnitsPerDevPixel()); - nsCSSProperty colorProp = mFrame->StyleContext()->GetTextFillColorProp(); + nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp(); ColorPattern color(ToDeviceColor( mFrame->GetVisitedDependentColor(colorProp))); diff --git a/layout/style/CSSVariableImageTable.h b/layout/style/CSSVariableImageTable.h index 1366f4d83c76..26c9c7507c7b 100644 --- a/layout/style/CSSVariableImageTable.h +++ b/layout/style/CSSVariableImageTable.h @@ -9,14 +9,14 @@ #define mozilla_CSSVariableImageTable_h #include "nsClassHashtable.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSValue.h" #include "nsStyleContext.h" #include "nsTArray.h" /** * CSSVariableImageTable maintains a global mapping - * (nsStyleContext, nsCSSProperty) -> nsTArray + * (nsStyleContext, nsCSSPropertyID) -> nsTArray * which allows us to track the relationship between CSS property values * involving variables and any images they may reference. * @@ -44,7 +44,7 @@ namespace CSSVariableImageTable { namespace detail { typedef nsTArray> ImageValueArray; -typedef nsClassHashtable, ImageValueArray> +typedef nsClassHashtable, ImageValueArray> PerPropertyImageHashtable; typedef nsClassHashtable, PerPropertyImageHashtable> CSSVariableImageHashtable; @@ -67,7 +67,7 @@ inline bool& IsReplacing() /** * ReplaceAll() allows callers to replace the ImageValues associated with a - * (nsStyleContext, nsCSSProperty) pair. The memory used by the previous list of + * (nsStyleContext, nsCSSPropertyID) pair. The memory used by the previous list of * ImageValues is automatically released. * * @param aContext The style context the ImageValues are associated with. @@ -77,7 +77,7 @@ inline bool& IsReplacing() */ template inline void ReplaceAll(nsStyleContext* aContext, - nsCSSProperty aProp, + nsCSSPropertyID aProp, Lambda aFunc) { MOZ_ASSERT(aContext); @@ -134,7 +134,7 @@ inline void ReplaceAll(nsStyleContext* aContext, * CSSVariableImageTable::ReplaceAll(). */ inline void -Add(nsStyleContext* aContext, nsCSSProperty aProp, css::ImageValue* aValue) +Add(nsStyleContext* aContext, nsCSSPropertyID aProp, css::ImageValue* aValue) { MOZ_ASSERT(aValue); MOZ_ASSERT(aContext); diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index c6eea9d2ae15..3ec9bc6ca517 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -124,7 +124,7 @@ Declaration::MapsImportantInheritedStyleData() const } void -Declaration::ValueAppended(nsCSSProperty aProperty) +Declaration::ValueAppended(nsCSSPropertyID aProperty) { MOZ_ASSERT(!mData && !mImportantData, "should only be called while expanded"); @@ -136,7 +136,7 @@ Declaration::ValueAppended(nsCSSProperty aProperty) } void -Declaration::RemoveProperty(nsCSSProperty aProperty) +Declaration::RemoveProperty(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT); @@ -159,7 +159,7 @@ Declaration::RemoveProperty(nsCSSProperty aProperty) } bool -Declaration::HasProperty(nsCSSProperty aProperty) const +Declaration::HasProperty(nsCSSPropertyID aProperty) const { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "property ID out of range"); @@ -171,7 +171,7 @@ Declaration::HasProperty(nsCSSProperty aProperty) const } bool -Declaration::AppendValueToString(nsCSSProperty aProperty, +Declaration::AppendValueToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { @@ -190,13 +190,13 @@ Declaration::AppendValueToString(nsCSSProperty aProperty, } void -Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const +Declaration::GetValue(nsCSSPropertyID aProperty, nsAString& aValue) const { GetValue(aProperty, aValue, nsCSSValue::eNormalized); } void -Declaration::GetAuthoredValue(nsCSSProperty aProperty, nsAString& aValue) const +Declaration::GetAuthoredValue(nsCSSPropertyID aProperty, nsAString& aValue) const { GetValue(aProperty, aValue, nsCSSValue::eAuthorSpecified); } @@ -204,7 +204,7 @@ Declaration::GetAuthoredValue(nsCSSProperty aProperty, nsAString& aValue) const static void AppendSingleImageLayerPositionValue(const nsCSSValue& aPositionX, const nsCSSValue& aPositionY, - const nsCSSProperty aTable[], + const nsCSSPropertyID aTable[], nsAString& aValue, nsCSSValue::Serialization aSerialization) { @@ -241,7 +241,7 @@ Declaration::GetImageLayerValue( nsCSSCompressedDataBlock *data, nsAString& aValue, nsCSSValue::Serialization aSerialization, - const nsCSSProperty aTable[]) const + const nsCSSPropertyID aTable[]) const { // We know from our caller that all subproperties were specified. // However, we still can't represent that in the shorthand unless @@ -444,7 +444,7 @@ Declaration::GetImageLayerPositionValue( nsCSSCompressedDataBlock *data, nsAString& aValue, nsCSSValue::Serialization aSerialization, - const nsCSSProperty aTable[]) const + const nsCSSPropertyID aTable[]) const { // We know from above that all subproperties were specified. // However, we still can't represent that in the shorthand unless @@ -473,7 +473,7 @@ Declaration::GetImageLayerPositionValue( } void -Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, +Declaration::GetValue(nsCSSPropertyID aProperty, nsAString& aValue, nsCSSValue::Serialization aSerialization) const { aValue.Truncate(0); @@ -592,7 +592,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, case eCSSProperty_border_color: case eCSSProperty_border_style: case eCSSProperty_border_width: { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") != kNotFound, "first subprop must be top"); @@ -614,7 +614,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } case eCSSProperty_border_radius: case eCSSProperty__moz_outline_radius: { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); const nsCSSValue* vals[4] = { data->ValueFor(subprops[0]), @@ -686,13 +686,13 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, break; } - const nsCSSProperty* subproptables[3] = { + const nsCSSPropertyID* subproptables[3] = { nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color), nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_style), nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_width) }; bool match = true; - for (const nsCSSProperty** subprops = subproptables, + for (const nsCSSPropertyID** subprops = subproptables, **subprops_end = ArrayEnd(subproptables); subprops < subprops_end; ++subprops) { const nsCSSValue *firstSide = data->ValueFor((*subprops)[0]); @@ -721,7 +721,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, case eCSSProperty_border_block_end: case eCSSProperty__moz_column_rule: case eCSSProperty_outline: { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]), NS_LITERAL_CSTRING("-color")), @@ -890,7 +890,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, break; } case eCSSProperty_font_variant: { - const nsCSSProperty *subprops = + const nsCSSPropertyID *subprops = nsCSSProps::SubpropertyEntryFor(aProperty); const nsCSSValue *fontVariantLigatures = data->ValueFor(eCSSProperty_font_variant_ligatures); @@ -898,7 +898,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, // all subproperty values normal? system font? bool normalLigs = true, normalNonLigs = true, systemFont = true, hasSystem = false; - for (const nsCSSProperty *sp = subprops; *sp != eCSSProperty_UNKNOWN; sp++) { + for (const nsCSSPropertyID *sp = subprops; *sp != eCSSProperty_UNKNOWN; sp++) { const nsCSSValue *spVal = data->ValueFor(*sp); bool isNormal = (spVal->GetUnit() == eCSSUnit_Normal); if (*sp == eCSSProperty_font_variant_ligatures) { @@ -928,7 +928,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } else { // iterate over and append non-normal values bool appendSpace = false; - for (const nsCSSProperty *sp = subprops; + for (const nsCSSPropertyID *sp = subprops; *sp != eCSSProperty_UNKNOWN; sp++) { const nsCSSValue *spVal = data->ValueFor(*sp); if (spVal && spVal->GetUnit() != eCSSUnit_Normal) { @@ -1067,7 +1067,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, break; } case eCSSProperty_animation: { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_animation); static const size_t numProps = 8; MOZ_ASSERT(subprops[numProps] == eCSSProperty_UNKNOWN, @@ -1127,7 +1127,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } case eCSSProperty__moz_columns: { // Two values, column-count and column-width, separated by a space. - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); AppendValueToString(subprops[0], aValue, aSerialization); aValue.Append(char16_t(' ')); @@ -1136,7 +1136,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } case eCSSProperty_flex: { // flex-grow, flex-shrink, flex-basis, separated by single space - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); AppendValueToString(subprops[0], aValue, aSerialization); @@ -1148,7 +1148,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } case eCSSProperty_flex_flow: { // flex-direction, flex-wrap, separated by single space - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); MOZ_ASSERT(subprops[2] == eCSSProperty_UNKNOWN, "must have exactly two subproperties"); @@ -1161,7 +1161,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, case eCSSProperty_grid_row: case eCSSProperty_grid_column: { // grid-{row,column}-start, grid-{row,column}-end, separated by a slash - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); MOZ_ASSERT(subprops[2] == eCSSProperty_UNKNOWN, "must have exactly two subproperties"); @@ -1173,7 +1173,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, break; } case eCSSProperty_grid_area: { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); MOZ_ASSERT(subprops[4] == eCSSProperty_UNKNOWN, "must have exactly four subproperties"); @@ -1338,7 +1338,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, break; } case eCSSProperty_grid_gap: { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); MOZ_ASSERT(subprops[2] == eCSSProperty_UNKNOWN, "must have exactly two subproperties"); @@ -1378,7 +1378,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } case eCSSProperty__moz_transform: { // shorthands that are just aliases with different parsing rules - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); MOZ_ASSERT(subprops[1] == eCSSProperty_UNKNOWN, "must have exactly one subproperty"); @@ -1435,7 +1435,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, bool Declaration::GetValueIsImportant(const nsAString& aProperty) const { - nsCSSProperty propID = nsCSSProps:: + nsCSSPropertyID propID = nsCSSProps:: LookupProperty(aProperty, CSSEnabledState::eIgnoreEnabledState); if (propID == eCSSProperty_UNKNOWN) { return false; @@ -1449,7 +1449,7 @@ Declaration::GetValueIsImportant(const nsAString& aProperty) const } bool -Declaration::GetValueIsImportant(nsCSSProperty aProperty) const +Declaration::GetValueIsImportant(nsCSSPropertyID aProperty) const { if (!mImportantData) return false; @@ -1474,7 +1474,7 @@ Declaration::GetValueIsImportant(nsCSSProperty aProperty) const } void -Declaration::AppendPropertyAndValueToString(nsCSSProperty aProperty, +Declaration::AppendPropertyAndValueToString(nsCSSPropertyID aProperty, nsAutoString& aValue, nsAString& aResult) const { @@ -1565,9 +1565,9 @@ Declaration::ToString(nsAString& aString) const int32_t count = mOrder.Length(); int32_t index; - AutoTArray shorthandsUsed; + AutoTArray shorthandsUsed; for (index = 0; index < count; index++) { - nsCSSProperty property = GetPropertyAt(index); + nsCSSPropertyID property = GetPropertyAt(index); if (property == eCSSPropertyExtra_variable) { uint32_t variableIndex = mOrder[index] - eCSSProperty_COUNT; @@ -1582,7 +1582,7 @@ Declaration::ToString(nsAString& aString) const // If we already used this property in a shorthand, skip it. if (shorthandsUsed.Length() > 0) { - for (const nsCSSProperty *shorthands = + for (const nsCSSPropertyID *shorthands = nsCSSProps::ShorthandsContaining(property); *shorthands != eCSSProperty_UNKNOWN; ++shorthands) { if (shorthandsUsed.Contains(*shorthands)) { @@ -1596,13 +1596,13 @@ Declaration::ToString(nsAString& aString) const // Try to use this property in a shorthand. nsAutoString value; - for (const nsCSSProperty *shorthands = + for (const nsCSSPropertyID *shorthands = nsCSSProps::ShorthandsContaining(property); *shorthands != eCSSProperty_UNKNOWN; ++shorthands) { // ShorthandsContaining returns the shorthands in order from those // that contain the most subproperties to those that contain the // least, which is exactly the order we want to test them. - nsCSSProperty shorthand = *shorthands; + nsCSSPropertyID shorthand = *shorthands; GetValue(shorthand, value); @@ -1691,7 +1691,7 @@ Declaration::GetNthProperty(uint32_t aIndex, nsAString& aReturn) const { aReturn.Truncate(); if (aIndex < mOrder.Length()) { - nsCSSProperty property = GetPropertyAt(aIndex); + nsCSSPropertyID property = GetPropertyAt(aIndex); if (property == eCSSPropertyExtra_variable) { GetCustomPropertyNameAt(aIndex, aReturn); return true; diff --git a/layout/style/Declaration.h b/layout/style/Declaration.h index 46561e406619..3e8ef29fd3f7 100644 --- a/layout/style/Declaration.h +++ b/layout/style/Declaration.h @@ -21,7 +21,7 @@ #include "mozilla/MemoryReporting.h" #include "CSSVariableDeclarations.h" #include "nsCSSDataBlock.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSProps.h" #include "nsIStyleRule.h" #include "nsStringFwd.h" @@ -112,19 +112,19 @@ public: * |mOrder| whenever a property is parsed into an expanded data block * for this declaration. aProperty must not be a shorthand. */ - void ValueAppended(nsCSSProperty aProperty); + void ValueAppended(nsCSSPropertyID aProperty); - void RemoveProperty(nsCSSProperty aProperty); + void RemoveProperty(nsCSSPropertyID aProperty); - bool HasProperty(nsCSSProperty aProperty) const; + bool HasProperty(nsCSSPropertyID aProperty) const; - void GetValue(nsCSSProperty aProperty, nsAString& aValue) const; - void GetAuthoredValue(nsCSSProperty aProperty, nsAString& aValue) const; + void GetValue(nsCSSPropertyID aProperty, nsAString& aValue) const; + void GetAuthoredValue(nsCSSPropertyID aProperty, nsAString& aValue) const; bool HasImportantData() const { return mImportantData || mImportantVariables; } - bool GetValueIsImportant(nsCSSProperty aProperty) const; + bool GetValueIsImportant(nsCSSPropertyID aProperty) const; bool GetValueIsImportant(const nsAString& aProperty) const; /** @@ -238,7 +238,7 @@ public: * |aFromBlock|. |aChanged| is set to true if the declaration * changed as a result of the call, and to false otherwise. */ - bool TryReplaceValue(nsCSSProperty aProperty, bool aIsImportant, + bool TryReplaceValue(nsCSSPropertyID aProperty, bool aIsImportant, nsCSSExpandedDataBlock& aFromBlock, bool* aChanged) { @@ -267,7 +267,7 @@ public: return block->TryReplaceValue(aProperty, aFromBlock, aChanged); } - bool HasNonImportantValueFor(nsCSSProperty aProperty) const { + bool HasNonImportantValueFor(nsCSSPropertyID aProperty) const { MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), "must be longhand"); return !!mData->ValueFor(aProperty); } @@ -353,16 +353,16 @@ private: Declaration& operator=(const Declaration& aCopy) = delete; bool operator==(const Declaration& aCopy) const = delete; - void GetValue(nsCSSProperty aProperty, nsAString& aValue, + void GetValue(nsCSSPropertyID aProperty, nsAString& aValue, nsCSSValue::Serialization aValueSerialization) const; static void AppendImportanceToString(bool aIsImportant, nsAString& aString); // return whether there was a value in |aValue| (i.e., it had a non-null unit) - bool AppendValueToString(nsCSSProperty aProperty, nsAString& aResult) const; - bool AppendValueToString(nsCSSProperty aProperty, nsAString& aResult, + bool AppendValueToString(nsCSSPropertyID aProperty, nsAString& aResult) const; + bool AppendValueToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aValueSerialization) const; // Helper for ToString with strange semantics regarding aValue. - void AppendPropertyAndValueToString(nsCSSProperty aProperty, + void AppendPropertyAndValueToString(nsCSSPropertyID aProperty, nsAutoString& aValue, nsAString& aResult) const; // helper for ToString that serializes a custom property declaration for @@ -373,12 +373,12 @@ private: void GetImageLayerValue(nsCSSCompressedDataBlock *data, nsAString& aValue, nsCSSValue::Serialization aSerialization, - const nsCSSProperty aTable[]) const; + const nsCSSPropertyID aTable[]) const; void GetImageLayerPositionValue(nsCSSCompressedDataBlock *data, nsAString& aValue, nsCSSValue::Serialization aSerialization, - const nsCSSProperty aTable[]) const; + const nsCSSPropertyID aTable[]) const; public: /** @@ -386,12 +386,12 @@ public: * declarations. For custom properties, eCSSPropertyExtra_variable * is returned. */ - nsCSSProperty GetPropertyAt(uint32_t aIndex) const { + nsCSSPropertyID GetPropertyAt(uint32_t aIndex) const { uint32_t value = mOrder[aIndex]; if (value >= eCSSProperty_COUNT) { return eCSSPropertyExtra_variable; } - return nsCSSProperty(value); + return nsCSSPropertyID(value); } /** @@ -410,7 +410,7 @@ public: private: // The order of properties in this declaration. Longhand properties are - // represented by their nsCSSProperty value, and each custom property (--*) + // represented by their nsCSSPropertyID value, and each custom property (--*) // is represented by a value that begins at eCSSProperty_COUNT. // // Subtracting eCSSProperty_COUNT from those values that represent custom diff --git a/layout/style/FontFace.cpp b/layout/style/FontFace.cpp index c85c45c32a2d..8adfe19c6105 100644 --- a/layout/style/FontFace.cpp +++ b/layout/style/FontFace.cpp @@ -597,7 +597,7 @@ FontFace::GetDesc(nsCSSFontDesc aDescID, nsCSSValue& aResult) const void FontFace::GetDesc(nsCSSFontDesc aDescID, - nsCSSProperty aPropID, + nsCSSPropertyID aPropID, nsString& aResult) const { MOZ_ASSERT(aDescID == eCSSFontDesc_UnicodeRange || diff --git a/layout/style/FontFace.h b/layout/style/FontFace.h index 82ab2575be8e..8da40f53becf 100644 --- a/layout/style/FontFace.h +++ b/layout/style/FontFace.h @@ -9,7 +9,7 @@ #include "mozilla/dom/FontFaceBinding.h" #include "gfxUserFontSet.h" #include "nsAutoPtr.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSValue.h" #include "nsWrapperCache.h" @@ -191,7 +191,7 @@ private: void SetStatus(mozilla::dom::FontFaceLoadStatus aStatus); void GetDesc(nsCSSFontDesc aDescID, - nsCSSProperty aPropID, + nsCSSPropertyID aPropID, nsString& aResult) const; /** diff --git a/layout/style/GenerateCSSPropsGenerated.py b/layout/style/GenerateCSSPropsGenerated.py index 9efe4e25ee71..4dc2a253a811 100644 --- a/layout/style/GenerateCSSPropsGenerated.py +++ b/layout/style/GenerateCSSPropsGenerated.py @@ -20,7 +20,7 @@ def get_properties(preprocessorHeader): # Sort the list so that longhand and logical properties are intermingled # first, shorthand properties follow, then aliases appear last. This matches - # the order of the nsCSSProperty enum. + # the order of the nsCSSPropertyID enum. def property_compare(x, y): property_order = {"longhand": 0, "logical": 0, "shorthand": 1, "alias": 2} @@ -61,7 +61,7 @@ def generate_assertions(properties): else: return "eCSSProperty_%s" % p["id"] msg = ('static_assert(%s == %d, "GenerateCSSPropsGenerated.py did not list ' - 'properties in nsCSSProperty order");') + 'properties in nsCSSPropertyID order");') return "\n".join(map(lambda p: msg % (enum(p), p["index"]), properties)) def generate_idl_name_positions(properties): @@ -74,7 +74,7 @@ def generate_idl_name_positions(properties): # Annotate entries with the sorted position. ps = [(p, position) for position, p in enumerate(ps)] - # Sort back to nsCSSProperty order. + # Sort back to nsCSSPropertyID order. ps = sorted(ps, key=lambda (p, position): p["index"]) return ",\n".join(map(lambda (p, position): " %d" % position, ps)) diff --git a/layout/style/LayerAnimationInfo.cpp b/layout/style/LayerAnimationInfo.cpp index bebdb7d3de67..8a119512b974 100644 --- a/layout/style/LayerAnimationInfo.cpp +++ b/layout/style/LayerAnimationInfo.cpp @@ -30,9 +30,9 @@ LayerAnimationInfo::Initialize() // Check that every property with the flag for animating on the // compositor has an entry in LayerAnimationInfo::sRecords. - for (nsCSSProperty prop = nsCSSProperty(0); + for (nsCSSPropertyID prop = nsCSSPropertyID(0); prop < eCSSProperty_COUNT; - prop = nsCSSProperty(prop + 1)) { + prop = nsCSSPropertyID(prop + 1)) { if (nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR)) { bool found = false; diff --git a/layout/style/LayerAnimationInfo.h b/layout/style/LayerAnimationInfo.h index 01a1ef42b395..53c5ae9bf218 100644 --- a/layout/style/LayerAnimationInfo.h +++ b/layout/style/LayerAnimationInfo.h @@ -7,7 +7,7 @@ #define mozilla_LayerAnimationInfo_h #include "nsChangeHint.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsDisplayList.h" // For nsDisplayItem::Type namespace mozilla { @@ -19,7 +19,7 @@ struct LayerAnimationInfo { // For CSS properties that may be animated on a separate layer, represents // a record of the corresponding layer type and change hint. struct Record { - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; nsDisplayItem::Type mLayerType; nsChangeHint mChangeHint; }; diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index 430549cd0648..7a5ee4b7ea78 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -53,7 +53,7 @@ using namespace mozilla::gfx; */ static StyleAnimationValue::Unit -GetCommonUnit(nsCSSProperty aProperty, +GetCommonUnit(nsCSSPropertyID aProperty, StyleAnimationValue::Unit aFirstUnit, StyleAnimationValue::Unit aSecondUnit) { @@ -75,7 +75,7 @@ GetCommonUnit(nsCSSProperty aProperty, static nsCSSUnit -GetCommonUnit(nsCSSProperty aProperty, +GetCommonUnit(nsCSSPropertyID aProperty, nsCSSUnit aFirstUnit, nsCSSUnit aSecondUnit) { @@ -483,7 +483,7 @@ CalcPositionCoordSquareDistance(const nsCSSValue& aPos1, // ------------- bool -StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, +StyleAnimationValue::ComputeDistance(nsCSSPropertyID aProperty, const StyleAnimationValue& aStartValue, const StyleAnimationValue& aEndValue, double& aDistance) @@ -1017,7 +1017,7 @@ RestrictValue(uint32_t aRestrictions, T aValue) template T -RestrictValue(nsCSSProperty aProperty, T aValue) +RestrictValue(nsCSSPropertyID aProperty, T aValue) { return RestrictValue(nsCSSProps::ValueRestrictions(aProperty), aValue); } @@ -1839,7 +1839,7 @@ AddPositions(double aCoeff1, const nsCSSValue& aPos1, } static Maybe -AddCSSValuePair(nsCSSProperty aProperty, uint32_t aRestrictions, +AddCSSValuePair(nsCSSPropertyID aProperty, uint32_t aRestrictions, double aCoeff1, const nsCSSValuePair* aPair1, double aCoeff2, const nsCSSValuePair* aPair2) { @@ -1878,7 +1878,7 @@ AddCSSValuePair(nsCSSProperty aProperty, uint32_t aRestrictions, } static UniquePtr -AddCSSValuePairList(nsCSSProperty aProperty, +AddCSSValuePairList(nsCSSPropertyID aProperty, double aCoeff1, const nsCSSValuePairList* aList1, double aCoeff2, const nsCSSValuePairList* aList2) { @@ -1930,7 +1930,7 @@ AddCSSValuePairList(nsCSSProperty aProperty, } static already_AddRefed -AddShapeFunction(nsCSSProperty aProperty, +AddShapeFunction(nsCSSPropertyID aProperty, double aCoeff1, const nsCSSValue::Array* aArray1, double aCoeff2, const nsCSSValue::Array* aArray2) { @@ -2247,7 +2247,7 @@ AddPositionCoords(double aCoeff1, const nsCSSValue& aPos1, } bool -StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, +StyleAnimationValue::AddWeighted(nsCSSPropertyID aProperty, double aCoeff1, const StyleAnimationValue& aValue1, double aCoeff2, @@ -2756,7 +2756,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, } already_AddRefed -BuildStyleRule(nsCSSProperty aProperty, +BuildStyleRule(nsCSSPropertyID aProperty, dom::Element* aTargetElement, const nsAString& aSpecifiedValue, bool aUseSVGMode) @@ -2770,7 +2770,7 @@ BuildStyleRule(nsCSSProperty aProperty, nsCOMPtr baseURI = aTargetElement->GetBaseURI(); nsCSSParser parser(doc->CSSLoader()); - nsCSSProperty propertyToCheck = nsCSSProps::IsShorthand(aProperty) ? + nsCSSPropertyID propertyToCheck = nsCSSProps::IsShorthand(aProperty) ? nsCSSProps::SubpropertyEntryFor(aProperty)[0] : aProperty; // Get a parser, parse the property, and check for CSS parsing errors. @@ -2791,7 +2791,7 @@ BuildStyleRule(nsCSSProperty aProperty, } already_AddRefed -BuildStyleRule(nsCSSProperty aProperty, +BuildStyleRule(nsCSSPropertyID aProperty, dom::Element* aTargetElement, const nsCSSValue& aSpecifiedValue, bool aUseSVGMode) @@ -2820,7 +2820,7 @@ BuildStyleRule(nsCSSProperty aProperty, } static bool -ComputeValuesFromStyleRule(nsCSSProperty aProperty, +ComputeValuesFromStyleRule(nsCSSPropertyID aProperty, CSSEnabledState aEnabledState, dom::Element* aTargetElement, nsStyleContext* aStyleContext, @@ -2908,7 +2908,7 @@ ComputeValuesFromStyleRule(nsCSSProperty aProperty, } /* static */ bool -StyleAnimationValue::ComputeValue(nsCSSProperty aProperty, +StyleAnimationValue::ComputeValue(nsCSSPropertyID aProperty, dom::Element* aTargetElement, nsStyleContext* aStyleContext, const nsAString& aSpecifiedValue, @@ -2959,7 +2959,7 @@ StyleAnimationValue::ComputeValue(nsCSSProperty aProperty, template bool ComputeValuesFromSpecifiedValue( - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, CSSEnabledState aEnabledState, dom::Element* aTargetElement, nsStyleContext* aStyleContext, @@ -2987,7 +2987,7 @@ ComputeValuesFromSpecifiedValue( /* static */ bool StyleAnimationValue::ComputeValues( - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, CSSEnabledState aEnabledState, dom::Element* aTargetElement, nsStyleContext* aStyleContext, @@ -3003,7 +3003,7 @@ StyleAnimationValue::ComputeValues( /* static */ bool StyleAnimationValue::ComputeValues( - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, CSSEnabledState aEnabledState, dom::Element* aTargetElement, nsStyleContext* aStyleContext, @@ -3018,7 +3018,7 @@ StyleAnimationValue::ComputeValues( } bool -StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty, +StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty, const StyleAnimationValue& aComputedValue, nsCSSValue& aSpecifiedValue) { @@ -3134,7 +3134,7 @@ StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty, } bool -StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty, +StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty, StyleAnimationValue&& aComputedValue, nsCSSValue& aSpecifiedValue) { @@ -3169,7 +3169,7 @@ StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty, } bool -StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty, +StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty, const StyleAnimationValue& aComputedValue, nsAString& aSpecifiedValue) { @@ -3587,7 +3587,7 @@ StyleClipBasicShapeToCSSArray(const StyleClipPath& aClipPath, } bool -StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, +StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty, nsStyleContext* aStyleContext, StyleAnimationValue& aComputedValue) { diff --git a/layout/style/StyleAnimationValue.h b/layout/style/StyleAnimationValue.h index 14509db454b4..135fb1b842cb 100644 --- a/layout/style/StyleAnimationValue.h +++ b/layout/style/StyleAnimationValue.h @@ -53,7 +53,7 @@ public: * @param aCount The number of times to add aValueToAdd. * @return true on success, false on failure. */ - static bool Add(nsCSSProperty aProperty, StyleAnimationValue& aDest, + static bool Add(nsCSSPropertyID aProperty, StyleAnimationValue& aDest, const StyleAnimationValue& aValueToAdd, uint32_t aCount) { return AddWeighted(aProperty, 1.0, aDest, aCount, aValueToAdd, aDest); } @@ -76,7 +76,7 @@ public: * @param aDistance The result of the calculation. * @return true on success, false on failure. */ - static bool ComputeDistance(nsCSSProperty aProperty, + static bool ComputeDistance(nsCSSPropertyID aProperty, const StyleAnimationValue& aStartValue, const StyleAnimationValue& aEndValue, double& aDistance); @@ -97,7 +97,7 @@ public: * @param [out] aResultValue The resulting interpolated value. * @return true on success, false on failure. */ - static bool Interpolate(nsCSSProperty aProperty, + static bool Interpolate(nsCSSPropertyID aProperty, const StyleAnimationValue& aStartValue, const StyleAnimationValue& aEndValue, double aPortion, @@ -120,7 +120,7 @@ public: * difficulty, we might change this to restrict them to being * positive. */ - static bool AddWeighted(nsCSSProperty aProperty, + static bool AddWeighted(nsCSSPropertyID aProperty, double aCoeff1, const StyleAnimationValue& aValue1, double aCoeff2, const StyleAnimationValue& aValue2, StyleAnimationValue& aResultValue); @@ -157,7 +157,7 @@ public: * nullptr. * @return true on success, false on failure. */ - static bool ComputeValue(nsCSSProperty aProperty, + static bool ComputeValue(nsCSSPropertyID aProperty, mozilla::dom::Element* aTargetElement, nsStyleContext* aStyleContext, const nsAString& aSpecifiedValue, @@ -175,7 +175,7 @@ public: * to aResult. On failure, aResult might still have partial results * in it. */ - static bool ComputeValues(nsCSSProperty aProperty, + static bool ComputeValues(nsCSSPropertyID aProperty, mozilla::CSSEnabledState aEnabledState, mozilla::dom::Element* aTargetElement, nsStyleContext* aStyleContext, @@ -187,7 +187,7 @@ public: * A variant on ComputeValues that takes an nsCSSValue as the specified * value. Only longhand properties are supported. */ - static bool ComputeValues(nsCSSProperty aProperty, + static bool ComputeValues(nsCSSPropertyID aProperty, mozilla::CSSEnabledState aEnabledState, mozilla::dom::Element* aTargetElement, nsStyleContext* aStyleContext, @@ -212,13 +212,13 @@ public: * @param [out] aSpecifiedValue The resulting specified value. * @return true on success, false on failure. */ - static bool UncomputeValue(nsCSSProperty aProperty, + static bool UncomputeValue(nsCSSPropertyID aProperty, const StyleAnimationValue& aComputedValue, nsCSSValue& aSpecifiedValue); - static bool UncomputeValue(nsCSSProperty aProperty, + static bool UncomputeValue(nsCSSPropertyID aProperty, StyleAnimationValue&& aComputedValue, nsCSSValue& aSpecifiedValue); - static bool UncomputeValue(nsCSSProperty aProperty, + static bool UncomputeValue(nsCSSPropertyID aProperty, const StyleAnimationValue& aComputedValue, nsAString& aSpecifiedValue); @@ -236,7 +236,7 @@ public: * @param [out] aComputedValue The resulting computed value. * @return true on success, false on failure. */ - static bool ExtractComputedValue(nsCSSProperty aProperty, + static bool ExtractComputedValue(nsCSSPropertyID aProperty, nsStyleContext* aStyleContext, StyleAnimationValue& aComputedValue); @@ -509,7 +509,7 @@ private: struct PropertyStyleAnimationValuePair { - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; StyleAnimationValue mValue; }; diff --git a/layout/style/moz.build b/layout/style/moz.build index a2446063562f..0eb2a8cb68e4 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -42,7 +42,7 @@ EXPORTS += [ 'nsCSSKeywords.h', 'nsCSSParser.h', 'nsCSSPropAliasList.h', - 'nsCSSProperty.h', + 'nsCSSPropertyID.h', 'nsCSSPropertySet.h', 'nsCSSPropList.h', 'nsCSSPropLogicalGroupList.h', diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index f75ede6e6362..6d503c0124ea 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -558,10 +558,10 @@ private: const Maybe& aInheritedTimingFunction, nsTArray& aKeyframes); void AppendProperty(nsPresContext* aPresContext, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, nsTArray& aPropertyValues); nsCSSValue GetComputedValue(nsPresContext* aPresContext, - nsCSSProperty aProperty); + nsCSSPropertyID aProperty); static TimingParams TimingParamsFrom( const StyleAnimation& aStyleAnimation) @@ -881,9 +881,9 @@ CSSAnimationBuilder::GetKeyframePropertyValues( mResolvedStyles.Get(aPresContext, mStyleContext, aKeyframeRule->Declaration()); - for (nsCSSProperty prop = nsCSSProperty(0); + for (nsCSSPropertyID prop = nsCSSPropertyID(0); prop < eCSSProperty_COUNT_no_shorthands; - prop = nsCSSProperty(prop + 1)) { + prop = nsCSSPropertyID(prop + 1)) { if (nsCSSProps::kAnimTypeTable[prop] == eStyleAnimType_None || !aKeyframeRule->Declaration()->HasNonImportantValueFor(prop)) { continue; @@ -997,9 +997,9 @@ CSSAnimationBuilder::FillInMissingKeyframeValues( ? nullptr : &aKeyframes[endKeyframeIndex]; // Iterate through all properties and fill-in missing values - for (nsCSSProperty prop = nsCSSProperty(0); + for (nsCSSPropertyID prop = nsCSSPropertyID(0); prop < eCSSProperty_COUNT_no_shorthands; - prop = nsCSSProperty(prop + 1)) { + prop = nsCSSPropertyID(prop + 1)) { if (!aAnimatedProperties.HasProperty(prop)) { continue; } @@ -1016,7 +1016,7 @@ CSSAnimationBuilder::FillInMissingKeyframeValues( void CSSAnimationBuilder::AppendProperty( nsPresContext* aPresContext, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, nsTArray& aPropertyValues) { PropertyValuePair propertyValue; @@ -1028,7 +1028,7 @@ CSSAnimationBuilder::AppendProperty( nsCSSValue CSSAnimationBuilder::GetComputedValue(nsPresContext* aPresContext, - nsCSSProperty aProperty) + nsCSSPropertyID aProperty) { nsCSSValue result; StyleAnimationValue computedValue; diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index 8fbf9e8577c1..da498ad0c13b 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -55,7 +55,7 @@ ShouldIgnoreColors(nsRuleData *aRuleData) */ static void TryToStartImageLoadOnValue(const nsCSSValue& aValue, nsIDocument* aDocument, - nsStyleContext* aContext, nsCSSProperty aProperty, + nsStyleContext* aContext, nsCSSPropertyID aProperty, bool aForTokenStream) { MOZ_ASSERT(aDocument); @@ -125,7 +125,7 @@ TryToStartImageLoadOnValue(const nsCSSValue& aValue, nsIDocument* aDocument, static void TryToStartImageLoad(const nsCSSValue& aValue, nsIDocument* aDocument, - nsStyleContext* aContext, nsCSSProperty aProperty, + nsStyleContext* aContext, nsCSSPropertyID aProperty, bool aForTokenStream) { if (aValue.GetUnit() == eCSSUnit_List) { @@ -146,7 +146,7 @@ TryToStartImageLoad(const nsCSSValue& aValue, nsIDocument* aDocument, } static inline bool -ShouldStartImageLoads(nsRuleData *aRuleData, nsCSSProperty aProperty) +ShouldStartImageLoads(nsRuleData *aRuleData, nsCSSPropertyID aProperty) { // Don't initiate image loads for if-visited styles. This is // important because: @@ -160,7 +160,7 @@ ShouldStartImageLoads(nsRuleData *aRuleData, nsCSSProperty aProperty) } static void -MapSinglePropertyInto(nsCSSProperty aTargetProp, +MapSinglePropertyInto(nsCSSPropertyID aTargetProp, const nsCSSValue* aSrcValue, nsCSSValue* aTargetValue, nsRuleData* aRuleData) @@ -212,7 +212,7 @@ MapSinglePropertyInto(nsCSSProperty aTargetProp, * style context. */ static inline void -EnsurePhysicalProperty(nsCSSProperty& aProperty, nsRuleData* aRuleData) +EnsurePhysicalProperty(nsCSSPropertyID& aProperty, nsRuleData* aRuleData) { bool isAxisProperty = nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_LOGICAL_AXIS); @@ -258,7 +258,7 @@ EnsurePhysicalProperty(nsCSSProperty& aProperty, nsRuleData* aRuleData) index = side; } - const nsCSSProperty* props = nsCSSProps::LogicalGroup(aProperty); + const nsCSSPropertyID* props = nsCSSProps::LogicalGroup(aProperty); size_t len = isAxisProperty ? 2 : 4; #ifdef DEBUG for (size_t i = 0; i < len; i++) { @@ -312,7 +312,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const // right property when one can be expressed using both logical and // physical property names. for (uint32_t i = mNumProps; i-- > 0; ) { - nsCSSProperty iProp = PropertyAtIndex(i); + nsCSSPropertyID iProp = PropertyAtIndex(i); if (nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[iProp]) & aRuleData->mSIDs) { if (nsCSSProps::PropHasFlags(iProp, CSS_PROPERTY_LOGICAL)) { @@ -337,7 +337,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const } const nsCSSValue* -nsCSSCompressedDataBlock::ValueFor(nsCSSProperty aProperty) const +nsCSSCompressedDataBlock::ValueFor(nsCSSPropertyID aProperty) const { MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), "Don't call for shorthands"); @@ -360,7 +360,7 @@ nsCSSCompressedDataBlock::ValueFor(nsCSSProperty aProperty) const } bool -nsCSSCompressedDataBlock::TryReplaceValue(nsCSSProperty aProperty, +nsCSSCompressedDataBlock::TryReplaceValue(nsCSSPropertyID aProperty, nsCSSExpandedDataBlock& aFromBlock, bool *aChanged) { @@ -480,7 +480,7 @@ nsCSSExpandedDataBlock::DoExpand(nsCSSCompressedDataBlock *aBlock, * corresponding to the stored data in the compressed block. */ for (uint32_t i = 0; i < aBlock->mNumProps; i++) { - nsCSSProperty iProp = aBlock->PropertyAtIndex(i); + nsCSSPropertyID iProp = aBlock->PropertyAtIndex(i); MOZ_ASSERT(!nsCSSProps::IsShorthand(iProp), "out of range"); MOZ_ASSERT(!HasPropertyBit(iProp), "compressed block has property multiple times"); @@ -530,7 +530,7 @@ nsCSSExpandedDataBlock::ComputeNumProps(uint32_t* aNumPropsNormal, if (!mPropertiesSet.HasPropertyAt(iHigh, iLow)) continue; #ifdef DEBUG - nsCSSProperty iProp = nsCSSPropertySet::CSSPropertyAt(iHigh, iLow); + nsCSSPropertyID iProp = nsCSSPropertySet::CSSPropertyAt(iHigh, iLow); #endif MOZ_ASSERT(!nsCSSProps::IsShorthand(iProp), "out of range"); MOZ_ASSERT(PropertyAt(iProp)->GetUnit() != eCSSUnit_Null, @@ -570,7 +570,7 @@ nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock, * clearing the data in the expanded block. */ for (size_t i = 0; i < aOrder.Length(); i++) { - nsCSSProperty iProp = static_cast(aOrder[i]); + nsCSSPropertyID iProp = static_cast(aOrder[i]); if (iProp >= eCSSProperty_COUNT) { // a custom property continue; @@ -627,7 +627,7 @@ nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock, } void -nsCSSExpandedDataBlock::AddLonghandProperty(nsCSSProperty aProperty, +nsCSSExpandedDataBlock::AddLonghandProperty(nsCSSPropertyID aProperty, const nsCSSValue& aValue) { MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), @@ -646,7 +646,7 @@ nsCSSExpandedDataBlock::Clear() for (size_t iLow = 0; iLow < nsCSSPropertySet::kBitsInChunk; ++iLow) { if (!mPropertiesSet.HasPropertyAt(iHigh, iLow)) continue; - nsCSSProperty iProp = nsCSSPropertySet::CSSPropertyAt(iHigh, iLow); + nsCSSPropertyID iProp = nsCSSPropertySet::CSSPropertyAt(iHigh, iLow); ClearLonghandProperty(iProp); } } @@ -655,7 +655,7 @@ nsCSSExpandedDataBlock::Clear() } void -nsCSSExpandedDataBlock::ClearProperty(nsCSSProperty aPropID) +nsCSSExpandedDataBlock::ClearProperty(nsCSSPropertyID aPropID) { if (nsCSSProps::IsShorthand(aPropID)) { CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES( @@ -668,7 +668,7 @@ nsCSSExpandedDataBlock::ClearProperty(nsCSSProperty aPropID) } void -nsCSSExpandedDataBlock::ClearLonghandProperty(nsCSSProperty aPropID) +nsCSSExpandedDataBlock::ClearLonghandProperty(nsCSSPropertyID aPropID) { MOZ_ASSERT(!nsCSSProps::IsShorthand(aPropID), "out of range"); @@ -679,7 +679,7 @@ nsCSSExpandedDataBlock::ClearLonghandProperty(nsCSSProperty aPropID) bool nsCSSExpandedDataBlock::TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock, - nsCSSProperty aPropID, + nsCSSPropertyID aPropID, CSSEnabledState aEnabledState, bool aIsImportant, bool aOverrideImportant, @@ -711,7 +711,7 @@ nsCSSExpandedDataBlock::TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock, bool nsCSSExpandedDataBlock::DoTransferFromBlock(nsCSSExpandedDataBlock& aFromBlock, - nsCSSProperty aPropID, + nsCSSPropertyID aPropID, bool aIsImportant, bool aOverrideImportant, bool aMustCallValueAppended, @@ -764,7 +764,7 @@ nsCSSExpandedDataBlock::DoTransferFromBlock(nsCSSExpandedDataBlock& aFromBlock, } void -nsCSSExpandedDataBlock::MapRuleInfoInto(nsCSSProperty aPropID, +nsCSSExpandedDataBlock::MapRuleInfoInto(nsCSSPropertyID aPropID, nsRuleData* aRuleData) const { MOZ_ASSERT(!nsCSSProps::IsShorthand(aPropID)); @@ -772,7 +772,7 @@ nsCSSExpandedDataBlock::MapRuleInfoInto(nsCSSProperty aPropID, const nsCSSValue* src = PropertyAt(aPropID); MOZ_ASSERT(src->GetUnit() != eCSSUnit_Null); - nsCSSProperty physicalProp = aPropID; + nsCSSPropertyID physicalProp = aPropID; if (nsCSSProps::PropHasFlags(aPropID, CSS_PROPERTY_LOGICAL)) { EnsurePhysicalProperty(physicalProp, aRuleData); } @@ -794,7 +794,7 @@ nsCSSExpandedDataBlock::DoAssertInitialState() mPropertiesImportant.AssertIsEmpty("not initial state"); for (uint32_t i = 0; i < eCSSProperty_COUNT_no_shorthands; ++i) { - nsCSSProperty prop = nsCSSProperty(i); + nsCSSPropertyID prop = nsCSSPropertyID(i); MOZ_ASSERT(PropertyAt(prop)->GetUnit() == eCSSUnit_Null, "not initial state"); } diff --git a/layout/style/nsCSSDataBlock.h b/layout/style/nsCSSDataBlock.h index 33f30230f0d1..36b2790ca5cd 100644 --- a/layout/style/nsCSSDataBlock.h +++ b/layout/style/nsCSSDataBlock.h @@ -64,7 +64,7 @@ public: * * Must not be called for shorthands. */ - const nsCSSValue* ValueFor(nsCSSProperty aProperty) const; + const nsCSSValue* ValueFor(nsCSSPropertyID aProperty) const; /** * Attempt to replace the value for |aProperty| stored in this block @@ -74,7 +74,7 @@ public: * actually made a change to the block, but regardless, if it * returns true, the value in |aFromBlock| was erased. */ - bool TryReplaceValue(nsCSSProperty aProperty, + bool TryReplaceValue(nsCSSPropertyID aProperty, nsCSSExpandedDataBlock& aFromBlock, bool* aChanged); @@ -108,9 +108,9 @@ private: } public: - // Ideally, |nsCSSProperty| would be |enum nsCSSProperty : int16_t|. But + // Ideally, |nsCSSPropertyID| would be |enum nsCSSPropertyID : int16_t|. But // not all of the compilers we use are modern enough to support small - // enums. So we manually squeeze nsCSSProperty into 16 bits ourselves. + // enums. So we manually squeeze nsCSSPropertyID into 16 bits ourselves. // The static assertion below ensures it fits. typedef int16_t CompressedCSSProperty; static const size_t MaxCompressedCSSProperty = INT16_MAX; @@ -125,7 +125,7 @@ private: // |nsCachedStyleData::GetBitForSID|. uint32_t mNumProps; // nsCSSValue elements are stored after these fields, and - // nsCSSProperty elements are stored -- each one compressed as a + // nsCSSPropertyID elements are stored -- each one compressed as a // CompressedCSSProperty -- after the nsCSSValue elements. Space for them // is allocated in |operator new| above. The static assertions following // this class make sure that the value and property elements are aligned @@ -144,9 +144,9 @@ private: return Values() + i; } - nsCSSProperty PropertyAtIndex(uint32_t i) const { + nsCSSPropertyID PropertyAtIndex(uint32_t i) const { MOZ_ASSERT(i < mNumProps, "property index out of range"); - nsCSSProperty prop = (nsCSSProperty)CompressedProperties()[i]; + nsCSSPropertyID prop = (nsCSSPropertyID)CompressedProperties()[i]; MOZ_ASSERT(!nsCSSProps::IsShorthand(prop), "out of range"); return prop; } @@ -159,7 +159,7 @@ private: memcpy(ValueAtIndex(i), aValue, sizeof(nsCSSValue)); } - void SetPropertyAtIndex(uint32_t i, nsCSSProperty aProperty) { + void SetPropertyAtIndex(uint32_t i, nsCSSPropertyID aProperty) { MOZ_ASSERT(i < mNumProps, "set property index out of range"); CompressedProperties()[i] = (CompressedCSSProperty)aProperty; } @@ -181,7 +181,7 @@ static_assert(NS_ALIGNMENT_OF(nsCSSCompressedDataBlock::CompressedCSSProperty) = // Make sure that sizeof(CompressedCSSProperty) is big enough. static_assert(eCSSProperty_COUNT_no_shorthands <= nsCSSCompressedDataBlock::MaxCompressedCSSProperty, - "nsCSSProperty doesn't fit in StoredSizeOfCSSProperty"); + "nsCSSPropertyID doesn't fit in StoredSizeOfCSSProperty"); class nsCSSExpandedDataBlock { @@ -218,7 +218,7 @@ public: * !important properties in the expanded block; otherwise * |*aImportantBlock| will be set to null. * - * aOrder is an array of nsCSSProperty values specifying the order + * aOrder is an array of nsCSSPropertyID values specifying the order * to store values in the two data blocks. */ void Compress(nsCSSCompressedDataBlock **aNormalBlock, @@ -229,7 +229,7 @@ public: * Copy a value into this expanded block. This does NOT destroy * the source value object. |aProperty| cannot be a shorthand. */ - void AddLonghandProperty(nsCSSProperty aProperty, const nsCSSValue& aValue); + void AddLonghandProperty(nsCSSPropertyID aProperty, const nsCSSValue& aValue); /** * Clear the state of this expanded block. @@ -240,12 +240,12 @@ public: * Clear the data for the given property (including the set and * important bits). Can be used with shorthand properties. */ - void ClearProperty(nsCSSProperty aPropID); + void ClearProperty(nsCSSPropertyID aPropID); /** * Same as ClearProperty, but faster and cannot be used with shorthands. */ - void ClearLonghandProperty(nsCSSProperty aPropID); + void ClearLonghandProperty(nsCSSPropertyID aPropID); /** * Transfer the state for |aPropID| (which may be a shorthand) @@ -263,7 +263,7 @@ public: * non-null and |aPropID| has a use counter. */ bool TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock, - nsCSSProperty aPropID, + nsCSSPropertyID aPropID, mozilla::CSSEnabledState aEnabledState, bool aIsImportant, bool aOverrideImportant, @@ -277,7 +277,7 @@ public: * This is used for copying parsed-at-computed-value-time properties * that had variable references. aPropID must be a longhand property. */ - void MapRuleInfoInto(nsCSSProperty aPropID, nsRuleData* aRuleData) const; + void MapRuleInfoInto(nsCSSPropertyID aPropID, nsRuleData* aRuleData) const; void AssertInitialState() { #ifdef DEBUG @@ -299,7 +299,7 @@ private: * Worker for TransferFromBlock; cannot be used with shorthands. */ bool DoTransferFromBlock(nsCSSExpandedDataBlock& aFromBlock, - nsCSSProperty aPropID, + nsCSSPropertyID aPropID, bool aIsImportant, bool aOverrideImportant, bool aMustCallValueAppended, @@ -326,40 +326,40 @@ private: * Return the storage location within |this| of the value of the * property |aProperty|. */ - nsCSSValue* PropertyAt(nsCSSProperty aProperty) { + nsCSSValue* PropertyAt(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "property out of range"); return &mValues[aProperty]; } - const nsCSSValue* PropertyAt(nsCSSProperty aProperty) const { + const nsCSSValue* PropertyAt(nsCSSPropertyID aProperty) const { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "property out of range"); return &mValues[aProperty]; } - void SetPropertyBit(nsCSSProperty aProperty) { + void SetPropertyBit(nsCSSPropertyID aProperty) { mPropertiesSet.AddProperty(aProperty); } - void ClearPropertyBit(nsCSSProperty aProperty) { + void ClearPropertyBit(nsCSSPropertyID aProperty) { mPropertiesSet.RemoveProperty(aProperty); } - bool HasPropertyBit(nsCSSProperty aProperty) { + bool HasPropertyBit(nsCSSPropertyID aProperty) { return mPropertiesSet.HasProperty(aProperty); } - void SetImportantBit(nsCSSProperty aProperty) { + void SetImportantBit(nsCSSPropertyID aProperty) { mPropertiesImportant.AddProperty(aProperty); } - void ClearImportantBit(nsCSSProperty aProperty) { + void ClearImportantBit(nsCSSPropertyID aProperty) { mPropertiesImportant.RemoveProperty(aProperty); } - bool HasImportantBit(nsCSSProperty aProperty) { + bool HasImportantBit(nsCSSPropertyID aProperty) { return mPropertiesImportant.HasProperty(aProperty); } diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 1f0cbb21ffab..602ceb1eae1b 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -173,7 +173,7 @@ public: nsIPrincipal* aSheetPrincipal, css::Rule** aResult); - void ParseProperty(const nsCSSProperty aPropID, + void ParseProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURL, nsIURI* aBaseURL, @@ -182,7 +182,7 @@ public: bool* aChanged, bool aIsImportant, bool aIsSVGMode); - void ParseLonghandProperty(const nsCSSProperty aPropID, + void ParseLonghandProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURL, nsIURI* aBaseURL, @@ -270,7 +270,7 @@ public: nsIPrincipal* aSheetPrincipal, nsCSSValue& aValue); - bool IsValueValidForProperty(const nsCSSProperty aPropID, + bool IsValueValidForProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue); typedef nsCSSParser::VariableEnumFunc VariableEnumFunc; @@ -334,8 +334,8 @@ public: * @param aRuleData The rule data object into which parsed property value for * aPropertyID will be stored. */ - void ParsePropertyWithVariableReferences(nsCSSProperty aPropertyID, - nsCSSProperty aShorthandPropertyID, + void ParsePropertyWithVariableReferences(nsCSSPropertyID aPropertyID, + nsCSSPropertyID aShorthandPropertyID, const nsAString& aValue, const CSSVariableValues* aVariables, nsRuleData* aRuleData, @@ -371,7 +371,7 @@ public: return enabledState; } - nsCSSProperty LookupEnabledProperty(const nsAString& aProperty) { + nsCSSPropertyID LookupEnabledProperty(const nsAString& aProperty) { return nsCSSProps::LookupProperty(aProperty, EnabledState()); } @@ -829,12 +829,12 @@ protected: bool ParseWebkitPrefixedGradientWithService(nsAString& aPrefixedFuncName, nsCSSValue& aValue); - bool ParseProperty(nsCSSProperty aPropID); - bool ParsePropertyByFunction(nsCSSProperty aPropID); + bool ParseProperty(nsCSSPropertyID aPropID); + bool ParsePropertyByFunction(nsCSSPropertyID aPropID); CSSParseResult ParseSingleValueProperty(nsCSSValue& aValue, - nsCSSProperty aPropID); + nsCSSPropertyID aPropID); bool ParseSingleValuePropertyByFunction(nsCSSValue& aValue, - nsCSSProperty aPropID); + nsCSSPropertyID aPropID); // This is similar to ParseSingleValueProperty but only works for // properties that are parsed with ParseBoxProperties or @@ -843,7 +843,7 @@ protected: // Only works with variants with the following flags: // A, C, H, K, L, N, P, CALC. CSSParseResult ParseBoxProperty(nsCSSValue& aValue, - nsCSSProperty aPropID); + nsCSSPropertyID aPropID); enum PriorityParsingStatus { ePriority_None, @@ -857,7 +857,7 @@ protected: #endif // Property specific parsing routines - bool ParseImageLayers(const nsCSSProperty aTable[]); + bool ParseImageLayers(const nsCSSPropertyID aTable[]); struct ImageLayersShorthandParseState { nsCSSValue& mColor; @@ -887,13 +887,13 @@ protected: bool IsFunctionTokenValidForImageLayerImage(const nsCSSToken& aToken) const; bool ParseImageLayersItem(ImageLayersShorthandParseState& aState, - const nsCSSProperty aTable[]); + const nsCSSPropertyID aTable[]); - bool ParseValueList(nsCSSProperty aPropID); // a single value prop-id - bool ParseImageLayerRepeat(nsCSSProperty aPropID); + bool ParseValueList(nsCSSPropertyID aPropID); // a single value prop-id + bool ParseImageLayerRepeat(nsCSSPropertyID aPropID); bool ParseImageLayerRepeatValues(nsCSSValuePair& aValue); - bool ParseImageLayerPosition(const nsCSSProperty aTable[]); - bool ParseImageLayerPositionCoord(nsCSSProperty aPropID, bool aIsHorizontal); + bool ParseImageLayerPosition(const nsCSSPropertyID aTable[]); + bool ParseImageLayerPositionCoord(nsCSSPropertyID aPropID, bool aIsHorizontal); // ParseBoxPositionValues parses the CSS 2.1 background-position syntax, // which is still used by some properties. See ParsePositionValue @@ -907,10 +907,10 @@ protected: bool ParsePositionValueSeparateCoords(nsCSSValue& aOutX, nsCSSValue& aOutY); bool ParseImageLayerPositionCoordItem(nsCSSValue& aOut, bool aIsHorizontal); - bool ParseImageLayerSize(nsCSSProperty aPropID); + bool ParseImageLayerSize(nsCSSPropertyID aPropID); bool ParseImageLayerSizeValues(nsCSSValuePair& aOut); bool ParseBorderColor(); - bool ParseBorderColors(nsCSSProperty aProperty); + bool ParseBorderColors(nsCSSPropertyID aProperty); void SetBorderImageInitialValues(); bool ParseBorderImageRepeat(bool aAcceptsInherit); // If ParseBorderImageSlice returns false, aConsumedTokens indicates @@ -922,7 +922,7 @@ protected: bool ParseBorderImageOutset(bool aAcceptsInherit); bool ParseBorderImage(); bool ParseBorderSpacing(); - bool ParseBorderSide(const nsCSSProperty aPropIDs[], + bool ParseBorderSide(const nsCSSPropertyID aPropIDs[], bool aSetAllSides); bool ParseBorderStyle(); bool ParseBorderWidth(); @@ -963,7 +963,7 @@ protected: CSSParseResult ParseGridTrackSize(nsCSSValue& aValue, GridTrackSizeFlags aFlags = GridTrackSizeFlags::eDefaultTrackSize); - bool ParseGridAutoColumnsRows(nsCSSProperty aPropID); + bool ParseGridAutoColumnsRows(nsCSSPropertyID aPropID); bool ParseGridTrackListRepeat(nsCSSValueList** aTailPtr); bool ParseGridTrackRepeatIntro(bool aForSubgrid, int32_t* aRepetitions, @@ -983,8 +983,8 @@ protected: bool ParseGridTrackListWithFirstLineNames(nsCSSValue& aValue, const nsCSSValue& aFirstLineNames); - bool ParseGridTrackList(nsCSSProperty aPropID); - bool ParseGridTemplateColumnsRows(nsCSSProperty aPropID); + bool ParseGridTrackList(nsCSSPropertyID aPropID); + bool ParseGridTemplateColumnsRows(nsCSSPropertyID aPropID); // |aAreaIndices| is a lookup table to help us parse faster, // mapping area names to indices in |aResult.mNamedAreas|. @@ -997,9 +997,9 @@ protected: bool ParseGrid(); bool ParseGridShorthandAutoProps(); bool ParseGridLine(nsCSSValue& aValue); - bool ParseGridColumnRowStartEnd(nsCSSProperty aPropID); - bool ParseGridColumnRow(nsCSSProperty aStartPropID, - nsCSSProperty aEndPropID); + bool ParseGridColumnRowStartEnd(nsCSSPropertyID aPropID); + bool ParseGridColumnRow(nsCSSPropertyID aStartPropID, + nsCSSPropertyID aEndPropID); bool ParseGridArea(); bool ParseGridGap(); @@ -1010,16 +1010,16 @@ protected: const KTableEntry aTable[]); bool ParseJustifyItems(); bool ParseAlignItems(); - bool ParseAlignJustifySelf(nsCSSProperty aPropID); + bool ParseAlignJustifySelf(nsCSSPropertyID aPropID); // parsing 'align/justify-content' from the css-align spec - bool ParseAlignJustifyContent(nsCSSProperty aPropID); + bool ParseAlignJustifyContent(nsCSSPropertyID aPropID); // for 'clip' and '-moz-image-region' - bool ParseRect(nsCSSProperty aPropID); + bool ParseRect(nsCSSPropertyID aPropID); bool ParseColumns(); bool ParseContain(nsCSSValue& aValue); bool ParseContent(); - bool ParseCounterData(nsCSSProperty aPropID); + bool ParseCounterData(nsCSSPropertyID aPropID); bool ParseCursor(); bool ParseFont(); bool ParseFontSynthesis(nsCSSValue& aValue); @@ -1065,7 +1065,7 @@ protected: bool ParseTouchAction(nsCSSValue& aValue); bool ParseShadowItem(nsCSSValue& aValue, bool aIsBoxShadow); - bool ParseShadowList(nsCSSProperty aProperty); + bool ParseShadowList(nsCSSPropertyID aProperty); bool ParseShapeOutside(nsCSSValue& aValue); bool ParseTransitionProperty(); bool ParseTransitionTimingFunctionValues(nsCSSValue& aValue); @@ -1079,7 +1079,7 @@ protected: eParseAnimationOrTransitionShorthand_Error }; ParseAnimationOrTransitionShorthandResult - ParseAnimationOrTransitionShorthand(const nsCSSProperty* aProperties, + ParseAnimationOrTransitionShorthand(const nsCSSPropertyID* aProperties, const nsCSSValue* aInitialValues, nsCSSValue* aValues, size_t aNumProperties); @@ -1087,13 +1087,13 @@ protected: bool ParseAnimation(); bool ParseWillChange(); - bool ParsePaint(nsCSSProperty aPropID); + bool ParsePaint(nsCSSPropertyID aPropID); bool ParseDasharray(); bool ParseMarker(); bool ParsePaintOrder(); bool ParseAll(); bool ParseScrollSnapType(); - bool ParseScrollSnapPoints(nsCSSValue& aValue, nsCSSProperty aPropID); + bool ParseScrollSnapPoints(nsCSSValue& aValue, nsCSSPropertyID aPropID); bool ParseScrollSnapDestination(nsCSSValue& aValue); bool ParseScrollSnapCoordinate(nsCSSValue& aValue); bool ParseWebkitTextStroke(); @@ -1146,16 +1146,16 @@ protected: void AppendImpliedEOFCharacters(nsAString& aResult); // Reused utility parsing routines - void AppendValue(nsCSSProperty aPropID, const nsCSSValue& aValue); - bool ParseBoxProperties(const nsCSSProperty aPropIDs[]); + void AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue); + bool ParseBoxProperties(const nsCSSPropertyID aPropIDs[]); bool ParseGroupedBoxProperty(int32_t aVariantMask, nsCSSValue& aValue); - bool ParseBoxCornerRadius(const nsCSSProperty aPropID); + bool ParseBoxCornerRadius(const nsCSSPropertyID aPropID); bool ParseBoxCornerRadiiInternals(nsCSSValue array[]); - bool ParseBoxCornerRadii(const nsCSSProperty aPropIDs[]); + bool ParseBoxCornerRadii(const nsCSSPropertyID aPropIDs[]); int32_t ParseChoice(nsCSSValue aValues[], - const nsCSSProperty aPropIDs[], int32_t aNumIDs); + const nsCSSPropertyID aPropIDs[], int32_t aNumIDs); CSSParseResult ParseColor(nsCSSValue& aValue); bool ParseNumberColorComponent(uint8_t& aComponent, char aStop); bool ParsePercentageColorComponent(float& aComponent, char aStop); @@ -1871,7 +1871,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule, } void -CSSParserImpl::ParseLonghandProperty(const nsCSSProperty aPropID, +CSSParserImpl::ParseLonghandProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURL, nsIURI* aBaseURL, @@ -1940,7 +1940,7 @@ CSSParserImpl::ParseTransformProperty(const nsAString& aPropValue, } void -CSSParserImpl::ParseProperty(const nsCSSProperty aPropID, +CSSParserImpl::ParseProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURI, nsIURI* aBaseURI, @@ -2340,7 +2340,7 @@ CSSParserImpl::EvaluateSupportsDeclaration(const nsAString& aProperty, nsIURI* aBaseURL, nsIPrincipal* aDocPrincipal) { - nsCSSProperty propID = LookupEnabledProperty(aProperty); + nsCSSPropertyID propID = LookupEnabledProperty(aProperty); if (propID == eCSSProperty_UNKNOWN) { return false; } @@ -2919,8 +2919,8 @@ CSSParserImpl::ResolveVariableValue(const nsAString& aPropertyValue, void CSSParserImpl::ParsePropertyWithVariableReferences( - nsCSSProperty aPropertyID, - nsCSSProperty aShorthandPropertyID, + nsCSSPropertyID aPropertyID, + nsCSSPropertyID aShorthandPropertyID, const nsAString& aValue, const CSSVariableValues* aVariables, nsRuleData* aRuleData, @@ -2959,7 +2959,7 @@ CSSParserImpl::ParsePropertyWithVariableReferences( ReleaseScanner(); } - nsCSSProperty propertyToParse = + nsCSSPropertyID propertyToParse = aShorthandPropertyID != eCSSProperty_UNKNOWN ? aShorthandPropertyID : aPropertyID; @@ -4662,7 +4662,7 @@ CSSParserImpl::ParseSupportsConditionInParensInsideParens(bool& aConditionMet) return false; } - nsCSSProperty propID = LookupEnabledProperty(propertyName); + nsCSSPropertyID propID = LookupEnabledProperty(propertyName); if (propID == eCSSProperty_UNKNOWN) { if (ExpectSymbol(')', true)) { UngetToken(); @@ -7285,7 +7285,7 @@ CSSParserImpl::ParseDeclaration(css::Declaration* aDeclaration, nsAutoSuppressErrors suppressErrors(this, mInFailingSupportsRule); // Information about a parsed non-custom property. - nsCSSProperty propID; + nsCSSPropertyID propID; // Information about a parsed custom property. CSSVariableDeclarations::Type variableType; @@ -7402,47 +7402,47 @@ CSSParserImpl::ParseDeclaration(css::Declaration* aDeclaration, return true; } -static const nsCSSProperty kBorderTopIDs[] = { +static const nsCSSPropertyID kBorderTopIDs[] = { eCSSProperty_border_top_width, eCSSProperty_border_top_style, eCSSProperty_border_top_color }; -static const nsCSSProperty kBorderRightIDs[] = { +static const nsCSSPropertyID kBorderRightIDs[] = { eCSSProperty_border_right_width, eCSSProperty_border_right_style, eCSSProperty_border_right_color }; -static const nsCSSProperty kBorderBottomIDs[] = { +static const nsCSSPropertyID kBorderBottomIDs[] = { eCSSProperty_border_bottom_width, eCSSProperty_border_bottom_style, eCSSProperty_border_bottom_color }; -static const nsCSSProperty kBorderLeftIDs[] = { +static const nsCSSPropertyID kBorderLeftIDs[] = { eCSSProperty_border_left_width, eCSSProperty_border_left_style, eCSSProperty_border_left_color }; -static const nsCSSProperty kBorderInlineStartIDs[] = { +static const nsCSSPropertyID kBorderInlineStartIDs[] = { eCSSProperty_border_inline_start_width, eCSSProperty_border_inline_start_style, eCSSProperty_border_inline_start_color }; -static const nsCSSProperty kBorderInlineEndIDs[] = { +static const nsCSSPropertyID kBorderInlineEndIDs[] = { eCSSProperty_border_inline_end_width, eCSSProperty_border_inline_end_style, eCSSProperty_border_inline_end_color }; -static const nsCSSProperty kBorderBlockStartIDs[] = { +static const nsCSSPropertyID kBorderBlockStartIDs[] = { eCSSProperty_border_block_start_width, eCSSProperty_border_block_start_style, eCSSProperty_border_block_start_color }; -static const nsCSSProperty kBorderBlockEndIDs[] = { +static const nsCSSPropertyID kBorderBlockEndIDs[] = { eCSSProperty_border_block_end_width, eCSSProperty_border_block_end_style, eCSSProperty_border_block_end_color }; -static const nsCSSProperty kColumnRuleIDs[] = { +static const nsCSSPropertyID kColumnRuleIDs[] = { eCSSProperty__moz_column_rule_width, eCSSProperty__moz_column_rule_style, eCSSProperty__moz_column_rule_color @@ -8487,7 +8487,7 @@ CSSParserImpl::ParseFlex() bool CSSParserImpl::ParseFlexFlow() { - static const nsCSSProperty kFlexFlowSubprops[] = { + static const nsCSSPropertyID kFlexFlowSubprops[] = { eCSSProperty_flex_direction, eCSSProperty_flex_wrap }; @@ -8779,7 +8779,7 @@ CSSParserImpl::ParseGridTrackSize(nsCSSValue& aValue, } bool -CSSParserImpl::ParseGridAutoColumnsRows(nsCSSProperty aPropID) +CSSParserImpl::ParseGridAutoColumnsRows(nsCSSPropertyID aPropID) { nsCSSValue value; if (ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr) || @@ -9155,7 +9155,7 @@ CSSParserImpl::ParseGridTrackListRepeat(nsCSSValueList** aTailPtr) } bool -CSSParserImpl::ParseGridTrackList(nsCSSProperty aPropID) +CSSParserImpl::ParseGridTrackList(nsCSSPropertyID aPropID) { nsCSSValue value; nsCSSValue firstLineNames; @@ -9168,7 +9168,7 @@ CSSParserImpl::ParseGridTrackList(nsCSSProperty aPropID) } bool -CSSParserImpl::ParseGridTemplateColumnsRows(nsCSSProperty aPropID) +CSSParserImpl::ParseGridTemplateColumnsRows(nsCSSPropertyID aPropID) { nsCSSValue value; if (ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE, nullptr)) { @@ -9487,7 +9487,7 @@ CSSParserImpl::ParseGrid() { nsCSSValue value; if (ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { - for (const nsCSSProperty* subprops = + for (const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_grid); *subprops != eCSSProperty_UNKNOWN; ++subprops) { AppendValue(*subprops, value); @@ -9661,7 +9661,7 @@ CSSParserImpl::ParseGridLine(nsCSSValue& aValue) } bool -CSSParserImpl::ParseGridColumnRowStartEnd(nsCSSProperty aPropID) +CSSParserImpl::ParseGridColumnRowStartEnd(nsCSSPropertyID aPropID) { nsCSSValue value; if (ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr) || @@ -9688,8 +9688,8 @@ HandleGridLineFallback(const nsCSSValue& aFallback, nsCSSValue& aValue) } bool -CSSParserImpl::ParseGridColumnRow(nsCSSProperty aStartPropID, - nsCSSProperty aEndPropID) +CSSParserImpl::ParseGridColumnRow(nsCSSPropertyID aStartPropID, + nsCSSPropertyID aEndPropID) { nsCSSValue value; nsCSSValue secondValue; @@ -9905,7 +9905,7 @@ CSSParserImpl::ParseAlignItems() // auto | normal | stretch | | // [ ? && ] bool -CSSParserImpl::ParseAlignJustifySelf(nsCSSProperty aPropID) +CSSParserImpl::ParseAlignJustifySelf(nsCSSPropertyID aPropID) { nsCSSValue value; if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { @@ -9924,7 +9924,7 @@ CSSParserImpl::ParseAlignJustifySelf(nsCSSProperty aPropID) // [ ? && ] ] // (the part after the || is called <*-position> below) bool -CSSParserImpl::ParseAlignJustifyContent(nsCSSProperty aPropID) +CSSParserImpl::ParseAlignJustifyContent(nsCSSPropertyID aPropID) { nsCSSValue value; if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { @@ -10867,7 +10867,7 @@ CSSParserImpl::ParseWebkitGradient(nsCSSValue& aValue) bool CSSParserImpl::ParseWebkitTextStroke() { - static const nsCSSProperty kWebkitTextStrokeIDs[] = { + static const nsCSSPropertyID kWebkitTextStrokeIDs[] = { eCSSProperty__webkit_text_stroke_width, eCSSProperty__webkit_text_stroke_color }; @@ -10897,7 +10897,7 @@ CSSParserImpl::ParseWebkitTextStroke() int32_t CSSParserImpl::ParseChoice(nsCSSValue aValues[], - const nsCSSProperty aPropIDs[], int32_t aNumIDs) + const nsCSSPropertyID aPropIDs[], int32_t aNumIDs) { int32_t found = 0; nsAutoParseCompoundProperty compound(this); @@ -10970,7 +10970,7 @@ CSSParserImpl::ParseChoice(nsCSSValue aValues[], } void -CSSParserImpl::AppendValue(nsCSSProperty aPropID, const nsCSSValue& aValue) +CSSParserImpl::AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue) { mTempData.AddLonghandProperty(aPropID, aValue); } @@ -10981,7 +10981,7 @@ CSSParserImpl::AppendValue(nsCSSProperty aPropID, const nsCSSValue& aValue) * existing values. */ bool -CSSParserImpl::ParseBoxProperties(const nsCSSProperty aPropIDs[]) +CSSParserImpl::ParseBoxProperties(const nsCSSPropertyID aPropIDs[]) { // Get up to four values for the property int32_t count = 0; @@ -11073,7 +11073,7 @@ CSSParserImpl::ParseGroupedBoxProperty(int32_t aVariantMask, } bool -CSSParserImpl::ParseBoxCornerRadius(nsCSSProperty aPropID) +CSSParserImpl::ParseBoxCornerRadius(nsCSSPropertyID aPropID) { nsCSSValue dimenX, dimenY; // required first value @@ -11197,7 +11197,7 @@ CSSParserImpl::ParseBoxCornerRadiiInternals(nsCSSValue array[]) } bool -CSSParserImpl::ParseBoxCornerRadii(const nsCSSProperty aPropIDs[]) +CSSParserImpl::ParseBoxCornerRadii(const nsCSSPropertyID aPropIDs[]) { nsCSSValue value[4]; if (!ParseBoxCornerRadiiInternals(value)) { @@ -11211,31 +11211,31 @@ CSSParserImpl::ParseBoxCornerRadii(const nsCSSProperty aPropIDs[]) } // These must be in CSS order (top,right,bottom,left) for indexing to work -static const nsCSSProperty kBorderStyleIDs[] = { +static const nsCSSPropertyID kBorderStyleIDs[] = { eCSSProperty_border_top_style, eCSSProperty_border_right_style, eCSSProperty_border_bottom_style, eCSSProperty_border_left_style }; -static const nsCSSProperty kBorderWidthIDs[] = { +static const nsCSSPropertyID kBorderWidthIDs[] = { eCSSProperty_border_top_width, eCSSProperty_border_right_width, eCSSProperty_border_bottom_width, eCSSProperty_border_left_width }; -static const nsCSSProperty kBorderColorIDs[] = { +static const nsCSSPropertyID kBorderColorIDs[] = { eCSSProperty_border_top_color, eCSSProperty_border_right_color, eCSSProperty_border_bottom_color, eCSSProperty_border_left_color }; -static const nsCSSProperty kBorderRadiusIDs[] = { +static const nsCSSPropertyID kBorderRadiusIDs[] = { eCSSProperty_border_top_left_radius, eCSSProperty_border_top_right_radius, eCSSProperty_border_bottom_right_radius, eCSSProperty_border_bottom_left_radius }; -static const nsCSSProperty kOutlineRadiusIDs[] = { +static const nsCSSPropertyID kOutlineRadiusIDs[] = { eCSSProperty__moz_outline_radius_topLeft, eCSSProperty__moz_outline_radius_topRight, eCSSProperty__moz_outline_radius_bottomRight, @@ -11259,7 +11259,7 @@ CSSParserImpl::RestoreSavedInputState(const CSSParserInputState& aState) } bool -CSSParserImpl::ParseProperty(nsCSSProperty aPropID) +CSSParserImpl::ParseProperty(nsCSSPropertyID aPropID) { // Can't use AutoRestore because it's a bitfield. MOZ_ASSERT(!mHashlessColorQuirk, @@ -11473,7 +11473,7 @@ CSSParserImpl::ParseProperty(nsCSSProperty aPropID) } bool -CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID) +CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID) { switch (aPropID) { // handle shorthand or multiple properties case eCSSProperty_background: @@ -11698,7 +11698,7 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID) CSSParseResult CSSParserImpl::ParseBoxProperty(nsCSSValue& aValue, - nsCSSProperty aPropID) + nsCSSPropertyID aPropID) { if (aPropID < 0 || aPropID >= eCSSProperty_COUNT_no_shorthands) { MOZ_ASSERT(false, "must only be called for longhand properties"); @@ -11729,7 +11729,7 @@ CSSParserImpl::ParseBoxProperty(nsCSSValue& aValue, bool CSSParserImpl::ParseSingleValuePropertyByFunction(nsCSSValue& aValue, - nsCSSProperty aPropID) + nsCSSPropertyID aPropID) { switch (aPropID) { case eCSSProperty_font_family: @@ -11788,7 +11788,7 @@ CSSParserImpl::ParseSingleValuePropertyByFunction(nsCSSValue& aValue, CSSParseResult CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, - nsCSSProperty aPropID) + nsCSSPropertyID aPropID) { if (aPropID == eCSSPropertyExtra_x_none_value) { return ParseVariant(aValue, VARIANT_NONE | VARIANT_INHERIT, nullptr); @@ -11936,7 +11936,7 @@ BoxPositionMaskToCSSValue(int32_t aMask, bool isX) } bool -CSSParserImpl::ParseImageLayers(const nsCSSProperty aTable[]) +CSSParserImpl::ParseImageLayers(const nsCSSPropertyID aTable[]) { nsAutoParseCompoundProperty compound(this); @@ -11946,7 +11946,7 @@ CSSParserImpl::ParseImageLayers(const nsCSSProperty aTable[]) // Check first for inherit/initial/unset. if (ParseSingleTokenVariant(color, VARIANT_INHERIT, nullptr)) { // must be alone - for (const nsCSSProperty* subprops = + for (const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aTable[nsStyleImageLayers::shorthand]); *subprops != eCSSProperty_UNKNOWN; ++subprops) { AppendValue(*subprops, color); @@ -12071,7 +12071,7 @@ CSSParserImpl::IsFunctionTokenValidForImageLayerImage( bool CSSParserImpl::ParseImageLayersItem( CSSParserImpl::ImageLayersShorthandParseState& aState, - const nsCSSProperty aTable[]) + const nsCSSPropertyID aTable[]) { // Fill in the values that the shorthand will set if we don't find // other values. @@ -12330,7 +12330,7 @@ CSSParserImpl::ParseImageLayersItem( // This function is very similar to ParseScrollSnapCoordinate, // ParseImageLayerPosition, and ParseImageLayersSize. bool -CSSParserImpl::ParseValueList(nsCSSProperty aPropID) +CSSParserImpl::ParseValueList(nsCSSPropertyID aPropID) { // aPropID is a single value prop-id nsCSSValue value; @@ -12354,7 +12354,7 @@ CSSParserImpl::ParseValueList(nsCSSProperty aPropID) } bool -CSSParserImpl::ParseImageLayerRepeat(nsCSSProperty aPropID) +CSSParserImpl::ParseImageLayerRepeat(nsCSSPropertyID aPropID) { nsCSSValue value; // 'initial', 'inherit' and 'unset' stand alone, no list permitted. @@ -12405,7 +12405,7 @@ CSSParserImpl::ParseImageLayerRepeatValues(nsCSSValuePair& aValue) } bool -CSSParserImpl::ParseImageLayerPosition(const nsCSSProperty aTable[]) +CSSParserImpl::ParseImageLayerPosition(const nsCSSPropertyID aTable[]) { // 'initial', 'inherit' and 'unset' stand alone, no list permitted. nsCSSValue position; @@ -12445,7 +12445,7 @@ CSSParserImpl::ParseImageLayerPosition(const nsCSSProperty aTable[]) } bool -CSSParserImpl::ParseImageLayerPositionCoord(nsCSSProperty aPropID, bool aIsHorizontal) +CSSParserImpl::ParseImageLayerPositionCoord(nsCSSPropertyID aPropID, bool aIsHorizontal) { nsCSSValue value; // 'initial', 'inherit' and 'unset' stand alone, no list permitted. @@ -12914,7 +12914,7 @@ CSSParserImpl::ParseImageLayerPositionCoordItem(nsCSSValue& aOut, bool aIsHorizo // This function is very similar to ParseScrollSnapCoordinate, // ParseImageLayers, and ParseImageLayerPosition. bool -CSSParserImpl::ParseImageLayerSize(nsCSSProperty aPropID) +CSSParserImpl::ParseImageLayerSize(nsCSSPropertyID aPropID) { nsCSSValue value; // 'initial', 'inherit' and 'unset' stand alone, no list permitted. @@ -13288,7 +13288,7 @@ CSSParserImpl::ParseBorderSpacing() } bool -CSSParserImpl::ParseBorderSide(const nsCSSProperty aPropIDs[], +CSSParserImpl::ParseBorderSide(const nsCSSPropertyID aPropIDs[], bool aSetAllSides) { const int32_t numProps = 3; @@ -13318,7 +13318,7 @@ CSSParserImpl::ParseBorderSide(const nsCSSProperty aPropIDs[], AppendValue(kBorderColorIDs[index], values[2]); } - static const nsCSSProperty kBorderColorsProps[] = { + static const nsCSSPropertyID kBorderColorsProps[] = { eCSSProperty_border_top_colors, eCSSProperty_border_right_colors, eCSSProperty_border_bottom_colors, @@ -13371,7 +13371,7 @@ CSSParserImpl::ParseBorderWidth() } bool -CSSParserImpl::ParseBorderColors(nsCSSProperty aProperty) +CSSParserImpl::ParseBorderColors(nsCSSPropertyID aProperty) { nsCSSValue value; // 'inherit', 'initial', 'unset' and 'none' are only allowed on their own @@ -13659,7 +13659,7 @@ CSSParserImpl::RequireWhitespace() } bool -CSSParserImpl::ParseRect(nsCSSProperty aPropID) +CSSParserImpl::ParseRect(nsCSSPropertyID aPropID) { nsCSSValue val; if (ParseSingleTokenVariant(val, VARIANT_INHERIT | VARIANT_AUTO, nullptr)) { @@ -13710,7 +13710,7 @@ CSSParserImpl::ParseColumns() // If the fake "auto" value is found, and one of the real values isn't, // that means the fake auto value is meant for the real value we didn't // find. - static const nsCSSProperty columnIDs[] = { + static const nsCSSPropertyID columnIDs[] = { eCSSPropertyExtra_x_auto_value, eCSSProperty__moz_column_count, eCSSProperty__moz_column_width @@ -13798,7 +13798,7 @@ CSSParserImpl::ParseContent() } bool -CSSParserImpl::ParseCounterData(nsCSSProperty aPropID) +CSSParserImpl::ParseCounterData(nsCSSPropertyID aPropID) { static const nsCSSKeyword kCounterDataKTable[] = { eCSSKeyword_none, @@ -13946,7 +13946,7 @@ CSSParserImpl::ParseFont() // The order of the initializers here must match the order of the indexes // defined above! - static const nsCSSProperty fontIDs[] = { + static const nsCSSPropertyID fontIDs[] = { eCSSProperty_font_style, eCSSProperty_font_variant_caps, eCSSProperty_font_weight, @@ -14995,7 +14995,7 @@ CSSParserImpl::ParseListStyle() // allocated to a dummy property instead. Since parse function for // 'list-style-type' could accept values for 'list-style-position', // we put position in front of type. - static const nsCSSProperty listStyleIDs[] = { + static const nsCSSPropertyID listStyleIDs[] = { eCSSPropertyExtra_x_none_value, eCSSProperty_list_style_position, eCSSProperty_list_style_type, @@ -15061,7 +15061,7 @@ CSSParserImpl::ParseListStyleType(nsCSSValue& aValue) bool CSSParserImpl::ParseMargin() { - static const nsCSSProperty kMarginSideIDs[] = { + static const nsCSSPropertyID kMarginSideIDs[] = { eCSSProperty_margin_top, eCSSProperty_margin_right, eCSSProperty_margin_bottom, @@ -15087,7 +15087,7 @@ bool CSSParserImpl::ParseOutline() { const int32_t numProps = 3; - static const nsCSSProperty kOutlineIDs[] = { + static const nsCSSPropertyID kOutlineIDs[] = { eCSSProperty_outline_color, eCSSProperty_outline_style, eCSSProperty_outline_width @@ -15147,7 +15147,7 @@ CSSParserImpl::ParseOverflow() bool CSSParserImpl::ParsePadding() { - static const nsCSSProperty kPaddingSideIDs[] = { + static const nsCSSPropertyID kPaddingSideIDs[] = { eCSSProperty_padding_top, eCSSProperty_padding_right, eCSSProperty_padding_bottom, @@ -15188,7 +15188,7 @@ CSSParserImpl::ParseQuotes() bool CSSParserImpl::ParseTextDecoration() { - static const nsCSSProperty kTextDecorationIDs[] = { + static const nsCSSPropertyID kTextDecorationIDs[] = { eCSSProperty_text_decoration_line, eCSSProperty_text_decoration_style, eCSSProperty_text_decoration_color @@ -15224,7 +15224,7 @@ CSSParserImpl::ParseTextDecoration() bool CSSParserImpl::ParseTextEmphasis() { - static constexpr nsCSSProperty kTextEmphasisIDs[] = { + static constexpr nsCSSPropertyID kTextEmphasisIDs[] = { eCSSProperty_text_emphasis_style, eCSSProperty_text_emphasis_color }; @@ -16260,7 +16260,7 @@ bool CSSParserImpl::ParseTransformOrigin(bool aPerspective) if (!ParseBoxPositionValues(position, true)) return false; - nsCSSProperty prop = eCSSProperty_transform_origin; + nsCSSPropertyID prop = eCSSProperty_transform_origin; if (aPerspective) { prop = eCSSProperty_perspective_origin; } @@ -16635,7 +16635,7 @@ AppendValueToList(nsCSSValue& aContainer, CSSParserImpl::ParseAnimationOrTransitionShorthandResult CSSParserImpl::ParseAnimationOrTransitionShorthand( - const nsCSSProperty* aProperties, + const nsCSSPropertyID* aProperties, const nsCSSValue* aInitialValues, nsCSSValue* aValues, size_t aNumProperties) @@ -16731,7 +16731,7 @@ CSSParserImpl::ParseAnimationOrTransitionShorthand( bool CSSParserImpl::ParseTransition() { - static const nsCSSProperty kTransitionProperties[] = { + static const nsCSSPropertyID kTransitionProperties[] = { eCSSProperty_transition_duration, eCSSProperty_transition_timing_function, // Must check 'transition-delay' after 'transition-duration', since @@ -16808,7 +16808,7 @@ CSSParserImpl::ParseTransition() bool CSSParserImpl::ParseAnimation() { - static const nsCSSProperty kAnimationProperties[] = { + static const nsCSSPropertyID kAnimationProperties[] = { eCSSProperty_animation_duration, eCSSProperty_animation_timing_function, // Must check 'animation-delay' after 'animation-duration', since @@ -16954,7 +16954,7 @@ CSSParserImpl::ParseShadowItem(nsCSSValue& aValue, bool aIsBoxShadow) } bool -CSSParserImpl::ParseShadowList(nsCSSProperty aProperty) +CSSParserImpl::ParseShadowList(nsCSSPropertyID aProperty) { nsAutoParseCompoundProperty compound(this); bool isBoxShadow = aProperty == eCSSProperty_box_shadow; @@ -17010,7 +17010,7 @@ CSSParserImpl::SetDefaultNamespaceOnSelector(nsCSSSelector& aSelector) } bool -CSSParserImpl::ParsePaint(nsCSSProperty aPropID) +CSSParserImpl::ParsePaint(nsCSSPropertyID aPropID) { nsCSSValue x, y; @@ -17273,7 +17273,7 @@ CSSParserImpl::ParseScrollSnapType() } bool -CSSParserImpl::ParseScrollSnapPoints(nsCSSValue& aValue, nsCSSProperty aPropID) +CSSParserImpl::ParseScrollSnapPoints(nsCSSValue& aValue, nsCSSPropertyID aPropID) { if (ParseSingleTokenVariant(aValue, VARIANT_INHERIT | VARIANT_NONE, nullptr)) { @@ -17577,7 +17577,7 @@ CSSParserImpl::ParseValueWithVariables(CSSVariableDeclarations::Type* aType, } bool -CSSParserImpl::IsValueValidForProperty(const nsCSSProperty aPropID, +CSSParserImpl::IsValueValidForProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue) { mData.AssertInitialState(); @@ -17747,7 +17747,7 @@ nsCSSParser::ParseRule(const nsAString& aRule, } void -nsCSSParser::ParseProperty(const nsCSSProperty aPropID, +nsCSSParser::ParseProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURI, nsIURI* aBaseURI, @@ -17764,7 +17764,7 @@ nsCSSParser::ParseProperty(const nsCSSProperty aPropID, } void -nsCSSParser::ParseLonghandProperty(const nsCSSProperty aPropID, +nsCSSParser::ParseLonghandProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURI, nsIURI* aBaseURI, @@ -17920,8 +17920,8 @@ nsCSSParser::ResolveVariableValue(const nsAString& aPropertyValue, void nsCSSParser::ParsePropertyWithVariableReferences( - nsCSSProperty aPropertyID, - nsCSSProperty aShorthandPropertyID, + nsCSSPropertyID aPropertyID, + nsCSSPropertyID aShorthandPropertyID, const nsAString& aValue, const CSSVariableValues* aVariables, nsRuleData* aRuleData, @@ -17975,7 +17975,7 @@ nsCSSParser::ParseFontFaceDescriptor(nsCSSFontDesc aDescID, } bool -nsCSSParser::IsValueValidForProperty(const nsCSSProperty aPropID, +nsCSSParser::IsValueValidForProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue) { return static_cast(mImpl)-> diff --git a/layout/style/nsCSSParser.h b/layout/style/nsCSSParser.h index 9ee9b5bd67d8..af8842a42331 100644 --- a/layout/style/nsCSSParser.h +++ b/layout/style/nsCSSParser.h @@ -11,7 +11,7 @@ #include "mozilla/Attributes.h" #include "mozilla/css/Loader.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSScanner.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" @@ -113,7 +113,7 @@ public: // particular, units may be omitted from . The 'aIsSVGMode' // argument controls this quirk. Note that this *only* applies to // mapped attributes, not inline styles or full style sheets in SVG. - void ParseProperty(const nsCSSProperty aPropID, + void ParseProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURL, nsIURI* aBaseURL, @@ -126,7 +126,7 @@ public: // Same as ParseProperty but returns an nsCSSValue in aResult // rather than storing the property in a Declaration. aPropID // must be a longhand property. - void ParseLonghandProperty(const nsCSSProperty aPropID, + void ParseLonghandProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue, nsIURI* aSheetURL, nsIURI* aBaseURL, @@ -285,8 +285,8 @@ public: * respectively. */ void ParsePropertyWithVariableReferences( - nsCSSProperty aPropertyID, - nsCSSProperty aShorthandPropertyID, + nsCSSPropertyID aPropertyID, + nsCSSPropertyID aShorthandPropertyID, const nsAString& aValue, const mozilla::CSSVariableValues* aVariables, nsRuleData* aRuleData, @@ -316,7 +316,7 @@ public: nsCSSValue& aValue); // Check whether a given value can be applied to a property. - bool IsValueValidForProperty(const nsCSSProperty aPropID, + bool IsValueValidForProperty(const nsCSSPropertyID aPropID, const nsAString& aPropValue); // Return the default value to be used for -moz-control-character-visibility, diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 5f80a6123c0b..b1bab29f16a9 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -27,7 +27,7 @@ on a standards track, any '-moz-' prefix is removed in 'id'. This lets us do nice things with the macros without having to copy/convert strings at runtime. These are the names used for the enum values of - the nsCSSProperty enumeration defined in nsCSSProps.h. + the nsCSSPropertyID enumeration defined in nsCSSProps.h. -. 'method' is designed to be as input for CSS2Properties and similar callers. It must always be the same as 'name' except it must use diff --git a/layout/style/nsCSSProperty.h b/layout/style/nsCSSPropertyID.h similarity index 95% rename from layout/style/nsCSSProperty.h rename to layout/style/nsCSSPropertyID.h index 0e0536da785e..cbebdfe17d17 100644 --- a/layout/style/nsCSSProperty.h +++ b/layout/style/nsCSSPropertyID.h @@ -5,8 +5,8 @@ /* enum types for CSS properties and their values */ -#ifndef nsCSSProperty_h___ -#define nsCSSProperty_h___ +#ifndef nsCSSPropertyID_h___ +#define nsCSSPropertyID_h___ #include @@ -17,7 +17,7 @@ To change the list of properties, see nsCSSPropList.h */ -enum nsCSSProperty { +enum nsCSSPropertyID { eCSSProperty_UNKNOWN = -1, #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \ @@ -70,7 +70,7 @@ namespace mozilla { template<> inline PLDHashNumber -Hash(const nsCSSProperty& aValue) +Hash(const nsCSSPropertyID& aValue) { return uint32_t(aValue); } @@ -112,4 +112,4 @@ enum nsCSSPropertyLogicalGroup { eCSSPropertyLogicalGroup_COUNT }; -#endif /* nsCSSProperty_h___ */ +#endif /* nsCSSPropertyID_h___ */ diff --git a/layout/style/nsCSSPropertySet.h b/layout/style/nsCSSPropertySet.h index 06ce4e2c5c90..b643657d83c9 100644 --- a/layout/style/nsCSSPropertySet.h +++ b/layout/style/nsCSSPropertySet.h @@ -10,7 +10,7 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/PodOperations.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include // for CHAR_BIT /** @@ -23,7 +23,7 @@ public: nsCSSPropertySet() { Empty(); } // auto-generated copy-constructor OK - void AssertInSetRange(nsCSSProperty aProperty) const { + void AssertInSetRange(nsCSSPropertyID aProperty) const { NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "out of bounds"); @@ -32,21 +32,21 @@ public: // Conversion of aProperty to |size_t| after AssertInSetRange // lets the compiler generate significantly tighter code. - void AddProperty(nsCSSProperty aProperty) { + void AddProperty(nsCSSPropertyID aProperty) { AssertInSetRange(aProperty); size_t p = aProperty; mProperties[p / kBitsInChunk] |= property_set_type(1) << (p % kBitsInChunk); } - void RemoveProperty(nsCSSProperty aProperty) { + void RemoveProperty(nsCSSPropertyID aProperty) { AssertInSetRange(aProperty); size_t p = aProperty; mProperties[p / kBitsInChunk] &= ~(property_set_type(1) << (p % kBitsInChunk)); } - bool HasProperty(nsCSSProperty aProperty) const { + bool HasProperty(nsCSSPropertyID aProperty) const { AssertInSetRange(aProperty); size_t p = aProperty; return (mProperties[p / kBitsInChunk] & @@ -87,8 +87,8 @@ public: bool HasPropertyAt(size_t aChunk, size_t aBit) const { return (mProperties[aChunk] & (property_set_type(1) << aBit)) != 0; } - static nsCSSProperty CSSPropertyAt(size_t aChunk, size_t aBit) { - return nsCSSProperty(aChunk * kBitsInChunk + aBit); + static nsCSSPropertyID CSSPropertyAt(size_t aChunk, size_t aBit) { + return nsCSSPropertyID(aChunk * kBitsInChunk + aBit); } private: diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index aaa5af6c78b3..a3677dab935d 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -81,11 +81,11 @@ static nsStaticCaseInsensitiveNameTable* gPropertyTable; static nsStaticCaseInsensitiveNameTable* gFontDescTable; static nsStaticCaseInsensitiveNameTable* gCounterDescTable; static nsStaticCaseInsensitiveNameTable* gPredefinedCounterStyleTable; -static nsDataHashtable* gPropertyIDLNameTable; +static nsDataHashtable* gPropertyIDLNameTable; -/* static */ nsCSSProperty * +/* static */ nsCSSPropertyID * nsCSSProps::gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands]; -/* static */ nsCSSProperty* nsCSSProps::gShorthandsContainingPool = nullptr; +/* static */ nsCSSPropertyID* nsCSSProps::gShorthandsContainingPool = nullptr; static const char* const kCSSRawFontDescs[] = { #define CSS_FONT_DESC(name_, method_) #name_, @@ -128,7 +128,7 @@ static const char* const kCSSRawPredefinedCounterStyles[] = { }; struct PropertyAndCount { - nsCSSProperty property; + nsCSSPropertyID property; uint32_t count; }; @@ -151,7 +151,7 @@ enum { }; // The names are in kCSSRawProperties. -static nsCSSProperty gAliases[eCSSAliasCount != 0 ? eCSSAliasCount : 1] = { +static nsCSSPropertyID gAliases[eCSSAliasCount != 0 ? eCSSAliasCount : 1] = { #define CSS_PROP_ALIAS(aliasname_, propid_, aliasmethod_, pref_) \ eCSSProperty_##propid_ , #include "nsCSSPropAliasList.h" @@ -192,10 +192,10 @@ nsCSSProps::AddRefTable(void) kCSSRawPredefinedCounterStyles, ArrayLength(kCSSRawPredefinedCounterStyles)); - gPropertyIDLNameTable = new nsDataHashtable; - for (nsCSSProperty p = nsCSSProperty(0); + gPropertyIDLNameTable = new nsDataHashtable; + for (nsCSSPropertyID p = nsCSSPropertyID(0); size_t(p) < ArrayLength(kIDLNameTable); - p = nsCSSProperty(p + 1)) { + p = nsCSSPropertyID(p + 1)) { if (kIDLNameTable[p]) { gPropertyIDLNameTable->Put(nsDependentCString(kIDLNameTable[p]), p); } @@ -243,15 +243,15 @@ nsCSSProps::AddRefTable(void) CSS_PROPERTY_ENABLED_IN_UA_SHEETS, CSS_PROPERTY_ENABLED_IN_CHROME }; - for (nsCSSProperty shorthand = eCSSProperty_COUNT_no_shorthands; + for (nsCSSPropertyID shorthand = eCSSProperty_COUNT_no_shorthands; shorthand < eCSSProperty_COUNT; - shorthand = nsCSSProperty(shorthand + 1)) { + shorthand = nsCSSPropertyID(shorthand + 1)) { for (size_t i = 0; i < ArrayLength(flagsToCheck); i++) { uint32_t flag = flagsToCheck[i]; if (!nsCSSProps::PropHasFlags(shorthand, flag)) { continue; } - for (const nsCSSProperty* p = + for (const nsCSSPropertyID* p = nsCSSProps::SubpropertyEntryFor(shorthand); *p != eCSSProperty_UNKNOWN; ++p) { @@ -266,7 +266,7 @@ nsCSSProps::AddRefTable(void) // Assert that CSS_PROPERTY_INTERNAL is used on properties in // #ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL sections of nsCSSPropList.h // and on no others. - static nsCSSProperty nonInternalProperties[] = { + static nsCSSPropertyID nonInternalProperties[] = { #define CSS_PROP(name_, id_, ...) eCSSProperty_##id_, #define CSS_PROP_SHORTHAND(name_, id_, ...) eCSSProperty_##id_, #define CSS_PROP_LIST_INCLUDE_LOGICAL @@ -281,7 +281,7 @@ nsCSSProps::AddRefTable(void) bool found[eCSSProperty_COUNT]; PodArrayZero(found); - for (nsCSSProperty p : nonInternalProperties) { + for (nsCSSPropertyID p : nonInternalProperties) { MOZ_ASSERT(!nsCSSProps::PropHasFlags(p, CSS_PROPERTY_INTERNAL), "properties defined outside of #ifndef " "CSS_PROP_LIST_EXCLUDE_INTERNAL sections must not have " @@ -291,7 +291,7 @@ nsCSSProps::AddRefTable(void) for (size_t i = 0; i < ArrayLength(found); ++i) { if (!found[i]) { - auto p = static_cast(i); + auto p = static_cast(i); MOZ_ASSERT(nsCSSProps::PropHasFlags(p, CSS_PROPERTY_INTERNAL), "properties defined in #ifndef " "CSS_PROP_LIST_EXCLUDE_INTERNAL sections must have " @@ -312,9 +312,9 @@ nsCSSProps::BuildShorthandsContainingTable() memset(occurrenceCounts, 0, sizeof(occurrenceCounts)); PropertyAndCount subpropCounts[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands]; - for (nsCSSProperty shorthand = eCSSProperty_COUNT_no_shorthands; + for (nsCSSPropertyID shorthand = eCSSProperty_COUNT_no_shorthands; shorthand < eCSSProperty_COUNT; - shorthand = nsCSSProperty(shorthand + 1)) { + shorthand = nsCSSPropertyID(shorthand + 1)) { #ifdef DEBUG_SHORTHANDS_CONTAINING printf("Considering shorthand property '%s'.\n", nsCSSProps::GetStringValue(shorthand).get()); @@ -328,7 +328,7 @@ nsCSSProps::BuildShorthandsContainingTable() // shorthands-containing lists. continue; } - for (const nsCSSProperty* subprops = SubpropertyEntryFor(shorthand); + for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(shorthand); *subprops != eCSSProperty_UNKNOWN; ++subprops) { MOZ_ASSERT(0 <= *subprops && *subprops < eCSSProperty_COUNT_no_shorthands, @@ -339,27 +339,27 @@ nsCSSProps::BuildShorthandsContainingTable() } uint32_t poolEntries = 0; - for (nsCSSProperty longhand = nsCSSProperty(0); + for (nsCSSPropertyID longhand = nsCSSPropertyID(0); longhand < eCSSProperty_COUNT_no_shorthands; - longhand = nsCSSProperty(longhand + 1)) { + longhand = nsCSSPropertyID(longhand + 1)) { uint32_t count = occurrenceCounts[longhand]; if (count > 0) // leave room for terminator poolEntries += count + 1; } - gShorthandsContainingPool = new nsCSSProperty[poolEntries]; + gShorthandsContainingPool = new nsCSSPropertyID[poolEntries]; if (!gShorthandsContainingPool) return false; // Initialize all entries to point to their null-terminator. { - nsCSSProperty *poolCursor = gShorthandsContainingPool - 1; - nsCSSProperty *lastTerminator = + nsCSSPropertyID *poolCursor = gShorthandsContainingPool - 1; + nsCSSPropertyID *lastTerminator = gShorthandsContainingPool + poolEntries - 1; - for (nsCSSProperty longhand = nsCSSProperty(0); + for (nsCSSPropertyID longhand = nsCSSPropertyID(0); longhand < eCSSProperty_COUNT_no_shorthands; - longhand = nsCSSProperty(longhand + 1)) { + longhand = nsCSSPropertyID(longhand + 1)) { uint32_t count = occurrenceCounts[longhand]; if (count > 0) { poolCursor += count + 1; @@ -393,7 +393,7 @@ nsCSSProps::BuildShorthandsContainingTable() // shorthands-containing lists. continue; } - for (const nsCSSProperty* subprops = + for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(shorthandAndCount->property); *subprops != eCSSProperty_UNKNOWN; ++subprops) { @@ -402,13 +402,13 @@ nsCSSProps::BuildShorthandsContainingTable() } #ifdef DEBUG_SHORTHANDS_CONTAINING - for (nsCSSProperty longhand = nsCSSProperty(0); + for (nsCSSPropertyID longhand = nsCSSPropertyID(0); longhand < eCSSProperty_COUNT_no_shorthands; - longhand = nsCSSProperty(longhand + 1)) { + longhand = nsCSSPropertyID(longhand + 1)) { printf("Property %s is in %d shorthands.\n", nsCSSProps::GetStringValue(longhand).get(), occurrenceCounts[longhand]); - for (const nsCSSProperty *shorthands = ShorthandsContaining(longhand); + for (const nsCSSPropertyID *shorthands = ShorthandsContaining(longhand); *shorthands != eCSSProperty_UNKNOWN; ++shorthands) { printf(" %s\n", nsCSSProps::GetStringValue(*shorthands).get()); @@ -418,19 +418,19 @@ nsCSSProps::BuildShorthandsContainingTable() #ifdef DEBUG // Verify that all values that should be are present. - for (nsCSSProperty shorthand = eCSSProperty_COUNT_no_shorthands; + for (nsCSSPropertyID shorthand = eCSSProperty_COUNT_no_shorthands; shorthand < eCSSProperty_COUNT; - shorthand = nsCSSProperty(shorthand + 1)) { + shorthand = nsCSSPropertyID(shorthand + 1)) { if (nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS)) { // Don't put shorthands that are acting as aliases in the // shorthands-containing lists. continue; } - for (const nsCSSProperty* subprops = SubpropertyEntryFor(shorthand); + for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(shorthand); *subprops != eCSSProperty_UNKNOWN; ++subprops) { uint32_t count = 0; - for (const nsCSSProperty *shcont = ShorthandsContaining(*subprops); + for (const nsCSSPropertyID *shcont = ShorthandsContaining(*subprops); *shcont != eCSSProperty_UNKNOWN; ++shcont) { if (*shcont == shorthand) @@ -443,14 +443,14 @@ nsCSSProps::BuildShorthandsContainingTable() } // Verify that there are no extra values - for (nsCSSProperty longhand = nsCSSProperty(0); + for (nsCSSPropertyID longhand = nsCSSPropertyID(0); longhand < eCSSProperty_COUNT_no_shorthands; - longhand = nsCSSProperty(longhand + 1)) { - for (const nsCSSProperty *shorthands = ShorthandsContaining(longhand); + longhand = nsCSSPropertyID(longhand + 1)) { + for (const nsCSSPropertyID *shorthands = ShorthandsContaining(longhand); *shorthands != eCSSProperty_UNKNOWN; ++shorthands) { uint32_t count = 0; - for (const nsCSSProperty* subprops = SubpropertyEntryFor(*shorthands); + for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(*shorthands); *subprops != eCSSProperty_UNKNOWN; ++subprops) { if (*subprops == longhand) @@ -491,7 +491,7 @@ nsCSSProps::ReleaseTable(void) } /* static */ bool -nsCSSProps::IsInherited(nsCSSProperty aProperty) +nsCSSProps::IsInherited(nsCSSPropertyID aProperty) { MOZ_ASSERT(!IsShorthand(aProperty)); @@ -514,7 +514,7 @@ nsCSSProps::IsCustomPropertyName(const nsAString& aProperty) StringBeginsWith(aProperty, NS_LITERAL_STRING("--")); } -nsCSSProperty +nsCSSPropertyID nsCSSProps::LookupProperty(const nsACString& aProperty, EnabledState aEnabled) { @@ -525,7 +525,7 @@ nsCSSProps::LookupProperty(const nsACString& aProperty, return eCSSPropertyExtra_variable; } - nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty)); + nsCSSPropertyID res = nsCSSPropertyID(gPropertyTable->Lookup(aProperty)); if (MOZ_LIKELY(res < eCSSProperty_COUNT)) { if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) { res = eCSSProperty_UNKNOWN; @@ -548,7 +548,7 @@ nsCSSProps::LookupProperty(const nsACString& aProperty, return eCSSProperty_UNKNOWN; } -nsCSSProperty +nsCSSPropertyID nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled) { if (nsLayoutUtils::CSSVariablesEnabled() && @@ -560,7 +560,7 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled) // LookupProperty(nsACString&). The table will do its own // converting and avoid a PromiseFlatCString() call. MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref"); - nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty)); + nsCSSPropertyID res = nsCSSPropertyID(gPropertyTable->Lookup(aProperty)); if (MOZ_LIKELY(res < eCSSProperty_COUNT)) { if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) { res = eCSSProperty_UNKNOWN; @@ -583,11 +583,11 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled) return eCSSProperty_UNKNOWN; } -nsCSSProperty +nsCSSPropertyID nsCSSProps::LookupPropertyByIDLName(const nsACString& aPropertyIDLName, EnabledState aEnabled) { - nsCSSProperty res; + nsCSSPropertyID res; if (!gPropertyIDLNameTable->Get(aPropertyIDLName, &res)) { return eCSSProperty_UNKNOWN; } @@ -598,7 +598,7 @@ nsCSSProps::LookupPropertyByIDLName(const nsACString& aPropertyIDLName, return res; } -nsCSSProperty +nsCSSPropertyID nsCSSProps::LookupPropertyByIDLName(const nsAString& aPropertyIDLName, EnabledState aEnabled) { @@ -678,7 +678,7 @@ nsCSSProps::IsPredefinedCounterStyle(const nsACString& aStyle) } const nsAFlatCString& -nsCSSProps::GetStringValue(nsCSSProperty aProperty) +nsCSSProps::GetStringValue(nsCSSPropertyID aProperty) { MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref"); if (gPropertyTable) { @@ -2504,7 +2504,7 @@ nsCSSProps::kKeywordTableTable[eCSSProperty_COUNT_no_shorthands] = { }; const nsAFlatCString& -nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, int32_t aValue) +nsCSSProps::LookupPropertyValue(nsCSSPropertyID aProp, int32_t aValue) { MOZ_ASSERT(aProp >= 0 && aProp < eCSSProperty_COUNT, "property out of range"); @@ -2588,7 +2588,7 @@ const uint32_t nsCSSProps::kFlagsTable[eCSSProperty_COUNT] = { #undef CSS_PROP_SHORTHAND }; -static const nsCSSProperty gAllSubpropTable[] = { +static const nsCSSPropertyID gAllSubpropTable[] = { #define CSS_PROP_LIST_ONLY_COMPONENTS_OF_ALL_SHORTHAND #define CSS_PROP_LIST_INCLUDE_LOGICAL #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \ @@ -2601,7 +2601,7 @@ static const nsCSSProperty gAllSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gAnimationSubpropTable[] = { +static const nsCSSPropertyID gAnimationSubpropTable[] = { eCSSProperty_animation_duration, eCSSProperty_animation_timing_function, eCSSProperty_animation_delay, @@ -2616,7 +2616,7 @@ static const nsCSSProperty gAnimationSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderRadiusSubpropTable[] = { +static const nsCSSPropertyID gBorderRadiusSubpropTable[] = { // Code relies on these being in topleft-topright-bottomright-bottomleft // order. eCSSProperty_border_top_left_radius, @@ -2626,7 +2626,7 @@ static const nsCSSProperty gBorderRadiusSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gOutlineRadiusSubpropTable[] = { +static const nsCSSPropertyID gOutlineRadiusSubpropTable[] = { // Code relies on these being in topleft-topright-bottomright-bottomleft // order. eCSSProperty__moz_outline_radius_topLeft, @@ -2636,7 +2636,7 @@ static const nsCSSProperty gOutlineRadiusSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBackgroundSubpropTable[] = { +static const nsCSSPropertyID gBackgroundSubpropTable[] = { eCSSProperty_background_color, eCSSProperty_background_image, eCSSProperty_background_repeat, @@ -2649,13 +2649,13 @@ static const nsCSSProperty gBackgroundSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBackgroundPositionSubpropTable[] = { +static const nsCSSPropertyID gBackgroundPositionSubpropTable[] = { eCSSProperty_background_position_x, eCSSProperty_background_position_y, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderSubpropTable[] = { +static const nsCSSPropertyID gBorderSubpropTable[] = { eCSSProperty_border_top_width, eCSSProperty_border_right_width, eCSSProperty_border_bottom_width, @@ -2680,7 +2680,7 @@ static const nsCSSProperty gBorderSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderBlockEndSubpropTable[] = { +static const nsCSSPropertyID gBorderBlockEndSubpropTable[] = { // Declaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_block_end_width, @@ -2689,7 +2689,7 @@ static const nsCSSProperty gBorderBlockEndSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderBlockStartSubpropTable[] = { +static const nsCSSPropertyID gBorderBlockStartSubpropTable[] = { // Declaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_block_start_width, @@ -2698,7 +2698,7 @@ static const nsCSSProperty gBorderBlockStartSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderBottomSubpropTable[] = { +static const nsCSSPropertyID gBorderBottomSubpropTable[] = { // Declaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_bottom_width, @@ -2710,7 +2710,7 @@ static const nsCSSProperty gBorderBottomSubpropTable[] = { static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 && NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3, "box side constants not top/right/bottom/left == 0/1/2/3"); -static const nsCSSProperty gBorderColorSubpropTable[] = { +static const nsCSSPropertyID gBorderColorSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. // Code relies on these matching the NS_SIDE_* constants. eCSSProperty_border_top_color, @@ -2720,7 +2720,7 @@ static const nsCSSProperty gBorderColorSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderInlineEndSubpropTable[] = { +static const nsCSSPropertyID gBorderInlineEndSubpropTable[] = { // Declaration.cpp output the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_inline_end_width, @@ -2729,7 +2729,7 @@ static const nsCSSProperty gBorderInlineEndSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderLeftSubpropTable[] = { +static const nsCSSPropertyID gBorderLeftSubpropTable[] = { // Declaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_left_width, @@ -2738,7 +2738,7 @@ static const nsCSSProperty gBorderLeftSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderRightSubpropTable[] = { +static const nsCSSPropertyID gBorderRightSubpropTable[] = { // Declaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_right_width, @@ -2747,7 +2747,7 @@ static const nsCSSProperty gBorderRightSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderInlineStartSubpropTable[] = { +static const nsCSSPropertyID gBorderInlineStartSubpropTable[] = { // Declaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_inline_start_width, @@ -2756,7 +2756,7 @@ static const nsCSSProperty gBorderInlineStartSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderStyleSubpropTable[] = { +static const nsCSSPropertyID gBorderStyleSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. eCSSProperty_border_top_style, eCSSProperty_border_right_style, @@ -2765,7 +2765,7 @@ static const nsCSSProperty gBorderStyleSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderTopSubpropTable[] = { +static const nsCSSPropertyID gBorderTopSubpropTable[] = { // Declaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_border_top_width, @@ -2774,7 +2774,7 @@ static const nsCSSProperty gBorderTopSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderWidthSubpropTable[] = { +static const nsCSSPropertyID gBorderWidthSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. eCSSProperty_border_top_width, eCSSProperty_border_right_width, @@ -2783,7 +2783,7 @@ static const nsCSSProperty gBorderWidthSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gFontSubpropTable[] = { +static const nsCSSPropertyID gFontSubpropTable[] = { eCSSProperty_font_family, eCSSProperty_font_style, eCSSProperty_font_weight, @@ -2805,7 +2805,7 @@ static const nsCSSProperty gFontSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gFontVariantSubpropTable[] = { +static const nsCSSPropertyID gFontVariantSubpropTable[] = { eCSSProperty_font_variant_alternates, eCSSProperty_font_variant_caps, eCSSProperty_font_variant_east_asian, @@ -2815,14 +2815,14 @@ static const nsCSSProperty gFontVariantSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gListStyleSubpropTable[] = { +static const nsCSSPropertyID gListStyleSubpropTable[] = { eCSSProperty_list_style_type, eCSSProperty_list_style_image, eCSSProperty_list_style_position, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gMarginSubpropTable[] = { +static const nsCSSPropertyID gMarginSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. eCSSProperty_margin_top, eCSSProperty_margin_right, @@ -2832,7 +2832,7 @@ static const nsCSSProperty gMarginSubpropTable[] = { }; -static const nsCSSProperty gOutlineSubpropTable[] = { +static const nsCSSPropertyID gOutlineSubpropTable[] = { // nsCSSDeclaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty_outline_width, @@ -2841,13 +2841,13 @@ static const nsCSSProperty gOutlineSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gColumnsSubpropTable[] = { +static const nsCSSPropertyID gColumnsSubpropTable[] = { eCSSProperty__moz_column_count, eCSSProperty__moz_column_width, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gColumnRuleSubpropTable[] = { +static const nsCSSPropertyID gColumnRuleSubpropTable[] = { // nsCSSDeclaration.cpp outputs the subproperties in this order. // It also depends on the color being third. eCSSProperty__moz_column_rule_width, @@ -2856,27 +2856,27 @@ static const nsCSSProperty gColumnRuleSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gFlexSubpropTable[] = { +static const nsCSSPropertyID gFlexSubpropTable[] = { eCSSProperty_flex_grow, eCSSProperty_flex_shrink, eCSSProperty_flex_basis, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gFlexFlowSubpropTable[] = { +static const nsCSSPropertyID gFlexFlowSubpropTable[] = { eCSSProperty_flex_direction, eCSSProperty_flex_wrap, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gGridTemplateSubpropTable[] = { +static const nsCSSPropertyID gGridTemplateSubpropTable[] = { eCSSProperty_grid_template_areas, eCSSProperty_grid_template_rows, eCSSProperty_grid_template_columns, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gGridSubpropTable[] = { +static const nsCSSPropertyID gGridSubpropTable[] = { eCSSProperty_grid_template_areas, eCSSProperty_grid_template_rows, eCSSProperty_grid_template_columns, @@ -2888,19 +2888,19 @@ static const nsCSSProperty gGridSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gGridColumnSubpropTable[] = { +static const nsCSSPropertyID gGridColumnSubpropTable[] = { eCSSProperty_grid_column_start, eCSSProperty_grid_column_end, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gGridRowSubpropTable[] = { +static const nsCSSPropertyID gGridRowSubpropTable[] = { eCSSProperty_grid_row_start, eCSSProperty_grid_row_end, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gGridAreaSubpropTable[] = { +static const nsCSSPropertyID gGridAreaSubpropTable[] = { eCSSProperty_grid_row_start, eCSSProperty_grid_column_start, eCSSProperty_grid_row_end, @@ -2908,19 +2908,19 @@ static const nsCSSProperty gGridAreaSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gGridGapSubpropTable[] = { +static const nsCSSPropertyID gGridGapSubpropTable[] = { eCSSProperty_grid_row_gap, eCSSProperty_grid_column_gap, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gOverflowSubpropTable[] = { +static const nsCSSPropertyID gOverflowSubpropTable[] = { eCSSProperty_overflow_x, eCSSProperty_overflow_y, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gPaddingSubpropTable[] = { +static const nsCSSPropertyID gPaddingSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. eCSSProperty_padding_top, eCSSProperty_padding_right, @@ -2929,26 +2929,26 @@ static const nsCSSProperty gPaddingSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gTextDecorationSubpropTable[] = { +static const nsCSSPropertyID gTextDecorationSubpropTable[] = { eCSSProperty_text_decoration_color, eCSSProperty_text_decoration_line, eCSSProperty_text_decoration_style, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gTextEmphasisSubpropTable[] = { +static const nsCSSPropertyID gTextEmphasisSubpropTable[] = { eCSSProperty_text_emphasis_style, eCSSProperty_text_emphasis_color, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gWebkitTextStrokeSubpropTable[] = { +static const nsCSSPropertyID gWebkitTextStrokeSubpropTable[] = { eCSSProperty__webkit_text_stroke_width, eCSSProperty__webkit_text_stroke_color, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gTransitionSubpropTable[] = { +static const nsCSSPropertyID gTransitionSubpropTable[] = { eCSSProperty_transition_property, eCSSProperty_transition_duration, eCSSProperty_transition_timing_function, @@ -2956,7 +2956,7 @@ static const nsCSSProperty gTransitionSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gBorderImageSubpropTable[] = { +static const nsCSSPropertyID gBorderImageSubpropTable[] = { eCSSProperty_border_image_source, eCSSProperty_border_image_slice, eCSSProperty_border_image_width, @@ -2965,7 +2965,7 @@ static const nsCSSProperty gBorderImageSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gMarkerSubpropTable[] = { +static const nsCSSPropertyID gMarkerSubpropTable[] = { eCSSProperty_marker_start, eCSSProperty_marker_mid, eCSSProperty_marker_end, @@ -2974,18 +2974,18 @@ static const nsCSSProperty gMarkerSubpropTable[] = { // Subproperty tables for shorthands that are just aliases with // different parsing rules. -static const nsCSSProperty gMozTransformSubpropTable[] = { +static const nsCSSPropertyID gMozTransformSubpropTable[] = { eCSSProperty_transform, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gScrollSnapTypeSubpropTable[] = { +static const nsCSSPropertyID gScrollSnapTypeSubpropTable[] = { eCSSProperty_scroll_snap_type_x, eCSSProperty_scroll_snap_type_y, eCSSProperty_UNKNOWN }; #ifdef MOZ_ENABLE_MASK_AS_SHORTHAND -static const nsCSSProperty gMaskSubpropTable[] = { +static const nsCSSPropertyID gMaskSubpropTable[] = { eCSSProperty_mask_image, eCSSProperty_mask_repeat, eCSSProperty_mask_position_x, @@ -2997,7 +2997,7 @@ static const nsCSSProperty gMaskSubpropTable[] = { eCSSProperty_mask_mode, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gMaskPositionSubpropTable[] = { +static const nsCSSPropertyID gMaskPositionSubpropTable[] = { eCSSProperty_mask_position_x, eCSSProperty_mask_position_y, eCSSProperty_UNKNOWN @@ -3006,7 +3006,7 @@ static const nsCSSProperty gMaskPositionSubpropTable[] = { // FIXME: mask-border tables should be added when we implement // mask-border properties. -const nsCSSProperty *const +const nsCSSPropertyID *const nsCSSProps::kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands] = { #define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_ // Need an extra level of macro nesting to force expansion of method_ @@ -3021,7 +3021,7 @@ nsCSSProps::kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shortha }; -static const nsCSSProperty gOffsetLogicalGroupTable[] = { +static const nsCSSPropertyID gOffsetLogicalGroupTable[] = { eCSSProperty_top, eCSSProperty_right, eCSSProperty_bottom, @@ -3029,25 +3029,25 @@ static const nsCSSProperty gOffsetLogicalGroupTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gMaxSizeLogicalGroupTable[] = { +static const nsCSSPropertyID gMaxSizeLogicalGroupTable[] = { eCSSProperty_max_height, eCSSProperty_max_width, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gMinSizeLogicalGroupTable[] = { +static const nsCSSPropertyID gMinSizeLogicalGroupTable[] = { eCSSProperty_min_height, eCSSProperty_min_width, eCSSProperty_UNKNOWN }; -static const nsCSSProperty gSizeLogicalGroupTable[] = { +static const nsCSSPropertyID gSizeLogicalGroupTable[] = { eCSSProperty_height, eCSSProperty_width, eCSSProperty_UNKNOWN }; -const nsCSSProperty* const +const nsCSSPropertyID* const nsCSSProps::kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT] = { #define CSS_PROP_LOGICAL_GROUP_SHORTHAND(id_) g##id_##SubpropTable, #define CSS_PROP_LOGICAL_GROUP_AXIS(name_) g##name_##LogicalGroupTable, @@ -3061,7 +3061,7 @@ nsCSSProps::kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT] = { // Mapping of logical longhand properties to their logical group (which // represents the physical longhands the logical properties an correspond // to). The format is pairs of values, where the first is the logical -// longhand property (an nsCSSProperty) and the second is the logical group +// longhand property (an nsCSSPropertyID) and the second is the logical group // (an nsCSSPropertyLogicalGroup), stored in a flat array (like KTableEntry // arrays). static const int gLogicalGroupMappingTable[] = { @@ -3073,8 +3073,8 @@ static const int gLogicalGroupMappingTable[] = { #undef CSS_PROP_LOGICAL }; -/* static */ const nsCSSProperty* -nsCSSProps::LogicalGroup(nsCSSProperty aProperty) +/* static */ const nsCSSPropertyID* +nsCSSProps::LogicalGroup(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "out of range"); diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index e5050f97af75..6de4fc2d5066 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -14,7 +14,7 @@ #include #include #include "nsString.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsStyleStructFwd.h" #include "nsCSSKeywords.h" #include "mozilla/CSSEnabledState.h" @@ -163,7 +163,7 @@ #define CSS_PROPERTY_STORES_CALC (1<<8) // Define what mechanism the CSS parser uses for parsing the property. -// See CSSParserImpl::ParseProperty(nsCSSProperty). Don't use 0 so that +// See CSSParserImpl::ParseProperty(nsCSSPropertyID). Don't use 0 so that // we can verify that every property sets one of the values. // // CSS_PROPERTY_PARSE_FUNCTION must be used for shorthand properties, @@ -381,18 +381,18 @@ public: static void ReleaseTable(void); // Looks up the property with name aProperty and returns its corresponding - // nsCSSProperty value. If aProperty is the name of a custom property, + // nsCSSPropertyID value. If aProperty is the name of a custom property, // then eCSSPropertyExtra_variable will be returned. - static nsCSSProperty LookupProperty(const nsAString& aProperty, + static nsCSSPropertyID LookupProperty(const nsAString& aProperty, EnabledState aEnabled); - static nsCSSProperty LookupProperty(const nsACString& aProperty, + static nsCSSPropertyID LookupProperty(const nsACString& aProperty, EnabledState aEnabled); // As above, but looked up using a property's IDL name. // eCSSPropertyExtra_variable won't be returned from these methods. - static nsCSSProperty LookupPropertyByIDLName( + static nsCSSPropertyID LookupPropertyByIDLName( const nsAString& aPropertyIDLName, EnabledState aEnabled); - static nsCSSProperty LookupPropertyByIDLName( + static nsCSSPropertyID LookupPropertyByIDLName( const nsACString& aPropertyIDLName, EnabledState aEnabled); @@ -401,14 +401,14 @@ public: static bool IsCustomPropertyName(const nsAString& aProperty); static bool IsCustomPropertyName(const nsACString& aProperty); - static inline bool IsShorthand(nsCSSProperty aProperty) { + static inline bool IsShorthand(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, "out of range"); return (aProperty >= eCSSProperty_COUNT_no_shorthands); } // Must be given a longhand property. - static bool IsInherited(nsCSSProperty aProperty); + static bool IsInherited(nsCSSPropertyID aProperty); // Same but for @font-face descriptors static nsCSSFontDesc LookupFontDesc(const nsAString& aProperty); @@ -423,14 +423,14 @@ public: static bool IsPredefinedCounterStyle(const nsACString& aStyle); // Given a property enum, get the string value - static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty); + static const nsAFlatCString& GetStringValue(nsCSSPropertyID aProperty); static const nsAFlatCString& GetStringValue(nsCSSFontDesc aFontDesc); static const nsAFlatCString& GetStringValue(nsCSSCounterDesc aCounterDesc); // Given a CSS Property and a Property Enum Value // Return back a const nsString& representation of the // value. Return back nullstr if no value is found - static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, int32_t aValue); + static const nsAFlatCString& LookupPropertyValue(nsCSSPropertyID aProperty, int32_t aValue); // Get a color name for a predefined color value like buttonhighlight or activeborder // Sets the aStr param to the name of the propertyID @@ -482,7 +482,7 @@ private: static const uint32_t kFlagsTable[eCSSProperty_COUNT]; public: - static inline bool PropHasFlags(nsCSSProperty aProperty, uint32_t aFlags) + static inline bool PropHasFlags(nsCSSPropertyID aProperty, uint32_t aFlags) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, "out of range"); @@ -493,7 +493,7 @@ public: return (nsCSSProps::kFlagsTable[aProperty] & aFlags) == aFlags; } - static inline uint32_t PropertyParseType(nsCSSProperty aProperty) + static inline uint32_t PropertyParseType(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, "out of range"); @@ -501,7 +501,7 @@ public: CSS_PROPERTY_PARSE_PROPERTY_MASK; } - static inline uint32_t ValueRestrictions(nsCSSProperty aProperty) + static inline uint32_t ValueRestrictions(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, "out of range"); @@ -514,7 +514,7 @@ private: static const uint32_t kParserVariantTable[eCSSProperty_COUNT_no_shorthands]; public: - static inline uint32_t ParserVariant(nsCSSProperty aProperty) { + static inline uint32_t ParserVariant(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "out of range"); return nsCSSProps::kParserVariantTable[aProperty]; @@ -523,12 +523,12 @@ public: private: // A table for shorthand properties. The appropriate index is the // property ID minus eCSSProperty_COUNT_no_shorthands. - static const nsCSSProperty *const + static const nsCSSPropertyID *const kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands]; public: static inline - const nsCSSProperty * SubpropertyEntryFor(nsCSSProperty aProperty) { + const nsCSSPropertyID * SubpropertyEntryFor(nsCSSPropertyID aProperty) { MOZ_ASSERT(eCSSProperty_COUNT_no_shorthands <= aProperty && aProperty < eCSSProperty_COUNT, "out of range"); @@ -539,7 +539,7 @@ public: // Returns an eCSSProperty_UNKNOWN-terminated array of the shorthand // properties containing |aProperty|, sorted from those that contain // the most properties to those that contain the least. - static const nsCSSProperty * ShorthandsContaining(nsCSSProperty aProperty) { + static const nsCSSPropertyID * ShorthandsContaining(nsCSSPropertyID aProperty) { MOZ_ASSERT(gShorthandsContainingPool, "uninitialized"); MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "out of range"); @@ -547,12 +547,12 @@ public: } private: // gShorthandsContainingTable is an array of the return values for - // ShorthandsContaining (arrays of nsCSSProperty terminated by + // ShorthandsContaining (arrays of nsCSSPropertyID terminated by // eCSSProperty_UNKNOWN) pointing into memory in // gShorthandsContainingPool (which contains all of those arrays in a // single allocation, and is the one pointer that should be |free|d). - static nsCSSProperty *gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands]; - static nsCSSProperty* gShorthandsContainingPool; + static nsCSSPropertyID *gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands]; + static nsCSSPropertyID* gShorthandsContainingPool; static bool BuildShorthandsContainingTable(); private: @@ -572,7 +572,7 @@ public: * Return an index for aProperty that is unique within its SID and in * the range 0 <= index < PropertyCountInStruct(aSID). */ - static size_t PropertyIndexInStruct(nsCSSProperty aProperty) { + static size_t PropertyIndexInStruct(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "out of range"); return gPropertyIndexInStruct[aProperty]; @@ -581,7 +581,7 @@ public: private: // A table for logical property groups. Indexes are // nsCSSPropertyLogicalGroup values. - static const nsCSSProperty* const + static const nsCSSPropertyID* const kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT]; public: @@ -603,7 +603,7 @@ public: * getting too many of these properties, we should make kLogicalGroupTable * be a simple array of eCSSProperty_COUNT length.) */ - static const nsCSSProperty* LogicalGroup(nsCSSProperty aProperty); + static const nsCSSPropertyID* LogicalGroup(nsCSSPropertyID aProperty); private: static bool gPropertyEnabled[eCSSProperty_COUNT_with_aliases]; @@ -623,7 +623,7 @@ public: * As a special case, the string "cssFloat" is returned for the float * property. nullptr is returned for internal properties. */ - static const char* PropertyIDLName(nsCSSProperty aProperty) + static const char* PropertyIDLName(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, "out of range"); @@ -638,14 +638,14 @@ public: * Returns the position of the specified property in a list of all * properties sorted by their IDL name. */ - static int32_t PropertyIDLNameSortPosition(nsCSSProperty aProperty) + static int32_t PropertyIDLNameSortPosition(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, "out of range"); return kIDLNameSortPositionTable[aProperty]; } - static bool IsEnabled(nsCSSProperty aProperty) { + static bool IsEnabled(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_with_aliases, "out of range"); return gPropertyEnabled[aProperty]; @@ -658,13 +658,13 @@ public: public: - static mozilla::UseCounter UseCounterFor(nsCSSProperty aProperty) { + static mozilla::UseCounter UseCounterFor(nsCSSPropertyID aProperty) { MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, "out of range"); return gPropertyUseCounter[aProperty]; } - static bool IsEnabled(nsCSSProperty aProperty, EnabledState aEnabled) + static bool IsEnabled(nsCSSPropertyID aProperty, EnabledState aEnabled) { if (IsEnabled(aProperty)) { return true; @@ -687,13 +687,13 @@ public: public: -// Storing the enabledstate_ value in an nsCSSProperty variable is a small hack +// Storing the enabledstate_ value in an nsCSSPropertyID variable is a small hack // to avoid needing a separate variable declaration for its real type // (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_) | \ + for (const nsCSSPropertyID *it_ = nsCSSProps::SubpropertyEntryFor(prop_), \ + es_ = (nsCSSPropertyID)((enabledstate_) | \ CSSEnabledState(0)); \ *it_ != eCSSProperty_UNKNOWN; ++it_) \ if (nsCSSProps::IsEnabled(*it_, (mozilla::CSSEnabledState) es_)) diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index a4beb8a98370..6cbee6606cd7 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -1464,7 +1464,7 @@ nsCSSFontFaceStyleDecl::GetParentRule(nsIDOMCSSRule** aParentRule) } NS_IMETHODIMP -nsCSSFontFaceStyleDecl::GetPropertyValue(const nsCSSProperty aPropID, +nsCSSFontFaceStyleDecl::GetPropertyValue(const nsCSSPropertyID aPropID, nsAString& aValue) { return @@ -1473,7 +1473,7 @@ nsCSSFontFaceStyleDecl::GetPropertyValue(const nsCSSProperty aPropID, } NS_IMETHODIMP -nsCSSFontFaceStyleDecl::SetPropertyValue(const nsCSSProperty aPropID, +nsCSSFontFaceStyleDecl::SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) { return SetProperty(NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(aPropID)), diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index a5bd033b8c4f..921570c7e3cd 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -19,7 +19,7 @@ #include "mozilla/css/GroupRule.h" #include "mozilla/dom/FontFace.h" #include "nsAutoPtr.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSValue.h" #include "nsDOMCSSDeclaration.h" #include "nsIDOMCSSConditionRule.h" diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 7f5b540b40e3..f864d8a37b4f 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -846,7 +846,7 @@ nsCSSValue::BufferFromString(const nsString& aValue) namespace { struct CSSValueSerializeCalcOps { - CSSValueSerializeCalcOps(nsCSSProperty aProperty, nsAString& aResult, + CSSValueSerializeCalcOps(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) : mProperty(aProperty), mResult(aResult), @@ -882,7 +882,7 @@ struct CSSValueSerializeCalcOps { } private: - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; nsAString &mResult; nsCSSValue::Serialization mValueSerialization; }; @@ -890,7 +890,7 @@ private: } // namespace void -nsCSSValue::AppendPolygonToString(nsCSSProperty aProperty, nsAString& aResult, +nsCSSValue::AppendPolygonToString(nsCSSPropertyID aProperty, nsAString& aResult, Serialization aSerialization) const { const nsCSSValue::Array* array = GetArrayValue(); @@ -917,7 +917,7 @@ nsCSSValue::AppendPolygonToString(nsCSSProperty aProperty, nsAString& aResult, inline void nsCSSValue::AppendPositionCoordinateToString( - const nsCSSValue& aValue, nsCSSProperty aProperty, + const nsCSSValue& aValue, nsCSSPropertyID aProperty, nsAString& aResult, Serialization aSerialization) const { if (aValue.GetUnit() == eCSSUnit_Enumerated) { @@ -931,7 +931,7 @@ nsCSSValue::AppendPositionCoordinateToString( void nsCSSValue::AppendCircleOrEllipseToString(nsCSSKeyword aFunctionId, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, nsAString& aResult, Serialization aSerialization) const { @@ -1027,7 +1027,7 @@ nsCSSValue::AppendBasicShapePositionToString(nsAString& aResult, // Helper to append |aString| with the shorthand sides notation used in e.g. // 'padding'. |aProperties| and |aValues| are expected to have 4 elements. /*static*/ void -nsCSSValue::AppendSidesShorthandToString(const nsCSSProperty aProperties[], +nsCSSValue::AppendSidesShorthandToString(const nsCSSPropertyID aProperties[], const nsCSSValue* aValues[], nsAString& aString, nsCSSValue::Serialization @@ -1058,7 +1058,7 @@ nsCSSValue::AppendSidesShorthandToString(const nsCSSProperty aProperties[], } /*static*/ void -nsCSSValue::AppendBasicShapeRadiusToString(const nsCSSProperty aProperties[], +nsCSSValue::AppendBasicShapeRadiusToString(const nsCSSPropertyID aProperties[], const nsCSSValue* aValues[], nsAString& aResult, Serialization aSerialization) @@ -1084,7 +1084,7 @@ nsCSSValue::AppendBasicShapeRadiusToString(const nsCSSProperty aProperties[], } void -nsCSSValue::AppendInsetToString(nsCSSProperty aProperty, nsAString& aResult, +nsCSSValue::AppendInsetToString(nsCSSPropertyID aProperty, nsAString& aResult, Serialization aSerialization) const { const nsCSSValue::Array* array = GetArrayValue(); @@ -1107,7 +1107,7 @@ nsCSSValue::AppendInsetToString(nsCSSProperty aProperty, nsAString& aResult, } if (array->Item(5).GetUnit() == eCSSUnit_Array) { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius); const nsCSSValue::Array* radius = array->Item(5).GetArrayValue(); MOZ_ASSERT(radius->Count() == 4, "expected 4 radii values"); @@ -1157,7 +1157,7 @@ nsCSSValue::AppendAlignJustifyValueToString(int32_t aValue, nsAString& aResult) } void -nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, +nsCSSValue::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, Serialization aSerialization) const { // eCSSProperty_UNKNOWN gets used for some recursive calls below. @@ -1230,7 +1230,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, } continue; } - nsCSSProperty prop = + nsCSSPropertyID prop = ((eCSSUnit_Counter <= unit && unit <= eCSSUnit_Counters) && i == array->Count() - 1) ? eCSSProperty_list_style_type : aProperty; @@ -1743,7 +1743,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, aResult.Append(')'); } else if (eCSSUnit_TokenStream == unit) { - nsCSSProperty shorthand = mValue.mTokenStream->mShorthandPropertyID; + nsCSSPropertyID shorthand = mValue.mTokenStream->mShorthandPropertyID; if (shorthand == eCSSProperty_UNKNOWN || nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS) || aProperty == eCSSProperty__x_system_font) { @@ -2119,7 +2119,7 @@ nsCSSValueList::CloneInto(nsCSSValueList* aList) const static void AppendValueListToString(const nsCSSValueList* val, - nsCSSProperty aProperty, nsAString& aResult, + nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) { for (;;) { @@ -2137,7 +2137,7 @@ AppendValueListToString(const nsCSSValueList* val, static void AppendGridTemplateToString(const nsCSSValueList* val, - nsCSSProperty aProperty, nsAString& aResult, + nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) { // This is called for the "list" that's the top-level value of the property. @@ -2230,7 +2230,7 @@ AppendGridTemplateToString(const nsCSSValueList* val, } void -nsCSSValueList::AppendToString(nsCSSProperty aProperty, nsAString& aResult, +nsCSSValueList::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { if (aProperty == eCSSProperty_grid_template_columns || @@ -2295,7 +2295,7 @@ nsCSSValueSharedList::~nsCSSValueSharedList() } void -nsCSSValueSharedList::AppendToString(nsCSSProperty aProperty, nsAString& aResult, +nsCSSValueSharedList::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { if (mHead) { @@ -2343,7 +2343,7 @@ nsCSSRect::~nsCSSRect() } void -nsCSSRect::AppendToString(nsCSSProperty aProperty, nsAString& aResult, +nsCSSRect::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { MOZ_ASSERT(mTop.GetUnit() != eCSSUnit_Null && @@ -2416,7 +2416,7 @@ static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 && // --- nsCSSValuePair ----------------- void -nsCSSValuePair::AppendToString(nsCSSProperty aProperty, +nsCSSValuePair::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { @@ -2452,7 +2452,7 @@ nsCSSValuePair_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) co // --- nsCSSValueTriplet ----------------- void -nsCSSValueTriplet::AppendToString(nsCSSProperty aProperty, +nsCSSValueTriplet::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { @@ -2506,7 +2506,7 @@ nsCSSValuePairList::Clone() const } void -nsCSSValuePairList::AppendToString(nsCSSProperty aProperty, +nsCSSValuePairList::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index fc48b72097bd..abccdaa54d6f 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -19,7 +19,7 @@ #include "nsIURI.h" #include "nsCOMPtr.h" #include "nsCSSKeywords.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsCSSProps.h" #include "nsColor.h" #include "nsCoord.h" @@ -491,7 +491,7 @@ public: * Serialize |this| as a specified value for |aProperty| and append * it to |aResult|. */ - void AppendToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, Serialization aValueSerialization) const; nsCSSUnit GetUnit() const { return mUnit; } @@ -800,12 +800,12 @@ public: size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; static void - AppendSidesShorthandToString(const nsCSSProperty aProperties[], + AppendSidesShorthandToString(const nsCSSPropertyID aProperties[], const nsCSSValue* aValues[], nsAString& aString, Serialization aSerialization); static void - AppendBasicShapeRadiusToString(const nsCSSProperty aProperties[], + AppendBasicShapeRadiusToString(const nsCSSPropertyID aProperties[], const nsCSSValue* aValues[], nsAString& aResult, Serialization aValueSerialization); @@ -817,20 +817,20 @@ private: return static_cast(aBuffer->Data()); } - void AppendPolygonToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendPolygonToString(nsCSSPropertyID aProperty, nsAString& aResult, Serialization aValueSerialization) const; void AppendPositionCoordinateToString(const nsCSSValue& aValue, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, nsAString& aResult, Serialization aSerialization) const; void AppendCircleOrEllipseToString( nsCSSKeyword aFunctionId, - nsCSSProperty aProperty, nsAString& aResult, + nsCSSPropertyID aProperty, nsAString& aResult, Serialization aValueSerialization) const; void AppendBasicShapePositionToString( nsAString& aResult, Serialization aValueSerialization) const; - void AppendInsetToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendInsetToString(nsCSSPropertyID aProperty, nsAString& aResult, Serialization aValueSerialization) const; protected: nsCSSUnit mUnit; @@ -976,7 +976,7 @@ struct nsCSSValueList { nsCSSValueList* Clone() const; // makes a deep copy. Infallible. void CloneInto(nsCSSValueList* aList) const; // makes a deep copy into aList - void AppendToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aValueSerialization) const; static bool Equal(const nsCSSValueList* aList1, @@ -1041,7 +1041,7 @@ private: public: NS_INLINE_DECL_REFCOUNTING(nsCSSValueSharedList) - void AppendToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aValueSerialization) const; bool operator==(nsCSSValueSharedList const& aOther) const; @@ -1082,7 +1082,7 @@ struct nsCSSRect { nsCSSRect(const nsCSSRect& aCopy); ~nsCSSRect(); - void AppendToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aValueSerialization) const; bool operator==(const nsCSSRect& aOther) const { @@ -1224,7 +1224,7 @@ struct nsCSSValuePair { mYValue.GetUnit() != eCSSUnit_Null; } - void AppendToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aValueSerialization) const; size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; @@ -1316,7 +1316,7 @@ struct nsCSSValueTriplet { mZValue.GetUnit() != eCSSUnit_Null; } - void AppendToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aValueSerialization) const; nsCSSValue mXValue; @@ -1380,7 +1380,7 @@ struct nsCSSValuePairList { ~nsCSSValuePairList(); nsCSSValuePairList* Clone() const; // makes a deep copy. Infallible. - void AppendToString(nsCSSProperty aProperty, nsAString& aResult, + void AppendToString(nsCSSPropertyID aProperty, nsAString& aResult, nsCSSValue::Serialization aValueSerialization) const; static bool Equal(const nsCSSValuePairList* aList1, @@ -1633,12 +1633,12 @@ public: // When a variable reference is used in a shorthand property, a // TokenStream value is stored as the specified value for each of its // component longhand properties. - nsCSSProperty mPropertyID; + nsCSSPropertyID mPropertyID; // The shorthand property that had a value with a variable reference, // which caused the longhand property identified by mPropertyID to have // a TokenStream value. - nsCSSProperty mShorthandPropertyID; + nsCSSPropertyID mShorthandPropertyID; // The unparsed CSS corresponding to the specified value of the property. // When the value of a shorthand property has a variable reference, the diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index fddfba2ad219..0fd9d94ab08c 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -87,7 +87,7 @@ struct nsComputedStyleMap // Create a pointer-to-member-function type. typedef already_AddRefed (nsComputedDOMStyle::*ComputeMethod)(); - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; ComputeMethod mGetter; bool IsLayoutFlushNeeded() const @@ -128,7 +128,7 @@ struct nsComputedStyleMap * that should be exposed on an nsComputedDOMStyle, excluding any * disabled properties. */ - nsCSSProperty PropertyAt(uint32_t aIndex) + nsCSSPropertyID PropertyAt(uint32_t aIndex) { Update(); return kEntries[EntryIndex(aIndex)].mProperty; @@ -139,7 +139,7 @@ struct nsComputedStyleMap * property, or nullptr if the property is not exposed on nsComputedDOMStyle * or is currently disabled. */ - const Entry* FindEntryForProperty(nsCSSProperty aPropID) + const Entry* FindEntryForProperty(nsCSSPropertyID aPropID) { Update(); for (uint32_t i = 0; i < mExposedPropertyCount; i++) { @@ -308,7 +308,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsComputedDOMStyle) NS_IMPL_CYCLE_COLLECTING_RELEASE(nsComputedDOMStyle) NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyValue(const nsCSSProperty aPropID, +nsComputedDOMStyle::GetPropertyValue(const nsCSSPropertyID aPropID, nsAString& aValue) { // This is mostly to avoid code duplication with GetPropertyCSSValue(); if @@ -320,7 +320,7 @@ nsComputedDOMStyle::GetPropertyValue(const nsCSSProperty aPropID, } NS_IMETHODIMP -nsComputedDOMStyle::SetPropertyValue(const nsCSSProperty aPropID, +nsComputedDOMStyle::SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; @@ -753,7 +753,7 @@ nsComputedDOMStyle::ClearCurrentStyleSources() already_AddRefed nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv) { - nsCSSProperty prop = + nsCSSPropertyID prop = nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent); bool needsLayoutFlush; @@ -770,7 +770,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorRes // GetQueryablePropertyMap. if (prop != eCSSProperty_UNKNOWN && nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_IS_ALIAS)) { - const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(prop); + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(prop); MOZ_ASSERT(subprops[1] == eCSSProperty_UNKNOWN, "must have list of length 1"); prop = subprops[0]; @@ -6322,7 +6322,7 @@ nsComputedDOMStyle::DoGetTransitionProperty() do { const StyleTransition *transition = &display->mTransitions[i]; RefPtr property = new nsROCSSPrimitiveValue; - nsCSSProperty cssprop = transition->GetProperty(); + nsCSSPropertyID cssprop = transition->GetProperty(); if (cssprop == eCSSPropertyExtra_all_properties) property->SetIdent(eCSSKeyword_all); else if (cssprop == eCSSPropertyExtra_no_properties) diff --git a/layout/style/nsComputedDOMStylePropertyList.h b/layout/style/nsComputedDOMStylePropertyList.h index 0023bab92de6..defe4cc9ea6a 100644 --- a/layout/style/nsComputedDOMStylePropertyList.h +++ b/layout/style/nsComputedDOMStylePropertyList.h @@ -19,7 +19,7 @@ The COMPUTED_STYLE_PROP macro is defined for each such property. Its arguments are: - -. 'id' the nsCSSProperty ID, without the leading "nsCSSProperty_". + -. 'id' the nsCSSPropertyID ID, without the leading "nsCSSProperty_". -. 'method' the nsComputedDOMStyle method name that returns the CSSValue representing that property's computed value, without the leading diff --git a/layout/style/nsDOMCSSAttrDeclaration.cpp b/layout/style/nsDOMCSSAttrDeclaration.cpp index 22d2397238da..8105301cd77e 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.cpp +++ b/layout/style/nsDOMCSSAttrDeclaration.cpp @@ -172,7 +172,7 @@ nsDOMCSSAttributeDeclaration::GetParentObject() } NS_IMETHODIMP -nsDOMCSSAttributeDeclaration::SetPropertyValue(const nsCSSProperty aPropID, +nsDOMCSSAttributeDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) { // Scripted modifications to style.opacity or style.transform diff --git a/layout/style/nsDOMCSSAttrDeclaration.h b/layout/style/nsDOMCSSAttrDeclaration.h index 887e9044af34..9865aaf5290d 100644 --- a/layout/style/nsDOMCSSAttrDeclaration.h +++ b/layout/style/nsDOMCSSAttrDeclaration.h @@ -36,7 +36,7 @@ public: virtual nsINode* GetParentObject() override; - NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, + NS_IMETHOD SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) override; protected: diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index 5d1ae9df75eb..30e3ac0f25c1 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -41,7 +41,7 @@ NS_INTERFACE_TABLE_HEAD(nsDOMCSSDeclaration) NS_INTERFACE_MAP_END NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyValue(const nsCSSProperty aPropID, +nsDOMCSSDeclaration::GetPropertyValue(const nsCSSPropertyID aPropID, nsAString& aValue) { NS_PRECONDITION(aPropID != eCSSProperty_UNKNOWN, @@ -75,7 +75,7 @@ nsDOMCSSDeclaration::GetCustomPropertyValue(const nsAString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPropertyValue(const nsCSSProperty aPropID, +nsDOMCSSDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) { switch (aPropID) { @@ -195,7 +195,7 @@ NS_IMETHODIMP nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName, nsAString& aReturn) { - const nsCSSProperty propID = + const nsCSSPropertyID propID = nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent); if (propID == eCSSProperty_UNKNOWN) { aReturn.Truncate(); @@ -214,7 +214,7 @@ NS_IMETHODIMP nsDOMCSSDeclaration::GetAuthoredPropertyValue(const nsAString& aPropertyName, nsAString& aReturn) { - const nsCSSProperty propID = + const nsCSSPropertyID propID = nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent); if (propID == eCSSProperty_UNKNOWN) { aReturn.Truncate(); @@ -255,7 +255,7 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName, const nsAString& aPriority) { // In the common (and fast) cases we can use the property id - nsCSSProperty propID = + nsCSSPropertyID propID = nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent); if (propID == eCSSProperty_UNKNOWN) { return NS_OK; @@ -291,7 +291,7 @@ NS_IMETHODIMP nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName, nsAString& aReturn) { - const nsCSSProperty propID = + const nsCSSPropertyID propID = nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent); if (propID == eCSSProperty_UNKNOWN) { aReturn.Truncate(); @@ -327,7 +327,7 @@ nsDOMCSSDeclaration::GetCSSParsingEnvironmentForRule(css::Rule* aRule, } nsresult -nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID, +nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSPropertyID aPropID, const nsAString& aPropValue, bool aIsImportant) { @@ -404,7 +404,7 @@ nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName, } nsresult -nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID) +nsDOMCSSDeclaration::RemoveProperty(const nsCSSPropertyID aPropID) { css::Declaration* olddecl = GetCSSDeclaration(eOperation_RemoveProperty); if (!olddecl) { diff --git a/layout/style/nsDOMCSSDeclaration.h b/layout/style/nsDOMCSSDeclaration.h index 6a3c3a9e310c..b563f8c7cef5 100644 --- a/layout/style/nsDOMCSSDeclaration.h +++ b/layout/style/nsDOMCSSDeclaration.h @@ -156,13 +156,13 @@ protected: static void GetCSSParsingEnvironmentForRule(mozilla::css::Rule* aRule, CSSParsingEnvironment& aCSSParseEnv); - nsresult ParsePropertyValue(const nsCSSProperty aPropID, + nsresult ParsePropertyValue(const nsCSSPropertyID aPropID, const nsAString& aPropValue, bool aIsImportant); // Prop-id based version of RemoveProperty. Note that this does not // return the old value; it just does a straight removal. - nsresult RemoveProperty(const nsCSSProperty aPropID); + nsresult RemoveProperty(const nsCSSPropertyID aPropID); void GetCustomPropertyValue(const nsAString& aPropertyName, nsAString& aValue); nsresult RemoveCustomProperty(const nsAString& aPropertyName); diff --git a/layout/style/nsICSSDeclaration.h b/layout/style/nsICSSDeclaration.h index e9a39ad5792f..ff6ec4a78236 100644 --- a/layout/style/nsICSSDeclaration.h +++ b/layout/style/nsICSSDeclaration.h @@ -14,14 +14,14 @@ /** * This interface provides access to methods analogous to those of * nsIDOMCSSStyleDeclaration; the difference is that these use - * nsCSSProperty enums for the prop names instead of using strings. + * nsCSSPropertyID enums for the prop names instead of using strings. * This is meant for use in performance-sensitive code only! Most * consumers should continue to use nsIDOMCSSStyleDeclaration. */ #include "mozilla/Attributes.h" #include "nsIDOMCSSStyleDeclaration.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "CSSValue.h" #include "nsWrapperCache.h" #include "nsString.h" @@ -47,7 +47,7 @@ public: * Method analogous to nsIDOMCSSStyleDeclaration::GetPropertyValue, * which obeys all the same restrictions. */ - NS_IMETHOD GetPropertyValue(const nsCSSProperty aPropID, + NS_IMETHOD GetPropertyValue(const nsCSSPropertyID aPropID, nsAString& aValue) = 0; NS_IMETHOD GetAuthoredPropertyValue(const nsAString& aPropName, @@ -58,7 +58,7 @@ public: * method does NOT allow setting a priority (the priority will * always be set to default priority). */ - NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, + NS_IMETHOD SetPropertyValue(const nsCSSPropertyID aPropID, const nsAString& aValue) = 0; virtual nsINode *GetParentObject() = 0; @@ -153,11 +153,11 @@ public: NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSDeclaration, NS_ICSSDECLARATION_IID) #define NS_DECL_NSICSSDECLARATION \ - NS_IMETHOD GetPropertyValue(const nsCSSProperty aPropID, \ + NS_IMETHOD GetPropertyValue(const nsCSSPropertyID aPropID, \ nsAString& aValue) override; \ NS_IMETHOD GetAuthoredPropertyValue(const nsAString& aPropName, \ nsAString& aValue) override; \ - NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, \ + NS_IMETHOD SetPropertyValue(const nsCSSPropertyID aPropID, \ const nsAString& aValue) override; #define NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER \ diff --git a/layout/style/nsRuleData.h b/layout/style/nsRuleData.h index 1a4c1e369b5e..d51d50cb3f83 100644 --- a/layout/style/nsRuleData.h +++ b/layout/style/nsRuleData.h @@ -66,7 +66,7 @@ struct nsRuleData * This function must only be called if the given property is in * mSIDs. */ - nsCSSValue* ValueFor(nsCSSProperty aProperty) + nsCSSValue* ValueFor(nsCSSPropertyID aProperty) { MOZ_ASSERT(aProperty < eCSSProperty_COUNT_no_shorthands, "invalid or shorthand property"); @@ -84,7 +84,7 @@ struct nsRuleData return mValueStorage + mValueOffsets[sid] + indexInStruct; } - const nsCSSValue* ValueFor(nsCSSProperty aProperty) const { + const nsCSSValue* ValueFor(nsCSSPropertyID aProperty) const { return const_cast(this)->ValueFor(aProperty); } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index e08365e61566..26fdcd817763 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -5178,7 +5178,7 @@ nsRuleNode::ComputeUIResetData(void* aStartStruct, // Information about each transition or animation property that is // constant. struct TransitionPropInfo { - nsCSSProperty property; + nsCSSPropertyID property; // Location of the count of the property's computed value. uint32_t nsStyleDisplay::* sdCount; }; @@ -5351,7 +5351,7 @@ nsRuleNode::ComputeTimingFunction(const nsCSSValue& aValue, } static uint8_t -GetWillChangeBitFieldFromPropFlags(const nsCSSProperty& aProp) +GetWillChangeBitFieldFromPropFlags(const nsCSSPropertyID& aProp) { uint8_t willChangeBitField = 0; if (nsCSSProps::PropHasFlags(aProp, CSS_PROPERTY_CREATES_STACKING_CONTEXT)) { @@ -5494,7 +5494,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (val.GetUnit() == eCSSUnit_Ident) { nsDependentString propertyStr(property.list->mValue.GetStringBufferValue()); - nsCSSProperty prop = + nsCSSPropertyID prop = nsCSSProps::LookupProperty(propertyStr, CSSEnabledState::eForAllContent); if (prop == eCSSProperty_UNKNOWN || @@ -6294,14 +6294,14 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_SCROLL; } - nsCSSProperty prop = + nsCSSPropertyID prop = nsCSSProps::LookupProperty(buffer, CSSEnabledState::eForAllContent); 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 = + for (const nsCSSPropertyID* shorthands = nsCSSProps::SubpropertyEntryFor(prop); *shorthands != eCSSProperty_UNKNOWN; ++shorthands) { display->mWillChangeBitField |= GetWillChangeBitFieldFromPropFlags(*shorthands); @@ -7335,7 +7335,7 @@ nsRuleNode::ComputeMarginData(void* aStartStruct, COMPUTE_START_RESET(Margin, margin, parentMargin) // margin: length, percent, calc, inherit - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_margin); nsStyleCoord coord; NS_FOR_CSS_SIDES(side) { @@ -7449,7 +7449,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, // border-width, border-*-width: length, enum, inherit nsStyleCoord coord; { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_width); NS_FOR_CSS_SIDES(side) { const nsCSSValue& value = *aRuleData->ValueFor(subprops[side]); @@ -7496,7 +7496,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, // border-style, border-*-style: enum, inherit { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_style); NS_FOR_CSS_SIDES(side) { const nsCSSValue& value = *aRuleData->ValueFor(subprops[side]); @@ -7521,7 +7521,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, nscolor borderColor; nscolor unused = NS_RGB(0,0,0); - static const nsCSSProperty borderColorsProps[] = { + static const nsCSSPropertyID borderColorsProps[] = { eCSSProperty_border_top_colors, eCSSProperty_border_right_colors, eCSSProperty_border_bottom_colors, @@ -7580,7 +7580,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, // border-color, border-*-color: color, string, enum, inherit { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color); bool foreground; NS_FOR_CSS_SIDES(side) { @@ -7626,7 +7626,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, // border-radius: length, percent, inherit { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius); NS_FOR_CSS_FULL_CORNERS(corner) { int cx = NS_FULL_TO_HALF_CORNER(corner, false); @@ -7756,7 +7756,7 @@ nsRuleNode::ComputePaddingData(void* aStartStruct, COMPUTE_START_RESET(Padding, padding, parentPadding) // padding: length, percent, calc, inherit - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_padding); nsStyleCoord coord; NS_FOR_CSS_SIDES(side) { @@ -7844,7 +7844,7 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct, // -moz-outline-radius: length, percent, inherit { - const nsCSSProperty* subprops = + const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty__moz_outline_radius); NS_FOR_CSS_FULL_CORNERS(corner) { int cx = NS_FULL_TO_HALF_CORNER(corner, false); @@ -8386,7 +8386,7 @@ nsRuleNode::ComputePositionData(void* aStartStruct, COMPUTE_START_RESET(Position, pos, parentPos) // box offsets: length, percent, calc, auto, inherit - static const nsCSSProperty offsetProps[] = { + static const nsCSSPropertyID offsetProps[] = { eCSSProperty_top, eCSSProperty_right, eCSSProperty_bottom, @@ -10431,12 +10431,12 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext, ruleData.mValueOffsets[eStyleStruct_Text] = textShadowOffset; } - static const nsCSSProperty backgroundValues[] = { + static const nsCSSPropertyID backgroundValues[] = { eCSSProperty_background_color, eCSSProperty_background_image, }; - static const nsCSSProperty borderValues[] = { + static const nsCSSPropertyID borderValues[] = { eCSSProperty_border_top_color, eCSSProperty_border_top_style, eCSSProperty_border_top_width, @@ -10455,14 +10455,14 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext, eCSSProperty_border_bottom_left_radius, }; - static const nsCSSProperty paddingValues[] = { + static const nsCSSPropertyID paddingValues[] = { eCSSProperty_padding_top, eCSSProperty_padding_right, eCSSProperty_padding_bottom, eCSSProperty_padding_left, }; - static const nsCSSProperty textShadowValues[] = { + static const nsCSSPropertyID textShadowValues[] = { eCSSProperty_text_shadow }; @@ -10474,7 +10474,7 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext, MOZ_ARRAY_LENGTH(paddingValues) + MOZ_ARRAY_LENGTH(textShadowValues)]; - nsCSSProperty properties[MOZ_ARRAY_LENGTH(backgroundValues) + + nsCSSPropertyID properties[MOZ_ARRAY_LENGTH(backgroundValues) + MOZ_ARRAY_LENGTH(borderValues) + MOZ_ARRAY_LENGTH(paddingValues) + MOZ_ARRAY_LENGTH(textShadowValues)]; @@ -10598,7 +10598,7 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext, /* static */ void nsRuleNode::ComputePropertiesOverridingAnimation( - const nsTArray& aProperties, + const nsTArray& aProperties, nsStyleContext* aStyleContext, nsCSSPropertySet& aPropertiesOverridden) { @@ -10611,7 +10611,7 @@ nsRuleNode::ComputePropertiesOverridingAnimation( size_t offsets[nsStyleStructID_Length]; for (size_t propIdx = 0, propEnd = aProperties.Length(); propIdx < propEnd; ++propIdx) { - nsCSSProperty prop = aProperties[propIdx]; + nsCSSPropertyID prop = aProperties[propIdx]; nsStyleStructID sid = nsCSSProps::kSIDTable[prop]; uint32_t bit = nsCachedStyleData::GetBitForSID(sid); if (!(structBits & bit)) { @@ -10672,7 +10672,7 @@ nsRuleNode::ComputePropertiesOverridingAnimation( */ for (size_t propIdx = 0, propEnd = aProperties.Length(); propIdx < propEnd; ++propIdx) { - nsCSSProperty prop = aProperties[propIdx]; + nsCSSPropertyID prop = aProperties[propIdx]; if (ruleData.ValueFor(prop)->GetUnit() != eCSSUnit_Null) { aPropertiesOverridden.AddProperty(prop); } diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index 8c14cb08d3b9..afff818243e2 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -961,7 +961,7 @@ public: */ static void ComputePropertiesOverridingAnimation( - const nsTArray& aProperties, + const nsTArray& aProperties, nsStyleContext* aStyleContext, nsCSSPropertySet& aPropertiesOverridden); diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 0b89659599b6..626cef0d47ce 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -1394,7 +1394,7 @@ nsStyleContext::Arena() } static inline void -ExtractAnimationValue(nsCSSProperty aProperty, +ExtractAnimationValue(nsCSSPropertyID aProperty, nsStyleContext* aStyleContext, StyleAnimationValue& aResult) { @@ -1406,7 +1406,7 @@ ExtractAnimationValue(nsCSSProperty aProperty, } static nscolor -ExtractColor(nsCSSProperty aProperty, +ExtractColor(nsCSSPropertyID aProperty, nsStyleContext *aStyleContext) { StyleAnimationValue val; @@ -1416,7 +1416,7 @@ ExtractColor(nsCSSProperty aProperty, } static nscolor -ExtractColorLenient(nsCSSProperty aProperty, +ExtractColorLenient(nsCSSPropertyID aProperty, nsStyleContext *aStyleContext) { StyleAnimationValue val; @@ -1436,7 +1436,7 @@ struct ColorIndexSet { static const ColorIndexSet gVisitedIndices[2] = { { 0, 0 }, { 1, 0 } }; nscolor -nsStyleContext::GetVisitedDependentColor(nsCSSProperty aProperty) +nsStyleContext::GetVisitedDependentColor(nsCSSPropertyID aProperty) { NS_ASSERTION(aProperty == eCSSProperty_color || aProperty == eCSSProperty_background_color || diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h index 54f3b79ed522..9bd38d399056 100644 --- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -174,7 +174,7 @@ public: /** * Get the color property that should be used to fill text. */ - nsCSSProperty GetTextFillColorProp() { + nsCSSPropertyID GetTextFillColorProp() { return StyleText()->mWebkitTextFillColorForeground ? eCSSProperty_color : eCSSProperty__webkit_text_fill_color; } @@ -426,7 +426,7 @@ public: * Note that if aProperty is eCSSProperty_border_*_color, this * function handles -moz-use-text-color. */ - nscolor GetVisitedDependentColor(nsCSSProperty aProperty); + nscolor GetVisitedDependentColor(nsCSSPropertyID aProperty); /** * aColors should be a two element array of nscolor in which the first diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 743ae000f75b..b699c7729ddd 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2335,7 +2335,7 @@ nsStyleImage::PurgeCacheForViewportChange( // nsStyleImageLayers // -const nsCSSProperty nsStyleImageLayers::kBackgroundLayerTable[] = { +const nsCSSPropertyID nsStyleImageLayers::kBackgroundLayerTable[] = { eCSSProperty_background, // shorthand eCSSProperty_background_color, // color eCSSProperty_background_image, // image @@ -2351,7 +2351,7 @@ const nsCSSProperty nsStyleImageLayers::kBackgroundLayerTable[] = { }; #ifdef MOZ_ENABLE_MASK_AS_SHORTHAND -const nsCSSProperty nsStyleImageLayers::kMaskLayerTable[] = { +const nsCSSPropertyID nsStyleImageLayers::kMaskLayerTable[] = { eCSSProperty_mask, // shorthand eCSSProperty_UNKNOWN, // color eCSSProperty_mask_image, // image @@ -2917,7 +2917,7 @@ StyleTransition::SetInitialValues() } void -StyleTransition::SetUnknownProperty(nsCSSProperty aProperty, +StyleTransition::SetUnknownProperty(nsCSSPropertyID aProperty, const nsAString& aPropertyString) { MOZ_ASSERT(nsCSSProps::LookupProperty(aPropertyString, diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 8d8ed5d4436e..9059f7da2ead 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -807,8 +807,8 @@ struct nsStyleImageLayers { bool HasLayerWithImage() const; - static const nsCSSProperty kBackgroundLayerTable[]; - static const nsCSSProperty kMaskLayerTable[]; + static const nsCSSPropertyID kBackgroundLayerTable[]; + static const nsCSSPropertyID kMaskLayerTable[]; #define NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(var_, layers_) \ for (uint32_t var_ = (layers_).mImageCount; var_-- != 0; ) @@ -2434,7 +2434,7 @@ struct StyleTransition const nsTimingFunction& GetTimingFunction() const { return mTimingFunction; } float GetDelay() const { return mDelay; } float GetDuration() const { return mDuration; } - nsCSSProperty GetProperty() const { return mProperty; } + nsCSSPropertyID GetProperty() const { return mProperty; } nsIAtom* GetUnknownProperty() const { return mUnknownProperty; } float GetCombinedDuration() const { @@ -2446,14 +2446,14 @@ struct StyleTransition { mTimingFunction = aTimingFunction; } void SetDelay(float aDelay) { mDelay = aDelay; } void SetDuration(float aDuration) { mDuration = aDuration; } - void SetProperty(nsCSSProperty aProperty) + void SetProperty(nsCSSPropertyID aProperty) { NS_ASSERTION(aProperty != eCSSProperty_UNKNOWN && aProperty != eCSSPropertyExtra_variable, "invalid property"); mProperty = aProperty; } - void SetUnknownProperty(nsCSSProperty aProperty, + void SetUnknownProperty(nsCSSPropertyID aProperty, const nsAString& aPropertyString); void CopyPropertyFrom(const StyleTransition& aOther) { @@ -2471,7 +2471,7 @@ private: nsTimingFunction mTimingFunction; float mDuration; float mDelay; - nsCSSProperty mProperty; + nsCSSPropertyID mProperty; nsCOMPtr mUnknownProperty; // used when mProperty is // eCSSProperty_UNKNOWN or // eCSSPropertyExtra_variable diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index 3f5f245dc2ef..197ac9b03840 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -228,7 +228,7 @@ nsStyleUtil::AppendEscapedCSSFontFamilyList( /* static */ void -nsStyleUtil::AppendBitmaskCSSValue(nsCSSProperty aProperty, +nsStyleUtil::AppendBitmaskCSSValue(nsCSSPropertyID aProperty, int32_t aMaskedValue, int32_t aFirstMask, int32_t aLastMask, diff --git a/layout/style/nsStyleUtil.h b/layout/style/nsStyleUtil.h index 6b8ea79543e8..e5b7a055ff84 100644 --- a/layout/style/nsStyleUtil.h +++ b/layout/style/nsStyleUtil.h @@ -6,7 +6,7 @@ #define nsStyleUtil_h___ #include "nsCoord.h" -#include "nsCSSProperty.h" +#include "nsCSSPropertyID.h" #include "nsString.h" #include "nsTArrayForwardDeclare.h" #include "gfxFontFamilyList.h" @@ -53,7 +53,7 @@ public: nsAString& aResult); // Append a bitmask-valued property's value(s) (space-separated) to aResult. - static void AppendBitmaskCSSValue(nsCSSProperty aProperty, + static void AppendBitmaskCSSValue(nsCSSPropertyID aProperty, int32_t aMaskedValue, int32_t aFirstMask, int32_t aLastMask, diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index f1f30e8cde1b..1136114c656e 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -141,7 +141,7 @@ CSSTransition::GetTransitionProperty(nsString& aRetVal) const // now we can just query the effect. MOZ_ASSERT(mEffect && mEffect->AsTransition(), "Transitions should have a transition effect"); - nsCSSProperty prop = mEffect->AsTransition()->TransitionProperty(); + nsCSSPropertyID prop = mEffect->AsTransition()->TransitionProperty(); aRetVal = NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(prop)); } @@ -209,7 +209,7 @@ CSSTransition::Tick() QueueEvents(); } -nsCSSProperty +nsCSSPropertyID CSSTransition::TransitionProperty() const { // FIXME: Once we support replacing/removing the effect (bug 1049975) @@ -468,15 +468,15 @@ nsTransitionManager::UpdateTransitions( // properties in question changed and are animatable. // FIXME: Would be good to find a way to share code between this // interpretation of transition-property and the one below. - nsCSSProperty property = t.GetProperty(); + nsCSSPropertyID property = t.GetProperty(); if (property == eCSSPropertyExtra_no_properties || property == eCSSPropertyExtra_variable || property == eCSSProperty_UNKNOWN) { // Nothing to do, but need to exclude this from cases below. } else if (property == eCSSPropertyExtra_all_properties) { - for (nsCSSProperty p = nsCSSProperty(0); + for (nsCSSPropertyID p = nsCSSPropertyID(0); p < eCSSProperty_COUNT_no_shorthands; - p = nsCSSProperty(p + 1)) { + p = nsCSSPropertyID(p + 1)) { ConsiderStartingTransition(p, t, aElement, aElementTransitions, aOldStyleContext, aNewStyleContext, &startedAny, &whichStarted); @@ -515,15 +515,15 @@ nsTransitionManager::UpdateTransitions( const StyleTransition& t = aDisp->mTransitions[i]; // FIXME: Would be good to find a way to share code between this // interpretation of transition-property and the one above. - nsCSSProperty property = t.GetProperty(); + nsCSSPropertyID property = t.GetProperty(); if (property == eCSSPropertyExtra_no_properties || property == eCSSPropertyExtra_variable || property == eCSSProperty_UNKNOWN) { // Nothing to do, but need to exclude this from cases below. } else if (property == eCSSPropertyExtra_all_properties) { - for (nsCSSProperty p = nsCSSProperty(0); + for (nsCSSPropertyID p = nsCSSPropertyID(0); p < eCSSProperty_COUNT_no_shorthands; - p = nsCSSProperty(p + 1)) { + p = nsCSSPropertyID(p + 1)) { allTransitionProperties.AddProperty(p); } } else if (nsCSSProps::IsShorthand(property)) { @@ -581,7 +581,7 @@ nsTransitionManager::UpdateTransitions( void nsTransitionManager::ConsiderStartingTransition( - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, const StyleTransition& aTransition, dom::Element* aElement, CSSTransitionCollection*& aElementTransitions, @@ -862,7 +862,7 @@ nsTransitionManager::ConsiderStartingTransition( } static Keyframe& -AppendKeyframe(double aOffset, nsCSSProperty aProperty, +AppendKeyframe(double aOffset, nsCSSPropertyID aProperty, StyleAnimationValue&& aValue, nsTArray& aKeyframes) { Keyframe& frame = *aKeyframes.AppendElement(); @@ -879,7 +879,7 @@ AppendKeyframe(double aOffset, nsCSSProperty aProperty, nsTArray nsTransitionManager::GetTransitionKeyframes( nsStyleContext* aStyleContext, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, StyleAnimationValue&& aStartValue, StyleAnimationValue&& aEndValue, const nsTimingFunction& aTimingFunction) diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index 106951e796c5..704779367a5e 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -52,7 +52,7 @@ struct ElementPropertyTransition : public dom::KeyframeEffectReadOnly return this; } - nsCSSProperty TransitionProperty() const { + nsCSSPropertyID TransitionProperty() const { MOZ_ASSERT(mKeyframes.Length() == 2, "Transitions should have exactly two animation keyframes. " "Perhaps we are using an un-initialized transition?"); @@ -170,7 +170,7 @@ public: void Tick() override; - nsCSSProperty TransitionProperty() const; + nsCSSPropertyID TransitionProperty() const; StyleAnimationValue ToValue() const; bool HasLowerCompositeOrderThan(const CSSTransition& aOther) const; @@ -276,7 +276,7 @@ struct TransitionEventInfo { TransitionEventInfo(dom::Element* aElement, CSSPseudoElementType aPseudoType, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, StickyTimeDuration aDuration, const TimeStamp& aTimeStamp, dom::Animation* aAnimation) @@ -399,7 +399,7 @@ protected: nsStyleContext* aNewStyleContext); void - ConsiderStartingTransition(nsCSSProperty aProperty, + ConsiderStartingTransition(nsCSSPropertyID aProperty, const mozilla::StyleTransition& aTransition, mozilla::dom::Element* aElement, CSSTransitionCollection*& aElementTransitions, @@ -410,7 +410,7 @@ protected: nsTArray GetTransitionKeyframes( nsStyleContext* aStyleContext, - nsCSSProperty aProperty, + nsCSSPropertyID aProperty, mozilla::StyleAnimationValue&& aStartValue, mozilla::StyleAnimationValue&& aEndValue, const nsTimingFunction& aTimingFunction); diff --git a/layout/style/test/TestCSSPropertyLookup.cpp b/layout/style/test/TestCSSPropertyLookup.cpp index fc751d4fbc01..60a15311c98b 100644 --- a/layout/style/test/TestCSSPropertyLookup.cpp +++ b/layout/style/test/TestCSSPropertyLookup.cpp @@ -24,8 +24,8 @@ static bool TestProps() { bool success = true; - nsCSSProperty id; - nsCSSProperty index; + nsCSSPropertyID id; + nsCSSPropertyID index; // Everything appears to assert if we don't do this first... nsCSSProps::AddRefTable(); @@ -40,7 +40,7 @@ TestProps() while (et < end) { char tagName[100]; PL_strcpy(tagName, *et); - index = nsCSSProperty(int32_t(index) + 1); + index = nsCSSPropertyID(int32_t(index) + 1); id = nsCSSProps::LookupProperty(nsCString(tagName), CSSEnabledState::eIgnoreEnabledState);