| Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp | 
| diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp | 
| index 3473d985568a4909a753b20b240b68abb091fbc4..e8b90aa690228ec3e9f30bbfe7298e5c54d78385 100644 | 
| --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp | 
| +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp | 
| @@ -35,6 +35,7 @@ | 
| #include "core/css/CSSFunctionValue.h" | 
| #include "core/css/CSSGridAutoRepeatValue.h" | 
| #include "core/css/CSSGridLineNamesValue.h" | 
| +#include "core/css/CSSIdentifierValue.h" | 
| #include "core/css/CSSPathValue.h" | 
| #include "core/css/CSSPrimitiveValueMappings.h" | 
| #include "core/css/CSSQuadValue.h" | 
| @@ -57,27 +58,27 @@ namespace blink { | 
|  | 
| namespace { | 
|  | 
| -static GridLength convertGridTrackBreadth(const StyleResolverState& state, const CSSPrimitiveValue& primitiveValue) | 
| +static GridLength convertGridTrackBreadth(const StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    if (primitiveValue.getValueID() == CSSValueMinContent) | 
| +    // Fractional unit. | 
| +    if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).isFlex()) | 
| +        return GridLength(toCSSPrimitiveValue(value).getDoubleValue()); | 
| + | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueMinContent) | 
| return Length(MinContent); | 
|  | 
| -    if (primitiveValue.getValueID() == CSSValueMaxContent) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueMaxContent) | 
| return Length(MaxContent); | 
|  | 
| -    // Fractional unit. | 
| -    if (primitiveValue.isFlex()) | 
| -        return GridLength(primitiveValue.getDoubleValue()); | 
| - | 
| -    return StyleBuilderConverter::convertLengthOrAuto(state, primitiveValue); | 
| +    return StyleBuilderConverter::convertLengthOrAuto(state, value); | 
| } | 
|  | 
| } // namespace | 
|  | 
| PassRefPtr<StyleReflection> StyleBuilderConverter::convertBoxReflect(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    if (value.isPrimitiveValue()) { | 
| -        ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 
| +    if (value.isIdentifierValue()) { | 
| +        DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 
| return ComputedStyle::initialBoxReflect(); | 
| } | 
|  | 
| @@ -132,7 +133,7 @@ PassRefPtr<ClipPathOperation> StyleBuilderConverter::convertClipPath(StyleResolv | 
| // TODO(fs): Doesn't work with forward or external SVG references (crbug.com/391604, crbug.com/109212, ...) | 
| return ReferenceClipPathOperation::create(toCSSURIValue(value).value(), fragmentIdentifier); | 
| } | 
| -    DCHECK(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 
| +    DCHECK(value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNone); | 
| return nullptr; | 
| } | 
|  | 
| @@ -170,7 +171,7 @@ static bool convertFontFamilyName(StyleResolverState& state, const CSSValue& val | 
| genericFamily = FontDescription::NoFamily; | 
| familyName = AtomicString(toCSSFontFamilyValue(value).value()); | 
| } else if (state.document().settings()) { | 
| -        genericFamily = convertGenericFamily(toCSSPrimitiveValue(value).getValueID()); | 
| +        genericFamily = convertGenericFamily(toCSSIdentifierValue(value).getValueID()); | 
| familyName = state.fontBuilder().genericFontFamilyName(genericFamily); | 
| } | 
|  | 
| @@ -210,7 +211,7 @@ FontDescription::FamilyDescription StyleBuilderConverter::convertFontFamily(Styl | 
|  | 
| PassRefPtr<FontFeatureSettings> StyleBuilderConverter::convertFontFeatureSettings(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueNormal) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNormal) | 
| return FontBuilder::initialFeatureSettings(); | 
|  | 
| const CSSValueList& list = toCSSValueList(value); | 
| @@ -236,15 +237,14 @@ static float computeFontSize(StyleResolverState& state, const CSSPrimitiveValue& | 
|  | 
| FontDescription::Size StyleBuilderConverter::convertFontSize(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| - | 
| FontDescription::Size parentSize(0, 0.0f, false); | 
|  | 
| // FIXME: Find out when parentStyle could be 0? | 
| if (state.parentStyle()) | 
| parentSize = state.parentFontDescription().getSize(); | 
|  | 
| -    if (CSSValueID valueID = primitiveValue.getValueID()) { | 
| +    if (value.isIdentifierValue()) { | 
| +        CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); | 
| if (FontSize::isValidValueID(valueID)) | 
| return FontDescription::Size(FontSize::keywordSize(valueID), 0.0f, false); | 
| if (valueID == CSSValueSmaller) | 
| @@ -257,6 +257,7 @@ FontDescription::Size StyleBuilderConverter::convertFontSize(StyleResolverState& | 
|  | 
| bool parentIsAbsoluteSize = state.parentFontDescription().isAbsoluteSize(); | 
|  | 
| +    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| if (primitiveValue.isPercentage()) | 
| return FontDescription::Size(0, (primitiveValue.getFloatValue() * parentSize.value / 100.0f), parentIsAbsoluteSize); | 
|  | 
| @@ -265,31 +266,31 @@ FontDescription::Size StyleBuilderConverter::convertFontSize(StyleResolverState& | 
|  | 
| float StyleBuilderConverter::convertFontSizeAdjust(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    if (primitiveValue.getValueID() == CSSValueNone) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNone) | 
| return FontBuilder::initialSizeAdjust(); | 
|  | 
| +    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| ASSERT(primitiveValue.isNumber()); | 
| return primitiveValue.getFloatValue(); | 
| } | 
|  | 
| FontWeight StyleBuilderConverter::convertFontWeight(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    switch (primitiveValue.getValueID()) { | 
| +    const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); | 
| +    switch (identifierValue.getValueID()) { | 
| case CSSValueBolder: | 
| return FontDescription::bolderWeight(state.parentStyle()->getFontDescription().weight()); | 
| case CSSValueLighter: | 
| return FontDescription::lighterWeight(state.parentStyle()->getFontDescription().weight()); | 
| default: | 
| -        return primitiveValue.convertTo<FontWeight>(); | 
| +        return identifierValue.convertTo<FontWeight>(); | 
| } | 
| } | 
|  | 
| FontDescription::FontVariantCaps StyleBuilderConverter::convertFontVariantCaps(StyleResolverState&, const CSSValue& value) | 
| { | 
| -    ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); | 
| -    CSSValueID valueID = toCSSPrimitiveValue(value).getValueID(); | 
| +    SECURITY_DCHECK(value.isIdentifierValue()); | 
| +    CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); | 
| switch (valueID) { | 
| case CSSValueNormal: | 
| return FontDescription::CapsNormal; | 
| @@ -317,8 +318,7 @@ FontDescription::VariantLigatures StyleBuilderConverter::convertFontVariantLigat | 
| const CSSValueList& valueList = toCSSValueList(value); | 
| for (size_t i = 0; i < valueList.length(); ++i) { | 
| const CSSValue& item = valueList.item(i); | 
| -            const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(item); | 
| -            switch (primitiveValue.getValueID()) { | 
| +            switch (toCSSIdentifierValue(item).getValueID()) { | 
| case CSSValueNoCommonLigatures: | 
| ligatures.common = FontDescription::DisabledLigaturesState; | 
| break; | 
| @@ -351,26 +351,25 @@ FontDescription::VariantLigatures StyleBuilderConverter::convertFontVariantLigat | 
| return ligatures; | 
| } | 
|  | 
| -    ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); | 
| - | 
| -    if (toCSSPrimitiveValue(value).getValueID() == CSSValueNone) { | 
| +    SECURITY_DCHECK(value.isIdentifierValue()); | 
| +    if (toCSSIdentifierValue(value).getValueID() == CSSValueNone) { | 
| return FontDescription::VariantLigatures(FontDescription::DisabledLigaturesState); | 
| } | 
|  | 
| -    ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNormal); | 
| +    DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNormal); | 
| return FontDescription::VariantLigatures(); | 
| } | 
|  | 
| FontVariantNumeric StyleBuilderConverter::convertFontVariantNumeric(StyleResolverState&, const CSSValue& value) | 
| { | 
| -    if (value.isPrimitiveValue()) { | 
| -        ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNormal); | 
| +    if (value.isIdentifierValue()) { | 
| +        DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNormal); | 
| return FontVariantNumeric(); | 
| } | 
|  | 
| FontVariantNumeric variantNumeric; | 
| for (const CSSValue* feature : toCSSValueList(value)) { | 
| -        switch (toCSSPrimitiveValue(feature)->getValueID()) { | 
| +        switch (toCSSIdentifierValue(feature)->getValueID()) { | 
| case CSSValueLiningNums: | 
| variantNumeric.setNumericFigure(FontVariantNumeric::LiningNums); | 
| break; | 
| @@ -408,15 +407,15 @@ StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( | 
| StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment(); | 
| if (value.isValuePair()) { | 
| const CSSValuePair& pair = toCSSValuePair(value); | 
| -        if (toCSSPrimitiveValue(pair.first()).getValueID() == CSSValueLegacy) { | 
| +        if (toCSSIdentifierValue(pair.first()).getValueID() == CSSValueLegacy) { | 
| alignmentData.setPositionType(LegacyPosition); | 
| -            alignmentData.setPosition(toCSSPrimitiveValue(pair.second()).convertTo<ItemPosition>()); | 
| +            alignmentData.setPosition(toCSSIdentifierValue(pair.second()).convertTo<ItemPosition>()); | 
| } else { | 
| -            alignmentData.setPosition(toCSSPrimitiveValue(pair.first()).convertTo<ItemPosition>()); | 
| -            alignmentData.setOverflow(toCSSPrimitiveValue(pair.second()).convertTo<OverflowAlignment>()); | 
| +            alignmentData.setPosition(toCSSIdentifierValue(pair.first()).convertTo<ItemPosition>()); | 
| +            alignmentData.setOverflow(toCSSIdentifierValue(pair.second()).convertTo<OverflowAlignment>()); | 
| } | 
| } else { | 
| -        alignmentData.setPosition(toCSSPrimitiveValue(value).convertTo<ItemPosition>()); | 
| +        alignmentData.setPosition(toCSSIdentifierValue(value).convertTo<ItemPosition>()); | 
| } | 
| return alignmentData; | 
| } | 
| @@ -425,17 +424,17 @@ StyleContentAlignmentData StyleBuilderConverter::convertContentAlignmentData(Sty | 
| { | 
| StyleContentAlignmentData alignmentData = ComputedStyle::initialContentAlignment(); | 
| if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) { | 
| -        const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -        switch (primitiveValue.getValueID()) { | 
| +        const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); | 
| +        switch (identifierValue.getValueID()) { | 
| case CSSValueStretch: | 
| case CSSValueSpaceBetween: | 
| case CSSValueSpaceAround: | 
| -            alignmentData.setDistribution(primitiveValue.convertTo<ContentDistributionType>()); | 
| +            alignmentData.setDistribution(identifierValue.convertTo<ContentDistributionType>()); | 
| break; | 
| case CSSValueFlexStart: | 
| case CSSValueFlexEnd: | 
| case CSSValueCenter: | 
| -            alignmentData.setPosition(primitiveValue.convertTo<ContentPosition>()); | 
| +            alignmentData.setPosition(identifierValue.convertTo<ContentPosition>()); | 
| break; | 
| default: | 
| ASSERT_NOT_REACHED(); | 
| @@ -457,8 +456,8 @@ GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, con | 
| const CSSValueList& list = toCSSValueList(value); | 
|  | 
| ASSERT(list.length() >= 1); | 
| -    const CSSPrimitiveValue& first = toCSSPrimitiveValue(list.item(0)); | 
| -    const CSSPrimitiveValue* second = list.length() == 2 ? &toCSSPrimitiveValue(list.item(1)) : nullptr; | 
| +    const CSSIdentifierValue& first = toCSSIdentifierValue(list.item(0)); | 
| +    const CSSIdentifierValue* second = list.length() == 2 ? &toCSSIdentifierValue(list.item(1)) : nullptr; | 
|  | 
| switch (first.getValueID()) { | 
| case CSSValueRow: | 
| @@ -493,8 +492,8 @@ GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, con | 
| return position; | 
| } | 
|  | 
| -    if (value.isPrimitiveValue()) { | 
| -        ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueAuto); | 
| +    if (value.isIdentifierValue()) { | 
| +        DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueAuto); | 
| return position; | 
| } | 
|  | 
| @@ -508,7 +507,7 @@ GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, con | 
|  | 
| auto it = values.begin(); | 
| const CSSValue* currentValue = it->get(); | 
| -    if (currentValue->isPrimitiveValue() && toCSSPrimitiveValue(currentValue)->getValueID() == CSSValueSpan) { | 
| +    if (currentValue->isIdentifierValue() && toCSSIdentifierValue(currentValue)->getValueID() == CSSValueSpan) { | 
| isSpanPosition = true; | 
| ++it; | 
| currentValue = it != values.end() ? it->get() : nullptr; | 
| @@ -536,18 +535,18 @@ GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, con | 
|  | 
| GridTrackSize StyleBuilderConverter::convertGridTrackSize(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    if (value.isPrimitiveValue()) | 
| -        return GridTrackSize(convertGridTrackBreadth(state, toCSSPrimitiveValue(value))); | 
| +    if (value.isPrimitiveValue() || value.isIdentifierValue()) | 
| +        return GridTrackSize(convertGridTrackBreadth(state, value)); | 
|  | 
| auto& function = toCSSFunctionValue(value); | 
| if (function.functionType() == CSSValueFitContent) { | 
| SECURITY_DCHECK(function.length() == 1); | 
| -        return GridTrackSize(convertGridTrackBreadth(state, toCSSPrimitiveValue(function.item(0))), FitContentTrackSizing); | 
| +        return GridTrackSize(convertGridTrackBreadth(state, function.item(0)), FitContentTrackSizing); | 
| } | 
|  | 
| SECURITY_DCHECK(function.length() == 2); | 
| -    GridLength minTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValue(function.item(0)))); | 
| -    GridLength maxTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValue(function.item(1)))); | 
| +    GridLength minTrackBreadth(convertGridTrackBreadth(state, function.item(0))); | 
| +    GridLength maxTrackBreadth(convertGridTrackBreadth(state, function.item(1))); | 
| return GridTrackSize(minTrackBreadth, maxTrackBreadth); | 
| } | 
|  | 
| @@ -578,8 +577,8 @@ Vector<GridTrackSize> StyleBuilderConverter::convertGridTrackSizeList(StyleResol | 
|  | 
| void StyleBuilderConverter::convertGridTrackList(const CSSValue& value, Vector<GridTrackSize>& trackSizes, NamedGridLinesMap& namedGridLines, OrderedNamedGridLines& orderedNamedGridLines, Vector<GridTrackSize>& autoRepeatTrackSizes, NamedGridLinesMap& autoRepeatNamedGridLines, OrderedNamedGridLines& autoRepeatOrderedNamedGridLines, size_t& autoRepeatInsertionPoint, AutoRepeatType &autoRepeatType, StyleResolverState& state) | 
| { | 
| -    if (value.isPrimitiveValue()) { | 
| -        ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 
| +    if (value.isIdentifierValue()) { | 
| +        DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 
| return; | 
| } | 
|  | 
| @@ -666,18 +665,18 @@ UnzoomedLength StyleBuilderConverter::convertUnzoomedLength(const StyleResolverS | 
|  | 
| Length StyleBuilderConverter::convertLengthOrAuto(const StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    if (primitiveValue.getValueID() == CSSValueAuto) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueAuto) | 
| return Length(Auto); | 
| -    return primitiveValue.convertToLength(state.cssToLengthConversionData()); | 
| +    return toCSSPrimitiveValue(value).convertToLength(state.cssToLengthConversionData()); | 
| } | 
|  | 
| Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    switch (primitiveValue.getValueID()) { | 
| -    case CSSValueInvalid: | 
| +    if (!value.isIdentifierValue()) | 
| return convertLength(state, value); | 
| + | 
| +    const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); | 
| +    switch (identifierValue.getValueID()) { | 
| case CSSValueMinContent: | 
| case CSSValueWebkitMinContent: | 
| return Length(MinContent); | 
| @@ -699,8 +698,7 @@ Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state, con | 
|  | 
| Length StyleBuilderConverter::convertLengthMaxSizing(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    if (primitiveValue.getValueID() == CSSValueNone) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNone) | 
| return Length(MaxSizeNone); | 
| return convertLengthSizing(state, value); | 
| } | 
| @@ -723,20 +721,21 @@ static CSSToLengthConversionData lineHeightToLengthConversionData(StyleResolverS | 
|  | 
| Length StyleBuilderConverter::convertLineHeight(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| - | 
| -    if (primitiveValue.isLength()) | 
| -        return primitiveValue.computeLength<Length>(lineHeightToLengthConversionData(state)); | 
| -    if (primitiveValue.isPercentage()) | 
| -        return Length((state.style()->computedFontSize() * primitiveValue.getIntValue()) / 100.0, Fixed); | 
| -    if (primitiveValue.isNumber()) | 
| -        return Length(primitiveValue.getDoubleValue() * 100.0, Percent); | 
| -    if (primitiveValue.isCalculated()) { | 
| -        Length zoomedLength = Length(primitiveValue.cssCalcValue()->toCalcValue(lineHeightToLengthConversionData(state))); | 
| -        return Length(valueForLength(zoomedLength, LayoutUnit(state.style()->computedFontSize())), Fixed); | 
| +    if (value.isPrimitiveValue()) { | 
| +        const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| +        if (primitiveValue.isLength()) | 
| +            return primitiveValue.computeLength<Length>(lineHeightToLengthConversionData(state)); | 
| +        if (primitiveValue.isPercentage()) | 
| +            return Length((state.style()->computedFontSize() * primitiveValue.getIntValue()) / 100.0, Fixed); | 
| +        if (primitiveValue.isNumber()) | 
| +            return Length(primitiveValue.getDoubleValue() * 100.0, Percent); | 
| +        if (primitiveValue.isCalculated()) { | 
| +            Length zoomedLength = Length(primitiveValue.cssCalcValue()->toCalcValue(lineHeightToLengthConversionData(state))); | 
| +            return Length(valueForLength(zoomedLength, LayoutUnit(state.style()->computedFontSize())), Fixed); | 
| +        } | 
| } | 
|  | 
| -    ASSERT(primitiveValue.getValueID() == CSSValueNormal); | 
| +    DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNormal); | 
| return ComputedStyle::initialLineHeight(); | 
| } | 
|  | 
| @@ -761,13 +760,13 @@ StyleOffsetRotation StyleBuilderConverter::convertOffsetRotation(const CSSValue& | 
| const CSSValueList& list = toCSSValueList(value); | 
| ASSERT(list.length() == 1 || list.length() == 2); | 
| for (const auto& item : list) { | 
| -        const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item); | 
| -        if (primitiveValue.getValueID() == CSSValueAuto) { | 
| +        if (item->isIdentifierValue() && toCSSIdentifierValue(*item).getValueID() == CSSValueAuto) { | 
| result.type = OffsetRotationAuto; | 
| -        } else if (primitiveValue.getValueID() == CSSValueReverse) { | 
| +        } else if (item->isIdentifierValue() && toCSSIdentifierValue(*item).getValueID() == CSSValueReverse) { | 
| result.type = OffsetRotationAuto; | 
| result.angle += 180; | 
| } else { | 
| +            const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item); | 
| result.angle += primitiveValue.computeDegrees(); | 
| } | 
| } | 
| @@ -782,15 +781,14 @@ Length StyleBuilderConverter::convertPositionLength(StyleResolverState& state, c | 
| if (value.isValuePair()) { | 
| const CSSValuePair& pair = toCSSValuePair(value); | 
| Length length = StyleBuilderConverter::convertLength(state, pair.second()); | 
| -        if (toCSSPrimitiveValue(pair.first()).getValueID() == cssValueFor0) | 
| +        if (toCSSIdentifierValue(pair.first()).getValueID() == cssValueFor0) | 
| return length; | 
| -        ASSERT(toCSSPrimitiveValue(pair.first()).getValueID() == cssValueFor100); | 
| +        DCHECK_EQ(toCSSIdentifierValue(pair.first()).getValueID(), cssValueFor100); | 
| return length.subtractFromOneHundredPercent(); | 
| } | 
|  | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    if (primitiveValue.isValueID()) { | 
| -        switch (primitiveValue.getValueID()) { | 
| +    if (value.isIdentifierValue()) { | 
| +        switch (toCSSIdentifierValue(value).getValueID()) { | 
| case cssValueFor0: | 
| return Length(0, Percent); | 
| case cssValueFor100: | 
| @@ -802,7 +800,7 @@ Length StyleBuilderConverter::convertPositionLength(StyleResolverState& state, c | 
| } | 
| } | 
|  | 
| -    return StyleBuilderConverter::convertLength(state, primitiveValue); | 
| +    return StyleBuilderConverter::convertLength(state, toCSSPrimitiveValue(value)); | 
| } | 
|  | 
| LengthPoint StyleBuilderConverter::convertPosition(StyleResolverState& state, const CSSValue& value) | 
| @@ -818,7 +816,7 @@ LengthPoint StyleBuilderConverter::convertPositionOrAuto(StyleResolverState& sta | 
| { | 
| if (value.isValuePair()) | 
| return convertPosition(state, value); | 
| -    DCHECK(toCSSPrimitiveValue(value).getValueID() == CSSValueAuto); | 
| +    DCHECK(toCSSIdentifierValue(value).getValueID() == CSSValueAuto); | 
| return LengthPoint(Length(Auto), Length(Auto)); | 
| } | 
|  | 
| @@ -829,18 +827,16 @@ static float convertPerspectiveLength(StyleResolverState& state, const CSSPrimit | 
|  | 
| float StyleBuilderConverter::convertPerspective(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| - | 
| -    if (primitiveValue.getValueID() == CSSValueNone) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNone) | 
| return ComputedStyle::initialPerspective(); | 
| -    return convertPerspectiveLength(state, primitiveValue); | 
| +    return convertPerspectiveLength(state, toCSSPrimitiveValue(value)); | 
| } | 
|  | 
| EPaintOrder StyleBuilderConverter::convertPaintOrder(StyleResolverState&, const CSSValue& cssPaintOrder) | 
| { | 
| if (cssPaintOrder.isValueList()) { | 
| const CSSValueList& orderTypeList = toCSSValueList(cssPaintOrder); | 
| -        switch (toCSSPrimitiveValue(orderTypeList.item(0)).getValueID()) { | 
| +        switch (toCSSIdentifierValue(orderTypeList.item(0)).getValueID()) { | 
| case CSSValueFill: | 
| return orderTypeList.length() > 1 ? PaintOrderFillMarkersStroke : PaintOrderFillStrokeMarkers; | 
| case CSSValueStroke: | 
| @@ -860,7 +856,7 @@ Length StyleBuilderConverter::convertQuirkyLength(StyleResolverState& state, con | 
| { | 
| Length length = convertLengthOrAuto(state, value); | 
| // This is only for margins which use __qem | 
| -    length.setQuirk(toCSSPrimitiveValue(value).isQuirkyEms()); | 
| +    length.setQuirk(value.isPrimitiveValue() && toCSSPrimitiveValue(value).isQuirkyEms()); | 
| return length; | 
| } | 
|  | 
| @@ -876,7 +872,7 @@ PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&, | 
| } | 
| return quotes.release(); | 
| } | 
| -    ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 
| +    DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 
| return QuotesData::create(); | 
| } | 
|  | 
| @@ -890,8 +886,8 @@ LengthSize StyleBuilderConverter::convertRadius(StyleResolverState& state, const | 
|  | 
| PassRefPtr<ShadowList> StyleBuilderConverter::convertShadow(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    if (value.isPrimitiveValue()) { | 
| -        ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 
| +    if (value.isIdentifierValue()) { | 
| +        DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 
| return PassRefPtr<ShadowList>(); | 
| } | 
|  | 
| @@ -915,8 +911,8 @@ PassRefPtr<ShadowList> StyleBuilderConverter::convertShadow(StyleResolverState& | 
|  | 
| ShapeValue* StyleBuilderConverter::convertShapeValue(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    if (value.isPrimitiveValue()) { | 
| -        ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 
| +    if (value.isIdentifierValue()) { | 
| +        DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 
| return nullptr; | 
| } | 
|  | 
| @@ -931,7 +927,7 @@ ShapeValue* StyleBuilderConverter::convertShapeValue(StyleResolverState& state, | 
| if (value.isBasicShapeValue()) { | 
| shape = basicShapeForValue(state, value); | 
| } else { | 
| -            cssBox = toCSSPrimitiveValue(value).convertTo<CSSBoxType>(); | 
| +            cssBox = toCSSIdentifierValue(value).convertTo<CSSBoxType>(); | 
| } | 
| } | 
|  | 
| @@ -944,10 +940,9 @@ ShapeValue* StyleBuilderConverter::convertShapeValue(StyleResolverState& state, | 
|  | 
| float StyleBuilderConverter::convertSpacing(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    if (primitiveValue.getValueID() == CSSValueNormal) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNormal) | 
| return 0; | 
| -    return primitiveValue.computeLength<float>(state.cssToLengthConversionData()); | 
| +    return toCSSPrimitiveValue(value).computeLength<float>(state.cssToLengthConversionData()); | 
| } | 
|  | 
| PassRefPtr<SVGDashArray> StyleBuilderConverter::convertStrokeDasharray(StyleResolverState& state, const CSSValue& value) | 
| @@ -968,28 +963,27 @@ PassRefPtr<SVGDashArray> StyleBuilderConverter::convertStrokeDasharray(StyleReso | 
|  | 
| StyleColor StyleBuilderConverter::convertStyleColor(StyleResolverState& state, const CSSValue& value, bool forVisitedLink) | 
| { | 
| -    if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueCurrentcolor) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueCurrentcolor) | 
| return StyleColor::currentColor(); | 
| return state.document().textLinkColors().colorFromCSSValue(value, Color(), forVisitedLink); | 
| } | 
|  | 
| float StyleBuilderConverter::convertTextStrokeWidth(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    if (primitiveValue.getValueID()) { | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID()) { | 
| float multiplier = convertLineWidth<float>(state, value); | 
| return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::UnitType::Ems)->computeLength<float>(state.cssToLengthConversionData()); | 
| } | 
| -    return primitiveValue.computeLength<float>(state.cssToLengthConversionData()); | 
| +    return toCSSPrimitiveValue(value).computeLength<float>(state.cssToLengthConversionData()); | 
| } | 
|  | 
| TextSizeAdjust StyleBuilderConverter::convertTextSizeAdjust(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    if (primitiveValue.getValueID() == CSSValueNone) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNone) | 
| return TextSizeAdjust::adjustNone(); | 
| -    if (primitiveValue.getValueID() == CSSValueAuto) | 
| +    if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueAuto) | 
| return TextSizeAdjust::adjustAuto(); | 
| +    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| DCHECK(primitiveValue.isPercentage()); | 
| return TextSizeAdjust(primitiveValue.getFloatValue() / 100.0f); | 
| } | 
| @@ -997,16 +991,15 @@ TextSizeAdjust StyleBuilderConverter::convertTextSizeAdjust(StyleResolverState& | 
| TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState& state, const CSSValue& value) | 
| { | 
| const CSSValueList& list = toCSSValueList(value); | 
| -    ASSERT(list.length() == 3); | 
| - | 
| -    const CSSPrimitiveValue& primitiveValueX = toCSSPrimitiveValue(list.item(0)); | 
| -    const CSSPrimitiveValue& primitiveValueY = toCSSPrimitiveValue(list.item(1)); | 
| -    const CSSPrimitiveValue& primitiveValueZ = toCSSPrimitiveValue(list.item(2)); | 
| +    DCHECK_EQ(list.length(), 3U); | 
| +    DCHECK(list.item(0).isPrimitiveValue() || list.item(0).isIdentifierValue()); | 
| +    DCHECK(list.item(1).isPrimitiveValue() || list.item(1).isIdentifierValue()); | 
| +    DCHECK(list.item(2).isPrimitiveValue()); | 
|  | 
| return TransformOrigin( | 
| -        convertPositionLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX), | 
| -        convertPositionLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY), | 
| -        StyleBuilderConverter::convertComputedLength<float>(state, primitiveValueZ) | 
| +        convertPositionLength<CSSValueLeft, CSSValueRight>(state, list.item(0)), | 
| +        convertPositionLength<CSSValueTop, CSSValueBottom>(state, list.item(1)), | 
| +        StyleBuilderConverter::convertComputedLength<float>(state, list.item(2)) | 
| ); | 
| } | 
|  | 
| @@ -1097,15 +1090,14 @@ PassRefPtr<ScaleTransformOperation> StyleBuilderConverter::convertScale(StyleRes | 
|  | 
| RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(StyleResolverState& state, const CSSValue& value) | 
| { | 
| -    const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 
| -    return primitiveValue.getValueID() == CSSValueFromImage ? RespectImageOrientation : DoNotRespectImageOrientation; | 
| +    return value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueFromImage ? RespectImageOrientation : DoNotRespectImageOrientation; | 
| } | 
|  | 
| PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverState& state, const CSSValue& value) | 
| { | 
| if (value.isPathValue()) | 
| return toCSSPathValue(value).stylePath(); | 
| -    ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 
| +    DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 
| return nullptr; | 
| } | 
|  | 
|  |