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

Side by Side Diff: Source/core/svg/SVGGradientElement.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, 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 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 DEFINE_TRACE(SVGGradientElement) 57 DEFINE_TRACE(SVGGradientElement)
58 { 58 {
59 visitor->trace(m_gradientTransform); 59 visitor->trace(m_gradientTransform);
60 visitor->trace(m_spreadMethod); 60 visitor->trace(m_spreadMethod);
61 visitor->trace(m_gradientUnits); 61 visitor->trace(m_gradientUnits);
62 SVGElement::trace(visitor); 62 SVGElement::trace(visitor);
63 SVGURIReference::trace(visitor); 63 SVGURIReference::trace(visitor);
64 } 64 }
65 65
66 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName)
67 {
68 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
69 if (supportedAttributes.isEmpty()) {
70 SVGURIReference::addSupportedAttributes(supportedAttributes);
71 supportedAttributes.add(SVGNames::gradientUnitsAttr);
72 supportedAttributes.add(SVGNames::gradientTransformAttr);
73 supportedAttributes.add(SVGNames::spreadMethodAttr);
74 }
75 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
76 }
77
78 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) 66 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName)
79 { 67 {
80 if (!isSupportedAttribute(attrName)) { 68 if (attrName == SVGNames::gradientUnitsAttr
81 SVGElement::svgAttributeChanged(attrName); 69 || attrName == SVGNames::gradientTransformAttr
70 || attrName == SVGNames::spreadMethodAttr
71 || SVGURIReference::isKnownAttribute(attrName))
72 {
73 SVGElement::InvalidationGuard invalidationGuard(this);
74
75 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this ->layoutObject());
76 if (renderer)
77 renderer->invalidateCacheAndMarkForLayout();
78
82 return; 79 return;
83 } 80 }
84 81
85 SVGElement::InvalidationGuard invalidationGuard(this); 82 SVGElement::svgAttributeChanged(attrName);
86
87 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
88 if (renderer)
89 renderer->invalidateCacheAndMarkForLayout();
90 } 83 }
91 84
92 void SVGGradientElement::childrenChanged(const ChildrenChange& change) 85 void SVGGradientElement::childrenChanged(const ChildrenChange& change)
93 { 86 {
94 SVGElement::childrenChanged(change); 87 SVGElement::childrenChanged(change);
95 88
96 if (change.byParser) 89 if (change.byParser)
97 return; 90 return;
98 91
99 if (LayoutObject* object = layoutObject()) 92 if (LayoutObject* object = layoutObject())
(...skipping 11 matching lines...) Expand all
111 offset = std::min(std::max(previousOffset, offset), 1.0f); 104 offset = std::min(std::max(previousOffset, offset), 1.0f);
112 previousOffset = offset; 105 previousOffset = offset;
113 106
114 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity ())); 107 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity ()));
115 } 108 }
116 109
117 return stops; 110 return stops;
118 } 111 }
119 112
120 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698