diff --git a/crates/obscura-render/src/dom.rs b/crates/obscura-render/src/dom.rs index ac68ca0..ca741df 100644 --- a/crates/obscura-render/src/dom.rs +++ b/crates/obscura-render/src/dom.rs @@ -267,6 +267,9 @@ fn build( let _name = node.as_element()?; let style = styles.get(&id)?; + if style.display == crate::Display::None { + return None; + } let mut taffy_style = to_taffy_style(style); // Emulate HTML table layout by giving the last td in a tr all remaining space diff --git a/crates/obscura-render/src/style.rs b/crates/obscura-render/src/style.rs index 9247ea1..49c661a 100644 --- a/crates/obscura-render/src/style.rs +++ b/crates/obscura-render/src/style.rs @@ -37,6 +37,8 @@ pub fn ua_style(tag: &str) -> LayoutStyle { style.display = Display::Flex; style.flex_direction = Some(taffy::FlexDirection::Column); style.align_items = Some(taffy::AlignItems::Center); + } else if tag == "head" || tag == "script" || tag == "style" || tag == "title" || tag == "meta" || tag == "link" { + style.display = Display::None; } else if tag == "body" { style.margin = Edges { top: 8.0, right: 8.0, bottom: 8.0, left: 8.0 }; } else if tag == "table" || tag == "tbody" {