[CSS Parser] Rename CSSPrimitiveValue::UnitTypes to CSSPrimitiveValue::UnitType
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Dec 2016 17:39:27 +0000 (17:39 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Dec 2016 17:39:27 +0000 (17:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165776

Reviewed by Zalan Bujtas.

* css/CSSCalculationValue.cpp:
(WebCore::unitCategory):
(WebCore::hasDoubleValue):
(WebCore::determineCategory):
(WebCore::CSSCalcExpressionNodeParser::parseValue):
* css/CSSCalculationValue.h:
* css/CSSPrimitiveValue.cpp:
(WebCore::isValidCSSUnitTypeForDoubleConversion):
(WebCore::isStringType):
(WebCore::CSSPrimitiveValue::unitCategory):
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::computeLengthDouble):
(WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
(WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
(WebCore::CSSPrimitiveValue::getFloatValue):
(WebCore::CSSPrimitiveValue::doubleValue):
(WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
(WebCore::CSSPrimitiveValue::doubleValueInternal):
(WebCore::CSSPrimitiveValue::cloneForCSSOM):
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::isFontRelativeLength):
(WebCore::CSSPrimitiveValue::isLength):
(WebCore::CSSPrimitiveValue::isResolution):
(WebCore::CSSPrimitiveValue::createAllowingMarginQuirk):
* css/CSSValue.h:
* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::createValue):
* css/CSSValuePool.h:
(WebCore::CSSValuePool::createValue):
* css/MediaQueryExp.cpp:
(WebCore::featureWithValidDensity):
(WebCore::MediaQueryExpression::MediaQueryExpression):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::parseSimpleLength):
(WebCore::parseSimpleLengthValue):
(WebCore::parseColorIntOrPercentage):
(WebCore::fastParseColorInternal):
(WebCore::parseTransformTranslateArguments):
(WebCore::parseTransformNumberArguments):
* css/parser/CSSParserToken.cpp:
(WebCore::cssPrimitiveValueUnitFromTrie):
(WebCore::stringToUnitType):
(WebCore::CSSParserToken::CSSParserToken):
(WebCore::CSSParserToken::convertToPercentage):
* css/parser/CSSParserToken.h:
(WebCore::CSSParserToken::unitType):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeTransformOrigin):
(WebCore::consumeCounter):
(WebCore::consumeAnimationName):
(WebCore::consumePerspective):
(WebCore::consumePositionLonghand):
(WebCore::consumeCounterContent):
(WebCore::consumeReflect):
(WebCore::consumeGridBreadth):
(WebCore::CSSPropertyParser::consumeFlex):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
(WebCore::CSSPropertyParserHelpers::consumeInteger):
(WebCore::CSSPropertyParserHelpers::consumeLength):
(WebCore::CSSPropertyParserHelpers::consumePercent):
(WebCore::CSSPropertyParserHelpers::consumeAngle):
(WebCore::CSSPropertyParserHelpers::consumeTime):
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
(WebCore::CSSPropertyParserHelpers::consumeString):
(WebCore::CSSPropertyParserHelpers::consumeUrl):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
(WebCore::CSSPropertyParserHelpers::consumeCrossFade):
(WebCore::CSSPropertyParserHelpers::consumeImageSet):
(WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
* css/parser/MediaQueryParser.cpp:
(WebCore::MediaQueryParser::readFeatureValue):
* css/parser/SizesAttributeParser.cpp:
(WebCore::SizesAttributeParser::computeLength):
* css/parser/SizesAttributeParser.h:
* dom/StyledElement.cpp:
(WebCore::StyledElement::setInlineStyleProperty):
(WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
* dom/StyledElement.h:
* svg/SVGLengthValue.cpp:
(WebCore::SVGLengthValue::toCSSPrimitiveValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209758 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValuePool.cpp
Source/WebCore/css/CSSValuePool.h
Source/WebCore/css/MediaQueryExp.cpp
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/css/parser/CSSParserToken.cpp
Source/WebCore/css/parser/CSSParserToken.h
Source/WebCore/css/parser/CSSPropertyParser.cpp
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
Source/WebCore/css/parser/MediaQueryParser.cpp
Source/WebCore/css/parser/SizesAttributeParser.cpp
Source/WebCore/css/parser/SizesAttributeParser.h
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/dom/StyledElement.h
Source/WebCore/svg/SVGLengthValue.cpp

index 1aae9e2..3357507 100644 (file)
@@ -1,3 +1,94 @@
+2016-12-13  Dave Hyatt  <hyatt@apple.com>
+
+        [CSS Parser] Rename CSSPrimitiveValue::UnitTypes to CSSPrimitiveValue::UnitType
+        https://bugs.webkit.org/show_bug.cgi?id=165776
+
+        Reviewed by Zalan Bujtas.
+
+        * css/CSSCalculationValue.cpp:
+        (WebCore::unitCategory):
+        (WebCore::hasDoubleValue):
+        (WebCore::determineCategory):
+        (WebCore::CSSCalcExpressionNodeParser::parseValue):
+        * css/CSSCalculationValue.h:
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::isValidCSSUnitTypeForDoubleConversion):
+        (WebCore::isStringType):
+        (WebCore::CSSPrimitiveValue::unitCategory):
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::cleanup):
+        (WebCore::CSSPrimitiveValue::computeLengthDouble):
+        (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
+        (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
+        (WebCore::CSSPrimitiveValue::getFloatValue):
+        (WebCore::CSSPrimitiveValue::doubleValue):
+        (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
+        (WebCore::CSSPrimitiveValue::doubleValueInternal):
+        (WebCore::CSSPrimitiveValue::cloneForCSSOM):
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::isFontRelativeLength):
+        (WebCore::CSSPrimitiveValue::isLength):
+        (WebCore::CSSPrimitiveValue::isResolution):
+        (WebCore::CSSPrimitiveValue::createAllowingMarginQuirk):
+        * css/CSSValue.h:
+        * css/CSSValuePool.cpp:
+        (WebCore::CSSValuePool::createValue):
+        * css/CSSValuePool.h:
+        (WebCore::CSSValuePool::createValue):
+        * css/MediaQueryExp.cpp:
+        (WebCore::featureWithValidDensity):
+        (WebCore::MediaQueryExpression::MediaQueryExpression):
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::parseSimpleLength):
+        (WebCore::parseSimpleLengthValue):
+        (WebCore::parseColorIntOrPercentage):
+        (WebCore::fastParseColorInternal):
+        (WebCore::parseTransformTranslateArguments):
+        (WebCore::parseTransformNumberArguments):
+        * css/parser/CSSParserToken.cpp:
+        (WebCore::cssPrimitiveValueUnitFromTrie):
+        (WebCore::stringToUnitType):
+        (WebCore::CSSParserToken::CSSParserToken):
+        (WebCore::CSSParserToken::convertToPercentage):
+        * css/parser/CSSParserToken.h:
+        (WebCore::CSSParserToken::unitType):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::consumeTransformOrigin):
+        (WebCore::consumeCounter):
+        (WebCore::consumeAnimationName):
+        (WebCore::consumePerspective):
+        (WebCore::consumePositionLonghand):
+        (WebCore::consumeCounterContent):
+        (WebCore::consumeReflect):
+        (WebCore::consumeGridBreadth):
+        (WebCore::CSSPropertyParser::consumeFlex):
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
+        (WebCore::CSSPropertyParserHelpers::consumeInteger):
+        (WebCore::CSSPropertyParserHelpers::consumeLength):
+        (WebCore::CSSPropertyParserHelpers::consumePercent):
+        (WebCore::CSSPropertyParserHelpers::consumeAngle):
+        (WebCore::CSSPropertyParserHelpers::consumeTime):
+        (WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
+        (WebCore::CSSPropertyParserHelpers::consumeString):
+        (WebCore::CSSPropertyParserHelpers::consumeUrl):
+        (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
+        (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
+        (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
+        (WebCore::CSSPropertyParserHelpers::consumeImageSet):
+        (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
+        * css/parser/MediaQueryParser.cpp:
+        (WebCore::MediaQueryParser::readFeatureValue):
+        * css/parser/SizesAttributeParser.cpp:
+        (WebCore::SizesAttributeParser::computeLength):
+        * css/parser/SizesAttributeParser.h:
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::setInlineStyleProperty):
+        (WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
+        * dom/StyledElement.h:
+        * svg/SVGLengthValue.cpp:
+        (WebCore::SVGLengthValue::toCSSPrimitiveValue):
+
 2016-12-13  Eric Carlson  <eric.carlson@apple.com>
 
         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
index 934f10a..68cc292 100644 (file)
@@ -52,7 +52,7 @@ namespace WebCore {
 static RefPtr<CSSCalcExpressionNode> createCSS(const CalcExpressionNode&, const RenderStyle&);
 static RefPtr<CSSCalcExpressionNode> createCSS(const Length&, const RenderStyle&);
 
-static CalculationCategory unitCategory(CSSPrimitiveValue::UnitTypes type)
+static CalculationCategory unitCategory(CSSPrimitiveValue::UnitType type)
 {
     switch (type) {
     case CSSPrimitiveValue::CSS_NUMBER:
@@ -90,7 +90,7 @@ static CalculationCategory unitCategory(CSSPrimitiveValue::UnitTypes type)
     }
 }
 
-static bool hasDoubleValue(CSSPrimitiveValue::UnitTypes type)
+static bool hasDoubleValue(CSSPrimitiveValue::UnitType type)
 {
     switch (type) {
     case CSSPrimitiveValue::CSS_FR:
@@ -201,7 +201,7 @@ public:
         return adoptRef(*new CSSCalcPrimitiveValue(WTFMove(value), isInteger));
     }
 
-    static RefPtr<CSSCalcPrimitiveValue> create(double value, CSSPrimitiveValue::UnitTypes type, bool isInteger)
+    static RefPtr<CSSCalcPrimitiveValue> create(double value, CSSPrimitiveValue::UnitType type, bool isInteger)
     {
         if (std::isnan(value) || std::isinf(value))
             return nullptr;
@@ -281,14 +281,14 @@ private:
     }
 
     Type type() const final { return CssCalcPrimitiveValue; }
-    CSSPrimitiveValue::UnitTypes primitiveType() const final
+    CSSPrimitiveValue::UnitType primitiveType() const final
     {
-        return CSSPrimitiveValue::UnitTypes(m_value->primitiveType());
+        return CSSPrimitiveValue::UnitType(m_value->primitiveType());
     }
 
 private:
     explicit CSSCalcPrimitiveValue(Ref<CSSPrimitiveValue>&& value, bool isInteger)
-        : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitTypes)value->primitiveType()), isInteger)
+        : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitType)value->primitiveType()), isInteger)
         , m_value(WTFMove(value))
     {
     }
@@ -368,21 +368,21 @@ public:
 
         // Simplify numbers.
         if (leftCategory == CalcNumber && rightCategory == CalcNumber) {
-            CSSPrimitiveValue::UnitTypes evaluationType = CSSPrimitiveValue::CSS_NUMBER;
+            CSSPrimitiveValue::UnitType evaluationType = CSSPrimitiveValue::CSS_NUMBER;
             return CSSCalcPrimitiveValue::create(evaluateOperator(op, leftSide->doubleValue(), rightSide->doubleValue()), evaluationType, isInteger);
         }
 
         // Simplify addition and subtraction between same types.
         if (op == CalcAdd || op == CalcSubtract) {
             if (leftCategory == rightSide->category()) {
-                CSSPrimitiveValue::UnitTypes leftType = leftSide->primitiveType();
+                CSSPrimitiveValue::UnitType leftType = leftSide->primitiveType();
                 if (hasDoubleValue(leftType)) {
-                    CSSPrimitiveValue::UnitTypes rightType = rightSide->primitiveType();
+                    CSSPrimitiveValue::UnitType rightType = rightSide->primitiveType();
                     if (leftType == rightType)
                         return CSSCalcPrimitiveValue::create(evaluateOperator(op, leftSide->doubleValue(), rightSide->doubleValue()), leftType, isInteger);
                     CSSPrimitiveValue::UnitCategory leftUnitCategory = CSSPrimitiveValue::unitCategory(leftType);
                     if (leftUnitCategory != CSSPrimitiveValue::UOther && leftUnitCategory == CSSPrimitiveValue::unitCategory(rightType)) {
-                        CSSPrimitiveValue::UnitTypes canonicalType = CSSPrimitiveValue::canonicalUnitTypeForCategory(leftUnitCategory);
+                        CSSPrimitiveValue::UnitType canonicalType = CSSPrimitiveValue::canonicalUnitTypeForCategory(leftUnitCategory);
                         if (canonicalType != CSSPrimitiveValue::CSS_UNKNOWN) {
                             double leftValue = leftSide->doubleValue() * CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(leftType);
                             double rightValue = rightSide->doubleValue() * CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(rightType);
@@ -407,7 +407,7 @@ public:
             if (op == CalcDivide && !number)
                 return nullptr;
 
-            CSSPrimitiveValue::UnitTypes otherType = otherSide->primitiveType();
+            CSSPrimitiveValue::UnitType otherType = otherSide->primitiveType();
             if (hasDoubleValue(otherType))
                 return CSSCalcPrimitiveValue::create(evaluateOperator(op, otherSide->doubleValue(), number), otherType, isInteger);
         }
@@ -476,7 +476,7 @@ private:
 
     Type type() const final { return CssCalcBinaryOperation; }
 
-    CSSPrimitiveValue::UnitTypes primitiveType() const final
+    CSSPrimitiveValue::UnitType primitiveType() const final
     {
         switch (category()) {
         case CalcNumber:
@@ -488,7 +488,7 @@ private:
                 return m_rightSide->primitiveType();
             if (m_rightSide->category() == CalcNumber)
                 return m_leftSide->primitiveType();
-            CSSPrimitiveValue::UnitTypes leftType = m_leftSide->primitiveType();
+            CSSPrimitiveValue::UnitType leftType = m_leftSide->primitiveType();
             if (leftType == m_rightSide->primitiveType())
                 return leftType;
             return CSSPrimitiveValue::CSS_UNKNOWN;
@@ -593,7 +593,7 @@ private:
         if (!(token.type() == NumberToken || token.type() == PercentageToken || token.type() == DimensionToken))
             return false;
         
-        CSSPrimitiveValue::UnitTypes type = token.unitType();
+        CSSPrimitiveValue::UnitType type = token.unitType();
         if (unitCategory(type) == CalcOther)
             return false;
         
index 77310d0..23f9fdd 100644 (file)
@@ -66,7 +66,7 @@ public:
     virtual String customCSSText() const = 0;
     virtual bool equals(const CSSCalcExpressionNode& other) const { return m_category == other.m_category && m_isInteger == other.m_isInteger; }
     virtual Type type() const = 0;
-    virtual CSSPrimitiveValue::UnitTypes primitiveType() const = 0;
+    virtual CSSPrimitiveValue::UnitType primitiveType() const = 0;
 
     CalculationCategory category() const { return m_category; }
     bool isInteger() const { return m_isInteger; }
index f074acd..dbb39ca 100644 (file)
@@ -61,7 +61,7 @@ using namespace WTF;
 
 namespace WebCore {
 
-static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::UnitTypes unitType)
+static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::UnitType unitType)
 {
     switch (unitType) {
     case CSSPrimitiveValue::CSS_CALC:
@@ -134,7 +134,7 @@ static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit
 
 #if !ASSERT_DISABLED
 
-static inline bool isStringType(CSSPrimitiveValue::UnitTypes type)
+static inline bool isStringType(CSSPrimitiveValue::UnitType type)
 {
     switch (type) {
     case CSSPrimitiveValue::CSS_STRING:
@@ -202,7 +202,7 @@ static inline bool isStringType(CSSPrimitiveValue::UnitTypes type)
 
 #endif // !ASSERT_DISABLED
 
-CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValue::UnitTypes type)
+CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValue::UnitType type)
 {
     // Here we violate the spec (http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSPrimitiveValue) and allow conversions
     // between CSS_PX and relative lengths (see cssPixelsPerInch comment in CSSHelper.h for the topic treatment).
@@ -317,7 +317,7 @@ CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID)
     m_value.propertyID = propertyID;
 }
 
-CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type)
+CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitType type)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = type;
@@ -325,7 +325,7 @@ CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type)
     m_value.num = num;
 }
 
-CSSPrimitiveValue::CSSPrimitiveValue(const String& string, UnitTypes type)
+CSSPrimitiveValue::CSSPrimitiveValue(const String& string, UnitType type)
     : CSSValue(PrimitiveClass)
 {
     ASSERT(isStringType(type));
@@ -506,7 +506,7 @@ CSSPrimitiveValue::~CSSPrimitiveValue()
 
 void CSSPrimitiveValue::cleanup()
 {
-    auto type = static_cast<UnitTypes>(m_primitiveUnitType);
+    auto type = static_cast<UnitType>(m_primitiveUnitType);
     switch (type) {
     case CSS_STRING:
     case CSS_URI:
@@ -661,10 +661,10 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c
         // The multiplier and factor is applied to each value in the calc expression individually
         return m_value.calc->computeLengthPx(conversionData);
 
-    return computeNonCalcLengthDouble(conversionData, static_cast<UnitTypes>(primitiveType()), m_value.num);
+    return computeNonCalcLengthDouble(conversionData, static_cast<UnitType>(primitiveType()), m_value.num);
 }
 
-double CSSPrimitiveValue::computeNonCalcLengthDouble(const CSSToLengthConversionData& conversionData, UnitTypes primitiveType, double value)
+double CSSPrimitiveValue::computeNonCalcLengthDouble(const CSSToLengthConversionData& conversionData, UnitType primitiveType, double value)
 {
     double factor;
 
@@ -752,7 +752,7 @@ ExceptionOr<void> CSSPrimitiveValue::setFloatValue(unsigned short, double)
     return Exception { NO_MODIFICATION_ALLOWED_ERR };
 }
 
-double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(UnitTypes unitType)
+double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(UnitType unitType)
 {
     double factor = 1.0;
     // FIXME: the switch can be replaced by an array of scale factors.
@@ -806,13 +806,13 @@ double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(UnitTypes unitTy
 
 ExceptionOr<float> CSSPrimitiveValue::getFloatValue(unsigned short unitType) const
 {
-    auto result = doubleValueInternal(static_cast<UnitTypes>(unitType));
+    auto result = doubleValueInternal(static_cast<UnitType>(unitType));
     if (!result)
         return Exception { INVALID_ACCESS_ERR };
     return clampTo<float>(result.value());
 }
 
-double CSSPrimitiveValue::doubleValue(UnitTypes unitType) const
+double CSSPrimitiveValue::doubleValue(UnitType unitType) const
 {
     return doubleValueInternal(unitType).value_or(0);
 }
@@ -823,7 +823,7 @@ double CSSPrimitiveValue::doubleValue() const
 }
 
 
-CSSPrimitiveValue::UnitTypes CSSPrimitiveValue::canonicalUnitTypeForCategory(UnitCategory category)
+CSSPrimitiveValue::UnitType CSSPrimitiveValue::canonicalUnitTypeForCategory(UnitCategory category)
 {
     // The canonical unit type is chosen according to the way CSSParser::validUnit() chooses the default unit
     // in each category (based on unitflags).
@@ -849,19 +849,19 @@ CSSPrimitiveValue::UnitTypes CSSPrimitiveValue::canonicalUnitTypeForCategory(Uni
     }
 }
 
-std::optional<double> CSSPrimitiveValue::doubleValueInternal(UnitTypes requestedUnitType) const
+std::optional<double> CSSPrimitiveValue::doubleValueInternal(UnitType requestedUnitType) const
 {
-    if (!isValidCSSUnitTypeForDoubleConversion(static_cast<UnitTypes>(m_primitiveUnitType)) || !isValidCSSUnitTypeForDoubleConversion(requestedUnitType))
+    if (!isValidCSSUnitTypeForDoubleConversion(static_cast<UnitType>(m_primitiveUnitType)) || !isValidCSSUnitTypeForDoubleConversion(requestedUnitType))
         return std::nullopt;
 
-    UnitTypes sourceUnitType = static_cast<UnitTypes>(primitiveType());
+    UnitType sourceUnitType = static_cast<UnitType>(primitiveType());
     if (requestedUnitType == sourceUnitType || requestedUnitType == CSS_DIMENSION)
         return doubleValue();
 
     UnitCategory sourceCategory = unitCategory(sourceUnitType);
     ASSERT(sourceCategory != UOther);
 
-    UnitTypes targetUnitType = requestedUnitType;
+    UnitType targetUnitType = requestedUnitType;
     UnitCategory targetCategory = unitCategory(targetUnitType);
     ASSERT(targetCategory != UOther);
 
@@ -1183,7 +1183,7 @@ Ref<CSSPrimitiveValue> CSSPrimitiveValue::cloneForCSSOM() const
     case CSS_URI:
     case CSS_ATTR:
     case CSS_COUNTER_NAME:
-        result = CSSPrimitiveValue::create(m_value.string, static_cast<UnitTypes>(m_primitiveUnitType));
+        result = CSSPrimitiveValue::create(m_value.string, static_cast<UnitType>(m_primitiveUnitType));
         break;
     case CSS_FONT_FAMILY:
         result = CSSPrimitiveValue::create(*m_value.fontFamily);
@@ -1251,7 +1251,7 @@ Ref<CSSPrimitiveValue> CSSPrimitiveValue::cloneForCSSOM() const
     case CSS_DPCM:
 #endif
     case CSS_FR:
-        result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitTypes>(m_primitiveUnitType));
+        result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitType>(m_primitiveUnitType));
         break;
     case CSS_PROPERTY_ID:
         result = CSSPrimitiveValue::createIdentifier(m_value.propertyID);
index 3e4d91f..8ed0fcf 100644 (file)
@@ -75,7 +75,7 @@ template<> inline float roundForImpreciseConversion(double value)
 
 class CSSPrimitiveValue final : public CSSValue {
 public:
-    enum UnitTypes {
+    enum UnitType {
         CSS_UNKNOWN = 0,
         CSS_NUMBER = 1,
         CSS_PERCENTAGE = 2,
@@ -164,22 +164,22 @@ public:
 #endif
         UOther
     };
-    static UnitCategory unitCategory(UnitTypes);
+    static UnitCategory unitCategory(UnitType);
 
     bool isAngle() const;
     bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; }
     bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; }
     bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX && m_primitiveUnitType <= CSS_PC; }
-    static bool isFontRelativeLength(UnitTypes);
-    bool isFontRelativeLength() const { return isFontRelativeLength(static_cast<UnitTypes>(m_primitiveUnitType)); }
+    static bool isFontRelativeLength(UnitType);
+    bool isFontRelativeLength() const { return isFontRelativeLength(static_cast<UnitType>(m_primitiveUnitType)); }
     
-    bool isQuirkyEms() const { return primitiveType() == UnitTypes::CSS_QUIRKY_EMS; }
+    bool isQuirkyEms() const { return primitiveType() == UnitType::CSS_QUIRKY_EMS; }
 
-    static bool isViewportPercentageLength(UnitTypes type) { return type >= CSS_VW && type <= CSS_VMAX; }
-    bool isViewportPercentageLength() const { return isViewportPercentageLength(static_cast<UnitTypes>(m_primitiveUnitType)); }
+    static bool isViewportPercentageLength(UnitType type) { return type >= CSS_VW && type <= CSS_VMAX; }
+    bool isViewportPercentageLength() const { return isViewportPercentageLength(static_cast<UnitType>(m_primitiveUnitType)); }
 
-    static bool isLength(UnitTypes);
-    bool isLength() const { return isLength(static_cast<UnitTypes>(primitiveType())); }
+    static bool isLength(UnitType);
+    bool isLength() const { return isLength(static_cast<UnitType>(primitiveType())); }
     bool isNumber() const { return primitiveType() == CSS_NUMBER; }
     bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; }
     bool isPx() const { return primitiveType() == CSS_PX; }
@@ -202,8 +202,8 @@ public:
     bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; }
     bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; }
 
-    static bool isResolution(UnitTypes);
-    bool isResolution() const { return isResolution(static_cast<UnitTypes>(primitiveType())); }
+    static bool isResolution(UnitType);
+    bool isResolution() const { return isResolution(static_cast<UnitType>(primitiveType())); }
     bool isViewportPercentageWidth() const { return m_primitiveUnitType == CSS_VW; }
     bool isViewportPercentageHeight() const { return m_primitiveUnitType == CSS_VH; }
     bool isViewportPercentageMax() const { return m_primitiveUnitType == CSS_VMAX; }
@@ -214,8 +214,8 @@ public:
     static Ref<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) { return adoptRef(*new CSSPrimitiveValue(valueID)); }
     static Ref<CSSPrimitiveValue> createIdentifier(CSSPropertyID propertyID) { return adoptRef(*new CSSPrimitiveValue(propertyID)); }
 
-    static Ref<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
-    static Ref<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
+    static Ref<CSSPrimitiveValue> create(double value, UnitType type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
+    static Ref<CSSPrimitiveValue> create(const String& value, UnitType type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
     static Ref<CSSPrimitiveValue> create(const Length& value, const RenderStyle& style) { return adoptRef(*new CSSPrimitiveValue(value, style)); }
     static Ref<CSSPrimitiveValue> create(const LengthSize& value, const RenderStyle& style) { return adoptRef(*new CSSPrimitiveValue(value, style)); }
 
@@ -225,7 +225,7 @@ public:
     // The basic idea is that a stylesheet can use the value __qem (for quirky em) instead of em.
     // When the quirky value is used, if you're in quirks mode, the margin will collapse away
     // inside a table cell.
-    static Ref<CSSPrimitiveValue> createAllowingMarginQuirk(double value, UnitTypes);
+    static Ref<CSSPrimitiveValue> createAllowingMarginQuirk(double value, UnitType);
 
     ~CSSPrimitiveValue();
 
@@ -250,16 +250,16 @@ public:
 
     bool convertingToLengthRequiresNonNullStyle(int lengthConversion) const;
 
-    double doubleValue(UnitTypes) const;
+    double doubleValue(UnitType) const;
     double doubleValue() const;
 
-    template<typename T> inline T value(UnitTypes type) const { return clampTo<T>(doubleValue(type)); }
+    template<typename T> inline T value(UnitType type) const { return clampTo<T>(doubleValue(type)); }
     template<typename T> inline T value() const { return clampTo<T>(doubleValue()); }
 
-    float floatValue(UnitTypes type) const { return value<float>(type); }
+    float floatValue(UnitType type) const { return value<float>(type); }
     float floatValue() const { return value<float>(); }
 
-    int intValue(UnitTypes type) const { return value<int>(type); }
+    int intValue(UnitType type) const { return value<int>(type); }
     int intValue() const { return value<int>(); }
 
     WEBCORE_EXPORT String stringValue() const;
@@ -294,10 +294,10 @@ public:
 
     bool equals(const CSSPrimitiveValue&) const;
 
-    static UnitTypes canonicalUnitTypeForCategory(UnitCategory);
-    static double conversionToCanonicalUnitsScaleFactor(UnitTypes);
+    static UnitType canonicalUnitTypeForCategory(UnitCategory);
+    static double conversionToCanonicalUnitsScaleFactor(UnitType);
 
-    static double computeNonCalcLengthDouble(const CSSToLengthConversionData&, UnitTypes, double value);
+    static double computeNonCalcLengthDouble(const CSSToLengthConversionData&, UnitType, double value);
 
 #if COMPILER(MSVC)
     // FIXME: This should be private, but for some reason MSVC then fails to invoke it from LazyNeverDestroyed::construct.
@@ -314,8 +314,8 @@ private:
     CSSPrimitiveValue(const Length&);
     CSSPrimitiveValue(const Length&, const RenderStyle&);
     CSSPrimitiveValue(const LengthSize&, const RenderStyle&);
-    CSSPrimitiveValue(const String&, UnitTypes);
-    CSSPrimitiveValue(double, UnitTypes);
+    CSSPrimitiveValue(const String&, UnitType);
+    CSSPrimitiveValue(double, UnitType);
 
     template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h
     template<typename T> CSSPrimitiveValue(RefPtr<T>&&);
@@ -341,7 +341,7 @@ private:
     void init(RefPtr<DashboardRegion>&&); // FIXME: Dashboard region should not be a primitive value.
 #endif
 
-    std::optional<double> doubleValueInternal(UnitTypes targetUnitType) const;
+    std::optional<double> doubleValueInternal(UnitType targetUnitType) const;
 
     double computeLengthDouble(const CSSToLengthConversionData&) const;
 
@@ -377,7 +377,7 @@ inline bool CSSPrimitiveValue::isAngle() const
         || m_primitiveUnitType == CSS_TURN;
 }
 
-inline bool CSSPrimitiveValue::isFontRelativeLength(UnitTypes type)
+inline bool CSSPrimitiveValue::isFontRelativeLength(UnitType type)
 {
     return type == CSS_EMS
         || type == CSS_EXS
@@ -386,7 +386,7 @@ inline bool CSSPrimitiveValue::isFontRelativeLength(UnitTypes type)
         || type == CSS_QUIRKY_EMS;
 }
 
-inline bool CSSPrimitiveValue::isLength(UnitTypes type)
+inline bool CSSPrimitiveValue::isLength(UnitType type)
 {
     return (type >= CSS_EMS && type <= CSS_PC)
         || type == CSS_REMS
@@ -395,7 +395,7 @@ inline bool CSSPrimitiveValue::isLength(UnitTypes type)
         || type == CSS_QUIRKY_EMS;
 }
 
-inline bool CSSPrimitiveValue::isResolution(UnitTypes type)
+inline bool CSSPrimitiveValue::isResolution(UnitType type)
 {
     return type >= CSS_DPPX && type <= CSS_DPCM;
 }
@@ -405,7 +405,7 @@ template<typename T> inline Ref<CSSPrimitiveValue> CSSPrimitiveValue::create(T&&
     return adoptRef(*new CSSPrimitiveValue(std::forward<T>(value)));
 }
 
-inline Ref<CSSPrimitiveValue> CSSPrimitiveValue::createAllowingMarginQuirk(double value, UnitTypes type)
+inline Ref<CSSPrimitiveValue> CSSPrimitiveValue::createAllowingMarginQuirk(double value, UnitType type)
 {
     auto result = adoptRef(*new CSSPrimitiveValue(value, type));
     result->m_isQuirkValue = true;
index 2dfdd4f..c69735e 100644 (file)
@@ -252,7 +252,7 @@ protected:
     // to maximize struct packing.
 
     // CSSPrimitiveValue bits:
-    unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitTypes
+    unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitType
     mutable unsigned m_hasCachedCSSText : 1;
     unsigned m_isQuirkValue : 1;
 
index b2e2bb5..e67f4e2 100644 (file)
@@ -95,7 +95,7 @@ Ref<CSSPrimitiveValue> CSSValuePool::createColorValue(const Color& color)
     return *entry.iterator->value;
 }
 
-Ref<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitTypes type)
+Ref<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitType type)
 {
     ASSERT(std::isfinite(value));
 
index fbb21c5..a4259ec 100644 (file)
@@ -61,8 +61,8 @@ public:
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
     Ref<CSSPrimitiveValue> createColorValue(const Color&);
-    Ref<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
-    Ref<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
+    Ref<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitType);
+    Ref<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitType type) { return CSSPrimitiveValue::create(value, type); }
     Ref<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle& style) { return CSSPrimitiveValue::create(value, style); }
     Ref<CSSPrimitiveValue> createValue(const LengthSize& value, const RenderStyle& style) { return CSSPrimitiveValue::create(value, style); }
     template<typename T> static Ref<CSSPrimitiveValue> createValue(T&& value) { return CSSPrimitiveValue::create(std::forward<T>(value)); }
