Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: Source/core/svg/SVGMPathElement.cpp

Issue 169103002: Drop [LegacyImplementedInBaseClass] from SVGURIReference IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 18 matching lines...) Expand all
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 // Animated property definitions 32 // Animated property definitions
33 33
34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) 34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement)
35 END_REGISTER_ANIMATED_PROPERTIES 35 END_REGISTER_ANIMATED_PROPERTIES
36 36
37 inline SVGMPathElement::SVGMPathElement(Document& document) 37 inline SVGMPathElement::SVGMPathElement(Document& document)
38 : SVGElement(SVGNames::mpathTag, document) 38 : SVGElement(SVGNames::mpathTag, document)
39 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr eate())) 39 , SVGURIReference(this)
40 { 40 {
41 ScriptWrappable::init(this); 41 ScriptWrappable::init(this);
42 addToPropertyMap(m_href);
43 registerAnimatedPropertiesForSVGMPathElement(); 42 registerAnimatedPropertiesForSVGMPathElement();
44 } 43 }
45 44
46 PassRefPtr<SVGMPathElement> SVGMPathElement::create(Document& document) 45 PassRefPtr<SVGMPathElement> SVGMPathElement::create(Document& document)
47 { 46 {
48 return adoptRef(new SVGMPathElement(document)); 47 return adoptRef(new SVGMPathElement(document));
49 } 48 }
50 49
51 SVGMPathElement::~SVGMPathElement() 50 SVGMPathElement::~SVGMPathElement()
52 { 51 {
53 clearResourceReferences(); 52 clearResourceReferences();
54 } 53 }
55 54
56 void SVGMPathElement::buildPendingResource() 55 void SVGMPathElement::buildPendingResource()
57 { 56 {
58 clearResourceReferences(); 57 clearResourceReferences();
59 if (!inDocument()) 58 if (!inDocument())
60 return; 59 return;
61 60
62 AtomicString id; 61 AtomicString id;
63 Element* target = SVGURIReference::targetElementFromIRIString(m_href->curren tValue()->value(), document(), &id); 62 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(), document(), &id);
64 if (!target) { 63 if (!target) {
65 // Do not register as pending if we are already pending this resource. 64 // Do not register as pending if we are already pending this resource.
66 if (document().accessSVGExtensions()->isElementPendingResource(this, id) ) 65 if (document().accessSVGExtensions()->isElementPendingResource(this, id) )
67 return; 66 return;
68 67
69 if (!id.isEmpty()) { 68 if (!id.isEmpty()) {
70 document().accessSVGExtensions()->addPendingResource(id, this); 69 document().accessSVGExtensions()->addPendingResource(id, this);
71 ASSERT(hasPendingResources()); 70 ASSERT(hasPendingResources());
72 } 71 }
73 } else if (target->isSVGElement()) { 72 } else if (target->isSVGElement()) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 107 }
109 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 108 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
110 } 109 }
111 110
112 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) 111 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value)
113 { 112 {
114 SVGParsingError parseError = NoError; 113 SVGParsingError parseError = NoError;
115 114
116 if (!isSupportedAttribute(name)) { 115 if (!isSupportedAttribute(name)) {
117 SVGElement::parseAttribute(name, value); 116 SVGElement::parseAttribute(name, value);
118 } else if (name.matches(XLinkNames::hrefAttr)) { 117 } else if (SVGURIReference::parseAttribute(name, value, parseError)) {
119 m_href->setBaseValueAsString(value, parseError);
120 } else { 118 } else {
121 ASSERT_NOT_REACHED(); 119 ASSERT_NOT_REACHED();
122 } 120 }
123 121
124 reportAttributeParsingError(parseError, name, value); 122 reportAttributeParsingError(parseError, name, value);
125 } 123 }
126 124
127 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) 125 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName)
128 { 126 {
129 if (!isSupportedAttribute(attrName)) { 127 if (!isSupportedAttribute(attrName)) {
130 SVGElement::svgAttributeChanged(attrName); 128 SVGElement::svgAttributeChanged(attrName);
131 return; 129 return;
132 } 130 }
133 131
134 SVGElementInstance::InvalidationGuard invalidationGuard(this); 132 SVGElementInstance::InvalidationGuard invalidationGuard(this);
135 133
136 if (SVGURIReference::isKnownAttribute(attrName)) { 134 if (SVGURIReference::isKnownAttribute(attrName)) {
137 buildPendingResource(); 135 buildPendingResource();
138 return; 136 return;
139 } 137 }
140 138
141 ASSERT_NOT_REACHED(); 139 ASSERT_NOT_REACHED();
142 } 140 }
143 141
144 SVGPathElement* SVGMPathElement::pathElement() 142 SVGPathElement* SVGMPathElement::pathElement()
145 { 143 {
146 Element* target = targetElementFromIRIString(m_href->currentValue()->value() , document()); 144 Element* target = targetElementFromIRIString(hrefString(), document());
147 if (target && target->hasTagName(SVGNames::pathTag)) 145 if (target && target->hasTagName(SVGNames::pathTag))
148 return toSVGPathElement(target); 146 return toSVGPathElement(target);
149 return 0; 147 return 0;
150 } 148 }
151 149
152 void SVGMPathElement::targetPathChanged() 150 void SVGMPathElement::targetPathChanged()
153 { 151 {
154 notifyParentOfPathChange(parentNode()); 152 notifyParentOfPathChange(parentNode());
155 } 153 }
156 154
157 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) 155 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent)
158 { 156 {
159 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) 157 if (parent && parent->hasTagName(SVGNames::animateMotionTag))
160 toSVGAnimateMotionElement(parent)->updateAnimationPath(); 158 toSVGAnimateMotionElement(parent)->updateAnimationPath();
161 } 159 }
162 160
163 } // namespace WebCore 161 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698