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

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

Issue 985023003: Don't accept <string> for text-align (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Don't construct CSSPrimitiveValue for text-align <string> Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 int id = value->id; 384 int id = value->id;
385 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent) 385 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent)
386 return true; 386 return true;
387 return !id && validUnit(value, FLength | FPercent | FNonNeg | unitless); 387 return !id && validUnit(value, FLength | FPercent | FNonNeg | unitless);
388 } 388 }
389 389
390 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr imitive(CSSValueID identifier, CSSParserValue* value) 390 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr imitive(CSSValueID identifier, CSSParserValue* value)
391 { 391 {
392 if (identifier) 392 if (identifier)
393 return cssValuePool().createIdentifierValue(identifier); 393 return cssValuePool().createIdentifierValue(identifier);
394 if (value->unit == CSSPrimitiveValue::CSS_STRING)
395 return createPrimitiveCustomIdentValue(value);
396 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ) 394 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ)
397 return createPrimitiveNumericValue(value); 395 return createPrimitiveNumericValue(value);
398 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS) 396 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS)
399 return createPrimitiveNumericValue(value); 397 return createPrimitiveNumericValue(value);
400 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX) 398 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX)
401 return createPrimitiveNumericValue(value); 399 return createPrimitiveNumericValue(value);
402 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv eValue::CSS_DPCM) 400 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv eValue::CSS_DPCM)
403 return createPrimitiveNumericValue(value); 401 return createPrimitiveNumericValue(value);
404 if (value->unit >= CSSParserValue::Q_EMS) 402 if (value->unit >= CSSParserValue::Q_EMS)
405 return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPr imitiveValue::CSS_EMS); 403 return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPr imitiveValue::CSS_EMS);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto); 519 overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto);
522 else 520 else
523 overflowXValue = m_parsedProperties.last().value(); 521 overflowXValue = m_parsedProperties.last().value();
524 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); 522 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important);
525 return true; 523 return true;
526 } 524 }
527 525
528 case CSSPropertyTextAlign: 526 case CSSPropertyTextAlign:
529 // left | right | center | justify | -webkit-left | -webkit-right | -web kit-center | -webkit-match-parent 527 // left | right | center | justify | -webkit-left | -webkit-right | -web kit-center | -webkit-match-parent
530 // | start | end | <string> | inherit | -webkit-auto (converted to start ) 528 // | start | end | <string> | inherit | -webkit-auto (converted to start )
531 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id == CSSValueStart || id == CSSValueEnd 529 // FIXME: <string> not supported right now
532 || value->unit == CSSPrimitiveValue::CSS_STRING) 530 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id == CSSValueStart || id == CSSValueEnd) {
533 validPrimitive = true; 531 validPrimitive = true;
532 }
534 break; 533 break;
535 534
536 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2 00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit 535 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2 00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
537 if (m_valueList->size() != 1) 536 if (m_valueList->size() != 1)
538 return false; 537 return false;
539 return parseFontWeight(important); 538 return parseFontWeight(important);
540 } 539 }
541 540
542 case CSSPropertyBorderSpacing: { 541 case CSSPropertyBorderSpacing: {
543 if (num == 1) { 542 if (num == 1) {
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 } 2171 }
2173 2172
2174 // [ <string> <string> ]+ | none, but none is handled in parseValue 2173 // [ <string> <string> ]+ | none, but none is handled in parseValue
2175 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes() 2174 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes()
2176 { 2175 {
2177 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); 2176 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated ();
2178 while (CSSParserValue* val = m_valueList->current()) { 2177 while (CSSParserValue* val = m_valueList->current()) {
2179 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; 2178 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
2180 if (val->unit != CSSPrimitiveValue::CSS_STRING) 2179 if (val->unit != CSSPrimitiveValue::CSS_STRING)
2181 return nullptr; 2180 return nullptr;
2182 parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue:: CSS_STRING); 2181 parsedValue = createPrimitiveStringValue(val);
2183 values->append(parsedValue.release()); 2182 values->append(parsedValue.release());
2184 m_valueList->next(); 2183 m_valueList->next();
2185 } 2184 }
2186 if (values->length() && values->length() % 2 == 0) 2185 if (values->length() && values->length() % 2 == 0)
2187 return values.release(); 2186 return values.release();
2188 return nullptr; 2187 return nullptr;
2189 } 2188 }
2190 2189
2191 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit 2190 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit
2192 // in CSS 2.1 this got somewhat reduced: 2191 // in CSS 2.1 this got somewhat reduced:
(...skipping 6302 matching lines...) Expand 10 before | Expand all | Expand 10 after
8495 } 8494 }
8496 } 8495 }
8497 8496
8498 if (!list->length()) 8497 if (!list->length())
8499 return nullptr; 8498 return nullptr;
8500 8499
8501 return list.release(); 8500 return list.release();
8502 } 8501 }
8503 8502
8504 } // namespace blink 8503 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698