Convert CSSPrimitiveValue::UnitType to an enum class, and cleanup
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2019 04:41:17 +0000 (04:41 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2019 04:41:17 +0000 (04:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204101

Reviewed by Antti Koivisto.
Source/WebCore:

Move CSSPrimitiveValue::UnitType to a standalone enum class CSSUnitType, and
CSSPrimitiveVallue::UnitCategory to CSSUnitCategory; these are going to more extensive
use in calc() and in the CSS OM.

Remove some comments about quirky units behavior which is now the standard behavior.

The compiler warned about some units not handled in CSSPrimitiveValue::formatNumberForCustomCSSText()
and CSSPrimitiveValue::equals() which may reveal bugs; assert for now.

* css/CSSCalculationValue.cpp:
(WebCore::calcUnitCategory):
(WebCore::hasDoubleValue):
(WebCore::CSSCalcOperation::createSimplified):
(WebCore::CSSCalcOperation::primitiveType const):
(WebCore::CSSCalcExpressionNodeParser::parseValue):
(WebCore::createBlendHalf):
(WebCore::createCSS):
(WebCore::unitCategory): Deleted.
* css/CSSCalculationValue.h:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForImageSliceSide):
(WebCore::valueForNinePieceImageQuad):
(WebCore::zoomAdjustedPixelValue):
(WebCore::zoomAdjustedNumberValue):
(WebCore::valueForReflection):
(WebCore::percentageOrZoomAdjustedValue):
(WebCore::matrixTransformValue):
(WebCore::adjustLengthForZoom):
(WebCore::ComputedStyleExtractor::valueForFilter):
(WebCore::specifiedValueForGridTrackBreadth):
(WebCore::specifiedValueForGridTrackSize):
(WebCore::OrderedNamedLinesCollector::appendLines const):
(WebCore::valueForGridPosition):
(WebCore::createTransitionPropertyValue):
(WebCore::delayValue):
(WebCore::durationValue):
(WebCore::textUnderlineOffsetToCSSValue):
(WebCore::textDecorationThicknessToCSSValue):
(WebCore::altTextToCSSValue):
(WebCore::contentToCSSValue):
(WebCore::counterToCSSValue):
(WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
(WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
(WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
(WebCore::fontShorthandValueForSelectionProperties):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSCrossfadeValue.cpp:
(WebCore::CSSCrossfadeValue::blend const):
* css/CSSCustomPropertyValue.cpp:
(WebCore::CSSCustomPropertyValue::customCSSText const):
* css/CSSFontFace.cpp:
(WebCore::calculateItalicRange):
* css/CSSFontStyleValue.h:
* css/CSSGradientValue.cpp:
(WebCore::compareStops):
(WebCore::CSSGradientValue::computeStops):
(WebCore::appendGradientStops):
(WebCore::CSSLinearGradientValue::createGradient):
(WebCore::CSSConicGradientValue::createGradient):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::createDeprecatedCSSOMWrapper const):
* css/CSSPrimitiveValue.cpp:
(WebCore::isValidCSSUnitTypeForDoubleConversion):
(WebCore::isStringType):
(WebCore::unitCategory):
(WebCore::CSSPrimitiveValue::primitiveType const):
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::init):
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::computeDegrees const):
(WebCore::CSSPrimitiveValue::computeLengthDouble const):
(WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
(WebCore::CSSPrimitiveValue::setFloatValue):
(WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
(WebCore::CSSPrimitiveValue::getFloatValue const):
(WebCore::CSSPrimitiveValue::doubleValue const):
(WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
(WebCore::CSSPrimitiveValue::doubleValueInternal const):
(WebCore::CSSPrimitiveValue::setStringValue):
(WebCore::CSSPrimitiveValue::getStringValue const):
(WebCore::CSSPrimitiveValue::stringValue const):
(WebCore:: const):
(WebCore::CSSPrimitiveValue::getRGBColorValue const):
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
(WebCore::CSSPrimitiveValue::equals const):
(WebCore::CSSPrimitiveValue::collectDirectComputationalDependencies const):
(WebCore::CSSPrimitiveValue::collectDirectRootComputationalDependencies const):
(WebCore::CSSPrimitiveValue::unitCategory): Deleted.
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::isAngle const):
(WebCore::CSSPrimitiveValue::isFontRelativeLength):
(WebCore::CSSPrimitiveValue::isLength):
(WebCore::CSSPrimitiveValue::isResolution):
(WebCore::CSSPrimitiveValue::createAllowingMarginQuirk):
(WebCore::CSSPrimitiveValue::computeTime const):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator short const):
(WebCore::CSSPrimitiveValue::operator unsigned short const):
(WebCore::CSSPrimitiveValue::operator int const):
(WebCore::CSSPrimitiveValue::operator unsigned const):
(WebCore::CSSPrimitiveValue::operator float const):
(WebCore::CSSPrimitiveValue::operator LineClampValue const):
(WebCore::CSSPrimitiveValue::operator ColumnFill const):
(WebCore::CSSPrimitiveValue::operator ColumnSpan const):
(WebCore::CSSPrimitiveValue::convertingToLengthRequiresNonNullStyle const):
(WebCore::CSSPrimitiveValue::operator ImageOrientation const):
* css/CSSStyleDeclaration.cpp:
(WebCore::CSSStyleDeclaration::namedItem):
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapNinePieceImageSlice):
(WebCore::CSSToStyleMap::mapNinePieceImageQuad):
* css/CSSValue.h:
* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::CSSValuePool):
(WebCore::CSSValuePool::createValue):
* css/CSSValuePool.h:
(WebCore::CSSValuePool::createValue):
* css/DeprecatedCSSOMPrimitiveValue.cpp:
(WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const):
(WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
(WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const):
(WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
* css/DeprecatedCSSOMPrimitiveValue.h:
* css/DeprecatedCSSOMRGBColor.h:
* css/MediaQueryEvaluator.cpp:
(WebCore::doubleValue):
(WebCore::evaluateResolution):
* css/MediaQueryExpression.cpp:
(WebCore::featureWithValidIdent):
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::glyphOrientationToCSSPrimitiveValue):
(WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const):
(WebCore::ComputedStyleExtractor::svgPropertyValue):
* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText const):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::parseSimpleLength):
(WebCore::parseSimpleAngle):
(WebCore::parseSimpleLengthValue):
(WebCore::parseColorIntOrPercentage):
(WebCore::fastParseColorInternal):
(WebCore::parseTransformTranslateArguments):
(WebCore::parseTransformAngleArgument):
(WebCore::parseTransformNumberArguments):
* css/parser/CSSParserToken.cpp:
(WebCore::cssPrimitiveValueUnitFromTrie):
(WebCore::stringToUnitType):
(WebCore::CSSParserToken::CSSParserToken):
(WebCore::CSSParserToken::convertToPercentage):
* css/parser/CSSParserToken.h:
(WebCore::CSSParserToken::unitType const):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeTransformOrigin):
(WebCore::consumeFontStyle):
(WebCore::consumeFontStyleRange):
(WebCore::consumeCounter):
(WebCore::consumeAnimationName):
(WebCore::consumePerspective):
(WebCore::consumePositionLonghand):
(WebCore::consumeAttr):
(WebCore::consumeCounterContent):
(WebCore::consumeReflect):
(WebCore::consumeGridBreadth):
(WebCore::CSSPropertyParser::consumeSystemFont):
(WebCore::CSSPropertyParser::consumeFlex):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeInteger):
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
(WebCore::CSSPropertyParserHelpers::consumeInteger):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
(WebCore::CSSPropertyParserHelpers::consumeLength):
(WebCore::CSSPropertyParserHelpers::consumePercent):
(WebCore::CSSPropertyParserHelpers::consumeAngle):
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
(WebCore::CSSPropertyParserHelpers::consumeTime):
(WebCore::CSSPropertyParserHelpers::consumeResolution):
(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):
(WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
* css/parser/SizesAttributeParser.h:
* css/typedom/StylePropertyMapReadOnly.cpp:
(WebCore::StylePropertyMapReadOnly::reifyValue):
* dom/StyledElement.cpp:
(WebCore::StyledElement::setInlineStyleProperty):
(WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
* dom/StyledElement.h:
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::ApplyStyleCommand::computedFontSize):
* editing/EditingStyle.cpp:
(WebCore::legacyFontSizeFromCSSValue):
* editing/FontAttributeChanges.cpp:
(WebCore::FontChanges::createStyleProperties const):
(WebCore::cssValueListForShadow):
* editing/cocoa/HTMLConverter.mm:
(stringFromCSSValue):
(floatValueFromPrimitiveValue):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::applyBorderAttributeToStyle):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::collectStyleForPresentationAttribute):
* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute):
* html/HTMLInputElement.cpp:
(WebCore::autoFillStrongPasswordMaskImage):
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::didElementStateChange):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::collectStyleForPresentationAttribute):
(WebCore::HTMLTableElement::createSharedCellStyle):
* html/ValidationMessage.cpp:
(WebCore::adjustBubblePosition):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlPanelElement::setPosition):
(WebCore::MediaControlPanelElement::makeOpaque):
(WebCore::MediaControlPanelElement::makeTransparent):
(WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
(WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation):
* html/shadow/ProgressShadowElement.cpp:
(WebCore::ProgressValueElement::setWidthPercentage):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerElement::resolveCustomStyle):
* html/shadow/mac/ImageControlsButtonElementMac.cpp:
(WebCore::ImageControlsButtonElementMac::tryCreate):
* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
(WebCore::TextTrackCueGeneric::setFontSize):
* html/track/VTTCue.cpp:
(WebCore::VTTCueBox::applyCSSProperties):
(WebCore::VTTCue::getDisplayTree):
* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::displayLastTextTrackCueBox):
(WebCore::VTTRegion::willRemoveTextTrackCueBox):
(WebCore::VTTRegion::prepareRegionDisplayTree):
* page/DragController.cpp:
(WebCore::DragController::insertDroppedImagePlaceholdersAtCaret):
* page/PrintContext.cpp:
(WebCore::PrintContext::computedPageMargin):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::crossfadeBlend):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::resize):
* rendering/RenderThemeIOS.mm:
(WebCore::applyCommonButtonPaddingToStyle):
(WebCore::RenderThemeIOS::adjustButtonStyle const):
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertNumber):
(WebCore::Style::BuilderConverter::convertWebkitHyphenateLimitLines):
(WebCore::Style::BuilderConverter::convertClipPath):
(WebCore::Style::BuilderConverter::convertTextStrokeWidth):
(WebCore::Style::BuilderConverter::convertFontStyleFromValue):
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::mmLength):
(WebCore::Style::BuilderCustom::inchLength):
(WebCore::Style::BuilderCustom::applyValueImageResolution):
* svg/SVGLengthValue.cpp:
(WebCore::primitiveTypeToLengthType):
(WebCore::lengthTypeToPrimitiveType):

Source/WebKit:

Move CSSPrimitiveValue::UnitType to a standalone enum class CSSUnitType, and
CSSPrimitiveVallue::UnitCategory to CSSUnitCategory; these are going to more extensive
use in calc() and in the CSS OM.

* WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
(WebKit::PDFPluginAnnotation::updateGeometry):
* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::updateGeometry):
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
(WebKit::PDFPluginTextAnnotation::updateGeometry):

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

67 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSCrossfadeValue.cpp
Source/WebCore/css/CSSCustomPropertyValue.cpp
Source/WebCore/css/CSSFontFace.cpp
Source/WebCore/css/CSSFontStyleValue.h
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSImageValue.cpp
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSStyleDeclaration.cpp
Source/WebCore/css/CSSToStyleMap.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValuePool.cpp
Source/WebCore/css/CSSValuePool.h
Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.cpp
Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h
Source/WebCore/css/DeprecatedCSSOMRGBColor.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/MediaQueryExpression.cpp
Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
Source/WebCore/css/StyleProperties.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/css/typedom/StylePropertyMapReadOnly.cpp
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/dom/StyledElement.h
Source/WebCore/editing/ApplyStyleCommand.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/FontAttributeChanges.cpp
Source/WebCore/editing/cocoa/HTMLConverter.mm
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLHRElement.cpp
Source/WebCore/html/HTMLIFrameElement.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLMeterElement.cpp
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/ValidationMessage.cpp
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/ProgressShadowElement.cpp
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp
Source/WebCore/html/track/TextTrackCueGeneric.cpp
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/html/track/VTTRegion.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/PrintContext.cpp
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/style/StyleBuilderConverter.h
Source/WebCore/style/StyleBuilderCustom.h
Source/WebCore/svg/SVGLengthValue.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm
Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm
Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm

index 3a4ceec..a4de1d6 100644 (file)
@@ -1,3 +1,282 @@
+2019-11-12  Simon Fraser  <simon.fraser@apple.com>
+
+        Convert CSSPrimitiveValue::UnitType to an enum class, and cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=204101
+
+        Reviewed by Antti Koivisto.
+        
+        Move CSSPrimitiveValue::UnitType to a standalone enum class CSSUnitType, and
+        CSSPrimitiveVallue::UnitCategory to CSSUnitCategory; these are going to more extensive
+        use in calc() and in the CSS OM.
+        
+        Remove some comments about quirky units behavior which is now the standard behavior.
+        
+        The compiler warned about some units not handled in CSSPrimitiveValue::formatNumberForCustomCSSText()
+        and CSSPrimitiveValue::equals() which may reveal bugs; assert for now.
+
+        * css/CSSCalculationValue.cpp:
+        (WebCore::calcUnitCategory):
+        (WebCore::hasDoubleValue):
+        (WebCore::CSSCalcOperation::createSimplified):
+        (WebCore::CSSCalcOperation::primitiveType const):
+        (WebCore::CSSCalcExpressionNodeParser::parseValue):
+        (WebCore::createBlendHalf):
+        (WebCore::createCSS):
+        (WebCore::unitCategory): Deleted.
+        * css/CSSCalculationValue.h:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::valueForImageSliceSide):
+        (WebCore::valueForNinePieceImageQuad):
+        (WebCore::zoomAdjustedPixelValue):
+        (WebCore::zoomAdjustedNumberValue):
+        (WebCore::valueForReflection):
+        (WebCore::percentageOrZoomAdjustedValue):
+        (WebCore::matrixTransformValue):
+        (WebCore::adjustLengthForZoom):
+        (WebCore::ComputedStyleExtractor::valueForFilter):
+        (WebCore::specifiedValueForGridTrackBreadth):
+        (WebCore::specifiedValueForGridTrackSize):
+        (WebCore::OrderedNamedLinesCollector::appendLines const):
+        (WebCore::valueForGridPosition):
+        (WebCore::createTransitionPropertyValue):
+        (WebCore::delayValue):
+        (WebCore::durationValue):
+        (WebCore::textUnderlineOffsetToCSSValue):
+        (WebCore::textDecorationThicknessToCSSValue):
+        (WebCore::altTextToCSSValue):
+        (WebCore::contentToCSSValue):
+        (WebCore::counterToCSSValue):
+        (WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
+        (WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
+        (WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
+        (WebCore::fontShorthandValueForSelectionProperties):
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/CSSCrossfadeValue.cpp:
+        (WebCore::CSSCrossfadeValue::blend const):
+        * css/CSSCustomPropertyValue.cpp:
+        (WebCore::CSSCustomPropertyValue::customCSSText const):
+        * css/CSSFontFace.cpp:
+        (WebCore::calculateItalicRange):
+        * css/CSSFontStyleValue.h:
+        * css/CSSGradientValue.cpp:
+        (WebCore::compareStops):
+        (WebCore::CSSGradientValue::computeStops):
+        (WebCore::appendGradientStops):
+        (WebCore::CSSLinearGradientValue::createGradient):
+        (WebCore::CSSConicGradientValue::createGradient):
+        * css/CSSImageValue.cpp:
+        (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper const):
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::isValidCSSUnitTypeForDoubleConversion):
+        (WebCore::isStringType):
+        (WebCore::unitCategory):
+        (WebCore::CSSPrimitiveValue::primitiveType const):
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::init):
+        (WebCore::CSSPrimitiveValue::cleanup):
+        (WebCore::CSSPrimitiveValue::computeDegrees const):
+        (WebCore::CSSPrimitiveValue::computeLengthDouble const):
+        (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
+        (WebCore::CSSPrimitiveValue::setFloatValue):
+        (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
+        (WebCore::CSSPrimitiveValue::getFloatValue const):
+        (WebCore::CSSPrimitiveValue::doubleValue const):
+        (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
+        (WebCore::CSSPrimitiveValue::doubleValueInternal const):
+        (WebCore::CSSPrimitiveValue::setStringValue):
+        (WebCore::CSSPrimitiveValue::getStringValue const):
+        (WebCore::CSSPrimitiveValue::stringValue const):
+        (WebCore:: const):
+        (WebCore::CSSPrimitiveValue::getRGBColorValue const):
+        (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
+        (WebCore::CSSPrimitiveValue::equals const):
+        (WebCore::CSSPrimitiveValue::collectDirectComputationalDependencies const):
+        (WebCore::CSSPrimitiveValue::collectDirectRootComputationalDependencies const):
+        (WebCore::CSSPrimitiveValue::unitCategory): Deleted.
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::isAngle const):
+        (WebCore::CSSPrimitiveValue::isFontRelativeLength):
+        (WebCore::CSSPrimitiveValue::isLength):
+        (WebCore::CSSPrimitiveValue::isResolution):
+        (WebCore::CSSPrimitiveValue::createAllowingMarginQuirk):
+        (WebCore::CSSPrimitiveValue::computeTime const):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator short const):
+        (WebCore::CSSPrimitiveValue::operator unsigned short const):
+        (WebCore::CSSPrimitiveValue::operator int const):
+        (WebCore::CSSPrimitiveValue::operator unsigned const):
+        (WebCore::CSSPrimitiveValue::operator float const):
+        (WebCore::CSSPrimitiveValue::operator LineClampValue const):
+        (WebCore::CSSPrimitiveValue::operator ColumnFill const):
+        (WebCore::CSSPrimitiveValue::operator ColumnSpan const):
+        (WebCore::CSSPrimitiveValue::convertingToLengthRequiresNonNullStyle const):
+        (WebCore::CSSPrimitiveValue::operator ImageOrientation const):
+        * css/CSSStyleDeclaration.cpp:
+        (WebCore::CSSStyleDeclaration::namedItem):
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::mapNinePieceImageSlice):
+        (WebCore::CSSToStyleMap::mapNinePieceImageQuad):
+        * css/CSSValue.h:
+        * css/CSSValuePool.cpp:
+        (WebCore::CSSValuePool::CSSValuePool):
+        (WebCore::CSSValuePool::createValue):
+        * css/CSSValuePool.h:
+        (WebCore::CSSValuePool::createValue):
+        * css/DeprecatedCSSOMPrimitiveValue.cpp:
+        (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const):
+        (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue):
+        (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const):
+        (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue):
+        * css/DeprecatedCSSOMPrimitiveValue.h:
+        * css/DeprecatedCSSOMRGBColor.h:
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::doubleValue):
+        (WebCore::evaluateResolution):
+        * css/MediaQueryExpression.cpp:
+        (WebCore::featureWithValidIdent):
+        * css/SVGCSSComputedStyleDeclaration.cpp:
+        (WebCore::glyphOrientationToCSSPrimitiveValue):
+        (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const):
+        (WebCore::ComputedStyleExtractor::svgPropertyValue):
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::asText const):
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::parseSimpleLength):
+        (WebCore::parseSimpleAngle):
+        (WebCore::parseSimpleLengthValue):
+        (WebCore::parseColorIntOrPercentage):
+        (WebCore::fastParseColorInternal):
+        (WebCore::parseTransformTranslateArguments):
+        (WebCore::parseTransformAngleArgument):
+        (WebCore::parseTransformNumberArguments):
+        * css/parser/CSSParserToken.cpp:
+        (WebCore::cssPrimitiveValueUnitFromTrie):
+        (WebCore::stringToUnitType):
+        (WebCore::CSSParserToken::CSSParserToken):
+        (WebCore::CSSParserToken::convertToPercentage):
+        * css/parser/CSSParserToken.h:
+        (WebCore::CSSParserToken::unitType const):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::consumeTransformOrigin):
+        (WebCore::consumeFontStyle):
+        (WebCore::consumeFontStyleRange):
+        (WebCore::consumeCounter):
+        (WebCore::consumeAnimationName):
+        (WebCore::consumePerspective):
+        (WebCore::consumePositionLonghand):
+        (WebCore::consumeAttr):
+        (WebCore::consumeCounterContent):
+        (WebCore::consumeReflect):
+        (WebCore::consumeGridBreadth):
+        (WebCore::CSSPropertyParser::consumeSystemFont):
+        (WebCore::CSSPropertyParser::consumeFlex):
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::CalcParser::consumeInteger):
+        (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
+        (WebCore::CSSPropertyParserHelpers::consumeInteger):
+        (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
+        (WebCore::CSSPropertyParserHelpers::consumeLength):
+        (WebCore::CSSPropertyParserHelpers::consumePercent):
+        (WebCore::CSSPropertyParserHelpers::consumeAngle):
+        (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
+        (WebCore::CSSPropertyParserHelpers::consumeTime):
+        (WebCore::CSSPropertyParserHelpers::consumeResolution):
+        (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):
+        (WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
+        * css/parser/SizesAttributeParser.h:
+        * css/typedom/StylePropertyMapReadOnly.cpp:
+        (WebCore::StylePropertyMapReadOnly::reifyValue):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::setInlineStyleProperty):
+        (WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
+        * dom/StyledElement.h:
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
+        (WebCore::ApplyStyleCommand::computedFontSize):
+        * editing/EditingStyle.cpp:
+        (WebCore::legacyFontSizeFromCSSValue):
+        * editing/FontAttributeChanges.cpp:
+        (WebCore::FontChanges::createStyleProperties const):
+        (WebCore::cssValueListForShadow):
+        * editing/cocoa/HTMLConverter.mm:
+        (stringFromCSSValue):
+        (floatValueFromPrimitiveValue):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::applyBorderAttributeToStyle):
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::collectStyleForPresentationAttribute):
+        * html/HTMLHRElement.cpp:
+        (WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
+        * html/HTMLIFrameElement.cpp:
+        (WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute):
+        * html/HTMLInputElement.cpp:
+        (WebCore::autoFillStrongPasswordMaskImage):
+        * html/HTMLMeterElement.cpp:
+        (WebCore::HTMLMeterElement::didElementStateChange):
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::collectStyleForPresentationAttribute):
+        (WebCore::HTMLTableElement::createSharedCellStyle):
+        * html/ValidationMessage.cpp:
+        (WebCore::adjustBubblePosition):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlPanelElement::setPosition):
+        (WebCore::MediaControlPanelElement::makeOpaque):
+        (WebCore::MediaControlPanelElement::makeTransparent):
+        (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
+        (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation):
+        * html/shadow/ProgressShadowElement.cpp:
+        (WebCore::ProgressValueElement::setWidthPercentage):
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::TextControlInnerElement::resolveCustomStyle):
+        * html/shadow/mac/ImageControlsButtonElementMac.cpp:
+        (WebCore::ImageControlsButtonElementMac::tryCreate):
+        * html/track/TextTrackCueGeneric.cpp:
+        (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
+        (WebCore::TextTrackCueGeneric::setFontSize):
+        * html/track/VTTCue.cpp:
+        (WebCore::VTTCueBox::applyCSSProperties):
+        (WebCore::VTTCue::getDisplayTree):
+        * html/track/VTTRegion.cpp:
+        (WebCore::VTTRegion::displayLastTextTrackCueBox):
+        (WebCore::VTTRegion::willRemoveTextTrackCueBox):
+        (WebCore::VTTRegion::prepareRegionDisplayTree):
+        * page/DragController.cpp:
+        (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret):
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::computedPageMargin):
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::crossfadeBlend):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::resize):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::applyCommonButtonPaddingToStyle):
+        (WebCore::RenderThemeIOS::adjustButtonStyle const):
+        * style/StyleBuilderConverter.h:
+        (WebCore::Style::BuilderConverter::convertNumber):
+        (WebCore::Style::BuilderConverter::convertWebkitHyphenateLimitLines):
+        (WebCore::Style::BuilderConverter::convertClipPath):
+        (WebCore::Style::BuilderConverter::convertTextStrokeWidth):
+        (WebCore::Style::BuilderConverter::convertFontStyleFromValue):
+        * style/StyleBuilderCustom.h:
+        (WebCore::Style::BuilderCustom::mmLength):
+        (WebCore::Style::BuilderCustom::inchLength):
+        (WebCore::Style::BuilderCustom::applyValueImageResolution):
+        * svg/SVGLengthValue.cpp:
+        (WebCore::primitiveTypeToLengthType):
+        (WebCore::lengthTypeToPrimitiveType):
+
 2019-11-12  Keith Miller  <keith_miller@apple.com>
 
         AudioScheduledSourceNodes leak if they have an attached onended EventTarget
index 4da44be..10da598 100644 (file)
@@ -52,99 +52,99 @@ namespace WebCore {
 static RefPtr<CSSCalcExpressionNode> createCSS(const CalcExpressionNode&, const RenderStyle&);
 static RefPtr<CSSCalcExpressionNode> createCSS(const Length&, const RenderStyle&);
 
-static CalculationCategory unitCategory(CSSPrimitiveValue::UnitType type)
+static CalculationCategory calcUnitCategory(CSSUnitType type)
 {
     switch (type) {
-    case CSSPrimitiveValue::CSS_NUMBER:
+    case CSSUnitType::CSS_NUMBER:
         return CalculationCategory::Number;
-    case CSSPrimitiveValue::CSS_EMS:
-    case CSSPrimitiveValue::CSS_EXS:
-    case CSSPrimitiveValue::CSS_PX:
-    case CSSPrimitiveValue::CSS_CM:
-    case CSSPrimitiveValue::CSS_MM:
-    case CSSPrimitiveValue::CSS_IN:
-    case CSSPrimitiveValue::CSS_PT:
-    case CSSPrimitiveValue::CSS_PC:
-    case CSSPrimitiveValue::CSS_Q:
-    case CSSPrimitiveValue::CSS_REMS:
-    case CSSPrimitiveValue::CSS_CHS:
-    case CSSPrimitiveValue::CSS_VW:
-    case CSSPrimitiveValue::CSS_VH:
-    case CSSPrimitiveValue::CSS_VMIN:
-    case CSSPrimitiveValue::CSS_VMAX:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_CM:
+    case CSSUnitType::CSS_MM:
+    case CSSUnitType::CSS_IN:
+    case CSSUnitType::CSS_PT:
+    case CSSUnitType::CSS_PC:
+    case CSSUnitType::CSS_Q:
+    case CSSUnitType::CSS_REMS:
+    case CSSUnitType::CSS_CHS:
+    case CSSUnitType::CSS_VW:
+    case CSSUnitType::CSS_VH:
+    case CSSUnitType::CSS_VMIN:
+    case CSSUnitType::CSS_VMAX:
         return CalculationCategory::Length;
-    case CSSPrimitiveValue::CSS_PERCENTAGE:
+    case CSSUnitType::CSS_PERCENTAGE:
         return CalculationCategory::Percent;
-    case CSSPrimitiveValue::CSS_DEG:
-    case CSSPrimitiveValue::CSS_RAD:
-    case CSSPrimitiveValue::CSS_GRAD:
-    case CSSPrimitiveValue::CSS_TURN:
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_RAD:
+    case CSSUnitType::CSS_GRAD:
+    case CSSUnitType::CSS_TURN:
         return CalculationCategory::Angle;
-    case CSSPrimitiveValue::CSS_MS:
-    case CSSPrimitiveValue::CSS_S:
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_S:
         return CalculationCategory::Time;
-    case CSSPrimitiveValue::CSS_HZ:
-    case CSSPrimitiveValue::CSS_KHZ:
+    case CSSUnitType::CSS_HZ:
+    case CSSUnitType::CSS_KHZ:
         return CalculationCategory::Frequency;
     default:
         return CalculationCategory::Other;
     }
 }
 
-static bool hasDoubleValue(CSSPrimitiveValue::UnitType type)
+static bool hasDoubleValue(CSSUnitType type)
 {
     switch (type) {
-    case CSSPrimitiveValue::CSS_NUMBER:
-    case CSSPrimitiveValue::CSS_PERCENTAGE:
-    case CSSPrimitiveValue::CSS_EMS:
-    case CSSPrimitiveValue::CSS_EXS:
-    case CSSPrimitiveValue::CSS_CHS:
-    case CSSPrimitiveValue::CSS_REMS:
-    case CSSPrimitiveValue::CSS_PX:
-    case CSSPrimitiveValue::CSS_CM:
-    case CSSPrimitiveValue::CSS_MM:
-    case CSSPrimitiveValue::CSS_IN:
-    case CSSPrimitiveValue::CSS_PT:
-    case CSSPrimitiveValue::CSS_PC:
-    case CSSPrimitiveValue::CSS_DEG:
-    case CSSPrimitiveValue::CSS_RAD:
-    case CSSPrimitiveValue::CSS_GRAD:
-    case CSSPrimitiveValue::CSS_TURN:
-    case CSSPrimitiveValue::CSS_MS:
-    case CSSPrimitiveValue::CSS_S:
-    case CSSPrimitiveValue::CSS_HZ:
-    case CSSPrimitiveValue::CSS_KHZ:
-    case CSSPrimitiveValue::CSS_DIMENSION:
-    case CSSPrimitiveValue::CSS_VW:
-    case CSSPrimitiveValue::CSS_VH:
-    case CSSPrimitiveValue::CSS_VMIN:
-    case CSSPrimitiveValue::CSS_VMAX:
-    case CSSPrimitiveValue::CSS_DPPX:
-    case CSSPrimitiveValue::CSS_DPI:
-    case CSSPrimitiveValue::CSS_DPCM:
-    case CSSPrimitiveValue::CSS_FR:
-    case CSSPrimitiveValue::CSS_Q:
+    case CSSUnitType::CSS_NUMBER:
+    case CSSUnitType::CSS_PERCENTAGE:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_CHS:
+    case CSSUnitType::CSS_REMS:
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_CM:
+    case CSSUnitType::CSS_MM:
+    case CSSUnitType::CSS_IN:
+    case CSSUnitType::CSS_PT:
+    case CSSUnitType::CSS_PC:
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_RAD:
+    case CSSUnitType::CSS_GRAD:
+    case CSSUnitType::CSS_TURN:
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_S:
+    case CSSUnitType::CSS_HZ:
+    case CSSUnitType::CSS_KHZ:
+    case CSSUnitType::CSS_DIMENSION:
+    case CSSUnitType::CSS_VW:
+    case CSSUnitType::CSS_VH:
+    case CSSUnitType::CSS_VMIN:
+    case CSSUnitType::CSS_VMAX:
+    case CSSUnitType::CSS_DPPX:
+    case CSSUnitType::CSS_DPI:
+    case CSSUnitType::CSS_DPCM:
+    case CSSUnitType::CSS_FR:
+    case CSSUnitType::CSS_Q:
         return true;
-    case CSSPrimitiveValue::CSS_UNKNOWN:
-    case CSSPrimitiveValue::CSS_STRING:
-    case CSSPrimitiveValue::CSS_FONT_FAMILY:
-    case CSSPrimitiveValue::CSS_URI:
-    case CSSPrimitiveValue::CSS_IDENT:
-    case CSSPrimitiveValue::CSS_ATTR:
-    case CSSPrimitiveValue::CSS_COUNTER:
-    case CSSPrimitiveValue::CSS_RECT:
-    case CSSPrimitiveValue::CSS_RGBCOLOR:
-    case CSSPrimitiveValue::CSS_PAIR:
-    case CSSPrimitiveValue::CSS_UNICODE_RANGE:
-    case CSSPrimitiveValue::CSS_COUNTER_NAME:
-    case CSSPrimitiveValue::CSS_SHAPE:
-    case CSSPrimitiveValue::CSS_QUAD:
-    case CSSPrimitiveValue::CSS_QUIRKY_EMS:
-    case CSSPrimitiveValue::CSS_CALC:
-    case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER:
-    case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH:
-    case CSSPrimitiveValue::CSS_PROPERTY_ID:
-    case CSSPrimitiveValue::CSS_VALUE_ID:
+    case CSSUnitType::CSS_UNKNOWN:
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_URI:
+    case CSSUnitType::CSS_IDENT:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_COUNTER:
+    case CSSUnitType::CSS_RECT:
+    case CSSUnitType::CSS_RGBCOLOR:
+    case CSSUnitType::CSS_PAIR:
+    case CSSUnitType::CSS_UNICODE_RANGE:
+    case CSSUnitType::CSS_COUNTER_NAME:
+    case CSSUnitType::CSS_SHAPE:
+    case CSSUnitType::CSS_QUAD:
+    case CSSUnitType::CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_CALC:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
+    case CSSUnitType::CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_VALUE_ID:
         return false;
     };
     ASSERT_NOT_REACHED();
@@ -160,7 +160,7 @@ public:
         return adoptRef(*new CSSCalcPrimitiveValue(WTFMove(value), isInteger));
     }
 
-    static RefPtr<CSSCalcPrimitiveValue> create(double value, CSSPrimitiveValue::UnitType type, bool isInteger)
+    static RefPtr<CSSCalcPrimitiveValue> create(double value, CSSUnitType type, bool isInteger)
     {
         if (!std::isfinite(value))
             return nullptr;
@@ -176,9 +176,9 @@ private:
     bool equals(const CSSCalcExpressionNode& other) const final;
     Type type() const final { return CssCalcPrimitiveValue; }
 
-    CSSPrimitiveValue::UnitType primitiveType() const final
+    CSSUnitType primitiveType() const final
     {
-        return CSSPrimitiveValue::UnitType(m_value->primitiveType());
+        return CSSUnitType(m_value->primitiveType());
     }
 
     std::unique_ptr<CalcExpressionNode> createCalcExpression(const CSSToLengthConversionData&) const final;
@@ -195,7 +195,7 @@ private:
 
 private:
     explicit CSSCalcPrimitiveValue(Ref<CSSPrimitiveValue>&& value, bool isInteger)
-        : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitType)value->primitiveType()), isInteger)
+        : CSSCalcExpressionNode(calcUnitCategory(value->primitiveType()), isInteger)
         , m_value(WTFMove(value))
     {
     }
@@ -406,7 +406,7 @@ private:
 
     std::unique_ptr<CalcExpressionNode> createCalcExpression(const CSSToLengthConversionData&) const final;
 
