| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 static SMILEventSender& smilRepeatEventSender() | 94 static SMILEventSender& smilRepeatEventSender() |
| 95 { | 95 { |
| 96 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv
entSender::create(EventTypeNames::repeatEvent))); | 96 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv
entSender::create(EventTypeNames::repeatEvent))); |
| 97 return *sender; | 97 return *sender; |
| 98 } | 98 } |
| 99 | 99 |
| 100 static SMILEventSender& smilRepeatNEventSender() | 100 static SMILEventSender& smilRepeatNEventSender() |
| 101 { | 101 { |
| 102 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv
entSender::create(AtomicString("repeatn", AtomicString::ConstructFromLiteral))))
; | 102 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv
entSender::create(AtomicString("repeatn")))); |
| 103 return *sender; | 103 return *sender; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // This is used for duration type time values that can't be negative. | 106 // This is used for duration type time values that can't be negative. |
| 107 static const double invalidCachedTime = -1.; | 107 static const double invalidCachedTime = -1.; |
| 108 | 108 |
| 109 class ConditionEventListener final : public EventListener { | 109 class ConditionEventListener final : public EventListener { |
| 110 public: | 110 public: |
| 111 static PassRefPtrWillBeRawPtr<ConditionEventListener> create(SVGSMILElement*
animation, SVGSMILElement::Condition* condition) | 111 static PassRefPtrWillBeRawPtr<ConditionEventListener> create(SVGSMILElement*
animation, SVGSMILElement::Condition* condition) |
| 112 { | 112 { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 return result; | 391 return result; |
| 392 } | 392 } |
| 393 | 393 |
| 394 SMILTime SVGSMILElement::parseClockValue(const String& data) | 394 SMILTime SVGSMILElement::parseClockValue(const String& data) |
| 395 { | 395 { |
| 396 if (data.isNull()) | 396 if (data.isNull()) |
| 397 return SMILTime::unresolved(); | 397 return SMILTime::unresolved(); |
| 398 | 398 |
| 399 String parse = data.stripWhiteSpace(); | 399 String parse = data.stripWhiteSpace(); |
| 400 | 400 |
| 401 DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite", Atom
icString::ConstructFromLiteral)); | 401 DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite")); |
| 402 if (parse == indefiniteValue) | 402 if (parse == indefiniteValue) |
| 403 return SMILTime::indefinite(); | 403 return SMILTime::indefinite(); |
| 404 | 404 |
| 405 double result = 0; | 405 double result = 0; |
| 406 bool ok; | 406 bool ok; |
| 407 size_t doublePointOne = parse.find(':'); | 407 size_t doublePointOne = parse.find(':'); |
| 408 size_t doublePointTwo = parse.find(':', doublePointOne + 1); | 408 size_t doublePointTwo = parse.find(':', doublePointOne + 1); |
| 409 if (doublePointOne == 2 && doublePointTwo == 5 && parse.length() >= 8) { | 409 if (doublePointOne == 2 && doublePointTwo == 5 && parse.length() >= 8) { |
| 410 result += parse.substring(0, 2).toUIntStrict(&ok) * 60 * 60; | 410 result += parse.substring(0, 2).toUIntStrict(&ok) * 60 * 60; |
| 411 if (!ok) | 411 if (!ok) |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 return m_timeContainer ? m_timeContainer->elapsed() : 0; | 703 return m_timeContainer ? m_timeContainer->elapsed() : 0; |
| 704 } | 704 } |
| 705 | 705 |
| 706 bool SVGSMILElement::isFrozen() const | 706 bool SVGSMILElement::isFrozen() const |
| 707 { | 707 { |
| 708 return m_activeState == Frozen; | 708 return m_activeState == Frozen; |
| 709 } | 709 } |
| 710 | 710 |
| 711 SVGSMILElement::Restart SVGSMILElement::getRestart() const | 711 SVGSMILElement::Restart SVGSMILElement::getRestart() const |
| 712 { | 712 { |
| 713 DEFINE_STATIC_LOCAL(const AtomicString, never, ("never", AtomicString::Const
ructFromLiteral)); | 713 DEFINE_STATIC_LOCAL(const AtomicString, never, ("never")); |
| 714 DEFINE_STATIC_LOCAL(const AtomicString, whenNotActive, ("whenNotActive", Ato
micString::ConstructFromLiteral)); | 714 DEFINE_STATIC_LOCAL(const AtomicString, whenNotActive, ("whenNotActive")); |
| 715 const AtomicString& value = fastGetAttribute(SVGNames::restartAttr); | 715 const AtomicString& value = fastGetAttribute(SVGNames::restartAttr); |
| 716 if (value == never) | 716 if (value == never) |
| 717 return RestartNever; | 717 return RestartNever; |
| 718 if (value == whenNotActive) | 718 if (value == whenNotActive) |
| 719 return RestartWhenNotActive; | 719 return RestartWhenNotActive; |
| 720 return RestartAlways; | 720 return RestartAlways; |
| 721 } | 721 } |
| 722 | 722 |
| 723 SVGSMILElement::FillMode SVGSMILElement::fill() const | 723 SVGSMILElement::FillMode SVGSMILElement::fill() const |
| 724 { | 724 { |
| 725 DEFINE_STATIC_LOCAL(const AtomicString, freeze, ("freeze", AtomicString::Con
structFromLiteral)); | 725 DEFINE_STATIC_LOCAL(const AtomicString, freeze, ("freeze")); |
| 726 const AtomicString& value = fastGetAttribute(SVGNames::fillAttr); | 726 const AtomicString& value = fastGetAttribute(SVGNames::fillAttr); |
| 727 return value == freeze ? FillFreeze : FillRemove; | 727 return value == freeze ? FillFreeze : FillRemove; |
| 728 } | 728 } |
| 729 | 729 |
| 730 SMILTime SVGSMILElement::dur() const | 730 SMILTime SVGSMILElement::dur() const |
| 731 { | 731 { |
| 732 if (m_cachedDur != invalidCachedTime) | 732 if (m_cachedDur != invalidCachedTime) |
| 733 return m_cachedDur; | 733 return m_cachedDur; |
| 734 const AtomicString& value = fastGetAttribute(SVGNames::durAttr); | 734 const AtomicString& value = fastGetAttribute(SVGNames::durAttr); |
| 735 SMILTime clockValue = parseClockValue(value); | 735 SMILTime clockValue = parseClockValue(value); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 747 } | 747 } |
| 748 | 748 |
| 749 // So a count is not really a time but let just all pretend we did not notice. | 749 // So a count is not really a time but let just all pretend we did not notice. |
| 750 SMILTime SVGSMILElement::repeatCount() const | 750 SMILTime SVGSMILElement::repeatCount() const |
| 751 { | 751 { |
| 752 if (m_cachedRepeatCount != invalidCachedTime) | 752 if (m_cachedRepeatCount != invalidCachedTime) |
| 753 return m_cachedRepeatCount; | 753 return m_cachedRepeatCount; |
| 754 SMILTime computedRepeatCount = SMILTime::unresolved(); | 754 SMILTime computedRepeatCount = SMILTime::unresolved(); |
| 755 const AtomicString& value = fastGetAttribute(SVGNames::repeatCountAttr); | 755 const AtomicString& value = fastGetAttribute(SVGNames::repeatCountAttr); |
| 756 if (!value.isNull()) { | 756 if (!value.isNull()) { |
| 757 DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite",
AtomicString::ConstructFromLiteral)); | 757 DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite"))
; |
| 758 if (value == indefiniteValue) { | 758 if (value == indefiniteValue) { |
| 759 computedRepeatCount = SMILTime::indefinite(); | 759 computedRepeatCount = SMILTime::indefinite(); |
| 760 } else { | 760 } else { |
| 761 bool ok; | 761 bool ok; |
| 762 double result = value.toDouble(&ok); | 762 double result = value.toDouble(&ok); |
| 763 if (ok && result > 0) | 763 if (ok && result > 0) |
| 764 computedRepeatCount = result; | 764 computedRepeatCount = result; |
| 765 } | 765 } |
| 766 } | 766 } |
| 767 m_cachedRepeatCount = computedRepeatCount; | 767 m_cachedRepeatCount = computedRepeatCount; |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 visitor->trace(m_targetElement); | 1368 visitor->trace(m_targetElement); |
| 1369 visitor->trace(m_timeContainer); | 1369 visitor->trace(m_timeContainer); |
| 1370 visitor->trace(m_conditions); | 1370 visitor->trace(m_conditions); |
| 1371 visitor->trace(m_syncBaseDependents); | 1371 visitor->trace(m_syncBaseDependents); |
| 1372 #endif | 1372 #endif |
| 1373 SVGElement::trace(visitor); | 1373 SVGElement::trace(visitor); |
| 1374 SVGTests::trace(visitor); | 1374 SVGTests::trace(visitor); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 } // namespace blink | 1377 } // namespace blink |
| OLD | NEW |