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

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

Issue 1310603004: WIP: Reduce sizeof(CSSValue) by 8 byte Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return adoptRefWillBeNoop(new CSSPrimitiveValue(value)); 236 return adoptRefWillBeNoop(new CSSPrimitiveValue(value));
237 } 237 }
238 238
239 // This value is used to handle quirky margins in reflow roots (body, td, an d th) like WinIE. 239 // This value is used to handle quirky margins in reflow roots (body, td, an d th) like WinIE.
240 // The basic idea is that a stylesheet can use the value __qem (for quirky e m) instead of em. 240 // The basic idea is that a stylesheet can use the value __qem (for quirky e m) instead of em.
241 // When the quirky value is used, if you're in quirks mode, the margin will collapse away 241 // When the quirky value is used, if you're in quirks mode, the margin will collapse away
242 // inside a table cell. 242 // inside a table cell.
243 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createAllowingMarginQuirk(d ouble value, UnitType type) 243 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createAllowingMarginQuirk(d ouble value, UnitType type)
244 { 244 {
245 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); 245 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type);
246 quirkValue->m_isQuirkValue = true; 246 quirkValue->setIsQuirkValue(true);
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;
(...skipping 23 matching lines...) Expand all
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() const { return m_isQuirkValue; }
291
292 bool equals(const CSSPrimitiveValue&) const; 290 bool equals(const CSSPrimitiveValue&) const;
293 291
294 DECLARE_TRACE_AFTER_DISPATCH(); 292 DECLARE_TRACE_AFTER_DISPATCH();
295 293
296 static UnitType canonicalUnitTypeForCategory(UnitCategory); 294 static UnitType canonicalUnitTypeForCategory(UnitCategory);
297 static double conversionToCanonicalUnitsScaleFactor(UnitType); 295 static double conversionToCanonicalUnitsScaleFactor(UnitType);
298 296
299 // Returns true and populates lengthUnitType, if unitType is a length unit. Otherwise, returns false. 297 // Returns true and populates lengthUnitType, if unitType is a length unit. Otherwise, returns false.
300 static bool unitTypeToLengthUnitType(UnitType, LengthUnitType&); 298 static bool unitTypeToLengthUnitType(UnitType, LengthUnitType&);
301 static UnitType lengthUnitTypeToUnitType(LengthUnitType); 299 static UnitType lengthUnitTypeToUnitType(LengthUnitType);
(...skipping 28 matching lines...) Expand all
330 void init(const Length&); 328 void init(const Length&);
331 void init(const LengthSize&, const ComputedStyle&); 329 void init(const LengthSize&, const ComputedStyle&);
332 void init(PassRefPtrWillBeRawPtr<Rect>); 330 void init(PassRefPtrWillBeRawPtr<Rect>);
333 void init(PassRefPtrWillBeRawPtr<Pair>); 331 void init(PassRefPtrWillBeRawPtr<Pair>);
334 void init(PassRefPtrWillBeRawPtr<Quad>); 332 void init(PassRefPtrWillBeRawPtr<Quad>);
335 void init(PassRefPtrWillBeRawPtr<CSSBasicShape>); 333 void init(PassRefPtrWillBeRawPtr<CSSBasicShape>);
336 void init(PassRefPtrWillBeRawPtr<CSSCalcValue>); 334 void init(PassRefPtrWillBeRawPtr<CSSCalcValue>);
337 335
338 double computeLengthDouble(const CSSToLengthConversionData&) const; 336 double computeLengthDouble(const CSSToLengthConversionData&) const;
339 337
340 inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitT ype); } 338 inline UnitType type() const { return static_cast<UnitType>(primitiveUnitTyp e()); }
341 339
342 union { 340 union {
343 CSSPropertyID propertyID; 341 CSSPropertyID propertyID;
344 CSSValueID valueID; 342 CSSValueID valueID;
345 double num; 343 double num;
346 StringImpl* string; 344 StringImpl* string;
347 RGBA32 rgbcolor; 345 RGBA32 rgbcolor;
348 // FIXME: oilpan: Should be members, but no support for members in union s. Just trace the raw ptr for now. 346 // FIXME: oilpan: Should be members, but no support for members in union s. Just trace the raw ptr for now.
349 CSSBasicShape* shape; 347 CSSBasicShape* shape;
350 CSSCalcValue* calc; 348 CSSCalcValue* calc;
351 Pair* pair; 349 Pair* pair;
352 Rect* rect; 350 Rect* rect;
353 Quad* quad; 351 Quad* quad;
354 } m_value; 352 } m_value;
355 }; 353 };
356 354
357 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 355 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
358 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; 356 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray;
359 357
360 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 358 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
361 359
362 } // namespace blink 360 } // namespace blink
363 361
364 #endif // CSSPrimitiveValue_h 362 #endif // CSSPrimitiveValue_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698