| 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" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return false; | 74 return false; |
| 75 type = parseSyntaxType(input.substring(typeStart, offset - typeStart)); | 75 type = parseSyntaxType(input.substring(typeStart, offset - typeStart)); |
| 76 if (type == CSSSyntaxType::Ident) | 76 if (type == CSSSyntaxType::Ident) |
| 77 return false; | 77 return false; |
| 78 offset++; | 78 offset++; |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool consumeSyntaxIdent(const String& input, size_t& offset, String& ident) | 82 bool consumeSyntaxIdent(const String& input, size_t& offset, String& ident) |
| 83 { | 83 { |
| 84 // TODO(timloh): Are CSS-wide keywords allowed here? | |
| 85 size_t identStart = offset; | 84 size_t identStart = offset; |
| 86 while (isNameCodePoint(input[offset])) | 85 while (isNameCodePoint(input[offset])) |
| 87 offset++; | 86 offset++; |
| 88 if (offset == identStart) | 87 if (offset == identStart) |
| 89 return false; | 88 return false; |
| 90 ident = input.substring(identStart, offset - identStart); | 89 ident = input.substring(identStart, offset - identStart); |
| 91 return true; | 90 return !CSSPropertyParserHelpers::isCSSWideKeyword(ident); |
| 92 } | 91 } |
| 93 | 92 |
| 94 CSSSyntaxDescriptor::CSSSyntaxDescriptor(String input) | 93 CSSSyntaxDescriptor::CSSSyntaxDescriptor(String input) |
| 95 { | 94 { |
| 96 size_t offset = 0; | 95 size_t offset = 0; |
| 97 consumeWhitespace(input, offset); | 96 consumeWhitespace(input, offset); |
| 98 | 97 |
| 99 if (consumeCharacterAndWhitespace(input, '*', offset)) { | 98 if (consumeCharacterAndWhitespace(input, '*', offset)) { |
| 100 if (offset != input.length()) | 99 if (offset != input.length()) |
| 101 return; | 100 return; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 return CSSVariableParser::parseRegisteredPropertyValue(range, false); | 200 return CSSVariableParser::parseRegisteredPropertyValue(range, false); |
| 202 range.consumeWhitespace(); | 201 range.consumeWhitespace(); |
| 203 for (const CSSSyntaxComponent& component : m_syntaxComponents) { | 202 for (const CSSSyntaxComponent& component : m_syntaxComponents) { |
| 204 if (const CSSValue* result = consumeSyntaxComponent(component, range)) | 203 if (const CSSValue* result = consumeSyntaxComponent(component, range)) |
| 205 return result; | 204 return result; |
| 206 } | 205 } |
| 207 return CSSVariableParser::parseRegisteredPropertyValue(range, true); | 206 return CSSVariableParser::parseRegisteredPropertyValue(range, true); |
| 208 } | 207 } |
| 209 | 208 |
| 210 } // namespace blink | 209 } // namespace blink |
| OLD | NEW |