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 19 matching lines...) Expand all Loading... |
30 : value(numericValue) | 30 : value(numericValue) |
31 , isLength(length) | 31 , isLength(length) |
32 , operation(0) | 32 , operation(0) |
33 { | 33 { |
34 } | 34 } |
35 }; | 35 }; |
36 | 36 |
37 class CORE_EXPORT SizesCalcParser { | 37 class CORE_EXPORT SizesCalcParser { |
38 STACK_ALLOCATED(); | 38 STACK_ALLOCATED(); |
39 public: | 39 public: |
40 SizesCalcParser(CSSParserTokenRange, RawPtr<MediaValues>); | 40 SizesCalcParser(CSSParserTokenRange, MediaValues*); |
41 | 41 |
42 float result() const; | 42 float result() const; |
43 bool isValid() const { return m_isValid; } | 43 bool isValid() const { return m_isValid; } |
44 | 44 |
45 private: | 45 private: |
46 bool calcToReversePolishNotation(CSSParserTokenRange); | 46 bool calcToReversePolishNotation(CSSParserTokenRange); |
47 bool calculate(); | 47 bool calculate(); |
48 void appendNumber(const CSSParserToken&); | 48 void appendNumber(const CSSParserToken&); |
49 bool appendLength(const CSSParserToken&); | 49 bool appendLength(const CSSParserToken&); |
50 bool handleOperator(Vector<CSSParserToken>& stack, const CSSParserToken&); | 50 bool handleOperator(Vector<CSSParserToken>& stack, const CSSParserToken&); |
51 void appendOperator(const CSSParserToken&); | 51 void appendOperator(const CSSParserToken&); |
52 | 52 |
53 Vector<SizesCalcValue> m_valueList; | 53 Vector<SizesCalcValue> m_valueList; |
54 Member<MediaValues> m_mediaValues; | 54 Member<MediaValues> m_mediaValues; |
55 bool m_isValid; | 55 bool m_isValid; |
56 float m_result; | 56 float m_result; |
57 }; | 57 }; |
58 | 58 |
59 } // namespace blink | 59 } // namespace blink |
60 | 60 |
61 #endif // SizesCalcParser_h | 61 #endif // SizesCalcParser_h |
62 | 62 |
OLD | NEW |