-    CSSPrimitiveValue::UnitType primitiveType() const final;
+    CSSUnitType primitiveType() const final;
     double doubleValue() const final;
     double computeLengthPx(const CSSToLengthConversionData&) const final;
 
@@ -496,22 +496,22 @@ RefPtr<CSSCalcExpressionNode> CSSCalcOperation::createSimplified(CalcOperator op
 
     // Simplify numbers.
     if (leftCategory == CalculationCategory::Number && rightCategory == CalculationCategory::Number) {
-        CSSPrimitiveValue::UnitType evaluationType = CSSPrimitiveValue::CSS_NUMBER;
+        CSSUnitType evaluationType = CSSUnitType::CSS_NUMBER;
         return CSSCalcPrimitiveValue::create(evaluateOperator(op, { leftSide->doubleValue(), rightSide->doubleValue() }), evaluationType, isInteger);
     }
 
     // Simplify addition and subtraction between same types.
     if (op == CalcOperator::Add || op == CalcOperator::Subtract) {
         if (leftCategory == rightSide->category()) {
-            CSSPrimitiveValue::UnitType leftType = leftSide->primitiveType();
+            CSSUnitType leftType = leftSide->primitiveType();
             if (hasDoubleValue(leftType)) {
-                CSSPrimitiveValue::UnitType rightType = rightSide->primitiveType();
+                CSSUnitType 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::UnitType canonicalType = CSSPrimitiveValue::canonicalUnitTypeForCategory(leftUnitCategory);
-                    if (canonicalType != CSSPrimitiveValue::CSS_UNKNOWN) {
+                CSSUnitCategory leftUnitCategory = unitCategory(leftType);
+                if (leftUnitCategory != CSSUnitCategory::Other && leftUnitCategory == unitCategory(rightType)) {
+                    CSSUnitType canonicalType = CSSPrimitiveValue::canonicalUnitTypeForCategory(leftUnitCategory);
+                    if (canonicalType != CSSUnitType::CSS_UNKNOWN) {
                         double leftValue = leftSide->doubleValue() * CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(leftType);
                         double rightValue = rightSide->doubleValue() * CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(rightType);
                         return CSSCalcPrimitiveValue::create(evaluateOperator(op, { leftValue, rightValue }), canonicalType, isInteger);
@@ -543,7 +543,7 @@ RefPtr<CSSCalcExpressionNode> CSSCalcOperation::createSimplified(CalcOperator op
     return create(op, leftSide.releaseNonNull(), rightSide.releaseNonNull());
 }
 
-CSSPrimitiveValue::UnitType CSSCalcOperation::primitiveType() const
+CSSUnitType CSSCalcOperation::primitiveType() const
 {
     switch (category()) {
     case CalculationCategory::Number:
@@ -551,37 +551,37 @@ CSSPrimitiveValue::UnitType CSSCalcOperation::primitiveType() const
         for (auto& child : m_children)
             ASSERT(child->category() == CalculationCategory::Number);
 #endif
-        return CSSPrimitiveValue::CSS_NUMBER;
+        return CSSUnitType::CSS_NUMBER;
     case CalculationCategory::Length:
     case CalculationCategory::Percent: {
         if (m_children.isEmpty())
-            return CSSPrimitiveValue::CSS_UNKNOWN;
+            return CSSUnitType::CSS_UNKNOWN;
         if (m_children.size() == 2) {
             if (m_children[0]->category() == CalculationCategory::Number)
                 return m_children[1]->primitiveType();
             if (m_children[1]->category() == CalculationCategory::Number)
                 return m_children[0]->primitiveType();
         }
-        CSSPrimitiveValue::UnitType firstType = m_children[0]->primitiveType();
+        CSSUnitType firstType = m_children[0]->primitiveType();
         for (auto& child : m_children) {
             if (firstType != child->primitiveType())
-                return CSSPrimitiveValue::CSS_UNKNOWN;
+                return CSSUnitType::CSS_UNKNOWN;
         }
         return firstType;
     }
     case CalculationCategory::Angle:
-        return CSSPrimitiveValue::CSS_DEG;
+        return CSSUnitType::CSS_DEG;
     case CalculationCategory::Time:
-        return CSSPrimitiveValue::CSS_MS;
+        return CSSUnitType::CSS_MS;
     case CalculationCategory::Frequency:
-        return CSSPrimitiveValue::CSS_HZ;
+        return CSSUnitType::CSS_HZ;
     case CalculationCategory::PercentLength:
     case CalculationCategory::PercentNumber:
     case CalculationCategory::Other:
-        return CSSPrimitiveValue::CSS_UNKNOWN;
+        return CSSUnitType::CSS_UNKNOWN;
     }
     ASSERT_NOT_REACHED();
-    return CSSPrimitiveValue::CSS_UNKNOWN;
+    return CSSUnitType::CSS_UNKNOWN;
 }
 
 std::unique_ptr<CalcExpressionNode> CSSCalcOperation::createCalcExpression(const CSSToLengthConversionData& conversionData) const
@@ -775,8 +775,8 @@ bool CSSCalcExpressionNodeParser::parseValue(CSSParserTokenRange& tokens, Value*
     if (!(token.type() == NumberToken || token.type() == PercentageToken || token.type() == DimensionToken))
         return false;
     
-    CSSPrimitiveValue::UnitType type = token.unitType();
-    if (unitCategory(type) == CalculationCategory::Other)
+    CSSUnitType type = token.unitType();
+    if (calcUnitCategory(type) == CalculationCategory::Other)
         return false;
     
     bool isInteger = token.numericValueType() == IntegerValueType || (token.numericValueType() == NumberValueType && token.numericValue() == trunc(token.numericValue()));
@@ -916,7 +916,7 @@ bool CSSCalcExpressionNodeParser::parseValueExpression(CSSParserTokenRange& toke
 static inline RefPtr<CSSCalcOperation> createBlendHalf(const Length& length, const RenderStyle& style, float progress)
 {
     return CSSCalcOperation::create(CalcOperator::Multiply, createCSS(length, style),
-        CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER), !progress || progress == 1));
+        CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(progress, CSSUnitType::CSS_NUMBER), !progress || progress == 1));
 }
 
 static RefPtr<CSSCalcExpressionNode> createCSS(const CalcExpressionNode& node, const RenderStyle& style)
@@ -924,7 +924,7 @@ static RefPtr<CSSCalcExpressionNode> createCSS(const CalcExpressionNode& node, c
     switch (node.type()) {
     case CalcExpressionNodeType::Number: {
         float value = toCalcExpressionNumber(node).value();
-        return CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER), value == std::trunc(value));
+        return CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(value, CSSUnitType::CSS_NUMBER), value == std::trunc(value));
     }
     case CalcExpressionNodeType::Length:
         return createCSS(toCalcExpressionLength(node).length(), style);
index ed2ea55..1e97c3b 100644 (file)
@@ -67,7 +67,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::UnitType primitiveType() const = 0;
+    virtual CSSUnitType primitiveType() const = 0;
 
     virtual void collectDirectComputationalDependencies(HashSet<CSSPropertyID>&) const = 0;
     virtual void collectDirectRootComputationalDependencies(HashSet<CSSPropertyID>&) const = 0;
@@ -99,7 +99,7 @@ public:
     bool isPositive() const { return m_expression->doubleValue() > 0; }
     bool isNegative() const { return m_expression->doubleValue() < 0; }
     double computeLengthPx(const CSSToLengthConversionData&) const;
-    unsigned short primitiveType() const { return m_expression->primitiveType(); }
+    CSSUnitType primitiveType() const { return m_expression->primitiveType(); }
 
     Ref<CalculationValue> createCalculationValue(const CSSToLengthConversionData&) const;
     void setPermittedValueRange(ValueRange);
index 0de5827..9df1820 100644 (file)
@@ -107,15 +107,15 @@ static Ref<CSSPrimitiveValue> valueForImageSliceSide(const Length& length)
     // These values can be percentages, numbers, or while an animation of mixed types is in progress,
     // a calculation that combines a percentage and a number.
     if (length.isPercent())
-        return CSSValuePool::singleton().createValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
+        return CSSValuePool::singleton().createValue(length.percent(), CSSUnitType::CSS_PERCENTAGE);
     if (length.isFixed())
-        return CSSValuePool::singleton().createValue(length.value(), CSSPrimitiveValue::CSS_NUMBER);
+        return CSSValuePool::singleton().createValue(length.value(), CSSUnitType::CSS_NUMBER);
 
     // Calculating the actual length currently in use would require most of the code from RenderBoxModelObject::paintNinePieceImage.
     // And even if we could do that, it's not clear if that's exactly what we'd want during animation.
     // FIXME: For now, just return 0.
     ASSERT(length.isCalculated());
-    return CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::CSS_NUMBER);
+    return CSSValuePool::singleton().createValue(0, CSSUnitType::CSS_NUMBER);
 }
 
 static Ref<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
@@ -167,7 +167,7 @@ static Ref<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
     auto& cssValuePool = CSSValuePool::singleton();
 
     if (box.top().isRelative())
-        top = cssValuePool.createValue(box.top().value(), CSSPrimitiveValue::CSS_NUMBER);
+        top = cssValuePool.createValue(box.top().value(), CSSUnitType::CSS_NUMBER);
     else
         top = cssValuePool.createValue(box.top());
 
@@ -177,7 +177,7 @@ static Ref<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
         left = top;
     } else {
         if (box.right().isRelative())
-            right = cssValuePool.createValue(box.right().value(), CSSPrimitiveValue::CSS_NUMBER);
+            right = cssValuePool.createValue(box.right().value(), CSSUnitType::CSS_NUMBER);
         else
             right = cssValuePool.createValue(box.right());
 
@@ -186,7 +186,7 @@ static Ref<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
             left = right;
         } else {
             if (box.bottom().isRelative())
-                bottom = cssValuePool.createValue(box.bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
+                bottom = cssValuePool.createValue(box.bottom().value(), CSSUnitType::CSS_NUMBER);
             else
                 bottom = cssValuePool.createValue(box.bottom());
 
@@ -194,7 +194,7 @@ static Ref<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
                 left = right;
             else {
                 if (box.left().isRelative())
-                    left = cssValuePool.createValue(box.left().value(), CSSPrimitiveValue::CSS_NUMBER);
+                    left = cssValuePool.createValue(box.left().value(), CSSUnitType::CSS_NUMBER);
                 else
                     left = cssValuePool.createValue(box.left());
             }
@@ -249,12 +249,12 @@ static Ref<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
 
 inline static Ref<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const RenderStyle& style)
 {
-    return CSSValuePool::singleton().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
+    return CSSValuePool::singleton().createValue(adjustFloatForAbsoluteZoom(value, style), CSSUnitType::CSS_PX);
 }
 
 inline static Ref<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle& style)
 {
-    return CSSValuePool::singleton().createValue(value / style.effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
+    return CSSValuePool::singleton().createValue(value / style.effectiveZoom(), CSSUnitType::CSS_NUMBER);
 }
 
 static Ref<CSSValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle& style)
@@ -271,7 +271,7 @@ static Ref<CSSValue> valueForReflection(const StyleReflection* reflection, const
 
     RefPtr<CSSPrimitiveValue> offset;
     if (reflection->offset().isPercentOrCalculated())
-        offset = CSSValuePool::singleton().createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
+        offset = CSSValuePool::singleton().createValue(reflection->offset().percent(), CSSUnitType::CSS_PERCENTAGE);
     else
         offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
 
@@ -452,7 +452,7 @@ Ref<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(const Re
 static Ref<CSSPrimitiveValue> percentageOrZoomAdjustedValue(Length length, const RenderStyle& style)
 {
     if (length.isPercent())
-        return CSSValuePool::singleton().createValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
+        return CSSValuePool::singleton().createValue(length.percent(), CSSUnitType::CSS_PERCENTAGE);
     
     return zoomAdjustedPixelValue(valueForLength(length, 0), style);
 }
@@ -538,34 +538,34 @@ static Ref<CSSFunctionValue> matrixTransformValue(const TransformationMatrix& tr
     if (transform.isAffine()) {
         transformValue = CSSFunctionValue::create(CSSValueMatrix);
 
-        transformValue->append(cssValuePool.createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.a(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.b(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.c(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.d(), CSSUnitType::CSS_NUMBER));
         transformValue->append(zoomAdjustedNumberValue(transform.e(), style));
         transformValue->append(zoomAdjustedNumberValue(transform.f(), style));
     } else {
         transformValue = CSSFunctionValue::create(CSSValueMatrix3d);
 
-        transformValue->append(cssValuePool.createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m11(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m12(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m13(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m14(), CSSUnitType::CSS_NUMBER));
 
-        transformValue->append(cssValuePool.createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m21(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m22(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m23(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m24(), CSSUnitType::CSS_NUMBER));
 
-        transformValue->append(cssValuePool.createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
-        transformValue->append(cssValuePool.createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m31(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m32(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m33(), CSSUnitType::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m34(), CSSUnitType::CSS_NUMBER));
 
         transformValue->append(zoomAdjustedNumberValue(transform.m41(), style));
         transformValue->append(zoomAdjustedNumberValue(transform.m42(), style));
         transformValue->append(zoomAdjustedNumberValue(transform.m43(), style));
-        transformValue->append(cssValuePool.createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
+        transformValue->append(cssValuePool.createValue(transform.m44(), CSSUnitType::CSS_NUMBER));
     }
 
     return transformValue.releaseNonNull();
@@ -593,7 +593,7 @@ static Ref<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle
 
 static inline Ref<CSSPrimitiveValue> adjustLengthForZoom(double length, const RenderStyle& style, AdjustPixelValuesForComputedStyle adjust)
 {
-    return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length, style) : CSSValuePool::singleton().createValue(length, CSSPrimitiveValue::CSS_PX);
+    return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length, style) : CSSValuePool::singleton().createValue(length, CSSUnitType::CSS_PX);
 }
 
 static inline Ref<CSSPrimitiveValue> adjustLengthForZoom(const Length& length, const RenderStyle& style, AdjustPixelValuesForComputedStyle adjust)
@@ -634,33 +634,33 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
 
         if (filterOperation.type() == FilterOperation::REFERENCE) {
             ReferenceFilterOperation& referenceOperation = downcast<ReferenceFilterOperation>(filterOperation);
-            list->append(cssValuePool.createValue(referenceOperation.url(), CSSPrimitiveValue::CSS_URI));
+            list->append(cssValuePool.createValue(referenceOperation.url(), CSSUnitType::CSS_URI));
         } else {
             RefPtr<CSSFunctionValue> filterValue;
             switch (filterOperation.type()) {
             case FilterOperation::GRAYSCALE: {
                 filterValue = CSSFunctionValue::create(CSSValueGrayscale);
-                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_NUMBER));
+                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
                 break;
             }
             case FilterOperation::SEPIA: {
                 filterValue = CSSFunctionValue::create(CSSValueSepia);
-                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_NUMBER));
+                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
                 break;
             }
             case FilterOperation::SATURATE: {
                 filterValue = CSSFunctionValue::create(CSSValueSaturate);
-                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_NUMBER));
+                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
                 break;
             }
             case FilterOperation::HUE_ROTATE: {
                 filterValue = CSSFunctionValue::create(CSSValueHueRotate);
-                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_DEG));
+                filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_DEG));
                 break;
             }
             case FilterOperation::INVERT: {
                 filterValue = CSSFunctionValue::create(CSSValueInvert);
-                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_NUMBER));
+                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
                 break;
             }
             case FilterOperation::APPLE_INVERT_LIGHTNESS: {
@@ -669,17 +669,17 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
             }
             case FilterOperation::OPACITY: {
                 filterValue = CSSFunctionValue::create(CSSValueOpacity);
-                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_NUMBER));
+                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
                 break;
             }
             case FilterOperation::BRIGHTNESS: {
                 filterValue = CSSFunctionValue::create(CSSValueBrightness);
-                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_NUMBER));
+                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
                 break;
             }
             case FilterOperation::CONTRAST: {
                 filterValue = CSSFunctionValue::create(CSSValueContrast);
-                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSPrimitiveValue::CSS_NUMBER));
+                filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
                 break;
             }
             case FilterOperation::BLUR: {
@@ -709,7 +709,7 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
 static Ref<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle& style)
 {
     if (!trackBreadth.isLength())
-        return CSSValuePool::singleton().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
+        return CSSValuePool::singleton().createValue(trackBreadth.flex(), CSSUnitType::CSS_FR);
 
     const Length& trackBreadthLength = trackBreadth.length();
     if (trackBreadthLength.isAuto())
@@ -730,7 +730,7 @@ static Ref<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSi
     default:
         ASSERT(trackSize.type() == MinMaxTrackSizing);
         if (trackSize.minTrackBreadth().isAuto() && trackSize.maxTrackBreadth().isFlex())
-            return CSSValuePool::singleton().createValue(trackSize.maxTrackBreadth().flex(), CSSPrimitiveValue::CSS_FR);
+            return CSSValuePool::singleton().createValue(trackSize.maxTrackBreadth().flex(), CSSUnitType::CSS_FR);
 
         auto minMaxTrackBreadths = CSSFunctionValue::create(CSSValueMinmax);
         minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style));
@@ -798,7 +798,7 @@ void OrderedNamedLinesCollector::appendLines(CSSGridLineNamesValue& lineNamesVal
 
     auto& cssValuePool = CSSValuePool::singleton();
     for (const auto& lineName : iter->value)
-        lineNamesValue.append(cssValuePool.createValue(lineName, CSSPrimitiveValue::CSS_STRING));
+        lineNamesValue.append(cssValuePool.createValue(lineName, CSSUnitType::CSS_STRING));
 }
 
 void OrderedNamedLinesCollector::collectLineNamesForIndex(CSSGridLineNamesValue& lineNamesValue, unsigned i) const
@@ -952,17 +952,17 @@ static Ref<CSSValue> valueForGridPosition(const GridPosition& position)
         return cssValuePool.createIdentifierValue(CSSValueAuto);
 
     if (position.isNamedGridArea())
-        return cssValuePool.createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING);
+        return cssValuePool.createValue(position.namedGridLine(), CSSUnitType::CSS_STRING);
 
     auto list = CSSValueList::createSpaceSeparated();
     if (position.isSpan()) {
         list->append(cssValuePool.createIdentifierValue(CSSValueSpan));
-        list->append(cssValuePool.createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
+        list->append(cssValuePool.createValue(position.spanPosition(), CSSUnitType::CSS_NUMBER));
     } else
-        list->append(cssValuePool.createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
+        list->append(cssValuePool.createValue(position.integerPosition(), CSSUnitType::CSS_NUMBER));
 
     if (!position.namedGridLine().isNull())
-        list->append(cssValuePool.createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
+        list->append(cssValuePool.createValue(position.namedGridLine(), CSSUnitType::CSS_STRING));
     return list;
 }
 
@@ -974,9 +974,9 @@ static Ref<CSSValue> createTransitionPropertyValue(const Animation& animation)
     case Animation::AnimateAll:
         return CSSValuePool::singleton().createIdentifierValue(CSSValueAll);
     case Animation::AnimateSingleProperty:
-        return CSSValuePool::singleton().createValue(getPropertyNameString(animation.property()), CSSPrimitiveValue::CSS_STRING);
+        return CSSValuePool::singleton().createValue(getPropertyNameString(animation.property()), CSSUnitType::CSS_STRING);
     case Animation::AnimateUnknownProperty:
-        return CSSValuePool::singleton().createValue(animation.unknownProperty(), CSSPrimitiveValue::CSS_STRING);
+        return CSSValuePool::singleton().createValue(animation.unknownProperty(), CSSUnitType::CSS_STRING);
     }
     ASSERT_NOT_REACHED();
     return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
@@ -1237,10 +1237,10 @@ static Ref<CSSValueList> delayValue(const AnimationList* animationList)
     auto list = CSSValueList::createCommaSeparated();
     if (animationList) {
         for (size_t i = 0; i < animationList->size(); ++i)
-            list->append(cssValuePool.createValue(animationList->animation(i).delay(), CSSPrimitiveValue::CSS_S));
+            list->append(cssValuePool.createValue(animationList->animation(i).delay(), CSSUnitType::CSS_S));
     } else {
         // Note that initialAnimationDelay() is used for both transitions and animations
-        list->append(cssValuePool.createValue(Animation::initialDelay(), CSSPrimitiveValue::CSS_S));
+        list->append(cssValuePool.createValue(Animation::initialDelay(), CSSUnitType::CSS_S));
     }
     return list;
 }
@@ -1251,10 +1251,10 @@ static Ref<CSSValueList> durationValue(const AnimationList* animationList)
     auto list = CSSValueList::createCommaSeparated();
     if (animationList) {
         for (size_t i = 0; i < animationList->size(); ++i)
-            list->append(cssValuePool.createValue(animationList->animation(i).duration(), CSSPrimitiveValue::CSS_S));
+            list->append(cssValuePool.createValue(animationList->animation(i).duration(), CSSUnitType::CSS_S));
     } else {
         // Note that initialAnimationDuration() is used for both transitions and animations
-        list->append(cssValuePool.createValue(Animation::initialDuration(), CSSPrimitiveValue::CSS_S));
+        list->append(cssValuePool.createValue(Animation::initialDuration(), CSSUnitType::CSS_S));
     }
     return list;
 }
@@ -1531,7 +1531,7 @@ static Ref<CSSValue> textUnderlineOffsetToCSSValue(const TextUnderlineOffset& te
     if (textUnderlineOffset.isAuto())
         return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
     ASSERT(textUnderlineOffset.isLength());
-    return CSSValuePool::singleton().createValue(textUnderlineOffset.lengthValue(), CSSPrimitiveValue::CSS_PX);
+    return CSSValuePool::singleton().createValue(textUnderlineOffset.lengthValue(), CSSUnitType::CSS_PX);
 }
 
 static Ref<CSSValue> textDecorationThicknessToCSSValue(const TextDecorationThickness& textDecorationThickness)
@@ -1541,7 +1541,7 @@ static Ref<CSSValue> textDecorationThicknessToCSSValue(const TextDecorationThick
     if (textDecorationThickness.isFromFont())
         return CSSValuePool::singleton().createIdentifierValue(CSSValueFromFont);
     ASSERT(textDecorationThickness.isLength());
-    return CSSValuePool::singleton().createValue(textDecorationThickness.lengthValue(), CSSPrimitiveValue::CSS_PX);
+    return CSSValuePool::singleton().createValue(textDecorationThickness.lengthValue(), CSSUnitType::CSS_PX);
 }
 
 static Ref<CSSValue> renderEmphasisPositionFlagsToCSSValue(OptionSet<TextEmphasisPosition> textEmphasisPosition)
@@ -1645,7 +1645,7 @@ static Ref<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderSt
 
 static Ref<CSSValue> altTextToCSSValue(const RenderStyle& style)
 {
-    return CSSValuePool::singleton().createValue(style.contentAltText(), CSSPrimitiveValue::CSS_STRING);
+    return CSSValuePool::singleton().createValue(style.contentAltText(), CSSUnitType::CSS_STRING);
 }
     
 static Ref<CSSValueList> contentToCSSValue(const RenderStyle& style)
@@ -1654,11 +1654,11 @@ static Ref<CSSValueList> contentToCSSValue(const RenderStyle& style)
     auto list = CSSValueList::createSpaceSeparated();
     for (auto* contentData = style.contentData(); contentData; contentData = contentData->next()) {
         if (is<CounterContentData>(*contentData))
-            list->append(cssValuePool.createValue(downcast<CounterContentData>(*contentData).counter().identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
+            list->append(cssValuePool.createValue(downcast<CounterContentData>(*contentData).counter().identifier(), CSSUnitType::CSS_COUNTER_NAME));
         else if (is<ImageContentData>(*contentData))
             list->append(downcast<ImageContentData>(*contentData).image().cssValue());
         else if (is<TextContentData>(*contentData))
-            list->append(cssValuePool.createValue(downcast<TextContentData>(*contentData).text(), CSSPrimitiveValue::CSS_STRING));
+            list->append(cssValuePool.createValue(downcast<TextContentData>(*contentData).text(), CSSUnitType::CSS_STRING));
     }
     return list;
 }
@@ -1672,9 +1672,9 @@ static Ref<CSSValue> counterToCSSValue(const RenderStyle& style, CSSPropertyID p
     auto& cssValuePool = CSSValuePool::singleton();
     auto list = CSSValueList::createSpaceSeparated();
     for (auto& keyValue : *map) {
-        list->append(cssValuePool.createValue(keyValue.key, CSSPrimitiveValue::CSS_STRING));
+        list->append(cssValuePool.createValue(keyValue.key, CSSUnitType::CSS_STRING));
         double number = (propertyID == CSSPropertyCounterIncrement ? keyValue.value.incrementValue : keyValue.value.resetValue).valueOr(0);
-        list->append(cssValuePool.createValue(number, CSSPrimitiveValue::CSS_NUMBER));
+        list->append(cssValuePool.createValue(number, CSSUnitType::CSS_NUMBER));
     }
     return list;
 }
@@ -1716,7 +1716,7 @@ static Ref<CSSPrimitiveValue> fontSizeFromStyle(const RenderStyle& style)
 
 Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue(FontSelectionValue weight)
 {
-    return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
+    return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSUnitType::CSS_NUMBER);
 }
 
 Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontWeightFromStyleValue(FontSelectionValue weight)
@@ -1733,7 +1733,7 @@ static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle& style)
 
 Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue(FontSelectionValue stretch)
 {
-    return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSPrimitiveValue::CSS_PERCENTAGE);
+    return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSUnitType::CSS_PERCENTAGE);
 }
 
 Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontStretchFromStyleValue(FontSelectionValue stretch)
@@ -1750,7 +1750,7 @@ static Ref<CSSPrimitiveValue> fontStretchFromStyle(const RenderStyle& style)
 
 Ref<CSSFontStyleValue> ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue(FontSelectionValue italic)
 {
-    return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
+    return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSUnitType::CSS_DEG));
 }
 
 Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(Optional<FontSelectionValue> italic, FontStyleAxis fontStyleAxis)
@@ -2391,7 +2391,7 @@ static Ref<CSSFontValue> fontShorthandValueForSelectionProperties(const FontDesc
     if (auto value = fontWeightKeyword(weight))
         computedFont->weight = CSSValuePool::singleton().createIdentifierValue(value.value());
     else if (isCSS21Weight(weight))
-        computedFont->weight = CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
+        computedFont->weight = CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSUnitType::CSS_NUMBER);
     else
         return CSSFontValue::create();
 
@@ -2639,13 +2639,13 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyWebkitBoxDirection:
             return cssValuePool.createValue(style.boxDirection());
         case CSSPropertyWebkitBoxFlex:
