Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 1306823004: Split out String, URI and CustomIdent from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_out_attr_values
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/css/CSSImageValue.h" 43 #include "core/css/CSSImageValue.h"
44 #include "core/css/CSSLineBoxContainValue.h" 44 #include "core/css/CSSLineBoxContainValue.h"
45 #include "core/css/CSSPathValue.h" 45 #include "core/css/CSSPathValue.h"
46 #include "core/css/CSSPrimitiveValueMappings.h" 46 #include "core/css/CSSPrimitiveValueMappings.h"
47 #include "core/css/CSSProperty.h" 47 #include "core/css/CSSProperty.h"
48 #include "core/css/CSSPropertyMetadata.h" 48 #include "core/css/CSSPropertyMetadata.h"
49 #include "core/css/CSSQuadValue.h" 49 #include "core/css/CSSQuadValue.h"
50 #include "core/css/CSSReflectValue.h" 50 #include "core/css/CSSReflectValue.h"
51 #include "core/css/CSSSVGDocumentValue.h" 51 #include "core/css/CSSSVGDocumentValue.h"
52 #include "core/css/CSSShadowValue.h" 52 #include "core/css/CSSShadowValue.h"
53 #include "core/css/CSSStringValue.h"
53 #include "core/css/CSSTimingFunctionValue.h" 54 #include "core/css/CSSTimingFunctionValue.h"
54 #include "core/css/CSSUnicodeRangeValue.h" 55 #include "core/css/CSSUnicodeRangeValue.h"
55 #include "core/css/CSSValuePair.h" 56 #include "core/css/CSSValuePair.h"
56 #include "core/css/CSSValuePool.h" 57 #include "core/css/CSSValuePool.h"
57 #include "core/css/HashTools.h" 58 #include "core/css/HashTools.h"
58 #include "core/css/parser/CSSParserFastPaths.h" 59 #include "core/css/parser/CSSParserFastPaths.h"
59 #include "core/css/parser/CSSParserValues.h" 60 #include "core/css/parser/CSSParserValues.h"
60 #include "core/frame/UseCounter.h" 61 #include "core/frame/UseCounter.h"
61 #include "core/layout/LayoutTheme.h" 62 #include "core/layout/LayoutTheme.h"
62 #include "core/style/GridCoordinate.h" 63 #include "core/style/GridCoordinate.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return CSSPrimitiveValue::create(m_parsedCalculation.release()); 301 return CSSPrimitiveValue::create(m_parsedCalculation.release());
301 } 302 }
302 303
303 ASSERT((value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit( ) <= CSSPrimitiveValue::UnitType::Kilohertz) 304 ASSERT((value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit( ) <= CSSPrimitiveValue::UnitType::Kilohertz)
304 || (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit() <= CSSPrimitiveValue::UnitType::Chs) 305 || (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit() <= CSSPrimitiveValue::UnitType::Chs)
305 || (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value ->unit() <= CSSPrimitiveValue::UnitType::ViewportMax) 306 || (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value ->unit() <= CSSPrimitiveValue::UnitType::ViewportMax)
306 || (value->unit() >= CSSPrimitiveValue::UnitType::DotsPerPixel && value- >unit() <= CSSPrimitiveValue::UnitType::DotsPerCentimeter)); 307 || (value->unit() >= CSSPrimitiveValue::UnitType::DotsPerPixel && value- >unit() <= CSSPrimitiveValue::UnitType::DotsPerCentimeter));
307 return cssValuePool().createValue(value->fValue, value->unit()); 308 return cssValuePool().createValue(value->fValue, value->unit());
308 } 309 }
309 310
310 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit iveStringValue(CSSParserValue* value) 311 inline PassRefPtrWillBeRawPtr<CSSStringValue> CSSPropertyParser::createPrimitive StringValue(CSSParserValue* value)
311 { 312 {
312 ASSERT(value->unit() == CSSPrimitiveValue::UnitType::String || value->m_unit == CSSParserValue::Identifier); 313 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser Value::Identifier);
313 return cssValuePool().createValue(value->string, CSSPrimitiveValue::UnitType ::String); 314 return CSSStringValue::create(value->string, CSSStringValue::SerializeAsStri ng);
314 } 315 }
315 316
316 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit iveCustomIdentValue(CSSParserValue* value) 317 inline PassRefPtrWillBeRawPtr<CSSStringValue> CSSPropertyParser::createPrimitive CustomIdentValue(CSSParserValue* value)
317 { 318 {
318 ASSERT(value->unit() == CSSPrimitiveValue::UnitType::String || value->m_unit == CSSParserValue::Identifier); 319 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser Value::Identifier);
319 return cssValuePool().createValue(value->string, CSSPrimitiveValue::UnitType ::CustomIdentifier); 320 return CSSStringValue::create(value->string, CSSStringValue::SerializeAsCust omIdentifier);
320 } 321 }
321 322
322 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi thReferrer(const String& rawValue, const KURL& url) 323 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi thReferrer(const String& rawValue, const KURL& url)
323 { 324 {
324 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur l); 325 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur l);
325 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); 326 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer());
326 return imageValue; 327 return imageValue;
327 } 328 }
328 329
329 static inline bool isComma(CSSParserValue* value) 330 static inline bool isComma(CSSParserValue* value)
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 // Grammar defined by CSS3 UI and modified by CSS4 images: 589 // Grammar defined by CSS3 UI and modified by CSS4 images:
589 // [ [<image> [<x> <y>]?,]* 590 // [ [<image> [<x> <y>]?,]*
590 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize | 591 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize |
591 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize | 592 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize |
592 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex t | wait | help | 593 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex t | wait | help |
593 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al lowed | all-scroll | 594 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al lowed | all-scroll |
594 // zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-i n | -webkit-zoom-out ] ] | inherit 595 // zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-i n | -webkit-zoom-out ] ] | inherit
595 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; 596 RefPtrWillBeRawPtr<CSSValueList> list = nullptr;
596 while (value) { 597 while (value) {
597 RefPtrWillBeRawPtr<CSSValue> image = nullptr; 598 RefPtrWillBeRawPtr<CSSValue> image = nullptr;
598 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 599 if (value->m_unit == CSSParserValue::URI) {
599 String uri = value->string; 600 String uri = value->string;
600 if (!uri.isNull()) 601 if (!uri.isNull())
601 image = createCSSImageValueWithReferrer(uri, completeURL(uri )); 602 image = createCSSImageValueWithReferrer(uri, completeURL(uri ));
602 } else if (value->m_unit == CSSParserValue::Function && value->funct ion->id == CSSValueWebkitImageSet) { 603 } else if (value->m_unit == CSSParserValue::Function && value->funct ion->id == CSSValueWebkitImageSet) {
603 image = parseImageSet(m_valueList); 604 image = parseImageSet(m_valueList);
604 if (!image) 605 if (!image)
605 break; 606 break;
606 } else 607 } else
607 break; 608 break;
608 609
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 718 }
718 case CSSPropertyObjectPosition: 719 case CSSPropertyObjectPosition:
719 parsedValue = parsePosition(m_valueList); 720 parsedValue = parsePosition(m_valueList);
720 break; 721 break;
721 case CSSPropertyListStyleImage: // <uri> | none | inherit 722 case CSSPropertyListStyleImage: // <uri> | none | inherit
722 case CSSPropertyBorderImageSource: 723 case CSSPropertyBorderImageSource:
723 case CSSPropertyWebkitMaskBoxImageSource: 724 case CSSPropertyWebkitMaskBoxImageSource:
724 if (id == CSSValueNone) { 725 if (id == CSSValueNone) {
725 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); 726 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone);
726 m_valueList->next(); 727 m_valueList->next();
727 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 728 } else if (value->m_unit == CSSParserValue::URI) {
728 parsedValue = createCSSImageValueWithReferrer(value->string, complet eURL(value->string)); 729 parsedValue = createCSSImageValueWithReferrer(value->string, complet eURL(value->string));
729 m_valueList->next(); 730 m_valueList->next();
730 } else if (isGeneratedImageValue(value)) { 731 } else if (isGeneratedImageValue(value)) {
731 if (parseGeneratedImage(m_valueList, parsedValue)) 732 if (parseGeneratedImage(m_valueList, parsedValue))
732 m_valueList->next(); 733 m_valueList->next();
733 else 734 else
734 return false; 735 return false;
735 } else if (value->m_unit == CSSParserValue::Function && value->function- >id == CSSValueWebkitImageSet) { 736 } else if (value->m_unit == CSSParserValue::Function && value->function- >id == CSSValueWebkitImageSet) {
736 parsedValue = parseImageSet(m_valueList); 737 parsedValue = parseImageSet(m_valueList);
737 if (!parsedValue) 738 if (!parsedValue)
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 validPrimitive = (!id && !isCalculation(value) && validUnit(value, FInte ger | FPercent | FNonNeg) && (value->unit() == CSSPrimitiveValue::UnitType::Perc entage || value->fValue)); 1335 validPrimitive = (!id && !isCalculation(value) && validUnit(value, FInte ger | FPercent | FNonNeg) && (value->unit() == CSSPrimitiveValue::UnitType::Perc entage || value->fValue));
1335 break; 1336 break;
1336 1337
1337 case CSSPropertyWebkitFontSizeDelta: // <length> 1338 case CSSPropertyWebkitFontSizeDelta: // <length>
1338 validPrimitive = validUnit(value, FLength | FUnitlessQuirk); 1339 validPrimitive = validUnit(value, FLength | FUnitlessQuirk);
1339 break; 1340 break;
1340 1341
1341 case CSSPropertyWebkitHighlight: 1342 case CSSPropertyWebkitHighlight:
1342 if (id == CSSValueNone) { 1343 if (id == CSSValueNone) {
1343 validPrimitive = true; 1344 validPrimitive = true;
1344 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { 1345 } else if (value->m_unit == CSSParserValue::String) {
1345 parsedValue = createPrimitiveStringValue(value); 1346 parsedValue = createPrimitiveStringValue(value);
1346 m_valueList->next(); 1347 m_valueList->next();
1347 } 1348 }
1348 break; 1349 break;
1349 1350
1350 case CSSPropertyWebkitHyphenateCharacter: 1351 case CSSPropertyWebkitHyphenateCharacter:
1351 case CSSPropertyWebkitLocale: 1352 case CSSPropertyWebkitLocale:
1352 if (id == CSSValueAuto) { 1353 if (id == CSSValueAuto) {
1353 validPrimitive = true; 1354 validPrimitive = true;
1354 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { 1355 } else if (value->m_unit == CSSParserValue::String) {
1355 parsedValue = createPrimitiveStringValue(value); 1356 parsedValue = createPrimitiveStringValue(value);
1356 m_valueList->next(); 1357 m_valueList->next();
1357 } 1358 }
1358 break; 1359 break;
1359 1360
1360 // End Apple-specific properties 1361 // End Apple-specific properties
1361 1362
1362 case CSSPropertyWebkitAppRegion: 1363 case CSSPropertyWebkitAppRegion:
1363 if (id >= CSSValueDrag && id <= CSSValueNoDrag) 1364 if (id >= CSSValueDrag && id <= CSSValueNoDrag)
1364 validPrimitive = true; 1365 validPrimitive = true;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 if (id == CSSValueNormal) 1490 if (id == CSSValueNormal)
1490 validPrimitive = true; 1491 validPrimitive = true;
1491 else 1492 else
1492 return parseFontVariantLigatures(important); 1493 return parseFontVariantLigatures(important);
1493 break; 1494 break;
1494 case CSSPropertyWebkitClipPath: 1495 case CSSPropertyWebkitClipPath:
1495 if (id == CSSValueNone) { 1496 if (id == CSSValueNone) {
1496 validPrimitive = true; 1497 validPrimitive = true;
1497 } else if (value->m_unit == CSSParserValue::Function) { 1498 } else if (value->m_unit == CSSParserValue::Function) {
1498 parsedValue = parseBasicShape(); 1499 parsedValue = parseBasicShape();
1499 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 1500 } else if (value->m_unit == CSSParserValue::URI) {
1500 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV alue::UnitType::URI); 1501 parsedValue = CSSStringValue::create(value->string, CSSStringValue:: SerializeAsURI);
1501 addProperty(propId, parsedValue.release(), important); 1502 addProperty(propId, parsedValue.release(), important);
1502 return true; 1503 return true;
1503 } 1504 }
1504 break; 1505 break;
1505 case CSSPropertyShapeOutside: 1506 case CSSPropertyShapeOutside:
1506 if (id == CSSValueNone) 1507 if (id == CSSValueNone)
1507 validPrimitive = true; 1508 validPrimitive = true;
1508 else 1509 else
1509 parsedValue = parseShapeProperty(propId); 1510 parsedValue = parseShapeProperty(propId);
1510 break; 1511 break;
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() 2096 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate()
2096 { 2097 {
2097 if (m_valueList->current()->id == CSSValueNone) { 2098 if (m_valueList->current()->id == CSSValueNone) {
2098 m_valueList->next(); 2099 m_valueList->next();
2099 return cssValuePool().createIdentifierValue(CSSValueNone); 2100 return cssValuePool().createIdentifierValue(CSSValueNone);
2100 } 2101 }
2101 2102
2102 return parsePositionList(m_valueList); 2103 return parsePositionList(m_valueList);
2103 } 2104 }
2104 2105
2105 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parsePage() 2106 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePage()
2106 { 2107 {
2107 CSSParserValue* value = m_valueList->current(); 2108 CSSParserValue* value = m_valueList->current();
2108 m_valueList->next(); 2109 m_valueList->next();
2109 ASSERT(value); 2110 ASSERT(value);
2110 2111
2111 if (value->id == CSSValueAuto) 2112 if (value->id == CSSValueAuto)
2112 return cssValuePool().createIdentifierValue(value->id); 2113 return cssValuePool().createIdentifierValue(value->id);
2113 if (value->m_unit == CSSParserValue::Identifier) 2114 if (value->m_unit == CSSParserValue::Identifier)
2114 return createPrimitiveCustomIdentValue(value); 2115 return createPrimitiveCustomIdentValue(value);
2115 return nullptr; 2116 return nullptr;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 return None; 2181 return None;
2181 } 2182 }
2182 } 2183 }
2183 2184
2184 // [ <string> <string> ]+ | none, but none is handled in parseValue 2185 // [ <string> <string> ]+ | none, but none is handled in parseValue
2185 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes() 2186 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes()
2186 { 2187 {
2187 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated (); 2188 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated ();
2188 while (CSSParserValue* val = m_valueList->current()) { 2189 while (CSSParserValue* val = m_valueList->current()) {
2189 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; 2190 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
2190 if (val->unit() != CSSPrimitiveValue::UnitType::String) 2191 if (val->m_unit != CSSParserValue::String)
2191 return nullptr; 2192 return nullptr;
2192 parsedValue = createPrimitiveStringValue(val); 2193 parsedValue = createPrimitiveStringValue(val);
2193 values->append(parsedValue.release()); 2194 values->append(parsedValue.release());
2194 m_valueList->next(); 2195 m_valueList->next();
2195 } 2196 }
2196 if (values->length() && values->length() % 2 == 0) 2197 if (values->length() && values->length() % 2 == 0)
2197 return values.release(); 2198 return values.release();
2198 return nullptr; 2199 return nullptr;
2199 } 2200 }
2200 2201
2201 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit 2202 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit
2202 // in CSS 2.1 this got somewhat reduced: 2203 // in CSS 2.1 this got somewhat reduced:
2203 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu ote ]+ | inherit 2204 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu ote ]+ | inherit
2204 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent() 2205 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent()
2205 { 2206 {
2206 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated (); 2207 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated ();
2207 2208
2208 while (CSSParserValue* val = m_valueList->current()) { 2209 while (CSSParserValue* val = m_valueList->current()) {
2209 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; 2210 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
2210 if (val->unit() == CSSPrimitiveValue::UnitType::URI) { 2211 if (val->m_unit == CSSParserValue::URI) {
2211 // url 2212 // url
2212 parsedValue = createCSSImageValueWithReferrer(val->string, completeU RL(val->string)); 2213 parsedValue = createCSSImageValueWithReferrer(val->string, completeU RL(val->string));
2213 } else if (val->m_unit == CSSParserValue::Function) { 2214 } else if (val->m_unit == CSSParserValue::Function) {
2214 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie nt(...) 2215 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie nt(...)
2215 CSSParserValueList* args = val->function->args.get(); 2216 CSSParserValueList* args = val->function->args.get();
2216 if (!args) 2217 if (!args)
2217 return nullptr; 2218 return nullptr;
2218 if (val->function->id == CSSValueAttr) { 2219 if (val->function->id == CSSValueAttr) {
2219 parsedValue = parseAttr(args); 2220 parsedValue = parseAttr(args);
2220 } else if (val->function->id == CSSValueCounter) { 2221 } else if (val->function->id == CSSValueCounter) {
(...skipping 11 matching lines...) Expand all
2232 case CSSValueOpenQuote: 2233 case CSSValueOpenQuote:
2233 case CSSValueCloseQuote: 2234 case CSSValueCloseQuote:
2234 case CSSValueNoOpenQuote: 2235 case CSSValueNoOpenQuote:
2235 case CSSValueNoCloseQuote: 2236 case CSSValueNoCloseQuote:
2236 case CSSValueNone: 2237 case CSSValueNone:
2237 case CSSValueNormal: 2238 case CSSValueNormal:
2238 parsedValue = cssValuePool().createIdentifierValue(val->id); 2239 parsedValue = cssValuePool().createIdentifierValue(val->id);
2239 default: 2240 default:
2240 break; 2241 break;
2241 } 2242 }
2242 } else if (val->unit() == CSSPrimitiveValue::UnitType::String) { 2243 } else if (val->m_unit == CSSParserValue::String) {
2243 parsedValue = createPrimitiveStringValue(val); 2244 parsedValue = createPrimitiveStringValue(val);
2244 } 2245 }
2245 if (!parsedValue) 2246 if (!parsedValue)
2246 return nullptr; 2247 return nullptr;
2247 values->append(parsedValue.release()); 2248 values->append(parsedValue.release());
2248 m_valueList->next(); 2249 m_valueList->next();
2249 } 2250 }
2250 2251
2251 return values.release(); 2252 return values.release();
2252 } 2253 }
(...skipping 12 matching lines...) Expand all
2265 // CSS allows identifiers with "-" at the start, like "-webkit-mask-image". 2266 // CSS allows identifiers with "-" at the start, like "-webkit-mask-image".
2266 // But HTML attribute names can't have those characters, and we should not 2267 // But HTML attribute names can't have those characters, and we should not
2267 // even parse them inside attr(). 2268 // even parse them inside attr().
2268 if (attrName[0] == '-') 2269 if (attrName[0] == '-')
2269 return nullptr; 2270 return nullptr;
2270 2271
2271 if (m_context.isHTMLDocument()) 2272 if (m_context.isHTMLDocument())
2272 attrName = attrName.lower(); 2273 attrName = attrName.lower();
2273 2274
2274 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS SValueAttr); 2275 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS SValueAttr);
2275 attrValue->append(CSSPrimitiveValue::create(attrName, CSSPrimitiveValue::Uni tType::CustomIdentifier)); 2276 attrValue->append(CSSStringValue::create(attrName, CSSStringValue::Serialize AsCustomIdentifier));
2276 return attrValue.release(); 2277 return attrValue.release();
2277 } 2278 }
2278 2279
2279 bool CSSPropertyParser::acceptQuirkyColors(CSSPropertyID propertyId) const 2280 bool CSSPropertyParser::acceptQuirkyColors(CSSPropertyID propertyId) const
2280 { 2281 {
2281 if (!inQuirksMode()) 2282 if (!inQuirksMode())
2282 return false; 2283 return false;
2283 switch (propertyId) { 2284 switch (propertyId) {
2284 case CSSPropertyBackgroundColor: 2285 case CSSPropertyBackgroundColor:
2285 case CSSPropertyBorderBottomColor: 2286 case CSSPropertyBorderBottomColor:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 return nullptr; 2338 return nullptr;
2338 return cssValuePool().createColorValue(c); 2339 return cssValuePool().createColorValue(c);
2339 } 2340 }
2340 2341
2341 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill BeRawPtr<CSSValue>& value) 2342 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill BeRawPtr<CSSValue>& value)
2342 { 2343 {
2343 if (valueList->current()->id == CSSValueNone) { 2344 if (valueList->current()->id == CSSValueNone) {
2344 value = cssValuePool().createIdentifierValue(CSSValueNone); 2345 value = cssValuePool().createIdentifierValue(CSSValueNone);
2345 return true; 2346 return true;
2346 } 2347 }
2347 if (valueList->current()->unit() == CSSPrimitiveValue::UnitType::URI) { 2348 if (valueList->current()->m_unit == CSSParserValue::URI) {
2348 value = createCSSImageValueWithReferrer(valueList->current()->string, co mpleteURL(valueList->current()->string)); 2349 value = createCSSImageValueWithReferrer(valueList->current()->string, co mpleteURL(valueList->current()->string));
2349 return true; 2350 return true;
2350 } 2351 }
2351 2352
2352 if (isGeneratedImageValue(valueList->current())) 2353 if (isGeneratedImageValue(valueList->current()))
2353 return parseGeneratedImage(valueList, value); 2354 return parseGeneratedImage(valueList, value);
2354 2355
2355 if (valueList->current()->m_unit == CSSParserValue::Function && valueList->c urrent()->function->id == CSSValueWebkitImageSet) { 2356 if (valueList->current()->m_unit == CSSParserValue::Function && valueList->c urrent()->function->id == CSSValueWebkitImageSet) {
2356 value = parseImageSet(m_valueList); 2357 value = parseImageSet(m_valueList);
2357 if (value) 2358 if (value)
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo wQuotedName) 3027 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo wQuotedName)
3027 { 3028 {
3028 CSSParserValue* value = m_valueList->current(); 3029 CSSParserValue* value = m_valueList->current();
3029 3030
3030 if (value->id == CSSValueNone) 3031 if (value->id == CSSValueNone)
3031 return cssValuePool().createIdentifierValue(CSSValueNone); 3032 return cssValuePool().createIdentifierValue(CSSValueNone);
3032 3033
3033 if (value->m_unit == CSSParserValue::Identifier) 3034 if (value->m_unit == CSSParserValue::Identifier)
3034 return createPrimitiveCustomIdentValue(value); 3035 return createPrimitiveCustomIdentValue(value);
3035 3036
3036 if (allowQuotedName && value->unit() == CSSPrimitiveValue::UnitType::String) { 3037 if (allowQuotedName && value->m_unit == CSSParserValue::String) {
3037 // Legacy support for strings in prefixed animations 3038 // Legacy support for strings in prefixed animations
3038 if (m_context.useCounter()) 3039 if (m_context.useCounter())
3039 m_context.useCounter()->count(UseCounter::QuotedAnimationName); 3040 m_context.useCounter()->count(UseCounter::QuotedAnimationName);
3040 if (equalIgnoringCase(value->string, "none")) 3041 if (equalIgnoringCase(value->string, "none"))
3041 return cssValuePool().createIdentifierValue(CSSValueNone); 3042 return cssValuePool().createIdentifierValue(CSSValueNone);
3042 return createPrimitiveCustomIdentValue(value); 3043 return createPrimitiveCustomIdentValue(value);
3043 } 3044 }
3044 3045
3045 return nullptr; 3046 return nullptr;
3046 } 3047 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
3232 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i d == CSSValueUnset || value.id == CSSValueDefault; 3233 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i d == CSSValueUnset || value.id == CSSValueDefault;
3233 } 3234 }
3234 3235
3235 static inline bool isValidCustomIdentForGridPositions(const CSSParserValue& valu e) 3236 static inline bool isValidCustomIdentForGridPositions(const CSSParserValue& valu e)
3236 { 3237 {
3237 // FIXME: we need a more general solution for <custom-ident> in all properti es. 3238 // FIXME: we need a more general solution for <custom-ident> in all properti es.
3238 return value.m_unit == CSSParserValue::Identifier && value.id != CSSValueSpa n && value.id != CSSValueAuto && !isCSSWideKeyword(value); 3239 return value.m_unit == CSSParserValue::Identifier && value.id != CSSValueSpa n && value.id != CSSValueAuto && !isCSSWideKeyword(value);
3239 } 3240 }
3240 3241
3241 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can be stand alone or with 'span'). 3242 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can be stand alone or with 'span').
3242 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gr idLineName) 3243 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSStringValue>& gridL ineName)
3243 { 3244 {
3244 CSSParserValue* value = m_valueList->current(); 3245 CSSParserValue* value = m_valueList->current();
3245 if (validUnit(value, FInteger) && value->fValue) { 3246 if (validUnit(value, FInteger) && value->fValue) {
3246 numericValue = createPrimitiveNumericValue(value); 3247 numericValue = createPrimitiveNumericValue(value);
3247 value = m_valueList->next(); 3248 value = m_valueList->next();
3248 if (value && isValidCustomIdentForGridPositions(*value)) { 3249 if (value && isValidCustomIdentForGridPositions(*value)) {
3249 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current( )); 3250 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current( ));
3250 m_valueList->next(); 3251 m_valueList->next();
3251 } 3252 }
3252 return true; 3253 return true;
(...skipping 16 matching lines...) Expand all
3269 { 3270 {
3270 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3271 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3271 3272
3272 CSSParserValue* value = m_valueList->current(); 3273 CSSParserValue* value = m_valueList->current();
3273 if (value->id == CSSValueAuto) { 3274 if (value->id == CSSValueAuto) {
3274 m_valueList->next(); 3275 m_valueList->next();
3275 return cssValuePool().createIdentifierValue(CSSValueAuto); 3276 return cssValuePool().createIdentifierValue(CSSValueAuto);
3276 } 3277 }
3277 3278
3278 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr; 3279 RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr;
3279 RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName = nullptr; 3280 RefPtrWillBeRawPtr<CSSStringValue> gridLineName = nullptr;
3280 bool hasSeenSpanKeyword = false; 3281 bool hasSeenSpanKeyword = false;
3281 3282
3282 if (parseIntegerOrCustomIdentFromGridPosition(numericValue, gridLineName)) { 3283 if (parseIntegerOrCustomIdentFromGridPosition(numericValue, gridLineName)) {
3283 value = m_valueList->current(); 3284 value = m_valueList->current();
3284 if (value && value->id == CSSValueSpan) { 3285 if (value && value->id == CSSValueSpan) {
3285 hasSeenSpanKeyword = true; 3286 hasSeenSpanKeyword = true;
3286 m_valueList->next(); 3287 m_valueList->next();
3287 } 3288 }
3288 } else if (value->id == CSSValueSpan) { 3289 } else if (value->id == CSSValueSpan) {
3289 hasSeenSpanKeyword = true; 3290 hasSeenSpanKeyword = true;
(...skipping 11 matching lines...) Expand all
3301 // If we didn't parse anything, this is not a valid grid position. 3302 // If we didn't parse anything, this is not a valid grid position.
3302 if (!hasSeenSpanKeyword && !gridLineName && !numericValue) 3303 if (!hasSeenSpanKeyword && !gridLineName && !numericValue)
3303 return nullptr; 3304 return nullptr;
3304 3305
3305 // Negative numbers are not allowed for span (but are for <integer>). 3306 // Negative numbers are not allowed for span (but are for <integer>).
3306 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0) 3307 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0)
3307 return nullptr; 3308 return nullptr;
3308 3309
3309 // For the <custom-ident> case. 3310 // For the <custom-ident> case.
3310 if (gridLineName && !numericValue && !hasSeenSpanKeyword) 3311 if (gridLineName && !numericValue && !hasSeenSpanKeyword)
3311 return cssValuePool().createValue(gridLineName->getStringValue(), CSSPri mitiveValue::UnitType::CustomIdentifier); 3312 return CSSStringValue::create(gridLineName->getStringValue(), CSSStringV alue::SerializeAsCustomIdentifier);
3312 3313
3313 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated (); 3314 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated ();
3314 if (hasSeenSpanKeyword) 3315 if (hasSeenSpanKeyword)
3315 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); 3316 values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
3316 if (numericValue) 3317 if (numericValue)
3317 values->append(numericValue.release()); 3318 values->append(numericValue.release());
3318 if (gridLineName) 3319 if (gridLineName)
3319 values->append(gridLineName.release()); 3320 values->append(gridLineName.release());
3320 ASSERT(values->length()); 3321 ASSERT(values->length());
3321 return values.release(); 3322 return values.release();
3322 } 3323 }
3323 3324
3324 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v alue) 3325 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v alue)
3325 { 3326 {
3326 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isCustomIdent() ) 3327 if (value->isStringValue() && toCSSStringValue(value)->serializationType() = = CSSStringValue::SerializeAsCustomIdentifier)
3327 return value; 3328 return value;
3328 3329
3329 return cssValuePool().createIdentifierValue(CSSValueAuto); 3330 return cssValuePool().createIdentifierValue(CSSValueAuto);
3330 } 3331 }
3331 3332
3332 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId , bool important) 3333 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId , bool important)
3333 { 3334 {
3334 ShorthandScope scope(this, shorthandId); 3335 ShorthandScope scope(this, shorthandId);
3335 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); 3336 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
3336 ASSERT(shorthand.length() == 2); 3337 ASSERT(shorthand.length() == 2);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3375 // Handle leading <custom-ident>*. 3376 // Handle leading <custom-ident>*.
3376 if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdd ed ? toCSSGridLineNamesValue(templateRows->item(templateRows->length() - 1)) : n ullptr)) 3377 if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdd ed ? toCSSGridLineNamesValue(templateRows->item(templateRows->length() - 1)) : n ullptr))
3377 return false; 3378 return false;
3378 3379
3379 // Handle a template-area's row. 3380 // Handle a template-area's row.
3380 if (!parseGridTemplateAreasRow(gridAreaMap, rowCount, columnCount)) 3381 if (!parseGridTemplateAreasRow(gridAreaMap, rowCount, columnCount))
3381 return false; 3382 return false;
3382 ++rowCount; 3383 ++rowCount;
3383 3384
3384 // Handle template-rows's track-size. 3385 // Handle template-rows's track-size.
3385 if (m_valueList->current() && m_valueList->current()->unit() != CSSPrimi tiveValue::UnitType::String) { 3386 if (m_valueList->current() && m_valueList->current()->m_unit != CSSParse rValue::String) {
3386 RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList ); 3387 RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList );
3387 if (!value) 3388 if (!value)
3388 return false; 3389 return false;
3389 templateRows->append(value); 3390 templateRows->append(value);
3390 } else { 3391 } else {
3391 templateRows->append(cssValuePool().createIdentifierValue(CSSValueAu to)); 3392 templateRows->append(cssValuePool().createIdentifierValue(CSSValueAu to));
3392 } 3393 }
3393 3394
3394 // This will handle the trailing/leading <custom-ident>* in the grammar. 3395 // This will handle the trailing/leading <custom-ident>* in the grammar.
3395 if (!parseGridLineNames(*m_valueList, *templateRows)) 3396 if (!parseGridLineNames(*m_valueList, *templateRows))
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3598 if (!lineNames) 3599 if (!lineNames)
3599 lineNames = CSSGridLineNamesValue::create(); 3600 lineNames = CSSGridLineNamesValue::create();
3600 3601
3601 while (CSSParserValue* identValue = inputList.current()) { 3602 while (CSSParserValue* identValue = inputList.current()) {
3602 if (isClosingBracket(*identValue)) 3603 if (isClosingBracket(*identValue))
3603 break; 3604 break;
3604 3605
3605 if (!isValidCustomIdentForGridPositions(*identValue)) 3606 if (!isValidCustomIdentForGridPositions(*identValue))
3606 return false; 3607 return false;
3607 3608
3608 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveCustomId entValue(identValue); 3609 RefPtrWillBeRawPtr<CSSStringValue> lineName = createPrimitiveCustomIdent Value(identValue);
3609 lineNames->append(lineName.release()); 3610 lineNames->append(lineName.release());
3610 inputList.next(); 3611 inputList.next();
3611 } 3612 }
3612 3613
3613 if (!inputList.current() || !isClosingBracket(*inputList.current())) 3614 if (!inputList.current() || !isClosingBracket(*inputList.current()))
3614 return false; 3615 return false;
3615 3616
3616 if (!previousNamedAreaTrailingLineNames) 3617 if (!previousNamedAreaTrailingLineNames)
3617 valueList.append(lineNames.release()); 3618 valueList.append(lineNames.release());
3618 3619
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3802 3803
3803 if (!areaName.isEmpty()) 3804 if (!areaName.isEmpty())
3804 columnNames.append(areaName.toString()); 3805 columnNames.append(areaName.toString());
3805 3806
3806 return columnNames; 3807 return columnNames;
3807 } 3808 }
3808 3809
3809 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount) 3810 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount)
3810 { 3811 {
3811 CSSParserValue* currentValue = m_valueList->current(); 3812 CSSParserValue* currentValue = m_valueList->current();
3812 if (!currentValue || currentValue->unit() != CSSPrimitiveValue::UnitType::St ring) 3813 if (!currentValue || currentValue->m_unit != CSSParserValue::String)
3813 return false; 3814 return false;
3814 3815
3815 String gridRowNames = currentValue->string; 3816 String gridRowNames = currentValue->string;
3816 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) 3817 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace())
3817 return false; 3818 return false;
3818 3819
3819 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames) ; 3820 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames) ;
3820 if (!columnCount) { 3821 if (!columnCount) {
3821 columnCount = columnNames.size(); 3822 columnCount = columnNames.size();
3822 ASSERT(columnCount); 3823 ASSERT(columnCount);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3934 { 3935 {
3935 unsigned numArgs = args->size(); 3936 unsigned numArgs = args->size();
3936 if (counters && numArgs != 3 && numArgs != 5) 3937 if (counters && numArgs != 3 && numArgs != 5)
3937 return nullptr; 3938 return nullptr;
3938 if (!counters && numArgs != 1 && numArgs != 3) 3939 if (!counters && numArgs != 1 && numArgs != 3)
3939 return nullptr; 3940 return nullptr;
3940 3941
3941 CSSParserValue* i = args->current(); 3942 CSSParserValue* i = args->current();
3942 if (i->m_unit != CSSParserValue::Identifier) 3943 if (i->m_unit != CSSParserValue::Identifier)
3943 return nullptr; 3944 return nullptr;
3944 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveCustomIden tValue(i); 3945 RefPtrWillBeRawPtr<CSSStringValue> identifier = createPrimitiveCustomIdentVa lue(i);
3945 3946
3946 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = nullptr; 3947 RefPtrWillBeRawPtr<CSSStringValue> separator = nullptr;
3947 if (!counters) 3948 if (!counters)
3948 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::Unit Type::CustomIdentifier); 3949 separator = CSSStringValue::create(String(), CSSStringValue::SerializeAs CustomIdentifier);
3949 else { 3950 else {
3950 args->next(); 3951 args->next();
3951 if (!consumeComma(args)) 3952 if (!consumeComma(args))
3952 return nullptr; 3953 return nullptr;
3953 3954
3954 i = args->current(); 3955 i = args->current();
3955 if (i->unit() != CSSPrimitiveValue::UnitType::String) 3956 if (i->m_unit != CSSParserValue::String)
3956 return nullptr; 3957 return nullptr;
3957 3958
3958 separator = createPrimitiveCustomIdentValue(i); 3959 separator = createPrimitiveCustomIdentValue(i);
3959 } 3960 }
3960 3961
3961 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr; 3962 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr;
3962 i = args->next(); 3963 i = args->next();
3963 if (!i) // Make the list style default decimal 3964 if (!i) // Make the list style default decimal
3964 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); 3965 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal);
3965 else { 3966 else {
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
4705 CSSParserValue* value = m_valueList->current(); 4706 CSSParserValue* value = m_valueList->current();
4706 4707
4707 FontFamilyValueBuilder familyBuilder(list.get()); 4708 FontFamilyValueBuilder familyBuilder(list.get());
4708 bool inFamily = false; 4709 bool inFamily = false;
4709 4710
4710 while (value) { 4711 while (value) {
4711 CSSParserValue* nextValue = m_valueList->next(); 4712 CSSParserValue* nextValue = m_valueList->next();
4712 bool nextValBreaksFont = !nextValue || isComma(nextValue); 4713 bool nextValBreaksFont = !nextValue || isComma(nextValue);
4713 bool nextValIsFontName = nextValue && 4714 bool nextValIsFontName = nextValue &&
4714 ((nextValue->id >= CSSValueSerif && nextValue->id <= CSSValueWebkitB ody) || 4715 ((nextValue->id >= CSSValueSerif && nextValue->id <= CSSValueWebkitB ody) ||
4715 (nextValue->unit() == CSSPrimitiveValue::UnitType::String || nextVal ue->m_unit == CSSParserValue::Identifier)); 4716 (nextValue->m_unit == CSSParserValue::String || nextValue->m_unit == CSSParserValue::Identifier));
4716 4717
4717 if (isCSSWideKeyword(*value) && !inFamily) { 4718 if (isCSSWideKeyword(*value) && !inFamily) {
4718 if (nextValBreaksFont) 4719 if (nextValBreaksFont)
4719 return nullptr; 4720 return nullptr;
4720 else if (nextValIsFontName) 4721 else if (nextValIsFontName)
4721 value = nextValue; 4722 value = nextValue;
4722 continue; 4723 continue;
4723 } 4724 }
4724 4725
4725 if (value->id >= CSSValueSerif && value->id <= CSSValueWebkitBody) { 4726 if (value->id >= CSSValueSerif && value->id <= CSSValueWebkitBody) {
4726 if (inFamily) 4727 if (inFamily)
4727 familyBuilder.add(value->string); 4728 familyBuilder.add(value->string);
4728 else if (nextValBreaksFont || !nextValIsFontName) 4729 else if (nextValBreaksFont || !nextValIsFontName)
4729 list->append(cssValuePool().createIdentifierValue(value->id)); 4730 list->append(cssValuePool().createIdentifierValue(value->id));
4730 else { 4731 else {
4731 familyBuilder.commit(); 4732 familyBuilder.commit();
4732 familyBuilder.add(value->string); 4733 familyBuilder.add(value->string);
4733 inFamily = true; 4734 inFamily = true;
4734 } 4735 }
4735 } else if (value->unit() == CSSPrimitiveValue::UnitType::String) { 4736 } else if (value->m_unit == CSSParserValue::String) {
4736 // Strings never share in a family name. 4737 // Strings never share in a family name.
4737 inFamily = false; 4738 inFamily = false;
4738 familyBuilder.commit(); 4739 familyBuilder.commit();
4739 list->append(cssValuePool().createFontFamilyValue(value->string)); 4740 list->append(cssValuePool().createFontFamilyValue(value->string));
4740 } else if (value->m_unit == CSSParserValue::Identifier) { 4741 } else if (value->m_unit == CSSParserValue::Identifier) {
4741 if (inFamily) 4742 if (inFamily)
4742 familyBuilder.add(value->string); 4743 familyBuilder.add(value->string);
4743 else if (nextValBreaksFont || !nextValIsFontName) 4744 else if (nextValBreaksFont || !nextValIsFontName)
4744 list->append(cssValuePool().createFontFamilyValue(value->string) ); 4745 list->append(cssValuePool().createFontFamilyValue(value->string) );
4745 else { 4746 else {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4881 4882
4882 CSSParserValue* value = m_valueList->next(); 4883 CSSParserValue* value = m_valueList->next();
4883 if (!value || value->m_unit != CSSParserValue::Function || value->function-> id != CSSValueFormat) { 4884 if (!value || value->m_unit != CSSParserValue::Function || value->function-> id != CSSValueFormat) {
4884 valueList->append(uriValue.release()); 4885 valueList->append(uriValue.release());
4885 return true; 4886 return true;
4886 } 4887 }
4887 4888
4888 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20111004/ says that format () contains a comma-separated list of strings, 4889 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20111004/ says that format () contains a comma-separated list of strings,
4889 // but CSSFontFaceSrcValue stores only one format. Allowing one format for n ow. 4890 // but CSSFontFaceSrcValue stores only one format. Allowing one format for n ow.
4890 CSSParserValueList* args = value->function->args.get(); 4891 CSSParserValueList* args = value->function->args.get();
4891 if (!args || args->size() != 1 || (args->current()->unit() != CSSPrimitiveVa lue::UnitType::String && args->current()->m_unit != CSSParserValue::Identifier)) 4892 if (!args || args->size() != 1 || (args->current()->m_unit != CSSParserValue ::String && args->current()->m_unit != CSSParserValue::Identifier))
4892 return false; 4893 return false;
4893 uriValue->setFormat(args->current()->string); 4894 uriValue->setFormat(args->current()->string);
4894 valueList->append(uriValue.release()); 4895 valueList->append(uriValue.release());
4895 m_valueList->next(); 4896 m_valueList->next();
4896 return true; 4897 return true;
4897 } 4898 }
4898 4899
4899 bool CSSPropertyParser::parseFontFaceSrcLocal(CSSValueList* valueList) 4900 bool CSSPropertyParser::parseFontFaceSrcLocal(CSSValueList* valueList)
4900 { 4901 {
4901 CSSParserValueList* args = m_valueList->current()->function->args.get(); 4902 CSSParserValueList* args = m_valueList->current()->function->args.get();
4902 if (!args || !args->size()) 4903 if (!args || !args->size())
4903 return false; 4904 return false;
4904 m_valueList->next(); 4905 m_valueList->next();
4905 4906
4906 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy = m_contex t.shouldCheckContentSecurityPolicy(); 4907 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy = m_contex t.shouldCheckContentSecurityPolicy();
4907 if (args->size() == 1 && args->current()->unit() == CSSPrimitiveValue::UnitT ype::String) { 4908 if (args->size() == 1 && args->current()->m_unit == CSSParserValue::String) {
4908 valueList->append(CSSFontFaceSrcValue::createLocal(args->current()->stri ng, shouldCheckContentSecurityPolicy)); 4909 valueList->append(CSSFontFaceSrcValue::createLocal(args->current()->stri ng, shouldCheckContentSecurityPolicy));
4909 } else if (args->current()->m_unit == CSSParserValue::Identifier) { 4910 } else if (args->current()->m_unit == CSSParserValue::Identifier) {
4910 StringBuilder builder; 4911 StringBuilder builder;
4911 for (CSSParserValue* localValue = args->current(); localValue; localValu e = args->next()) { 4912 for (CSSParserValue* localValue = args->current(); localValue; localValu e = args->next()) {
4912 if (localValue->m_unit != CSSParserValue::Identifier) 4913 if (localValue->m_unit != CSSParserValue::Identifier)
4913 return false; 4914 return false;
4914 if (!builder.isEmpty()) 4915 if (!builder.isEmpty())
4915 builder.append(' '); 4916 builder.append(' ');
4916 builder.append(localValue->string); 4917 builder.append(localValue->string);
4917 } 4918 }
4918 valueList->append(CSSFontFaceSrcValue::createLocal(builder.toString(), s houldCheckContentSecurityPolicy)); 4919 valueList->append(CSSFontFaceSrcValue::createLocal(builder.toString(), s houldCheckContentSecurityPolicy));
4919 } else 4920 } else
4920 return false; 4921 return false;
4921 4922
4922 return true; 4923 return true;
4923 } 4924 }
4924 4925
4925 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFontFaceSrc() 4926 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFontFaceSrc()
4926 { 4927 {
4927 RefPtrWillBeRawPtr<CSSValueList> values(CSSValueList::createCommaSeparated() ); 4928 RefPtrWillBeRawPtr<CSSValueList> values(CSSValueList::createCommaSeparated() );
4928 4929
4929 while (true) { 4930 while (true) {
4930 CSSParserValue* value = m_valueList->current(); 4931 CSSParserValue* value = m_valueList->current();
4931 if (!value) 4932 if (!value)
4932 return nullptr; 4933 return nullptr;
4933 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 4934 if (value->m_unit == CSSParserValue::URI) {
4934 if (!parseFontFaceSrcURI(values.get())) 4935 if (!parseFontFaceSrcURI(values.get()))
4935 return nullptr; 4936 return nullptr;
4936 } else if (value->m_unit == CSSParserValue::Function && value->function- >id == CSSValueLocal) { 4937 } else if (value->m_unit == CSSParserValue::Function && value->function- >id == CSSValueLocal) {
4937 if (!parseFontFaceSrcLocal(values.get())) 4938 if (!parseFontFaceSrcLocal(values.get()))
4938 return nullptr; 4939 return nullptr;
4939 } else { 4940 } else {
4940 return nullptr; 4941 return nullptr;
4941 } 4942 }
4942 4943
4943 if (!m_valueList->current()) 4944 if (!m_valueList->current())
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
5567 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde rImageParseContext& context) 5568 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde rImageParseContext& context)
5568 { 5569 {
5569 CSSPropertyParser::ShorthandScope scope(this, propId); 5570 CSSPropertyParser::ShorthandScope scope(this, propId);
5570 while (CSSParserValue* val = m_valueList->current()) { 5571 while (CSSParserValue* val = m_valueList->current()) {
5571 context.setCanAdvance(false); 5572 context.setCanAdvance(false);
5572 5573
5573 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo rwardSlashOperator(val)) 5574 if (!context.canAdvance() && context.allowForwardSlashOperator() && isFo rwardSlashOperator(val))
5574 context.commitForwardSlashOperator(); 5575 context.commitForwardSlashOperator();
5575 5576
5576 if (!context.canAdvance() && context.allowImage()) { 5577 if (!context.canAdvance() && context.allowImage()) {
5577 if (val->unit() == CSSPrimitiveValue::UnitType::URI) { 5578 if (val->m_unit == CSSParserValue::URI) {
5578 context.commitImage(createCSSImageValueWithReferrer(val->string, m_context.completeURL(val->string))); 5579 context.commitImage(createCSSImageValueWithReferrer(val->string, m_context.completeURL(val->string)));
5579 } else if (isGeneratedImageValue(val)) { 5580 } else if (isGeneratedImageValue(val)) {
5580 RefPtrWillBeRawPtr<CSSValue> value = nullptr; 5581 RefPtrWillBeRawPtr<CSSValue> value = nullptr;
5581 if (parseGeneratedImage(m_valueList, value)) 5582 if (parseGeneratedImage(m_valueList, value))
5582 context.commitImage(value.release()); 5583 context.commitImage(value.release());
5583 else 5584 else
5584 return false; 5585 return false;
5585 } else if (val->m_unit == CSSParserValue::Function && val->function- >id == CSSValueWebkitImageSet) { 5586 } else if (val->m_unit == CSSParserValue::Function && val->function- >id == CSSValueWebkitImageSet) {
5586 RefPtrWillBeRawPtr<CSSValue> value = parseImageSet(m_valueList); 5587 RefPtrWillBeRawPtr<CSSValue> value = parseImageSet(m_valueList);
5587 if (value) 5588 if (value)
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
5968 } 5969 }
5969 5970
5970 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu e) 5971 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu e)
5971 { 5972 {
5972 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 5973 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
5973 5974
5974 while (m_valueList->current()) { 5975 while (m_valueList->current()) {
5975 CSSParserValue* val = m_valueList->current(); 5976 CSSParserValue* val = m_valueList->current();
5976 if (val->m_unit != CSSParserValue::Identifier) 5977 if (val->m_unit != CSSParserValue::Identifier)
5977 return nullptr; 5978 return nullptr;
5978 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = createPrimitiveCusto mIdentValue(val); 5979 RefPtrWillBeRawPtr<CSSStringValue> counterName = createPrimitiveCustomId entValue(val);
5979 m_valueList->next(); 5980 m_valueList->next();
5980 5981
5981 val = m_valueList->current(); 5982 val = m_valueList->current();
5982 int i = defaultValue; 5983 int i = defaultValue;
5983 if (val && validUnit(val, FInteger)) { 5984 if (val && validUnit(val, FInteger)) {
5984 i = clampTo<int>(val->fValue); 5985 i = clampTo<int>(val->fValue);
5985 m_valueList->next(); 5986 m_valueList->next();
5986 } 5987 }
5987 5988
5988 list->append(createCSSValuePair(counterName.release(), 5989 list->append(createCSSValuePair(counterName.release(),
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
6797 return nullptr; 6798 return nullptr;
6798 6799
6799 CSSParserValueList* functionArgs = valueList->current()->function->args.get( ); 6800 CSSParserValueList* functionArgs = valueList->current()->function->args.get( );
6800 if (!functionArgs || !functionArgs->size() || !functionArgs->current()) 6801 if (!functionArgs || !functionArgs->size() || !functionArgs->current())
6801 return nullptr; 6802 return nullptr;
6802 6803
6803 RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create(); 6804 RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create();
6804 6805
6805 while (functionArgs->current()) { 6806 while (functionArgs->current()) {
6806 CSSParserValue* arg = functionArgs->current(); 6807 CSSParserValue* arg = functionArgs->current();
6807 if (arg->unit() != CSSPrimitiveValue::UnitType::URI) 6808 if (arg->m_unit != CSSParserValue::URI)
6808 return nullptr; 6809 return nullptr;
6809 6810
6810 RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg ->string, completeURL(arg->string)); 6811 RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg ->string, completeURL(arg->string));
6811 imageSet->append(image); 6812 imageSet->append(image);
6812 6813
6813 arg = functionArgs->next(); 6814 arg = functionArgs->next();
6814 if (!arg) 6815 if (!arg)
6815 return nullptr; 6816 return nullptr;
6816 6817
6817 if (arg->m_unit != CSSParserValue::DimensionList) 6818 if (arg->m_unit != CSSParserValue::DimensionList)
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
6973 } 6974 }
6974 6975
6975 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter() 6976 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter()
6976 { 6977 {
6977 if (!m_valueList) 6978 if (!m_valueList)
6978 return nullptr; 6979 return nullptr;
6979 6980
6980 // The filter is a list of functional primitives that specify individual ope rations. 6981 // The filter is a list of functional primitives that specify individual ope rations.
6981 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 6982 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
6982 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { 6983 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) {
6983 if (value->unit() != CSSPrimitiveValue::UnitType::URI && (value->m_unit != CSSParserValue::Function || !value->function)) 6984 if (value->m_unit != CSSParserValue::URI && (value->m_unit != CSSParserV alue::Function || !value->function))
6984 return nullptr; 6985 return nullptr;
6985 6986
6986 // See if the specified primitive is one we understand. 6987 // See if the specified primitive is one we understand.
6987 if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 6988 if (value->m_unit == CSSParserValue::URI) {
6988 RefPtrWillBeRawPtr<CSSFunctionValue> referenceFilterValue = CSSFunct ionValue::create(CSSValueUrl); 6989 RefPtrWillBeRawPtr<CSSFunctionValue> referenceFilterValue = CSSFunct ionValue::create(CSSValueUrl);
6989 referenceFilterValue->append(CSSSVGDocumentValue::create(value->stri ng)); 6990 referenceFilterValue->append(CSSSVGDocumentValue::create(value->stri ng));
6990 list->append(referenceFilterValue.release()); 6991 list->append(referenceFilterValue.release());
6991 } else { 6992 } else {
6992 CSSValueID filterType = value->function->id; 6993 CSSValueID filterType = value->function->id;
6993 unsigned maximumArgumentCount = filterType == CSSValueDropShadow ? 4 : 1; 6994 unsigned maximumArgumentCount = filterType == CSSValueDropShadow ? 4 : 1;
6994 6995
6995 CSSParserValueList* args = value->function->args.get(); 6996 CSSParserValueList* args = value->function->args.get();
6996 if (!args || args->size() > maximumArgumentCount) 6997 if (!args || args->size() > maximumArgumentCount)
6997 return nullptr; 6998 return nullptr;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
7157 return list.release(); 7158 return list.release();
7158 return nullptr; 7159 return nullptr;
7159 } 7160 }
7160 7161
7161 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle() 7162 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle()
7162 { 7163 {
7163 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr; 7164 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr;
7164 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr; 7165 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr;
7165 7166
7166 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) { 7167 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) {
7167 if (value->unit() == CSSPrimitiveValue::UnitType::String) { 7168 if (value->m_unit == CSSParserValue::String) {
7168 if (fill || shape) 7169 if (fill || shape)
7169 return nullptr; 7170 return nullptr;
7170 m_valueList->next(); 7171 m_valueList->next();
7171 return createPrimitiveStringValue(value); 7172 return createPrimitiveStringValue(value);
7172 } 7173 }
7173 7174
7174 if (value->id == CSSValueNone) { 7175 if (value->id == CSSValueNone) {
7175 if (fill || shape) 7176 if (fill || shape)
7176 return nullptr; 7177 return nullptr;
7177 m_valueList->next(); 7178 m_valueList->next();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
7274 return CSSLineBoxContainValue::create(lineBoxContain); 7275 return CSSLineBoxContainValue::create(lineBoxContain);
7275 } 7276 }
7276 7277
7277 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings) 7278 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings)
7278 { 7279 {
7279 // Feature tag name consists of 4-letter characters. 7280 // Feature tag name consists of 4-letter characters.
7280 static const unsigned tagNameLength = 4; 7281 static const unsigned tagNameLength = 4;
7281 7282
7282 CSSParserValue* value = m_valueList->current(); 7283 CSSParserValue* value = m_valueList->current();
7283 // Feature tag name comes first 7284 // Feature tag name comes first
7284 if (value->unit() != CSSPrimitiveValue::UnitType::String) 7285 if (value->m_unit != CSSParserValue::String)
7285 return false; 7286 return false;
7286 if (value->string.length() != tagNameLength) 7287 if (value->string.length() != tagNameLength)
7287 return false; 7288 return false;
7288 for (unsigned i = 0; i < tagNameLength; ++i) { 7289 for (unsigned i = 0; i < tagNameLength; ++i) {
7289 // Limits the range of characters to 0x20-0x7E, following the tag name r ules defiend in the OpenType specification. 7290 // Limits the range of characters to 0x20-0x7E, following the tag name r ules defiend in the OpenType specification.
7290 UChar character = value->string[i]; 7291 UChar character = value->string[i];
7291 if (character < 0x20 || character > 0x7E) 7292 if (character < 0x20 || character > 0x7E)
7292 return false; 7293 return false;
7293 } 7294 }
7294 7295
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
7624 break; 7625 break;
7625 7626
7626 case CSSPropertyClipPath: 7627 case CSSPropertyClipPath:
7627 case CSSPropertyFilter: 7628 case CSSPropertyFilter:
7628 case CSSPropertyMarkerStart: 7629 case CSSPropertyMarkerStart:
7629 case CSSPropertyMarkerMid: 7630 case CSSPropertyMarkerMid:
7630 case CSSPropertyMarkerEnd: 7631 case CSSPropertyMarkerEnd:
7631 case CSSPropertyMask: 7632 case CSSPropertyMask:
7632 if (id == CSSValueNone) { 7633 if (id == CSSValueNone) {
7633 validPrimitive = true; 7634 validPrimitive = true;
7634 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 7635 } else if (value->m_unit == CSSParserValue::URI) {
7635 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV alue::UnitType::URI); 7636 parsedValue = CSSStringValue::create(value->string, CSSStringValue:: SerializeAsURI);
7636 if (parsedValue) 7637 if (parsedValue)
7637 m_valueList->next(); 7638 m_valueList->next();
7638 } 7639 }
7639 break; 7640 break;
7640 7641
7641 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit 7642 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit
7642 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode); 7643 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode);
7643 break; 7644 break;
7644 7645
7645 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit 7646 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit
(...skipping 20 matching lines...) Expand all
7666 if (parsedValue) 7667 if (parsedValue)
7667 m_valueList->next(); 7668 m_valueList->next();
7668 } 7669 }
7669 break; 7670 break;
7670 7671
7671 case CSSPropertyFill: // <paint> | inherit 7672 case CSSPropertyFill: // <paint> | inherit
7672 case CSSPropertyStroke: // <paint> | inherit 7673 case CSSPropertyStroke: // <paint> | inherit
7673 { 7674 {
7674 if (id == CSSValueNone) { 7675 if (id == CSSValueNone) {
7675 parsedValue = cssValuePool().createIdentifierValue(id); 7676 parsedValue = cssValuePool().createIdentifierValue(id);
7676 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 7677 } else if (value->m_unit == CSSParserValue::URI) {
7677 if (m_valueList->next()) { 7678 if (m_valueList->next()) {
7678 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea teSpaceSeparated(); 7679 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea teSpaceSeparated();
7679 values->append(CSSPrimitiveValue::create(value->string, CSSP rimitiveValue::UnitType::URI)); 7680 values->append(CSSStringValue::create(value->string, CSSStri ngValue::SerializeAsURI));
7680 if (m_valueList->current()->id == CSSValueNone) 7681 if (m_valueList->current()->id == CSSValueNone)
7681 parsedValue = cssValuePool().createIdentifierValue(m_val ueList->current()->id); 7682 parsedValue = cssValuePool().createIdentifierValue(m_val ueList->current()->id);
7682 else 7683 else
7683 parsedValue = parseColor(m_valueList->current()); 7684 parsedValue = parseColor(m_valueList->current());
7684 if (parsedValue) { 7685 if (parsedValue) {
7685 values->append(parsedValue); 7686 values->append(parsedValue);
7686 parsedValue = values; 7687 parsedValue = values;
7687 } 7688 }
7688 } 7689 }
7689 if (!parsedValue) 7690 if (!parsedValue)
7690 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr imitiveValue::UnitType::URI); 7691 parsedValue = CSSStringValue::create(value->string, CSSStrin gValue::SerializeAsURI);
7691 } else { 7692 } else {
7692 parsedValue = parseColor(m_valueList->current()); 7693 parsedValue = parseColor(m_valueList->current());
7693 } 7694 }
7694 7695
7695 if (parsedValue) 7696 if (parsedValue)
7696 m_valueList->next(); 7697 m_valueList->next();
7697 } 7698 }
7698 break; 7699 break;
7699 7700
7700 case CSSPropertyStopColor: // TODO : icccolor 7701 case CSSPropertyStopColor: // TODO : icccolor
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
7749 default: 7750 default:
7750 // If you crash here, it's because you added a css property and are not handling it 7751 // If you crash here, it's because you added a css property and are not handling it
7751 // in either this switch statement or the one in CSSPropertyParser::pars eValue 7752 // in either this switch statement or the one in CSSPropertyParser::pars eValue
7752 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); 7753 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId);
7753 return false; 7754 return false;
7754 } 7755 }
7755 7756
7756 if (validPrimitive) { 7757 if (validPrimitive) {
7757 if (id) 7758 if (id)
7758 parsedValue = CSSPrimitiveValue::createIdentifier(id); 7759 parsedValue = CSSPrimitiveValue::createIdentifier(id);
7759 else if (value->unit() == CSSPrimitiveValue::UnitType::String) 7760 else if (value->m_unit == CSSParserValue::String)
7760 parsedValue = CSSPrimitiveValue::create(value->string, value->unit() ); 7761 parsedValue = CSSStringValue::create(value->string, CSSStringValue:: SerializeAsString);
7761 else if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value-> unit() <= CSSPrimitiveValue::UnitType::Kilohertz) 7762 else if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value-> unit() <= CSSPrimitiveValue::UnitType::Kilohertz)
7762 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit() ); 7763 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit() );
7763 else if (value->unit() == CSSPrimitiveValue::UnitType::Rems || value->un it() == CSSPrimitiveValue::UnitType::Chs) 7764 else if (value->unit() == CSSPrimitiveValue::UnitType::Rems || value->un it() == CSSPrimitiveValue::UnitType::Chs)
7764 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit() ); 7765 parsedValue = CSSPrimitiveValue::create(value->fValue, value->unit() );
7765 else if (value->unit() == CSSPrimitiveValue::UnitType::QuirkyEms) 7766 else if (value->unit() == CSSPrimitiveValue::UnitType::QuirkyEms)
7766 parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(value->fV alue, CSSPrimitiveValue::UnitType::Ems); 7767 parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(value->fV alue, CSSPrimitiveValue::UnitType::Ems);
7767 if (isCalculation(value)) { 7768 if (isCalculation(value)) {
7768 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri mitiveValue here, ie 7769 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri mitiveValue here, ie
7769 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea se()); 7770 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea se());
7770 m_parsedCalculation.release(); 7771 m_parsedCalculation.release();
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
8057 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. 8058 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>.
8058 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV aluePath) 8059 if (value->m_unit != CSSParserValue::Function || value->function->id != CSSV aluePath)
8059 return nullptr; 8060 return nullptr;
8060 8061
8061 // FIXME: Add support for <fill-rule>. 8062 // FIXME: Add support for <fill-rule>.
8062 CSSParserValueList* functionArgs = value->function->args.get(); 8063 CSSParserValueList* functionArgs = value->function->args.get();
8063 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) 8064 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current())
8064 return nullptr; 8065 return nullptr;
8065 8066
8066 CSSParserValue* arg = functionArgs->current(); 8067 CSSParserValue* arg = functionArgs->current();
8067 if (arg->unit() != CSSPrimitiveValue::UnitType::String) 8068 if (arg->m_unit != CSSParserValue::String)
8068 return nullptr; 8069 return nullptr;
8069 8070
8070 String pathString = arg->string; 8071 String pathString = arg->string;
8071 Path path; 8072 Path path;
8072 if (!buildPathFromString(pathString, path)) 8073 if (!buildPathFromString(pathString, path))
8073 return nullptr; 8074 return nullptr;
8074 8075
8075 m_valueList->next(); 8076 m_valueList->next();
8076 return CSSPathValue::create(pathString); 8077 return CSSPathValue::create(pathString);
8077 } 8078 }
(...skipping 16 matching lines...) Expand all
8094 } 8095 }
8095 } 8096 }
8096 8097
8097 if (!list->length()) 8098 if (!list->length())
8098 return nullptr; 8099 return nullptr;
8099 8100
8100 return list.release(); 8101 return list.release();
8101 } 8102 }
8102 8103
8103 } // namespace blink 8104 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698