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 #ifndef SizesCalcParser_h | 5 #ifndef SizesCalcParser_h |
6 #define SizesCalcParser_h | 6 #define SizesCalcParser_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/css/MediaValues.h" | 9 #include "core/css/MediaValues.h" |
10 #include "core/css/parser/CSSParserToken.h" | 10 #include "core/css/parser/CSSParserToken.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 SizesCalcValue(double numericValue, bool length) | 28 SizesCalcValue(double numericValue, bool length) |
29 : value(numericValue) | 29 : value(numericValue) |
30 , isLength(length) | 30 , isLength(length) |
31 , operation(0) | 31 , operation(0) |
32 { | 32 { |
33 } | 33 } |
34 }; | 34 }; |
35 | 35 |
36 class CORE_EXPORT SizesCalcParser { | 36 class CORE_EXPORT SizesCalcParser { |
37 | 37 STACK_ALLOCATED(); |
38 public: | 38 public: |
39 SizesCalcParser(CSSParserTokenRange, PassRefPtr<MediaValues>); | 39 SizesCalcParser(CSSParserTokenRange, PassRefPtrWillBeRawPtr<MediaValues>); |
40 | 40 |
41 float result() const; | 41 float result() const; |
42 bool isValid() const { return m_isValid; } | 42 bool isValid() const { return m_isValid; } |
43 | 43 |
44 private: | 44 private: |
45 bool calcToReversePolishNotation(CSSParserTokenRange); | 45 bool calcToReversePolishNotation(CSSParserTokenRange); |
46 bool calculate(); | 46 bool calculate(); |
47 void appendNumber(const CSSParserToken&); | 47 void appendNumber(const CSSParserToken&); |
48 bool appendLength(const CSSParserToken&); | 48 bool appendLength(const CSSParserToken&); |
49 bool handleOperator(Vector<CSSParserToken>& stack, const CSSParserToken&); | 49 bool handleOperator(Vector<CSSParserToken>& stack, const CSSParserToken&); |
50 void appendOperator(const CSSParserToken&); | 50 void appendOperator(const CSSParserToken&); |
51 | 51 |
52 Vector<SizesCalcValue> m_valueList; | 52 Vector<SizesCalcValue> m_valueList; |
53 RefPtr<MediaValues> m_mediaValues; | 53 RefPtrWillBeMember<MediaValues> m_mediaValues; |
54 bool m_isValid; | 54 bool m_isValid; |
55 float m_result; | 55 float m_result; |
56 }; | 56 }; |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
59 | 59 |
60 #endif // SizesCalcParser_h | 60 #endif // SizesCalcParser_h |
61 | 61 |
OLD | NEW |