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

@ -113,128 +113,65 @@
['grid' with: grid-template-columns: [a\] min-content [b\] 1fr [c\] calc(20px + 10%) [d\] minmax(30em, 50em) [e\]; and grid-template-rows: [z\] min-content [y\] 1fr [x\] calc(10% + 40px) [w\] minmax(3em, 5em) [v\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a\]; and grid-template-rows: [a\];]
expected: FAIL
['grid' with: grid-template-columns: [a\]; and grid-template-rows: [a\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a b\]; and grid-template-rows: [a b\];]
expected: FAIL
['grid' with: grid-template-columns: [a b\]; and grid-template-rows: [a b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a\] none [b\]; and grid-template-rows: [a\] none [b\];]
expected: FAIL
['grid' with: grid-template-columns: [a\] none [b\]; and grid-template-rows: [a\] none [b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a\] [b\]; and grid-template-rows: [a\] [b\];]
expected: FAIL
['grid' with: grid-template-columns: [a\] [b\]; and grid-template-rows: [a\] [b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: a auto b; and grid-template-rows: a auto b;]
expected: FAIL
['grid' with: grid-template-columns: a auto b; and grid-template-rows: a auto b;]
expected: FAIL
['emptyGrid' with: grid-template-columns: (a) auto (b); and grid-template-rows: (a) auto (b);]
expected: FAIL
['grid' with: grid-template-columns: (a) auto (b); and grid-template-rows: (a) auto (b);]
expected: FAIL
['emptyGrid' with: grid-template-columns: 'a' auto 'b'; and grid-template-rows: 'a' auto 'b';]
expected: FAIL
['grid' with: grid-template-columns: 'a' auto 'b'; and grid-template-rows: 'a' auto 'b';]
expected: FAIL
['emptyGrid' with: grid-template-columns: "a" auto "b"; and grid-template-rows: "a" auto "b";]
expected: FAIL
['grid' with: grid-template-columns: "a" auto "b"; and grid-template-rows: "a" auto "b";]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a, b\] auto [a, b\]; and grid-template-rows: [a, b\] auto [a, b\];]
expected: FAIL
['grid' with: grid-template-columns: [a, b\] auto [a, b\]; and grid-template-rows: [a, b\] auto [a, b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a\] [b\] auto [c d\] [e\]; and grid-template-rows: [a\] [b\] auto [c d\] [e\];]
expected: FAIL
['grid' with: grid-template-columns: [a\] [b\] auto [c d\] [e\]; and grid-template-rows: [a\] [b\] auto [c d\] [e\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a [b\]\] auto [c\]; and grid-template-rows: [a [b\]\] auto [c\];]
expected: FAIL
['grid' with: grid-template-columns: [a [b\]\] auto [c\]; and grid-template-rows: [a [b\]\] auto [c\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a\] auto [[b\]\]; and grid-template-rows: [a\] auto [[b\]\];]
expected: FAIL
['grid' with: grid-template-columns: [a\] auto [[b\]\]; and grid-template-rows: [a\] auto [[b\]\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a auto [b\]; and grid-template-rows: [a auto [b\];]
expected: FAIL
['grid' with: grid-template-columns: [a auto [b\]; and grid-template-rows: [a auto [b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a 100px\] auto [b\]; and grid-template-rows: [a 100px\] auto [b\];]
expected: FAIL
['grid' with: grid-template-columns: [a 100px\] auto [b\]; and grid-template-rows: [a 100px\] auto [b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a 50%\] auto [b\]; and grid-template-rows: [a 50%\] auto [b\];]
expected: FAIL
['grid' with: grid-template-columns: [a 50%\] auto [b\]; and grid-template-rows: [a 50%\] auto [b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [5\] auto [10\]; and grid-template-rows: [5\] auto [10\];]
expected: FAIL
['grid' with: grid-template-columns: [5\] auto [10\]; and grid-template-rows: [5\] auto [10\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [a.\] auto [b*\]; and grid-template-rows: [a.\] auto [b*\];]
expected: FAIL
['grid' with: grid-template-columns: [a.\] auto [b*\]; and grid-template-rows: [a.\] auto [b*\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [#a\] auto [$b\]; and grid-template-rows: [#a\] auto [$b\];]
expected: FAIL
['grid' with: grid-template-columns: [#a\] auto [$b\]; and grid-template-rows: [#a\] auto [$b\];]
expected: FAIL
['emptyGrid' with: grid-template-columns: [initial\] auto; and grid-template-rows: [initial\] auto;]
expected: FAIL
['grid' with: grid-template-columns: [initial\] auto; and grid-template-rows: [initial\] auto;]
expected: FAIL
['emptyGrid' with: grid-template-columns: [inherit\] auto; and grid-template-rows: [inherit\] auto;]
expected: FAIL
['grid' with: grid-template-columns: [inherit\] auto; and grid-template-rows: [inherit\] auto;]
expected: FAIL
['emptyGrid' with: grid-template-columns: [default\] auto; and grid-template-rows: [default\] auto;]
expected: FAIL
['grid' with: grid-template-columns: [default\] auto; and grid-template-rows: [default\] auto;]
expected: FAIL