OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/SizesCalcParser.h" | 5 #include "core/css/parser/SizesCalcParser.h" |
6 | 6 |
7 #include "core/css/MediaValues.h" | 7 #include "core/css/MediaValues.h" |
8 #include "core/css/parser/CSSParserToken.h" | 8 #include "core/css/parser/CSSParserToken.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 break; | 98 break; |
99 case DimensionToken: | 99 case DimensionToken: |
100 if (!CSSPrimitiveValue::isLength(token.unitType()) || !appendLength(
token)) | 100 if (!CSSPrimitiveValue::isLength(token.unitType()) || !appendLength(
token)) |
101 return false; | 101 return false; |
102 break; | 102 break; |
103 case DelimiterToken: | 103 case DelimiterToken: |
104 if (!handleOperator(stack, token)) | 104 if (!handleOperator(stack, token)) |
105 return false; | 105 return false; |
106 break; | 106 break; |
107 case FunctionToken: | 107 case FunctionToken: |
108 if (!token.valueEqualsIgnoringCase("calc")) | 108 if (!token.valueEqualsIgnoringASCIICase("calc")) |
109 return false; | 109 return false; |
110 // "calc(" is the same as "(" | 110 // "calc(" is the same as "(" |
111 case LeftParenthesisToken: | 111 case LeftParenthesisToken: |
112 // If the token is a left parenthesis, then push it onto the stack. | 112 // If the token is a left parenthesis, then push it onto the stack. |
113 stack.append(token); | 113 stack.append(token); |
114 break; | 114 break; |
115 case RightParenthesisToken: | 115 case RightParenthesisToken: |
116 // If the token is a right parenthesis: | 116 // If the token is a right parenthesis: |
117 // Until the token at the top of the stack is a left parenthesis, po
p operators off the stack onto the output queue. | 117 // Until the token at the top of the stack is a left parenthesis, po
p operators off the stack onto the output queue. |
118 while (!stack.isEmpty() && stack.last().type() != LeftParenthesisTok
en && stack.last().type() != FunctionToken) { | 118 while (!stack.isEmpty() && stack.last().type() != LeftParenthesisTok
en && stack.last().type() != FunctionToken) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 } | 224 } |
225 if (stack.size() == 1 && stack.last().isLength) { | 225 if (stack.size() == 1 && stack.last().isLength) { |
226 m_result = std::max(clampTo<float>(stack.last().value), (float)0.0); | 226 m_result = std::max(clampTo<float>(stack.last().value), (float)0.0); |
227 return true; | 227 return true; |
228 } | 228 } |
229 return false; | 229 return false; |
230 } | 230 } |
231 | 231 |
232 } // namespace blink | 232 } // namespace blink |
OLD | NEW |