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.
5 #ifndef MediaQueryToken_h
6 #define MediaQueryToken_h
8 #include "core/css/CSSPrimitiveValue.h"
9 #include "wtf/text/WTFString.h"
13 enum MediaQueryTokenType {
25 RightParenthesisToken,
36 enum NumericValueType {
41 class MediaQueryToken {
49 MediaQueryToken(MediaQueryTokenType, BlockType = NotBlock);
50 MediaQueryToken(MediaQueryTokenType, String value, BlockType = NotBlock);
52 MediaQueryToken(MediaQueryTokenType, UChar); // for DelimiterToken
53 MediaQueryToken(MediaQueryTokenType, double, NumericValueType); // for NumberToken
55 // Converts NumberToken to DimensionToken.
56 void convertToDimensionWithUnit(String);
58 // Converts NumberToken to PercentageToken.
59 void convertToPercentage();
61 MediaQueryTokenType type() const { return m_type; }
62 String value() const { return m_value; }
63 String textForUnitTests() const;
65 UChar delimiter() const;
66 NumericValueType numericValueType() const;
67 double numericValue() const;
68 BlockType blockType() const { return m_blockType; }
69 CSSPrimitiveValue::UnitType unitType() const { return m_unit; }
72 MediaQueryTokenType m_type;
75 UChar m_delimiter; // Could be rolled into m_value?
77 NumericValueType m_numericValueType;
78 double m_numericValue;
79 CSSPrimitiveValue::UnitType m_unit;
81 BlockType m_blockType;
84 typedef Vector<MediaQueryToken>::iterator MediaQueryTokenIterator;
88 #endif // MediaQueryToken_h