index e43a6ae..eef58a6 100644 (file)
@@ -56,7 +56,7 @@ static inline bool featureWithValidIdent(const AtomicString& mediaFeature)
 
 static inline bool featureWithValidDensity(const String& mediaFeature, const CSSParserToken& token)
 {
-    if (!CSSPrimitiveValue::isResolution(static_cast<CSSPrimitiveValue::UnitTypes>(token.unitType())) || token.numericValue() <= 0)
+    if (!CSSPrimitiveValue::isResolution(static_cast<CSSPrimitiveValue::UnitType>(token.unitType())) || token.numericValue() <= 0)
         return false;
     
     return mediaFeature == MediaFeatureNames::resolution
@@ -186,7 +186,7 @@ MediaQueryExpression::MediaQueryExpression(const String& feature, const Vector<C
                 || featureWithValidPositiveLength(m_mediaFeature, token)) {
                 // Media features that must have non-negative <density>, ie. dppx, dpi or dpcm,
                 // or Media features that must have non-negative <length> or number value.
-                m_value = CSSPrimitiveValue::create(token.numericValue(), (CSSPrimitiveValue::UnitTypes) token.unitType());
+                m_value = CSSPrimitiveValue::create(token.numericValue(), (CSSPrimitiveValue::UnitType) token.unitType());
                 m_isValid = true;
             } else if (featureWithPositiveInteger(m_mediaFeature, token)
                 || featureWithPositiveNumber(m_mediaFeature, token)
@@ -194,7 +194,7 @@ MediaQueryExpression::MediaQueryExpression(const String& feature, const Vector<C
                 // Media features that must have non-negative integer value,
                 // or media features that must have non-negative number value,
                 // or media features that must have (0|1) value.
-                m_value = CSSPrimitiveValue::create(token.numericValue(), CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
+                m_value = CSSPrimitiveValue::create(token.numericValue(), CSSPrimitiveValue::UnitType::CSS_NUMBER);
                 m_isValid = true;
             }
         }
index 96f2c6b..0a760ac 100644 (file)
@@ -101,14 +101,14 @@ static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acce
 }
 
 template <typename CharacterType>
-static inline bool parseSimpleLength(const CharacterType* characters, unsigned length, CSSPrimitiveValue::UnitTypes& unit, double& number)
+static inline bool parseSimpleLength(const CharacterType* characters, unsigned length, CSSPrimitiveValue::UnitType& unit, double& number)
 {
     if (length > 2 && (characters[length - 2] | 0x20) == 'p' && (characters[length - 1] | 0x20) == 'x') {
         length -= 2;
-        unit = CSSPrimitiveValue::UnitTypes::CSS_PX;
+        unit = CSSPrimitiveValue::UnitType::CSS_PX;
     } else if (length > 1 && characters[length - 1] == '%') {
         length -= 1;
-        unit = CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE;
+        unit = CSSPrimitiveValue::UnitType::CSS_PERCENTAGE;
     }
 
     // We rely on charactersToDouble for validation as well. The function
@@ -132,7 +132,7 @@ static RefPtr<CSSValue> parseSimpleLengthValue(CSSPropertyID propertyId, const S
 
     unsigned length = string.length();
     double number;
-    CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::UnitTypes::CSS_NUMBER;
+    CSSPrimitiveValue::UnitType unit = CSSPrimitiveValue::UnitType::CSS_NUMBER;
 
     if (string.is8Bit()) {
         if (!parseSimpleLength(string.characters8(), length, unit, number))
@@ -142,10 +142,10 @@ static RefPtr<CSSValue> parseSimpleLengthValue(CSSPropertyID propertyId, const S
             return nullptr;
     }
 
-    if (unit == CSSPrimitiveValue::UnitTypes::CSS_NUMBER) {
+    if (unit == CSSPrimitiveValue::UnitType::CSS_NUMBER) {
         if (number && cssParserMode != SVGAttributeMode)
             return nullptr;
-        unit = CSSPrimitiveValue::UnitTypes::CSS_PX;
+        unit = CSSPrimitiveValue::UnitType::CSS_PX;
     }
 
     if (number < 0 && !acceptsNegativeNumbers)
@@ -256,7 +256,7 @@ static int parseDouble(const CharacterType* string, const CharacterType* end, co
 }
 
 template <typename CharacterType>
-static bool parseColorIntOrPercentage(const CharacterType*& string, const CharacterType* end, const char terminator, CSSPrimitiveValue::UnitTypes& expect, int& value)
+static bool parseColorIntOrPercentage(const CharacterType*& string, const CharacterType* end, const char terminator, CSSPrimitiveValue::UnitType& expect, int& value)
 {
     const CharacterType* current = string;
     double localValue = 0;
@@ -284,7 +284,7 @@ static bool parseColorIntOrPercentage(const CharacterType*& string, const Charac
     if (current == end)
         return false;
 
-    if (expect == CSSPrimitiveValue::UnitTypes::CSS_NUMBER && (*current == '.' || *current == '%'))
+    if (expect == CSSPrimitiveValue::UnitType::CSS_NUMBER && (*current == '.' || *current == '%'))
         return false;
 
     if (*current == '.') {
@@ -300,18 +300,18 @@ static bool parseColorIntOrPercentage(const CharacterType*& string, const Charac
         localValue += percentage;
     }
 
-    if (expect == CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE && *current != '%')
+    if (expect == CSSPrimitiveValue::UnitType::CSS_PERCENTAGE && *current != '%')
         return false;
 
     if (*current == '%') {
-        expect = CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE;
+        expect = CSSPrimitiveValue::UnitType::CSS_PERCENTAGE;
         localValue = localValue / 100.0 * 256.0;
         // Clamp values at 255 for percentages over 100%
         if (localValue > 255)
             localValue = 255;
         current++;
     } else {
-        expect = CSSPrimitiveValue::UnitTypes::CSS_NUMBER;
+        expect = CSSPrimitiveValue::UnitType::CSS_NUMBER;
     }
 
     while (current != end && isHTMLSpace<CharacterType>(*current))
@@ -416,7 +416,7 @@ static inline bool mightBeRGB(const CharacterType* characters, unsigned length)
 template <typename CharacterType>
 static Color fastParseColorInternal(const CharacterType* characters, unsigned length, bool quirksMode)
 {
-    CSSPrimitiveValue::UnitTypes expect = CSSPrimitiveValue::UnitTypes::CSS_UNKNOWN;
+    CSSPrimitiveValue::UnitType expect = CSSPrimitiveValue::UnitType::CSS_UNKNOWN;
 
     if (length >= 4 && characters[0] == '#') {
         RGBA32 rgb;
@@ -1059,13 +1059,13 @@ static bool parseTransformTranslateArguments(CharType*& pos, CharType* end, unsi
         if (delimiter == notFound)
             return false;
         unsigned argumentLength = static_cast<unsigned>(delimiter);
-        CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::UnitTypes::CSS_NUMBER;
+        CSSPrimitiveValue::UnitType unit = CSSPrimitiveValue::UnitType::CSS_NUMBER;
         double number;
         if (!parseSimpleLength(pos, argumentLength, unit, number))
             return false;
-        if (unit != CSSPrimitiveValue::UnitTypes::CSS_PX && (number || unit != CSSPrimitiveValue::UnitTypes::CSS_NUMBER))
+        if (unit != CSSPrimitiveValue::UnitType::CSS_PX && (number || unit != CSSPrimitiveValue::UnitType::CSS_NUMBER))
             return false;
-        transformValue->append(CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitTypes::CSS_PX));
+        transformValue->append(CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitType::CSS_PX));
         pos += argumentLength + 1;
         --expectedCount;
     }
@@ -1084,7 +1084,7 @@ static bool parseTransformNumberArguments(CharType*& pos, CharType* end, unsigne
         double number = charactersToDouble(pos, argumentLength, &ok);
         if (!ok)
             return false;
-        transformValue->append(CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitTypes::CSS_NUMBER));
+        transformValue->append(CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitType::CSS_NUMBER));
         pos += argumentLength + 1;
         --expectedCount;
     }
index 992d04e..3e95b5a 100644 (file)
@@ -40,7 +40,7 @@
 namespace WebCore {
 
 template<typename CharacterType>
-CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType* data, unsigned length)
+CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* data, unsigned length)
 {
     ASSERT(data);
     ASSERT(length);
@@ -48,7 +48,7 @@ CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType*
     case 1:
         switch (toASCIILower(data[0])) {
         case 's':
-            return CSSPrimitiveValue::UnitTypes::CSS_S;
+            return CSSPrimitiveValue::UnitType::CSS_S;
         }
         break;
     case 2:
@@ -56,55 +56,55 @@ CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType*
         case 'c':
             switch (toASCIILower(data[1])) {
             case 'h':
-                return CSSPrimitiveValue::UnitTypes::CSS_CHS;
+                return CSSPrimitiveValue::UnitType::CSS_CHS;
             case 'm':
-                return CSSPrimitiveValue::UnitTypes::CSS_CM;
+                return CSSPrimitiveValue::UnitType::CSS_CM;
             }
             break;
         case 'e':
             switch (toASCIILower(data[1])) {
             case 'm':
-                return CSSPrimitiveValue::UnitTypes::CSS_EMS;
+                return CSSPrimitiveValue::UnitType::CSS_EMS;
             case 'x':
-                return CSSPrimitiveValue::UnitTypes::CSS_EXS;
+                return CSSPrimitiveValue::UnitType::CSS_EXS;
             }
             break;
         case 'f':
             if (toASCIILower(data[1]) == 'r')
-                return CSSPrimitiveValue::UnitTypes::CSS_FR;
+                return CSSPrimitiveValue::UnitType::CSS_FR;
             break;
         case 'h':
             if (toASCIILower(data[1]) == 'z')
-                return CSSPrimitiveValue::UnitTypes::CSS_HZ;
+                return CSSPrimitiveValue::UnitType::CSS_HZ;
             break;
         case 'i':
             if (toASCIILower(data[1]) == 'n')
-                return CSSPrimitiveValue::UnitTypes::CSS_IN;
+                return CSSPrimitiveValue::UnitType::CSS_IN;
             break;
         case 'm':
             switch (toASCIILower(data[1])) {
             case 'm':
-                return CSSPrimitiveValue::UnitTypes::CSS_MM;
+                return CSSPrimitiveValue::UnitType::CSS_MM;
             case 's':
-                return CSSPrimitiveValue::UnitTypes::CSS_MS;
+                return CSSPrimitiveValue::UnitType::CSS_MS;
             }
             break;
         case 'p':
             switch (toASCIILower(data[1])) {
             case 'c':
-                return CSSPrimitiveValue::UnitTypes::CSS_PC;
+                return CSSPrimitiveValue::UnitType::CSS_PC;
             case 't':
-                return CSSPrimitiveValue::UnitTypes::CSS_PT;
+                return CSSPrimitiveValue::UnitType::CSS_PT;
             case 'x':
-                return CSSPrimitiveValue::UnitTypes::CSS_PX;
+                return CSSPrimitiveValue::UnitType::CSS_PX;
             }
             break;
         case 'v':
             switch (toASCIILower(data[1])) {
             case 'h':
-                return CSSPrimitiveValue::UnitTypes::CSS_VH;
+                return CSSPrimitiveValue::UnitType::CSS_VH;
             case 'w':
-                return CSSPrimitiveValue::UnitTypes::CSS_VW;
+                return CSSPrimitiveValue::UnitType::CSS_VW;
             }
             break;
         }
@@ -115,27 +115,27 @@ CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType*
             switch (toASCIILower(data[1])) {
             case 'e':
                 if (toASCIILower(data[2]) == 'g')
-                    return CSSPrimitiveValue::UnitTypes::CSS_DEG;
+                    return CSSPrimitiveValue::UnitType::CSS_DEG;
                 break;
             case 'p':
                 if (toASCIILower(data[2]) == 'i')
-                    return CSSPrimitiveValue::UnitTypes::CSS_DPI;
+                    return CSSPrimitiveValue::UnitType::CSS_DPI;
                 break;
             }
         break;
         case 'k':
             if (toASCIILower(data[1]) == 'h' && toASCIILower(data[2]) == 'z')
-                return CSSPrimitiveValue::UnitTypes::CSS_KHZ;
+                return CSSPrimitiveValue::UnitType::CSS_KHZ;
             break;
         case 'r':
             switch (toASCIILower(data[1])) {
             case 'a':
                 if (toASCIILower(data[2]) == 'd')
-                    return CSSPrimitiveValue::UnitTypes::CSS_RAD;
+                    return CSSPrimitiveValue::UnitType::CSS_RAD;
                 break;
             case 'e':
                 if (toASCIILower(data[2]) == 'm')
-                    return CSSPrimitiveValue::UnitTypes::CSS_REMS;
+                    return CSSPrimitiveValue::UnitType::CSS_REMS;
                 break;
             }
         break;
@@ -149,11 +149,11 @@ CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType*
                 switch (toASCIILower(data[2])) {
                 case 'c':
                     if (toASCIILower(data[3]) == 'm')
-                        return CSSPrimitiveValue::UnitTypes::CSS_DPCM;
+                        return CSSPrimitiveValue::UnitType::CSS_DPCM;
                     break;
                 case 'p':
                     if (toASCIILower(data[3]) == 'x')
-                        return CSSPrimitiveValue::UnitTypes::CSS_DPPX;
+                        return CSSPrimitiveValue::UnitType::CSS_DPPX;
                     break;
                 }
             break;
@@ -161,11 +161,11 @@ CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType*
         break;
         case 'g':
             if (toASCIILower(data[1]) == 'r' && toASCIILower(data[2]) == 'a' && toASCIILower(data[3]) == 'd')
-                return CSSPrimitiveValue::UnitTypes::CSS_GRAD;
+                return CSSPrimitiveValue::UnitType::CSS_GRAD;
             break;
         case 't':
             if (toASCIILower(data[1]) == 'u' && toASCIILower(data[2]) == 'r' && toASCIILower(data[3]) == 'n')
-                return CSSPrimitiveValue::UnitTypes::CSS_TURN;
+                return CSSPrimitiveValue::UnitType::CSS_TURN;
             break;
         case 'v':
             switch (toASCIILower(data[1])) {
@@ -173,11 +173,11 @@ CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType*
                 switch (toASCIILower(data[2])) {
                 case 'a':
                     if (toASCIILower(data[3]) == 'x')
-                        return CSSPrimitiveValue::UnitTypes::CSS_VMAX;
+                        return CSSPrimitiveValue::UnitType::CSS_VMAX;
                     break;
                 case 'i':
                     if (toASCIILower(data[3]) == 'n')
-                        return CSSPrimitiveValue::UnitTypes::CSS_VMIN;
+                        return CSSPrimitiveValue::UnitType::CSS_VMIN;
                     break;
                 }
                 break;
@@ -189,15 +189,15 @@ CSSPrimitiveValue::UnitTypes cssPrimitiveValueUnitFromTrie(const CharacterType*
         switch (toASCIILower(data[0])) {
         case '_':
             if (toASCIILower(data[1]) == '_' && toASCIILower(data[2]) == 'q' && toASCIILower(data[3]) == 'e' && toASCIILower(data[4]) == 'm')
-                return CSSPrimitiveValue::UnitTypes::CSS_QUIRKY_EMS;
+                return CSSPrimitiveValue::UnitType::CSS_QUIRKY_EMS;
             break;
         }
         break;
     }
-    return CSSPrimitiveValue::UnitTypes::CSS_UNKNOWN;
+    return CSSPrimitiveValue::UnitType::CSS_UNKNOWN;
 }
 
-static CSSPrimitiveValue::UnitTypes stringToUnitType(StringView stringView)
+static CSSPrimitiveValue::UnitType stringToUnitType(StringView stringView)
 {
     if (stringView.is8Bit())
         return cssPrimitiveValueUnitFromTrie(stringView.characters8(), stringView.length());
@@ -232,7 +232,7 @@ CSSParserToken::CSSParserToken(CSSParserTokenType type, double numericValue, Num
     , m_blockType(NotBlock)
     , m_numericValueType(numericValueType)
     , m_numericSign(sign)
-    , m_unit(static_cast<unsigned>(CSSPrimitiveValue::UnitTypes::CSS_NUMBER))
+    , m_unit(static_cast<unsigned>(CSSPrimitiveValue::UnitType::CSS_NUMBER))
 {
     ASSERT(type == NumberToken);
     m_numericValue = numericValue;
@@ -267,7 +267,7 @@ void CSSParserToken::convertToPercentage()
 {
     ASSERT(m_type == NumberToken);
     m_type = PercentageToken;
-    m_unit = static_cast<unsigned>(CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE);
+    m_unit = static_cast<unsigned>(CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
 }
 
 UChar CSSParserToken::delimiter() const
index e819755..7870c00 100644 (file)
@@ -127,7 +127,7 @@ public:
     double numericValue() const;
     HashTokenType getHashTokenType() const { ASSERT(m_type == HashToken); return m_hashTokenType; }
     BlockType getBlockType() const { return static_cast<BlockType>(m_blockType); }
-    CSSPrimitiveValue::UnitTypes unitType() const { return static_cast<CSSPrimitiveValue::UnitTypes>(m_unit); }
+    CSSPrimitiveValue::UnitType unitType() const { return static_cast<CSSPrimitiveValue::UnitType>(m_unit); }
     UChar32 unicodeRangeStart() const { ASSERT(m_type == UnicodeRangeToken); return m_unicodeRange.start; }
     UChar32 unicodeRangeEnd() const { ASSERT(m_type == UnicodeRangeToken); return m_unicodeRange.end; }
     CSSValueID id() const;
@@ -152,7 +152,7 @@ private:
     unsigned m_blockType : 2; // BlockType
     unsigned m_numericValueType : 1; // NumericValueType
     unsigned m_numericSign : 2; // NumericSign
-    unsigned m_unit : 7; // CSSPrimitiveValue::UnitTypes
+    unsigned m_unit : 7; // CSSPrimitiveValue::UnitType
 
     bool valueDataCharRawEqual(const CSSParserToken& other) const;
 
index 5808de7..5f52faf 100644 (file)
@@ -386,7 +386,7 @@ bool CSSPropertyParser::consumeTransformOrigin(bool important)
             return false;
         addProperty(CSSPropertyTransformOriginX, CSSPropertyTransformOrigin, resultX.releaseNonNull(), important);
         addProperty(CSSPropertyTransformOriginY, CSSPropertyTransformOrigin, resultY.releaseNonNull(), important);
-        addProperty(CSSPropertyTransformOriginZ, CSSPropertyTransformOrigin, resultZ ? resultZ.releaseNonNull() : CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::UnitTypes::CSS_PX), important, !hasZ);
+        addProperty(CSSPropertyTransformOriginZ, CSSPropertyTransformOrigin, resultZ ? resultZ.releaseNonNull() : CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::UnitType::CSS_PX), important, !hasZ);
         
         return true;
     }
@@ -1041,7 +1041,7 @@ static RefPtr<CSSValue> consumeCounter(CSSParserTokenRange& range, int defaultVa
         int i = defaultValue;
         if (RefPtr<CSSPrimitiveValue> counterValue = consumeInteger(range))
             i = counterValue->intValue();
-        list->append(createPrimitiveValuePair(counterName.releaseNonNull(), CSSPrimitiveValue::create(i, CSSPrimitiveValue::UnitTypes::CSS_NUMBER), Pair::IdenticalValueEncoding::Coalesce));
+        list->append(createPrimitiveValuePair(counterName.releaseNonNull(), CSSPrimitiveValue::create(i, CSSPrimitiveValue::UnitType::CSS_NUMBER), Pair::IdenticalValueEncoding::Coalesce));
     } while (!range.atEnd());
     return list;
 }
@@ -1293,7 +1293,7 @@ static RefPtr<CSSValue> consumeAnimationName(CSSParserTokenRange& range)
         if (equalIgnoringASCIICase(token.value(), "none"))
             return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
         // FIXME-NEWPARSER: Want to use a CSSCustomIdentValue here eventually.
-        return CSSValuePool::singleton().createValue(token.value().toString(), CSSPrimitiveValue::UnitTypes::CSS_STRING);
+        return CSSValuePool::singleton().createValue(token.value().toString(), CSSPrimitiveValue::UnitType::CSS_STRING);
     }
 
     return consumeCustomIdent(range);
@@ -1751,7 +1751,7 @@ static bool consumePerspective(CSSParserTokenRange& args, CSSParserMode cssParse
         double perspective;
         if (!consumeNumberRaw(args, perspective) || perspective < 0)
             return false;
-        parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::UnitTypes::CSS_PX);
+        parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::UnitType::CSS_PX);
     }
     if (!parsedValue)
         return false;
@@ -1937,7 +1937,7 @@ static RefPtr<CSSPrimitiveValue> consumePositionLonghand(CSSParserTokenRange& ra
         else
             return nullptr;
         range.consumeIncludingWhitespace();
-        return CSSPrimitiveValue::create(percent, CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE);
+        return CSSPrimitiveValue::create(percent, CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
     }
     return consumeLengthOrPercent(range, cssParserMode, ValueRangeAll);
 }
@@ -2160,11 +2160,11 @@ static RefPtr<CSSValue> consumeCounterContent(CSSParserTokenRange args, bool cou
 
     RefPtr<CSSPrimitiveValue> separator;
     if (!counters)
-        separator = CSSPrimitiveValue::create(String(), CSSPrimitiveValue::UnitTypes::CSS_STRING);
+        separator = CSSPrimitiveValue::create(String(), CSSPrimitiveValue::UnitType::CSS_STRING);
     else {
         if (!consumeCommaIncludingWhitespace(args) || args.peek().type() != StringToken)
             return nullptr;
-        separator = CSSPrimitiveValue::create(args.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitTypes::CSS_STRING);
+        separator = CSSPrimitiveValue::create(args.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitType::CSS_STRING);
     }
 
     RefPtr<CSSPrimitiveValue> listStyle;
@@ -2222,7 +2222,7 @@ static RefPtr<CSSPrimitiveValue> consumePerspective(CSSParserTokenRange& range,
         double perspective;
         if (!consumeNumberRaw(range, perspective))
             return nullptr;
-        parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::UnitTypes::CSS_PX);
+        parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::UnitType::CSS_PX);
     }
     if (parsedValue && (parsedValue->isCalculated() || parsedValue->doubleValue() > 0))
         return parsedValue;
@@ -2782,7 +2782,7 @@ static RefPtr<CSSValue> consumeReflect(CSSParserTokenRange& range, const CSSPars
 
     RefPtr<CSSPrimitiveValue> offset;
     if (range.atEnd())
-        offset = CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::UnitTypes::CSS_PX);
+        offset = CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::UnitType::CSS_PX);
     else {
         offset = consumeLengthOrPercent(range, context.mode, ValueRangeAll, UnitlessQuirk::Forbid);
         if (!offset)
@@ -3203,10 +3203,10 @@ static RefPtr<CSSPrimitiveValue> consumeGridBreadth(CSSParserTokenRange& range,
     const CSSParserToken& token = range.peek();
     if (identMatches<CSSValueWebkitMinContent, CSSValueWebkitMaxContent, CSSValueAuto>(token.id()))
         return consumeIdent(range);
-    if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue::UnitTypes::CSS_FR) {
+    if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue::UnitType::CSS_FR) {
         if (range.peek().numericValue() < 0)
             return nullptr;
-        return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitTypes::CSS_FR);
+        return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitType::CSS_FR);
     }
     return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
 }
