mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
tables: Add a naive implementation of border-collapse
(#32309)
This change adds a very simple implementation of `border-collapse` for tables. No harmonization or merging is done at all for borders. Instead, the largest border for every continuous border sets the size. Instead of merging different border styles, they are squashed to half size -- which isn't great, but ensures appropriate positioning. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
5cac276997
commit
0cd9c3f2c4
36 changed files with 126 additions and 285 deletions
|
@ -175,10 +175,10 @@ impl<'a> PlacementAmongFloats<'a> {
|
|||
let mut min_inline_end = self.max_inline_end;
|
||||
for band in self.current_bands.iter() {
|
||||
if let Some(left) = band.left {
|
||||
max_inline_start = max_inline_start.max(left);
|
||||
max_inline_start.max_assign(left);
|
||||
}
|
||||
if let Some(right) = band.right {
|
||||
min_inline_end = min_inline_end.min(right);
|
||||
min_inline_end.min_assign(right);
|
||||
}
|
||||
}
|
||||
(max_inline_start, min_inline_end)
|
||||
|
@ -459,14 +459,12 @@ impl FloatContext {
|
|||
// Update clear.
|
||||
match new_float.side {
|
||||
FloatSide::Left => {
|
||||
self.clear_left_position = self
|
||||
.clear_left_position
|
||||
.max(new_float_rect.max_block_position())
|
||||
self.clear_left_position
|
||||
.max_assign(new_float_rect.max_block_position());
|
||||
},
|
||||
FloatSide::Right => {
|
||||
self.clear_right_position = self
|
||||
.clear_right_position
|
||||
.max(new_float_rect.max_block_position())
|
||||
self.clear_right_position
|
||||
.max_assign(new_float_rect.max_block_position());
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -491,20 +489,13 @@ impl FloatContext {
|
|||
|
||||
// CSS 2.1 § 9.5.1 rule 6: The outer top of a floating box may not be higher than the outer
|
||||
// top of any block or floated box generated by an element earlier in the source document.
|
||||
max_assign_au(
|
||||
&mut self.ceiling_from_floats,
|
||||
new_float_rect.start_corner.block,
|
||||
);
|
||||
self.ceiling_from_floats
|
||||
.max_assign(new_float_rect.start_corner.block);
|
||||
|
||||
new_float_rect.start_corner
|
||||
}
|
||||
}
|
||||
|
||||
fn max_assign_au(current: &mut Au, other: Au) {
|
||||
let max_value = std::cmp::max(current.0, other.0);
|
||||
*current = Au(max_value);
|
||||
}
|
||||
|
||||
/// Information needed to place an object so that it doesn't collide with existing floats.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PlacementInfo {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue