Title: [208058] trunk
Revision
208058
Author
simon.fra...@apple.com
Date
2016-10-28 11:34:17 -0700 (Fri, 28 Oct 2016)

Log Message

Wrong blur radius for filter: drop-shadow()
https://bugs.webkit.org/show_bug.cgi?id=163667

Reviewed by Darin Adler.

Source/WebCore:

The "stdDev" parameter to <feDropShadow> and <feGaussianBlur> represents the standard
deviation (σ) of the Gaussian blur function. CSS filters drop-shadow() and blur() follow
this with their radius parameter.

However, CSS box-shadow and text-shadow use 2σ to describe the blur radius, since this
is conveniently close to the number of pixels the effect of the blur extends out.

feDropShadow, which is used by non-accelerated filter: drop-shadow(), was using
the wrong blur radius because it passed its stdDev directly to ShadowBlur. ShadowBlur
was written for CSS box-shadow, so expected its input "blur radius" to be twice the
stdDev.

Tests: css3/filters/drop-shadow-blur-radius.html
       svg/filters/feDropShadow-blur-radius.html

* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::platformApplySoftware):

LayoutTests:

Mismatch tests to detect that the blurry area extends out from under a masking
element on top.

* css3/filters/drop-shadow-blur-radius-expected-mismatch.html: Added.
* css3/filters/drop-shadow-blur-radius.html: Added.
* svg/filters/feDropShadow-blur-radius-expected-mismatch.html: Added.
* svg/filters/feDropShadow-blur-radius.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208057 => 208058)


--- trunk/LayoutTests/ChangeLog	2016-10-28 18:09:41 UTC (rev 208057)
+++ trunk/LayoutTests/ChangeLog	2016-10-28 18:34:17 UTC (rev 208058)
@@ -1,3 +1,18 @@
+2016-10-28  Simon Fraser  <simon.fra...@apple.com>
+
+        Wrong blur radius for filter: drop-shadow()
+        https://bugs.webkit.org/show_bug.cgi?id=163667
+
+        Reviewed by Darin Adler.
+        
+        Mismatch tests to detect that the blurry area extends out from under a masking
+        element on top.
+
+        * css3/filters/drop-shadow-blur-radius-expected-mismatch.html: Added.
+        * css3/filters/drop-shadow-blur-radius.html: Added.
+        * svg/filters/feDropShadow-blur-radius-expected-mismatch.html: Added.
+        * svg/filters/feDropShadow-blur-radius.html: Added.
+
 2016-10-28  Youenn Fablet  <you...@apple.com>
 
         Expose RTCPeerConnection unprefixed

Added: trunk/LayoutTests/css3/filters/drop-shadow-blur-radius-expected-mismatch.html (0 => 208058)


--- trunk/LayoutTests/css3/filters/drop-shadow-blur-radius-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/drop-shadow-blur-radius-expected-mismatch.html	2016-10-28 18:34:17 UTC (rev 208058)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .overlay {
+            position: absolute;
+            top: 75px;
+            left: 75px;
+            height: 250px;
+            width: 250px;
+            border-radius: 50%;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <div class="overlay"></div>
+</body>
+</html>

Added: trunk/LayoutTests/css3/filters/drop-shadow-blur-radius.html (0 => 208058)


--- trunk/LayoutTests/css3/filters/drop-shadow-blur-radius.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/drop-shadow-blur-radius.html	2016-10-28 18:34:17 UTC (rev 208058)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .circle {
+            position: absolute;
+            top: 100px;
+            left: 100px;
+            height: 200px;
+            width: 200px;
+            border-radius: 50%;
+            background-color: white;
+            filter: drop-shadow(0 0 20px black);
+        }
+        
+        .overlay {
+            position: absolute;
+            top: 75px;
+            left: 75px;
+            height: 250px;
+            width: 250px;
+            border-radius: 50%;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <div class="circle"></div>
+    <div class="overlay"></div>
+</body>
+</html>

Added: trunk/LayoutTests/svg/filters/feDropShadow-blur-radius-expected-mismatch.html (0 => 208058)


--- trunk/LayoutTests/svg/filters/feDropShadow-blur-radius-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/feDropShadow-blur-radius-expected-mismatch.html	2016-10-28 18:34:17 UTC (rev 208058)
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" style="width: 400px; height: 400px;">
+    <circle cx="150" cy="150" r="124" fill="green"/>
+</svg>

Added: trunk/LayoutTests/svg/filters/feDropShadow-blur-radius.html (0 => 208058)


--- trunk/LayoutTests/svg/filters/feDropShadow-blur-radius.html	                        (rev 0)
+++ trunk/LayoutTests/svg/filters/feDropShadow-blur-radius.html	2016-10-28 18:34:17 UTC (rev 208058)
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" style="width: 400px; height: 400px;">
+    <defs>
+        <filter id="drop-shadow" x="-20%" y="-20%" width="150%" height="150%">
+            <feDropShadow stdDeviation="20"/>
+        </filter>
+    </defs>
+    <circle cx="150" cy="150" r="100" fill="white" filter="url(#drop-shadow)"/>
+    <circle cx="150" cy="150" r="124" fill="green"/>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (208057 => 208058)


--- trunk/Source/WebCore/ChangeLog	2016-10-28 18:09:41 UTC (rev 208057)
+++ trunk/Source/WebCore/ChangeLog	2016-10-28 18:34:17 UTC (rev 208058)
@@ -1,3 +1,28 @@
+2016-10-28  Simon Fraser  <simon.fra...@apple.com>
+
+        Wrong blur radius for filter: drop-shadow()
+        https://bugs.webkit.org/show_bug.cgi?id=163667
+
+        Reviewed by Darin Adler.
+        
+        The "stdDev" parameter to <feDropShadow> and <feGaussianBlur> represents the standard
+        deviation (σ) of the Gaussian blur function. CSS filters drop-shadow() and blur() follow
+        this with their radius parameter.
+        
+        However, CSS box-shadow and text-shadow use 2σ to describe the blur radius, since this
+        is conveniently close to the number of pixels the effect of the blur extends out.
+        
+        feDropShadow, which is used by non-accelerated filter: drop-shadow(), was using
+        the wrong blur radius because it passed its stdDev directly to ShadowBlur. ShadowBlur
+        was written for CSS box-shadow, so expected its input "blur radius" to be twice the
+        stdDev.
+        
+        Tests: css3/filters/drop-shadow-blur-radius.html
+               svg/filters/feDropShadow-blur-radius.html
+
+        * platform/graphics/filters/FEDropShadow.cpp:
+        (WebCore::FEDropShadow::platformApplySoftware):
+
 2016-10-28  Youenn Fablet  <you...@apple.com>
 
         Expose RTCPeerConnection unprefixed

Modified: trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp (208057 => 208058)


--- trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp	2016-10-28 18:09:41 UTC (rev 208057)
+++ trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp	2016-10-28 18:34:17 UTC (rev 208058)
@@ -78,7 +78,7 @@
         return;
 
     Filter& filter = this->filter();
-    FloatSize blurRadius(filter.applyHorizontalScale(m_stdX), filter.applyVerticalScale(m_stdY));
+    FloatSize blurRadius(2 * filter.applyHorizontalScale(m_stdX), 2 * filter.applyVerticalScale(m_stdY));
     blurRadius.scale(filter.filterScale());
     FloatSize offset(filter.applyHorizontalScale(m_dx), filter.applyVerticalScale(m_dy));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to