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

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

Issue 192133002: Use isSVG*Element() helpers more in SVG code (Part 1) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/svg/SVGFELightElement.h ('k') | Source/core/svg/SVGFESpecularLightingElement.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, 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 addToPropertyMap(m_x); 50 addToPropertyMap(m_x);
51 addToPropertyMap(m_y); 51 addToPropertyMap(m_y);
52 addToPropertyMap(m_z); 52 addToPropertyMap(m_z);
53 addToPropertyMap(m_pointsAtX); 53 addToPropertyMap(m_pointsAtX);
54 addToPropertyMap(m_pointsAtY); 54 addToPropertyMap(m_pointsAtY);
55 addToPropertyMap(m_pointsAtZ); 55 addToPropertyMap(m_pointsAtZ);
56 addToPropertyMap(m_specularExponent); 56 addToPropertyMap(m_specularExponent);
57 addToPropertyMap(m_limitingConeAngle); 57 addToPropertyMap(m_limitingConeAngle);
58 } 58 }
59 59
60 SVGFELightElement* SVGFELightElement::findLightElement(const SVGElement* svgElem ent) 60 SVGFELightElement* SVGFELightElement::findLightElement(const SVGElement& svgElem ent)
61 { 61 {
62 for (Node* node = svgElement->firstChild(); node; node = node->nextSibling() ) { 62 return Traversal<SVGFELightElement>::firstChild(svgElement);
63 if (isSVGFELightElement(*node))
64 return toSVGFELightElement(node);
65 }
66 return 0;
67 } 63 }
68 64
69 PassRefPtr<LightSource> SVGFELightElement::findLightSource(const SVGElement* svg Element) 65 PassRefPtr<LightSource> SVGFELightElement::findLightSource(const SVGElement& svg Element)
70 { 66 {
71 SVGFELightElement* lightNode = findLightElement(svgElement); 67 SVGFELightElement* lightNode = findLightElement(svgElement);
72 if (!lightNode) 68 if (!lightNode)
73 return nullptr; 69 return nullptr;
74 return lightNode->lightSource(); 70 return lightNode->lightSource();
75 } 71 }
76 72
77 bool SVGFELightElement::isSupportedAttribute(const QualifiedName& attrName) 73 bool SVGFELightElement::isSupportedAttribute(const QualifiedName& attrName)
78 { 74 {
79 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 75 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 || attrName == SVGNames::specularExponentAttr 143 || attrName == SVGNames::specularExponentAttr
148 || attrName == SVGNames::limitingConeAngleAttr) { 144 || attrName == SVGNames::limitingConeAngleAttr) {
149 ContainerNode* parent = parentNode(); 145 ContainerNode* parent = parentNode();
150 if (!parent) 146 if (!parent)
151 return; 147 return;
152 148
153 RenderObject* renderer = parent->renderer(); 149 RenderObject* renderer = parent->renderer();
154 if (!renderer || !renderer->isSVGResourceFilterPrimitive()) 150 if (!renderer || !renderer->isSVGResourceFilterPrimitive())
155 return; 151 return;
156 152
157 if (parent->hasTagName(SVGNames::feDiffuseLightingTag)) { 153 if (isSVGFEDiffuseLightingElement(*parent)) {
158 toSVGFEDiffuseLightingElement(parent)->lightElementAttributeChanged( this, attrName); 154 toSVGFEDiffuseLightingElement(*parent).lightElementAttributeChanged( this, attrName);
159 return; 155 return;
160 } else if (parent->hasTagName(SVGNames::feSpecularLightingTag)) { 156 }
161 toSVGFESpecularLightingElement(parent)->lightElementAttributeChanged (this, attrName); 157 if (isSVGFESpecularLightingElement(*parent)) {
158 toSVGFESpecularLightingElement(*parent).lightElementAttributeChanged (this, attrName);
162 return; 159 return;
163 } 160 }
164 } 161 }
165 162
166 ASSERT_NOT_REACHED(); 163 ASSERT_NOT_REACHED();
167 } 164 }
168 165
169 void SVGFELightElement::childrenChanged(bool changedByParser, Node* beforeChange , Node* afterChange, int childCountDelta) 166 void SVGFELightElement::childrenChanged(bool changedByParser, Node* beforeChange , Node* afterChange, int childCountDelta)
170 { 167 {
171 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta); 168 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta);
172 169
173 if (!changedByParser) { 170 if (!changedByParser) {
174 if (ContainerNode* parent = parentNode()) { 171 if (ContainerNode* parent = parentNode()) {
175 RenderObject* renderer = parent->renderer(); 172 RenderObject* renderer = parent->renderer();
176 if (renderer && renderer->isSVGResourceFilterPrimitive()) 173 if (renderer && renderer->isSVGResourceFilterPrimitive())
177 RenderSVGResource::markForLayoutAndParentResourceInvalidation(re nderer); 174 RenderSVGResource::markForLayoutAndParentResourceInvalidation(re nderer);
178 } 175 }
179 } 176 }
180 } 177 }
181 178
182 } 179 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFELightElement.h ('k') | Source/core/svg/SVGFESpecularLightingElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698