mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Fix clientWidth & friends for tables (#35096)
`clientWidth` shouldn't include the borders of a box. The problem was that we pretend that table wrapper boxes have the border specified on the table element, even though this border actually applies to the table grid box instead of the table wrapper box. Therefore, `clientWidth` was wrong when it subtracted the borders. This patch fixes it. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
b5d1d03698
commit
9b388da9cb
7 changed files with 30 additions and 26 deletions
|
@ -19,7 +19,7 @@ use crate::geom::{
|
|||
AuOrAuto, LengthPercentageOrAuto, PhysicalPoint, PhysicalRect, PhysicalSides, ToLogical,
|
||||
};
|
||||
use crate::style_ext::ComputedValuesExt;
|
||||
use crate::table::SpecificTableOrTableCellInfo;
|
||||
use crate::table::SpecificTableGridOrTableCellInfo;
|
||||
use crate::taffy::SpecificTaffyGridInfo;
|
||||
|
||||
/// Describes how a [`BoxFragment`] paints its background.
|
||||
|
@ -43,7 +43,8 @@ pub(crate) struct ExtraBackground {
|
|||
#[derive(Clone, Debug)]
|
||||
pub(crate) enum SpecificLayoutInfo {
|
||||
Grid(Box<SpecificTaffyGridInfo>),
|
||||
TableOrTableCell(Box<SpecificTableOrTableCellInfo>),
|
||||
TableGridOrTableCell(Box<SpecificTableGridOrTableCellInfo>),
|
||||
TableWrapper,
|
||||
}
|
||||
|
||||
pub(crate) struct BoxFragment {
|
||||
|
@ -346,4 +347,13 @@ impl BoxFragment {
|
|||
self.style.get_box().display.is_inline_flow() &&
|
||||
!self.base.flags.contains(FragmentFlags::IS_REPLACED)
|
||||
}
|
||||
|
||||
/// Whether this is a table wrapper box.
|
||||
/// <https://www.w3.org/TR/css-tables-3/#table-wrapper-box>
|
||||
pub(crate) fn is_table_wrapper(&self) -> bool {
|
||||
matches!(
|
||||
self.detailed_layout_info,
|
||||
Some(SpecificLayoutInfo::TableWrapper)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue