| 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/css/MediaValues.h" | 8 #include "core/css/MediaValues.h" |
| 9 #include "core/css/parser/MediaQueryToken.h" | 9 #include "core/css/parser/MediaQueryToken.h" |
| 10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 : value(numericValue) | 27 : value(numericValue) |
| 28 , isLength(length) | 28 , isLength(length) |
| 29 , operation(0) | 29 , operation(0) |
| 30 { | 30 { |
| 31 } | 31 } |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class SizesCalcParser { | 34 class SizesCalcParser { |
| 35 | 35 |
| 36 public: | 36 public: |
| 37 static bool parse(MediaQueryTokenIterator start, MediaQueryTokenIterator end
, PassRefPtr<MediaValues>, unsigned& result); | 37 SizesCalcParser(MediaQueryTokenIterator start, MediaQueryTokenIterator end,
PassRefPtr<MediaValues>); |
| 38 bool viewportDependant() const { return m_viewportDependant; } |
| 39 unsigned result(); |
| 40 bool isValid() const { return m_isValid; } |
| 38 | 41 |
| 39 private: | 42 private: |
| 40 SizesCalcParser(PassRefPtr<MediaValues> mediaValues) | |
| 41 : m_mediaValues(mediaValues) | |
| 42 { | |
| 43 } | |
| 44 | |
| 45 bool calcToReversePolishNotation(MediaQueryTokenIterator start, MediaQueryTo
kenIterator end); | 43 bool calcToReversePolishNotation(MediaQueryTokenIterator start, MediaQueryTo
kenIterator end); |
| 46 bool calculate(unsigned& result); | 44 bool calculate(); |
| 47 void appendNumber(const MediaQueryToken&); | 45 void appendNumber(const MediaQueryToken&); |
| 48 bool appendLength(const MediaQueryToken&); | 46 bool appendLength(const MediaQueryToken&); |
| 49 bool handleOperator(Vector<MediaQueryToken>& stack, const MediaQueryToken&); | 47 bool handleOperator(Vector<MediaQueryToken>& stack, const MediaQueryToken&); |
| 50 void appendOperator(const MediaQueryToken&); | 48 void appendOperator(const MediaQueryToken&); |
| 51 | 49 |
| 52 Vector<SizesCalcValue> m_valueList; | 50 Vector<SizesCalcValue> m_valueList; |
| 53 RefPtr<MediaValues> m_mediaValues; | 51 RefPtr<MediaValues> m_mediaValues; |
| 52 bool m_viewportDependant; |
| 53 bool m_isValid; |
| 54 unsigned m_result; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 } // namespace blink | 57 } // namespace blink |
| 57 | 58 |
| 58 #endif // SizesCalcParser_h | 59 #endif // SizesCalcParser_h |
| 59 | 60 |
| OLD | NEW |