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

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
8 years ago
6 years ago

People

(Reporter: Jan Thor, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
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.
(Reporter)

Comment 1

8 years ago
Created attachment 368113 [details]
SVG filter region for stroked object bug test
(Reporter)

Updated

8 years ago
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

Updated

8 years ago
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

Comment 3

7 years ago
Am also facing this bug , any suggestions to work around this bug ?

Comment 4

6 years ago
Fixed in Firefox 9 by check-in for bug 647687
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Depends on: 647687
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.