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

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

Issue 109433003: SVGLangSpace interface should be removed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Avoid running into ASSERT for Debug Created 7 years 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
« 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 PassRefPtr<SVGRectElement> SVGRectElement::create(Document& document) 65 PassRefPtr<SVGRectElement> SVGRectElement::create(Document& document)
66 { 66 {
67 return adoptRef(new SVGRectElement(document)); 67 return adoptRef(new SVGRectElement(document));
68 } 68 }
69 69
70 bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName) 70 bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName)
71 { 71 {
72 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 72 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
73 if (supportedAttributes.isEmpty()) { 73 if (supportedAttributes.isEmpty()) {
74 SVGLangSpace::addSupportedAttributes(supportedAttributes);
75 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 74 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
76 supportedAttributes.add(SVGNames::xAttr); 75 supportedAttributes.add(SVGNames::xAttr);
77 supportedAttributes.add(SVGNames::yAttr); 76 supportedAttributes.add(SVGNames::yAttr);
78 supportedAttributes.add(SVGNames::widthAttr); 77 supportedAttributes.add(SVGNames::widthAttr);
79 supportedAttributes.add(SVGNames::heightAttr); 78 supportedAttributes.add(SVGNames::heightAttr);
80 supportedAttributes.add(SVGNames::rxAttr); 79 supportedAttributes.add(SVGNames::rxAttr);
81 supportedAttributes.add(SVGNames::ryAttr); 80 supportedAttributes.add(SVGNames::ryAttr);
82 } 81 }
83 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 82 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
84 } 83 }
85 84
86 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 85 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
87 { 86 {
88 SVGParsingError parseError = NoError; 87 SVGParsingError parseError = NoError;
89 88
90 if (!isSupportedAttribute(name)) 89 if (!isSupportedAttribute(name))
91 SVGGeometryElement::parseAttribute(name, value); 90 SVGGeometryElement::parseAttribute(name, value);
92 else if (name == SVGNames::xAttr) 91 else if (name == SVGNames::xAttr)
93 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); 92 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
94 else if (name == SVGNames::yAttr) 93 else if (name == SVGNames::yAttr)
95 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 94 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
96 else if (name == SVGNames::rxAttr) 95 else if (name == SVGNames::rxAttr)
97 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 96 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
98 else if (name == SVGNames::ryAttr) 97 else if (name == SVGNames::ryAttr)
99 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 98 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
100 else if (name == SVGNames::widthAttr) 99 else if (name == SVGNames::widthAttr)
101 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); 100 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths));
102 else if (name == SVGNames::heightAttr) 101 else if (name == SVGNames::heightAttr)
103 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); 102 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths));
104 else if (SVGLangSpace::parseAttribute(name, value) 103 else if (SVGExternalResourcesRequired::parseAttribute(name, value)) {
105 || SVGExternalResourcesRequired::parseAttribute(name, value)) {
106 } else 104 } else
107 ASSERT_NOT_REACHED(); 105 ASSERT_NOT_REACHED();
108 106
109 reportAttributeParsingError(parseError, name, value); 107 reportAttributeParsingError(parseError, name, value);
110 } 108 }
111 109
112 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) 110 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
113 { 111 {
114 if (!isSupportedAttribute(attrName)) { 112 if (!isSupportedAttribute(attrName)) {
115 SVGGeometryElement::svgAttributeChanged(attrName); 113 SVGGeometryElement::svgAttributeChanged(attrName);
(...skipping 15 matching lines...) Expand all
131 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 129 RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
132 if (!renderer) 130 if (!renderer)
133 return; 131 return;
134 132
135 if (isLengthAttribute) { 133 if (isLengthAttribute) {
136 renderer->setNeedsShapeUpdate(); 134 renderer->setNeedsShapeUpdate();
137 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 135 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
138 return; 136 return;
139 } 137 }
140 138
141 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired ::isKnownAttribute(attrName)) { 139 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
142 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 140 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
143 return; 141 return;
144 } 142 }
145 143
146 ASSERT_NOT_REACHED(); 144 ASSERT_NOT_REACHED();
147 } 145 }
148 146
149 bool SVGRectElement::selfHasRelativeLengths() const 147 bool SVGRectElement::selfHasRelativeLengths() const
150 { 148 {
151 return xCurrentValue().isRelative() 149 return xCurrentValue().isRelative()
152 || yCurrentValue().isRelative() 150 || yCurrentValue().isRelative()
153 || widthCurrentValue().isRelative() 151 || widthCurrentValue().isRelative()
154 || heightCurrentValue().isRelative() 152 || heightCurrentValue().isRelative()
155 || rxCurrentValue().isRelative() 153 || rxCurrentValue().isRelative()
156 || ryCurrentValue().isRelative(); 154 || ryCurrentValue().isRelative();
157 } 155 }
158 156
159 RenderObject* SVGRectElement::createRenderer(RenderStyle*) 157 RenderObject* SVGRectElement::createRenderer(RenderStyle*)
160 { 158 {
161 return new RenderSVGRect(this); 159 return new RenderSVGRect(this);
162 } 160 }
163 161
164 } 162 }
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