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

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

Issue 1074813002: Remove isSupportedAttribute in svg (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixups 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, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 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) 2005 Oliver Hunt <oliver@nerget.com> 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 FloatPoint3D SVGFELightElement::position() const 78 FloatPoint3D SVGFELightElement::position() const
79 { 79 {
80 return FloatPoint3D(x()->currentValue()->value(), y()->currentValue()->value (), z()->currentValue()->value()); 80 return FloatPoint3D(x()->currentValue()->value(), y()->currentValue()->value (), z()->currentValue()->value());
81 } 81 }
82 82
83 FloatPoint3D SVGFELightElement::pointsAt() const 83 FloatPoint3D SVGFELightElement::pointsAt() const
84 { 84 {
85 return FloatPoint3D(pointsAtX()->currentValue()->value(), pointsAtY()->curre ntValue()->value(), pointsAtZ()->currentValue()->value()); 85 return FloatPoint3D(pointsAtX()->currentValue()->value(), pointsAtY()->curre ntValue()->value(), pointsAtZ()->currentValue()->value());
86 } 86 }
87 87
88 bool SVGFELightElement::isSupportedAttribute(const QualifiedName& attrName)
89 {
90 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
91 if (supportedAttributes.isEmpty()) {
92 supportedAttributes.add(SVGNames::azimuthAttr);
93 supportedAttributes.add(SVGNames::elevationAttr);
94 supportedAttributes.add(SVGNames::xAttr);
95 supportedAttributes.add(SVGNames::yAttr);
96 supportedAttributes.add(SVGNames::zAttr);
97 supportedAttributes.add(SVGNames::pointsAtXAttr);
98 supportedAttributes.add(SVGNames::pointsAtYAttr);
99 supportedAttributes.add(SVGNames::pointsAtZAttr);
100 supportedAttributes.add(SVGNames::specularExponentAttr);
101 supportedAttributes.add(SVGNames::limitingConeAngleAttr);
102 }
103 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
104 }
105
106 void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName) 88 void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName)
107 { 89 {
108 if (!isSupportedAttribute(attrName)) {
109 SVGElement::svgAttributeChanged(attrName);
110 return;
111 }
112
113 SVGElement::InvalidationGuard invalidationGuard(this);
114
115 if (attrName == SVGNames::azimuthAttr 90 if (attrName == SVGNames::azimuthAttr
116 || attrName == SVGNames::elevationAttr 91 || attrName == SVGNames::elevationAttr
117 || attrName == SVGNames::xAttr 92 || attrName == SVGNames::xAttr
118 || attrName == SVGNames::yAttr 93 || attrName == SVGNames::yAttr
119 || attrName == SVGNames::zAttr 94 || attrName == SVGNames::zAttr
120 || attrName == SVGNames::pointsAtXAttr 95 || attrName == SVGNames::pointsAtXAttr
121 || attrName == SVGNames::pointsAtYAttr 96 || attrName == SVGNames::pointsAtYAttr
122 || attrName == SVGNames::pointsAtZAttr 97 || attrName == SVGNames::pointsAtZAttr
123 || attrName == SVGNames::specularExponentAttr 98 || attrName == SVGNames::specularExponentAttr
124 || attrName == SVGNames::limitingConeAngleAttr) { 99 || attrName == SVGNames::limitingConeAngleAttr) {
100 SVGElement::InvalidationGuard invalidationGuard(this);
fs 2015/04/10 14:25:24 Move this down to just before isSVGFEDiffuseLighti
Erik Dahlström (inactive) 2015/04/10 15:33:44 Done.
125 ContainerNode* parent = parentNode(); 101 ContainerNode* parent = parentNode();
126 if (!parent) 102 if (!parent)
127 return; 103 return;
128 104
129 LayoutObject* renderer = parent->layoutObject(); 105 LayoutObject* renderer = parent->layoutObject();
130 if (!renderer || !renderer->isSVGResourceFilterPrimitive()) 106 if (!renderer || !renderer->isSVGResourceFilterPrimitive())
131 return; 107 return;
132 108
133 if (isSVGFEDiffuseLightingElement(*parent)) { 109 if (isSVGFEDiffuseLightingElement(*parent)) {
134 toSVGFEDiffuseLightingElement(*parent).lightElementAttributeChanged( this, attrName); 110 toSVGFEDiffuseLightingElement(*parent).lightElementAttributeChanged( this, attrName);
135 return; 111 return;
136 } 112 }
137 if (isSVGFESpecularLightingElement(*parent)) { 113 if (isSVGFESpecularLightingElement(*parent)) {
138 toSVGFESpecularLightingElement(*parent).lightElementAttributeChanged (this, attrName); 114 toSVGFESpecularLightingElement(*parent).lightElementAttributeChanged (this, attrName);
139 return; 115 return;
140 } 116 }
141 } 117 }
fs 2015/04/10 14:25:24 Should probably move the ASSERT_NOT_REACHED() here
Erik Dahlström (inactive) 2015/04/10 15:33:44 Done.
142 118
143 ASSERT_NOT_REACHED(); 119 SVGElement::svgAttributeChanged(attrName);
144 } 120 }
145 121
146 void SVGFELightElement::childrenChanged(const ChildrenChange& change) 122 void SVGFELightElement::childrenChanged(const ChildrenChange& change)
147 { 123 {
148 SVGElement::childrenChanged(change); 124 SVGElement::childrenChanged(change);
149 125
150 if (!change.byParser) { 126 if (!change.byParser) {
151 if (ContainerNode* parent = parentNode()) { 127 if (ContainerNode* parent = parentNode()) {
152 LayoutObject* renderer = parent->layoutObject(); 128 LayoutObject* renderer = parent->layoutObject();
153 if (renderer && renderer->isSVGResourceFilterPrimitive()) 129 if (renderer && renderer->isSVGResourceFilterPrimitive())
154 markForLayoutAndParentResourceInvalidation(renderer); 130 markForLayoutAndParentResourceInvalidation(renderer);
155 } 131 }
156 } 132 }
157 } 133 }
158 134
159 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698