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

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

Issue 1074813002: Remove isSupportedAttribute in svg (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: invalidation guard tweaks Created 5 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2014 Google, Inc. 4 * Copyright (C) 2014 Google, Inc.
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (hasSVGRareData()) 180 if (hasSVGRareData())
181 return *svgRareData()->animateMotionTransform() * matrix; 181 return *svgRareData()->animateMotionTransform() * matrix;
182 return matrix; 182 return matrix;
183 } 183 }
184 184
185 AffineTransform* SVGGraphicsElement::animateMotionTransform() 185 AffineTransform* SVGGraphicsElement::animateMotionTransform()
186 { 186 {
187 return ensureSVGRareData()->animateMotionTransform(); 187 return ensureSVGRareData()->animateMotionTransform();
188 } 188 }
189 189
190 bool SVGGraphicsElement::isSupportedAttribute(const QualifiedName& attrName)
191 {
192 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
193 if (supportedAttributes.isEmpty()) {
194 SVGTests::addSupportedAttributes(supportedAttributes);
195 supportedAttributes.add(SVGNames::transformAttr);
196 }
197 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
198 }
199
200 void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) 190 void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
201 { 191 {
202 if (!isSupportedAttribute(attrName)) {
203 SVGElement::svgAttributeChanged(attrName);
204 return;
205 }
206
207 SVGElement::InvalidationGuard invalidationGuard(this);
208
209 // Reattach so the isValid() check will be run again during renderer creatio n. 192 // Reattach so the isValid() check will be run again during renderer creatio n.
210 if (SVGTests::isKnownAttribute(attrName)) { 193 if (SVGTests::isKnownAttribute(attrName)) {
194 SVGElement::InvalidationGuard invalidationGuard(this);
211 lazyReattachIfAttached(); 195 lazyReattachIfAttached();
212 return; 196 return;
213 } 197 }
214 198
215 LayoutObject* object = layoutObject(); 199 if (attrName == SVGNames::transformAttr) {
216 if (!object) 200 LayoutObject* object = layoutObject();
217 return; 201 if (!object)
202 return;
218 203
219 if (attrName == SVGNames::transformAttr) { 204 SVGElement::InvalidationGuard invalidationGuard(this);
220 object->setNeedsTransformUpdate(); 205 object->setNeedsTransformUpdate();
221 markForLayoutAndParentResourceInvalidation(object); 206 markForLayoutAndParentResourceInvalidation(object);
222 return; 207 return;
223 } 208 }
224 209
225 ASSERT_NOT_REACHED(); 210 SVGElement::svgAttributeChanged(attrName);
226 } 211 }
227 212
228 SVGElement* SVGGraphicsElement::nearestViewportElement() const 213 SVGElement* SVGGraphicsElement::nearestViewportElement() const
229 { 214 {
230 for (Element* current = parentOrShadowHostElement(); current; current = curr ent->parentOrShadowHostElement()) { 215 for (Element* current = parentOrShadowHostElement(); current; current = curr ent->parentOrShadowHostElement()) {
231 if (isViewportElement(*current)) 216 if (isViewportElement(*current))
232 return toSVGElement(current); 217 return toSVGElement(current);
233 } 218 }
234 219
235 return 0; 220 return 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return new LayoutSVGPath(this); 252 return new LayoutSVGPath(this);
268 } 253 }
269 254
270 void SVGGraphicsElement::toClipPath(Path& path) 255 void SVGGraphicsElement::toClipPath(Path& path)
271 { 256 {
272 updatePathFromGraphicsElement(this, path); 257 updatePathFromGraphicsElement(this, path);
273 path.transform(calculateAnimatedLocalTransform()); 258 path.transform(calculateAnimatedLocalTransform());
274 } 259 }
275 260
276 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698