OLD | NEW |
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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 return true; | 1190 return true; |
1191 } | 1191 } |
1192 return false; | 1192 return false; |
1193 } | 1193 } |
1194 | 1194 |
1195 case CSSPropertyJustifySelf: | 1195 case CSSPropertyJustifySelf: |
1196 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1196 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
1197 return false; | 1197 return false; |
1198 | 1198 |
1199 return parseItemPositionOverflowPosition(propId, important); | 1199 return parseItemPositionOverflowPosition(propId, important); |
| 1200 case CSSPropertyJustifyItems: |
| 1201 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
| 1202 return false; |
| 1203 |
| 1204 if (parseLegacyPosition(propId, important)) |
| 1205 return true; |
| 1206 |
| 1207 m_valueList->setCurrentIndex(0); |
| 1208 return parseItemPositionOverflowPosition(propId, important); |
1200 case CSSPropertyGridAutoFlow: | 1209 case CSSPropertyGridAutoFlow: |
1201 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1210 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
1202 return false; | 1211 return false; |
1203 parsedValue = parseGridAutoFlow(*m_valueList); | 1212 parsedValue = parseGridAutoFlow(*m_valueList); |
1204 break; | 1213 break; |
1205 case CSSPropertyGridAutoColumns: | 1214 case CSSPropertyGridAutoColumns: |
1206 case CSSPropertyGridAutoRows: | 1215 case CSSPropertyGridAutoRows: |
1207 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1216 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
1208 return false; | 1217 return false; |
1209 parsedValue = parseGridTrackSize(*m_valueList); | 1218 parsedValue = parseGridTrackSize(*m_valueList); |
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4173 } | 4182 } |
4174 default: | 4183 default: |
4175 return nullptr; | 4184 return nullptr; |
4176 } | 4185 } |
4177 | 4186 |
4178 if (hasRoundedInset) | 4187 if (hasRoundedInset) |
4179 return parseInsetRoundedCorners(shape, args); | 4188 return parseInsetRoundedCorners(shape, args); |
4180 return shape; | 4189 return shape; |
4181 } | 4190 } |
4182 | 4191 |
| 4192 static bool isBaselinePositionKeyword(CSSValueID id) |
| 4193 { |
| 4194 return id == CSSValueBaseline || id == CSSValueLastBaseline; |
| 4195 } |
| 4196 |
4183 static bool isItemPositionKeyword(CSSValueID id) | 4197 static bool isItemPositionKeyword(CSSValueID id) |
4184 { | 4198 { |
4185 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 4199 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
4186 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart | 4200 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart |
4187 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; | 4201 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; |
4188 } | 4202 } |
4189 | 4203 |
| 4204 bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important
) |
| 4205 { |
| 4206 // [ legacy && [ left | right | center ] |
| 4207 |
| 4208 CSSParserValue* value = m_valueList->current(); |
| 4209 if (!value) |
| 4210 return false; |
| 4211 |
| 4212 if (value->id == CSSValueLegacy) { |
| 4213 value = m_valueList->next(); |
| 4214 if (!value) |
| 4215 return false; |
| 4216 if (value->id != CSSValueCenter && value->id != CSSValueLeft && value->i
d != CSSValueRight) |
| 4217 return false; |
| 4218 } else if (value->id == CSSValueCenter || value->id == CSSValueLeft || value
->id == CSSValueRight) { |
| 4219 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy
) |
| 4220 return false; |
| 4221 } else { |
| 4222 return false; |
| 4223 } |
| 4224 |
| 4225 addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdentifier
Value(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), importa
nt); |
| 4226 return !m_valueList->next(); |
| 4227 } |
| 4228 |
4190 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId,
bool important) | 4229 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId,
bool important) |
4191 { | 4230 { |
4192 // auto | baseline | stretch | [<item-position> && <overflow-position>? ] | 4231 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi
tion>? ] |
| 4232 // <baseline-position> = baseline | last-baseline; |
4193 // <item-position> = center | start | end | self-start | self-end | flex-sta
rt | flex-end | left | right; | 4233 // <item-position> = center | start | end | self-start | self-end | flex-sta
rt | flex-end | left | right; |
4194 // <overflow-position> = true | safe | 4234 // <overflow-position> = true | safe |
4195 | 4235 |
4196 CSSParserValue* value = m_valueList->current(); | 4236 CSSParserValue* value = m_valueList->current(); |
| 4237 if (!value) |
| 4238 return false; |
4197 | 4239 |
4198 if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id
== CSSValueStretch) { | 4240 if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselineP
ositionKeyword(value->id)) { |
4199 if (m_valueList->next()) | 4241 if (m_valueList->next()) |
4200 return false; | 4242 return false; |
4201 | 4243 |
4202 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | 4244 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); |
4203 return true; | 4245 return true; |
4204 } | 4246 } |
4205 | 4247 |
4206 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr; | 4248 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr; |
4207 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = nullptr; | 4249 RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = nullptr; |
4208 if (isItemPositionKeyword(value->id)) { | 4250 if (isItemPositionKeyword(value->id)) { |
(...skipping 4263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8472 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8514 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8473 if (!seenStroke) | 8515 if (!seenStroke) |
8474 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8516 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
8475 if (!seenMarkers) | 8517 if (!seenMarkers) |
8476 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8518 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
8477 | 8519 |
8478 return parsedValues.release(); | 8520 return parsedValues.release(); |
8479 } | 8521 } |
8480 | 8522 |
8481 } // namespace WebCore | 8523 } // namespace WebCore |
OLD | NEW |