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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 return filterValue; | 1180 return filterValue; |
1181 } | 1181 } |
1182 | 1182 |
1183 static CSSValue* consumeFilter(CSSParserTokenRange& range, | 1183 static CSSValue* consumeFilter(CSSParserTokenRange& range, |
1184 const CSSParserContext* context) { | 1184 const CSSParserContext* context) { |
1185 if (range.peek().id() == CSSValueNone) | 1185 if (range.peek().id() == CSSValueNone) |
1186 return consumeIdent(range); | 1186 return consumeIdent(range); |
1187 | 1187 |
1188 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1188 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1189 do { | 1189 do { |
1190 CSSValue* filterValue = consumeUrl(range); | 1190 CSSValue* filterValue = consumeUrl(range, context); |
1191 if (!filterValue) { | 1191 if (!filterValue) { |
1192 filterValue = consumeFilterFunction(range, context); | 1192 filterValue = consumeFilterFunction(range, context); |
1193 if (!filterValue) | 1193 if (!filterValue) |
1194 return nullptr; | 1194 return nullptr; |
1195 } | 1195 } |
1196 list->append(*filterValue); | 1196 list->append(*filterValue); |
1197 } while (!range.atEnd()); | 1197 } while (!range.atEnd()); |
1198 return list; | 1198 return list; |
1199 } | 1199 } |
1200 | 1200 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 cssParserMode); | 1574 cssParserMode); |
1575 } | 1575 } |
1576 | 1576 |
1577 static CSSValue* consumePositionY(CSSParserTokenRange& range, | 1577 static CSSValue* consumePositionY(CSSParserTokenRange& range, |
1578 CSSParserMode cssParserMode) { | 1578 CSSParserMode cssParserMode) { |
1579 return consumePositionLonghand<CSSValueTop, CSSValueBottom>(range, | 1579 return consumePositionLonghand<CSSValueTop, CSSValueBottom>(range, |
1580 cssParserMode); | 1580 cssParserMode); |
1581 } | 1581 } |
1582 | 1582 |
1583 static CSSValue* consumePaintStroke(CSSParserTokenRange& range, | 1583 static CSSValue* consumePaintStroke(CSSParserTokenRange& range, |
1584 CSSParserMode cssParserMode) { | 1584 const CSSParserContext* context) { |
1585 if (range.peek().id() == CSSValueNone) | 1585 if (range.peek().id() == CSSValueNone) |
1586 return consumeIdent(range); | 1586 return consumeIdent(range); |
1587 CSSURIValue* url = consumeUrl(range); | 1587 CSSURIValue* url = consumeUrl(range, context); |
1588 if (url) { | 1588 if (url) { |
1589 CSSValue* parsedValue = nullptr; | 1589 CSSValue* parsedValue = nullptr; |
1590 if (range.peek().id() == CSSValueNone) | 1590 if (range.peek().id() == CSSValueNone) |
1591 parsedValue = consumeIdent(range); | 1591 parsedValue = consumeIdent(range); |
1592 else | 1592 else |
1593 parsedValue = consumeColor(range, cssParserMode); | 1593 parsedValue = consumeColor(range, context->mode()); |
1594 if (parsedValue) { | 1594 if (parsedValue) { |
1595 CSSValueList* values = CSSValueList::createSpaceSeparated(); | 1595 CSSValueList* values = CSSValueList::createSpaceSeparated(); |
1596 values->append(*url); | 1596 values->append(*url); |
1597 values->append(*parsedValue); | 1597 values->append(*parsedValue); |
1598 return values; | 1598 return values; |
1599 } | 1599 } |
1600 return url; | 1600 return url; |
1601 } | 1601 } |
1602 return consumeColor(range, cssParserMode); | 1602 return consumeColor(range, context->mode()); |
1603 } | 1603 } |
1604 | 1604 |
1605 static CSSValue* consumeNoneOrURI(CSSParserTokenRange& range) { | 1605 static CSSValue* consumeNoneOrURI(CSSParserTokenRange& range, |
| 1606 const CSSParserContext* context) { |
1606 if (range.peek().id() == CSSValueNone) | 1607 if (range.peek().id() == CSSValueNone) |
1607 return consumeIdent(range); | 1608 return consumeIdent(range); |
1608 return consumeUrl(range); | 1609 return consumeUrl(range, context); |
1609 } | 1610 } |
1610 | 1611 |
1611 static CSSValue* consumeBaselineShift(CSSParserTokenRange& range) { | 1612 static CSSValue* consumeBaselineShift(CSSParserTokenRange& range) { |
1612 CSSValueID id = range.peek().id(); | 1613 CSSValueID id = range.peek().id(); |
1613 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) | 1614 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) |
1614 return consumeIdent(range); | 1615 return consumeIdent(range); |
1615 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll); | 1616 return consumeLengthOrPercent(range, SVGAttributeMode, ValueRangeAll); |
1616 } | 1617 } |
1617 | 1618 |
1618 static CSSValue* consumeRxOrRy(CSSParserTokenRange& range) { | 1619 static CSSValue* consumeRxOrRy(CSSParserTokenRange& range) { |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 if (!shape || !args.atEnd()) | 2023 if (!shape || !args.atEnd()) |
2023 return nullptr; | 2024 return nullptr; |
2024 range = rangeCopy; | 2025 range = rangeCopy; |
2025 return shape; | 2026 return shape; |
2026 } | 2027 } |
2027 | 2028 |
2028 static CSSValue* consumeClipPath(CSSParserTokenRange& range, | 2029 static CSSValue* consumeClipPath(CSSParserTokenRange& range, |
2029 const CSSParserContext* context) { | 2030 const CSSParserContext* context) { |
2030 if (range.peek().id() == CSSValueNone) | 2031 if (range.peek().id() == CSSValueNone) |
2031 return consumeIdent(range); | 2032 return consumeIdent(range); |
2032 if (CSSURIValue* url = consumeUrl(range)) | 2033 if (CSSURIValue* url = consumeUrl(range, context)) |
2033 return url; | 2034 return url; |
2034 return consumeBasicShape(range, context); | 2035 return consumeBasicShape(range, context); |
2035 } | 2036 } |
2036 | 2037 |
2037 static CSSValue* consumeShapeOutside(CSSParserTokenRange& range, | 2038 static CSSValue* consumeShapeOutside(CSSParserTokenRange& range, |
2038 const CSSParserContext* context) { | 2039 const CSSParserContext* context) { |
2039 if (CSSValue* imageValue = consumeImageOrNone(range, context)) | 2040 if (CSSValue* imageValue = consumeImageOrNone(range, context)) |
2040 return imageValue; | 2041 return imageValue; |
2041 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 2042 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
2042 if (CSSValue* boxValue = consumeShapeBox(range)) | 2043 if (CSSValue* boxValue = consumeShapeBox(range)) |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3187 m_range, m_context, | 3188 m_range, m_context, |
3188 unresolvedProperty == CSSPropertyAliasWebkitTransform); | 3189 unresolvedProperty == CSSPropertyAliasWebkitTransform); |
3189 case CSSPropertyWebkitTransformOriginX: | 3190 case CSSPropertyWebkitTransformOriginX: |
3190 case CSSPropertyWebkitPerspectiveOriginX: | 3191 case CSSPropertyWebkitPerspectiveOriginX: |
3191 return consumePositionX(m_range, m_context->mode()); | 3192 return consumePositionX(m_range, m_context->mode()); |
3192 case CSSPropertyWebkitTransformOriginY: | 3193 case CSSPropertyWebkitTransformOriginY: |
3193 case CSSPropertyWebkitPerspectiveOriginY: | 3194 case CSSPropertyWebkitPerspectiveOriginY: |
3194 return consumePositionY(m_range, m_context->mode()); | 3195 return consumePositionY(m_range, m_context->mode()); |
3195 case CSSPropertyFill: | 3196 case CSSPropertyFill: |
3196 case CSSPropertyStroke: | 3197 case CSSPropertyStroke: |
3197 return consumePaintStroke(m_range, m_context->mode()); | 3198 return consumePaintStroke(m_range, m_context); |
3198 case CSSPropertyMarkerStart: | 3199 case CSSPropertyMarkerStart: |
3199 case CSSPropertyMarkerMid: | 3200 case CSSPropertyMarkerMid: |
3200 case CSSPropertyMarkerEnd: | 3201 case CSSPropertyMarkerEnd: |
3201 case CSSPropertyMask: | 3202 case CSSPropertyMask: |
3202 return consumeNoneOrURI(m_range); | 3203 return consumeNoneOrURI(m_range, m_context); |
3203 case CSSPropertyFlexGrow: | 3204 case CSSPropertyFlexGrow: |
3204 case CSSPropertyFlexShrink: | 3205 case CSSPropertyFlexShrink: |
3205 return consumeNumber(m_range, ValueRangeNonNegative); | 3206 return consumeNumber(m_range, ValueRangeNonNegative); |
3206 case CSSPropertyColumnRuleWidth: | 3207 case CSSPropertyColumnRuleWidth: |
3207 return consumeColumnRuleWidth(m_range, m_context->mode()); | 3208 return consumeColumnRuleWidth(m_range, m_context->mode()); |
3208 case CSSPropertyStrokeOpacity: | 3209 case CSSPropertyStrokeOpacity: |
3209 case CSSPropertyFillOpacity: | 3210 case CSSPropertyFillOpacity: |
3210 case CSSPropertyStopOpacity: | 3211 case CSSPropertyStopOpacity: |
3211 case CSSPropertyFloodOpacity: | 3212 case CSSPropertyFloodOpacity: |
3212 case CSSPropertyOpacity: | 3213 case CSSPropertyOpacity: |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4813 case CSSPropertyGridTemplate: | 4814 case CSSPropertyGridTemplate: |
4814 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4815 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
4815 case CSSPropertyGrid: | 4816 case CSSPropertyGrid: |
4816 return consumeGridShorthand(important); | 4817 return consumeGridShorthand(important); |
4817 default: | 4818 default: |
4818 return false; | 4819 return false; |
4819 } | 4820 } |
4820 } | 4821 } |
4821 | 4822 |
4822 } // namespace blink | 4823 } // namespace blink |
OLD | NEW |