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

Side by Side Diff: Source/core/svg/SVGUseElement.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/SVGTextContentElement.cpp ('k') | no next file » | 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, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6 * Copyright (C) 2012 University of Szeged 6 * Copyright (C) 2012 University of Szeged
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 SVGElementInstance* SVGUseElement::animatedInstanceRoot() const 117 SVGElementInstance* SVGUseElement::animatedInstanceRoot() const
118 { 118 {
119 // FIXME: Implement me. 119 // FIXME: Implement me.
120 return 0; 120 return 0;
121 } 121 }
122 122
123 bool SVGUseElement::isSupportedAttribute(const QualifiedName& attrName) 123 bool SVGUseElement::isSupportedAttribute(const QualifiedName& attrName)
124 { 124 {
125 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 125 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
126 if (supportedAttributes.isEmpty()) { 126 if (supportedAttributes.isEmpty()) {
127 SVGTests::addSupportedAttributes(supportedAttributes);
128 SVGLangSpace::addSupportedAttributes(supportedAttributes); 127 SVGLangSpace::addSupportedAttributes(supportedAttributes);
129 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 128 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
130 SVGURIReference::addSupportedAttributes(supportedAttributes); 129 SVGURIReference::addSupportedAttributes(supportedAttributes);
131 supportedAttributes.add(SVGNames::xAttr); 130 supportedAttributes.add(SVGNames::xAttr);
132 supportedAttributes.add(SVGNames::yAttr); 131 supportedAttributes.add(SVGNames::yAttr);
133 supportedAttributes.add(SVGNames::widthAttr); 132 supportedAttributes.add(SVGNames::widthAttr);
134 supportedAttributes.add(SVGNames::heightAttr); 133 supportedAttributes.add(SVGNames::heightAttr);
135 } 134 }
136 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 135 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
137 } 136 }
138 137
139 void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString & value) 138 void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString & value)
140 { 139 {
141 SVGParsingError parseError = NoError; 140 SVGParsingError parseError = NoError;
142 141
143 if (!isSupportedAttribute(name)) 142 if (!isSupportedAttribute(name))
144 SVGGraphicsElement::parseAttribute(name, value); 143 SVGGraphicsElement::parseAttribute(name, value);
145 else if (name == SVGNames::xAttr) 144 else if (name == SVGNames::xAttr)
146 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); 145 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
147 else if (name == SVGNames::yAttr) 146 else if (name == SVGNames::yAttr)
148 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 147 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
149 else if (name == SVGNames::widthAttr) 148 else if (name == SVGNames::widthAttr)
150 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); 149 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths));
151 else if (name == SVGNames::heightAttr) 150 else if (name == SVGNames::heightAttr)
152 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); 151 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths));
153 else if (SVGTests::parseAttribute(name, value) 152 else if (SVGLangSpace::parseAttribute(name, value)
154 || SVGLangSpace::parseAttribute(name, value)
155 || SVGExternalResourcesRequired::parseAttribute(name, value) 153 || SVGExternalResourcesRequired::parseAttribute(name, value)
156 || SVGURIReference::parseAttribute(name, value)) { 154 || SVGURIReference::parseAttribute(name, value)) {
157 } else 155 } else
158 ASSERT_NOT_REACHED(); 156 ASSERT_NOT_REACHED();
159 157
160 reportAttributeParsingError(parseError, name, value); 158 reportAttributeParsingError(parseError, name, value);
161 } 159 }
162 160
163 static inline bool isWellFormedDocument(Document* document) 161 static inline bool isWellFormedDocument(Document* document)
164 { 162 {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (attrName == SVGNames::xAttr 218 if (attrName == SVGNames::xAttr
221 || attrName == SVGNames::yAttr 219 || attrName == SVGNames::yAttr
222 || attrName == SVGNames::widthAttr 220 || attrName == SVGNames::widthAttr
223 || attrName == SVGNames::heightAttr) { 221 || attrName == SVGNames::heightAttr) {
224 updateRelativeLengthsInformation(); 222 updateRelativeLengthsInformation();
225 if (renderer) 223 if (renderer)
226 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er); 224 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er);
227 return; 225 return;
228 } 226 }
229 227
230 if (SVGTests::handleAttributeChange(this, attrName))
231 return;
232
233 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) 228 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName))
234 return; 229 return;
235 230
236 if (SVGURIReference::isKnownAttribute(attrName)) { 231 if (SVGURIReference::isKnownAttribute(attrName)) {
237 bool isExternalReference = isExternalURIReference(href(), document()); 232 bool isExternalReference = isExternalURIReference(href(), document());
238 if (isExternalReference) { 233 if (isExternalReference) {
239 KURL url = document()->completeURL(href()); 234 KURL url = document()->completeURL(href());
240 if (url.hasFragmentIdentifier()) { 235 if (url.hasFragmentIdentifier()) {
241 CachedResourceRequest request(ResourceRequest(url.string()), loc alName()); 236 CachedResourceRequest request(ResourceRequest(url.string()), loc alName());
242 setCachedDocument(document()->cachedResourceLoader()->requestSVG Document(request)); 237 setCachedDocument(document()->cachedResourceLoader()->requestSVG Document(request));
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 983
989 if (m_cachedDocument) 984 if (m_cachedDocument)
990 m_cachedDocument->removeClient(this); 985 m_cachedDocument->removeClient(this);
991 986
992 m_cachedDocument = cachedDocument; 987 m_cachedDocument = cachedDocument;
993 if (m_cachedDocument) 988 if (m_cachedDocument)
994 m_cachedDocument->addClient(this); 989 m_cachedDocument->addClient(this);
995 } 990 }
996 991
997 } 992 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGTextContentElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698