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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return CSSPrimitiveValue::create(m_parsedCalculation.release()); | 252 return CSSPrimitiveValue::create(m_parsedCalculation.release()); |
253 } | 253 } |
254 | 254 |
255 ASSERT((value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit(
) <= CSSPrimitiveValue::UnitType::Kilohertz) | 255 ASSERT((value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit(
) <= CSSPrimitiveValue::UnitType::Kilohertz) |
256 || (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit()
<= CSSPrimitiveValue::UnitType::Chs) | 256 || (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit()
<= CSSPrimitiveValue::UnitType::Chs) |
257 || (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value
->unit() <= CSSPrimitiveValue::UnitType::ViewportMax) | 257 || (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value
->unit() <= CSSPrimitiveValue::UnitType::ViewportMax) |
258 || (value->unit() >= CSSPrimitiveValue::UnitType::DotsPerPixel && value-
>unit() <= CSSPrimitiveValue::UnitType::DotsPerCentimeter)); | 258 || (value->unit() >= CSSPrimitiveValue::UnitType::DotsPerPixel && value-
>unit() <= CSSPrimitiveValue::UnitType::DotsPerCentimeter)); |
259 return cssValuePool().createValue(value->fValue, value->unit()); | 259 return cssValuePool().createValue(value->fValue, value->unit()); |
260 } | 260 } |
261 | 261 |
262 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit
iveStringValue(CSSParserValue* value) | 262 inline PassRefPtrWillBeRawPtr<CSSStringValue> CSSPropertyParser::createPrimitive
StringValue(CSSParserValue* value) |
263 { | 263 { |
264 ASSERT(value->unit() == CSSPrimitiveValue::UnitType::String || value->m_unit
== CSSParserValue::Identifier); | 264 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser
Value::Identifier); |
265 return cssValuePool().createValue(value->string, CSSPrimitiveValue::UnitType
::String); | 265 return CSSStringValue::create(value->string); |
266 } | 266 } |
267 | 267 |
268 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit
iveCustomIdentValue(CSSParserValue* value) | 268 inline PassRefPtrWillBeRawPtr<CSSCustomIdentValue> CSSPropertyParser::createPrim
itiveCustomIdentValue(CSSParserValue* value) |
269 { | 269 { |
270 ASSERT(value->unit() == CSSPrimitiveValue::UnitType::String || value->m_unit
== CSSParserValue::Identifier); | 270 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser
Value::Identifier); |
271 return cssValuePool().createValue(value->string, CSSPrimitiveValue::UnitType
::CustomIdentifier); | 271 return CSSCustomIdentValue::create(value->string); |
272 } | 272 } |
273 | 273 |
274 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi
thReferrer(const String& rawValue, const KURL& url) | 274 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi
thReferrer(const String& rawValue, const KURL& url) |
275 { | 275 { |
276 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur
l); | 276 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur
l); |
277 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); | 277 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); |
278 return imageValue; | 278 return imageValue; |
279 } | 279 } |
280 | 280 |
281 static inline bool isComma(CSSParserValue* value) | 281 static inline bool isComma(CSSParserValue* value) |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // Grammar defined by CSS3 UI and modified by CSS4 images: | 525 // Grammar defined by CSS3 UI and modified by CSS4 images: |
526 // [ [<image> [<x> <y>]?,]* | 526 // [ [<image> [<x> <y>]?,]* |
527 // [ auto | crosshair | default | pointer | progress | move | e-resize |
ne-resize | | 527 // [ auto | crosshair | default | pointer | progress | move | e-resize |
ne-resize | |
528 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize |
ew-resize | | 528 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize |
ew-resize | |
529 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex
t | wait | help | | 529 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex
t | wait | help | |
530 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al
lowed | all-scroll | | 530 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al
lowed | all-scroll | |
531 // zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-i
n | -webkit-zoom-out ] ] | inherit | 531 // zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-i
n | -webkit-zoom-out ] ] | inherit |
532 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; | 532 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; |
533 while (value) { | 533 while (value) { |
534 RefPtrWillBeRawPtr<CSSValue> image = nullptr; | 534 RefPtrWillBeRawPtr<CSSValue> image = nullptr; |
535 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 535 if (value->m_unit == CSSParserValue::URI) { |
536 String uri = value->string; | 536 String uri = value->string; |
537 if (!uri.isNull()) | 537 if (!uri.isNull()) |
538 image = createCSSImageValueWithReferrer(uri, completeURL(uri
)); | 538 image = createCSSImageValueWithReferrer(uri, completeURL(uri
)); |
539 } else if (value->m_unit == CSSParserValue::Function && value->funct
ion->id == CSSValueWebkitImageSet) { | 539 } else if (value->m_unit == CSSParserValue::Function && value->funct
ion->id == CSSValueWebkitImageSet) { |
540 image = parseImageSet(m_valueList); | 540 image = parseImageSet(m_valueList); |
541 if (!image) | 541 if (!image) |
542 break; | 542 break; |
543 } else | 543 } else |
544 break; | 544 break; |
545 | 545 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 } | 654 } |
655 case CSSPropertyObjectPosition: | 655 case CSSPropertyObjectPosition: |
656 parsedValue = parsePosition(m_valueList); | 656 parsedValue = parsePosition(m_valueList); |
657 break; | 657 break; |
658 case CSSPropertyListStyleImage: // <uri> | none | inherit | 658 case CSSPropertyListStyleImage: // <uri> | none | inherit |
659 case CSSPropertyBorderImageSource: | 659 case CSSPropertyBorderImageSource: |
660 case CSSPropertyWebkitMaskBoxImageSource: | 660 case CSSPropertyWebkitMaskBoxImageSource: |
661 if (id == CSSValueNone) { | 661 if (id == CSSValueNone) { |
662 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); | 662 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); |
663 m_valueList->next(); | 663 m_valueList->next(); |
664 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 664 } else if (value->m_unit == CSSParserValue::URI) { |
665 parsedValue = createCSSImageValueWithReferrer(value->string, complet
eURL(value->string)); | 665 parsedValue = createCSSImageValueWithReferrer(value->string, complet
eURL(value->string)); |
666 m_valueList->next(); | 666 m_valueList->next(); |
667 } else if (isGeneratedImageValue(value)) { | 667 } else if (isGeneratedImageValue(value)) { |
668 if (parseGeneratedImage(m_valueList, parsedValue)) | 668 if (parseGeneratedImage(m_valueList, parsedValue)) |
669 m_valueList->next(); | 669 m_valueList->next(); |
670 else | 670 else |
671 return false; | 671 return false; |
672 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueWebkitImageSet) { | 672 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueWebkitImageSet) { |
673 parsedValue = parseImageSet(m_valueList); | 673 parsedValue = parseImageSet(m_valueList); |
674 if (!parsedValue) | 674 if (!parsedValue) |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 break; | 1250 break; |
1251 | 1251 |
1252 case CSSPropertyWebkitFontSizeDelta: // <length> | 1252 case CSSPropertyWebkitFontSizeDelta: // <length> |
1253 validPrimitive = validUnit(value, FLength | FUnitlessQuirk); | 1253 validPrimitive = validUnit(value, FLength | FUnitlessQuirk); |
1254 break; | 1254 break; |
1255 | 1255 |
1256 case CSSPropertyWebkitHyphenateCharacter: | 1256 case CSSPropertyWebkitHyphenateCharacter: |
1257 case CSSPropertyWebkitLocale: | 1257 case CSSPropertyWebkitLocale: |
1258 if (id == CSSValueAuto) { | 1258 if (id == CSSValueAuto) { |
1259 validPrimitive = true; | 1259 validPrimitive = true; |
1260 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { | 1260 } else if (value->m_unit == CSSParserValue::String) { |
1261 parsedValue = createPrimitiveStringValue(value); | 1261 parsedValue = createPrimitiveStringValue(value); |
1262 m_valueList->next(); | 1262 m_valueList->next(); |
1263 } | 1263 } |
1264 break; | 1264 break; |
1265 | 1265 |
1266 // End Apple-specific properties | 1266 // End Apple-specific properties |
1267 | 1267 |
1268 case CSSPropertyWebkitAppRegion: | 1268 case CSSPropertyWebkitAppRegion: |
1269 if (id >= CSSValueDrag && id <= CSSValueNoDrag) | 1269 if (id >= CSSValueDrag && id <= CSSValueNoDrag) |
1270 validPrimitive = true; | 1270 validPrimitive = true; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 if (id == CSSValueNormal) | 1386 if (id == CSSValueNormal) |
1387 validPrimitive = true; | 1387 validPrimitive = true; |
1388 else | 1388 else |
1389 return parseFontVariantLigatures(important); | 1389 return parseFontVariantLigatures(important); |
1390 break; | 1390 break; |
1391 case CSSPropertyWebkitClipPath: | 1391 case CSSPropertyWebkitClipPath: |
1392 if (id == CSSValueNone) { | 1392 if (id == CSSValueNone) { |
1393 validPrimitive = true; | 1393 validPrimitive = true; |
1394 } else if (value->m_unit == CSSParserValue::Function) { | 1394 } else if (value->m_unit == CSSParserValue::Function) { |
1395 parsedValue = parseBasicShape(); | 1395 parsedValue = parseBasicShape(); |
1396 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 1396 } else if (value->m_unit == CSSParserValue::URI) { |
1397 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::UnitType::URI); | 1397 parsedValue = CSSURIValue::create(value->string); |
1398 addProperty(propId, parsedValue.release(), important); | 1398 addProperty(propId, parsedValue.release(), important); |
1399 return true; | 1399 return true; |
1400 } | 1400 } |
1401 break; | 1401 break; |
1402 case CSSPropertyShapeOutside: | 1402 case CSSPropertyShapeOutside: |
1403 if (id == CSSValueNone) | 1403 if (id == CSSValueNone) |
1404 validPrimitive = true; | 1404 validPrimitive = true; |
1405 else | 1405 else |
1406 parsedValue = parseShapeProperty(propId); | 1406 parsedValue = parseShapeProperty(propId); |
1407 break; | 1407 break; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 } | 1660 } |
1661 | 1661 |
1662 static bool isValidTransitionPropertyList(CSSValueList* value) | 1662 static bool isValidTransitionPropertyList(CSSValueList* value) |
1663 { | 1663 { |
1664 if (value->length() < 2) | 1664 if (value->length() < 2) |
1665 return true; | 1665 return true; |
1666 for (auto& property : *value) { | 1666 for (auto& property : *value) { |
1667 // FIXME: Shorthand parsing shouldn't add initial to the list since it w
on't round-trip | 1667 // FIXME: Shorthand parsing shouldn't add initial to the list since it w
on't round-trip |
1668 if (property->isInitialValue()) | 1668 if (property->isInitialValue()) |
1669 continue; | 1669 continue; |
1670 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(property.get()); | 1670 if (property->isPrimitiveValue() && toCSSPrimitiveValue(*property).isVal
ueID() && toCSSPrimitiveValue(*property).getValueID() == CSSValueNone) |
1671 if (primitiveValue->isValueID() && primitiveValue->getValueID() == CSSVa
lueNone) | |
1672 return false; | 1671 return false; |
1673 } | 1672 } |
1674 return true; | 1673 return true; |
1675 } | 1674 } |
1676 | 1675 |
1677 bool CSSPropertyParser::parseAnimationShorthand(bool useLegacyparsing, bool impo
rtant) | 1676 bool CSSPropertyParser::parseAnimationShorthand(bool useLegacyparsing, bool impo
rtant) |
1678 { | 1677 { |
1679 const StylePropertyShorthand& animationProperties = animationShorthandForPar
sing(); | 1678 const StylePropertyShorthand& animationProperties = animationShorthandForPar
sing(); |
1680 const unsigned numProperties = 8; | 1679 const unsigned numProperties = 8; |
1681 | 1680 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 | 2056 |
2058 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open
-quote | no-close-quote ]+ | inherit | 2057 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open
-quote | no-close-quote ]+ | inherit |
2059 // in CSS 2.1 this got somewhat reduced: | 2058 // in CSS 2.1 this got somewhat reduced: |
2060 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu
ote ]+ | inherit | 2059 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu
ote ]+ | inherit |
2061 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent() | 2060 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent() |
2062 { | 2061 { |
2063 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); | 2062 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); |
2064 | 2063 |
2065 while (CSSParserValue* val = m_valueList->current()) { | 2064 while (CSSParserValue* val = m_valueList->current()) { |
2066 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; | 2065 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
2067 if (val->unit() == CSSPrimitiveValue::UnitType::URI) { | 2066 if (val->m_unit == CSSParserValue::URI) { |
2068 // url | 2067 // url |
2069 parsedValue = createCSSImageValueWithReferrer(val->string, completeU
RL(val->string)); | 2068 parsedValue = createCSSImageValueWithReferrer(val->string, completeU
RL(val->string)); |
2070 } else if (val->m_unit == CSSParserValue::Function) { | 2069 } else if (val->m_unit == CSSParserValue::Function) { |
2071 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie
nt(...) | 2070 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie
nt(...) |
2072 CSSParserValueList* args = val->function->args.get(); | 2071 CSSParserValueList* args = val->function->args.get(); |
2073 if (!args) | 2072 if (!args) |
2074 return nullptr; | 2073 return nullptr; |
2075 if (val->function->id == CSSValueAttr) { | 2074 if (val->function->id == CSSValueAttr) { |
2076 parsedValue = parseAttr(args); | 2075 parsedValue = parseAttr(args); |
2077 } else if (val->function->id == CSSValueCounter) { | 2076 } else if (val->function->id == CSSValueCounter) { |
(...skipping 11 matching lines...) Expand all Loading... |
2089 case CSSValueOpenQuote: | 2088 case CSSValueOpenQuote: |
2090 case CSSValueCloseQuote: | 2089 case CSSValueCloseQuote: |
2091 case CSSValueNoOpenQuote: | 2090 case CSSValueNoOpenQuote: |
2092 case CSSValueNoCloseQuote: | 2091 case CSSValueNoCloseQuote: |
2093 case CSSValueNone: | 2092 case CSSValueNone: |
2094 case CSSValueNormal: | 2093 case CSSValueNormal: |
2095 parsedValue = cssValuePool().createIdentifierValue(val->id); | 2094 parsedValue = cssValuePool().createIdentifierValue(val->id); |
2096 default: | 2095 default: |
2097 break; | 2096 break; |
2098 } | 2097 } |
2099 } else if (val->unit() == CSSPrimitiveValue::UnitType::String) { | 2098 } else if (val->m_unit == CSSParserValue::String) { |
2100 parsedValue = createPrimitiveStringValue(val); | 2099 parsedValue = createPrimitiveStringValue(val); |
2101 } | 2100 } |
2102 if (!parsedValue) | 2101 if (!parsedValue) |
2103 return nullptr; | 2102 return nullptr; |
2104 values->append(parsedValue.release()); | 2103 values->append(parsedValue.release()); |
2105 m_valueList->next(); | 2104 m_valueList->next(); |
2106 } | 2105 } |
2107 | 2106 |
2108 return values.release(); | 2107 return values.release(); |
2109 } | 2108 } |
(...skipping 12 matching lines...) Expand all Loading... |
2122 // CSS allows identifiers with "-" at the start, like "-webkit-mask-image". | 2121 // CSS allows identifiers with "-" at the start, like "-webkit-mask-image". |
2123 // But HTML attribute names can't have those characters, and we should not | 2122 // But HTML attribute names can't have those characters, and we should not |
2124 // even parse them inside attr(). | 2123 // even parse them inside attr(). |
2125 if (attrName[0] == '-') | 2124 if (attrName[0] == '-') |
2126 return nullptr; | 2125 return nullptr; |
2127 | 2126 |
2128 if (m_context.isHTMLDocument()) | 2127 if (m_context.isHTMLDocument()) |
2129 attrName = attrName.lower(); | 2128 attrName = attrName.lower(); |
2130 | 2129 |
2131 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS
SValueAttr); | 2130 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS
SValueAttr); |
2132 attrValue->append(CSSPrimitiveValue::create(attrName, CSSPrimitiveValue::Uni
tType::CustomIdentifier)); | 2131 attrValue->append(CSSCustomIdentValue::create(attrName)); |
2133 return attrValue.release(); | 2132 return attrValue.release(); |
2134 } | 2133 } |
2135 | 2134 |
2136 bool CSSPropertyParser::acceptQuirkyColors(CSSPropertyID propertyId) const | 2135 bool CSSPropertyParser::acceptQuirkyColors(CSSPropertyID propertyId) const |
2137 { | 2136 { |
2138 if (!inQuirksMode()) | 2137 if (!inQuirksMode()) |
2139 return false; | 2138 return false; |
2140 switch (propertyId) { | 2139 switch (propertyId) { |
2141 case CSSPropertyBackgroundColor: | 2140 case CSSPropertyBackgroundColor: |
2142 case CSSPropertyBorderBottomColor: | 2141 case CSSPropertyBorderBottomColor: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2196 return nullptr; | 2195 return nullptr; |
2197 return cssValuePool().createColorValue(c); | 2196 return cssValuePool().createColorValue(c); |
2198 } | 2197 } |
2199 | 2198 |
2200 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& value) | 2199 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& value) |
2201 { | 2200 { |
2202 if (valueList->current()->id == CSSValueNone) { | 2201 if (valueList->current()->id == CSSValueNone) { |
2203 value = cssValuePool().createIdentifierValue(CSSValueNone); | 2202 value = cssValuePool().createIdentifierValue(CSSValueNone); |
2204 return true; | 2203 return true; |
2205 } | 2204 } |
2206 if (valueList->current()->unit() == CSSPrimitiveValue::UnitType::URI) { | 2205 if (valueList->current()->m_unit == CSSParserValue::URI) { |
2207 value = createCSSImageValueWithReferrer(valueList->current()->string, co
mpleteURL(valueList->current()->string)); | 2206 value = createCSSImageValueWithReferrer(valueList->current()->string, co
mpleteURL(valueList->current()->string)); |
2208 return true; | 2207 return true; |
2209 } | 2208 } |
2210 | 2209 |
2211 if (isGeneratedImageValue(valueList->current())) | 2210 if (isGeneratedImageValue(valueList->current())) |
2212 return parseGeneratedImage(valueList, value); | 2211 return parseGeneratedImage(valueList, value); |
2213 | 2212 |
2214 if (valueList->current()->m_unit == CSSParserValue::Function && valueList->c
urrent()->function->id == CSSValueWebkitImageSet) { | 2213 if (valueList->current()->m_unit == CSSParserValue::Function && valueList->c
urrent()->function->id == CSSValueWebkitImageSet) { |
2215 value = parseImageSet(m_valueList); | 2214 value = parseImageSet(m_valueList); |
2216 if (value) | 2215 if (value) |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo
wQuotedName) | 2889 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo
wQuotedName) |
2891 { | 2890 { |
2892 CSSParserValue* value = m_valueList->current(); | 2891 CSSParserValue* value = m_valueList->current(); |
2893 | 2892 |
2894 if (value->id == CSSValueNone) | 2893 if (value->id == CSSValueNone) |
2895 return cssValuePool().createIdentifierValue(CSSValueNone); | 2894 return cssValuePool().createIdentifierValue(CSSValueNone); |
2896 | 2895 |
2897 if (value->m_unit == CSSParserValue::Identifier) | 2896 if (value->m_unit == CSSParserValue::Identifier) |
2898 return createPrimitiveCustomIdentValue(value); | 2897 return createPrimitiveCustomIdentValue(value); |
2899 | 2898 |
2900 if (allowQuotedName && value->unit() == CSSPrimitiveValue::UnitType::String)
{ | 2899 if (allowQuotedName && value->m_unit == CSSParserValue::String) { |
2901 // Legacy support for strings in prefixed animations | 2900 // Legacy support for strings in prefixed animations |
2902 if (m_context.useCounter()) | 2901 if (m_context.useCounter()) |
2903 m_context.useCounter()->count(UseCounter::QuotedAnimationName); | 2902 m_context.useCounter()->count(UseCounter::QuotedAnimationName); |
2904 if (equalIgnoringCase(value->string, "none")) | 2903 if (equalIgnoringCase(value->string, "none")) |
2905 return cssValuePool().createIdentifierValue(CSSValueNone); | 2904 return cssValuePool().createIdentifierValue(CSSValueNone); |
2906 return createPrimitiveCustomIdentValue(value); | 2905 return createPrimitiveCustomIdentValue(value); |
2907 } | 2906 } |
2908 | 2907 |
2909 return nullptr; | 2908 return nullptr; |
2910 } | 2909 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i
d == CSSValueUnset || value.id == CSSValueDefault; | 3095 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i
d == CSSValueUnset || value.id == CSSValueDefault; |
3097 } | 3096 } |
3098 | 3097 |
3099 static inline bool isValidCustomIdentForGridPositions(const CSSParserValue& valu
e) | 3098 static inline bool isValidCustomIdentForGridPositions(const CSSParserValue& valu
e) |
3100 { | 3099 { |
3101 // FIXME: we need a more general solution for <custom-ident> in all properti
es. | 3100 // FIXME: we need a more general solution for <custom-ident> in all properti
es. |
3102 return value.m_unit == CSSParserValue::Identifier && value.id != CSSValueSpa
n && value.id != CSSValueAuto && !isCSSWideKeyword(value); | 3101 return value.m_unit == CSSParserValue::Identifier && value.id != CSSValueSpa
n && value.id != CSSValueAuto && !isCSSWideKeyword(value); |
3103 } | 3102 } |
3104 | 3103 |
3105 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can
be stand alone or with 'span'). | 3104 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can
be stand alone or with 'span'). |
3106 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa
wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gr
idLineName) | 3105 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa
wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSCustomIdentValue>&
gridLineName) |
3107 { | 3106 { |
3108 CSSParserValue* value = m_valueList->current(); | 3107 CSSParserValue* value = m_valueList->current(); |
3109 if (validUnit(value, FInteger) && value->fValue) { | 3108 if (validUnit(value, FInteger) && value->fValue) { |
3110 numericValue = createPrimitiveNumericValue(value); | 3109 numericValue = createPrimitiveNumericValue(value); |
3111 value = m_valueList->next(); | 3110 value = m_valueList->next(); |
3112 if (value && isValidCustomIdentForGridPositions(*value)) { | 3111 if (value && isValidCustomIdentForGridPositions(*value)) { |
3113 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current(
)); | 3112 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current(
)); |
3114 m_valueList->next(); | 3113 m_valueList->next(); |
3115 } | 3114 } |
3116 return true; | 3115 return true; |
(...skipping 16 matching lines...) Expand all Loading... |
3133 { | 3132 { |
3134 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3133 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3135 | 3134 |
3136 CSSParserValue* value = m_valueList->current(); | 3135 CSSParserValue* value = m_valueList->current(); |
3137 if (value->id == CSSValueAuto) { | 3136 if (value->id == CSSValueAuto) { |
3138 m_valueList->next(); | 3137 m_valueList->next(); |
3139 return cssValuePool().createIdentifierValue(CSSValueAuto); | 3138 return cssValuePool().createIdentifierValue(CSSValueAuto); |
3140 } | 3139 } |
3141 | 3140 |
3142 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr; | 3141 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr; |
3143 RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName = nullptr; | 3142 RefPtrWillBeRawPtr<CSSCustomIdentValue> gridLineName = nullptr; |
3144 bool hasSeenSpanKeyword = false; | 3143 bool hasSeenSpanKeyword = false; |
3145 | 3144 |
3146 if (parseIntegerOrCustomIdentFromGridPosition(numericValue, gridLineName)) { | 3145 if (parseIntegerOrCustomIdentFromGridPosition(numericValue, gridLineName)) { |
3147 value = m_valueList->current(); | 3146 value = m_valueList->current(); |
3148 if (value && value->id == CSSValueSpan) { | 3147 if (value && value->id == CSSValueSpan) { |
3149 hasSeenSpanKeyword = true; | 3148 hasSeenSpanKeyword = true; |
3150 m_valueList->next(); | 3149 m_valueList->next(); |
3151 } | 3150 } |
3152 } else if (value->id == CSSValueSpan) { | 3151 } else if (value->id == CSSValueSpan) { |
3153 hasSeenSpanKeyword = true; | 3152 hasSeenSpanKeyword = true; |
(...skipping 11 matching lines...) Expand all Loading... |
3165 // If we didn't parse anything, this is not a valid grid position. | 3164 // If we didn't parse anything, this is not a valid grid position. |
3166 if (!hasSeenSpanKeyword && !gridLineName && !numericValue) | 3165 if (!hasSeenSpanKeyword && !gridLineName && !numericValue) |
3167 return nullptr; | 3166 return nullptr; |
3168 | 3167 |
3169 // Negative numbers are not allowed for span (but are for <integer>). | 3168 // Negative numbers are not allowed for span (but are for <integer>). |
3170 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0) | 3169 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0) |
3171 return nullptr; | 3170 return nullptr; |
3172 | 3171 |
3173 // For the <custom-ident> case. | 3172 // For the <custom-ident> case. |
3174 if (gridLineName && !numericValue && !hasSeenSpanKeyword) | 3173 if (gridLineName && !numericValue && !hasSeenSpanKeyword) |
3175 return cssValuePool().createValue(gridLineName->getStringValue(), CSSPri
mitiveValue::UnitType::CustomIdentifier); | 3174 return CSSCustomIdentValue::create(gridLineName->value()); |
3176 | 3175 |
3177 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); | 3176 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); |
3178 if (hasSeenSpanKeyword) | 3177 if (hasSeenSpanKeyword) |
3179 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); | 3178 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); |
3180 if (numericValue) | 3179 if (numericValue) |
3181 values->append(numericValue.release()); | 3180 values->append(numericValue.release()); |
3182 if (gridLineName) | 3181 if (gridLineName) |
3183 values->append(gridLineName.release()); | 3182 values->append(gridLineName.release()); |
3184 ASSERT(values->length()); | 3183 ASSERT(values->length()); |
3185 return values.release(); | 3184 return values.release(); |
3186 } | 3185 } |
3187 | 3186 |
3188 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v
alue) | 3187 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v
alue) |
3189 { | 3188 { |
3190 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isCustomIdent()
) | 3189 if (value->isCustomIdentValue()) |
3191 return value; | 3190 return value; |
3192 | 3191 |
3193 return cssValuePool().createIdentifierValue(CSSValueAuto); | 3192 return cssValuePool().createIdentifierValue(CSSValueAuto); |
3194 } | 3193 } |
3195 | 3194 |
3196 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
, bool important) | 3195 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
, bool important) |
3197 { | 3196 { |
3198 ShorthandScope scope(this, shorthandId); | 3197 ShorthandScope scope(this, shorthandId); |
3199 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); | 3198 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); |
3200 ASSERT(shorthand.length() == 2); | 3199 ASSERT(shorthand.length() == 2); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3239 // Handle leading <custom-ident>*. | 3238 // Handle leading <custom-ident>*. |
3240 if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdd
ed ? toCSSGridLineNamesValue(templateRows->item(templateRows->length() - 1)) : n
ullptr)) | 3239 if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdd
ed ? toCSSGridLineNamesValue(templateRows->item(templateRows->length() - 1)) : n
ullptr)) |
3241 return false; | 3240 return false; |
3242 | 3241 |
3243 // Handle a template-area's row. | 3242 // Handle a template-area's row. |
3244 if (!parseGridTemplateAreasRow(gridAreaMap, rowCount, columnCount)) | 3243 if (!parseGridTemplateAreasRow(gridAreaMap, rowCount, columnCount)) |
3245 return false; | 3244 return false; |
3246 ++rowCount; | 3245 ++rowCount; |
3247 | 3246 |
3248 // Handle template-rows's track-size. | 3247 // Handle template-rows's track-size. |
3249 if (m_valueList->current() && m_valueList->current()->unit() != CSSPrimi
tiveValue::UnitType::String) { | 3248 if (m_valueList->current() && m_valueList->current()->m_unit != CSSParse
rValue::String) { |
3250 RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList
); | 3249 RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList
); |
3251 if (!value) | 3250 if (!value) |
3252 return false; | 3251 return false; |
3253 templateRows->append(value); | 3252 templateRows->append(value); |
3254 } else { | 3253 } else { |
3255 templateRows->append(cssValuePool().createIdentifierValue(CSSValueAu
to)); | 3254 templateRows->append(cssValuePool().createIdentifierValue(CSSValueAu
to)); |
3256 } | 3255 } |
3257 | 3256 |
3258 // This will handle the trailing/leading <custom-ident>* in the grammar. | 3257 // This will handle the trailing/leading <custom-ident>* in the grammar. |
3259 if (!parseGridLineNames(*m_valueList, *templateRows)) | 3258 if (!parseGridLineNames(*m_valueList, *templateRows)) |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3462 if (!lineNames) | 3461 if (!lineNames) |
3463 lineNames = CSSGridLineNamesValue::create(); | 3462 lineNames = CSSGridLineNamesValue::create(); |
3464 | 3463 |
3465 while (CSSParserValue* identValue = inputList.current()) { | 3464 while (CSSParserValue* identValue = inputList.current()) { |
3466 if (isClosingBracket(*identValue)) | 3465 if (isClosingBracket(*identValue)) |
3467 break; | 3466 break; |
3468 | 3467 |
3469 if (!isValidCustomIdentForGridPositions(*identValue)) | 3468 if (!isValidCustomIdentForGridPositions(*identValue)) |
3470 return false; | 3469 return false; |
3471 | 3470 |
3472 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveCustomId
entValue(identValue); | 3471 RefPtrWillBeRawPtr<CSSCustomIdentValue> lineName = createPrimitiveCustom
IdentValue(identValue); |
3473 lineNames->append(lineName.release()); | 3472 lineNames->append(lineName.release()); |
3474 inputList.next(); | 3473 inputList.next(); |
3475 } | 3474 } |
3476 | 3475 |
3477 if (!inputList.current() || !isClosingBracket(*inputList.current())) | 3476 if (!inputList.current() || !isClosingBracket(*inputList.current())) |
3478 return false; | 3477 return false; |
3479 | 3478 |
3480 if (!previousNamedAreaTrailingLineNames) | 3479 if (!previousNamedAreaTrailingLineNames) |
3481 valueList.append(lineNames.release()); | 3480 valueList.append(lineNames.release()); |
3482 | 3481 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3666 | 3665 |
3667 if (!areaName.isEmpty()) | 3666 if (!areaName.isEmpty()) |
3668 columnNames.append(areaName.toString()); | 3667 columnNames.append(areaName.toString()); |
3669 | 3668 |
3670 return columnNames; | 3669 return columnNames; |
3671 } | 3670 } |
3672 | 3671 |
3673 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap,
const size_t rowCount, size_t& columnCount) | 3672 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap,
const size_t rowCount, size_t& columnCount) |
3674 { | 3673 { |
3675 CSSParserValue* currentValue = m_valueList->current(); | 3674 CSSParserValue* currentValue = m_valueList->current(); |
3676 if (!currentValue || currentValue->unit() != CSSPrimitiveValue::UnitType::St
ring) | 3675 if (!currentValue || currentValue->m_unit != CSSParserValue::String) |
3677 return false; | 3676 return false; |
3678 | 3677 |
3679 String gridRowNames = currentValue->string; | 3678 String gridRowNames = currentValue->string; |
3680 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) | 3679 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) |
3681 return false; | 3680 return false; |
3682 | 3681 |
3683 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames)
; | 3682 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames)
; |
3684 if (!columnCount) { | 3683 if (!columnCount) { |
3685 columnCount = columnNames.size(); | 3684 columnCount = columnNames.size(); |
3686 ASSERT(columnCount); | 3685 ASSERT(columnCount); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3798 { | 3797 { |
3799 unsigned numArgs = args->size(); | 3798 unsigned numArgs = args->size(); |
3800 if (counters && numArgs != 3 && numArgs != 5) | 3799 if (counters && numArgs != 3 && numArgs != 5) |
3801 return nullptr; | 3800 return nullptr; |
3802 if (!counters && numArgs != 1 && numArgs != 3) | 3801 if (!counters && numArgs != 1 && numArgs != 3) |
3803 return nullptr; | 3802 return nullptr; |
3804 | 3803 |
3805 CSSParserValue* i = args->current(); | 3804 CSSParserValue* i = args->current(); |
3806 if (i->m_unit != CSSParserValue::Identifier) | 3805 if (i->m_unit != CSSParserValue::Identifier) |
3807 return nullptr; | 3806 return nullptr; |
3808 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveCustomIden
tValue(i); | 3807 RefPtrWillBeRawPtr<CSSCustomIdentValue> identifier = createPrimitiveCustomId
entValue(i); |
3809 | 3808 |
3810 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = nullptr; | 3809 RefPtrWillBeRawPtr<CSSCustomIdentValue> separator = nullptr; |
3811 if (!counters) | 3810 if (!counters) |
3812 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::Unit
Type::CustomIdentifier); | 3811 separator = CSSCustomIdentValue::create(String()); |
3813 else { | 3812 else { |
3814 args->next(); | 3813 args->next(); |
3815 if (!consumeComma(args)) | 3814 if (!consumeComma(args)) |
3816 return nullptr; | 3815 return nullptr; |
3817 | 3816 |
3818 i = args->current(); | 3817 i = args->current(); |
3819 if (i->unit() != CSSPrimitiveValue::UnitType::String) | 3818 if (i->m_unit != CSSParserValue::String) |
3820 return nullptr; | 3819 return nullptr; |
3821 | 3820 |
3822 separator = createPrimitiveCustomIdentValue(i); | 3821 separator = createPrimitiveCustomIdentValue(i); |
3823 } | 3822 } |
3824 | 3823 |
3825 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr; | 3824 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr; |
3826 i = args->next(); | 3825 i = args->next(); |
3827 if (!i) // Make the list style default decimal | 3826 if (!i) // Make the list style default decimal |
3828 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); | 3827 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); |
3829 else { | 3828 else { |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4565 CSSParserValue* value = m_valueList->current(); | 4564 CSSParserValue* value = m_valueList->current(); |
4566 | 4565 |
4567 FontFamilyValueBuilder familyBuilder(list.get()); | 4566 FontFamilyValueBuilder familyBuilder(list.get()); |
4568 bool inFamily = false; | 4567 bool inFamily = false; |
4569 | 4568 |
4570 while (value) { | 4569 while (value) { |
4571 CSSParserValue* nextValue = m_valueList->next(); | 4570 CSSParserValue* nextValue = m_valueList->next(); |
4572 bool nextValBreaksFont = !nextValue || isComma(nextValue); | 4571 bool nextValBreaksFont = !nextValue || isComma(nextValue); |
4573 bool nextValIsFontName = nextValue && | 4572 bool nextValIsFontName = nextValue && |
4574 ((nextValue->id >= CSSValueSerif && nextValue->id <= CSSValueWebkitB
ody) || | 4573 ((nextValue->id >= CSSValueSerif && nextValue->id <= CSSValueWebkitB
ody) || |
4575 (nextValue->unit() == CSSPrimitiveValue::UnitType::String || nextVal
ue->m_unit == CSSParserValue::Identifier)); | 4574 (nextValue->m_unit == CSSParserValue::String || nextValue->m_unit ==
CSSParserValue::Identifier)); |
4576 | 4575 |
4577 if (isCSSWideKeyword(*value) && !inFamily) { | 4576 if (isCSSWideKeyword(*value) && !inFamily) { |
4578 if (nextValBreaksFont) | 4577 if (nextValBreaksFont) |
4579 return nullptr; | 4578 return nullptr; |
4580 else if (nextValIsFontName) | 4579 else if (nextValIsFontName) |
4581 value = nextValue; | 4580 value = nextValue; |
4582 continue; | 4581 continue; |
4583 } | 4582 } |
4584 | 4583 |
4585 if (value->id >= CSSValueSerif && value->id <= CSSValueWebkitBody) { | 4584 if (value->id >= CSSValueSerif && value->id <= CSSValueWebkitBody) { |
4586 if (inFamily) | 4585 if (inFamily) |
4587 familyBuilder.add(value->string); | 4586 familyBuilder.add(value->string); |
4588 else if (nextValBreaksFont || !nextValIsFontName) | 4587 else if (nextValBreaksFont || !nextValIsFontName) |
4589 list->append(cssValuePool().createIdentifierValue(value->id)); | 4588 list->append(cssValuePool().createIdentifierValue(value->id)); |
4590 else { | 4589 else { |
4591 familyBuilder.commit(); | 4590 familyBuilder.commit(); |
4592 familyBuilder.add(value->string); | 4591 familyBuilder.add(value->string); |
4593 inFamily = true; | 4592 inFamily = true; |
4594 } | 4593 } |
4595 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { | 4594 } else if (value->m_unit == CSSParserValue::String) { |
4596 // Strings never share in a family name. | 4595 // Strings never share in a family name. |
4597 inFamily = false; | 4596 inFamily = false; |
4598 familyBuilder.commit(); | 4597 familyBuilder.commit(); |
4599 list->append(cssValuePool().createFontFamilyValue(value->string)); | 4598 list->append(cssValuePool().createFontFamilyValue(value->string)); |
4600 } else if (value->m_unit == CSSParserValue::Identifier) { | 4599 } else if (value->m_unit == CSSParserValue::Identifier) { |
4601 if (inFamily) | 4600 if (inFamily) |
4602 familyBuilder.add(value->string); | 4601 familyBuilder.add(value->string); |
4603 else if (nextValBreaksFont || !nextValIsFontName) | 4602 else if (nextValBreaksFont || !nextValIsFontName) |
4604 list->append(cssValuePool().createFontFamilyValue(value->string)
); | 4603 list->append(cssValuePool().createFontFamilyValue(value->string)
); |
4605 else { | 4604 else { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4741 | 4740 |
4742 CSSParserValue* value = m_valueList->next(); | 4741 CSSParserValue* value = m_valueList->next(); |
4743 if (!value || value->m_unit != CSSParserValue::Function || value->function->
id != CSSValueFormat) { | 4742 if (!value || value->m_unit != CSSParserValue::Function || value->function->
id != CSSValueFormat) { |
4744 valueList->append(uriValue.release()); | 4743 valueList->append(uriValue.release()); |
4745 return true; | 4744 return true; |
4746 } | 4745 } |
4747 | 4746 |
4748 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20111004/ says that format
() contains a comma-separated list of strings, | 4747 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20111004/ says that format
() contains a comma-separated list of strings, |
4749 // but CSSFontFaceSrcValue stores only one format. Allowing one format for n
ow. | 4748 // but CSSFontFaceSrcValue stores only one format. Allowing one format for n
ow. |
4750 CSSParserValueList* args = value->function->args.get(); | 4749 CSSParserValueList* args = value->function->args.get(); |
4751 if (!args || args->size() != 1 || (args->current()->unit() != CSSPrimitiveVa
lue::UnitType::String && args->current()->m_unit != CSSParserValue::Identifier)) | 4750 if (!args || args->size() != 1 || (args->current()->m_unit != CSSParserValue
::String && args->current()->m_unit != CSSParserValue::Identifier)) |
4752 return false; | 4751 return false; |
4753 uriValue->setFormat(args->current()->string); | 4752 uriValue->setFormat(args->current()->string); |
4754 valueList->append(uriValue.release()); | 4753 valueList->append(uriValue.release()); |
4755 m_valueList->next(); | 4754 m_valueList->next(); |
4756 return true; | 4755 return true; |
4757 } | 4756 } |
4758 | 4757 |
4759 bool CSSPropertyParser::parseFontFaceSrcLocal(CSSValueList* valueList) | 4758 bool CSSPropertyParser::parseFontFaceSrcLocal(CSSValueList* valueList) |
4760 { | 4759 { |
4761 CSSParserValueList* args = m_valueList->current()->function->args.get(); | 4760 CSSParserValueList* args = m_valueList->current()->function->args.get(); |
4762 if (!args || !args->size()) | 4761 if (!args || !args->size()) |
4763 return false; | 4762 return false; |
4764 m_valueList->next(); | 4763 m_valueList->next(); |
4765 | 4764 |
4766 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy = m_contex
t.shouldCheckContentSecurityPolicy(); | 4765 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy = m_contex
t.shouldCheckContentSecurityPolicy(); |
4767 if (args->size() == 1 && args->current()->unit() == CSSPrimitiveValue::UnitT
ype::String) { | 4766 if (args->size() == 1 && args->current()->m_unit == CSSParserValue::String)
{ |
4768 valueList->append(CSSFontFaceSrcValue::createLocal(args->current()->stri
ng, shouldCheckContentSecurityPolicy)); | 4767 valueList->append(CSSFontFaceSrcValue::createLocal(args->current()->stri
ng, shouldCheckContentSecurityPolicy)); |
4769 } else if (args->current()->m_unit == CSSParserValue::Identifier) { | 4768 } else if (args->current()->m_unit == CSSParserValue::Identifier) { |
4770 StringBuilder builder; | 4769 StringBuilder builder; |
4771 for (CSSParserValue* localValue = args->current(); localValue; localValu
e = args->next()) { | 4770 for (CSSParserValue* localValue = args->current(); localValue; localValu
e = args->next()) { |
4772 if (localValue->m_unit != CSSParserValue::Identifier) | 4771 if (localValue->m_unit != CSSParserValue::Identifier) |
4773 return false; | 4772 return false; |
4774 if (!builder.isEmpty()) | 4773 if (!builder.isEmpty()) |
4775 builder.append(' '); | 4774 builder.append(' '); |
4776 builder.append(localValue->string); | 4775 builder.append(localValue->string); |
4777 } | 4776 } |
4778 valueList->append(CSSFontFaceSrcValue::createLocal(builder.toString(), s
houldCheckContentSecurityPolicy)); | 4777 valueList->append(CSSFontFaceSrcValue::createLocal(builder.toString(), s
houldCheckContentSecurityPolicy)); |
4779 } else | 4778 } else |
4780 return false; | 4779 return false; |
4781 | 4780 |
4782 return true; | 4781 return true; |
4783 } | 4782 } |
4784 | 4783 |
4785 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFontFaceSrc() | 4784 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFontFaceSrc() |
4786 { | 4785 { |
4787 RefPtrWillBeRawPtr<CSSValueList> values(CSSValueList::createCommaSeparated()
); | 4786 RefPtrWillBeRawPtr<CSSValueList> values(CSSValueList::createCommaSeparated()
); |
4788 | 4787 |
4789 while (true) { | 4788 while (true) { |
4790 CSSParserValue* value = m_valueList->current(); | 4789 CSSParserValue* value = m_valueList->current(); |
4791 if (!value) | 4790 if (!value) |
4792 return nullptr; | 4791 return nullptr; |
4793 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 4792 if (value->m_unit == CSSParserValue::URI) { |
4794 if (!parseFontFaceSrcURI(values.get())) | 4793 if (!parseFontFaceSrcURI(values.get())) |
4795 return nullptr; | 4794 return nullptr; |
4796 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueLocal) { | 4795 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueLocal) { |
4797 if (!parseFontFaceSrcLocal(values.get())) | 4796 if (!parseFontFaceSrcLocal(values.get())) |
4798 return nullptr; | 4797 return nullptr; |
4799 } else { | 4798 } else { |
4800 return nullptr; | 4799 return nullptr; |
4801 } | 4800 } |
4802 | 4801 |
4803 if (!m_valueList->current()) | 4802 if (!m_valueList->current()) |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5339 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) | 5338 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) |
5340 { | 5339 { |
5341 CSSPropertyParser::ShorthandScope scope(this, propId); | 5340 CSSPropertyParser::ShorthandScope scope(this, propId); |
5342 while (CSSParserValue* val = m_valueList->current()) { | 5341 while (CSSParserValue* val = m_valueList->current()) { |
5343 context.setCanAdvance(false); | 5342 context.setCanAdvance(false); |
5344 | 5343 |
5345 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo
rwardSlashOperator(val)) | 5344 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo
rwardSlashOperator(val)) |
5346 context.commitForwardSlashOperator(); | 5345 context.commitForwardSlashOperator(); |
5347 | 5346 |
5348 if (!context.canAdvance() && context.allowImage()) { | 5347 if (!context.canAdvance() && context.allowImage()) { |
5349 if (val->unit() == CSSPrimitiveValue::UnitType::URI) { | 5348 if (val->m_unit == CSSParserValue::URI) { |
5350 context.commitImage(createCSSImageValueWithReferrer(val->string,
m_context.completeURL(val->string))); | 5349 context.commitImage(createCSSImageValueWithReferrer(val->string,
m_context.completeURL(val->string))); |
5351 } else if (isGeneratedImageValue(val)) { | 5350 } else if (isGeneratedImageValue(val)) { |
5352 RefPtrWillBeRawPtr<CSSValue> value = nullptr; | 5351 RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
5353 if (parseGeneratedImage(m_valueList, value)) | 5352 if (parseGeneratedImage(m_valueList, value)) |
5354 context.commitImage(value.release()); | 5353 context.commitImage(value.release()); |
5355 else | 5354 else |
5356 return false; | 5355 return false; |
5357 } else if (val->m_unit == CSSParserValue::Function && val->function-
>id == CSSValueWebkitImageSet) { | 5356 } else if (val->m_unit == CSSParserValue::Function && val->function-
>id == CSSValueWebkitImageSet) { |
5358 RefPtrWillBeRawPtr<CSSValue> value = parseImageSet(m_valueList); | 5357 RefPtrWillBeRawPtr<CSSValue> value = parseImageSet(m_valueList); |
5359 if (value) | 5358 if (value) |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5740 } | 5739 } |
5741 | 5740 |
5742 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu
e) | 5741 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu
e) |
5743 { | 5742 { |
5744 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 5743 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
5745 | 5744 |
5746 while (m_valueList->current()) { | 5745 while (m_valueList->current()) { |
5747 CSSParserValue* val = m_valueList->current(); | 5746 CSSParserValue* val = m_valueList->current(); |
5748 if (val->m_unit != CSSParserValue::Identifier) | 5747 if (val->m_unit != CSSParserValue::Identifier) |
5749 return nullptr; | 5748 return nullptr; |
5750 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = createPrimitiveCusto
mIdentValue(val); | 5749 RefPtrWillBeRawPtr<CSSCustomIdentValue> counterName = createPrimitiveCus
tomIdentValue(val); |
5751 m_valueList->next(); | 5750 m_valueList->next(); |
5752 | 5751 |
5753 val = m_valueList->current(); | 5752 val = m_valueList->current(); |
5754 int i = defaultValue; | 5753 int i = defaultValue; |
5755 if (val && validUnit(val, FInteger)) { | 5754 if (val && validUnit(val, FInteger)) { |
5756 i = clampTo<int>(val->fValue); | 5755 i = clampTo<int>(val->fValue); |
5757 m_valueList->next(); | 5756 m_valueList->next(); |
5758 } | 5757 } |
5759 | 5758 |
5760 list->append(CSSValuePair::create(counterName.release(), | 5759 list->append(CSSValuePair::create(counterName.release(), |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6570 return nullptr; | 6569 return nullptr; |
6571 | 6570 |
6572 CSSParserValueList* functionArgs = valueList->current()->function->args.get(
); | 6571 CSSParserValueList* functionArgs = valueList->current()->function->args.get(
); |
6573 if (!functionArgs || !functionArgs->size() || !functionArgs->current()) | 6572 if (!functionArgs || !functionArgs->size() || !functionArgs->current()) |
6574 return nullptr; | 6573 return nullptr; |
6575 | 6574 |
6576 RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create(); | 6575 RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create(); |
6577 | 6576 |
6578 while (functionArgs->current()) { | 6577 while (functionArgs->current()) { |
6579 CSSParserValue* arg = functionArgs->current(); | 6578 CSSParserValue* arg = functionArgs->current(); |
6580 if (arg->unit() != CSSPrimitiveValue::UnitType::URI) | 6579 if (arg->m_unit != CSSParserValue::URI) |
6581 return nullptr; | 6580 return nullptr; |
6582 | 6581 |
6583 RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg
->string, completeURL(arg->string)); | 6582 RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg
->string, completeURL(arg->string)); |
6584 imageSet->append(image); | 6583 imageSet->append(image); |
6585 | 6584 |
6586 arg = functionArgs->next(); | 6585 arg = functionArgs->next(); |
6587 if (!arg) | 6586 if (!arg) |
6588 return nullptr; | 6587 return nullptr; |
6589 | 6588 |
6590 if (arg->m_unit != CSSParserValue::DimensionList) | 6589 if (arg->m_unit != CSSParserValue::DimensionList) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6695 } | 6694 } |
6696 | 6695 |
6697 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter() | 6696 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter() |
6698 { | 6697 { |
6699 if (!m_valueList) | 6698 if (!m_valueList) |
6700 return nullptr; | 6699 return nullptr; |
6701 | 6700 |
6702 // The filter is a list of functional primitives that specify individual ope
rations. | 6701 // The filter is a list of functional primitives that specify individual ope
rations. |
6703 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 6702 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
6704 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 6703 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
6705 if (value->unit() != CSSPrimitiveValue::UnitType::URI && (value->m_unit
!= CSSParserValue::Function || !value->function)) | 6704 if (value->m_unit != CSSParserValue::URI && (value->m_unit != CSSParserV
alue::Function || !value->function)) |
6706 return nullptr; | 6705 return nullptr; |
6707 | 6706 |
6708 // See if the specified primitive is one we understand. | 6707 // See if the specified primitive is one we understand. |
6709 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 6708 if (value->m_unit == CSSParserValue::URI) { |
6710 RefPtrWillBeRawPtr<CSSFunctionValue> referenceFilterValue = CSSFunct
ionValue::create(CSSValueUrl); | 6709 RefPtrWillBeRawPtr<CSSFunctionValue> referenceFilterValue = CSSFunct
ionValue::create(CSSValueUrl); |
6711 referenceFilterValue->append(CSSSVGDocumentValue::create(value->stri
ng)); | 6710 referenceFilterValue->append(CSSSVGDocumentValue::create(value->stri
ng)); |
6712 list->append(referenceFilterValue.release()); | 6711 list->append(referenceFilterValue.release()); |
6713 } else { | 6712 } else { |
6714 CSSValueID filterType = value->function->id; | 6713 CSSValueID filterType = value->function->id; |
6715 unsigned maximumArgumentCount = filterType == CSSValueDropShadow ? 4
: 1; | 6714 unsigned maximumArgumentCount = filterType == CSSValueDropShadow ? 4
: 1; |
6716 | 6715 |
6717 CSSParserValueList* args = value->function->args.get(); | 6716 CSSParserValueList* args = value->function->args.get(); |
6718 if (!args || args->size() > maximumArgumentCount) | 6717 if (!args || args->size() > maximumArgumentCount) |
6719 return nullptr; | 6718 return nullptr; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6879 return list.release(); | 6878 return list.release(); |
6880 return nullptr; | 6879 return nullptr; |
6881 } | 6880 } |
6882 | 6881 |
6883 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle() | 6882 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle() |
6884 { | 6883 { |
6885 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr; | 6884 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr; |
6886 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr; | 6885 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr; |
6887 | 6886 |
6888 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 6887 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
6889 if (value->unit() == CSSPrimitiveValue::UnitType::String) { | 6888 if (value->m_unit == CSSParserValue::String) { |
6890 if (fill || shape) | 6889 if (fill || shape) |
6891 return nullptr; | 6890 return nullptr; |
6892 m_valueList->next(); | 6891 m_valueList->next(); |
6893 return createPrimitiveStringValue(value); | 6892 return createPrimitiveStringValue(value); |
6894 } | 6893 } |
6895 | 6894 |
6896 if (value->id == CSSValueNone) { | 6895 if (value->id == CSSValueNone) { |
6897 if (fill || shape) | 6896 if (fill || shape) |
6898 return nullptr; | 6897 return nullptr; |
6899 m_valueList->next(); | 6898 m_valueList->next(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6966 return list.release(); | 6965 return list.release(); |
6967 } | 6966 } |
6968 | 6967 |
6969 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings) | 6968 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings) |
6970 { | 6969 { |
6971 // Feature tag name consists of 4-letter characters. | 6970 // Feature tag name consists of 4-letter characters. |
6972 static const unsigned tagNameLength = 4; | 6971 static const unsigned tagNameLength = 4; |
6973 | 6972 |
6974 CSSParserValue* value = m_valueList->current(); | 6973 CSSParserValue* value = m_valueList->current(); |
6975 // Feature tag name comes first | 6974 // Feature tag name comes first |
6976 if (value->unit() != CSSPrimitiveValue::UnitType::String) | 6975 if (value->m_unit != CSSParserValue::String) |
6977 return false; | 6976 return false; |
6978 if (value->string.length() != tagNameLength) | 6977 if (value->string.length() != tagNameLength) |
6979 return false; | 6978 return false; |
6980 for (unsigned i = 0; i < tagNameLength; ++i) { | 6979 for (unsigned i = 0; i < tagNameLength; ++i) { |
6981 // Limits the range of characters to 0x20-0x7E, following the tag name r
ules defiend in the OpenType specification. | 6980 // Limits the range of characters to 0x20-0x7E, following the tag name r
ules defiend in the OpenType specification. |
6982 UChar character = value->string[i]; | 6981 UChar character = value->string[i]; |
6983 if (character < 0x20 || character > 0x7E) | 6982 if (character < 0x20 || character > 0x7E) |
6984 return false; | 6983 return false; |
6985 } | 6984 } |
6986 | 6985 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7316 break; | 7315 break; |
7317 | 7316 |
7318 case CSSPropertyClipPath: | 7317 case CSSPropertyClipPath: |
7319 case CSSPropertyFilter: | 7318 case CSSPropertyFilter: |
7320 case CSSPropertyMarkerStart: | 7319 case CSSPropertyMarkerStart: |
7321 case CSSPropertyMarkerMid: | 7320 case CSSPropertyMarkerMid: |
7322 case CSSPropertyMarkerEnd: | 7321 case CSSPropertyMarkerEnd: |
7323 case CSSPropertyMask: | 7322 case CSSPropertyMask: |
7324 if (id == CSSValueNone) { | 7323 if (id == CSSValueNone) { |
7325 validPrimitive = true; | 7324 validPrimitive = true; |
7326 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 7325 } else if (value->m_unit == CSSParserValue::URI) { |
7327 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::UnitType::URI); | 7326 parsedValue = CSSURIValue::create(value->string); |
7328 if (parsedValue) | 7327 if (parsedValue) |
7329 m_valueList->next(); | 7328 m_valueList->next(); |
7330 } | 7329 } |
7331 break; | 7330 break; |
7332 | 7331 |
7333 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit | 7332 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit |
7334 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode); | 7333 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode); |
7335 break; | 7334 break; |
7336 | 7335 |
7337 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit | 7336 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit |
(...skipping 20 matching lines...) Expand all Loading... |
7358 if (parsedValue) | 7357 if (parsedValue) |
7359 m_valueList->next(); | 7358 m_valueList->next(); |
7360 } | 7359 } |
7361 break; | 7360 break; |
7362 | 7361 |
7363 case CSSPropertyFill: // <paint> | inherit | 7362 case CSSPropertyFill: // <paint> | inherit |
7364 case CSSPropertyStroke: // <paint> | inherit | 7363 case CSSPropertyStroke: // <paint> | inherit |
7365 { | 7364 { |
7366 if (id == CSSValueNone) { | 7365 if (id == CSSValueNone) { |
7367 parsedValue = cssValuePool().createIdentifierValue(id); | 7366 parsedValue = cssValuePool().createIdentifierValue(id); |
7368 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 7367 } else if (value->m_unit == CSSParserValue::URI) { |
7369 if (m_valueList->next()) { | 7368 if (m_valueList->next()) { |
7370 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea
teSpaceSeparated(); | 7369 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea
teSpaceSeparated(); |
7371 values->append(CSSPrimitiveValue::create(value->string, CSSP
rimitiveValue::UnitType::URI)); | 7370 values->append(CSSURIValue::create(value->string)); |
7372 if (m_valueList->current()->id == CSSValueNone) | 7371 if (m_valueList->current()->id == CSSValueNone) |
7373 parsedValue = cssValuePool().createIdentifierValue(m_val
ueList->current()->id); | 7372 parsedValue = cssValuePool().createIdentifierValue(m_val
ueList->current()->id); |
7374 else | 7373 else |
7375 parsedValue = parseColor(m_valueList->current()); | 7374 parsedValue = parseColor(m_valueList->current()); |
7376 if (parsedValue) { | 7375 if (parsedValue) { |
7377 values->append(parsedValue); | 7376 values->append(parsedValue); |
7378 parsedValue = values; | 7377 parsedValue = values; |
7379 } | 7378 } |
7380 } | 7379 } |
7381 if (!parsedValue) | 7380 if (!parsedValue) |
7382 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr
imitiveValue::UnitType::URI); | 7381 parsedValue = CSSURIValue::create(value->string); |
7383 } else { | 7382 } else { |
7384 parsedValue = parseColor(m_valueList->current()); | 7383 parsedValue = parseColor(m_valueList->current()); |
7385 } | 7384 } |
7386 | 7385 |
7387 if (parsedValue) | 7386 if (parsedValue) |
7388 m_valueList->next(); | 7387 m_valueList->next(); |
7389 } | 7388 } |
7390 break; | 7389 break; |
7391 | 7390 |
7392 case CSSPropertyStopColor: // TODO : icccolor | 7391 case CSSPropertyStopColor: // TODO : icccolor |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7441 default: | 7440 default: |
7442 // If you crash here, it's because you added a css property and are not
handling it | 7441 // If you crash here, it's because you added a css property and are not
handling it |
7443 // in either this switch statement or the one in CSSPropertyParser::pars
eValue | 7442 // in either this switch statement or the one in CSSPropertyParser::pars
eValue |
7444 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); | 7443 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); |
7445 return false; | 7444 return false; |
7446 } | 7445 } |
7447 | 7446 |
7448 if (validPrimitive) { | 7447 if (validPrimitive) { |
7449 if (id) | 7448 if (id) |
7450 parsedValue = CSSPrimitiveValue::createIdentifier(id); | 7449 parsedValue = CSSPrimitiveValue::createIdentifier(id); |
7451 else if (value->unit() == CSSPrimitiveValue::UnitType::String) | 7450 else if (value->m_unit == CSSParserValue::String) |
7452 parsedValue = CSSPrimitiveValue::create(value->string, value->unit()
); | 7451 parsedValue = CSSStringValue::create(value->string); |
7453 else if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->
unit() <= CSSPrimitiveValue::UnitType::Kilohertz) | 7452 else if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->
unit() <= CSSPrimitiveValue::UnitType::Kilohertz) |
7454 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); | 7453 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); |
7455 else if (value->unit() == CSSPrimitiveValue::UnitType::Rems || value->un
it() == CSSPrimitiveValue::UnitType::Chs) | 7454 else if (value->unit() == CSSPrimitiveValue::UnitType::Rems || value->un
it() == CSSPrimitiveValue::UnitType::Chs) |
7456 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); | 7455 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); |
7457 else if (value->unit() == CSSPrimitiveValue::UnitType::QuirkyEms) | 7456 else if (value->unit() == CSSPrimitiveValue::UnitType::QuirkyEms) |
7458 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::UnitType::QuirkyEms); | 7457 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::UnitType::QuirkyEms); |
7459 if (isCalculation(value)) { | 7458 if (isCalculation(value)) { |
7460 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri
mitiveValue here, ie | 7459 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri
mitiveValue here, ie |
7461 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea
se()); | 7460 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea
se()); |
7462 m_parsedCalculation.release(); | 7461 m_parsedCalculation.release(); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7749 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. | 7748 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. |
7750 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV
aluePath) | 7749 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV
aluePath) |
7751 return nullptr; | 7750 return nullptr; |
7752 | 7751 |
7753 // FIXME: Add support for <fill-rule>. | 7752 // FIXME: Add support for <fill-rule>. |
7754 CSSParserValueList* functionArgs = value->function->args.get(); | 7753 CSSParserValueList* functionArgs = value->function->args.get(); |
7755 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) | 7754 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) |
7756 return nullptr; | 7755 return nullptr; |
7757 | 7756 |
7758 CSSParserValue* arg = functionArgs->current(); | 7757 CSSParserValue* arg = functionArgs->current(); |
7759 if (arg->unit() != CSSPrimitiveValue::UnitType::String) | 7758 if (arg->m_unit != CSSParserValue::String) |
7760 return nullptr; | 7759 return nullptr; |
7761 | 7760 |
7762 String pathString = arg->string; | 7761 String pathString = arg->string; |
7763 Path path; | 7762 Path path; |
7764 if (!buildPathFromString(pathString, path)) | 7763 if (!buildPathFromString(pathString, path)) |
7765 return nullptr; | 7764 return nullptr; |
7766 | 7765 |
7767 m_valueList->next(); | 7766 m_valueList->next(); |
7768 return CSSPathValue::create(pathString); | 7767 return CSSPathValue::create(pathString); |
7769 } | 7768 } |
(...skipping 16 matching lines...) Expand all Loading... |
7786 } | 7785 } |
7787 } | 7786 } |
7788 | 7787 |
7789 if (!list->length()) | 7788 if (!list->length()) |
7790 return nullptr; | 7789 return nullptr; |
7791 | 7790 |
7792 return list.release(); | 7791 return list.release(); |
7793 } | 7792 } |
7794 | 7793 |
7795 } // namespace blink | 7794 } // namespace blink |
OLD | NEW |