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

WIP: Fix #1329: Update taffy to 0.5.2 #1330

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iamralpht
Copy link
Collaborator

Taffy changed the way the "measure function" is passed in, and it actually now matches how the JNI glue was doing it already.

@iamralpht
Copy link
Collaborator Author

I think the Battleship sample might be rendering differently, so pushing to confirm/deny that via the CI tests.

Copy link

github-actions bot commented Jul 8, 2024

Snapshot diff report vs base branch: main
Last updated: Sun Jul 14 23:01:03 PDT 2024, Sha: a1fc390

File name Image
Grid-Layout_compare.
png
Fill-Container_compa
re.png
Dials-Gauges_compare
.png
Battleship_compare.p
ng
ChangeFileScreen_com
pare.png
ExpandedSwitcher_com
pare.png

@iamralpht iamralpht changed the title Fix #1329: Update taffy to 0.5.2 WIP: Fix #1329: Update taffy to 0.5.2 Jul 8, 2024
Copy link
Member

@timothyfroehlich timothyfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see the update to the current version, but what shall we do about the layout changes? Most of them look fine, but obviously the Battleship one is odd.

@timothyfroehlich
Copy link
Member

Happy to see the update to the current version, but what shall we do about the layout changes? Most of them look fine, but obviously the Battleship one is odd.

Oh, just noticed that you'd labelled it "WIP". Mind if you switch the PR to Draft? I assumed you wanted reviews right now.

@iamralpht
Copy link
Collaborator Author

iamralpht commented Jul 8, 2024 via email

@iamralpht iamralpht marked this pull request as draft July 8, 2024 15:24
@iamralpht
Copy link
Collaborator Author

It took me quite a long time to figure out where the changes were coming from. There were two sources:

  • Our text measurement function would sometimes return a large height (depending on the incoming Available Size), which the text node itself would forget, but which would expand the text node's containing frame in some cases. I addressed this with a more careful interpretation of Available Size in the DesignText measure function. I was able to find this by tracing the measure function and changing its return values (before fixing the Available Size interpretation).
  • If a flex node needs to shrink in the cross axis (e.g.: the big battleship frames) to be smaller than its children, then we need to set width or height (as appropriate) to something other than Auto. Zero works. I eventually found this issue after making a tool to dump a layout tree into HTML and comparing our layout with Chrome's. Chrome generates the correct layout with auto, but also generates the correct layout with zero.

Taffy changed the way the "measure function" is passed in, and it
actually now matches how the JNI glue was doing it already.
@iamralpht iamralpht marked this pull request as ready for review July 15, 2024 05:55
@iamralpht iamralpht marked this pull request as draft July 15, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants