Bug 32584

Summary: Opacity and shadow both clip away too much in some cases with filters
Product: WebKit Reporter: Beth Dakin <bdakin>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, eric, krit, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on: 32815    
Bug Blocks: 68469, 26389    
Attachments:
Description Flags
fix for the clipping bug none

Description Beth Dakin 2009-12-15 15:01:48 PST
svg/filters/shadow-on-rect-with-filter.svg is currently failing the pixel tests because we started using a transparency layer for shadows and clipping appropriately. Turns out the same bug already existed for opacity which does the same thing; in other words, if you replace the shadow style in that test case with "opacity: 0.5," we clip too much in the same way.
Comment 1 Dirk Schulze 2009-12-18 02:14:00 PST
Yes. http://trac.webkit.org/browser/trunk/WebCore/rendering/SVGRenderSupport.cpp#93 and http://trac.webkit.org/browser/trunk/WebCore/rendering/SVGRenderSupport.cpp#L102 SVGRenderSupport uses the boundingbox. We might use the union of filter rect and objectboundingbox for the clipping, if filters are present.
But atm the filter rect is calculated at http://trac.webkit.org/browser/trunk/WebCore/rendering/SVGRenderSupport.cpp#L135.
Comment 2 Dirk Schulze 2009-12-18 05:24:26 PST
*** Bug 32702 has been marked as a duplicate of this bug. ***
Comment 3 Dirk Schulze 2009-12-18 05:51:05 PST
It needs a redesign, but I already have a patch for it. Just needs a bit more clean-up and testing.
Comment 4 Dirk Schulze 2009-12-18 09:01:19 PST
Created attachment 45154 [details]
fix for the clipping bug

This fixes the failing pixel tests. Sadly object->repaintRectInLocalCoordinates() seems to change some local values of Renderers, so many filter related LayoutTests have different results.
Also we still have to calculate the filterRect a second time on drawing. But this is not avoidable, since we call the filters by id and one filter can be used by different object's.
Comment 5 Nikolas Zimmermann 2009-12-18 20:25:51 PST
*** Bug 32765 has been marked as a duplicate of this bug. ***
Comment 6 Nikolas Zimmermann 2009-12-18 20:26:01 PST
There are other affected tests (run pixel tests with --tolerance 0, and you'll see the errors):
svg/css/arrow-with-shadow.svg
svg/css/group-with-shadow.svg
svg/css/stars-with-shadow.html
svg/filters/shadow-on-rect-with-filter.svg
Comment 7 Nikolas Zimmermann 2009-12-18 20:28:03 PST
(In reply to comment #6)
> There are other affected tests (run pixel tests with --tolerance 0, and you'll
> see the errors):
> svg/css/arrow-with-shadow.svg
> svg/css/group-with-shadow.svg
> svg/css/stars-with-shadow.html
> svg/filters/shadow-on-rect-with-filter.svg
^^^^^^^^^^^^^^^^^ Beth already reported that one, oops.

Closed the bug 32584 that I just filed, it's a duplicate of this bug.
All have the same problem -- we _do_ need a pixel tests bot :(
Beth, can you do anything from the Apple side about this?
Comment 8 Dirk Schulze 2009-12-30 01:11:42 PST
The clipping bug is fixed with r52647.

I'm not sure, if the patch also fixes:
svg/css/arrow-with-shadow.svg
svg/css/group-with-shadow.svg
svg/css/stars-with-shadow.html

If not, we have to open another bug.