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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (proximityToNextInt <= 0.01 && value > 0) | 63 if (proximityToNextInt <= 0.01 && value > 0) |
64 return static_cast<float>(ceiledValue); | 64 return static_cast<float>(ceiledValue); |
65 if (proximityToNextInt >= 0.99 && value < 0) | 65 if (proximityToNextInt >= 0.99 && value < 0) |
66 return static_cast<float>(floor(value)); | 66 return static_cast<float>(floor(value)); |
67 return static_cast<float>(value); | 67 return static_cast<float>(value); |
68 } | 68 } |
69 | 69 |
70 // CSSPrimitiveValues are immutable. This class has manual ref-counting | 70 // CSSPrimitiveValues are immutable. This class has manual ref-counting |
71 // of unioned types and does not have the code necessary | 71 // of unioned types and does not have the code necessary |
72 // to handle any kind of mutations. | 72 // to handle any kind of mutations. |
73 class CORE_EXPORT CSSPrimitiveValue : public CSSValue { | 73 class CORE_EXPORT CSSPrimitiveValue : public CSSValueObject { |
74 public: | 74 public: |
75 enum UnitType { | 75 enum UnitType { |
76 CSS_UNKNOWN = 0, | 76 CSS_UNKNOWN = 0, |
77 CSS_NUMBER = 1, | 77 CSS_NUMBER = 1, |
78 CSS_PERCENTAGE = 2, | 78 CSS_PERCENTAGE = 2, |
79 CSS_EMS = 3, | 79 CSS_EMS = 3, |
80 CSS_EXS = 4, | 80 CSS_EXS = 4, |
81 CSS_PX = 5, | 81 CSS_PX = 5, |
82 CSS_CM = 6, | 82 CSS_CM = 6, |
83 CSS_MM = 7, | 83 CSS_MM = 7, |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 CSSPrimitiveValue(CSSValueID); | 307 CSSPrimitiveValue(CSSValueID); |
308 CSSPrimitiveValue(CSSPropertyID); | 308 CSSPrimitiveValue(CSSPropertyID); |
309 CSSPrimitiveValue(RGBA32 color); | 309 CSSPrimitiveValue(RGBA32 color); |
310 CSSPrimitiveValue(const Length&, float zoom); | 310 CSSPrimitiveValue(const Length&, float zoom); |
311 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&); | 311 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&); |
312 CSSPrimitiveValue(const String&, UnitType); | 312 CSSPrimitiveValue(const String&, UnitType); |
313 CSSPrimitiveValue(double, UnitType); | 313 CSSPrimitiveValue(double, UnitType); |
314 | 314 |
315 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa
ppings.h | 315 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa
ppings.h |
316 template<typename T> CSSPrimitiveValue(T* val) | 316 template<typename T> CSSPrimitiveValue(T* val) |
317 : CSSValue(PrimitiveClass) | 317 : CSSValueObject(PrimitiveClass) |
318 { | 318 { |
319 init(PassRefPtrWillBeRawPtr<T>(val)); | 319 init(PassRefPtrWillBeRawPtr<T>(val)); |
320 } | 320 } |
321 | 321 |
322 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val) | 322 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val) |
323 : CSSValue(PrimitiveClass) | 323 : CSSValueObject(PrimitiveClass) |
324 { | 324 { |
325 init(val); | 325 init(val); |
326 } | 326 } |
327 | 327 |
328 static void create(int); // compile-time guard | 328 static void create(int); // compile-time guard |
329 static void create(unsigned); // compile-time guard | 329 static void create(unsigned); // compile-time guard |
330 template<typename T> operator T*(); // compile-time guard | 330 template<typename T> operator T*(); // compile-time guard |
331 | 331 |
332 void init(const Length&); | 332 void init(const Length&); |
333 void init(const LengthSize&, const ComputedStyle&); | 333 void init(const LengthSize&, const ComputedStyle&); |
(...skipping 23 matching lines...) Expand all Loading... |
357 }; | 357 }; |
358 | 358 |
359 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; | 359 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; |
360 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; | 360 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; |
361 | 361 |
362 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); | 362 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); |
363 | 363 |
364 } // namespace blink | 364 } // namespace blink |
365 | 365 |
366 #endif // CSSPrimitiveValue_h | 366 #endif // CSSPrimitiveValue_h |
OLD | NEW |