| 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 #include "core/css/parser/CSSParserValues.h" | 9 #include "core/css/parser/CSSParserValues.h" |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 if (!classifyBlock(block, hasReferences, false)) | 41 if (!classifyBlock(block, hasReferences, false)) |
| 42 return false; | 42 return false; |
| 43 continue; | 43 continue; |
| 44 } | 44 } |
| 45 | 45 |
| 46 ASSERT(range.peek().getBlockType() != CSSParserToken::BlockEnd); | 46 ASSERT(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: { |
| 51 // This might have false positives if the @apply doesn't actually ma
tch |
| 52 // the syntax, but that just means we do extra computation work. |
| 53 if (token.valueEqualsIgnoringASCIICase("apply")) |
| 54 hasReferences = true; |
| 55 break; |
| 56 } |
| 50 case DelimiterToken: { | 57 case DelimiterToken: { |
| 51 if (token.delimiter() == '!' && isTopLevelBlock) | 58 if (token.delimiter() == '!' && isTopLevelBlock) |
| 52 return false; | 59 return false; |
| 53 break; | 60 break; |
| 54 } | 61 } |
| 55 case RightParenthesisToken: | 62 case RightParenthesisToken: |
| 56 case RightBraceToken: | 63 case RightBraceToken: |
| 57 case RightBracketToken: | 64 case RightBracketToken: |
| 58 case BadStringToken: | 65 case BadStringToken: |
| 59 case BadUrlToken: | 66 case BadUrlToken: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 CSSValueID type = classifyVariableRange(range, hasReferences); | 125 CSSValueID type = classifyVariableRange(range, hasReferences); |
| 119 | 126 |
| 120 if (type == CSSValueInvalid) | 127 if (type == CSSValueInvalid) |
| 121 return nullptr; | 128 return nullptr; |
| 122 if (type == CSSValueInternalVariableValue) | 129 if (type == CSSValueInternalVariableValue) |
| 123 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat
a::create(range, hasReferences)); | 130 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat
a::create(range, hasReferences)); |
| 124 return CSSCustomPropertyDeclaration::create(variableName, type); | 131 return CSSCustomPropertyDeclaration::create(variableName, type); |
| 125 } | 132 } |
| 126 | 133 |
| 127 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |