Add support for cellpadding attribute (#31201)

This commit is contained in:
Oriol Brufau 2024-01-29 12:51:30 +01:00 committed by GitHub
parent 091653417a
commit 7d1b19c865
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 58 additions and 68 deletions

View file

@ -989,6 +989,32 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
PropertyDeclaration::BorderRightWidth(width_value),
));
}
if let Some(cellpadding) = self
.downcast::<HTMLTableCellElement>()
.and_then(|this| this.get_table())
.and_then(|table| table.get_cellpadding())
{
let cellpadding = NonNegative(specified::LengthPercentage::Length(
specified::NoCalcLength::from_px(cellpadding as f32),
));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::PaddingTop(cellpadding.clone()),
));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::PaddingLeft(cellpadding.clone()),
));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::PaddingBottom(cellpadding.clone()),
));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::PaddingRight(cellpadding),
));
}
}
fn get_colspan(self) -> u32 {