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