Closed
Bug 1231355
Opened 10 years ago
Closed 3 years ago
SVG with only width OR height does not apply img srcset 2x descriptor
Categories
(Core :: Layout: Images, Video, and HTML Frames, defect)
Core
Layout: Images, Video, and HTML Frames
Tracking
()
RESOLVED
DUPLICATE
of bug 1149357
| Tracking | Status | |
|---|---|---|
| firefox45 | --- | affected |
People
(Reporter: zcorpan, Unassigned)
Details
(Whiteboard: [tw-dom])
Attachments
(1 file)
|
655 bytes,
text/html
|
Details |
See https://github.com/w3c/web-platform-tests/pull/2418
<img srcset="data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20width='20'><circle%20r='1'/></svg> 2x" data-expect="10">
<img srcset="data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20height='20'><circle%20r='1'/></svg> 2x" data-expect="10">
Gecko renders these as 20x20 instead of 10x10. Works OK if the SVG specifies both width and height attributes.
Updated•10 years ago
|
Flags: needinfo?(josh)
Comment 1•10 years ago
|
||
(Here's a testcase built from test code in comment 0.
Chrome 48 DevEdition renders all 3 img elements the same size. Firefox 45 Nightly renders the first 2 images larger than the 3rd.)
Comment 2•10 years ago
|
||
For the first two images in testcase 1, either imgIContainer::GetWidth or GetHeight will fail, and I think imgIContainer::GetIntrinsicSize will fail as well (since we only have one intrinsic dimension).
imgIContainer::GetIntrinsicRatio will succeed, though (since we have a viewBox attribute, which gives us an intrinsic ratio). That, combined with the attribute that is present, can be used to infer the other dimension if desired, at whatever callsite matters for this bug.
Comment 3•10 years ago
|
||
If layout code is where the problem lies, I'm not a good candidate to look at this.
Flags: needinfo?(josh)
Updated•9 years ago
|
Whiteboard: [tw-dom]
Comment 4•9 years ago
|
||
I use this sample to describe my finding
http://daoshengmu.github.io/layout-sample/svg/bug1231355/
At ResponsiveImageSelector::SetCandidatesFromSourceSet, the parse and select src candidate are correct to 4x.
HTMLImageElement::BindToTree also check the responsive context correctly.
I think the issue is happened at VectorImage. I list some stats in my experiment:
wxh Instrinsic size ratio width height
20x? 1200 -1 2 2 30 31
? x 20 -1 1200 30 31 30 31
20x20 1200 1200 20 20 20 20
Hope that would be help.
Updated•7 years ago
|
Product: Core → Core Graveyard
Updated•7 years ago
|
Product: Core Graveyard → Core
Updated•3 years ago
|
Severity: normal → S3
Comment 5•3 years ago
|
||
All the images are the same size now.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
Comment 6•3 years ago
|
||
Looks like this was fixed by (and essentially a dupe of) bug 1149357.
Duplicate of bug: 1149357
Resolution: WORKSFORME → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•