mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #29863 - nicoburns:fix-infinite-loop-when-shrinking, r=Loirooriol
Fix infinite loop in flexbox algorithm Only apply step 5c of "resolve flexible lengths" if sum of scaled flexible shrink factors > 0 Probably fixes #29852 (but speculative as I can't get mach to run). --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___
This commit is contained in:
commit
7d9839acc8
7 changed files with 9 additions and 10 deletions
|
@ -976,10 +976,12 @@ impl FlexLine<'_> {
|
|||
let scaled_shrink_factors_sum: Length = unfrozen_items()
|
||||
.map(|(item, _)| scaled_shrink_factor(item))
|
||||
.sum();
|
||||
for (item, target_main_size) in unfrozen_items() {
|
||||
let ratio = scaled_shrink_factor(item) / scaled_shrink_factors_sum;
|
||||
target_main_size
|
||||
.set(item.flex_base_size - remaining_free_space.abs() * ratio);
|
||||
if scaled_shrink_factors_sum > Length::zero() {
|
||||
for (item, target_main_size) in unfrozen_items() {
|
||||
let ratio = scaled_shrink_factor(item) / scaled_shrink_factors_sum;
|
||||
target_main_size
|
||||
.set(item.flex_base_size - remaining_free_space.abs() * ratio);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue