OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/css/properties/CSSPropertyAPIWebkitTextEmphasisStyle.h" |
| 6 |
| 7 #include "core/css/CSSStringValue.h" |
| 8 #include "core/css/CSSValueList.h" |
| 9 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 const CSSValue* CSSPropertyAPIWebkitTextEmphasisStyle::parseSingleValue( |
| 14 CSSParserTokenRange& range, |
| 15 const CSSParserContext* context) { |
| 16 CSSValueID id = range.peek().id(); |
| 17 if (id == CSSValueNone) |
| 18 return CSSPropertyParserHelpers::consumeIdent(range); |
| 19 |
| 20 if (CSSValue* textEmphasisStyle = |
| 21 CSSPropertyParserHelpers::consumeString(range)) |
| 22 return textEmphasisStyle; |
| 23 |
| 24 CSSIdentifierValue* fill = |
| 25 CSSPropertyParserHelpers::consumeIdent<CSSValueFilled, CSSValueOpen>( |
| 26 range); |
| 27 CSSIdentifierValue* shape = |
| 28 CSSPropertyParserHelpers::consumeIdent<CSSValueDot, CSSValueCircle, |
| 29 CSSValueDoubleCircle, |
| 30 CSSValueTriangle, CSSValueSesame>( |
| 31 range); |
| 32 if (!fill) { |
| 33 fill = CSSPropertyParserHelpers::consumeIdent<CSSValueFilled, CSSValueOpen>( |
| 34 range); |
| 35 } |
| 36 if (fill && shape) { |
| 37 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); |
| 38 parsedValues->append(*fill); |
| 39 parsedValues->append(*shape); |
| 40 return parsedValues; |
| 41 } |
| 42 if (fill) |
| 43 return fill; |
| 44 if (shape) |
| 45 return shape; |
| 46 return nullptr; |
| 47 } |
| 48 |
| 49 } // namespace blink |
OLD | NEW |