| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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/properties/CSSPropertyAPIContent.h" | 5 #include "core/css/properties/CSSPropertyAPIContent.h" |
| 6 | 6 |
| 7 #include "core/CSSValueKeywords.h" | 7 #include "core/CSSValueKeywords.h" |
| 8 #include "core/css/CSSCounterValue.h" | 8 #include "core/css/CSSCounterValue.h" |
| 9 #include "core/css/CSSFunctionValue.h" | 9 #include "core/css/CSSFunctionValue.h" |
| 10 #include "core/css/CSSStringValue.h" | 10 #include "core/css/CSSStringValue.h" |
| 11 #include "core/css/CSSValueList.h" | 11 #include "core/css/CSSValueList.h" |
| 12 #include "core/css/parser/CSSParserContext.h" | 12 #include "core/css/parser/CSSParserContext.h" |
| 13 #include "core/css/parser/CSSPropertyParserHelpers.h" | 13 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 14 | 14 |
| 15 class CSSParserLocalContext; | 15 class CSSParserLocalContext; |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 using CSSCounterValue = cssvalue::CSSCounterValue; | |
| 19 | |
| 20 namespace { | 18 namespace { |
| 21 | 19 |
| 22 CSSValue* ConsumeAttr(CSSParserTokenRange args, | 20 CSSValue* ConsumeAttr(CSSParserTokenRange args, |
| 23 const CSSParserContext* context) { | 21 const CSSParserContext* context) { |
| 24 if (args.Peek().GetType() != kIdentToken) | 22 if (args.Peek().GetType() != kIdentToken) |
| 25 return nullptr; | 23 return nullptr; |
| 26 | 24 |
| 27 AtomicString attr_name = | 25 AtomicString attr_name = |
| 28 args.ConsumeIncludingWhitespace().Value().ToAtomicString(); | 26 args.ConsumeIncludingWhitespace().Value().ToAtomicString(); |
| 29 if (!args.AtEnd()) | 27 if (!args.AtEnd()) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 60 if ((id != CSSValueNone && | 58 if ((id != CSSValueNone && |
| 61 (id < CSSValueDisc || id > CSSValueKatakanaIroha))) | 59 (id < CSSValueDisc || id > CSSValueKatakanaIroha))) |
| 62 return nullptr; | 60 return nullptr; |
| 63 list_style = CSSPropertyParserHelpers::ConsumeIdent(args); | 61 list_style = CSSPropertyParserHelpers::ConsumeIdent(args); |
| 64 } else { | 62 } else { |
| 65 list_style = CSSIdentifierValue::Create(CSSValueDecimal); | 63 list_style = CSSIdentifierValue::Create(CSSValueDecimal); |
| 66 } | 64 } |
| 67 | 65 |
| 68 if (!args.AtEnd()) | 66 if (!args.AtEnd()) |
| 69 return nullptr; | 67 return nullptr; |
| 70 return blink::CSSCounterValue::Create(identifier, list_style, separator); | 68 return cssvalue::CSSCounterValue::Create(identifier, list_style, separator); |
| 71 } | 69 } |
| 72 | 70 |
| 73 } // namespace | 71 } // namespace |
| 74 | 72 |
| 75 const CSSValue* CSSPropertyAPIContent::parseSingleValue( | 73 const CSSValue* CSSPropertyAPIContent::parseSingleValue( |
| 76 CSSParserTokenRange& range, | 74 CSSParserTokenRange& range, |
| 77 const CSSParserContext& context, | 75 const CSSParserContext& context, |
| 78 const CSSParserLocalContext&) { | 76 const CSSParserLocalContext&) { |
| 79 if (CSSPropertyParserHelpers::IdentMatches<CSSValueNone, CSSValueNormal>( | 77 if (CSSPropertyParserHelpers::IdentMatches<CSSValueNone, CSSValueNormal>( |
| 80 range.Peek().Id())) | 78 range.Peek().Id())) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 106 if (!parsed_value) | 104 if (!parsed_value) |
| 107 return nullptr; | 105 return nullptr; |
| 108 } | 106 } |
| 109 values->Append(*parsed_value); | 107 values->Append(*parsed_value); |
| 110 } while (!range.AtEnd()); | 108 } while (!range.AtEnd()); |
| 111 | 109 |
| 112 return values; | 110 return values; |
| 113 } | 111 } |
| 114 | 112 |
| 115 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |