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

Unified Diff: Source/core/svg/SVGFEGaussianBlurElement.cpp

Issue 1350903009: Update handling of negative std.dev for feGaussianblur/feDropShadow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGFEDropShadowElement.cpp ('k') | Source/platform/graphics/filters/FEDropShadow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGFEGaussianBlurElement.cpp
diff --git a/Source/core/svg/SVGFEGaussianBlurElement.cpp b/Source/core/svg/SVGFEGaussianBlurElement.cpp
index c322d8dfd379d22cc1ca5fd6183bf7e28e4d1f6a..cfb1503edc502291f1c3ddb4485c5fb09b9acf3c 100644
--- a/Source/core/svg/SVGFEGaussianBlurElement.cpp
+++ b/Source/core/svg/SVGFEGaussianBlurElement.cpp
@@ -72,10 +72,14 @@ PassRefPtrWillBeRawPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBu
if (!input1)
return nullptr;
- if (stdDeviationX()->currentValue()->value() < 0 || stdDeviationY()->currentValue()->value() < 0)
- return nullptr;
-
- RefPtrWillBeRawPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationX()->currentValue()->value(), stdDeviationY()->currentValue()->value());
+ // "A negative value or a value of zero disables the effect of the given
+ // filter primitive (i.e., the result is the filter input image)."
+ // (https://drafts.fxtf.org/filters/#element-attrdef-fegaussianblur-stddeviation)
+ //
+ // => Clamp to non-negative.
+ float stdDevX = std::max(0.0f, stdDeviationX()->currentValue()->value());
+ float stdDevY = std::max(0.0f, stdDeviationY()->currentValue()->value());
+ RefPtrWillBeRawPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDevX, stdDevY);
effect->inputEffects().append(input1);
return effect.release();
}
« no previous file with comments | « Source/core/svg/SVGFEDropShadowElement.cpp ('k') | Source/platform/graphics/filters/FEDropShadow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698