Closed Bug 484067 Opened 12 years ago Closed 10 years ago

SVG filter region clipped if Firefox thinks a smaller region is sufficient

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jan, Unassigned)

References

Details

Attachments

(1 file)

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.
Summary: SVG filter region clipped if firefox thinks a smaller region is sufficient → SVG filter region clipped if Firefox thinks a smaller region is sufficient
Component: General → SVG
Product: Firefox → Core
QA Contact: general → general
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.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Am also facing this bug , any suggestions to work around this bug ?
Fixed in Firefox 9 by check-in for bug 647687
Status: NEW → RESOLVED
Closed: 10 years ago
Depends on: 647687
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.