Bug 218630

Summary: [css-grid] IndefiniteSizeStrategy::findUsedFlexFraction can iterate the same item multiple times
Product: WebKit Reporter: Oriol Brufau <obrufau>
Component: CSSAssignee: Oriol Brufau <obrufau>
Status: RESOLVED FIXED    
Severity: Normal CC: changseok, esprehn+autocc, ews-watchlist, glenn, jfernandez, kondapallykalyan, pdr, rego, svillar, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.chromium.org/p/chromium/issues/detail?id=1026275
Attachments:
Description Flags
Patch none

Description Oriol Brufau 2020-11-05 11:25:45 PST
IndefiniteSizeStrategy::findUsedFlexFraction needs to iterate all grid items that cross a flexible track. To do so it, takes the indices of the flex tracks, and for each one it uses GridIterator to iterate the items in that track.

Then, to avoid processing the same item multiple times, it checks that the item started in the current flex track, not in a previous one.

However, this is insufficient: it's not taking into account that an item can be in a single flex track, but span multiple tracks in the other axis.

This can make it very slow. Testcase: https://jsbin.com/hefajukaxo/1/edit?html,css,js,output

Chromium has been fixed in https://crbug.com/1026275
Comment 1 Oriol Brufau 2020-11-05 11:36:41 PST
Created attachment 413335 [details]
Patch
Comment 2 Javier Fernandez 2020-11-06 03:39:05 PST
Comment on attachment 413335 [details]
Patch

r=me
Comment 3 EWS 2020-11-06 06:09:52 PST
Committed r269509: <https://trac.webkit.org/changeset/269509>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 413335 [details].
Comment 4 Radar WebKit Bug Importer 2020-11-06 06:10:23 PST
<rdar://problem/71117312>