Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not consider min/max sizes when computing width as flex base size.
https://bugs.webkit.org/show_bug.cgi?id=244394 rdar://99193252 Reviewed by Alan Bujtas. According to the CSS flexbox spec, when we compute the base size for flex items, we want to ignore the min and max main sizes of the item. This is because these values will be used to compute the hypothetical main size instead, The hypothetical main size will be computed using the base size and clamping it in between the min and max main sizes. This patch focuses specifically on the case when the main size is in the inline axis (i.e. logical width). In order to accomplish this, we need to keep track of when we are computing base sizes in the flex algorithm. The m_isComputingBaseSizes member will keep track of this and will be set/unset using the SetForScope class. Then, whenever we compute the width of an item, we will check to see if it is a flex item and if it is currently being computed as a flex base size. A little more work may be required to add the same type of logic to the block axis. When attempting to do this in an initial implementation, other test cases that started failing. It seems like that will require an additional patch. Spec: https://www.w3.org/TR/css-flexbox-1/#algo-main-item * LayoutTests/TestExpectations: * Source/WebCore/rendering/RenderBox.cpp: (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth const): (WebCore::RenderBox::shouldIgnoreMinMaxSizes const): * Source/WebCore/rendering/RenderBox.h: * Source/WebCore/rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computeFlexBaseSizeForChild): * Source/WebCore/rendering/RenderFlexibleBox.h: (WebCore::RenderFlexibleBox::isComputingBaseSizes const): * Source/WebCore/rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computePreferredLogicalWidths): Canonical link: https://commits.webkit.org/255002@main
- Loading branch information
Showing 6 changed files with 17 additions and 3 deletions.