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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return CSSPrimitiveValue::create(m_parsedCalculation.release()); | 294 return CSSPrimitiveValue::create(m_parsedCalculation.release()); |
295 } | 295 } |
296 | 296 |
297 ASSERT((value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit(
) <= CSSPrimitiveValue::UnitType::Kilohertz) | 297 ASSERT((value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit(
) <= CSSPrimitiveValue::UnitType::Kilohertz) |
298 || (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit()
<= CSSPrimitiveValue::UnitType::Chs) | 298 || (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit()
<= CSSPrimitiveValue::UnitType::Chs) |
299 || (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value
->unit() <= CSSPrimitiveValue::UnitType::ViewportMax) | 299 || (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value
->unit() <= CSSPrimitiveValue::UnitType::ViewportMax) |
300 || (value->unit() >= CSSPrimitiveValue::UnitType::DotsPerPixel && value-
>unit() <= CSSPrimitiveValue::UnitType::DotsPerCentimeter)); | 300 || (value->unit() >= CSSPrimitiveValue::UnitType::DotsPerPixel && value-
>unit() <= CSSPrimitiveValue::UnitType::DotsPerCentimeter)); |
301 return cssValuePool().createValue(value->fValue, value->unit()); | 301 return cssValuePool().createValue(value->fValue, value->unit()); |
302 } | 302 } |
303 | 303 |
304 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit
iveStringValue(CSSParserValue* value) | 304 inline PassRefPtrWillBeRawPtr<CSSStringValue> CSSPropertyParser::createPrimitive
StringValue(CSSParserValue* value) |
305 { | 305 { |
306 ASSERT(value->unit() == CSSPrimitiveValue::UnitType::String || value->m_unit
== CSSParserValue::Identifier); | 306 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser
Value::Identifier); |
307 return cssValuePool().createValue(value->string, CSSPrimitiveValue::UnitType
::String); | 307 return CSSStringValue::create(value->string); |
308 } | 308 } |
309 | 309 |
310 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit
iveCustomIdentValue(CSSParserValue* value) | 310 inline PassRefPtrWillBeRawPtr<CSSIdentValue> CSSPropertyParser::createPrimitiveC
ustomIdentValue(CSSParserValue* value) |
311 { | 311 { |
312 ASSERT(value->unit() == CSSPrimitiveValue::UnitType::String || value->m_unit
== CSSParserValue::Identifier); | 312 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser
Value::Identifier); |
313 return cssValuePool().createValue(value->string, CSSPrimitiveValue::UnitType
::CustomIdentifier); | 313 return CSSIdentValue::create(value->string); |
314 } | 314 } |
315 | 315 |
316 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi
thReferrer(const String& rawValue, const KURL& url) | 316 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi
thReferrer(const String& rawValue, const KURL& url) |
317 { | 317 { |
318 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur
l); | 318 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur
l); |
319 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); | 319 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); |
320 return imageValue; | 320 return imageValue; |
321 } | 321 } |
322 | 322 |
323 static inline bool isComma(CSSParserValue* value) | 323 static inline bool isComma(CSSParserValue* value) |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // Grammar defined by CSS3 UI and modified by CSS4 images: | 582 // Grammar defined by CSS3 UI and modified by CSS4 images: |
583 // [ [<image> [<x> <y>]?,]* | 583 // [ [<image> [<x> <y>]?,]* |
584 // [ auto | crosshair | default | pointer | progress | move | e-resize |
ne-resize | | 584 // [ auto | crosshair | default | pointer | progress | move | e-resize |
ne-resize | |
585 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize |
ew-resize | | 585 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize |
ew-resize | |
586 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex
t | wait | help | | 586 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex
t | wait | help | |
587 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al
lowed | all-scroll | | 587 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al
lowed | all-scroll | |
588 // zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-i
n | -webkit-zoom-out ] ] | inherit | 588 // zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-i
n | -webkit-zoom-out ] ] | inherit |
589 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; | 589 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; |
590 while (value) { | 590 while (value) { |
591 RefPtrWillBeRawPtr<CSSValue> image = nullptr; | 591 RefPtrWillBeRawPtr<CSSValue> image = nullptr; |
592 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 592 if (value->m_unit == CSSParserValue::URI) { |
593 String uri = value->string; | 593 String uri = value->string; |
594 if (!uri.isNull()) | 594 if (!uri.isNull()) |
595 image = createCSSImageValueWithReferrer(uri, completeURL(uri
)); | 595 image = createCSSImageValueWithReferrer(uri, completeURL(uri
)); |
596 } else if (value->m_unit == CSSParserValue::Function && value->funct
ion->id == CSSValueWebkitImageSet) { | 596 } else if (value->m_unit == CSSParserValue::Function && value->funct
ion->id == CSSValueWebkitImageSet) { |
597 image = parseImageSet(m_valueList); | 597 image = parseImageSet(m_valueList); |
598 if (!image) | 598 if (!image) |
599 break; | 599 break; |
600 } else | 600 } else |
601 break; | 601 break; |
602 | 602 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 } | 711 } |
712 case CSSPropertyObjectPosition: | 712 case CSSPropertyObjectPosition: |
713 parsedValue = parsePosition(m_valueList); | 713 parsedValue = parsePosition(m_valueList); |
714 break; | 714 break; |
715 case CSSPropertyListStyleImage: // <uri> | none | inherit | 715 case CSSPropertyListStyleImage: // <uri> | none | inherit |
716 case CSSPropertyBorderImageSource: | 716 case CSSPropertyBorderImageSource: |
717 case CSSPropertyWebkitMaskBoxImageSource: | 717 case CSSPropertyWebkitMaskBoxImageSource: |
718 if (id == CSSValueNone) { | 718 if (id == CSSValueNone) { |
719 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); | 719 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); |
720 m_valueList->next(); | 720 m_valueList->next(); |
721 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 721 } else if (value->m_unit == CSSParserValue::URI) { |
722 parsedValue = createCSSImageValueWithReferrer(value->string, complet
eURL(value->string)); | 722 parsedValue = createCSSImageValueWithReferrer(value->string, complet
eURL(value->string)); |
723 m_valueList->next(); | 723 m_valueList->next(); |
724 } else if (isGeneratedImageValue(value)) { | 724 } else if (isGeneratedImageValue(value)) { |
725 if (parseGeneratedImage(m_valueList, parsedValue)) | 725 if (parseGeneratedImage(m_valueList, parsedValue)) |
726 m_valueList->next(); | 726 m_valueList->next(); |
727 else | 727 else |
728 return false; | 728 return false; |
729 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueWebkitImageSet) { | 729 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueWebkitImageSet) { |
730 parsedValue = parseImageSet(m_valueList); | 730 parsedValue = parseImageSet(m_valueList); |
731 if (!parsedValue) | 731 if (!parsedValue) |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 validPrimitive = (!id && !isCalculation(value) && validUnit(value, FInte
ger | FPercent | FNonNeg) && (value->unit() == CSSPrimitiveValue::UnitType::Perc
entage || value->fValue)); | 1322 validPrimitive = (!id && !isCalculation(value) && validUnit(value, FInte
ger | FPercent | FNonNeg) && (value->unit() == CSSPrimitiveValue::UnitType::Perc
entage || value->fValue)); |
1323 break; | 1323 break; |
1324 | 1324 |
1325 case CSSPropertyWebkitFontSizeDelta: // <length> | 1325 case CSSPropertyWebkitFontSizeDelta: // <length> |
1326 validPrimitive = validUnit(value, FLength | FUnitlessQuirk); | 1326 validPrimitive = validUnit(value, FLength | FUnitlessQuirk); |
1327 break; | 1327 break; |
1328 | 1328 |
1329 case CSSPropertyWebkitHighlight: | 1329 case CSSPropertyWebkitHighlight: |
1330 if (id == CSSValueNone) { | 1330 if (id == CSSValueNone) { |
1331 validPrimitive = true; | 1331 validPrimitive = true; |
1332 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { | 1332 } else if (value->m_unit == CSSParserValue::String) { |
1333 parsedValue = createPrimitiveStringValue(value); | 1333 parsedValue = createPrimitiveStringValue(value); |
1334 m_valueList->next(); | 1334 m_valueList->next(); |
1335 } | 1335 } |
1336 break; | 1336 break; |
1337 | 1337 |
1338 case CSSPropertyWebkitHyphenateCharacter: | 1338 case CSSPropertyWebkitHyphenateCharacter: |
1339 case CSSPropertyWebkitLocale: | 1339 case CSSPropertyWebkitLocale: |
1340 if (id == CSSValueAuto) { | 1340 if (id == CSSValueAuto) { |
1341 validPrimitive = true; | 1341 validPrimitive = true; |
1342 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { | 1342 } else if (value->m_unit == CSSParserValue::String) { |
1343 parsedValue = createPrimitiveStringValue(value); | 1343 parsedValue = createPrimitiveStringValue(value); |
1344 m_valueList->next(); | 1344 m_valueList->next(); |
1345 } | 1345 } |
1346 break; | 1346 break; |
1347 | 1347 |
1348 // End Apple-specific properties | 1348 // End Apple-specific properties |
1349 | 1349 |
1350 case CSSPropertyWebkitAppRegion: | 1350 case CSSPropertyWebkitAppRegion: |
1351 if (id >= CSSValueDrag && id <= CSSValueNoDrag) | 1351 if (id >= CSSValueDrag && id <= CSSValueNoDrag) |
1352 validPrimitive = true; | 1352 validPrimitive = true; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 if (id == CSSValueNormal) | 1471 if (id == CSSValueNormal) |
1472 validPrimitive = true; | 1472 validPrimitive = true; |
1473 else | 1473 else |
1474 return parseFontVariantLigatures(important); | 1474 return parseFontVariantLigatures(important); |
1475 break; | 1475 break; |
1476 case CSSPropertyWebkitClipPath: | 1476 case CSSPropertyWebkitClipPath: |
1477 if (id == CSSValueNone) { | 1477 if (id == CSSValueNone) { |
1478 validPrimitive = true; | 1478 validPrimitive = true; |
1479 } else if (value->m_unit == CSSParserValue::Function) { | 1479 } else if (value->m_unit == CSSParserValue::Function) { |
1480 parsedValue = parseBasicShape(); | 1480 parsedValue = parseBasicShape(); |
1481 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 1481 } else if (value->m_unit == CSSParserValue::URI) { |
1482 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::UnitType::URI); | 1482 parsedValue = CSSURIValue::create(value->string); |
1483 addProperty(propId, parsedValue.release(), important); | 1483 addProperty(propId, parsedValue.release(), important); |
1484 return true; | 1484 return true; |
1485 } | 1485 } |
1486 break; | 1486 break; |
1487 case CSSPropertyShapeOutside: | 1487 case CSSPropertyShapeOutside: |
1488 if (id == CSSValueNone) | 1488 if (id == CSSValueNone) |
1489 validPrimitive = true; | 1489 validPrimitive = true; |
1490 else | 1490 else |
1491 parsedValue = parseShapeProperty(propId); | 1491 parsedValue = parseShapeProperty(propId); |
1492 break; | 1492 break; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 } | 1735 } |
1736 | 1736 |
1737 static bool isValidTransitionPropertyList(CSSValueList* value) | 1737 static bool isValidTransitionPropertyList(CSSValueList* value) |
1738 { | 1738 { |
1739 if (value->length() < 2) | 1739 if (value->length() < 2) |
1740 return true; | 1740 return true; |
1741 for (auto& property : *value) { | 1741 for (auto& property : *value) { |
1742 // FIXME: Shorthand parsing shouldn't add initial to the list since it w
on't round-trip | 1742 // FIXME: Shorthand parsing shouldn't add initial to the list since it w
on't round-trip |
1743 if (property->isInitialValue()) | 1743 if (property->isInitialValue()) |
1744 continue; | 1744 continue; |
1745 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(property.get()); | 1745 if (property->isPrimitiveValue() && toCSSPrimitiveValue(*property).isVal
ueID() && toCSSPrimitiveValue(*property).getValueID() == CSSValueNone) |
1746 if (primitiveValue->isValueID() && primitiveValue->getValueID() == CSSVa
lueNone) | |
1747 return false; | 1746 return false; |
1748 } | 1747 } |
1749 return true; | 1748 return true; |
1750 } | 1749 } |
1751 | 1750 |
1752 bool CSSPropertyParser::parseAnimationShorthand(bool useLegacyparsing, bool impo
rtant) | 1751 bool CSSPropertyParser::parseAnimationShorthand(bool useLegacyparsing, bool impo
rtant) |
1753 { | 1752 { |
1754 const StylePropertyShorthand& animationProperties = animationShorthandForPar
sing(); | 1753 const StylePropertyShorthand& animationProperties = animationShorthandForPar
sing(); |
1755 const unsigned numProperties = 8; | 1754 const unsigned numProperties = 8; |
1756 | 1755 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() | 2056 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() |
2058 { | 2057 { |
2059 if (m_valueList->current()->id == CSSValueNone) { | 2058 if (m_valueList->current()->id == CSSValueNone) { |
2060 m_valueList->next(); | 2059 m_valueList->next(); |
2061 return cssValuePool().createIdentifierValue(CSSValueNone); | 2060 return cssValuePool().createIdentifierValue(CSSValueNone); |
2062 } | 2061 } |
2063 | 2062 |
2064 return parsePositionList(m_valueList); | 2063 return parsePositionList(m_valueList); |
2065 } | 2064 } |
2066 | 2065 |
2067 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parsePage() | 2066 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePage() |
2068 { | 2067 { |
2069 CSSParserValue* value = m_valueList->current(); | 2068 CSSParserValue* value = m_valueList->current(); |
2070 m_valueList->next(); | 2069 m_valueList->next(); |
2071 ASSERT(value); | 2070 ASSERT(value); |
2072 | 2071 |
2073 if (value->id == CSSValueAuto) | 2072 if (value->id == CSSValueAuto) |
2074 return cssValuePool().createIdentifierValue(value->id); | 2073 return cssValuePool().createIdentifierValue(value->id); |
2075 if (value->m_unit == CSSParserValue::Identifier) | 2074 if (value->m_unit == CSSParserValue::Identifier) |
2076 return createPrimitiveCustomIdentValue(value); | 2075 return createPrimitiveCustomIdentValue(value); |
2077 return nullptr; | 2076 return nullptr; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 return None; | 2141 return None; |
2143 } | 2142 } |
2144 } | 2143 } |
2145 | 2144 |
2146 // [ <string> <string> ]+ | none, but none is handled in parseValue | 2145 // [ <string> <string> ]+ | none, but none is handled in parseValue |
2147 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes() | 2146 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes() |
2148 { | 2147 { |
2149 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); | 2148 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); |
2150 while (CSSParserValue* val = m_valueList->current()) { | 2149 while (CSSParserValue* val = m_valueList->current()) { |
2151 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; | 2150 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
2152 if (val->unit() != CSSPrimitiveValue::UnitType::String) | 2151 if (val->m_unit != CSSParserValue::String) |
2153 return nullptr; | 2152 return nullptr; |
2154 parsedValue = createPrimitiveStringValue(val); | 2153 parsedValue = createPrimitiveStringValue(val); |
2155 values->append(parsedValue.release()); | 2154 values->append(parsedValue.release()); |
2156 m_valueList->next(); | 2155 m_valueList->next(); |
2157 } | 2156 } |
2158 if (values->length() && values->length() % 2 == 0) | 2157 if (values->length() && values->length() % 2 == 0) |
2159 return values.release(); | 2158 return values.release(); |
2160 return nullptr; | 2159 return nullptr; |
2161 } | 2160 } |
2162 | 2161 |
2163 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open
-quote | no-close-quote ]+ | inherit | 2162 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open
-quote | no-close-quote ]+ | inherit |
2164 // in CSS 2.1 this got somewhat reduced: | 2163 // in CSS 2.1 this got somewhat reduced: |
2165 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu
ote ]+ | inherit | 2164 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu
ote ]+ | inherit |
2166 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent() | 2165 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent() |
2167 { | 2166 { |
2168 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); | 2167 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); |
2169 | 2168 |
2170 while (CSSParserValue* val = m_valueList->current()) { | 2169 while (CSSParserValue* val = m_valueList->current()) { |
2171 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; | 2170 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
2172 if (val->unit() == CSSPrimitiveValue::UnitType::URI) { | 2171 if (val->m_unit == CSSParserValue::URI) { |
2173 // url | 2172 // url |
2174 parsedValue = createCSSImageValueWithReferrer(val->string, completeU
RL(val->string)); | 2173 parsedValue = createCSSImageValueWithReferrer(val->string, completeU
RL(val->string)); |
2175 } else if (val->m_unit == CSSParserValue::Function) { | 2174 } else if (val->m_unit == CSSParserValue::Function) { |
2176 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie
nt(...) | 2175 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie
nt(...) |
2177 CSSParserValueList* args = val->function->args.get(); | 2176 CSSParserValueList* args = val->function->args.get(); |
2178 if (!args) | 2177 if (!args) |
2179 return nullptr; | 2178 return nullptr; |
2180 if (val->function->id == CSSValueAttr) { | 2179 if (val->function->id == CSSValueAttr) { |
2181 parsedValue = parseAttr(args); | 2180 parsedValue = parseAttr(args); |
2182 } else if (val->function->id == CSSValueCounter) { | 2181 } else if (val->function->id == CSSValueCounter) { |
(...skipping 11 matching lines...) Expand all Loading... |
2194 case CSSValueOpenQuote: | 2193 case CSSValueOpenQuote: |
2195 case CSSValueCloseQuote: | 2194 case CSSValueCloseQuote: |
2196 case CSSValueNoOpenQuote: | 2195 case CSSValueNoOpenQuote: |
2197 case CSSValueNoCloseQuote: | 2196 case CSSValueNoCloseQuote: |
2198 case CSSValueNone: | 2197 case CSSValueNone: |
2199 case CSSValueNormal: | 2198 case CSSValueNormal: |
2200 parsedValue = cssValuePool().createIdentifierValue(val->id); | 2199 parsedValue = cssValuePool().createIdentifierValue(val->id); |
2201 default: | 2200 default: |
2202 break; | 2201 break; |
2203 } | 2202 } |
2204 } else if (val->unit() == CSSPrimitiveValue::UnitType::String) { | 2203 } else if (val->m_unit == CSSParserValue::String) { |
2205 parsedValue = createPrimitiveStringValue(val); | 2204 parsedValue = createPrimitiveStringValue(val); |
2206 } | 2205 } |
2207 if (!parsedValue) | 2206 if (!parsedValue) |
2208 return nullptr; | 2207 return nullptr; |
2209 values->append(parsedValue.release()); | 2208 values->append(parsedValue.release()); |
2210 m_valueList->next(); | 2209 m_valueList->next(); |
2211 } | 2210 } |
2212 | 2211 |
2213 return values.release(); | 2212 return values.release(); |
2214 } | 2213 } |
(...skipping 12 matching lines...) Expand all Loading... |
2227 // CSS allows identifiers with "-" at the start, like "-webkit-mask-image". | 2226 // CSS allows identifiers with "-" at the start, like "-webkit-mask-image". |
2228 // But HTML attribute names can't have those characters, and we should not | 2227 // But HTML attribute names can't have those characters, and we should not |
2229 // even parse them inside attr(). | 2228 // even parse them inside attr(). |
2230 if (attrName[0] == '-') | 2229 if (attrName[0] == '-') |
2231 return nullptr; | 2230 return nullptr; |
2232 | 2231 |
2233 if (m_context.isHTMLDocument()) | 2232 if (m_context.isHTMLDocument()) |
2234 attrName = attrName.lower(); | 2233 attrName = attrName.lower(); |
2235 | 2234 |
2236 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS
SValueAttr); | 2235 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS
SValueAttr); |
2237 attrValue->append(CSSPrimitiveValue::create(attrName, CSSPrimitiveValue::Uni
tType::CustomIdentifier)); | 2236 attrValue->append(CSSIdentValue::create(attrName)); |
2238 return attrValue.release(); | 2237 return attrValue.release(); |
2239 } | 2238 } |
2240 | 2239 |
2241 bool CSSPropertyParser::acceptQuirkyColors(CSSPropertyID propertyId) const | 2240 bool CSSPropertyParser::acceptQuirkyColors(CSSPropertyID propertyId) const |
2242 { | 2241 { |
2243 if (!inQuirksMode()) | 2242 if (!inQuirksMode()) |
2244 return false; | 2243 return false; |
2245 switch (propertyId) { | 2244 switch (propertyId) { |
2246 case CSSPropertyBackgroundColor: | 2245 case CSSPropertyBackgroundColor: |
2247 case CSSPropertyBorderBottomColor: | 2246 case CSSPropertyBorderBottomColor: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 return nullptr; | 2300 return nullptr; |
2302 return cssValuePool().createColorValue(c); | 2301 return cssValuePool().createColorValue(c); |
2303 } | 2302 } |
2304 | 2303 |
2305 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& value) | 2304 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& value) |
2306 { | 2305 { |
2307 if (valueList->current()->id == CSSValueNone) { | 2306 if (valueList->current()->id == CSSValueNone) { |
2308 value = cssValuePool().createIdentifierValue(CSSValueNone); | 2307 value = cssValuePool().createIdentifierValue(CSSValueNone); |
2309 return true; | 2308 return true; |
2310 } | 2309 } |
2311 if (valueList->current()->unit() == CSSPrimitiveValue::UnitType::URI) { | 2310 if (valueList->current()->m_unit == CSSParserValue::URI) { |
2312 value = createCSSImageValueWithReferrer(valueList->current()->string, co
mpleteURL(valueList->current()->string)); | 2311 value = createCSSImageValueWithReferrer(valueList->current()->string, co
mpleteURL(valueList->current()->string)); |
2313 return true; | 2312 return true; |
2314 } | 2313 } |
2315 | 2314 |
2316 if (isGeneratedImageValue(valueList->current())) | 2315 if (isGeneratedImageValue(valueList->current())) |
2317 return parseGeneratedImage(valueList, value); | 2316 return parseGeneratedImage(valueList, value); |
2318 | 2317 |
2319 if (valueList->current()->m_unit == CSSParserValue::Function && valueList->c
urrent()->function->id == CSSValueWebkitImageSet) { | 2318 if (valueList->current()->m_unit == CSSParserValue::Function && valueList->c
urrent()->function->id == CSSValueWebkitImageSet) { |
2320 value = parseImageSet(m_valueList); | 2319 value = parseImageSet(m_valueList); |
2321 if (value) | 2320 if (value) |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo
wQuotedName) | 2994 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo
wQuotedName) |
2996 { | 2995 { |
2997 CSSParserValue* value = m_valueList->current(); | 2996 CSSParserValue* value = m_valueList->current(); |
2998 | 2997 |
2999 if (value->id == CSSValueNone) | 2998 if (value->id == CSSValueNone) |
3000 return cssValuePool().createIdentifierValue(CSSValueNone); | 2999 return cssValuePool().createIdentifierValue(CSSValueNone); |
3001 | 3000 |
3002 if (value->m_unit == CSSParserValue::Identifier) | 3001 if (value->m_unit == CSSParserValue::Identifier) |
3003 return createPrimitiveCustomIdentValue(value); | 3002 return createPrimitiveCustomIdentValue(value); |
3004 | 3003 |
3005 if (allowQuotedName && value->unit() == CSSPrimitiveValue::UnitType::String)
{ | 3004 if (allowQuotedName && value->m_unit == CSSParserValue::String) { |
3006 // Legacy support for strings in prefixed animations | 3005 // Legacy support for strings in prefixed animations |
3007 if (m_context.useCounter()) | 3006 if (m_context.useCounter()) |
3008 m_context.useCounter()->count(UseCounter::QuotedAnimationName); | 3007 m_context.useCounter()->count(UseCounter::QuotedAnimationName); |
3009 if (equalIgnoringCase(value->string, "none")) | 3008 if (equalIgnoringCase(value->string, "none")) |
3010 return cssValuePool().createIdentifierValue(CSSValueNone); | 3009 return cssValuePool().createIdentifierValue(CSSValueNone); |
3011 return createPrimitiveCustomIdentValue(value); | 3010 return createPrimitiveCustomIdentValue(value); |
3012 } | 3011 } |
3013 | 3012 |
3014 return nullptr; | 3013 return nullptr; |
3015 } | 3014 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3201 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i
d == CSSValueUnset || value.id == CSSValueDefault; | 3200 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i
d == CSSValueUnset || value.id == CSSValueDefault; |
3202 } | 3201 } |
3203 | 3202 |
3204 static inline bool isValidCustomIdentForGridPositions(const CSSParserValue& valu
e) | 3203 static inline bool isValidCustomIdentForGridPositions(const CSSParserValue& valu
e) |
3205 { | 3204 { |
3206 // FIXME: we need a more general solution for <custom-ident> in all properti
es. | 3205 // FIXME: we need a more general solution for <custom-ident> in all properti
es. |
3207 return value.m_unit == CSSParserValue::Identifier && value.id != CSSValueSpa
n && value.id != CSSValueAuto && !isCSSWideKeyword(value); | 3206 return value.m_unit == CSSParserValue::Identifier && value.id != CSSValueSpa
n && value.id != CSSValueAuto && !isCSSWideKeyword(value); |
3208 } | 3207 } |
3209 | 3208 |
3210 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can
be stand alone or with 'span'). | 3209 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can
be stand alone or with 'span'). |
3211 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa
wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gr
idLineName) | 3210 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa
wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSIdentValue>& gridLi
neName) |
3212 { | 3211 { |
3213 CSSParserValue* value = m_valueList->current(); | 3212 CSSParserValue* value = m_valueList->current(); |
3214 if (validUnit(value, FInteger) && value->fValue) { | 3213 if (validUnit(value, FInteger) && value->fValue) { |
3215 numericValue = createPrimitiveNumericValue(value); | 3214 numericValue = createPrimitiveNumericValue(value); |
3216 value = m_valueList->next(); | 3215 value = m_valueList->next(); |
3217 if (value && isValidCustomIdentForGridPositions(*value)) { | 3216 if (value && isValidCustomIdentForGridPositions(*value)) { |
3218 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current(
)); | 3217 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current(
)); |
3219 m_valueList->next(); | 3218 m_valueList->next(); |
3220 } | 3219 } |
3221 return true; | 3220 return true; |
(...skipping 16 matching lines...) Expand all Loading... |
3238 { | 3237 { |
3239 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3238 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3240 | 3239 |
3241 CSSParserValue* value = m_valueList->current(); | 3240 CSSParserValue* value = m_valueList->current(); |
3242 if (value->id == CSSValueAuto) { | 3241 if (value->id == CSSValueAuto) { |
3243 m_valueList->next(); | 3242 m_valueList->next(); |
3244 return cssValuePool().createIdentifierValue(CSSValueAuto); | 3243 return cssValuePool().createIdentifierValue(CSSValueAuto); |
3245 } | 3244 } |
3246 | 3245 |
3247 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr; | 3246 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr; |
3248 RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName = nullptr; | 3247 RefPtrWillBeRawPtr<CSSIdentValue> gridLineName = nullptr; |
3249 bool hasSeenSpanKeyword = false; | 3248 bool hasSeenSpanKeyword = false; |
3250 | 3249 |
3251 if (parseIntegerOrCustomIdentFromGridPosition(numericValue, gridLineName)) { | 3250 if (parseIntegerOrCustomIdentFromGridPosition(numericValue, gridLineName)) { |
3252 value = m_valueList->current(); | 3251 value = m_valueList->current(); |
3253 if (value && value->id == CSSValueSpan) { | 3252 if (value && value->id == CSSValueSpan) { |
3254 hasSeenSpanKeyword = true; | 3253 hasSeenSpanKeyword = true; |
3255 m_valueList->next(); | 3254 m_valueList->next(); |
3256 } | 3255 } |
3257 } else if (value->id == CSSValueSpan) { | 3256 } else if (value->id == CSSValueSpan) { |
3258 hasSeenSpanKeyword = true; | 3257 hasSeenSpanKeyword = true; |
(...skipping 11 matching lines...) Expand all Loading... |
3270 // If we didn't parse anything, this is not a valid grid position. | 3269 // If we didn't parse anything, this is not a valid grid position. |
3271 if (!hasSeenSpanKeyword && !gridLineName && !numericValue) | 3270 if (!hasSeenSpanKeyword && !gridLineName && !numericValue) |
3272 return nullptr; | 3271 return nullptr; |
3273 | 3272 |
3274 // Negative numbers are not allowed for span (but are for <integer>). | 3273 // Negative numbers are not allowed for span (but are for <integer>). |
3275 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0) | 3274 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0) |
3276 return nullptr; | 3275 return nullptr; |
3277 | 3276 |
3278 // For the <custom-ident> case. | 3277 // For the <custom-ident> case. |
3279 if (gridLineName && !numericValue && !hasSeenSpanKeyword) | 3278 if (gridLineName && !numericValue && !hasSeenSpanKeyword) |
3280 return cssValuePool().createValue(gridLineName->getStringValue(), CSSPri
mitiveValue::UnitType::CustomIdentifier); | 3279 return CSSIdentValue::create(gridLineName->getStringValue()); |
3281 | 3280 |
3282 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); | 3281 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated
(); |
3283 if (hasSeenSpanKeyword) | 3282 if (hasSeenSpanKeyword) |
3284 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); | 3283 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); |
3285 if (numericValue) | 3284 if (numericValue) |
3286 values->append(numericValue.release()); | 3285 values->append(numericValue.release()); |
3287 if (gridLineName) | 3286 if (gridLineName) |
3288 values->append(gridLineName.release()); | 3287 values->append(gridLineName.release()); |
3289 ASSERT(values->length()); | 3288 ASSERT(values->length()); |
3290 return values.release(); | 3289 return values.release(); |
3291 } | 3290 } |
3292 | 3291 |
3293 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v
alue) | 3292 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v
alue) |
3294 { | 3293 { |
3295 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isCustomIdent()
) | 3294 if (value->isIdentValue()) |
3296 return value; | 3295 return value; |
3297 | 3296 |
3298 return cssValuePool().createIdentifierValue(CSSValueAuto); | 3297 return cssValuePool().createIdentifierValue(CSSValueAuto); |
3299 } | 3298 } |
3300 | 3299 |
3301 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
, bool important) | 3300 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
, bool important) |
3302 { | 3301 { |
3303 ShorthandScope scope(this, shorthandId); | 3302 ShorthandScope scope(this, shorthandId); |
3304 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); | 3303 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); |
3305 ASSERT(shorthand.length() == 2); | 3304 ASSERT(shorthand.length() == 2); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3344 // Handle leading <custom-ident>*. | 3343 // Handle leading <custom-ident>*. |
3345 if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdd
ed ? toCSSGridLineNamesValue(templateRows->item(templateRows->length() - 1)) : n
ullptr)) | 3344 if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdd
ed ? toCSSGridLineNamesValue(templateRows->item(templateRows->length() - 1)) : n
ullptr)) |
3346 return false; | 3345 return false; |
3347 | 3346 |
3348 // Handle a template-area's row. | 3347 // Handle a template-area's row. |
3349 if (!parseGridTemplateAreasRow(gridAreaMap, rowCount, columnCount)) | 3348 if (!parseGridTemplateAreasRow(gridAreaMap, rowCount, columnCount)) |
3350 return false; | 3349 return false; |
3351 ++rowCount; | 3350 ++rowCount; |
3352 | 3351 |
3353 // Handle template-rows's track-size. | 3352 // Handle template-rows's track-size. |
3354 if (m_valueList->current() && m_valueList->current()->unit() != CSSPrimi
tiveValue::UnitType::String) { | 3353 if (m_valueList->current() && m_valueList->current()->m_unit != CSSParse
rValue::String) { |
3355 RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList
); | 3354 RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList
); |
3356 if (!value) | 3355 if (!value) |
3357 return false; | 3356 return false; |
3358 templateRows->append(value); | 3357 templateRows->append(value); |
3359 } else { | 3358 } else { |
3360 templateRows->append(cssValuePool().createIdentifierValue(CSSValueAu
to)); | 3359 templateRows->append(cssValuePool().createIdentifierValue(CSSValueAu
to)); |
3361 } | 3360 } |
3362 | 3361 |
3363 // This will handle the trailing/leading <custom-ident>* in the grammar. | 3362 // This will handle the trailing/leading <custom-ident>* in the grammar. |
3364 if (!parseGridLineNames(*m_valueList, *templateRows)) | 3363 if (!parseGridLineNames(*m_valueList, *templateRows)) |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3567 if (!lineNames) | 3566 if (!lineNames) |
3568 lineNames = CSSGridLineNamesValue::create(); | 3567 lineNames = CSSGridLineNamesValue::create(); |
3569 | 3568 |
3570 while (CSSParserValue* identValue = inputList.current()) { | 3569 while (CSSParserValue* identValue = inputList.current()) { |
3571 if (isClosingBracket(*identValue)) | 3570 if (isClosingBracket(*identValue)) |
3572 break; | 3571 break; |
3573 | 3572 |
3574 if (!isValidCustomIdentForGridPositions(*identValue)) | 3573 if (!isValidCustomIdentForGridPositions(*identValue)) |
3575 return false; | 3574 return false; |
3576 | 3575 |
3577 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveCustomId
entValue(identValue); | 3576 RefPtrWillBeRawPtr<CSSIdentValue> lineName = createPrimitiveCustomIdentV
alue(identValue); |
3578 lineNames->append(lineName.release()); | 3577 lineNames->append(lineName.release()); |
3579 inputList.next(); | 3578 inputList.next(); |
3580 } | 3579 } |
3581 | 3580 |
3582 if (!inputList.current() || !isClosingBracket(*inputList.current())) | 3581 if (!inputList.current() || !isClosingBracket(*inputList.current())) |
3583 return false; | 3582 return false; |
3584 | 3583 |
3585 if (!previousNamedAreaTrailingLineNames) | 3584 if (!previousNamedAreaTrailingLineNames) |
3586 valueList.append(lineNames.release()); | 3585 valueList.append(lineNames.release()); |
3587 | 3586 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3771 | 3770 |
3772 if (!areaName.isEmpty()) | 3771 if (!areaName.isEmpty()) |
3773 columnNames.append(areaName.toString()); | 3772 columnNames.append(areaName.toString()); |
3774 | 3773 |
3775 return columnNames; | 3774 return columnNames; |
3776 } | 3775 } |
3777 | 3776 |
3778 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap,
const size_t rowCount, size_t& columnCount) | 3777 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap,
const size_t rowCount, size_t& columnCount) |
3779 { | 3778 { |
3780 CSSParserValue* currentValue = m_valueList->current(); | 3779 CSSParserValue* currentValue = m_valueList->current(); |
3781 if (!currentValue || currentValue->unit() != CSSPrimitiveValue::UnitType::St
ring) | 3780 if (!currentValue || currentValue->m_unit != CSSParserValue::String) |
3782 return false; | 3781 return false; |
3783 | 3782 |
3784 String gridRowNames = currentValue->string; | 3783 String gridRowNames = currentValue->string; |
3785 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) | 3784 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) |
3786 return false; | 3785 return false; |
3787 | 3786 |
3788 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames)
; | 3787 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames)
; |
3789 if (!columnCount) { | 3788 if (!columnCount) { |
3790 columnCount = columnNames.size(); | 3789 columnCount = columnNames.size(); |
3791 ASSERT(columnCount); | 3790 ASSERT(columnCount); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3903 { | 3902 { |
3904 unsigned numArgs = args->size(); | 3903 unsigned numArgs = args->size(); |
3905 if (counters && numArgs != 3 && numArgs != 5) | 3904 if (counters && numArgs != 3 && numArgs != 5) |
3906 return nullptr; | 3905 return nullptr; |
3907 if (!counters && numArgs != 1 && numArgs != 3) | 3906 if (!counters && numArgs != 1 && numArgs != 3) |
3908 return nullptr; | 3907 return nullptr; |
3909 | 3908 |
3910 CSSParserValue* i = args->current(); | 3909 CSSParserValue* i = args->current(); |
3911 if (i->m_unit != CSSParserValue::Identifier) | 3910 if (i->m_unit != CSSParserValue::Identifier) |
3912 return nullptr; | 3911 return nullptr; |
3913 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveCustomIden
tValue(i); | 3912 RefPtrWillBeRawPtr<CSSIdentValue> identifier = createPrimitiveCustomIdentVal
ue(i); |
3914 | 3913 |
3915 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = nullptr; | 3914 RefPtrWillBeRawPtr<CSSIdentValue> separator = nullptr; |
3916 if (!counters) | 3915 if (!counters) |
3917 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::Unit
Type::CustomIdentifier); | 3916 separator = CSSIdentValue::create(String()); |
3918 else { | 3917 else { |
3919 args->next(); | 3918 args->next(); |
3920 if (!consumeComma(args)) | 3919 if (!consumeComma(args)) |
3921 return nullptr; | 3920 return nullptr; |
3922 | 3921 |
3923 i = args->current(); | 3922 i = args->current(); |
3924 if (i->unit() != CSSPrimitiveValue::UnitType::String) | 3923 if (i->m_unit != CSSParserValue::String) |
3925 return nullptr; | 3924 return nullptr; |
3926 | 3925 |
3927 separator = createPrimitiveCustomIdentValue(i); | 3926 separator = createPrimitiveCustomIdentValue(i); |
3928 } | 3927 } |
3929 | 3928 |
3930 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr; | 3929 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr; |
3931 i = args->next(); | 3930 i = args->next(); |
3932 if (!i) // Make the list style default decimal | 3931 if (!i) // Make the list style default decimal |
3933 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); | 3932 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); |
3934 else { | 3933 else { |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4670 CSSParserValue* value = m_valueList->current(); | 4669 CSSParserValue* value = m_valueList->current(); |
4671 | 4670 |
4672 FontFamilyValueBuilder familyBuilder(list.get()); | 4671 FontFamilyValueBuilder familyBuilder(list.get()); |
4673 bool inFamily = false; | 4672 bool inFamily = false; |
4674 | 4673 |
4675 while (value) { | 4674 while (value) { |
4676 CSSParserValue* nextValue = m_valueList->next(); | 4675 CSSParserValue* nextValue = m_valueList->next(); |
4677 bool nextValBreaksFont = !nextValue || isComma(nextValue); | 4676 bool nextValBreaksFont = !nextValue || isComma(nextValue); |
4678 bool nextValIsFontName = nextValue && | 4677 bool nextValIsFontName = nextValue && |
4679 ((nextValue->id >= CSSValueSerif && nextValue->id <= CSSValueWebkitB
ody) || | 4678 ((nextValue->id >= CSSValueSerif && nextValue->id <= CSSValueWebkitB
ody) || |
4680 (nextValue->unit() == CSSPrimitiveValue::UnitType::String || nextVal
ue->m_unit == CSSParserValue::Identifier)); | 4679 (nextValue->m_unit == CSSParserValue::String || nextValue->m_unit ==
CSSParserValue::Identifier)); |
4681 | 4680 |
4682 if (isCSSWideKeyword(*value) && !inFamily) { | 4681 if (isCSSWideKeyword(*value) && !inFamily) { |
4683 if (nextValBreaksFont) | 4682 if (nextValBreaksFont) |
4684 return nullptr; | 4683 return nullptr; |
4685 else if (nextValIsFontName) | 4684 else if (nextValIsFontName) |
4686 value = nextValue; | 4685 value = nextValue; |
4687 continue; | 4686 continue; |
4688 } | 4687 } |
4689 | 4688 |
4690 if (value->id >= CSSValueSerif && value->id <= CSSValueWebkitBody) { | 4689 if (value->id >= CSSValueSerif && value->id <= CSSValueWebkitBody) { |
4691 if (inFamily) | 4690 if (inFamily) |
4692 familyBuilder.add(value->string); | 4691 familyBuilder.add(value->string); |
4693 else if (nextValBreaksFont || !nextValIsFontName) | 4692 else if (nextValBreaksFont || !nextValIsFontName) |
4694 list->append(cssValuePool().createIdentifierValue(value->id)); | 4693 list->append(cssValuePool().createIdentifierValue(value->id)); |
4695 else { | 4694 else { |
4696 familyBuilder.commit(); | 4695 familyBuilder.commit(); |
4697 familyBuilder.add(value->string); | 4696 familyBuilder.add(value->string); |
4698 inFamily = true; | 4697 inFamily = true; |
4699 } | 4698 } |
4700 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { | 4699 } else if (value->m_unit == CSSParserValue::String) { |
4701 // Strings never share in a family name. | 4700 // Strings never share in a family name. |
4702 inFamily = false; | 4701 inFamily = false; |
4703 familyBuilder.commit(); | 4702 familyBuilder.commit(); |
4704 list->append(cssValuePool().createFontFamilyValue(value->string)); | 4703 list->append(cssValuePool().createFontFamilyValue(value->string)); |
4705 } else if (value->m_unit == CSSParserValue::Identifier) { | 4704 } else if (value->m_unit == CSSParserValue::Identifier) { |
4706 if (inFamily) | 4705 if (inFamily) |
4707 familyBuilder.add(value->string); | 4706 familyBuilder.add(value->string); |
4708 else if (nextValBreaksFont || !nextValIsFontName) | 4707 else if (nextValBreaksFont || !nextValIsFontName) |
4709 list->append(cssValuePool().createFontFamilyValue(value->string)
); | 4708 list->append(cssValuePool().createFontFamilyValue(value->string)
); |
4710 else { | 4709 else { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4846 | 4845 |
4847 CSSParserValue* value = m_valueList->next(); | 4846 CSSParserValue* value = m_valueList->next(); |
4848 if (!value || value->m_unit != CSSParserValue::Function || value->function->
id != CSSValueFormat) { | 4847 if (!value || value->m_unit != CSSParserValue::Function || value->function->
id != CSSValueFormat) { |
4849 valueList->append(uriValue.release()); | 4848 valueList->append(uriValue.release()); |
4850 return true; | 4849 return true; |
4851 } | 4850 } |
4852 | 4851 |
4853 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20111004/ says that format
() contains a comma-separated list of strings, | 4852 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20111004/ says that format
() contains a comma-separated list of strings, |
4854 // but CSSFontFaceSrcValue stores only one format. Allowing one format for n
ow. | 4853 // but CSSFontFaceSrcValue stores only one format. Allowing one format for n
ow. |
4855 CSSParserValueList* args = value->function->args.get(); | 4854 CSSParserValueList* args = value->function->args.get(); |
4856 if (!args || args->size() != 1 || (args->current()->unit() != CSSPrimitiveVa
lue::UnitType::String && args->current()->m_unit != CSSParserValue::Identifier)) | 4855 if (!args || args->size() != 1 || (args->current()->m_unit != CSSParserValue
::String && args->current()->m_unit != CSSParserValue::Identifier)) |
4857 return false; | 4856 return false; |
4858 uriValue->setFormat(args->current()->string); | 4857 uriValue->setFormat(args->current()->string); |
4859 valueList->append(uriValue.release()); | 4858 valueList->append(uriValue.release()); |
4860 m_valueList->next(); | 4859 m_valueList->next(); |
4861 return true; | 4860 return true; |
4862 } | 4861 } |
4863 | 4862 |
4864 bool CSSPropertyParser::parseFontFaceSrcLocal(CSSValueList* valueList) | 4863 bool CSSPropertyParser::parseFontFaceSrcLocal(CSSValueList* valueList) |
4865 { | 4864 { |
4866 CSSParserValueList* args = m_valueList->current()->function->args.get(); | 4865 CSSParserValueList* args = m_valueList->current()->function->args.get(); |
4867 if (!args || !args->size()) | 4866 if (!args || !args->size()) |
4868 return false; | 4867 return false; |
4869 m_valueList->next(); | 4868 m_valueList->next(); |
4870 | 4869 |
4871 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy = m_contex
t.shouldCheckContentSecurityPolicy(); | 4870 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy = m_contex
t.shouldCheckContentSecurityPolicy(); |
4872 if (args->size() == 1 && args->current()->unit() == CSSPrimitiveValue::UnitT
ype::String) { | 4871 if (args->size() == 1 && args->current()->m_unit == CSSParserValue::String)
{ |
4873 valueList->append(CSSFontFaceSrcValue::createLocal(args->current()->stri
ng, shouldCheckContentSecurityPolicy)); | 4872 valueList->append(CSSFontFaceSrcValue::createLocal(args->current()->stri
ng, shouldCheckContentSecurityPolicy)); |
4874 } else if (args->current()->m_unit == CSSParserValue::Identifier) { | 4873 } else if (args->current()->m_unit == CSSParserValue::Identifier) { |
4875 StringBuilder builder; | 4874 StringBuilder builder; |
4876 for (CSSParserValue* localValue = args->current(); localValue; localValu
e = args->next()) { | 4875 for (CSSParserValue* localValue = args->current(); localValue; localValu
e = args->next()) { |
4877 if (localValue->m_unit != CSSParserValue::Identifier) | 4876 if (localValue->m_unit != CSSParserValue::Identifier) |
4878 return false; | 4877 return false; |
4879 if (!builder.isEmpty()) | 4878 if (!builder.isEmpty()) |
4880 builder.append(' '); | 4879 builder.append(' '); |
4881 builder.append(localValue->string); | 4880 builder.append(localValue->string); |
4882 } | 4881 } |
4883 valueList->append(CSSFontFaceSrcValue::createLocal(builder.toString(), s
houldCheckContentSecurityPolicy)); | 4882 valueList->append(CSSFontFaceSrcValue::createLocal(builder.toString(), s
houldCheckContentSecurityPolicy)); |
4884 } else | 4883 } else |
4885 return false; | 4884 return false; |
4886 | 4885 |
4887 return true; | 4886 return true; |
4888 } | 4887 } |
4889 | 4888 |
4890 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFontFaceSrc() | 4889 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFontFaceSrc() |
4891 { | 4890 { |
4892 RefPtrWillBeRawPtr<CSSValueList> values(CSSValueList::createCommaSeparated()
); | 4891 RefPtrWillBeRawPtr<CSSValueList> values(CSSValueList::createCommaSeparated()
); |
4893 | 4892 |
4894 while (true) { | 4893 while (true) { |
4895 CSSParserValue* value = m_valueList->current(); | 4894 CSSParserValue* value = m_valueList->current(); |
4896 if (!value) | 4895 if (!value) |
4897 return nullptr; | 4896 return nullptr; |
4898 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 4897 if (value->m_unit == CSSParserValue::URI) { |
4899 if (!parseFontFaceSrcURI(values.get())) | 4898 if (!parseFontFaceSrcURI(values.get())) |
4900 return nullptr; | 4899 return nullptr; |
4901 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueLocal) { | 4900 } else if (value->m_unit == CSSParserValue::Function && value->function-
>id == CSSValueLocal) { |
4902 if (!parseFontFaceSrcLocal(values.get())) | 4901 if (!parseFontFaceSrcLocal(values.get())) |
4903 return nullptr; | 4902 return nullptr; |
4904 } else { | 4903 } else { |
4905 return nullptr; | 4904 return nullptr; |
4906 } | 4905 } |
4907 | 4906 |
4908 if (!m_valueList->current()) | 4907 if (!m_valueList->current()) |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5444 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) | 5443 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) |
5445 { | 5444 { |
5446 CSSPropertyParser::ShorthandScope scope(this, propId); | 5445 CSSPropertyParser::ShorthandScope scope(this, propId); |
5447 while (CSSParserValue* val = m_valueList->current()) { | 5446 while (CSSParserValue* val = m_valueList->current()) { |
5448 context.setCanAdvance(false); | 5447 context.setCanAdvance(false); |
5449 | 5448 |
5450 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo
rwardSlashOperator(val)) | 5449 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo
rwardSlashOperator(val)) |
5451 context.commitForwardSlashOperator(); | 5450 context.commitForwardSlashOperator(); |
5452 | 5451 |
5453 if (!context.canAdvance() && context.allowImage()) { | 5452 if (!context.canAdvance() && context.allowImage()) { |
5454 if (val->unit() == CSSPrimitiveValue::UnitType::URI) { | 5453 if (val->m_unit == CSSParserValue::URI) { |
5455 context.commitImage(createCSSImageValueWithReferrer(val->string,
m_context.completeURL(val->string))); | 5454 context.commitImage(createCSSImageValueWithReferrer(val->string,
m_context.completeURL(val->string))); |
5456 } else if (isGeneratedImageValue(val)) { | 5455 } else if (isGeneratedImageValue(val)) { |
5457 RefPtrWillBeRawPtr<CSSValue> value = nullptr; | 5456 RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
5458 if (parseGeneratedImage(m_valueList, value)) | 5457 if (parseGeneratedImage(m_valueList, value)) |
5459 context.commitImage(value.release()); | 5458 context.commitImage(value.release()); |
5460 else | 5459 else |
5461 return false; | 5460 return false; |
5462 } else if (val->m_unit == CSSParserValue::Function && val->function-
>id == CSSValueWebkitImageSet) { | 5461 } else if (val->m_unit == CSSParserValue::Function && val->function-
>id == CSSValueWebkitImageSet) { |
5463 RefPtrWillBeRawPtr<CSSValue> value = parseImageSet(m_valueList); | 5462 RefPtrWillBeRawPtr<CSSValue> value = parseImageSet(m_valueList); |
5464 if (value) | 5463 if (value) |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5845 } | 5844 } |
5846 | 5845 |
5847 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu
e) | 5846 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu
e) |
5848 { | 5847 { |
5849 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 5848 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
5850 | 5849 |
5851 while (m_valueList->current()) { | 5850 while (m_valueList->current()) { |
5852 CSSParserValue* val = m_valueList->current(); | 5851 CSSParserValue* val = m_valueList->current(); |
5853 if (val->m_unit != CSSParserValue::Identifier) | 5852 if (val->m_unit != CSSParserValue::Identifier) |
5854 return nullptr; | 5853 return nullptr; |
5855 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = createPrimitiveCusto
mIdentValue(val); | 5854 RefPtrWillBeRawPtr<CSSIdentValue> counterName = createPrimitiveCustomIde
ntValue(val); |
5856 m_valueList->next(); | 5855 m_valueList->next(); |
5857 | 5856 |
5858 val = m_valueList->current(); | 5857 val = m_valueList->current(); |
5859 int i = defaultValue; | 5858 int i = defaultValue; |
5860 if (val && validUnit(val, FInteger)) { | 5859 if (val && validUnit(val, FInteger)) { |
5861 i = clampTo<int>(val->fValue); | 5860 i = clampTo<int>(val->fValue); |
5862 m_valueList->next(); | 5861 m_valueList->next(); |
5863 } | 5862 } |
5864 | 5863 |
5865 list->append(CSSValuePair::create(counterName.release(), | 5864 list->append(CSSValuePair::create(counterName.release(), |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6675 return nullptr; | 6674 return nullptr; |
6676 | 6675 |
6677 CSSParserValueList* functionArgs = valueList->current()->function->args.get(
); | 6676 CSSParserValueList* functionArgs = valueList->current()->function->args.get(
); |
6678 if (!functionArgs || !functionArgs->size() || !functionArgs->current()) | 6677 if (!functionArgs || !functionArgs->size() || !functionArgs->current()) |
6679 return nullptr; | 6678 return nullptr; |
6680 | 6679 |
6681 RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create(); | 6680 RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create(); |
6682 | 6681 |
6683 while (functionArgs->current()) { | 6682 while (functionArgs->current()) { |
6684 CSSParserValue* arg = functionArgs->current(); | 6683 CSSParserValue* arg = functionArgs->current(); |
6685 if (arg->unit() != CSSPrimitiveValue::UnitType::URI) | 6684 if (arg->m_unit != CSSParserValue::URI) |
6686 return nullptr; | 6685 return nullptr; |
6687 | 6686 |
6688 RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg
->string, completeURL(arg->string)); | 6687 RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg
->string, completeURL(arg->string)); |
6689 imageSet->append(image); | 6688 imageSet->append(image); |
6690 | 6689 |
6691 arg = functionArgs->next(); | 6690 arg = functionArgs->next(); |
6692 if (!arg) | 6691 if (!arg) |
6693 return nullptr; | 6692 return nullptr; |
6694 | 6693 |
6695 if (arg->m_unit != CSSParserValue::DimensionList) | 6694 if (arg->m_unit != CSSParserValue::DimensionList) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6850 } | 6849 } |
6851 | 6850 |
6852 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter() | 6851 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter() |
6853 { | 6852 { |
6854 if (!m_valueList) | 6853 if (!m_valueList) |
6855 return nullptr; | 6854 return nullptr; |
6856 | 6855 |
6857 // The filter is a list of functional primitives that specify individual ope
rations. | 6856 // The filter is a list of functional primitives that specify individual ope
rations. |
6858 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 6857 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
6859 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 6858 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
6860 if (value->unit() != CSSPrimitiveValue::UnitType::URI && (value->m_unit
!= CSSParserValue::Function || !value->function)) | 6859 if (value->m_unit != CSSParserValue::URI && (value->m_unit != CSSParserV
alue::Function || !value->function)) |
6861 return nullptr; | 6860 return nullptr; |
6862 | 6861 |
6863 // See if the specified primitive is one we understand. | 6862 // See if the specified primitive is one we understand. |
6864 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 6863 if (value->m_unit == CSSParserValue::URI) { |
6865 RefPtrWillBeRawPtr<CSSFunctionValue> referenceFilterValue = CSSFunct
ionValue::create(CSSValueUrl); | 6864 RefPtrWillBeRawPtr<CSSFunctionValue> referenceFilterValue = CSSFunct
ionValue::create(CSSValueUrl); |
6866 referenceFilterValue->append(CSSSVGDocumentValue::create(value->stri
ng)); | 6865 referenceFilterValue->append(CSSSVGDocumentValue::create(value->stri
ng)); |
6867 list->append(referenceFilterValue.release()); | 6866 list->append(referenceFilterValue.release()); |
6868 } else { | 6867 } else { |
6869 CSSValueID filterType = value->function->id; | 6868 CSSValueID filterType = value->function->id; |
6870 unsigned maximumArgumentCount = filterType == CSSValueDropShadow ? 4
: 1; | 6869 unsigned maximumArgumentCount = filterType == CSSValueDropShadow ? 4
: 1; |
6871 | 6870 |
6872 CSSParserValueList* args = value->function->args.get(); | 6871 CSSParserValueList* args = value->function->args.get(); |
6873 if (!args || args->size() > maximumArgumentCount) | 6872 if (!args || args->size() > maximumArgumentCount) |
6874 return nullptr; | 6873 return nullptr; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7034 return list.release(); | 7033 return list.release(); |
7035 return nullptr; | 7034 return nullptr; |
7036 } | 7035 } |
7037 | 7036 |
7038 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle() | 7037 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle() |
7039 { | 7038 { |
7040 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr; | 7039 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr; |
7041 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr; | 7040 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr; |
7042 | 7041 |
7043 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 7042 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
7044 if (value->unit() == CSSPrimitiveValue::UnitType::String) { | 7043 if (value->m_unit == CSSParserValue::String) { |
7045 if (fill || shape) | 7044 if (fill || shape) |
7046 return nullptr; | 7045 return nullptr; |
7047 m_valueList->next(); | 7046 m_valueList->next(); |
7048 return createPrimitiveStringValue(value); | 7047 return createPrimitiveStringValue(value); |
7049 } | 7048 } |
7050 | 7049 |
7051 if (value->id == CSSValueNone) { | 7050 if (value->id == CSSValueNone) { |
7052 if (fill || shape) | 7051 if (fill || shape) |
7053 return nullptr; | 7052 return nullptr; |
7054 m_valueList->next(); | 7053 m_valueList->next(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7121 return list.release(); | 7120 return list.release(); |
7122 } | 7121 } |
7123 | 7122 |
7124 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings) | 7123 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings) |
7125 { | 7124 { |
7126 // Feature tag name consists of 4-letter characters. | 7125 // Feature tag name consists of 4-letter characters. |
7127 static const unsigned tagNameLength = 4; | 7126 static const unsigned tagNameLength = 4; |
7128 | 7127 |
7129 CSSParserValue* value = m_valueList->current(); | 7128 CSSParserValue* value = m_valueList->current(); |
7130 // Feature tag name comes first | 7129 // Feature tag name comes first |
7131 if (value->unit() != CSSPrimitiveValue::UnitType::String) | 7130 if (value->m_unit != CSSParserValue::String) |
7132 return false; | 7131 return false; |
7133 if (value->string.length() != tagNameLength) | 7132 if (value->string.length() != tagNameLength) |
7134 return false; | 7133 return false; |
7135 for (unsigned i = 0; i < tagNameLength; ++i) { | 7134 for (unsigned i = 0; i < tagNameLength; ++i) { |
7136 // Limits the range of characters to 0x20-0x7E, following the tag name r
ules defiend in the OpenType specification. | 7135 // Limits the range of characters to 0x20-0x7E, following the tag name r
ules defiend in the OpenType specification. |
7137 UChar character = value->string[i]; | 7136 UChar character = value->string[i]; |
7138 if (character < 0x20 || character > 0x7E) | 7137 if (character < 0x20 || character > 0x7E) |
7139 return false; | 7138 return false; |
7140 } | 7139 } |
7141 | 7140 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7471 break; | 7470 break; |
7472 | 7471 |
7473 case CSSPropertyClipPath: | 7472 case CSSPropertyClipPath: |
7474 case CSSPropertyFilter: | 7473 case CSSPropertyFilter: |
7475 case CSSPropertyMarkerStart: | 7474 case CSSPropertyMarkerStart: |
7476 case CSSPropertyMarkerMid: | 7475 case CSSPropertyMarkerMid: |
7477 case CSSPropertyMarkerEnd: | 7476 case CSSPropertyMarkerEnd: |
7478 case CSSPropertyMask: | 7477 case CSSPropertyMask: |
7479 if (id == CSSValueNone) { | 7478 if (id == CSSValueNone) { |
7480 validPrimitive = true; | 7479 validPrimitive = true; |
7481 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 7480 } else if (value->m_unit == CSSParserValue::URI) { |
7482 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::UnitType::URI); | 7481 parsedValue = CSSURIValue::create(value->string); |
7483 if (parsedValue) | 7482 if (parsedValue) |
7484 m_valueList->next(); | 7483 m_valueList->next(); |
7485 } | 7484 } |
7486 break; | 7485 break; |
7487 | 7486 |
7488 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit | 7487 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit |
7489 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode); | 7488 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode); |
7490 break; | 7489 break; |
7491 | 7490 |
7492 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit | 7491 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit |
(...skipping 20 matching lines...) Expand all Loading... |
7513 if (parsedValue) | 7512 if (parsedValue) |
7514 m_valueList->next(); | 7513 m_valueList->next(); |
7515 } | 7514 } |
7516 break; | 7515 break; |
7517 | 7516 |
7518 case CSSPropertyFill: // <paint> | inherit | 7517 case CSSPropertyFill: // <paint> | inherit |
7519 case CSSPropertyStroke: // <paint> | inherit | 7518 case CSSPropertyStroke: // <paint> | inherit |
7520 { | 7519 { |
7521 if (id == CSSValueNone) { | 7520 if (id == CSSValueNone) { |
7522 parsedValue = cssValuePool().createIdentifierValue(id); | 7521 parsedValue = cssValuePool().createIdentifierValue(id); |
7523 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { | 7522 } else if (value->m_unit == CSSParserValue::URI) { |
7524 if (m_valueList->next()) { | 7523 if (m_valueList->next()) { |
7525 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea
teSpaceSeparated(); | 7524 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea
teSpaceSeparated(); |
7526 values->append(CSSPrimitiveValue::create(value->string, CSSP
rimitiveValue::UnitType::URI)); | 7525 values->append(CSSURIValue::create(value->string)); |
7527 if (m_valueList->current()->id == CSSValueNone) | 7526 if (m_valueList->current()->id == CSSValueNone) |
7528 parsedValue = cssValuePool().createIdentifierValue(m_val
ueList->current()->id); | 7527 parsedValue = cssValuePool().createIdentifierValue(m_val
ueList->current()->id); |
7529 else | 7528 else |
7530 parsedValue = parseColor(m_valueList->current()); | 7529 parsedValue = parseColor(m_valueList->current()); |
7531 if (parsedValue) { | 7530 if (parsedValue) { |
7532 values->append(parsedValue); | 7531 values->append(parsedValue); |
7533 parsedValue = values; | 7532 parsedValue = values; |
7534 } | 7533 } |
7535 } | 7534 } |
7536 if (!parsedValue) | 7535 if (!parsedValue) |
7537 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr
imitiveValue::UnitType::URI); | 7536 parsedValue = CSSURIValue::create(value->string); |
7538 } else { | 7537 } else { |
7539 parsedValue = parseColor(m_valueList->current()); | 7538 parsedValue = parseColor(m_valueList->current()); |
7540 } | 7539 } |
7541 | 7540 |
7542 if (parsedValue) | 7541 if (parsedValue) |
7543 m_valueList->next(); | 7542 m_valueList->next(); |
7544 } | 7543 } |
7545 break; | 7544 break; |
7546 | 7545 |
7547 case CSSPropertyStopColor: // TODO : icccolor | 7546 case CSSPropertyStopColor: // TODO : icccolor |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7596 default: | 7595 default: |
7597 // If you crash here, it's because you added a css property and are not
handling it | 7596 // If you crash here, it's because you added a css property and are not
handling it |
7598 // in either this switch statement or the one in CSSPropertyParser::pars
eValue | 7597 // in either this switch statement or the one in CSSPropertyParser::pars
eValue |
7599 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); | 7598 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); |
7600 return false; | 7599 return false; |
7601 } | 7600 } |
7602 | 7601 |
7603 if (validPrimitive) { | 7602 if (validPrimitive) { |
7604 if (id) | 7603 if (id) |
7605 parsedValue = CSSPrimitiveValue::createIdentifier(id); | 7604 parsedValue = CSSPrimitiveValue::createIdentifier(id); |
7606 else if (value->unit() == CSSPrimitiveValue::UnitType::String) | 7605 else if (value->m_unit == CSSParserValue::String) |
7607 parsedValue = CSSPrimitiveValue::create(value->string, value->unit()
); | 7606 parsedValue = CSSStringValue::create(value->string); |
7608 else if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->
unit() <= CSSPrimitiveValue::UnitType::Kilohertz) | 7607 else if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->
unit() <= CSSPrimitiveValue::UnitType::Kilohertz) |
7609 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); | 7608 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); |
7610 else if (value->unit() == CSSPrimitiveValue::UnitType::Rems || value->un
it() == CSSPrimitiveValue::UnitType::Chs) | 7609 else if (value->unit() == CSSPrimitiveValue::UnitType::Rems || value->un
it() == CSSPrimitiveValue::UnitType::Chs) |
7611 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); | 7610 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit()
); |
7612 else if (value->unit() == CSSPrimitiveValue::UnitType::QuirkyEms) | 7611 else if (value->unit() == CSSPrimitiveValue::UnitType::QuirkyEms) |
7613 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::UnitType::QuirkyEms); | 7612 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::UnitType::QuirkyEms); |
7614 if (isCalculation(value)) { | 7613 if (isCalculation(value)) { |
7615 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri
mitiveValue here, ie | 7614 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri
mitiveValue here, ie |
7616 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea
se()); | 7615 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea
se()); |
7617 m_parsedCalculation.release(); | 7616 m_parsedCalculation.release(); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7904 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. | 7903 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. |
7905 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV
aluePath) | 7904 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV
aluePath) |
7906 return nullptr; | 7905 return nullptr; |
7907 | 7906 |
7908 // FIXME: Add support for <fill-rule>. | 7907 // FIXME: Add support for <fill-rule>. |
7909 CSSParserValueList* functionArgs = value->function->args.get(); | 7908 CSSParserValueList* functionArgs = value->function->args.get(); |
7910 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) | 7909 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) |
7911 return nullptr; | 7910 return nullptr; |
7912 | 7911 |
7913 CSSParserValue* arg = functionArgs->current(); | 7912 CSSParserValue* arg = functionArgs->current(); |
7914 if (arg->unit() != CSSPrimitiveValue::UnitType::String) | 7913 if (arg->m_unit != CSSParserValue::String) |
7915 return nullptr; | 7914 return nullptr; |
7916 | 7915 |
7917 String pathString = arg->string; | 7916 String pathString = arg->string; |
7918 Path path; | 7917 Path path; |
7919 if (!buildPathFromString(pathString, path)) | 7918 if (!buildPathFromString(pathString, path)) |
7920 return nullptr; | 7919 return nullptr; |
7921 | 7920 |
7922 m_valueList->next(); | 7921 m_valueList->next(); |
7923 return CSSPathValue::create(pathString); | 7922 return CSSPathValue::create(pathString); |
7924 } | 7923 } |
(...skipping 16 matching lines...) Expand all Loading... |
7941 } | 7940 } |
7942 } | 7941 } |
7943 | 7942 |
7944 if (!list->length()) | 7943 if (!list->length()) |
7945 return nullptr; | 7944 return nullptr; |
7946 | 7945 |
7947 return list.release(); | 7946 return list.release(); |
7948 } | 7947 } |
7949 | 7948 |
7950 } // namespace blink | 7949 } // namespace blink |
OLD | NEW |