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)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1149357
Tracking Status
firefox45 --- affected

People

(Reporter: zcorpan, Unassigned)

Details

(Whiteboard: [tw-dom])

Attachments

(1 file)

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.
Flags: needinfo?(josh)
Attached file testcase 1
(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.)
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.
If layout code is where the problem lies, I'm not a good candidate to look at this.
Flags: needinfo?(josh)
Whiteboard: [tw-dom]
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.
Product: Core → Core Graveyard
Product: Core Graveyard → Core
Severity: normal → S3

All the images are the same size now.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
Duplicate of bug: 1149357
Resolution: WORKSFORME → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: