| OLD | NEW |
| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 isDotsPerInch(UnitType type) { return type == UnitType::DotsPerI
nch; } | 198 static bool isDotsPerInch(UnitType type) { return type == UnitType::DotsPerI
nch; } |
| 199 static bool isDotsPerPixel(UnitType type) { return type == UnitType::DotsPer
Pixel; } | 199 static bool isDotsPerPixel(UnitType type) { return type == UnitType::DotsPer
Pixel; } |
| 200 static bool isDotsPerCentimeter(UnitType type) { return type == UnitType::Do
tsPerCentimeter; } | 200 static bool isDotsPerCentimeter(UnitType type) { return type == UnitType::Do
tsPerCentimeter; } |
| 201 static bool isResolution(UnitType type) { return type >= UnitType::DotsPerPi
xel && type <= UnitType::DotsPerCentimeter; } | 201 static bool isResolution(UnitType type) { return type >= UnitType::DotsPerPi
xel && type <= UnitType::DotsPerCentimeter; } |
| 202 bool isFlex() const { return typeWithCalcResolved() == UnitType::Fraction; } | 202 bool isFlex() const { return typeWithCalcResolved() == UnitType::Fraction; } |
| 203 bool isValueID() const { return type() == UnitType::ValueID; } | 203 bool isValueID() const { return type() == UnitType::ValueID; } |
| 204 bool colorIsDerivedFromElement() const; | 204 bool colorIsDerivedFromElement() const; |
| 205 | 205 |
| 206 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID
valueID) | 206 static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) |
| 207 { | 207 { |
| 208 return adoptRefWillBeNoop(new CSSPrimitiveValue(valueID)); | 208 return adoptRef(new CSSPrimitiveValue(valueID)); |
| 209 } | 209 } |
| 210 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert
yID propertyID) | 210 static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSPropertyID property
ID) |
| 211 { | 211 { |
| 212 return adoptRefWillBeNoop(new CSSPrimitiveValue(propertyID)); | 212 return adoptRef(new CSSPrimitiveValue(propertyID)); |
| 213 } | 213 } |
| 214 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColor(RGBA32 rgbValue
) | 214 static PassRefPtr<CSSPrimitiveValue> createColor(RGBA32 rgbValue) |
| 215 { | 215 { |
| 216 return adoptRefWillBeNoop(new CSSPrimitiveValue(rgbValue)); | 216 return adoptRef(new CSSPrimitiveValue(rgbValue)); |
| 217 } | 217 } |
| 218 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(double value, UnitTy
pe type) | 218 static PassRefPtr<CSSPrimitiveValue> create(double value, UnitType type) |
| 219 { | 219 { |
| 220 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, type)); | 220 return adoptRef(new CSSPrimitiveValue(value, type)); |
| 221 } | 221 } |
| 222 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const String& value,
UnitType type) | 222 static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitType ty
pe) |
| 223 { | 223 { |
| 224 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, type)); | 224 return adoptRef(new CSSPrimitiveValue(value, type)); |
| 225 } | 225 } |
| 226 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const Length& value,
float zoom) | 226 static PassRefPtr<CSSPrimitiveValue> create(const Length& value, float zoom) |
| 227 { | 227 { |
| 228 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, zoom)); | 228 return adoptRef(new CSSPrimitiveValue(value, zoom)); |
| 229 } | 229 } |
| 230 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const LengthSize& va
lue, const ComputedStyle& style) | 230 static PassRefPtr<CSSPrimitiveValue> create(const LengthSize& value, const C
omputedStyle& style) |
| 231 { | 231 { |
| 232 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, style)); | 232 return adoptRef(new CSSPrimitiveValue(value, style)); |
| 233 } | 233 } |
| 234 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
(T value) | 234 template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value) |
| 235 { | 235 { |
| 236 return adoptRefWillBeNoop(new CSSPrimitiveValue(value)); | 236 return adoptRef(new CSSPrimitiveValue(value)); |
| 237 } |
| 238 template<typename T> static PassRefPtr<CSSPrimitiveValue> create(PassRefPtr<
T> value) |
| 239 { |
| 240 return adoptRef(new CSSPrimitiveValue(value.get())); |
| 237 } | 241 } |
| 238 | 242 |
| 239 // This value is used to handle quirky margins in reflow roots (body, td, an
d th) like WinIE. | 243 // 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. | 244 // 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 | 245 // When the quirky value is used, if you're in quirks mode, the margin will
collapse away |
| 242 // inside a table cell. | 246 // inside a table cell. |
| 243 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createAllowingMarginQuirk(d
ouble value, UnitType type) | 247 static PassRefPtr<CSSPrimitiveValue> createAllowingMarginQuirk(double value,
UnitType type) |
| 244 { | 248 { |
| 245 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); | 249 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); |
| 246 quirkValue->m_isQuirkValue = true; | 250 quirkValue->m_isQuirkValue = true; |
| 247 return adoptRefWillBeNoop(quirkValue); | 251 return adoptRef(quirkValue); |
| 248 } | 252 } |
| 249 | 253 |
| 250 ~CSSPrimitiveValue(); | 254 ~CSSPrimitiveValue(); |
| 251 | 255 |
| 252 void cleanup(); | 256 void cleanup(); |
| 253 | 257 |
| 254 UnitType typeWithCalcResolved() const; | 258 UnitType typeWithCalcResolved() const; |
| 255 | 259 |
| 256 double computeDegrees() const; | 260 double computeDegrees() const; |
| 257 double computeSeconds() const; | 261 double computeSeconds() const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 284 | 288 |
| 285 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa
lueMappings.h | 289 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa
lueMappings.h |
| 286 | 290 |
| 287 static const char* unitTypeToString(UnitType); | 291 static const char* unitTypeToString(UnitType); |
| 288 String customCSSText() const; | 292 String customCSSText() const; |
| 289 | 293 |
| 290 bool isQuirkValue() const { return m_isQuirkValue; } | 294 bool isQuirkValue() const { return m_isQuirkValue; } |
| 291 | 295 |
| 292 bool equals(const CSSPrimitiveValue&) const; | 296 bool equals(const CSSPrimitiveValue&) const; |
| 293 | 297 |
| 294 DECLARE_TRACE_AFTER_DISPATCH(); | |
| 295 | |
| 296 static UnitType canonicalUnitTypeForCategory(UnitCategory); | 298 static UnitType canonicalUnitTypeForCategory(UnitCategory); |
| 297 static double conversionToCanonicalUnitsScaleFactor(UnitType); | 299 static double conversionToCanonicalUnitsScaleFactor(UnitType); |
| 298 | 300 |
| 299 // Returns true and populates lengthUnitType, if unitType is a length unit.
Otherwise, returns false. | 301 // Returns true and populates lengthUnitType, if unitType is a length unit.
Otherwise, returns false. |
| 300 static bool unitTypeToLengthUnitType(UnitType, LengthUnitType&); | 302 static bool unitTypeToLengthUnitType(UnitType, LengthUnitType&); |
| 301 static UnitType lengthUnitTypeToUnitType(LengthUnitType); | 303 static UnitType lengthUnitTypeToUnitType(LengthUnitType); |
| 302 | 304 |
| 303 private: | 305 private: |
| 304 CSSPrimitiveValue(CSSValueID); | 306 CSSPrimitiveValue(CSSValueID); |
| 305 CSSPrimitiveValue(CSSPropertyID); | 307 CSSPrimitiveValue(CSSPropertyID); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 322 init(val); | 324 init(val); |
| 323 } | 325 } |
| 324 | 326 |
| 325 static void create(int); // compile-time guard | 327 static void create(int); // compile-time guard |
| 326 static void create(unsigned); // compile-time guard | 328 static void create(unsigned); // compile-time guard |
| 327 template<typename T> operator T*(); // compile-time guard | 329 template<typename T> operator T*(); // compile-time guard |
| 328 | 330 |
| 329 void init(UnitType); | 331 void init(UnitType); |
| 330 void init(const Length&); | 332 void init(const Length&); |
| 331 void init(const LengthSize&, const ComputedStyle&); | 333 void init(const LengthSize&, const ComputedStyle&); |
| 332 void init(PassRefPtrWillBeRawPtr<Rect>); | 334 void init(PassRefPtr<Rect>); |
| 333 void init(PassRefPtrWillBeRawPtr<Pair>); | 335 void init(PassRefPtr<Pair>); |
| 334 void init(PassRefPtrWillBeRawPtr<Quad>); | 336 void init(PassRefPtr<Quad>); |
| 335 void init(PassRefPtrWillBeRawPtr<CSSBasicShape>); | 337 void init(PassRefPtr<CSSBasicShape>); |
| 336 void init(PassRefPtrWillBeRawPtr<CSSCalcValue>); | 338 void init(PassRefPtr<CSSCalcValue>); |
| 337 | 339 |
| 338 double computeLengthDouble(const CSSToLengthConversionData&) const; | 340 double computeLengthDouble(const CSSToLengthConversionData&) const; |
| 339 | 341 |
| 340 inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitT
ype); } | 342 inline UnitType type() const { return static_cast<UnitType>(m_primitiveUnitT
ype); } |
| 341 | 343 |
| 342 union { | 344 union { |
| 343 CSSPropertyID propertyID; | 345 CSSPropertyID propertyID; |
| 344 CSSValueID valueID; | 346 CSSValueID valueID; |
| 345 double num; | 347 double num; |
| 346 StringImpl* string; | 348 StringImpl* string; |
| 347 RGBA32 rgbcolor; | 349 RGBA32 rgbcolor; |
| 348 // FIXME: oilpan: Should be members, but no support for members in union
s. Just trace the raw ptr for now. | 350 // FIXME: oilpan: Should be members, but no support for members in union
s. Just trace the raw ptr for now. |
| 349 CSSBasicShape* shape; | 351 CSSBasicShape* shape; |
| 350 CSSCalcValue* calc; | 352 CSSCalcValue* calc; |
| 351 Pair* pair; | 353 Pair* pair; |
| 352 Rect* rect; | 354 Rect* rect; |
| 353 Quad* quad; | 355 Quad* quad; |
| 354 } m_value; | 356 } m_value; |
| 355 }; | 357 }; |
| 356 | 358 |
| 357 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; | 359 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; |
| 358 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; | 360 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; |
| 359 | 361 |
| 360 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); | 362 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); |
| 361 | 363 |
| 362 } // namespace blink | 364 } // namespace blink |
| 363 | 365 |
| 364 #endif // CSSPrimitiveValue_h | 366 #endif // CSSPrimitiveValue_h |
| OLD | NEW |