| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/CSSSyntaxDescriptor.h" | 5 #include "core/css/CSSSyntaxDescriptor.h" |
| 6 | 6 |
| 7 #include "core/css/CSSCustomPropertyDeclaration.h" | 7 #include "core/css/CSSCustomPropertyDeclaration.h" |
| 8 #include "core/css/CSSURIValue.h" | 8 #include "core/css/CSSURIValue.h" |
| 9 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
| 10 #include "core/css/CSSVariableReferenceValue.h" | 10 #include "core/css/CSSVariableReferenceValue.h" |
| 11 #include "core/css/parser/CSSParserIdioms.h" | 11 #include "core/css/parser/CSSParserIdioms.h" |
| 12 #include "core/css/parser/CSSPropertyParserHelpers.h" | 12 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 13 #include "core/css/parser/CSSTokenizer.h" | |
| 14 #include "core/css/parser/CSSVariableParser.h" | 13 #include "core/css/parser/CSSVariableParser.h" |
| 15 #include "core/html/parser/HTMLParserIdioms.h" | 14 #include "core/html/parser/HTMLParserIdioms.h" |
| 16 | 15 |
| 17 namespace blink { | 16 namespace blink { |
| 18 | 17 |
| 19 void consumeWhitespace(const String& string, size_t& offset) | 18 void consumeWhitespace(const String& string, size_t& offset) |
| 20 { | 19 { |
| 21 while (isHTMLSpace(string[offset])) | 20 while (isHTMLSpace(string[offset])) |
| 22 offset++; | 21 offset++; |
| 23 } | 22 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 list->append(*value); | 188 list->append(*value); |
| 190 } | 189 } |
| 191 return list; | 190 return list; |
| 192 } | 191 } |
| 193 const CSSValue* result = consumeSingleType(syntax, range); | 192 const CSSValue* result = consumeSingleType(syntax, range); |
| 194 if (!range.atEnd()) | 193 if (!range.atEnd()) |
| 195 return nullptr; | 194 return nullptr; |
| 196 return result; | 195 return result; |
| 197 } | 196 } |
| 198 | 197 |
| 199 const CSSValue* CSSSyntaxDescriptor::parse(const String& value) const | |
| 200 { | |
| 201 CSSTokenizer::Scope scope(value); | |
| 202 return parse(scope.tokenRange()); | |
| 203 } | |
| 204 | |
| 205 const CSSValue* CSSSyntaxDescriptor::parse(CSSParserTokenRange range) const | 198 const CSSValue* CSSSyntaxDescriptor::parse(CSSParserTokenRange range) const |
| 206 { | 199 { |
| 207 if (isTokenStream()) | 200 if (isTokenStream()) |
| 208 return CSSVariableParser::parseRegisteredPropertyValue(range, false); | 201 return CSSVariableParser::parseRegisteredPropertyValue(range, false); |
| 209 range.consumeWhitespace(); | 202 range.consumeWhitespace(); |
| 210 for (const CSSSyntaxComponent& component : m_syntaxComponents) { | 203 for (const CSSSyntaxComponent& component : m_syntaxComponents) { |
| 211 if (const CSSValue* result = consumeSyntaxComponent(component, range)) | 204 if (const CSSValue* result = consumeSyntaxComponent(component, range)) |
| 212 return result; | 205 return result; |
| 213 } | 206 } |
| 214 return CSSVariableParser::parseRegisteredPropertyValue(range, true); | 207 return CSSVariableParser::parseRegisteredPropertyValue(range, true); |
| 215 } | 208 } |
| 216 | 209 |
| 217 } // namespace blink | 210 } // namespace blink |
| OLD | NEW |