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

@ -1,2 +0,0 @@
[display-grid.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[display-inline-grid.html]
expected: FAIL

View file

@ -1,72 +1,12 @@
[grid-box-sizing-001.html]
[.grid 1]
expected: FAIL
[.grid 2]
expected: FAIL
[.grid 3]
expected: FAIL
[.grid 4]
expected: FAIL
[.grid 5]
expected: FAIL
[.grid 6]
expected: FAIL
[.grid 7]
expected: FAIL
[.grid 8]
expected: FAIL
[.grid 9]
expected: FAIL
[.grid 10]
expected: FAIL
[.grid 11]
expected: FAIL
[.grid 12]
expected: FAIL
[.grid 13]
expected: FAIL
[.grid 14]
expected: FAIL
[.grid 15]
expected: FAIL
[.grid 16]
expected: FAIL
[.grid 17]
expected: FAIL
[.grid 18]
expected: FAIL
[.grid 19]
expected: FAIL
[.grid 20]
expected: FAIL
[.grid 21]
expected: FAIL
[.grid 22]
expected: FAIL
[.grid 23]
expected: FAIL
[.grid 24]
expected: FAIL

View file

@ -1,6 +0,0 @@
[grid-button-001.html]
[[data-expected-width\] 1]
expected: FAIL
[[data-expected-width\] 2]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-container-scrollbar-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-container-scrollbar-vertical-lr-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-container-scrollbar-vertical-rl-001.html]
expected: FAIL

View file

@ -1,45 +1,9 @@
[grid-container-sizing-constraints-001.html]
[.grid 1]
expected: FAIL
[.grid 2]
expected: FAIL
[.grid 3]
expected: FAIL
[.grid 4]
expected: FAIL
[.grid 5]
expected: FAIL
[.grid 6]
expected: FAIL
[.grid 7]
expected: FAIL
[.grid 8]
expected: FAIL
[.grid 9]
expected: FAIL
[.grid 10]
expected: FAIL
[.grid 11]
expected: FAIL
[.grid 12]
expected: FAIL
[.grid 13]
expected: FAIL
[.grid 14]
expected: FAIL
[.grid 15]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-display-grid-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-display-inline-grid-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-first-letter-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-first-letter-002.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-first-line-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-first-line-002.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-float-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-floats-no-intrude-001.html]
expected: FAIL

View file

@ -1,24 +0,0 @@
[grid-gutters-and-flex-content-001.html]
[.grid 1]
expected: FAIL
[.grid 2]
expected: FAIL
[.grid 3]
expected: FAIL
[.grid 4]
expected: FAIL
[.grid 5]
expected: FAIL
[.grid 6]
expected: FAIL
[.grid 7]
expected: FAIL
[.grid 8]
expected: FAIL

View file

@ -2,9 +2,6 @@
[.grid 1]
expected: FAIL
[.grid 2]
expected: FAIL
[.grid 3]
expected: FAIL
@ -14,9 +11,6 @@
[.grid 5]
expected: FAIL
[.grid 6]
expected: FAIL
[.grid 7]
expected: FAIL
@ -26,26 +20,11 @@
[.grid 9]
expected: FAIL
[.grid 10]
expected: FAIL
[.grid 11]
expected: FAIL
[.grid 12]
expected: FAIL
[.grid 13]
expected: FAIL
[.grid 14]
expected: FAIL
[.grid 15]
expected: FAIL
[.grid 16]
expected: FAIL
[.grid 17]
expected: FAIL

View file

@ -11,36 +11,15 @@
[.grid 4]
expected: FAIL
[.grid 5]
expected: FAIL
[.grid 6]
expected: FAIL
[.grid 7]
expected: FAIL
[.grid 8]
expected: FAIL
[.grid 9]
expected: FAIL
[.grid 10]
expected: FAIL
[.grid 11]
expected: FAIL
[.grid 12]
expected: FAIL
[.grid 13]
expected: FAIL
[.grid 14]
expected: FAIL
[.grid 15]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-first-letter-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-first-letter-002.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-first-line-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-first-line-002.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-float-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-floats-no-intrude-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-margins-no-collapse-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-vertical-align-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-margins-no-collapse-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-margins-no-collapse-002.html]
expected: FAIL

View file

@ -1,6 +0,0 @@
[grid-min-max-height-001.html]
[.grid 2]
expected: FAIL
[.grid 8]
expected: FAIL

View file

@ -1,12 +0,0 @@
[grid-size-shrink-to-fit-001.html]
[.grid 1]
expected: FAIL
[.grid 2]
expected: FAIL
[.grid 3]
expected: FAIL
[.grid 4]
expected: FAIL

View file

@ -1,18 +0,0 @@
[grid-support-display-001.html]
[Test style display 'grid']
expected: FAIL
[Test style display 'inline-grid']
expected: FAIL
[Test CSS display 'grid']
expected: FAIL
[Test CSS display 'inline-grid']
expected: FAIL
[Test JavaScript display 'grid']
expected: FAIL
[Test JavaScript display 'inline-grid']
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-vertical-align-001.html]
expected: FAIL