Closed
Bug 1106522
Opened 10 years ago
Closed 10 years ago
`<picture>` mime type selection doesn't pick SVG
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: yoav, Assigned: seth)
Details
Attachments
(2 files, 1 obsolete file)
3.09 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
4.61 KB,
patch
|
Details | Diff | Splinter Review |
`<img>`'s source selection with a `<picture>` parent seems to be able to do MIME type based selection (using the `type` attribute), as we can see in http://jsbin.com/jivavejifu/1 OTOH, it doesn't seem to pick an SVG MIME type (image/xml+svg) using the same logic. See http://ericportis.com/etc/type-svg-test/ In Chrome/Blink there was a similar bug where SVG wasn't considered a supported *image* MIME type, since it's XML. It is now fixed in Chrome 39.
Comment 1•10 years ago
|
||
Yeah, in HTMLImageElement::TryCreateResponsiveSelector we call imgLoader::SupportImageWithMimeType which calls Image::GetDecoderType which only knows about jpeg, gif, png, bmp, ico, icon. That's what other consumers of SupportImageWithMimeType want, because they're switching between image and document (<iframe> and <object>). But that's not what we want here. Inside imagelib itself, GetDecoderType is only called from RasterImage, and there is an explicit check for the SVG type in ImageFactory::CreateImage for "image/svg+xml", picking VectorImage if so and RasterImage otherwise. Seth, do you want to add some sort of argument to SupportImageWithMimeType to indicate whether SVG should be considered an image type, or just add an explicit check for "image/svg+xml" in the HTMLImageElement code?
Flags: needinfo?(seth)
Assignee | ||
Comment 2•10 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #1) > Seth, do you want to add some sort of argument to SupportImageWithMimeType > to indicate whether SVG should be considered an image type, or just add an > explicit check for "image/svg+xml" in the HTMLImageElement code? I suppose I think it's marginally cleaner to support it in SupportImageWithMimeType. I'll work up a patch.
Flags: needinfo?(seth)
Updated•10 years ago
|
Assignee: nobody → seth
Assignee | ||
Comment 3•10 years ago
|
||
This needs a test, but I'll go ahead and upload the patch now.
Attachment #8532161 -
Flags: review?(bzbarsky)
Comment 4•10 years ago
|
||
Comment on attachment 8532161 [details] [diff] [review] (Part 1) - Make imgLoader::SupportImageWithMimeType optionally support image/svg+xml An enum would probably be more self-documenting than a boolean argument.... r=me
Attachment #8532161 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 5•10 years ago
|
||
Here's the test. I added two variants of the test, one with a |type| attribute and one without, because it looked to me like the code paths are somewhat different.
Attachment #8532197 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 6•10 years ago
|
||
Thanks for the review! (In reply to Boris Zbarsky [:bz] from comment #4) > Comment on attachment 8532161 [details] [diff] [review] > (Part 1) - Make imgLoader::SupportImageWithMimeType optionally support > image/svg+xml > > An enum would probably be more self-documenting than a boolean argument.... > > r=me I was on the fence about it myself; I'll switch it out.
Assignee | ||
Comment 7•10 years ago
|
||
Addressed review comments.
Assignee | ||
Updated•10 years ago
|
Attachment #8532161 -
Attachment is obsolete: true
Assignee | ||
Comment 8•10 years ago
|
||
Try job here: https://tbpl.mozilla.org/?tree=Try&rev=e8f8258737c1
Comment 9•10 years ago
|
||
Comment on attachment 8532197 [details] [diff] [review] (Part 2) - Add a test for SVG-as-image in picture elements r=me. Thank you!
Attachment #8532197 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 10•10 years ago
|
||
Thanks for the review! Pushed: remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/019d55dc6783 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/cbba93f5833b
Comment 11•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/019d55dc6783 https://hg.mozilla.org/mozilla-central/rev/cbba93f5833b
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•