Closed Bug 1639963 Opened 4 years ago Closed 4 years ago

Implement aspect-ratio for basic blocks and replaced elements

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: boris, Assigned: boris)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(12 files, 2 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

Let aspect-ratio support the basic block cases in this bug (excluding flex and grid).
There are some tentative wpts there, so we could use them as the first draft version.

Keywords: dev-doc-needed

Will set the correct return value in the latter patch.

Attachment #9155411 - Attachment description: Bug 1639963 - Apply Automatic Content-based Minimum Sizes for aspect-ratio. → Bug 1639963 - Apply Automatic content-based minimum sizes for aspect-ratio.
Attachment #9156022 - Attachment description: Bug 1639963 - Drop redundant check of auto. → Bug 1639963 - Drop redundant check of auto in nsImageFrame.

This should be very simliar with <object> with image example.
We use nsImageFrame to represent this embed element.

Just make sure wpt covers all the typical replaced elements, based on
MDN (https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element).

Summary: Implement aspect-ratio for basic blocks → Implement aspect-ratio for basic blocks and replaced elements

This is related to the spec issue:
https://github.com/w3c/csswg-drafts/issues/4572.

We could revert this patch or update the condition once this spec issue
has been resolved.

Attachment #9157016 - Attachment is obsolete: true
Attachment #9155409 - Attachment is obsolete: true
Attachment #9156443 - Attachment description: Bug 1639963 - Add one extra wpt for HTML embed element. → Bug 1639963 - Add extra wpts for HTML embed element.
Status: NEW → ASSIGNED

Basically, we treat aspect-ratio (together with inline size) as a
non-auto block size. This means the block is not empty when using
aspect-ratio.

Also, add 3 tentative wpts for this, based on the current spec issue
examples.

https://github.com/w3c/csswg-drafts/issues/5328

See Also: → 1656081
Depends on: 1656081
See Also: 1656081
Attachment #9156080 - Attachment description: Bug 1639963 - Support aspect-ratio for svg object. → Bug 1639963 - Support aspect-ratio for svg object and iframe (i.e. nsSubDocumentFrame).
Blocks: 1651776
Pushed by bchiou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8cb2a9e57cba Calculate inline size and block size based on aspect-ratio. r=emilio https://hg.mozilla.org/integration/autoland/rev/a5e9b2bede3a Fix margin collapsing with aspect-ratio. r=emilio https://hg.mozilla.org/integration/autoland/rev/b7f8a00c7278 Update the API of nsIFrame::ComputeSize for aspect-ratio. r=emilio https://hg.mozilla.org/integration/autoland/rev/c26b41b07084 Apply Automatic content-based minimum sizes for aspect-ratio. r=emilio https://hg.mozilla.org/integration/autoland/rev/8e3ff3f26946 Drop redundant check of auto in nsImageFrame. r=emilio https://hg.mozilla.org/integration/autoland/rev/a37073226eb7 Define the default size for replaced elements. r=dholbert https://hg.mozilla.org/integration/autoland/rev/8326d6db2755 Support aspect-ratio for video element. r=dholbert https://hg.mozilla.org/integration/autoland/rev/802185dc6fff Support aspect-ratio for svg object and iframe (i.e. nsSubDocumentFrame). r=emilio https://hg.mozilla.org/integration/autoland/rev/00fac1d4990f Support aspect-ratio for svg frames. r=emilio https://hg.mozilla.org/integration/autoland/rev/15dfbfd21a51 Support aspect-ratio for HTML canvas. r=emilio https://hg.mozilla.org/integration/autoland/rev/2da97f87cae2 Add extra wpts for HTML embed element. r=dholbert
Failed to create upstream wpt PR due to merge conflicts. This requires fixup from a wpt sync admin.

(In reply to Web Platform Test Sync Bot (Matrix: #interop:mozilla.org) from comment #16)

Failed to create upstream wpt PR due to merge conflicts. This requires fixup
from a wpt sync admin.

Google added two new tests last week:
replaced-element-013.tentative.html
replaced-element-014.tentative.html

Maybe we have to update the file names in this bug because I also add some for replaced elements.

@jgraham, what is the expected way to fix this issue? I think it is just a name collision. Basically, just rename these files in my patch:

from:
replaced-element-013.tentative.html
replaced-element-014.tentative.html
replaced-element-015.tentative.html
replaced-element-016.tentative.html
replaced-element-017.tentative.html
replaced-element-018.tentative.html
replaced-element-019.tentative.html

to:
replaced-element-015.tentative.html
replaced-element-016.tentative.html
replaced-element-017.tentative.html
replaced-element-018.tentative.html
replaced-element-019.tentative.html
replaced-element-020.tentative.html
replaced-element-021.tentative.html

Flags: needinfo?(james)

Can you push another commit with those changes to this bug? Then I can deal with the rest.

Sure. Working on this.

I just push the commit and add you as the reviewer (and I guess we should make it landed into m-c). Thanks for handling this.

Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/b77345b53a86 Tweak wpt file names to fix the merge conflicts. r=jgraham
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/25180 for changes under testing/web-platform/tests
Flags: needinfo?(james)
Upstream PR merged by moz-wptsync-bot

Added to Experimental Features page, BCD is process of updating, and made some light edits to the aspect-ratio MDN page.

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

Attachment

General

Created:
Updated:
Size: