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 MediaQueryToken(MediaQueryTokenType); | 43 enum BlockType { |
44 MediaQueryToken(MediaQueryTokenType, String); | 44 NotBlock, |
| 45 BlockStart, |
| 46 BlockEnd, |
| 47 }; |
| 48 |
| 49 MediaQueryToken(MediaQueryTokenType, BlockType = NotBlock); |
| 50 MediaQueryToken(MediaQueryTokenType, String value, BlockType = NotBlock); |
45 | 51 |
46 MediaQueryToken(MediaQueryTokenType, UChar); // for DelimiterToken | 52 MediaQueryToken(MediaQueryTokenType, UChar); // for DelimiterToken |
47 MediaQueryToken(MediaQueryTokenType, double, NumericValueType); // for Numbe
rToken | 53 MediaQueryToken(MediaQueryTokenType, double, NumericValueType); // for Numbe
rToken |
48 | 54 |
49 // Converts NumberToken to DimensionToken. | 55 // Converts NumberToken to DimensionToken. |
50 void convertToDimensionWithUnit(String); | 56 void convertToDimensionWithUnit(String); |
51 | 57 |
52 // Converts NumberToken to PercentageToken. | 58 // Converts NumberToken to PercentageToken. |
53 void convertToPercentage(); | 59 void convertToPercentage(); |
54 | 60 |
55 MediaQueryTokenType type() const { return m_type; } | 61 MediaQueryTokenType type() const { return m_type; } |
56 String value() const { return m_value; } | 62 String value() const { return m_value; } |
57 String textForUnitTests() const; | 63 String textForUnitTests() const; |
58 | 64 |
59 UChar delimiter() const { return m_delimiter; } | 65 UChar delimiter() const { return m_delimiter; } |
60 NumericValueType numericValueType() const { return m_numericValueType; } | 66 NumericValueType numericValueType() const { return m_numericValueType; } |
61 double numericValue() const { return m_numericValue; } | 67 double numericValue() const { return m_numericValue; } |
62 CSSPrimitiveValue::UnitTypes unitType() const { return m_unit; } | 68 CSSPrimitiveValue::UnitTypes unitType() const { return m_unit; } |
| 69 BlockType blockType() const { return m_blockType; } |
63 | 70 |
64 private: | 71 private: |
65 MediaQueryTokenType m_type; | 72 MediaQueryTokenType m_type; |
66 String m_value; | 73 String m_value; |
67 | 74 |
68 UChar m_delimiter; // Could be rolled into m_value? | 75 UChar m_delimiter; // Could be rolled into m_value? |
69 | 76 |
70 NumericValueType m_numericValueType; | 77 NumericValueType m_numericValueType; |
71 double m_numericValue; | 78 double m_numericValue; |
72 CSSPrimitiveValue::UnitTypes m_unit; | 79 CSSPrimitiveValue::UnitTypes m_unit; |
| 80 |
| 81 BlockType m_blockType; |
73 }; | 82 }; |
74 | 83 |
75 } | 84 } // namespace |
76 | 85 |
77 #endif // MediaQueryToken_h | 86 #endif // MediaQueryToken_h |
OLD | NEW |