| 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, 2012 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv
ed. |
| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 m_primitiveUnitType = static_cast<unsigned>(type); | 334 m_primitiveUnitType = static_cast<unsigned>(type); |
| 335 } | 335 } |
| 336 | 336 |
| 337 void CSSPrimitiveValue::init(const LengthSize& lengthSize, const ComputedStyle&
style) | 337 void CSSPrimitiveValue::init(const LengthSize& lengthSize, const ComputedStyle&
style) |
| 338 { | 338 { |
| 339 init(UnitType::Pair); | 339 init(UnitType::Pair); |
| 340 m_hasCachedCSSText = false; | 340 m_hasCachedCSSText = false; |
| 341 m_value.pair = Pair::create(create(lengthSize.width(), style.effectiveZoom()
), create(lengthSize.height(), style.effectiveZoom()), Pair::KeepIdenticalValues
).leakRef(); | 341 m_value.pair = Pair::create(create(lengthSize.width(), style.effectiveZoom()
), create(lengthSize.height(), style.effectiveZoom()), Pair::KeepIdenticalValues
).leakRef(); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<Rect> r) | 344 void CSSPrimitiveValue::init(PassRefPtr<Rect> r) |
| 345 { | 345 { |
| 346 init(UnitType::Rect); | 346 init(UnitType::Rect); |
| 347 m_hasCachedCSSText = false; | 347 m_hasCachedCSSText = false; |
| 348 m_value.rect = r.leakRef(); | 348 m_value.rect = r.leakRef(); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<Quad> quad) | 351 void CSSPrimitiveValue::init(PassRefPtr<Quad> quad) |
| 352 { | 352 { |
| 353 init(UnitType::Quad); | 353 init(UnitType::Quad); |
| 354 m_hasCachedCSSText = false; | 354 m_hasCachedCSSText = false; |
| 355 m_value.quad = quad.leakRef(); | 355 m_value.quad = quad.leakRef(); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<Pair> p) | 358 void CSSPrimitiveValue::init(PassRefPtr<Pair> p) |
| 359 { | 359 { |
| 360 init(UnitType::Pair); | 360 init(UnitType::Pair); |
| 361 m_hasCachedCSSText = false; | 361 m_hasCachedCSSText = false; |
| 362 m_value.pair = p.leakRef(); | 362 m_value.pair = p.leakRef(); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<CSSCalcValue> c) | 365 void CSSPrimitiveValue::init(PassRefPtr<CSSCalcValue> c) |
| 366 { | 366 { |
| 367 init(UnitType::Calc); | 367 init(UnitType::Calc); |
| 368 m_hasCachedCSSText = false; | 368 m_hasCachedCSSText = false; |
| 369 m_value.calc = c.leakRef(); | 369 m_value.calc = c.leakRef(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<CSSBasicShape> shape) | 372 void CSSPrimitiveValue::init(PassRefPtr<CSSBasicShape> shape) |
| 373 { | 373 { |
| 374 init(UnitType::Shape); | 374 init(UnitType::Shape); |
| 375 m_hasCachedCSSText = false; | 375 m_hasCachedCSSText = false; |
| 376 m_value.shape = shape.leakRef(); | 376 m_value.shape = shape.leakRef(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 CSSPrimitiveValue::~CSSPrimitiveValue() | 379 CSSPrimitiveValue::~CSSPrimitiveValue() |
| 380 { | 380 { |
| 381 cleanup(); | 381 cleanup(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void CSSPrimitiveValue::cleanup() | 384 void CSSPrimitiveValue::cleanup() |
| 385 { | 385 { |
| 386 switch (type()) { | 386 switch (type()) { |
| 387 case UnitType::CustomIdentifier: | 387 case UnitType::CustomIdentifier: |
| 388 case UnitType::String: | 388 case UnitType::String: |
| 389 case UnitType::URI: | 389 case UnitType::URI: |
| 390 case UnitType::Attribute: | 390 case UnitType::Attribute: |
| 391 if (m_value.string) | 391 if (m_value.string) |
| 392 m_value.string->deref(); | 392 m_value.string->deref(); |
| 393 break; | 393 break; |
| 394 case UnitType::Rect: | 394 case UnitType::Rect: |
| 395 // We must not call deref() when oilpan is enabled because m_value.rect
is traced. | |
| 396 #if !ENABLE(OILPAN) | |
| 397 m_value.rect->deref(); | 395 m_value.rect->deref(); |
| 398 #endif | |
| 399 break; | 396 break; |
| 400 case UnitType::Quad: | 397 case UnitType::Quad: |
| 401 // We must not call deref() when oilpan is enabled because m_value.quad
is traced. | |
| 402 #if !ENABLE(OILPAN) | |
| 403 m_value.quad->deref(); | 398 m_value.quad->deref(); |
| 404 #endif | |
| 405 break; | 399 break; |
| 406 case UnitType::Pair: | 400 case UnitType::Pair: |
| 407 // We must not call deref() when oilpan is enabled because m_value.pair
is traced. | |
| 408 #if !ENABLE(OILPAN) | |
| 409 m_value.pair->deref(); | 401 m_value.pair->deref(); |
| 410 #endif | |
| 411 break; | 402 break; |
| 412 case UnitType::Calc: | 403 case UnitType::Calc: |
| 413 // We must not call deref() when oilpan is enabled because m_value.calc
is traced. | |
| 414 #if !ENABLE(OILPAN) | |
| 415 m_value.calc->deref(); | 404 m_value.calc->deref(); |
| 416 #endif | |
| 417 break; | 405 break; |
| 418 case UnitType::CalcPercentageWithNumber: | 406 case UnitType::CalcPercentageWithNumber: |
| 419 case UnitType::CalcPercentageWithLength: | 407 case UnitType::CalcPercentageWithLength: |
| 420 ASSERT_NOT_REACHED(); | 408 ASSERT_NOT_REACHED(); |
| 421 break; | 409 break; |
| 422 case UnitType::Shape: | 410 case UnitType::Shape: |
| 423 // We must not call deref() when oilpan is enabled because m_value.shape
is traced. | |
| 424 #if !ENABLE(OILPAN) | |
| 425 m_value.shape->deref(); | 411 m_value.shape->deref(); |
| 426 #endif | |
| 427 break; | 412 break; |
| 428 case UnitType::Number: | 413 case UnitType::Number: |
| 429 case UnitType::Integer: | 414 case UnitType::Integer: |
| 430 case UnitType::Percentage: | 415 case UnitType::Percentage: |
| 431 case UnitType::Ems: | 416 case UnitType::Ems: |
| 432 case UnitType::QuirkyEms: | 417 case UnitType::QuirkyEms: |
| 433 case UnitType::Exs: | 418 case UnitType::Exs: |
| 434 case UnitType::Rems: | 419 case UnitType::Rems: |
| 435 case UnitType::Chs: | 420 case UnitType::Chs: |
| 436 case UnitType::Pixels: | 421 case UnitType::Pixels: |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 case UnitType::Integer: | 1067 case UnitType::Integer: |
| 1083 case UnitType::Chs: | 1068 case UnitType::Chs: |
| 1084 case UnitType::CalcPercentageWithNumber: | 1069 case UnitType::CalcPercentageWithNumber: |
| 1085 case UnitType::CalcPercentageWithLength: | 1070 case UnitType::CalcPercentageWithLength: |
| 1086 case UnitType::QuirkyEms: | 1071 case UnitType::QuirkyEms: |
| 1087 return false; | 1072 return false; |
| 1088 } | 1073 } |
| 1089 return false; | 1074 return false; |
| 1090 } | 1075 } |
| 1091 | 1076 |
| 1092 DEFINE_TRACE_AFTER_DISPATCH(CSSPrimitiveValue) | |
| 1093 { | |
| 1094 #if ENABLE(OILPAN) | |
| 1095 switch (type()) { | |
| 1096 case UnitType::Rect: | |
| 1097 visitor->trace(m_value.rect); | |
| 1098 break; | |
| 1099 case UnitType::Quad: | |
| 1100 visitor->trace(m_value.quad); | |
| 1101 break; | |
| 1102 case UnitType::Pair: | |
| 1103 visitor->trace(m_value.pair); | |
| 1104 break; | |
| 1105 case UnitType::Calc: | |
| 1106 visitor->trace(m_value.calc); | |
| 1107 break; | |
| 1108 case UnitType::Shape: | |
| 1109 visitor->trace(m_value.shape); | |
| 1110 break; | |
| 1111 default: | |
| 1112 break; | |
| 1113 } | |
| 1114 #endif | |
| 1115 CSSValue::traceAfterDispatch(visitor); | |
| 1116 } | |
| 1117 | |
| 1118 } // namespace blink | 1077 } // namespace blink |
| OLD | NEW |