| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 UnitTypeViewportWidth, | 150 UnitTypeViewportWidth, |
| 151 UnitTypeViewportHeight, | 151 UnitTypeViewportHeight, |
| 152 UnitTypeViewportMin, | 152 UnitTypeViewportMin, |
| 153 UnitTypeViewportMax, | 153 UnitTypeViewportMax, |
| 154 | 154 |
| 155 // This value must come after the last length unit type to enable iterat
ion over the length unit types. | 155 // This value must come after the last length unit type to enable iterat
ion over the length unit types. |
| 156 LengthUnitTypeCount, | 156 LengthUnitTypeCount, |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 typedef Vector<double, CSSPrimitiveValue::LengthUnitTypeCount> CSSLengthArra
y; | 159 typedef Vector<double, CSSPrimitiveValue::LengthUnitTypeCount> CSSLengthArra
y; |
| 160 static void zeroLengthArray(CSSLengthArray&); |
| 160 void accumulateLengthArray(CSSLengthArray&, double multiplier = 1) const; | 161 void accumulateLengthArray(CSSLengthArray&, double multiplier = 1) const; |
| 161 | 162 |
| 162 // This enum follows the BisonCSSParser::Units enum augmented with UNIT_FREQ
UENCY for frequencies. | 163 // This enum follows the BisonCSSParser::Units enum augmented with UNIT_FREQ
UENCY for frequencies. |
| 163 enum UnitCategory { | 164 enum UnitCategory { |
| 164 UNumber, | 165 UNumber, |
| 165 UPercent, | 166 UPercent, |
| 166 ULength, | 167 ULength, |
| 167 UAngle, | 168 UAngle, |
| 168 UTime, | 169 UTime, |
| 169 UFrequency, | 170 UFrequency, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 184 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; } | 185 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; } |
| 185 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; } | 186 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; } |
| 186 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX
&& m_primitiveUnitType <= CSS_PC; } | 187 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX
&& m_primitiveUnitType <= CSS_PC; } |
| 187 bool isFontRelativeLength() const | 188 bool isFontRelativeLength() const |
| 188 { | 189 { |
| 189 return m_primitiveUnitType == CSS_EMS | 190 return m_primitiveUnitType == CSS_EMS |
| 190 || m_primitiveUnitType == CSS_EXS | 191 || m_primitiveUnitType == CSS_EXS |
| 191 || m_primitiveUnitType == CSS_REMS | 192 || m_primitiveUnitType == CSS_REMS |
| 192 || m_primitiveUnitType == CSS_CHS; | 193 || m_primitiveUnitType == CSS_CHS; |
| 193 } | 194 } |
| 195 bool isViewportPercentageLength() const { return isViewportPercentageLength(
m_primitiveUnitType); } |
| 194 static bool isViewportPercentageLength(unsigned short type) { return type >=
CSS_VW && type <= CSS_VMAX; } | 196 static bool isViewportPercentageLength(unsigned short type) { return type >=
CSS_VW && type <= CSS_VMAX; } |
| 195 static bool isLength(unsigned short type) | 197 static bool isLength(unsigned short type) |
| 196 { | 198 { |
| 197 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type =
= CSS_CHS || isViewportPercentageLength(type); | 199 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type =
= CSS_CHS || isViewportPercentageLength(type); |
| 198 } | 200 } |
| 199 bool isLength() const { return isLength(primitiveType()); } | 201 bool isLength() const { return isLength(primitiveType()); } |
| 200 bool isNumber() const { return primitiveType() == CSS_NUMBER; } | 202 bool isNumber() const { return primitiveType() == CSS_NUMBER; } |
| 201 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } | 203 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } |
| 202 bool isPx() const { return primitiveType() == CSS_PX; } | 204 bool isPx() const { return primitiveType() == CSS_PX; } |
| 203 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } | 205 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } m_value; | 430 } m_value; |
| 429 }; | 431 }; |
| 430 | 432 |
| 431 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; | 433 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; |
| 432 | 434 |
| 433 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); | 435 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); |
| 434 | 436 |
| 435 } // namespace WebCore | 437 } // namespace WebCore |
| 436 | 438 |
| 437 #endif // CSSPrimitiveValue_h | 439 #endif // CSSPrimitiveValue_h |
| OLD | NEW |