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

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

Issue 1383013002: SVGFilterBuilder::getEffectById never return nullptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (SVGFELightElement::findLightElement(*this) != lightElement) 115 if (SVGFELightElement::findLightElement(*this) != lightElement)
116 return; 116 return;
117 117
118 // The light element has different attribute names. 118 // The light element has different attribute names.
119 primitiveAttributeChanged(attrName); 119 primitiveAttributeChanged(attrName);
120 } 120 }
121 121
122 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilte rBuilder* filterBuilder, Filter* filter) 122 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilte rBuilder* filterBuilder, Filter* filter)
123 { 123 {
124 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value())); 124 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value()));
125 125 ASSERT(input1);
126 if (!input1)
127 return nullptr;
128 126
129 LayoutObject* layoutObject = this->layoutObject(); 127 LayoutObject* layoutObject = this->layoutObject();
130 if (!layoutObject) 128 if (!layoutObject)
131 return nullptr; 129 return nullptr;
132 130
133 ASSERT(layoutObject->style()); 131 ASSERT(layoutObject->style());
134 Color color = layoutObject->style()->svgStyle().lightingColor(); 132 Color color = layoutObject->style()->svgStyle().lightingColor();
135 133
136 const SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*th is); 134 const SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*th is);
137 RefPtr<LightSource> lightSource = lightNode ? lightNode->lightSource(filter) : nullptr; 135 RefPtr<LightSource> lightSource = lightNode ? lightNode->lightSource(filter) : nullptr;
138 136
139 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, 137 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter,
140 color, 138 color,
141 m_surfaceScale->currentValue()->value(), 139 m_surfaceScale->currentValue()->value(),
142 m_diffuseConstant->currentValue()->value(), 140 m_diffuseConstant->currentValue()->value(),
143 lightSource.release()); 141 lightSource.release());
144 effect->inputEffects().append(input1); 142 effect->inputEffects().append(input1);
145 return effect.release(); 143 return effect.release();
146 } 144 }
147 145
148 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698