| 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 MediaQueryToken_h | 5 #ifndef MediaQueryToken_h |
| 6 #define MediaQueryToken_h | 6 #define MediaQueryToken_h |
| 7 | 7 |
| 8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
| 9 #include "wtf/text/WTFString.h" | 9 #include "wtf/text/WTFString.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 CommentToken = 18, | 33 CommentToken = 18, |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 enum NumericValueType { | 36 enum NumericValueType { |
| 37 IntegerValueType, | 37 IntegerValueType, |
| 38 NumberValueType, | 38 NumberValueType, |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class MediaQueryToken { | 41 class MediaQueryToken { |
| 42 public: | 42 public: |
| 43 enum BlockType { |
| 44 NotBlock, |
| 45 BlockStart, |
| 46 BlockEnd, |
| 47 }; |
| 48 |
| 43 MediaQueryToken(MediaQueryTokenType); | 49 MediaQueryToken(MediaQueryTokenType); |
| 44 MediaQueryToken(MediaQueryTokenType, String); | 50 MediaQueryToken(MediaQueryTokenType, BlockType); |
| 51 MediaQueryToken(MediaQueryTokenType, String value); |
| 52 MediaQueryToken(MediaQueryTokenType, String value, BlockType); |
| 45 | 53 |
| 46 MediaQueryToken(MediaQueryTokenType, UChar); // for DelimiterToken | 54 MediaQueryToken(MediaQueryTokenType, UChar); // for DelimiterToken |
| 47 MediaQueryToken(MediaQueryTokenType, double, NumericValueType); // for Numbe
rToken | 55 MediaQueryToken(MediaQueryTokenType, double, NumericValueType); // for Numbe
rToken |
| 48 | 56 |
| 49 // Converts NumberToken to DimensionToken. | 57 // Converts NumberToken to DimensionToken. |
| 50 void convertToDimensionWithUnit(String); | 58 void convertToDimensionWithUnit(String); |
| 51 | 59 |
| 52 // Converts NumberToken to PercentageToken. | 60 // Converts NumberToken to PercentageToken. |
| 53 void convertToPercentage(); | 61 void convertToPercentage(); |
| 54 | 62 |
| 55 MediaQueryTokenType type() const { return m_type; } | 63 MediaQueryTokenType type() const { return m_type; } |
| 56 String value() const { return m_value; } | 64 String value() const { return m_value; } |
| 57 String textForUnitTests() const; | 65 String textForUnitTests() const; |
| 58 | 66 |
| 59 UChar delimiter() const { return m_delimiter; } | 67 UChar delimiter() const { return m_delimiter; } |
| 60 NumericValueType numericValueType() const { return m_numericValueType; } | 68 NumericValueType numericValueType() const { return m_numericValueType; } |
| 61 double numericValue() const { return m_numericValue; } | 69 double numericValue() const { return m_numericValue; } |
| 62 CSSPrimitiveValue::UnitTypes unitType() const { return m_unit; } | 70 CSSPrimitiveValue::UnitTypes unitType() const { return m_unit; } |
| 71 BlockType blockType() const { return m_blockType; } |
| 72 unsigned blockLevel() const { return m_blockLevel; } |
| 73 void setBlockLevel(unsigned blockLevel) { m_blockLevel = blockLevel; } |
| 63 | 74 |
| 64 private: | 75 private: |
| 65 MediaQueryTokenType m_type; | 76 MediaQueryTokenType m_type; |
| 66 String m_value; | 77 String m_value; |
| 67 | 78 |
| 68 UChar m_delimiter; // Could be rolled into m_value? | 79 UChar m_delimiter; // Could be rolled into m_value? |
| 69 | 80 |
| 70 NumericValueType m_numericValueType; | 81 NumericValueType m_numericValueType; |
| 71 double m_numericValue; | 82 double m_numericValue; |
| 72 CSSPrimitiveValue::UnitTypes m_unit; | 83 CSSPrimitiveValue::UnitTypes m_unit; |
| 84 |
| 85 BlockType m_blockType; |
| 86 unsigned m_blockLevel; |
| 73 }; | 87 }; |
| 74 | 88 |
| 75 } | 89 } |
| 76 | 90 |
| 77 #endif // MediaQueryToken_h | 91 #endif // MediaQueryToken_h |
| OLD | NEW |