| Index: Source/core/css/parser/CSSPropertyParser.cpp
|
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
|
| index 113724f4d307a3fba6222cdf0442e502f3397cf4..604179f100eedc06dbfaf8c1c2bf254ac076fa47 100644
|
| --- a/Source/core/css/parser/CSSPropertyParser.cpp
|
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp
|
| @@ -75,7 +75,7 @@ static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N])
|
| return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF::equalIgnoringCase(b, a.characters16(), length);
|
| }
|
|
|
| -static CSSPrimitiveValue createPrimitiveValuePair(CSSPrimitiveValue first, CSSPrimitiveValue second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues)
|
| +static CSSPrimitiveValue createPrimitiveValuePair(const CSSPrimitiveValue& first, const CSSPrimitiveValue& second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues)
|
| {
|
| return cssValuePool().createValue(Pair::create(first, second, identicalValuesPolicy));
|
| }
|
| @@ -122,7 +122,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| return parseSuccess;
|
| }
|
|
|
| -void CSSPropertyParser::addProperty(CSSPropertyID propId, CSSValue value, bool important, bool implicit)
|
| +void CSSPropertyParser::addProperty(CSSPropertyID propId, const CSSValue& value, bool important, bool implicit)
|
| {
|
| ASSERT(!isPropertyAlias(propId));
|
|
|
| @@ -519,7 +519,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| ShorthandScope scope(this, CSSPropertyBorderSpacing);
|
| if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important))
|
| return false;
|
| - CSSValue value = m_parsedProperties.last().value();
|
| + const CSSValue& value = m_parsedProperties.last().value();
|
| addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important);
|
| return true;
|
| }
|
| @@ -1561,7 +1561,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| return false;
|
| }
|
|
|
| -void CSSPropertyParser::addFillValue(NullableCSSValue& lval, CSSValue rval)
|
| +void CSSPropertyParser::addFillValue(NullableCSSValue& lval, const CSSValue& rval)
|
| {
|
| if (lval) {
|
| if (lval->isBaseValueList())
|
| @@ -1750,7 +1750,7 @@ static bool isValidTransitionPropertyList(CSSValueList* value)
|
| // FIXME: Shorthand parsing shouldn't add initial to the list since it won't round-trip
|
| if (property.isInitialValue())
|
| continue;
|
| - CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(property);
|
| + const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(property);
|
| if (primitiveValue.isValueID() && primitiveValue.getValueID() == CSSValueNone)
|
| return false;
|
| }
|
| @@ -2016,7 +2016,7 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
|
| case 1: {
|
| if (!parseValue(properties[0], important))
|
| return false;
|
| - CSSValue value = m_parsedProperties.last().value();
|
| + const CSSValue& value = m_parsedProperties.last().value();
|
| ImplicitScope implicitScope(this);
|
| addProperty(properties[1], value, important);
|
| addProperty(properties[2], value, important);
|
| @@ -2026,17 +2026,16 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
|
| case 2: {
|
| if (!parseValue(properties[0], important) || !parseValue(properties[1], important))
|
| return false;
|
| - CSSValue value = m_parsedProperties[m_parsedProperties.size() - 2].value();
|
| + const CSSValue& value = m_parsedProperties[m_parsedProperties.size() - 2].value();
|
| ImplicitScope implicitScope(this);
|
| addProperty(properties[2], value, important);
|
| - value = m_parsedProperties[m_parsedProperties.size() - 2].value();
|
| addProperty(properties[3], value, important);
|
| break;
|
| }
|
| case 3: {
|
| if (!parseValue(properties[0], important) || !parseValue(properties[1], important) || !parseValue(properties[2], important))
|
| return false;
|
| - CSSValue value = m_parsedProperties[m_parsedProperties.size() - 2].value();
|
| + const CSSValue& value = m_parsedProperties[m_parsedProperties.size() - 2].value();
|
| ImplicitScope implicitScope(this);
|
| addProperty(properties[3], value, important);
|
| break;
|
| @@ -2483,7 +2482,7 @@ static bool isFillPositionKeyword(CSSValueID value)
|
| return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBottom || value == CSSValueRight || value == CSSValueCenter;
|
| }
|
|
|
| -void CSSPropertyParser::parse4ValuesFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& value2, CSSPrimitiveValue parsedValue1, CSSPrimitiveValue parsedValue2)
|
| +void CSSPropertyParser::parse4ValuesFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& value2, const CSSPrimitiveValue& parsedValue1, const CSSPrimitiveValue& parsedValue2)
|
| {
|
| // [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <percentage> | <length> ]
|
| // In the case of 4 values <position> requires the second value to be a length or a percentage.
|
| @@ -2531,7 +2530,7 @@ void CSSPropertyParser::parse4ValuesFillPosition(CSSParserValueList* valueList,
|
|
|
| valueList->next();
|
| }
|
| -void CSSPropertyParser::parse3ValuesFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& value2, CSSPrimitiveValue parsedValue1, CSSPrimitiveValue parsedValue2)
|
| +void CSSPropertyParser::parse3ValuesFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& value2, const CSSPrimitiveValue& parsedValue1, const CSSPrimitiveValue& parsedValue2)
|
| {
|
| unsigned cumulativeFlags = 0;
|
| FillPositionFlag value3Flag = InvalidFillPosition;
|
| @@ -2613,10 +2612,10 @@ void CSSPropertyParser::parse3ValuesFillPosition(CSSParserValueList* valueList,
|
| value1.swap(value2);
|
|
|
| #if ENABLE(ASSERT)
|
| - CSSPrimitiveValue first = toCSSPrimitiveValue(*value1);
|
| - CSSPrimitiveValue second = toCSSPrimitiveValue(*value2);
|
| - ident1 = toCSSPrimitiveValue(*first.getPairValue()->first()).getValueID();
|
| - ident2 = toCSSPrimitiveValue(*second.getPairValue()->first()).getValueID();
|
| + const CSSPrimitiveValue& first = toCSSPrimitiveValue(*value1);
|
| + const CSSPrimitiveValue& second = toCSSPrimitiveValue(*value2);
|
| + ident1 = first.getPairValue()->first().getValueID();
|
| + ident2 = second.getPairValue()->first().getValueID();
|
| ASSERT(ident1 == CSSValueLeft || ident1 == CSSValueRight);
|
| ASSERT(ident2 == CSSValueBottom || ident2 == CSSValueTop);
|
| #endif
|
| @@ -2674,6 +2673,7 @@ void CSSPropertyParser::parseFillPosition(CSSParserValueList* valueList, Nullabl
|
| return;
|
| }
|
|
|
| + // Explicitly make copies.
|
| CSSPrimitiveValue parsedValue1 = toCSSPrimitiveValue(*value1);
|
| CSSPrimitiveValue parsedValue2 = toCSSPrimitiveValue(*value2);
|
|
|
| @@ -5218,7 +5218,7 @@ public:
|
| allowStyle = property == CSSPropertyBoxShadow;
|
| }
|
|
|
| - void commitLength(CSSPrimitiveValue val)
|
| + void commitLength(const CSSPrimitiveValue& val)
|
| {
|
| if (allowX) {
|
| x = val;
|
| @@ -5244,7 +5244,7 @@ public:
|
| }
|
| }
|
|
|
| - void commitColor(CSSPrimitiveValue val)
|
| + void commitColor(const CSSPrimitiveValue& val)
|
| {
|
| color = val;
|
| allowColor = false;
|
| @@ -5531,7 +5531,7 @@ public:
|
| m_allowWidth = false;
|
| }
|
| }
|
| - void commitBorderWidth(CSSPrimitiveValue width)
|
| + void commitBorderWidth(const CSSPrimitiveValue& width)
|
| {
|
| m_borderWidth = width;
|
| m_canAdvance = true;
|
| @@ -5543,7 +5543,7 @@ public:
|
| m_allowImage = !m_image;
|
| m_allowRepeat = !m_repeat;
|
| }
|
| - void commitBorderOutset(CSSPrimitiveValue outset)
|
| + void commitBorderOutset(const CSSPrimitiveValue& outset)
|
| {
|
| m_outset = outset;
|
| m_canAdvance = true;
|
| @@ -5653,7 +5653,7 @@ bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
|
| return context.allowCommit();
|
| }
|
|
|
| -void CSSPropertyParser::commitBorderImageProperty(CSSPropertyID propId, NullableCSSValue value, bool important)
|
| +void CSSPropertyParser::commitBorderImageProperty(CSSPropertyID propId, const NullableCSSValue& value, bool important)
|
| {
|
| if (value)
|
| addProperty(propId, *value, important);
|
| @@ -5747,9 +5747,9 @@ public:
|
| bool allowNumber() const { return m_allowNumber; }
|
| bool allowFill() const { return m_allowFill; }
|
| bool allowFinalCommit() const { return m_allowFinalCommit; }
|
| - NullableCSSValue top() const { return m_top; }
|
| + const NullableCSSValue& top() const { return m_top; }
|
|
|
| - void commitNumber(CSSPrimitiveValue val)
|
| + void commitNumber(const CSSPrimitiveValue& val)
|
| {
|
| if (!m_top)
|
| m_top = val;
|
| @@ -5853,9 +5853,9 @@ public:
|
|
|
| bool allowNumber() const { return m_allowNumber; }
|
| bool allowFinalCommit() const { return m_allowFinalCommit; }
|
| - NullableCSSValue top() const { return m_top; }
|
| + const NullableCSSValue& top() const { return m_top; }
|
|
|
| - void commitNumber(CSSPrimitiveValue val)
|
| + void commitNumber(const CSSPrimitiveValue& val)
|
| {
|
| if (!m_top)
|
| m_top = val;
|
| @@ -5872,9 +5872,9 @@ public:
|
| m_allowFinalCommit = true;
|
| }
|
|
|
| - void setTop(CSSPrimitiveValue val) { m_top = val; }
|
| + void setTop(const CSSPrimitiveValue& val) { m_top = val; }
|
|
|
| - CSSPrimitiveValue commitBorderImageQuad()
|
| + const CSSPrimitiveValue commitBorderImageQuad()
|
| {
|
| // We need to clone and repeat values for any omissions.
|
| ASSERT(m_top);
|
|
|