OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
6 | 6 |
7 #include "core/StylePropertyShorthand.h" | 7 #include "core/StylePropertyShorthand.h" |
8 #include "core/css/CSSBasicShapeValues.h" | 8 #include "core/css/CSSBasicShapeValues.h" |
9 #include "core/css/CSSBorderImage.h" | 9 #include "core/css/CSSBorderImage.h" |
10 #include "core/css/CSSContentDistributionValue.h" | 10 #include "core/css/CSSContentDistributionValue.h" |
(...skipping 3344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3355 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars
erMode cssParserMode) | 3355 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars
erMode cssParserMode) |
3356 { | 3356 { |
3357 const CSSParserToken& token = range.peek(); | 3357 const CSSParserToken& token = range.peek(); |
3358 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(token
.id())) | 3358 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(token
.id())) |
3359 return consumeIdent(range); | 3359 return consumeIdent(range); |
3360 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue:
:UnitType::Fraction) { | 3360 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveValue:
:UnitType::Fraction) { |
3361 if (range.peek().numericValue() < 0) | 3361 if (range.peek().numericValue() < 0) |
3362 return nullptr; | 3362 return nullptr; |
3363 return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().nume
ricValue(), CSSPrimitiveValue::UnitType::Fraction); | 3363 return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().nume
ricValue(), CSSPrimitiveValue::UnitType::Fraction); |
3364 } | 3364 } |
| 3365 // TODO (lajava): Does <track-breadth> support unitless quirk ? |
3365 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U
nitlessQuirk::Allow); | 3366 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U
nitlessQuirk::Allow); |
3366 } | 3367 } |
3367 | 3368 |
3368 // TODO(rob.buis): This needs a bool parameter so we can disallow <auto-track-li
st> for the grid shorthand. | 3369 // TODO(rob.buis): This needs a bool parameter so we can disallow <auto-track-li
st> for the grid shorthand. |
3369 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode
cssParserMode) | 3370 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode
cssParserMode) |
3370 { | 3371 { |
3371 const CSSParserToken& token = range.peek(); | 3372 const CSSParserToken& token = range.peek(); |
3372 if (identMatches<CSSValueAuto>(token.id())) | 3373 if (identMatches<CSSValueAuto>(token.id())) |
3373 return consumeIdent(range); | 3374 return consumeIdent(range); |
3374 | 3375 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3691 case CSSPropertyAnimationFillMode: | 3692 case CSSPropertyAnimationFillMode: |
3692 case CSSPropertyAnimationIterationCount: | 3693 case CSSPropertyAnimationIterationCount: |
3693 case CSSPropertyAnimationName: | 3694 case CSSPropertyAnimationName: |
3694 case CSSPropertyAnimationPlayState: | 3695 case CSSPropertyAnimationPlayState: |
3695 case CSSPropertyTransitionProperty: | 3696 case CSSPropertyTransitionProperty: |
3696 case CSSPropertyAnimationTimingFunction: | 3697 case CSSPropertyAnimationTimingFunction: |
3697 case CSSPropertyTransitionTimingFunction: | 3698 case CSSPropertyTransitionTimingFunction: |
3698 return consumeAnimationPropertyList(property, m_range, m_context, unreso
lvedProperty == CSSPropertyAliasWebkitAnimationName); | 3699 return consumeAnimationPropertyList(property, m_range, m_context, unreso
lvedProperty == CSSPropertyAliasWebkitAnimationName); |
3699 case CSSPropertyGridColumnGap: | 3700 case CSSPropertyGridColumnGap: |
3700 case CSSPropertyGridRowGap: | 3701 case CSSPropertyGridRowGap: |
3701 return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative); | 3702 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeNonNe
gative); |
3702 case CSSPropertyShapeMargin: | 3703 case CSSPropertyShapeMargin: |
3703 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeNonNe
gative); | 3704 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeNonNe
gative); |
3704 case CSSPropertyShapeImageThreshold: | 3705 case CSSPropertyShapeImageThreshold: |
3705 return consumeNumber(m_range, ValueRangeAll); | 3706 return consumeNumber(m_range, ValueRangeAll); |
3706 case CSSPropertyWebkitBoxOrdinalGroup: | 3707 case CSSPropertyWebkitBoxOrdinalGroup: |
3707 case CSSPropertyOrphans: | 3708 case CSSPropertyOrphans: |
3708 case CSSPropertyWidows: | 3709 case CSSPropertyWidows: |
3709 return consumePositiveInteger(m_range); | 3710 return consumePositiveInteger(m_range); |
3710 case CSSPropertyTextDecorationColor: | 3711 case CSSPropertyTextDecorationColor: |
3711 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); | 3712 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5130 addProperty(property == CSSPropertyBackgroundRepeat ? CSSPropertyBackgro
undRepeatX : CSSPropertyWebkitMaskRepeatX, property, resultX, important, implici
t); | 5131 addProperty(property == CSSPropertyBackgroundRepeat ? CSSPropertyBackgro
undRepeatX : CSSPropertyWebkitMaskRepeatX, property, resultX, important, implici
t); |
5131 addProperty(property == CSSPropertyBackgroundRepeat ? CSSPropertyBackgro
undRepeatY : CSSPropertyWebkitMaskRepeatY, property, resultY, important, implici
t); | 5132 addProperty(property == CSSPropertyBackgroundRepeat ? CSSPropertyBackgro
undRepeatY : CSSPropertyWebkitMaskRepeatY, property, resultY, important, implici
t); |
5132 return true; | 5133 return true; |
5133 } | 5134 } |
5134 case CSSPropertyBackground: | 5135 case CSSPropertyBackground: |
5135 return consumeBackgroundShorthand(backgroundShorthand(), important); | 5136 return consumeBackgroundShorthand(backgroundShorthand(), important); |
5136 case CSSPropertyWebkitMask: | 5137 case CSSPropertyWebkitMask: |
5137 return consumeBackgroundShorthand(webkitMaskShorthand(), important); | 5138 return consumeBackgroundShorthand(webkitMaskShorthand(), important); |
5138 case CSSPropertyGridGap: { | 5139 case CSSPropertyGridGap: { |
5139 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled() && shorthandForPro
perty(CSSPropertyGridGap).length() == 2); | 5140 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled() && shorthandForPro
perty(CSSPropertyGridGap).length() == 2); |
5140 CSSValue* rowGap = consumeLength(m_range, m_context.mode(), ValueRangeNo
nNegative); | 5141 CSSValue* rowGap = consumeLengthOrPercent(m_range, m_context.mode(), Val
ueRangeNonNegative); |
5141 CSSValue* columnGap = consumeLength(m_range, m_context.mode(), ValueRang
eNonNegative); | 5142 CSSValue* columnGap = consumeLengthOrPercent(m_range, m_context.mode(),
ValueRangeNonNegative); |
5142 if (!rowGap || !m_range.atEnd()) | 5143 if (!rowGap || !m_range.atEnd()) |
5143 return false; | 5144 return false; |
5144 if (!columnGap) | 5145 if (!columnGap) |
5145 columnGap = rowGap; | 5146 columnGap = rowGap; |
5146 addProperty(CSSPropertyGridRowGap, CSSPropertyGridGap, rowGap, important
); | 5147 addProperty(CSSPropertyGridRowGap, CSSPropertyGridGap, rowGap, important
); |
5147 addProperty(CSSPropertyGridColumnGap, CSSPropertyGridGap, columnGap, imp
ortant); | 5148 addProperty(CSSPropertyGridColumnGap, CSSPropertyGridGap, columnGap, imp
ortant); |
5148 return true; | 5149 return true; |
5149 } | 5150 } |
5150 case CSSPropertyGridColumn: | 5151 case CSSPropertyGridColumn: |
5151 case CSSPropertyGridRow: | 5152 case CSSPropertyGridRow: |
5152 return consumeGridItemPositionShorthand(property, important); | 5153 return consumeGridItemPositionShorthand(property, important); |
5153 case CSSPropertyGridArea: | 5154 case CSSPropertyGridArea: |
5154 return consumeGridAreaShorthand(important); | 5155 return consumeGridAreaShorthand(important); |
5155 case CSSPropertyGridTemplate: | 5156 case CSSPropertyGridTemplate: |
5156 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 5157 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
5157 case CSSPropertyGrid: | 5158 case CSSPropertyGrid: |
5158 return consumeGridShorthand(important); | 5159 return consumeGridShorthand(important); |
5159 default: | 5160 default: |
5160 return false; | 5161 return false; |
5161 } | 5162 } |
5162 } | 5163 } |
5163 | 5164 |
5164 } // namespace blink | 5165 } // namespace blink |
OLD | NEW |