@@ -4676,7 +4676,7 @@ bool CSSPropertyParser::consumeFlex(bool important)
                 else if (flexShrink == unsetValue)
                     flexShrink = num;
                 else if (!num) // flex only allows a basis of 0 (sans units) if flex-grow and flex-shrink values have already been set.
-                    flexBasis = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitTypes::CSS_PX);
+                    flexBasis = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::CSS_PX);
                 else
                     return false;
             } else if (!flexBasis) {
@@ -4695,13 +4695,13 @@ bool CSSPropertyParser::consumeFlex(bool important)
         if (flexShrink == unsetValue)
             flexShrink = 1;
         if (!flexBasis)
-            flexBasis = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitTypes::CSS_PX);
+            flexBasis = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::CSS_PX);
     }
 
     if (!m_range.atEnd())
         return false;
-    addProperty(CSSPropertyFlexGrow, CSSPropertyFlex, CSSPrimitiveValue::create(clampTo<float>(flexGrow), CSSPrimitiveValue::UnitTypes::CSS_NUMBER), important);
-    addProperty(CSSPropertyFlexShrink, CSSPropertyFlex, CSSPrimitiveValue::create(clampTo<float>(flexShrink), CSSPrimitiveValue::UnitTypes::CSS_NUMBER), important);
+    addProperty(CSSPropertyFlexGrow, CSSPropertyFlex, CSSPrimitiveValue::create(clampTo<float>(flexGrow), CSSPrimitiveValue::UnitType::CSS_NUMBER), important);
+    addProperty(CSSPropertyFlexShrink, CSSPropertyFlex, CSSPrimitiveValue::create(clampTo<float>(flexShrink), CSSPrimitiveValue::UnitType::CSS_NUMBER), important);
     addProperty(CSSPropertyFlexBasis, CSSPropertyFlex, flexBasis.releaseNonNull(), important);
     return true;
 }
