Last Comment Bug 484067 - SVG filter region clipped if Firefox thinks a smaller region is sufficient
: SVG filter region clipped if Firefox thinks a smaller region is sufficient
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: unspecified
: x86 Windows XP
: -- normal with 3 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 647687
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-18 14:45 PDT by Jan Thor
Modified: 2011-12-18 15:12 PST (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
SVG filter region for stroked object bug test (1.53 KB, image/svg+xml)
2009-03-18 14:47 PDT, Jan Thor
no flags Details

Description Jan Thor 2009-03-18 14:45:42 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7

Example:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" 
     width="100%" height="100%" preserveAspectRatio="xMidYMin meet"
     viewBox="0 0 300 100">
<defs>
  <filter id="filter1" x="-10%" y="-10%" width="120%" height="120%">
    <feColorMatrix type="saturate" values="1" />
  </filter>
  <filter id="filter2" x="0%" y="0%" width="100%" height="100%">
    <feColorMatrix type="saturate" values="1" />
  </filter>
</defs>
<circle cx="50"  cy="50" r="40" fill="#f00" stroke="#000" stroke-width="15" />
<circle cx="150" cy="50" r="40" fill="#f00" stroke="#000" stroke-width="15"
        filter="url(#filter1)" />
<circle cx="250" cy="50" r="40" fill="#f00" stroke="#000" stroke-width="15"
        filter="url(#filter2)" />
</svg>

Firefox ignores filter regions outside of its own estimate of what is really
needed. This works well for the blur filter (see #467930), but it forgets to
take into consideration that parts of an object may reside outside its
bounding box if that object is surrounded by a thick stroke. In the example,
exactly one of the three circles (the rightmost circle) should appear to be 
clipped, because the filter region is explicitly restricted to the bounding 
box. And that’s what I get from Batik and Adobe (interestingly, Inkscape gets 
it wrong  by clipping no circle at all). Firefox also clips the circle in the 
middle, ignoring that a larger filter region is explicitly specified.


Reproducible: Always

Steps to Reproduce:
1. Load the svg file in firefox

Actual Results:  
Two of three circles are clipped.

Expected Results:  
Only one of three circles should be clipped.
Comment 1 Jan Thor 2009-03-18 14:47:55 PDT
Created attachment 368113 [details]
SVG filter region for stroked object bug test
Comment 2 Jonathan Watt [:jwatt] 2009-04-23 16:32:58 PDT
Yeah, this is down to nsSVGFilterInstance::BuildSources using mTargetBBox
to calculate mResultBoundingBox I think. Of course bbox doesn't take account of stroke or filter effects on children of the filtered element. :-/

This is probably a dup, but I'm not sure of what offhand.
Comment 3 Karthik 2010-06-30 23:13:14 PDT
Am also facing this bug , any suggestions to work around this bug ?
Comment 4 Robert Longson 2011-12-18 15:12:55 PST
Fixed in Firefox 9 by check-in for bug 647687

Note You need to log in before you can comment on or make changes to this bug.