| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } while (consumeCharacterAndWhitespace(input, '|', offset)); | 125 } while (consumeCharacterAndWhitespace(input, '|', offset)); |
| 126 | 126 |
| 127 if (offset != input.length()) | 127 if (offset != input.length()) |
| 128 m_syntaxComponents.clear(); | 128 m_syntaxComponents.clear(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 const CSSValue* consumeSingleType(const CSSSyntaxComponent& syntax, | 131 const CSSValue* consumeSingleType(const CSSSyntaxComponent& syntax, |
| 132 CSSParserTokenRange& range) { | 132 CSSParserTokenRange& range) { |
| 133 using namespace CSSPropertyParserHelpers; | 133 using namespace CSSPropertyParserHelpers; |
| 134 | 134 |
| 135 // TODO(timloh): Calc values need to be normalized | |
| 136 switch (syntax.m_type) { | 135 switch (syntax.m_type) { |
| 137 case CSSSyntaxType::Ident: | 136 case CSSSyntaxType::Ident: |
| 138 if (range.peek().type() == IdentToken && | 137 if (range.peek().type() == IdentToken && |
| 139 range.peek().value() == syntax.m_string) { | 138 range.peek().value() == syntax.m_string) { |
| 140 range.consumeIncludingWhitespace(); | 139 range.consumeIncludingWhitespace(); |
| 141 return CSSCustomIdentValue::create(AtomicString(syntax.m_string)); | 140 return CSSCustomIdentValue::create(AtomicString(syntax.m_string)); |
| 142 } | 141 } |
| 143 return nullptr; | 142 return nullptr; |
| 144 case CSSSyntaxType::Length: | 143 case CSSSyntaxType::Length: |
| 145 return consumeLength(range, HTMLStandardMode, ValueRange::ValueRangeAll); | 144 return consumeLength(range, HTMLStandardMode, ValueRange::ValueRangeAll); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return CSSVariableParser::parseRegisteredPropertyValue(range, false); | 198 return CSSVariableParser::parseRegisteredPropertyValue(range, false); |
| 200 range.consumeWhitespace(); | 199 range.consumeWhitespace(); |
| 201 for (const CSSSyntaxComponent& component : m_syntaxComponents) { | 200 for (const CSSSyntaxComponent& component : m_syntaxComponents) { |
| 202 if (const CSSValue* result = consumeSyntaxComponent(component, range)) | 201 if (const CSSValue* result = consumeSyntaxComponent(component, range)) |
| 203 return result; | 202 return result; |
| 204 } | 203 } |
| 205 return CSSVariableParser::parseRegisteredPropertyValue(range, true); | 204 return CSSVariableParser::parseRegisteredPropertyValue(range, true); |
| 206 } | 205 } |
| 207 | 206 |
| 208 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |