Closed Bug 1683424 Opened 3 years ago Closed 3 years ago

The aspect ratio used in ComputeSizeWithIntrinsicDimensions() should consider box-sizing if it is from aspect-ratio property

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: boris, Assigned: boris)

References

(Blocks 1 open bug, )

Details

Attachments

(2 files)

Based on the spec definitions, for replaced elements, if aspect-ratio is:

  1. auto
    Replaced elements with a natural aspect ratio use that aspect ratio; otherwise the box has no preferred aspect ratio. Size calculations involving the aspect ratio work with the content box dimensions always.

  2. <ratio>
    The box’s preferred aspect ratio is the specified ratio of width / height. Size calculations involving the aspect ratio work with the dimensions of the box specified by box-sizing.

  3. auto && <ratio>
    If both auto and a <ratio> are specified together, the preferred aspect ratio is the specified ratio of width / height unless it is a replaced element with a natural aspect ratio, in which case that aspect ratio is used instead. In all cases, size calculations involving the aspect ratio work with the content box dimensions always.

So if we use <ratio>, we have to take box-sizing into consideration for replaced elements.

In some cases, the aspect ratio works with box sizing dimensions, and
sometimes it works only with content box dimensions. We need an extra
flag to know this, and handle it well while computing the size in
ratio-dependent axis.

Attachment #9194035 - Attachment description: Bug 1646100 - Add UseBoxSizing for AspectRatio class. → Bug 1683424 - Add UseBoxSizing for AspectRatio class.

If aspect-ratio is '<ratio>', now the aspect-ratio works with box sizing
dimensions for replaced elements.

Assignee: nobody → boris.chiou
Status: NEW → ASSIGNED
Attachment #9194035 - Attachment description: Bug 1683424 - Add UseBoxSizing for AspectRatio class. → Bug 1683424 - Add UseBoxSizing for AspectRatio class, and fix non-replaced element usage.
Blocks: 1684107
Pushed by bchiou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c86f4e7967e3
Add UseBoxSizing for AspectRatio class, and fix non-replaced element usage. r=TYLin
https://hg.mozilla.org/integration/autoland/rev/5dc148186bb2
Take box sizing into account for replaced elements with aspect-ratio. r=TYLin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/27008 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Upstream PR merged by moz-wptsync-bot
Blocks: 1690422
Regressions: 1786568
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: