| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/svg/SVGElementRareData.h" | 5 #include "core/svg/SVGElementRareData.h" |
| 6 | 6 |
| 7 #include "core/css/CSSCursorImageValue.h" | |
| 8 #include "core/css/resolver/StyleResolver.h" | 7 #include "core/css/resolver/StyleResolver.h" |
| 9 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 10 #include "core/svg/SVGCursorElement.h" | |
| 11 #include "core/svg/SVGElementProxy.h" | 9 #include "core/svg/SVGElementProxy.h" |
| 12 | 10 |
| 13 namespace blink { | 11 namespace blink { |
| 14 | 12 |
| 15 MutableStylePropertySet* | 13 MutableStylePropertySet* |
| 16 SVGElementRareData::ensureAnimatedSMILStyleProperties() { | 14 SVGElementRareData::ensureAnimatedSMILStyleProperties() { |
| 17 if (!m_animatedSMILStyleProperties) | 15 if (!m_animatedSMILStyleProperties) |
| 18 m_animatedSMILStyleProperties = | 16 m_animatedSMILStyleProperties = |
| 19 MutableStylePropertySet::create(SVGAttributeMode); | 17 MutableStylePropertySet::create(SVGAttributeMode); |
| 20 return m_animatedSMILStyleProperties.get(); | 18 return m_animatedSMILStyleProperties.get(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 } | 39 } |
| 42 | 40 |
| 43 DEFINE_TRACE(SVGElementRareData) { | 41 DEFINE_TRACE(SVGElementRareData) { |
| 44 visitor->trace(m_outgoingReferences); | 42 visitor->trace(m_outgoingReferences); |
| 45 visitor->trace(m_incomingReferences); | 43 visitor->trace(m_incomingReferences); |
| 46 visitor->trace(m_elementProxySet); | 44 visitor->trace(m_elementProxySet); |
| 47 visitor->trace(m_animatedSMILStyleProperties); | 45 visitor->trace(m_animatedSMILStyleProperties); |
| 48 visitor->trace(m_elementInstances); | 46 visitor->trace(m_elementInstances); |
| 49 visitor->trace(m_correspondingElement); | 47 visitor->trace(m_correspondingElement); |
| 50 visitor->trace(m_owner); | 48 visitor->trace(m_owner); |
| 51 visitor->template registerWeakMembers< | |
| 52 SVGElementRareData, &SVGElementRareData::processWeakMembers>(this); | |
| 53 } | |
| 54 | |
| 55 void SVGElementRareData::processWeakMembers(Visitor* visitor) { | |
| 56 ASSERT(m_owner); | |
| 57 if (!ThreadHeap::isHeapObjectAlive(m_cursorElement)) | |
| 58 m_cursorElement = nullptr; | |
| 59 | |
| 60 if (!ThreadHeap::isHeapObjectAlive(m_cursorImageValue)) { | |
| 61 // The owning SVGElement is still alive and if it is pointing to an | |
| 62 // SVGCursorElement we unregister it when the CSSCursorImageValue dies. | |
| 63 if (m_cursorElement) { | |
| 64 m_cursorElement->removeReferencedElement(m_owner); | |
| 65 m_cursorElement = nullptr; | |
| 66 } | |
| 67 m_cursorImageValue = nullptr; | |
| 68 } | |
| 69 ASSERT(!m_cursorElement || ThreadHeap::isHeapObjectAlive(m_cursorElement)); | |
| 70 ASSERT(!m_cursorImageValue || | |
| 71 ThreadHeap::isHeapObjectAlive(m_cursorImageValue)); | |
| 72 } | 49 } |
| 73 | 50 |
| 74 AffineTransform* SVGElementRareData::animateMotionTransform() { | 51 AffineTransform* SVGElementRareData::animateMotionTransform() { |
| 75 return &m_animateMotionTransform; | 52 return &m_animateMotionTransform; |
| 76 } | 53 } |
| 77 | 54 |
| 78 SVGElementProxySet& SVGElementRareData::ensureElementProxySet() { | 55 SVGElementProxySet& SVGElementRareData::ensureElementProxySet() { |
| 79 if (!m_elementProxySet) | 56 if (!m_elementProxySet) |
| 80 m_elementProxySet = new SVGElementProxySet; | 57 m_elementProxySet = new SVGElementProxySet; |
| 81 return *m_elementProxySet; | 58 return *m_elementProxySet; |
| 82 } | 59 } |
| 83 | 60 |
| 84 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |