-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
#1397: Fix fill + max #1569
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
Closed
Closed
#1397: Fix fill + max #1569
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really really woud like to avoid introducing additional cost to this function. It's a very critical path for our layout performance.
Instead of introducing additional logic, I'd like to explore other options first. Like maybe changing
Widget::width
andWidget::height
to return further information, enhancing ourLimits
type, etc.The most important shortcoming of the current layout logic here is that a
Fill
inside aShrink
will cause theShrink
to fill all the remaining space in the parent, independently of anything. A container with aFill
child should somehow beFill
as well.I believe we should focus on rethinking our layout engine to deal with this basic shortcoming first, as doing so may shine a light on other inconsistencies (like this one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct me if I'm mistaken, but wouldn't any
Widget
changes still be dependent on receiving the available space fromresolve
? Like in this specific example, the widget width/height either needs to act likeLength::Units(max)
(if available space > max) orLength::Fill
(if available space <= max), and the outcome would affect the available space for any remainingFill
widgets. I'm not quite sure how that would be possible without changing this function (or some equivalent of it in an updated layout engine).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would make sense to have
Length
variants like this? (justFillMax
would solve #1397, but the others are for the sake of example)That way,
resolve
would know if any of the widgets have a max set, and it could only trigger the extra code/cost if there are widgets that need it.If it doesn't belong in
Length
directly, then maybe haveWidget::width
return aWidth
like this?