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

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

Issue 17090005: [CSS Grid Layout] Implement 'justify-self' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Scrubbed and rebaselined patch Created 7 years, 1 month 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
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('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 * 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 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 case CSSPropertyWebkitTransitionProperty: { 2479 case CSSPropertyWebkitTransitionProperty: {
2480 RefPtr<CSSValue> val; 2480 RefPtr<CSSValue> val;
2481 AnimationParseContext context; 2481 AnimationParseContext context;
2482 if (parseAnimationProperty(propId, val, context)) { 2482 if (parseAnimationProperty(propId, val, context)) {
2483 addPropertyWithPrefixingVariant(propId, val.release(), important); 2483 addPropertyWithPrefixingVariant(propId, val.release(), important);
2484 return true; 2484 return true;
2485 } 2485 }
2486 return false; 2486 return false;
2487 } 2487 }
2488 2488
2489 case CSSPropertyJustifySelf:
2490 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
2491 return false;
2492
2493 return parseJustifySelf(propId, important);
2489 case CSSPropertyGridAutoColumns: 2494 case CSSPropertyGridAutoColumns:
2490 case CSSPropertyGridAutoRows: 2495 case CSSPropertyGridAutoRows:
2491 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) 2496 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
2492 return false; 2497 return false;
2493 parsedValue = parseGridTrackSize(*m_valueList); 2498 parsedValue = parseGridTrackSize(*m_valueList);
2494 break; 2499 break;
2495 2500
2496 case CSSPropertyGridDefinitionColumns: 2501 case CSSPropertyGridDefinitionColumns:
2497 case CSSPropertyGridDefinitionRows: 2502 case CSSPropertyGridDefinitionRows:
2498 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) 2503 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 i++; 5132 i++;
5128 } 5133 }
5129 if (valid) { 5134 if (valid) {
5130 addProperty(propId, cssValuePool().createValue(rect.release()), importan t); 5135 addProperty(propId, cssValuePool().createValue(rect.release()), importan t);
5131 m_valueList->next(); 5136 m_valueList->next();
5132 return true; 5137 return true;
5133 } 5138 }
5134 return false; 5139 return false;
5135 } 5140 }
5136 5141
5142 static bool isItemPosition(CSSValueID id)
ojan 2013/11/25 21:24:08 This is a confusing name...how about...isJustifySe
Julien - ping for review 2013/11/26 00:08:24 This syntax is also used for justify-items / align
5143 {
5144 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
5145 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart
5146 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight;
5147 }
5148
5149 bool CSSParser::parseJustifySelf(CSSPropertyID propId, bool important)
5150 {
5151 // auto | baseline | stretch | [<item-position> && <overflow-position>? ]
5152 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right;
5153 // <overflow-position> = true | safe
5154
5155 CSSParserValue* value = m_valueList->current();
5156
5157 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) {
5158 if (m_valueList->next())
5159 return false;
5160
5161 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant);
5162 return true;
5163 }
5164
5165 RefPtr<CSSPrimitiveValue> position = 0;
5166 RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0;
5167 if (isItemPosition(value->id)) {
5168 position = cssValuePool().createIdentifierValue(value->id);
5169 value = m_valueList->next();
5170 if (value) {
5171 if (value->id == CSSValueTrue || value->id == CSSValueSafe)
5172 overflowAlignmentKeyword = cssValuePool().createIdentifierValue( value->id);
5173 else
5174 return false;
5175 }
5176 } else if (value->id == CSSValueTrue || value->id == CSSValueSafe) {
5177 overflowAlignmentKeyword = cssValuePool().createIdentifierValue(value->i d);
5178 value = m_valueList->next();
5179 if (value) {
5180 if (isItemPosition(value->id))
5181 position = cssValuePool().createIdentifierValue(value->id);
5182 else
5183 return false;
5184 }
5185 } else {
5186 return false;
5187 }
5188
5189 if (m_valueList->next())
5190 return false;
5191
5192 ASSERT(position);
5193 if (overflowAlignmentKeyword)
5194 addProperty(propId, createPrimitiveValuePair(position, overflowAlignment Keyword), important);
5195 else
5196 addProperty(propId, position.release(), important);
5197
5198 return true;
5199 }
5200
5137 PassRefPtr<CSSBasicShape> CSSParser::parseBasicShapeRectangle(CSSParserValueList * args) 5201 PassRefPtr<CSSBasicShape> CSSParser::parseBasicShapeRectangle(CSSParserValueList * args)
5138 { 5202 {
5139 ASSERT(args); 5203 ASSERT(args);
5140 5204
5141 // rect(x, y, width, height, [[rx], ry]) 5205 // rect(x, y, width, height, [[rx], ry])
5142 if (args->size() != 7 && args->size() != 9 && args->size() != 11) 5206 if (args->size() != 7 && args->size() != 9 && args->size() != 11)
5143 return 0; 5207 return 0;
5144 5208
5145 RefPtr<CSSBasicShapeRectangle> shape = CSSBasicShapeRectangle::create(); 5209 RefPtr<CSSBasicShapeRectangle> shape = CSSBasicShapeRectangle::create();
5146 5210
(...skipping 6806 matching lines...) Expand 10 before | Expand all | Expand 10 after
11953 { 12017 {
11954 // The tokenizer checks for the construct of an+b. 12018 // The tokenizer checks for the construct of an+b.
11955 // However, since the {ident} rule precedes the {nth} rule, some of those 12019 // However, since the {ident} rule precedes the {nth} rule, some of those
11956 // tokens are identified as string literal. Furthermore we need to accept 12020 // tokens are identified as string literal. Furthermore we need to accept
11957 // "odd" and "even" which does not match to an+b. 12021 // "odd" and "even" which does not match to an+b.
11958 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 12022 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11959 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 12023 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11960 } 12024 }
11961 12025
11962 } 12026 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698