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

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

Issue 1087283002: Rework the checks for too-few values in feColorMatrix filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Correct patch 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
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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 SVGFilterPrimitiveStandardAttributes::trace(visitor); 59 SVGFilterPrimitiveStandardAttributes::trace(visitor);
60 } 60 }
61 61
62 DEFINE_NODE_FACTORY(SVGFEColorMatrixElement) 62 DEFINE_NODE_FACTORY(SVGFEColorMatrixElement)
63 63
64 bool SVGFEColorMatrixElement::setFilterEffectAttribute(FilterEffect* effect, con st QualifiedName& attrName) 64 bool SVGFEColorMatrixElement::setFilterEffectAttribute(FilterEffect* effect, con st QualifiedName& attrName)
65 { 65 {
66 FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect); 66 FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect);
67 if (attrName == SVGNames::typeAttr) 67 if (attrName == SVGNames::typeAttr)
68 return colorMatrix->setType(m_type->currentValue()->enumValue()); 68 return colorMatrix->setType(m_type->currentValue()->enumValue());
69 if (attrName == SVGNames::valuesAttr) { 69 if (attrName == SVGNames::valuesAttr)
70 Vector<float> values = m_values->currentValue()->toFloatVector(); 70 return colorMatrix->setValues(m_values->currentValue()->toFloatVector()) ;
71 if (values.size() == 20)
72 return colorMatrix->setValues(m_values->currentValue()->toFloatVecto r());
73 return false;
74 }
75 71
76 ASSERT_NOT_REACHED(); 72 ASSERT_NOT_REACHED();
77 return false; 73 return false;
78 } 74 }
79 75
80 void SVGFEColorMatrixElement::svgAttributeChanged(const QualifiedName& attrName) 76 void SVGFEColorMatrixElement::svgAttributeChanged(const QualifiedName& attrName)
81 { 77 {
82 if (attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr) { 78 if (attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr) {
83 SVGElement::InvalidationGuard invalidationGuard(this); 79 SVGElement::InvalidationGuard invalidationGuard(this);
84 primitiveAttributeChanged(attrName); 80 primitiveAttributeChanged(attrName);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 127
132 filterValues = values->toFloatVector(); 128 filterValues = values->toFloatVector();
133 } 129 }
134 130
135 RefPtrWillBeRawPtr<FilterEffect> effect = FEColorMatrix::create(filter, filt erType, filterValues); 131 RefPtrWillBeRawPtr<FilterEffect> effect = FEColorMatrix::create(filter, filt erType, filterValues);
136 effect->inputEffects().append(input1); 132 effect->inputEffects().append(input1);
137 return effect.release(); 133 return effect.release();
138 } 134 }
139 135
140 } // namespace blink 136 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698