Skip to content

Truly independent web browser

LibWeb: Apply a table's transform to its table wrapper box

Andreas Klingc0f1fe7979ed
diff --git a/Libraries/LibWeb/Rust/src/css/style/layout_style.rs b/Libraries/LibWeb/Rust/src/css/style/layout_style.rs
index 9d6b699b0e5..c5696bb35df 100644
--- a/Libraries/LibWeb/Rust/src/css/style/layout_style.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/layout_style.rs
@@ -90,6 +90,7 @@ groups! {
AnchorValues => ANCHOR,
BorderValues => BORDER,
InheritedTextValues => INHERITED_TEXT,
+ TransformValues => TRANSFORM,
}
/// A style for layout's own use, which no record holds: a base style's groups, with those an edit
@@ -461,6 +462,10 @@ impl LayoutStyle {
self.edit::<GridValues>(|target| {
crate::css::computed_values::copy_grid_placements(source.group::<GridValues>(), target);
});
+ // INTEROP: Like other engines, transform the table wrapper box, so the captions move with the table and
+ // the transform origin is relative to the wrapper.
+ let transform = source.group::<TransformValues>();
+ self.edit::<TransformValues>(|target| *target = transform.clone());
self.edit::<EffectsValues>(|target| {
let source = source.group::<EffectsValues>();
target.clip_is_rect = source.clip_is_rect;
diff --git a/Libraries/LibWeb/Rust/src/painting/style_queries.rs b/Libraries/LibWeb/Rust/src/painting/style_queries.rs
index 4250ee3b933..2cbeff6d72a 100644
--- a/Libraries/LibWeb/Rust/src/painting/style_queries.rs
+++ b/Libraries/LibWeb/Rust/src/painting/style_queries.rs
@@ -452,6 +452,10 @@ pub(crate) fn is_transformable(arena: &impl PaintRead, node: NodeSlotId) -> bool
&& !node_facts::kind_is_text(kind)
&& kind != NodeKind::Viewport;
let is_element_or_pseudo_element = is_dom_element || row.generated_for() != 0;
+ // NB: A table's wrapper box takes the transform of the table (see LayoutStyle::copy_table_properties).
+ if kind == NodeKind::TableWrapper {
+ return true;
+ }
if is_element_or_pseudo_element && node_facts::kind_is_box(kind) {
let Some(style) = row.style() else {
return false;
diff --git a/Tests/LibWeb/Text/expected/Layout/table-box-containing-block-of-abspos-in-cell.txt b/Tests/LibWeb/Text/expected/Layout/table-box-containing-block-of-abspos-in-cell.txt
index af0dfbbe726..5ae9437990f 100644
--- a/Tests/LibWeb/Text/expected/Layout/table-box-containing-block-of-abspos-in-cell.txt
+++ b/Tests/LibWeb/Text/expected/Layout/table-box-containing-block-of-abspos-in-cell.txt
@@ -1,3 +1,3 @@
cell: 30,50
-inset: 24,44
+inset: 21,11
static: 30,50