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

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

Issue 1085873002: Only accept inherit/initial/unset in single value declarations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add subtests Created 5 years, 8 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 | « LayoutTests/css3/supports-dom-api-expected.txt ('k') | 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 return parseViewportProperty(propId, important); 440 return parseViewportProperty(propId, important);
441 } 441 }
442 442
443 // Note: m_parsedCalculation is used to pass the calc value to validUnit and then cleared at the end of this function. 443 // Note: m_parsedCalculation is used to pass the calc value to validUnit and then cleared at the end of this function.
444 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller s. 444 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller s.
445 ASSERT(!m_parsedCalculation); 445 ASSERT(!m_parsedCalculation);
446 446
447 CSSValueID id = value->id; 447 CSSValueID id = value->id;
448 448
449 int num = inShorthand() ? 1 : m_valueList->size();
450
451 if (id == CSSValueInherit) { 449 if (id == CSSValueInherit) {
452 if (num != 1) 450 if (m_valueList->size() != 1)
453 return false; 451 return false;
454 addExpandedPropertyForValue(propId, cssValuePool().createInheritedValue( ), important); 452 addExpandedPropertyForValue(propId, cssValuePool().createInheritedValue( ), important);
455 return true; 453 return true;
456 } else if (id == CSSValueInitial) { 454 } else if (id == CSSValueInitial) {
457 if (num != 1) 455 if (m_valueList->size() != 1)
458 return false; 456 return false;
459 addExpandedPropertyForValue(propId, cssValuePool().createExplicitInitial Value(), important); 457 addExpandedPropertyForValue(propId, cssValuePool().createExplicitInitial Value(), important);
460 return true; 458 return true;
461 } else if (id == CSSValueUnset) { 459 } else if (id == CSSValueUnset) {
462 if (num != 1) 460 if (m_valueList->size() != 1)
463 return false; 461 return false;
464 addExpandedPropertyForValue(propId, cssValuePool().createUnsetValue(), i mportant); 462 addExpandedPropertyForValue(propId, cssValuePool().createUnsetValue(), i mportant);
465 return true; 463 return true;
466 } 464 }
467 465
466 int num = inShorthand() ? 1 : m_valueList->size();
467
468 if (CSSParserFastPaths::isKeywordPropertyID(propId)) { 468 if (CSSParserFastPaths::isKeywordPropertyID(propId)) {
469 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id)) 469 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id))
470 return false; 470 return false;
471 if (m_valueList->next() && !inShorthand()) 471 if (m_valueList->next() && !inShorthand())
472 return false; 472 return false;
473 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ; 473 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ;
474 return true; 474 return true;
475 } 475 }
476 476
477 bool validPrimitive = false; 477 bool validPrimitive = false;
(...skipping 8007 matching lines...) Expand 10 before | Expand all | Expand 10 after
8485 } 8485 }
8486 } 8486 }
8487 8487
8488 if (!list->length()) 8488 if (!list->length())
8489 return nullptr; 8489 return nullptr;
8490 8490
8491 return list.release(); 8491 return list.release();
8492 } 8492 }
8493 8493
8494 } // namespace blink 8494 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/css3/supports-dom-api-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698