[webkit-changes] [WebKit/WebKit] 6bd29f: Initial implementation margin-trim for block conta...

Sammy Gill noreply at github.com
Wed Jan 4 16:35:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6bd29f7cff747f7bb1c9965e4b08e52099f204ee
      https://github.com/WebKit/WebKit/commit/6bd29f7cff747f7bb1c9965e4b08e52099f204ee
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-01-04 (Wed, 04 Jan 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-001-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-001.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-002-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-002.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-001-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-001.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-002-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-002.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-001-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-001.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-002-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-002.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-non-adjoining-item-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-non-adjoining-item.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-end-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-end.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-start-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-start.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block.html
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBlockFlow.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h

  Log Message:
  -----------
  Initial implementation margin-trim for block containers (without floats and margin collapsing).
https://bugs.webkit.org/show_bug.cgi?id=249206
rdar://103285722

Reviewed by Alan Baradlay.

Adds the  initial logic for margin-trim support in block containers when
there are no floats or collapsing margins. Support for both of these will
be done in their own patches.

A virtual method named shouldTrimChildMargin was added to help determine
if a box's block start or block end margin should be trimmed.
RenderBlockFlows defines its own version which checks a couple of things:
1.) That the box passed in is a block level box
2.) Whether the passed in MarginTrimType is set for the margin trim
property and if the child is either the first in flow child box (for
BlockStart) or the last in flow child box (for BlockEnd).

Spec reference: https://drafts.csswg.org/css-box-4/#margin-trim-block

* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-end-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-start-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-non-adjoining-item-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-non-adjoining-item.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-end-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-end.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-start-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block-start.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-replaced-block.html: Added.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::shouldTrimChildMargin const):
* Source/WebCore/rendering/RenderBlockFlow.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::computeBlockDirectionMargins const):
(WebCore::RenderBox::constrainBlockMarginInAvailableSpaceOrTrim const):
* Source/WebCore/rendering/RenderBox.h:
(WebCore::RenderBox::shouldTrimChildMargin const):

Canonical link: https://commits.webkit.org/258457@main




More information about the webkit-changes mailing list