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

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

Issue 148173018: [SVG] SVGAnimatedString{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove debug print 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
« no previous file with comments | « Source/core/svg/SVGMPathElement.h ('k') | Source/core/svg/SVGMaskElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 23
24 #include "XLinkNames.h" 24 #include "XLinkNames.h"
25 #include "core/dom/Document.h" 25 #include "core/dom/Document.h"
26 #include "core/svg/SVGAnimateMotionElement.h" 26 #include "core/svg/SVGAnimateMotionElement.h"
27 #include "core/svg/SVGDocumentExtensions.h" 27 #include "core/svg/SVGDocumentExtensions.h"
28 #include "core/svg/SVGPathElement.h" 28 #include "core/svg/SVGPathElement.h"
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 // Animated property definitions 32 // Animated property definitions
33 DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href)
34 33
35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) 34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement)
36 REGISTER_LOCAL_ANIMATED_PROPERTY(href)
37 END_REGISTER_ANIMATED_PROPERTIES 35 END_REGISTER_ANIMATED_PROPERTIES
38 36
39 inline SVGMPathElement::SVGMPathElement(Document& document) 37 inline SVGMPathElement::SVGMPathElement(Document& document)
40 : SVGElement(SVGNames::mpathTag, document) 38 : SVGElement(SVGNames::mpathTag, document)
39 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr eate()))
41 { 40 {
42 ScriptWrappable::init(this); 41 ScriptWrappable::init(this);
42 addToPropertyMap(m_href);
43 registerAnimatedPropertiesForSVGMPathElement(); 43 registerAnimatedPropertiesForSVGMPathElement();
44 } 44 }
45 45
46 PassRefPtr<SVGMPathElement> SVGMPathElement::create(Document& document) 46 PassRefPtr<SVGMPathElement> SVGMPathElement::create(Document& document)
47 { 47 {
48 return adoptRef(new SVGMPathElement(document)); 48 return adoptRef(new SVGMPathElement(document));
49 } 49 }
50 50
51 SVGMPathElement::~SVGMPathElement() 51 SVGMPathElement::~SVGMPathElement()
52 { 52 {
53 clearResourceReferences(); 53 clearResourceReferences();
54 } 54 }
55 55
56 void SVGMPathElement::buildPendingResource() 56 void SVGMPathElement::buildPendingResource()
57 { 57 {
58 clearResourceReferences(); 58 clearResourceReferences();
59 if (!inDocument()) 59 if (!inDocument())
60 return; 60 return;
61 61
62 AtomicString id; 62 AtomicString id;
63 Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentVal ue(), document(), &id); 63 Element* target = SVGURIReference::targetElementFromIRIString(m_href->curren tValue()->value(), document(), &id);
64 if (!target) { 64 if (!target) {
65 // Do not register as pending if we are already pending this resource. 65 // Do not register as pending if we are already pending this resource.
66 if (document().accessSVGExtensions()->isElementPendingResource(this, id) ) 66 if (document().accessSVGExtensions()->isElementPendingResource(this, id) )
67 return; 67 return;
68 68
69 if (!id.isEmpty()) { 69 if (!id.isEmpty()) {
70 document().accessSVGExtensions()->addPendingResource(id, this); 70 document().accessSVGExtensions()->addPendingResource(id, this);
71 ASSERT(hasPendingResources()); 71 ASSERT(hasPendingResources());
72 } 72 }
73 } else if (target->isSVGElement()) { 73 } else if (target->isSVGElement()) {
(...skipping 30 matching lines...) Expand all
104 { 104 {
105 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 105 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
106 if (supportedAttributes.isEmpty()) { 106 if (supportedAttributes.isEmpty()) {
107 SVGURIReference::addSupportedAttributes(supportedAttributes); 107 SVGURIReference::addSupportedAttributes(supportedAttributes);
108 } 108 }
109 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 109 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
110 } 110 }
111 111
112 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) 112 void SVGMPathElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value)
113 { 113 {
114 SVGParsingError parseError = NoError;
115
114 if (!isSupportedAttribute(name)) { 116 if (!isSupportedAttribute(name)) {
115 SVGElement::parseAttribute(name, value); 117 SVGElement::parseAttribute(name, value);
116 return; 118 } else if (name.matches(XLinkNames::hrefAttr)) {
119 m_href->setBaseValueAsString(value, parseError);
120 } else {
121 ASSERT_NOT_REACHED();
117 } 122 }
118 123
119 if (SVGURIReference::parseAttribute(name, value)) 124 reportAttributeParsingError(parseError, name, value);
120 return;
121
122 ASSERT_NOT_REACHED();
123 } 125 }
124 126
125 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) 127 void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName)
126 { 128 {
127 if (!isSupportedAttribute(attrName)) { 129 if (!isSupportedAttribute(attrName)) {
128 SVGElement::svgAttributeChanged(attrName); 130 SVGElement::svgAttributeChanged(attrName);
129 return; 131 return;
130 } 132 }
131 133
132 SVGElementInstance::InvalidationGuard invalidationGuard(this); 134 SVGElementInstance::InvalidationGuard invalidationGuard(this);
133 135
134 if (SVGURIReference::isKnownAttribute(attrName)) { 136 if (SVGURIReference::isKnownAttribute(attrName)) {
135 buildPendingResource(); 137 buildPendingResource();
136 return; 138 return;
137 } 139 }
138 140
139 ASSERT_NOT_REACHED(); 141 ASSERT_NOT_REACHED();
140 } 142 }
141 143
142 SVGPathElement* SVGMPathElement::pathElement() 144 SVGPathElement* SVGMPathElement::pathElement()
143 { 145 {
144 Element* target = targetElementFromIRIString(hrefCurrentValue(), document()) ; 146 Element* target = targetElementFromIRIString(m_href->currentValue()->value() , document());
145 if (target && target->hasTagName(SVGNames::pathTag)) 147 if (target && target->hasTagName(SVGNames::pathTag))
146 return toSVGPathElement(target); 148 return toSVGPathElement(target);
147 return 0; 149 return 0;
148 } 150 }
149 151
150 void SVGMPathElement::targetPathChanged() 152 void SVGMPathElement::targetPathChanged()
151 { 153 {
152 notifyParentOfPathChange(parentNode()); 154 notifyParentOfPathChange(parentNode());
153 } 155 }
154 156
155 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) 157 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent)
156 { 158 {
157 if (parent && parent->hasTagName(SVGNames::animateMotionTag)) 159 if (parent && parent->hasTagName(SVGNames::animateMotionTag))
158 toSVGAnimateMotionElement(parent)->updateAnimationPath(); 160 toSVGAnimateMotionElement(parent)->updateAnimationPath();
159 } 161 }
160 162
161 } // namespace WebCore 163 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/svg/SVGMPathElement.h ('k') | Source/core/svg/SVGMaskElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698