Bug 253610 - [margin-trim] Trimmed block-end margins for block-level boxes in a block container should be reflected in computed style
Summary: [margin-trim] Trimmed block-end margins for block-level boxes in a block cont...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sammy Gill
URL:
Keywords: InRadar
Depends on:
Blocks: 253454 255736
  Show dependency treegraph
 
Reported: 2023-03-08 15:11 PST by Sammy Gill
Modified: 2023-04-25 20:08 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sammy Gill 2023-03-08 15:11:16 PST
The web inspector shows the untrimmed margins for a box even if has been trimmed by the containing block's margin-trim property.
Comment 1 Radar WebKit Bug Importer 2023-03-08 15:11:43 PST
<rdar://problem/106454992>
Comment 2 Sammy Gill 2023-03-09 14:32:07 PST
This scenario is actually slightly more tricky than the block-start one. 

By the time we get to the end of the block container, we have propagated some margin information from the top that will be used to determine the final margin of the block container. At this point we actually haven’t trimmed any of the block-end margins of the children (the m_marginBox in the renderer still contains the used value of the margin), but we only consider the propagated value to update/trim the block containers block-end margin.

I think in order for this to be correct, we need to walk back up the container's children and trim the block-end margins (and block-start if the child is self collapsing) until we get to a child that is not self collapsing.

I think this means that we also need to update the position for the self-collapsing children, which may be just below the first non self-collapsing child.
Comment 3 Sammy Gill 2023-04-20 09:45:21 PDT
Pull request: https://github.com/WebKit/WebKit/pull/12977
Comment 4 Sammy Gill 2023-04-24 20:51:04 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/39673
Comment 5 EWS 2023-04-25 20:08:30 PDT
Committed 263398@main (e44bd7f346a1): <https://commits.webkit.org/263398@main>

Reviewed commits have been landed. Closing PR #12977 and removing active labels.