mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Paint collapsed table borders on their own (#35075)
We were previously splitting collapsed borders into two halves, and then paint each one as part of the corresponding cell. This looked wrong when the border style wasn't solid, or when a cell spanned multiple tracks and the border wasn't the same for all of them. Now the borders of a table wrapper, table grid or table cell aren't painted in collapsed borders mode. Instead, the resulting collapsed borders are painted on their own. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
e43baed585
commit
d00d76c1e8
15 changed files with 208 additions and 124 deletions
|
@ -6,6 +6,7 @@ use app_units::Au;
|
|||
use atomic_refcell::AtomicRefCell;
|
||||
use base::print_tree::PrintTree;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use style::computed_values::border_collapse::T as BorderCollapse;
|
||||
use style::computed_values::overflow_x::T as ComputedOverflow;
|
||||
use style::computed_values::position::T as ComputedPosition;
|
||||
use style::logical_geometry::WritingMode;
|
||||
|
@ -19,7 +20,7 @@ use crate::geom::{
|
|||
AuOrAuto, LengthPercentageOrAuto, PhysicalPoint, PhysicalRect, PhysicalSides, ToLogical,
|
||||
};
|
||||
use crate::style_ext::ComputedValuesExt;
|
||||
use crate::table::SpecificTableGridOrTableCellInfo;
|
||||
use crate::table::SpecificTableGridInfo;
|
||||
use crate::taffy::SpecificTaffyGridInfo;
|
||||
|
||||
/// Describes how a [`BoxFragment`] paints its background.
|
||||
|
@ -43,7 +44,8 @@ pub(crate) struct ExtraBackground {
|
|||
#[derive(Clone, Debug)]
|
||||
pub(crate) enum SpecificLayoutInfo {
|
||||
Grid(Box<SpecificTaffyGridInfo>),
|
||||
TableGridOrTableCell(Box<SpecificTableGridOrTableCellInfo>),
|
||||
TableCellWithCollapsedBorders,
|
||||
TableGridWithCollapsedBorders(Box<SpecificTableGridInfo>),
|
||||
TableWrapper,
|
||||
}
|
||||
|
||||
|
@ -356,4 +358,15 @@ impl BoxFragment {
|
|||
Some(SpecificLayoutInfo::TableWrapper)
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn has_collapsed_borders(&self) -> bool {
|
||||
match &self.detailed_layout_info {
|
||||
Some(SpecificLayoutInfo::TableCellWithCollapsedBorders) => true,
|
||||
Some(SpecificLayoutInfo::TableGridWithCollapsedBorders(_)) => true,
|
||||
Some(SpecificLayoutInfo::TableWrapper) => {
|
||||
self.style.get_inherited_table().border_collapse == BorderCollapse::Collapse
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue