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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
10 #include "core/css/CSSCustomIdentValue.h" | 10 #include "core/css/CSSCustomIdentValue.h" |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1498 if (list->hasValue(ident.get())) | 1498 if (list->hasValue(ident.get())) |
1499 return nullptr; | 1499 return nullptr; |
1500 list->append(ident.release()); | 1500 list->append(ident.release()); |
1501 } | 1501 } |
1502 | 1502 |
1503 if (!list->length()) | 1503 if (!list->length()) |
1504 return nullptr; | 1504 return nullptr; |
1505 return list.release(); | 1505 return list.release(); |
1506 } | 1506 } |
1507 | 1507 |
1508 static PassRefPtrWillBeRawPtr<CSSValue> consumeOutlineColor(CSSParserTokenRange& range, const CSSParserContext& context) | |
1509 { | |
1510 // Outline color has "invert" as additional keyword. | |
1511 // Also, we want to allow the special focus color even in HTML Standard pars ing mode. | |
1512 if (range.peek().id() == CSSValueInvert || range.peek().id() == CSSValueWebk itFocusRingColor) | |
1513 return consumeIdent(range); | |
1514 return consumeColor(range, context); | |
1515 } | |
1516 | |
1517 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeBorderWidth(CSSParserTok enRange& range, CSSParserMode cssParserMode) | |
Timothy Loh
2015/11/05 05:08:26
The spec calls this a <line-width> for the border-
| |
1518 { | |
1519 CSSValueID id = range.peek().id(); | |
1520 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) | |
1521 return consumeIdent(range); | |
1522 return consumeLength(range, cssParserMode, ValueRangeNonNegative); | |
1523 } | |
1524 | |
1508 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) | 1525 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) |
1509 { | 1526 { |
1510 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 1527 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
1511 m_range.consumeWhitespace(); | 1528 m_range.consumeWhitespace(); |
1512 switch (property) { | 1529 switch (property) { |
1513 case CSSPropertyWillChange: | 1530 case CSSPropertyWillChange: |
1514 return consumeWillChange(m_range); | 1531 return consumeWillChange(m_range); |
1515 case CSSPropertyPage: | 1532 case CSSPropertyPage: |
1516 return consumePage(m_range); | 1533 return consumePage(m_range); |
1517 case CSSPropertyQuotes: | 1534 case CSSPropertyQuotes: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1614 return consumeZIndex(m_range); | 1631 return consumeZIndex(m_range); |
1615 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS 3, so treat as CSS3 | 1632 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS 3, so treat as CSS3 |
1616 case CSSPropertyBoxShadow: | 1633 case CSSPropertyBoxShadow: |
1617 return consumeShadow(m_range, m_context, property == CSSPropertyBoxShado w); | 1634 return consumeShadow(m_range, m_context, property == CSSPropertyBoxShado w); |
1618 case CSSPropertyWebkitFilter: | 1635 case CSSPropertyWebkitFilter: |
1619 case CSSPropertyBackdropFilter: | 1636 case CSSPropertyBackdropFilter: |
1620 return consumeFilter(m_range, m_context); | 1637 return consumeFilter(m_range, m_context); |
1621 case CSSPropertyWebkitTextDecorationsInEffect: | 1638 case CSSPropertyWebkitTextDecorationsInEffect: |
1622 case CSSPropertyTextDecorationLine: | 1639 case CSSPropertyTextDecorationLine: |
1623 return consumeTextDecorationLine(m_range); | 1640 return consumeTextDecorationLine(m_range); |
1641 case CSSPropertyOutlineColor: | |
1642 return consumeOutlineColor(m_range, m_context); | |
1643 case CSSPropertyOutlineOffset: | |
1644 return consumeLength(m_range, m_context.mode(), ValueRangeAll); | |
1645 case CSSPropertyOutlineWidth: | |
1646 return consumeBorderWidth(m_range, m_context.mode()); | |
1624 default: | 1647 default: |
1625 return nullptr; | 1648 return nullptr; |
1626 } | 1649 } |
1627 } | 1650 } |
1628 | 1651 |
1629 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) | 1652 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) |
1630 { | 1653 { |
1631 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); | 1654 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); |
1632 | 1655 |
1633 do { | 1656 do { |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2085 // Fall through 'text-decoration-line' parsing if CSS 3 Text Decoration | 2108 // Fall through 'text-decoration-line' parsing if CSS 3 Text Decoration |
2086 // is disabled to match CSS 2.1 rules for parsing 'text-decoration'. | 2109 // is disabled to match CSS 2.1 rules for parsing 'text-decoration'. |
2087 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) | 2110 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
2088 return consumeShorthandGreedily(textDecorationShorthand(), important ); | 2111 return consumeShorthandGreedily(textDecorationShorthand(), important ); |
2089 RefPtrWillBeRawPtr<CSSValue> textDecoration = consumeTextDecorationLine( m_range); | 2112 RefPtrWillBeRawPtr<CSSValue> textDecoration = consumeTextDecorationLine( m_range); |
2090 if (!textDecoration || !m_range.atEnd()) | 2113 if (!textDecoration || !m_range.atEnd()) |
2091 return false; | 2114 return false; |
2092 addProperty(CSSPropertyTextDecoration, textDecoration.release(), importa nt); | 2115 addProperty(CSSPropertyTextDecoration, textDecoration.release(), importa nt); |
2093 return true; | 2116 return true; |
2094 } | 2117 } |
2118 case CSSPropertyOutline: | |
2119 return consumeShorthandGreedily(outlineShorthand(), important); | |
2095 default: | 2120 default: |
2096 m_currentShorthand = oldShorthand; | 2121 m_currentShorthand = oldShorthand; |
2097 return false; | 2122 return false; |
2098 } | 2123 } |
2099 } | 2124 } |
2100 | 2125 |
2101 } // namespace blink | 2126 } // namespace blink |
OLD | NEW |