Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Side by Side Diff: Source/core/css/CSSPrimitiveValue.h

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and oilpan feedback Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 CSSPrimitiveValue(CSSValueID); 308 CSSPrimitiveValue(CSSValueID);
309 CSSPrimitiveValue(CSSPropertyID); 309 CSSPrimitiveValue(CSSPropertyID);
310 CSSPrimitiveValue(RGBA32 color); 310 CSSPrimitiveValue(RGBA32 color);
311 CSSPrimitiveValue(const Length&, float zoom); 311 CSSPrimitiveValue(const Length&, float zoom);
312 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&); 312 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&);
313 CSSPrimitiveValue(const String&, UnitType); 313 CSSPrimitiveValue(const String&, UnitType);
314 CSSPrimitiveValue(double, UnitType); 314 CSSPrimitiveValue(double, UnitType);
315 315
316 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa ppings.h 316 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa ppings.h
317 template<typename T> CSSPrimitiveValue(T* val) 317 template<typename T> CSSPrimitiveValue(T* val)
318 : CSSValue(PrimitiveClass) 318 : CSSValueObject(PrimitiveClass)
319 { 319 {
320 init(PassRefPtrWillBeRawPtr<T>(val)); 320 init(PassRefPtrWillBeRawPtr<T>(val));
321 } 321 }
322 322
323 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val) 323 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val)
324 : CSSValue(PrimitiveClass) 324 : CSSValueObject(PrimitiveClass)
325 { 325 {
326 init(val); 326 init(val);
327 } 327 }
328 328
329 static void create(int); // compile-time guard 329 static void create(int); // compile-time guard
330 static void create(unsigned); // compile-time guard 330 static void create(unsigned); // compile-time guard
331 template<typename T> operator T*(); // compile-time guard 331 template<typename T> operator T*(); // compile-time guard
332 332
333 void init(const Length&); 333 void init(const Length&);
334 void init(const LengthSize&, const ComputedStyle&); 334 void init(const LengthSize&, const ComputedStyle&);
(...skipping 23 matching lines...) Expand all
358 }; 358 };
359 359
360 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 360 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
361 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; 361 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray;
362 362
363 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 363 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
364 364
365 } // namespace blink 365 } // namespace blink
366 366
367 #endif // CSSPrimitiveValue_h 367 #endif // CSSPrimitiveValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698