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

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

Issue 18328007: Move SVGTests attributes parsing to SVGGraphicsElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix issue in SVGSVGElement::svgAttributeChanged() Created 7 years, 5 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/SVGGraphicsElement.cpp ('k') | Source/core/svg/SVGLineElement.cpp » ('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) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 PassRefPtr<SVGImageElement> SVGImageElement::create(const QualifiedName& tagName , Document* document) 69 PassRefPtr<SVGImageElement> SVGImageElement::create(const QualifiedName& tagName , Document* document)
70 { 70 {
71 return adoptRef(new SVGImageElement(tagName, document)); 71 return adoptRef(new SVGImageElement(tagName, document));
72 } 72 }
73 73
74 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName) 74 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)
75 { 75 {
76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
77 if (supportedAttributes.isEmpty()) { 77 if (supportedAttributes.isEmpty()) {
78 SVGTests::addSupportedAttributes(supportedAttributes);
79 SVGLangSpace::addSupportedAttributes(supportedAttributes); 78 SVGLangSpace::addSupportedAttributes(supportedAttributes);
80 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 79 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
81 SVGURIReference::addSupportedAttributes(supportedAttributes); 80 SVGURIReference::addSupportedAttributes(supportedAttributes);
82 supportedAttributes.add(SVGNames::xAttr); 81 supportedAttributes.add(SVGNames::xAttr);
83 supportedAttributes.add(SVGNames::yAttr); 82 supportedAttributes.add(SVGNames::yAttr);
84 supportedAttributes.add(SVGNames::widthAttr); 83 supportedAttributes.add(SVGNames::widthAttr);
85 supportedAttributes.add(SVGNames::heightAttr); 84 supportedAttributes.add(SVGNames::heightAttr);
86 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); 85 supportedAttributes.add(SVGNames::preserveAspectRatioAttr);
87 } 86 }
88 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 87 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
(...skipping 27 matching lines...) Expand all
116 else if (name == SVGNames::yAttr) 115 else if (name == SVGNames::yAttr)
117 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 116 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
118 else if (name == SVGNames::preserveAspectRatioAttr) { 117 else if (name == SVGNames::preserveAspectRatioAttr) {
119 SVGPreserveAspectRatio preserveAspectRatio; 118 SVGPreserveAspectRatio preserveAspectRatio;
120 preserveAspectRatio.parse(value); 119 preserveAspectRatio.parse(value);
121 setPreserveAspectRatioBaseValue(preserveAspectRatio); 120 setPreserveAspectRatioBaseValue(preserveAspectRatio);
122 } else if (name == SVGNames::widthAttr) 121 } else if (name == SVGNames::widthAttr)
123 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); 122 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths));
124 else if (name == SVGNames::heightAttr) 123 else if (name == SVGNames::heightAttr)
125 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); 124 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths));
126 else if (SVGTests::parseAttribute(name, value) 125 else if (SVGLangSpace::parseAttribute(name, value)
127 || SVGLangSpace::parseAttribute(name, value)
128 || SVGExternalResourcesRequired::parseAttribute(name, value) 126 || SVGExternalResourcesRequired::parseAttribute(name, value)
129 || SVGURIReference::parseAttribute(name, value)) { 127 || SVGURIReference::parseAttribute(name, value)) {
130 } else 128 } else
131 ASSERT_NOT_REACHED(); 129 ASSERT_NOT_REACHED();
132 130
133 reportAttributeParsingError(parseError, name, value); 131 reportAttributeParsingError(parseError, name, value);
134 } 132 }
135 133
136 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) 134 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
137 { 135 {
138 if (!isSupportedAttribute(attrName)) { 136 if (!isSupportedAttribute(attrName)) {
139 SVGGraphicsElement::svgAttributeChanged(attrName); 137 SVGGraphicsElement::svgAttributeChanged(attrName);
140 return; 138 return;
141 } 139 }
142 140
143 SVGElementInstance::InvalidationGuard invalidationGuard(this); 141 SVGElementInstance::InvalidationGuard invalidationGuard(this);
144 142
145 bool isLengthAttribute = attrName == SVGNames::xAttr 143 bool isLengthAttribute = attrName == SVGNames::xAttr
146 || attrName == SVGNames::yAttr 144 || attrName == SVGNames::yAttr
147 || attrName == SVGNames::widthAttr 145 || attrName == SVGNames::widthAttr
148 || attrName == SVGNames::heightAttr; 146 || attrName == SVGNames::heightAttr;
149 147
150 if (isLengthAttribute) 148 if (isLengthAttribute)
151 updateRelativeLengthsInformation(); 149 updateRelativeLengthsInformation();
152 150
153 if (SVGTests::handleAttributeChange(this, attrName))
154 return;
155
156 if (SVGURIReference::isKnownAttribute(attrName)) { 151 if (SVGURIReference::isKnownAttribute(attrName)) {
157 m_imageLoader.updateFromElementIgnoringPreviousError(); 152 m_imageLoader.updateFromElementIgnoringPreviousError();
158 return; 153 return;
159 } 154 }
160 155
161 RenderObject* renderer = this->renderer(); 156 RenderObject* renderer = this->renderer();
162 if (!renderer) 157 if (!renderer)
163 return; 158 return;
164 159
165 if (isLengthAttribute) { 160 if (isLengthAttribute) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 addSubresourceURL(urls, document()->completeURL(href())); 226 addSubresourceURL(urls, document()->completeURL(href()));
232 } 227 }
233 228
234 void SVGImageElement::didMoveToNewDocument(Document* oldDocument) 229 void SVGImageElement::didMoveToNewDocument(Document* oldDocument)
235 { 230 {
236 m_imageLoader.elementDidMoveToNewDocument(); 231 m_imageLoader.elementDidMoveToNewDocument();
237 SVGGraphicsElement::didMoveToNewDocument(oldDocument); 232 SVGGraphicsElement::didMoveToNewDocument(oldDocument);
238 } 233 }
239 234
240 } 235 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGGraphicsElement.cpp ('k') | Source/core/svg/SVGLineElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698