Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/css/parser/CSSPropertyParser.h" | 28 #include "core/css/parser/CSSPropertyParser.h" |
| 29 | 29 |
| 30 // FIXME: Way too many! | 30 // FIXME: Way too many! |
| 31 #include "core/CSSValueKeywords.h" | 31 #include "core/CSSValueKeywords.h" |
| 32 #include "core/StylePropertyShorthand.h" | 32 #include "core/StylePropertyShorthand.h" |
| 33 #include "core/css/CSSBasicShapes.h" | 33 #include "core/css/CSSBasicShapes.h" |
| 34 #include "core/css/CSSBorderImage.h" | 34 #include "core/css/CSSBorderImage.h" |
| 35 #include "core/css/CSSCanvasValue.h" | 35 #include "core/css/CSSCanvasValue.h" |
| 36 #include "core/css/CSSContentDistributionValue.h" | |
| 36 #include "core/css/CSSCrossfadeValue.h" | 37 #include "core/css/CSSCrossfadeValue.h" |
| 37 #include "core/css/CSSCursorImageValue.h" | 38 #include "core/css/CSSCursorImageValue.h" |
| 38 #include "core/css/CSSFontFaceSrcValue.h" | 39 #include "core/css/CSSFontFaceSrcValue.h" |
| 39 #include "core/css/CSSFontFeatureValue.h" | 40 #include "core/css/CSSFontFeatureValue.h" |
| 40 #include "core/css/CSSFunctionValue.h" | 41 #include "core/css/CSSFunctionValue.h" |
| 41 #include "core/css/CSSGradientValue.h" | 42 #include "core/css/CSSGradientValue.h" |
| 42 #include "core/css/CSSGridLineNamesValue.h" | 43 #include "core/css/CSSGridLineNamesValue.h" |
| 43 #include "core/css/CSSGridTemplateAreasValue.h" | 44 #include "core/css/CSSGridTemplateAreasValue.h" |
| 44 #include "core/css/CSSImageSetValue.h" | 45 #include "core/css/CSSImageSetValue.h" |
| 45 #include "core/css/CSSImageValue.h" | 46 #include "core/css/CSSImageValue.h" |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1195 case CSSPropertyWebkitTransitionDuration: | 1196 case CSSPropertyWebkitTransitionDuration: |
| 1196 case CSSPropertyWebkitTransitionTimingFunction: | 1197 case CSSPropertyWebkitTransitionTimingFunction: |
| 1197 case CSSPropertyWebkitTransitionProperty: { | 1198 case CSSPropertyWebkitTransitionProperty: { |
| 1198 if (RefPtrWillBeRawPtr<CSSValueList> val = parseAnimationPropertyList(pr opId)) { | 1199 if (RefPtrWillBeRawPtr<CSSValueList> val = parseAnimationPropertyList(pr opId)) { |
| 1199 addPropertyWithPrefixingVariant(propId, val.release(), important); | 1200 addPropertyWithPrefixingVariant(propId, val.release(), important); |
| 1200 return true; | 1201 return true; |
| 1201 } | 1202 } |
| 1202 return false; | 1203 return false; |
| 1203 } | 1204 } |
| 1204 | 1205 |
| 1206 case CSSPropertyJustifyContent: | |
| 1207 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | |
| 1208 parsedValue = parseContentDistributionOverflowPosition(); | |
| 1209 break; | |
| 1205 case CSSPropertyJustifySelf: | 1210 case CSSPropertyJustifySelf: |
| 1206 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 1211 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 1207 return parseItemPositionOverflowPosition(propId, important); | 1212 return parseItemPositionOverflowPosition(propId, important); |
| 1208 case CSSPropertyJustifyItems: | 1213 case CSSPropertyJustifyItems: |
| 1209 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 1214 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 1210 | 1215 |
| 1211 if (parseLegacyPosition(propId, important)) | 1216 if (parseLegacyPosition(propId, important)) |
| 1212 return true; | 1217 return true; |
| 1213 | 1218 |
| 1214 m_valueList->setCurrentIndex(0); | 1219 m_valueList->setCurrentIndex(0); |
| (...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4022 } | 4027 } |
| 4023 default: | 4028 default: |
| 4024 return nullptr; | 4029 return nullptr; |
| 4025 } | 4030 } |
| 4026 | 4031 |
| 4027 if (hasRoundedInset) | 4032 if (hasRoundedInset) |
| 4028 return parseInsetRoundedCorners(shape, args); | 4033 return parseInsetRoundedCorners(shape, args); |
| 4029 return shape; | 4034 return shape; |
| 4030 } | 4035 } |
| 4031 | 4036 |
| 4037 static bool isContentDistributionKeyword(CSSValueID id) | |
| 4038 { | |
| 4039 return id == CSSValueSpaceBetween || id == CSSValueSpaceAround | |
| 4040 || id == CSSValueSpaceEvenly || id == CSSValueStretch; | |
| 4041 } | |
| 4042 | |
| 4043 static bool isContentPositionKeyword(CSSValueID id) | |
| 4044 { | |
| 4045 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | |
| 4046 || id == CSSValueFlexStart || id == CSSValueFlexEnd | |
| 4047 || id == CSSValueLeft || id == CSSValueRight; | |
| 4048 } | |
| 4049 | |
| 4032 static bool isBaselinePositionKeyword(CSSValueID id) | 4050 static bool isBaselinePositionKeyword(CSSValueID id) |
| 4033 { | 4051 { |
| 4034 return id == CSSValueBaseline || id == CSSValueLastBaseline; | 4052 return id == CSSValueBaseline || id == CSSValueLastBaseline; |
| 4035 } | 4053 } |
| 4036 | 4054 |
| 4037 static bool isItemPositionKeyword(CSSValueID id) | 4055 static bool isItemPositionKeyword(CSSValueID id) |
| 4038 { | 4056 { |
| 4039 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 4057 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
| 4040 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart | 4058 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle xStart |
| 4041 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; | 4059 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 4059 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy ) | 4077 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy ) |
| 4060 return false; | 4078 return false; |
| 4061 } else { | 4079 } else { |
| 4062 return false; | 4080 return false; |
| 4063 } | 4081 } |
| 4064 | 4082 |
| 4065 addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdentifier Value(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), importa nt); | 4083 addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdentifier Value(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), importa nt); |
| 4066 return !m_valueList->next(); | 4084 return !m_valueList->next(); |
| 4067 } | 4085 } |
| 4068 | 4086 |
| 4087 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseContentDistributionOver flowPosition() | |
| 4088 { | |
| 4089 // auto | <baseline-position> | [ <content-distribution>? && <content-positi on>? ]! && <overflow-position>? | |
| 4090 // <baseline-position> = baseline | last-baseline; | |
| 4091 // <content-distribution> = space-between | space-around | space-evenly | st retch; | |
| 4092 // <content-position> = center | start | end | flex-start | flex-end | left | right; | |
| 4093 // <overflow-position> = true | safe | |
| 4094 | |
| 4095 // auto | <baseline-position> | |
| 4096 CSSParserValue* value = m_valueList->current(); | |
| 4097 if (value->id == CSSValueAuto || isBaselinePositionKeyword(value->id)) { | |
| 4098 m_valueList->next(); | |
| 4099 return CSSContentDistributionValue::create(CSSValueInvalid, value->id, C SSValueInvalid); | |
| 4100 } | |
| 4101 | |
| 4102 CSSValueID distribution = CSSValueInvalid; | |
| 4103 CSSValueID position = CSSValueInvalid; | |
| 4104 CSSValueID overflow = CSSValueInvalid; | |
| 4105 if (value->id == CSSValueTrue || value->id == CSSValueSafe) { | |
|
Julien - ping for review
2014/10/28 17:23:05
We should add a helper function for these too!
jfernandez
2014/10/29 11:03:05
Done.
| |
| 4106 overflow = value->id; | |
| 4107 value = m_valueList->next(); | |
| 4108 } | |
| 4109 if (value && isContentDistributionKeyword(value->id)) { | |
| 4110 distribution = value->id; | |
| 4111 value = m_valueList->next(); | |
| 4112 } | |
| 4113 if (value && isContentPositionKeyword(value->id)) { | |
| 4114 position = value->id; | |
| 4115 value = m_valueList->next(); | |
| 4116 } | |
| 4117 if (value) { | |
| 4118 if (overflow != CSSValueInvalid || (value->id != CSSValueTrue && value-> id != CSSValueSafe)) | |
| 4119 return nullptr; | |
| 4120 overflow = value->id; | |
| 4121 } | |
| 4122 | |
| 4123 // [ <content-distribution>? && <content-position>? ]! | |
|
Julien - ping for review
2014/10/28 17:23:05
It would be better to state it in English:
// The
jfernandez
2014/10/29 11:03:05
Done.
| |
| 4124 if (m_valueList->next() || (position == CSSValueInvalid && distribution == C SSValueInvalid)) | |
| 4125 return nullptr; | |
| 4126 | |
| 4127 return CSSContentDistributionValue::create(distribution, position, overflow) ; | |
| 4128 } | |
| 4129 | |
| 4069 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) | 4130 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) |
| 4070 { | 4131 { |
| 4071 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi tion>? ] | 4132 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi tion>? ] |
| 4072 // <baseline-position> = baseline | last-baseline; | 4133 // <baseline-position> = baseline | last-baseline; |
| 4073 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right; | 4134 // <item-position> = center | start | end | self-start | self-end | flex-sta rt | flex-end | left | right; |
| 4074 // <overflow-position> = true | safe | 4135 // <overflow-position> = true | safe |
| 4075 | 4136 |
| 4076 CSSParserValue* value = m_valueList->current(); | 4137 CSSParserValue* value = m_valueList->current(); |
| 4077 if (!value) | 4138 if (!value) |
| 4078 return false; | 4139 return false; |
| (...skipping 4269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8348 return nullptr; | 8409 return nullptr; |
| 8349 a = args->next(); | 8410 a = args->next(); |
| 8350 | 8411 |
| 8351 argNumber++; | 8412 argNumber++; |
| 8352 } | 8413 } |
| 8353 | 8414 |
| 8354 return transformValue.release(); | 8415 return transformValue.release(); |
| 8355 } | 8416 } |
| 8356 | 8417 |
| 8357 } // namespace blink | 8418 } // namespace blink |
| OLD | NEW |