| Summary: | [CSS-Sizing] Block size with max-content and min-content in a RenderBox.cpp | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> | ||||
| Component: | CSS | Assignee: | Ahmad Saleem <ahmad.saleem792> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | ntim, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | BrowserCompat, InRadar, WPTImpact | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=261986 | ||||||
| Attachments: |
|
||||||
|
Description
Ahmad Saleem
2023-11-08 15:28:56 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. Created attachment 471774 [details]
Patch
|