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

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 Created 5 years, 4 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
« no previous file with comments | « Source/core/css/CSSPathValue.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 CSSPrimitiveValue(CSSValueID); 310 CSSPrimitiveValue(CSSValueID);
311 CSSPrimitiveValue(CSSPropertyID); 311 CSSPrimitiveValue(CSSPropertyID);
312 CSSPrimitiveValue(RGBA32 color); 312 CSSPrimitiveValue(RGBA32 color);
313 CSSPrimitiveValue(const Length&, float zoom); 313 CSSPrimitiveValue(const Length&, float zoom);
314 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&); 314 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&);
315 CSSPrimitiveValue(const String&, UnitType); 315 CSSPrimitiveValue(const String&, UnitType);
316 CSSPrimitiveValue(double, UnitType); 316 CSSPrimitiveValue(double, UnitType);
317 317
318 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa ppings.h 318 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa ppings.h
319 template<typename T> CSSPrimitiveValue(T* val) 319 template<typename T> CSSPrimitiveValue(T* val)
320 : CSSValue(PrimitiveClass) 320 : CSSValueObject(PrimitiveClass)
321 { 321 {
322 init(PassRefPtrWillBeRawPtr<T>(val)); 322 init(PassRefPtrWillBeRawPtr<T>(val));
323 } 323 }
324 324
325 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val) 325 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val)
326 : CSSValue(PrimitiveClass) 326 : CSSValueObject(PrimitiveClass)
327 { 327 {
328 init(val); 328 init(val);
329 } 329 }
330 330
331 static void create(int); // compile-time guard 331 static void create(int); // compile-time guard
332 static void create(unsigned); // compile-time guard 332 static void create(unsigned); // compile-time guard
333 template<typename T> operator T*(); // compile-time guard 333 template<typename T> operator T*(); // compile-time guard
334 334
335 void init(const Length&); 335 void init(const Length&);
336 void init(const LengthSize&, const ComputedStyle&); 336 void init(const LengthSize&, const ComputedStyle&);
(...skipping 23 matching lines...) Expand all
360 }; 360 };
361 361
362 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 362 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
363 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; 363 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray;
364 364
365 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 365 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
366 366
367 } // namespace blink 367 } // namespace blink
368 368
369 #endif // CSSPrimitiveValue_h 369 #endif // CSSPrimitiveValue_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSPathValue.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698