-            return cssValuePool.createValue(style.boxFlex(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.boxFlex(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWebkitBoxFlexGroup:
-            return cssValuePool.createValue(style.boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.boxFlexGroup(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWebkitBoxLines:
             return cssValuePool.createValue(style.boxLines());
         case CSSPropertyWebkitBoxOrdinalGroup:
-            return cssValuePool.createValue(style.boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.boxOrdinalGroup(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWebkitBoxOrient:
             return cssValuePool.createValue(style.boxOrient());
         case CSSPropertyWebkitBoxPack:
@@ -2670,7 +2670,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyColumnCount:
             if (style.hasAutoColumnCount())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
-            return cssValuePool.createValue(style.columnCount(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.columnCount(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyColumnFill:
             return cssValuePool.createValue(style.columnFill());
         case CSSPropertyColumnGap:
@@ -2702,7 +2702,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
             return zoomAdjustedPixelValue(style.columnWidth(), style);
         case CSSPropertyTabSize:
-            return cssValuePool.createValue(style.tabSize().widthInPixels(1.0), style.tabSize().isSpaces() ? CSSPrimitiveValue::CSS_NUMBER : CSSPrimitiveValue::CSS_PX);
+            return cssValuePool.createValue(style.tabSize().widthInPixels(1.0), style.tabSize().isSpaces() ? CSSUnitType::CSS_NUMBER : CSSUnitType::CSS_PX);
         case CSSPropertyCursor: {
             RefPtr<CSSValueList> list;
             auto* cursors = style.cursors();
@@ -2762,7 +2762,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyPlaceSelf:
             return getCSSPropertyValuesForShorthandProperties(placeSelfShorthand());
         case CSSPropertyOrder:
-            return cssValuePool.createValue(style.order(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.order(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyFloat:
             if (style.display() != DisplayType::None && style.hasOutOfFlowPosition())
                 return cssValuePool.createIdentifierValue(CSSValueNone);
@@ -2878,19 +2878,19 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyWebkitHyphenateCharacter:
             if (style.hyphenationString().isNull())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
-            return cssValuePool.createValue(style.hyphenationString(), CSSPrimitiveValue::CSS_STRING);
+            return cssValuePool.createValue(style.hyphenationString(), CSSUnitType::CSS_STRING);
         case CSSPropertyWebkitHyphenateLimitAfter:
             if (style.hyphenationLimitAfter() < 0)
                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
-            return CSSPrimitiveValue::create(style.hyphenationLimitAfter(), CSSPrimitiveValue::CSS_NUMBER);
+            return CSSPrimitiveValue::create(style.hyphenationLimitAfter(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWebkitHyphenateLimitBefore:
             if (style.hyphenationLimitBefore() < 0)
                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
-            return CSSPrimitiveValue::create(style.hyphenationLimitBefore(), CSSPrimitiveValue::CSS_NUMBER);
+            return CSSPrimitiveValue::create(style.hyphenationLimitBefore(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWebkitHyphenateLimitLines:
             if (style.hyphenationLimitLines() < 0)
                 return CSSPrimitiveValue::createIdentifier(CSSValueNoLimit);
-            return CSSPrimitiveValue::create(style.hyphenationLimitLines(), CSSPrimitiveValue::CSS_NUMBER);
+            return CSSPrimitiveValue::create(style.hyphenationLimitLines(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWebkitBorderFit:
             if (style.borderFit() == BorderFit::Border)
                 return cssValuePool.createIdentifierValue(CSSValueBorder);
@@ -2903,7 +2903,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             return CSSPrimitiveValue::create(style.imageRendering());
 #if ENABLE(CSS_IMAGE_RESOLUTION)
         case CSSPropertyImageResolution:
-            return cssValuePool.createValue(style.imageResolution(), CSSPrimitiveValue::CSS_DPPX);
+            return cssValuePool.createValue(style.imageResolution(), CSSUnitType::CSS_DPPX);
 #endif
         case CSSPropertyLeft:
             return positionOffsetValue(style, CSSPropertyLeft, renderer);
@@ -2914,7 +2914,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyWebkitLineClamp:
             if (style.lineClamp().isNone())
                 return cssValuePool.createIdentifierValue(CSSValueNone);
-            return cssValuePool.createValue(style.lineClamp().value(), style.lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.lineClamp().value(), style.lineClamp().isPercentage() ? CSSUnitType::CSS_PERCENTAGE : CSSUnitType::CSS_NUMBER);
         case CSSPropertyLineHeight:
             return lineHeightFromStyle(style);
         case CSSPropertyListStyleImage:
@@ -2928,7 +2928,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyWebkitLocale:
             if (style.locale().isNull())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
-            return cssValuePool.createValue(style.locale(), CSSPrimitiveValue::CSS_STRING);
+            return cssValuePool.createValue(style.locale(), CSSUnitType::CSS_STRING);
         case CSSPropertyMarginTop:
             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginTop, &RenderBoxModelObject::marginTop>(style, renderer);
         case CSSPropertyMarginRight: {
@@ -2956,7 +2956,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyWebkitMarqueeRepetition:
             if (style.marqueeLoopCount() < 0)
                 return cssValuePool.createIdentifierValue(CSSValueInfinite);
-            return cssValuePool.createValue(style.marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.marqueeLoopCount(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWebkitMarqueeStyle:
             return cssValuePool.createValue(style.marqueeBehavior());
         case CSSPropertyWebkitUserModify:
@@ -2998,11 +2998,11 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             return list;
         }
         case CSSPropertyOpacity:
-            return cssValuePool.createValue(style.opacity(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.opacity(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyOrphans:
             if (style.hasAutoOrphans())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
-            return cssValuePool.createValue(style.orphans(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.orphans(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyOutlineColor:
             return m_allowVisitedStyle ? cssValuePool.createColorValue(style.visitedDependentColor(CSSPropertyOutlineColor)) : currentColorOrValidColor(&style, style.outlineColor());
         case CSSPropertyOutlineOffset:
@@ -3090,7 +3090,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             case TextEmphasisMark::None:
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             case TextEmphasisMark::Custom:
-                return cssValuePool.createValue(style.textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING);
+                return cssValuePool.createValue(style.textEmphasisCustomMark(), CSSUnitType::CSS_STRING);
             case TextEmphasisMark::Auto:
                 ASSERT_NOT_REACHED();
 #if ASSERT_DISABLED
@@ -3142,7 +3142,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
             if (style.textSizeAdjust().isNone())
                 return cssValuePool.createIdentifierValue(CSSValueNone);
-            return CSSPrimitiveValue::create(style.textSizeAdjust().percentage(), CSSPrimitiveValue::CSS_PERCENTAGE);
+            return CSSPrimitiveValue::create(style.textSizeAdjust().percentage(), CSSUnitType::CSS_PERCENTAGE);
 #endif
         case CSSPropertyWebkitTextStrokeColor:
             return currentColorOrValidColor(&style, style.textStrokeColor());
@@ -3186,7 +3186,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyWidows:
             if (style.hasAutoWidows())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
-            return cssValuePool.createValue(style.widows(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.widows(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyWidth:
             if (renderer && !renderer->isRenderSVGModelObject()) {
                 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-property,
@@ -3228,9 +3228,9 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyZIndex:
             if (style.hasAutoZIndex())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
-            return cssValuePool.createValue(style.zIndex(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.zIndex(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyZoom:
-            return cssValuePool.createValue(style.zoom(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.zoom(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyBoxSizing:
             if (style.boxSizing() == BoxSizing::ContentBox)
                 return cssValuePool.createIdentifierValue(CSSValueContentBox);
@@ -3296,10 +3296,10 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
                     if (iterationCount == Animation::IterationCountInfinite)
                         list->append(cssValuePool.createIdentifierValue(CSSValueInfinite));
                     else
-                        list->append(cssValuePool.createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
+                        list->append(cssValuePool.createValue(iterationCount, CSSUnitType::CSS_NUMBER));
                 }
             } else
-                list->append(cssValuePool.createValue(Animation::initialIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
+                list->append(cssValuePool.createValue(Animation::initialIterationCount(), CSSUnitType::CSS_NUMBER));
             return list;
         }
         case CSSPropertyAnimationName: {
@@ -3307,7 +3307,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             const AnimationList* t = style.animations();
             if (t) {
                 for (size_t i = 0; i < t->size(); ++i)
-                    list->append(cssValuePool.createValue(t->animation(i).name(), CSSPrimitiveValue::CSS_STRING));
+                    list->append(cssValuePool.createValue(t->animation(i).name(), CSSUnitType::CSS_STRING));
             } else
                 list->append(cssValuePool.createIdentifierValue(CSSValueNone));
             return list;
@@ -3377,8 +3377,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             // Not a real style property -- used by the editing engine -- so has no computed value.
             break;
         case CSSPropertyWebkitInitialLetter: {
-            auto drop = !style.initialLetterDrop() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style.initialLetterDrop(), CSSPrimitiveValue::CSS_NUMBER);
-            auto size = !style.initialLetterHeight() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style.initialLetterHeight(), CSSPrimitiveValue::CSS_NUMBER);
+            auto drop = !style.initialLetterDrop() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style.initialLetterDrop(), CSSUnitType::CSS_NUMBER);
+            auto size = !style.initialLetterHeight() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style.initialLetterHeight(), CSSUnitType::CSS_NUMBER);
             return cssValuePool.createValue(Pair::create(WTFMove(drop), WTFMove(size)));
         }
         case CSSPropertyWebkitMarginBottomCollapse:
@@ -3491,9 +3491,9 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
                     auto list = CSSValueList::createSpaceSeparated();
                     auto& animation = animationList->animation(i);
                     list->append(createTransitionPropertyValue(animation));
-                    list->append(cssValuePool.createValue(animation.duration(), CSSPrimitiveValue::CSS_S));
+                    list->append(cssValuePool.createValue(animation.duration(), CSSUnitType::CSS_S));
                     list->append(createTimingFunctionValue(*animation.timingFunction()));
-                    list->append(cssValuePool.createValue(animation.delay(), CSSPrimitiveValue::CSS_S));
+                    list->append(cssValuePool.createValue(animation.delay(), CSSUnitType::CSS_S));
                     transitionsList->append(WTFMove(list));
                 }
                 return transitionsList;
@@ -3502,9 +3502,9 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             auto list = CSSValueList::createSpaceSeparated();
             // transition-property default value.
             list->append(cssValuePool.createIdentifierValue(CSSValueAll));
-            list->append(cssValuePool.createValue(Animation::initialDuration(), CSSPrimitiveValue::CSS_S));
+            list->append(cssValuePool.createValue(Animation::initialDuration(), CSSUnitType::CSS_S));
             list->append(createTimingFunctionValue(Animation::initialTimingFunction()));
-            list->append(cssValuePool.createValue(Animation::initialDelay(), CSSPrimitiveValue::CSS_S));
+            list->append(cssValuePool.createValue(Animation::initialDelay(), CSSUnitType::CSS_S));
             return list;
         }
         case CSSPropertyPointerEvents:
@@ -3512,7 +3512,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyWebkitLineGrid:
             if (style.lineGrid().isNull())
                 return cssValuePool.createIdentifierValue(CSSValueNone);
-            return cssValuePool.createValue(style.lineGrid(), CSSPrimitiveValue::CSS_STRING);
+            return cssValuePool.createValue(style.lineGrid(), CSSUnitType::CSS_STRING);
         case CSSPropertyWebkitLineSnap:
             return CSSPrimitiveValue::create(style.lineSnap());
         case CSSPropertyWebkitLineAlign:
@@ -3538,7 +3538,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             if (!operation)
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             if (is<ReferenceClipPathOperation>(*operation))
-                return CSSPrimitiveValue::create(downcast<ReferenceClipPathOperation>(*operation).url(), CSSPrimitiveValue::CSS_URI);
+                return CSSPrimitiveValue::create(downcast<ReferenceClipPathOperation>(*operation).url(), CSSUnitType::CSS_URI);
             auto list = CSSValueList::createSpaceSeparated();
             if (is<ShapeClipPathOperation>(*operation)) {
                 auto& shapeOperation = downcast<ShapeClipPathOperation>(*operation);
@@ -3553,7 +3553,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyShapeMargin:
             return cssValuePool.createValue(style.shapeMargin(), style);
         case CSSPropertyShapeImageThreshold:
-            return cssValuePool.createValue(style.shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool.createValue(style.shapeImageThreshold(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyShapeOutside:
             return shapePropertyValue(style, style.shapeOutside());
         case CSSPropertyFilter:
@@ -3751,7 +3751,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
         case CSSPropertyStrokeColor:
             return currentColorOrValidColor(&style, style.strokeColor());
         case CSSPropertyStrokeMiterlimit:
-            return CSSPrimitiveValue::create(style.strokeMiterLimit(), CSSPrimitiveValue::CSS_NUMBER);
+            return CSSPrimitiveValue::create(style.strokeMiterLimit(), CSSUnitType::CSS_NUMBER);
 
         /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
         case CSSPropertyAll:
index cd016cc..9e6ab68 100644 (file)
@@ -218,7 +218,7 @@ RefPtr<CSSCrossfadeValue> CSSCrossfadeValue::blend(const CSSCrossfadeValue& from
     double toPercentage = m_percentageValue->doubleValue();
     if (m_percentageValue->isPercentage())
         toPercentage /= 100.0;
-    auto percentageValue = CSSPrimitiveValue::create(blendFunc(fromPercentage, toPercentage, progress), CSSPrimitiveValue::CSS_NUMBER);
+    auto percentageValue = CSSPrimitiveValue::create(blendFunc(fromPercentage, toPercentage, progress), CSSUnitType::CSS_NUMBER);
 
     return CSSCrossfadeValue::create(WTFMove(fromImageValue), WTFMove(toImageValue), WTFMove(percentageValue), from.isPrefixed() && isPrefixed());
 }
index 13a73e3..65cf4c5 100644 (file)
@@ -58,7 +58,7 @@ String CSSCustomPropertyValue::customCSSText() const
         }, [&](const Ref<CSSVariableData>& value) {
             m_stringValue = value->tokenRange().serialize();
         }, [&](const Length& value) {
-            m_stringValue = CSSPrimitiveValue::create(value.value(), CSSPrimitiveValue::CSS_PX)->cssText();
+            m_stringValue = CSSPrimitiveValue::create(value.value(), CSSUnitType::CSS_PX)->cssText();
         }, [&](const Ref<StyleImage>& value) {
             m_stringValue = value->cssValue()->cssText();
         });
index 3a64622..982973a 100644 (file)
@@ -224,14 +224,14 @@ static FontSelectionRange calculateItalicRange(CSSValue& value)
     auto length = rangeValue.obliqueValues->length();
     if (length == 1) {
         auto& primitiveValue = downcast<CSSPrimitiveValue>(*rangeValue.obliqueValues->item(0));
-        FontSelectionValue result(primitiveValue.value<float>(CSSPrimitiveValue::CSS_DEG));
+        FontSelectionValue result(primitiveValue.value<float>(CSSUnitType::CSS_DEG));
         return { result, result };
     }
     ASSERT(length == 2);
     auto& primitiveValue1 = downcast<CSSPrimitiveValue>(*rangeValue.obliqueValues->item(0));
     auto& primitiveValue2 = downcast<CSSPrimitiveValue>(*rangeValue.obliqueValues->item(1));
-    FontSelectionValue result1(primitiveValue1.value<float>(CSSPrimitiveValue::CSS_DEG));
-    FontSelectionValue result2(primitiveValue2.value<float>(CSSPrimitiveValue::CSS_DEG));
+    FontSelectionValue result1(primitiveValue1.value<float>(CSSUnitType::CSS_DEG));
+    FontSelectionValue result2(primitiveValue2.value<float>(CSSUnitType::CSS_DEG));
     return { result1, result2 };
 }
 
index a978968..8624df8 100644 (file)
@@ -52,7 +52,7 @@ public:
             auto valueID = fontStyleValue->valueID();
             return valueID == CSSValueItalic || valueID == CSSValueOblique;
         }
-        return obliqueValue->value<float>(CSSPrimitiveValue::CSS_DEG) >= static_cast<float>(italicValue());
+        return obliqueValue->value<float>(CSSUnitType::CSS_DEG) >= static_cast<float>(italicValue());
     }
 
     Ref<CSSPrimitiveValue> fontStyleValue;
index 7ace1c5..0ce45c2 100644 (file)
@@ -70,8 +70,8 @@ RefPtr<Image> CSSGradientValue::image(RenderElement& renderer, const FloatSize&
 // Should only ever be called for deprecated gradients.
 static inline bool compareStops(const CSSGradientColorStop& a, const CSSGradientColorStop& b)
 {
-    double aVal = a.m_position->doubleValue(CSSPrimitiveValue::CSS_NUMBER);
-    double bVal = b.m_position->doubleValue(CSSPrimitiveValue::CSS_NUMBER);
+    double aVal = a.m_position->doubleValue(CSSUnitType::CSS_NUMBER);
+    double bVal = b.m_position->doubleValue(CSSUnitType::CSS_NUMBER);
 
     return aVal < bVal;
 }
@@ -334,9 +334,9 @@ Gradient::ColorStopVector CSSGradientValue::computeStops(GradientAdapter& gradie
         for (auto& stop : m_stops) {
             float offset;
             if (stop.m_position->isPercentage())
-                offset = stop.m_position->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE) / 100;
+                offset = stop.m_position->floatValue(CSSUnitType::CSS_PERCENTAGE) / 100;
             else
-                offset = stop.m_position->floatValue(CSSPrimitiveValue::CSS_NUMBER);
+                offset = stop.m_position->floatValue(CSSUnitType::CSS_NUMBER);
 
             Color color = stop.m_resolvedColor;
             if (style.hasAppleColorFilter())
@@ -366,7 +366,7 @@ Gradient::ColorStopVector CSSGradientValue::computeStops(GradientAdapter& gradie
         if (stop.m_position) {
             auto& positionValue = *stop.m_position;
             if (positionValue.isPercentage())
-                stops[i].offset = positionValue.floatValue(CSSPrimitiveValue::CSS_PERCENTAGE) / 100;
+                stops[i].offset = positionValue.floatValue(CSSUnitType::CSS_PERCENTAGE) / 100;
             else if (positionValue.isLength() || positionValue.isViewportPercentageLength() || positionValue.isCalculatedPercentageWithLength()) {
                 float length;
                 if (positionValue.isLength())
@@ -377,7 +377,7 @@ Gradient::ColorStopVector CSSGradientValue::computeStops(GradientAdapter& gradie
                 }
                 stops[i].offset = (gradientLength > 0) ? length / gradientLength : 0;
             } else if (positionValue.isAngle())
-                stops[i].offset = positionValue.floatValue(CSSPrimitiveValue::CSS_DEG) / 360;
+                stops[i].offset = positionValue.floatValue(CSSUnitType::CSS_DEG) / 360;
             else {
                 ASSERT_NOT_REACHED();
                 stops[i].offset = 0;
@@ -694,7 +694,7 @@ bool CSSGradientValue::knownToBeOpaque(const RenderElement& renderer) const
 static void appendGradientStops(StringBuilder& builder, const Vector<CSSGradientColorStop, 2>& stops)
 {
     for (auto& stop : stops) {
-        double position = stop.m_position->doubleValue(CSSPrimitiveValue::CSS_NUMBER);
+        double position = stop.m_position->doubleValue(CSSUnitType::CSS_NUMBER);
         if (!position)
             builder.append(", from(", stop.m_color->cssText(), ')');
         else if (position == 1)
@@ -858,7 +858,7 @@ Ref<Gradient> CSSLinearGradientValue::createGradient(RenderElement& renderer, co
     FloatPoint firstPoint;
     FloatPoint secondPoint;
     if (m_angle) {
-        float angle = m_angle->floatValue(CSSPrimitiveValue::CSS_DEG);
+        float angle = m_angle->floatValue(CSSUnitType::CSS_DEG);
         endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType);
     } else {
         switch (m_gradientType) {
@@ -1376,7 +1376,7 @@ Ref<Gradient> CSSConicGradientValue::createGradient(RenderElement& renderer, con
 
     float angleRadians = 0;
     if (m_angle)
-        angleRadians = m_angle->floatValue(CSSPrimitiveValue::CSS_RAD);
+        angleRadians = m_angle->floatValue(CSSUnitType::CSS_RAD);
 
     Gradient::ConicData data { centerPoint, angleRadians };
     ConicGradientAdapter adapter;
index e1420d1..0acb47c 100644 (file)
@@ -100,7 +100,7 @@ String CSSImageValue::customCSSText() const
 Ref<DeprecatedCSSOMValue> CSSImageValue::createDeprecatedCSSOMWrapper(CSSStyleDeclaration& styleDeclaration) const
 {
     // NOTE: We expose CSSImageValues as URI primitive values in CSSOM to maintain old behavior.
-    return DeprecatedCSSOMPrimitiveValue::create(CSSPrimitiveValue::create(m_url, CSSPrimitiveValue::CSS_URI), styleDeclaration);
+    return DeprecatedCSSOMPrimitiveValue::create(CSSPrimitiveValue::create(m_url, CSSUnitType::CSS_URI), styleDeclaration);
 }
 
 bool CSSImageValue::knownToBeOpaque(const RenderElement& renderer) const
index 9da5be6..283307c 100644 (file)
 
 namespace WebCore {
 
-static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::UnitType unitType)
+static inline bool isValidCSSUnitTypeForDoubleConversion(CSSUnitType unitType)
 {
     switch (unitType) {
-    case CSSPrimitiveValue::CSS_CALC:
-    case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH:
-    case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER:
-    case CSSPrimitiveValue::CSS_CHS:
-    case CSSPrimitiveValue::CSS_CM:
-    case CSSPrimitiveValue::CSS_DEG:
-    case CSSPrimitiveValue::CSS_DIMENSION:
-    case CSSPrimitiveValue::CSS_EMS:
-    case CSSPrimitiveValue::CSS_EXS:
-    case CSSPrimitiveValue::CSS_FR:
-    case CSSPrimitiveValue::CSS_GRAD:
-    case CSSPrimitiveValue::CSS_HZ:
-    case CSSPrimitiveValue::CSS_IN:
-    case CSSPrimitiveValue::CSS_KHZ:
-    case CSSPrimitiveValue::CSS_MM:
-    case CSSPrimitiveValue::CSS_MS:
-    case CSSPrimitiveValue::CSS_NUMBER:
-    case CSSPrimitiveValue::CSS_PC:
-    case CSSPrimitiveValue::CSS_PERCENTAGE:
-    case CSSPrimitiveValue::CSS_PT:
-    case CSSPrimitiveValue::CSS_PX:
-    case CSSPrimitiveValue::CSS_Q:
-    case CSSPrimitiveValue::CSS_QUIRKY_EMS:
-    case CSSPrimitiveValue::CSS_RAD:
-    case CSSPrimitiveValue::CSS_REMS:
-    case CSSPrimitiveValue::CSS_S:
-    case CSSPrimitiveValue::CSS_TURN:
-    case CSSPrimitiveValue::CSS_VH:
-    case CSSPrimitiveValue::CSS_VMAX:
-    case CSSPrimitiveValue::CSS_VMIN:
-    case CSSPrimitiveValue::CSS_VW:
+    case CSSUnitType::CSS_CALC:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_CHS:
+    case CSSUnitType::CSS_CM:
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_DIMENSION:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_FR:
+    case CSSUnitType::CSS_GRAD:
+    case CSSUnitType::CSS_HZ:
+    case CSSUnitType::CSS_IN:
+    case CSSUnitType::CSS_KHZ:
+    case CSSUnitType::CSS_MM:
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_NUMBER:
+    case CSSUnitType::CSS_PC:
+    case CSSUnitType::CSS_PERCENTAGE:
+    case CSSUnitType::CSS_PT:
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_Q:
+    case CSSUnitType::CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_RAD:
+    case CSSUnitType::CSS_REMS:
+    case CSSUnitType::CSS_S:
+    case CSSUnitType::CSS_TURN:
+    case CSSUnitType::CSS_VH:
+    case CSSUnitType::CSS_VMAX:
+    case CSSUnitType::CSS_VMIN:
+    case CSSUnitType::CSS_VW:
         return true;
-    case CSSPrimitiveValue::CSS_DPCM:
-    case CSSPrimitiveValue::CSS_DPI:
-    case CSSPrimitiveValue::CSS_DPPX:
+    case CSSUnitType::CSS_DPCM:
+    case CSSUnitType::CSS_DPI:
+    case CSSUnitType::CSS_DPPX:
 #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
         return true;
 #else
         return false;
 #endif
-    case CSSPrimitiveValue::CSS_ATTR:
-    case CSSPrimitiveValue::CSS_COUNTER:
-    case CSSPrimitiveValue::CSS_COUNTER_NAME:
-    case CSSPrimitiveValue::CSS_FONT_FAMILY:
-    case CSSPrimitiveValue::CSS_IDENT:
-    case CSSPrimitiveValue::CSS_PAIR:
-    case CSSPrimitiveValue::CSS_PROPERTY_ID:
-    case CSSPrimitiveValue::CSS_QUAD:
-    case CSSPrimitiveValue::CSS_RECT:
-    case CSSPrimitiveValue::CSS_RGBCOLOR:
-    case CSSPrimitiveValue::CSS_SHAPE:
-    case CSSPrimitiveValue::CSS_STRING:
-    case CSSPrimitiveValue::CSS_UNICODE_RANGE:
-    case CSSPrimitiveValue::CSS_UNKNOWN:
-    case CSSPrimitiveValue::CSS_URI:
-    case CSSPrimitiveValue::CSS_VALUE_ID:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_COUNTER:
+    case CSSUnitType::CSS_COUNTER_NAME:
+    case CSSUnitType::CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_IDENT:
+    case CSSUnitType::CSS_PAIR:
+    case CSSUnitType::CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_QUAD:
+    case CSSUnitType::CSS_RECT:
+    case CSSUnitType::CSS_RGBCOLOR:
+    case CSSUnitType::CSS_SHAPE:
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_UNICODE_RANGE:
+    case CSSUnitType::CSS_UNKNOWN:
+    case CSSUnitType::CSS_URI:
+    case CSSUnitType::CSS_VALUE_ID:
         return false;
     }
 
@@ -115,60 +115,60 @@ static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit
 
 #if !ASSERT_DISABLED
 
-static inline bool isStringType(CSSPrimitiveValue::UnitType type)
+static inline bool isStringType(CSSUnitType type)
 {
     switch (type) {
-    case CSSPrimitiveValue::CSS_STRING:
-    case CSSPrimitiveValue::CSS_URI:
-    case CSSPrimitiveValue::CSS_ATTR:
-    case CSSPrimitiveValue::CSS_COUNTER_NAME:
-    case CSSPrimitiveValue::CSS_DIMENSION:
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_URI:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_COUNTER_NAME:
+    case CSSUnitType::CSS_DIMENSION:
         return true;
-    case CSSPrimitiveValue::CSS_CALC:
-    case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH:
-    case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER:
-    case CSSPrimitiveValue::CSS_CHS:
-    case CSSPrimitiveValue::CSS_CM:
-    case CSSPrimitiveValue::CSS_COUNTER:
-    case CSSPrimitiveValue::CSS_DEG:
-    case CSSPrimitiveValue::CSS_DPCM:
-    case CSSPrimitiveValue::CSS_DPI:
-    case CSSPrimitiveValue::CSS_DPPX:
-    case CSSPrimitiveValue::CSS_EMS:
-    case CSSPrimitiveValue::CSS_EXS:
-    case CSSPrimitiveValue::CSS_FONT_FAMILY:
-    case CSSPrimitiveValue::CSS_FR:
-    case CSSPrimitiveValue::CSS_GRAD:
-    case CSSPrimitiveValue::CSS_HZ:
-    case CSSPrimitiveValue::CSS_IDENT:
-    case CSSPrimitiveValue::CSS_IN:
-    case CSSPrimitiveValue::CSS_KHZ:
-    case CSSPrimitiveValue::CSS_MM:
-    case CSSPrimitiveValue::CSS_MS:
-    case CSSPrimitiveValue::CSS_NUMBER:
-    case CSSPrimitiveValue::CSS_PAIR:
-    case CSSPrimitiveValue::CSS_PC:
-    case CSSPrimitiveValue::CSS_PERCENTAGE:
-    case CSSPrimitiveValue::CSS_PROPERTY_ID:
-    case CSSPrimitiveValue::CSS_PT:
-    case CSSPrimitiveValue::CSS_PX:
-    case CSSPrimitiveValue::CSS_Q:
-    case CSSPrimitiveValue::CSS_QUAD:
-    case CSSPrimitiveValue::CSS_QUIRKY_EMS:
-    case CSSPrimitiveValue::CSS_RAD:
-    case CSSPrimitiveValue::CSS_RECT:
-    case CSSPrimitiveValue::CSS_REMS:
-    case CSSPrimitiveValue::CSS_RGBCOLOR:
-    case CSSPrimitiveValue::CSS_S:
-    case CSSPrimitiveValue::CSS_SHAPE:
-    case CSSPrimitiveValue::CSS_TURN:
-    case CSSPrimitiveValue::CSS_UNICODE_RANGE:
-    case CSSPrimitiveValue::CSS_UNKNOWN:
-    case CSSPrimitiveValue::CSS_VALUE_ID:
-    case CSSPrimitiveValue::CSS_VH:
-    case CSSPrimitiveValue::CSS_VMAX:
-    case CSSPrimitiveValue::CSS_VMIN:
-    case CSSPrimitiveValue::CSS_VW:
+    case CSSUnitType::CSS_CALC:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_CHS:
+    case CSSUnitType::CSS_CM:
+    case CSSUnitType::CSS_COUNTER:
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_DPCM:
+    case CSSUnitType::CSS_DPI:
+    case CSSUnitType::CSS_DPPX:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_FR:
+    case CSSUnitType::CSS_GRAD:
+    case CSSUnitType::CSS_HZ:
+    case CSSUnitType::CSS_IDENT:
+    case CSSUnitType::CSS_IN:
+    case CSSUnitType::CSS_KHZ:
+    case CSSUnitType::CSS_MM:
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_NUMBER:
+    case CSSUnitType::CSS_PAIR:
+    case CSSUnitType::CSS_PC:
+    case CSSUnitType::CSS_PERCENTAGE:
+    case CSSUnitType::CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_PT:
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_Q:
+    case CSSUnitType::CSS_QUAD:
+    case CSSUnitType::CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_RAD:
+    case CSSUnitType::CSS_RECT:
+    case CSSUnitType::CSS_REMS:
+    case CSSUnitType::CSS_RGBCOLOR:
+    case CSSUnitType::CSS_S:
+    case CSSUnitType::CSS_SHAPE:
+    case CSSUnitType::CSS_TURN:
+    case CSSUnitType::CSS_UNICODE_RANGE:
+    case CSSUnitType::CSS_UNKNOWN:
+    case CSSUnitType::CSS_VALUE_ID:
+    case CSSUnitType::CSS_VH:
+    case CSSUnitType::CSS_VMAX:
+    case CSSUnitType::CSS_VMIN:
+    case CSSUnitType::CSS_VW:
         return false;
     }
 
@@ -178,42 +178,40 @@ static inline bool isStringType(CSSPrimitiveValue::UnitType type)
 
 #endif // !ASSERT_DISABLED
 
-CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValue::UnitType type)
+CSSUnitCategory unitCategory(CSSUnitType 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).
     switch (type) {
-    case CSS_NUMBER:
-        return UNumber;
-    case CSS_PERCENTAGE:
-        return UPercent;
-    case CSS_PX:
-    case CSS_CM:
-    case CSS_MM:
-    case CSS_IN:
-    case CSS_PT:
-    case CSS_PC:
-    case CSS_Q:
-        return ULength;
-    case CSS_MS:
-    case CSS_S:
-        return UTime;
-    case CSS_DEG:
-    case CSS_RAD:
-    case CSS_GRAD:
-    case CSS_TURN:
-        return UAngle;
-    case CSS_HZ:
-    case CSS_KHZ:
-        return UFrequency;
+    case CSSUnitType::CSS_NUMBER:
+        return CSSUnitCategory::Number;
+    case CSSUnitType::CSS_PERCENTAGE:
+        return CSSUnitCategory::Percent;
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_CM:
+    case CSSUnitType::CSS_MM:
+    case CSSUnitType::CSS_IN:
+    case CSSUnitType::CSS_PT:
+    case CSSUnitType::CSS_PC:
+    case CSSUnitType::CSS_Q:
+        return CSSUnitCategory::Length;
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_S:
+        return CSSUnitCategory::Time;
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_RAD:
+    case CSSUnitType::CSS_GRAD:
+    case CSSUnitType::CSS_TURN:
+        return CSSUnitCategory::Angle;
+    case CSSUnitType::CSS_HZ:
+    case CSSUnitType::CSS_KHZ:
+        return CSSUnitCategory::Frequency;
 #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
-    case CSS_DPPX:
-    case CSS_DPI:
-    case CSS_DPCM:
-        return UResolution;
+    case CSSUnitType::CSS_DPPX:
+    case CSSUnitType::CSS_DPI:
+    case CSSUnitType::CSS_DPCM:
+        return CSSUnitCategory::Resolution;
 #endif
     default:
-        return UOther;
+        return CSSUnitCategory::Other;
     }
 }
 
@@ -224,38 +222,38 @@ static CSSTextCache& cssTextCache()
     return cache;
 }
 
-unsigned short CSSPrimitiveValue::primitiveType() const
+CSSUnitType CSSPrimitiveValue::primitiveType() const
 {
-    if (m_primitiveUnitType == CSS_PROPERTY_ID || m_primitiveUnitType == CSS_VALUE_ID)
-        return CSS_IDENT;
+    if (primitiveUnitType() == CSSUnitType::CSS_PROPERTY_ID || primitiveUnitType() == CSSUnitType::CSS_VALUE_ID)
+        return CSSUnitType::CSS_IDENT;
 
-    // Web-exposed content expects font family values to have CSS_STRING primitive type
-    // so we need to map our internal CSS_FONT_FAMILY type here.
-    if (m_primitiveUnitType == CSS_FONT_FAMILY)
-        return CSS_STRING;
+    // Web-exposed content expects font family values to have CSSUnitType::CSS_STRING primitive type
+    // so we need to map our internal CSSUnitType::CSS_FONT_FAMILY type here.
+    if (primitiveUnitType() == CSSUnitType::CSS_FONT_FAMILY)
+        return CSSUnitType::CSS_STRING;
 
-    if (m_primitiveUnitType != CSSPrimitiveValue::CSS_CALC)
-        return m_primitiveUnitType;
+    if (primitiveUnitType() != CSSUnitType::CSS_CALC)
+        return primitiveUnitType();
 
     switch (m_value.calc->category()) {
     case CalculationCategory::Number:
-        return CSSPrimitiveValue::CSS_NUMBER;
+        return CSSUnitType::CSS_NUMBER;
     case CalculationCategory::Length:
-        return CSSPrimitiveValue::CSS_PX;
+        return CSSUnitType::CSS_PX;
     case CalculationCategory::Percent:
-        return CSSPrimitiveValue::CSS_PERCENTAGE;
+        return CSSUnitType::CSS_PERCENTAGE;
     case CalculationCategory::PercentNumber:
-        return CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER;
+        return CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER;
     case CalculationCategory::PercentLength:
-        return CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH;
+        return CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH;
     case CalculationCategory::Angle:
     case CalculationCategory::Time:
     case CalculationCategory::Frequency:
         return m_value.calc->primitiveType();
     case CalculationCategory::Other:
-        return CSSPrimitiveValue::CSS_UNKNOWN;
+        return CSSUnitType::CSS_UNKNOWN;
     }
-    return CSSPrimitiveValue::CSS_UNKNOWN;
+    return CSSUnitType::CSS_UNKNOWN;
 }
 
 static const AtomString& propertyName(CSSPropertyID propertyID)
@@ -275,30 +273,30 @@ static const AtomString& valueName(CSSValueID valueID)
 CSSPrimitiveValue::CSSPrimitiveValue(CSSValueID valueID)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     m_value.valueID = valueID;
 }
 
 CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_PROPERTY_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_PROPERTY_ID);
     m_value.propertyID = propertyID;
 }
 
-CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitType type)
+CSSPrimitiveValue::CSSPrimitiveValue(double num, CSSUnitType type)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = type;
+    setPrimitiveUnitType(type);
     ASSERT(std::isfinite(num));
     m_value.num = num;
 }
 
-CSSPrimitiveValue::CSSPrimitiveValue(const String& string, UnitType type)
+CSSPrimitiveValue::CSSPrimitiveValue(const String& string, CSSUnitType type)
     : CSSValue(PrimitiveClass)
 {
     ASSERT(isStringType(type));
-    m_primitiveUnitType = type;
+    setPrimitiveUnitType(type);
     if ((m_value.string = string.impl()))
         m_value.string->ref();
 }
@@ -306,7 +304,7 @@ CSSPrimitiveValue::CSSPrimitiveValue(const String& string, UnitType type)
 CSSPrimitiveValue::CSSPrimitiveValue(const Color& color)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_RGBCOLOR;
+    setPrimitiveUnitType(CSSUnitType::CSS_RGBCOLOR);
     m_value.color = new Color(color);
 }
 
@@ -331,7 +329,7 @@ CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, const RenderStyle& st
         init(length);
         return;
     case Fixed:
-        m_primitiveUnitType = CSS_PX;
+        setPrimitiveUnitType(CSSUnitType::CSS_PX);
         m_value.num = adjustFloatForAbsoluteZoom(length.value(), style);
         return;
     case Calculated: {
@@ -356,39 +354,39 @@ void CSSPrimitiveValue::init(const Length& length)
 {
     switch (length.type()) {
     case Auto:
-        m_primitiveUnitType = CSS_VALUE_ID;
+        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueAuto;
         return;
     case WebCore::Fixed:
-        m_primitiveUnitType = CSS_PX;
+        setPrimitiveUnitType(CSSUnitType::CSS_PX);
         m_value.num = length.value();
         return;
     case Intrinsic:
-        m_primitiveUnitType = CSS_VALUE_ID;
+        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueIntrinsic;
         return;
     case MinIntrinsic:
-        m_primitiveUnitType = CSS_VALUE_ID;
+        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueMinIntrinsic;
         return;
     case MinContent:
-        m_primitiveUnitType = CSS_VALUE_ID;
+        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueMinContent;
         return;
     case MaxContent:
-        m_primitiveUnitType = CSS_VALUE_ID;
+        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueMaxContent;
         return;
     case FillAvailable:
-        m_primitiveUnitType = CSS_VALUE_ID;
+        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueWebkitFillAvailable;
         return;
     case FitContent:
-        m_primitiveUnitType = CSS_VALUE_ID;
+        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueFitContent;
         return;
     case Percent:
-        m_primitiveUnitType = CSS_PERCENTAGE;
+        setPrimitiveUnitType(CSSUnitType::CSS_PERCENTAGE);
         ASSERT(std::isfinite(length.percent()));
         m_value.num = length.percent();
         return;
@@ -403,49 +401,49 @@ void CSSPrimitiveValue::init(const Length& length)
 
 void CSSPrimitiveValue::init(const LengthSize& lengthSize, const RenderStyle& style)
 {
-    m_primitiveUnitType = CSS_PAIR;
+    setPrimitiveUnitType(CSSUnitType::CSS_PAIR);
     m_hasCachedCSSText = false;
     m_value.pair = &Pair::create(create(lengthSize.width, style), create(lengthSize.height, style)).leakRef();
 }
 
 void CSSPrimitiveValue::init(Ref<Counter>&& counter)
 {
-    m_primitiveUnitType = CSS_COUNTER;
+    setPrimitiveUnitType(CSSUnitType::CSS_COUNTER);
     m_hasCachedCSSText = false;
     m_value.counter = &counter.leakRef();
 }
 
 void CSSPrimitiveValue::init(Ref<Rect>&& r)
 {
-    m_primitiveUnitType = CSS_RECT;
+    setPrimitiveUnitType(CSSUnitType::CSS_RECT);
     m_hasCachedCSSText = false;
     m_value.rect = &r.leakRef();
 }
 
 void CSSPrimitiveValue::init(Ref<Quad>&& quad)
 {
-    m_primitiveUnitType = CSS_QUAD;
+    setPrimitiveUnitType(CSSUnitType::CSS_QUAD);
     m_hasCachedCSSText = false;
     m_value.quad = &quad.leakRef();
 }
 
 void CSSPrimitiveValue::init(Ref<Pair>&& p)
 {
-    m_primitiveUnitType = CSS_PAIR;
+    setPrimitiveUnitType(CSSUnitType::CSS_PAIR);
     m_hasCachedCSSText = false;
     m_value.pair = &p.leakRef();
 }
 
 void CSSPrimitiveValue::init(Ref<CSSBasicShape>&& shape)
 {
-    m_primitiveUnitType = CSS_SHAPE;
+    setPrimitiveUnitType(CSSUnitType::CSS_SHAPE);
     m_hasCachedCSSText = false;
     m_value.shape = &shape.leakRef();
 }
 
 void CSSPrimitiveValue::init(RefPtr<CSSCalcValue>&& c)
 {
-    m_primitiveUnitType = CSS_CALC;
+    setPrimitiveUnitType(CSSUnitType::CSS_CALC);
     m_hasCachedCSSText = false;
     m_value.calc = c.leakRef();
 }
@@ -457,87 +455,87 @@ CSSPrimitiveValue::~CSSPrimitiveValue()
 
 void CSSPrimitiveValue::cleanup()
 {
-    auto type = static_cast<UnitType>(m_primitiveUnitType);
+    auto type = primitiveUnitType();
     switch (type) {
-    case CSS_STRING:
-    case CSS_URI:
-    case CSS_ATTR:
-    case CSS_COUNTER_NAME:
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_URI:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_COUNTER_NAME:
         if (m_value.string)
             m_value.string->deref();
         break;
-    case CSS_DIMENSION:
-    case CSS_COUNTER:
+    case CSSUnitType::CSS_DIMENSION:
+    case CSSUnitType::CSS_COUNTER:
         m_value.counter->deref();
         break;
-    case CSS_RECT:
+    case CSSUnitType::CSS_RECT:
         m_value.rect->deref();
         break;
-    case CSS_QUAD:
+    case CSSUnitType::CSS_QUAD:
         m_value.quad->deref();
         break;
-    case CSS_PAIR:
+    case CSSUnitType::CSS_PAIR:
         m_value.pair->deref();
         break;
-    case CSS_CALC:
+    case CSSUnitType::CSS_CALC:
         m_value.calc->deref();
         break;
-    case CSS_CALC_PERCENTAGE_WITH_NUMBER:
-    case CSS_CALC_PERCENTAGE_WITH_LENGTH:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
         ASSERT_NOT_REACHED();
         break;
-    case CSS_SHAPE:
+    case CSSUnitType::CSS_SHAPE:
         m_value.shape->deref();
         break;
-    case CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_FONT_FAMILY:
         ASSERT(m_value.fontFamily);
         delete m_value.fontFamily;
         m_value.fontFamily = nullptr;
         break;
-    case CSS_RGBCOLOR:
+    case CSSUnitType::CSS_RGBCOLOR:
         ASSERT(m_value.color);
         delete m_value.color;
         m_value.color = nullptr;
         break;
-    case CSS_NUMBER:
-    case CSS_PERCENTAGE:
-    case CSS_EMS:
-    case CSS_QUIRKY_EMS:
-    case CSS_EXS:
-    case CSS_REMS:
-    case CSS_CHS:
-    case CSS_PX:
-    case CSS_CM:
-    case CSS_MM:
-    case CSS_IN:
-    case CSS_PT:
-    case CSS_PC:
-    case CSS_DEG:
-    case CSS_RAD:
-    case CSS_GRAD:
-    case CSS_MS:
-    case CSS_S:
-    case CSS_HZ:
-    case CSS_KHZ:
-    case CSS_TURN:
-    case CSS_VW:
-    case CSS_VH:
-    case CSS_VMIN:
-    case CSS_VMAX:
-    case CSS_DPPX:
-    case CSS_DPI:
-    case CSS_DPCM:
-    case CSS_FR:
-    case CSS_Q:
-    case CSS_IDENT:
-    case CSS_UNKNOWN:
-    case CSS_UNICODE_RANGE:
-    case CSS_PROPERTY_ID:
-    case CSS_VALUE_ID:
+    case CSSUnitType::CSS_NUMBER:
+    case CSSUnitType::CSS_PERCENTAGE:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_REMS:
+    case CSSUnitType::CSS_CHS:
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_CM:
+    case CSSUnitType::CSS_MM:
+    case CSSUnitType::CSS_IN:
+    case CSSUnitType::CSS_PT:
+    case CSSUnitType::CSS_PC:
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_RAD:
+    case CSSUnitType::CSS_GRAD:
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_S:
+    case CSSUnitType::CSS_HZ:
+    case CSSUnitType::CSS_KHZ:
+    case CSSUnitType::CSS_TURN:
+    case CSSUnitType::CSS_VW:
+    case CSSUnitType::CSS_VH:
+    case CSSUnitType::CSS_VMIN:
+    case CSSUnitType::CSS_VMAX:
+    case CSSUnitType::CSS_DPPX:
+    case CSSUnitType::CSS_DPI:
+    case CSSUnitType::CSS_DPCM:
+    case CSSUnitType::CSS_FR:
+    case CSSUnitType::CSS_Q:
+    case CSSUnitType::CSS_IDENT:
+    case CSSUnitType::CSS_UNKNOWN:
+    case CSSUnitType::CSS_UNICODE_RANGE:
+    case CSSUnitType::CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_VALUE_ID:
         ASSERT(!isStringType(type));
         break;
     }
-    m_primitiveUnitType = 0;
+    setPrimitiveUnitType(CSSUnitType::CSS_UNKNOWN);
     if (m_hasCachedCSSText) {
         cssTextCache().remove(this);
         m_hasCachedCSSText = false;
@@ -547,13 +545,13 @@ void CSSPrimitiveValue::cleanup()
 double CSSPrimitiveValue::computeDegrees() const
 {
     switch (primitiveType()) {
-    case CSS_DEG:
+    case CSSUnitType::CSS_DEG:
         return doubleValue();
-    case CSS_RAD:
+    case CSSUnitType::CSS_RAD:
         return rad2deg(doubleValue());
-    case CSS_GRAD:
+    case CSSUnitType::CSS_GRAD:
         return grad2deg(doubleValue());
-    case CSS_TURN:
+    case CSSUnitType::CSS_TURN:
         return turn2deg(doubleValue());
     default:
         ASSERT_NOT_REACHED();
@@ -603,29 +601,30 @@ template<> LayoutUnit CSSPrimitiveValue::computeLength(const CSSToLengthConversi
 
 double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& conversionData) const
 {
-    if (m_primitiveUnitType == CSS_CALC)
+    if (primitiveUnitType() == CSSUnitType::CSS_CALC) {
         // 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<UnitType>(primitiveType()), m_value.num);
+    return computeNonCalcLengthDouble(conversionData, primitiveType(), m_value.num);
 }
 
 static constexpr double mmPerInch = 25.4;
 static constexpr double cmPerInch = 2.54;
 static constexpr double QPerInch = 25.4 * 4.0;
 
-double CSSPrimitiveValue::computeNonCalcLengthDouble(const CSSToLengthConversionData& conversionData, UnitType primitiveType, double value)
+double CSSPrimitiveValue::computeNonCalcLengthDouble(const CSSToLengthConversionData& conversionData, CSSUnitType primitiveType, double value)
 {
     double factor;
     bool applyZoom = true;
 
     switch (primitiveType) {
-    case CSS_EMS:
-    case CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_QUIRKY_EMS:
         ASSERT(conversionData.style());
         factor = conversionData.computingFontSize() ? conversionData.style()->fontDescription().specifiedSize() : conversionData.style()->fontDescription().computedSize();
         break;
-    case CSS_EXS:
+    case CSSUnitType::CSS_EXS:
         ASSERT(conversionData.style());
         // FIXME: We have a bug right now where the zoom will be applied twice to EX units.
         // We really need to compute EX using fontMetrics for the original specifiedSize and not use
@@ -635,55 +634,55 @@ double CSSPrimitiveValue::computeNonCalcLengthDouble(const CSSToLengthConversion
         else
             factor = (conversionData.computingFontSize() ? conversionData.style()->fontDescription().specifiedSize() : conversionData.style()->fontDescription().computedSize()) / 2.0;
         break;
-    case CSS_REMS:
+    case CSSUnitType::CSS_REMS:
         if (conversionData.rootStyle())
             factor = conversionData.computingFontSize() ? conversionData.rootStyle()->fontDescription().specifiedSize() : conversionData.rootStyle()->fontDescription().computedSize();
         else
             factor = 1.0;
         break;
-    case CSS_CHS:
+    case CSSUnitType::CSS_CHS:
         ASSERT(conversionData.style());
         factor = conversionData.style()->fontMetrics().zeroWidth();
         break;
-    case CSS_PX:
+    case CSSUnitType::CSS_PX:
         factor = 1.0;
         break;
-    case CSS_CM:
+    case CSSUnitType::CSS_CM:
         factor = cssPixelsPerInch / cmPerInch;
         break;
-    case CSS_MM:
+    case CSSUnitType::CSS_MM:
         factor = cssPixelsPerInch / mmPerInch;
         break;
-    case CSS_Q:
+    case CSSUnitType::CSS_Q:
         factor = cssPixelsPerInch / QPerInch;
         break;
-    case CSS_IN:
+    case CSSUnitType::CSS_IN:
         factor = cssPixelsPerInch;
         break;
-    case CSS_PT:
+    case CSSUnitType::CSS_PT:
         factor = cssPixelsPerInch / 72.0;
         break;
-    case CSS_PC:
+    case CSSUnitType::CSS_PC:
         // 1 pc == 12 pt
         factor = cssPixelsPerInch * 12.0 / 72.0;
         break;
-    case CSS_CALC_PERCENTAGE_WITH_LENGTH:
-    case CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
         ASSERT_NOT_REACHED();
         return -1.0;
-    case CSS_VH:
+    case CSSUnitType::CSS_VH:
         factor = conversionData.viewportHeightFactor();
         applyZoom = false;
         break;
-    case CSS_VW:
+    case CSSUnitType::CSS_VW:
         factor = conversionData.viewportWidthFactor();
         applyZoom = false;
         break;
-    case CSS_VMAX:
+    case CSSUnitType::CSS_VMAX:
         factor = conversionData.viewportMaxFactor();
         applyZoom = false;
         break;
-    case CSS_VMIN:
+    case CSSUnitType::CSS_VMIN:
         factor = conversionData.viewportMinFactor();
         applyZoom = false;
         break;
@@ -724,7 +723,7 @@ bool CSSPrimitiveValue::equalForLengthResolution(const RenderStyle& styleA, cons
     return true;
 }
 
-ExceptionOr<void> CSSPrimitiveValue::setFloatValue(unsigned short, double)
+ExceptionOr<void> CSSPrimitiveValue::setFloatValue(CSSUnitType, double)
 {
     // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
     // No other engine supports mutating style through this API. Computed style is always read-only anyway.
@@ -732,49 +731,49 @@ ExceptionOr<void> CSSPrimitiveValue::setFloatValue(unsigned short, double)
     return Exception { NoModificationAllowedError };
 }
 
-double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(UnitType unitType)
+double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(CSSUnitType unitType)
 {
     double factor = 1.0;
     // FIXME: the switch can be replaced by an array of scale factors.
     switch (unitType) {
     // These are "canonical" units in their respective categories.
-    case CSS_PX:
-    case CSS_DEG:
-    case CSS_MS:
-    case CSS_HZ:
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_HZ:
         break;
-    case CSS_CM:
+    case CSSUnitType::CSS_CM:
         factor = cssPixelsPerInch / cmPerInch;
         break;
-    case CSS_DPCM:
+    case CSSUnitType::CSS_DPCM:
         factor = cmPerInch / cssPixelsPerInch; // (2.54 cm/in)
         break;
-    case CSS_MM:
+    case CSSUnitType::CSS_MM:
         factor = cssPixelsPerInch / mmPerInch;
         break;
-    case CSS_IN:
+    case CSSUnitType::CSS_IN:
         factor = cssPixelsPerInch;
         break;
-    case CSS_DPI:
+    case CSSUnitType::CSS_DPI:
         factor = 1 / cssPixelsPerInch;
         break;
-    case CSS_PT:
+    case CSSUnitType::CSS_PT:
         factor = cssPixelsPerInch / 72.0;
         break;
-    case CSS_PC:
+    case CSSUnitType::CSS_PC:
         factor = cssPixelsPerInch * 12.0 / 72.0; // 1 pc == 12 pt
         break;
-    case CSS_RAD:
+    case CSSUnitType::CSS_RAD:
         factor = 180 / piDouble;
         break;
-    case CSS_GRAD:
+    case CSSUnitType::CSS_GRAD:
         factor = 0.9;
         break;
-    case CSS_TURN:
+    case CSSUnitType::CSS_TURN:
         factor = 360;
         break;
-    case CSS_S:
-    case CSS_KHZ:
+    case CSSUnitType::CSS_S:
+    case CSSUnitType::CSS_KHZ:
         factor = 1000;
         break;
     default:
@@ -784,88 +783,88 @@ double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(UnitType unitTyp
     return factor;
 }
 
-ExceptionOr<float> CSSPrimitiveValue::getFloatValue(unsigned short unitType) const
+ExceptionOr<float> CSSPrimitiveValue::getFloatValue(CSSUnitType unitType) const
 {
-    auto result = doubleValueInternal(static_cast<UnitType>(unitType));
+    auto result = doubleValueInternal(unitType);
     if (!result)
         return Exception { InvalidAccessError };
     return clampTo<float>(result.value());
 }
 
-double CSSPrimitiveValue::doubleValue(UnitType unitType) const
+double CSSPrimitiveValue::doubleValue(CSSUnitType unitType) const
 {
     return doubleValueInternal(unitType).valueOr(0);
 }
 
 double CSSPrimitiveValue::doubleValue() const
 {
-    return m_primitiveUnitType != CSS_CALC ? m_value.num : m_value.calc->doubleValue();
+    return primitiveUnitType() != CSSUnitType::CSS_CALC ? m_value.num : m_value.calc->doubleValue();
 }
 
-
-CSSPrimitiveValue::UnitType CSSPrimitiveValue::canonicalUnitTypeForCategory(UnitCategory category)
+CSSUnitType CSSPrimitiveValue::canonicalUnitTypeForCategory(CSSUnitCategory category)
 {
     // The canonical unit type is chosen according to the way CSSParser::validUnit() chooses the default unit
     // in each category (based on unitflags).
+    // Canonical units are specified in <https://drafts.csswg.org/css-values-4>.
     switch (category) {
-    case UNumber:
-        return CSS_NUMBER;
-    case ULength:
-        return CSS_PX;
-    case UPercent:
-        return CSS_UNKNOWN; // Cannot convert between numbers and percent.
-    case UTime:
-        return CSS_MS;
-    case UAngle:
-        return CSS_DEG;
-    case UFrequency:
-        return CSS_HZ;
+    case CSSUnitCategory::Number:
+        return CSSUnitType::CSS_NUMBER;
+    case CSSUnitCategory::Length:
+        return CSSUnitType::CSS_PX;
+    case CSSUnitCategory::Percent:
+        return CSSUnitType::CSS_UNKNOWN; // Cannot convert between numbers and percent.
+    case CSSUnitCategory::Time:
+        return CSSUnitType::CSS_MS;
+    case CSSUnitCategory::Angle:
+        return CSSUnitType::CSS_DEG;
+    case CSSUnitCategory::Frequency:
+        return CSSUnitType::CSS_HZ;
 #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
-    case UResolution:
-        return CSS_DPPX;
+    case CSSUnitCategory::Resolution:
+        return CSSUnitType::CSS_DPPX;
 #endif
     default:
-        return CSS_UNKNOWN;
+        return CSSUnitType::CSS_UNKNOWN;
     }
 }
 
-Optional<double> CSSPrimitiveValue::doubleValueInternal(UnitType requestedUnitType) const
+Optional<double> CSSPrimitiveValue::doubleValueInternal(CSSUnitType requestedUnitType) const
 {
-    if (!isValidCSSUnitTypeForDoubleConversion(static_cast<UnitType>(m_primitiveUnitType)) || !isValidCSSUnitTypeForDoubleConversion(requestedUnitType))
+    if (!isValidCSSUnitTypeForDoubleConversion(primitiveUnitType()) || !isValidCSSUnitTypeForDoubleConversion(requestedUnitType))
         return WTF::nullopt;
 
-    UnitType sourceUnitType = static_cast<UnitType>(primitiveType());
-    if (requestedUnitType == sourceUnitType || requestedUnitType == CSS_DIMENSION)
+    CSSUnitType sourceUnitType = primitiveType();
+    if (requestedUnitType == sourceUnitType || requestedUnitType == CSSUnitType::CSS_DIMENSION)
         return doubleValue();
 
-    UnitCategory sourceCategory = unitCategory(sourceUnitType);
-    ASSERT(sourceCategory != UOther);
+    CSSUnitCategory sourceCategory = unitCategory(sourceUnitType);
+    ASSERT(sourceCategory != CSSUnitCategory::Other);
 
-    UnitType targetUnitType = requestedUnitType;
-    UnitCategory targetCategory = unitCategory(targetUnitType);
-    ASSERT(targetCategory != UOther);
+    CSSUnitType targetUnitType = requestedUnitType;
+    CSSUnitCategory targetCategory = unitCategory(targetUnitType);
+    ASSERT(targetCategory != CSSUnitCategory::Other);
 
-    // Cannot convert between unrelated unit categories if one of them is not UNumber.
-    if (sourceCategory != targetCategory && sourceCategory != UNumber && targetCategory != UNumber)
+    // Cannot convert between unrelated unit categories if one of them is not CSSUnitCategory::Number.
+    if (sourceCategory != targetCategory && sourceCategory != CSSUnitCategory::Number && targetCategory != CSSUnitCategory::Number)
         return WTF::nullopt;
 
-    if (targetCategory == UNumber) {
-        // We interpret conversion to CSS_NUMBER as conversion to a canonical unit in this value's category.
+    if (targetCategory == CSSUnitCategory::Number) {
+        // We interpret conversion to CSSUnitType::CSS_NUMBER as conversion to a canonical unit in this value's category.
         targetUnitType = canonicalUnitTypeForCategory(sourceCategory);
-        if (targetUnitType == CSS_UNKNOWN)
+        if (targetUnitType == CSSUnitType::CSS_UNKNOWN)
             return WTF::nullopt;
     }
 
-    if (sourceUnitType == CSS_NUMBER) {
-        // We interpret conversion from CSS_NUMBER in the same way as CSSParser::validUnit() while using non-strict mode.
+    if (sourceUnitType == CSSUnitType::CSS_NUMBER) {
+        // We interpret conversion from CSSUnitType::CSS_NUMBER in the same way as CSSParser::validUnit() while using non-strict mode.
         sourceUnitType = canonicalUnitTypeForCategory(targetCategory);
-        if (sourceUnitType == CSS_UNKNOWN)
+        if (sourceUnitType == CSSUnitType::CSS_UNKNOWN)
             return WTF::nullopt;
     }
 
     double convertedValue = doubleValue();
 
-    // First convert the value from m_primitiveUnitType to canonical type.
+    // First convert the value from primitiveUnitType() to canonical type.
     double factor = conversionToCanonicalUnitsScaleFactor(sourceUnitType);
     convertedValue *= factor;
 
@@ -876,7 +875,7 @@ Optional<double> CSSPrimitiveValue::doubleValueInternal(UnitType requestedUnitTy
     return convertedValue;
 }
 
-ExceptionOr<void> CSSPrimitiveValue::setStringValue(unsigned short, const String&)
+ExceptionOr<void> CSSPrimitiveValue::setStringValue(CSSUnitType, const String&)
 {
     // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
     // No other engine supports mutating style through this API. Computed style is always read-only anyway.
@@ -886,16 +885,16 @@ ExceptionOr<void> CSSPrimitiveValue::setStringValue(unsigned short, const String
 
 ExceptionOr<String> CSSPrimitiveValue::getStringValue() const
 {
-    switch (m_primitiveUnitType) {
-    case CSS_STRING:
-    case CSS_ATTR:
-    case CSS_URI:
+    switch (primitiveUnitType()) {
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_URI:
         return m_value.string;
-    case CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_FONT_FAMILY:
         return String { m_value.fontFamily->familyName };
-    case CSS_VALUE_ID:
+    case CSSUnitType::CSS_VALUE_ID:
         return String { valueName(m_value.valueID).string() };
-    case CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_PROPERTY_ID:
         return String { propertyName(m_value.propertyID).string() };
     default:
         return Exception { InvalidAccessError };
@@ -904,16 +903,16 @@ ExceptionOr<String> CSSPrimitiveValue::getStringValue() const
 
 String CSSPrimitiveValue::stringValue() const
 {
-    switch (m_primitiveUnitType) {
-    case CSS_STRING:
-    case CSS_ATTR:
-    case CSS_URI:
+    switch (primitiveUnitType()) {
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_URI:
         return m_value.string;
-    case CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_FONT_FAMILY:
         return m_value.fontFamily->familyName;
-    case CSS_VALUE_ID:
+    case CSSUnitType::CSS_VALUE_ID:
         return valueName(m_value.valueID);
-    case CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_PROPERTY_ID:
         return propertyName(m_value.propertyID);
     default:
         return String();
@@ -922,21 +921,21 @@ String CSSPrimitiveValue::stringValue() const
 
 ExceptionOr<Counter&> CSSPrimitiveValue::getCounterValue() const
 {
-    if (m_primitiveUnitType != CSS_COUNTER)
+    if (primitiveUnitType() != CSSUnitType::CSS_COUNTER)
         return Exception { InvalidAccessError };
     return *m_value.counter;
 }
 
 ExceptionOr<Rect&> CSSPrimitiveValue::getRectValue() const
 {
-    if (m_primitiveUnitType != CSS_RECT)
+    if (primitiveUnitType() != CSSUnitType::CSS_RECT)
         return Exception { InvalidAccessError };
     return *m_value.rect;
 }
 
 ExceptionOr<Ref<RGBColor>> CSSPrimitiveValue::getRGBColorValue() const
 {
-    if (m_primitiveUnitType != CSS_RGBCOLOR)
+    if (primitiveUnitType() != CSSUnitType::CSS_RGBCOLOR)
         return Exception { InvalidAccessError };
 
     // FIXME: This should not return a new object for each invocation.
@@ -950,83 +949,81 @@ NEVER_INLINE String CSSPrimitiveValue::formatNumberValue(StringView suffix) cons
 
 ALWAYS_INLINE String CSSPrimitiveValue::formatNumberForCustomCSSText() const
 {
-    switch (m_primitiveUnitType) {
-    case CSS_UNKNOWN:
+    switch (primitiveUnitType()) {
+    case CSSUnitType::CSS_UNKNOWN:
         return String();
-    case CSS_NUMBER:
+    case CSSUnitType::CSS_NUMBER:
         return formatNumberValue("");
-    case CSS_PERCENTAGE:
+    case CSSUnitType::CSS_PERCENTAGE:
         return formatNumberValue("%");
-    case CSS_EMS:
-    case CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_QUIRKY_EMS:
         return formatNumberValue("em");
-    case CSS_EXS:
+    case CSSUnitType::CSS_EXS:
         return formatNumberValue("ex");
-    case CSS_REMS:
+    case CSSUnitType::CSS_REMS:
         return formatNumberValue("rem");
-    case CSS_CHS:
+    case CSSUnitType::CSS_CHS:
         return formatNumberValue("ch");
-    case CSS_PX:
+    case CSSUnitType::CSS_PX:
         return formatNumberValue("px");
-    case CSS_CM:
+    case CSSUnitType::CSS_CM:
         return formatNumberValue("cm");
-#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
-    case CSS_DPPX:
+    case CSSUnitType::CSS_DPPX:
         return formatNumberValue("dppx");
-    case CSS_DPI:
+    case CSSUnitType::CSS_DPI:
         return formatNumberValue("dpi");
-    case CSS_DPCM:
+    case CSSUnitType::CSS_DPCM:
         return formatNumberValue("dpcm");
-#endif
-    case CSS_MM:
+    case CSSUnitType::CSS_MM:
         return formatNumberValue("mm");
-    case CSS_IN:
+    case CSSUnitType::CSS_IN:
         return formatNumberValue("in");
-    case CSS_PT:
+    case CSSUnitType::CSS_PT:
         return formatNumberValue("pt");
-    case CSS_PC:
+    case CSSUnitType::CSS_PC:
         return formatNumberValue("pc");
-    case CSS_DEG:
+    case CSSUnitType::CSS_DEG:
         return formatNumberValue("deg");
-    case CSS_RAD:
+    case CSSUnitType::CSS_RAD:
         return formatNumberValue("rad");
-    case CSS_GRAD:
+    case CSSUnitType::CSS_GRAD:
         return formatNumberValue("grad");
-    case CSS_MS:
+    case CSSUnitType::CSS_MS:
         return formatNumberValue("ms");
-    case CSS_S:
+    case CSSUnitType::CSS_S:
         return formatNumberValue("s");
-    case CSS_HZ:
+    case CSSUnitType::CSS_HZ:
         return formatNumberValue("hz");
-    case CSS_KHZ:
+    case CSSUnitType::CSS_KHZ:
         return formatNumberValue("khz");
-    case CSS_TURN:
+    case CSSUnitType::CSS_TURN:
         return formatNumberValue("turn");
-    case CSS_FR:
+    case CSSUnitType::CSS_FR:
         return formatNumberValue("fr");
-    case CSS_Q:
+    case CSSUnitType::CSS_Q:
         return formatNumberValue("q");
-    case CSS_DIMENSION:
-        // FIXME: We currently don't handle CSS_DIMENSION properly as we don't store
+    case CSSUnitType::CSS_DIMENSION:
+        // FIXME: We currently don't handle CSSUnitType::CSS_DIMENSION properly as we don't store
         // the actual dimension, just the numeric value as a string.
-    case CSS_STRING:
+    case CSSUnitType::CSS_STRING:
         // FIME-NEWPARSER: Once we have CSSCustomIdentValue hooked up, this can just be
         // serializeString, since custom identifiers won't be the same value as strings
         // any longer.
         return serializeAsStringOrCustomIdent(m_value.string);
-    case CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_FONT_FAMILY:
         return serializeFontFamily(m_value.fontFamily->familyName);
-    case CSS_URI:
+    case CSSUnitType::CSS_URI:
         return serializeURL(m_value.string);
-    case CSS_VALUE_ID:
+    case CSSUnitType::CSS_VALUE_ID:
         return valueName(m_value.valueID);
-    case CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_PROPERTY_ID:
         return propertyName(m_value.propertyID);
-    case CSS_ATTR:
+    case CSSUnitType::CSS_ATTR:
         return "attr(" + String(m_value.string) + ')';
-    case CSS_COUNTER_NAME:
+    case CSSUnitType::CSS_COUNTER_NAME:
         return "counter(" + String(m_value.string) + ')';
-    case CSS_COUNTER: {
+    case CSSUnitType::CSS_COUNTER: {
         StringBuilder result;
         String separator = m_value.counter->separator();
         if (separator.isEmpty())
@@ -1046,26 +1043,31 @@ ALWAYS_INLINE String CSSPrimitiveValue::formatNumberForCustomCSSText() const
 
         return result.toString();
     }
-    case CSS_RECT:
+    case CSSUnitType::CSS_RECT:
         return rectValue()->cssText();
-    case CSS_QUAD:
+    case CSSUnitType::CSS_QUAD:
         return quadValue()->cssText();
-    case CSS_RGBCOLOR:
+    case CSSUnitType::CSS_RGBCOLOR:
         return color().cssText();
-    case CSS_PAIR:
+    case CSSUnitType::CSS_PAIR:
         return pairValue()->cssText();
-    case CSS_CALC:
+    case CSSUnitType::CSS_CALC:
         return m_value.calc->cssText();
-    case CSS_SHAPE:
+    case CSSUnitType::CSS_SHAPE:
         return m_value.shape->cssText();
-    case CSS_VW:
+    case CSSUnitType::CSS_VW:
         return formatNumberValue("vw");
-    case CSS_VH:
+    case CSSUnitType::CSS_VH:
         return formatNumberValue("vh");
-    case CSS_VMIN:
+    case CSSUnitType::CSS_VMIN:
         return formatNumberValue("vmin");
-    case CSS_VMAX:
+    case CSSUnitType::CSS_VMAX:
         return formatNumberValue("vmax");
+    case CSSUnitType::CSS_IDENT:
+    case CSSUnitType::CSS_UNICODE_RANGE:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
+        ASSERT_NOT_REACHED();
     }
     return String();
 }
@@ -1092,69 +1094,76 @@ String CSSPrimitiveValue::customCSSText() const
 
 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const
 {
-    if (m_primitiveUnitType != other.m_primitiveUnitType)
+    if (primitiveUnitType() != other.primitiveUnitType())
         return false;
 
-    switch (m_primitiveUnitType) {
-    case CSS_UNKNOWN:
+    switch (primitiveUnitType()) {
+    case CSSUnitType::CSS_UNKNOWN:
         return false;
-    case CSS_NUMBER:
-    case CSS_PERCENTAGE:
-    case CSS_EMS:
-    case CSS_QUIRKY_EMS:
-    case CSS_EXS:
-    case CSS_REMS:
-    case CSS_PX:
-    case CSS_CM:
-#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
-    case CSS_DPPX:
-    case CSS_DPI:
-    case CSS_DPCM:
-#endif
-    case CSS_MM:
-    case CSS_IN:
-    case CSS_PT:
-    case CSS_PC:
-    case CSS_DEG:
-    case CSS_RAD:
-    case CSS_GRAD:
-    case CSS_MS:
-    case CSS_S:
-    case CSS_HZ:
-    case CSS_KHZ:
-    case CSS_TURN:
-    case CSS_VW:
-    case CSS_VH:
-    case CSS_VMIN:
-    case CSS_FR:
-    case CSS_Q:
+    case CSSUnitType::CSS_NUMBER:
+    case CSSUnitType::CSS_PERCENTAGE:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_REMS:
+    case CSSUnitType::CSS_CHS:
+    case CSSUnitType::CSS_PX:
+    case CSSUnitType::CSS_CM:
+    case CSSUnitType::CSS_DPPX:
+    case CSSUnitType::CSS_DPI:
+    case CSSUnitType::CSS_DPCM:
+    case CSSUnitType::CSS_MM:
+    case CSSUnitType::CSS_IN:
+    case CSSUnitType::CSS_PT:
+    case CSSUnitType::CSS_PC:
+    case CSSUnitType::CSS_DEG:
+    case CSSUnitType::CSS_RAD:
+    case CSSUnitType::CSS_GRAD:
+    case CSSUnitType::CSS_MS:
+    case CSSUnitType::CSS_S:
+    case CSSUnitType::CSS_HZ:
+    case CSSUnitType::CSS_KHZ:
+    case CSSUnitType::CSS_TURN:
+    case CSSUnitType::CSS_VW:
+    case CSSUnitType::CSS_VH:
+    case CSSUnitType::CSS_VMIN:
+    case CSSUnitType::CSS_VMAX:
+    case CSSUnitType::CSS_FR:
+    case CSSUnitType::CSS_Q:
         return m_value.num == other.m_value.num;
-    case CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_PROPERTY_ID:
         return propertyName(m_value.propertyID) == propertyName(other.m_value.propertyID);
-    case CSS_VALUE_ID:
+    case CSSUnitType::CSS_VALUE_ID:
         return valueName(m_value.valueID) == valueName(other.m_value.valueID);
-    case CSS_DIMENSION:
-    case CSS_STRING:
-    case CSS_URI:
-    case CSS_ATTR:
-    case CSS_COUNTER_NAME:
+    case CSSUnitType::CSS_DIMENSION:
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_URI:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_COUNTER_NAME:
         return equal(m_value.string, other.m_value.string);
-    case CSS_COUNTER:
+    case CSSUnitType::CSS_COUNTER:
         return m_value.counter && other.m_value.counter && m_value.counter->equals(*other.m_value.counter);
-    case CSS_RECT:
+    case CSSUnitType::CSS_RECT:
         return m_value.rect && other.m_value.rect && m_value.rect->equals(*other.m_value.rect);
-    case CSS_QUAD:
+    case CSSUnitType::CSS_QUAD:
         return m_value.quad && other.m_value.quad && m_value.quad->equals(*other.m_value.quad);
-    case CSS_RGBCOLOR:
+    case CSSUnitType::CSS_RGBCOLOR:
         return color() == other.color();
-    case CSS_PAIR:
+    case CSSUnitType::CSS_PAIR:
         return m_value.pair && other.m_value.pair && m_value.pair->equals(*other.m_value.pair);
-    case CSS_CALC:
+    case CSSUnitType::CSS_CALC:
         return m_value.calc && other.m_value.calc && m_value.calc->equals(*other.m_value.calc);
-    case CSS_SHAPE:
+    case CSSUnitType::CSS_SHAPE:
         return m_value.shape && other.m_value.shape && m_value.shape->equals(*other.m_value.shape);
-    case CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_FONT_FAMILY:
         return fontFamily() == other.fontFamily();
+    case CSSUnitType::CSS_IDENT:
+    case CSSUnitType::CSS_UNICODE_RANGE:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
+        // FIXME: seems like these should be handled.
+        ASSERT_NOT_REACHED();
+        break;
     }
     return false;
 }
@@ -1167,28 +1176,32 @@ Ref<DeprecatedCSSOMPrimitiveValue> CSSPrimitiveValue::createDeprecatedCSSOMPrimi
 // https://drafts.css-houdini.org/css-properties-values-api/#dependency-cycles-via-relative-units
 void CSSPrimitiveValue::collectDirectComputationalDependencies(HashSet<CSSPropertyID>& values) const
 {
-    switch (m_primitiveUnitType) {
-    case CSS_EMS:
-    case CSS_QUIRKY_EMS:
-    case CSS_EXS:
-    case CSS_CHS:
+    switch (primitiveUnitType()) {
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_CHS:
         values.add(CSSPropertyFontSize);
         break;
-    case CSS_CALC:
+    case CSSUnitType::CSS_CALC:
         m_value.calc->collectDirectComputationalDependencies(values);
         break;
+    default:
+        break;
     }
 }
 
 void CSSPrimitiveValue::collectDirectRootComputationalDependencies(HashSet<CSSPropertyID>& values) const
 {
-    switch (m_primitiveUnitType) {
-    case CSS_REMS:
+    switch (primitiveUnitType()) {
+    case CSSUnitType::CSS_REMS:
         values.add(CSSPropertyFontSize);
         break;
-    case CSS_CALC:
+    case CSSUnitType::CSS_CALC:
         m_value.calc->collectDirectRootComputationalDependencies(values);
         break;
+    default:
+        break;
     }
 }
 
index ad4a051..8090d85 100644 (file)
@@ -72,140 +72,137 @@ template<> inline float roundForImpreciseConversion(double value)
     return static_cast<float>(value);
 }
 
-class CSSPrimitiveValue final : public CSSValue {
-public:
-    enum UnitType {
-        CSS_UNKNOWN = 0,
-        CSS_NUMBER = 1,
-        CSS_PERCENTAGE = 2,
-        CSS_EMS = 3,
-        CSS_EXS = 4,
-        CSS_PX = 5,
-        CSS_CM = 6,
-        CSS_MM = 7,
-        CSS_IN = 8,
-        CSS_PT = 9,
-        CSS_PC = 10,
-        CSS_DEG = 11,
-        CSS_RAD = 12,
-        CSS_GRAD = 13,
-        CSS_MS = 14,
-        CSS_S = 15,
-        CSS_HZ = 16,
-        CSS_KHZ = 17,
-        CSS_DIMENSION = 18,
-        CSS_STRING = 19,
-        CSS_URI = 20,
-        CSS_IDENT = 21,
-        CSS_ATTR = 22,
-        CSS_COUNTER = 23,
-        CSS_RECT = 24,
-        CSS_RGBCOLOR = 25,
-        // From CSS Values and Units. Viewport-percentage Lengths (vw/vh/vmin/vmax).
-        CSS_VW = 26,
-        CSS_VH = 27,
-        CSS_VMIN = 28,
-        CSS_VMAX = 29,
-        CSS_DPPX = 30,
-        CSS_DPI = 31,
-        CSS_DPCM = 32,
-        CSS_FR = 33,
-        CSS_Q = 34,
-        CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
-        CSS_UNICODE_RANGE = 102,
-
-        // These are from CSS3 Values and Units, but that isn't a finished standard yet
-        CSS_TURN = 107,
-        CSS_REMS = 108,
-        CSS_CHS = 109,
-
-        // This is used internally for counter names (as opposed to counter values)
-        CSS_COUNTER_NAME = 110,
-
-        // This is used by the CSS Shapes draft
-        CSS_SHAPE = 111,
-
-        // Used by border images.
-        CSS_QUAD = 112,
-
-        CSS_CALC = 113,
-        CSS_CALC_PERCENTAGE_WITH_NUMBER = 114,
-        CSS_CALC_PERCENTAGE_WITH_LENGTH = 115,
-
-        CSS_FONT_FAMILY = 116,
-
-        CSS_PROPERTY_ID = 117,
-        CSS_VALUE_ID = 118,
-        
-        // This value is used to handle quirky margins in reflow roots (body, td, and th) like WinIE.
-        // 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. This quirk is specified in the HTML spec but our impl is different.
-        CSS_QUIRKY_EMS = 120
-    };
-
-    // This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY for frequencies.
-    enum UnitCategory {
-        UNumber,
-        UPercent,
-        ULength,
-        UAngle,
-        UTime,
-        UFrequency,
+enum class CSSUnitType : uint8_t {
+    CSS_UNKNOWN = 0,
+    CSS_NUMBER = 1,
+    CSS_PERCENTAGE = 2,
+    CSS_EMS = 3,
+    CSS_EXS = 4,
+    CSS_PX = 5,
+    CSS_CM = 6,
+    CSS_MM = 7,
+    CSS_IN = 8,
+    CSS_PT = 9,
+    CSS_PC = 10,
+    CSS_DEG = 11,
+    CSS_RAD = 12,
+    CSS_GRAD = 13,
+    CSS_MS = 14,
+    CSS_S = 15,
+    CSS_HZ = 16,
+    CSS_KHZ = 17,
+    CSS_DIMENSION = 18,
+    CSS_STRING = 19,
+    CSS_URI = 20,
+    CSS_IDENT = 21,
+    CSS_ATTR = 22,
+    CSS_COUNTER = 23,
+    CSS_RECT = 24,
+    CSS_RGBCOLOR = 25,
+    CSS_VW = 26,
+    CSS_VH = 27,
+    CSS_VMIN = 28,
+    CSS_VMAX = 29,
+    CSS_DPPX = 30,
+    CSS_DPI = 31,
+    CSS_DPCM = 32,
+    CSS_FR = 33,
+    CSS_Q = 34,
+    CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
+    CSS_UNICODE_RANGE = 102,
+    CSS_TURN = 107,
+    CSS_REMS = 108,
+    CSS_CHS = 109,
+
+    // This is used internally for counter names (as opposed to counter values)
+    CSS_COUNTER_NAME = 110,
+
+    CSS_SHAPE = 111,
+
+    // Used by border images.
+    CSS_QUAD = 112,
+
+    CSS_CALC = 113,
+    CSS_CALC_PERCENTAGE_WITH_NUMBER = 114,
+    CSS_CALC_PERCENTAGE_WITH_LENGTH = 115,
+
+    CSS_FONT_FAMILY = 116,
+
+    CSS_PROPERTY_ID = 117,
+    CSS_VALUE_ID = 118,
+    
+    // This value is used to handle quirky margins in reflow roots (body, td, and th) like WinIE.
+    // 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. This quirk is specified in the HTML spec but our impl is different.
+    CSS_QUIRKY_EMS = 120
+    
+    // Note that CSSValue allocates 7 bits for m_primitiveUnitType, so there can be no value here > 127.
+};
+
+// This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY for frequencies.
+enum class CSSUnitCategory : uint8_t {
+    Number,
+    Percent,
+    Length,
+    Angle,
+    Time,
+    Frequency,
 #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
-        UResolution,
+    Resolution,
 #endif
-        UOther
-    };
-    static UnitCategory unitCategory(UnitType);
+    Other
+};
+
+CSSUnitCategory unitCategory(CSSUnitType);
+
+class CSSPrimitiveValue final : public CSSValue {
+public:
+
+    static bool isFontRelativeLength(CSSUnitType);
+    static bool isLength(CSSUnitType);
+    static bool isResolution(CSSUnitType);
+    static bool isViewportPercentageLength(CSSUnitType type) { return type >= CSSUnitType::CSS_VW && type <= CSSUnitType::CSS_VMAX; }
 
     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(UnitType);
-    bool isFontRelativeLength() const { return isFontRelativeLength(static_cast<UnitType>(m_primitiveUnitType)); }
-    
-    bool isQuirkyEms() const { return primitiveType() == UnitType::CSS_QUIRKY_EMS; }
-
-    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(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; }
-    bool isRect() const { return m_primitiveUnitType == CSS_RECT; }
-    bool isPair() const { return m_primitiveUnitType == CSS_PAIR; }
-    bool isPropertyID() const { return m_primitiveUnitType == CSS_PROPERTY_ID; }
-    bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; }
-    bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; }
-    bool isString() const { return m_primitiveUnitType == CSS_STRING; }
-    bool isFontFamily() const { return m_primitiveUnitType == CSS_FONT_FAMILY; }
-    bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnitType == CSS_MS; }
-    bool isURI() const { return m_primitiveUnitType == CSS_URI; }
-    bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; }
-    bool isCalculatedPercentageWithNumber() const { return primitiveType() == CSS_CALC_PERCENTAGE_WITH_NUMBER; }
-    bool isCalculatedPercentageWithLength() const { return primitiveType() == CSS_CALC_PERCENTAGE_WITH_LENGTH; }
-    bool isDotsPerInch() const { return primitiveType() == CSS_DPI; }
-    bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; }
-    bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; }
-
-    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; }
-    bool isViewportPercentageMin() const { return m_primitiveUnitType == CSS_VMIN; }
-    bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
-    bool isFlex() const { return primitiveType() == CSS_FR; }
+    bool isAttr() const { return primitiveUnitType() == CSSUnitType::CSS_ATTR; }
+    bool isCounter() const { return primitiveUnitType() == CSSUnitType::CSS_COUNTER; }
+    bool isFontIndependentLength() const { return primitiveUnitType() >= CSSUnitType::CSS_PX && primitiveUnitType() <= CSSUnitType::CSS_PC; }
+    bool isFontRelativeLength() const { return isFontRelativeLength(primitiveUnitType()); }
+    bool isQuirkyEms() const { return primitiveType() == CSSUnitType::CSS_QUIRKY_EMS; }
+    bool isLength() const { return isLength(static_cast<CSSUnitType>(primitiveType())); }
+    bool isNumber() const { return primitiveType() == CSSUnitType::CSS_NUMBER; }
+    bool isPercentage() const { return primitiveType() == CSSUnitType::CSS_PERCENTAGE; }
+    bool isPx() const { return primitiveType() == CSSUnitType::CSS_PX; }
+    bool isRect() const { return primitiveUnitType() == CSSUnitType::CSS_RECT; }
+    bool isPair() const { return primitiveUnitType() == CSSUnitType::CSS_PAIR; }
+    bool isPropertyID() const { return primitiveUnitType() == CSSUnitType::CSS_PROPERTY_ID; }
+    bool isRGBColor() const { return primitiveUnitType() == CSSUnitType::CSS_RGBCOLOR; }
+    bool isShape() const { return primitiveUnitType() == CSSUnitType::CSS_SHAPE; }
+    bool isString() const { return primitiveUnitType() == CSSUnitType::CSS_STRING; }
+    bool isFontFamily() const { return primitiveUnitType() == CSSUnitType::CSS_FONT_FAMILY; }
+    bool isTime() const { return primitiveUnitType() == CSSUnitType::CSS_S || primitiveUnitType() == CSSUnitType::CSS_MS; }
+    bool isURI() const { return primitiveUnitType() == CSSUnitType::CSS_URI; }
+    bool isCalculated() const { return primitiveUnitType() == CSSUnitType::CSS_CALC; }
+    bool isCalculatedPercentageWithNumber() const { return primitiveType() == CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER; }
+    bool isCalculatedPercentageWithLength() const { return primitiveType() == CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH; }
+    bool isDotsPerInch() const { return primitiveType() == CSSUnitType::CSS_DPI; }
+    bool isDotsPerPixel() const { return primitiveType() == CSSUnitType::CSS_DPPX; }
+    bool isDotsPerCentimeter() const { return primitiveType() == CSSUnitType::CSS_DPCM; }
+    bool isResolution() const { return isResolution(primitiveType()); }
+    bool isViewportPercentageLength() const { return isViewportPercentageLength(primitiveUnitType()); }
+    bool isViewportPercentageWidth() const { return primitiveUnitType() == CSSUnitType::CSS_VW; }
+    bool isViewportPercentageHeight() const { return primitiveUnitType() == CSSUnitType::CSS_VH; }
+    bool isViewportPercentageMax() const { return primitiveUnitType() == CSSUnitType::CSS_VMAX; }
+    bool isViewportPercentageMin() const { return primitiveUnitType() == CSSUnitType::CSS_VMIN; }
+    bool isValueID() const { return primitiveUnitType() == CSSUnitType::CSS_VALUE_ID; }
+    bool isFlex() const { return primitiveType() == CSSUnitType::CSS_FR; }
 
     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, 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(double value, CSSUnitType type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
+    static Ref<CSSPrimitiveValue> create(const String& value, CSSUnitType 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)); }
 
@@ -215,16 +212,16 @@ 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, UnitType);
+    static Ref<CSSPrimitiveValue> createAllowingMarginQuirk(double value, CSSUnitType);
 
     ~CSSPrimitiveValue();
 
     void cleanup();
 
-    WEBCORE_EXPORT unsigned short primitiveType() const;
-    WEBCORE_EXPORT ExceptionOr<void> setFloatValue(unsigned short unitType, double floatValue);
-    WEBCORE_EXPORT ExceptionOr<float> getFloatValue(unsigned short unitType) const;
-    WEBCORE_EXPORT ExceptionOr<void> setStringValue(unsigned short stringType, const String& stringValue);
+    WEBCORE_EXPORT CSSUnitType primitiveType() const;
+    WEBCORE_EXPORT ExceptionOr<void> setFloatValue(CSSUnitType , double);
+    WEBCORE_EXPORT ExceptionOr<float> getFloatValue(CSSUnitType) const;
+    WEBCORE_EXPORT ExceptionOr<void> setStringValue(CSSUnitType, const String&);
     WEBCORE_EXPORT ExceptionOr<String> getStringValue() const;
     WEBCORE_EXPORT ExceptionOr<Counter&> getCounterValue() const;
     WEBCORE_EXPORT ExceptionOr<Rect&> getRectValue() const;
@@ -240,44 +237,44 @@ public:
 
     bool convertingToLengthRequiresNonNullStyle(int lengthConversion) const;
 
-    double doubleValue(UnitType) const;
+    double doubleValue(CSSUnitType) const;
     double doubleValue() const;
 
-    template<typename T> inline T value(UnitType type) const { return clampTo<T>(doubleValue(type)); }
+    template<typename T> inline T value(CSSUnitType type) const { return clampTo<T>(doubleValue(type)); }
     template<typename T> inline T value() const { return clampTo<T>(doubleValue()); }
 
-    float floatValue(UnitType type) const { return value<float>(type); }
+    float floatValue(CSSUnitType type) const { return value<float>(type); }
     float floatValue() const { return value<float>(); }
 
-    int intValue(UnitType type) const { return value<int>(type); }
+    int intValue(CSSUnitType type) const { return value<int>(type); }
     int intValue() const { return value<int>(); }
 
     WEBCORE_EXPORT String stringValue() const;
 
-    const Color& color() const { ASSERT(m_primitiveUnitType == CSS_RGBCOLOR); return *m_value.color; }
-    Counter* counterValue() const { return m_primitiveUnitType != CSS_COUNTER ? nullptr : m_value.counter; }
-    CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? nullptr : m_value.calc; }
-    const CSSFontFamily& fontFamily() const { ASSERT(m_primitiveUnitType == CSS_FONT_FAMILY); return *m_value.fontFamily; }
-    Pair* pairValue() const { return m_primitiveUnitType != CSS_PAIR ? nullptr : m_value.pair; }
-    CSSPropertyID propertyID() const { return m_primitiveUnitType == CSS_PROPERTY_ID ? m_value.propertyID : CSSPropertyInvalid; }
-    Quad* quadValue() const { return m_primitiveUnitType != CSS_QUAD ? nullptr : m_value.quad; }
-    Rect* rectValue() const { return m_primitiveUnitType != CSS_RECT ? nullptr : m_value.rect; }
-    CSSBasicShape* shapeValue() const { return m_primitiveUnitType != CSS_SHAPE ? nullptr : m_value.shape; }
-    CSSValueID valueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
+    const Color& color() const { ASSERT(primitiveUnitType() == CSSUnitType::CSS_RGBCOLOR); return *m_value.color; }
+    Counter* counterValue() const { return primitiveUnitType() != CSSUnitType::CSS_COUNTER ? nullptr : m_value.counter; }
+    CSSCalcValue* cssCalcValue() const { return primitiveUnitType() != CSSUnitType::CSS_CALC ? nullptr : m_value.calc; }
+    const CSSFontFamily& fontFamily() const { ASSERT(primitiveUnitType() == CSSUnitType::CSS_FONT_FAMILY); return *m_value.fontFamily; }
+    Pair* pairValue() const { return primitiveUnitType() != CSSUnitType::CSS_PAIR ? nullptr : m_value.pair; }
+    CSSPropertyID propertyID() const { return primitiveUnitType() == CSSUnitType::CSS_PROPERTY_ID ? m_value.propertyID : CSSPropertyInvalid; }
+    Quad* quadValue() const { return primitiveUnitType() != CSSUnitType::CSS_QUAD ? nullptr : m_value.quad; }
+    Rect* rectValue() const { return primitiveUnitType() != CSSUnitType::CSS_RECT ? nullptr : m_value.rect; }
+    CSSBasicShape* shapeValue() const { return primitiveUnitType() != CSSUnitType::CSS_SHAPE ? nullptr : m_value.shape; }
+    CSSValueID valueID() const { return primitiveUnitType() == CSSUnitType::CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
 
     template<typename T> inline operator T() const; // Defined in CSSPrimitiveValueMappings.h
 
     String customCSSText() const;
 
     // FIXME-NEWPARSER: Can ditch the boolean and just use the unit type once old parser is gone.
-    bool isQuirkValue() const { return m_isQuirkValue || primitiveType() == CSS_QUIRKY_EMS; }
+    bool isQuirkValue() const { return m_isQuirkValue || primitiveType() == CSSUnitType::CSS_QUIRKY_EMS; }
 
     bool equals(const CSSPrimitiveValue&) const;
 
-    static UnitType canonicalUnitTypeForCategory(UnitCategory);
-    static double conversionToCanonicalUnitsScaleFactor(UnitType);
+    static CSSUnitType canonicalUnitTypeForCategory(CSSUnitCategory);
+    static double conversionToCanonicalUnitsScaleFactor(CSSUnitType);
 
-    static double computeNonCalcLengthDouble(const CSSToLengthConversionData&, UnitType, double value);
+    static double computeNonCalcLengthDouble(const CSSToLengthConversionData&, CSSUnitType, double value);
     // True if computeNonCalcLengthDouble would produce identical results when resolved against both these styles.
     static bool equalForLengthResolution(const RenderStyle&, const RenderStyle&);
 
@@ -296,8 +293,8 @@ private:
     CSSPrimitiveValue(const Length&);
     CSSPrimitiveValue(const Length&, const RenderStyle&);
     CSSPrimitiveValue(const LengthSize&, const RenderStyle&);
-    CSSPrimitiveValue(const String&, UnitType);
-    CSSPrimitiveValue(double, UnitType);
+    CSSPrimitiveValue(const String&, CSSUnitType);
+    CSSPrimitiveValue(double, CSSUnitType);
 
     template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h
     template<typename T> CSSPrimitiveValue(RefPtr<T>&&);
@@ -316,7 +313,10 @@ private:
     void init(Ref<Quad>&&);
     void init(Ref<Rect>&&);
 
-    Optional<double> doubleValueInternal(UnitType targetUnitType) const;
+    CSSUnitType primitiveUnitType() const { return static_cast<CSSUnitType>(m_primitiveUnitType); }
+    void setPrimitiveUnitType(CSSUnitType type) { m_primitiveUnitType = static_cast<unsigned>(type); }
+
+    Optional<double> doubleValueInternal(CSSUnitType targetUnitType) const;
 
     double computeLengthDouble(const CSSToLengthConversionData&) const;
 
@@ -342,34 +342,34 @@ private:
 inline bool CSSPrimitiveValue::isAngle() const
 {
     auto primitiveType = this->primitiveType();
-    return primitiveType == CSS_DEG
-        || primitiveType == CSS_RAD
-        || primitiveType == CSS_GRAD
-        || primitiveType == CSS_TURN;
+    return primitiveType == CSSUnitType::CSS_DEG
+        || primitiveType == CSSUnitType::CSS_RAD
+        || primitiveType == CSSUnitType::CSS_GRAD
+        || primitiveType == CSSUnitType::CSS_TURN;
 }
 
-inline bool CSSPrimitiveValue::isFontRelativeLength(UnitType type)
+inline bool CSSPrimitiveValue::isFontRelativeLength(CSSUnitType type)
 {
-    return type == CSS_EMS
-        || type == CSS_EXS
-        || type == CSS_REMS
-        || type == CSS_CHS
-        || type == CSS_QUIRKY_EMS;
+    return type == CSSUnitType::CSS_EMS
+        || type == CSSUnitType::CSS_EXS
+        || type == CSSUnitType::CSS_REMS
+        || type == CSSUnitType::CSS_CHS
+        || type == CSSUnitType::CSS_QUIRKY_EMS;
 }
 
-inline bool CSSPrimitiveValue::isLength(UnitType type)
+inline bool CSSPrimitiveValue::isLength(CSSUnitType type)
 {
-    return (type >= CSS_EMS && type <= CSS_PC)
-        || type == CSS_REMS
-        || type == CSS_CHS
-        || type == CSS_Q
+    return (type >= CSSUnitType::CSS_EMS && type <= CSSUnitType::CSS_PC)
+        || type == CSSUnitType::CSS_REMS
+        || type == CSSUnitType::CSS_CHS
+        || type == CSSUnitType::CSS_Q
         || isViewportPercentageLength(type)
-        || type == CSS_QUIRKY_EMS;
+        || type == CSSUnitType::CSS_QUIRKY_EMS;
 }
 
-inline bool CSSPrimitiveValue::isResolution(UnitType type)
+inline bool CSSPrimitiveValue::isResolution(CSSUnitType type)
 {
-    return type >= CSS_DPPX && type <= CSS_DPCM;
+    return type >= CSSUnitType::CSS_DPPX && type <= CSSUnitType::CSS_DPCM;
 }
 
 template<typename T> inline Ref<CSSPrimitiveValue> CSSPrimitiveValue::create(T&& value)
@@ -377,7 +377,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, UnitType type)
+inline Ref<CSSPrimitiveValue> CSSPrimitiveValue::createAllowingMarginQuirk(double value, CSSUnitType type)
 {
     auto result = adoptRef(*new CSSPrimitiveValue(value, type));
     result->m_isQuirkValue = true;
@@ -386,13 +386,13 @@ inline Ref<CSSPrimitiveValue> CSSPrimitiveValue::createAllowingMarginQuirk(doubl
 
 template<typename T, CSSPrimitiveValue::TimeUnit timeUnit> inline T CSSPrimitiveValue::computeTime() const
 {
-    if (timeUnit == Seconds && primitiveType() == CSS_S)
+    if (timeUnit == Seconds && primitiveType() == CSSUnitType::CSS_S)
         return value<T>();
-    if (timeUnit == Seconds && primitiveType() == CSS_MS)
+    if (timeUnit == Seconds && primitiveType() == CSSUnitType::CSS_MS)
         return value<T>() / 1000;
-    if (timeUnit == Milliseconds && primitiveType() == CSS_MS)
+    if (timeUnit == Milliseconds && primitiveType() == CSSUnitType::CSS_MS)
         return value<T>();
-    if (timeUnit == Milliseconds && primitiveType() == CSS_S)
+    if (timeUnit == Milliseconds && primitiveType() == CSSUnitType::CSS_S)
         return value<T>() * 1000;
     ASSERT_NOT_REACHED();
     return 0;
index bc33c9f..a398d10 100644 (file)
@@ -56,13 +56,13 @@ namespace WebCore {
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_NUMBER;
+    setPrimitiveUnitType(CSSUnitType::CSS_NUMBER);
     m_value.num = static_cast<double>(i);
 }
 
 template<> inline CSSPrimitiveValue::operator short() const
 {
-    if (m_primitiveUnitType == CSS_NUMBER)
+    if (primitiveUnitType() == CSSUnitType::CSS_NUMBER)
         return clampTo<short>(m_value.num);
 
     ASSERT_NOT_REACHED();
@@ -72,13 +72,13 @@ template<> inline CSSPrimitiveValue::operator short() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(unsigned short i)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_NUMBER;
+    setPrimitiveUnitType(CSSUnitType::CSS_NUMBER);
     m_value.num = static_cast<double>(i);
 }
 
 template<> inline CSSPrimitiveValue::operator unsigned short() const
 {
-    if (primitiveType() == CSS_NUMBER)
+    if (primitiveType() == CSSUnitType::CSS_NUMBER)
         return value<unsigned short>();
 
     ASSERT_NOT_REACHED();
@@ -87,7 +87,7 @@ template<> inline CSSPrimitiveValue::operator unsigned short() const
 
 template<> inline CSSPrimitiveValue::operator int() const
 {
-    if (primitiveType() == CSS_NUMBER)
+    if (primitiveType() == CSSUnitType::CSS_NUMBER)
         return value<int>();
 
     ASSERT_NOT_REACHED();
@@ -96,7 +96,7 @@ template<> inline CSSPrimitiveValue::operator int() const
 
 template<> inline CSSPrimitiveValue::operator unsigned() const
 {
-    if (primitiveType() == CSS_NUMBER)
+    if (primitiveType() == CSSUnitType::CSS_NUMBER)
         return value<unsigned>();
 
     ASSERT_NOT_REACHED();
@@ -107,13 +107,13 @@ template<> inline CSSPrimitiveValue::operator unsigned() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(float i)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_NUMBER;
+    setPrimitiveUnitType(CSSUnitType::CSS_NUMBER);
     m_value.num = static_cast<double>(i);
 }
 
 template<> inline CSSPrimitiveValue::operator float() const
 {
-    if (primitiveType() == CSS_NUMBER)
+    if (primitiveType() == CSSUnitType::CSS_NUMBER)
         return value<float>();
 
     ASSERT_NOT_REACHED();
@@ -123,16 +123,16 @@ template<> inline CSSPrimitiveValue::operator float() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineClampValue i)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = i.isPercentage() ? CSS_PERCENTAGE : CSS_NUMBER;
+    setPrimitiveUnitType(i.isPercentage() ? CSSUnitType::CSS_PERCENTAGE : CSSUnitType::CSS_NUMBER);
     m_value.num = static_cast<double>(i.value());
 }
 
 template<> inline CSSPrimitiveValue::operator LineClampValue() const
 {
-    if (primitiveType() == CSS_NUMBER)
+    if (primitiveType() == CSSUnitType::CSS_NUMBER)
         return LineClampValue(value<int>(), LineClamp::LineCount);
 
-    if (primitiveType() == CSS_PERCENTAGE)
+    if (primitiveType() == CSSUnitType::CSS_PERCENTAGE)
         return LineClampValue(value<int>(), LineClamp::Percentage);
 
     ASSERT_NOT_REACHED();
@@ -142,7 +142,7 @@ template<> inline CSSPrimitiveValue::operator LineClampValue() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ReflectionDirection direction)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (direction) {
     case ReflectionDirection::Above:
         m_value.valueID = CSSValueAbove;
@@ -182,7 +182,7 @@ template<> inline CSSPrimitiveValue::operator ReflectionDirection() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (columnFill) {
     case ColumnFill::Auto:
         m_value.valueID = CSSValueAuto;
@@ -195,7 +195,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill)
 
 template<> inline CSSPrimitiveValue::operator ColumnFill() const
 {
-    if (m_primitiveUnitType == CSS_VALUE_ID) {
+    if (primitiveUnitType() == CSSUnitType::CSS_VALUE_ID) {
         if (m_value.valueID == CSSValueBalance)
             return ColumnFill::Balance;
         if (m_value.valueID == CSSValueAuto)
@@ -208,7 +208,7 @@ template<> inline CSSPrimitiveValue::operator ColumnFill() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (columnSpan) {
     case ColumnSpan::All:
         m_value.valueID = CSSValueAll;
@@ -222,7 +222,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
 template<> inline CSSPrimitiveValue::operator ColumnSpan() const
 {
     // Map 1 to none for compatibility reasons.
-    if (m_primitiveUnitType == CSS_NUMBER && m_value.num == 1)
+    if (primitiveUnitType() == CSSUnitType::CSS_NUMBER && m_value.num == 1)
         return ColumnSpan::None;
 
     ASSERT(isValueID());
@@ -244,7 +244,7 @@ template<> inline CSSPrimitiveValue::operator ColumnSpan() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PrintColorAdjust value)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (value) {
     case PrintColorAdjust::Exact:
         m_value.valueID = CSSValueExact;
@@ -276,7 +276,7 @@ template<> inline CSSPrimitiveValue::operator PrintColorAdjust() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BorderStyle e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BorderStyle::None:
         m_value.valueID = CSSValueNone;
@@ -332,7 +332,7 @@ template<> inline CSSPrimitiveValue::operator OutlineIsAuto() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case CompositeClear:
         m_value.valueID = CSSValueClear;
@@ -421,7 +421,7 @@ template<> inline CSSPrimitiveValue::operator CompositeOperator() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case NoControlPart:
         m_value.valueID = CSSValueNone;
@@ -646,7 +646,7 @@ template<> inline CSSPrimitiveValue::operator ControlPart() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BackfaceVisibility e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BackfaceVisibility::Visible:
         m_value.valueID = CSSValueVisible;
@@ -678,7 +678,7 @@ template<> inline CSSPrimitiveValue::operator BackfaceVisibility() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FillAttachment e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case FillAttachment::ScrollBackground:
         m_value.valueID = CSSValueScroll;
@@ -714,7 +714,7 @@ template<> inline CSSPrimitiveValue::operator FillAttachment() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FillBox e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case FillBox::Border:
         m_value.valueID = CSSValueBorderBox;
@@ -759,7 +759,7 @@ template<> inline CSSPrimitiveValue::operator FillBox() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FillRepeat e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case FillRepeat::Repeat:
         m_value.valueID = CSSValueRepeat;
@@ -800,7 +800,7 @@ template<> inline CSSPrimitiveValue::operator FillRepeat() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BoxPack e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BoxPack::Start:
         m_value.valueID = CSSValueStart;
@@ -841,7 +841,7 @@ template<> inline CSSPrimitiveValue::operator BoxPack() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BoxAlignment e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BoxAlignment::Stretch:
         m_value.valueID = CSSValueStretch;
@@ -888,7 +888,7 @@ template<> inline CSSPrimitiveValue::operator BoxAlignment() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BoxDecorationBreak e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BoxDecorationBreak::Slice:
         m_value.valueID = CSSValueSlice;
@@ -920,7 +920,7 @@ template<> inline CSSPrimitiveValue::operator BoxDecorationBreak() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Edge e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case Edge::Top:
         m_value.valueID = CSSValueTop;
@@ -961,7 +961,7 @@ template<> inline CSSPrimitiveValue::operator Edge() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BoxSizing e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BoxSizing::BorderBox:
         m_value.valueID = CSSValueBorderBox;
@@ -992,7 +992,7 @@ template<> inline CSSPrimitiveValue::operator BoxSizing() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BoxDirection e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BoxDirection::Normal:
         m_value.valueID = CSSValueNormal;
@@ -1023,7 +1023,7 @@ template<> inline CSSPrimitiveValue::operator BoxDirection() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BoxLines e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BoxLines::Single:
         m_value.valueID = CSSValueSingle;
@@ -1054,7 +1054,7 @@ template<> inline CSSPrimitiveValue::operator BoxLines() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BoxOrient e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BoxOrient::Horizontal:
         m_value.valueID = CSSValueHorizontal;
@@ -1087,7 +1087,7 @@ template<> inline CSSPrimitiveValue::operator BoxOrient() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CaptionSide e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case CaptionSide::Left:
         m_value.valueID = CSSValueLeft;
@@ -1128,7 +1128,7 @@ template<> inline CSSPrimitiveValue::operator CaptionSide() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Clear e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case Clear::None:
         m_value.valueID = CSSValueNone;
@@ -1169,7 +1169,7 @@ template<> inline CSSPrimitiveValue::operator Clear() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CursorType e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case CursorType::Auto:
         m_value.valueID = CSSValueAuto;
@@ -1307,7 +1307,7 @@ template<> inline CSSPrimitiveValue::operator CursorType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CursorVisibility e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case CursorVisibility::Auto:
         m_value.valueID = CSSValueAuto;
@@ -1335,7 +1335,7 @@ template<> inline CSSPrimitiveValue::operator CursorVisibility() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(DisplayType e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case DisplayType::Inline:
         m_value.valueID = CSSValueInline;
@@ -1433,7 +1433,7 @@ template<> inline CSSPrimitiveValue::operator DisplayType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EmptyCell e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case EmptyCell::Show:
         m_value.valueID = CSSValueShow;
@@ -1464,7 +1464,7 @@ template<> inline CSSPrimitiveValue::operator EmptyCell() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FlexDirection e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case FlexDirection::Row:
         m_value.valueID = CSSValueRow;
@@ -1505,7 +1505,7 @@ template<> inline CSSPrimitiveValue::operator FlexDirection() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(AlignContent e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case AlignContent::FlexStart:
         m_value.valueID = CSSValueFlexStart;
@@ -1556,7 +1556,7 @@ template<> inline CSSPrimitiveValue::operator AlignContent() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FlexWrap e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case FlexWrap::NoWrap:
         m_value.valueID = CSSValueNowrap;
@@ -1592,7 +1592,7 @@ template<> inline CSSPrimitiveValue::operator FlexWrap() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Float e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case Float::No:
         m_value.valueID = CSSValueNone;
@@ -1629,7 +1629,7 @@ template<> inline CSSPrimitiveValue::operator Float() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineBreak e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case LineBreak::Auto:
         m_value.valueID = CSSValueAuto;
@@ -1703,7 +1703,7 @@ template<> inline CSSPrimitiveValue::operator LineBreak() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ListStylePosition e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ListStylePosition::Outside:
         m_value.valueID = CSSValueOutside;
@@ -1734,7 +1734,7 @@ template<> inline CSSPrimitiveValue::operator ListStylePosition() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ListStyleType e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ListStyleType::Afar:
         m_value.valueID = CSSValueAfar;
@@ -1997,7 +1997,7 @@ template<> inline CSSPrimitiveValue::operator ListStyleType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(MarginCollapse e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case MarginCollapse::Collapse:
         m_value.valueID = CSSValueCollapse;
@@ -2033,7 +2033,7 @@ template<> inline CSSPrimitiveValue::operator MarginCollapse() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(MarqueeBehavior e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case MarqueeBehavior::None:
         m_value.valueID = CSSValueNone;
@@ -2074,7 +2074,7 @@ template<> inline CSSPrimitiveValue::operator MarqueeBehavior() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(MarqueeDirection direction)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (direction) {
     case MarqueeDirection::Forward:
         m_value.valueID = CSSValueForwards;
@@ -2132,7 +2132,7 @@ template<> inline CSSPrimitiveValue::operator MarqueeDirection() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(NBSPMode e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case NBSPMode::Normal:
         m_value.valueID = CSSValueNormal;
@@ -2163,7 +2163,7 @@ template<> inline CSSPrimitiveValue::operator NBSPMode() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Overflow e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case Overflow::Visible:
         m_value.valueID = CSSValueVisible;
@@ -2215,7 +2215,7 @@ template<> inline CSSPrimitiveValue::operator Overflow() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BreakBetween e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BreakBetween::Auto:
         m_value.valueID = CSSValueAuto;
@@ -2286,7 +2286,7 @@ template<> inline CSSPrimitiveValue::operator BreakBetween() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BreakInside e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BreakInside::Auto:
         m_value.valueID = CSSValueAuto;
@@ -2327,7 +2327,7 @@ template<> inline CSSPrimitiveValue::operator BreakInside() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PositionType e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case PositionType::Static:
         m_value.valueID = CSSValueStatic;
@@ -2374,7 +2374,7 @@ template<> inline CSSPrimitiveValue::operator PositionType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Resize e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case Resize::Both:
         m_value.valueID = CSSValueBoth;
@@ -2418,7 +2418,7 @@ template<> inline CSSPrimitiveValue::operator Resize() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TableLayoutType e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TableLayoutType::Auto:
         m_value.valueID = CSSValueAuto;
@@ -2449,7 +2449,7 @@ template<> inline CSSPrimitiveValue::operator TableLayoutType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextAlignMode e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextAlignMode::Start:
         m_value.valueID = CSSValueStart;
@@ -2500,7 +2500,7 @@ template<> inline CSSPrimitiveValue::operator TextAlignMode() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextAlignLast e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextAlignLast::Start:
         m_value.valueID = CSSValueStart;
@@ -2556,7 +2556,7 @@ template<> inline CSSPrimitiveValue::operator TextAlignLast() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextJustify e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextJustify::Auto:
         m_value.valueID = CSSValueAuto;
@@ -2648,7 +2648,7 @@ template<> inline CSSPrimitiveValue::operator TextDecorationStyle() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextUnderlinePosition position)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (position) {
     case TextUnderlinePosition::Auto:
         m_value.valueID = CSSValueAuto;
@@ -2687,7 +2687,7 @@ template<> inline CSSPrimitiveValue::operator TextUnderlinePosition() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextSecurity e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextSecurity::None:
         m_value.valueID = CSSValueNone;
@@ -2728,7 +2728,7 @@ template<> inline CSSPrimitiveValue::operator TextSecurity() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextTransform e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextTransform::Capitalize:
         m_value.valueID = CSSValueCapitalize;
@@ -2769,7 +2769,7 @@ template<> inline CSSPrimitiveValue::operator TextTransform() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case UBNormal:
         m_value.valueID = CSSValueNormal;
@@ -2823,7 +2823,7 @@ template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(UserDrag e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case UserDrag::Auto:
         m_value.valueID = CSSValueAuto;
@@ -2861,7 +2861,7 @@ template<> inline CSSPrimitiveValue::operator UserDrag() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(UserModify e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case UserModify::ReadOnly:
         m_value.valueID = CSSValueReadOnly;
@@ -2897,7 +2897,7 @@ template<> inline CSSPrimitiveValue::operator UserModify() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(UserSelect e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case UserSelect::None:
         m_value.valueID = CSSValueNone;
@@ -2935,7 +2935,7 @@ template<> inline CSSPrimitiveValue::operator UserSelect() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(VerticalAlign a)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (a) {
     case VerticalAlign::Top:
         m_value.valueID = CSSValueTop;
@@ -3003,7 +3003,7 @@ template<> inline CSSPrimitiveValue::operator VerticalAlign() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Visibility e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case Visibility::Visible:
         m_value.valueID = CSSValueVisible;
@@ -3039,7 +3039,7 @@ template<> inline CSSPrimitiveValue::operator Visibility() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WhiteSpace e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case WhiteSpace::Normal:
         m_value.valueID = CSSValueNormal;
@@ -3095,7 +3095,7 @@ template<> inline CSSPrimitiveValue::operator WhiteSpace() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WordBreak e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case WordBreak::Normal:
         m_value.valueID = CSSValueNormal;
@@ -3136,7 +3136,7 @@ template<> inline CSSPrimitiveValue::operator WordBreak() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverflowWrap e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case OverflowWrap::Normal:
         m_value.valueID = CSSValueNormal;
@@ -3167,7 +3167,7 @@ template<> inline CSSPrimitiveValue::operator OverflowWrap() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextDirection::LTR:
         m_value.valueID = CSSValueLtr;
@@ -3198,7 +3198,7 @@ template<> inline CSSPrimitiveValue::operator TextDirection() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TopToBottomWritingMode:
         m_value.valueID = CSSValueHorizontalTb;
@@ -3245,7 +3245,7 @@ template<> inline CSSPrimitiveValue::operator WritingMode() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextCombine e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextCombine::None:
         m_value.valueID = CSSValueNone;
@@ -3276,7 +3276,7 @@ template<> inline CSSPrimitiveValue::operator TextCombine() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RubyPosition position)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (position) {
     case RubyPosition::Before:
         m_value.valueID = CSSValueBefore;
@@ -3312,7 +3312,7 @@ template<> inline CSSPrimitiveValue::operator RubyPosition() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOverflow overflow)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (overflow) {
     case TextOverflow::Clip:
         m_value.valueID = CSSValueClip;
@@ -3343,7 +3343,7 @@ template<> inline CSSPrimitiveValue::operator TextOverflow() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (fill) {
     case TextEmphasisFill::Filled:
         m_value.valueID = CSSValueFilled;
@@ -3374,7 +3374,7 @@ template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (mark) {
     case TextEmphasisMark::Dot:
         m_value.valueID = CSSValueDot;
@@ -3428,7 +3428,7 @@ template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextOrientation::Sideways:
         m_value.valueID = CSSValueSideways;
@@ -3468,7 +3468,7 @@ template<> inline CSSPrimitiveValue::operator TextOrientation() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PointerEvents e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case PointerEvents::None:
         m_value.valueID = CSSValueNone;
@@ -3544,7 +3544,7 @@ template<> inline CSSPrimitiveValue::operator PointerEvents() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Kerning kerning)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (kerning) {
     case Kerning::Auto:
         m_value.valueID = CSSValueAuto;
@@ -3583,7 +3583,7 @@ template<> inline CSSPrimitiveValue::operator Kerning() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ObjectFit fit)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (fit) {
     case ObjectFit::Fill:
         m_value.valueID = CSSValueFill;
@@ -3627,7 +3627,7 @@ template<> inline CSSPrimitiveValue::operator ObjectFit() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (smoothing) {
     case FontSmoothingMode::AutoSmoothing:
         m_value.valueID = CSSValueAuto;
@@ -3671,7 +3671,7 @@ template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmallCaps smallCaps)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (smallCaps) {
     case FontSmallCaps::Off:
         m_value.valueID = CSSValueNormal;
@@ -3704,7 +3704,7 @@ template<> inline CSSPrimitiveValue::operator FontSmallCaps() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextRenderingMode::AutoTextRendering:
         m_value.valueID = CSSValueAuto;
@@ -3745,7 +3745,7 @@ template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (hyphens) {
     case Hyphens::None:
         m_value.valueID = CSSValueNone;
@@ -3781,7 +3781,7 @@ template<> inline CSSPrimitiveValue::operator Hyphens() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineSnap gridSnap)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (gridSnap) {
     case LineSnap::None:
         m_value.valueID = CSSValueNone;
@@ -3817,7 +3817,7 @@ template<> inline CSSPrimitiveValue::operator LineSnap() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineAlign lineAlign)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (lineAlign) {
     case LineAlign::None:
         m_value.valueID = CSSValueNone;
@@ -3848,7 +3848,7 @@ template<> inline CSSPrimitiveValue::operator LineAlign() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(SpeakAs e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case SpeakAs::Normal:
         m_value.valueID = CSSValueNormal;
@@ -3888,7 +3888,7 @@ template<> inline CSSPrimitiveValue::operator Order() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case Order::Logical:
         m_value.valueID = CSSValueLogical;
@@ -3925,7 +3925,7 @@ template<> inline CSSPrimitiveValue::operator OptionSet<SpeakAs>() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BlendMode blendMode)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (blendMode) {
     case BlendMode::Normal:
         m_value.valueID = CSSValueNormal;
@@ -4036,7 +4036,7 @@ template<> inline CSSPrimitiveValue::operator BlendMode() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Isolation isolation)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (isolation) {
     case Isolation::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4068,7 +4068,7 @@ template<> inline CSSPrimitiveValue::operator Isolation() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ButtCap:
         m_value.valueID = CSSValueButt;
@@ -4104,7 +4104,7 @@ template<> inline CSSPrimitiveValue::operator LineCap() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case MiterJoin:
         m_value.valueID = CSSValueMiter;
@@ -4140,7 +4140,7 @@ template<> inline CSSPrimitiveValue::operator LineJoin() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case WindRule::NonZero:
         m_value.valueID = CSSValueNonzero;
@@ -4172,7 +4172,7 @@ template<> inline CSSPrimitiveValue::operator WindRule() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(AlignmentBaseline e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case AlignmentBaseline::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4253,7 +4253,7 @@ template<> inline CSSPrimitiveValue::operator AlignmentBaseline() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BorderCollapse e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BorderCollapse::Separate:
         m_value.valueID = CSSValueSeparate;
@@ -4284,7 +4284,7 @@ template<> inline CSSPrimitiveValue::operator BorderCollapse() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BorderFit e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BorderFit::Border:
         m_value.valueID = CSSValueBorder;
@@ -4315,7 +4315,7 @@ template<> inline CSSPrimitiveValue::operator BorderFit() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ImageRendering imageRendering)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (imageRendering) {
     case ImageRendering::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4363,7 +4363,7 @@ template<> inline CSSPrimitiveValue::operator ImageRendering() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TransformStyle3D e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TransformStyle3D::Flat:
         m_value.valueID = CSSValueFlat;
@@ -4394,7 +4394,7 @@ template<> inline CSSPrimitiveValue::operator TransformStyle3D() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TransformBox box)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (box) {
     case TransformBox::StrokeBox:
         m_value.valueID = CSSValueStrokeBox;
@@ -4440,7 +4440,7 @@ template<> inline CSSPrimitiveValue::operator TransformBox() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnAxis e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ColumnAxis::Horizontal:
         m_value.valueID = CSSValueHorizontal;
@@ -4476,7 +4476,7 @@ template<> inline CSSPrimitiveValue::operator ColumnAxis() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnProgression e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ColumnProgression::Normal:
         m_value.valueID = CSSValueNormal;
@@ -4517,10 +4517,10 @@ inline bool CSSPrimitiveValue::convertingToLengthRequiresNonNullStyle(int length
 {
     ASSERT(isFontRelativeLength());
     // This matches the implementation in CSSPrimitiveValue::computeLengthDouble().
-    switch (m_primitiveUnitType) {
-    case CSS_EMS:
-    case CSS_EXS:
-    case CSS_CHS:
+    switch (primitiveUnitType()) {
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_CHS:
         return lengthConversion & (FixedIntegerConversion | FixedFloatConversion);
     default:
         return false;
@@ -4547,7 +4547,7 @@ template<int supported> Length CSSPrimitiveValue::convertToLength(const CSSToLen
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BufferedRendering e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case BufferedRendering::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4583,7 +4583,7 @@ template<> inline CSSPrimitiveValue::operator BufferedRendering() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorInterpolation e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ColorInterpolation::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4619,7 +4619,7 @@ template<> inline CSSPrimitiveValue::operator ColorInterpolation() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorRendering e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ColorRendering::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4655,7 +4655,7 @@ template<> inline CSSPrimitiveValue::operator ColorRendering() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(DominantBaseline e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case DominantBaseline::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4736,7 +4736,7 @@ template<> inline CSSPrimitiveValue::operator DominantBaseline() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ShapeRendering e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ShapeRendering::Auto:
         m_value.valueID = CSSValueAuto;
@@ -4777,7 +4777,7 @@ template<> inline CSSPrimitiveValue::operator ShapeRendering() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextAnchor e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TextAnchor::Start:
         m_value.valueID = CSSValueStart;
@@ -4813,21 +4813,21 @@ template<> inline CSSPrimitiveValue::operator TextAnchor() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(const Color& color)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_RGBCOLOR;
+    setPrimitiveUnitType(CSSUnitType::CSS_RGBCOLOR);
     m_value.color = new Color(color);
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSFontFamily fontFamily)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_FONT_FAMILY;
+    setPrimitiveUnitType(CSSUnitType::CSS_FONT_FAMILY);
     m_value.fontFamily = new CSSFontFamily(WTFMove(fontFamily));
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(VectorEffect e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case VectorEffect::None:
         m_value.valueID = CSSValueNone;
@@ -4858,7 +4858,7 @@ template<> inline CSSPrimitiveValue::operator VectorEffect() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(MaskType e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case MaskType::Luminance:
         m_value.valueID = CSSValueLuminance;
@@ -4891,7 +4891,7 @@ template<> inline CSSPrimitiveValue::operator MaskType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ImageOrientation e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_DEG;
+    setPrimitiveUnitType(CSSUnitType::CSS_DEG);
     switch (e) {
     case ImageOrientation::OriginTopLeft:
         m_value.num = 0;
@@ -4917,7 +4917,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ImageOrientation e)
 template<> inline CSSPrimitiveValue::operator ImageOrientation() const
 {
     ASSERT(isAngle());
-    double quarters = 4 * doubleValue(CSS_TURN);
+    double quarters = 4 * doubleValue(CSSUnitType::CSS_TURN);
     int orientation = 3 & static_cast<int>(quarters < 0 ? floor(quarters) : ceil(quarters));
     switch (orientation) {
     case 0:
@@ -4939,7 +4939,7 @@ template<> inline CSSPrimitiveValue::operator ImageOrientation() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSBoxType cssBox)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (cssBox) {
     case CSSBoxType::MarginBox:
         m_value.valueID = CSSValueMarginBox;
@@ -4997,7 +4997,7 @@ template<> inline CSSPrimitiveValue::operator CSSBoxType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ItemPosition itemPosition)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (itemPosition) {
     case ItemPosition::Legacy:
         m_value.valueID = CSSValueLegacy;
@@ -5092,7 +5092,7 @@ template<> inline CSSPrimitiveValue::operator ItemPosition() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverflowAlignment overflowAlignment)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (overflowAlignment) {
     case OverflowAlignment::Default:
         m_value.valueID = CSSValueDefault;
@@ -5123,7 +5123,7 @@ template<> inline CSSPrimitiveValue::operator OverflowAlignment() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentPosition contentPosition)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (contentPosition) {
     case ContentPosition::Normal:
         m_value.valueID = CSSValueNormal;
@@ -5193,7 +5193,7 @@ template<> inline CSSPrimitiveValue::operator ContentPosition() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentDistribution contentDistribution)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (contentDistribution) {
     case ContentDistribution::Default:
         m_value.valueID = CSSValueDefault;
@@ -5251,7 +5251,7 @@ template<> inline CSSPrimitiveValue::operator TextZoom() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextZoom textZoom)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (textZoom) {
     case TextZoom::Normal:
         m_value.valueID = CSSValueNormal;
@@ -5269,7 +5269,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextZoom textZoom)
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TouchAction touchAction)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (touchAction) {
     case TouchAction::Auto:
         m_value.valueID = CSSValueAuto;
@@ -5321,7 +5321,7 @@ template<> inline CSSPrimitiveValue::operator OptionSet<TouchAction>() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapStrictness strictness)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (strictness) {
     case ScrollSnapStrictness::None:
         m_value.valueID = CSSValueNone;
@@ -5354,7 +5354,7 @@ template<> inline CSSPrimitiveValue::operator ScrollSnapStrictness() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapAxis axis)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (axis) {
     case ScrollSnapAxis::XAxis:
         m_value.valueID = CSSValueX;
@@ -5397,7 +5397,7 @@ template<> inline CSSPrimitiveValue::operator ScrollSnapAxis() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapAxisAlignType type)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (type) {
     case ScrollSnapAxisAlignType::None:
         m_value.valueID = CSSValueNone;
@@ -5438,7 +5438,7 @@ template<> inline CSSPrimitiveValue::operator ScrollSnapAxisAlignType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TrailingWord e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case TrailingWord::Auto:
         m_value.valueID = CSSValueAuto;
@@ -5472,7 +5472,7 @@ template<> inline CSSPrimitiveValue::operator TrailingWord() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ApplePayButtonStyle e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ApplePayButtonStyle::White:
         m_value.valueID = CSSValueWhite;
@@ -5509,7 +5509,7 @@ template<> inline CSSPrimitiveValue::operator ApplePayButtonStyle() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ApplePayButtonType e)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
     case ApplePayButtonType::Plain:
         m_value.valueID = CSSValuePlain;
@@ -5572,7 +5572,7 @@ template<> inline CSSPrimitiveValue::operator ApplePayButtonType() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontVariantPosition position)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (position) {
     case FontVariantPosition::Normal:
         m_value.valueID = CSSValueNormal;
@@ -5609,7 +5609,7 @@ template<> inline CSSPrimitiveValue::operator FontVariantPosition() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontVariantCaps caps)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (caps) {
     case FontVariantCaps::Normal:
         m_value.valueID = CSSValueNormal;
@@ -5666,7 +5666,7 @@ template<> inline CSSPrimitiveValue::operator FontVariantCaps() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontVariantAlternates alternates)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (alternates) {
     case FontVariantAlternates::Normal:
         m_value.valueID = CSSValueNormal;
@@ -5698,7 +5698,7 @@ template<> inline CSSPrimitiveValue::operator FontVariantAlternates() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontOpticalSizing sizing)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (sizing) {
     case FontOpticalSizing::Enabled:
         m_value.valueID = CSSValueAuto;
@@ -5730,7 +5730,7 @@ template<> inline CSSPrimitiveValue::operator FontOpticalSizing() const
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontLoadingBehavior behavior)
     : CSSValue(PrimitiveClass)
 {
-    m_primitiveUnitType = CSS_VALUE_ID;
+    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (behavior) {
     case FontLoadingBehavior::Auto:
         m_value.valueID = CSSValueAuto;
index 2f69ef7..69a7dd7 100644 (file)
@@ -279,7 +279,7 @@ Optional<Variant<String, double>> CSSStyleDeclaration::namedItem(const AtomStrin
         // Call this version of the getter so that, e.g., pixelTop returns top as a number
         // in pixel units and posTop should does the same _if_ this is a positioned element.
         // FIXME: If not a positioned element, MSIE documentation says posTop should return 0; this rule is not implemented.
-        return Variant<String, double> { downcast<CSSPrimitiveValue>(*value).floatValue(CSSPrimitiveValue::CSS_PX) };
+        return Variant<String, double> { downcast<CSSPrimitiveValue>(*value).floatValue(CSSUnitType::CSS_PX) };
     }
 
     return Variant<String, double> { value->cssText() };
index 793db47..332039d 100644 (file)
@@ -563,19 +563,19 @@ void CSSToStyleMap::mapNinePieceImageSlice(CSSValue& value, NinePieceImage& imag
     if (slices->top()->isPercentage())
         box.top() = Length(slices->top()->doubleValue(), Percent);
     else
-        box.top() = Length(slices->top()->intValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+        box.top() = Length(slices->top()->intValue(CSSUnitType::CSS_NUMBER), Fixed);
     if (slices->bottom()->isPercentage())
         box.bottom() = Length(slices->bottom()->doubleValue(), Percent);
     else
-        box.bottom() = Length((int)slices->bottom()->floatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+        box.bottom() = Length((int)slices->bottom()->floatValue(CSSUnitType::CSS_NUMBER), Fixed);
     if (slices->left()->isPercentage())
         box.left() = Length(slices->left()->doubleValue(), Percent);
     else
-        box.left() = Length(slices->left()->intValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+        box.left() = Length(slices->left()->intValue(CSSUnitType::CSS_NUMBER), Fixed);
     if (slices->right()->isPercentage())
         box.right() = Length(slices->right()->doubleValue(), Percent);
     else
-        box.right() = Length(slices->right()->intValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+        box.right() = Length(slices->right()->intValue(CSSUnitType::CSS_NUMBER), Fixed);
     image.setImageSlices(box);
 
     // Set our fill mode.
@@ -599,28 +599,28 @@ LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue& value)
     if (slices->top()->isNumber())
         box.top() = Length(slices->top()->intValue(), Relative);
     else if (slices->top()->isPercentage())
-        box.top() = Length(slices->top()->doubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
+        box.top() = Length(slices->top()->doubleValue(CSSUnitType::CSS_PERCENTAGE), Percent);
     else if (slices->top()->valueID() != CSSValueAuto)
         box.top() = slices->top()->computeLength<Length>(conversionData);
 
     if (slices->right()->isNumber())
         box.right() = Length(slices->right()->intValue(), Relative);
     else if (slices->right()->isPercentage())
-        box.right() = Length(slices->right()->doubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
+        box.right() = Length(slices->right()->doubleValue(CSSUnitType::CSS_PERCENTAGE), Percent);
     else if (slices->right()->valueID() != CSSValueAuto)
         box.right() = slices->right()->computeLength<Length>(conversionData);
 
     if (slices->bottom()->isNumber())
         box.bottom() = Length(slices->bottom()->intValue(), Relative);
     else if (slices->bottom()->isPercentage())
-        box.bottom() = Length(slices->bottom()->doubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
+        box.bottom() = Length(slices->bottom()->doubleValue(CSSUnitType::CSS_PERCENTAGE), Percent);
     else if (slices->bottom()->valueID() != CSSValueAuto)
         box.bottom() = slices->bottom()->computeLength<Length>(conversionData);
 
     if (slices->left()->isNumber())
         box.left() = Length(slices->left()->intValue(), Relative);
     else if (slices->left()->isPercentage())
-        box.left() = Length(slices->left()->doubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
+        box.left() = Length(slices->left()->doubleValue(CSSUnitType::CSS_PERCENTAGE), Percent);
     else if (slices->left()->valueID() != CSSValueAuto)
         box.left() = slices->left()->computeLength<Length>(conversionData);
 
index f885ebd..aca7afe 100644 (file)
@@ -238,7 +238,7 @@ protected:
     // to maximize struct packing.
 
     // CSSPrimitiveValue bits:
-    unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitType
+    unsigned m_primitiveUnitType : 7; // CSSUnitType
     mutable unsigned m_hasCachedCSSText : 1;
     unsigned m_isQuirkValue : 1;
 
index 6947e05..feeb8f1 100644 (file)
@@ -55,9 +55,9 @@ CSSValuePool::CSSValuePool()
         m_identifierValues[i].construct(static_cast<CSSValueID>(i));
 
     for (unsigned i = 0; i < (maximumCacheableIntegerValue + 1); ++i) {
-        m_pixelValues[i].construct(i, CSSPrimitiveValue::CSS_PX);
-        m_percentValues[i].construct(i, CSSPrimitiveValue::CSS_PERCENTAGE);
-        m_numberValues[i].construct(i, CSSPrimitiveValue::CSS_NUMBER);
+        m_pixelValues[i].construct(i, CSSUnitType::CSS_PX);
+        m_percentValues[i].construct(i, CSSUnitType::CSS_PERCENTAGE);
+        m_numberValues[i].construct(i, CSSUnitType::CSS_NUMBER);
     }
 }
 
@@ -94,7 +94,7 @@ Ref<CSSPrimitiveValue> CSSValuePool::createColorValue(const Color& color)
     }).iterator->value;
 }
 
-Ref<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitType type)
+Ref<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSUnitType type)
 {
     ASSERT(std::isfinite(value));
 
@@ -106,11 +106,11 @@ Ref<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue
         return CSSPrimitiveValue::create(value, type);
 
     switch (type) {
-    case CSSPrimitiveValue::CSS_PX:
+    case CSSUnitType::CSS_PX:
         return m_pixelValues[intValue].get();
-    case CSSPrimitiveValue::CSS_PERCENTAGE:
+    case CSSUnitType::CSS_PERCENTAGE:
         return m_percentValues[intValue].get();
-    case CSSPrimitiveValue::CSS_NUMBER:
+    case CSSUnitType::CSS_NUMBER:
         return m_numberValues[intValue].get();
     default:
         return CSSPrimitiveValue::create(value, type);
index e80e676..5857e1f 100644 (file)
@@ -60,8 +60,8 @@ public:
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
     Ref<CSSPrimitiveValue> createColorValue(const Color&);
-    Ref<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitType);
-    Ref<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitType type) { return CSSPrimitiveValue::create(value, type); }
+    Ref<CSSPrimitiveValue> createValue(double value, CSSUnitType);
+    Ref<CSSPrimitiveValue> createValue(const String& value, CSSUnitType 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 5af0cde..04bf970 100644 (file)
@@ -39,22 +39,22 @@ namespace WebCore {
 
 unsigned short DeprecatedCSSOMPrimitiveValue::primitiveType() const
 {
-    return m_value->primitiveType();
+    return static_cast<unsigned short>(m_value->primitiveType());
 }
 
 ExceptionOr<void> DeprecatedCSSOMPrimitiveValue::setFloatValue(unsigned short unitType, double floatValue)
 {
-    return m_value->setFloatValue(unitType, floatValue);
+    return m_value->setFloatValue(static_cast<CSSUnitType>(unitType), floatValue);
 }
 
 ExceptionOr<float> DeprecatedCSSOMPrimitiveValue::getFloatValue(unsigned short unitType) const
 {
-    return m_value->getFloatValue(unitType);
+    return m_value->getFloatValue(static_cast<CSSUnitType>(unitType));
 }
 
 ExceptionOr<void> DeprecatedCSSOMPrimitiveValue::setStringValue(unsigned short stringType, const String& stringValue)
 {
-    return m_value->setStringValue(stringType, stringValue);
+    return m_value->setStringValue(static_cast<CSSUnitType>(stringType), stringValue);
 }
 
 ExceptionOr<String> DeprecatedCSSOMPrimitiveValue::getStringValue() const
index 73ffac1..c89d9f9 100644 (file)
@@ -79,8 +79,6 @@ public:
     unsigned cssValueType() const { return m_value->cssValueType(); }
     String cssText() const { return m_value->cssText(); }
     
-    // FIXME: Eventually these will contain more code and not just call through to
-    // CSSPrimitiveValue.
     WEBCORE_EXPORT unsigned short primitiveType() const;
     WEBCORE_EXPORT ExceptionOr<void> setFloatValue(unsigned short unitType, double);
     WEBCORE_EXPORT ExceptionOr<float> getFloatValue(unsigned short unitType) const;
index 0f87962..4655085 100644 (file)
@@ -46,22 +46,22 @@ private:
     {
         // Red
         unsigned value = (m_rgbColor >> 16) & 0xFF;
-        auto result = CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
+        auto result = CSSPrimitiveValue::create(value, CSSUnitType::CSS_NUMBER);
         m_red = result->createDeprecatedCSSOMPrimitiveWrapper(owner);
         
         // Green
         value = (m_rgbColor >> 8) & 0xFF;
-        result = CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
+        result = CSSPrimitiveValue::create(value, CSSUnitType::CSS_NUMBER);
         m_green = result->createDeprecatedCSSOMPrimitiveWrapper(owner);
 
         // Blue
         value = m_rgbColor & 0xFF;
-        result = CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
+        result = CSSPrimitiveValue::create(value, CSSUnitType::CSS_NUMBER);
         m_blue = result->createDeprecatedCSSOMPrimitiveWrapper(owner);
         
         // Alpha
         float alphaValue = static_cast<float>((m_rgbColor >> 24) & 0xFF) / 0xFF;
-        result = CSSPrimitiveValue::create(alphaValue, CSSPrimitiveValue::CSS_NUMBER);
+        result = CSSPrimitiveValue::create(alphaValue, CSSUnitType::CSS_NUMBER);
         m_alpha = result->createDeprecatedCSSOMPrimitiveWrapper(owner);
     }
     
index f0c2c1f..686cf0a 100644 (file)
@@ -261,7 +261,7 @@ static Optional<double> doubleValue(CSSValue* value)
 {
     if (!is<CSSPrimitiveValue>(value) || !downcast<CSSPrimitiveValue>(*value).isNumber())
         return WTF::nullopt;
-    return downcast<CSSPrimitiveValue>(*value).doubleValue(CSSPrimitiveValue::CSS_NUMBER);
+    return downcast<CSSPrimitiveValue>(*value).doubleValue(CSSUnitType::CSS_NUMBER);
 }
 
 static bool zeroEvaluate(CSSValue* value, MediaFeaturePrefix op)
@@ -427,7 +427,7 @@ static bool evaluateResolution(CSSValue* value, Frame& frame, MediaFeaturePrefix
         return false;
 
     auto& resolution = downcast<CSSPrimitiveValue>(*value);
-    float resolutionValue = resolution.isNumber() ? resolution.floatValue() : resolution.floatValue(CSSPrimitiveValue::CSS_DPPX);
+    float resolutionValue = resolution.isNumber() ? resolution.floatValue() : resolution.floatValue(CSSUnitType::CSS_DPPX);
     bool result = compareValue(deviceScaleFactor, resolutionValue, op);
     LOG_WITH_STREAM(MediaQueries, stream << "  evaluateResolution: " << op << " " << resolutionValue << " device scale factor " << deviceScaleFactor << ": " << result);
     return result;
index 76ffac9..eef367a 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
 
 static inline bool featureWithValidIdent(const AtomString& mediaFeature, const CSSPrimitiveValue& value, const MediaQueryParserContext& context)
 {
-    if (value.primitiveType() != CSSPrimitiveValue::UnitType::CSS_IDENT)
+    if (value.primitiveType() != CSSUnitType::CSS_IDENT)
         return false;
 
     return mediaFeature == MediaFeatureNames::orientation
index 2718e45..8340cb6 100644 (file)
@@ -35,13 +35,13 @@ static RefPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(GlyphOrient
 {
     switch (orientation) {
     case GlyphOrientation::Degrees0:
-        return CSSPrimitiveValue::create(0.0f, CSSPrimitiveValue::CSS_DEG);
+        return CSSPrimitiveValue::create(0.0f, CSSUnitType::CSS_DEG);
     case GlyphOrientation::Degrees90:
-        return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::CSS_DEG);
+        return CSSPrimitiveValue::create(90.0f, CSSUnitType::CSS_DEG);
     case GlyphOrientation::Degrees180:
-        return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::CSS_DEG);
+        return CSSPrimitiveValue::create(180.0f, CSSUnitType::CSS_DEG);
     case GlyphOrientation::Degrees270:
-        return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG);
+        return CSSPrimitiveValue::create(270.0f, CSSUnitType::CSS_DEG);
     case GlyphOrientation::Auto:
         return nullptr;
     }
@@ -65,7 +65,7 @@ Ref<CSSValue> ComputedStyleExtractor::adjustSVGPaintForCurrentColor(SVGPaintType
 {
     if (paintType >= SVGPaintType::URINone) {
         auto values = CSSValueList::createSpaceSeparated();
-        values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::UnitType::CSS_URI));
+        values->append(CSSPrimitiveValue::create(url, CSSUnitType::CSS_URI));
         if (paintType == SVGPaintType::URINone)
             values->append(CSSPrimitiveValue::createIdentifier(CSSValueNone));
         else if (paintType == SVGPaintType::URICurrentColor)
@@ -97,15 +97,15 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
     case CSSPropertyClipRule:
         return CSSPrimitiveValue::create(svgStyle.clipRule());
     case CSSPropertyFloodOpacity:
-        return CSSPrimitiveValue::create(svgStyle.floodOpacity(), CSSPrimitiveValue::CSS_NUMBER);
+        return CSSPrimitiveValue::create(svgStyle.floodOpacity(), CSSUnitType::CSS_NUMBER);
     case CSSPropertyStopOpacity:
-        return CSSPrimitiveValue::create(svgStyle.stopOpacity(), CSSPrimitiveValue::CSS_NUMBER);
+        return CSSPrimitiveValue::create(svgStyle.stopOpacity(), CSSUnitType::CSS_NUMBER);
     case CSSPropertyColorInterpolation:
         return CSSPrimitiveValue::create(svgStyle.colorInterpolation());
     case CSSPropertyColorInterpolationFilters:
         return CSSPrimitiveValue::create(svgStyle.colorInterpolationFilters());
     case CSSPropertyFillOpacity:
-        return CSSPrimitiveValue::create(svgStyle.fillOpacity(), CSSPrimitiveValue::CSS_NUMBER);
+        return CSSPrimitiveValue::create(svgStyle.fillOpacity(), CSSUnitType::CSS_NUMBER);
     case CSSPropertyFillRule:
         return CSSPrimitiveValue::create(svgStyle.fillRule());
     case CSSPropertyColorRendering:
@@ -113,7 +113,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
     case CSSPropertyShapeRendering:
         return CSSPrimitiveValue::create(svgStyle.shapeRendering());
     case CSSPropertyStrokeOpacity:
-        return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), CSSPrimitiveValue::CSS_NUMBER);
+        return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), CSSUnitType::CSS_NUMBER);
     case CSSPropertyAlignmentBaseline:
         return CSSPrimitiveValue::create(svgStyle.alignmentBaseline());
     case CSSPropertyDominantBaseline:
@@ -122,7 +122,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
         return CSSPrimitiveValue::create(svgStyle.textAnchor());
     case CSSPropertyMask:
         if (!svgStyle.maskerResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.maskerResource(), CSSPrimitiveValue::CSS_URI);
+            return CSSPrimitiveValue::create(svgStyle.maskerResource(), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyFloodColor:
         return currentColorOrValidColor(style, svgStyle.floodColor());
@@ -136,15 +136,15 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
         return SVGLengthValue::toCSSPrimitiveValue(svgStyle.kerning());
     case CSSPropertyMarkerEnd:
         if (!svgStyle.markerEndResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.markerEndResource(), CSSPrimitiveValue::CSS_URI);
+            return CSSPrimitiveValue::create(svgStyle.markerEndResource(), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyMarkerMid:
         if (!svgStyle.markerMidResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.markerMidResource(), CSSPrimitiveValue::CSS_URI);
+            return CSSPrimitiveValue::create(svgStyle.markerMidResource(), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyMarkerStart:
         if (!svgStyle.markerStartResource().isEmpty())
-            return CSSPrimitiveValue::create(svgStyle.markerStartResource(), CSSPrimitiveValue::CSS_URI);
+            return CSSPrimitiveValue::create(svgStyle.markerStartResource(), CSSUnitType::CSS_URI);
         return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     case CSSPropertyStroke:
         return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyle.strokePaintUri(), svgStyle.strokePaintColor(), style->color());
index 3578c9a..3cacd11 100644 (file)
@@ -1283,7 +1283,7 @@ String StyleProperties::asText() const
     // FIXME: This is a not-so-nice way to turn x/y positions into single background-position in output.
     // It is required because background-position-x/y are non-standard properties and WebKit generated output
     // would not work in Firefox (<rdar://problem/5143183>)
-    // It would be a better solution if background-position was CSS_PAIR.
+    // It would be a better solution if background-position was CSSUnitType::CSS_PAIR.
     if (positionXPropertyIndex != -1 && positionYPropertyIndex != -1 && propertyAt(positionXPropertyIndex).isImportant() == propertyAt(positionYPropertyIndex).isImportant()) {
         PropertyReference positionXProperty = propertyAt(positionXPropertyIndex);
         PropertyReference positionYProperty = propertyAt(positionYPropertyIndex);
index 0f3b438..c3ad8ba 100644 (file)
@@ -98,14 +98,14 @@ static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acce
 }
 
 template <typename CharacterType>
-static inline bool parseSimpleLength(const CharacterType* characters, unsigned length, CSSPrimitiveValue::UnitType& unit, double& number)
+static inline bool parseSimpleLength(const CharacterType* characters, unsigned length, CSSUnitType& unit, double& number)
 {
     if (length > 2 && (characters[length - 2] | 0x20) == 'p' && (characters[length - 1] | 0x20) == 'x') {
         length -= 2;
-        unit = CSSPrimitiveValue::UnitType::CSS_PX;
+        unit = CSSUnitType::CSS_PX;
     } else if (length > 1 && characters[length - 1] == '%') {
         length -= 1;
-        unit = CSSPrimitiveValue::UnitType::CSS_PERCENTAGE;
+        unit = CSSUnitType::CSS_PERCENTAGE;
     }
 
     // We rely on charactersToDouble for validation as well. The function
@@ -119,7 +119,7 @@ static inline bool parseSimpleLength(const CharacterType* characters, unsigned l
 }
 
 template <typename CharacterType>
-static inline bool parseSimpleAngle(const CharacterType* characters, unsigned length, CSSPrimitiveValue::UnitType& unit, double& number)
+static inline bool parseSimpleAngle(const CharacterType* characters, unsigned length, CSSUnitType& unit, double& number)
 {
     // Just support deg and rad for now.
     if (length < 4)
@@ -127,10 +127,10 @@ static inline bool parseSimpleAngle(const CharacterType* characters, unsigned le
 
     if ((characters[length - 3] | 0x20) == 'd' && (characters[length - 2] | 0x20) == 'e' && (characters[length - 1] | 0x20) == 'g') {
         length -= 3;
-        unit = CSSPrimitiveValue::UnitType::CSS_DEG;
+        unit = CSSUnitType::CSS_DEG;
     } else if ((characters[length - 3] | 0x20) == 'r' && (characters[length - 2] | 0x20) == 'a' && (characters[length - 1] | 0x20) == 'd') {
         length -= 3;
-        unit = CSSPrimitiveValue::UnitType::CSS_RAD;
+        unit = CSSUnitType::CSS_RAD;
     } else
         return false;
 
@@ -155,7 +155,7 @@ static RefPtr<CSSValue> parseSimpleLengthValue(CSSPropertyID propertyId, const S
 
     unsigned length = string.length();
     double number;
-    CSSPrimitiveValue::UnitType unit = CSSPrimitiveValue::UnitType::CSS_NUMBER;
+    CSSUnitType unit = CSSUnitType::CSS_NUMBER;
 
     if (string.is8Bit()) {
         if (!parseSimpleLength(string.characters8(), length, unit, number))
@@ -165,10 +165,10 @@ static RefPtr<CSSValue> parseSimpleLengthValue(CSSPropertyID propertyId, const S
             return nullptr;
     }
 
-    if (unit == CSSPrimitiveValue::UnitType::CSS_NUMBER) {
+    if (unit == CSSUnitType::CSS_NUMBER) {
         if (number && cssParserMode != SVGAttributeMode)
             return nullptr;
-        unit = CSSPrimitiveValue::UnitType::CSS_PX;
+        unit = CSSUnitType::CSS_PX;
     }
 
     if (number < 0 && !acceptsNegativeNumbers)
@@ -280,7 +280,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::UnitType& expect, int& value)
+static bool parseColorIntOrPercentage(const CharacterType*& string, const CharacterType* end, const char terminator, CSSUnitType& expect, int& value)
 {
     const CharacterType* current = string;
     double localValue = 0;
@@ -308,7 +308,7 @@ static bool parseColorIntOrPercentage(const CharacterType*& string, const Charac
     if (current == end)
         return false;
 
-    if (expect == CSSPrimitiveValue::UnitType::CSS_NUMBER && (*current == '.' || *current == '%'))
+    if (expect == CSSUnitType::CSS_NUMBER && (*current == '.' || *current == '%'))
         return false;
 
     if (*current == '.') {
@@ -324,18 +324,18 @@ static bool parseColorIntOrPercentage(const CharacterType*& string, const Charac
         localValue += percentage;
     }
 
-    if (expect == CSSPrimitiveValue::UnitType::CSS_PERCENTAGE && *current != '%')
+    if (expect == CSSUnitType::CSS_PERCENTAGE && *current != '%')
         return false;
 
     if (*current == '%') {
-        expect = CSSPrimitiveValue::UnitType::CSS_PERCENTAGE;
+        expect = CSSUnitType::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::UnitType::CSS_NUMBER;
+        expect = CSSUnitType::CSS_NUMBER;
     }
 
     while (current != end && isHTMLSpace<CharacterType>(*current))
@@ -440,7 +440,7 @@ static inline bool mightBeRGB(const CharacterType* characters, unsigned length)
 template <typename CharacterType>
 static Color fastParseColorInternal(const CharacterType* characters, unsigned length, bool quirksMode)
 {
-    CSSPrimitiveValue::UnitType expect = CSSPrimitiveValue::UnitType::CSS_UNKNOWN;
+    CSSUnitType expect = CSSUnitType::CSS_UNKNOWN;
 
     if (length >= 4 && characters[0] == '#') {
         RGBA32 rgb;
@@ -1037,13 +1037,13 @@ static bool parseTransformTranslateArguments(CharType*& pos, CharType* end, unsi
         if (delimiter == notFound)
             return false;
         unsigned argumentLength = static_cast<unsigned>(delimiter);
-        CSSPrimitiveValue::UnitType unit = CSSPrimitiveValue::UnitType::CSS_NUMBER;
+        CSSUnitType unit = CSSUnitType::CSS_NUMBER;
         double number;
         if (!parseSimpleLength(pos, argumentLength, unit, number))
             return false;
-        if (!number && unit == CSSPrimitiveValue::CSS_NUMBER)
-            unit = CSSPrimitiveValue::UnitType::CSS_PX;
-        if (unit == CSSPrimitiveValue::UnitType::CSS_NUMBER || (unit == CSSPrimitiveValue::UnitType::CSS_PERCENTAGE && (transformValue->name() == CSSValueTranslateZ || (transformValue->name() == CSSValueTranslate3d && expectedCount == 1))))
+        if (!number && unit == CSSUnitType::CSS_NUMBER)
+            unit = CSSUnitType::CSS_PX;
+        if (unit == CSSUnitType::CSS_NUMBER || (unit == CSSUnitType::CSS_PERCENTAGE && (transformValue->name() == CSSValueTranslateZ || (transformValue->name() == CSSValueTranslate3d && expectedCount == 1))))
             return false;
         transformValue->append(CSSPrimitiveValue::create(number, unit));
         pos += argumentLength + 1;
@@ -1060,12 +1060,12 @@ static bool parseTransformAngleArgument(CharType*& pos, CharType* end, CSSFuncti
         return false;
 
     unsigned argumentLength = static_cast<unsigned>(delimiter);
-    CSSPrimitiveValue::UnitType unit = CSSPrimitiveValue::UnitType::CSS_NUMBER;
+    CSSUnitType unit = CSSUnitType::CSS_NUMBER;
     double number;
     if (!parseSimpleAngle(pos, argumentLength, unit, number))
         return false;
-    if (!number && unit == CSSPrimitiveValue::CSS_NUMBER)
-        unit = CSSPrimitiveValue::UnitType::CSS_DEG;
+    if (!number && unit == CSSUnitType::CSS_NUMBER)
+        unit = CSSUnitType::CSS_DEG;
 
     transformValue->append(CSSPrimitiveValue::create(number, unit));
     pos += argumentLength + 1;
@@ -1085,7 +1085,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::UnitType::CSS_NUMBER));
+        transformValue->append(CSSPrimitiveValue::create(number, CSSUnitType::CSS_NUMBER));
         pos += argumentLength + 1;
         --expectedCount;
     }
index 6cec213..a8632fa 100644 (file)
@@ -40,7 +40,7 @@
 namespace WebCore {
 
 template<typename CharacterType>
-CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* data, unsigned length)
+CSSUnitType cssPrimitiveValueUnitFromTrie(const CharacterType* data, unsigned length)
 {
     ASSERT(data);
     ASSERT(length);
@@ -48,9 +48,9 @@ CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d
     case 1:
         switch (toASCIILower(data[0])) {
         case 'q':
-            return CSSPrimitiveValue::UnitType::CSS_Q;
+            return CSSUnitType::CSS_Q;
         case 's':
-            return CSSPrimitiveValue::UnitType::CSS_S;
+            return CSSUnitType::CSS_S;
         }
         break;
     case 2:
@@ -58,55 +58,55 @@ CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d
         case 'c':
             switch (toASCIILower(data[1])) {
             case 'h':
-                return CSSPrimitiveValue::UnitType::CSS_CHS;
+                return CSSUnitType::CSS_CHS;
             case 'm':
-                return CSSPrimitiveValue::UnitType::CSS_CM;
+                return CSSUnitType::CSS_CM;
             }
             break;
         case 'e':
             switch (toASCIILower(data[1])) {
             case 'm':
-                return CSSPrimitiveValue::UnitType::CSS_EMS;
+                return CSSUnitType::CSS_EMS;
             case 'x':
-                return CSSPrimitiveValue::UnitType::CSS_EXS;
+                return CSSUnitType::CSS_EXS;
             }
             break;
         case 'f':
             if (toASCIILower(data[1]) == 'r')
-                return CSSPrimitiveValue::UnitType::CSS_FR;
+                return CSSUnitType::CSS_FR;
             break;
         case 'h':
             if (toASCIILower(data[1]) == 'z')
-                return CSSPrimitiveValue::UnitType::CSS_HZ;
+                return CSSUnitType::CSS_HZ;
             break;
         case 'i':
             if (toASCIILower(data[1]) == 'n')
-                return CSSPrimitiveValue::UnitType::CSS_IN;
+                return CSSUnitType::CSS_IN;
             break;
         case 'm':
             switch (toASCIILower(data[1])) {
             case 'm':
-                return CSSPrimitiveValue::UnitType::CSS_MM;
+                return CSSUnitType::CSS_MM;
             case 's':
-                return CSSPrimitiveValue::UnitType::CSS_MS;
+                return CSSUnitType::CSS_MS;
             }
             break;
         case 'p':
             switch (toASCIILower(data[1])) {
             case 'c':
-                return CSSPrimitiveValue::UnitType::CSS_PC;
+                return CSSUnitType::CSS_PC;
             case 't':
-                return CSSPrimitiveValue::UnitType::CSS_PT;
+                return CSSUnitType::CSS_PT;
             case 'x':
-                return CSSPrimitiveValue::UnitType::CSS_PX;
+                return CSSUnitType::CSS_PX;
             }
             break;
         case 'v':
             switch (toASCIILower(data[1])) {
             case 'h':
-                return CSSPrimitiveValue::UnitType::CSS_VH;
+                return CSSUnitType::CSS_VH;
             case 'w':
-                return CSSPrimitiveValue::UnitType::CSS_VW;
+                return CSSUnitType::CSS_VW;
             }
             break;
         }
@@ -117,27 +117,27 @@ CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d
             switch (toASCIILower(data[1])) {
             case 'e':
                 if (toASCIILower(data[2]) == 'g')
-                    return CSSPrimitiveValue::UnitType::CSS_DEG;
+                    return CSSUnitType::CSS_DEG;
                 break;
             case 'p':
                 if (toASCIILower(data[2]) == 'i')
-                    return CSSPrimitiveValue::UnitType::CSS_DPI;
+                    return CSSUnitType::CSS_DPI;
                 break;
             }
         break;
         case 'k':
             if (toASCIILower(data[1]) == 'h' && toASCIILower(data[2]) == 'z')
-                return CSSPrimitiveValue::UnitType::CSS_KHZ;
+                return CSSUnitType::CSS_KHZ;
             break;
         case 'r':
             switch (toASCIILower(data[1])) {
             case 'a':
                 if (toASCIILower(data[2]) == 'd')
-                    return CSSPrimitiveValue::UnitType::CSS_RAD;
+                    return CSSUnitType::CSS_RAD;
                 break;
             case 'e':
                 if (toASCIILower(data[2]) == 'm')
-                    return CSSPrimitiveValue::UnitType::CSS_REMS;
+                    return CSSUnitType::CSS_REMS;
                 break;
             }
         break;
@@ -151,11 +151,11 @@ CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d
                 switch (toASCIILower(data[2])) {
                 case 'c':
                     if (toASCIILower(data[3]) == 'm')
-                        return CSSPrimitiveValue::UnitType::CSS_DPCM;
+                        return CSSUnitType::CSS_DPCM;
                     break;
                 case 'p':
                     if (toASCIILower(data[3]) == 'x')
-                        return CSSPrimitiveValue::UnitType::CSS_DPPX;
+                        return CSSUnitType::CSS_DPPX;
                     break;
                 }
             break;
@@ -163,11 +163,11 @@ CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d
         break;
         case 'g':
             if (toASCIILower(data[1]) == 'r' && toASCIILower(data[2]) == 'a' && toASCIILower(data[3]) == 'd')
-                return CSSPrimitiveValue::UnitType::CSS_GRAD;
+                return CSSUnitType::CSS_GRAD;
             break;
         case 't':
             if (toASCIILower(data[1]) == 'u' && toASCIILower(data[2]) == 'r' && toASCIILower(data[3]) == 'n')
-                return CSSPrimitiveValue::UnitType::CSS_TURN;
+                return CSSUnitType::CSS_TURN;
             break;
         case 'v':
             switch (toASCIILower(data[1])) {
@@ -175,11 +175,11 @@ CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d
                 switch (toASCIILower(data[2])) {
                 case 'a':
                     if (toASCIILower(data[3]) == 'x')
-                        return CSSPrimitiveValue::UnitType::CSS_VMAX;
+                        return CSSUnitType::CSS_VMAX;
                     break;
                 case 'i':
                     if (toASCIILower(data[3]) == 'n')
-                        return CSSPrimitiveValue::UnitType::CSS_VMIN;
+                        return CSSUnitType::CSS_VMIN;
                     break;
                 }
                 break;
@@ -191,15 +191,15 @@ CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d
         switch (toASCIILower(data[0])) {
         case '_':
             if (toASCIILower(data[1]) == '_' && toASCIILower(data[2]) == 'q' && toASCIILower(data[3]) == 'e' && toASCIILower(data[4]) == 'm')
-                return CSSPrimitiveValue::UnitType::CSS_QUIRKY_EMS;
+                return CSSUnitType::CSS_QUIRKY_EMS;
             break;
         }
         break;
     }
-    return CSSPrimitiveValue::UnitType::CSS_UNKNOWN;
+    return CSSUnitType::CSS_UNKNOWN;
 }
 
-static CSSPrimitiveValue::UnitType stringToUnitType(StringView stringView)
+static CSSUnitType stringToUnitType(StringView stringView)
 {
     if (stringView.is8Bit())
         return cssPrimitiveValueUnitFromTrie(stringView.characters8(), stringView.length());
@@ -234,7 +234,7 @@ CSSParserToken::CSSParserToken(CSSParserTokenType type, double numericValue, Num
     , m_blockType(NotBlock)
     , m_numericValueType(numericValueType)
     , m_numericSign(sign)
-    , m_unit(static_cast<unsigned>(CSSPrimitiveValue::UnitType::CSS_NUMBER))
+    , m_unit(static_cast<unsigned>(CSSUnitType::CSS_NUMBER))
 {
     ASSERT(type == NumberToken);
     m_numericValue = numericValue;
@@ -269,7 +269,7 @@ void CSSParserToken::convertToPercentage()
 {
     ASSERT(m_type == NumberToken);
     m_type = PercentageToken;
-    m_unit = static_cast<unsigned>(CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
+    m_unit = static_cast<unsigned>(CSSUnitType::CSS_PERCENTAGE);
 }
 
 UChar CSSParserToken::delimiter() const
index 7870c00..723b098 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::UnitType unitType() const { return static_cast<CSSPrimitiveValue::UnitType>(m_unit); }
+    CSSUnitType unitType() const { return static_cast<CSSUnitType>(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::UnitType
+    unsigned m_unit : 7; // CSSUnitType
 
     bool valueDataCharRawEqual(const CSSParserToken& other) const;
 
index 4ba0c1c..dbfcb18 100644 (file)
@@ -389,7 +389,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::UnitType::CSS_PX), important, !hasZ);
+        addProperty(CSSPropertyTransformOriginZ, CSSPropertyTransformOrigin, resultZ ? resultZ.releaseNonNull() : CSSValuePool::singleton().createValue(0, CSSUnitType::CSS_PX), important, !hasZ);
         
         return true;
     }
@@ -970,7 +970,7 @@ static RefPtr<CSSFontStyleValue> consumeFontStyle(CSSParserTokenRange& range, CS
 #if ENABLE(VARIATION_FONTS)
     if (!range.atEnd()) {
         if (auto angle = consumeAngle(range, cssParserMode)) {
-            if (fontStyleIsWithinRange(angle->value<float>(CSSPrimitiveValue::CSS_DEG)))
+            if (fontStyleIsWithinRange(angle->value<float>(CSSUnitType::CSS_DEG)))
                 return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), WTFMove(angle));
             return nullptr;
         }
@@ -992,7 +992,7 @@ static RefPtr<CSSFontStyleRangeValue> consumeFontStyleRange(CSSParserTokenRange&
         return CSSFontStyleRangeValue::create(keyword.releaseNonNull());
 
     if (auto firstAngle = consumeAngle(range, cssParserMode)) {
-        if (!fontStyleIsWithinRange(firstAngle->value<float>(CSSPrimitiveValue::CSS_DEG)))
+        if (!fontStyleIsWithinRange(firstAngle->value<float>(CSSUnitType::CSS_DEG)))
             return nullptr;
         if (range.atEnd()) {
             auto result = CSSValueList::createSpaceSeparated();
@@ -1000,7 +1000,7 @@ static RefPtr<CSSFontStyleRangeValue> consumeFontStyleRange(CSSParserTokenRange&
             return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
         }
         auto secondAngle = consumeAngle(range, cssParserMode);
-        if (!secondAngle || !fontStyleIsWithinRange(secondAngle->value<float>(CSSPrimitiveValue::CSS_DEG)) || firstAngle->floatValue(CSSPrimitiveValue::CSS_DEG) > secondAngle->floatValue(CSSPrimitiveValue::CSS_DEG))
+        if (!secondAngle || !fontStyleIsWithinRange(secondAngle->value<float>(CSSUnitType::CSS_DEG)) || firstAngle->floatValue(CSSUnitType::CSS_DEG) > secondAngle->floatValue(CSSUnitType::CSS_DEG))
             return nullptr;
         auto result = CSSValueList::createSpaceSeparated();
         result->append(firstAngle.releaseNonNull());
@@ -1175,7 +1175,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::UnitType::CSS_NUMBER), Pair::IdenticalValueEncoding::Coalesce));
+        list->append(createPrimitiveValuePair(counterName.releaseNonNull(), CSSPrimitiveValue::create(i, CSSUnitType::CSS_NUMBER), Pair::IdenticalValueEncoding::Coalesce));
     } while (!range.atEnd());
     return list;
 }
@@ -1435,7 +1435,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::UnitType::CSS_STRING);
+        return CSSValuePool::singleton().createValue(token.value().toString(), CSSUnitType::CSS_STRING);
     }
 
     return consumeCustomIdent(range);
@@ -1863,7 +1863,7 @@ static bool consumePerspective(CSSParserTokenRange& args, CSSParserMode cssParse
         double perspective;
         if (!consumeNumberRaw(args, perspective) || perspective < 0)
             return false;
-        parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::UnitType::CSS_PX);
+        parsedValue = CSSPrimitiveValue::create(perspective, CSSUnitType::CSS_PX);
     }
     if (!parsedValue)
         return false;
@@ -1995,7 +1995,7 @@ static RefPtr<CSSPrimitiveValue> consumePositionLonghand(CSSParserTokenRange& ra
         else
             return nullptr;
         range.consumeIncludingWhitespace();
-        return CSSPrimitiveValue::create(percent, CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
+        return CSSPrimitiveValue::create(percent, CSSUnitType::CSS_PERCENTAGE);
     }
     return consumeLengthOrPercent(range, cssParserMode, ValueRangeAll);
 }
@@ -2205,7 +2205,7 @@ static RefPtr<CSSValue> consumeAttr(CSSParserTokenRange args, CSSParserContext c
     // FIXME-NEWPARSER: We want to use a CSSCustomIdentValue here eventually for the attrName.
     // FIXME-NEWPARSER: We want to use a CSSFunctionValue rather than relying on a custom
     // attr() primitive value.
-    return CSSValuePool::singleton().createValue(attrName, CSSPrimitiveValue::CSS_ATTR);
+    return CSSValuePool::singleton().createValue(attrName, CSSUnitType::CSS_ATTR);
 }
 
 static RefPtr<CSSValue> consumeCounterContent(CSSParserTokenRange args, bool counters)
@@ -2216,11 +2216,11 @@ static RefPtr<CSSValue> consumeCounterContent(CSSParserTokenRange args, bool cou
 
     RefPtr<CSSPrimitiveValue> separator;
     if (!counters)
-        separator = CSSPrimitiveValue::create(String(), CSSPrimitiveValue::UnitType::CSS_STRING);
+        separator = CSSPrimitiveValue::create(String(), CSSUnitType::CSS_STRING);
     else {
         if (!consumeCommaIncludingWhitespace(args) || args.peek().type() != StringToken)
             return nullptr;
-        separator = CSSPrimitiveValue::create(args.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitType::CSS_STRING);
+        separator = CSSPrimitiveValue::create(args.consumeIncludingWhitespace().value().toString(), CSSUnitType::CSS_STRING);
     }
 
     RefPtr<CSSPrimitiveValue> listStyle;
@@ -2278,7 +2278,7 @@ static RefPtr<CSSPrimitiveValue> consumePerspective(CSSParserTokenRange& range,
         double perspective;
         if (!consumeNumberRaw(range, perspective))
             return nullptr;
-        parsedValue = CSSPrimitiveValue::create(perspective, CSSPrimitiveValue::UnitType::CSS_PX);
+        parsedValue = CSSPrimitiveValue::create(perspective, CSSUnitType::CSS_PX);
     }
     if (parsedValue && (parsedValue->isCalculated() || parsedValue->doubleValue() > 0))
         return parsedValue;
@@ -2879,7 +2879,7 @@ static RefPtr<CSSValue> consumeReflect(CSSParserTokenRange& range, const CSSPars
 
     RefPtr<CSSPrimitiveValue> offset;
     if (range.atEnd())
-        offset = CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::UnitType::CSS_PX);
+        offset = CSSValuePool::singleton().createValue(0, CSSUnitType::CSS_PX);
     else {
         offset = consumeLengthOrPercent(range, context.mode, ValueRangeAll, UnitlessQuirk::Forbid);
         if (!offset)
@@ -3305,10 +3305,10 @@ static RefPtr<CSSPrimitiveValue> consumeGridBreadth(CSSParserTokenRange& range,
     const CSSParserToken& token = range.peek();
     if (identMatches<CSSValueMinContent, CSSValueWebkitMinContent, CSSValueMaxContent, CSSValueWebkitMaxContent, CSSValueAuto>(token.id()))
         return consumeIdent(range);
-    if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue::UnitType::CSS_FR) {
+    if (token.type() == DimensionToken && token.unitType() == CSSUnitType::CSS_FR) {
         if (range.peek().numericValue() < 0)
             return nullptr;
-        return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitType::CSS_FR);
+        return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().numericValue(), CSSUnitType::CSS_FR);
     }
     return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
 }
@@ -4483,7 +4483,7 @@ bool CSSPropertyParser::consumeSystemFont(bool important)
     
     addProperty(CSSPropertyFontStyle, CSSPropertyFont, CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(isItalic(fontDescription.italic()) ? CSSValueItalic : CSSValueNormal)), important);
     addProperty(CSSPropertyFontWeight, CSSPropertyFont, CSSValuePool::singleton().createValue(static_cast<float>(fontDescription.weight())), important);
-    addProperty(CSSPropertyFontSize, CSSPropertyFont, CSSValuePool::singleton().createValue(fontDescription.specifiedSize(), CSSPrimitiveValue::CSS_PX), important);
+    addProperty(CSSPropertyFontSize, CSSPropertyFont, CSSValuePool::singleton().createValue(fontDescription.specifiedSize(), CSSUnitType::CSS_PX), important);
     Ref<CSSValueList> fontFamilyList = CSSValueList::createCommaSeparated();
     fontFamilyList->append(CSSValuePool::singleton().createFontFamilyValue(fontDescription.familyAt(0), FromSystemFontID::Yes));
     addProperty(CSSPropertyFontFamily, CSSPropertyFont, WTFMove(fontFamilyList), important);
@@ -4852,7 +4852,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::UnitType::CSS_PX);
+                    flexBasis = CSSPrimitiveValue::create(0, CSSUnitType::CSS_PX);
                 else
                     return false;
             } else if (!flexBasis) {
@@ -4876,13 +4876,13 @@ bool CSSPropertyParser::consumeFlex(bool important)
         // if turned back on for nested columns, etc.). We have layout test coverage of both
         // scenarios.
         if (!flexBasis)
-            flexBasis = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
+            flexBasis = CSSPrimitiveValue::create(0, CSSUnitType::CSS_PERCENTAGE);
     }
 
     if (!m_range.atEnd())
         return false;
-    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(CSSPropertyFlexGrow, CSSPropertyFlex, CSSPrimitiveValue::create(clampTo<float>(flexGrow), CSSUnitType::CSS_NUMBER), important);
+    addProperty(CSSPropertyFlexShrink, CSSPropertyFlex, CSSPrimitiveValue::create(clampTo<float>(flexShrink), CSSUnitType::CSS_NUMBER), important);
     addProperty(CSSPropertyFlexBasis, CSSPropertyFlex, flexBasis.releaseNonNull(), important);
     return true;
 }
index 886f2dd..0fd44db 100644 (file)
@@ -108,7 +108,7 @@ public:
 
         double value = std::max(m_calcValue->doubleValue(), minimumValue);
         value = std::round(value);
-        return CSSValuePool::singleton().createValue(value, CSSPrimitiveValue::UnitType::CSS_NUMBER);
+        return CSSValuePool::singleton().createValue(value, CSSUnitType::CSS_NUMBER);
     }
 
     RefPtr<CSSPrimitiveValue> consumeNumber()
@@ -116,7 +116,7 @@ public:
         if (!m_calcValue)
             return nullptr;
         m_sourceRange = m_range;
-        return CSSValuePool::singleton().createValue(m_calcValue->doubleValue(), CSSPrimitiveValue::UnitType::CSS_NUMBER);
+        return CSSValuePool::singleton().createValue(m_calcValue->doubleValue(), CSSUnitType::CSS_NUMBER);
     }
 
     bool consumeNumberRaw(double& result)
@@ -151,7 +151,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::UnitType::CSS_NUMBER);
+        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSUnitType::CSS_NUMBER);
     }
 
     if (token.type() != FunctionToken)
@@ -259,7 +259,7 @@ RefPtr<CSSPrimitiveValue> consumeFontWeightNumber(CSSParserTokenRange& range)
 #endif
     ) {
         result = std::min(std::max(result, std::nextafter(0., 1.)), std::nextafter(1000., 0.));
-        return CSSValuePool::singleton().createValue(result, CSSPrimitiveValue::UnitType::CSS_NUMBER);
+        return CSSValuePool::singleton().createValue(result, CSSUnitType::CSS_NUMBER);
     }
 
     return nullptr;
@@ -278,25 +278,25 @@ RefPtr<CSSPrimitiveValue> consumeLength(CSSParserTokenRange& range, CSSParserMod
     const CSSParserToken& token = range.peek();
     if (token.type() == DimensionToken) {
         switch (token.unitType()) {
-        case CSSPrimitiveValue::UnitType::CSS_QUIRKY_EMS:
+        case CSSUnitType::CSS_QUIRKY_EMS:
             if (cssParserMode != UASheetMode)
                 return nullptr;
             FALLTHROUGH;
-        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:
-        case CSSPrimitiveValue::UnitType::CSS_Q:
+        case CSSUnitType::CSS_EMS:
+        case CSSUnitType::CSS_REMS:
+        case CSSUnitType::CSS_CHS:
+        case CSSUnitType::CSS_EXS:
+        case CSSUnitType::CSS_PX:
+        case CSSUnitType::CSS_CM:
+        case CSSUnitType::CSS_MM:
+        case CSSUnitType::CSS_IN:
+        case CSSUnitType::CSS_PT:
+        case CSSUnitType::CSS_PC:
+        case CSSUnitType::CSS_VW:
+        case CSSUnitType::CSS_VH:
+        case CSSUnitType::CSS_VMIN:
+        case CSSUnitType::CSS_VMAX:
+        case CSSUnitType::CSS_Q:
             break;
         default:
             return nullptr;
@@ -311,7 +311,7 @@ RefPtr<CSSPrimitiveValue> consumeLength(CSSParserTokenRange& range, CSSParserMod
             return nullptr;
         if (std::isinf(token.numericValue()))
             return nullptr;
-        CSSPrimitiveValue::UnitType unitType = CSSPrimitiveValue::UnitType::CSS_PX;
+        CSSUnitType unitType = CSSUnitType::CSS_PX;
         return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), unitType);
     }
 
@@ -331,7 +331,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::UnitType::CSS_PERCENTAGE);
+        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSUnitType::CSS_PERCENTAGE);
     }
 
     if (token.type() != FunctionToken)
@@ -383,10 +383,10 @@ RefPtr<CSSPrimitiveValue> consumeAngle(CSSParserTokenRange& range, CSSParserMode
     const CSSParserToken& token = range.peek();
     if (token.type() == DimensionToken) {
         switch (token.unitType()) {
-        case CSSPrimitiveValue::UnitType::CSS_DEG:
-        case CSSPrimitiveValue::UnitType::CSS_RAD:
-        case CSSPrimitiveValue::UnitType::CSS_GRAD:
-        case CSSPrimitiveValue::UnitType::CSS_TURN:
+        case CSSUnitType::CSS_DEG:
+        case CSSUnitType::CSS_RAD:
+        case CSSUnitType::CSS_GRAD:
+        case CSSUnitType::CSS_TURN:
             return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), token.unitType());
         default:
             return nullptr;
@@ -394,7 +394,7 @@ RefPtr<CSSPrimitiveValue> consumeAngle(CSSParserTokenRange& range, CSSParserMode
     }
 
     if (token.type() == NumberToken && shouldAcceptUnitlessValue(token.numericValue(), cssParserMode, unitless))
-        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitType::CSS_DEG);
+        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSUnitType::CSS_DEG);
 
     if (token.type() != FunctionToken)
         return nullptr;
@@ -412,17 +412,17 @@ static RefPtr<CSSPrimitiveValue> consumeAngleOrPercent(CSSParserTokenRange& rang
     const CSSParserToken& token = range.peek();
     if (token.type() == DimensionToken) {
         switch (token.unitType()) {
-        case CSSPrimitiveValue::UnitType::CSS_DEG:
-        case CSSPrimitiveValue::UnitType::CSS_RAD:
-        case CSSPrimitiveValue::UnitType::CSS_GRAD:
-        case CSSPrimitiveValue::UnitType::CSS_TURN:
+        case CSSUnitType::CSS_DEG:
+        case CSSUnitType::CSS_RAD:
+        case CSSUnitType::CSS_GRAD:
+        case CSSUnitType::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::UnitType::CSS_DEG);
+        return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), CSSUnitType::CSS_DEG);
 
     if (token.type() == PercentageToken)
         return consumePercent(range, valueRange);
@@ -447,14 +447,14 @@ static RefPtr<CSSPrimitiveValue> consumeAngleOrPercent(CSSParserTokenRange& rang
 RefPtr<CSSPrimitiveValue> consumeTime(CSSParserTokenRange& range, CSSParserMode cssParserMode, ValueRange valueRange, UnitlessQuirk unitless)
 {
     const CSSParserToken& token = range.peek();
-    CSSPrimitiveValue::UnitType unit = token.unitType();
+    CSSUnitType unit = token.unitType();
     bool acceptUnitless = token.type() == NumberToken && unitless == UnitlessQuirk::Allow && shouldAcceptUnitlessValue(token.numericValue(), cssParserMode, unitless);
     if (acceptUnitless)
-        unit = CSSPrimitiveValue::UnitType::CSS_MS;
+        unit = CSSUnitType::CSS_MS;
     if (token.type() == DimensionToken || acceptUnitless) {
         if (valueRange == ValueRangeNonNegative && token.numericValue() < 0)
             return nullptr;
-        if (unit == CSSPrimitiveValue::UnitType::CSS_MS || unit == CSSPrimitiveValue::UnitType::CSS_S)
+        if (unit == CSSUnitType::CSS_MS || unit == CSSUnitType::CSS_S)
             return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), unit);
         return nullptr;
     }
@@ -476,8 +476,8 @@ RefPtr<CSSPrimitiveValue> consumeResolution(CSSParserTokenRange& range)
     // Unlike the other types, calc() does not work with <resolution>.
     if (token.type() != DimensionToken)
         return nullptr;
-    CSSPrimitiveValue::UnitType unit = token.unitType();
-    if (unit == CSSPrimitiveValue::UnitType::CSS_DPPX || unit == CSSPrimitiveValue::UnitType::CSS_DPI || unit == CSSPrimitiveValue::UnitType::CSS_DPCM)
+    CSSUnitType unit = token.unitType();
+    if (unit == CSSUnitType::CSS_DPPX || unit == CSSUnitType::CSS_DPI || unit == CSSUnitType::CSS_DPCM)
         return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().numericValue(), unit);
     return nullptr;
 }
@@ -503,14 +503,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::UnitType::CSS_STRING);
+    return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().value().toString(), CSSUnitType::CSS_STRING);
 }
 
 RefPtr<CSSPrimitiveValue> consumeString(CSSParserTokenRange& range)
 {
     if (range.peek().type() != StringToken)
         return nullptr;
-    return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().value().toString(), CSSPrimitiveValue::UnitType::CSS_STRING);
+    return CSSValuePool::singleton().createValue(range.consumeIncludingWhitespace().value().toString(), CSSUnitType::CSS_STRING);
 }
 
 StringView consumeUrlAsStringView(CSSParserTokenRange& range)
@@ -540,7 +540,7 @@ RefPtr<CSSPrimitiveValue> consumeUrl(CSSParserTokenRange& range)
     StringView url = consumeUrlAsStringView(range);
     if (url.isNull())
         return nullptr;
-    return CSSValuePool::singleton().createValue(url.toString(), CSSPrimitiveValue::UnitType::CSS_URI);
+    return CSSValuePool::singleton().createValue(url.toString(), CSSUnitType::CSS_URI);
 }
 
 static int clampRGBComponent(const CSSPrimitiveValue& value)
@@ -1008,11 +1008,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::UnitType::CSS_PERCENTAGE);
+            return CSSValuePool::singleton().createValue(0., CSSUnitType::CSS_PERCENTAGE);
         if ((horizontal && consumeIdent<CSSValueRight>(args)) || (!horizontal && consumeIdent<CSSValueBottom>(args)))
-            return CSSValuePool::singleton().createValue(100., CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
+            return CSSValuePool::singleton().createValue(100., CSSUnitType::CSS_PERCENTAGE);
         if (consumeIdent<CSSValueCenter>(args))
-            return CSSValuePool::singleton().createValue(50., CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
+            return CSSValuePool::singleton().createValue(50., CSSUnitType::CSS_PERCENTAGE);
         return nullptr;
     }
     RefPtr<CSSPrimitiveValue> result = consumePercent(args, ValueRangeAll);
@@ -1050,7 +1050,7 @@ static bool consumeDeprecatedGradientColorStop(CSSParserTokenRange& range, CSSGr
             return false;
     }
 
-    stop.m_position = CSSValuePool::singleton().createValue(position, CSSPrimitiveValue::UnitType::CSS_NUMBER);
+    stop.m_position = CSSValuePool::singleton().createValue(position, CSSUnitType::CSS_NUMBER);
     stop.m_color = consumeDeprecatedGradientStopColor(args, cssParserMode);
     return stop.m_color && args.atEnd();
 }
@@ -1396,9 +1396,9 @@ static RefPtr<CSSValue> consumeCrossFade(CSSParserTokenRange& args, CSSParserCon
 
     RefPtr<CSSPrimitiveValue> percentage;
     if (auto percentValue = consumePercent(args, ValueRangeAll))
-        percentage = CSSValuePool::singleton().createValue(clampTo<double>(percentValue->doubleValue() / 100.0, 0, 1), CSSPrimitiveValue::UnitType::CSS_NUMBER);
+        percentage = CSSValuePool::singleton().createValue(clampTo<double>(percentValue->doubleValue() / 100.0, 0, 1), CSSUnitType::CSS_NUMBER);
     else if (auto numberValue = consumeNumber(args, ValueRangeAll))
-        percentage = CSSValuePool::singleton().createValue(clampTo<double>(numberValue->doubleValue(), 0, 1), CSSPrimitiveValue::UnitType::CSS_NUMBER);
+        percentage = CSSValuePool::singleton().createValue(clampTo<double>(numberValue->doubleValue(), 0, 1), CSSUnitType::CSS_NUMBER);
 
     if (!percentage)
         return nullptr;
@@ -1529,11 +1529,11 @@ static RefPtr<CSSValue> consumeImageSet(CSSParserTokenRange& range, const CSSPar
             return nullptr;
         if (token.value() != "x")
             return nullptr;
-        ASSERT(token.unitType() == CSSPrimitiveValue::UnitType::CSS_UNKNOWN);
+        ASSERT(token.unitType() == CSSUnitType::CSS_UNKNOWN);
         double imageScaleFactor = token.numericValue();
         if (imageScaleFactor <= 0)
             return nullptr;
-        imageSet->append(CSSValuePool::singleton().createValue(imageScaleFactor, CSSPrimitiveValue::UnitType::CSS_NUMBER));
+        imageSet->append(CSSValuePool::singleton().createValue(imageScaleFactor, CSSUnitType::CSS_NUMBER));
     } while (consumeCommaIncludingWhitespace(args));
     if (!args.atEnd())
         return nullptr;
@@ -1657,7 +1657,7 @@ static RefPtr<CSSFunctionValue> consumeFilterFunction(CSSParserTokenRange& range
                 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::UnitType::CSS_PERCENTAGE : CSSPrimitiveValue::UnitType::CSS_NUMBER);
+                    parsedValue = CSSPrimitiveValue::create(maxAllowed, isPercentage ? CSSUnitType::CSS_PERCENTAGE : CSSUnitType::CSS_NUMBER);
             }
         }
     }
index 6d21d20..18120ce 100644 (file)
@@ -194,7 +194,7 @@ void MediaQueryParser::readFeatureColon(CSSParserTokenType type, const CSSParser
 
 void MediaQueryParser::readFeatureValue(CSSParserTokenType type, const CSSParserToken& token, CSSParserTokenRange& range)
 {
-    if (type == DimensionToken && token.unitType() == CSSPrimitiveValue::UnitType::CSS_UNKNOWN) {
+    if (type == DimensionToken && token.unitType() == CSSUnitType::CSS_UNKNOWN) {
         range.consume();
         m_state = SkipUntilComma;
     } else {
index b909aff..806eda8 100644 (file)
@@ -44,7 +44,7 @@
 
 namespace WebCore {
 
-float SizesAttributeParser::computeLength(double value, CSSPrimitiveValue::UnitType type, const Document& document)
+float SizesAttributeParser::computeLength(double value, CSSUnitType type, const Document& document)
 {
     auto* renderer = document.renderView();
     if (!renderer)
@@ -58,7 +58,7 @@ float SizesAttributeParser::computeLength(double value, CSSPrimitiveValue::UnitT
     // the pointer to it for the duration of the unit evaluation. This is acceptible because the style always comes from the
     // RenderView, which has its font information hardcoded in resolveForDocument() to be -webkit-standard, whose operations
     // don't require a font selector.
-    if (type == CSSPrimitiveValue::CSS_EXS || type == CSSPrimitiveValue::CSS_CHS) {
+    if (type == CSSUnitType::CSS_EXS || type == CSSUnitType::CSS_CHS) {
         RefPtr<FontSelector> fontSelector = style.fontCascade().fontSelector();
         style.fontCascade().update(nullptr);
         float result = CSSPrimitiveValue::computeNonCalcLengthDouble(conversionData, type, value);
@@ -160,7 +160,7 @@ unsigned SizesAttributeParser::effectiveSizeDefaultValue()
     if (!renderer)
         return 0;
     auto& style = renderer->style();
-    return clampTo<float>(CSSPrimitiveValue::computeNonCalcLengthDouble({ &style, &style, renderer }, CSSPrimitiveValue::CSS_VW, 100.0));
+    return clampTo<float>(CSSPrimitiveValue::computeNonCalcLengthDouble({ &style, &style, renderer }, CSSUnitType::CSS_VW, 100.0));
 }
 
 } // namespace WebCore
index a2bcb2f..14930d2 100644 (file)
@@ -46,7 +46,7 @@ public:
     float length();
 
     static float defaultLength(const Document&);
-    static float computeLength(double value, CSSPrimitiveValue::UnitType, const Document&);
+    static float computeLength(double value, CSSUnitType, const Document&);
 
 private:
     bool parse(CSSParserTokenRange);
index ebf3ffa..d517ad4 100644 (file)
@@ -51,7 +51,7 @@ RefPtr<TypedOMCSSStyleValue> StylePropertyMapReadOnly::reifyValue(CSSValue* valu
         return nullptr;
 
     // FIXME: Properly reify all length values.
-    if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).primitiveType() == CSSPrimitiveValue::CSS_PX)
+    if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).primitiveType() == CSSUnitType::CSS_PX)
         return TypedOMCSSUnitValue::create(downcast<CSSPrimitiveValue>(*value).doubleValue(), "px");
 
     if (is<CSSImageValue>(*value))
index 3ab2fed..a42baa6 100644 (file)
@@ -248,7 +248,7 @@ bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, CSSProperty
     return true;
 }
 
-bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit, bool important)
+bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSSUnitType unit, bool important)
 {
     ensureMutableInlineStyle().setProperty(propertyID, CSSValuePool::singleton().createValue(value, unit), important);
     inlineStyleChanged();
@@ -310,7 +310,7 @@ void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperti
     style.setProperty(propertyID, CSSValuePool::singleton().createIdentifierValue(identifier));
 }
 
-void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit)
+void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, double value, CSSUnitType unit)
 {
     style.setProperty(propertyID, CSSValuePool::singleton().createValue(value, unit));
 }
index 56f6f44..e6b0df2 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::UnitType, bool important = false);
+    WEBCORE_EXPORT bool setInlineStyleProperty(CSSPropertyID, double value, CSSUnitType, bool important = false);
     WEBCORE_EXPORT bool setInlineStyleProperty(CSSPropertyID, const String& value, bool important = false);
     bool removeInlineStyleProperty(CSSPropertyID);
     void removeAllInlineStyleProperties();
@@ -76,7 +76,7 @@ protected:
     virtual bool isPresentationAttribute(const QualifiedName&) const { return false; }
 
     void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, CSSValueID identifier);
-    void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, double value, CSSPrimitiveValue::UnitType);
+    void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, double value, CSSUnitType);
     void addPropertyToPresentationAttributeStyle(MutableStyleProperties&, CSSPropertyID, const String& value);
 
     void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
index 49163d7..52e6e4e 100644 (file)
@@ -418,7 +418,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
             currentFontSize = computedFontSize(node);
         }
         if (currentFontSize != desiredFontSize) {
-            inlineStyle->setProperty(CSSPropertyFontSize, CSSValuePool::singleton().createValue(desiredFontSize, CSSPrimitiveValue::CSS_PX), false);
+            inlineStyle->setProperty(CSSPropertyFontSize, CSSValuePool::singleton().createValue(desiredFontSize, CSSUnitType::CSS_PX), false);
             setNodeAttribute(*element, styleAttr, inlineStyle->asText());
         }
         if (inlineStyle->isEmpty()) {
@@ -1497,7 +1497,7 @@ float ApplyStyleCommand::computedFontSize(Node* node)
         return 0;
 
     auto value = ComputedStyleExtractor(node).propertyValue(CSSPropertyFontSize);
-    return downcast<CSSPrimitiveValue>(*value).floatValue(CSSPrimitiveValue::CSS_PX);
+    return downcast<CSSPrimitiveValue>(*value).floatValue(CSSUnitType::CSS_PX);
 }
 
 void ApplyStyleCommand::joinChildTextNodes(Node* node, const Position& start, const Position& end)
index 48326bc..a14881f 100644 (file)
@@ -1884,7 +1884,7 @@ static bool isCSSValueLength(CSSPrimitiveValue* value)
 int legacyFontSizeFromCSSValue(Document& document, CSSPrimitiveValue* value, bool shouldUseFixedFontDefaultSize, LegacyFontSizeMode mode)
 {
     if (isCSSValueLength(value)) {
-        int pixelFontSize = value->intValue(CSSPrimitiveValue::CSS_PX);
+        int pixelFontSize = value->intValue(CSSUnitType::CSS_PX);
         int legacyFontSize = Style::legacyFontSizeForPixelSize(pixelFontSize, shouldUseFixedFontDefaultSize, document);
         // Use legacy font size only if pixel value matches exactly to that of legacy font size.
         int cssPrimitiveEquivalent = legacyFontSize - 1 + CSSValueXSmall;
index f0b13ec..a9ca0a1 100644 (file)
@@ -71,10 +71,10 @@ Ref<MutableStyleProperties> FontChanges::createStyleProperties() const
         style->setProperty(CSSPropertyFontWeight, *m_bold ? CSSValueBold : CSSValueNormal);
 
     if (m_fontSize)
-        style->setProperty(CSSPropertyFontSize, cssValuePool.createValue(*m_fontSize, CSSPrimitiveValue::CSS_PX));
+        style->setProperty(CSSPropertyFontSize, cssValuePool.createValue(*m_fontSize, CSSUnitType::CSS_PX));
 
     if (m_fontSizeDelta)
-        style->setProperty(CSSPropertyWebkitFontSizeDelta, cssValuePool.createValue(*m_fontSizeDelta, CSSPrimitiveValue::CSS_PX));
+        style->setProperty(CSSPropertyWebkitFontSizeDelta, cssValuePool.createValue(*m_fontSizeDelta, CSSUnitType::CSS_PX));
 
     return style;
 }
@@ -86,9 +86,9 @@ static RefPtr<CSSValueList> cssValueListForShadow(const FontShadow& shadow)
 
     auto list = CSSValueList::createCommaSeparated();
     auto& cssValuePool = CSSValuePool::singleton();
-    auto width = cssValuePool.createValue(shadow.offset.width(), CSSPrimitiveValue::CSS_PX);
-    auto height = cssValuePool.createValue(shadow.offset.height(), CSSPrimitiveValue::CSS_PX);
-    auto blurRadius = cssValuePool.createValue(shadow.blurRadius, CSSPrimitiveValue::CSS_PX);
+    auto width = cssValuePool.createValue(shadow.offset.width(), CSSUnitType::CSS_PX);
+    auto height = cssValuePool.createValue(shadow.offset.height(), CSSUnitType::CSS_PX);
+    auto blurRadius = cssValuePool.createValue(shadow.blurRadius, CSSUnitType::CSS_PX);
     auto color = cssValuePool.createValue(shadow.color);
     list->prepend(CSSShadowValue::create(WTFMove(width), WTFMove(height), WTFMove(blurRadius), { }, { }, WTFMove(color)));
     return list.ptr();
index 45488b7..b32c133 100644 (file)
@@ -569,9 +569,10 @@ RefPtr<CSSValue> HTMLConverterCaches::inlineStylePropertyForElement(Element& ele
 static bool stringFromCSSValue(CSSValue& value, String& result)
 {
     if (is<CSSPrimitiveValue>(value)) {
-        unsigned short primitiveType = downcast<CSSPrimitiveValue>(value).primitiveType();
-        if (primitiveType == CSSPrimitiveValue::CSS_STRING || primitiveType == CSSPrimitiveValue::CSS_URI ||
-            primitiveType == CSSPrimitiveValue::CSS_IDENT || primitiveType == CSSPrimitiveValue::CSS_ATTR) {
+        // FIXME: Use isStringType(CSSUnitType)?
+        CSSUnitType primitiveType = downcast<CSSPrimitiveValue>(value).primitiveType();
+        if (primitiveType == CSSUnitType::CSS_STRING || primitiveType == CSSUnitType::CSS_URI
+            || primitiveType == CSSUnitType::CSS_IDENT || primitiveType == CSSUnitType::CSS_ATTR) {
             String stringValue = value.cssText();
             if (stringValue.length()) {
                 result = stringValue;
@@ -707,26 +708,26 @@ static inline bool floatValueFromPrimitiveValue(CSSPrimitiveValue& primitiveValu
 {
     // FIXME: Use CSSPrimitiveValue::computeValue.
     switch (primitiveValue.primitiveType()) {
-    case CSSPrimitiveValue::CSS_PX:
-        result = primitiveValue.floatValue(CSSPrimitiveValue::CSS_PX);
+    case CSSUnitType::CSS_PX:
+        result = primitiveValue.floatValue(CSSUnitType::CSS_PX);
         return true;
-    case CSSPrimitiveValue::CSS_PT:
-        result = 4 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_PT) / 3;
+    case CSSUnitType::CSS_PT:
+        result = 4 * primitiveValue.floatValue(CSSUnitType::CSS_PT) / 3;
         return true;
-    case CSSPrimitiveValue::CSS_PC:
-        result = 16 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_PC);
+    case CSSUnitType::CSS_PC:
+        result = 16 * primitiveValue.floatValue(CSSUnitType::CSS_PC);
         return true;
-    case CSSPrimitiveValue::CSS_CM:
-        result = 96 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_PC) / 2.54;
+    case CSSUnitType::CSS_CM:
+        result = 96 * primitiveValue.floatValue(CSSUnitType::CSS_PC) / 2.54;
         return true;
-    case CSSPrimitiveValue::CSS_MM:
-        result = 96 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_PC) / 25.4;
+    case CSSUnitType::CSS_MM:
+        result = 96 * primitiveValue.floatValue(CSSUnitType::CSS_PC) / 25.4;
         return true;
-    case CSSPrimitiveValue::CSS_Q:
-        result = 96 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_PC) / (25.4 * 4.0);
+    case CSSUnitType::CSS_Q:
+        result = 96 * primitiveValue.floatValue(CSSUnitType::CSS_PC) / (25.4 * 4.0);
         return true;
-    case CSSPrimitiveValue::CSS_IN:
-        result = 96 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_IN);
+    case CSSUnitType::CSS_IN:
+        result = 96 * primitiveValue.floatValue(CSSUnitType::CSS_IN);
         return true;
     default:
         return false;
index d7d8676..7ab1ff5 100644 (file)
@@ -114,7 +114,7 @@ unsigned HTMLElement::parseBorderWidthAttribute(const AtomString& value) const
 
 void HTMLElement::applyBorderAttributeToStyle(const AtomString& value, MutableStyleProperties& style)
 {
-    addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, parseBorderWidthAttribute(value), CSSPrimitiveValue::CSS_PX);
+    addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, parseBorderWidthAttribute(value), CSSUnitType::CSS_PX);
     addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
 }
 
index 2057354..91701e1 100644 (file)
@@ -94,8 +94,8 @@ void HTMLEmbedElement::collectStyleForPresentationAttribute(const QualifiedName&
 {
     if (name == hiddenAttr) {
         if (equalLettersIgnoringASCIICase(value, "yes") || equalLettersIgnoringASCIICase(value, "true")) {
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 0, CSSPrimitiveValue::CSS_PX);
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, 0, CSSPrimitiveValue::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 0, CSSUnitType::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, 0, CSSUnitType::CSS_PX);
         }
     } else
         HTMLPlugInImageElement::collectStyleForPresentationAttribute(name, value, style);
index 63034c8..259c5d1 100644 (file)
@@ -63,11 +63,11 @@ void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& na
 {
     if (name == alignAttr) {
         if (equalLettersIgnoringASCIICase(value, "left")) {
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, 0, CSSPrimitiveValue::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, 0, CSSUnitType::CSS_PX);
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
         } else if (equalLettersIgnoringASCIICase(value, "right")) {
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, 0, CSSPrimitiveValue::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, 0, CSSUnitType::CSS_PX);
         } else {
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
@@ -76,7 +76,7 @@ void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& na
         bool ok;
         int v = value.toInt(&ok);
         if (ok && !v)
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 1, CSSPrimitiveValue::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 1, CSSUnitType::CSS_PX);
         else
             addHTMLLengthToStyle(style, CSSPropertyWidth, value);
     } else if (name == colorAttr) {
@@ -95,9 +95,9 @@ void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& na
         StringImpl* si = value.impl();
         int size = si->toInt();
         if (size <= 1)
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomWidth, 0, CSSPrimitiveValue::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomWidth, 0, CSSUnitType::CSS_PX);
         else
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, size - 2, CSSPrimitiveValue::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, size - 2, CSSUnitType::CSS_PX);
     } else
         HTMLElement::collectStyleForPresentationAttribute(name, value, style);
 }
index 939af97..ae3c8a9 100644 (file)
@@ -86,7 +86,7 @@ void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName
         // a presentational hint that the border should be off if set to zero.
         if (!value.toInt()) {
             // Add a rule that nulls out our border width.
-            addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, 0, CSSPrimitiveValue::CSS_PX);
+            addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, 0, CSSUnitType::CSS_PX);
         }
     } else
         HTMLFrameElementBase::collectStyleForPresentationAttribute(name, value, style);
index 4aff7f1..49fd2be 100644 (file)
@@ -2056,14 +2056,14 @@ static Ref<CSSLinearGradientValue> autoFillStrongPasswordMaskImage()
 {
     CSSGradientColorStop firstStop;
     firstStop.m_color = CSSValuePool::singleton().createColorValue(Color::black);
-    firstStop.m_position = CSSValuePool::singleton().createValue(50, CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
+    firstStop.m_position = CSSValuePool::singleton().createValue(50, CSSUnitType::CSS_PERCENTAGE);
 
     CSSGradientColorStop secondStop;
     secondStop.m_color = CSSValuePool::singleton().createColorValue(Color::transparent);
-    secondStop.m_position = CSSValuePool::singleton().createValue(100, CSSPrimitiveValue::UnitType::CSS_PERCENTAGE);
+    secondStop.m_position = CSSValuePool::singleton().createValue(100, CSSUnitType::CSS_PERCENTAGE);
 
     auto gradient = CSSLinearGradientValue::create(CSSGradientRepeat::NonRepeating, CSSGradientType::CSSLinearGradient);
-    gradient->setAngle(CSSValuePool::singleton().createValue(90, CSSPrimitiveValue::UnitType::CSS_DEG));
+    gradient->setAngle(CSSValuePool::singleton().createValue(90, CSSUnitType::CSS_DEG));
     gradient->addStop(firstStop);
     gradient->addStop(secondStop);
     gradient->resolveRGBColors();
index c52c471..a53e429 100644 (file)
@@ -209,7 +209,7 @@ static void setValueClass(HTMLElement& element, HTMLMeterElement::GaugeRegion ga
 
 void HTMLMeterElement::didElementStateChange()
 {
-    m_value->setInlineStyleProperty(CSSPropertyWidth, valueRatio()*100, CSSPrimitiveValue::CSS_PERCENTAGE);
+    m_value->setInlineStyleProperty(CSSPropertyWidth, valueRatio()*100, CSSUnitType::CSS_PERCENTAGE);
     setValueClass(*m_value, gaugeRegion());
 
     if (RenderMeter* render = renderMeter())
index 238b9a9..767a3e3 100644 (file)
@@ -311,7 +311,7 @@ void HTMLTableElement::collectStyleForPresentationAttribute(const QualifiedName&
     else if (name == heightAttr)
         addHTMLLengthToStyle(style, CSSPropertyHeight, value);
     else if (name == borderAttr) 
-        addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, parseBorderWidthAttribute(value), CSSPrimitiveValue::CSS_PX);
+        addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, parseBorderWidthAttribute(value), CSSUnitType::CSS_PX);
     else if (name == bordercolorAttr) {
         if (!value.isEmpty())
             addHTMLColorToStyle(style, CSSPropertyBorderColor, value);
@@ -494,12 +494,12 @@ Ref<StyleProperties> HTMLTableElement::createSharedCellStyle()
         style->setProperty(CSSPropertyBorderColor, cssValuePool.createInheritedValue());
         break;
     case SolidBorders:
-        style->setProperty(CSSPropertyBorderWidth, cssValuePool.createValue(1, CSSPrimitiveValue::CSS_PX));
+        style->setProperty(CSSPropertyBorderWidth, cssValuePool.createValue(1, CSSUnitType::CSS_PX));
         style->setProperty(CSSPropertyBorderStyle, cssValuePool.createIdentifierValue(CSSValueSolid));
         style->setProperty(CSSPropertyBorderColor, cssValuePool.createInheritedValue());
         break;
     case InsetBorders:
-        style->setProperty(CSSPropertyBorderWidth, cssValuePool.createValue(1, CSSPrimitiveValue::CSS_PX));
+        style->setProperty(CSSPropertyBorderWidth, cssValuePool.createValue(1, CSSUnitType::CSS_PX));
         style->setProperty(CSSPropertyBorderStyle, cssValuePool.createIdentifierValue(CSSValueInset));
         style->setProperty(CSSPropertyBorderColor, cssValuePool.createInheritedValue());
         break;
@@ -509,7 +509,7 @@ Ref<StyleProperties> HTMLTableElement::createSharedCellStyle()
     }
 
     if (m_padding)
-        style->setProperty(CSSPropertyPadding, cssValuePool.createValue(m_padding, CSSPrimitiveValue::CSS_PX));
+        style->setProperty(CSSPropertyPadding, cssValuePool.createValue(m_padding, CSSUnitType::CSS_PX));
 
     return style;
 }
index f5dab0f..31aab85 100644 (file)
@@ -163,13 +163,13 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble
         }
     }
 
-    bubble->setInlineStyleProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX);
+    bubble->setInlineStyleProperty(CSSPropertyTop, hostY + hostRect.height(), CSSUnitType::CSS_PX);
     // The 'left' value of ::-webkit-validation-bubble-arrow.
     const int bubbleArrowTopOffset = 32;
     double bubbleX = hostX;
     if (hostRect.width() / 2 < bubbleArrowTopOffset)
         bubbleX = std::max(hostX + hostRect.width() / 2 - bubbleArrowTopOffset, 0.0);
-    bubble->setInlineStyleProperty(CSSPropertyLeft, bubbleX, CSSPrimitiveValue::CSS_PX);
+    bubble->setInlineStyleProperty(CSSPropertyLeft, bubbleX, CSSUnitType::CSS_PX);
 }
 
 void ValidationMessage::buildBubbleTree()
index 39a1d3a..0cbd0a3 100644 (file)
@@ -194,10 +194,10 @@ void MediaControlPanelElement::setPosition(const LayoutPoint& position)
 
     // Set the left and top to control the panel's position; this depends on it being absolute positioned.
     // Set the margin to zero since the position passed in will already include the effect of the margin.
-    setInlineStyleProperty(CSSPropertyLeft, left, CSSPrimitiveValue::CSS_PX);
-    setInlineStyleProperty(CSSPropertyTop, top, CSSPrimitiveValue::CSS_PX);
-    setInlineStyleProperty(CSSPropertyMarginLeft, 0.0, CSSPrimitiveValue::CSS_PX);
-    setInlineStyleProperty(CSSPropertyMarginTop, 0.0, CSSPrimitiveValue::CSS_PX);
+    setInlineStyleProperty(CSSPropertyLeft, left, CSSUnitType::CSS_PX);
+    setInlineStyleProperty(CSSPropertyTop, top, CSSUnitType::CSS_PX);
+    setInlineStyleProperty(CSSPropertyMarginLeft, 0.0, CSSUnitType::CSS_PX);
+    setInlineStyleProperty(CSSPropertyMarginTop, 0.0, CSSUnitType::CSS_PX);
 
     classList().add("dragged");
 }
@@ -223,8 +223,8 @@ void MediaControlPanelElement::makeOpaque()
     double duration = RenderTheme::singleton().mediaControlsFadeInDuration();
 
     setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity);
-    setInlineStyleProperty(CSSPropertyTransitionDuration, duration, CSSPrimitiveValue::CSS_S);
-    setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBER);
+    setInlineStyleProperty(CSSPropertyTransitionDuration, duration, CSSUnitType::CSS_S);
+    setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSUnitType::CSS_NUMBER);
 
     m_opaque = true;
 
@@ -240,8 +240,8 @@ void MediaControlPanelElement::makeTransparent()
     Seconds duration = RenderTheme::singleton().mediaControlsFadeOutDuration();
 
     setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity);
-    setInlineStyleProperty(CSSPropertyTransitionDuration, duration.value(), CSSPrimitiveValue::CSS_S);
-    setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBER);
+    setInlineStyleProperty(CSSPropertyTransitionDuration, duration.value(), CSSUnitType::CSS_S);
+    setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSUnitType::CSS_NUMBER);
 
     m_opaque = false;
     startTimer();
@@ -1289,7 +1289,7 @@ void MediaControlTextTrackContainerElement::updateTextStrokeStyle()
 
     // FIXME: find a way to set this property in the stylesheet like the other user style preferences, see <https://bugs.webkit.org/show_bug.cgi?id=169874>.
     if (document().page()->group().captionPreferences().captionStrokeWidthForFont(m_fontSize, language, strokeWidth, important))
-        setInlineStyleProperty(CSSPropertyStrokeWidth, strokeWidth, CSSPrimitiveValue::CSS_PX, important);
+        setInlineStyleProperty(CSSPropertyStrokeWidth, strokeWidth, CSSUnitType::CSS_PX, important);
 }
 
 void MediaControlTextTrackContainerElement::updateTimerFired()
@@ -1359,11 +1359,11 @@ void MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentatio
     m_updateTextTrackRepresentationStyle = false;
 
     if (m_textTrackRepresentation) {
-        setInlineStyleProperty(CSSPropertyWidth, m_videoDisplaySize.size().width(), CSSPrimitiveValue::CSS_PX);
-        setInlineStyleProperty(CSSPropertyHeight, m_videoDisplaySize.size().height(), CSSPrimitiveValue::CSS_PX);
+        setInlineStyleProperty(CSSPropertyWidth, m_videoDisplaySize.size().width(), CSSUnitType::CSS_PX);
+        setInlineStyleProperty(CSSPropertyHeight, m_videoDisplaySize.size().height(), CSSUnitType::CSS_PX);
         setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
-        setInlineStyleProperty(CSSPropertyLeft, 0, CSSPrimitiveValue::CSS_PX);
-        setInlineStyleProperty(CSSPropertyTop, 0, CSSPrimitiveValue::CSS_PX);
+        setInlineStyleProperty(CSSPropertyLeft, 0, CSSUnitType::CSS_PX);
+        setInlineStyleProperty(CSSPropertyTop, 0, CSSUnitType::CSS_PX);
         return;
     }
 
index 3050355..838b244 100644 (file)
@@ -86,7 +86,7 @@ ProgressValueElement::ProgressValueElement(Document& document)
 
 void ProgressValueElement::setWidthPercentage(double width)
 {
-    setInlineStyleProperty(CSSPropertyWidth, width, CSSPrimitiveValue::CSS_PERCENTAGE);
+    setInlineStyleProperty(CSSPropertyWidth, width, CSSUnitType::CSS_PERCENTAGE);
 }
 
 }
index d566bcc..43932e4 100644 (file)
@@ -122,7 +122,7 @@ Optional<ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderS
         // Set "flex-basis: 1em". Note that CSSPrimitiveValue::computeLengthInt() only needs the element's
         // style to calculate em lengths. Since the element might not be in a document, just pass nullptr
         // for the root element style and the render view.
-        auto emSize = CSSPrimitiveValue::create(1, CSSPrimitiveValue::CSS_EMS);
+        auto emSize = CSSPrimitiveValue::create(1, CSSUnitType::CSS_EMS);
         int pixels = emSize->computeLength<int>(CSSToLengthConversionData { newStyle.get(), nullptr, nullptr, 1.0, false });
         newStyle->setFlexBasis(Length { pixels, Fixed });
     }
index 8ee2392..26090da 100644 (file)
@@ -98,10 +98,10 @@ RefPtr<ImageControlsButtonElementMac> ImageControlsButtonElementMac::tryCreate(D
     button->setAttributeWithoutSynchronization(HTMLNames::classAttr, AtomString("x-webkit-image-controls-button", AtomString::ConstructFromLiteral));
 
     IntSize positionOffset = RenderTheme::singleton().imageControlsButtonPositionOffset();
-    button->setInlineStyleProperty(CSSPropertyTop, positionOffset.height(), CSSPrimitiveValue::CSS_PX);
+    button->setInlineStyleProperty(CSSPropertyTop, positionOffset.height(), CSSUnitType::CSS_PX);
 
     // FIXME: Why is right: 0px off the right edge of the parent?
-    button->setInlineStyleProperty(CSSPropertyRight, positionOffset.width(), CSSPrimitiveValue::CSS_PX);
+    button->setInlineStyleProperty(CSSPropertyRight, positionOffset.width(), CSSUnitType::CSS_PX);
 
     return WTFMove(button);
 }
index c4b6fd9..982f286 100644 (file)
@@ -84,11 +84,11 @@ void TextTrackCueGenericBoxElement::applyCSSProperties(const IntSize& videoSize)
     CSSValueID alignment = cue->getCSSAlignment();
     float size = static_cast<float>(cue->getCSSSize());
     if (cue->useDefaultPosition()) {
-        setInlineStyleProperty(CSSPropertyBottom, 0, CSSPrimitiveValue::CSS_PX);
-        setInlineStyleProperty(CSSPropertyMarginBottom, 1.0, CSSPrimitiveValue::CSS_PERCENTAGE);
+        setInlineStyleProperty(CSSPropertyBottom, 0, CSSUnitType::CSS_PX);
+        setInlineStyleProperty(CSSPropertyMarginBottom, 1.0, CSSUnitType::CSS_PERCENTAGE);
     } else {
-        setInlineStyleProperty(CSSPropertyLeft, static_cast<float>(textPosition), CSSPrimitiveValue::CSS_PERCENTAGE);
-        setInlineStyleProperty(CSSPropertyTop, static_cast<float>(cue->line()), CSSPrimitiveValue::CSS_PERCENTAGE);
+        setInlineStyleProperty(CSSPropertyLeft, static_cast<float>(textPosition), CSSUnitType::CSS_PERCENTAGE);
+        setInlineStyleProperty(CSSPropertyTop, static_cast<float>(cue->line()), CSSUnitType::CSS_PERCENTAGE);
 
         double authorFontSize = videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100.0;
         if (!authorFontSize)
@@ -100,13 +100,13 @@ void TextTrackCueGenericBoxElement::applyCSSProperties(const IntSize& videoSize)
         double multiplier = fontSizeFromCaptionUserPrefs() / authorFontSize;
         double newCueSize = std::min(size * multiplier, 100.0);
         if (cue->getWritingDirection() == VTTCue::Horizontal) {
-            setInlineStyleProperty(CSSPropertyWidth, newCueSize, CSSPrimitiveValue::CSS_PERCENTAGE);
+            setInlineStyleProperty(CSSPropertyWidth, newCueSize, CSSUnitType::CSS_PERCENTAGE);
             if ((alignment == CSSValueMiddle || alignment == CSSValueCenter) && multiplier != 1.0)
-                setInlineStyleProperty(CSSPropertyLeft, static_cast<double>(textPosition - (newCueSize - cue->getCSSSize()) / 2), CSSPrimitiveValue::CSS_PERCENTAGE);
+                setInlineStyleProperty(CSSPropertyLeft, static_cast<double>(textPosition - (newCueSize - cue->getCSSSize()) / 2), CSSUnitType::CSS_PERCENTAGE);
         } else {
-            setInlineStyleProperty(CSSPropertyHeight, newCueSize,  CSSPrimitiveValue::CSS_PERCENTAGE);
+            setInlineStyleProperty(CSSPropertyHeight, newCueSize,  CSSUnitType::CSS_PERCENTAGE);
             if ((alignment == CSSValueMiddle || alignment == CSSValueCenter) && multiplier != 1.0)
-                setInlineStyleProperty(CSSPropertyTop, static_cast<double>(cue->line() - (newCueSize - cue->getCSSSize()) / 2), CSSPrimitiveValue::CSS_PERCENTAGE);
+                setInlineStyleProperty(CSSPropertyTop, static_cast<double>(cue->line() - (newCueSize - cue->getCSSSize()) / 2), CSSUnitType::CSS_PERCENTAGE);
         }
     }
 
@@ -119,10 +119,10 @@ void TextTrackCueGenericBoxElement::applyCSSProperties(const IntSize& videoSize)
 
     if (cue->getWritingDirection() == VTTCue::Horizontal) {
         setInlineStyleProperty(CSSPropertyMinWidth, "min-content");
-        setInlineStyleProperty(CSSPropertyMaxWidth, maxSize, CSSPrimitiveValue::CSS_PERCENTAGE);
+        setInlineStyleProperty(CSSPropertyMaxWidth, maxSize, CSSUnitType::CSS_PERCENTAGE);
     } else {
         setInlineStyleProperty(CSSPropertyMinHeight, "min-content");
-        setInlineStyleProperty(CSSPropertyMaxHeight, maxSize, CSSPrimitiveValue::CSS_PERCENTAGE);
+        setInlineStyleProperty(CSSPropertyMaxHeight, maxSize, CSSUnitType::CSS_PERCENTAGE);
     }
 
     if (cue->foregroundColor().isValid())
@@ -196,7 +196,7 @@ void TextTrackCueGeneric::setFontSize(int fontSize, const IntSize& videoSize, bo
     double size = videoSize.height() * baseFontSizeRelativeToVideoHeight() / 100;
     if (fontSizeMultiplier())
         size *= fontSizeMultiplier() / 100;
-    displayTreeInternal().setInlineStyleProperty(CSSPropertyFontSize, lround(size), CSSPrimitiveValue::CSS_PX);
+    displayTreeInternal().setInlineStyleProperty(CSSPropertyFontSize, lround(size), CSSUnitType::CSS_PX);
 }
 
 bool TextTrackCueGeneric::cueContentsMatch(const TextTrackCue& cue) const