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 { |
11 | 11 |
12 SizesCalcParser::SizesCalcParser(CSSParserTokenRange range, RawPtr<MediaValues>
mediaValues) | 12 SizesCalcParser::SizesCalcParser(CSSParserTokenRange range, MediaValues* mediaVa
lues) |
13 : m_mediaValues(mediaValues) | 13 : m_mediaValues(mediaValues) |
14 , m_result(0) | 14 , m_result(0) |
15 { | 15 { |
16 m_isValid = calcToReversePolishNotation(range) && calculate(); | 16 m_isValid = calcToReversePolishNotation(range) && calculate(); |
17 } | 17 } |
18 | 18 |
19 float SizesCalcParser::result() const | 19 float SizesCalcParser::result() const |
20 { | 20 { |
21 ASSERT(m_isValid); | 21 ASSERT(m_isValid); |
22 return m_result; | 22 return m_result; |
(...skipping 200 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 |