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

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

Issue 1807603002: Move the grid-column/grid-row shorthands into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (parsedValue) { 290 if (parsedValue) {
291 if (!m_valueList->current() || inShorthand()) 291 if (!m_valueList->current() || inShorthand())
292 return parsedValue.release(); 292 return parsedValue.release();
293 } 293 }
294 return nullptr; 294 return nullptr;
295 } 295 }
296 296
297 bool CSSPropertyParser::legacyParseShorthand(CSSPropertyID propertyID, bool impo rtant) 297 bool CSSPropertyParser::legacyParseShorthand(CSSPropertyID propertyID, bool impo rtant)
298 { 298 {
299 switch (propertyID) { 299 switch (propertyID) {
300 case CSSPropertyGridColumn:
301 case CSSPropertyGridRow:
302 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
303 return parseGridItemPositionShorthand(propertyID, important);
304
305 case CSSPropertyGridArea: 300 case CSSPropertyGridArea:
306 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 301 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
307 return parseGridAreaShorthand(important); 302 return parseGridAreaShorthand(important);
308 303
309 case CSSPropertyGridTemplate: 304 case CSSPropertyGridTemplate:
310 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 305 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
311 return parseGridTemplateShorthand(important); 306 return parseGridTemplateShorthand(important);
312 307
313 case CSSPropertyGrid: 308 case CSSPropertyGrid:
314 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 309 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 410 }
416 411
417 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v alue) 412 static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* v alue)
418 { 413 {
419 if (value->isCustomIdentValue()) 414 if (value->isCustomIdentValue())
420 return value; 415 return value;
421 416
422 return cssValuePool().createIdentifierValue(CSSValueAuto); 417 return cssValuePool().createIdentifierValue(CSSValueAuto);
423 } 418 }
424 419
425 bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId , bool important)
426 {
427 ShorthandScope scope(this, shorthandId);
428 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
429 ASSERT(shorthand.length() == 2);
430
431 RefPtrWillBeRawPtr<CSSValue> startValue = parseGridPosition();
432 if (!startValue)
433 return false;
434
435 RefPtrWillBeRawPtr<CSSValue> endValue = nullptr;
436 if (m_valueList->current()) {
437 if (!isForwardSlashOperator(m_valueList->current()))
438 return false;
439
440 if (!m_valueList->next())
441 return false;
442
443 endValue = parseGridPosition();
444 if (!endValue || m_valueList->current())
445 return false;
446 } else {
447 endValue = gridMissingGridPositionValue(startValue.get());
448 }
449
450 addProperty(shorthand.properties()[0], startValue, important);
451 addProperty(shorthand.properties()[1], endValue, important);
452 return true;
453 }
454
455 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateColumns(boo l important) 420 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateColumns(boo l important)
456 { 421 {
457 if (!(m_valueList->current() && isForwardSlashOperator(m_valueList->current( )) && m_valueList->next())) 422 if (!(m_valueList->current() && isForwardSlashOperator(m_valueList->current( )) && m_valueList->next()))
458 return nullptr; 423 return nullptr;
459 if (RefPtrWillBeRawPtr<CSSValue> columnsValue = parseGridTrackList()) { 424 if (RefPtrWillBeRawPtr<CSSValue> columnsValue = parseGridTrackList()) {
460 if (m_valueList->current()) 425 if (m_valueList->current())
461 return nullptr; 426 return nullptr;
462 return columnsValue; 427 return columnsValue;
463 } 428 }
464 429
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 ASSERT(!m_parsedCalculation); 1061 ASSERT(!m_parsedCalculation);
1097 m_parsedCalculation = CSSCalcValue::create(args, range); 1062 m_parsedCalculation = CSSCalcValue::create(args, range);
1098 1063
1099 if (!m_parsedCalculation) 1064 if (!m_parsedCalculation)
1100 return false; 1065 return false;
1101 1066
1102 return true; 1067 return true;
1103 } 1068 }
1104 1069
1105 } // namespace blink 1070 } // 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