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

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

Issue 1309513008: [css-grid] Implement grid gutters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed two tests which were not testing gutters code Created 5 years, 3 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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 break; 1253 break;
1254 1254
1255 case CSSPropertyGridColumnEnd: 1255 case CSSPropertyGridColumnEnd:
1256 case CSSPropertyGridColumnStart: 1256 case CSSPropertyGridColumnStart:
1257 case CSSPropertyGridRowEnd: 1257 case CSSPropertyGridRowEnd:
1258 case CSSPropertyGridRowStart: 1258 case CSSPropertyGridRowStart:
1259 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1259 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1260 parsedValue = parseGridPosition(); 1260 parsedValue = parseGridPosition();
1261 break; 1261 break;
1262 1262
1263 case CSSPropertyGridColumnGap:
1264 case CSSPropertyGridRowGap:
1265 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1266 validPrimitive = validUnit(value, FLength | FNonNeg);
1267 break;
1268
1269 case CSSPropertyGridGap:
1270 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1271 return parseGridGapShorthand(important);
1272
1263 case CSSPropertyGridColumn: 1273 case CSSPropertyGridColumn:
1264 case CSSPropertyGridRow: 1274 case CSSPropertyGridRow:
1265 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1275 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1266 return parseGridItemPositionShorthand(propId, important); 1276 return parseGridItemPositionShorthand(propId, important);
1267 1277
1268 case CSSPropertyGridArea: 1278 case CSSPropertyGridArea:
1269 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1279 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1270 return parseGridAreaShorthand(important); 1280 return parseGridAreaShorthand(important);
1271 1281
1272 case CSSPropertyGridTemplateAreas: 1282 case CSSPropertyGridTemplateAreas:
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
3409 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createIdenti fierValue(CSSValueNone), important); 3419 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createIdenti fierValue(CSSValueNone), important);
3410 3420
3411 // [<line-names>? <string> [<track-size> <line-names>]? ]+ 3421 // [<line-names>? <string> [<track-size> <line-names>]? ]+
3412 RefPtrWillBeRawPtr<CSSValue> templateAreas = CSSGridTemplateAreasValue::crea te(gridAreaMap, rowCount, columnCount); 3422 RefPtrWillBeRawPtr<CSSValue> templateAreas = CSSGridTemplateAreasValue::crea te(gridAreaMap, rowCount, columnCount);
3413 addProperty(CSSPropertyGridTemplateAreas, templateAreas.release(), important ); 3423 addProperty(CSSPropertyGridTemplateAreas, templateAreas.release(), important );
3414 addProperty(CSSPropertyGridTemplateRows, templateRows.release(), important); 3424 addProperty(CSSPropertyGridTemplateRows, templateRows.release(), important);
3415 3425
3416 return true; 3426 return true;
3417 } 3427 }
3418 3428
3429 bool CSSPropertyParser::parseGridGapShorthand(bool important)
3430 {
3431 ShorthandScope scope(this, CSSPropertyGridGap);
3432 ASSERT(shorthandForProperty(CSSPropertyGridGap).length() == 2);
3433
3434 CSSParserValue* value = m_valueList->current();
3435 if (!value)
3436 return false;
3437
3438 if (value->id == CSSValueNormal) {
3439 if (m_valueList->next())
3440 return false;
3441 addProperty(CSSPropertyGridColumnGap, cssValuePool().createImplicitIniti alValue(), important);
3442 addProperty(CSSPropertyGridRowGap, cssValuePool().createImplicitInitialV alue(), important);
3443 return true;
3444 }
3445
3446 if (!validUnit(value, FLength | FNonNeg))
3447 return false;
3448
3449 RefPtrWillBeRawPtr<CSSPrimitiveValue> columnGap = createPrimitiveNumericValu e(value);
3450
3451 value = m_valueList->next();
3452 if (!value) {
3453 addProperty(CSSPropertyGridColumnGap, columnGap, important);
3454 addProperty(CSSPropertyGridRowGap, columnGap, important);
3455 return true;
3456 }
3457
3458 if (!validUnit(value, FLength | FNonNeg))
3459 return false;
3460
3461 if (m_valueList->next())
3462 return false;
3463
3464 RefPtrWillBeRawPtr<CSSPrimitiveValue> rowGap = createPrimitiveNumericValue(v alue);
3465
3466 addProperty(CSSPropertyGridColumnGap, columnGap, important);
3467 addProperty(CSSPropertyGridRowGap, rowGap, important);
3468
3469 return true;
3470 }
3471
3419 3472
3420 bool CSSPropertyParser::parseGridTemplateShorthand(bool important) 3473 bool CSSPropertyParser::parseGridTemplateShorthand(bool important)
3421 { 3474 {
3422 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3475 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3423 3476
3424 ShorthandScope scope(this, CSSPropertyGridTemplate); 3477 ShorthandScope scope(this, CSSPropertyGridTemplate);
3425 ASSERT(gridTemplateShorthand().length() == 3); 3478 ASSERT(gridTemplateShorthand().length() == 3);
3426 3479
3427 // At least "none" must be defined. 3480 // At least "none" must be defined.
3428 if (!m_valueList->current()) 3481 if (!m_valueList->current())
(...skipping 4714 matching lines...) Expand 10 before | Expand all | Expand 10 after
8143 } 8196 }
8144 } 8197 }
8145 8198
8146 if (!list->length()) 8199 if (!list->length())
8147 return nullptr; 8200 return nullptr;
8148 8201
8149 return list.release(); 8202 return list.release();
8150 } 8203 }
8151 8204
8152 } // namespace blink 8205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698