Last Comment Bug 598204 - Make <feImage> work with xlink:href=[svg-image.svg]
: Make <feImage> work with xlink:href=[svg-image.svg]
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on: 589558
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-20 16:55 PDT by Daniel Holbert [:dholbert]
Modified: 2011-11-01 15:20 PDT (History)
2 users (show)
dholbert: in‑testsuite?
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
testcase with PNG image (758 bytes, image/svg+xml)
2010-09-20 17:08 PDT, Daniel Holbert [:dholbert]
no flags Details
(helper SVG image) (354 bytes, image/svg+xml)
2010-09-20 17:09 PDT, Daniel Holbert [:dholbert]
no flags Details
testcase w/ SVG image (756 bytes, image/svg+xml)
2010-09-20 17:13 PDT, Daniel Holbert [:dholbert]
no flags Details
testcase with SVG image (1.17 KB, image/svg+xml)
2010-09-20 17:16 PDT, Daniel Holbert [:dholbert]
no flags Details

Description Daniel Holbert [:dholbert] 2010-09-20 16:55:20 PDT
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.
Comment 1 Daniel Holbert [:dholbert] 2010-09-20 17:08:44 PDT
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.)
Comment 2 Daniel Holbert [:dholbert] 2010-09-20 17:09:08 PDT
Created attachment 476972 [details]
(helper SVG image)
Comment 3 Daniel Holbert [:dholbert] 2010-09-20 17:13:44 PDT
Created attachment 476975 [details]
testcase w/ SVG image
Comment 4 Daniel Holbert [:dholbert] 2010-09-20 17:16:25 PDT
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.
Comment 5 Robert Longson 2010-09-20 23:55:37 PDT
See also bug 455986 which may be a superset of this.
Comment 6 Daniel Holbert [:dholbert] 2010-09-21 09:01:38 PDT
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 Robert Longson 2011-11-01 15:15:56 PDT
Seems to work now in Firefox 7.
Comment 8 Daniel Holbert [:dholbert] 2011-11-01 15:20:56 PDT
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+

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