-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement margin-trim for flexbox. #8166
Merged
webkit-early-warning-system
merged 1 commit into
WebKit:main
from
sammygill:eng/margin-trim-Implement-margin-trim-for-flex-containers
Jan 6, 2023
Merged
Implement margin-trim for flexbox. #8166
webkit-early-warning-system
merged 1 commit into
WebKit:main
from
sammygill:eng/margin-trim-Implement-margin-trim-for-flex-containers
Jan 6, 2023
Commits on Jan 6, 2023
-
Implement margin-trim for flexbox.
https://bugs.webkit.org/show_bug.cgi?id=249208 rdar://103285847 Reviewed by Alan Baradlay. Adds support for the margin-trim property on flexbox containers. Depending on the values that are set for this property, it will trim the corresponding edges of the flex items that are adjacent to those edges of the container. In order to achieve this, a new data structure, m_marginTrimItems, was added to RenderFlexibleBox. This structure simply holds the items that are trimmed according to their location in the flexbox. The first step of this algorithm is to trim the edges of the first and last child of the flexbox. This is done so that RenderFlexibleBox::computeIntrinsicLogicalWidths does not incorrectly take these margins into consideration when computing the width of the flexbox under a min/max content constraint. In order to figure out which items are actually being trimmed, we cannot perform any trimming until the flex lines are created. As the lines get created in FlexLayoutAlgorithm::computeNextFlexLine, we can trim the main axis margins of the first and last items. This will require not only updating the object's MarginBox but also the main axis sizing information of the flex item itself. In order to do this, we need to make FlexItem's mainAxisMargin mutable. After the line has been constructed, we can trim the cross axis margins of the items if the line is either the first line or last line of the flexbox. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-block-end-trimmed-only-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-block-end-trimmed-only.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-block-start-trimmed-only-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-block-start-trimmed-only.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-block-trimmed-only-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-block-trimmed-only.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-block-multiline-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-block-multiline.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-grow-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-grow.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-inline-multiline-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-inline-multiline.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-orthogonal-item-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-orthogonal-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-shrink-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-column-shrink.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-inline-end-trimmed-only-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-inline-end-trimmed-only.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-inline-start-trimmed-only-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-inline-start-trimmed-only.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-inline-trimmed-only-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-inline-trimmed-only.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-block-multiline-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-block-multiline.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-grow-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-grow.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-inline-multiline-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-inline-multiline.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-orthogonal-item-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-orthogonal-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-shrink-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-row-shrink.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-trim-all-margins-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-trim-all-margins.html: Added. * LayoutTests/platform/mac/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-template-expected.txt: Added. * Source/WebCore/rendering/FlexibleBoxAlgorithm.cpp: (WebCore::FlexLayoutAlgorithm::FlexLayoutAlgorithm): (WebCore::FlexLayoutAlgorithm::canFitItemWithTrimmedMarginEnd const): (WebCore::FlexLayoutAlgorithm::removeMarginEndFromFlexSizes const): (WebCore::FlexLayoutAlgorithm::computeNextFlexLine): * Source/WebCore/rendering/FlexibleBoxAlgorithm.h: (WebCore::FlexLayoutAlgorithm::isMultiline const): * Source/WebCore/rendering/RenderBlock.cpp: (WebCore::RenderBlock::marginIntrinsicLogicalWidthForChild const): * Source/WebCore/rendering/RenderBox.cpp: (WebCore::RenderBox::computeLogicalWidthInFragment const): (WebCore::RenderBox::fillAvailableMeasure const): (WebCore::RenderBox::computeOrTrimInlineMargin const): (WebCore::RenderBox::computeInlineDirectionMargins const): * Source/WebCore/rendering/RenderBox.h: * Source/WebCore/rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutBlock): (WebCore::RenderFlexibleBox::initializeMarginTrimState): (WebCore::RenderFlexibleBox::shouldTrimChildMargin const): (WebCore::RenderFlexibleBox::shouldTrimMainAxisMarginStart const): (WebCore::RenderFlexibleBox::shouldTrimMainAxisMarginEnd const): (WebCore::RenderFlexibleBox::shouldTrimCrossAxisMarginStart const): (WebCore::RenderFlexibleBox::shouldTrimCrossAxisMarginEnd const): (WebCore::RenderFlexibleBox::trimMainAxisMarginStart): (WebCore::RenderFlexibleBox::trimMainAxisMarginEnd): (WebCore::RenderFlexibleBox::trimCrossAxisMarginStart): (WebCore::RenderFlexibleBox::trimCrossAxisMarginEnd): (WebCore::RenderFlexibleBox::layoutFlexItems): * Source/WebCore/rendering/RenderFlexibleBox.h: Canonical link: https://commits.webkit.org/258563@main
Configuration menu - View commit details
-
Copy full SHA for 0efe67f - Browse repository at this point
Copy the full SHA 0efe67fView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.