index 58d387c..7977709 100644 (file)
@@ -100,7 +100,7 @@ public:
         if (!m_calcValue)
             return nullptr;
         m_sourceRange = m_range;
-        return CSSValuePool::singleton().createValue(m_calcValue->doubleValue(), CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
+        return CSSValuePool::singleton().createValue(m_calcValue->doubleValue(), CSSPrimitiveValue::UnitType::CSS_NUMBER);
     }
 
     bool consumeNumberRaw(double& result)
@@ -135,7 +135,7 @@ RefPtr<CSSPrimitiveValue> consumeInteger(CSSParserTokenRange& range, double mini
     if (token.type() == NumberToken) {
         if (token.numericValueType() == NumberValueType || token.numericValue() < minimumValue)
             return nullptr;
-        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
+        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitType::CSS_NUMBER);
     }
     CalcParser calcParser(range);
     if (const CSSCalcValue* calculation = calcParser.value()) {
@@ -210,24 +210,24 @@ RefPtr<CSSPrimitiveValue> consumeLength(CSSParserTokenRange& range, CSSParserMod
     const CSSParserToken& token = range.peek();
     if (token.type() == DimensionToken) {
         switch (token.unitType()) {
-        case CSSPrimitiveValue::UnitTypes::CSS_QUIRKY_EMS:
+        case CSSPrimitiveValue::UnitType::CSS_QUIRKY_EMS:
             if (cssParserMode != UASheetMode)
                 return nullptr;
             FALLTHROUGH;
-        case CSSPrimitiveValue::UnitTypes::CSS_EMS:
-        case CSSPrimitiveValue::UnitTypes::CSS_REMS:
-        case CSSPrimitiveValue::UnitTypes::CSS_CHS:
-        case CSSPrimitiveValue::UnitTypes::CSS_EXS:
-        case CSSPrimitiveValue::UnitTypes::CSS_PX:
-        case CSSPrimitiveValue::UnitTypes::CSS_CM:
-        case CSSPrimitiveValue::UnitTypes::CSS_MM:
-        case CSSPrimitiveValue::UnitTypes::CSS_IN:
-        case CSSPrimitiveValue::UnitTypes::CSS_PT:
-        case CSSPrimitiveValue::UnitTypes::CSS_PC:
-        case CSSPrimitiveValue::UnitTypes::CSS_VW:
-        case CSSPrimitiveValue::UnitTypes::CSS_VH:
-        case CSSPrimitiveValue::UnitTypes::CSS_VMIN:
-        case CSSPrimitiveValue::UnitTypes::CSS_VMAX:
+        case CSSPrimitiveValue::UnitType::CSS_EMS:
+        case CSSPrimitiveValue::UnitType::CSS_REMS:
+        case CSSPrimitiveValue::UnitType::CSS_CHS:
+        case CSSPrimitiveValue::UnitType::CSS_EXS:
+        case CSSPrimitiveValue::UnitType::CSS_PX:
+        case CSSPrimitiveValue::UnitType::CSS_CM:
+        case CSSPrimitiveValue::UnitType::CSS_MM:
+        case CSSPrimitiveValue::UnitType::CSS_IN:
+        case CSSPrimitiveValue::UnitType::CSS_PT:
+        case CSSPrimitiveValue::UnitType::CSS_PC:
+        case CSSPrimitiveValue::UnitType::CSS_VW:
+        case CSSPrimitiveValue::UnitType::CSS_VH:
+        case CSSPrimitiveValue::UnitType::CSS_VMIN:
+        case CSSPrimitiveValue::UnitType::CSS_VMAX:
             break;
         default:
             return nullptr;
@@ -242,7 +242,7 @@ RefPtr<CSSPrimitiveValue> consumeLength(CSSParserTokenRange& range, CSSParserMod
             return nullptr;
         if (std::isinf(token.numericValue()))
             return nullptr;
-        CSSPrimitiveValue::UnitTypes unitType = CSSPrimitiveValue::UnitTypes::CSS_PX;
+        CSSPrimitiveValue::UnitType unitType = CSSPrimitiveValue::UnitType::CSS_PX;
         return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), unitType);
     }
     CalcParser calcParser(range, valueRange);
@@ -257,7 +257,7 @@ RefPtr<CSSPrimitiveValue> consumePercent(CSSParserTokenRange& range, ValueRange
     if (token.type() == PercentageToken) {
         if ((valueRange == ValueRangeNonNegative && token.numericValue() < 0) || std::isinf(token.numericValue()))
             return nullptr;
-        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE);
+        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
     }
     CalcParser calcParser(range, valueRange);
     if (const CSSCalcValue* calculation = calcParser.value()) {
@@ -301,17 +301,17 @@ RefPtr<CSSPrimitiveValue> consumeAngle(CSSParserTokenRange& range, CSSParserMode
     const CSSParserToken& token = range.peek();
     if (token.type() == DimensionToken) {
         switch (token.unitType()) {
-        case CSSPrimitiveValue::UnitTypes::CSS_DEG:
-        case CSSPrimitiveValue::UnitTypes::CSS_RAD:
-        case CSSPrimitiveValue::UnitTypes::CSS_GRAD:
-        case CSSPrimitiveValue::UnitTypes::CSS_TURN:
+        case CSSPrimitiveValue::UnitType::CSS_DEG:
+        case CSSPrimitiveValue::UnitType::CSS_RAD:
+        case CSSPrimitiveValue::UnitType::CSS_GRAD:
+        case CSSPrimitiveValue::UnitType::CSS_TURN:
             return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), token.unitType());
         default:
             return nullptr;
         }
     }
     if (token.type() == NumberToken && shouldAcceptUnitlessValue(token.numericValue(), cssParserMode, unitless)) {
-        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitTypes::CSS_DEG);
+        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitType::CSS_DEG);
     }
 
     CalcParser calcParser(range, ValueRangeAll);
