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

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

Issue 1375793003: Update error-handling for fe*Lighting and feTurbulence (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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
126 if (!input1) 126 if (!input1)
127 return nullptr; 127 return nullptr;
128 128
129 SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this);
130 if (!lightNode)
131 return nullptr;
132
133 LayoutObject* layoutObject = this->layoutObject(); 129 LayoutObject* layoutObject = this->layoutObject();
134 if (!layoutObject) 130 if (!layoutObject)
135 return nullptr; 131 return nullptr;
136 132
137 ASSERT(layoutObject->style()); 133 ASSERT(layoutObject->style());
138 Color color = layoutObject->style()->svgStyle().lightingColor(); 134 Color color = layoutObject->style()->svgStyle().lightingColor();
139 135
140 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); 136 const SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*th is);
141 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_surfaceScale->currentValue()->value(), m_diffuseConstant->currentValue( )->value(), 137 RefPtr<LightSource> lightSource = lightNode ? lightNode->lightSource(filter) : nullptr;
138
139 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter,
140 color,
141 m_surfaceScale->currentValue()->value(),
142 m_diffuseConstant->currentValue()->value(),
142 lightSource.release()); 143 lightSource.release());
143 effect->inputEffects().append(input1); 144 effect->inputEffects().append(input1);
144 return effect.release(); 145 return effect.release();
145 } 146 }
146 147
147 } // namespace blink 148 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698