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

Side by Side Diff: Source/core/css/parser/CSSGrammar.y

Issue 645033004: Move rolling back badly parsed property to CSSPropertyParser::parseValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | 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 2
3 /* 3 /*
4 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 App le Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2012 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 404
405 internal_decls: 405 internal_decls:
406 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF { 406 INTERNAL_DECLS_SYM maybe_space_before_declaration declaration_list TOKEN_EOF {
407 /* can be empty */ 407 /* can be empty */
408 } 408 }
409 ; 409 ;
410 410
411 internal_value: 411 internal_value:
412 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF { 412 INTERNAL_VALUE_SYM maybe_space expr TOKEN_EOF {
413 parser->m_valueList = parser->sinkFloatingValueList($3); 413 parser->m_valueList = parser->sinkFloatingValueList($3);
414 int oldParsedProperties = parser->m_parsedProperties.size(); 414 parser->parseValue(parser->m_id, parser->m_important);
415 if (!parser->parseValue(parser->m_id, parser->m_important))
416 parser->rollbackLastProperties(parser->m_parsedProperties.size() - o ldParsedProperties);
417 parser->m_valueList = nullptr; 415 parser->m_valueList = nullptr;
418 } 416 }
419 ; 417 ;
420 418
421 internal_selector: 419 internal_selector:
422 INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF { 420 INTERNAL_SELECTOR_SYM maybe_space selector_list TOKEN_EOF {
423 if (parser->m_selectorListForParseSelector) 421 if (parser->m_selectorListForParseSelector)
424 parser->m_selectorListForParseSelector->adoptSelectorVector(*$3); 422 parser->m_selectorListForParseSelector->adoptSelectorVector(*$3);
425 } 423 }
426 ; 424 ;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 $$ = $1 || $2; 1510 $$ = $1 || $2;
1513 } 1511 }
1514 ; 1512 ;
1515 1513
1516 declaration: 1514 declaration:
1517 property ':' maybe_space error_location expr prio { 1515 property ':' maybe_space error_location expr prio {
1518 $$ = false; 1516 $$ = false;
1519 bool isPropertyParsed = false; 1517 bool isPropertyParsed = false;
1520 if ($1 != CSSPropertyInvalid) { 1518 if ($1 != CSSPropertyInvalid) {
1521 parser->m_valueList = parser->sinkFloatingValueList($5); 1519 parser->m_valueList = parser->sinkFloatingValueList($5);
1522 int oldParsedProperties = parser->m_parsedProperties.size();
1523 $$ = parser->parseValue($1, $6); 1520 $$ = parser->parseValue($1, $6);
1524 if (!$$) { 1521 if (!$$)
1525 parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
1526 parser->reportError($4, InvalidPropertyValueCSSError); 1522 parser->reportError($4, InvalidPropertyValueCSSError);
1527 } else 1523 else
1528 isPropertyParsed = true; 1524 isPropertyParsed = true;
1529 parser->m_valueList = nullptr; 1525 parser->m_valueList = nullptr;
1530 } 1526 }
1531 parser->endProperty($6, isPropertyParsed); 1527 parser->endProperty($6, isPropertyParsed);
1532 } 1528 }
1533 | 1529 |
1534 property ':' maybe_space error_location expr prio error error_recovery { 1530 property ':' maybe_space error_location expr prio error error_recovery {
1535 /* When we encounter something like p {color: red !important fail;} we s hould drop the declaration */ 1531 /* When we encounter something like p {color: red !important fail;} we s hould drop the declaration */
1536 parser->reportError($4, InvalidPropertyValueCSSError); 1532 parser->reportError($4, InvalidPropertyValueCSSError);
1537 parser->endProperty(false, false); 1533 parser->endProperty(false, false);
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 ; 1852 ;
1857 1853
1858 rule_error_recovery: 1854 rule_error_recovery:
1859 /* empty */ 1855 /* empty */
1860 | rule_error_recovery error 1856 | rule_error_recovery error
1861 | rule_error_recovery invalid_square_brackets_block 1857 | rule_error_recovery invalid_square_brackets_block
1862 | rule_error_recovery invalid_parentheses_block 1858 | rule_error_recovery invalid_parentheses_block
1863 ; 1859 ;
1864 1860
1865 %% 1861 %%
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698