Skip to content

Commit

Permalink
[css-grid] Small cleanup patch
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=272458

Reviewed by Tim Nguyen.

A few things I have noticed when working in Grid these last few weeks.

* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::rawGridTrackSize const):
(WebCore::distributeItemIncurredIncreases):
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeIntrinsicLogicalWidths const):

Canonical link: https://commits.webkit.org/277316@main
  • Loading branch information
stwrt committed Apr 10, 2024
1 parent eab2b21 commit cd08370
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const GridTrackSize& GridTrackSizingAlgorithm::rawGridTrackSize(GridTrackSizingD
unsigned autoTrackStylesSize = autoTrackStyles.size();
if (untranslatedIndexAsInt < 0) {
int index = untranslatedIndexAsInt % static_cast<int>(autoTrackStylesSize);
// We need to traspose the index because the first negative implicit line will get the last defined auto track and so on.
// We need to transpose the index because the first negative implicit line will get the last defined auto track and so on.
index += index ? autoTrackStylesSize : 0;
ASSERT(index >= 0);
return autoTrackStyles[index];
Expand Down Expand Up @@ -589,7 +589,7 @@ static void distributeItemIncurredIncreases(Vector<WeakPtr<GridTrack>>& tracks,
}
for (uint32_t i = 0; i < tracksSize; ++i) {
// Sorting is not needed for TrackSizeComputationVariant::CrossingFlexibleTracks, since all tracks have an infinite growth potential.
ASSERT(tracks[i]->growthLimitIsInfinite());
ASSERT(tracks[i]->growthLimitIsInfinite());
distributeItemIncurredIncreaseToTrack<phase, limit>(*tracks[i], freeSpace, fractionsOfRemainingSpace[i]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ void RenderGrid::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
m_grid.m_currentGrid = std::ref(grid);
GridTrackSizingAlgorithm algorithm(this, grid);
// placeItemsOnGrid isn't const since it mutates our grid, but it's safe to do
// so here since we've overriden m_currentGrid with a stack based temporary.
// so here since we've overridden m_currentGrid with a stack based temporary.
const_cast<RenderGrid&>(*this).placeItemsOnGrid(std::nullopt);

performPreLayoutForGridItems(algorithm, ShouldUpdateGridAreaLogicalSize::No);
Expand Down

0 comments on commit cd08370

Please sign in to comment.