Closed Bug 1656081 Opened 4 years ago Closed 4 years ago

Use ComputeSizeWithIntrinsicDimensions for iframe in nsSubDocumentFrame::ComputeSize()

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: boris, Assigned: emilio)

References

Details

Attachments

(1 file)

I notice we are using nsIFrame::ComputeSize() for iframe (example) in nsSubDocumentFrame::ComputeSize(). Based on the comment in Bug 1639963, we should always call into ComputeSizeWithIntrinsicDimensions because iframe is a replaced element and we have some assumptions for replaced element, e.g. 300x150 default intrinsic size.

See Also: → 294086
Assignee: nobody → emilio
Status: NEW → ASSIGNED
Depends on: 1656281
Blocks: 1639963
See Also: 1639963
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e6fa159738fa Cleanup iframe sizing so that it does the same as every other replaced element. r=boris
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch

Are you sure this is correct? My understanding is that things are specified so that iframes do not have intrinsic dimensions, and 300x150 is the size that you get when a replaced element has no intrinsic dimensions.

(In reply to David Baron :dbaron: 🏴󠁵󠁳󠁣󠁡󠁿 ⌚UTC-8 from comment #4)

Are you sure this is correct? My understanding is that things are specified so that iframes do not have intrinsic dimensions, and 300x150 is the size that you get when a replaced element has no intrinsic dimensions.

I think it is correct, yeah. Compare the rendering of:

data:text/html,<div style="border: 2px solid blue; width: min-content"><svg style="background: purple"></svg></div>

The div is zero-width in Gecko, because the SVG has no intrinsic dimensions (though in fairness Blink and WebKit render as if the svg had intrinsic dimensions, we disagree with them here).

But in any case that's not our current behavior (both with and without this patch) with <iframes>, see:

data:text/html,<div style="border: 2px solid blue; width: min-content"><iframe></iframe></div>

Where the <iframe> actually behaves as if it had an intrinsic size. My patch preserves this behavior in pretty much all cases. The cases where I know this patch changes behavior, mostly related to grid item stretching special behavior for replaced elements, now match other browsers.

I guess more than "it's correct" I should say "matches our existing behavior".

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: