| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MediaQueryCalcParser_h |
| 6 #define MediaQueryCalcParser_h |
| 7 |
| 8 #include "core/css/parser/MediaQueryToken.h" |
| 9 #include "wtf/text/WTFString.h" |
| 10 |
| 11 namespace WebCore { |
| 12 |
| 13 struct MediaQueryCalcValue { |
| 14 double value; |
| 15 UChar operation; |
| 16 |
| 17 MediaQueryCalcValue() |
| 18 : value(0) |
| 19 , operation(0) |
| 20 { |
| 21 } |
| 22 }; |
| 23 |
| 24 class MediaQueryCalcParser { |
| 25 |
| 26 public: |
| 27 static int parse(MediaQueryTokenIterator start, MediaQueryTokenIterator end,
unsigned fontSize, unsigned viewportWidth, unsigned viewportHeight); |
| 28 |
| 29 private: |
| 30 MediaQueryCalcParser(unsigned fontSize, unsigned viewportWidth, unsigned vie
wportHeight) |
| 31 : m_fontSize(fontSize) |
| 32 , m_viewportWidth(viewportWidth) |
| 33 , m_viewportHeight(viewportHeight) |
| 34 { |
| 35 } |
| 36 |
| 37 bool calcToReversePolishNotation(MediaQueryTokenIterator start, MediaQueryTo
kenIterator end); |
| 38 bool calculate(int& result); |
| 39 bool appendNumber(const MediaQueryToken&); |
| 40 bool handleOperator(Vector<MediaQueryToken>& stack, const MediaQueryToken&); |
| 41 void appendOperator(const MediaQueryToken&); |
| 42 |
| 43 Vector<MediaQueryCalcValue> m_valueList; |
| 44 unsigned m_fontSize; |
| 45 unsigned m_viewportWidth; |
| 46 unsigned m_viewportHeight; |
| 47 }; |
| 48 |
| 49 } // namespace WebCore |
| 50 |
| 51 #endif // MediaQueryCalcParser_h |
| 52 |
| OLD | NEW |