Auto merge of #29750 - stshine:fix-flex-resolve, r=mrobinson

layout_2020: fix target main size not get clamped in flexbox

When Resolving flexible lengths, the clamp result of item's target main size is not actually saved when it should.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-05-22 17:51:57 +02:00 committed by GitHub
commit b1f9126163
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 7 additions and 49 deletions

View file

@ -943,6 +943,8 @@ impl FlexLine<'_> {
// its a min violation.”
for (item_and_target_main_size, frozen) in items() {
if violation(item_and_target_main_size) > Length::zero() {
let (item, target_main_size) = item_and_target_main_size;
target_main_size.set(item.content_min_size.main);
frozen_count.set(frozen_count.get() + 1);
frozen.set(true);
}
@ -954,6 +956,11 @@ impl FlexLine<'_> {
// its a max violation.”
for (item_and_target_main_size, frozen) in items() {
if violation(item_and_target_main_size) < Length::zero() {
let (item, target_main_size) = item_and_target_main_size;
let Some(max_size) = item.content_max_size.main else {
unreachable!()
};
target_main_size.set(max_size);
frozen_count.set(frozen_count.get() + 1);
frozen.set(true);
}