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

Side by Side Diff: Source/core/css/CSSParser.cpp

Issue 16917013: [CSS Grid Layout] CSSParser should reject <track-list> without a <track-size> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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 4577 matching lines...) Expand 10 before | Expand all | Expand 10 after
4588 CSSParserValue* value = m_valueList->current(); 4588 CSSParserValue* value = m_valueList->current();
4589 if (value->id == CSSValueNone) { 4589 if (value->id == CSSValueNone) {
4590 if (m_valueList->next()) 4590 if (m_valueList->next())
4591 return false; 4591 return false;
4592 4592
4593 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant); 4593 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant);
4594 return true; 4594 return true;
4595 } 4595 }
4596 4596
4597 RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); 4597 RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
4598 size_t currentLineNumber = 0; 4598 // Handle leading <string>*.
4599 while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiv eValue::CSS_STRING) {
4600 RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList- >current());
4601 values->append(name);
4602 m_valueList->next();
4603 }
4604
4605 bool seenTrackSize = false;
4599 while (m_valueList->current()) { 4606 while (m_valueList->current()) {
4607 RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize();
4608 if (!primitiveValue)
4609 return false;
4610
4611 seenTrackSize = true;
4612 values->append(primitiveValue.release());
4613
4614 // This will handle the trailing <string>* in the grammar.
4600 while (m_valueList->current() && m_valueList->current()->unit == CSSPrim itiveValue::CSS_STRING) { 4615 while (m_valueList->current() && m_valueList->current()->unit == CSSPrim itiveValue::CSS_STRING) {
4601 RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueL ist->current()); 4616 RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueL ist->current());
4602 values->append(name); 4617 values->append(name);
4603 m_valueList->next(); 4618 m_valueList->next();
4604 } 4619 }
4620 }
4605 4621
4606 // This allows trailing <string>* per the specification. 4622 // We should have found a <track-size> or else it is not a valid <track-list >
4607 if (!m_valueList->current()) 4623 if (!seenTrackSize)
4608 break; 4624 return false;
4609 4625
4610 RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize();
4611 if (!primitiveValue)
4612 return false;
4613
4614 values->append(primitiveValue.release());
4615 }
4616 addProperty(propId, values.release(), important); 4626 addProperty(propId, values.release(), important);
4617 return true; 4627 return true;
4618 } 4628 }
4619 4629
4620 PassRefPtr<CSSPrimitiveValue> CSSParser::parseGridTrackSize() 4630 PassRefPtr<CSSPrimitiveValue> CSSParser::parseGridTrackSize()
4621 { 4631 {
4622 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 4632 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
4623 4633
4624 CSSParserValue* currentValue = m_valueList->current(); 4634 CSSParserValue* currentValue = m_valueList->current();
4625 m_valueList->next(); 4635 m_valueList->next();
(...skipping 7180 matching lines...) Expand 10 before | Expand all | Expand 10 after
11806 { 11816 {
11807 // The tokenizer checks for the construct of an+b. 11817 // The tokenizer checks for the construct of an+b.
11808 // However, since the {ident} rule precedes the {nth} rule, some of those 11818 // However, since the {ident} rule precedes the {nth} rule, some of those
11809 // tokens are identified as string literal. Furthermore we need to accept 11819 // tokens are identified as string literal. Furthermore we need to accept
11810 // "odd" and "even" which does not match to an+b. 11820 // "odd" and "even" which does not match to an+b.
11811 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 11821 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11812 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 11822 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11813 } 11823 }
11814 11824
11815 } 11825 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698