OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 // This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY
for frequencies. | 133 // This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY
for frequencies. |
134 enum UnitCategory { | 134 enum UnitCategory { |
135 UNumber, | 135 UNumber, |
136 UPercent, | 136 UPercent, |
137 ULength, | 137 ULength, |
138 UAngle, | 138 UAngle, |
139 UTime, | 139 UTime, |
140 UFrequency, | 140 UFrequency, |
141 UViewportPercentageLength, | 141 UViewportPercentageLength, |
142 #if ENABLE(RESOLUTION_MEDIA_QUERY) | |
143 UResolution, | 142 UResolution, |
144 #endif | |
145 UOther | 143 UOther |
146 }; | 144 }; |
147 | 145 |
148 bool isAngle() const | 146 bool isAngle() const |
149 { | 147 { |
150 return m_primitiveUnitType == CSS_DEG | 148 return m_primitiveUnitType == CSS_DEG |
151 || m_primitiveUnitType == CSS_RAD | 149 || m_primitiveUnitType == CSS_RAD |
152 || m_primitiveUnitType == CSS_GRAD | 150 || m_primitiveUnitType == CSS_GRAD |
153 || m_primitiveUnitType == CSS_TURN; | 151 || m_primitiveUnitType == CSS_TURN; |
154 } | 152 } |
(...skipping 21 matching lines...) Expand all Loading... |
176 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } | 174 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } |
177 bool isString() const { return m_primitiveUnitType == CSS_STRING; } | 175 bool isString() const { return m_primitiveUnitType == CSS_STRING; } |
178 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit
Type == CSS_MS; } | 176 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit
Type == CSS_MS; } |
179 bool isURI() const { return m_primitiveUnitType == CSS_URI; } | 177 bool isURI() const { return m_primitiveUnitType == CSS_URI; } |
180 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; } | 178 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; } |
181 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_NUMBER; } | 179 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_NUMBER; } |
182 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_LENGTH; } | 180 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_LENGTH; } |
183 bool isDotsPerInch() const { return primitiveType() == CSS_DPI; } | 181 bool isDotsPerInch() const { return primitiveType() == CSS_DPI; } |
184 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } | 182 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } |
185 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } | 183 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } |
| 184 bool isResolution() const |
| 185 { |
| 186 unsigned short type = primitiveType(); |
| 187 return type >= CSS_DPPX && type <= CSS_DPCM; |
| 188 } |
186 bool isVariableName() const { return primitiveType() == CSS_VARIABLE_NAME; } | 189 bool isVariableName() const { return primitiveType() == CSS_VARIABLE_NAME; } |
187 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_
VW && m_primitiveUnitType <= CSS_VMAX; } | 190 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_
VW && m_primitiveUnitType <= CSS_VMAX; } |
188 bool isFlex() const { return primitiveType() == CSS_FR; } | 191 bool isFlex() const { return primitiveType() == CSS_FR; } |
189 | 192 |
190 static PassRefPtr<CSSPrimitiveValue> createIdentifier(int identifier) { retu
rn adoptRef(new CSSPrimitiveValue(identifier)); } | 193 static PassRefPtr<CSSPrimitiveValue> createIdentifier(int identifier) { retu
rn adoptRef(new CSSPrimitiveValue(identifier)); } |
191 static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue) { return
adoptRef(new CSSPrimitiveValue(rgbValue)); } | 194 static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue) { return
adoptRef(new CSSPrimitiveValue(rgbValue)); } |
192 static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) {
return adoptRef(new CSSPrimitiveValue(value, type)); } | 195 static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) {
return adoptRef(new CSSPrimitiveValue(value, type)); } |
193 static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes t
ype) { return adoptRef(new CSSPrimitiveValue(value, type)); } | 196 static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes t
ype) { return adoptRef(new CSSPrimitiveValue(value, type)); } |
194 | 197 |
195 template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value) | 198 template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isPrimitiveValue()); | 375 ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isPrimitiveValue()); |
373 return static_cast<const CSSPrimitiveValue*>(value); | 376 return static_cast<const CSSPrimitiveValue*>(value); |
374 } | 377 } |
375 | 378 |
376 // Catch unneeded cast. | 379 // Catch unneeded cast. |
377 void toCSSPrimitiveValue(const CSSPrimitiveValue*); | 380 void toCSSPrimitiveValue(const CSSPrimitiveValue*); |
378 | 381 |
379 } // namespace WebCore | 382 } // namespace WebCore |
380 | 383 |
381 #endif // CSSPrimitiveValue_h | 384 #endif // CSSPrimitiveValue_h |
OLD | NEW |