NEW 264448
[CSS-Sizing] Block size with max-content and min-content in a RenderBox.cpp
https://bugs.webkit.org/show_bug.cgi?id=264448
Summary [CSS-Sizing] Block size with max-content and min-content in a RenderBox.cpp
Ahmad Saleem
Reported 2023-11-08 15:28:56 PST
Hi Team, This is about other partial portion of changes from Blink Commit in 'RenderBox.cpp' (from bug 261986 - in 'See Also'): Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/3a0c4adda19bade345ca115fdcfe825acf0b8869 ___ NOTE - In local testing, it progress following tests from WPT: hori-block-size-small-or-larger-than-container-with-min-or-max-content-1.html intrinsic-percent-replaced-dynamic-002.html intrinsic-percent-replaced-dynamic-003.html intrinsic-percent-replaced-dynamic-004.html intrinsic-percent-replaced-dynamic-006.html intrinsic-percent-replaced-dynamic-009.html intrinsic-percent-replaced-dynamic-010.html vert-block-size-small-or-larger-than-container-with-min-or-max-content-1.html ___ Although I think it also regress another one but it could be due to a lot of other changes on my test branch as well. Just wanted to raise, so we can merge 'RenderBox.cpp' changes. I will attach my local 'RenderBox.cpp' file or list down all changes with function name (whichever is easier) for reference. Thanks!
Attachments
Patch (5.56 KB, patch)
2024-06-30 06:17 PDT, Ahmad Saleem
no flags
Ahmad Saleem
Comment 1 2023-11-08 15:37:29 PST
All changes in 'RenderBox.cpp': >> RenderBox::constrainLogicalHeightByMinMax (With all changes to compile) LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const { // Note that the values 'min-content', 'max-content' and 'fit-content' should // behave as the initial value if specified in the block direction. const auto& logicalMaxHeight = style().logicalMaxHeight(); std::optional<LayoutUnit> computedLogicalMaxHeight; if (!logicalMaxHeight.isUndefined() && !logicalMaxHeight.isMinContent() && !logicalMaxHeight.isMaxContent() && !logicalMaxHeight.isFitContent()) { computedLogicalMaxHeight = computeLogicalHeightUsing(MaxSize, logicalMaxHeight, intrinsicContentHeight); } MinimumSizeIsAutomaticContentBased minimumSizeType = MinimumSizeIsAutomaticContentBased::No; Length logicalMinHeight = style().logicalMinHeight(); if (logicalMinHeight.isAuto() && shouldComputeLogicalHeightFromAspectRatio() && intrinsicContentHeight && !is<RenderReplaced>(*this) && effectiveOverflowBlockDirection() == Overflow::Visible) { auto heightFromAspectRatio = blockSizeFromAspectRatio(borderAndPaddingLogicalWidth(), borderAndPaddingLogicalHeight(), style().logicalAspectRatio(), style().boxSizingForAspectRatio(), logicalWidth(), style().aspectRatioType(), isRenderReplaced()) - borderAndPaddingLogicalHeight(); if (firstChild()) heightFromAspectRatio = std::max(heightFromAspectRatio, *intrinsicContentHeight); logicalMinHeight = Length(heightFromAspectRatio, LengthType::Fixed); minimumSizeType = MinimumSizeIsAutomaticContentBased::Yes; } if (logicalMinHeight.isMinContent() || logicalMinHeight.isMaxContent() || logicalMinHeight.isFitContent()) logicalMinHeight = LengthType::Auto; std::optional<LayoutUnit> computedLogicalMinHeight = computeLogicalHeightUsing(MinSize, logicalMinHeight, intrinsicContentHeight); LayoutUnit maxHeight = computedLogicalMaxHeight ? computedLogicalMaxHeight.value() : LayoutUnit::max(); LayoutUnit minHeight = computedLogicalMinHeight ? computedLogicalMinHeight.value() : LayoutUnit(); if (style().hasAspectRatio()) constrainLogicalMinMaxSizesByAspectRatio(minHeight, maxHeight, logicalHeight, minimumSizeType, ConstrainDimension::Height); logicalHeight = std::min(logicalHeight, maxHeight); return std::max(logicalHeight, minHeight); } ___ >> RenderBox::computeLogicalHeightUsing (With all changes to compile) std::optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const { if (is<RenderReplaced>(this)) { if ((heightType == MinSize || heightType == MaxSize) && !replacedMinMaxLogicalHeightComputesAsNone(heightType)) return computeReplacedLogicalHeightUsing(heightType, height) + borderAndPaddingLogicalHeight(); return std::nullopt; } if (std::optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight)) return adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight.value()); return std::nullopt; } ____ >> RenderBox::computePositionedLogicalHeight (With all changes to compile) From Line 4462 onward - 'Calculate constraint equation values for 'max-height'..' const auto& logicalMaxHeight = styleToUse.logicalMaxHeight(); if (!logicalMaxHeight.isUndefined() && !logicalMaxHeight.isMinContent() && !logicalMaxHeight.isMaxContent() && !logicalMaxHeight.isFitContent()) { LogicalExtentComputedValues maxValues; computePositionedLogicalHeightUsing(MaxSize, logicalMaxHeight, containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, logicalTopLength, logicalBottomLength, marginBefore, marginAfter, maxValues); if (computedValues.m_extent > maxValues.m_extent) { computedValues.m_extent = maxValues.m_extent; computedValues.m_position = maxValues.m_position; computedValues.m_margins.m_before = maxValues.m_margins.m_before; computedValues.m_margins.m_after = maxValues.m_margins.m_after; } } // Calculate constraint equation values for 'min-height' case. Length logicalMinHeight = styleToUse.logicalMinHeight(); if (logicalMinHeight.isMinContent() || logicalMinHeight.isMaxContent() || logicalMinHeight.isFitContent()) logicalMinHeight = LengthType::Auto; if (!logicalMinHeight.isZero() || logicalMinHeight.isFillAvailable()) { LogicalExtentComputedValues minValues; computePositionedLogicalHeightUsing(MinSize, logicalMinHeight, containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, logicalTopLength, logicalBottomLength, marginBefore, marginAfter, minValues); ... _____ Just wanted to update here.
Radar WebKit Bug Importer
Comment 2 2023-11-15 15:29:41 PST
Ahmad Saleem
Comment 3 2024-06-30 06:17:04 PDT
Ahmad Saleem
Comment 4 2024-10-23 22:44:57 PDT
Note You need to log in before you can comment on or make changes to this bug.