OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF
::equalIgnoringCase(b, a.characters16(), length); | 126 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF
::equalIgnoringCase(b, a.characters16(), length); |
127 } | 127 } |
128 | 128 |
129 template <unsigned N> | 129 template <unsigned N> |
130 static bool equalIgnoringCase(CSSParserValue* value, const char (&b)[N]) | 130 static bool equalIgnoringCase(CSSParserValue* value, const char (&b)[N]) |
131 { | 131 { |
132 ASSERT(value->unit == CSSPrimitiveValue::CSS_IDENT || value->unit == CSSPrim
itiveValue::CSS_STRING); | 132 ASSERT(value->unit == CSSPrimitiveValue::CSS_IDENT || value->unit == CSSPrim
itiveValue::CSS_STRING); |
133 return equalIgnoringCase(value->string, b); | 133 return equalIgnoringCase(value->string, b); |
134 } | 134 } |
135 | 135 |
136 static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrim
itiveValue> first, PassRefPtr<CSSPrimitiveValue> second, Pair::IdenticalValuesPo
licy identicalValuesPolicy = Pair::DropIdenticalValues) | 136 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe
fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa
lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent
icalValues) |
137 { | 137 { |
138 return cssValuePool().createValue(Pair::create(first, second, identicalValue
sPolicy)); | 138 return cssValuePool().createValue(Pair::create(first, second, identicalValue
sPolicy)); |
139 } | 139 } |
140 | 140 |
141 class AnimationParseContext { | 141 class AnimationParseContext { |
142 public: | 142 public: |
143 AnimationParseContext() | 143 AnimationParseContext() |
144 : m_animationPropertyKeywordAllowed(true) | 144 : m_animationPropertyKeywordAllowed(true) |
145 , m_firstAnimationCommitted(false) | 145 , m_firstAnimationCommitted(false) |
146 , m_hasSeenAnimationPropertyKeyword(false) | 146 , m_hasSeenAnimationPropertyKeyword(false) |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 case CSSPrimitiveValue::CSS_KHZ: | 1527 case CSSPrimitiveValue::CSS_KHZ: |
1528 case CSSPrimitiveValue::CSS_DIMENSION: | 1528 case CSSPrimitiveValue::CSS_DIMENSION: |
1529 default: | 1529 default: |
1530 break; | 1530 break; |
1531 } | 1531 } |
1532 if (b && unitflags & FNonNeg && value->fValue < 0) | 1532 if (b && unitflags & FNonNeg && value->fValue < 0) |
1533 b = false; | 1533 b = false; |
1534 return b; | 1534 return b; |
1535 } | 1535 } |
1536 | 1536 |
1537 inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveNumericValue
(CSSParserValue* value) | 1537 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitive
NumericValue(CSSParserValue* value) |
1538 { | 1538 { |
1539 if (m_parsedCalculation) { | 1539 if (m_parsedCalculation) { |
1540 ASSERT(isCalculation(value)); | 1540 ASSERT(isCalculation(value)); |
1541 return CSSPrimitiveValue::create(m_parsedCalculation.release()); | 1541 return CSSPrimitiveValue::create(m_parsedCalculation.release()); |
1542 } | 1542 } |
1543 | 1543 |
1544 ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPr
imitiveValue::CSS_KHZ) | 1544 ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPr
imitiveValue::CSS_KHZ) |
1545 || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrim
itiveValue::CSS_CHS) | 1545 || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrim
itiveValue::CSS_CHS) |
1546 || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimit
iveValue::CSS_VMAX) | 1546 || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimit
iveValue::CSS_VMAX) |
1547 || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrim
itiveValue::CSS_DPCM)); | 1547 || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrim
itiveValue::CSS_DPCM)); |
1548 return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveVal
ue::UnitTypes>(value->unit)); | 1548 return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveVal
ue::UnitTypes>(value->unit)); |
1549 } | 1549 } |
1550 | 1550 |
1551 inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveStringValue(
CSSParserValue* value) | 1551 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitive
StringValue(CSSParserValue* value) |
1552 { | 1552 { |
1553 ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPri
mitiveValue::CSS_IDENT); | 1553 ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPri
mitiveValue::CSS_IDENT); |
1554 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRI
NG); | 1554 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRI
NG); |
1555 } | 1555 } |
1556 | 1556 |
1557 static inline bool isComma(CSSParserValue* value) | 1557 static inline bool isComma(CSSParserValue* value) |
1558 { | 1558 { |
1559 return value && value->unit == CSSParserValue::Operator && value->iValue ==
','; | 1559 return value && value->unit == CSSParserValue::Operator && value->iValue ==
','; |
1560 } | 1560 } |
1561 | 1561 |
(...skipping 22 matching lines...) Expand all Loading... |
1584 } | 1584 } |
1585 | 1585 |
1586 bool BisonCSSParser::validWidthOrHeight(CSSParserValue* value) | 1586 bool BisonCSSParser::validWidthOrHeight(CSSParserValue* value) |
1587 { | 1587 { |
1588 int id = value->id; | 1588 int id = value->id; |
1589 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW
ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva
ilable || id == CSSValueWebkitFitContent) | 1589 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW
ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva
ilable || id == CSSValueWebkitFitContent) |
1590 return true; | 1590 return true; |
1591 return !id && validUnit(value, FLength | FPercent | FNonNeg); | 1591 return !id && validUnit(value, FLength | FPercent | FNonNeg); |
1592 } | 1592 } |
1593 | 1593 |
1594 inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseValidPrimitive(CSSValu
eID identifier, CSSParserValue* value) | 1594 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseValidPrimi
tive(CSSValueID identifier, CSSParserValue* value) |
1595 { | 1595 { |
1596 if (identifier) | 1596 if (identifier) |
1597 return cssValuePool().createIdentifierValue(identifier); | 1597 return cssValuePool().createIdentifierValue(identifier); |
1598 if (value->unit == CSSPrimitiveValue::CSS_STRING) | 1598 if (value->unit == CSSPrimitiveValue::CSS_STRING) |
1599 return createPrimitiveStringValue(value); | 1599 return createPrimitiveStringValue(value); |
1600 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit
iveValue::CSS_KHZ) | 1600 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit
iveValue::CSS_KHZ) |
1601 return createPrimitiveNumericValue(value); | 1601 return createPrimitiveNumericValue(value); |
1602 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv
eValue::CSS_CHS) | 1602 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv
eValue::CSS_CHS) |
1603 return createPrimitiveNumericValue(value); | 1603 return createPrimitiveNumericValue(value); |
1604 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV
alue::CSS_VMAX) | 1604 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV
alue::CSS_VMAX) |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 case CSSPropertyWebkitBorderImage: { | 2139 case CSSPropertyWebkitBorderImage: { |
2140 if (RefPtr<CSSValue> result = parseBorderImage(propId)) { | 2140 if (RefPtr<CSSValue> result = parseBorderImage(propId)) { |
2141 addProperty(propId, result, important); | 2141 addProperty(propId, result, important); |
2142 return true; | 2142 return true; |
2143 } | 2143 } |
2144 return false; | 2144 return false; |
2145 } | 2145 } |
2146 | 2146 |
2147 case CSSPropertyBorderImageOutset: | 2147 case CSSPropertyBorderImageOutset: |
2148 case CSSPropertyWebkitMaskBoxImageOutset: { | 2148 case CSSPropertyWebkitMaskBoxImageOutset: { |
2149 RefPtr<CSSPrimitiveValue> result; | 2149 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; |
2150 if (parseBorderImageOutset(result)) { | 2150 if (parseBorderImageOutset(result)) { |
2151 addProperty(propId, result, important); | 2151 addProperty(propId, result, important); |
2152 return true; | 2152 return true; |
2153 } | 2153 } |
2154 break; | 2154 break; |
2155 } | 2155 } |
2156 case CSSPropertyBorderImageRepeat: | 2156 case CSSPropertyBorderImageRepeat: |
2157 case CSSPropertyWebkitMaskBoxImageRepeat: { | 2157 case CSSPropertyWebkitMaskBoxImageRepeat: { |
2158 RefPtr<CSSValue> result; | 2158 RefPtr<CSSValue> result; |
2159 if (parseBorderImageRepeat(result)) { | 2159 if (parseBorderImageRepeat(result)) { |
2160 addProperty(propId, result, important); | 2160 addProperty(propId, result, important); |
2161 return true; | 2161 return true; |
2162 } | 2162 } |
2163 break; | 2163 break; |
2164 } | 2164 } |
2165 case CSSPropertyBorderImageSlice: | 2165 case CSSPropertyBorderImageSlice: |
2166 case CSSPropertyWebkitMaskBoxImageSlice: { | 2166 case CSSPropertyWebkitMaskBoxImageSlice: { |
2167 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result; | 2167 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result; |
2168 if (parseBorderImageSlice(propId, result)) { | 2168 if (parseBorderImageSlice(propId, result)) { |
2169 addProperty(propId, result, important); | 2169 addProperty(propId, result, important); |
2170 return true; | 2170 return true; |
2171 } | 2171 } |
2172 break; | 2172 break; |
2173 } | 2173 } |
2174 case CSSPropertyBorderImageWidth: | 2174 case CSSPropertyBorderImageWidth: |
2175 case CSSPropertyWebkitMaskBoxImageWidth: { | 2175 case CSSPropertyWebkitMaskBoxImageWidth: { |
2176 RefPtr<CSSPrimitiveValue> result; | 2176 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; |
2177 if (parseBorderImageWidth(result)) { | 2177 if (parseBorderImageWidth(result)) { |
2178 addProperty(propId, result, important); | 2178 addProperty(propId, result, important); |
2179 return true; | 2179 return true; |
2180 } | 2180 } |
2181 break; | 2181 break; |
2182 } | 2182 } |
2183 case CSSPropertyBorderTopRightRadius: | 2183 case CSSPropertyBorderTopRightRadius: |
2184 case CSSPropertyBorderTopLeftRadius: | 2184 case CSSPropertyBorderTopLeftRadius: |
2185 case CSSPropertyBorderBottomLeftRadius: | 2185 case CSSPropertyBorderBottomLeftRadius: |
2186 case CSSPropertyBorderBottomRightRadius: { | 2186 case CSSPropertyBorderBottomRightRadius: { |
2187 if (num != 1 && num != 2) | 2187 if (num != 1 && num != 2) |
2188 return false; | 2188 return false; |
2189 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 2189 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
2190 if (!validPrimitive) | 2190 if (!validPrimitive) |
2191 return false; | 2191 return false; |
2192 RefPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(val
ue); | 2192 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNume
ricValue(value); |
2193 RefPtr<CSSPrimitiveValue> parsedValue2; | 2193 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2; |
2194 if (num == 2) { | 2194 if (num == 2) { |
2195 value = m_valueList->next(); | 2195 value = m_valueList->next(); |
2196 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 2196 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
2197 if (!validPrimitive) | 2197 if (!validPrimitive) |
2198 return false; | 2198 return false; |
2199 parsedValue2 = createPrimitiveNumericValue(value); | 2199 parsedValue2 = createPrimitiveNumericValue(value); |
2200 } else | 2200 } else |
2201 parsedValue2 = parsedValue1; | 2201 parsedValue2 = parsedValue1; |
2202 | 2202 |
2203 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par
sedValue2.release()), important); | 2203 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par
sedValue2.release()), important); |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 percent = 100; | 3631 percent = 100; |
3632 else if (id == CSSValueCenter) | 3632 else if (id == CSSValueCenter) |
3633 percent = 50; | 3633 percent = 50; |
3634 return cssValuePool().createValue(percent, CSSPrimitiveValue::CSS_PERCEN
TAGE); | 3634 return cssValuePool().createValue(percent, CSSPrimitiveValue::CSS_PERCEN
TAGE); |
3635 } | 3635 } |
3636 if (validUnit(valueList->current(), FPercent | FLength)) | 3636 if (validUnit(valueList->current(), FPercent | FLength)) |
3637 return createPrimitiveNumericValue(valueList->current()); | 3637 return createPrimitiveNumericValue(valueList->current()); |
3638 return 0; | 3638 return 0; |
3639 } | 3639 } |
3640 | 3640 |
3641 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseFillPositionComponent(CSSPars
erValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualF
lag, FillPositionParsingMode parsingMode) | 3641 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseFillPositionCompo
nent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag&
individualFlag, FillPositionParsingMode parsingMode) |
3642 { | 3642 { |
3643 CSSValueID id = valueList->current()->id; | 3643 CSSValueID id = valueList->current()->id; |
3644 if (id == CSSValueLeft || id == CSSValueTop || id == CSSValueRight || id ==
CSSValueBottom || id == CSSValueCenter) { | 3644 if (id == CSSValueLeft || id == CSSValueTop || id == CSSValueRight || id ==
CSSValueBottom || id == CSSValueCenter) { |
3645 int percent = 0; | 3645 int percent = 0; |
3646 if (id == CSSValueLeft || id == CSSValueRight) { | 3646 if (id == CSSValueLeft || id == CSSValueRight) { |
3647 if (cumulativeFlags & XFillPosition) | 3647 if (cumulativeFlags & XFillPosition) |
3648 return 0; | 3648 return 0; |
3649 cumulativeFlags |= XFillPosition; | 3649 cumulativeFlags |= XFillPosition; |
3650 individualFlag = XFillPosition; | 3650 individualFlag = XFillPosition; |
3651 if (id == CSSValueRight) | 3651 if (id == CSSValueRight) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3696 return true; | 3696 return true; |
3697 | 3697 |
3698 return false; | 3698 return false; |
3699 } | 3699 } |
3700 | 3700 |
3701 static bool isFillPositionKeyword(CSSValueID value) | 3701 static bool isFillPositionKeyword(CSSValueID value) |
3702 { | 3702 { |
3703 return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBot
tom || value == CSSValueRight || value == CSSValueCenter; | 3703 return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBot
tom || value == CSSValueRight || value == CSSValueCenter; |
3704 } | 3704 } |
3705 | 3705 |
3706 void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, Ref
Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> p
arsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2) | 3706 void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, Ref
Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimi
tiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2) |
3707 { | 3707 { |
3708 // [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <perce
ntage> | <length> ] | 3708 // [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <perce
ntage> | <length> ] |
3709 // In the case of 4 values <position> requires the second value to be a leng
th or a percentage. | 3709 // In the case of 4 values <position> requires the second value to be a leng
th or a percentage. |
3710 if (isFillPositionKeyword(parsedValue2->getValueID())) | 3710 if (isFillPositionKeyword(parsedValue2->getValueID())) |
3711 return; | 3711 return; |
3712 | 3712 |
3713 unsigned cumulativeFlags = 0; | 3713 unsigned cumulativeFlags = 0; |
3714 FillPositionFlag value3Flag = InvalidFillPosition; | 3714 FillPositionFlag value3Flag = InvalidFillPosition; |
3715 RefPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cum
ulativeFlags, value3Flag, ResolveValuesAsKeyword); | 3715 RefPtrWillBeRawPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(va
lueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); |
3716 if (!value3) | 3716 if (!value3) |
3717 return; | 3717 return; |
3718 | 3718 |
3719 CSSValueID ident1 = parsedValue1->getValueID(); | 3719 CSSValueID ident1 = parsedValue1->getValueID(); |
3720 CSSValueID ident3 = value3->getValueID(); | 3720 CSSValueID ident3 = value3->getValueID(); |
3721 | 3721 |
3722 if (ident1 == CSSValueCenter) | 3722 if (ident1 == CSSValueCenter) |
3723 return; | 3723 return; |
3724 | 3724 |
3725 if (!isFillPositionKeyword(ident3) || ident3 == CSSValueCenter) | 3725 if (!isFillPositionKeyword(ident3) || ident3 == CSSValueCenter) |
3726 return; | 3726 return; |
3727 | 3727 |
3728 // We need to check if the values are not conflicting, e.g. they are not on
the same edge. It is | 3728 // We need to check if the values are not conflicting, e.g. they are not on
the same edge. It is |
3729 // needed as the second call to parseFillPositionComponent was on purpose no
t checking it. In the | 3729 // needed as the second call to parseFillPositionComponent was on purpose no
t checking it. In the |
3730 // case of two values top 20px is invalid but in the case of 4 values it bec
omes valid. | 3730 // case of two values top 20px is invalid but in the case of 4 values it bec
omes valid. |
3731 if (isValueConflictingWithCurrentEdge(ident1, ident3)) | 3731 if (isValueConflictingWithCurrentEdge(ident1, ident3)) |
3732 return; | 3732 return; |
3733 | 3733 |
3734 valueList->next(); | 3734 valueList->next(); |
3735 | 3735 |
3736 cumulativeFlags = 0; | 3736 cumulativeFlags = 0; |
3737 FillPositionFlag value4Flag = InvalidFillPosition; | 3737 FillPositionFlag value4Flag = InvalidFillPosition; |
3738 RefPtr<CSSPrimitiveValue> value4 = parseFillPositionComponent(valueList, cum
ulativeFlags, value4Flag, ResolveValuesAsKeyword); | 3738 RefPtrWillBeRawPtr<CSSPrimitiveValue> value4 = parseFillPositionComponent(va
lueList, cumulativeFlags, value4Flag, ResolveValuesAsKeyword); |
3739 if (!value4) | 3739 if (!value4) |
3740 return; | 3740 return; |
3741 | 3741 |
3742 // 4th value must be a length or a percentage. | 3742 // 4th value must be a length or a percentage. |
3743 if (isFillPositionKeyword(value4->getValueID())) | 3743 if (isFillPositionKeyword(value4->getValueID())) |
3744 return; | 3744 return; |
3745 | 3745 |
3746 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); | 3746 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); |
3747 value2 = createPrimitiveValuePair(value3, value4); | 3747 value2 = createPrimitiveValuePair(value3, value4); |
3748 | 3748 |
3749 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) | 3749 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) |
3750 value1.swap(value2); | 3750 value1.swap(value2); |
3751 | 3751 |
3752 valueList->next(); | 3752 valueList->next(); |
3753 } | 3753 } |
3754 void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, Ref
Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> p
arsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2) | 3754 void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, Ref
Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimi
tiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2) |
3755 { | 3755 { |
3756 unsigned cumulativeFlags = 0; | 3756 unsigned cumulativeFlags = 0; |
3757 FillPositionFlag value3Flag = InvalidFillPosition; | 3757 FillPositionFlag value3Flag = InvalidFillPosition; |
3758 RefPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cum
ulativeFlags, value3Flag, ResolveValuesAsKeyword); | 3758 RefPtrWillBeRawPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(va
lueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); |
3759 | 3759 |
3760 // value3 is not an expected value, we return. | 3760 // value3 is not an expected value, we return. |
3761 if (!value3) | 3761 if (!value3) |
3762 return; | 3762 return; |
3763 | 3763 |
3764 valueList->next(); | 3764 valueList->next(); |
3765 | 3765 |
3766 bool swapNeeded = false; | 3766 bool swapNeeded = false; |
3767 CSSValueID ident1 = parsedValue1->getValueID(); | 3767 CSSValueID ident1 = parsedValue1->getValueID(); |
3768 CSSValueID ident2 = parsedValue2->getValueID(); | 3768 CSSValueID ident2 = parsedValue2->getValueID(); |
(...skipping 23 matching lines...) Expand all Loading... |
3792 return; | 3792 return; |
3793 | 3793 |
3794 secondPositionKeyword = CSSValueTop; | 3794 secondPositionKeyword = CSSValueTop; |
3795 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) { | 3795 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) { |
3796 secondPositionKeyword = CSSValueLeft; | 3796 secondPositionKeyword = CSSValueLeft; |
3797 swapNeeded = true; | 3797 swapNeeded = true; |
3798 } | 3798 } |
3799 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); | 3799 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); |
3800 value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(s
econdPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PER
CENTAGE)); | 3800 value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(s
econdPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PER
CENTAGE)); |
3801 } else { | 3801 } else { |
3802 RefPtr<CSSPrimitiveValue> firstPositionValue; | 3802 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue; |
3803 RefPtr<CSSPrimitiveValue> secondPositionValue; | 3803 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue; |
3804 | 3804 |
3805 if (isFillPositionKeyword(ident2)) { | 3805 if (isFillPositionKeyword(ident2)) { |
3806 // To match CSS grammar, we should only accept: [ center | left | ri
ght | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ]
. | 3806 // To match CSS grammar, we should only accept: [ center | left | ri
ght | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ]
. |
3807 ASSERT(ident2 != CSSValueCenter); | 3807 ASSERT(ident2 != CSSValueCenter); |
3808 | 3808 |
3809 if (isFillPositionKeyword(ident3)) | 3809 if (isFillPositionKeyword(ident3)) |
3810 return; | 3810 return; |
3811 | 3811 |
3812 secondPositionValue = value3; | 3812 secondPositionValue = value3; |
3813 secondPositionKeyword = ident2; | 3813 secondPositionKeyword = ident2; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3887 // a valid start for <position>. | 3887 // a valid start for <position>. |
3888 cumulativeFlags = AmbiguousFillPosition; | 3888 cumulativeFlags = AmbiguousFillPosition; |
3889 value2 = parseFillPositionComponent(valueList, cumulativeFlags, value2Flag,
ResolveValuesAsKeyword); | 3889 value2 = parseFillPositionComponent(valueList, cumulativeFlags, value2Flag,
ResolveValuesAsKeyword); |
3890 if (value2) | 3890 if (value2) |
3891 valueList->next(); | 3891 valueList->next(); |
3892 else { | 3892 else { |
3893 value1.clear(); | 3893 value1.clear(); |
3894 return; | 3894 return; |
3895 } | 3895 } |
3896 | 3896 |
3897 RefPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get()); | 3897 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(val
ue1.get()); |
3898 RefPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get()); | 3898 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(val
ue2.get()); |
3899 | 3899 |
3900 value1.clear(); | 3900 value1.clear(); |
3901 value2.clear(); | 3901 value2.clear(); |
3902 | 3902 |
3903 // Per CSS3 syntax, <position> can't have 'center' as its second keyword as
we have more arguments to follow. | 3903 // Per CSS3 syntax, <position> can't have 'center' as its second keyword as
we have more arguments to follow. |
3904 if (parsedValue2->getValueID() == CSSValueCenter) | 3904 if (parsedValue2->getValueID() == CSSValueCenter) |
3905 return; | 3905 return; |
3906 | 3906 |
3907 if (numberOfValues == 3) | 3907 if (numberOfValues == 3) |
3908 parse3ValuesFillPosition(valueList, value1, value2, parsedValue1.release
(), parsedValue2.release()); | 3908 parse3ValuesFillPosition(valueList, value1, value2, parsedValue1.release
(), parsedValue2.release()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3996 } | 3996 } |
3997 | 3997 |
3998 PassRefPtr<CSSValue> BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a
llowComma) | 3998 PassRefPtr<CSSValue> BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a
llowComma) |
3999 { | 3999 { |
4000 allowComma = true; | 4000 allowComma = true; |
4001 CSSParserValue* value = m_valueList->current(); | 4001 CSSParserValue* value = m_valueList->current(); |
4002 | 4002 |
4003 if (value->id == CSSValueContain || value->id == CSSValueCover) | 4003 if (value->id == CSSValueContain || value->id == CSSValueCover) |
4004 return cssValuePool().createIdentifierValue(value->id); | 4004 return cssValuePool().createIdentifierValue(value->id); |
4005 | 4005 |
4006 RefPtr<CSSPrimitiveValue> parsedValue1; | 4006 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1; |
4007 | 4007 |
4008 if (value->id == CSSValueAuto) | 4008 if (value->id == CSSValueAuto) |
4009 parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto); | 4009 parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto); |
4010 else { | 4010 else { |
4011 if (!validUnit(value, FLength | FPercent)) | 4011 if (!validUnit(value, FLength | FPercent)) |
4012 return 0; | 4012 return 0; |
4013 parsedValue1 = createPrimitiveNumericValue(value); | 4013 parsedValue1 = createPrimitiveNumericValue(value); |
4014 } | 4014 } |
4015 | 4015 |
4016 RefPtr<CSSPrimitiveValue> parsedValue2; | 4016 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2; |
4017 if ((value = m_valueList->next())) { | 4017 if ((value = m_valueList->next())) { |
4018 if (value->unit == CSSParserValue::Operator && value->iValue == ',') | 4018 if (value->unit == CSSParserValue::Operator && value->iValue == ',') |
4019 allowComma = false; | 4019 allowComma = false; |
4020 else if (value->id != CSSValueAuto) { | 4020 else if (value->id != CSSValueAuto) { |
4021 if (!validUnit(value, FLength | FPercent)) { | 4021 if (!validUnit(value, FLength | FPercent)) { |
4022 if (!inShorthand()) | 4022 if (!inShorthand()) |
4023 return 0; | 4023 return 0; |
4024 // We need to rewind the value list, so that when it is advanced
we'll end up back at this value. | 4024 // We need to rewind the value list, so that when it is advanced
we'll end up back at this value. |
4025 m_valueList->previous(); | 4025 m_valueList->previous(); |
4026 } else | 4026 } else |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4526 return true; | 4526 return true; |
4527 } | 4527 } |
4528 if (value) { | 4528 if (value) { |
4529 result = value.release(); | 4529 result = value.release(); |
4530 return true; | 4530 return true; |
4531 } | 4531 } |
4532 return false; | 4532 return false; |
4533 } | 4533 } |
4534 | 4534 |
4535 // The function parses [ <integer> || <string> ] in <grid-line> (which can be st
and alone or with 'span'). | 4535 // The function parses [ <integer> || <string> ] in <grid-line> (which can be st
and alone or with 'span'). |
4536 bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtr<CSSPrimitiveVal
ue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName) | 4536 bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtrWillBeRawPtr<CSS
PrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gridLineNa
me) |
4537 { | 4537 { |
4538 CSSParserValue* value = m_valueList->current(); | 4538 CSSParserValue* value = m_valueList->current(); |
4539 if (validUnit(value, FInteger) && value->fValue) { | 4539 if (validUnit(value, FInteger) && value->fValue) { |
4540 numericValue = createPrimitiveNumericValue(value); | 4540 numericValue = createPrimitiveNumericValue(value); |
4541 value = m_valueList->next(); | 4541 value = m_valueList->next(); |
4542 if (value && value->unit == CSSPrimitiveValue::CSS_STRING) { | 4542 if (value && value->unit == CSSPrimitiveValue::CSS_STRING) { |
4543 gridLineName = createPrimitiveStringValue(m_valueList->current()); | 4543 gridLineName = createPrimitiveStringValue(m_valueList->current()); |
4544 m_valueList->next(); | 4544 m_valueList->next(); |
4545 } | 4545 } |
4546 return true; | 4546 return true; |
(...skipping 20 matching lines...) Expand all Loading... |
4567 if (value->id == CSSValueAuto) { | 4567 if (value->id == CSSValueAuto) { |
4568 m_valueList->next(); | 4568 m_valueList->next(); |
4569 return cssValuePool().createIdentifierValue(CSSValueAuto); | 4569 return cssValuePool().createIdentifierValue(CSSValueAuto); |
4570 } | 4570 } |
4571 | 4571 |
4572 if (value->id != CSSValueSpan && value->unit == CSSPrimitiveValue::CSS_IDENT
) { | 4572 if (value->id != CSSValueSpan && value->unit == CSSPrimitiveValue::CSS_IDENT
) { |
4573 m_valueList->next(); | 4573 m_valueList->next(); |
4574 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_
STRING); | 4574 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_
STRING); |
4575 } | 4575 } |
4576 | 4576 |
4577 RefPtr<CSSPrimitiveValue> numericValue; | 4577 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue; |
4578 RefPtr<CSSPrimitiveValue> gridLineName; | 4578 RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName; |
4579 bool hasSeenSpanKeyword = false; | 4579 bool hasSeenSpanKeyword = false; |
4580 | 4580 |
4581 if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) { | 4581 if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) { |
4582 value = m_valueList->current(); | 4582 value = m_valueList->current(); |
4583 if (value && value->id == CSSValueSpan) { | 4583 if (value && value->id == CSSValueSpan) { |
4584 hasSeenSpanKeyword = true; | 4584 hasSeenSpanKeyword = true; |
4585 m_valueList->next(); | 4585 m_valueList->next(); |
4586 } | 4586 } |
4587 } else if (value->id == CSSValueSpan) { | 4587 } else if (value->id == CSSValueSpan) { |
4588 hasSeenSpanKeyword = true; | 4588 hasSeenSpanKeyword = true; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4713 | 4713 |
4714 CSSParserValueList* identList = parserValueList->current()->valueList; | 4714 CSSParserValueList* identList = parserValueList->current()->valueList; |
4715 if (!identList->size()) { | 4715 if (!identList->size()) { |
4716 parserValueList->next(); | 4716 parserValueList->next(); |
4717 return; | 4717 return; |
4718 } | 4718 } |
4719 | 4719 |
4720 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); | 4720 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); |
4721 while (CSSParserValue* identValue = identList->current()) { | 4721 while (CSSParserValue* identValue = identList->current()) { |
4722 ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT); | 4722 ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT); |
4723 RefPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identVal
ue); | 4723 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveStringVa
lue(identValue); |
4724 lineNames->append(lineName.release()); | 4724 lineNames->append(lineName.release()); |
4725 identList->next(); | 4725 identList->next(); |
4726 } | 4726 } |
4727 valueList.append(lineNames.release()); | 4727 valueList.append(lineNames.release()); |
4728 | 4728 |
4729 parserValueList->next(); | 4729 parserValueList->next(); |
4730 } | 4730 } |
4731 | 4731 |
4732 bool BisonCSSParser::parseGridTrackList(CSSPropertyID propId, bool important) | 4732 bool BisonCSSParser::parseGridTrackList(CSSPropertyID propId, bool important) |
4733 { | 4733 { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4824 | 4824 |
4825 if (currentValue->id == CSSValueAuto) | 4825 if (currentValue->id == CSSValueAuto) |
4826 return cssValuePool().createIdentifierValue(CSSValueAuto); | 4826 return cssValuePool().createIdentifierValue(CSSValueAuto); |
4827 | 4827 |
4828 if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(curr
entValue->function->name, "minmax(")) { | 4828 if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(curr
entValue->function->name, "minmax(")) { |
4829 // The spec defines the following grammar: minmax( <track-breadth> , <tr
ack-breadth> ) | 4829 // The spec defines the following grammar: minmax( <track-breadth> , <tr
ack-breadth> ) |
4830 CSSParserValueList* arguments = currentValue->function->args.get(); | 4830 CSSParserValueList* arguments = currentValue->function->args.get(); |
4831 if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt(
1))) | 4831 if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt(
1))) |
4832 return 0; | 4832 return 0; |
4833 | 4833 |
4834 RefPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(arguments->
valueAt(0)); | 4834 RefPtrWillBeRawPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth
(arguments->valueAt(0)); |
4835 if (!minTrackBreadth) | 4835 if (!minTrackBreadth) |
4836 return 0; | 4836 return 0; |
4837 | 4837 |
4838 RefPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth(arguments->
valueAt(2)); | 4838 RefPtrWillBeRawPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth
(arguments->valueAt(2)); |
4839 if (!maxTrackBreadth) | 4839 if (!maxTrackBreadth) |
4840 return 0; | 4840 return 0; |
4841 | 4841 |
4842 RefPtrWillBeRawPtr<CSSValueList> parsedArguments = CSSValueList::createC
ommaSeparated(); | 4842 RefPtrWillBeRawPtr<CSSValueList> parsedArguments = CSSValueList::createC
ommaSeparated(); |
4843 parsedArguments->append(minTrackBreadth); | 4843 parsedArguments->append(minTrackBreadth); |
4844 parsedArguments->append(maxTrackBreadth); | 4844 parsedArguments->append(maxTrackBreadth); |
4845 return CSSFunctionValue::create("minmax(", parsedArguments); | 4845 return CSSFunctionValue::create("minmax(", parsedArguments); |
4846 } | 4846 } |
4847 | 4847 |
4848 return parseGridBreadth(currentValue); | 4848 return parseGridBreadth(currentValue); |
4849 } | 4849 } |
4850 | 4850 |
4851 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSParserValue* c
urrentValue) | 4851 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSPa
rserValue* currentValue) |
4852 { | 4852 { |
4853 if (currentValue->id == CSSValueMinContent || currentValue->id == CSSValueMa
xContent) | 4853 if (currentValue->id == CSSValueMinContent || currentValue->id == CSSValueMa
xContent) |
4854 return cssValuePool().createIdentifierValue(currentValue->id); | 4854 return cssValuePool().createIdentifierValue(currentValue->id); |
4855 | 4855 |
4856 if (currentValue->unit == CSSPrimitiveValue::CSS_FR) { | 4856 if (currentValue->unit == CSSPrimitiveValue::CSS_FR) { |
4857 double flexValue = currentValue->fValue; | 4857 double flexValue = currentValue->fValue; |
4858 | 4858 |
4859 // Fractional unit is a non-negative dimension. | 4859 // Fractional unit is a non-negative dimension. |
4860 if (flexValue <= 0) | 4860 if (flexValue <= 0) |
4861 return 0; | 4861 return 0; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4946 { | 4946 { |
4947 unsigned numArgs = args->size(); | 4947 unsigned numArgs = args->size(); |
4948 if (counters && numArgs != 3 && numArgs != 5) | 4948 if (counters && numArgs != 3 && numArgs != 5) |
4949 return 0; | 4949 return 0; |
4950 if (!counters && numArgs != 1 && numArgs != 3) | 4950 if (!counters && numArgs != 1 && numArgs != 3) |
4951 return 0; | 4951 return 0; |
4952 | 4952 |
4953 CSSParserValue* i = args->current(); | 4953 CSSParserValue* i = args->current(); |
4954 if (i->unit != CSSPrimitiveValue::CSS_IDENT) | 4954 if (i->unit != CSSPrimitiveValue::CSS_IDENT) |
4955 return 0; | 4955 return 0; |
4956 RefPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValue(i); | 4956 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValu
e(i); |
4957 | 4957 |
4958 RefPtr<CSSPrimitiveValue> separator; | 4958 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator; |
4959 if (!counters) | 4959 if (!counters) |
4960 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_
STRING); | 4960 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_
STRING); |
4961 else { | 4961 else { |
4962 i = args->next(); | 4962 i = args->next(); |
4963 if (i->unit != CSSParserValue::Operator || i->iValue != ',') | 4963 if (i->unit != CSSParserValue::Operator || i->iValue != ',') |
4964 return 0; | 4964 return 0; |
4965 | 4965 |
4966 i = args->next(); | 4966 i = args->next(); |
4967 if (i->unit != CSSPrimitiveValue::CSS_STRING) | 4967 if (i->unit != CSSPrimitiveValue::CSS_STRING) |
4968 return 0; | 4968 return 0; |
4969 | 4969 |
4970 separator = createPrimitiveStringValue(i); | 4970 separator = createPrimitiveStringValue(i); |
4971 } | 4971 } |
4972 | 4972 |
4973 RefPtr<CSSPrimitiveValue> listStyle; | 4973 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle; |
4974 i = args->next(); | 4974 i = args->next(); |
4975 if (!i) // Make the list style default decimal | 4975 if (!i) // Make the list style default decimal |
4976 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); | 4976 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); |
4977 else { | 4977 else { |
4978 if (i->unit != CSSParserValue::Operator || i->iValue != ',') | 4978 if (i->unit != CSSParserValue::Operator || i->iValue != ',') |
4979 return 0; | 4979 return 0; |
4980 | 4980 |
4981 i = args->next(); | 4981 i = args->next(); |
4982 if (i->unit != CSSPrimitiveValue::CSS_IDENT) | 4982 if (i->unit != CSSPrimitiveValue::CSS_IDENT) |
4983 return 0; | 4983 return 0; |
(...skipping 22 matching lines...) Expand all Loading... |
5006 if (args->size() != 4 && args->size() != 7) | 5006 if (args->size() != 4 && args->size() != 7) |
5007 return false; | 5007 return false; |
5008 RefPtr<Rect> rect = Rect::create(); | 5008 RefPtr<Rect> rect = Rect::create(); |
5009 bool valid = true; | 5009 bool valid = true; |
5010 int i = 0; | 5010 int i = 0; |
5011 CSSParserValue* a = args->current(); | 5011 CSSParserValue* a = args->current(); |
5012 while (a) { | 5012 while (a) { |
5013 valid = a->id == CSSValueAuto || validUnit(a, FLength); | 5013 valid = a->id == CSSValueAuto || validUnit(a, FLength); |
5014 if (!valid) | 5014 if (!valid) |
5015 break; | 5015 break; |
5016 RefPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? | 5016 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? |
5017 cssValuePool().createIdentifierValue(CSSValueAuto) : | 5017 cssValuePool().createIdentifierValue(CSSValueAuto) : |
5018 createPrimitiveNumericValue(a); | 5018 createPrimitiveNumericValue(a); |
5019 if (i == 0) | 5019 if (i == 0) |
5020 rect->setTop(length); | 5020 rect->setTop(length); |
5021 else if (i == 1) | 5021 else if (i == 1) |
5022 rect->setRight(length); | 5022 rect->setRight(length); |
5023 else if (i == 2) | 5023 else if (i == 2) |
5024 rect->setBottom(length); | 5024 rect->setBottom(length); |
5025 else | 5025 else |
5026 rect->setLeft(length); | 5026 rect->setLeft(length); |
5027 a = args->next(); | 5027 a = args->next(); |
5028 if (a && args->size() == 7) { | 5028 if (a && args->size() == 7) { |
5029 if (a->unit == CSSParserValue::Operator && a->iValue == ',') { | 5029 if (a->unit == CSSParserValue::Operator && a->iValue == ',') { |
5030 a = args->next(); | 5030 a = args->next(); |
5031 } else { | 5031 } else { |
5032 valid = false; | 5032 valid = false; |
5033 break; | 5033 break; |
5034 } | 5034 } |
5035 } | 5035 } |
5036 i++; | 5036 i++; |
5037 } | 5037 } |
5038 if (valid) { | 5038 if (valid) { |
5039 addProperty(propId, cssValuePool().createValue(rect.release()), importan
t); | 5039 addProperty(propId, cssValuePool().createValue(rect.release()), importan
t); |
5040 m_valueList->next(); | 5040 m_valueList->next(); |
5041 return true; | 5041 return true; |
5042 } | 5042 } |
5043 return false; | 5043 return false; |
5044 } | 5044 } |
5045 | 5045 |
5046 static void completeBorderRadii(RefPtr<CSSPrimitiveValue> radii[4]) | 5046 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) |
5047 { | 5047 { |
5048 if (radii[3]) | 5048 if (radii[3]) |
5049 return; | 5049 return; |
5050 if (!radii[2]) { | 5050 if (!radii[2]) { |
5051 if (!radii[1]) | 5051 if (!radii[1]) |
5052 radii[1] = radii[0]; | 5052 radii[1] = radii[0]; |
5053 radii[2] = radii[0]; | 5053 radii[2] = radii[0]; |
5054 } | 5054 } |
5055 radii[3] = radii[1]; | 5055 radii[3] = radii[1]; |
5056 } | 5056 } |
(...skipping 11 matching lines...) Expand all Loading... |
5068 while (argument) { | 5068 while (argument) { |
5069 radiusArguments.addValue(*argument); | 5069 radiusArguments.addValue(*argument); |
5070 argument = args->next(); | 5070 argument = args->next(); |
5071 } | 5071 } |
5072 | 5072 |
5073 unsigned num = radiusArguments.size(); | 5073 unsigned num = radiusArguments.size(); |
5074 if (!num || num > 9) | 5074 if (!num || num > 9) |
5075 return 0; | 5075 return 0; |
5076 | 5076 |
5077 // FIXME: Refactor completeBorderRadii and the array | 5077 // FIXME: Refactor completeBorderRadii and the array |
5078 RefPtr<CSSPrimitiveValue> radii[2][4]; | 5078 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; |
5079 | 5079 |
5080 unsigned indexAfterSlash = 0; | 5080 unsigned indexAfterSlash = 0; |
5081 for (unsigned i = 0; i < num; ++i) { | 5081 for (unsigned i = 0; i < num; ++i) { |
5082 CSSParserValue* value = radiusArguments.valueAt(i); | 5082 CSSParserValue* value = radiusArguments.valueAt(i); |
5083 if (value->unit == CSSParserValue::Operator) { | 5083 if (value->unit == CSSParserValue::Operator) { |
5084 if (value->iValue != '/') | 5084 if (value->iValue != '/') |
5085 return 0; | 5085 return 0; |
5086 | 5086 |
5087 if (!i || indexAfterSlash || i + 1 == num) | 5087 if (!i || indexAfterSlash || i + 1 == num) |
5088 return 0; | 5088 return 0; |
5089 | 5089 |
5090 indexAfterSlash = i + 1; | 5090 indexAfterSlash = i + 1; |
5091 completeBorderRadii(radii[0]); | 5091 completeBorderRadii(radii[0]); |
5092 continue; | 5092 continue; |
5093 } | 5093 } |
5094 | 5094 |
5095 if (i - indexAfterSlash >= 4) | 5095 if (i - indexAfterSlash >= 4) |
5096 return 0; | 5096 return 0; |
5097 | 5097 |
5098 if (!validUnit(value, FLength | FPercent | FNonNeg)) | 5098 if (!validUnit(value, FLength | FPercent | FNonNeg)) |
5099 return 0; | 5099 return 0; |
5100 | 5100 |
5101 RefPtr<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value); | 5101 RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = createPrimitiveNumericVal
ue(value); |
5102 | 5102 |
5103 if (!indexAfterSlash) | 5103 if (!indexAfterSlash) |
5104 radii[0][i] = radius; | 5104 radii[0][i] = radius; |
5105 else | 5105 else |
5106 radii[1][i - indexAfterSlash] = radius.release(); | 5106 radii[1][i - indexAfterSlash] = radius.release(); |
5107 } | 5107 } |
5108 | 5108 |
5109 if (!indexAfterSlash) { | 5109 if (!indexAfterSlash) { |
5110 completeBorderRadii(radii[0]); | 5110 completeBorderRadii(radii[0]); |
5111 for (unsigned i = 0; i < 4; ++i) | 5111 for (unsigned i = 0; i < 4; ++i) |
5112 radii[1][i] = radii[0][i]; | 5112 radii[1][i] = radii[0][i]; |
5113 } else { | 5113 } else { |
5114 completeBorderRadii(radii[1]); | 5114 completeBorderRadii(radii[1]); |
5115 } | 5115 } |
5116 shape->setTopLeftRadius(createPrimitiveValuePair(radii[0][0].release(), radi
i[1][0].release())); | 5116 shape->setTopLeftRadius(createPrimitiveValuePair(radii[0][0].release(), radi
i[1][0].release())); |
5117 shape->setTopRightRadius(createPrimitiveValuePair(radii[0][1].release(), rad
ii[1][1].release())); | 5117 shape->setTopRightRadius(createPrimitiveValuePair(radii[0][1].release(), rad
ii[1][1].release())); |
5118 shape->setBottomRightRadius(createPrimitiveValuePair(radii[0][2].release(),
radii[1][2].release())); | 5118 shape->setBottomRightRadius(createPrimitiveValuePair(radii[0][2].release(),
radii[1][2].release())); |
5119 shape->setBottomLeftRadius(createPrimitiveValuePair(radii[0][3].release(), r
adii[1][3].release())); | 5119 shape->setBottomLeftRadius(createPrimitiveValuePair(radii[0][3].release(), r
adii[1][3].release())); |
5120 | 5120 |
5121 return shape; | 5121 return shape; |
5122 } | 5122 } |
5123 | 5123 |
5124 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeInset(CSSParserValueLis
t* args) | 5124 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeInset(CSSParserValueLis
t* args) |
5125 { | 5125 { |
5126 ASSERT(args); | 5126 ASSERT(args); |
5127 | 5127 |
5128 RefPtr<CSSBasicShapeInset> shape = CSSBasicShapeInset::create(); | 5128 RefPtr<CSSBasicShapeInset> shape = CSSBasicShapeInset::create(); |
5129 | 5129 |
5130 CSSParserValue* argument = args->current(); | 5130 CSSParserValue* argument = args->current(); |
5131 Vector<RefPtr<CSSPrimitiveValue> > widthArguments; | 5131 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue> > widthArguments; |
5132 bool hasRoundedInset = false; | 5132 bool hasRoundedInset = false; |
5133 | 5133 |
5134 while (argument) { | 5134 while (argument) { |
5135 if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(
argument->string, "round")) { | 5135 if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(
argument->string, "round")) { |
5136 hasRoundedInset = true; | 5136 hasRoundedInset = true; |
5137 break; | 5137 break; |
5138 } | 5138 } |
5139 | 5139 |
5140 Units unitFlags = FLength | FPercent; | 5140 Units unitFlags = FLength | FPercent; |
5141 if (!validUnit(argument, unitFlags) || widthArguments.size() > 4) | 5141 if (!validUnit(argument, unitFlags) || widthArguments.size() > 4) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5187 CSSParserValue* value = m_valueList->current(); | 5187 CSSParserValue* value = m_valueList->current(); |
5188 | 5188 |
5189 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id
== CSSValueStretch) { | 5189 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id
== CSSValueStretch) { |
5190 if (m_valueList->next()) | 5190 if (m_valueList->next()) |
5191 return false; | 5191 return false; |
5192 | 5192 |
5193 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | 5193 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); |
5194 return true; | 5194 return true; |
5195 } | 5195 } |
5196 | 5196 |
5197 RefPtr<CSSPrimitiveValue> position = 0; | 5197 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = 0; |
5198 RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0; | 5198 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0; |
5199 if (isItemPositionKeyword(value->id)) { | 5199 if (isItemPositionKeyword(value->id)) { |
5200 position = cssValuePool().createIdentifierValue(value->id); | 5200 position = cssValuePool().createIdentifierValue(value->id); |
5201 value = m_valueList->next(); | 5201 value = m_valueList->next(); |
5202 if (value) { | 5202 if (value) { |
5203 if (value->id == CSSValueTrue || value->id == CSSValueSafe) | 5203 if (value->id == CSSValueTrue || value->id == CSSValueSafe) |
5204 overflowAlignmentKeyword = cssValuePool().createIdentifierValue(
value->id); | 5204 overflowAlignmentKeyword = cssValuePool().createIdentifierValue(
value->id); |
5205 else | 5205 else |
5206 return false; | 5206 return false; |
5207 } | 5207 } |
5208 } else if (value->id == CSSValueTrue || value->id == CSSValueSafe) { | 5208 } else if (value->id == CSSValueTrue || value->id == CSSValueSafe) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5244 CSSParserValue* argument = args->current(); | 5244 CSSParserValue* argument = args->current(); |
5245 while (argument) { | 5245 while (argument) { |
5246 Units unitFlags = FLength | FPercent; | 5246 Units unitFlags = FLength | FPercent; |
5247 if (argumentNumber > 1) { | 5247 if (argumentNumber > 1) { |
5248 // Arguments width, height, rx, and ry cannot be negative. | 5248 // Arguments width, height, rx, and ry cannot be negative. |
5249 unitFlags = unitFlags | FNonNeg; | 5249 unitFlags = unitFlags | FNonNeg; |
5250 } | 5250 } |
5251 if (!validUnit(argument, unitFlags)) | 5251 if (!validUnit(argument, unitFlags)) |
5252 return 0; | 5252 return 0; |
5253 | 5253 |
5254 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument)
; | 5254 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal
ue(argument); |
5255 ASSERT(argumentNumber < 6); | 5255 ASSERT(argumentNumber < 6); |
5256 switch (argumentNumber) { | 5256 switch (argumentNumber) { |
5257 case 0: | 5257 case 0: |
5258 shape->setX(length); | 5258 shape->setX(length); |
5259 break; | 5259 break; |
5260 case 1: | 5260 case 1: |
5261 shape->setY(length); | 5261 shape->setY(length); |
5262 break; | 5262 break; |
5263 case 2: | 5263 case 2: |
5264 shape->setWidth(length); | 5264 shape->setWidth(length); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5298 | 5298 |
5299 RefPtr<CSSBasicShapeInsetRectangle> shape = CSSBasicShapeInsetRectangle::cre
ate(); | 5299 RefPtr<CSSBasicShapeInsetRectangle> shape = CSSBasicShapeInsetRectangle::cre
ate(); |
5300 | 5300 |
5301 unsigned argumentNumber = 0; | 5301 unsigned argumentNumber = 0; |
5302 CSSParserValue* argument = args->current(); | 5302 CSSParserValue* argument = args->current(); |
5303 while (argument) { | 5303 while (argument) { |
5304 Units unitFlags = FLength | FPercent | FNonNeg; | 5304 Units unitFlags = FLength | FPercent | FNonNeg; |
5305 if (!validUnit(argument, unitFlags)) | 5305 if (!validUnit(argument, unitFlags)) |
5306 return 0; | 5306 return 0; |
5307 | 5307 |
5308 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument)
; | 5308 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal
ue(argument); |
5309 ASSERT(argumentNumber < 6); | 5309 ASSERT(argumentNumber < 6); |
5310 switch (argumentNumber) { | 5310 switch (argumentNumber) { |
5311 case 0: | 5311 case 0: |
5312 shape->setTop(length); | 5312 shape->setTop(length); |
5313 break; | 5313 break; |
5314 case 1: | 5314 case 1: |
5315 shape->setRight(length); | 5315 shape->setRight(length); |
5316 break; | 5316 break; |
5317 case 2: | 5317 case 2: |
5318 shape->setBottom(length); | 5318 shape->setBottom(length); |
(...skipping 16 matching lines...) Expand all Loading... |
5335 argument = args->next(); | 5335 argument = args->next(); |
5336 } | 5336 } |
5337 argumentNumber++; | 5337 argumentNumber++; |
5338 } | 5338 } |
5339 | 5339 |
5340 if (argumentNumber < 4) | 5340 if (argumentNumber < 4) |
5341 return 0; | 5341 return 0; |
5342 return shape; | 5342 return shape; |
5343 } | 5343 } |
5344 | 5344 |
5345 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSParserValue* v
alue) | 5345 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSPa
rserValue* value) |
5346 { | 5346 { |
5347 if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) | 5347 if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) |
5348 return cssValuePool().createIdentifierValue(value->id); | 5348 return cssValuePool().createIdentifierValue(value->id); |
5349 | 5349 |
5350 if (!validUnit(value, FLength | FPercent | FNonNeg)) | 5350 if (!validUnit(value, FLength | FPercent | FNonNeg)) |
5351 return 0; | 5351 return 0; |
5352 | 5352 |
5353 return createPrimitiveNumericValue(value); | 5353 return createPrimitiveNumericValue(value); |
5354 } | 5354 } |
5355 | 5355 |
5356 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeCircle(CSSParserValueLi
st* args) | 5356 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeCircle(CSSParserValueLi
st* args) |
5357 { | 5357 { |
5358 ASSERT(args); | 5358 ASSERT(args); |
5359 | 5359 |
5360 // circle(radius) | 5360 // circle(radius) |
5361 // circle(radius at <position> | 5361 // circle(radius at <position> |
5362 // circle(at <position>) | 5362 // circle(at <position>) |
5363 // where position defines centerX and centerY using a CSS <position> data ty
pe. | 5363 // where position defines centerX and centerY using a CSS <position> data ty
pe. |
5364 RefPtr<CSSBasicShapeCircle> shape = CSSBasicShapeCircle::create(); | 5364 RefPtr<CSSBasicShapeCircle> shape = CSSBasicShapeCircle::create(); |
5365 | 5365 |
5366 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { | 5366 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { |
5367 // The call to parseFillPosition below should consume all of the | 5367 // The call to parseFillPosition below should consume all of the |
5368 // arguments except the first two. Thus, and index greater than one | 5368 // arguments except the first two. Thus, and index greater than one |
5369 // indicates an invalid production. | 5369 // indicates an invalid production. |
5370 if (args->currentIndex() > 1) | 5370 if (args->currentIndex() > 1) |
5371 return 0; | 5371 return 0; |
5372 | 5372 |
5373 if (!args->currentIndex() && argument->id != CSSValueAt) { | 5373 if (!args->currentIndex() && argument->id != CSSValueAt) { |
5374 if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) { | 5374 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(
argument)) { |
5375 shape->setRadius(radius); | 5375 shape->setRadius(radius); |
5376 continue; | 5376 continue; |
5377 } | 5377 } |
5378 | 5378 |
5379 return 0; | 5379 return 0; |
5380 } | 5380 } |
5381 | 5381 |
5382 if (argument->id == CSSValueAt) { | 5382 if (argument->id == CSSValueAt) { |
5383 RefPtr<CSSValue> centerX; | 5383 RefPtr<CSSValue> centerX; |
5384 RefPtr<CSSValue> centerY; | 5384 RefPtr<CSSValue> centerY; |
(...skipping 30 matching lines...) Expand all Loading... |
5415 while (argument) { | 5415 while (argument) { |
5416 Units unitFlags = FLength | FPercent; | 5416 Units unitFlags = FLength | FPercent; |
5417 if (argumentNumber == 2) { | 5417 if (argumentNumber == 2) { |
5418 // Argument radius cannot be negative. | 5418 // Argument radius cannot be negative. |
5419 unitFlags = unitFlags | FNonNeg; | 5419 unitFlags = unitFlags | FNonNeg; |
5420 } | 5420 } |
5421 | 5421 |
5422 if (!validUnit(argument, unitFlags)) | 5422 if (!validUnit(argument, unitFlags)) |
5423 return 0; | 5423 return 0; |
5424 | 5424 |
5425 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument)
; | 5425 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal
ue(argument); |
5426 ASSERT(argumentNumber < 3); | 5426 ASSERT(argumentNumber < 3); |
5427 switch (argumentNumber) { | 5427 switch (argumentNumber) { |
5428 case 0: | 5428 case 0: |
5429 shape->setCenterX(length); | 5429 shape->setCenterX(length); |
5430 break; | 5430 break; |
5431 case 1: | 5431 case 1: |
5432 shape->setCenterY(length); | 5432 shape->setCenterY(length); |
5433 break; | 5433 break; |
5434 case 2: | 5434 case 2: |
5435 shape->setRadius(length); | 5435 shape->setRadius(length); |
(...skipping 27 matching lines...) Expand all Loading... |
5463 RefPtr<CSSBasicShapeEllipse> shape = CSSBasicShapeEllipse::create(); | 5463 RefPtr<CSSBasicShapeEllipse> shape = CSSBasicShapeEllipse::create(); |
5464 | 5464 |
5465 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { | 5465 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { |
5466 // The call to parseFillPosition below should consume all of the | 5466 // The call to parseFillPosition below should consume all of the |
5467 // arguments except the first three. Thus, an index greater than two | 5467 // arguments except the first three. Thus, an index greater than two |
5468 // indicates an invalid production. | 5468 // indicates an invalid production. |
5469 if (args->currentIndex() > 2) | 5469 if (args->currentIndex() > 2) |
5470 return 0; | 5470 return 0; |
5471 | 5471 |
5472 if (args->currentIndex() < 2 && argument->id != CSSValueAt) { | 5472 if (args->currentIndex() < 2 && argument->id != CSSValueAt) { |
5473 if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) { | 5473 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(
argument)) { |
5474 if (!shape->radiusX()) | 5474 if (!shape->radiusX()) |
5475 shape->setRadiusX(radius); | 5475 shape->setRadiusX(radius); |
5476 else | 5476 else |
5477 shape->setRadiusY(radius); | 5477 shape->setRadiusY(radius); |
5478 continue; | 5478 continue; |
5479 } | 5479 } |
5480 | 5480 |
5481 return 0; | 5481 return 0; |
5482 } | 5482 } |
5483 | 5483 |
(...skipping 28 matching lines...) Expand all Loading... |
5512 CSSParserValue* argument = args->current(); | 5512 CSSParserValue* argument = args->current(); |
5513 while (argument) { | 5513 while (argument) { |
5514 Units unitFlags = FLength | FPercent; | 5514 Units unitFlags = FLength | FPercent; |
5515 if (argumentNumber > 1) { | 5515 if (argumentNumber > 1) { |
5516 // Arguments radiusX and radiusY cannot be negative. | 5516 // Arguments radiusX and radiusY cannot be negative. |
5517 unitFlags = unitFlags | FNonNeg; | 5517 unitFlags = unitFlags | FNonNeg; |
5518 } | 5518 } |
5519 if (!validUnit(argument, unitFlags)) | 5519 if (!validUnit(argument, unitFlags)) |
5520 return 0; | 5520 return 0; |
5521 | 5521 |
5522 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument)
; | 5522 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal
ue(argument); |
5523 ASSERT(argumentNumber < 4); | 5523 ASSERT(argumentNumber < 4); |
5524 switch (argumentNumber) { | 5524 switch (argumentNumber) { |
5525 case 0: | 5525 case 0: |
5526 shape->setCenterX(length); | 5526 shape->setCenterX(length); |
5527 break; | 5527 break; |
5528 case 1: | 5528 case 1: |
5529 shape->setCenterY(length); | 5529 shape->setCenterY(length); |
5530 break; | 5530 break; |
5531 case 2: | 5531 case 2: |
5532 shape->setRadiusX(length); | 5532 shape->setRadiusX(length); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5577 | 5577 |
5578 CSSParserValue* argumentX = argument; | 5578 CSSParserValue* argumentX = argument; |
5579 while (argumentX) { | 5579 while (argumentX) { |
5580 if (!validUnit(argumentX, FLength | FPercent)) | 5580 if (!validUnit(argumentX, FLength | FPercent)) |
5581 return 0; | 5581 return 0; |
5582 | 5582 |
5583 CSSParserValue* argumentY = args->next(); | 5583 CSSParserValue* argumentY = args->next(); |
5584 if (!argumentY || !validUnit(argumentY, FLength | FPercent)) | 5584 if (!argumentY || !validUnit(argumentY, FLength | FPercent)) |
5585 return 0; | 5585 return 0; |
5586 | 5586 |
5587 RefPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argument
X); | 5587 RefPtrWillBeRawPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericVa
lue(argumentX); |
5588 RefPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericValue(argument
Y); | 5588 RefPtrWillBeRawPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericVa
lue(argumentY); |
5589 | 5589 |
5590 shape->appendPoint(xLength.release(), yLength.release()); | 5590 shape->appendPoint(xLength.release(), yLength.release()); |
5591 | 5591 |
5592 CSSParserValue* commaOrNull = args->next(); | 5592 CSSParserValue* commaOrNull = args->next(); |
5593 if (!commaOrNull) | 5593 if (!commaOrNull) |
5594 argumentX = 0; | 5594 argumentX = 0; |
5595 else if (!isComma(commaOrNull)) | 5595 else if (!isComma(commaOrNull)) |
5596 return 0; | 5596 return 0; |
5597 else | 5597 else |
5598 argumentX = args->next(); | 5598 argumentX = args->next(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5630 return false; | 5630 return false; |
5631 } | 5631 } |
5632 | 5632 |
5633 PassRefPtr<CSSValue> BisonCSSParser::parseShapeProperty(CSSPropertyID propId) | 5633 PassRefPtr<CSSValue> BisonCSSParser::parseShapeProperty(CSSPropertyID propId) |
5634 { | 5634 { |
5635 if (!RuntimeEnabledFeatures::cssShapesEnabled()) | 5635 if (!RuntimeEnabledFeatures::cssShapesEnabled()) |
5636 return 0; | 5636 return 0; |
5637 | 5637 |
5638 CSSParserValue* value = m_valueList->current(); | 5638 CSSParserValue* value = m_valueList->current(); |
5639 CSSValueID valueId = value->id; | 5639 CSSValueID valueId = value->id; |
5640 RefPtr<CSSPrimitiveValue> boxValue; | 5640 RefPtrWillBeRawPtr<CSSPrimitiveValue> boxValue; |
5641 RefPtr<CSSPrimitiveValue> shapeValue; | 5641 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; |
5642 | 5642 |
5643 if (valueId == CSSValueNone | 5643 if (valueId == CSSValueNone |
5644 || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside)
) { | 5644 || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside)
) { |
5645 RefPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive(valueId, va
lue); | 5645 RefPtrWillBeRawPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive
(valueId, value); |
5646 m_valueList->next(); | 5646 m_valueList->next(); |
5647 return keywordValue.release(); | 5647 return keywordValue.release(); |
5648 } | 5648 } |
5649 | 5649 |
5650 RefPtr<CSSValue> imageValue; | 5650 RefPtr<CSSValue> imageValue; |
5651 if (valueId != CSSValueNone && parseFillImage(m_valueList.get(), imageValue)
) { | 5651 if (valueId != CSSValueNone && parseFillImage(m_valueList.get(), imageValue)
) { |
5652 m_valueList->next(); | 5652 m_valueList->next(); |
5653 return imageValue.release(); | 5653 return imageValue.release(); |
5654 } | 5654 } |
5655 | 5655 |
(...skipping 26 matching lines...) Expand all Loading... |
5682 | 5682 |
5683 ASSERT(shapeValue && boxValue); | 5683 ASSERT(shapeValue && boxValue); |
5684 shapeValue->getShapeValue()->setLayoutBox(boxValue.release()); | 5684 shapeValue->getShapeValue()->setLayoutBox(boxValue.release()); |
5685 } | 5685 } |
5686 | 5686 |
5687 if (shapeValue) | 5687 if (shapeValue) |
5688 return shapeValue.release(); | 5688 return shapeValue.release(); |
5689 return boxValue.release(); | 5689 return boxValue.release(); |
5690 } | 5690 } |
5691 | 5691 |
5692 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape() | 5692 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape() |
5693 { | 5693 { |
5694 CSSParserValue* value = m_valueList->current(); | 5694 CSSParserValue* value = m_valueList->current(); |
5695 ASSERT(value->unit == CSSParserValue::Function); | 5695 ASSERT(value->unit == CSSParserValue::Function); |
5696 CSSParserValueList* args = value->function->args.get(); | 5696 CSSParserValueList* args = value->function->args.get(); |
5697 | 5697 |
5698 if (!args) | 5698 if (!args) |
5699 return 0; | 5699 return 0; |
5700 | 5700 |
5701 RefPtr<CSSBasicShape> shape; | 5701 RefPtr<CSSBasicShape> shape; |
5702 if (equalIgnoringCase(value->function->name, "rectangle(")) | 5702 if (equalIgnoringCase(value->function->name, "rectangle(")) |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5938 } | 5938 } |
5939 | 5939 |
5940 bool BisonCSSParser::parseFontVariant(bool important) | 5940 bool BisonCSSParser::parseFontVariant(bool important) |
5941 { | 5941 { |
5942 RefPtrWillBeRawPtr<CSSValueList> values; | 5942 RefPtrWillBeRawPtr<CSSValueList> values; |
5943 if (m_valueList->size() > 1) | 5943 if (m_valueList->size() > 1) |
5944 values = CSSValueList::createCommaSeparated(); | 5944 values = CSSValueList::createCommaSeparated(); |
5945 CSSParserValue* val; | 5945 CSSParserValue* val; |
5946 bool expectComma = false; | 5946 bool expectComma = false; |
5947 while ((val = m_valueList->current())) { | 5947 while ((val = m_valueList->current())) { |
5948 RefPtr<CSSPrimitiveValue> parsedValue; | 5948 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue; |
5949 if (!expectComma) { | 5949 if (!expectComma) { |
5950 expectComma = true; | 5950 expectComma = true; |
5951 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) | 5951 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) |
5952 parsedValue = cssValuePool().createIdentifierValue(val->id); | 5952 parsedValue = cssValuePool().createIdentifierValue(val->id); |
5953 else if (val->id == CSSValueAll && !values) { | 5953 else if (val->id == CSSValueAll && !values) { |
5954 // 'all' is only allowed in @font-face and with no other values.
Make a value list to | 5954 // 'all' is only allowed in @font-face and with no other values.
Make a value list to |
5955 // indicate that we are in the @font-face case. | 5955 // indicate that we are in the @font-face case. |
5956 values = CSSValueList::createCommaSeparated(); | 5956 values = CSSValueList::createCommaSeparated(); |
5957 parsedValue = cssValuePool().createIdentifierValue(val->id); | 5957 parsedValue = cssValuePool().createIdentifierValue(val->id); |
5958 } | 5958 } |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6594 if (v->unit != CSSParserValue::Operator && v->iValue != ',') | 6594 if (v->unit != CSSParserValue::Operator && v->iValue != ',') |
6595 return false; | 6595 return false; |
6596 v = args->next(); | 6596 v = args->next(); |
6597 if (!validUnit(v, FNumber, HTMLStandardMode)) | 6597 if (!validUnit(v, FNumber, HTMLStandardMode)) |
6598 return false; | 6598 return false; |
6599 colorArray[3] = max(0.0, min(1.0, parsedDouble(v, ReleaseParsedCalcValue
))); | 6599 colorArray[3] = max(0.0, min(1.0, parsedDouble(v, ReleaseParsedCalcValue
))); |
6600 } | 6600 } |
6601 return true; | 6601 return true; |
6602 } | 6602 } |
6603 | 6603 |
6604 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseColor(CSSParserValue* value) | 6604 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseColor(CSSParserVa
lue* value) |
6605 { | 6605 { |
6606 RGBA32 c = Color::transparent; | 6606 RGBA32 c = Color::transparent; |
6607 if (!parseColorFromValue(value ? value : m_valueList->current(), c)) | 6607 if (!parseColorFromValue(value ? value : m_valueList->current(), c)) |
6608 return 0; | 6608 return 0; |
6609 return cssValuePool().createColorValue(c); | 6609 return cssValuePool().createColorValue(c); |
6610 } | 6610 } |
6611 | 6611 |
6612 bool BisonCSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c) | 6612 bool BisonCSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c) |
6613 { | 6613 { |
6614 if (inQuirksMode() && value->unit == CSSPrimitiveValue::CSS_NUMBER | 6614 if (inQuirksMode() && value->unit == CSSPrimitiveValue::CSS_NUMBER |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6705 allowColor = true; | 6705 allowColor = true; |
6706 allowBreak = true; | 6706 allowBreak = true; |
6707 allowY = false; | 6707 allowY = false; |
6708 allowBlur = false; | 6708 allowBlur = false; |
6709 allowSpread = false; | 6709 allowSpread = false; |
6710 allowStyle = property == CSSPropertyWebkitBoxShadow || property == CSSPr
opertyBoxShadow; | 6710 allowStyle = property == CSSPropertyWebkitBoxShadow || property == CSSPr
opertyBoxShadow; |
6711 } | 6711 } |
6712 | 6712 |
6713 void commitLength(CSSParserValue* v) | 6713 void commitLength(CSSParserValue* v) |
6714 { | 6714 { |
6715 RefPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v)
; | 6715 RefPtrWillBeRawPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNum
ericValue(v); |
6716 | 6716 |
6717 if (allowX) { | 6717 if (allowX) { |
6718 x = val.release(); | 6718 x = val.release(); |
6719 allowX = false; | 6719 allowX = false; |
6720 allowY = true; | 6720 allowY = true; |
6721 allowColor = false; | 6721 allowColor = false; |
6722 allowStyle = false; | 6722 allowStyle = false; |
6723 allowBreak = false; | 6723 allowBreak = false; |
6724 } else if (allowY) { | 6724 } else if (allowY) { |
6725 y = val.release(); | 6725 y = val.release(); |
6726 allowY = false; | 6726 allowY = false; |
6727 allowBlur = true; | 6727 allowBlur = true; |
6728 allowColor = true; | 6728 allowColor = true; |
6729 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C
SSPropertyBoxShadow; | 6729 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C
SSPropertyBoxShadow; |
6730 allowBreak = true; | 6730 allowBreak = true; |
6731 } else if (allowBlur) { | 6731 } else if (allowBlur) { |
6732 blur = val.release(); | 6732 blur = val.release(); |
6733 allowBlur = false; | 6733 allowBlur = false; |
6734 allowSpread = property == CSSPropertyWebkitBoxShadow || property ==
CSSPropertyBoxShadow; | 6734 allowSpread = property == CSSPropertyWebkitBoxShadow || property ==
CSSPropertyBoxShadow; |
6735 } else if (allowSpread) { | 6735 } else if (allowSpread) { |
6736 spread = val.release(); | 6736 spread = val.release(); |
6737 allowSpread = false; | 6737 allowSpread = false; |
6738 } | 6738 } |
6739 } | 6739 } |
6740 | 6740 |
6741 void commitColor(PassRefPtr<CSSPrimitiveValue> val) | 6741 void commitColor(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) |
6742 { | 6742 { |
6743 color = val; | 6743 color = val; |
6744 allowColor = false; | 6744 allowColor = false; |
6745 if (allowX) { | 6745 if (allowX) { |
6746 allowStyle = false; | 6746 allowStyle = false; |
6747 allowBreak = false; | 6747 allowBreak = false; |
6748 } else { | 6748 } else { |
6749 allowBlur = false; | 6749 allowBlur = false; |
6750 allowSpread = false; | 6750 allowSpread = false; |
6751 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C
SSPropertyBoxShadow; | 6751 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C
SSPropertyBoxShadow; |
(...skipping 10 matching lines...) Expand all Loading... |
6762 allowBlur = false; | 6762 allowBlur = false; |
6763 allowSpread = false; | 6763 allowSpread = false; |
6764 allowColor = false; | 6764 allowColor = false; |
6765 } | 6765 } |
6766 } | 6766 } |
6767 | 6767 |
6768 CSSPropertyID property; | 6768 CSSPropertyID property; |
6769 BisonCSSParser* m_parser; | 6769 BisonCSSParser* m_parser; |
6770 | 6770 |
6771 RefPtrWillBeRawPtr<CSSValueList> values; | 6771 RefPtrWillBeRawPtr<CSSValueList> values; |
6772 RefPtr<CSSPrimitiveValue> x; | 6772 RefPtrWillBeRawPtr<CSSPrimitiveValue> x; |
6773 RefPtr<CSSPrimitiveValue> y; | 6773 RefPtrWillBeRawPtr<CSSPrimitiveValue> y; |
6774 RefPtr<CSSPrimitiveValue> blur; | 6774 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur; |
6775 RefPtr<CSSPrimitiveValue> spread; | 6775 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread; |
6776 RefPtr<CSSPrimitiveValue> style; | 6776 RefPtrWillBeRawPtr<CSSPrimitiveValue> style; |
6777 RefPtr<CSSPrimitiveValue> color; | 6777 RefPtrWillBeRawPtr<CSSPrimitiveValue> color; |
6778 | 6778 |
6779 bool allowX; | 6779 bool allowX; |
6780 bool allowY; | 6780 bool allowY; |
6781 bool allowBlur; | 6781 bool allowBlur; |
6782 bool allowSpread; | 6782 bool allowSpread; |
6783 bool allowColor; | 6783 bool allowColor; |
6784 bool allowStyle; // inset or not. | 6784 bool allowStyle; // inset or not. |
6785 bool allowBreak; | 6785 bool allowBreak; |
6786 }; | 6786 }; |
6787 | 6787 |
(...skipping 21 matching lines...) Expand all Loading... |
6809 | 6809 |
6810 // A length is allowed here. Construct the value and add it. | 6810 // A length is allowed here. Construct the value and add it. |
6811 context.commitLength(val); | 6811 context.commitLength(val); |
6812 } else if (val->id == CSSValueInset) { | 6812 } else if (val->id == CSSValueInset) { |
6813 if (!context.allowStyle) | 6813 if (!context.allowStyle) |
6814 return 0; | 6814 return 0; |
6815 | 6815 |
6816 context.commitStyle(val); | 6816 context.commitStyle(val); |
6817 } else { | 6817 } else { |
6818 // The only other type of value that's ok is a color value. | 6818 // The only other type of value that's ok is a color value. |
6819 RefPtr<CSSPrimitiveValue> parsedColor; | 6819 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedColor; |
6820 bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindo
wtext) || val->id == CSSValueMenu | 6820 bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindo
wtext) || val->id == CSSValueMenu |
6821 || (val->id >= CSSValueWebkitFocusRingColor && val->
id <= CSSValueWebkitText && inQuirksMode()) | 6821 || (val->id >= CSSValueWebkitFocusRingColor && val->
id <= CSSValueWebkitText && inQuirksMode()) |
6822 || val->id == CSSValueCurrentcolor); | 6822 || val->id == CSSValueCurrentcolor); |
6823 if (isColor) { | 6823 if (isColor) { |
6824 if (!context.allowColor) | 6824 if (!context.allowColor) |
6825 return 0; | 6825 return 0; |
6826 parsedColor = cssValuePool().createIdentifierValue(val->id); | 6826 parsedColor = cssValuePool().createIdentifierValue(val->id); |
6827 } | 6827 } |
6828 | 6828 |
6829 if (!parsedColor) | 6829 if (!parsedColor) |
(...skipping 18 matching lines...) Expand all Loading... |
6848 | 6848 |
6849 return 0; | 6849 return 0; |
6850 } | 6850 } |
6851 | 6851 |
6852 bool BisonCSSParser::parseReflect(CSSPropertyID propId, bool important) | 6852 bool BisonCSSParser::parseReflect(CSSPropertyID propId, bool important) |
6853 { | 6853 { |
6854 // box-reflect: <direction> <offset> <mask> | 6854 // box-reflect: <direction> <offset> <mask> |
6855 | 6855 |
6856 // Direction comes first. | 6856 // Direction comes first. |
6857 CSSParserValue* val = m_valueList->current(); | 6857 CSSParserValue* val = m_valueList->current(); |
6858 RefPtr<CSSPrimitiveValue> direction; | 6858 RefPtrWillBeRawPtr<CSSPrimitiveValue> direction; |
6859 switch (val->id) { | 6859 switch (val->id) { |
6860 case CSSValueAbove: | 6860 case CSSValueAbove: |
6861 case CSSValueBelow: | 6861 case CSSValueBelow: |
6862 case CSSValueLeft: | 6862 case CSSValueLeft: |
6863 case CSSValueRight: | 6863 case CSSValueRight: |
6864 direction = cssValuePool().createIdentifierValue(val->id); | 6864 direction = cssValuePool().createIdentifierValue(val->id); |
6865 break; | 6865 break; |
6866 default: | 6866 default: |
6867 return false; | 6867 return false; |
6868 } | 6868 } |
6869 | 6869 |
6870 // The offset comes next. | 6870 // The offset comes next. |
6871 val = m_valueList->next(); | 6871 val = m_valueList->next(); |
6872 RefPtr<CSSPrimitiveValue> offset; | 6872 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset; |
6873 if (!val) | 6873 if (!val) |
6874 offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); | 6874 offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); |
6875 else { | 6875 else { |
6876 if (!validUnit(val, FLength | FPercent)) | 6876 if (!validUnit(val, FLength | FPercent)) |
6877 return false; | 6877 return false; |
6878 offset = createPrimitiveNumericValue(val); | 6878 offset = createPrimitiveNumericValue(val); |
6879 } | 6879 } |
6880 | 6880 |
6881 // Now for the mask. | 6881 // Now for the mask. |
6882 RefPtr<CSSValue> mask; | 6882 RefPtr<CSSValue> mask; |
(...skipping 10 matching lines...) Expand all Loading... |
6893 return true; | 6893 return true; |
6894 } | 6894 } |
6895 | 6895 |
6896 bool BisonCSSParser::parseFlex(CSSParserValueList* args, bool important) | 6896 bool BisonCSSParser::parseFlex(CSSParserValueList* args, bool important) |
6897 { | 6897 { |
6898 if (!args || !args->size() || args->size() > 3) | 6898 if (!args || !args->size() || args->size() > 3) |
6899 return false; | 6899 return false; |
6900 static const double unsetValue = -1; | 6900 static const double unsetValue = -1; |
6901 double flexGrow = unsetValue; | 6901 double flexGrow = unsetValue; |
6902 double flexShrink = unsetValue; | 6902 double flexShrink = unsetValue; |
6903 RefPtr<CSSPrimitiveValue> flexBasis; | 6903 RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis; |
6904 | 6904 |
6905 while (CSSParserValue* arg = args->current()) { | 6905 while (CSSParserValue* arg = args->current()) { |
6906 if (validUnit(arg, FNumber | FNonNeg)) { | 6906 if (validUnit(arg, FNumber | FNonNeg)) { |
6907 if (flexGrow == unsetValue) | 6907 if (flexGrow == unsetValue) |
6908 flexGrow = arg->fValue; | 6908 flexGrow = arg->fValue; |
6909 else if (flexShrink == unsetValue) | 6909 else if (flexShrink == unsetValue) |
6910 flexShrink = arg->fValue; | 6910 flexShrink = arg->fValue; |
6911 else if (!arg->fValue) { | 6911 else if (!arg->fValue) { |
6912 // flex only allows a basis of 0 (sans units) if flex-grow and f
lex-shrink values have already been set. | 6912 // flex only allows a basis of 0 (sans units) if flex-grow and f
lex-shrink values have already been set. |
6913 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS
_PX); | 6913 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS
_PX); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7000 m_canAdvance = true; | 7000 m_canAdvance = true; |
7001 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all
owForwardSlashOperator = false; | 7001 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all
owForwardSlashOperator = false; |
7002 if (!m_borderSlice) { | 7002 if (!m_borderSlice) { |
7003 m_requireWidth = true; | 7003 m_requireWidth = true; |
7004 m_requireOutset = false; | 7004 m_requireOutset = false; |
7005 } else { | 7005 } else { |
7006 m_requireOutset = true; | 7006 m_requireOutset = true; |
7007 m_requireWidth = false; | 7007 m_requireWidth = false; |
7008 } | 7008 } |
7009 } | 7009 } |
7010 void commitBorderWidth(PassRefPtr<CSSPrimitiveValue> slice) | 7010 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> slice) |
7011 { | 7011 { |
7012 m_borderSlice = slice; | 7012 m_borderSlice = slice; |
7013 m_canAdvance = true; | 7013 m_canAdvance = true; |
7014 m_allowCommit = m_allowForwardSlashOperator = true; | 7014 m_allowCommit = m_allowForwardSlashOperator = true; |
7015 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 7015 m_allowImageSlice = m_requireWidth = m_requireOutset = false; |
7016 m_allowImage = !m_image; | 7016 m_allowImage = !m_image; |
7017 m_allowRepeat = !m_repeat; | 7017 m_allowRepeat = !m_repeat; |
7018 } | 7018 } |
7019 void commitBorderOutset(PassRefPtr<CSSPrimitiveValue> outset) | 7019 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) |
7020 { | 7020 { |
7021 m_outset = outset; | 7021 m_outset = outset; |
7022 m_canAdvance = true; | 7022 m_canAdvance = true; |
7023 m_allowCommit = true; | 7023 m_allowCommit = true; |
7024 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req
uireOutset = false; | 7024 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req
uireOutset = false; |
7025 m_allowImage = !m_image; | 7025 m_allowImage = !m_image; |
7026 m_allowRepeat = !m_repeat; | 7026 m_allowRepeat = !m_repeat; |
7027 } | 7027 } |
7028 void commitRepeat(PassRefPtr<CSSValue> repeat) | 7028 void commitRepeat(PassRefPtr<CSSValue> repeat) |
7029 { | 7029 { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7072 bool m_allowImage; | 7072 bool m_allowImage; |
7073 bool m_allowImageSlice; | 7073 bool m_allowImageSlice; |
7074 bool m_allowRepeat; | 7074 bool m_allowRepeat; |
7075 bool m_allowForwardSlashOperator; | 7075 bool m_allowForwardSlashOperator; |
7076 | 7076 |
7077 bool m_requireWidth; | 7077 bool m_requireWidth; |
7078 bool m_requireOutset; | 7078 bool m_requireOutset; |
7079 | 7079 |
7080 RefPtr<CSSValue> m_image; | 7080 RefPtr<CSSValue> m_image; |
7081 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice; | 7081 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice; |
7082 RefPtr<CSSPrimitiveValue> m_borderSlice; | 7082 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_borderSlice; |
7083 RefPtr<CSSPrimitiveValue> m_outset; | 7083 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_outset; |
7084 | 7084 |
7085 RefPtr<CSSValue> m_repeat; | 7085 RefPtr<CSSValue> m_repeat; |
7086 }; | 7086 }; |
7087 | 7087 |
7088 static bool buildBorderImageParseContext(BisonCSSParser& parser, CSSPropertyID p
ropId, BorderImageParseContext& context) | 7088 static bool buildBorderImageParseContext(BisonCSSParser& parser, CSSPropertyID p
ropId, BorderImageParseContext& context) |
7089 { | 7089 { |
7090 ShorthandScope scope(&parser, propId); | 7090 ShorthandScope scope(&parser, propId); |
7091 while (CSSParserValue* val = parser.m_valueList->current()) { | 7091 while (CSSParserValue* val = parser.m_valueList->current()) { |
7092 context.setCanAdvance(false); | 7092 context.setCanAdvance(false); |
7093 | 7093 |
(...skipping 25 matching lines...) Expand all Loading... |
7119 context.commitImageSlice(imageSlice.release()); | 7119 context.commitImageSlice(imageSlice.release()); |
7120 } | 7120 } |
7121 | 7121 |
7122 if (!context.canAdvance() && context.allowRepeat()) { | 7122 if (!context.canAdvance() && context.allowRepeat()) { |
7123 RefPtr<CSSValue> repeat; | 7123 RefPtr<CSSValue> repeat; |
7124 if (parser.parseBorderImageRepeat(repeat)) | 7124 if (parser.parseBorderImageRepeat(repeat)) |
7125 context.commitRepeat(repeat.release()); | 7125 context.commitRepeat(repeat.release()); |
7126 } | 7126 } |
7127 | 7127 |
7128 if (!context.canAdvance() && context.requireWidth()) { | 7128 if (!context.canAdvance() && context.requireWidth()) { |
7129 RefPtr<CSSPrimitiveValue> borderSlice; | 7129 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice; |
7130 if (parser.parseBorderImageWidth(borderSlice)) | 7130 if (parser.parseBorderImageWidth(borderSlice)) |
7131 context.commitBorderWidth(borderSlice.release()); | 7131 context.commitBorderWidth(borderSlice.release()); |
7132 } | 7132 } |
7133 | 7133 |
7134 if (!context.canAdvance() && context.requireOutset()) { | 7134 if (!context.canAdvance() && context.requireOutset()) { |
7135 RefPtr<CSSPrimitiveValue> borderOutset; | 7135 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset; |
7136 if (parser.parseBorderImageOutset(borderOutset)) | 7136 if (parser.parseBorderImageOutset(borderOutset)) |
7137 context.commitBorderOutset(borderOutset.release()); | 7137 context.commitBorderOutset(borderOutset.release()); |
7138 } | 7138 } |
7139 | 7139 |
7140 if (!context.canAdvance()) | 7140 if (!context.canAdvance()) |
7141 return false; | 7141 return false; |
7142 | 7142 |
7143 parser.m_valueList->next(); | 7143 parser.m_valueList->next(); |
7144 } | 7144 } |
7145 | 7145 |
(...skipping 28 matching lines...) Expand all Loading... |
7174 return 0; | 7174 return 0; |
7175 } | 7175 } |
7176 | 7176 |
7177 static bool isBorderImageRepeatKeyword(int id) | 7177 static bool isBorderImageRepeatKeyword(int id) |
7178 { | 7178 { |
7179 return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace
|| id == CSSValueRound; | 7179 return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace
|| id == CSSValueRound; |
7180 } | 7180 } |
7181 | 7181 |
7182 bool BisonCSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result) | 7182 bool BisonCSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result) |
7183 { | 7183 { |
7184 RefPtr<CSSPrimitiveValue> firstValue; | 7184 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue; |
7185 RefPtr<CSSPrimitiveValue> secondValue; | 7185 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue; |
7186 CSSParserValue* val = m_valueList->current(); | 7186 CSSParserValue* val = m_valueList->current(); |
7187 if (!val) | 7187 if (!val) |
7188 return false; | 7188 return false; |
7189 if (isBorderImageRepeatKeyword(val->id)) | 7189 if (isBorderImageRepeatKeyword(val->id)) |
7190 firstValue = cssValuePool().createIdentifierValue(val->id); | 7190 firstValue = cssValuePool().createIdentifierValue(val->id); |
7191 else | 7191 else |
7192 return false; | 7192 return false; |
7193 | 7193 |
7194 val = m_valueList->next(); | 7194 val = m_valueList->next(); |
7195 if (val) { | 7195 if (val) { |
7196 if (isBorderImageRepeatKeyword(val->id)) | 7196 if (isBorderImageRepeatKeyword(val->id)) |
7197 secondValue = cssValuePool().createIdentifierValue(val->id); | 7197 secondValue = cssValuePool().createIdentifierValue(val->id); |
7198 else if (!inShorthand()) { | 7198 else if (!inShorthand()) { |
7199 // If we're not parsing a shorthand then we are invalid. | 7199 // If we're not parsing a shorthand then we are invalid. |
7200 return false; | 7200 return false; |
7201 } else { | 7201 } else { |
7202 // We need to rewind the value list, so that when its advanced we'll | 7202 // We need to rewind the value list, so that when its advanced we'll |
7203 // end up back at this value. | 7203 // end up back at this value. |
7204 m_valueList->previous(); | 7204 m_valueList->previous(); |
7205 secondValue = firstValue; | 7205 secondValue = firstValue; |
7206 } | 7206 } |
7207 } else | 7207 } else |
7208 secondValue = firstValue; | 7208 secondValue = firstValue; |
7209 | 7209 |
7210 result = createPrimitiveValuePair(firstValue, secondValue); | 7210 result = createPrimitiveValuePair(firstValue, secondValue); |
7211 return true; | 7211 return true; |
7212 } | 7212 } |
7213 | 7213 |
7214 class BorderImageSliceParseContext { | 7214 class BorderImageSliceParseContext { |
| 7215 DISALLOW_ALLOCATION(); |
7215 public: | 7216 public: |
7216 BorderImageSliceParseContext(BisonCSSParser* parser) | 7217 BorderImageSliceParseContext(BisonCSSParser* parser) |
7217 : m_parser(parser) | 7218 : m_parser(parser) |
7218 , m_allowNumber(true) | 7219 , m_allowNumber(true) |
7219 , m_allowFill(true) | 7220 , m_allowFill(true) |
7220 , m_allowFinalCommit(false) | 7221 , m_allowFinalCommit(false) |
7221 , m_fill(false) | 7222 , m_fill(false) |
7222 { } | 7223 { } |
7223 | 7224 |
7224 bool allowNumber() const { return m_allowNumber; } | 7225 bool allowNumber() const { return m_allowNumber; } |
7225 bool allowFill() const { return m_allowFill; } | 7226 bool allowFill() const { return m_allowFill; } |
7226 bool allowFinalCommit() const { return m_allowFinalCommit; } | 7227 bool allowFinalCommit() const { return m_allowFinalCommit; } |
7227 CSSPrimitiveValue* top() const { return m_top.get(); } | 7228 CSSPrimitiveValue* top() const { return m_top.get(); } |
7228 | 7229 |
7229 void commitNumber(CSSParserValue* v) | 7230 void commitNumber(CSSParserValue* v) |
7230 { | 7231 { |
7231 RefPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v)
; | 7232 RefPtrWillBeRawPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNum
ericValue(v); |
7232 if (!m_top) | 7233 if (!m_top) |
7233 m_top = val; | 7234 m_top = val; |
7234 else if (!m_right) | 7235 else if (!m_right) |
7235 m_right = val; | 7236 m_right = val; |
7236 else if (!m_bottom) | 7237 else if (!m_bottom) |
7237 m_bottom = val; | 7238 m_bottom = val; |
7238 else { | 7239 else { |
7239 ASSERT(!m_left); | 7240 ASSERT(!m_left); |
7240 m_left = val; | 7241 m_left = val; |
7241 } | 7242 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7273 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.
release()), m_fill); | 7274 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.
release()), m_fill); |
7274 } | 7275 } |
7275 | 7276 |
7276 private: | 7277 private: |
7277 BisonCSSParser* m_parser; | 7278 BisonCSSParser* m_parser; |
7278 | 7279 |
7279 bool m_allowNumber; | 7280 bool m_allowNumber; |
7280 bool m_allowFill; | 7281 bool m_allowFill; |
7281 bool m_allowFinalCommit; | 7282 bool m_allowFinalCommit; |
7282 | 7283 |
7283 RefPtr<CSSPrimitiveValue> m_top; | 7284 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; |
7284 RefPtr<CSSPrimitiveValue> m_right; | 7285 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; |
7285 RefPtr<CSSPrimitiveValue> m_bottom; | 7286 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; |
7286 RefPtr<CSSPrimitiveValue> m_left; | 7287 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; |
7287 | 7288 |
7288 bool m_fill; | 7289 bool m_fill; |
7289 }; | 7290 }; |
7290 | 7291 |
7291 bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBeRaw
Ptr<CSSBorderImageSliceValue>& result) | 7292 bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBeRaw
Ptr<CSSBorderImageSliceValue>& result) |
7292 { | 7293 { |
7293 BorderImageSliceParseContext context(this); | 7294 BorderImageSliceParseContext context(this); |
7294 CSSParserValue* val; | 7295 CSSParserValue* val; |
7295 while ((val = m_valueList->current())) { | 7296 while ((val = m_valueList->current())) { |
7296 // FIXME calc() http://webkit.org/b/16662 : calc is parsed but values ar
e not created yet. | 7297 // FIXME calc() http://webkit.org/b/16662 : calc is parsed but values ar
e not created yet. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7332 , m_allowNumber(true) | 7333 , m_allowNumber(true) |
7333 , m_allowFinalCommit(false) | 7334 , m_allowFinalCommit(false) |
7334 { } | 7335 { } |
7335 | 7336 |
7336 bool allowNumber() const { return m_allowNumber; } | 7337 bool allowNumber() const { return m_allowNumber; } |
7337 bool allowFinalCommit() const { return m_allowFinalCommit; } | 7338 bool allowFinalCommit() const { return m_allowFinalCommit; } |
7338 CSSPrimitiveValue* top() const { return m_top.get(); } | 7339 CSSPrimitiveValue* top() const { return m_top.get(); } |
7339 | 7340 |
7340 void commitNumber(CSSParserValue* v) | 7341 void commitNumber(CSSParserValue* v) |
7341 { | 7342 { |
7342 RefPtr<CSSPrimitiveValue> val; | 7343 RefPtrWillBeRawPtr<CSSPrimitiveValue> val; |
7343 if (v->id == CSSValueAuto) | 7344 if (v->id == CSSValueAuto) |
7344 val = cssValuePool().createIdentifierValue(v->id); | 7345 val = cssValuePool().createIdentifierValue(v->id); |
7345 else | 7346 else |
7346 val = m_parser->createPrimitiveNumericValue(v); | 7347 val = m_parser->createPrimitiveNumericValue(v); |
7347 | 7348 |
7348 if (!m_top) | 7349 if (!m_top) |
7349 m_top = val; | 7350 m_top = val; |
7350 else if (!m_right) | 7351 else if (!m_right) |
7351 m_right = val; | 7352 m_right = val; |
7352 else if (!m_bottom) | 7353 else if (!m_bottom) |
7353 m_bottom = val; | 7354 m_bottom = val; |
7354 else { | 7355 else { |
7355 ASSERT(!m_left); | 7356 ASSERT(!m_left); |
7356 m_left = val; | 7357 m_left = val; |
7357 } | 7358 } |
7358 | 7359 |
7359 m_allowNumber = !m_left; | 7360 m_allowNumber = !m_left; |
7360 m_allowFinalCommit = true; | 7361 m_allowFinalCommit = true; |
7361 } | 7362 } |
7362 | 7363 |
7363 void setAllowFinalCommit() { m_allowFinalCommit = true; } | 7364 void setAllowFinalCommit() { m_allowFinalCommit = true; } |
7364 void setTop(PassRefPtr<CSSPrimitiveValue> val) { m_top = val; } | 7365 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } |
7365 | 7366 |
7366 PassRefPtr<CSSPrimitiveValue> commitBorderImageQuad() | 7367 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> commitBorderImageQuad() |
7367 { | 7368 { |
7368 // We need to clone and repeat values for any omissions. | 7369 // We need to clone and repeat values for any omissions. |
7369 ASSERT(m_top); | 7370 ASSERT(m_top); |
7370 if (!m_right) { | 7371 if (!m_right) { |
7371 m_right = m_top; | 7372 m_right = m_top; |
7372 m_bottom = m_top; | 7373 m_bottom = m_top; |
7373 m_left = m_top; | 7374 m_left = m_top; |
7374 } | 7375 } |
7375 if (!m_bottom) { | 7376 if (!m_bottom) { |
7376 m_bottom = m_top; | 7377 m_bottom = m_top; |
(...skipping 12 matching lines...) Expand all Loading... |
7389 // Make our new value now. | 7390 // Make our new value now. |
7390 return cssValuePool().createValue(quad.release()); | 7391 return cssValuePool().createValue(quad.release()); |
7391 } | 7392 } |
7392 | 7393 |
7393 private: | 7394 private: |
7394 BisonCSSParser* m_parser; | 7395 BisonCSSParser* m_parser; |
7395 | 7396 |
7396 bool m_allowNumber; | 7397 bool m_allowNumber; |
7397 bool m_allowFinalCommit; | 7398 bool m_allowFinalCommit; |
7398 | 7399 |
7399 RefPtr<CSSPrimitiveValue> m_top; | 7400 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; |
7400 RefPtr<CSSPrimitiveValue> m_right; | 7401 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; |
7401 RefPtr<CSSPrimitiveValue> m_bottom; | 7402 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; |
7402 RefPtr<CSSPrimitiveValue> m_left; | 7403 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; |
7403 }; | 7404 }; |
7404 | 7405 |
7405 bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtr<CSSPrimitiveV
alue>& result) | 7406 bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<C
SSPrimitiveValue>& result) |
7406 { | 7407 { |
7407 BorderImageQuadParseContext context(this); | 7408 BorderImageQuadParseContext context(this); |
7408 CSSParserValue* val; | 7409 CSSParserValue* val; |
7409 while ((val = m_valueList->current())) { | 7410 while ((val = m_valueList->current())) { |
7410 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod
e) || val->id == CSSValueAuto)) { | 7411 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod
e) || val->id == CSSValueAuto)) { |
7411 context.commitNumber(val); | 7412 context.commitNumber(val); |
7412 } else if (!inShorthand()) { | 7413 } else if (!inShorthand()) { |
7413 // If we're not parsing a shorthand then we are invalid. | 7414 // If we're not parsing a shorthand then we are invalid. |
7414 return false; | 7415 return false; |
7415 } else { | 7416 } else { |
7416 if (context.allowFinalCommit()) | 7417 if (context.allowFinalCommit()) |
7417 m_valueList->previous(); // The shorthand loop will advance back
to this point. | 7418 m_valueList->previous(); // The shorthand loop will advance back
to this point. |
7418 break; | 7419 break; |
7419 } | 7420 } |
7420 m_valueList->next(); | 7421 m_valueList->next(); |
7421 } | 7422 } |
7422 | 7423 |
7423 if (context.allowFinalCommit()) { | 7424 if (context.allowFinalCommit()) { |
7424 // Need to fully commit as a single value. | 7425 // Need to fully commit as a single value. |
7425 result = context.commitBorderImageQuad(); | 7426 result = context.commitBorderImageQuad(); |
7426 return true; | 7427 return true; |
7427 } | 7428 } |
7428 return false; | 7429 return false; |
7429 } | 7430 } |
7430 | 7431 |
7431 bool BisonCSSParser::parseBorderImageWidth(RefPtr<CSSPrimitiveValue>& result) | 7432 bool BisonCSSParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSPrimitiveValue>
& result) |
7432 { | 7433 { |
7433 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); | 7434 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); |
7434 } | 7435 } |
7435 | 7436 |
7436 bool BisonCSSParser::parseBorderImageOutset(RefPtr<CSSPrimitiveValue>& result) | 7437 bool BisonCSSParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSPrimitiveValue
>& result) |
7437 { | 7438 { |
7438 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); | 7439 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); |
7439 } | 7440 } |
7440 | 7441 |
7441 bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important) | 7442 bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important) |
7442 { | 7443 { |
7443 unsigned num = m_valueList->size(); | 7444 unsigned num = m_valueList->size(); |
7444 if (num > 9) | 7445 if (num > 9) |
7445 return false; | 7446 return false; |
7446 | 7447 |
7447 ShorthandScope scope(this, propId); | 7448 ShorthandScope scope(this, propId); |
7448 RefPtr<CSSPrimitiveValue> radii[2][4]; | 7449 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; |
7449 | 7450 |
7450 unsigned indexAfterSlash = 0; | 7451 unsigned indexAfterSlash = 0; |
7451 for (unsigned i = 0; i < num; ++i) { | 7452 for (unsigned i = 0; i < num; ++i) { |
7452 CSSParserValue* value = m_valueList->valueAt(i); | 7453 CSSParserValue* value = m_valueList->valueAt(i); |
7453 if (value->unit == CSSParserValue::Operator) { | 7454 if (value->unit == CSSParserValue::Operator) { |
7454 if (value->iValue != '/') | 7455 if (value->iValue != '/') |
7455 return false; | 7456 return false; |
7456 | 7457 |
7457 if (!i || indexAfterSlash || i + 1 == num || num > i + 5) | 7458 if (!i || indexAfterSlash || i + 1 == num || num > i + 5) |
7458 return false; | 7459 return false; |
7459 | 7460 |
7460 indexAfterSlash = i + 1; | 7461 indexAfterSlash = i + 1; |
7461 completeBorderRadii(radii[0]); | 7462 completeBorderRadii(radii[0]); |
7462 continue; | 7463 continue; |
7463 } | 7464 } |
7464 | 7465 |
7465 if (i - indexAfterSlash >= 4) | 7466 if (i - indexAfterSlash >= 4) |
7466 return false; | 7467 return false; |
7467 | 7468 |
7468 if (!validUnit(value, FLength | FPercent | FNonNeg)) | 7469 if (!validUnit(value, FLength | FPercent | FNonNeg)) |
7469 return false; | 7470 return false; |
7470 | 7471 |
7471 RefPtr<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value); | 7472 RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = createPrimitiveNumericVal
ue(value); |
7472 | 7473 |
7473 if (!indexAfterSlash) { | 7474 if (!indexAfterSlash) { |
7474 radii[0][i] = radius; | 7475 radii[0][i] = radius; |
7475 | 7476 |
7476 // Legacy syntax: -webkit-border-radius: l1 l2; is equivalent to bor
der-radius: l1 / l2; | 7477 // Legacy syntax: -webkit-border-radius: l1 l2; is equivalent to bor
der-radius: l1 / l2; |
7477 if (num == 2 && propId == CSSPropertyWebkitBorderRadius) { | 7478 if (num == 2 && propId == CSSPropertyWebkitBorderRadius) { |
7478 indexAfterSlash = 1; | 7479 indexAfterSlash = 1; |
7479 completeBorderRadii(radii[0]); | 7480 completeBorderRadii(radii[0]); |
7480 } | 7481 } |
7481 } else | 7482 } else |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7524 addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(narrow
PrecisionToFloat(lvalue->fValue), narrowPrecisionToFloat(rvalue->fValue)), impor
tant); | 7525 addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(narrow
PrecisionToFloat(lvalue->fValue), narrowPrecisionToFloat(rvalue->fValue)), impor
tant); |
7525 | 7526 |
7526 return true; | 7527 return true; |
7527 } | 7528 } |
7528 | 7529 |
7529 bool BisonCSSParser::parseCounter(CSSPropertyID propId, int defaultValue, bool i
mportant) | 7530 bool BisonCSSParser::parseCounter(CSSPropertyID propId, int defaultValue, bool i
mportant) |
7530 { | 7531 { |
7531 enum { ID, VAL } state = ID; | 7532 enum { ID, VAL } state = ID; |
7532 | 7533 |
7533 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 7534 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
7534 RefPtr<CSSPrimitiveValue> counterName; | 7535 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName; |
7535 | 7536 |
7536 while (true) { | 7537 while (true) { |
7537 CSSParserValue* val = m_valueList->current(); | 7538 CSSParserValue* val = m_valueList->current(); |
7538 switch (state) { | 7539 switch (state) { |
7539 case ID: | 7540 case ID: |
7540 if (val && val->unit == CSSPrimitiveValue::CSS_IDENT) { | 7541 if (val && val->unit == CSSPrimitiveValue::CSS_IDENT) { |
7541 counterName = createPrimitiveStringValue(val); | 7542 counterName = createPrimitiveStringValue(val); |
7542 state = VAL; | 7543 state = VAL; |
7543 m_valueList->next(); | 7544 m_valueList->next(); |
7544 continue; | 7545 continue; |
(...skipping 17 matching lines...) Expand all Loading... |
7562 | 7563 |
7563 if (list->length() > 0) { | 7564 if (list->length() > 0) { |
7564 addProperty(propId, list.release(), important); | 7565 addProperty(propId, list.release(), important); |
7565 return true; | 7566 return true; |
7566 } | 7567 } |
7567 | 7568 |
7568 return false; | 7569 return false; |
7569 } | 7570 } |
7570 | 7571 |
7571 // This should go away once we drop support for -webkit-gradient | 7572 // This should go away once we drop support for -webkit-gradient |
7572 static PassRefPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue
* a, bool horizontal) | 7573 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CS
SParserValue* a, bool horizontal) |
7573 { | 7574 { |
7574 RefPtr<CSSPrimitiveValue> result; | 7575 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; |
7575 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { | 7576 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { |
7576 if ((equalIgnoringCase(a, "left") && horizontal) | 7577 if ((equalIgnoringCase(a, "left") && horizontal) |
7577 || (equalIgnoringCase(a, "top") && !horizontal)) | 7578 || (equalIgnoringCase(a, "top") && !horizontal)) |
7578 result = cssValuePool().createValue(0., CSSPrimitiveValue::CSS_PERCE
NTAGE); | 7579 result = cssValuePool().createValue(0., CSSPrimitiveValue::CSS_PERCE
NTAGE); |
7579 else if ((equalIgnoringCase(a, "right") && horizontal) | 7580 else if ((equalIgnoringCase(a, "right") && horizontal) |
7580 || (equalIgnoringCase(a, "bottom") && !horizontal)) | 7581 || (equalIgnoringCase(a, "bottom") && !horizontal)) |
7581 result = cssValuePool().createValue(100., CSSPrimitiveValue::CSS_PER
CENTAGE); | 7582 result = cssValuePool().createValue(100., CSSPrimitiveValue::CSS_PER
CENTAGE); |
7582 else if (equalIgnoringCase(a, "center")) | 7583 else if (equalIgnoringCase(a, "center")) |
7583 result = cssValuePool().createValue(50., CSSPrimitiveValue::CSS_PERC
ENTAGE); | 7584 result = cssValuePool().createValue(50., CSSPrimitiveValue::CSS_PERC
ENTAGE); |
7584 } else if (a->unit == CSSPrimitiveValue::CSS_NUMBER || a->unit == CSSPrimiti
veValue::CSS_PERCENTAGE) | 7585 } else if (a->unit == CSSPrimitiveValue::CSS_NUMBER || a->unit == CSSPrimiti
veValue::CSS_PERCENTAGE) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7686 a = args->next(); | 7687 a = args->next(); |
7687 if (!isComma(a)) | 7688 if (!isComma(a)) |
7688 return false; | 7689 return false; |
7689 | 7690 |
7690 // Next comes the starting point for the gradient as an x y pair. There is
no | 7691 // Next comes the starting point for the gradient as an x y pair. There is
no |
7691 // comma between the x and the y values. | 7692 // comma between the x and the y values. |
7692 // First X. It can be left, right, number or percent. | 7693 // First X. It can be left, right, number or percent. |
7693 a = args->next(); | 7694 a = args->next(); |
7694 if (!a) | 7695 if (!a) |
7695 return false; | 7696 return false; |
7696 RefPtr<CSSPrimitiveValue> point = parseDeprecatedGradientPoint(a, true); | 7697 RefPtrWillBeRawPtr<CSSPrimitiveValue> point = parseDeprecatedGradientPoint(a
, true); |
7697 if (!point) | 7698 if (!point) |
7698 return false; | 7699 return false; |
7699 result->setFirstX(point.release()); | 7700 result->setFirstX(point.release()); |
7700 | 7701 |
7701 // First Y. It can be top, bottom, number or percent. | 7702 // First Y. It can be top, bottom, number or percent. |
7702 a = args->next(); | 7703 a = args->next(); |
7703 if (!a) | 7704 if (!a) |
7704 return false; | 7705 return false; |
7705 point = parseDeprecatedGradientPoint(a, false); | 7706 point = parseDeprecatedGradientPoint(a, false); |
7706 if (!point) | 7707 if (!point) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7776 result->addStop(stop); | 7777 result->addStop(stop); |
7777 | 7778 |
7778 // Advance | 7779 // Advance |
7779 a = args->next(); | 7780 a = args->next(); |
7780 } | 7781 } |
7781 | 7782 |
7782 gradient = result.release(); | 7783 gradient = result.release(); |
7783 return true; | 7784 return true; |
7784 } | 7785 } |
7785 | 7786 |
7786 static PassRefPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserValue* a, boo
l& isHorizontal) | 7787 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserV
alue* a, bool& isHorizontal) |
7787 { | 7788 { |
7788 if (a->unit != CSSPrimitiveValue::CSS_IDENT) | 7789 if (a->unit != CSSPrimitiveValue::CSS_IDENT) |
7789 return 0; | 7790 return 0; |
7790 | 7791 |
7791 switch (a->id) { | 7792 switch (a->id) { |
7792 case CSSValueLeft: | 7793 case CSSValueLeft: |
7793 case CSSValueRight: | 7794 case CSSValueRight: |
7794 isHorizontal = true; | 7795 isHorizontal = true; |
7795 break; | 7796 break; |
7796 case CSSValueTop: | 7797 case CSSValueTop: |
7797 case CSSValueBottom: | 7798 case CSSValueBottom: |
7798 isHorizontal = false; | 7799 isHorizontal = false; |
7799 break; | 7800 break; |
7800 default: | 7801 default: |
7801 return 0; | 7802 return 0; |
7802 } | 7803 } |
7803 return cssValuePool().createIdentifierValue(a->id); | 7804 return cssValuePool().createIdentifierValue(a->id); |
7804 } | 7805 } |
7805 | 7806 |
7806 static PassRefPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(BisonCSSParser*
p, CSSParserValue* value) | 7807 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(Bis
onCSSParser* p, CSSParserValue* value) |
7807 { | 7808 { |
7808 CSSValueID id = value->id; | 7809 CSSValueID id = value->id; |
7809 if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowt
ext) || id == CSSValueMenu || id == CSSValueCurrentcolor) | 7810 if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowt
ext) || id == CSSValueMenu || id == CSSValueCurrentcolor) |
7810 return cssValuePool().createIdentifierValue(id); | 7811 return cssValuePool().createIdentifierValue(id); |
7811 | 7812 |
7812 return p->parseColor(value); | 7813 return p->parseColor(value); |
7813 } | 7814 } |
7814 | 7815 |
7815 bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList
, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating) | 7816 bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList
, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating) |
7816 { | 7817 { |
(...skipping 10 matching lines...) Expand all Loading... |
7827 | 7828 |
7828 bool expectComma = false; | 7829 bool expectComma = false; |
7829 // Look for angle. | 7830 // Look for angle. |
7830 if (validUnit(a, FAngle, HTMLStandardMode)) { | 7831 if (validUnit(a, FAngle, HTMLStandardMode)) { |
7831 result->setAngle(createPrimitiveNumericValue(a)); | 7832 result->setAngle(createPrimitiveNumericValue(a)); |
7832 | 7833 |
7833 args->next(); | 7834 args->next(); |
7834 expectComma = true; | 7835 expectComma = true; |
7835 } else { | 7836 } else { |
7836 // Look one or two optional keywords that indicate a side or corner. | 7837 // Look one or two optional keywords that indicate a side or corner. |
7837 RefPtr<CSSPrimitiveValue> startX, startY; | 7838 RefPtrWillBeRawPtr<CSSPrimitiveValue> startX, startY; |
7838 | 7839 |
7839 RefPtr<CSSPrimitiveValue> location; | 7840 RefPtrWillBeRawPtr<CSSPrimitiveValue> location; |
7840 bool isHorizontal = false; | 7841 bool isHorizontal = false; |
7841 if ((location = valueFromSideKeyword(a, isHorizontal))) { | 7842 if ((location = valueFromSideKeyword(a, isHorizontal))) { |
7842 if (isHorizontal) | 7843 if (isHorizontal) |
7843 startX = location; | 7844 startX = location; |
7844 else | 7845 else |
7845 startY = location; | 7846 startY = location; |
7846 | 7847 |
7847 if ((a = args->next())) { | 7848 if ((a = args->next())) { |
7848 if ((location = valueFromSideKeyword(a, isHorizontal))) { | 7849 if ((location = valueFromSideKeyword(a, isHorizontal))) { |
7849 if (isHorizontal) { | 7850 if (isHorizontal) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7913 if (!a) | 7914 if (!a) |
7914 return false; | 7915 return false; |
7915 } | 7916 } |
7916 | 7917 |
7917 result->setFirstX(toCSSPrimitiveValue(centerX.get())); | 7918 result->setFirstX(toCSSPrimitiveValue(centerX.get())); |
7918 result->setSecondX(toCSSPrimitiveValue(centerX.get())); | 7919 result->setSecondX(toCSSPrimitiveValue(centerX.get())); |
7919 // CSS3 radial gradients always share the same start and end point. | 7920 // CSS3 radial gradients always share the same start and end point. |
7920 result->setFirstY(toCSSPrimitiveValue(centerY.get())); | 7921 result->setFirstY(toCSSPrimitiveValue(centerY.get())); |
7921 result->setSecondY(toCSSPrimitiveValue(centerY.get())); | 7922 result->setSecondY(toCSSPrimitiveValue(centerY.get())); |
7922 | 7923 |
7923 RefPtr<CSSPrimitiveValue> shapeValue; | 7924 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; |
7924 RefPtr<CSSPrimitiveValue> sizeValue; | 7925 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue; |
7925 | 7926 |
7926 // Optional shape and/or size in any order. | 7927 // Optional shape and/or size in any order. |
7927 for (int i = 0; i < 2; ++i) { | 7928 for (int i = 0; i < 2; ++i) { |
7928 if (a->unit != CSSPrimitiveValue::CSS_IDENT) | 7929 if (a->unit != CSSPrimitiveValue::CSS_IDENT) |
7929 break; | 7930 break; |
7930 | 7931 |
7931 bool foundValue = false; | 7932 bool foundValue = false; |
7932 switch (a->id) { | 7933 switch (a->id) { |
7933 case CSSValueCircle: | 7934 case CSSValueCircle: |
7934 case CSSValueEllipse: | 7935 case CSSValueEllipse: |
(...skipping 19 matching lines...) Expand all Loading... |
7954 return false; | 7955 return false; |
7955 | 7956 |
7956 expectComma = true; | 7957 expectComma = true; |
7957 } | 7958 } |
7958 } | 7959 } |
7959 | 7960 |
7960 result->setShape(shapeValue); | 7961 result->setShape(shapeValue); |
7961 result->setSizingBehavior(sizeValue); | 7962 result->setSizingBehavior(sizeValue); |
7962 | 7963 |
7963 // Or, two lengths or percentages | 7964 // Or, two lengths or percentages |
7964 RefPtr<CSSPrimitiveValue> horizontalSize; | 7965 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize; |
7965 RefPtr<CSSPrimitiveValue> verticalSize; | 7966 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize; |
7966 | 7967 |
7967 if (!shapeValue && !sizeValue) { | 7968 if (!shapeValue && !sizeValue) { |
7968 if (validUnit(a, FLength | FPercent)) { | 7969 if (validUnit(a, FLength | FPercent)) { |
7969 horizontalSize = createPrimitiveNumericValue(a); | 7970 horizontalSize = createPrimitiveNumericValue(a); |
7970 a = args->next(); | 7971 a = args->next(); |
7971 if (!a) | 7972 if (!a) |
7972 return false; | 7973 return false; |
7973 | 7974 |
7974 expectComma = true; | 7975 expectComma = true; |
7975 } | 7976 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8016 result->setAngle(createPrimitiveNumericValue(a)); | 8017 result->setAngle(createPrimitiveNumericValue(a)); |
8017 | 8018 |
8018 args->next(); | 8019 args->next(); |
8019 expectComma = true; | 8020 expectComma = true; |
8020 } else if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, "
to")) { | 8021 } else if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, "
to")) { |
8021 // to [ [left | right] || [top | bottom] ] | 8022 // to [ [left | right] || [top | bottom] ] |
8022 a = args->next(); | 8023 a = args->next(); |
8023 if (!a) | 8024 if (!a) |
8024 return false; | 8025 return false; |
8025 | 8026 |
8026 RefPtr<CSSPrimitiveValue> endX, endY; | 8027 RefPtrWillBeRawPtr<CSSPrimitiveValue> endX, endY; |
8027 RefPtr<CSSPrimitiveValue> location; | 8028 RefPtrWillBeRawPtr<CSSPrimitiveValue> location; |
8028 bool isHorizontal = false; | 8029 bool isHorizontal = false; |
8029 | 8030 |
8030 location = valueFromSideKeyword(a, isHorizontal); | 8031 location = valueFromSideKeyword(a, isHorizontal); |
8031 if (!location) | 8032 if (!location) |
8032 return false; | 8033 return false; |
8033 | 8034 |
8034 if (isHorizontal) | 8035 if (isHorizontal) |
8035 endX = location; | 8036 endX = location; |
8036 else | 8037 else |
8037 endY = location; | 8038 endY = location; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8077 CSSParserValueList* args = valueList->current()->function->args.get(); | 8078 CSSParserValueList* args = valueList->current()->function->args.get(); |
8078 if (!args || !args->size()) | 8079 if (!args || !args->size()) |
8079 return false; | 8080 return false; |
8080 | 8081 |
8081 CSSParserValue* a = args->current(); | 8082 CSSParserValue* a = args->current(); |
8082 if (!a) | 8083 if (!a) |
8083 return false; | 8084 return false; |
8084 | 8085 |
8085 bool expectComma = false; | 8086 bool expectComma = false; |
8086 | 8087 |
8087 RefPtr<CSSPrimitiveValue> shapeValue; | 8088 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; |
8088 RefPtr<CSSPrimitiveValue> sizeValue; | 8089 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue; |
8089 RefPtr<CSSPrimitiveValue> horizontalSize; | 8090 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize; |
8090 RefPtr<CSSPrimitiveValue> verticalSize; | 8091 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize; |
8091 | 8092 |
8092 // First part of grammar, the size/shape clause: | 8093 // First part of grammar, the size/shape clause: |
8093 // [ circle || <length> ] | | 8094 // [ circle || <length> ] | |
8094 // [ ellipse || [ <length> | <percentage> ]{2} ] | | 8095 // [ ellipse || [ <length> | <percentage> ]{2} ] | |
8095 // [ [ circle | ellipse] || <size-keyword> ] | 8096 // [ [ circle | ellipse] || <size-keyword> ] |
8096 for (int i = 0; i < 3; ++i) { | 8097 for (int i = 0; i < 3; ++i) { |
8097 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { | 8098 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { |
8098 bool badIdent = false; | 8099 bool badIdent = false; |
8099 switch (a->id) { | 8100 switch (a->id) { |
8100 case CSSValueCircle: | 8101 case CSSValueCircle: |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8317 if (!a || !parseFillImage(args, toImageValue)) | 8318 if (!a || !parseFillImage(args, toImageValue)) |
8318 return false; | 8319 return false; |
8319 a = args->next(); | 8320 a = args->next(); |
8320 | 8321 |
8321 // Skip a comma | 8322 // Skip a comma |
8322 if (!isComma(a)) | 8323 if (!isComma(a)) |
8323 return false; | 8324 return false; |
8324 a = args->next(); | 8325 a = args->next(); |
8325 | 8326 |
8326 // The third argument is the crossfade value. It is a percentage or a fracti
onal number. | 8327 // The third argument is the crossfade value. It is a percentage or a fracti
onal number. |
8327 RefPtr<CSSPrimitiveValue> percentage; | 8328 RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage; |
8328 if (!a) | 8329 if (!a) |
8329 return false; | 8330 return false; |
8330 | 8331 |
8331 if (a->unit == CSSPrimitiveValue::CSS_PERCENTAGE) | 8332 if (a->unit == CSSPrimitiveValue::CSS_PERCENTAGE) |
8332 percentage = cssValuePool().createValue(clampTo<double>(a->fValue / 100,
0, 1), CSSPrimitiveValue::CSS_NUMBER); | 8333 percentage = cssValuePool().createValue(clampTo<double>(a->fValue / 100,
0, 1), CSSPrimitiveValue::CSS_NUMBER); |
8333 else if (a->unit == CSSPrimitiveValue::CSS_NUMBER) | 8334 else if (a->unit == CSSPrimitiveValue::CSS_NUMBER) |
8334 percentage = cssValuePool().createValue(clampTo<double>(a->fValue, 0, 1)
, CSSPrimitiveValue::CSS_NUMBER); | 8335 percentage = cssValuePool().createValue(clampTo<double>(a->fValue, 0, 1)
, CSSPrimitiveValue::CSS_NUMBER); |
8335 else | 8336 else |
8336 return false; | 8337 return false; |
8337 | 8338 |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9067 return true; | 9068 return true; |
9068 default: | 9069 default: |
9069 return false; | 9070 return false; |
9070 } | 9071 } |
9071 } | 9072 } |
9072 | 9073 |
9073 bool BisonCSSParser::parseTextEmphasisStyle(bool important) | 9074 bool BisonCSSParser::parseTextEmphasisStyle(bool important) |
9074 { | 9075 { |
9075 unsigned valueListSize = m_valueList->size(); | 9076 unsigned valueListSize = m_valueList->size(); |
9076 | 9077 |
9077 RefPtr<CSSPrimitiveValue> fill; | 9078 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill; |
9078 RefPtr<CSSPrimitiveValue> shape; | 9079 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape; |
9079 | 9080 |
9080 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 9081 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
9081 if (value->unit == CSSPrimitiveValue::CSS_STRING) { | 9082 if (value->unit == CSSPrimitiveValue::CSS_STRING) { |
9082 if (fill || shape || (valueListSize != 1 && !inShorthand())) | 9083 if (fill || shape || (valueListSize != 1 && !inShorthand())) |
9083 return false; | 9084 return false; |
9084 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin
gValue(value), important); | 9085 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin
gValue(value), important); |
9085 m_valueList->next(); | 9086 m_valueList->next(); |
9086 return true; | 9087 return true; |
9087 } | 9088 } |
9088 | 9089 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9245 m_valueList->next(); | 9246 m_valueList->next(); |
9246 } | 9247 } |
9247 } | 9248 } |
9248 settings->append(CSSFontFeatureValue::create(tag, tagValue)); | 9249 settings->append(CSSFontFeatureValue::create(tag, tagValue)); |
9249 return true; | 9250 return true; |
9250 } | 9251 } |
9251 | 9252 |
9252 bool BisonCSSParser::parseFontFeatureSettings(bool important) | 9253 bool BisonCSSParser::parseFontFeatureSettings(bool important) |
9253 { | 9254 { |
9254 if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal
) { | 9255 if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal
) { |
9255 RefPtr<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierV
alue(CSSValueNormal); | 9256 RefPtrWillBeRawPtr<CSSPrimitiveValue> normalValue = cssValuePool().creat
eIdentifierValue(CSSValueNormal); |
9256 m_valueList->next(); | 9257 m_valueList->next(); |
9257 addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(),
important); | 9258 addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(),
important); |
9258 return true; | 9259 return true; |
9259 } | 9260 } |
9260 | 9261 |
9261 RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparat
ed(); | 9262 RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparat
ed(); |
9262 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 9263 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
9263 if (!parseFontFeatureTag(settings.get())) | 9264 if (!parseFontFeatureTag(settings.get())) |
9264 return false; | 9265 return false; |
9265 | 9266 |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10245 { | 10246 { |
10246 // The tokenizer checks for the construct of an+b. | 10247 // The tokenizer checks for the construct of an+b. |
10247 // However, since the {ident} rule precedes the {nth} rule, some of those | 10248 // However, since the {ident} rule precedes the {nth} rule, some of those |
10248 // tokens are identified as string literal. Furthermore we need to accept | 10249 // tokens are identified as string literal. Furthermore we need to accept |
10249 // "odd" and "even" which does not match to an+b. | 10250 // "odd" and "even" which does not match to an+b. |
10250 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10251 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
10251 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10252 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
10252 } | 10253 } |
10253 | 10254 |
10254 } | 10255 } |
OLD | NEW |