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

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

Issue 148523016: Move most of the [Pass]RefPtr's of CSSPrimitiveValue to our transition types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 { 192 {
193 unsigned short type = primitiveType(); 193 unsigned short type = primitiveType();
194 return type >= CSS_DPPX && type <= CSS_DPCM; 194 return type >= CSS_DPPX && type <= CSS_DPCM;
195 } 195 }
196 bool isVariableReference() const { return primitiveType() == CSS_VARIABLE_RE FERENCE; } 196 bool isVariableReference() const { return primitiveType() == CSS_VARIABLE_RE FERENCE; }
197 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_ VW && m_primitiveUnitType <= CSS_VMAX; } 197 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_ VW && m_primitiveUnitType <= CSS_VMAX; }
198 bool isFlex() const { return primitiveType() == CSS_FR; } 198 bool isFlex() const { return primitiveType() == CSS_FR; }
199 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; } 199 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
200 bool colorIsDerivedFromElement() const; 200 bool colorIsDerivedFromElement() const;
201 201
202 static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) { return adoptRef(new CSSPrimitiveValue(valueID)); } 202 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID)
203 static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSPropertyID property ID) { return adoptRef(new CSSPrimitiveValue(propertyID)); }
204 static PassRefPtr<CSSPrimitiveValue> createParserOperator(int parserOperator ) { return adoptRef(new CSSPrimitiveValue(parserOperator)); }
205 static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue) { return adoptRef(new CSSPrimitiveValue(rgbValue)); }
206 static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
207 static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes t ype) { return adoptRef(new CSSPrimitiveValue(value, type)); }
208 static PassRefPtr<CSSPrimitiveValue> create(const Length& value, float zoom) { return adoptRef(new CSSPrimitiveValue(value, zoom)); }
209 static PassRefPtr<CSSPrimitiveValue> create(const LengthSize& value) { retur n adoptRef(new CSSPrimitiveValue(value)); }
210
211 template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value)
212 { 203 {
213 return adoptRef(new CSSPrimitiveValue(value)); 204 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(valueID));
205 }
206 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert yID propertyID)
207 {
208 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(propertyID));
209 }
210 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createParserOperator(int pa rserOperator)
211 {
212 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(parserOperator));
213 }
214 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColor(unsigned rgbVal ue)
215 {
216 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(rgbValue));
217 }
218 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(double value, UnitTy pes type)
219 {
220 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(value, type));
221 }
222 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const String& value, UnitTypes type)
223 {
224 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(value, type));
225 }
226 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const Length& value, float zoom)
227 {
228 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(value, zoom));
229 }
230 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const LengthSize& va lue)
231 {
232 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(value));
233 }
234 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create (T value)
235 {
236 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV alue(value));
214 } 237 }
215 238
216 // 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.
217 // 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.
218 // 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
219 // inside a table cell. 242 // inside a table cell.
220 static PassRefPtr<CSSPrimitiveValue> createAllowingMarginQuirk(double value, UnitTypes type) 243 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createAllowingMarginQuirk(d ouble value, UnitTypes type)
221 { 244 {
222 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); 245 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type);
223 quirkValue->m_isQuirkValue = true; 246 quirkValue->m_isQuirkValue = true;
224 return adoptRef(quirkValue); 247 return adoptRefCountedWillBeRefCountedGarbageCollected(quirkValue);
225 } 248 }
226 249
227 ~CSSPrimitiveValue(); 250 ~CSSPrimitiveValue();
228 251
229 void cleanup(); 252 void cleanup();
230 253
231 unsigned short primitiveType() const; 254 unsigned short primitiveType() const;
232 255
233 double computeDegrees(); 256 double computeDegrees();
234 257
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; } 331 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
309 332
310 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h 333 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h
311 334
312 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const; 335 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const;
313 String customSerializeResolvingVariables(const HashMap<AtomicString, String> &) const; 336 String customSerializeResolvingVariables(const HashMap<AtomicString, String> &) const;
314 bool hasVariableReference() const; 337 bool hasVariableReference() const;
315 338
316 bool isQuirkValue() { return m_isQuirkValue; } 339 bool isQuirkValue() { return m_isQuirkValue; }
317 340
318 PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const; 341 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> cloneForCSSOM() const;
319 void setCSSOMSafe() { m_isCSSOMSafe = true; } 342 void setCSSOMSafe() { m_isCSSOMSafe = true; }
320 343
321 bool equals(const CSSPrimitiveValue&) const; 344 bool equals(const CSSPrimitiveValue&) const;
322 345
323 void traceAfterDispatch(Visitor*); 346 void traceAfterDispatch(Visitor*);
324 347
325 static UnitTypes canonicalUnitTypeForCategory(UnitCategory); 348 static UnitTypes canonicalUnitTypeForCategory(UnitCategory);
326 static double conversionToCanonicalUnitsScaleFactor(unsigned short unitType) ; 349 static double conversionToCanonicalUnitsScaleFactor(unsigned short unitType) ;
327 350
328 private: 351 private:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // FIXME: oilpan: Should be a member, but no support for members in unio ns. Just trace the raw ptr for now. 413 // FIXME: oilpan: Should be a member, but no support for members in unio ns. Just trace the raw ptr for now.
391 CSSCalcValue* calc; 414 CSSCalcValue* calc;
392 } m_value; 415 } m_value;
393 }; 416 };
394 417
395 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 418 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
396 419
397 } // namespace WebCore 420 } // namespace WebCore
398 421
399 #endif // CSSPrimitiveValue_h 422 #endif // CSSPrimitiveValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698