| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/parser/SizesCalcParser.h" | 6 #include "core/css/parser/SizesCalcParser.h" |
| 7 | 7 |
| 8 #include "core/css/MediaValues.h" | 8 #include "core/css/MediaValues.h" |
| 9 #include "core/css/parser/CSSParserToken.h" | 9 #include "core/css/parser/CSSParserToken.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 SizesCalcParser::SizesCalcParser(CSSParserTokenRange range, PassRefPtr<MediaValu
es> mediaValues) | 13 SizesCalcParser::SizesCalcParser(CSSParserTokenRange range, PassRefPtrWillBeRawP
tr<MediaValues> mediaValues) |
| 14 : m_mediaValues(mediaValues) | 14 : m_mediaValues(mediaValues) |
| 15 , m_result(0) | 15 , m_result(0) |
| 16 { | 16 { |
| 17 m_isValid = calcToReversePolishNotation(range) && calculate(); | 17 m_isValid = calcToReversePolishNotation(range) && calculate(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 float SizesCalcParser::result() const | 20 float SizesCalcParser::result() const |
| 21 { | 21 { |
| 22 ASSERT(m_isValid); | 22 ASSERT(m_isValid); |
| 23 return m_result; | 23 return m_result; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 if (stack.size() == 1 && stack.last().isLength) { | 226 if (stack.size() == 1 && stack.last().isLength) { |
| 227 m_result = std::max(clampTo<float>(stack.last().value), (float)0.0); | 227 m_result = std::max(clampTo<float>(stack.last().value), (float)0.0); |
| 228 return true; | 228 return true; |
| 229 } | 229 } |
| 230 return false; | 230 return false; |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace blink | 233 } // namespace blink |
| OLD | NEW |