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

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

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 { 301 {
302 RefPtrWillBeRawPtr<CSSValue> dummyValue = nullptr; 302 RefPtrWillBeRawPtr<CSSValue> dummyValue = nullptr;
303 CSSPropertyID propId1, propId2; 303 CSSPropertyID propId1, propId2;
304 if (!parseFillProperty(unresolvedProperty, propId1, propId2, parsedValue , dummyValue)) 304 if (!parseFillProperty(unresolvedProperty, propId1, propId2, parsedValue , dummyValue))
305 return nullptr; 305 return nullptr;
306 ASSERT(!dummyValue); 306 ASSERT(!dummyValue);
307 break; 307 break;
308 } 308 }
309 case CSSPropertyJustifySelf: 309 case CSSPropertyJustifySelf:
310 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 310 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
311 parsedValue = parseItemPositionOverflowPosition(); 311 parsedValue = parseItemPositionOverflowPosition(propId);
312 break; 312 break;
313 case CSSPropertyJustifyItems: 313 case CSSPropertyJustifyItems:
314 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 314 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
315 315
316 if ((parsedValue = parseLegacyPosition())) 316 if ((parsedValue = parseLegacyPosition()))
317 break; 317 break;
318 318
319 m_valueList->setCurrentIndex(0); 319 m_valueList->setCurrentIndex(0);
320 parsedValue = parseItemPositionOverflowPosition(); 320 parsedValue = parseItemPositionOverflowPosition(propId);
321 break; 321 break;
322 case CSSPropertyGridAutoFlow: 322 case CSSPropertyGridAutoFlow:
323 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 323 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
324 parsedValue = parseGridAutoFlow(*m_valueList); 324 parsedValue = parseGridAutoFlow(*m_valueList);
325 break; 325 break;
326 case CSSPropertyGridAutoColumns: 326 case CSSPropertyGridAutoColumns:
327 case CSSPropertyGridAutoRows: 327 case CSSPropertyGridAutoRows:
328 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 328 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
329 parsedValue = parseGridTrackSize(*m_valueList); 329 parsedValue = parseGridTrackSize(*m_valueList);
330 break; 330 break;
(...skipping 14 matching lines...) Expand all
345 345
346 case CSSPropertyGridTemplateAreas: 346 case CSSPropertyGridTemplateAreas:
347 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 347 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
348 parsedValue = parseGridTemplateAreas(); 348 parsedValue = parseGridTemplateAreas();
349 break; 349 break;
350 350
351 break; 351 break;
352 352
353 case CSSPropertyAlignSelf: 353 case CSSPropertyAlignSelf:
354 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 354 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
355 parsedValue = parseItemPositionOverflowPosition(); 355 parsedValue = parseItemPositionOverflowPosition(propId);
356 break; 356 break;
357 357
358 case CSSPropertyAlignItems: 358 case CSSPropertyAlignItems:
359 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 359 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
360 parsedValue = parseItemPositionOverflowPosition(); 360 parsedValue = parseItemPositionOverflowPosition(propId);
361 break; 361 break;
362 362
363 // Everything else is handled in CSSPropertyParser.cpp 363 // Everything else is handled in CSSPropertyParser.cpp
364 default: 364 default:
365 return nullptr; 365 return nullptr;
366 } 366 }
367 367
368 ASSERT(!m_parsedCalculation); 368 ASSERT(!m_parsedCalculation);
369 if (parsedValue) { 369 if (parsedValue) {
370 if (!m_valueList->current() || inShorthand()) 370 if (!m_valueList->current() || inShorthand())
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy ) 2092 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy )
2093 return nullptr; 2093 return nullptr;
2094 } else { 2094 } else {
2095 return nullptr; 2095 return nullptr;
2096 } 2096 }
2097 2097
2098 m_valueList->next(); 2098 m_valueList->next();
2099 return CSSValuePair::create(cssValuePool().createIdentifierValue(CSSValueLeg acy), cssValuePool().createIdentifierValue(value->id), CSSValuePair::DropIdentic alValues); 2099 return CSSValuePair::create(cssValuePool().createIdentifierValue(CSSValueLeg acy), cssValuePool().createIdentifierValue(value->id), CSSValuePair::DropIdentic alValues);
2100 } 2100 }
2101 2101
2102 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseItemPositionOverflowPos ition() 2102 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseItemPositionOverflowPos ition(CSSPropertyID propId)
2103 { 2103 {
2104 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi tion>? ] 2104 // auto | normal | stretch | <baseline-position> | [<item-position> && <over flow-position>? ]
2105 // <baseline-position> = baseline | last-baseline; 2105 // <baseline-position> = baseline | last-baseline;
2106 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right; 2106 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right;
2107 // <overflow-position> = unsafe | safe 2107 // <overflow-position> = unsafe | safe
2108 2108
2109 CSSParserValue* value = m_valueList->current(); 2109 CSSParserValue* value = m_valueList->current();
2110 ASSERT(value); 2110 ASSERT(value);
2111 2111
2112 if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselineP ositionKeyword(value->id)) { 2112 if (value->id == CSSValueAuto || value->id == CSSValueNormal || value->id == CSSValueStretch || isBaselinePositionKeyword(value->id)) {
2113 // align-items property does not allow the 'auto' value.
2114 if (value->id == CSSValueAuto && propId == CSSPropertyAlignItems)
2115 return nullptr;
2113 m_valueList->next(); 2116 m_valueList->next();
2114 return cssValuePool().createIdentifierValue(value->id); 2117 return cssValuePool().createIdentifierValue(value->id);
2115 } 2118 }
2116 2119
2117 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr; 2120 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr;
2118 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = nullptr; 2121 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = nullptr;
2119 if (isItemPositionKeyword(value->id)) { 2122 if (isItemPositionKeyword(value->id)) {
2120 position = cssValuePool().createIdentifierValue(value->id); 2123 position = cssValuePool().createIdentifierValue(value->id);
2121 value = m_valueList->next(); 2124 value = m_valueList->next();
2122 if (value) { 2125 if (value) {
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 ASSERT(!m_parsedCalculation); 3155 ASSERT(!m_parsedCalculation);
3153 m_parsedCalculation = CSSCalcValue::create(args, range); 3156 m_parsedCalculation = CSSCalcValue::create(args, range);
3154 3157
3155 if (!m_parsedCalculation) 3158 if (!m_parsedCalculation)
3156 return false; 3159 return false;
3157 3160
3158 return true; 3161 return true;
3159 } 3162 }
3160 3163
3161 } // namespace blink 3164 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698