OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/parser/CSSVariableParser.h" | 5 #include "core/css/parser/CSSVariableParser.h" |
6 | 6 |
7 #include "core/css/CSSCustomPropertyDeclaration.h" | 7 #include "core/css/CSSCustomPropertyDeclaration.h" |
8 #include "core/css/CSSVariableReferenceValue.h" | 8 #include "core/css/CSSVariableReferenceValue.h" |
9 #include "core/css/parser/CSSParserTokenRange.h" | 9 #include "core/css/parser/CSSParserTokenRange.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 if (!isValidVariableReference(block, hasAtApplyRule)) | 36 if (!isValidVariableReference(block, hasAtApplyRule)) |
37 return false; // Bail if any references are invalid | 37 return false; // Bail if any references are invalid |
38 hasReferences = true; | 38 hasReferences = true; |
39 continue; | 39 continue; |
40 } | 40 } |
41 if (!classifyBlock(block, hasReferences, hasAtApplyRule, false)) | 41 if (!classifyBlock(block, hasReferences, hasAtApplyRule, false)) |
42 return false; | 42 return false; |
43 continue; | 43 continue; |
44 } | 44 } |
45 | 45 |
46 ASSERT(range.peek().getBlockType() != CSSParserToken::BlockEnd); | 46 DCHECK_NE(range.peek().getBlockType(), CSSParserToken::BlockEnd); |
47 | 47 |
48 const CSSParserToken& token = range.consume(); | 48 const CSSParserToken& token = range.consume(); |
49 switch (token.type()) { | 49 switch (token.type()) { |
50 case AtKeywordToken: { | 50 case AtKeywordToken: { |
51 if (equalIgnoringASCIICase(token.value(), "apply")) { | 51 if (equalIgnoringASCIICase(token.value(), "apply")) { |
52 range.consumeWhitespace(); | 52 range.consumeWhitespace(); |
53 const CSSParserToken& variableName = | 53 const CSSParserToken& variableName = |
54 range.consumeIncludingWhitespace(); | 54 range.consumeIncludingWhitespace(); |
55 if (!CSSVariableParser::isValidVariableName(variableName) || | 55 if (!CSSVariableParser::isValidVariableName(variableName) || |
56 !(range.atEnd() || range.peek().type() == SemicolonToken || | 56 !(range.atEnd() || range.peek().type() == SemicolonToken || |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (type != CSSValueInternalVariableValue) | 162 if (type != CSSValueInternalVariableValue) |
163 return nullptr; // Invalid or a css-wide keyword | 163 return nullptr; // Invalid or a css-wide keyword |
164 if (requireVarReference && !hasReferences) | 164 if (requireVarReference && !hasReferences) |
165 return nullptr; | 165 return nullptr; |
166 // TODO(timloh): Should this be hasReferences || hasAtApplyRule? | 166 // TODO(timloh): Should this be hasReferences || hasAtApplyRule? |
167 return CSSVariableReferenceValue::create( | 167 return CSSVariableReferenceValue::create( |
168 CSSVariableData::create(range, isAnimationTainted, hasReferences)); | 168 CSSVariableData::create(range, isAnimationTainted, hasReferences)); |
169 } | 169 } |
170 | 170 |
171 } // namespace blink | 171 } // namespace blink |
OLD | NEW |