Permalink
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.
Browse files
[css-flexbox] Improve & simplify the flex-basis computation
https://bugs.webkit.org/show_bug.cgi?id=230755 Reviewed by Manuel Rego Casasnovas. Source/WebCore: The flex-basis computation code was a bit convoluted. It had some pre-computations for items with intrinsic main size that were causing several issues due to reentrancy. Actually those computations where not needed at all for the flex basis computation but for a later stage, the computation of the hyphotetical main size in which we need to compute 'min-{width|height}: auto'. That's why the code that was executed before the flex-basis computation is now part of computeFlexItemMinMaxSizes(). As we are no longer doing a layout before computing the flex-basis, a layout has to be added to those cases in which the main size is the block size of the child. Apart from that the flex-basis computation uses a newly defined RAII class to set the main size of the item to the value specified by flex-basis which is what the specs mandate. Last but not least, the computeInnerFlexBaseSizeForChild() method was renamed to computeFlexBaseSizeForChild() which fits better with the terminology used in the specs. Flex basis computation is already covered by the WPT test suite, there is no need for extra tests. This patch fixes the only flex-basis-* test case that was not passing. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild): Removed obsolete comment. Added a layoutIfNeeded() as we cannot be sure that the item was already laid out any more. (WebCore::ScopedFlexBasisAsMainSize::ScopedFlexBasisAsChildMainSize): New RAII class. (WebCore::ScopedFlexBasisAsMainSize::~ScopedFlexBasisAsChildMainSize): (WebCore::RenderFlexibleBox::computeFlexBaseSizeForChild): Renamed from computeInnerFlexBaseSizeForChild. (WebCore::RenderFlexibleBox::computeFlexItemMinMaxSizes): Added relayoutChildren parameter. (WebCore::RenderFlexibleBox::constructFlexItem): Moved code to computeFlexItemMinMaxSizes(). (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): Deleted. * rendering/RenderFlexibleBox.h: LayoutTests: * TestExpectations: Unskipped flex-basis-011.html which is now working fine. Canonical link: https://commits.webkit.org/243144@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
5 changed files
with
123 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters