- Revision
- 123210
- Author
- [email protected]
- Date
- 2012-07-20 06:55:02 -0700 (Fri, 20 Jul 2012)
Log Message
SVG Filter Effect sub-region not applied for some filters
https://bugs.webkit.org/show_bug.cgi?id=89767
Reviewed by Dirk Schulze.
Source/WebCore:
The filter effect region for SVG feGaussian and feDropShadow filters
was incorrectly set, failing to account for the radius of the blur.
This patch fixes the problem and removes an unneccessary clip
operation when the filter result is blitted into the target. That clip
was clipping the shadow from webkit-shadow.
Tests: svg/filters/feDropShadow-subregion.svg
svg/filters/feGaussianBlur-subregion.svg
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::determineAbsolutePaintRect): Moved the code
that clips the paint rect by the filter effect subregion to come after
the paint is modified by the filter radius.
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::determineAbsolutePaintRect):
Moved the code that clips the paint rect by the filter effect subregion to
come after the paint is modified by the filter radius.
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::postApplyResource):
Removed a clip that is unnecessary and that was incorrectly clipping drop shadows.
LayoutTests:
The filter effect region for SVG feGaussian and feDropShadow filters was incorrectly set,
failing to account for the radius of the blur. This patch fixes the problem and removes an
unneccessary clip operation when the filter result is blitted into the target. That clip
was clipping the shadow from webkit-shadow.
* platform/chromium/TestExpectations: Added temp entries for affected
tests. Will rebaseline later (not closing the bug in the meantime).
* svg/filters/feDropShadow-subregion-expected.png: Added.
* svg/filters/feDropShadow-subregion-expected.txt: Added.
* svg/filters/feDropShadow-subregion.svg: This verifies the subregion for feDropShadow.
* svg/filters/feGaussianBlur-subregion-expected.png: Added.
* svg/filters/feGaussianBlur-subregion-expected.txt: Added.
* svg/filters/feGaussianBlur-subregion.svg: This verifies the subregion for feGaussianBlur.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (123209 => 123210)
--- trunk/LayoutTests/ChangeLog 2012-07-20 13:41:54 UTC (rev 123209)
+++ trunk/LayoutTests/ChangeLog 2012-07-20 13:55:02 UTC (rev 123210)
@@ -1,3 +1,24 @@
+2012-07-20 Stephen Chenney <[email protected]>
+
+ SVG Filter Effect sub-region not applied for some filters
+ https://bugs.webkit.org/show_bug.cgi?id=89767
+
+ Reviewed by Dirk Schulze.
+
+ The filter effect region for SVG feGaussian and feDropShadow filters was incorrectly set,
+ failing to account for the radius of the blur. This patch fixes the problem and removes an
+ unneccessary clip operation when the filter result is blitted into the target. That clip
+ was clipping the shadow from webkit-shadow.
+
+ * platform/chromium/TestExpectations: Added temp entries for affected
+ tests. Will rebaseline later (not closing the bug in the meantime).
+ * svg/filters/feDropShadow-subregion-expected.png: Added.
+ * svg/filters/feDropShadow-subregion-expected.txt: Added.
+ * svg/filters/feDropShadow-subregion.svg: This verifies the subregion for feDropShadow.
+ * svg/filters/feGaussianBlur-subregion-expected.png: Added.
+ * svg/filters/feGaussianBlur-subregion-expected.txt: Added.
+ * svg/filters/feGaussianBlur-subregion.svg: This verifies the subregion for feGaussianBlur.
+
2012-07-20 Mihnea Ovidenie <[email protected]>
Unreviewed. Skip regions inspector test on EFL.
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (123209 => 123210)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-07-20 13:41:54 UTC (rev 123209)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-07-20 13:55:02 UTC (rev 123210)
@@ -1296,7 +1296,45 @@
BUGWK85107 : svg/as-image/svg-as-relative-image-with-explicit-size.html = PASS IMAGE
BUGWK85107 : svg/as-image/animated-svg-as-image.html = PASS IMAGE
+BUGWK89767 : svg/W3C-SVG-1.1/filters-comptran-01-b.svg = PASS IMAGE
+BUGWK89767 : svg/W3C-SVG-1.1/filters-morph-01-f.svg = PASS IMAGE
+BUGWK89767 : svg/W3C-SVG-1.1/filters-example-01-b.svg = PASS IMAGE
+BUGWK89767 : svg/W3C-SVG-1.1/filters-color-01-b.svg = PASS IMAGE
+BUGWK89767 : svg/W3C-SVG-1.1/filters-gauss-01-b.svg = PASS IMAGE
+BUGWK89767 : svg/dynamic-updates/SVGFEGaussianBlurElement-dom-stdDeviation-attr.html = PASS IMAGE
+BUGWK89767 : svg/dynamic-updates/SVGFEGaussianBlurElement-svgdom-in-prop.html = PASS IMAGE
+BUGWK89767 : svg/dynamic-updates/SVGFEGaussianBlurElement-dom-in-attr.html = PASS IMAGE
+BUGWK89767 : svg/dynamic-updates/SVGFEGaussianBlurElement-dom-stdDeviation-call.html = PASS IMAGE
+BUGWK89767 : svg/batik/text/smallFonts.svg = PASS IMAGE
+BUGWK89767 : svg/batik/text/textFeatures.svg = PASS IMAGE
+BUGWK89767 : svg/batik/filters/feTile.svg = PASS IMAGE
+BUGWK89767 : svg/batik/filters/filterRegions.svg = PASS IMAGE
+BUGWK89767 : svg/filters/filterRes.svg = PASS IMAGE
+BUGWK89767 : svg/filters/subRegion-one-effect.svg = PASS IMAGE
+BUGWK89767 : svg/filters/subRegion-two-effects.svg = PASS IMAGE
+BUGWK89767 : svg/filters/filter-on-tspan.svg = PASS IMAGE
+BUGWK89767 : svg/filters/shadow-on-filter.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feDropShadow.svg = PASS IMAGE
+BUGWK89767 : svg/filters/shadow-on-rect-with-filter.svg = PASS IMAGE
+BUGWK89767 : svg/custom/feComponentTransfer-Table.svg = PASS IMAGE
+BUGWK89767 : svg/custom/feComponentTransfer-Gamma.svg = PASS IMAGE
+BUGWK89767 : svg/custom/feComponentTransfer-Discrete.svg = PASS IMAGE
+BUGWK89767 : svg/custom/feComponentTransfer-Linear.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feOffset.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feTile.svg = PASS IMAGE
+BUGWK89767 : svg/filters/filterRes3.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feGaussianBlur.svg = PASS IMAGE
+BUGWK89767 : svg/filters/filter-placement-issue.svg = PASS IMAGE
+BUGWK89767 : svg/filters/filter-rounding-issues.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feImage-subregions-preseveAspectRatio-none-with-viewBox.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feImage-subregions-preseveAspectRatio-none.svg = PASS IMAGE
+BUGWK89767 : svg/filters/filterRes1.svg = PASS IMAGE
+BUGWK89767 : svg/filters/parent-children-with-same-filter.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feImage-subregions.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feGaussianBlur-subregion.svg = PASS IMAGE
+BUGWK89767 : svg/filters/feDropShadow-subregion.svg = PASS IMAGE
+
// -----------------------------------------------------------------
// End SVG TESTS
// -----------------------------------------------------------------
Added: trunk/LayoutTests/svg/filters/feDropShadow-subregion-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/svg/filters/feDropShadow-subregion-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/svg/filters/feDropShadow-subregion-expected.txt (0 => 123210)
--- trunk/LayoutTests/svg/filters/feDropShadow-subregion-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/filters/feDropShadow-subregion-expected.txt 2012-07-20 13:55:02 UTC (rev 123210)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 100x100
+ RenderSVGRoot {svg} at (0,0) size 70x70
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderSVGResourceFilter {filter} [id="DropShadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+ [feComposite operation="OVER"]
+ [feDropShadow stdDeviation="10.00, 10.00" dx="10.00" dy="10.00" flood-color="#FF0000" flood-opacity="1.00]
+ [SourceGraphic]
+ [feOffset dx="10.00" dy="10.00"]
+ [SourceGraphic]
+ RenderSVGRect {rect} at (0,0) size 70x70 [fill={[type=SOLID] [color=#008000]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+ [filter="DropShadow"] RenderSVGResourceFilter {filter} at (-10,-10) size 80x80
Added: trunk/LayoutTests/svg/filters/feDropShadow-subregion.svg (0 => 123210)
--- trunk/LayoutTests/svg/filters/feDropShadow-subregion.svg (rev 0)
+++ trunk/LayoutTests/svg/filters/feDropShadow-subregion.svg 2012-07-20 13:55:02 UTC (rev 123210)
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100">
+ <defs>
+ <filter id="DropShadow" x="-50%" y="-50%" width="200%" height="200%" >
+ <feOffset in="SourceGraphic" dx="10" dy="10" result="Offset"/>
+ <feDropShadow in="SourceGraphic" x="10" y="10" width="40" height="40" dx="10" dy="10" stdDeviation="10" flood-color="red" result="Drop"/>
+ <feComposite operator="over" in="Drop" in2="Offset" />
+ </filter>
+ </defs>
+
+ <rect filter="url(#DropShadow)" x="10" y="10" width="40" height="40" fill="green"/>
+</svg>
Added: trunk/LayoutTests/svg/filters/feGaussianBlur-subregion-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/svg/filters/feGaussianBlur-subregion-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/svg/filters/feGaussianBlur-subregion-expected.txt (0 => 123210)
--- trunk/LayoutTests/svg/filters/feGaussianBlur-subregion-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/filters/feGaussianBlur-subregion-expected.txt 2012-07-20 13:55:02 UTC (rev 123210)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 100x100
+ RenderSVGRoot {svg} at (0,0) size 70x70
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderSVGResourceFilter {filter} [id="Blur"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+ [feComposite operation="OVER"]
+ [SourceGraphic]
+ [feGaussianBlur stdDeviation="10.00, 10.00"]
+ [feColorMatrix type="MATRIX" values="0.00 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+ [SourceGraphic]
+ RenderSVGRect {rect} at (0,0) size 70x70 [fill={[type=SOLID] [color=#008000]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+ [filter="Blur"] RenderSVGResourceFilter {filter} at (-10,-10) size 80x80
Added: trunk/LayoutTests/svg/filters/feGaussianBlur-subregion.svg (0 => 123210)
--- trunk/LayoutTests/svg/filters/feGaussianBlur-subregion.svg (rev 0)
+++ trunk/LayoutTests/svg/filters/feGaussianBlur-subregion.svg 2012-07-20 13:55:02 UTC (rev 123210)
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100">
+ <defs>
+ <filter id="Blur" x="-50%" y="-50%" width="200%" height="200%" >
+ <feColorMatrix in="SourceGraphic" type="matrix" values="0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0" result="Transformed"/>
+ <feGaussianBlur in="Transformed" x="10" y="10" width="40" height="40" dx="10" dy="10" stdDeviation="10" result="Gaussian"/>
+ <feComposite operator="over" in="SourceGraphic" in2="Gaussian" />
+ </filter>
+ </defs>
+
+ <rect filter="url(#Blur)" x="10" y="10" width="40" height="40" fill="green"/>
+</svg>
Modified: trunk/Source/WebCore/ChangeLog (123209 => 123210)
--- trunk/Source/WebCore/ChangeLog 2012-07-20 13:41:54 UTC (rev 123209)
+++ trunk/Source/WebCore/ChangeLog 2012-07-20 13:55:02 UTC (rev 123210)
@@ -1,3 +1,31 @@
+2012-07-20 Stephen Chenney <[email protected]>
+
+ SVG Filter Effect sub-region not applied for some filters
+ https://bugs.webkit.org/show_bug.cgi?id=89767
+
+ Reviewed by Dirk Schulze.
+
+ The filter effect region for SVG feGaussian and feDropShadow filters
+ was incorrectly set, failing to account for the radius of the blur.
+ This patch fixes the problem and removes an unneccessary clip
+ operation when the filter result is blitted into the target. That clip
+ was clipping the shadow from webkit-shadow.
+
+ Tests: svg/filters/feDropShadow-subregion.svg
+ svg/filters/feGaussianBlur-subregion.svg
+
+ * platform/graphics/filters/FEDropShadow.cpp:
+ (WebCore::FEDropShadow::determineAbsolutePaintRect): Moved the code
+ that clips the paint rect by the filter effect subregion to come after
+ the paint is modified by the filter radius.
+ * platform/graphics/filters/FEGaussianBlur.cpp:
+ (WebCore::FEGaussianBlur::determineAbsolutePaintRect):
+ Moved the code that clips the paint rect by the filter effect subregion to
+ come after the paint is modified by the filter radius.
+ * rendering/svg/RenderSVGResourceFilter.cpp:
+ (WebCore::RenderSVGResourceFilter::postApplyResource):
+ Removed a clip that is unnecessary and that was incorrectly clipping drop shadows.
+
2012-07-19 Pavel Feldman <[email protected]>
Web Inspector: Status bar icons are misaligned by 1px to the right
Modified: trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp (123209 => 123210)
--- trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp 2012-07-20 13:41:54 UTC (rev 123209)
+++ trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp 2012-07-20 13:55:02 UTC (rev 123210)
@@ -61,10 +61,6 @@
FloatRect absoluteOffsetPaintRect(absolutePaintRect);
absoluteOffsetPaintRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy));
absolutePaintRect.unite(absoluteOffsetPaintRect);
- if (clipsToBounds())
- absolutePaintRect.intersect(maxEffectRect());
- else
- absolutePaintRect.unite(maxEffectRect());
unsigned kernelSizeX = 0;
unsigned kernelSizeY = 0;
@@ -73,6 +69,12 @@
// We take the half kernel size and multiply it with three, because we run box blur three times.
absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f);
absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f);
+
+ if (clipsToBounds())
+ absolutePaintRect.intersect(maxEffectRect());
+ else
+ absolutePaintRect.unite(maxEffectRect());
+
setAbsolutePaintRect(enclosingIntRect(absolutePaintRect));
}
Modified: trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp (123209 => 123210)
--- trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp 2012-07-20 13:41:54 UTC (rev 123209)
+++ trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp 2012-07-20 13:55:02 UTC (rev 123210)
@@ -260,19 +260,21 @@
void FEGaussianBlur::determineAbsolutePaintRect()
{
- FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect();
- if (clipsToBounds())
- absolutePaintRect.intersect(maxEffectRect());
- else
- absolutePaintRect.unite(maxEffectRect());
-
unsigned kernelSizeX = 0;
unsigned kernelSizeY = 0;
calculateKernelSize(filter(), kernelSizeX, kernelSizeY, m_stdX, m_stdY);
+ FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect();
+
// We take the half kernel size and multiply it with three, because we run box blur three times.
absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f);
absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f);
+
+ if (clipsToBounds())
+ absolutePaintRect.intersect(maxEffectRect());
+ else
+ absolutePaintRect.unite(maxEffectRect());
+
setAbsolutePaintRect(enclosingIntRect(absolutePaintRect));
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (123209 => 123210)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp 2012-07-20 13:41:54 UTC (rev 123209)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp 2012-07-20 13:55:02 UTC (rev 123210)
@@ -316,7 +316,6 @@
context->concatCTM(filterData->shearFreeAbsoluteTransform.inverse());
context->scale(FloatSize(1 / filterData->filter->filterResolution().width(), 1 / filterData->filter->filterResolution().height()));
- context->clip(lastEffect->maxEffectRect());
context->drawImageBuffer(resultImage, object->style()->colorSpace(), lastEffect->absolutePaintRect());
context->scale(filterData->filter->filterResolution());