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 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 parsedValues->append(shape.release()); | 1572 parsedValues->append(shape.release()); |
1573 return parsedValues.release(); | 1573 return parsedValues.release(); |
1574 } | 1574 } |
1575 if (fill) | 1575 if (fill) |
1576 return fill.release(); | 1576 return fill.release(); |
1577 if (shape) | 1577 if (shape) |
1578 return shape.release(); | 1578 return shape.release(); |
1579 return nullptr; | 1579 return nullptr; |
1580 } | 1580 } |
1581 | 1581 |
| 1582 static PassRefPtrWillBeRawPtr<CSSValue> consumeOutlineColor(CSSParserTokenRange&
range, const CSSParserContext& context) |
| 1583 { |
| 1584 // Outline color has "invert" as additional keyword. |
| 1585 // Also, we want to allow the special focus color even in HTML Standard pars
ing mode. |
| 1586 if (range.peek().id() == CSSValueInvert || range.peek().id() == CSSValueWebk
itFocusRingColor) |
| 1587 return consumeIdent(range); |
| 1588 return consumeColor(range, context); |
| 1589 } |
| 1590 |
| 1591 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineWidth(CSSParserToken
Range& range, CSSParserMode cssParserMode) |
| 1592 { |
| 1593 CSSValueID id = range.peek().id(); |
| 1594 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) |
| 1595 return consumeIdent(range); |
| 1596 return consumeLength(range, cssParserMode, ValueRangeNonNegative); |
| 1597 } |
| 1598 |
1582 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID unresolvedProperty) | 1599 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID unresolvedProperty) |
1583 { | 1600 { |
1584 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 1601 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
1585 m_range.consumeWhitespace(); | 1602 m_range.consumeWhitespace(); |
1586 switch (property) { | 1603 switch (property) { |
1587 case CSSPropertyWillChange: | 1604 case CSSPropertyWillChange: |
1588 return consumeWillChange(m_range); | 1605 return consumeWillChange(m_range); |
1589 case CSSPropertyPage: | 1606 case CSSPropertyPage: |
1590 return consumePage(m_range); | 1607 return consumePage(m_range); |
1591 case CSSPropertyQuotes: | 1608 case CSSPropertyQuotes: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 1717 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
1701 return consumeMotionPath(m_range); | 1718 return consumeMotionPath(m_range); |
1702 case CSSPropertyMotionOffset: | 1719 case CSSPropertyMotionOffset: |
1703 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 1720 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
1704 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll); | 1721 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll); |
1705 case CSSPropertyMotionRotation: | 1722 case CSSPropertyMotionRotation: |
1706 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 1723 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
1707 return consumeMotionRotation(m_range, m_context.mode()); | 1724 return consumeMotionRotation(m_range, m_context.mode()); |
1708 case CSSPropertyWebkitTextEmphasisStyle: | 1725 case CSSPropertyWebkitTextEmphasisStyle: |
1709 return consumeTextEmphasisStyle(m_range); | 1726 return consumeTextEmphasisStyle(m_range); |
| 1727 case CSSPropertyOutlineColor: |
| 1728 return consumeOutlineColor(m_range, m_context); |
| 1729 case CSSPropertyOutlineOffset: |
| 1730 return consumeLength(m_range, m_context.mode(), ValueRangeAll); |
| 1731 case CSSPropertyOutlineWidth: |
| 1732 return consumeLineWidth(m_range, m_context.mode()); |
1710 default: | 1733 default: |
1711 return nullptr; | 1734 return nullptr; |
1712 } | 1735 } |
1713 } | 1736 } |
1714 | 1737 |
1715 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) | 1738 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) |
1716 { | 1739 { |
1717 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); | 1740 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); |
1718 | 1741 |
1719 do { | 1742 do { |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 if (!textDecoration || !m_range.atEnd()) | 2201 if (!textDecoration || !m_range.atEnd()) |
2179 return false; | 2202 return false; |
2180 addProperty(CSSPropertyTextDecoration, textDecoration.release(), importa
nt); | 2203 addProperty(CSSPropertyTextDecoration, textDecoration.release(), importa
nt); |
2181 return true; | 2204 return true; |
2182 } | 2205 } |
2183 case CSSPropertyMotion: | 2206 case CSSPropertyMotion: |
2184 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 2207 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
2185 return consumeShorthandGreedily(motionShorthand(), important); | 2208 return consumeShorthandGreedily(motionShorthand(), important); |
2186 case CSSPropertyWebkitTextEmphasis: | 2209 case CSSPropertyWebkitTextEmphasis: |
2187 return consumeShorthandGreedily(webkitTextEmphasisShorthand(), important
); | 2210 return consumeShorthandGreedily(webkitTextEmphasisShorthand(), important
); |
| 2211 case CSSPropertyOutline: |
| 2212 return consumeShorthandGreedily(outlineShorthand(), important); |
2188 default: | 2213 default: |
2189 m_currentShorthand = oldShorthand; | 2214 m_currentShorthand = oldShorthand; |
2190 return false; | 2215 return false; |
2191 } | 2216 } |
2192 } | 2217 } |
2193 | 2218 |
2194 } // namespace blink | 2219 } // namespace blink |
OLD | NEW |