Open Bug 1094609 Opened 11 years ago Updated 3 years ago

Honor "object-fit" and "object-position" for nsLayoutUtils::DrawSingleImage() code-paths for <svg:image>

Categories

(Core :: Layout, defect)

defect

Tracking

()

REOPENED

People

(Reporter: dholbert, Unassigned)

References

()

Details

nsLayoutUtils::DrawSingleImage() is an all-in-one "draw me this image" function, which we use in a few places for different things. My patches for bug 624647 will not make this particular function aware of "object-fit" & "object-position" -- I'm punting that to this bug. Specifically, we only want to honor these properties in DrawSingleImage() *if we're drawing a replaced element*. Based on http://mxr.mozilla.org/mozilla-central/search?string=drawsingleimage , it looks like there are only three DrawSingleImage() callers for replaced elements: a) The SVG <image> element b) The XUL <image> element c) The HTML <img> element's alt-feedback icon. ..and then a two callers that are not for replaced elements (for bullets & border-images). I'm pretty sure we should honor "object-fit" on the SVG & XUL <image> elements. I'm not as sure about (c), though -- the <img> element's alt feedback (for e.g. image-failed-to-load icons); that's not as useful of a behavior to expose, and it might be surprising/unexpected if author styling affected the rendering of that icon.
(In reply to Daniel Holbert [:dholbert] from comment #0) > I'm not as sure about (c), though -- the <img> element's alt > feedback (for e.g. image-failed-to-load icons); that's not as useful of a > behavior to expose, and it might be surprising/unexpected if author styling > affected the rendering of that icon. For comparison, it looks like Chrome doesn't honor "object-fit" on <img> alt feedback icons, judging by the lack of icon-scaling in this example: data:text/html,<img src="data:" style="width: 300px; height: 300px; object-fit: fill">
Summary: Honor "object-fit" and "object-position" for nsLayoutUtils::DrawSingleImage() code-paths → Honor "object-fit" and "object-position" for nsLayoutUtils::DrawSingleImage() code-paths for replaced elements (<svg:image>, <xul:image>)
Flags: needinfo?(dholbert)
(In reply to Daniel Holbert [:dholbert] from comment #1) > (In reply to Daniel Holbert [:dholbert] from comment #0) > > I'm not as sure about (c), though -- the <img> element's alt > > feedback (for e.g. image-failed-to-load icons); that's not as useful of a > > behavior to expose, and it might be surprising/unexpected if author styling > > affected the rendering of that icon. > > For comparison, it looks like Chrome doesn't honor "object-fit" on <img> alt > feedback icons, judging by the lack of icon-scaling in this example: > data:text/html,<img src="data:" style="width: 300px; height: 300px; > object-fit: fill"> Does that feedback icon actually count as being the content there? It seems to me part and parcel of the "content to be replaced"; the placeholder for the image. In that case, it would make sense that object-fit wouldn't apply to it.
Yeah, I agree; it doesn't seem like these properties should apply to placeholder images. (If they did apply, it'd probably just cause trouble/confusion. e.g. If an author had a specific "object-*" configuration to position a particular part of a photo in an <img>'s content-box, and the photo is missing or has errors, then it would look pretty broken if we just showed the comparable part of the feedback-icon -- which is sort of what would happen if we let these properties apply.) So I think <xul:image> and <svg:image> are the only things needing fixing here.
Soooo, anyone got any progress on this one? I could really use this working with <xul:image>.
Depends on: 1170052

Given our plans to move away from XUL and remove its implementation as soon as we can (bug 1563415 etc), we won't be making further improvements/changes to XUL codepaths at this point. So, that makes this a WONTFIX.

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(dholbert)
Resolution: --- → WONTFIX

Er, I guess this bug covers <svg:image> as well, which we do still support (unlike xul:image). I'll reopen and narrow the scope to just cover that usage (assuming there's still improvements needed there).

Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Summary: Honor "object-fit" and "object-position" for nsLayoutUtils::DrawSingleImage() code-paths for replaced elements (<svg:image>, <xul:image>) → Honor "object-fit" and "object-position" for nsLayoutUtils::DrawSingleImage() code-paths for <svg:image>
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.