Skip to content

Truly independent web browser

LibWeb: Lay out progress and meter as independent formatting contexts

Andreas Kling7248e0342793
diff --git a/Libraries/LibWeb/Rust/src/layout/node_facts.rs b/Libraries/LibWeb/Rust/src/layout/node_facts.rs
index 568597db32d..50dd6ece58e 100644
--- a/Libraries/LibWeb/Rust/src/layout/node_facts.rs
+++ b/Libraries/LibWeb/Rust/src/layout/node_facts.rs
@@ -627,7 +627,10 @@ pub(crate) fn construction_flags(kind: NodeKind, is_anonymous: bool, constructio
let has_style = kind != NodeKind::Node && !kind_is_text(kind);
// Some native controls use a generic box so they can host their internal shadow tree, but
// remain replaced elements for CSS box generation and inline layout.
- let is_replaced_element = kind_is_replaced_box(kind) || has(fact::IS_HTML_INPUT_ELEMENT);
+ // NB: A progress or meter element lays out its internal shadow tree on its own, as other engines do, so no margin
+ // inside it collapses with the content around it.
+ let is_replaced_element =
+ kind_is_replaced_box(kind) || has(fact::IS_HTML_INPUT_ELEMENT) || has(fact::IS_HTML_PROGRESS_OR_METER_ELEMENT);
[
(NodeFlag::Anonymous, is_anonymous),
(NodeFlag::HasStyle, has_style),