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

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

Issue 636993002: [CSS Grid Layout] Upgrade justify-content parsing to CSS3 Box Alignment spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 case CSSPropertyWebkitTransitionDuration: 1198 case CSSPropertyWebkitTransitionDuration:
1199 case CSSPropertyWebkitTransitionTimingFunction: 1199 case CSSPropertyWebkitTransitionTimingFunction:
1200 case CSSPropertyWebkitTransitionProperty: { 1200 case CSSPropertyWebkitTransitionProperty: {
1201 if (RefPtrWillBeRawPtr<CSSValueList> val = parseAnimationPropertyList(pr opId)) { 1201 if (RefPtrWillBeRawPtr<CSSValueList> val = parseAnimationPropertyList(pr opId)) {
1202 addPropertyWithPrefixingVariant(propId, val.release(), important); 1202 addPropertyWithPrefixingVariant(propId, val.release(), important);
1203 return true; 1203 return true;
1204 } 1204 }
1205 return false; 1205 return false;
1206 } 1206 }
1207 1207
1208 case CSSPropertyJustifyContent:
1209 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1210 return parseContentDistributionOverflowPosition(propId, important);
1208 case CSSPropertyJustifySelf: 1211 case CSSPropertyJustifySelf:
1209 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1212 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1210 return parseItemPositionOverflowPosition(propId, important); 1213 return parseItemPositionOverflowPosition(propId, important);
1211 case CSSPropertyJustifyItems: 1214 case CSSPropertyJustifyItems:
1212 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1215 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1213 1216
1214 if (parseLegacyPosition(propId, important)) 1217 if (parseLegacyPosition(propId, important))
1215 return true; 1218 return true;
1216 1219
1217 m_valueList->setCurrentIndex(0); 1220 m_valueList->setCurrentIndex(0);
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
4085 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy ) 4088 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy )
4086 return false; 4089 return false;
4087 } else { 4090 } else {
4088 return false; 4091 return false;
4089 } 4092 }
4090 4093
4091 addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdentifier Value(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), importa nt); 4094 addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdentifier Value(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), importa nt);
4092 return !m_valueList->next(); 4095 return !m_valueList->next();
4093 } 4096 }
4094 4097
4098 bool CSSPropertyParser::parseContentDistributionOverflowPosition(CSSPropertyID p ropId, bool important)
Timothy Loh 2014/10/21 03:51:09 Maybe "PassRefPtrWillBeRawPtr<CSSValue> CSSPropert
jfernandez 2014/10/27 11:44:37 I implemented parsing methods of both forms and st
4099 {
4100 // auto | <baseline-position> | [ <content-distribution> <content-position>? | <content-position> ] && <overflow-position>?
Julien - ping for review 2014/10/20 21:24:02 The editor's draft version has a different syntax
jfernandez 2014/10/27 11:44:37 The current implementation already follows the new
4101 // <baseline-position> = baseline | last-baseline;
4102 // <content-distribution> = space-between | space-around | space-evenly | st retch;
4103 // <content-position> = center | start | end | flex-start | flex-end | left | right;
4104 // <overflow-position> = true | safe
4105
4106 CSSParserValue* value = m_valueList->current();
4107 if (!value)
Timothy Loh 2014/10/21 03:51:09 We're guaranteed to have at least one value by thi
jfernandez 2014/10/27 11:44:37 Done.
4108 return false;
4109
4110 if (value->id == CSSValueAuto || isBaselinePositionKeyword(value->id)) {
4111 if (m_valueList->next())
Timothy Loh 2014/10/21 03:51:09 Won't need this check if we return a CSSValue as p
jfernandez 2014/10/27 11:44:37 I agree that we don't need to check whether next()
Timothy Loh 2014/10/27 11:55:30 Whoops sorry, thought the caller would advance the
4112 return false;
4113
4114 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant);
4115 return true;
4116 }
4117
4118 RefPtrWillBeRawPtr<CSSPrimitiveValue> distribution = nullptr;
4119 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr;
4120 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflow = nullptr;
4121 if (value->id == CSSValueTrue || value->id == CSSValueSafe) {
4122 overflow = cssValuePool().createIdentifierValue(value->id);
4123 value = m_valueList->next();
4124 }
4125 if (value && CSSPrimitiveValue::isContentDistributionKeyword(value->id)) {
4126 distribution = cssValuePool().createIdentifierValue(value->id);
4127 value = m_valueList->next();
4128 }
4129 if (value && CSSPrimitiveValue::isContentPositionKeyword(value->id)) {
4130 position = cssValuePool().createIdentifierValue(value->id);
4131 value = m_valueList->next();
4132 }
4133 if (value) {
4134 if (overflow || (value->id != CSSValueTrue && value->id != CSSValueSafe) )
4135 return false;
4136 overflow = cssValuePool().createIdentifierValue(value->id);
4137 }
4138
4139 if (m_valueList->next() || !(position || distribution))
Timothy Loh 2014/10/21 03:51:09 Probably don't need to check m_valueList->next() w
jfernandez 2014/10/27 11:44:37 It seems next() call is still needed, as I comment
4140 return false;
4141
4142 RefPtrWillBeRawPtr<CSSPrimitiveValue> content = nullptr;
4143 if (position && distribution)
4144 content = createPrimitiveValuePair(distribution, position);
4145 else
4146 content = position ? position : distribution;
4147 if (overflow)
4148 addProperty(propId, createPrimitiveValuePair(content, overflow), importa nt);
4149 else
4150 addProperty(propId, content.release(), important);
4151
4152 return true;
4153 }
4154
4095 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) 4155 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important)
4096 { 4156 {
4097 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi tion>? ] 4157 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi tion>? ]
4098 // <baseline-position> = baseline | last-baseline; 4158 // <baseline-position> = baseline | last-baseline;
4099 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right; 4159 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right;
4100 // <overflow-position> = true | safe 4160 // <overflow-position> = true | safe
4101 4161
4102 CSSParserValue* value = m_valueList->current(); 4162 CSSParserValue* value = m_valueList->current();
4103 if (!value) 4163 if (!value)
4104 return false; 4164 return false;
(...skipping 4069 matching lines...) Expand 10 before | Expand all | Expand 10 after
8174 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8234 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8175 if (!seenStroke) 8235 if (!seenStroke)
8176 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8236 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8177 if (!seenMarkers) 8237 if (!seenMarkers)
8178 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8238 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8179 8239
8180 return parsedValues.release(); 8240 return parsedValues.release();
8181 } 8241 }
8182 8242
8183 } // namespace blink 8243 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698