Make <feImage> work with xlink:href=[svg-image.svg]

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: dholbert, Unassigned)

Tracking

Trunk
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 2 obsolete attachments)

Filing this bug on getting <feImage> to work with SVG images.  Note that this uses separate code from SVG's <image> tag -- the code in question is in nsSVGFEImageElement::Filter(), here:
http://mxr.mozilla.org/mozilla-central/source/content/svg/content/src/nsSVGFilters.cpp#5510

5510 nsSVGFEImageElement::Filter(nsSVGFilterInstance *instance,
5511                             const nsTArray<const Image*>& aSources,
5512                             const Image* aTarget,
5513                             const nsIntRect& rect)
[...]
5526   nsCOMPtr<imgIContainer> imageContainer;
5527   if (currentRequest)
5528     currentRequest->GetImage(getter_AddRefs(imageContainer));
5529 
5530   nsRefPtr<gfxASurface> currentFrame;
5531   if (imageContainer)
5532     imageContainer->GetFrame(imgIContainer::FRAME_CURRENT,
5533                              imgIContainer::FLAG_SYNC_DECODE,
5534                              getter_AddRefs(currentFrame));
Note that imgIContainer::GetFrame isn't implemented yet for SVG-as-image.
Created attachment 476971 [details]
testcase with PNG image

Here's a simple <feImage> testcase using a PNG image. (This works, since it's using a PNG image rather than an SVG image.)
Created attachment 476972 [details]
(helper SVG image)
Created attachment 476975 [details]
testcase w/ SVG image
Created attachment 476976 [details]
testcase with SVG image

Opera (which I'm using for comparison) isn't displaying the SVG image when it's hosted on bugzilla, so I'm re-attaching the SVG-image-version with a data-URL-encoded SVG image.
Attachment #476972 - Attachment is obsolete: true
Attachment #476975 - Attachment is obsolete: true
Attachment #476976 - Attachment description: testcase → testcase with SVG image
Attachment #476971 - Attachment description: testcase w/ PNG image → testcase with PNG image

Comment 5

7 years ago
See also bug 455986 which may be a superset of this.
Hm -- bug 455986 seems to be primarily about something else, actually.  Based on its first comment & its first testcase, it seems to focus on "make <feImage> work with xlink:href="foo.svg#someId" -- to get behavior like <use>.  I think it makes sense to keep that bug separate from this one.

So really, we should be detecting the type of <feImage>'s URI (just whether it contains a "#" character).  If it looks like a reference to some element's ID, we want to behave like <use> (bug 455986), and otherwise, we want to behave like <image> (this bug).

Comment 7

6 years ago
Seems to work now in Firefox 7.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
WFM in Firefox 4, in fact
Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101 Firefox/4.0

As noted in comment 0, at the point I filed this bug, imgIContainer::GetFrame wasn't implemented yet for SVG-as-image. (and feImage relies on GetFrame)

So, this was almost certainly fixed by
http://hg.mozilla.org/mozilla-central/rev/e0e28d38dd59
> Bug 589558, patch 1: Implement VectorImage::GetFrame & CopyFrame, using Draw. r=joe a=blocking-betaN+
Depends on: 589558
Flags: in-testsuite?
Resolution: WORKSFORME → FIXED
You need to log in before you can comment on or make changes to this bug.