[webkit-changes] [WebKit/WebKit] cea696: [Grid] Expand running repeatTracksSizingIfNeeded.
Sammy Gill
noreply at github.com
Thu Aug 15 08:29:08 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cea6964cf434e0c4b801dcb4d63361b88759b475
https://github.com/WebKit/WebKit/commit/cea6964cf434e0c4b801dcb4d63361b88759b475
Author: Sammy Gill <sammy.gill at apple.com>
Date: 2024-08-15 (Thu, 15 Aug 2024)
Changed paths:
M LayoutTests/TestExpectations
M Source/WebCore/rendering/GridLayoutFunctions.cpp
M Source/WebCore/rendering/GridLayoutFunctions.h
M Source/WebCore/rendering/GridLayoutState.h
M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
M Source/WebCore/rendering/GridTrackSizingAlgorithm.h
M Source/WebCore/rendering/RenderBox.cpp
M Source/WebCore/rendering/RenderBox.h
M Source/WebCore/rendering/RenderGrid.cpp
M Source/WebCore/rendering/RenderGrid.h
Log Message:
-----------
[Grid] Expand running repeatTracksSizingIfNeeded.
https://bugs.webkit.org/show_bug.cgi?id=260288
rdar://113984672
Reviewed by Alan Baradlay.
The grid spec states that we may need to rerun column or row track
sizing if the min content contributions in the relevant dimension
change for the grid item. In fact, the spec actually calls our a few
different scenarios for rerunning column sizing specifically:
1.) Wrapped column flex containers
2.) Orthogonal flows
3.) Multi-column containers
4.) Items with an aspect-ratio (or with a child with an aspect ratio)
whose size depends on the size of the row
Currently it seems like grid repeats column and row track sizing for
2 and partially 4 (it only considers the grid items themselves). The way
this is done is by keeping track of various state on the renderer and
then querying the state to determine if we should run repeatTracksSizingIfNeeded.
This patch expands the code guarding the track sizing repetition by
implementing a helper function called isGridItemInlineSizeDependentOnBlockConstraints.
Besides the already existing cases that are considered, this adds
support for 1, 3, and the remainder of 4.
Later on we check to see if this ItemLayoutRequirement was set in
the second column pass of GridTrackSizingAlgorithm and recompute the
grid item's min content inline size if it is. This ends up fixing
grid-item-inline-contribution-003 because the grid item's child ends up
changing the min content contribution of the item.
I also removed m_hasAnyOrthogonalItem since it was only used for this
purpose and is being handled by the new logic and GridLayoutState.
* LayoutTests/TestExpectations:
* Source/WebCore/rendering/GridLayoutFunctions.cpp:
(WebCore::GridLayoutFunctions::isGridItemInlineSizeDependentOnBlockConstraints):
(WebCore::GridLayoutFunctions::setOverridingContentSizeForGridItem):
(WebCore::GridLayoutFunctions::clearOverridingContentSizeForGridItem):
* Source/WebCore/rendering/GridLayoutFunctions.h:
* Source/WebCore/rendering/GridLayoutState.h:
(WebCore::GridLayoutState::needsSecondTrackSizingPass const):
(WebCore::GridLayoutState::setNeedsSecondTrackSizingPass):
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithmStrategy::minContentForGridItem const):
* Source/WebCore/rendering/GridTrackSizingAlgorithm.h:
(WebCore::GridTrackSizingAlgorithmStrategy::sizingState const):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const):
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::repeatTracksSizingIfNeeded):
(WebCore::RenderGrid::computeLayoutRequirementsForItemsBeforeLayout const):
* Source/WebCore/rendering/RenderGrid.h:
Canonical link: https://commits.webkit.org/282292@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list