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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; } | 189 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; } |
190 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; } | 190 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; } |
191 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX
&& m_primitiveUnitType <= CSS_PC; } | 191 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX
&& m_primitiveUnitType <= CSS_PC; } |
192 bool isFontRelativeLength() const | 192 bool isFontRelativeLength() const |
193 { | 193 { |
194 return m_primitiveUnitType == CSS_EMS | 194 return m_primitiveUnitType == CSS_EMS |
195 || m_primitiveUnitType == CSS_EXS | 195 || m_primitiveUnitType == CSS_EXS |
196 || m_primitiveUnitType == CSS_REMS | 196 || m_primitiveUnitType == CSS_REMS |
197 || m_primitiveUnitType == CSS_CHS; | 197 || m_primitiveUnitType == CSS_CHS; |
198 } | 198 } |
199 bool isLength() const | 199 static bool isViewportPercentageLength(unsigned short type) { return type >=
CSS_VW && type <= CSS_VMAX; } |
| 200 static bool isLength(unsigned short type) |
200 { | 201 { |
201 unsigned short type = primitiveType(); | 202 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type =
= CSS_CHS || isViewportPercentageLength(type); |
202 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type =
= CSS_CHS || isViewportPercentageLength(); | |
203 } | 203 } |
| 204 bool isLength() const { return isLength(primitiveType()); } |
204 bool isNumber() const { return primitiveType() == CSS_NUMBER; } | 205 bool isNumber() const { return primitiveType() == CSS_NUMBER; } |
205 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } | 206 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } |
206 bool isPx() const { return primitiveType() == CSS_PX; } | 207 bool isPx() const { return primitiveType() == CSS_PX; } |
207 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } | 208 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } |
208 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; } | 209 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; } |
209 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } | 210 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } |
210 bool isString() const { return m_primitiveUnitType == CSS_STRING; } | 211 bool isString() const { return m_primitiveUnitType == CSS_STRING; } |
211 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit
Type == CSS_MS; } | 212 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit
Type == CSS_MS; } |
212 bool isURI() const { return m_primitiveUnitType == CSS_URI; } | 213 bool isURI() const { return m_primitiveUnitType == CSS_URI; } |
213 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; } | 214 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; } |
214 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_NUMBER; } | 215 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_NUMBER; } |
215 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_LENGTH; } | 216 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_LENGTH; } |
216 bool isDotsPerInch() const { return primitiveType() == CSS_DPI; } | 217 bool isDotsPerInch() const { return primitiveType() == CSS_DPI; } |
217 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } | 218 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } |
218 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } | 219 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } |
219 bool isResolution() const | 220 bool isResolution() const |
220 { | 221 { |
221 unsigned short type = primitiveType(); | 222 unsigned short type = primitiveType(); |
222 return type >= CSS_DPPX && type <= CSS_DPCM; | 223 return type >= CSS_DPPX && type <= CSS_DPCM; |
223 } | 224 } |
224 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_
VW && m_primitiveUnitType <= CSS_VMAX; } | |
225 bool isFlex() const { return primitiveType() == CSS_FR; } | 225 bool isFlex() const { return primitiveType() == CSS_FR; } |
226 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; } | 226 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; } |
227 bool colorIsDerivedFromElement() const; | 227 bool colorIsDerivedFromElement() const; |
228 | 228 |
229 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID
valueID) | 229 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID
valueID) |
230 { | 230 { |
231 return adoptRefWillBeRefCountedGarbageCollected(new CSSPrimitiveValue(va
lueID)); | 231 return adoptRefWillBeRefCountedGarbageCollected(new CSSPrimitiveValue(va
lueID)); |
232 } | 232 } |
233 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert
yID propertyID) | 233 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert
yID propertyID) |
234 { | 234 { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 } m_value; | 436 } m_value; |
437 }; | 437 }; |
438 | 438 |
439 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; | 439 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; |
440 | 440 |
441 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); | 441 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); |
442 | 442 |
443 } // namespace WebCore | 443 } // namespace WebCore |
444 | 444 |
445 #endif // CSSPrimitiveValue_h | 445 #endif // CSSPrimitiveValue_h |
OLD | NEW |