Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CSS Grid "auto track" / placement bugs #481

Merged
merged 5 commits into from
May 17, 2023

Conversation

nicoburns
Copy link
Collaborator

@nicoburns nicoburns commented May 16, 2023

Objective

Fix bugs in the CSS Grid track initialization and placement code

Changes made

  • Add tests for grid_auto_rows and grid_auto_columns
  • Fix divide by zero when using grid_auto_rows/grid_auto_columns with zero negative implicit tracks
  • Fix over-allocation / over counting of tracks in the CellOccupancyMatrix when auto-placing in grids that contain negative implicit tracks.
  • Fix axis conflation in auto-placement code when grid_auto_flow is column
  • Fix computation of auto track offset when initializing negative implicit tracks

Context

While testing Taffy with Blitz I hit a panic caused by a divide-by-zero when attempting to use the grid_auto_rows property. Investigating this led me to realise that Taffy has no tests testing grid_auto_rows and grid_auto_columns. Adding some basic tests for these properties revealed a number of bugs which have been fixed in this PR.

Notes

This should probably be backported to 0.3.x once it lands in main.

@nicoburns nicoburns added the bug Something isn't working label May 16, 2023
@nicoburns nicoburns merged commit 8a04e1a into DioxusLabs:main May 17, 2023
@nicoburns nicoburns added this to the 0.3.13 milestone Aug 14, 2023
nicoburns added a commit that referenced this pull request Aug 14, 2023
* Fix divide by zero when using grid_auto_rows/grid_auto_columns with zero
"negative implicit" tracks

* Fix over-allocation in the CellOccupancyMatrix when auto-placing in grids
that contain negative implicit tracks.

* Fix axis conflation when grid_auto_flow is column

* Fix computation of auto track offset when initializing negative implicit tracks

* Add basic tests for grid_auto_rows and grid_auto_columns
nicoburns added a commit that referenced this pull request Aug 14, 2023
* Fix divide by zero when using grid_auto_rows/grid_auto_columns with zero
"negative implicit" tracks

* Fix over-allocation in the CellOccupancyMatrix when auto-placing in grids
that contain negative implicit tracks.

* Fix axis conflation when grid_auto_flow is column

* Fix computation of auto track offset when initializing negative implicit tracks

* Add basic tests for grid_auto_rows and grid_auto_columns
nicoburns added a commit that referenced this pull request Aug 14, 2023
* Fix divide by zero when using grid_auto_rows/grid_auto_columns with zero
"negative implicit" tracks

* Fix over-allocation in the CellOccupancyMatrix when auto-placing in grids
that contain negative implicit tracks.

* Fix axis conflation when grid_auto_flow is column

* Fix computation of auto track offset when initializing negative implicit tracks

* Add basic tests for grid_auto_rows and grid_auto_columns
nicoburns added a commit that referenced this pull request Aug 14, 2023
* Fix divide by zero when using grid_auto_rows/grid_auto_columns with zero
"negative implicit" tracks

* Fix over-allocation in the CellOccupancyMatrix when auto-placing in grids
that contain negative implicit tracks.

* Fix axis conflation when grid_auto_flow is column

* Fix computation of auto track offset when initializing negative implicit tracks

* Add basic tests for grid_auto_rows and grid_auto_columns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants