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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 return adoptRefWillBeNoop(quirkValue); | 247 return adoptRefWillBeNoop(quirkValue); |
248 } | 248 } |
249 | 249 |
250 ~CSSPrimitiveValue(); | 250 ~CSSPrimitiveValue(); |
251 | 251 |
252 void cleanup(); | 252 void cleanup(); |
253 | 253 |
254 UnitType typeWithCalcResolved() const; | 254 UnitType typeWithCalcResolved() const; |
255 | 255 |
256 double computeDegrees() const; | 256 double computeDegrees() const; |
257 double computeSeconds(); | 257 double computeSeconds() const; |
258 | 258 |
259 // Computes a length in pixels, resolving relative lengths | 259 // Computes a length in pixels, resolving relative lengths |
260 template<typename T> T computeLength(const CSSToLengthConversionData&); | 260 template<typename T> T computeLength(const CSSToLengthConversionData&) const
; |
261 | 261 |
262 // Converts to a Length (Fixed, Percent or Calculated) | 262 // Converts to a Length (Fixed, Percent or Calculated) |
263 Length convertToLength(const CSSToLengthConversionData&); | 263 Length convertToLength(const CSSToLengthConversionData&) const; |
264 | 264 |
265 double getDoubleValue() const; | 265 double getDoubleValue() const; |
266 float getFloatValue() const { return getValue<float>(); } | 266 float getFloatValue() const { return getValue<float>(); } |
267 int getIntValue() const { return getValue<int>(); } | 267 int getIntValue() const { return getValue<int>(); } |
268 template<typename T> inline T getValue() const { return clampTo<T>(getDouble
Value()); } | 268 template<typename T> inline T getValue() const { return clampTo<T>(getDouble
Value()); } |
269 | 269 |
270 String getStringValue() const; | 270 String getStringValue() const; |
271 | 271 |
272 Rect* getRectValue() const { ASSERT(isRect()); return m_value.rect; } | 272 Rect* getRectValue() const { ASSERT(isRect()); return m_value.rect; } |
273 Quad* getQuadValue() const { ASSERT(isQuad()); return m_value.quad; } | 273 Quad* getQuadValue() const { ASSERT(isQuad()); return m_value.quad; } |
274 RGBA32 getRGBA32Value() const { ASSERT(isRGBColor()); return m_value.rgbcolo
r; } | 274 RGBA32 getRGBA32Value() const { ASSERT(isRGBColor()); return m_value.rgbcolo
r; } |
275 | 275 |
276 // TODO(timloh): Add isPair() and update callers so we can ASSERT(isPair()) | 276 // TODO(timloh): Add isPair() and update callers so we can ASSERT(isPair()) |
277 Pair* getPairValue() const { return type() != UnitType::Pair ? 0 : m_value.p
air; } | 277 Pair* getPairValue() const { return type() != UnitType::Pair ? 0 : m_value.p
air; } |
278 | 278 |
279 CSSBasicShape* getShapeValue() const { ASSERT(isShape()); return m_value.sha
pe; } | 279 CSSBasicShape* getShapeValue() const { ASSERT(isShape()); return m_value.sha
pe; } |
280 CSSCalcValue* cssCalcValue() const { ASSERT(isCalculated()); return m_value.
calc; } | 280 CSSCalcValue* cssCalcValue() const { ASSERT(isCalculated()); return m_value.
calc; } |
281 CSSPropertyID getPropertyID() const { ASSERT(isPropertyID()); return m_value
.propertyID; } | 281 CSSPropertyID getPropertyID() const { ASSERT(isPropertyID()); return m_value
.propertyID; } |
282 | 282 |
283 CSSValueID getValueID() const { return type() == UnitType::ValueID ? m_value
.valueID : CSSValueInvalid; } | 283 CSSValueID getValueID() const { return type() == UnitType::ValueID ? m_value
.valueID : CSSValueInvalid; } |
284 | 284 |
285 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa
lueMappings.h | 285 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa
lueMappings.h |
286 | 286 |
287 static const char* unitTypeToString(UnitType); | 287 static const char* unitTypeToString(UnitType); |
288 String customCSSText() const; | 288 String customCSSText() const; |
289 | 289 |
290 bool isQuirkValue() { return m_isQuirkValue; } | 290 bool isQuirkValue() const { return m_isQuirkValue; } |
291 | 291 |
292 bool equals(const CSSPrimitiveValue&) const; | 292 bool equals(const CSSPrimitiveValue&) const; |
293 | 293 |
294 DECLARE_TRACE_AFTER_DISPATCH(); | 294 DECLARE_TRACE_AFTER_DISPATCH(); |
295 | 295 |
296 static UnitType canonicalUnitTypeForCategory(UnitCategory); | 296 static UnitType canonicalUnitTypeForCategory(UnitCategory); |
297 static double conversionToCanonicalUnitsScaleFactor(UnitType); | 297 static double conversionToCanonicalUnitsScaleFactor(UnitType); |
298 | 298 |
299 // Returns true and populates lengthUnitType, if unitType is a length unit.
Otherwise, returns false. | 299 // Returns true and populates lengthUnitType, if unitType is a length unit.
Otherwise, returns false. |
300 static bool unitTypeToLengthUnitType(UnitType, LengthUnitType&); | 300 static bool unitTypeToLengthUnitType(UnitType, LengthUnitType&); |
(...skipping 27 matching lines...) Expand all Loading... |
328 | 328 |
329 void init(UnitType); | 329 void init(UnitType); |
330 void init(const Length&); | 330 void init(const Length&); |
331 void init(const LengthSize&, const ComputedStyle&); | 331 void init(const LengthSize&, const ComputedStyle&); |
332 void init(PassRefPtrWillBeRawPtr<Rect>); | 332 void init(PassRefPtrWillBeRawPtr<Rect>); |
333 void init(PassRefPtrWillBeRawPtr<Pair>); | 333 void init(PassRefPtrWillBeRawPtr<Pair>); |
334 void init(PassRefPtrWillBeRawPtr<Quad>); | 334 void init(PassRefPtrWillBeRawPtr<Quad>); |
335 void init(PassRefPtrWillBeRawPtr<CSSBasicShape>); | 335 void init(PassRefPtrWillBeRawPtr<CSSBasicShape>); |
336 void init(PassRefPtrWillBeRawPtr<CSSCalcValue>); | 336 void init(PassRefPtrWillBeRawPtr<CSSCalcValue>); |
337 | 337 |
338 double computeLengthDouble(const CSSToLengthConversionData&); | 338 double computeLengthDouble(const CSSToLengthConversionData&) const; |
339 | 339 |
340 inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitT
ype); } | 340 inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitT
ype); } |
341 | 341 |
342 union { | 342 union { |
343 CSSPropertyID propertyID; | 343 CSSPropertyID propertyID; |
344 CSSValueID valueID; | 344 CSSValueID valueID; |
345 double num; | 345 double num; |
346 StringImpl* string; | 346 StringImpl* string; |
347 RGBA32 rgbcolor; | 347 RGBA32 rgbcolor; |
348 // FIXME: oilpan: Should be members, but no support for members in union
s. Just trace the raw ptr for now. | 348 // FIXME: oilpan: Should be members, but no support for members in union
s. Just trace the raw ptr for now. |
349 CSSBasicShape* shape; | 349 CSSBasicShape* shape; |
350 CSSCalcValue* calc; | 350 CSSCalcValue* calc; |
351 Pair* pair; | 351 Pair* pair; |
352 Rect* rect; | 352 Rect* rect; |
353 Quad* quad; | 353 Quad* quad; |
354 } m_value; | 354 } m_value; |
355 }; | 355 }; |
356 | 356 |
357 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; | 357 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; |
358 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; | 358 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; |
359 | 359 |
360 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); | 360 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); |
361 | 361 |
362 } // namespace blink | 362 } // namespace blink |
363 | 363 |
364 #endif // CSSPrimitiveValue_h | 364 #endif // CSSPrimitiveValue_h |
OLD | NEW |