Chromium Code Reviews| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF ::equalIgnoringCase(b, a.characters16(), length); | 127 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF ::equalIgnoringCase(b, a.characters16(), length); |
| 128 } | 128 } |
| 129 | 129 |
| 130 template <unsigned N> | 130 template <unsigned N> |
| 131 static bool equalIgnoringCase(CSSParserValue* value, const char (&b)[N]) | 131 static bool equalIgnoringCase(CSSParserValue* value, const char (&b)[N]) |
| 132 { | 132 { |
| 133 ASSERT(value->unit == CSSPrimitiveValue::CSS_IDENT || value->unit == CSSPrim itiveValue::CSS_STRING); | 133 ASSERT(value->unit == CSSPrimitiveValue::CSS_IDENT || value->unit == CSSPrim itiveValue::CSS_STRING); |
| 134 return equalIgnoringCase(value->string, b); | 134 return equalIgnoringCase(value->string, b); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrim itiveValue> first, PassRefPtr<CSSPrimitiveValue> second, Pair::IdenticalValuesPo licy identicalValuesPolicy = Pair::DropIdenticalValues) | 137 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent icalValues) |
| 138 { | 138 { |
| 139 return cssValuePool().createValue(Pair::create(first, second, identicalValue sPolicy)); | 139 return cssValuePool().createValue(Pair::create(first, second, identicalValue sPolicy)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 class AnimationParseContext { | 142 class AnimationParseContext { |
| 143 public: | 143 public: |
| 144 AnimationParseContext() | 144 AnimationParseContext() |
| 145 : m_animationPropertyKeywordAllowed(true) | 145 : m_animationPropertyKeywordAllowed(true) |
| 146 , m_firstAnimationCommitted(false) | 146 , m_firstAnimationCommitted(false) |
| 147 , m_hasSeenAnimationPropertyKeyword(false) | 147 , m_hasSeenAnimationPropertyKeyword(false) |
| (...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1549 case CSSPrimitiveValue::CSS_KHZ: | 1549 case CSSPrimitiveValue::CSS_KHZ: |
| 1550 case CSSPrimitiveValue::CSS_DIMENSION: | 1550 case CSSPrimitiveValue::CSS_DIMENSION: |
| 1551 default: | 1551 default: |
| 1552 break; | 1552 break; |
| 1553 } | 1553 } |
| 1554 if (b && unitflags & FNonNeg && value->fValue < 0) | 1554 if (b && unitflags & FNonNeg && value->fValue < 0) |
| 1555 b = false; | 1555 b = false; |
| 1556 return b; | 1556 return b; |
| 1557 } | 1557 } |
| 1558 | 1558 |
| 1559 inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveNumericValue (CSSParserValue* value) | 1559 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitive NumericValue(CSSParserValue* value) |
| 1560 { | 1560 { |
| 1561 if (isVariableReference(value)) | 1561 if (isVariableReference(value)) |
| 1562 return createPrimitiveVariableReferenceValue(value); | 1562 return createPrimitiveVariableReferenceValue(value); |
| 1563 | 1563 |
| 1564 if (m_parsedCalculation) { | 1564 if (m_parsedCalculation) { |
| 1565 ASSERT(isCalculation(value)); | 1565 ASSERT(isCalculation(value)); |
| 1566 return CSSPrimitiveValue::create(m_parsedCalculation.release()); | 1566 return CSSPrimitiveValue::create(m_parsedCalculation.release()); |
| 1567 } | 1567 } |
| 1568 | 1568 |
| 1569 ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPr imitiveValue::CSS_KHZ) | 1569 ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPr imitiveValue::CSS_KHZ) |
| 1570 || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrim itiveValue::CSS_CHS) | 1570 || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrim itiveValue::CSS_CHS) |
| 1571 || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimit iveValue::CSS_VMAX) | 1571 || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimit iveValue::CSS_VMAX) |
| 1572 || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrim itiveValue::CSS_DPCM)); | 1572 || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrim itiveValue::CSS_DPCM)); |
| 1573 return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveVal ue::UnitTypes>(value->unit)); | 1573 return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveVal ue::UnitTypes>(value->unit)); |
| 1574 } | 1574 } |
| 1575 | 1575 |
| 1576 inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveStringValue( CSSParserValue* value) | 1576 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitive StringValue(CSSParserValue* value) |
| 1577 { | 1577 { |
| 1578 ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPri mitiveValue::CSS_IDENT); | 1578 ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPri mitiveValue::CSS_IDENT); |
| 1579 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRI NG); | 1579 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRI NG); |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveVariableRefe renceValue(CSSParserValue* value) | 1582 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitive VariableReferenceValue(CSSParserValue* value) |
| 1583 { | 1583 { |
| 1584 ASSERT(value->unit == CSSParserValue::Function && value->function->args->siz e() == 1); | 1584 ASSERT(value->unit == CSSParserValue::Function && value->function->args->siz e() == 1); |
| 1585 return CSSPrimitiveValue::create(value->function->args->valueAt(0)->string, CSSPrimitiveValue::CSS_VARIABLE_REFERENCE); | 1585 return CSSPrimitiveValue::create(value->function->args->valueAt(0)->string, CSSPrimitiveValue::CSS_VARIABLE_REFERENCE); |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 static inline bool isComma(CSSParserValue* value) | 1588 static inline bool isComma(CSSParserValue* value) |
| 1589 { | 1589 { |
| 1590 return value && value->unit == CSSParserValue::Operator && value->iValue == ','; | 1590 return value && value->unit == CSSParserValue::Operator && value->iValue == ','; |
| 1591 } | 1591 } |
| 1592 | 1592 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 bool BisonCSSParser::validWidthOrHeight(CSSParserValue* value) | 1617 bool BisonCSSParser::validWidthOrHeight(CSSParserValue* value) |
| 1618 { | 1618 { |
| 1619 int id = value->id; | 1619 int id = value->id; |
| 1620 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent) | 1620 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent) |
| 1621 return true; | 1621 return true; |
| 1622 return !id && validUnit(value, FLength | FPercent | FNonNeg); | 1622 return !id && validUnit(value, FLength | FPercent | FNonNeg); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseValidPrimitive(CSSValu eID identifier, CSSParserValue* value) | 1625 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseValidPrimi tive(CSSValueID identifier, CSSParserValue* value) |
| 1626 { | 1626 { |
| 1627 if (identifier) | 1627 if (identifier) |
| 1628 return cssValuePool().createIdentifierValue(identifier); | 1628 return cssValuePool().createIdentifierValue(identifier); |
| 1629 if (value->unit == CSSPrimitiveValue::CSS_STRING) | 1629 if (value->unit == CSSPrimitiveValue::CSS_STRING) |
| 1630 return createPrimitiveStringValue(value); | 1630 return createPrimitiveStringValue(value); |
| 1631 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ) | 1631 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ) |
| 1632 return createPrimitiveNumericValue(value); | 1632 return createPrimitiveNumericValue(value); |
| 1633 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS) | 1633 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS) |
| 1634 return createPrimitiveNumericValue(value); | 1634 return createPrimitiveNumericValue(value); |
| 1635 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX) | 1635 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX) |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2179 case CSSPropertyWebkitBorderImage: { | 2179 case CSSPropertyWebkitBorderImage: { |
| 2180 if (RefPtr<CSSValue> result = parseBorderImage(propId)) { | 2180 if (RefPtr<CSSValue> result = parseBorderImage(propId)) { |
| 2181 addProperty(propId, result, important); | 2181 addProperty(propId, result, important); |
| 2182 return true; | 2182 return true; |
| 2183 } | 2183 } |
| 2184 return false; | 2184 return false; |
| 2185 } | 2185 } |
| 2186 | 2186 |
| 2187 case CSSPropertyBorderImageOutset: | 2187 case CSSPropertyBorderImageOutset: |
| 2188 case CSSPropertyWebkitMaskBoxImageOutset: { | 2188 case CSSPropertyWebkitMaskBoxImageOutset: { |
| 2189 RefPtr<CSSPrimitiveValue> result; | 2189 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; |
| 2190 if (parseBorderImageOutset(result)) { | 2190 if (parseBorderImageOutset(result)) { |
| 2191 addProperty(propId, result, important); | 2191 addProperty(propId, result, important); |
| 2192 return true; | 2192 return true; |
| 2193 } | 2193 } |
| 2194 break; | 2194 break; |
| 2195 } | 2195 } |
| 2196 case CSSPropertyBorderImageRepeat: | 2196 case CSSPropertyBorderImageRepeat: |
| 2197 case CSSPropertyWebkitMaskBoxImageRepeat: { | 2197 case CSSPropertyWebkitMaskBoxImageRepeat: { |
| 2198 RefPtr<CSSValue> result; | 2198 RefPtr<CSSValue> result; |
| 2199 if (parseBorderImageRepeat(result)) { | 2199 if (parseBorderImageRepeat(result)) { |
| 2200 addProperty(propId, result, important); | 2200 addProperty(propId, result, important); |
| 2201 return true; | 2201 return true; |
| 2202 } | 2202 } |
| 2203 break; | 2203 break; |
| 2204 } | 2204 } |
| 2205 case CSSPropertyBorderImageSlice: | 2205 case CSSPropertyBorderImageSlice: |
| 2206 case CSSPropertyWebkitMaskBoxImageSlice: { | 2206 case CSSPropertyWebkitMaskBoxImageSlice: { |
| 2207 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result; | 2207 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result; |
| 2208 if (parseBorderImageSlice(propId, result)) { | 2208 if (parseBorderImageSlice(propId, result)) { |
| 2209 addProperty(propId, result, important); | 2209 addProperty(propId, result, important); |
| 2210 return true; | 2210 return true; |
| 2211 } | 2211 } |
| 2212 break; | 2212 break; |
| 2213 } | 2213 } |
| 2214 case CSSPropertyBorderImageWidth: | 2214 case CSSPropertyBorderImageWidth: |
| 2215 case CSSPropertyWebkitMaskBoxImageWidth: { | 2215 case CSSPropertyWebkitMaskBoxImageWidth: { |
| 2216 RefPtr<CSSPrimitiveValue> result; | 2216 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; |
| 2217 if (parseBorderImageWidth(result)) { | 2217 if (parseBorderImageWidth(result)) { |
| 2218 addProperty(propId, result, important); | 2218 addProperty(propId, result, important); |
| 2219 return true; | 2219 return true; |
| 2220 } | 2220 } |
| 2221 break; | 2221 break; |
| 2222 } | 2222 } |
| 2223 case CSSPropertyBorderTopRightRadius: | 2223 case CSSPropertyBorderTopRightRadius: |
| 2224 case CSSPropertyBorderTopLeftRadius: | 2224 case CSSPropertyBorderTopLeftRadius: |
| 2225 case CSSPropertyBorderBottomLeftRadius: | 2225 case CSSPropertyBorderBottomLeftRadius: |
| 2226 case CSSPropertyBorderBottomRightRadius: { | 2226 case CSSPropertyBorderBottomRightRadius: { |
| 2227 if (num != 1 && num != 2) | 2227 if (num != 1 && num != 2) |
| 2228 return false; | 2228 return false; |
| 2229 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 2229 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
| 2230 if (!validPrimitive) | 2230 if (!validPrimitive) |
| 2231 return false; | 2231 return false; |
| 2232 RefPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(val ue); | 2232 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNume ricValue(value); |
| 2233 RefPtr<CSSPrimitiveValue> parsedValue2; | 2233 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2; |
| 2234 if (num == 2) { | 2234 if (num == 2) { |
| 2235 value = m_valueList->next(); | 2235 value = m_valueList->next(); |
| 2236 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 2236 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
| 2237 if (!validPrimitive) | 2237 if (!validPrimitive) |
| 2238 return false; | 2238 return false; |
| 2239 parsedValue2 = createPrimitiveNumericValue(value); | 2239 parsedValue2 = createPrimitiveNumericValue(value); |
| 2240 } else | 2240 } else |
| 2241 parsedValue2 = parsedValue1; | 2241 parsedValue2 = parsedValue1; |
| 2242 | 2242 |
| 2243 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par sedValue2.release()), important); | 2243 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par sedValue2.release()), important); |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3696 percent = 100; | 3696 percent = 100; |
| 3697 else if (id == CSSValueCenter) | 3697 else if (id == CSSValueCenter) |
| 3698 percent = 50; | 3698 percent = 50; |
| 3699 return cssValuePool().createValue(percent, CSSPrimitiveValue::CSS_PERCEN TAGE); | 3699 return cssValuePool().createValue(percent, CSSPrimitiveValue::CSS_PERCEN TAGE); |
| 3700 } | 3700 } |
| 3701 if (validUnit(valueList->current(), FPercent | FLength)) | 3701 if (validUnit(valueList->current(), FPercent | FLength)) |
| 3702 return createPrimitiveNumericValue(valueList->current()); | 3702 return createPrimitiveNumericValue(valueList->current()); |
| 3703 return 0; | 3703 return 0; |
| 3704 } | 3704 } |
| 3705 | 3705 |
| 3706 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseFillPositionComponent(CSSPars erValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualF lag, FillPositionParsingMode parsingMode) | 3706 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseFillPositionCompo nent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode parsingMode) |
| 3707 { | 3707 { |
| 3708 CSSValueID id = valueList->current()->id; | 3708 CSSValueID id = valueList->current()->id; |
| 3709 if (id == CSSValueLeft || id == CSSValueTop || id == CSSValueRight || id == CSSValueBottom || id == CSSValueCenter) { | 3709 if (id == CSSValueLeft || id == CSSValueTop || id == CSSValueRight || id == CSSValueBottom || id == CSSValueCenter) { |
| 3710 int percent = 0; | 3710 int percent = 0; |
| 3711 if (id == CSSValueLeft || id == CSSValueRight) { | 3711 if (id == CSSValueLeft || id == CSSValueRight) { |
| 3712 if (cumulativeFlags & XFillPosition) | 3712 if (cumulativeFlags & XFillPosition) |
| 3713 return 0; | 3713 return 0; |
| 3714 cumulativeFlags |= XFillPosition; | 3714 cumulativeFlags |= XFillPosition; |
| 3715 individualFlag = XFillPosition; | 3715 individualFlag = XFillPosition; |
| 3716 if (id == CSSValueRight) | 3716 if (id == CSSValueRight) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3761 return true; | 3761 return true; |
| 3762 | 3762 |
| 3763 return false; | 3763 return false; |
| 3764 } | 3764 } |
| 3765 | 3765 |
| 3766 static bool isFillPositionKeyword(CSSValueID value) | 3766 static bool isFillPositionKeyword(CSSValueID value) |
| 3767 { | 3767 { |
| 3768 return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBot tom || value == CSSValueRight || value == CSSValueCenter; | 3768 return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBot tom || value == CSSValueRight || value == CSSValueCenter; |
| 3769 } | 3769 } |
| 3770 | 3770 |
| 3771 void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, Ref Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> p arsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2) | 3771 void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, Ref Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimi tiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2) |
| 3772 { | 3772 { |
| 3773 // [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <perce ntage> | <length> ] | 3773 // [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <perce ntage> | <length> ] |
| 3774 // In the case of 4 values <position> requires the second value to be a leng th or a percentage. | 3774 // In the case of 4 values <position> requires the second value to be a leng th or a percentage. |
| 3775 if (isFillPositionKeyword(parsedValue2->getValueID())) | 3775 if (isFillPositionKeyword(parsedValue2->getValueID())) |
| 3776 return; | 3776 return; |
| 3777 | 3777 |
| 3778 unsigned cumulativeFlags = 0; | 3778 unsigned cumulativeFlags = 0; |
| 3779 FillPositionFlag value3Flag = InvalidFillPosition; | 3779 FillPositionFlag value3Flag = InvalidFillPosition; |
| 3780 RefPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cum ulativeFlags, value3Flag, ResolveValuesAsKeyword); | 3780 RefPtrWillBeRawPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(va lueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); |
| 3781 if (!value3) | 3781 if (!value3) |
| 3782 return; | 3782 return; |
| 3783 | 3783 |
| 3784 CSSValueID ident1 = parsedValue1->getValueID(); | 3784 CSSValueID ident1 = parsedValue1->getValueID(); |
| 3785 CSSValueID ident3 = value3->getValueID(); | 3785 CSSValueID ident3 = value3->getValueID(); |
| 3786 | 3786 |
| 3787 if (ident1 == CSSValueCenter) | 3787 if (ident1 == CSSValueCenter) |
| 3788 return; | 3788 return; |
| 3789 | 3789 |
| 3790 if (!isFillPositionKeyword(ident3) || ident3 == CSSValueCenter) | 3790 if (!isFillPositionKeyword(ident3) || ident3 == CSSValueCenter) |
| 3791 return; | 3791 return; |
| 3792 | 3792 |
| 3793 // We need to check if the values are not conflicting, e.g. they are not on the same edge. It is | 3793 // We need to check if the values are not conflicting, e.g. they are not on the same edge. It is |
| 3794 // needed as the second call to parseFillPositionComponent was on purpose no t checking it. In the | 3794 // needed as the second call to parseFillPositionComponent was on purpose no t checking it. In the |
| 3795 // case of two values top 20px is invalid but in the case of 4 values it bec omes valid. | 3795 // case of two values top 20px is invalid but in the case of 4 values it bec omes valid. |
| 3796 if (isValueConflictingWithCurrentEdge(ident1, ident3)) | 3796 if (isValueConflictingWithCurrentEdge(ident1, ident3)) |
| 3797 return; | 3797 return; |
| 3798 | 3798 |
| 3799 valueList->next(); | 3799 valueList->next(); |
| 3800 | 3800 |
| 3801 cumulativeFlags = 0; | 3801 cumulativeFlags = 0; |
| 3802 FillPositionFlag value4Flag = InvalidFillPosition; | 3802 FillPositionFlag value4Flag = InvalidFillPosition; |
| 3803 RefPtr<CSSPrimitiveValue> value4 = parseFillPositionComponent(valueList, cum ulativeFlags, value4Flag, ResolveValuesAsKeyword); | 3803 RefPtrWillBeRawPtr<CSSPrimitiveValue> value4 = parseFillPositionComponent(va lueList, cumulativeFlags, value4Flag, ResolveValuesAsKeyword); |
| 3804 if (!value4) | 3804 if (!value4) |
| 3805 return; | 3805 return; |
| 3806 | 3806 |
| 3807 // 4th value must be a length or a percentage. | 3807 // 4th value must be a length or a percentage. |
| 3808 if (isFillPositionKeyword(value4->getValueID())) | 3808 if (isFillPositionKeyword(value4->getValueID())) |
| 3809 return; | 3809 return; |
| 3810 | 3810 |
| 3811 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); | 3811 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); |
| 3812 value2 = createPrimitiveValuePair(value3, value4); | 3812 value2 = createPrimitiveValuePair(value3, value4); |
| 3813 | 3813 |
| 3814 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) | 3814 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) |
| 3815 value1.swap(value2); | 3815 value1.swap(value2); |
| 3816 | 3816 |
| 3817 valueList->next(); | 3817 valueList->next(); |
| 3818 } | 3818 } |
| 3819 void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, Ref Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> p arsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2) | 3819 void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, Ref Ptr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimi tiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2) |
| 3820 { | 3820 { |
| 3821 unsigned cumulativeFlags = 0; | 3821 unsigned cumulativeFlags = 0; |
| 3822 FillPositionFlag value3Flag = InvalidFillPosition; | 3822 FillPositionFlag value3Flag = InvalidFillPosition; |
| 3823 RefPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cum ulativeFlags, value3Flag, ResolveValuesAsKeyword); | 3823 RefPtrWillBeRawPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(va lueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); |
| 3824 | 3824 |
| 3825 // value3 is not an expected value, we return. | 3825 // value3 is not an expected value, we return. |
| 3826 if (!value3) | 3826 if (!value3) |
| 3827 return; | 3827 return; |
| 3828 | 3828 |
| 3829 valueList->next(); | 3829 valueList->next(); |
| 3830 | 3830 |
| 3831 bool swapNeeded = false; | 3831 bool swapNeeded = false; |
| 3832 CSSValueID ident1 = parsedValue1->getValueID(); | 3832 CSSValueID ident1 = parsedValue1->getValueID(); |
| 3833 CSSValueID ident2 = parsedValue2->getValueID(); | 3833 CSSValueID ident2 = parsedValue2->getValueID(); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3857 return; | 3857 return; |
| 3858 | 3858 |
| 3859 secondPositionKeyword = CSSValueTop; | 3859 secondPositionKeyword = CSSValueTop; |
| 3860 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) { | 3860 if (ident1 == CSSValueTop || ident1 == CSSValueBottom) { |
| 3861 secondPositionKeyword = CSSValueLeft; | 3861 secondPositionKeyword = CSSValueLeft; |
| 3862 swapNeeded = true; | 3862 swapNeeded = true; |
| 3863 } | 3863 } |
| 3864 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); | 3864 value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); |
| 3865 value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(s econdPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PER CENTAGE)); | 3865 value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(s econdPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PER CENTAGE)); |
| 3866 } else { | 3866 } else { |
| 3867 RefPtr<CSSPrimitiveValue> firstPositionValue; | 3867 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue; |
| 3868 RefPtr<CSSPrimitiveValue> secondPositionValue; | 3868 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue; |
| 3869 | 3869 |
| 3870 if (isFillPositionKeyword(ident2)) { | 3870 if (isFillPositionKeyword(ident2)) { |
| 3871 // To match CSS grammar, we should only accept: [ center | left | ri ght | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ] . | 3871 // To match CSS grammar, we should only accept: [ center | left | ri ght | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ] . |
| 3872 ASSERT(ident2 != CSSValueCenter); | 3872 ASSERT(ident2 != CSSValueCenter); |
| 3873 | 3873 |
| 3874 if (isFillPositionKeyword(ident3)) | 3874 if (isFillPositionKeyword(ident3)) |
| 3875 return; | 3875 return; |
| 3876 | 3876 |
| 3877 secondPositionValue = value3; | 3877 secondPositionValue = value3; |
| 3878 secondPositionKeyword = ident2; | 3878 secondPositionKeyword = ident2; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3952 // a valid start for <position>. | 3952 // a valid start for <position>. |
| 3953 cumulativeFlags = AmbiguousFillPosition; | 3953 cumulativeFlags = AmbiguousFillPosition; |
| 3954 value2 = parseFillPositionComponent(valueList, cumulativeFlags, value2Flag, ResolveValuesAsKeyword); | 3954 value2 = parseFillPositionComponent(valueList, cumulativeFlags, value2Flag, ResolveValuesAsKeyword); |
| 3955 if (value2) | 3955 if (value2) |
| 3956 valueList->next(); | 3956 valueList->next(); |
| 3957 else { | 3957 else { |
| 3958 value1.clear(); | 3958 value1.clear(); |
| 3959 return; | 3959 return; |
| 3960 } | 3960 } |
| 3961 | 3961 |
| 3962 RefPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get()); | 3962 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(val ue1.get()); |
| 3963 RefPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get()); | 3963 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(val ue2.get()); |
| 3964 | 3964 |
| 3965 value1.clear(); | 3965 value1.clear(); |
| 3966 value2.clear(); | 3966 value2.clear(); |
| 3967 | 3967 |
| 3968 // Per CSS3 syntax, <position> can't have 'center' as its second keyword as we have more arguments to follow. | 3968 // Per CSS3 syntax, <position> can't have 'center' as its second keyword as we have more arguments to follow. |
| 3969 if (parsedValue2->getValueID() == CSSValueCenter) | 3969 if (parsedValue2->getValueID() == CSSValueCenter) |
| 3970 return; | 3970 return; |
| 3971 | 3971 |
| 3972 if (numberOfValues == 3) | 3972 if (numberOfValues == 3) |
| 3973 parse3ValuesFillPosition(valueList, value1, value2, parsedValue1.release (), parsedValue2.release()); | 3973 parse3ValuesFillPosition(valueList, value1, value2, parsedValue1.release (), parsedValue2.release()); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4061 } | 4061 } |
| 4062 | 4062 |
| 4063 PassRefPtr<CSSValue> BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a llowComma) | 4063 PassRefPtr<CSSValue> BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a llowComma) |
| 4064 { | 4064 { |
| 4065 allowComma = true; | 4065 allowComma = true; |
| 4066 CSSParserValue* value = m_valueList->current(); | 4066 CSSParserValue* value = m_valueList->current(); |
| 4067 | 4067 |
| 4068 if (value->id == CSSValueContain || value->id == CSSValueCover) | 4068 if (value->id == CSSValueContain || value->id == CSSValueCover) |
| 4069 return cssValuePool().createIdentifierValue(value->id); | 4069 return cssValuePool().createIdentifierValue(value->id); |
| 4070 | 4070 |
| 4071 RefPtr<CSSPrimitiveValue> parsedValue1; | 4071 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1; |
| 4072 | 4072 |
| 4073 if (value->id == CSSValueAuto) | 4073 if (value->id == CSSValueAuto) |
| 4074 parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto); | 4074 parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto); |
| 4075 else { | 4075 else { |
| 4076 if (!validUnit(value, FLength | FPercent)) | 4076 if (!validUnit(value, FLength | FPercent)) |
| 4077 return 0; | 4077 return 0; |
| 4078 parsedValue1 = createPrimitiveNumericValue(value); | 4078 parsedValue1 = createPrimitiveNumericValue(value); |
| 4079 } | 4079 } |
| 4080 | 4080 |
| 4081 RefPtr<CSSPrimitiveValue> parsedValue2; | 4081 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2; |
| 4082 if ((value = m_valueList->next())) { | 4082 if ((value = m_valueList->next())) { |
| 4083 if (value->unit == CSSParserValue::Operator && value->iValue == ',') | 4083 if (value->unit == CSSParserValue::Operator && value->iValue == ',') |
| 4084 allowComma = false; | 4084 allowComma = false; |
| 4085 else if (value->id != CSSValueAuto) { | 4085 else if (value->id != CSSValueAuto) { |
| 4086 if (!validUnit(value, FLength | FPercent)) { | 4086 if (!validUnit(value, FLength | FPercent)) { |
| 4087 if (!inShorthand()) | 4087 if (!inShorthand()) |
| 4088 return 0; | 4088 return 0; |
| 4089 // We need to rewind the value list, so that when it is advanced we'll end up back at this value. | 4089 // We need to rewind the value list, so that when it is advanced we'll end up back at this value. |
| 4090 m_valueList->previous(); | 4090 m_valueList->previous(); |
| 4091 } else | 4091 } else |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4591 return true; | 4591 return true; |
| 4592 } | 4592 } |
| 4593 if (value) { | 4593 if (value) { |
| 4594 result = value.release(); | 4594 result = value.release(); |
| 4595 return true; | 4595 return true; |
| 4596 } | 4596 } |
| 4597 return false; | 4597 return false; |
| 4598 } | 4598 } |
| 4599 | 4599 |
| 4600 // The function parses [ <integer> || <string> ] in <grid-line> (which can be st and alone or with 'span'). | 4600 // The function parses [ <integer> || <string> ] in <grid-line> (which can be st and alone or with 'span'). |
| 4601 bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtr<CSSPrimitiveVal ue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName) | 4601 bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtrWillBeRawPtr<CSS PrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gridLineNa me) |
| 4602 { | 4602 { |
| 4603 CSSParserValue* value = m_valueList->current(); | 4603 CSSParserValue* value = m_valueList->current(); |
| 4604 if (validUnit(value, FInteger) && value->fValue) { | 4604 if (validUnit(value, FInteger) && value->fValue) { |
| 4605 numericValue = createPrimitiveNumericValue(value); | 4605 numericValue = createPrimitiveNumericValue(value); |
| 4606 value = m_valueList->next(); | 4606 value = m_valueList->next(); |
| 4607 if (value && value->unit == CSSPrimitiveValue::CSS_STRING) { | 4607 if (value && value->unit == CSSPrimitiveValue::CSS_STRING) { |
| 4608 gridLineName = createPrimitiveStringValue(m_valueList->current()); | 4608 gridLineName = createPrimitiveStringValue(m_valueList->current()); |
| 4609 m_valueList->next(); | 4609 m_valueList->next(); |
| 4610 } | 4610 } |
| 4611 return true; | 4611 return true; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 4632 if (value->id == CSSValueAuto) { | 4632 if (value->id == CSSValueAuto) { |
| 4633 m_valueList->next(); | 4633 m_valueList->next(); |
| 4634 return cssValuePool().createIdentifierValue(CSSValueAuto); | 4634 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 4635 } | 4635 } |
| 4636 | 4636 |
| 4637 if (value->id != CSSValueSpan && value->unit == CSSPrimitiveValue::CSS_IDENT ) { | 4637 if (value->id != CSSValueSpan && value->unit == CSSPrimitiveValue::CSS_IDENT ) { |
| 4638 m_valueList->next(); | 4638 m_valueList->next(); |
| 4639 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_ STRING); | 4639 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_ STRING); |
| 4640 } | 4640 } |
| 4641 | 4641 |
| 4642 RefPtr<CSSPrimitiveValue> numericValue; | 4642 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue; |
| 4643 RefPtr<CSSPrimitiveValue> gridLineName; | 4643 RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName; |
| 4644 bool hasSeenSpanKeyword = false; | 4644 bool hasSeenSpanKeyword = false; |
| 4645 | 4645 |
| 4646 if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) { | 4646 if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) { |
| 4647 value = m_valueList->current(); | 4647 value = m_valueList->current(); |
| 4648 if (value && value->id == CSSValueSpan) { | 4648 if (value && value->id == CSSValueSpan) { |
| 4649 hasSeenSpanKeyword = true; | 4649 hasSeenSpanKeyword = true; |
| 4650 m_valueList->next(); | 4650 m_valueList->next(); |
| 4651 } | 4651 } |
| 4652 } else if (value->id == CSSValueSpan) { | 4652 } else if (value->id == CSSValueSpan) { |
| 4653 hasSeenSpanKeyword = true; | 4653 hasSeenSpanKeyword = true; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4778 | 4778 |
| 4779 CSSParserValueList* identList = parserValueList->current()->valueList; | 4779 CSSParserValueList* identList = parserValueList->current()->valueList; |
| 4780 if (!identList->size()) { | 4780 if (!identList->size()) { |
| 4781 parserValueList->next(); | 4781 parserValueList->next(); |
| 4782 return; | 4782 return; |
| 4783 } | 4783 } |
| 4784 | 4784 |
| 4785 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue: :create(); | 4785 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue: :create(); |
| 4786 while (CSSParserValue* identValue = identList->current()) { | 4786 while (CSSParserValue* identValue = identList->current()) { |
| 4787 ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT); | 4787 ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT); |
| 4788 RefPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identVal ue); | 4788 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveStringVa lue(identValue); |
| 4789 lineNames->append(lineName.release()); | 4789 lineNames->append(lineName.release()); |
| 4790 identList->next(); | 4790 identList->next(); |
| 4791 } | 4791 } |
| 4792 valueList.append(lineNames.release()); | 4792 valueList.append(lineNames.release()); |
| 4793 | 4793 |
| 4794 parserValueList->next(); | 4794 parserValueList->next(); |
| 4795 } | 4795 } |
| 4796 | 4796 |
| 4797 bool BisonCSSParser::parseGridTrackList(CSSPropertyID propId, bool important) | 4797 bool BisonCSSParser::parseGridTrackList(CSSPropertyID propId, bool important) |
| 4798 { | 4798 { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4889 | 4889 |
| 4890 if (currentValue->id == CSSValueAuto) | 4890 if (currentValue->id == CSSValueAuto) |
| 4891 return cssValuePool().createIdentifierValue(CSSValueAuto); | 4891 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 4892 | 4892 |
| 4893 if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(curr entValue->function->name, "minmax(")) { | 4893 if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(curr entValue->function->name, "minmax(")) { |
| 4894 // The spec defines the following grammar: minmax( <track-breadth> , <tr ack-breadth> ) | 4894 // The spec defines the following grammar: minmax( <track-breadth> , <tr ack-breadth> ) |
| 4895 CSSParserValueList* arguments = currentValue->function->args.get(); | 4895 CSSParserValueList* arguments = currentValue->function->args.get(); |
| 4896 if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt( 1))) | 4896 if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt( 1))) |
| 4897 return 0; | 4897 return 0; |
| 4898 | 4898 |
| 4899 RefPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(arguments-> valueAt(0)); | 4899 RefPtrWillBeRawPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth (arguments->valueAt(0)); |
| 4900 if (!minTrackBreadth) | 4900 if (!minTrackBreadth) |
| 4901 return 0; | 4901 return 0; |
| 4902 | 4902 |
| 4903 RefPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth(arguments-> valueAt(2)); | 4903 RefPtrWillBeRawPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth (arguments->valueAt(2)); |
| 4904 if (!maxTrackBreadth) | 4904 if (!maxTrackBreadth) |
| 4905 return 0; | 4905 return 0; |
| 4906 | 4906 |
| 4907 RefPtrWillBeRawPtr<CSSValueList> parsedArguments = CSSValueList::createC ommaSeparated(); | 4907 RefPtrWillBeRawPtr<CSSValueList> parsedArguments = CSSValueList::createC ommaSeparated(); |
| 4908 parsedArguments->append(minTrackBreadth); | 4908 parsedArguments->append(minTrackBreadth); |
| 4909 parsedArguments->append(maxTrackBreadth); | 4909 parsedArguments->append(maxTrackBreadth); |
| 4910 return CSSFunctionValue::create("minmax(", parsedArguments); | 4910 return CSSFunctionValue::create("minmax(", parsedArguments); |
| 4911 } | 4911 } |
| 4912 | 4912 |
| 4913 return parseGridBreadth(currentValue); | 4913 return parseGridBreadth(currentValue); |
| 4914 } | 4914 } |
| 4915 | 4915 |
| 4916 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSParserValue* c urrentValue) | 4916 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSPa rserValue* currentValue) |
| 4917 { | 4917 { |
| 4918 if (currentValue->id == CSSValueMinContent || currentValue->id == CSSValueMa xContent) | 4918 if (currentValue->id == CSSValueMinContent || currentValue->id == CSSValueMa xContent) |
| 4919 return cssValuePool().createIdentifierValue(currentValue->id); | 4919 return cssValuePool().createIdentifierValue(currentValue->id); |
| 4920 | 4920 |
| 4921 if (currentValue->unit == CSSPrimitiveValue::CSS_FR) { | 4921 if (currentValue->unit == CSSPrimitiveValue::CSS_FR) { |
| 4922 double flexValue = currentValue->fValue; | 4922 double flexValue = currentValue->fValue; |
| 4923 | 4923 |
| 4924 // Fractional unit is a non-negative dimension. | 4924 // Fractional unit is a non-negative dimension. |
| 4925 if (flexValue <= 0) | 4925 if (flexValue <= 0) |
| 4926 return 0; | 4926 return 0; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5011 { | 5011 { |
| 5012 unsigned numArgs = args->size(); | 5012 unsigned numArgs = args->size(); |
| 5013 if (counters && numArgs != 3 && numArgs != 5) | 5013 if (counters && numArgs != 3 && numArgs != 5) |
| 5014 return 0; | 5014 return 0; |
| 5015 if (!counters && numArgs != 1 && numArgs != 3) | 5015 if (!counters && numArgs != 1 && numArgs != 3) |
| 5016 return 0; | 5016 return 0; |
| 5017 | 5017 |
| 5018 CSSParserValue* i = args->current(); | 5018 CSSParserValue* i = args->current(); |
| 5019 if (i->unit != CSSPrimitiveValue::CSS_IDENT) | 5019 if (i->unit != CSSPrimitiveValue::CSS_IDENT) |
| 5020 return 0; | 5020 return 0; |
| 5021 RefPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValue(i); | 5021 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValu e(i); |
| 5022 | 5022 |
| 5023 RefPtr<CSSPrimitiveValue> separator; | 5023 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator; |
| 5024 if (!counters) | 5024 if (!counters) |
| 5025 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_ STRING); | 5025 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_ STRING); |
| 5026 else { | 5026 else { |
| 5027 i = args->next(); | 5027 i = args->next(); |
| 5028 if (i->unit != CSSParserValue::Operator || i->iValue != ',') | 5028 if (i->unit != CSSParserValue::Operator || i->iValue != ',') |
| 5029 return 0; | 5029 return 0; |
| 5030 | 5030 |
| 5031 i = args->next(); | 5031 i = args->next(); |
| 5032 if (i->unit != CSSPrimitiveValue::CSS_STRING) | 5032 if (i->unit != CSSPrimitiveValue::CSS_STRING) |
| 5033 return 0; | 5033 return 0; |
| 5034 | 5034 |
| 5035 separator = createPrimitiveStringValue(i); | 5035 separator = createPrimitiveStringValue(i); |
| 5036 } | 5036 } |
| 5037 | 5037 |
| 5038 RefPtr<CSSPrimitiveValue> listStyle; | 5038 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle; |
| 5039 i = args->next(); | 5039 i = args->next(); |
| 5040 if (!i) // Make the list style default decimal | 5040 if (!i) // Make the list style default decimal |
| 5041 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); | 5041 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); |
| 5042 else { | 5042 else { |
| 5043 if (i->unit != CSSParserValue::Operator || i->iValue != ',') | 5043 if (i->unit != CSSParserValue::Operator || i->iValue != ',') |
| 5044 return 0; | 5044 return 0; |
| 5045 | 5045 |
| 5046 i = args->next(); | 5046 i = args->next(); |
| 5047 if (i->unit != CSSPrimitiveValue::CSS_IDENT) | 5047 if (i->unit != CSSPrimitiveValue::CSS_IDENT) |
| 5048 return 0; | 5048 return 0; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 5071 if (args->size() != 4 && args->size() != 7) | 5071 if (args->size() != 4 && args->size() != 7) |
| 5072 return false; | 5072 return false; |
| 5073 RefPtr<Rect> rect = Rect::create(); | 5073 RefPtr<Rect> rect = Rect::create(); |
| 5074 bool valid = true; | 5074 bool valid = true; |
| 5075 int i = 0; | 5075 int i = 0; |
| 5076 CSSParserValue* a = args->current(); | 5076 CSSParserValue* a = args->current(); |
| 5077 while (a) { | 5077 while (a) { |
| 5078 valid = a->id == CSSValueAuto || validUnit(a, FLength); | 5078 valid = a->id == CSSValueAuto || validUnit(a, FLength); |
| 5079 if (!valid) | 5079 if (!valid) |
| 5080 break; | 5080 break; |
| 5081 RefPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? | 5081 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? |
| 5082 cssValuePool().createIdentifierValue(CSSValueAuto) : | 5082 cssValuePool().createIdentifierValue(CSSValueAuto) : |
| 5083 createPrimitiveNumericValue(a); | 5083 createPrimitiveNumericValue(a); |
| 5084 if (i == 0) | 5084 if (i == 0) |
| 5085 rect->setTop(length); | 5085 rect->setTop(length); |
| 5086 else if (i == 1) | 5086 else if (i == 1) |
| 5087 rect->setRight(length); | 5087 rect->setRight(length); |
| 5088 else if (i == 2) | 5088 else if (i == 2) |
| 5089 rect->setBottom(length); | 5089 rect->setBottom(length); |
| 5090 else | 5090 else |
| 5091 rect->setLeft(length); | 5091 rect->setLeft(length); |
| 5092 a = args->next(); | 5092 a = args->next(); |
| 5093 if (a && args->size() == 7) { | 5093 if (a && args->size() == 7) { |
| 5094 if (a->unit == CSSParserValue::Operator && a->iValue == ',') { | 5094 if (a->unit == CSSParserValue::Operator && a->iValue == ',') { |
| 5095 a = args->next(); | 5095 a = args->next(); |
| 5096 } else { | 5096 } else { |
| 5097 valid = false; | 5097 valid = false; |
| 5098 break; | 5098 break; |
| 5099 } | 5099 } |
| 5100 } | 5100 } |
| 5101 i++; | 5101 i++; |
| 5102 } | 5102 } |
| 5103 if (valid) { | 5103 if (valid) { |
| 5104 addProperty(propId, cssValuePool().createValue(rect.release()), importan t); | 5104 addProperty(propId, cssValuePool().createValue(rect.release()), importan t); |
| 5105 m_valueList->next(); | 5105 m_valueList->next(); |
| 5106 return true; | 5106 return true; |
| 5107 } | 5107 } |
| 5108 return false; | 5108 return false; |
| 5109 } | 5109 } |
| 5110 | 5110 |
| 5111 static void completeBorderRadii(RefPtr<CSSPrimitiveValue> radii[4]) | 5111 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) |
| 5112 { | 5112 { |
| 5113 if (radii[3]) | 5113 if (radii[3]) |
| 5114 return; | 5114 return; |
| 5115 if (!radii[2]) { | 5115 if (!radii[2]) { |
| 5116 if (!radii[1]) | 5116 if (!radii[1]) |
| 5117 radii[1] = radii[0]; | 5117 radii[1] = radii[0]; |
| 5118 radii[2] = radii[0]; | 5118 radii[2] = radii[0]; |
| 5119 } | 5119 } |
| 5120 radii[3] = radii[1]; | 5120 radii[3] = radii[1]; |
| 5121 } | 5121 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 5133 while (argument) { | 5133 while (argument) { |
| 5134 radiusArguments.addValue(*argument); | 5134 radiusArguments.addValue(*argument); |
| 5135 argument = args->next(); | 5135 argument = args->next(); |
| 5136 } | 5136 } |
| 5137 | 5137 |
| 5138 unsigned num = radiusArguments.size(); | 5138 unsigned num = radiusArguments.size(); |
| 5139 if (!num || num > 9) | 5139 if (!num || num > 9) |
| 5140 return 0; | 5140 return 0; |
| 5141 | 5141 |
| 5142 // FIXME: Refactor completeBorderRadii and the array | 5142 // FIXME: Refactor completeBorderRadii and the array |
| 5143 RefPtr<CSSPrimitiveValue> radii[2][4]; | 5143 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; |
| 5144 | 5144 |
| 5145 unsigned indexAfterSlash = 0; | 5145 unsigned indexAfterSlash = 0; |
| 5146 for (unsigned i = 0; i < num; ++i) { | 5146 for (unsigned i = 0; i < num; ++i) { |
| 5147 CSSParserValue* value = radiusArguments.valueAt(i); | 5147 CSSParserValue* value = radiusArguments.valueAt(i); |
| 5148 if (value->unit == CSSParserValue::Operator) { | 5148 if (value->unit == CSSParserValue::Operator) { |
| 5149 if (value->iValue != '/') | 5149 if (value->iValue != '/') |
| 5150 return 0; | 5150 return 0; |
| 5151 | 5151 |
| 5152 if (!i || indexAfterSlash || i + 1 == num) | 5152 if (!i || indexAfterSlash || i + 1 == num) |
| 5153 return 0; | 5153 return 0; |
| 5154 | 5154 |
| 5155 indexAfterSlash = i + 1; | 5155 indexAfterSlash = i + 1; |
| 5156 completeBorderRadii(radii[0]); | 5156 completeBorderRadii(radii[0]); |
| 5157 continue; | 5157 continue; |
| 5158 } | 5158 } |
| 5159 | 5159 |
| 5160 if (i - indexAfterSlash >= 4) | 5160 if (i - indexAfterSlash >= 4) |
| 5161 return 0; | 5161 return 0; |
| 5162 | 5162 |
| 5163 if (!validUnit(value, FLength | FPercent | FNonNeg)) | 5163 if (!validUnit(value, FLength | FPercent | FNonNeg)) |
| 5164 return 0; | 5164 return 0; |
| 5165 | 5165 |
| 5166 RefPtr<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value); | 5166 RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = createPrimitiveNumericVal ue(value); |
| 5167 | 5167 |
| 5168 if (!indexAfterSlash) | 5168 if (!indexAfterSlash) |
| 5169 radii[0][i] = radius; | 5169 radii[0][i] = radius; |
| 5170 else | 5170 else |
| 5171 radii[1][i - indexAfterSlash] = radius.release(); | 5171 radii[1][i - indexAfterSlash] = radius.release(); |
| 5172 } | 5172 } |
| 5173 | 5173 |
| 5174 if (!indexAfterSlash) { | 5174 if (!indexAfterSlash) { |
| 5175 completeBorderRadii(radii[0]); | 5175 completeBorderRadii(radii[0]); |
| 5176 for (unsigned i = 0; i < 4; ++i) | 5176 for (unsigned i = 0; i < 4; ++i) |
| 5177 radii[1][i] = radii[0][i]; | 5177 radii[1][i] = radii[0][i]; |
| 5178 } else { | 5178 } else { |
| 5179 completeBorderRadii(radii[1]); | 5179 completeBorderRadii(radii[1]); |
| 5180 } | 5180 } |
| 5181 shape->setTopLeftRadius(createPrimitiveValuePair(radii[0][0].release(), radi i[1][0].release())); | 5181 shape->setTopLeftRadius(createPrimitiveValuePair(radii[0][0].release(), radi i[1][0].release())); |
| 5182 shape->setTopRightRadius(createPrimitiveValuePair(radii[0][1].release(), rad ii[1][1].release())); | 5182 shape->setTopRightRadius(createPrimitiveValuePair(radii[0][1].release(), rad ii[1][1].release())); |
| 5183 shape->setBottomRightRadius(createPrimitiveValuePair(radii[0][2].release(), radii[1][2].release())); | 5183 shape->setBottomRightRadius(createPrimitiveValuePair(radii[0][2].release(), radii[1][2].release())); |
| 5184 shape->setBottomLeftRadius(createPrimitiveValuePair(radii[0][3].release(), r adii[1][3].release())); | 5184 shape->setBottomLeftRadius(createPrimitiveValuePair(radii[0][3].release(), r adii[1][3].release())); |
| 5185 | 5185 |
| 5186 return shape; | 5186 return shape; |
| 5187 } | 5187 } |
| 5188 | 5188 |
| 5189 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeInset(CSSParserValueLis t* args) | 5189 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeInset(CSSParserValueLis t* args) |
| 5190 { | 5190 { |
| 5191 ASSERT(args); | 5191 ASSERT(args); |
| 5192 | 5192 |
| 5193 RefPtr<CSSBasicShapeInset> shape = CSSBasicShapeInset::create(); | 5193 RefPtr<CSSBasicShapeInset> shape = CSSBasicShapeInset::create(); |
| 5194 | 5194 |
| 5195 CSSParserValue* argument = args->current(); | 5195 CSSParserValue* argument = args->current(); |
| 5196 Vector<RefPtr<CSSPrimitiveValue> > widthArguments; | 5196 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue> > widthArguments; |
| 5197 bool hasRoundedInset = false; | 5197 bool hasRoundedInset = false; |
| 5198 | 5198 |
| 5199 while (argument) { | 5199 while (argument) { |
| 5200 if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase( argument->string, "round")) { | 5200 if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase( argument->string, "round")) { |
| 5201 hasRoundedInset = true; | 5201 hasRoundedInset = true; |
| 5202 break; | 5202 break; |
| 5203 } | 5203 } |
| 5204 | 5204 |
| 5205 Units unitFlags = FLength | FPercent; | 5205 Units unitFlags = FLength | FPercent; |
| 5206 if (!validUnit(argument, unitFlags) || widthArguments.size() > 4) | 5206 if (!validUnit(argument, unitFlags) || widthArguments.size() > 4) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5252 CSSParserValue* value = m_valueList->current(); | 5252 CSSParserValue* value = m_valueList->current(); |
| 5253 | 5253 |
| 5254 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) { | 5254 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) { |
| 5255 if (m_valueList->next()) | 5255 if (m_valueList->next()) |
| 5256 return false; | 5256 return false; |
| 5257 | 5257 |
| 5258 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant); | 5258 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant); |
| 5259 return true; | 5259 return true; |
| 5260 } | 5260 } |
| 5261 | 5261 |
| 5262 RefPtr<CSSPrimitiveValue> position = 0; | 5262 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = 0; |
| 5263 RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0; | 5263 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0; |
| 5264 if (isItemPositionKeyword(value->id)) { | 5264 if (isItemPositionKeyword(value->id)) { |
| 5265 position = cssValuePool().createIdentifierValue(value->id); | 5265 position = cssValuePool().createIdentifierValue(value->id); |
| 5266 value = m_valueList->next(); | 5266 value = m_valueList->next(); |
| 5267 if (value) { | 5267 if (value) { |
| 5268 if (value->id == CSSValueTrue || value->id == CSSValueSafe) | 5268 if (value->id == CSSValueTrue || value->id == CSSValueSafe) |
| 5269 overflowAlignmentKeyword = cssValuePool().createIdentifierValue( value->id); | 5269 overflowAlignmentKeyword = cssValuePool().createIdentifierValue( value->id); |
| 5270 else | 5270 else |
| 5271 return false; | 5271 return false; |
| 5272 } | 5272 } |
| 5273 } else if (value->id == CSSValueTrue || value->id == CSSValueSafe) { | 5273 } else if (value->id == CSSValueTrue || value->id == CSSValueSafe) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5309 CSSParserValue* argument = args->current(); | 5309 CSSParserValue* argument = args->current(); |
| 5310 while (argument) { | 5310 while (argument) { |
| 5311 Units unitFlags = FLength | FPercent; | 5311 Units unitFlags = FLength | FPercent; |
| 5312 if (argumentNumber > 1) { | 5312 if (argumentNumber > 1) { |
| 5313 // Arguments width, height, rx, and ry cannot be negative. | 5313 // Arguments width, height, rx, and ry cannot be negative. |
| 5314 unitFlags = unitFlags | FNonNeg; | 5314 unitFlags = unitFlags | FNonNeg; |
| 5315 } | 5315 } |
| 5316 if (!validUnit(argument, unitFlags)) | 5316 if (!validUnit(argument, unitFlags)) |
| 5317 return 0; | 5317 return 0; |
| 5318 | 5318 |
| 5319 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument) ; | 5319 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal ue(argument); |
| 5320 ASSERT(argumentNumber < 6); | 5320 ASSERT(argumentNumber < 6); |
| 5321 switch (argumentNumber) { | 5321 switch (argumentNumber) { |
| 5322 case 0: | 5322 case 0: |
| 5323 shape->setX(length); | 5323 shape->setX(length); |
| 5324 break; | 5324 break; |
| 5325 case 1: | 5325 case 1: |
| 5326 shape->setY(length); | 5326 shape->setY(length); |
| 5327 break; | 5327 break; |
| 5328 case 2: | 5328 case 2: |
| 5329 shape->setWidth(length); | 5329 shape->setWidth(length); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5363 | 5363 |
| 5364 RefPtr<CSSBasicShapeInsetRectangle> shape = CSSBasicShapeInsetRectangle::cre ate(); | 5364 RefPtr<CSSBasicShapeInsetRectangle> shape = CSSBasicShapeInsetRectangle::cre ate(); |
| 5365 | 5365 |
| 5366 unsigned argumentNumber = 0; | 5366 unsigned argumentNumber = 0; |
| 5367 CSSParserValue* argument = args->current(); | 5367 CSSParserValue* argument = args->current(); |
| 5368 while (argument) { | 5368 while (argument) { |
| 5369 Units unitFlags = FLength | FPercent | FNonNeg; | 5369 Units unitFlags = FLength | FPercent | FNonNeg; |
| 5370 if (!validUnit(argument, unitFlags)) | 5370 if (!validUnit(argument, unitFlags)) |
| 5371 return 0; | 5371 return 0; |
| 5372 | 5372 |
| 5373 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument) ; | 5373 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal ue(argument); |
| 5374 ASSERT(argumentNumber < 6); | 5374 ASSERT(argumentNumber < 6); |
| 5375 switch (argumentNumber) { | 5375 switch (argumentNumber) { |
| 5376 case 0: | 5376 case 0: |
| 5377 shape->setTop(length); | 5377 shape->setTop(length); |
| 5378 break; | 5378 break; |
| 5379 case 1: | 5379 case 1: |
| 5380 shape->setRight(length); | 5380 shape->setRight(length); |
| 5381 break; | 5381 break; |
| 5382 case 2: | 5382 case 2: |
| 5383 shape->setBottom(length); | 5383 shape->setBottom(length); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 5400 argument = args->next(); | 5400 argument = args->next(); |
| 5401 } | 5401 } |
| 5402 argumentNumber++; | 5402 argumentNumber++; |
| 5403 } | 5403 } |
| 5404 | 5404 |
| 5405 if (argumentNumber < 4) | 5405 if (argumentNumber < 4) |
| 5406 return 0; | 5406 return 0; |
| 5407 return shape; | 5407 return shape; |
| 5408 } | 5408 } |
| 5409 | 5409 |
| 5410 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSParserValue* v alue) | 5410 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSPa rserValue* value) |
| 5411 { | 5411 { |
| 5412 if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) | 5412 if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) |
| 5413 return cssValuePool().createIdentifierValue(value->id); | 5413 return cssValuePool().createIdentifierValue(value->id); |
| 5414 | 5414 |
| 5415 if (!validUnit(value, FLength | FPercent | FNonNeg)) | 5415 if (!validUnit(value, FLength | FPercent | FNonNeg)) |
| 5416 return 0; | 5416 return 0; |
| 5417 | 5417 |
| 5418 return createPrimitiveNumericValue(value); | 5418 return createPrimitiveNumericValue(value); |
| 5419 } | 5419 } |
| 5420 | 5420 |
| 5421 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeCircle(CSSParserValueLi st* args) | 5421 PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeCircle(CSSParserValueLi st* args) |
| 5422 { | 5422 { |
| 5423 ASSERT(args); | 5423 ASSERT(args); |
| 5424 | 5424 |
| 5425 // circle(radius) | 5425 // circle(radius) |
| 5426 // circle(radius at <position> | 5426 // circle(radius at <position> |
| 5427 // circle(at <position>) | 5427 // circle(at <position>) |
| 5428 // where position defines centerX and centerY using a CSS <position> data ty pe. | 5428 // where position defines centerX and centerY using a CSS <position> data ty pe. |
| 5429 RefPtr<CSSBasicShapeCircle> shape = CSSBasicShapeCircle::create(); | 5429 RefPtr<CSSBasicShapeCircle> shape = CSSBasicShapeCircle::create(); |
| 5430 | 5430 |
| 5431 for (CSSParserValue* argument = args->current(); argument; argument = args-> next()) { | 5431 for (CSSParserValue* argument = args->current(); argument; argument = args-> next()) { |
| 5432 // The call to parseFillPosition below should consume all of the | 5432 // The call to parseFillPosition below should consume all of the |
| 5433 // arguments except the first two. Thus, and index greater than one | 5433 // arguments except the first two. Thus, and index greater than one |
| 5434 // indicates an invalid production. | 5434 // indicates an invalid production. |
| 5435 if (args->currentIndex() > 1) | 5435 if (args->currentIndex() > 1) |
| 5436 return 0; | 5436 return 0; |
| 5437 | 5437 |
| 5438 if (!args->currentIndex() && argument->id != CSSValueAt) { | 5438 if (!args->currentIndex() && argument->id != CSSValueAt) { |
| 5439 if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) { | 5439 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius( argument)) { |
| 5440 shape->setRadius(radius); | 5440 shape->setRadius(radius); |
| 5441 continue; | 5441 continue; |
| 5442 } | 5442 } |
| 5443 | 5443 |
| 5444 return 0; | 5444 return 0; |
| 5445 } | 5445 } |
| 5446 | 5446 |
| 5447 if (argument->id == CSSValueAt) { | 5447 if (argument->id == CSSValueAt) { |
| 5448 RefPtr<CSSValue> centerX; | 5448 RefPtr<CSSValue> centerX; |
| 5449 RefPtr<CSSValue> centerY; | 5449 RefPtr<CSSValue> centerY; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 5480 while (argument) { | 5480 while (argument) { |
| 5481 Units unitFlags = FLength | FPercent; | 5481 Units unitFlags = FLength | FPercent; |
| 5482 if (argumentNumber == 2) { | 5482 if (argumentNumber == 2) { |
| 5483 // Argument radius cannot be negative. | 5483 // Argument radius cannot be negative. |
| 5484 unitFlags = unitFlags | FNonNeg; | 5484 unitFlags = unitFlags | FNonNeg; |
| 5485 } | 5485 } |
| 5486 | 5486 |
| 5487 if (!validUnit(argument, unitFlags)) | 5487 if (!validUnit(argument, unitFlags)) |
| 5488 return 0; | 5488 return 0; |
| 5489 | 5489 |
| 5490 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument) ; | 5490 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal ue(argument); |
| 5491 ASSERT(argumentNumber < 3); | 5491 ASSERT(argumentNumber < 3); |
| 5492 switch (argumentNumber) { | 5492 switch (argumentNumber) { |
| 5493 case 0: | 5493 case 0: |
| 5494 shape->setCenterX(length); | 5494 shape->setCenterX(length); |
| 5495 break; | 5495 break; |
| 5496 case 1: | 5496 case 1: |
| 5497 shape->setCenterY(length); | 5497 shape->setCenterY(length); |
| 5498 break; | 5498 break; |
| 5499 case 2: | 5499 case 2: |
| 5500 shape->setRadius(length); | 5500 shape->setRadius(length); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 5528 RefPtr<CSSBasicShapeEllipse> shape = CSSBasicShapeEllipse::create(); | 5528 RefPtr<CSSBasicShapeEllipse> shape = CSSBasicShapeEllipse::create(); |
| 5529 | 5529 |
| 5530 for (CSSParserValue* argument = args->current(); argument; argument = args-> next()) { | 5530 for (CSSParserValue* argument = args->current(); argument; argument = args-> next()) { |
| 5531 // The call to parseFillPosition below should consume all of the | 5531 // The call to parseFillPosition below should consume all of the |
| 5532 // arguments except the first three. Thus, an index greater than two | 5532 // arguments except the first three. Thus, an index greater than two |
| 5533 // indicates an invalid production. | 5533 // indicates an invalid production. |
| 5534 if (args->currentIndex() > 2) | 5534 if (args->currentIndex() > 2) |
| 5535 return 0; | 5535 return 0; |
| 5536 | 5536 |
| 5537 if (args->currentIndex() < 2 && argument->id != CSSValueAt) { | 5537 if (args->currentIndex() < 2 && argument->id != CSSValueAt) { |
| 5538 if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) { | 5538 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius( argument)) { |
| 5539 if (!shape->radiusX()) | 5539 if (!shape->radiusX()) |
| 5540 shape->setRadiusX(radius); | 5540 shape->setRadiusX(radius); |
| 5541 else | 5541 else |
| 5542 shape->setRadiusY(radius); | 5542 shape->setRadiusY(radius); |
| 5543 continue; | 5543 continue; |
| 5544 } | 5544 } |
| 5545 | 5545 |
| 5546 return 0; | 5546 return 0; |
| 5547 } | 5547 } |
| 5548 | 5548 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 5577 CSSParserValue* argument = args->current(); | 5577 CSSParserValue* argument = args->current(); |
| 5578 while (argument) { | 5578 while (argument) { |
| 5579 Units unitFlags = FLength | FPercent; | 5579 Units unitFlags = FLength | FPercent; |
| 5580 if (argumentNumber > 1) { | 5580 if (argumentNumber > 1) { |
| 5581 // Arguments radiusX and radiusY cannot be negative. | 5581 // Arguments radiusX and radiusY cannot be negative. |
| 5582 unitFlags = unitFlags | FNonNeg; | 5582 unitFlags = unitFlags | FNonNeg; |
| 5583 } | 5583 } |
| 5584 if (!validUnit(argument, unitFlags)) | 5584 if (!validUnit(argument, unitFlags)) |
| 5585 return 0; | 5585 return 0; |
| 5586 | 5586 |
| 5587 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument) ; | 5587 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericVal ue(argument); |
| 5588 ASSERT(argumentNumber < 4); | 5588 ASSERT(argumentNumber < 4); |
| 5589 switch (argumentNumber) { | 5589 switch (argumentNumber) { |
| 5590 case 0: | 5590 case 0: |
| 5591 shape->setCenterX(length); | 5591 shape->setCenterX(length); |
| 5592 break; | 5592 break; |
| 5593 case 1: | 5593 case 1: |
| 5594 shape->setCenterY(length); | 5594 shape->setCenterY(length); |
| 5595 break; | 5595 break; |
| 5596 case 2: | 5596 case 2: |
| 5597 shape->setRadiusX(length); | 5597 shape->setRadiusX(length); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5642 | 5642 |
| 5643 CSSParserValue* argumentX = argument; | 5643 CSSParserValue* argumentX = argument; |
| 5644 while (argumentX) { | 5644 while (argumentX) { |
| 5645 if (!validUnit(argumentX, FLength | FPercent)) | 5645 if (!validUnit(argumentX, FLength | FPercent)) |
| 5646 return 0; | 5646 return 0; |
| 5647 | 5647 |
| 5648 CSSParserValue* argumentY = args->next(); | 5648 CSSParserValue* argumentY = args->next(); |
| 5649 if (!argumentY || !validUnit(argumentY, FLength | FPercent)) | 5649 if (!argumentY || !validUnit(argumentY, FLength | FPercent)) |
| 5650 return 0; | 5650 return 0; |
| 5651 | 5651 |
| 5652 RefPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argument X); | 5652 RefPtrWillBeRawPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericVa lue(argumentX); |
| 5653 RefPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericValue(argument Y); | 5653 RefPtrWillBeRawPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericVa lue(argumentY); |
| 5654 | 5654 |
| 5655 shape->appendPoint(xLength.release(), yLength.release()); | 5655 shape->appendPoint(xLength.release(), yLength.release()); |
| 5656 | 5656 |
| 5657 CSSParserValue* commaOrNull = args->next(); | 5657 CSSParserValue* commaOrNull = args->next(); |
| 5658 if (!commaOrNull) | 5658 if (!commaOrNull) |
| 5659 argumentX = 0; | 5659 argumentX = 0; |
| 5660 else if (!isComma(commaOrNull)) | 5660 else if (!isComma(commaOrNull)) |
| 5661 return 0; | 5661 return 0; |
| 5662 else | 5662 else |
| 5663 argumentX = args->next(); | 5663 argumentX = args->next(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5695 return false; | 5695 return false; |
| 5696 } | 5696 } |
| 5697 | 5697 |
| 5698 PassRefPtr<CSSValue> BisonCSSParser::parseShapeProperty(CSSPropertyID propId) | 5698 PassRefPtr<CSSValue> BisonCSSParser::parseShapeProperty(CSSPropertyID propId) |
| 5699 { | 5699 { |
| 5700 if (!RuntimeEnabledFeatures::cssShapesEnabled()) | 5700 if (!RuntimeEnabledFeatures::cssShapesEnabled()) |
| 5701 return 0; | 5701 return 0; |
| 5702 | 5702 |
| 5703 CSSParserValue* value = m_valueList->current(); | 5703 CSSParserValue* value = m_valueList->current(); |
| 5704 CSSValueID valueId = value->id; | 5704 CSSValueID valueId = value->id; |
| 5705 RefPtr<CSSPrimitiveValue> boxValue; | 5705 RefPtrWillBeRawPtr<CSSPrimitiveValue> boxValue; |
| 5706 RefPtr<CSSPrimitiveValue> shapeValue; | 5706 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; |
| 5707 | 5707 |
| 5708 if (valueId == CSSValueNone | 5708 if (valueId == CSSValueNone |
| 5709 || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside) ) { | 5709 || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside) ) { |
| 5710 RefPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive(valueId, va lue); | 5710 RefPtrWillBeRawPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive (valueId, value); |
| 5711 m_valueList->next(); | 5711 m_valueList->next(); |
| 5712 return keywordValue.release(); | 5712 return keywordValue.release(); |
| 5713 } | 5713 } |
| 5714 | 5714 |
| 5715 RefPtr<CSSValue> imageValue; | 5715 RefPtr<CSSValue> imageValue; |
| 5716 if (valueId != CSSValueNone && parseFillImage(m_valueList.get(), imageValue) ) { | 5716 if (valueId != CSSValueNone && parseFillImage(m_valueList.get(), imageValue) ) { |
| 5717 m_valueList->next(); | 5717 m_valueList->next(); |
| 5718 return imageValue.release(); | 5718 return imageValue.release(); |
| 5719 } | 5719 } |
| 5720 | 5720 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 5747 | 5747 |
| 5748 ASSERT(shapeValue && boxValue); | 5748 ASSERT(shapeValue && boxValue); |
| 5749 shapeValue->getShapeValue()->setLayoutBox(boxValue.release()); | 5749 shapeValue->getShapeValue()->setLayoutBox(boxValue.release()); |
| 5750 } | 5750 } |
| 5751 | 5751 |
| 5752 if (shapeValue) | 5752 if (shapeValue) |
| 5753 return shapeValue.release(); | 5753 return shapeValue.release(); |
| 5754 return boxValue.release(); | 5754 return boxValue.release(); |
| 5755 } | 5755 } |
| 5756 | 5756 |
| 5757 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape() | 5757 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape() |
| 5758 { | 5758 { |
| 5759 CSSParserValue* value = m_valueList->current(); | 5759 CSSParserValue* value = m_valueList->current(); |
| 5760 ASSERT(value->unit == CSSParserValue::Function); | 5760 ASSERT(value->unit == CSSParserValue::Function); |
| 5761 CSSParserValueList* args = value->function->args.get(); | 5761 CSSParserValueList* args = value->function->args.get(); |
| 5762 | 5762 |
| 5763 if (!args) | 5763 if (!args) |
| 5764 return 0; | 5764 return 0; |
| 5765 | 5765 |
| 5766 RefPtr<CSSBasicShape> shape; | 5766 RefPtr<CSSBasicShape> shape; |
| 5767 if (equalIgnoringCase(value->function->name, "rectangle(")) | 5767 if (equalIgnoringCase(value->function->name, "rectangle(")) |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6003 } | 6003 } |
| 6004 | 6004 |
| 6005 bool BisonCSSParser::parseFontVariant(bool important) | 6005 bool BisonCSSParser::parseFontVariant(bool important) |
| 6006 { | 6006 { |
| 6007 RefPtrWillBeRawPtr<CSSValueList> values; | 6007 RefPtrWillBeRawPtr<CSSValueList> values; |
| 6008 if (m_valueList->size() > 1) | 6008 if (m_valueList->size() > 1) |
| 6009 values = CSSValueList::createCommaSeparated(); | 6009 values = CSSValueList::createCommaSeparated(); |
| 6010 CSSParserValue* val; | 6010 CSSParserValue* val; |
| 6011 bool expectComma = false; | 6011 bool expectComma = false; |
| 6012 while ((val = m_valueList->current())) { | 6012 while ((val = m_valueList->current())) { |
| 6013 RefPtr<CSSPrimitiveValue> parsedValue; | 6013 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue; |
| 6014 if (!expectComma) { | 6014 if (!expectComma) { |
| 6015 expectComma = true; | 6015 expectComma = true; |
| 6016 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) | 6016 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) |
| 6017 parsedValue = cssValuePool().createIdentifierValue(val->id); | 6017 parsedValue = cssValuePool().createIdentifierValue(val->id); |
| 6018 else if (val->id == CSSValueAll && !values) { | 6018 else if (val->id == CSSValueAll && !values) { |
| 6019 // 'all' is only allowed in @font-face and with no other values. Make a value list to | 6019 // 'all' is only allowed in @font-face and with no other values. Make a value list to |
| 6020 // indicate that we are in the @font-face case. | 6020 // indicate that we are in the @font-face case. |
| 6021 values = CSSValueList::createCommaSeparated(); | 6021 values = CSSValueList::createCommaSeparated(); |
| 6022 parsedValue = cssValuePool().createIdentifierValue(val->id); | 6022 parsedValue = cssValuePool().createIdentifierValue(val->id); |
| 6023 } | 6023 } |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6659 if (v->unit != CSSParserValue::Operator && v->iValue != ',') | 6659 if (v->unit != CSSParserValue::Operator && v->iValue != ',') |
| 6660 return false; | 6660 return false; |
| 6661 v = args->next(); | 6661 v = args->next(); |
| 6662 if (!validUnit(v, FNumber, HTMLStandardMode)) | 6662 if (!validUnit(v, FNumber, HTMLStandardMode)) |
| 6663 return false; | 6663 return false; |
| 6664 colorArray[3] = max(0.0, min(1.0, parsedDouble(v, ReleaseParsedCalcValue ))); | 6664 colorArray[3] = max(0.0, min(1.0, parsedDouble(v, ReleaseParsedCalcValue ))); |
| 6665 } | 6665 } |
| 6666 return true; | 6666 return true; |
| 6667 } | 6667 } |
| 6668 | 6668 |
| 6669 PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseColor(CSSParserValue* value) | 6669 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseColor(CSSParserVa lue* value) |
| 6670 { | 6670 { |
| 6671 RGBA32 c = Color::transparent; | 6671 RGBA32 c = Color::transparent; |
| 6672 if (!parseColorFromValue(value ? value : m_valueList->current(), c)) | 6672 if (!parseColorFromValue(value ? value : m_valueList->current(), c)) |
| 6673 return 0; | 6673 return 0; |
| 6674 return cssValuePool().createColorValue(c); | 6674 return cssValuePool().createColorValue(c); |
| 6675 } | 6675 } |
| 6676 | 6676 |
| 6677 bool BisonCSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c) | 6677 bool BisonCSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c) |
| 6678 { | 6678 { |
| 6679 if (inQuirksMode() && value->unit == CSSPrimitiveValue::CSS_NUMBER | 6679 if (inQuirksMode() && value->unit == CSSPrimitiveValue::CSS_NUMBER |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6770 allowColor = true; | 6770 allowColor = true; |
| 6771 allowBreak = true; | 6771 allowBreak = true; |
| 6772 allowY = false; | 6772 allowY = false; |
| 6773 allowBlur = false; | 6773 allowBlur = false; |
| 6774 allowSpread = false; | 6774 allowSpread = false; |
| 6775 allowStyle = property == CSSPropertyWebkitBoxShadow || property == CSSPr opertyBoxShadow; | 6775 allowStyle = property == CSSPropertyWebkitBoxShadow || property == CSSPr opertyBoxShadow; |
| 6776 } | 6776 } |
| 6777 | 6777 |
| 6778 void commitLength(CSSParserValue* v) | 6778 void commitLength(CSSParserValue* v) |
| 6779 { | 6779 { |
| 6780 RefPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v) ; | 6780 RefPtrWillBeRawPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNum ericValue(v); |
| 6781 | 6781 |
| 6782 if (allowX) { | 6782 if (allowX) { |
| 6783 x = val.release(); | 6783 x = val.release(); |
| 6784 allowX = false; | 6784 allowX = false; |
| 6785 allowY = true; | 6785 allowY = true; |
| 6786 allowColor = false; | 6786 allowColor = false; |
| 6787 allowStyle = false; | 6787 allowStyle = false; |
| 6788 allowBreak = false; | 6788 allowBreak = false; |
| 6789 } else if (allowY) { | 6789 } else if (allowY) { |
| 6790 y = val.release(); | 6790 y = val.release(); |
| 6791 allowY = false; | 6791 allowY = false; |
| 6792 allowBlur = true; | 6792 allowBlur = true; |
| 6793 allowColor = true; | 6793 allowColor = true; |
| 6794 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C SSPropertyBoxShadow; | 6794 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C SSPropertyBoxShadow; |
| 6795 allowBreak = true; | 6795 allowBreak = true; |
| 6796 } else if (allowBlur) { | 6796 } else if (allowBlur) { |
| 6797 blur = val.release(); | 6797 blur = val.release(); |
| 6798 allowBlur = false; | 6798 allowBlur = false; |
| 6799 allowSpread = property == CSSPropertyWebkitBoxShadow || property == CSSPropertyBoxShadow; | 6799 allowSpread = property == CSSPropertyWebkitBoxShadow || property == CSSPropertyBoxShadow; |
| 6800 } else if (allowSpread) { | 6800 } else if (allowSpread) { |
| 6801 spread = val.release(); | 6801 spread = val.release(); |
| 6802 allowSpread = false; | 6802 allowSpread = false; |
| 6803 } | 6803 } |
| 6804 } | 6804 } |
| 6805 | 6805 |
| 6806 void commitColor(PassRefPtr<CSSPrimitiveValue> val) | 6806 void commitColor(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) |
| 6807 { | 6807 { |
| 6808 color = val; | 6808 color = val; |
| 6809 allowColor = false; | 6809 allowColor = false; |
| 6810 if (allowX) { | 6810 if (allowX) { |
| 6811 allowStyle = false; | 6811 allowStyle = false; |
| 6812 allowBreak = false; | 6812 allowBreak = false; |
| 6813 } else { | 6813 } else { |
| 6814 allowBlur = false; | 6814 allowBlur = false; |
| 6815 allowSpread = false; | 6815 allowSpread = false; |
| 6816 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C SSPropertyBoxShadow; | 6816 allowStyle = property == CSSPropertyWebkitBoxShadow || property == C SSPropertyBoxShadow; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 6827 allowBlur = false; | 6827 allowBlur = false; |
| 6828 allowSpread = false; | 6828 allowSpread = false; |
| 6829 allowColor = false; | 6829 allowColor = false; |
| 6830 } | 6830 } |
| 6831 } | 6831 } |
| 6832 | 6832 |
| 6833 CSSPropertyID property; | 6833 CSSPropertyID property; |
| 6834 BisonCSSParser* m_parser; | 6834 BisonCSSParser* m_parser; |
| 6835 | 6835 |
| 6836 RefPtrWillBeRawPtr<CSSValueList> values; | 6836 RefPtrWillBeRawPtr<CSSValueList> values; |
| 6837 RefPtr<CSSPrimitiveValue> x; | 6837 RefPtrWillBeRawPtr<CSSPrimitiveValue> x; |
| 6838 RefPtr<CSSPrimitiveValue> y; | 6838 RefPtrWillBeRawPtr<CSSPrimitiveValue> y; |
| 6839 RefPtr<CSSPrimitiveValue> blur; | 6839 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur; |
| 6840 RefPtr<CSSPrimitiveValue> spread; | 6840 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread; |
| 6841 RefPtr<CSSPrimitiveValue> style; | 6841 RefPtrWillBeRawPtr<CSSPrimitiveValue> style; |
| 6842 RefPtr<CSSPrimitiveValue> color; | 6842 RefPtrWillBeRawPtr<CSSPrimitiveValue> color; |
| 6843 | 6843 |
| 6844 bool allowX; | 6844 bool allowX; |
| 6845 bool allowY; | 6845 bool allowY; |
| 6846 bool allowBlur; | 6846 bool allowBlur; |
| 6847 bool allowSpread; | 6847 bool allowSpread; |
| 6848 bool allowColor; | 6848 bool allowColor; |
| 6849 bool allowStyle; // inset or not. | 6849 bool allowStyle; // inset or not. |
| 6850 bool allowBreak; | 6850 bool allowBreak; |
| 6851 }; | 6851 }; |
| 6852 | 6852 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 6874 | 6874 |
| 6875 // A length is allowed here. Construct the value and add it. | 6875 // A length is allowed here. Construct the value and add it. |
| 6876 context.commitLength(val); | 6876 context.commitLength(val); |
| 6877 } else if (val->id == CSSValueInset) { | 6877 } else if (val->id == CSSValueInset) { |
| 6878 if (!context.allowStyle) | 6878 if (!context.allowStyle) |
| 6879 return 0; | 6879 return 0; |
| 6880 | 6880 |
| 6881 context.commitStyle(val); | 6881 context.commitStyle(val); |
| 6882 } else { | 6882 } else { |
| 6883 // The only other type of value that's ok is a color value. | 6883 // The only other type of value that's ok is a color value. |
| 6884 RefPtr<CSSPrimitiveValue> parsedColor; | 6884 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedColor; |
| 6885 bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindo wtext) || val->id == CSSValueMenu | 6885 bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindo wtext) || val->id == CSSValueMenu |
| 6886 || (val->id >= CSSValueWebkitFocusRingColor && val-> id <= CSSValueWebkitText && inQuirksMode()) | 6886 || (val->id >= CSSValueWebkitFocusRingColor && val-> id <= CSSValueWebkitText && inQuirksMode()) |
| 6887 || val->id == CSSValueCurrentcolor); | 6887 || val->id == CSSValueCurrentcolor); |
| 6888 if (isColor) { | 6888 if (isColor) { |
| 6889 if (!context.allowColor) | 6889 if (!context.allowColor) |
| 6890 return 0; | 6890 return 0; |
| 6891 parsedColor = cssValuePool().createIdentifierValue(val->id); | 6891 parsedColor = cssValuePool().createIdentifierValue(val->id); |
| 6892 } | 6892 } |
| 6893 | 6893 |
| 6894 if (!parsedColor) | 6894 if (!parsedColor) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 6913 | 6913 |
| 6914 return 0; | 6914 return 0; |
| 6915 } | 6915 } |
| 6916 | 6916 |
| 6917 bool BisonCSSParser::parseReflect(CSSPropertyID propId, bool important) | 6917 bool BisonCSSParser::parseReflect(CSSPropertyID propId, bool important) |
| 6918 { | 6918 { |
| 6919 // box-reflect: <direction> <offset> <mask> | 6919 // box-reflect: <direction> <offset> <mask> |
| 6920 | 6920 |
| 6921 // Direction comes first. | 6921 // Direction comes first. |
| 6922 CSSParserValue* val = m_valueList->current(); | 6922 CSSParserValue* val = m_valueList->current(); |
| 6923 RefPtr<CSSPrimitiveValue> direction; | 6923 RefPtrWillBeRawPtr<CSSPrimitiveValue> direction; |
| 6924 if (isVariableReference(val)) { | 6924 if (isVariableReference(val)) { |
| 6925 direction = createPrimitiveVariableReferenceValue(val); | 6925 direction = createPrimitiveVariableReferenceValue(val); |
| 6926 } else { | 6926 } else { |
| 6927 switch (val->id) { | 6927 switch (val->id) { |
| 6928 case CSSValueAbove: | 6928 case CSSValueAbove: |
| 6929 case CSSValueBelow: | 6929 case CSSValueBelow: |
| 6930 case CSSValueLeft: | 6930 case CSSValueLeft: |
| 6931 case CSSValueRight: | 6931 case CSSValueRight: |
| 6932 direction = cssValuePool().createIdentifierValue(val->id); | 6932 direction = cssValuePool().createIdentifierValue(val->id); |
| 6933 break; | 6933 break; |
| 6934 default: | 6934 default: |
| 6935 return false; | 6935 return false; |
| 6936 } | 6936 } |
| 6937 } | 6937 } |
| 6938 | 6938 |
| 6939 // The offset comes next. | 6939 // The offset comes next. |
| 6940 val = m_valueList->next(); | 6940 val = m_valueList->next(); |
| 6941 RefPtr<CSSPrimitiveValue> offset; | 6941 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset; |
| 6942 if (!val) | 6942 if (!val) |
| 6943 offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); | 6943 offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); |
| 6944 else { | 6944 else { |
| 6945 if (!validUnit(val, FLength | FPercent)) | 6945 if (!validUnit(val, FLength | FPercent)) |
| 6946 return false; | 6946 return false; |
| 6947 offset = createPrimitiveNumericValue(val); | 6947 offset = createPrimitiveNumericValue(val); |
| 6948 } | 6948 } |
| 6949 | 6949 |
| 6950 // Now for the mask. | 6950 // Now for the mask. |
| 6951 RefPtr<CSSValue> mask; | 6951 RefPtr<CSSValue> mask; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 6962 return true; | 6962 return true; |
| 6963 } | 6963 } |
| 6964 | 6964 |
| 6965 bool BisonCSSParser::parseFlex(CSSParserValueList* args, bool important) | 6965 bool BisonCSSParser::parseFlex(CSSParserValueList* args, bool important) |
| 6966 { | 6966 { |
| 6967 if (!args || !args->size() || args->size() > 3) | 6967 if (!args || !args->size() || args->size() > 3) |
| 6968 return false; | 6968 return false; |
| 6969 static const double unsetValue = -1; | 6969 static const double unsetValue = -1; |
| 6970 double flexGrow = unsetValue; | 6970 double flexGrow = unsetValue; |
| 6971 double flexShrink = unsetValue; | 6971 double flexShrink = unsetValue; |
| 6972 RefPtr<CSSPrimitiveValue> flexBasis; | 6972 RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis; |
| 6973 | 6973 |
| 6974 while (CSSParserValue* arg = args->current()) { | 6974 while (CSSParserValue* arg = args->current()) { |
| 6975 if (validUnit(arg, FNumber | FNonNeg)) { | 6975 if (validUnit(arg, FNumber | FNonNeg)) { |
| 6976 if (flexGrow == unsetValue) | 6976 if (flexGrow == unsetValue) |
| 6977 flexGrow = arg->fValue; | 6977 flexGrow = arg->fValue; |
| 6978 else if (flexShrink == unsetValue) | 6978 else if (flexShrink == unsetValue) |
| 6979 flexShrink = arg->fValue; | 6979 flexShrink = arg->fValue; |
| 6980 else if (!arg->fValue) { | 6980 else if (!arg->fValue) { |
| 6981 // flex only allows a basis of 0 (sans units) if flex-grow and f lex-shrink values have already been set. | 6981 // flex only allows a basis of 0 (sans units) if flex-grow and f lex-shrink values have already been set. |
| 6982 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS _PX); | 6982 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS _PX); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7069 m_canAdvance = true; | 7069 m_canAdvance = true; |
| 7070 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all owForwardSlashOperator = false; | 7070 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all owForwardSlashOperator = false; |
| 7071 if (!m_borderSlice) { | 7071 if (!m_borderSlice) { |
| 7072 m_requireWidth = true; | 7072 m_requireWidth = true; |
| 7073 m_requireOutset = false; | 7073 m_requireOutset = false; |
| 7074 } else { | 7074 } else { |
| 7075 m_requireOutset = true; | 7075 m_requireOutset = true; |
| 7076 m_requireWidth = false; | 7076 m_requireWidth = false; |
| 7077 } | 7077 } |
| 7078 } | 7078 } |
| 7079 void commitBorderWidth(PassRefPtr<CSSPrimitiveValue> slice) | 7079 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> slice) |
| 7080 { | 7080 { |
| 7081 m_borderSlice = slice; | 7081 m_borderSlice = slice; |
| 7082 m_canAdvance = true; | 7082 m_canAdvance = true; |
| 7083 m_allowCommit = m_allowForwardSlashOperator = true; | 7083 m_allowCommit = m_allowForwardSlashOperator = true; |
| 7084 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 7084 m_allowImageSlice = m_requireWidth = m_requireOutset = false; |
| 7085 m_allowImage = !m_image; | 7085 m_allowImage = !m_image; |
| 7086 m_allowRepeat = !m_repeat; | 7086 m_allowRepeat = !m_repeat; |
| 7087 } | 7087 } |
| 7088 void commitBorderOutset(PassRefPtr<CSSPrimitiveValue> outset) | 7088 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) |
| 7089 { | 7089 { |
| 7090 m_outset = outset; | 7090 m_outset = outset; |
| 7091 m_canAdvance = true; | 7091 m_canAdvance = true; |
| 7092 m_allowCommit = true; | 7092 m_allowCommit = true; |
| 7093 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req uireOutset = false; | 7093 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req uireOutset = false; |
| 7094 m_allowImage = !m_image; | 7094 m_allowImage = !m_image; |
| 7095 m_allowRepeat = !m_repeat; | 7095 m_allowRepeat = !m_repeat; |
| 7096 } | 7096 } |
| 7097 void commitRepeat(PassRefPtr<CSSValue> repeat) | 7097 void commitRepeat(PassRefPtr<CSSValue> repeat) |
| 7098 { | 7098 { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7141 bool m_allowImage; | 7141 bool m_allowImage; |
| 7142 bool m_allowImageSlice; | 7142 bool m_allowImageSlice; |
| 7143 bool m_allowRepeat; | 7143 bool m_allowRepeat; |
| 7144 bool m_allowForwardSlashOperator; | 7144 bool m_allowForwardSlashOperator; |
| 7145 | 7145 |
| 7146 bool m_requireWidth; | 7146 bool m_requireWidth; |
| 7147 bool m_requireOutset; | 7147 bool m_requireOutset; |
| 7148 | 7148 |
| 7149 RefPtr<CSSValue> m_image; | 7149 RefPtr<CSSValue> m_image; |
| 7150 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice; | 7150 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice; |
| 7151 RefPtr<CSSPrimitiveValue> m_borderSlice; | 7151 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_borderSlice; |
| 7152 RefPtr<CSSPrimitiveValue> m_outset; | 7152 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_outset; |
| 7153 | 7153 |
| 7154 RefPtr<CSSValue> m_repeat; | 7154 RefPtr<CSSValue> m_repeat; |
| 7155 }; | 7155 }; |
| 7156 | 7156 |
| 7157 static bool buildBorderImageParseContext(BisonCSSParser& parser, CSSPropertyID p ropId, BorderImageParseContext& context) | 7157 static bool buildBorderImageParseContext(BisonCSSParser& parser, CSSPropertyID p ropId, BorderImageParseContext& context) |
| 7158 { | 7158 { |
| 7159 ShorthandScope scope(&parser, propId); | 7159 ShorthandScope scope(&parser, propId); |
| 7160 while (CSSParserValue* val = parser.m_valueList->current()) { | 7160 while (CSSParserValue* val = parser.m_valueList->current()) { |
| 7161 context.setCanAdvance(false); | 7161 context.setCanAdvance(false); |
| 7162 | 7162 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 7188 context.commitImageSlice(imageSlice.release()); | 7188 context.commitImageSlice(imageSlice.release()); |
| 7189 } | 7189 } |
| 7190 | 7190 |
| 7191 if (!context.canAdvance() && context.allowRepeat()) { | 7191 if (!context.canAdvance() && context.allowRepeat()) { |
| 7192 RefPtr<CSSValue> repeat; | 7192 RefPtr<CSSValue> repeat; |
| 7193 if (parser.parseBorderImageRepeat(repeat)) | 7193 if (parser.parseBorderImageRepeat(repeat)) |
| 7194 context.commitRepeat(repeat.release()); | 7194 context.commitRepeat(repeat.release()); |
| 7195 } | 7195 } |
| 7196 | 7196 |
| 7197 if (!context.canAdvance() && context.requireWidth()) { | 7197 if (!context.canAdvance() && context.requireWidth()) { |
| 7198 RefPtr<CSSPrimitiveValue> borderSlice; | 7198 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice; |
| 7199 if (parser.parseBorderImageWidth(borderSlice)) | 7199 if (parser.parseBorderImageWidth(borderSlice)) |
| 7200 context.commitBorderWidth(borderSlice.release()); | 7200 context.commitBorderWidth(borderSlice.release()); |
| 7201 } | 7201 } |
| 7202 | 7202 |
| 7203 if (!context.canAdvance() && context.requireOutset()) { | 7203 if (!context.canAdvance() && context.requireOutset()) { |
| 7204 RefPtr<CSSPrimitiveValue> borderOutset; | 7204 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset; |
| 7205 if (parser.parseBorderImageOutset(borderOutset)) | 7205 if (parser.parseBorderImageOutset(borderOutset)) |
| 7206 context.commitBorderOutset(borderOutset.release()); | 7206 context.commitBorderOutset(borderOutset.release()); |
| 7207 } | 7207 } |
| 7208 | 7208 |
| 7209 if (!context.canAdvance()) | 7209 if (!context.canAdvance()) |
| 7210 return false; | 7210 return false; |
| 7211 | 7211 |
| 7212 parser.m_valueList->next(); | 7212 parser.m_valueList->next(); |
| 7213 } | 7213 } |
| 7214 | 7214 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 7243 return 0; | 7243 return 0; |
| 7244 } | 7244 } |
| 7245 | 7245 |
| 7246 static bool isBorderImageRepeatKeyword(int id) | 7246 static bool isBorderImageRepeatKeyword(int id) |
| 7247 { | 7247 { |
| 7248 return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace || id == CSSValueRound; | 7248 return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace || id == CSSValueRound; |
| 7249 } | 7249 } |
| 7250 | 7250 |
| 7251 bool BisonCSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result) | 7251 bool BisonCSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result) |
| 7252 { | 7252 { |
| 7253 RefPtr<CSSPrimitiveValue> firstValue; | 7253 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue; |
| 7254 RefPtr<CSSPrimitiveValue> secondValue; | 7254 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue; |
| 7255 CSSParserValue* val = m_valueList->current(); | 7255 CSSParserValue* val = m_valueList->current(); |
| 7256 if (!val) | 7256 if (!val) |
| 7257 return false; | 7257 return false; |
| 7258 if (isBorderImageRepeatKeyword(val->id)) | 7258 if (isBorderImageRepeatKeyword(val->id)) |
| 7259 firstValue = cssValuePool().createIdentifierValue(val->id); | 7259 firstValue = cssValuePool().createIdentifierValue(val->id); |
| 7260 else | 7260 else |
| 7261 return false; | 7261 return false; |
| 7262 | 7262 |
| 7263 val = m_valueList->next(); | 7263 val = m_valueList->next(); |
| 7264 if (val) { | 7264 if (val) { |
| 7265 if (isBorderImageRepeatKeyword(val->id)) | 7265 if (isBorderImageRepeatKeyword(val->id)) |
| 7266 secondValue = cssValuePool().createIdentifierValue(val->id); | 7266 secondValue = cssValuePool().createIdentifierValue(val->id); |
| 7267 else if (!inShorthand()) { | 7267 else if (!inShorthand()) { |
| 7268 // If we're not parsing a shorthand then we are invalid. | 7268 // If we're not parsing a shorthand then we are invalid. |
| 7269 return false; | 7269 return false; |
| 7270 } else { | 7270 } else { |
| 7271 // We need to rewind the value list, so that when its advanced we'll | 7271 // We need to rewind the value list, so that when its advanced we'll |
| 7272 // end up back at this value. | 7272 // end up back at this value. |
| 7273 m_valueList->previous(); | 7273 m_valueList->previous(); |
| 7274 secondValue = firstValue; | 7274 secondValue = firstValue; |
| 7275 } | 7275 } |
| 7276 } else | 7276 } else |
| 7277 secondValue = firstValue; | 7277 secondValue = firstValue; |
| 7278 | 7278 |
| 7279 result = createPrimitiveValuePair(firstValue, secondValue); | 7279 result = createPrimitiveValuePair(firstValue, secondValue); |
| 7280 return true; | 7280 return true; |
| 7281 } | 7281 } |
| 7282 | 7282 |
| 7283 class BorderImageSliceParseContext { | 7283 class BorderImageSliceParseContext { |
|
haraken
2014/02/12 14:05:45
You need DISALLOW_ALLOCATION().
It would be nice
wibling-chromium
2014/02/12 14:42:19
Done.
| |
| 7284 public: | 7284 public: |
| 7285 BorderImageSliceParseContext(BisonCSSParser* parser) | 7285 BorderImageSliceParseContext(BisonCSSParser* parser) |
| 7286 : m_parser(parser) | 7286 : m_parser(parser) |
| 7287 , m_allowNumber(true) | 7287 , m_allowNumber(true) |
| 7288 , m_allowFill(true) | 7288 , m_allowFill(true) |
| 7289 , m_allowFinalCommit(false) | 7289 , m_allowFinalCommit(false) |
| 7290 , m_fill(false) | 7290 , m_fill(false) |
| 7291 { } | 7291 { } |
| 7292 | 7292 |
| 7293 bool allowNumber() const { return m_allowNumber; } | 7293 bool allowNumber() const { return m_allowNumber; } |
| 7294 bool allowFill() const { return m_allowFill; } | 7294 bool allowFill() const { return m_allowFill; } |
| 7295 bool allowFinalCommit() const { return m_allowFinalCommit; } | 7295 bool allowFinalCommit() const { return m_allowFinalCommit; } |
| 7296 CSSPrimitiveValue* top() const { return m_top.get(); } | 7296 CSSPrimitiveValue* top() const { return m_top.get(); } |
| 7297 | 7297 |
| 7298 void commitNumber(CSSParserValue* v) | 7298 void commitNumber(CSSParserValue* v) |
| 7299 { | 7299 { |
| 7300 RefPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v) ; | 7300 RefPtrWillBeRawPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNum ericValue(v); |
| 7301 if (!m_top) | 7301 if (!m_top) |
| 7302 m_top = val; | 7302 m_top = val; |
| 7303 else if (!m_right) | 7303 else if (!m_right) |
| 7304 m_right = val; | 7304 m_right = val; |
| 7305 else if (!m_bottom) | 7305 else if (!m_bottom) |
| 7306 m_bottom = val; | 7306 m_bottom = val; |
| 7307 else { | 7307 else { |
| 7308 ASSERT(!m_left); | 7308 ASSERT(!m_left); |
| 7309 m_left = val; | 7309 m_left = val; |
| 7310 } | 7310 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7342 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad. release()), m_fill); | 7342 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad. release()), m_fill); |
| 7343 } | 7343 } |
| 7344 | 7344 |
| 7345 private: | 7345 private: |
| 7346 BisonCSSParser* m_parser; | 7346 BisonCSSParser* m_parser; |
| 7347 | 7347 |
| 7348 bool m_allowNumber; | 7348 bool m_allowNumber; |
| 7349 bool m_allowFill; | 7349 bool m_allowFill; |
| 7350 bool m_allowFinalCommit; | 7350 bool m_allowFinalCommit; |
| 7351 | 7351 |
| 7352 RefPtr<CSSPrimitiveValue> m_top; | 7352 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; |
| 7353 RefPtr<CSSPrimitiveValue> m_right; | 7353 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; |
| 7354 RefPtr<CSSPrimitiveValue> m_bottom; | 7354 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; |
| 7355 RefPtr<CSSPrimitiveValue> m_left; | 7355 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; |
| 7356 | 7356 |
| 7357 bool m_fill; | 7357 bool m_fill; |
| 7358 }; | 7358 }; |
| 7359 | 7359 |
| 7360 bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBeRaw Ptr<CSSBorderImageSliceValue>& result) | 7360 bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBeRaw Ptr<CSSBorderImageSliceValue>& result) |
| 7361 { | 7361 { |
| 7362 BorderImageSliceParseContext context(this); | 7362 BorderImageSliceParseContext context(this); |
| 7363 CSSParserValue* val; | 7363 CSSParserValue* val; |
| 7364 while ((val = m_valueList->current())) { | 7364 while ((val = m_valueList->current())) { |
| 7365 // FIXME calc() http://webkit.org/b/16662 : calc is parsed but values ar e not created yet. | 7365 // 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... | |
| 7401 , m_allowNumber(true) | 7401 , m_allowNumber(true) |
| 7402 , m_allowFinalCommit(false) | 7402 , m_allowFinalCommit(false) |
| 7403 { } | 7403 { } |
| 7404 | 7404 |
| 7405 bool allowNumber() const { return m_allowNumber; } | 7405 bool allowNumber() const { return m_allowNumber; } |
| 7406 bool allowFinalCommit() const { return m_allowFinalCommit; } | 7406 bool allowFinalCommit() const { return m_allowFinalCommit; } |
| 7407 CSSPrimitiveValue* top() const { return m_top.get(); } | 7407 CSSPrimitiveValue* top() const { return m_top.get(); } |
| 7408 | 7408 |
| 7409 void commitNumber(CSSParserValue* v) | 7409 void commitNumber(CSSParserValue* v) |
| 7410 { | 7410 { |
| 7411 RefPtr<CSSPrimitiveValue> val; | 7411 RefPtrWillBeRawPtr<CSSPrimitiveValue> val; |
| 7412 if (v->id == CSSValueAuto) | 7412 if (v->id == CSSValueAuto) |
| 7413 val = cssValuePool().createIdentifierValue(v->id); | 7413 val = cssValuePool().createIdentifierValue(v->id); |
| 7414 else | 7414 else |
| 7415 val = m_parser->createPrimitiveNumericValue(v); | 7415 val = m_parser->createPrimitiveNumericValue(v); |
| 7416 | 7416 |
| 7417 if (!m_top) | 7417 if (!m_top) |
| 7418 m_top = val; | 7418 m_top = val; |
| 7419 else if (!m_right) | 7419 else if (!m_right) |
| 7420 m_right = val; | 7420 m_right = val; |
| 7421 else if (!m_bottom) | 7421 else if (!m_bottom) |
| 7422 m_bottom = val; | 7422 m_bottom = val; |
| 7423 else { | 7423 else { |
| 7424 ASSERT(!m_left); | 7424 ASSERT(!m_left); |
| 7425 m_left = val; | 7425 m_left = val; |
| 7426 } | 7426 } |
| 7427 | 7427 |
| 7428 m_allowNumber = !m_left; | 7428 m_allowNumber = !m_left; |
| 7429 m_allowFinalCommit = true; | 7429 m_allowFinalCommit = true; |
| 7430 } | 7430 } |
| 7431 | 7431 |
| 7432 void setAllowFinalCommit() { m_allowFinalCommit = true; } | 7432 void setAllowFinalCommit() { m_allowFinalCommit = true; } |
| 7433 void setTop(PassRefPtr<CSSPrimitiveValue> val) { m_top = val; } | 7433 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } |
| 7434 | 7434 |
| 7435 PassRefPtr<CSSPrimitiveValue> commitBorderImageQuad() | 7435 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> commitBorderImageQuad() |
| 7436 { | 7436 { |
| 7437 // We need to clone and repeat values for any omissions. | 7437 // We need to clone and repeat values for any omissions. |
| 7438 ASSERT(m_top); | 7438 ASSERT(m_top); |
| 7439 if (!m_right) { | 7439 if (!m_right) { |
| 7440 m_right = m_top; | 7440 m_right = m_top; |
| 7441 m_bottom = m_top; | 7441 m_bottom = m_top; |
| 7442 m_left = m_top; | 7442 m_left = m_top; |
| 7443 } | 7443 } |
| 7444 if (!m_bottom) { | 7444 if (!m_bottom) { |
| 7445 m_bottom = m_top; | 7445 m_bottom = m_top; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 7458 // Make our new value now. | 7458 // Make our new value now. |
| 7459 return cssValuePool().createValue(quad.release()); | 7459 return cssValuePool().createValue(quad.release()); |
| 7460 } | 7460 } |
| 7461 | 7461 |
| 7462 private: | 7462 private: |
| 7463 BisonCSSParser* m_parser; | 7463 BisonCSSParser* m_parser; |
| 7464 | 7464 |
| 7465 bool m_allowNumber; | 7465 bool m_allowNumber; |
| 7466 bool m_allowFinalCommit; | 7466 bool m_allowFinalCommit; |
| 7467 | 7467 |
| 7468 RefPtr<CSSPrimitiveValue> m_top; | 7468 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; |
| 7469 RefPtr<CSSPrimitiveValue> m_right; | 7469 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; |
| 7470 RefPtr<CSSPrimitiveValue> m_bottom; | 7470 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; |
| 7471 RefPtr<CSSPrimitiveValue> m_left; | 7471 RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; |
| 7472 }; | 7472 }; |
| 7473 | 7473 |
| 7474 bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtr<CSSPrimitiveV alue>& result) | 7474 bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<C SSPrimitiveValue>& result) |
| 7475 { | 7475 { |
| 7476 BorderImageQuadParseContext context(this); | 7476 BorderImageQuadParseContext context(this); |
| 7477 CSSParserValue* val; | 7477 CSSParserValue* val; |
| 7478 while ((val = m_valueList->current())) { | 7478 while ((val = m_valueList->current())) { |
| 7479 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod e) || val->id == CSSValueAuto)) { | 7479 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod e) || val->id == CSSValueAuto)) { |
| 7480 context.commitNumber(val); | 7480 context.commitNumber(val); |
| 7481 } else if (!inShorthand()) { | 7481 } else if (!inShorthand()) { |
| 7482 // If we're not parsing a shorthand then we are invalid. | 7482 // If we're not parsing a shorthand then we are invalid. |
| 7483 return false; | 7483 return false; |
| 7484 } else { | 7484 } else { |
| 7485 if (context.allowFinalCommit()) | 7485 if (context.allowFinalCommit()) |
| 7486 m_valueList->previous(); // The shorthand loop will advance back to this point. | 7486 m_valueList->previous(); // The shorthand loop will advance back to this point. |
| 7487 break; | 7487 break; |
| 7488 } | 7488 } |
| 7489 m_valueList->next(); | 7489 m_valueList->next(); |
| 7490 } | 7490 } |
| 7491 | 7491 |
| 7492 if (context.allowFinalCommit()) { | 7492 if (context.allowFinalCommit()) { |
| 7493 // Need to fully commit as a single value. | 7493 // Need to fully commit as a single value. |
| 7494 result = context.commitBorderImageQuad(); | 7494 result = context.commitBorderImageQuad(); |
| 7495 return true; | 7495 return true; |
| 7496 } | 7496 } |
| 7497 return false; | 7497 return false; |
| 7498 } | 7498 } |
| 7499 | 7499 |
| 7500 bool BisonCSSParser::parseBorderImageWidth(RefPtr<CSSPrimitiveValue>& result) | 7500 bool BisonCSSParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSPrimitiveValue> & result) |
| 7501 { | 7501 { |
| 7502 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); | 7502 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); |
| 7503 } | 7503 } |
| 7504 | 7504 |
| 7505 bool BisonCSSParser::parseBorderImageOutset(RefPtr<CSSPrimitiveValue>& result) | 7505 bool BisonCSSParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSPrimitiveValue >& result) |
| 7506 { | 7506 { |
| 7507 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); | 7507 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); |
| 7508 } | 7508 } |
| 7509 | 7509 |
| 7510 bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important) | 7510 bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important) |
| 7511 { | 7511 { |
| 7512 unsigned num = m_valueList->size(); | 7512 unsigned num = m_valueList->size(); |
| 7513 if (num > 9) | 7513 if (num > 9) |
| 7514 return false; | 7514 return false; |
| 7515 | 7515 |
| 7516 ShorthandScope scope(this, propId); | 7516 ShorthandScope scope(this, propId); |
| 7517 RefPtr<CSSPrimitiveValue> radii[2][4]; | 7517 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4]; |
| 7518 | 7518 |
| 7519 unsigned indexAfterSlash = 0; | 7519 unsigned indexAfterSlash = 0; |
| 7520 for (unsigned i = 0; i < num; ++i) { | 7520 for (unsigned i = 0; i < num; ++i) { |
| 7521 CSSParserValue* value = m_valueList->valueAt(i); | 7521 CSSParserValue* value = m_valueList->valueAt(i); |
| 7522 if (value->unit == CSSParserValue::Operator) { | 7522 if (value->unit == CSSParserValue::Operator) { |
| 7523 if (value->iValue != '/') | 7523 if (value->iValue != '/') |
| 7524 return false; | 7524 return false; |
| 7525 | 7525 |
| 7526 if (!i || indexAfterSlash || i + 1 == num || num > i + 5) | 7526 if (!i || indexAfterSlash || i + 1 == num || num > i + 5) |
| 7527 return false; | 7527 return false; |
| 7528 | 7528 |
| 7529 indexAfterSlash = i + 1; | 7529 indexAfterSlash = i + 1; |
| 7530 completeBorderRadii(radii[0]); | 7530 completeBorderRadii(radii[0]); |
| 7531 continue; | 7531 continue; |
| 7532 } | 7532 } |
| 7533 | 7533 |
| 7534 if (i - indexAfterSlash >= 4) | 7534 if (i - indexAfterSlash >= 4) |
| 7535 return false; | 7535 return false; |
| 7536 | 7536 |
| 7537 if (!validUnit(value, FLength | FPercent | FNonNeg)) | 7537 if (!validUnit(value, FLength | FPercent | FNonNeg)) |
| 7538 return false; | 7538 return false; |
| 7539 | 7539 |
| 7540 RefPtr<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value); | 7540 RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = createPrimitiveNumericVal ue(value); |
| 7541 | 7541 |
| 7542 if (!indexAfterSlash) { | 7542 if (!indexAfterSlash) { |
| 7543 radii[0][i] = radius; | 7543 radii[0][i] = radius; |
| 7544 | 7544 |
| 7545 // Legacy syntax: -webkit-border-radius: l1 l2; is equivalent to bor der-radius: l1 / l2; | 7545 // Legacy syntax: -webkit-border-radius: l1 l2; is equivalent to bor der-radius: l1 / l2; |
| 7546 if (num == 2 && propId == CSSPropertyWebkitBorderRadius) { | 7546 if (num == 2 && propId == CSSPropertyWebkitBorderRadius) { |
| 7547 indexAfterSlash = 1; | 7547 indexAfterSlash = 1; |
| 7548 completeBorderRadii(radii[0]); | 7548 completeBorderRadii(radii[0]); |
| 7549 } | 7549 } |
| 7550 } else | 7550 } else |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7593 addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(narrow PrecisionToFloat(lvalue->fValue), narrowPrecisionToFloat(rvalue->fValue)), impor tant); | 7593 addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(narrow PrecisionToFloat(lvalue->fValue), narrowPrecisionToFloat(rvalue->fValue)), impor tant); |
| 7594 | 7594 |
| 7595 return true; | 7595 return true; |
| 7596 } | 7596 } |
| 7597 | 7597 |
| 7598 bool BisonCSSParser::parseCounter(CSSPropertyID propId, int defaultValue, bool i mportant) | 7598 bool BisonCSSParser::parseCounter(CSSPropertyID propId, int defaultValue, bool i mportant) |
| 7599 { | 7599 { |
| 7600 enum { ID, VAL } state = ID; | 7600 enum { ID, VAL } state = ID; |
| 7601 | 7601 |
| 7602 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; | 7602 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; |
| 7603 RefPtr<CSSPrimitiveValue> counterName; | 7603 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName; |
| 7604 | 7604 |
| 7605 while (true) { | 7605 while (true) { |
| 7606 CSSParserValue* val = m_valueList->current(); | 7606 CSSParserValue* val = m_valueList->current(); |
| 7607 switch (state) { | 7607 switch (state) { |
| 7608 case ID: | 7608 case ID: |
| 7609 if (val && val->unit == CSSPrimitiveValue::CSS_IDENT) { | 7609 if (val && val->unit == CSSPrimitiveValue::CSS_IDENT) { |
| 7610 counterName = createPrimitiveStringValue(val); | 7610 counterName = createPrimitiveStringValue(val); |
| 7611 state = VAL; | 7611 state = VAL; |
| 7612 m_valueList->next(); | 7612 m_valueList->next(); |
| 7613 continue; | 7613 continue; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 7631 | 7631 |
| 7632 if (list->length() > 0) { | 7632 if (list->length() > 0) { |
| 7633 addProperty(propId, list.release(), important); | 7633 addProperty(propId, list.release(), important); |
| 7634 return true; | 7634 return true; |
| 7635 } | 7635 } |
| 7636 | 7636 |
| 7637 return false; | 7637 return false; |
| 7638 } | 7638 } |
| 7639 | 7639 |
| 7640 // This should go away once we drop support for -webkit-gradient | 7640 // This should go away once we drop support for -webkit-gradient |
| 7641 static PassRefPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue * a, bool horizontal) | 7641 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CS SParserValue* a, bool horizontal) |
| 7642 { | 7642 { |
| 7643 RefPtr<CSSPrimitiveValue> result; | 7643 RefPtrWillBeRawPtr<CSSPrimitiveValue> result; |
| 7644 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { | 7644 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { |
| 7645 if ((equalIgnoringCase(a, "left") && horizontal) | 7645 if ((equalIgnoringCase(a, "left") && horizontal) |
| 7646 || (equalIgnoringCase(a, "top") && !horizontal)) | 7646 || (equalIgnoringCase(a, "top") && !horizontal)) |
| 7647 result = cssValuePool().createValue(0., CSSPrimitiveValue::CSS_PERCE NTAGE); | 7647 result = cssValuePool().createValue(0., CSSPrimitiveValue::CSS_PERCE NTAGE); |
| 7648 else if ((equalIgnoringCase(a, "right") && horizontal) | 7648 else if ((equalIgnoringCase(a, "right") && horizontal) |
| 7649 || (equalIgnoringCase(a, "bottom") && !horizontal)) | 7649 || (equalIgnoringCase(a, "bottom") && !horizontal)) |
| 7650 result = cssValuePool().createValue(100., CSSPrimitiveValue::CSS_PER CENTAGE); | 7650 result = cssValuePool().createValue(100., CSSPrimitiveValue::CSS_PER CENTAGE); |
| 7651 else if (equalIgnoringCase(a, "center")) | 7651 else if (equalIgnoringCase(a, "center")) |
| 7652 result = cssValuePool().createValue(50., CSSPrimitiveValue::CSS_PERC ENTAGE); | 7652 result = cssValuePool().createValue(50., CSSPrimitiveValue::CSS_PERC ENTAGE); |
| 7653 } else if (a->unit == CSSPrimitiveValue::CSS_NUMBER || a->unit == CSSPrimiti veValue::CSS_PERCENTAGE) | 7653 } 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... | |
| 7755 a = args->next(); | 7755 a = args->next(); |
| 7756 if (!isComma(a)) | 7756 if (!isComma(a)) |
| 7757 return false; | 7757 return false; |
| 7758 | 7758 |
| 7759 // Next comes the starting point for the gradient as an x y pair. There is no | 7759 // Next comes the starting point for the gradient as an x y pair. There is no |
| 7760 // comma between the x and the y values. | 7760 // comma between the x and the y values. |
| 7761 // First X. It can be left, right, number or percent. | 7761 // First X. It can be left, right, number or percent. |
| 7762 a = args->next(); | 7762 a = args->next(); |
| 7763 if (!a) | 7763 if (!a) |
| 7764 return false; | 7764 return false; |
| 7765 RefPtr<CSSPrimitiveValue> point = parseDeprecatedGradientPoint(a, true); | 7765 RefPtrWillBeRawPtr<CSSPrimitiveValue> point = parseDeprecatedGradientPoint(a , true); |
| 7766 if (!point) | 7766 if (!point) |
| 7767 return false; | 7767 return false; |
| 7768 result->setFirstX(point.release()); | 7768 result->setFirstX(point.release()); |
| 7769 | 7769 |
| 7770 // First Y. It can be top, bottom, number or percent. | 7770 // First Y. It can be top, bottom, number or percent. |
| 7771 a = args->next(); | 7771 a = args->next(); |
| 7772 if (!a) | 7772 if (!a) |
| 7773 return false; | 7773 return false; |
| 7774 point = parseDeprecatedGradientPoint(a, false); | 7774 point = parseDeprecatedGradientPoint(a, false); |
| 7775 if (!point) | 7775 if (!point) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7845 result->addStop(stop); | 7845 result->addStop(stop); |
| 7846 | 7846 |
| 7847 // Advance | 7847 // Advance |
| 7848 a = args->next(); | 7848 a = args->next(); |
| 7849 } | 7849 } |
| 7850 | 7850 |
| 7851 gradient = result.release(); | 7851 gradient = result.release(); |
| 7852 return true; | 7852 return true; |
| 7853 } | 7853 } |
| 7854 | 7854 |
| 7855 static PassRefPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserValue* a, boo l& isHorizontal) | 7855 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserV alue* a, bool& isHorizontal) |
| 7856 { | 7856 { |
| 7857 if (a->unit != CSSPrimitiveValue::CSS_IDENT) | 7857 if (a->unit != CSSPrimitiveValue::CSS_IDENT) |
| 7858 return 0; | 7858 return 0; |
| 7859 | 7859 |
| 7860 switch (a->id) { | 7860 switch (a->id) { |
| 7861 case CSSValueLeft: | 7861 case CSSValueLeft: |
| 7862 case CSSValueRight: | 7862 case CSSValueRight: |
| 7863 isHorizontal = true; | 7863 isHorizontal = true; |
| 7864 break; | 7864 break; |
| 7865 case CSSValueTop: | 7865 case CSSValueTop: |
| 7866 case CSSValueBottom: | 7866 case CSSValueBottom: |
| 7867 isHorizontal = false; | 7867 isHorizontal = false; |
| 7868 break; | 7868 break; |
| 7869 default: | 7869 default: |
| 7870 return 0; | 7870 return 0; |
| 7871 } | 7871 } |
| 7872 return cssValuePool().createIdentifierValue(a->id); | 7872 return cssValuePool().createIdentifierValue(a->id); |
| 7873 } | 7873 } |
| 7874 | 7874 |
| 7875 static PassRefPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(BisonCSSParser* p, CSSParserValue* value) | 7875 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(Bis onCSSParser* p, CSSParserValue* value) |
| 7876 { | 7876 { |
| 7877 CSSValueID id = value->id; | 7877 CSSValueID id = value->id; |
| 7878 if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowt ext) || id == CSSValueMenu || id == CSSValueCurrentcolor) | 7878 if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowt ext) || id == CSSValueMenu || id == CSSValueCurrentcolor) |
| 7879 return cssValuePool().createIdentifierValue(id); | 7879 return cssValuePool().createIdentifierValue(id); |
| 7880 | 7880 |
| 7881 return p->parseColor(value); | 7881 return p->parseColor(value); |
| 7882 } | 7882 } |
| 7883 | 7883 |
| 7884 bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList , RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating) | 7884 bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList , RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating) |
| 7885 { | 7885 { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 7896 | 7896 |
| 7897 bool expectComma = false; | 7897 bool expectComma = false; |
| 7898 // Look for angle. | 7898 // Look for angle. |
| 7899 if (validUnit(a, FAngle, HTMLStandardMode)) { | 7899 if (validUnit(a, FAngle, HTMLStandardMode)) { |
| 7900 result->setAngle(createPrimitiveNumericValue(a)); | 7900 result->setAngle(createPrimitiveNumericValue(a)); |
| 7901 | 7901 |
| 7902 args->next(); | 7902 args->next(); |
| 7903 expectComma = true; | 7903 expectComma = true; |
| 7904 } else { | 7904 } else { |
| 7905 // Look one or two optional keywords that indicate a side or corner. | 7905 // Look one or two optional keywords that indicate a side or corner. |
| 7906 RefPtr<CSSPrimitiveValue> startX, startY; | 7906 RefPtrWillBeRawPtr<CSSPrimitiveValue> startX, startY; |
| 7907 | 7907 |
| 7908 RefPtr<CSSPrimitiveValue> location; | 7908 RefPtrWillBeRawPtr<CSSPrimitiveValue> location; |
| 7909 bool isHorizontal = false; | 7909 bool isHorizontal = false; |
| 7910 if ((location = valueFromSideKeyword(a, isHorizontal))) { | 7910 if ((location = valueFromSideKeyword(a, isHorizontal))) { |
| 7911 if (isHorizontal) | 7911 if (isHorizontal) |
| 7912 startX = location; | 7912 startX = location; |
| 7913 else | 7913 else |
| 7914 startY = location; | 7914 startY = location; |
| 7915 | 7915 |
| 7916 if ((a = args->next())) { | 7916 if ((a = args->next())) { |
| 7917 if ((location = valueFromSideKeyword(a, isHorizontal))) { | 7917 if ((location = valueFromSideKeyword(a, isHorizontal))) { |
| 7918 if (isHorizontal) { | 7918 if (isHorizontal) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7982 if (!a) | 7982 if (!a) |
| 7983 return false; | 7983 return false; |
| 7984 } | 7984 } |
| 7985 | 7985 |
| 7986 result->setFirstX(toCSSPrimitiveValue(centerX.get())); | 7986 result->setFirstX(toCSSPrimitiveValue(centerX.get())); |
| 7987 result->setSecondX(toCSSPrimitiveValue(centerX.get())); | 7987 result->setSecondX(toCSSPrimitiveValue(centerX.get())); |
| 7988 // CSS3 radial gradients always share the same start and end point. | 7988 // CSS3 radial gradients always share the same start and end point. |
| 7989 result->setFirstY(toCSSPrimitiveValue(centerY.get())); | 7989 result->setFirstY(toCSSPrimitiveValue(centerY.get())); |
| 7990 result->setSecondY(toCSSPrimitiveValue(centerY.get())); | 7990 result->setSecondY(toCSSPrimitiveValue(centerY.get())); |
| 7991 | 7991 |
| 7992 RefPtr<CSSPrimitiveValue> shapeValue; | 7992 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; |
| 7993 RefPtr<CSSPrimitiveValue> sizeValue; | 7993 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue; |
| 7994 | 7994 |
| 7995 // Optional shape and/or size in any order. | 7995 // Optional shape and/or size in any order. |
| 7996 for (int i = 0; i < 2; ++i) { | 7996 for (int i = 0; i < 2; ++i) { |
| 7997 if (a->unit != CSSPrimitiveValue::CSS_IDENT) | 7997 if (a->unit != CSSPrimitiveValue::CSS_IDENT) |
| 7998 break; | 7998 break; |
| 7999 | 7999 |
| 8000 bool foundValue = false; | 8000 bool foundValue = false; |
| 8001 switch (a->id) { | 8001 switch (a->id) { |
| 8002 case CSSValueCircle: | 8002 case CSSValueCircle: |
| 8003 case CSSValueEllipse: | 8003 case CSSValueEllipse: |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 8023 return false; | 8023 return false; |
| 8024 | 8024 |
| 8025 expectComma = true; | 8025 expectComma = true; |
| 8026 } | 8026 } |
| 8027 } | 8027 } |
| 8028 | 8028 |
| 8029 result->setShape(shapeValue); | 8029 result->setShape(shapeValue); |
| 8030 result->setSizingBehavior(sizeValue); | 8030 result->setSizingBehavior(sizeValue); |
| 8031 | 8031 |
| 8032 // Or, two lengths or percentages | 8032 // Or, two lengths or percentages |
| 8033 RefPtr<CSSPrimitiveValue> horizontalSize; | 8033 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize; |
| 8034 RefPtr<CSSPrimitiveValue> verticalSize; | 8034 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize; |
| 8035 | 8035 |
| 8036 if (!shapeValue && !sizeValue) { | 8036 if (!shapeValue && !sizeValue) { |
| 8037 if (validUnit(a, FLength | FPercent)) { | 8037 if (validUnit(a, FLength | FPercent)) { |
| 8038 horizontalSize = createPrimitiveNumericValue(a); | 8038 horizontalSize = createPrimitiveNumericValue(a); |
| 8039 a = args->next(); | 8039 a = args->next(); |
| 8040 if (!a) | 8040 if (!a) |
| 8041 return false; | 8041 return false; |
| 8042 | 8042 |
| 8043 expectComma = true; | 8043 expectComma = true; |
| 8044 } | 8044 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8085 result->setAngle(createPrimitiveNumericValue(a)); | 8085 result->setAngle(createPrimitiveNumericValue(a)); |
| 8086 | 8086 |
| 8087 args->next(); | 8087 args->next(); |
| 8088 expectComma = true; | 8088 expectComma = true; |
| 8089 } else if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, " to")) { | 8089 } else if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, " to")) { |
| 8090 // to [ [left | right] || [top | bottom] ] | 8090 // to [ [left | right] || [top | bottom] ] |
| 8091 a = args->next(); | 8091 a = args->next(); |
| 8092 if (!a) | 8092 if (!a) |
| 8093 return false; | 8093 return false; |
| 8094 | 8094 |
| 8095 RefPtr<CSSPrimitiveValue> endX, endY; | 8095 RefPtrWillBeRawPtr<CSSPrimitiveValue> endX, endY; |
| 8096 RefPtr<CSSPrimitiveValue> location; | 8096 RefPtrWillBeRawPtr<CSSPrimitiveValue> location; |
| 8097 bool isHorizontal = false; | 8097 bool isHorizontal = false; |
| 8098 | 8098 |
| 8099 location = valueFromSideKeyword(a, isHorizontal); | 8099 location = valueFromSideKeyword(a, isHorizontal); |
| 8100 if (!location) | 8100 if (!location) |
| 8101 return false; | 8101 return false; |
| 8102 | 8102 |
| 8103 if (isHorizontal) | 8103 if (isHorizontal) |
| 8104 endX = location; | 8104 endX = location; |
| 8105 else | 8105 else |
| 8106 endY = location; | 8106 endY = location; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8146 CSSParserValueList* args = valueList->current()->function->args.get(); | 8146 CSSParserValueList* args = valueList->current()->function->args.get(); |
| 8147 if (!args || !args->size()) | 8147 if (!args || !args->size()) |
| 8148 return false; | 8148 return false; |
| 8149 | 8149 |
| 8150 CSSParserValue* a = args->current(); | 8150 CSSParserValue* a = args->current(); |
| 8151 if (!a) | 8151 if (!a) |
| 8152 return false; | 8152 return false; |
| 8153 | 8153 |
| 8154 bool expectComma = false; | 8154 bool expectComma = false; |
| 8155 | 8155 |
| 8156 RefPtr<CSSPrimitiveValue> shapeValue; | 8156 RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue; |
| 8157 RefPtr<CSSPrimitiveValue> sizeValue; | 8157 RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue; |
| 8158 RefPtr<CSSPrimitiveValue> horizontalSize; | 8158 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize; |
| 8159 RefPtr<CSSPrimitiveValue> verticalSize; | 8159 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize; |
| 8160 | 8160 |
| 8161 // First part of grammar, the size/shape clause: | 8161 // First part of grammar, the size/shape clause: |
| 8162 // [ circle || <length> ] | | 8162 // [ circle || <length> ] | |
| 8163 // [ ellipse || [ <length> | <percentage> ]{2} ] | | 8163 // [ ellipse || [ <length> | <percentage> ]{2} ] | |
| 8164 // [ [ circle | ellipse] || <size-keyword> ] | 8164 // [ [ circle | ellipse] || <size-keyword> ] |
| 8165 for (int i = 0; i < 3; ++i) { | 8165 for (int i = 0; i < 3; ++i) { |
| 8166 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { | 8166 if (a->unit == CSSPrimitiveValue::CSS_IDENT) { |
| 8167 bool badIdent = false; | 8167 bool badIdent = false; |
| 8168 switch (a->id) { | 8168 switch (a->id) { |
| 8169 case CSSValueCircle: | 8169 case CSSValueCircle: |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8386 if (!a || !parseFillImage(args, toImageValue)) | 8386 if (!a || !parseFillImage(args, toImageValue)) |
| 8387 return false; | 8387 return false; |
| 8388 a = args->next(); | 8388 a = args->next(); |
| 8389 | 8389 |
| 8390 // Skip a comma | 8390 // Skip a comma |
| 8391 if (!isComma(a)) | 8391 if (!isComma(a)) |
| 8392 return false; | 8392 return false; |
| 8393 a = args->next(); | 8393 a = args->next(); |
| 8394 | 8394 |
| 8395 // The third argument is the crossfade value. It is a percentage or a fracti onal number. | 8395 // The third argument is the crossfade value. It is a percentage or a fracti onal number. |
| 8396 RefPtr<CSSPrimitiveValue> percentage; | 8396 RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage; |
| 8397 if (!a) | 8397 if (!a) |
| 8398 return false; | 8398 return false; |
| 8399 | 8399 |
| 8400 if (a->unit == CSSPrimitiveValue::CSS_PERCENTAGE) | 8400 if (a->unit == CSSPrimitiveValue::CSS_PERCENTAGE) |
| 8401 percentage = cssValuePool().createValue(clampTo<double>(a->fValue / 100, 0, 1), CSSPrimitiveValue::CSS_NUMBER); | 8401 percentage = cssValuePool().createValue(clampTo<double>(a->fValue / 100, 0, 1), CSSPrimitiveValue::CSS_NUMBER); |
| 8402 else if (a->unit == CSSPrimitiveValue::CSS_NUMBER) | 8402 else if (a->unit == CSSPrimitiveValue::CSS_NUMBER) |
| 8403 percentage = cssValuePool().createValue(clampTo<double>(a->fValue, 0, 1) , CSSPrimitiveValue::CSS_NUMBER); | 8403 percentage = cssValuePool().createValue(clampTo<double>(a->fValue, 0, 1) , CSSPrimitiveValue::CSS_NUMBER); |
| 8404 else | 8404 else |
| 8405 return false; | 8405 return false; |
| 8406 | 8406 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9136 return true; | 9136 return true; |
| 9137 default: | 9137 default: |
| 9138 return false; | 9138 return false; |
| 9139 } | 9139 } |
| 9140 } | 9140 } |
| 9141 | 9141 |
| 9142 bool BisonCSSParser::parseTextEmphasisStyle(bool important) | 9142 bool BisonCSSParser::parseTextEmphasisStyle(bool important) |
| 9143 { | 9143 { |
| 9144 unsigned valueListSize = m_valueList->size(); | 9144 unsigned valueListSize = m_valueList->size(); |
| 9145 | 9145 |
| 9146 RefPtr<CSSPrimitiveValue> fill; | 9146 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill; |
| 9147 RefPtr<CSSPrimitiveValue> shape; | 9147 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape; |
| 9148 | 9148 |
| 9149 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { | 9149 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { |
| 9150 if (value->unit == CSSPrimitiveValue::CSS_STRING) { | 9150 if (value->unit == CSSPrimitiveValue::CSS_STRING) { |
| 9151 if (fill || shape || (valueListSize != 1 && !inShorthand())) | 9151 if (fill || shape || (valueListSize != 1 && !inShorthand())) |
| 9152 return false; | 9152 return false; |
| 9153 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin gValue(value), important); | 9153 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin gValue(value), important); |
| 9154 m_valueList->next(); | 9154 m_valueList->next(); |
| 9155 return true; | 9155 return true; |
| 9156 } | 9156 } |
| 9157 | 9157 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9314 m_valueList->next(); | 9314 m_valueList->next(); |
| 9315 } | 9315 } |
| 9316 } | 9316 } |
| 9317 settings->append(CSSFontFeatureValue::create(tag, tagValue)); | 9317 settings->append(CSSFontFeatureValue::create(tag, tagValue)); |
| 9318 return true; | 9318 return true; |
| 9319 } | 9319 } |
| 9320 | 9320 |
| 9321 bool BisonCSSParser::parseFontFeatureSettings(bool important) | 9321 bool BisonCSSParser::parseFontFeatureSettings(bool important) |
| 9322 { | 9322 { |
| 9323 if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal ) { | 9323 if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal ) { |
| 9324 RefPtr<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierV alue(CSSValueNormal); | 9324 RefPtrWillBeRawPtr<CSSPrimitiveValue> normalValue = cssValuePool().creat eIdentifierValue(CSSValueNormal); |
| 9325 m_valueList->next(); | 9325 m_valueList->next(); |
| 9326 addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(), important); | 9326 addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(), important); |
| 9327 return true; | 9327 return true; |
| 9328 } | 9328 } |
| 9329 | 9329 |
| 9330 RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparat ed(); | 9330 RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparat ed(); |
| 9331 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { | 9331 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { |
| 9332 if (!parseFontFeatureTag(settings.get())) | 9332 if (!parseFontFeatureTag(settings.get())) |
| 9333 return false; | 9333 return false; |
| 9334 | 9334 |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10314 { | 10314 { |
| 10315 // The tokenizer checks for the construct of an+b. | 10315 // The tokenizer checks for the construct of an+b. |
| 10316 // However, since the {ident} rule precedes the {nth} rule, some of those | 10316 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 10317 // tokens are identified as string literal. Furthermore we need to accept | 10317 // tokens are identified as string literal. Furthermore we need to accept |
| 10318 // "odd" and "even" which does not match to an+b. | 10318 // "odd" and "even" which does not match to an+b. |
| 10319 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10319 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 10320 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10320 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 10321 } | 10321 } |
| 10322 | 10322 |
| 10323 } | 10323 } |
| OLD | NEW |