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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 bool isPx() const { return typeWithCalcResolved() == UnitType::Pixels; } 193 bool isPx() const { return typeWithCalcResolved() == UnitType::Pixels; }
194 bool isTime() const { return type() == UnitType::Seconds || type() == UnitTy pe::Milliseconds; } 194 bool isTime() const { return type() == UnitType::Seconds || type() == UnitTy pe::Milliseconds; }
195 bool isCalculated() const { return type() == UnitType::Calc; } 195 bool isCalculated() const { return type() == UnitType::Calc; }
196 bool isCalculatedPercentageWithNumber() const { return typeWithCalcResolved( ) == UnitType::CalcPercentageWithNumber; } 196 bool isCalculatedPercentageWithNumber() const { return typeWithCalcResolved( ) == UnitType::CalcPercentageWithNumber; }
197 bool isCalculatedPercentageWithLength() const { return typeWithCalcResolved( ) == UnitType::CalcPercentageWithLength; } 197 bool isCalculatedPercentageWithLength() const { return typeWithCalcResolved( ) == UnitType::CalcPercentageWithLength; }
198 static bool isResolution(UnitType type) { return type >= UnitType::DotsPerPi xel && type <= UnitType::DotsPerCentimeter; } 198 static bool isResolution(UnitType type) { return type >= UnitType::DotsPerPi xel && type <= UnitType::DotsPerCentimeter; }
199 bool isFlex() const { return typeWithCalcResolved() == UnitType::Fraction; } 199 bool isFlex() const { return typeWithCalcResolved() == UnitType::Fraction; }
200 bool isValueID() const { return type() == UnitType::ValueID; } 200 bool isValueID() const { return type() == UnitType::ValueID; }
201 bool colorIsDerivedFromElement() const; 201 bool colorIsDerivedFromElement() const;
202 202
203 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) 203 static RawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID)
204 { 204 {
205 return adoptRefWillBeNoop(new CSSPrimitiveValue(valueID)); 205 return (new CSSPrimitiveValue(valueID));
206 } 206 }
207 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(double value, UnitTy pe type) 207 static RawPtr<CSSPrimitiveValue> create(double value, UnitType type)
208 { 208 {
209 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, type)); 209 return (new CSSPrimitiveValue(value, type));
210 } 210 }
211 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const Length& value, float zoom) 211 static RawPtr<CSSPrimitiveValue> create(const Length& value, float zoom)
212 { 212 {
213 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, zoom)); 213 return (new CSSPrimitiveValue(value, zoom));
214 } 214 }
215 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create (T value) 215 template<typename T> static RawPtr<CSSPrimitiveValue> create(T value)
216 { 216 {
217 static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead"); 217 static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead");
218 return adoptRefWillBeNoop(new CSSPrimitiveValue(value)); 218 return (new CSSPrimitiveValue(value));
219 } 219 }
220 220
221 ~CSSPrimitiveValue(); 221 ~CSSPrimitiveValue();
222 222
223 UnitType typeWithCalcResolved() const; 223 UnitType typeWithCalcResolved() const;
224 224
225 double computeDegrees() const; 225 double computeDegrees() const;
226 double computeSeconds() const; 226 double computeSeconds() const;
227 227
228 // Computes a length in pixels, resolving relative lengths 228 // Computes a length in pixels, resolving relative lengths
(...skipping 29 matching lines...) Expand all
258 258
259 private: 259 private:
260 CSSPrimitiveValue(CSSValueID); 260 CSSPrimitiveValue(CSSValueID);
261 CSSPrimitiveValue(const Length&, float zoom); 261 CSSPrimitiveValue(const Length&, float zoom);
262 CSSPrimitiveValue(double, UnitType); 262 CSSPrimitiveValue(double, UnitType);
263 263
264 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa ppings.h 264 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa ppings.h
265 template<typename T> CSSPrimitiveValue(T* val) 265 template<typename T> CSSPrimitiveValue(T* val)
266 : CSSValue(PrimitiveClass) 266 : CSSValue(PrimitiveClass)
267 { 267 {
268 init(PassRefPtrWillBeRawPtr<T>(val)); 268 init(RawPtr<T>(val));
269 } 269 }
270 270
271 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val) 271 template<typename T> CSSPrimitiveValue(RawPtr<T> val)
272 : CSSValue(PrimitiveClass) 272 : CSSValue(PrimitiveClass)
273 { 273 {
274 init(val); 274 init(val);
275 } 275 }
276 276
277 static void create(int); // compile-time guard 277 static void create(int); // compile-time guard
278 static void create(unsigned); // compile-time guard 278 static void create(unsigned); // compile-time guard
279 template<typename T> operator T*(); // compile-time guard 279 template<typename T> operator T*(); // compile-time guard
280 280
281 void init(UnitType); 281 void init(UnitType);
282 void init(const Length&); 282 void init(const Length&);
283 void init(PassRefPtrWillBeRawPtr<CSSCalcValue>); 283 void init(RawPtr<CSSCalcValue>);
284 284
285 double computeLengthDouble(const CSSToLengthConversionData&) const; 285 double computeLengthDouble(const CSSToLengthConversionData&) const;
286 286
287 inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitT ype); } 287 inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitT ype); }
288 288
289 union { 289 union {
290 CSSValueID valueID; 290 CSSValueID valueID;
291 double num; 291 double num;
292 // FIXME: oilpan: Should be a member, but no support for members in unio ns. Just trace the raw ptr for now. 292 // FIXME: oilpan: Should be a member, but no support for members in unio ns. Just trace the raw ptr for now.
293 CSSCalcValue* calc; 293 CSSCalcValue* calc;
294 } m_value; 294 } m_value;
295 }; 295 };
296 296
297 using CSSLengthArray = CSSPrimitiveValue::CSSLengthArray; 297 using CSSLengthArray = CSSPrimitiveValue::CSSLengthArray;
298 using CSSLengthTypeArray = CSSPrimitiveValue::CSSLengthTypeArray; 298 using CSSLengthTypeArray = CSSPrimitiveValue::CSSLengthTypeArray;
299 299
300 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 300 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
301 301
302 } // namespace blink 302 } // namespace blink
303 303
304 #endif // CSSPrimitiveValue_h 304 #endif // CSSPrimitiveValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698