OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/SVGAnimatedHref.h" | 5 #include "core/svg/SVGAnimatedHref.h" |
6 | 6 |
7 #include "core/SVGNames.h" | 7 #include "core/SVGNames.h" |
8 #include "core/XLinkNames.h" | 8 #include "core/XLinkNames.h" |
9 #include "core/frame/UseCounter.h" | 9 #include "core/frame/UseCounter.h" |
10 #include "core/svg/SVGElement.h" | 10 #include "core/svg/SVGElement.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 SVGAnimatedHref* SVGAnimatedHref::create(SVGElement* contextElement) { | 14 SVGAnimatedHref* SVGAnimatedHref::create(SVGElement* contextElement) { |
15 return new SVGAnimatedHref(contextElement); | 15 return new SVGAnimatedHref(contextElement); |
16 } | 16 } |
17 | 17 |
18 DEFINE_TRACE(SVGAnimatedHref) { | 18 DEFINE_TRACE(SVGAnimatedHref) { |
19 visitor->trace(m_xlinkHref); | 19 visitor->trace(m_xlinkHref); |
20 SVGAnimatedString::trace(visitor); | 20 SVGAnimatedString::trace(visitor); |
21 } | 21 } |
22 | 22 |
23 SVGAnimatedHref::SVGAnimatedHref(SVGElement* contextElement) | 23 SVGAnimatedHref::SVGAnimatedHref(SVGElement* contextElement) |
24 : SVGAnimatedString(contextElement, | 24 : SVGAnimatedString(contextElement, SVGNames::hrefAttr), |
25 SVGNames::hrefAttr, | 25 m_xlinkHref( |
26 SVGString::create()), | 26 SVGAnimatedString::create(contextElement, XLinkNames::hrefAttr)) {} |
27 m_xlinkHref(SVGAnimatedString::create(contextElement, | |
28 XLinkNames::hrefAttr, | |
29 SVGString::create())) {} | |
30 | 27 |
31 void SVGAnimatedHref::addToPropertyMap(SVGElement* element) { | 28 void SVGAnimatedHref::addToPropertyMap(SVGElement* element) { |
32 element->addToPropertyMap(this); | 29 element->addToPropertyMap(this); |
33 element->addToPropertyMap(m_xlinkHref); | 30 element->addToPropertyMap(m_xlinkHref); |
34 } | 31 } |
35 | 32 |
36 bool SVGAnimatedHref::isKnownAttribute(const QualifiedName& attrName) { | 33 bool SVGAnimatedHref::isKnownAttribute(const QualifiedName& attrName) { |
37 return attrName.matches(SVGNames::hrefAttr) || | 34 return attrName.matches(SVGNames::hrefAttr) || |
38 attrName.matches(XLinkNames::hrefAttr); | 35 attrName.matches(XLinkNames::hrefAttr); |
39 } | 36 } |
(...skipping 28 matching lines...) Expand all Loading... |
68 | 65 |
69 const SVGAnimatedString* SVGAnimatedHref::backingString() const { | 66 const SVGAnimatedString* SVGAnimatedHref::backingString() const { |
70 return useXLink() ? m_xlinkHref.get() : this; | 67 return useXLink() ? m_xlinkHref.get() : this; |
71 } | 68 } |
72 | 69 |
73 bool SVGAnimatedHref::useXLink() const { | 70 bool SVGAnimatedHref::useXLink() const { |
74 return !SVGAnimatedString::isSpecified() && m_xlinkHref->isSpecified(); | 71 return !SVGAnimatedString::isSpecified() && m_xlinkHref->isSpecified(); |
75 } | 72 } |
76 | 73 |
77 } // namespace blink | 74 } // namespace blink |
OLD | NEW |