@@ -325,14 +325,14 @@ RefPtr<CSSPrimitiveValue> consumeAngle(CSSParserTokenRange& range, CSSParserMode
 RefPtr<CSSPrimitiveValue> consumeTime(CSSParserTokenRange& range, CSSParserMode cssParserMode, ValueRange valueRange, UnitlessQuirk unitless)
 {
     const CSSParserToken& token = range.peek();
-    CSSPrimitiveValue::UnitTypes unit = token.unitType();
+    CSSPrimitiveValue::UnitType unit = token.unitType();
     bool acceptUnitless = token.type() == NumberToken && shouldAcceptUnitlessValue(token.numericValue(), cssParserMode, unitless);
     if (acceptUnitless)
-        unit = CSSPrimitiveValue::UnitTypes::CSS_MS;
+        unit = CSSPrimitiveValue::UnitType::CSS_MS;
     if (token.type() == DimensionToken || acceptUnitless) {
         if (valueRange == ValueRangeNonNegative && token.numericValue() < 0)
             return nullptr;
-        if (unit == CSSPrimitiveValue::UnitTypes::CSS_MS || unit == CSSPrimitiveValue::UnitTypes::CSS_S)
+        if (unit == CSSPrimitiveValue::UnitType::CSS_MS || unit == CSSPrimitiveValue::UnitType::CSS_S)
             return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), unit);
         return nullptr;
     }
@@ -365,14 +365,14 @@ RefPtr<CSSPrimitiveValue> consumeCustomIdent(CSSParserTokenRange& range)
 {
     if (range.peek().type() != IdentToken || isCSSWideKeyword(range.peek().id()))
         return nullptr;
-    return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitTypes::CSS_STRING);
+    return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitType::CSS_STRING);
 }
 
 RefPtr<CSSPrimitiveValue> consumeString(CSSParserTokenRange& range)
 {
     if (range.peek().type() != StringToken)
         return nullptr;
-    return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitTypes::CSS_STRING);
+    return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitType::CSS_STRING);
 }
 
 StringView consumeUrlAsStringView(CSSParserTokenRange& range)
@@ -402,7 +402,7 @@ RefPtr<CSSPrimitiveValue> consumeUrl(CSSParserTokenRange& range)
     StringView url = consumeUrlAsStringView(range);
     if (url.isNull())
         return nullptr;
-    return CSSValuePool::singleton().createValue(url.toString(), CSSPrimitiveValue::UnitTypes::CSS_URI);
+    return CSSValuePool::singleton().createValue(url.toString(), CSSPrimitiveValue::UnitType::CSS_URI);
 }
 
 static int clampRGBComponent(const CSSPrimitiveValue& value)
@@ -758,11 +758,11 @@ static RefPtr<CSSPrimitiveValue> consumeDeprecatedGradientPoint(CSSParserTokenRa
 {
     if (args.peek().type() == IdentToken) {
         if ((horizontal && consumeIdent<CSSValueLeft>(args)) || (!horizontal && consumeIdent<CSSValueTop>(args)))
-            return CSSValuePool::singleton().createValue(0., CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE);
+            return CSSValuePool::singleton().createValue(0., CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
         if ((horizontal && consumeIdent<CSSValueRight>(args)) || (!horizontal && consumeIdent<CSSValueBottom>(args)))
-            return CSSValuePool::singleton().createValue(100., CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE);
+            return CSSValuePool::singleton().createValue(100., CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
         if (consumeIdent<CSSValueCenter>(args))
-            return CSSValuePool::singleton().createValue(50., CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE);
+            return CSSValuePool::singleton().createValue(50., CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
         return nullptr;
     }
     RefPtr<CSSPrimitiveValue> result = consumePercent(args, ValueRangeAll);
@@ -803,7 +803,7 @@ static bool consumeDeprecatedGradientColorStop(CSSParserTokenRange& range, CSSGr
             return false;
     }
 
-    stop.m_position = CSSValuePool::singleton().createValue(position, CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
+    stop.m_position = CSSValuePool::singleton().createValue(position, CSSPrimitiveValue::UnitType::CSS_NUMBER);
     stop.m_color = consumeDeprecatedGradientStopColor(args, cssParserMode);
     return stop.m_color && args.atEnd();
 }
@@ -1081,9 +1081,9 @@ static RefPtr<CSSValue> consumeCrossFade(CSSParserTokenRange& args, CSSParserCon
     RefPtr<CSSPrimitiveValue> percentage;
     const CSSParserToken& percentageArg = args.consumeIncludingWhitespace();
     if (percentageArg.type() == PercentageToken)
-        percentage = CSSValuePool::singleton().createValue(clampTo<double>(percentageArg.numericValue() / 100, 0, 1), CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
+        percentage = CSSValuePool::singleton().createValue(clampTo<double>(percentageArg.numericValue() / 100, 0, 1), CSSPrimitiveValue::UnitType::CSS_NUMBER);
     else if (percentageArg.type() == NumberToken)
-        percentage = CSSValuePool::singleton().createValue(clampTo<double>(percentageArg.numericValue(), 0, 1), CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
+        percentage = CSSValuePool::singleton().createValue(clampTo<double>(percentageArg.numericValue(), 0, 1), CSSPrimitiveValue::UnitType::CSS_NUMBER);
 
     if (!percentage)
         return nullptr;
@@ -1183,11 +1183,11 @@ static RefPtr<CSSValue> consumeImageSet(CSSParserTokenRange& range, const CSSPar
             return nullptr;
         if (token.value() != "x")
             return nullptr;
-        ASSERT(token.unitType() == CSSPrimitiveValue::UnitTypes::CSS_UNKNOWN);
+        ASSERT(token.unitType() == CSSPrimitiveValue::UnitType::CSS_UNKNOWN);
         double imageScaleFactor = token.numericValue();
         if (imageScaleFactor <= 0)
             return nullptr;
-        imageSet->append(CSSValuePool::singleton().createValue(imageScaleFactor, CSSPrimitiveValue::UnitTypes::CSS_NUMBER));
+        imageSet->append(CSSValuePool::singleton().createValue(imageScaleFactor, CSSPrimitiveValue::UnitType::CSS_NUMBER));
     } while (consumeCommaIncludingWhitespace(args));
     if (!args.atEnd())
         return nullptr;
@@ -1254,7 +1254,7 @@ RefPtr<CSSFunctionValue> consumeFilterFunction(CSSParserTokenRange& range, const
                 bool isPercentage = downcast<CSSPrimitiveValue>(*parsedValue).isPercentage();
                 double maxAllowed = isPercentage ? 100.0 : 1.0;
                 if (downcast<CSSPrimitiveValue>(*parsedValue).doubleValue() > maxAllowed)
-                    parsedValue = CSSPrimitiveValue::create(maxAllowed, isPercentage ? CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE : CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
+                    parsedValue = CSSPrimitiveValue::create(maxAllowed, isPercentage ? CSSPrimitiveValue::UnitType::CSS_PERCENTAGE : CSSPrimitiveValue::UnitType::CSS_NUMBER);
             }
         }
     }
index d94425d..9b457ff 100644 (file)
@@ -184,7 +184,7 @@ void MediaQueryParser::readFeatureColon(CSSParserTokenType type, const CSSParser
 
 void MediaQueryParser::readFeatureValue(CSSParserTokenType type, const CSSParserToken& token)
 {
-    if (type == DimensionToken && token.unitType() == CSSPrimitiveValue::UnitTypes::CSS_UNKNOWN)
+    if (type == DimensionToken && token.unitType() == CSSPrimitiveValue::UnitType::CSS_UNKNOWN)
         m_state = SkipUntilComma;
     else {
         if (m_mediaQueryData.tryAddParserToken(type, token))
index c519421..6830215 100644 (file)
@@ -40,7 +40,7 @@
 
 namespace WebCore {
 
-float SizesAttributeParser::computeLength(double value, CSSPrimitiveValue::UnitTypes type, const Document& document)
+float SizesAttributeParser::computeLength(double value, CSSPrimitiveValue::UnitType type, const Document& document)
 {
     auto* renderer = document.renderView();
     if (!renderer)
index fc04447..38395cf 100644 (file)
@@ -45,7 +45,7 @@ public:
     float length();
 
     static float defaultLength(const Document&);
-    static float computeLength(double value, CSSPrimitiveValue::UnitTypes, const Document&);
+    static float computeLength(double value, CSSPrimitiveValue::UnitType, const Document&);
 
 private:
     bool parse(CSSParserTokenRange);
index b808af2..d180116 100644 (file)
@@ -251,7 +251,7 @@ bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, CSSProperty
     return true;
 }
 
-bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important)
+bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit, bool important)
 {
     ensureMutableInlineStyle().setProperty(propertyID, CSSValuePool::singleton().createValue(value, unit), important);
     inlineStyleChanged();
@@ -388,7 +388,7 @@ void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperti
     style.setProperty(propertyID, CSSValuePool::singleton().createIdentifierValue(identifier));
 }
 
-void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitTypes unit)
+void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit)
 {
     style.setProperty(propertyID, CSSValuePool::singleton().createValue(value, unit));
 }
index 0f8f8ac..a35eaa2 100644 (file)
@@ -49,7 +49,7 @@ public:
     
     bool setInlineStyleProperty(CSSPropertyID, CSSValueID identifier, bool important = false);
     bool setInlineStyleProperty(CSSPropertyID, CSSPropertyID identifier, bool important = false);
-    WEBCORE_EXPORT bool setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue::UnitTypes, bool important = false);
+    WEBCORE_EXPORT bool setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue::UnitType, bool important = false);
     WEBCORE_EXPORT bool setInlineStyleProperty(CSSPropertyID, const String& value, bool important = false);
     bool removeInlineStyleProperty(CSSPropertyID);
     void removeAllInlineStyleProperties();
@@ -75,7 +75,7 @@ protected:
     virtual bool isPresentationAttribute(const QualifiedName&) const { return false; }
 
     void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, CSSValueID identifier);
-    void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, double value, CSSPrimitiveValue::UnitTypes);
+    void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, double value, CSSPrimitiveValue::UnitType);
     void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, const String& value);
 
     void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
index b58d42d..6387e4a 100644 (file)
@@ -312,7 +312,7 @@ SVGLengthValue SVGLengthValue::fromCSSPrimitiveValue(const CSSPrimitiveValue& va
 
 Ref<CSSPrimitiveValue> SVGLengthValue::toCSSPrimitiveValue(const SVGLengthValue& length)
 {
-    CSSPrimitiveValue::UnitTypes cssType = CSSPrimitiveValue::CSS_UNKNOWN;
+    CSSPrimitiveValue::UnitType cssType = CSSPrimitiveValue::CSS_UNKNOWN;
     switch (length.unitType()) {
     case LengthTypeUnknown:
         break;