| 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/parser/CSSParserTokenRange.h" | 8 #include "core/css/parser/CSSParserTokenRange.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 if (!classifyBlock(block, hasReferences, hasAtApplyRule, false)) | 40 if (!classifyBlock(block, hasReferences, hasAtApplyRule, false)) |
| 41 return false; | 41 return false; |
| 42 continue; | 42 continue; |
| 43 } | 43 } |
| 44 | 44 |
| 45 ASSERT(range.peek().getBlockType() != CSSParserToken::BlockEnd); | 45 ASSERT(range.peek().getBlockType() != CSSParserToken::BlockEnd); |
| 46 | 46 |
| 47 const CSSParserToken& token = range.consume(); | 47 const CSSParserToken& token = range.consume(); |
| 48 switch (token.type()) { | 48 switch (token.type()) { |
| 49 case AtKeywordToken: { | 49 case AtKeywordToken: { |
| 50 if (token.valueEqualsIgnoringASCIICase("apply")) { | 50 if (equalIgnoringASCIICase(token.value(), "apply")) { |
| 51 range.consumeWhitespace(); | 51 range.consumeWhitespace(); |
| 52 const CSSParserToken& variableName = range.consumeIncludingWhite
space(); | 52 const CSSParserToken& variableName = range.consumeIncludingWhite
space(); |
| 53 if (!CSSVariableParser::isValidVariableName(variableName) | 53 if (!CSSVariableParser::isValidVariableName(variableName) |
| 54 || !(range.atEnd() || range.peek().type() == SemicolonToken
|| range.peek().type() == RightBraceToken)) | 54 || !(range.atEnd() || range.peek().type() == SemicolonToken
|| range.peek().type() == RightBraceToken)) |
| 55 return false; | 55 return false; |
| 56 hasAtApplyRule = true; | 56 hasAtApplyRule = true; |
| 57 } | 57 } |
| 58 break; | 58 break; |
| 59 } | 59 } |
| 60 case DelimiterToken: { | 60 case DelimiterToken: { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule
); | 131 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule
); |
| 132 | 132 |
| 133 if (type == CSSValueInvalid) | 133 if (type == CSSValueInvalid) |
| 134 return nullptr; | 134 return nullptr; |
| 135 if (type == CSSValueInternalVariableValue) | 135 if (type == CSSValueInternalVariableValue) |
| 136 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat
a::create(range, hasReferences || hasAtApplyRule)); | 136 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat
a::create(range, hasReferences || hasAtApplyRule)); |
| 137 return CSSCustomPropertyDeclaration::create(variableName, type); | 137 return CSSCustomPropertyDeclaration::create(variableName, type); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |