[webkit-changes] [WebKit/WebKit] 7b6003: Create a temporary grid for computing intrinsic si...

mattwoodrow noreply at github.com
Sun Nov 13 19:09:41 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7b600312f1e13c3d54289a9280d12c91ca123641
      https://github.com/WebKit/WebKit/commit/7b600312f1e13c3d54289a9280d12c91ca123641
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2022-11-13 (Sun, 13 Nov 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.h
    M Source/WebCore/rendering/RenderGrid.cpp
    M Source/WebCore/rendering/RenderGrid.h

  Log Message:
  -----------
  Create a temporary grid for computing intrinsic sizes.
https://bugs.webkit.org/show_bug.cgi?id=247653
<rdar://101965460>

Reviewed by Alan Baradlay.

Reverts r249006.

r249006 switched this code from using a temporary Grid during computeIntrinsicLogicalWidths to instead mutate the layout Grid if a layout was pending. If no layout was
pending, it used cached values from the previous layout.

This was to solve an issue with subgrid, where the sizing algorithm could recurse into nested subgrids, which in turn could recurse back into the original grid. The temporary
stack-based Grid wouldn't be available through this deeply nested callstack and the code defaulted back to the layout grid. Switching Grids mid-sizing caused incorrect sizes to
be computed.

This unforuntately still doesn't work, since we're not expecting computeInstrinsicLogicalWidths to have potential side-effects, even if layout was pending.

This change reverts r249006 and instead adds m_currentGrid so that the stack-based temporary Grid is available, without needing to pass it as a parameter. The real layout
Grid is put inside a private wrapper, so that callers can't accidentally use it, and must always use the 'current' grid.

No test unfortunately, but this was causing issues on humble bundle with grids nested inside flexbox, where we trigger repeated layouts (and they weren't idempotent due to
this bug).

* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize const):
(WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
(WebCore::GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild const):
(WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild const):
(WebCore::IndefiniteSizeStrategy::accumulateFlexFraction const):
(WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded const):
(WebCore::GridTrackSizingAlgorithm::setup):
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::RenderGrid):
(WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
(WebCore::RenderGrid::canPerformSimplifiedLayout const):
(WebCore::RenderGrid::layoutBlock):
(WebCore::RenderGrid::guttersSize const):
(WebCore::RenderGrid::computeIntrinsicLogicalWidths const):
(WebCore::RenderGrid::computeTrackSizesForIndefiniteSize const):
(WebCore::RenderGrid::computeEmptyTracksForAutoRepeat const):
(WebCore::RenderGrid::placeItems):
(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
(WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid const):
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
(WebCore::RenderGrid::dirtyGrid):
(WebCore::RenderGrid::trackSizesForComputedStyle const):
(WebCore::RenderGrid::layoutGridItems):
(WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets const):
(WebCore::RenderGrid::populateGridPositionsForDirection):
(WebCore::RenderGrid::firstLineBaseline const):
(WebCore::RenderGrid::lastLineBaseline const):
(WebCore::RenderGrid::getBaselineChild const):
(WebCore::RenderGrid::currentGrid const):
(WebCore::RenderGrid::currentGrid):
(WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
(WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
(WebCore::RenderGrid::nonCollapsedTracks const):
(WebCore::RenderGrid::numTracks const):
(WebCore::RenderGrid::paintChildren):
(WebCore::RenderGrid::computeGridPositionsForOutOfFlowChild const):
(WebCore::RenderGrid::gridSpanForOutOfFlowChild const):
(WebCore::RenderGrid::GridWrapper::GridWrapper):
(WebCore::RenderGrid::GridWrapper::resetCurrentGrid const):
(WebCore::RenderGrid::placeItemsOnGrid const): Deleted.
(WebCore::RenderGrid::populateExplicitGridAndOrderIterator const): Deleted.
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid const): Deleted.
(WebCore::RenderGrid::placeAutoMajorAxisItemsOnGrid const): Deleted.
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid const): Deleted.
* Source/WebCore/rendering/RenderGrid.h:

Canonical link: https://commits.webkit.org/256624@main




More information about the webkit-changes mailing list