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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_NUMBER; } | 216 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_NUMBER; } |
217 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_LENGTH; } | 217 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS
S_CALC_PERCENTAGE_WITH_LENGTH; } |
218 static bool isDotsPerInch(UnitType type) { return type == CSS_DPI; } | 218 static bool isDotsPerInch(UnitType type) { return type == CSS_DPI; } |
219 static bool isDotsPerPixel(UnitType type) { return type == CSS_DPPX; } | 219 static bool isDotsPerPixel(UnitType type) { return type == CSS_DPPX; } |
220 static bool isDotsPerCentimeter(UnitType type) { return type == CSS_DPCM; } | 220 static bool isDotsPerCentimeter(UnitType type) { return type == CSS_DPCM; } |
221 static bool isResolution(UnitType type) { return type >= CSS_DPPX && type <=
CSS_DPCM; } | 221 static bool isResolution(UnitType type) { return type >= CSS_DPPX && type <=
CSS_DPCM; } |
222 bool isFlex() const { return primitiveType() == CSS_FR; } | 222 bool isFlex() const { return primitiveType() == CSS_FR; } |
223 bool isValueID() const { return type() == CSS_VALUE_ID; } | 223 bool isValueID() const { return type() == CSS_VALUE_ID; } |
224 bool colorIsDerivedFromElement() const; | 224 bool colorIsDerivedFromElement() const; |
225 | 225 |
226 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID
valueID) | 226 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(CSSValueID valueID) |
227 { | 227 { |
228 CSSTaggedPtrValue taggedPtr; | 228 CSSTaggedPtrValue taggedPtr; |
229 taggedPtr.flag = 1; | 229 taggedPtr.flag = 1; |
230 taggedPtr.type = static_cast<uintptr_t>(CSSPrimitiveValue::CSS_VALUE_ID)
; | 230 taggedPtr.type = static_cast<uintptr_t>(CSSPrimitiveValue::CSS_VALUE_ID)
; |
231 taggedPtr.value = static_cast<uintptr_t>(valueID); | 231 taggedPtr.value = static_cast<uintptr_t>(valueID); |
232 return adoptRefWillBeNoop(toPtr(taggedPtr)); | 232 return adoptRefWillBeNoop(toPtr(taggedPtr)); |
233 } | 233 } |
234 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert
yID propertyID) | 234 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(CSSPropertyID proper
tyID) |
235 { | 235 { |
236 CSSTaggedPtrValue taggedPtr; | 236 CSSTaggedPtrValue taggedPtr; |
237 taggedPtr.flag = 1; | 237 taggedPtr.flag = 1; |
238 taggedPtr.type = static_cast<uintptr_t>(CSSPrimitiveValue::CSS_PROPERTY_
ID); | 238 taggedPtr.type = static_cast<uintptr_t>(CSSPrimitiveValue::CSS_PROPERTY_
ID); |
239 taggedPtr.value = static_cast<uintptr_t>(propertyID); | 239 taggedPtr.value = static_cast<uintptr_t>(propertyID); |
240 return adoptRefWillBeNoop(toPtr(taggedPtr)); | 240 return adoptRefWillBeNoop(toPtr(taggedPtr)); |
241 } | 241 } |
242 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColor(RGBA32 rgbValue
) | 242 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColor(RGBA32 rgbValue
) |
243 { | 243 { |
244 bool canFitColor; | 244 bool canFitColor; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, type)); | 283 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, type)); |
284 } | 284 } |
285 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const Length& value,
float zoom) | 285 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const Length& value,
float zoom) |
286 { | 286 { |
287 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, zoom)); | 287 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, zoom)); |
288 } | 288 } |
289 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const LengthSize& va
lue, const ComputedStyle& style) | 289 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(const LengthSize& va
lue, const ComputedStyle& style) |
290 { | 290 { |
291 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, style)); | 291 return adoptRefWillBeNoop(new CSSPrimitiveValue(value, style)); |
292 } | 292 } |
293 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
(T value) | 293 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
(T value); // Defined in CSSPrimitiveValueMappings.h |
| 294 |
| 295 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
(T* val) |
294 { | 296 { |
295 return adoptRefWillBeNoop(new CSSPrimitiveValue(value)); | 297 CSSPrimitiveValue* primitiveValue = new CSSPrimitiveValue(CSS_UNKNOWN); |
| 298 primitiveValue->init(PassRefPtrWillBeRawPtr<T>(val)); |
| 299 return adoptRefWillBeNoop(primitiveValue); |
| 300 } |
| 301 |
| 302 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
(PassRefPtrWillBeRawPtr<T> val) |
| 303 { |
| 304 CSSPrimitiveValue* primitiveValue = new CSSPrimitiveValue(CSS_UNKNOWN); |
| 305 primitiveValue->init(val); |
| 306 return adoptRefWillBeNoop(primitiveValue); |
296 } | 307 } |
297 | 308 |
298 // This value is used to handle quirky margins in reflow roots (body, td, an
d th) like WinIE. | 309 // This value is used to handle quirky margins in reflow roots (body, td, an
d th) like WinIE. |
299 // The basic idea is that a stylesheet can use the value __qem (for quirky e
m) instead of em. | 310 // The basic idea is that a stylesheet can use the value __qem (for quirky e
m) instead of em. |
300 // When the quirky value is used, if you're in quirks mode, the margin will
collapse away | 311 // When the quirky value is used, if you're in quirks mode, the margin will
collapse away |
301 // inside a table cell. | 312 // inside a table cell. |
302 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createAllowingMarginQuirk(d
ouble value, UnitType type) | 313 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createAllowingMarginQuirk(d
ouble value, UnitType type) |
303 { | 314 { |
304 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); | 315 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); |
305 quirkValue->m_isQuirkValue = true; | 316 quirkValue->m_isQuirkValue = true; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 389 |
379 private: | 390 private: |
380 CSSPrimitiveValue(CSSValueID); | 391 CSSPrimitiveValue(CSSValueID); |
381 CSSPrimitiveValue(CSSPropertyID); | 392 CSSPrimitiveValue(CSSPropertyID); |
382 CSSPrimitiveValue(RGBA32 color); | 393 CSSPrimitiveValue(RGBA32 color); |
383 CSSPrimitiveValue(const Length&, float zoom); | 394 CSSPrimitiveValue(const Length&, float zoom); |
384 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&); | 395 CSSPrimitiveValue(const LengthSize&, const ComputedStyle&); |
385 CSSPrimitiveValue(const String&, UnitType); | 396 CSSPrimitiveValue(const String&, UnitType); |
386 CSSPrimitiveValue(double, UnitType); | 397 CSSPrimitiveValue(double, UnitType); |
387 | 398 |
388 template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMa
ppings.h | |
389 template<typename T> CSSPrimitiveValue(T* val) | 399 template<typename T> CSSPrimitiveValue(T* val) |
390 : CSSValue(PrimitiveClass) | 400 : CSSValue(PrimitiveClass) |
391 { | 401 { |
392 init(PassRefPtrWillBeRawPtr<T>(val)); | 402 init(PassRefPtrWillBeRawPtr<T>(val)); |
393 } | 403 } |
394 | 404 |
395 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val) | 405 template<typename T> CSSPrimitiveValue(PassRefPtrWillBeRawPtr<T> val) |
396 : CSSValue(PrimitiveClass) | 406 : CSSValue(PrimitiveClass) |
397 { | 407 { |
398 init(val); | 408 init(val); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 // Immediates (non-pointers) end in a 1. | 521 // Immediates (non-pointers) end in a 1. |
512 if (!(reinterpret_cast<uintptr_t>(p) & 1)) | 522 if (!(reinterpret_cast<uintptr_t>(p) & 1)) |
513 adopted(p); | 523 adopted(p); |
514 return PassRefPtr<blink::CSSPrimitiveValue>(p, PassRefPtr<blink::CSSPrimitiv
eValue>::AdoptRef); | 524 return PassRefPtr<blink::CSSPrimitiveValue>(p, PassRefPtr<blink::CSSPrimitiv
eValue>::AdoptRef); |
515 } | 525 } |
516 #endif | 526 #endif |
517 | 527 |
518 } // namespace WTF | 528 } // namespace WTF |
519 | 529 |
520 #endif // CSSPrimitiveValue_h | 530 #endif // CSSPrimitiveValue_h |
OLD | NEW |