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 SizesCalcParser_h |
| 6 #define SizesCalcParser_h |
| 7 |
| 8 #include "core/css/MediaValues.h" |
| 9 #include "core/css/parser/MediaQueryToken.h" |
| 10 #include "wtf/text/WTFString.h" |
| 11 |
| 12 namespace WebCore { |
| 13 |
| 14 struct SizesCalcValue { |
| 15 double value; |
| 16 bool isLength; |
| 17 UChar operation; |
| 18 |
| 19 SizesCalcValue() |
| 20 : value(0) |
| 21 , isLength(false) |
| 22 , operation(0) |
| 23 { |
| 24 } |
| 25 |
| 26 SizesCalcValue(double numericValue, bool length) |
| 27 : value(numericValue) |
| 28 , isLength(length) |
| 29 , operation(0) |
| 30 { |
| 31 } |
| 32 }; |
| 33 |
| 34 class SizesCalcParser { |
| 35 |
| 36 public: |
| 37 static bool parse(MediaQueryTokenIterator start, MediaQueryTokenIterator end
, PassRefPtr<MediaValues>, unsigned& result); |
| 38 |
| 39 private: |
| 40 SizesCalcParser(PassRefPtr<MediaValues> mediaValues) |
| 41 : m_mediaValues(mediaValues) |
| 42 { |
| 43 } |
| 44 |
| 45 bool calcToReversePolishNotation(MediaQueryTokenIterator start, MediaQueryTo
kenIterator end); |
| 46 bool calculate(unsigned& result); |
| 47 void appendNumber(const MediaQueryToken&); |
| 48 bool appendLength(const MediaQueryToken&); |
| 49 bool handleOperator(Vector<MediaQueryToken>& stack, const MediaQueryToken&); |
| 50 void appendOperator(const MediaQueryToken&); |
| 51 |
| 52 Vector<SizesCalcValue> m_valueList; |
| 53 RefPtr<MediaValues> m_mediaValues; |
| 54 }; |
| 55 |
| 56 } // namespace WebCore |
| 57 |
| 58 #endif // SizesCalcParser_h |
| 59 |
OLD | NEW |