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

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

Issue 1777483008: Move the grid-gap shorthand into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (parsedValue) { 297 if (parsedValue) {
298 if (!m_valueList->current() || inShorthand()) 298 if (!m_valueList->current() || inShorthand())
299 return parsedValue.release(); 299 return parsedValue.release();
300 } 300 }
301 return nullptr; 301 return nullptr;
302 } 302 }
303 303
304 bool CSSPropertyParser::legacyParseShorthand(CSSPropertyID propertyID, bool impo rtant) 304 bool CSSPropertyParser::legacyParseShorthand(CSSPropertyID propertyID, bool impo rtant)
305 { 305 {
306 switch (propertyID) { 306 switch (propertyID) {
307 case CSSPropertyGridGap:
308 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
309 return parseGridGapShorthand(important);
310
311 case CSSPropertyGridColumn: 307 case CSSPropertyGridColumn:
312 case CSSPropertyGridRow: 308 case CSSPropertyGridRow:
313 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 309 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
314 return parseGridItemPositionShorthand(propertyID, important); 310 return parseGridItemPositionShorthand(propertyID, important);
315 311
316 case CSSPropertyGridArea: 312 case CSSPropertyGridArea:
317 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 313 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
318 return parseGridAreaShorthand(important); 314 return parseGridAreaShorthand(important);
319 315
320 case CSSPropertyGridTemplate: 316 case CSSPropertyGridTemplate:
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return false; 452 return false;
457 } else { 453 } else {
458 endValue = gridMissingGridPositionValue(startValue.get()); 454 endValue = gridMissingGridPositionValue(startValue.get());
459 } 455 }
460 456
461 addProperty(shorthand.properties()[0], startValue, important); 457 addProperty(shorthand.properties()[0], startValue, important);
462 addProperty(shorthand.properties()[1], endValue, important); 458 addProperty(shorthand.properties()[1], endValue, important);
463 return true; 459 return true;
464 } 460 }
465 461
466 bool CSSPropertyParser::parseGridGapShorthand(bool important)
467 {
468 ShorthandScope scope(this, CSSPropertyGridGap);
469 ASSERT(shorthandForProperty(CSSPropertyGridGap).length() == 2);
470
471 CSSParserValue* value = m_valueList->current();
472 if (!value)
473 return false;
474
475 if (!validUnit(value, FLength | FNonNeg))
476 return false;
477
478 RefPtrWillBeRawPtr<CSSPrimitiveValue> rowGap = createPrimitiveNumericValue(v alue);
479 RefPtrWillBeRawPtr<CSSPrimitiveValue> columnGap = nullptr;
480
481 value = m_valueList->next();
482 if (value) {
483 if (!validUnit(value, FLength | FNonNeg))
484 return false;
485
486 columnGap = createPrimitiveNumericValue(value);
487 if (m_valueList->next())
488 return false;
489 } else {
490 columnGap = rowGap;
491 }
492
493 addProperty(CSSPropertyGridRowGap, rowGap, important);
494 addProperty(CSSPropertyGridColumnGap, columnGap, important);
495
496 return true;
497 }
498
499 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateColumns(boo l important) 462 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateColumns(boo l important)
500 { 463 {
501 if (!(m_valueList->current() && isForwardSlashOperator(m_valueList->current( )) && m_valueList->next())) 464 if (!(m_valueList->current() && isForwardSlashOperator(m_valueList->current( )) && m_valueList->next()))
502 return nullptr; 465 return nullptr;
503 if (RefPtrWillBeRawPtr<CSSValue> columnsValue = parseGridTrackList()) { 466 if (RefPtrWillBeRawPtr<CSSValue> columnsValue = parseGridTrackList()) {
504 if (m_valueList->current()) 467 if (m_valueList->current())
505 return nullptr; 468 return nullptr;
506 return columnsValue; 469 return columnsValue;
507 } 470 }
508 471
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 ASSERT(!m_parsedCalculation); 1088 ASSERT(!m_parsedCalculation);
1126 m_parsedCalculation = CSSCalcValue::create(args, range); 1089 m_parsedCalculation = CSSCalcValue::create(args, range);
1127 1090
1128 if (!m_parsedCalculation) 1091 if (!m_parsedCalculation)
1129 return false; 1092 return false;
1130 1093
1131 return true; 1094 return true;
1132 } 1095 }
1133 1096
1134 } // namespace blink 1097 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698