Add an imgIContainer API to return pixel-valued height/width together, with failure differentiated from missing intrinsic size
Categories
(Core :: Graphics: ImageLib, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox140 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
Attachments
(3 files)
In bug 1935269, HTMLImageElement::NaturalSize() needs to query for an image's intrinsic height and width in a fallible way (i.e. with graceful fallback when an attribute is missing), and we need to differentiate between "the image lacks an intrinsic size in that axis" vs. "the image is in an error state".
Right now, GetWidth and GetHeight don't let us differentiate between those states, so I'm filing this bug to add a new API that does let us differentiate between them (and return both dimensions together so that we don't need to redundantly check for error states etc.)
Assignee | ||
Comment 1•11 days ago
|
||
This patch doesn't change behavior; it just refactors out some commont logic
into a helper (so that we can add another call to this same helper in a later
patch in this series).
Assignee | ||
Comment 2•11 days ago
|
||
This is mostly just a convenience shorthand to avoid running the same
boilerplate/error-checking code in the implementation of the 'width' and
'height' attributes, for the benefit of callers that need both sizes. But,
beyond that convenience: this also lets us elegantly express the case where an
image simply lacks an intrinsic width and/or height (not due to any error, but
simply because it's e.g. an SVG that has no preferred size in either or both of
its axes). This is a state we'll need to be able to detect and give special
treatment to in a forthcoming patch for bug 1935269.
Assignee | ||
Comment 3•11 days ago
|
||
This just demonstrates/tests proper use of the new API.
https://hg.mozilla.org/mozilla-central/rev/617bee1ed840
https://hg.mozilla.org/mozilla-central/rev/b2e62e739ed4
https://hg.mozilla.org/mozilla-central/rev/dc95348f17c0
Description
•