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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1309513008: [css-grid] Implement grid gutters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing v3 Created 5 years, 2 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 break; 1165 break;
1166 1166
1167 case CSSPropertyGridColumnEnd: 1167 case CSSPropertyGridColumnEnd:
1168 case CSSPropertyGridColumnStart: 1168 case CSSPropertyGridColumnStart:
1169 case CSSPropertyGridRowEnd: 1169 case CSSPropertyGridRowEnd:
1170 case CSSPropertyGridRowStart: 1170 case CSSPropertyGridRowStart:
1171 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1171 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1172 parsedValue = parseGridPosition(); 1172 parsedValue = parseGridPosition();
1173 break; 1173 break;
1174 1174
1175 case CSSPropertyGridColumnGap:
1176 case CSSPropertyGridRowGap:
1177 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1178 validPrimitive = validUnit(value, FLength | FNonNeg);
rune 2015/10/05 12:23:39 The current spec draft doesn't say it's limited to
svillar 2015/10/05 12:36:01 True, I think it's just an overlook, actually the
rune 2015/10/05 12:47:10 Yes, I just wanted to make sure the spec issue is
1179 break;
1180
1181 case CSSPropertyGridGap:
1182 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1183 return parseGridGapShorthand(important);
1184
1175 case CSSPropertyGridColumn: 1185 case CSSPropertyGridColumn:
1176 case CSSPropertyGridRow: 1186 case CSSPropertyGridRow:
1177 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1187 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1178 return parseGridItemPositionShorthand(propId, important); 1188 return parseGridItemPositionShorthand(propId, important);
1179 1189
1180 case CSSPropertyGridArea: 1190 case CSSPropertyGridArea:
1181 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1191 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1182 return parseGridAreaShorthand(important); 1192 return parseGridAreaShorthand(important);
1183 1193
1184 case CSSPropertyGridTemplateAreas: 1194 case CSSPropertyGridTemplateAreas:
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3190 return false; 3200 return false;
3191 } else { 3201 } else {
3192 endValue = gridMissingGridPositionValue(startValue.get()); 3202 endValue = gridMissingGridPositionValue(startValue.get());
3193 } 3203 }
3194 3204
3195 addProperty(shorthand.properties()[0], startValue, important); 3205 addProperty(shorthand.properties()[0], startValue, important);
3196 addProperty(shorthand.properties()[1], endValue, important); 3206 addProperty(shorthand.properties()[1], endValue, important);
3197 return true; 3207 return true;
3198 } 3208 }
3199 3209
3210 bool CSSPropertyParser::parseGridGapShorthand(bool important)
fs 2015/10/05 10:53:28 Could you use parseShorthand instead?
svillar 2015/10/05 11:58:40 I don't think so because although ideally the shor
fs 2015/10/05 12:01:54 Right, I figured it might be the column-gap -> row
3211 {
3212 ShorthandScope scope(this, CSSPropertyGridGap);
3213 ASSERT(shorthandForProperty(CSSPropertyGridGap).length() == 2);
3214
3215 CSSParserValue* value = m_valueList->current();
3216 if (!value)
3217 return false;
3218
3219 if (value->id == CSSValueNormal) {
3220 if (m_valueList->next())
3221 return false;
3222 addProperty(CSSPropertyGridColumnGap, cssValuePool().createImplicitIniti alValue(), important);
rune 2015/10/05 12:23:39 According to the spec, "normal" is not a valid val
svillar 2015/10/05 12:36:01 That was specified in the previous draft, see http
rune 2015/10/05 12:47:10 Ah. So the property used to be shared with multico
3223 addProperty(CSSPropertyGridRowGap, cssValuePool().createImplicitInitialV alue(), important);
3224 return true;
3225 }
3226
3227 if (!validUnit(value, FLength | FNonNeg))
3228 return false;
3229
3230 RefPtrWillBeRawPtr<CSSPrimitiveValue> columnGap = createPrimitiveNumericValu e(value);
3231
3232 value = m_valueList->next();
3233 if (!value) {
3234 addProperty(CSSPropertyGridColumnGap, columnGap, important);
3235 addProperty(CSSPropertyGridRowGap, columnGap, important);
rune 2015/10/05 12:23:39 I think it this code might be easier to read if yo
svillar 2015/10/05 12:36:01 Acknowledged.
3236 return true;
3237 }
3238
3239 if (!validUnit(value, FLength | FNonNeg))
3240 return false;
3241
3242 if (m_valueList->next())
3243 return false;
3244
3245 RefPtrWillBeRawPtr<CSSPrimitiveValue> rowGap = createPrimitiveNumericValue(v alue);
3246
3247 addProperty(CSSPropertyGridColumnGap, columnGap, important);
3248 addProperty(CSSPropertyGridRowGap, rowGap, important);
3249
3250 return true;
3251 }
3252
3200 bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS Value> templateColumns, bool important) 3253 bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS Value> templateColumns, bool important)
3201 { 3254 {
3202 NamedGridAreaMap gridAreaMap; 3255 NamedGridAreaMap gridAreaMap;
3203 size_t rowCount = 0; 3256 size_t rowCount = 0;
3204 size_t columnCount = 0; 3257 size_t columnCount = 0;
3205 bool trailingIdentWasAdded = false; 3258 bool trailingIdentWasAdded = false;
3206 RefPtrWillBeRawPtr<CSSValueList> templateRows = CSSValueList::createSpaceSep arated(); 3259 RefPtrWillBeRawPtr<CSSValueList> templateRows = CSSValueList::createSpaceSep arated();
3207 3260
3208 // At least template-areas strings must be defined. 3261 // At least template-areas strings must be defined.
3209 if (!m_valueList->current()) 3262 if (!m_valueList->current())
(...skipping 4253 matching lines...) Expand 10 before | Expand all | Expand 10 after
7463 } 7516 }
7464 } 7517 }
7465 7518
7466 if (!list->length()) 7519 if (!list->length())
7467 return nullptr; 7520 return nullptr;
7468 7521
7469 return list.release(); 7522 return list.release();
7470 } 7523 }
7471 7524
7472 } // namespace blink 7525 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698