Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 if (!parseLegacyPosition(propId, important)) { | |
|
Julien - ping for review
2014/06/24 19:04:56
I would avoid the negative branch as it confused m
jfernandez
2014/06/26 12:58:44
Done.
| |
| 1208 m_valueList->setCurrentIndex(0); | |
| 1209 return parseItemPositionOverflowPosition(propId, important); | |
| 1210 } | |
| 1211 | |
| 1212 return true; | |
| 1213 | |
| 1202 case CSSPropertyGridAutoColumns: | 1214 case CSSPropertyGridAutoColumns: |
| 1203 case CSSPropertyGridAutoRows: | 1215 case CSSPropertyGridAutoRows: |
| 1204 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1216 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
| 1205 return false; | 1217 return false; |
| 1206 parsedValue = parseGridTrackSize(*m_valueList); | 1218 parsedValue = parseGridTrackSize(*m_valueList); |
| 1207 break; | 1219 break; |
| 1208 | 1220 |
| 1209 case CSSPropertyGridTemplateColumns: | 1221 case CSSPropertyGridTemplateColumns: |
| 1210 case CSSPropertyGridTemplateRows: | 1222 case CSSPropertyGridTemplateRows: |
| 1211 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1223 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
| (...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4126 return shape; | 4138 return shape; |
| 4127 } | 4139 } |
| 4128 | 4140 |
| 4129 static bool isItemPositionKeyword(CSSValueID id) | 4141 static bool isItemPositionKeyword(CSSValueID id) |
| 4130 { | 4142 { |
| 4131 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 4143 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
| 4132 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart | 4144 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart |
| 4133 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; | 4145 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; |
| 4134 } | 4146 } |
| 4135 | 4147 |
| 4148 bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important ) | |
| 4149 { | |
| 4150 // [ legacy && [ left | right | center ] | |
| 4151 | |
| 4152 CSSParserValue* value = m_valueList->current(); | |
| 4153 if (!value || value->id != CSSValueLegacy || !(value = m_valueList->next())) | |
|
Julien - ping for review
2014/06/24 19:04:56
Per the grammar: legacy && [ left | right | center
jfernandez
2014/06/26 12:58:44
Done.
| |
| 4154 return false; | |
| 4155 | |
| 4156 if (value->id == CSSValueCenter || value->id == CSSValueLeft || value->id == CSSValueRight) { | |
| 4157 if (m_valueList->next()) | |
| 4158 return false; | |
| 4159 | |
| 4160 addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdenti fierValue(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), imp ortant); | |
| 4161 return true; | |
| 4162 } | |
| 4163 | |
| 4164 return false; | |
| 4165 } | |
| 4166 | |
| 4136 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) | 4167 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) |
| 4137 { | 4168 { |
| 4138 // auto | baseline | stretch | [<item-position> && <overflow-position>? ] | 4169 // auto | baseline | stretch | [<item-position> && <overflow-position>? ] |
| 4139 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right; | 4170 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right; |
| 4140 // <overflow-position> = true | safe | 4171 // <overflow-position> = true | safe |
| 4141 | 4172 |
| 4142 CSSParserValue* value = m_valueList->current(); | 4173 CSSParserValue* value = m_valueList->current(); |
| 4174 if (!value) | |
| 4175 return false; | |
| 4143 | 4176 |
| 4144 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) { | 4177 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) { |
| 4145 if (m_valueList->next()) | 4178 if (m_valueList->next()) |
| 4146 return false; | 4179 return false; |
| 4147 | 4180 |
| 4148 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant); | 4181 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant); |
| 4149 return true; | 4182 return true; |
| 4150 } | 4183 } |
| 4151 | 4184 |
| 4152 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr; | 4185 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr; |
| (...skipping 4264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8417 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8450 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
| 8418 if (!seenStroke) | 8451 if (!seenStroke) |
| 8419 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); | 8452 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); |
| 8420 if (!seenMarkers) | 8453 if (!seenMarkers) |
| 8421 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); | 8454 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); |
| 8422 | 8455 |
| 8423 return parsedValues.release(); | 8456 return parsedValues.release(); |
| 8424 } | 8457 } |
| 8425 | 8458 |
| 8426 } // namespace WebCore | 8459 } // namespace WebCore |
| OLD | NEW |