| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 bool isResolution() const | 189 bool isResolution() const |
| 190 { | 190 { |
| 191 unsigned short type = primitiveType(); | 191 unsigned short type = primitiveType(); |
| 192 return type >= CSS_DPPX && type <= CSS_DPCM; | 192 return type >= CSS_DPPX && type <= CSS_DPCM; |
| 193 } | 193 } |
| 194 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_
VW && m_primitiveUnitType <= CSS_VMAX; } | 194 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_
VW && m_primitiveUnitType <= CSS_VMAX; } |
| 195 bool isFlex() const { return primitiveType() == CSS_FR; } | 195 bool isFlex() const { return primitiveType() == CSS_FR; } |
| 196 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; } | 196 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; } |
| 197 bool colorIsDerivedFromElement() const; | 197 bool colorIsDerivedFromElement() const; |
| 198 | 198 |
| 199 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID
valueID) | 199 static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) {
return adoptRef(new CSSPrimitiveValue(valueID)); } |
| 200 static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSPropertyID property
ID) { return adoptRef(new CSSPrimitiveValue(propertyID)); } |
| 201 static PassRefPtr<CSSPrimitiveValue> createParserOperator(int parserOperator
) { return adoptRef(new CSSPrimitiveValue(parserOperator)); } |
| 202 static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue) { return
adoptRef(new CSSPrimitiveValue(rgbValue)); } |
| 203 static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) {
return adoptRef(new CSSPrimitiveValue(value, type)); } |
| 204 static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes t
ype) { return adoptRef(new CSSPrimitiveValue(value, type)); } |
| 205 static PassRefPtr<CSSPrimitiveValue> create(const Length& value, float zoom)
{ return adoptRef(new CSSPrimitiveValue(value, zoom)); } |
| 206 static PassRefPtr<CSSPrimitiveValue> create(const LengthSize& value) { retur
n adoptRef(new CSSPrimitiveValue(value)); } |
| 207 |
| 208 template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value) |
| 200 { | 209 { |
| 201 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(valueID)); | 210 return adoptRef(new CSSPrimitiveValue(value)); |
| 202 } | |
| 203 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert
yID propertyID) | |
| 204 { | |
| 205 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(propertyID)); | |
| 206 } | |
| 207 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createParserOperator(int pa
rserOperator) | |
| 208 { | |
| 209 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(parserOperator)); | |
| 210 } | |
| 211 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColor(unsigned rgbVal
ue) | |
| 212 { | |
| 213 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(rgbValue)); | |
| 214 } | |
| 215 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(double value, UnitTy
pes type) | |
| 216 { | |
| 217 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(value, type)); | |
| 218 } | |
| 219 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const String& value,
UnitTypes type) | |
| 220 { | |
| 221 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(value, type)); | |
| 222 } | |
| 223 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const Length& value,
float zoom) | |
| 224 { | |
| 225 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(value, zoom)); | |
| 226 } | |
| 227 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const LengthSize& va
lue) | |
| 228 { | |
| 229 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(value)); | |
| 230 } | |
| 231 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
(T value) | |
| 232 { | |
| 233 return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSPrimitiveV
alue(value)); | |
| 234 } | 211 } |
| 235 | 212 |
| 236 // This value is used to handle quirky margins in reflow roots (body, td, an
d th) like WinIE. | 213 // This value is used to handle quirky margins in reflow roots (body, td, an
d th) like WinIE. |
| 237 // The basic idea is that a stylesheet can use the value __qem (for quirky e
m) instead of em. | 214 // The basic idea is that a stylesheet can use the value __qem (for quirky e
m) instead of em. |
| 238 // When the quirky value is used, if you're in quirks mode, the margin will
collapse away | 215 // When the quirky value is used, if you're in quirks mode, the margin will
collapse away |
| 239 // inside a table cell. | 216 // inside a table cell. |
| 240 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createAllowingMarginQuirk(d
ouble value, UnitTypes type) | 217 static PassRefPtr<CSSPrimitiveValue> createAllowingMarginQuirk(double value,
UnitTypes type) |
| 241 { | 218 { |
| 242 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); | 219 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); |
| 243 quirkValue->m_isQuirkValue = true; | 220 quirkValue->m_isQuirkValue = true; |
| 244 return adoptRefCountedWillBeRefCountedGarbageCollected(quirkValue); | 221 return adoptRef(quirkValue); |
| 245 } | 222 } |
| 246 | 223 |
| 247 ~CSSPrimitiveValue(); | 224 ~CSSPrimitiveValue(); |
| 248 | 225 |
| 249 void cleanup(); | 226 void cleanup(); |
| 250 | 227 |
| 251 unsigned short primitiveType() const; | 228 unsigned short primitiveType() const; |
| 252 | 229 |
| 253 double computeDegrees(); | 230 double computeDegrees(); |
| 254 | 231 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 303 |
| 327 CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROP
ERTY_ID ? m_value.propertyID : CSSPropertyInvalid; } | 304 CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROP
ERTY_ID ? m_value.propertyID : CSSPropertyInvalid; } |
| 328 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ?
m_value.valueID : CSSValueInvalid; } | 305 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ?
m_value.valueID : CSSValueInvalid; } |
| 329 | 306 |
| 330 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa
lueMappings.h | 307 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa
lueMappings.h |
| 331 | 308 |
| 332 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const; | 309 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const; |
| 333 | 310 |
| 334 bool isQuirkValue() { return m_isQuirkValue; } | 311 bool isQuirkValue() { return m_isQuirkValue; } |
| 335 | 312 |
| 336 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> cloneForCSSOM() const; | 313 PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const; |
| 337 void setCSSOMSafe() { m_isCSSOMSafe = true; } | 314 void setCSSOMSafe() { m_isCSSOMSafe = true; } |
| 338 | 315 |
| 339 bool equals(const CSSPrimitiveValue&) const; | 316 bool equals(const CSSPrimitiveValue&) const; |
| 340 | 317 |
| 341 void traceAfterDispatch(Visitor*); | 318 void traceAfterDispatch(Visitor*); |
| 342 | 319 |
| 343 static UnitTypes canonicalUnitTypeForCategory(UnitCategory); | 320 static UnitTypes canonicalUnitTypeForCategory(UnitCategory); |
| 344 static double conversionToCanonicalUnitsScaleFactor(unsigned short unitType)
; | 321 static double conversionToCanonicalUnitsScaleFactor(unsigned short unitType)
; |
| 345 | 322 |
| 346 private: | 323 private: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // FIXME: oilpan: Should be a member, but no support for members in unio
ns. Just trace the raw ptr for now. | 385 // FIXME: oilpan: Should be a member, but no support for members in unio
ns. Just trace the raw ptr for now. |
| 409 CSSCalcValue* calc; | 386 CSSCalcValue* calc; |
| 410 } m_value; | 387 } m_value; |
| 411 }; | 388 }; |
| 412 | 389 |
| 413 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); | 390 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); |
| 414 | 391 |
| 415 } // namespace WebCore | 392 } // namespace WebCore |
| 416 | 393 |
| 417 #endif // CSSPrimitiveValue_h | 394 #endif // CSSPrimitiveValue_h |
| OLD | NEW |