| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 case DeviceWidth: | 324 case DeviceWidth: |
| 325 case DeviceHeight: | 325 case DeviceHeight: |
| 326 case MaxSizeNone: | 326 case MaxSizeNone: |
| 327 ASSERT_NOT_REACHED(); | 327 ASSERT_NOT_REACHED(); |
| 328 break; | 328 break; |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 void CSSPrimitiveValue::init(UnitType type) | 332 void CSSPrimitiveValue::init(UnitType type) |
| 333 { | 333 { |
| 334 m_primitiveUnitType = static_cast<unsigned>(type); | 334 setPrimitiveUnitType(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 setHasCachedCSSText(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(PassRefPtrWillBeRawPtr<Rect> r) |
| 345 { | 345 { |
| 346 init(UnitType::Rect); | 346 init(UnitType::Rect); |
| 347 m_hasCachedCSSText = false; | 347 setHasCachedCSSText(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(PassRefPtrWillBeRawPtr<Quad> quad) |
| 352 { | 352 { |
| 353 init(UnitType::Quad); | 353 init(UnitType::Quad); |
| 354 m_hasCachedCSSText = false; | 354 setHasCachedCSSText(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(PassRefPtrWillBeRawPtr<Pair> p) |
| 359 { | 359 { |
| 360 init(UnitType::Pair); | 360 init(UnitType::Pair); |
| 361 m_hasCachedCSSText = false; | 361 setHasCachedCSSText(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(PassRefPtrWillBeRawPtr<CSSCalcValue> c) |
| 366 { | 366 { |
| 367 init(UnitType::Calc); | 367 init(UnitType::Calc); |
| 368 m_hasCachedCSSText = false; | 368 setHasCachedCSSText(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(PassRefPtrWillBeRawPtr<CSSBasicShape> shape) |
| 373 { | 373 { |
| 374 init(UnitType::Shape); | 374 init(UnitType::Shape); |
| 375 m_hasCachedCSSText = false; | 375 setHasCachedCSSText(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 { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 case UnitType::DotsPerPixel: | 454 case UnitType::DotsPerPixel: |
| 455 case UnitType::DotsPerInch: | 455 case UnitType::DotsPerInch: |
| 456 case UnitType::DotsPerCentimeter: | 456 case UnitType::DotsPerCentimeter: |
| 457 case UnitType::Fraction: | 457 case UnitType::Fraction: |
| 458 case UnitType::RGBColor: | 458 case UnitType::RGBColor: |
| 459 case UnitType::Unknown: | 459 case UnitType::Unknown: |
| 460 case UnitType::PropertyID: | 460 case UnitType::PropertyID: |
| 461 case UnitType::ValueID: | 461 case UnitType::ValueID: |
| 462 break; | 462 break; |
| 463 } | 463 } |
| 464 if (m_hasCachedCSSText) { | 464 if (hasCachedCSSText()) { |
| 465 cssTextCache().remove(this); | 465 cssTextCache().remove(this); |
| 466 m_hasCachedCSSText = false; | 466 setHasCachedCSSText(false); |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 double CSSPrimitiveValue::computeSeconds() const | 470 double CSSPrimitiveValue::computeSeconds() const |
| 471 { | 471 { |
| 472 ASSERT(isTime() || (isCalculated() && cssCalcValue()->category() == CalcTime
)); | 472 ASSERT(isTime() || (isCalculated() && cssCalcValue()->category() == CalcTime
)); |
| 473 UnitType currentType = isCalculated() ? cssCalcValue()->expressionNode()->ty
peWithCalcResolved() : type(); | 473 UnitType currentType = isCalculated() ? cssCalcValue()->expressionNode()->ty
peWithCalcResolved() : type(); |
| 474 if (currentType == UnitType::Seconds) | 474 if (currentType == UnitType::Seconds) |
| 475 return getDoubleValue(); | 475 return getDoubleValue(); |
| 476 if (currentType == UnitType::Milliseconds) | 476 if (currentType == UnitType::Milliseconds) |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 case UnitType::CalcPercentageWithLength: | 914 case UnitType::CalcPercentageWithLength: |
| 915 case UnitType::QuirkyEms: | 915 case UnitType::QuirkyEms: |
| 916 break; | 916 break; |
| 917 }; | 917 }; |
| 918 ASSERT_NOT_REACHED(); | 918 ASSERT_NOT_REACHED(); |
| 919 return ""; | 919 return ""; |
| 920 } | 920 } |
| 921 | 921 |
| 922 String CSSPrimitiveValue::customCSSText() const | 922 String CSSPrimitiveValue::customCSSText() const |
| 923 { | 923 { |
| 924 if (m_hasCachedCSSText) { | 924 if (hasCachedCSSText()) { |
| 925 ASSERT(cssTextCache().contains(this)); | 925 ASSERT(cssTextCache().contains(this)); |
| 926 return cssTextCache().get(this); | 926 return cssTextCache().get(this); |
| 927 } | 927 } |
| 928 | 928 |
| 929 String text; | 929 String text; |
| 930 switch (type()) { | 930 switch (type()) { |
| 931 case UnitType::Unknown: | 931 case UnitType::Unknown: |
| 932 // FIXME | 932 // FIXME |
| 933 break; | 933 break; |
| 934 case UnitType::Integer: | 934 case UnitType::Integer: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 break; | 1011 break; |
| 1012 case UnitType::CalcPercentageWithNumber: | 1012 case UnitType::CalcPercentageWithNumber: |
| 1013 case UnitType::CalcPercentageWithLength: | 1013 case UnitType::CalcPercentageWithLength: |
| 1014 case UnitType::QuirkyEms: | 1014 case UnitType::QuirkyEms: |
| 1015 ASSERT_NOT_REACHED(); | 1015 ASSERT_NOT_REACHED(); |
| 1016 break; | 1016 break; |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 ASSERT(!cssTextCache().contains(this)); | 1019 ASSERT(!cssTextCache().contains(this)); |
| 1020 cssTextCache().set(this, text); | 1020 cssTextCache().set(this, text); |
| 1021 m_hasCachedCSSText = true; | 1021 const_cast<CSSPrimitiveValue*>(this)->setHasCachedCSSText(true); |
| 1022 return text; | 1022 return text; |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const | 1025 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const |
| 1026 { | 1026 { |
| 1027 if (type() != other.type()) | 1027 if (type() != other.type()) |
| 1028 return false; | 1028 return false; |
| 1029 | 1029 |
| 1030 switch (type()) { | 1030 switch (type()) { |
| 1031 case UnitType::Unknown: | 1031 case UnitType::Unknown: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 visitor->trace(m_value.shape); | 1109 visitor->trace(m_value.shape); |
| 1110 break; | 1110 break; |
| 1111 default: | 1111 default: |
| 1112 break; | 1112 break; |
| 1113 } | 1113 } |
| 1114 #endif | 1114 #endif |
| 1115 CSSValue::traceAfterDispatch(visitor); | 1115 CSSValue::traceAfterDispatch(visitor); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 } // namespace blink | 1118 } // namespace blink |
| OLD | NEW |