| 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/resolver/StyleResolver.h" | 7 #include "core/css/resolver/StyleResolver.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/svg/SVGElementProxy.h" | 9 #include "core/svg/SVGElementProxy.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 MutableStylePropertySet* | 13 MutableStylePropertySet* |
| 14 SVGElementRareData::ensureAnimatedSMILStyleProperties() { | 14 SVGElementRareData::ensureAnimatedSMILStyleProperties() { |
| 15 if (!m_animatedSMILStyleProperties) | 15 if (!m_animatedSMILStyleProperties) |
| 16 m_animatedSMILStyleProperties = | 16 m_animatedSMILStyleProperties = |
| 17 MutableStylePropertySet::create(SVGAttributeMode); | 17 MutableStylePropertySet::create(SVGAttributeMode); |
| 18 return m_animatedSMILStyleProperties.get(); | 18 return m_animatedSMILStyleProperties.get(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 ComputedStyle* SVGElementRareData::overrideComputedStyle( | 21 ComputedStyle* SVGElementRareData::overrideComputedStyle( |
| 22 Element* element, | 22 Element* element, |
| 23 const ComputedStyle* parentStyle) { | 23 const ComputedStyle* parentStyle) { |
| 24 ASSERT(element); | 24 DCHECK(element); |
| 25 if (!m_useOverrideComputedStyle) | 25 if (!m_useOverrideComputedStyle) |
| 26 return nullptr; | 26 return nullptr; |
| 27 if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) { | 27 if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) { |
| 28 // The style computed here contains no CSS Animations/Transitions or SMIL | 28 // The style computed here contains no CSS Animations/Transitions or SMIL |
| 29 // induced rules - this is needed to compute the "base value" for the SMIL | 29 // induced rules - this is needed to compute the "base value" for the SMIL |
| 30 // animation sandwhich model. | 30 // animation sandwhich model. |
| 31 m_overrideComputedStyle = | 31 m_overrideComputedStyle = |
| 32 element->document().ensureStyleResolver().styleForElement( | 32 element->document().ensureStyleResolver().styleForElement( |
| 33 element, parentStyle, parentStyle, DisallowStyleSharing, | 33 element, parentStyle, parentStyle, DisallowStyleSharing, |
| 34 MatchAllRulesExcludingSMIL); | 34 MatchAllRulesExcludingSMIL); |
| 35 m_needsOverrideComputedStyleUpdate = false; | 35 m_needsOverrideComputedStyleUpdate = false; |
| 36 } | 36 } |
| 37 ASSERT(m_overrideComputedStyle); | 37 DCHECK(m_overrideComputedStyle); |
| 38 return m_overrideComputedStyle.get(); | 38 return m_overrideComputedStyle.get(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 DEFINE_TRACE(SVGElementRareData) { | 41 DEFINE_TRACE(SVGElementRareData) { |
| 42 visitor->trace(m_outgoingReferences); | 42 visitor->trace(m_outgoingReferences); |
| 43 visitor->trace(m_incomingReferences); | 43 visitor->trace(m_incomingReferences); |
| 44 visitor->trace(m_elementProxySet); | 44 visitor->trace(m_elementProxySet); |
| 45 visitor->trace(m_animatedSMILStyleProperties); | 45 visitor->trace(m_animatedSMILStyleProperties); |
| 46 visitor->trace(m_elementInstances); | 46 visitor->trace(m_elementInstances); |
| 47 visitor->trace(m_correspondingElement); | 47 visitor->trace(m_correspondingElement); |
| 48 visitor->trace(m_owner); | 48 visitor->trace(m_owner); |
| 49 } | 49 } |
| 50 | 50 |
| 51 AffineTransform* SVGElementRareData::animateMotionTransform() { | 51 AffineTransform* SVGElementRareData::animateMotionTransform() { |
| 52 return &m_animateMotionTransform; | 52 return &m_animateMotionTransform; |
| 53 } | 53 } |
| 54 | 54 |
| 55 SVGElementProxySet& SVGElementRareData::ensureElementProxySet() { | 55 SVGElementProxySet& SVGElementRareData::ensureElementProxySet() { |
| 56 if (!m_elementProxySet) | 56 if (!m_elementProxySet) |
| 57 m_elementProxySet = new SVGElementProxySet; | 57 m_elementProxySet = new SVGElementProxySet; |
| 58 return *m_elementProxySet; | 58 return *m_elementProxySet; |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |