Layout: Implement CSS Grid using taffy (#32619)

* Add layout.grid.enabled pref

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Add taffy dependency

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Import taffy <-> stylo conversion code from taffy_stylo crate

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Add `Grid` variant to DisplayInside

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Implement CSS Grid using Taffy

Signed-off-by: Nico Burns <nico@nicoburns.com>

Import full stylo_taffy crate

Signed-off-by: Nico Burns <nico@nicoburns.com>

Squashed PR feedback changes

Deduplicate is_document_only_whitespace

Signed-off-by: Nico Burns <nico@nicoburns.com>

Import taffy::AvailableSpace

Signed-off-by: Nico Burns <nico@nicoburns.com>

Rename FlexContext to TaffyContainerContext

Signed-off-by: Nico Burns <nico@nicoburns.com>

Eliminate references to flexbox in taffy/layout module

Signed-off-by: Nico Burns <nico@nicoburns.com>

Use constructors for geom types

Signed-off-by: Nico Burns <nico@nicoburns.com>

Remove comment about abspos elements splitting contiguous text runs

Signed-off-by: Nico Burns <nico@nicoburns.com>

Remove reference to flexbox in taffy/construct

Signed-off-by: Nico Burns <nico@nicoburns.com>

Deduplicate construction of flexbox/grid containers

Signed-off-by: Nico Burns <nico@nicoburns.com>

Make anonymous text runs InFlow

Signed-off-by: Nico Burns <nico@nicoburns.com>

Remove commented code

Signed-off-by: Nico Burns <nico@nicoburns.com>

Update comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

Inline/vendor the stylo/taffy interop code

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Update test expectations

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix nits from PR review

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
Nico Burns 2024-11-22 09:21:01 +13:00 committed by GitHub
parent 339062c890
commit 6cbd89dbb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
508 changed files with 2057 additions and 10408 deletions

View file

@ -59,12 +59,6 @@
['grid' with: grid-template-columns: [a\] repeat(2, auto [b\]) 100px [c\]; and grid-template-rows: [a\] repeat(2, auto [b\]) 100px [c\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a\] repeat(2, [b\] 100px); and grid-template-rows: [a\] repeat(2, [b\] 100px);]
expected: FAIL
['grid' with: grid-template-columns: [a\] repeat(2, [b\] 100px); and grid-template-rows: [a\] repeat(2, [b\] 100px);]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a\] repeat(2, [b\] auto [c\]) [d\]; and grid-template-rows: [a\] repeat(2, [b\] auto [c\]) [d\];]
expected: FAIL
@ -77,44 +71,23 @@
['grid' with: grid-template-columns: [a\] min-content repeat(2, [b\] 1fr [c\] calc(20px + 10%)) [d\] minmax(30em, 50em) [e\]; and grid-template-rows: [z\] min-content repeat(2, [y\] 1fr [x\] calc(10% + 40px)) [w\] minmax(3em, 5em) [v\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: repeat(-1, auto); and grid-template-rows: repeat(-1, auto);]
expected: FAIL
['grid' with: grid-template-columns: repeat(-1, auto); and grid-template-rows: repeat(-1, auto);]
expected: FAIL
['emptyGrid' with: grid-template-columns: repeat(auto, 2); and grid-template-rows: repeat(auto, 2);]
expected: FAIL
['grid' with: grid-template-columns: repeat(auto, 2); and grid-template-rows: repeat(auto, 2);]
expected: FAIL
['emptyGrid' with: grid-template-columns: repeat 2, auto; and grid-template-rows: repeat 2, auto;]
expected: FAIL
['grid' with: grid-template-columns: repeat 2, auto; and grid-template-rows: repeat 2, auto;]
expected: FAIL
['emptyGrid' with: grid-template-columns: repeat(2 auto); and grid-template-rows: repeat(2 auto);]
expected: FAIL
['grid' with: grid-template-columns: repeat(2 auto); and grid-template-rows: repeat(2 auto);]
expected: FAIL
['emptyGrid' with: grid-template-columns: 100px (repeat 2, auto); and grid-template-rows: (repeat 2, auto);]
expected: FAIL
['grid' with: grid-template-columns: 100px (repeat 2, auto); and grid-template-rows: (repeat 2, auto);]
expected: FAIL
['emptyGrid' with: grid-template-columns: repeat(2, 50px repeat(2, 100px)); and grid-template-rows: repeat(2, 50px repeat(2, 100px));]
expected: FAIL
['grid' with: grid-template-columns: repeat(2, 50px repeat(2, 100px)); and grid-template-rows: repeat(2, 50px repeat(2, 100px));]
expected: FAIL
['emptyGrid' with: grid-template-columns: 100px repeat(2, [a\]); and grid-template-rows: 100px repeat(2, [a\]);]
expected: FAIL
['grid' with: grid-template-columns: 100px repeat(2, [a\]); and grid-template-rows: 100px repeat(2, [a\]);]
expected: FAIL