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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.cpp

Issue 2738863002: Replace ASSERT with DCHECK in core/svg/ (Closed)
Patch Set: Split DCHECKS wherever possible Created 3 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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DEFINE_NODE_FACTORY(SVGFESpecularLightingElement) 67 DEFINE_NODE_FACTORY(SVGFESpecularLightingElement)
68 68
69 bool SVGFESpecularLightingElement::setFilterEffectAttribute( 69 bool SVGFESpecularLightingElement::setFilterEffectAttribute(
70 FilterEffect* effect, 70 FilterEffect* effect,
71 const QualifiedName& attrName) { 71 const QualifiedName& attrName) {
72 FESpecularLighting* specularLighting = 72 FESpecularLighting* specularLighting =
73 static_cast<FESpecularLighting*>(effect); 73 static_cast<FESpecularLighting*>(effect);
74 74
75 if (attrName == SVGNames::lighting_colorAttr) { 75 if (attrName == SVGNames::lighting_colorAttr) {
76 LayoutObject* layoutObject = this->layoutObject(); 76 LayoutObject* layoutObject = this->layoutObject();
77 ASSERT(layoutObject); 77 DCHECK(layoutObject);
78 ASSERT(layoutObject->style()); 78 DCHECK(layoutObject->style());
79 return specularLighting->setLightingColor( 79 return specularLighting->setLightingColor(
80 layoutObject->style()->svgStyle().lightingColor()); 80 layoutObject->style()->svgStyle().lightingColor());
81 } 81 }
82 if (attrName == SVGNames::surfaceScaleAttr) 82 if (attrName == SVGNames::surfaceScaleAttr)
83 return specularLighting->setSurfaceScale( 83 return specularLighting->setSurfaceScale(
84 m_surfaceScale->currentValue()->value()); 84 m_surfaceScale->currentValue()->value());
85 if (attrName == SVGNames::specularConstantAttr) 85 if (attrName == SVGNames::specularConstantAttr)
86 return specularLighting->setSpecularConstant( 86 return specularLighting->setSpecularConstant(
87 m_specularConstant->currentValue()->value()); 87 m_specularConstant->currentValue()->value());
88 if (attrName == SVGNames::specularExponentAttr) 88 if (attrName == SVGNames::specularExponentAttr)
89 return specularLighting->setSpecularExponent( 89 return specularLighting->setSpecularExponent(
90 m_specularExponent->currentValue()->value()); 90 m_specularExponent->currentValue()->value());
91 91
92 LightSource* lightSource = 92 LightSource* lightSource =
93 const_cast<LightSource*>(specularLighting->lightSource()); 93 const_cast<LightSource*>(specularLighting->lightSource());
94 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this); 94 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this);
95 ASSERT(lightSource); 95 DCHECK(lightSource);
96 ASSERT(lightElement); 96 DCHECK(lightElement);
97 ASSERT(effect->getFilter()); 97 DCHECK(effect->getFilter());
98 98
99 if (attrName == SVGNames::azimuthAttr) 99 if (attrName == SVGNames::azimuthAttr)
100 return lightSource->setAzimuth( 100 return lightSource->setAzimuth(
101 lightElement->azimuth()->currentValue()->value()); 101 lightElement->azimuth()->currentValue()->value());
102 if (attrName == SVGNames::elevationAttr) 102 if (attrName == SVGNames::elevationAttr)
103 return lightSource->setElevation( 103 return lightSource->setElevation(
104 lightElement->elevation()->currentValue()->value()); 104 lightElement->elevation()->currentValue()->value());
105 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || 105 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
106 attrName == SVGNames::zAttr) 106 attrName == SVGNames::zAttr)
107 return lightSource->setPosition( 107 return lightSource->setPosition(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // The light element has different attribute names so attrName can identify 150 // The light element has different attribute names so attrName can identify
151 // the requested attribute. 151 // the requested attribute.
152 primitiveAttributeChanged(attrName); 152 primitiveAttributeChanged(attrName);
153 } 153 }
154 154
155 FilterEffect* SVGFESpecularLightingElement::build( 155 FilterEffect* SVGFESpecularLightingElement::build(
156 SVGFilterBuilder* filterBuilder, 156 SVGFilterBuilder* filterBuilder,
157 Filter* filter) { 157 Filter* filter) {
158 FilterEffect* input1 = filterBuilder->getEffectById( 158 FilterEffect* input1 = filterBuilder->getEffectById(
159 AtomicString(m_in1->currentValue()->value())); 159 AtomicString(m_in1->currentValue()->value()));
160 ASSERT(input1); 160 DCHECK(input1);
161 161
162 LayoutObject* layoutObject = this->layoutObject(); 162 LayoutObject* layoutObject = this->layoutObject();
163 if (!layoutObject) 163 if (!layoutObject)
164 return nullptr; 164 return nullptr;
165 165
166 ASSERT(layoutObject->style()); 166 DCHECK(layoutObject->style());
167 Color color = layoutObject->style()->svgStyle().lightingColor(); 167 Color color = layoutObject->style()->svgStyle().lightingColor();
168 168
169 const SVGFELightElement* lightNode = 169 const SVGFELightElement* lightNode =
170 SVGFELightElement::findLightElement(*this); 170 SVGFELightElement::findLightElement(*this);
171 RefPtr<LightSource> lightSource = 171 RefPtr<LightSource> lightSource =
172 lightNode ? lightNode->lightSource(filter) : nullptr; 172 lightNode ? lightNode->lightSource(filter) : nullptr;
173 173
174 FilterEffect* effect = FESpecularLighting::create( 174 FilterEffect* effect = FESpecularLighting::create(
175 filter, color, m_surfaceScale->currentValue()->value(), 175 filter, color, m_surfaceScale->currentValue()->value(),
176 m_specularConstant->currentValue()->value(), 176 m_specularConstant->currentValue()->value(),
177 m_specularExponent->currentValue()->value(), std::move(lightSource)); 177 m_specularExponent->currentValue()->value(), std::move(lightSource));
178 effect->inputEffects().push_back(input1); 178 effect->inputEffects().push_back(input1);
179 return effect; 179 return effect;
180 } 180 }
181 181
182 } // namespace blink 182 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGFEOffsetElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGFETileElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698