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

Side by Side Diff: Source/core/svg/SVGRectElement.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/SVGPolyElement.cpp ('k') | Source/core/svg/SVGSVGElement.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 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 PassRefPtr<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Document* document) 67 PassRefPtr<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Document* document)
68 { 68 {
69 return adoptRef(new SVGRectElement(tagName, document)); 69 return adoptRef(new SVGRectElement(tagName, document));
70 } 70 }
71 71
72 bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName) 72 bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName)
73 { 73 {
74 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 74 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
75 if (supportedAttributes.isEmpty()) { 75 if (supportedAttributes.isEmpty()) {
76 SVGTests::addSupportedAttributes(supportedAttributes);
77 SVGLangSpace::addSupportedAttributes(supportedAttributes); 76 SVGLangSpace::addSupportedAttributes(supportedAttributes);
78 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 77 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
79 supportedAttributes.add(SVGNames::xAttr); 78 supportedAttributes.add(SVGNames::xAttr);
80 supportedAttributes.add(SVGNames::yAttr); 79 supportedAttributes.add(SVGNames::yAttr);
81 supportedAttributes.add(SVGNames::widthAttr); 80 supportedAttributes.add(SVGNames::widthAttr);
82 supportedAttributes.add(SVGNames::heightAttr); 81 supportedAttributes.add(SVGNames::heightAttr);
83 supportedAttributes.add(SVGNames::rxAttr); 82 supportedAttributes.add(SVGNames::rxAttr);
84 supportedAttributes.add(SVGNames::ryAttr); 83 supportedAttributes.add(SVGNames::ryAttr);
85 } 84 }
86 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 85 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
(...skipping 10 matching lines...) Expand all
97 else if (name == SVGNames::yAttr) 96 else if (name == SVGNames::yAttr)
98 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 97 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
99 else if (name == SVGNames::rxAttr) 98 else if (name == SVGNames::rxAttr)
100 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 99 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
101 else if (name == SVGNames::ryAttr) 100 else if (name == SVGNames::ryAttr)
102 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 101 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
103 else if (name == SVGNames::widthAttr) 102 else if (name == SVGNames::widthAttr)
104 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); 103 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths));
105 else if (name == SVGNames::heightAttr) 104 else if (name == SVGNames::heightAttr)
106 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); 105 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths));
107 else if (SVGTests::parseAttribute(name, value) 106 else if (SVGLangSpace::parseAttribute(name, value)
108 || SVGLangSpace::parseAttribute(name, value)
109 || SVGExternalResourcesRequired::parseAttribute(name, value)) { 107 || SVGExternalResourcesRequired::parseAttribute(name, value)) {
110 } else 108 } else
111 ASSERT_NOT_REACHED(); 109 ASSERT_NOT_REACHED();
112 110
113 reportAttributeParsingError(parseError, name, value); 111 reportAttributeParsingError(parseError, name, value);
114 } 112 }
115 113
116 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) 114 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
117 { 115 {
118 if (!isSupportedAttribute(attrName)) { 116 if (!isSupportedAttribute(attrName)) {
119 SVGGraphicsElement::svgAttributeChanged(attrName); 117 SVGGraphicsElement::svgAttributeChanged(attrName);
120 return; 118 return;
121 } 119 }
122 120
123 SVGElementInstance::InvalidationGuard invalidationGuard(this); 121 SVGElementInstance::InvalidationGuard invalidationGuard(this);
124 122
125 bool isLengthAttribute = attrName == SVGNames::xAttr 123 bool isLengthAttribute = attrName == SVGNames::xAttr
126 || attrName == SVGNames::yAttr 124 || attrName == SVGNames::yAttr
127 || attrName == SVGNames::widthAttr 125 || attrName == SVGNames::widthAttr
128 || attrName == SVGNames::heightAttr 126 || attrName == SVGNames::heightAttr
129 || attrName == SVGNames::rxAttr 127 || attrName == SVGNames::rxAttr
130 || attrName == SVGNames::ryAttr; 128 || attrName == SVGNames::ryAttr;
131 129
132 if (isLengthAttribute) 130 if (isLengthAttribute)
133 updateRelativeLengthsInformation(); 131 updateRelativeLengthsInformation();
134 132
135 if (SVGTests::handleAttributeChange(this, attrName))
136 return;
137
138 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 133 RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
139 if (!renderer) 134 if (!renderer)
140 return; 135 return;
141 136
142 if (isLengthAttribute) { 137 if (isLengthAttribute) {
143 renderer->setNeedsShapeUpdate(); 138 renderer->setNeedsShapeUpdate();
144 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 139 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
145 return; 140 return;
146 } 141 }
147 142
(...skipping 14 matching lines...) Expand all
162 || rx().isRelative() 157 || rx().isRelative()
163 || ry().isRelative(); 158 || ry().isRelative();
164 } 159 }
165 160
166 RenderObject* SVGRectElement::createRenderer(RenderStyle*) 161 RenderObject* SVGRectElement::createRenderer(RenderStyle*)
167 { 162 {
168 return new (document()->renderArena()) RenderSVGRect(this); 163 return new (document()->renderArena()) RenderSVGRect(this);
169 } 164 }
170 165
171 } 166 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPolyElement.cpp ('k') | Source/core/svg/SVGSVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698