| Part of the tension with building masonry on top of grid is that they work in fundamentally different ways. Grid you place everything in the grid first (e.g. an item goes in col:2,row:3), then size the grid.
Masonry ideally you want to size the tracks first, then place items in those tracks. The first Firefox implementation (and the spec at that stage) basically said you don't consider any masonry items for sizing tracks (except for the first row, and some other rules - its complex). This meant that it is trivial to create items that overflow their tracks. The specification at the moment asks to place every item in every possible track. This has quadratic performance O(N_tracks * N_items) in the worst (and somewhat common case). Quadratic performance is bad[1] and we don't really have this in other layout algorithms. With nesting introduced the performance goes (sub-)exponential, which is really poor, even if you have a fast CPU. One may argue that these cases aren't common, but folks always test the boundaries with layout modes in CSS - so things need to be fast by default. Note: In grid items size themselves differently depending on what tracks you place them in, which is why you need to place in every possible position. Masonry potentially needs a different algorithm for sizing tracks to mitigate these problems, (the blog post doesn't go into these issues in sufficient detail). There may have been a version of grid sizing which didn't have item positional dependence but that ship has sailed. [1] https://randomascii.wordpress.com/2019/12/08/on2-again-now-i... |