mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Fix percentages in CSS tables (#31454)
100% is stored as Percent(1.), not as percent(100.) Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
127aa657c2
commit
5f399139ae
2 changed files with 3 additions and 6 deletions
|
@ -411,7 +411,7 @@ impl<'a> TableLayout<'a> {
|
||||||
let final_intrinsic_percentage_width = column_measure
|
let final_intrinsic_percentage_width = column_measure
|
||||||
.percentage
|
.percentage
|
||||||
.0
|
.0
|
||||||
.min(100. - total_intrinsic_percentage_width);
|
.min(1. - total_intrinsic_percentage_width);
|
||||||
total_intrinsic_percentage_width += final_intrinsic_percentage_width;
|
total_intrinsic_percentage_width += final_intrinsic_percentage_width;
|
||||||
column_measure.percentage = Percentage(final_intrinsic_percentage_width);
|
column_measure.percentage = Percentage(final_intrinsic_percentage_width);
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1148,7 @@ impl<'a> TableLayout<'a> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.rows[row_index].percent = Percentage(percentage.min(100. - total_percentage));
|
self.rows[row_index].percent = Percentage(percentage.min(1. - total_percentage));
|
||||||
total_percentage += self.rows[row_index].percent.0;
|
total_percentage += self.rows[row_index].percent.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,7 +1218,7 @@ impl<'a> TableLayout<'a> {
|
||||||
if let Some(percentage_resolution_size) = percentage_resolution_size {
|
if let Some(percentage_resolution_size) = percentage_resolution_size {
|
||||||
let get_percent_block_size_deficit = |row_index: usize, track_size: Au| {
|
let get_percent_block_size_deficit = |row_index: usize, track_size: Au| {
|
||||||
let size_needed_for_percent =
|
let size_needed_for_percent =
|
||||||
percentage_resolution_size.scale_by(self.rows[row_index].percent.0 / 100.);
|
percentage_resolution_size.scale_by(self.rows[row_index].percent.0);
|
||||||
(size_needed_for_percent - track_size).max(Au::zero())
|
(size_needed_for_percent - track_size).max(Au::zero())
|
||||||
};
|
};
|
||||||
let percent_block_size_deficit: Au = track_range
|
let percent_block_size_deficit: Au = track_range
|
||||||
|
|
|
@ -38,9 +38,6 @@
|
||||||
[table 15]
|
[table 15]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[table 19]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 20]
|
[table 20]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue