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

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

Issue 333423005: [CSS Grid Layout] Implement 'justify-items' parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 return true; 1192 return true;
1193 } 1193 }
1194 return false; 1194 return false;
1195 } 1195 }
1196 1196
1197 case CSSPropertyJustifySelf: 1197 case CSSPropertyJustifySelf:
1198 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) 1198 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
1199 return false; 1199 return false;
1200 1200
1201 return parseItemPositionOverflowPosition(propId, important); 1201 return parseItemPositionOverflowPosition(propId, important);
1202
1203 case CSSPropertyJustifyItems:
1204 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
1205 return false;
1206
1207 return parseLegacyPosition(propId, important) || parseItemPositionOverfl owPosition(propId, important);
1208
1202 case CSSPropertyGridAutoColumns: 1209 case CSSPropertyGridAutoColumns:
1203 case CSSPropertyGridAutoRows: 1210 case CSSPropertyGridAutoRows:
1204 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) 1211 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
1205 return false; 1212 return false;
1206 parsedValue = parseGridTrackSize(*m_valueList); 1213 parsedValue = parseGridTrackSize(*m_valueList);
1207 break; 1214 break;
1208 1215
1209 case CSSPropertyGridTemplateColumns: 1216 case CSSPropertyGridTemplateColumns:
1210 case CSSPropertyGridTemplateRows: 1217 case CSSPropertyGridTemplateRows:
1211 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) 1218 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after
4126 return shape; 4133 return shape;
4127 } 4134 }
4128 4135
4129 static bool isItemPositionKeyword(CSSValueID id) 4136 static bool isItemPositionKeyword(CSSValueID id)
4130 { 4137 {
4131 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter 4138 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
4132 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart 4139 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart
4133 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; 4140 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight;
4134 } 4141 }
4135 4142
4143 bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important )
4144 {
4145 // [ legacy && [ left | right | center ]
4146
4147 CSSParserValue* value = m_valueList->current();
4148 if (value->id != CSSValueLegacy || !m_valueList->next())
4149 return false;
4150
4151 if (value->id == CSSValueCenter || value->id == CSSValueLeft || value->id == CSSValueRight) {
cbiesinger 2014/06/17 22:53:33 Don't you need an m_valueList->current() call / ke
jfernandez 2014/06/19 15:19:14 Done.
4152 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant);
4153 }
cbiesinger 2014/06/17 22:53:33 else return false?
jfernandez 2014/06/19 15:19:14 Done.
4154
4155 return true;
cbiesinger 2014/06/17 22:53:33 Also, I'm not 100% sure but I think you need an "i
jfernandez 2014/06/19 15:19:14 Done.
4156 }
4157
4136 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) 4158 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important)
4137 { 4159 {
4138 // auto | baseline | stretch | [<item-position> && <overflow-position>? ] 4160 // auto | baseline | stretch | [<item-position> && <overflow-position>? ]
4139 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right; 4161 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right;
4140 // <overflow-position> = true | safe 4162 // <overflow-position> = true | safe
4141 4163
4142 CSSParserValue* value = m_valueList->current(); 4164 CSSParserValue* value = m_valueList->current();
4143 4165
4144 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) { 4166 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) {
4145 if (m_valueList->next()) 4167 if (m_valueList->next())
(...skipping 4271 matching lines...) Expand 10 before | Expand all | Expand 10 after
8417 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8439 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8418 if (!seenStroke) 8440 if (!seenStroke)
8419 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8441 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8420 if (!seenMarkers) 8442 if (!seenMarkers)
8421 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8443 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8422 8444
8423 return parsedValues.release(); 8445 return parsedValues.release();
8424 } 8446 }
8425 8447
8426 } // namespace WebCore 8448 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698