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

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: 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, 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) {
125 ContainerNode* parent = parentNode(); 100 ContainerNode* parent = parentNode();
126 if (!parent) 101 if (!parent)
127 return; 102 return;
128 103
129 LayoutObject* renderer = parent->layoutObject(); 104 LayoutObject* renderer = parent->layoutObject();
130 if (!renderer || !renderer->isSVGResourceFilterPrimitive()) 105 if (!renderer || !renderer->isSVGResourceFilterPrimitive())
131 return; 106 return;
132 107
108 SVGElement::InvalidationGuard invalidationGuard(this);
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 }
117
118 ASSERT_NOT_REACHED();
141 } 119 }
142 120
143 ASSERT_NOT_REACHED(); 121 SVGElement::svgAttributeChanged(attrName);
144 } 122 }
145 123
146 void SVGFELightElement::childrenChanged(const ChildrenChange& change) 124 void SVGFELightElement::childrenChanged(const ChildrenChange& change)
147 { 125 {
148 SVGElement::childrenChanged(change); 126 SVGElement::childrenChanged(change);
149 127
150 if (!change.byParser) { 128 if (!change.byParser) {
151 if (ContainerNode* parent = parentNode()) { 129 if (ContainerNode* parent = parentNode()) {
152 LayoutObject* renderer = parent->layoutObject(); 130 LayoutObject* renderer = parent->layoutObject();
153 if (renderer && renderer->isSVGResourceFilterPrimitive()) 131 if (renderer && renderer->isSVGResourceFilterPrimitive())
154 markForLayoutAndParentResourceInvalidation(renderer); 132 markForLayoutAndParentResourceInvalidation(renderer);
155 } 133 }
156 } 134 }
157 } 135 }
158 136
159 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698