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, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return *static_cast<thisType*>(value.get()); \ | 390 return *static_cast<thisType*>(value.get()); \ |
391 } \ | 391 } \ |
392 inline thisType* to##thisType(const NullableCSSValue& value) \ | 392 inline thisType* to##thisType(const NullableCSSValue& value) \ |
393 { \ | 393 { \ |
394 if (!value) \ | 394 if (!value) \ |
395 return nullptr; \ | 395 return nullptr; \ |
396 ASSERT_WITH_SECURITY_IMPLICATION(value->predicate); \ | 396 ASSERT_WITH_SECURITY_IMPLICATION(value->predicate); \ |
397 return static_cast<thisType*>(value.get()); \ | 397 return static_cast<thisType*>(value.get()); \ |
398 } | 398 } |
399 | 399 |
400 // Returns by value on purpose. | |
401 inline const CSSPrimitiveValue& toCSSPrimitiveValue(const CSSValue& value) | 400 inline const CSSPrimitiveValue& toCSSPrimitiveValue(const CSSValue& value) |
402 { | 401 { |
403 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); | 402 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); |
404 return *reinterpret_cast<const CSSPrimitiveValue*>(&value); | 403 return *reinterpret_cast<const CSSPrimitiveValue*>(&value); |
405 } | 404 } |
| 405 inline const CSSPrimitiveValue& toCSSPrimitiveValue(const NullableCSSValue& valu
e) |
| 406 { |
| 407 ASSERT_WITH_SECURITY_IMPLICATION(value && value->isPrimitiveValue()); |
| 408 return *reinterpret_cast<const CSSPrimitiveValue*>(&value); |
| 409 } |
406 /* | 410 /* |
407 inline CSSPrimitiveValue& toCSSPrimitiveValue(const CSSValue& value) | 411 inline CSSPrimitiveValue& toCSSPrimitiveValue(const CSSValue& value) |
408 { | 412 { |
409 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); | 413 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); |
410 return *const_cast<CSSPrimitiveValue*>(reinterpret_cast<const CSSPrimitiveVa
lue*>(&value)); | 414 return *const_cast<CSSPrimitiveValue*>(reinterpret_cast<const CSSPrimitiveVa
lue*>(&value)); |
411 } | 415 } |
412 */ | 416 */ |
413 | 417 |
414 } // namespace blink | 418 } // namespace blink |
415 | 419 |
416 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::CSSValue); | 420 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::CSSValue); |
417 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::NullableCSSValue); | 421 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::NullableCSSValue); |
418 | 422 |
419 #endif // CSSValue_h | 423 #endif // CSSValue_h |
OLD | NEW |