diff --git a/Libraries/LibWeb/Layout/TextNode.cpp b/Libraries/LibWeb/Layout/TextNode.cpp index 6f8bfd0c2d..bf027b9cb7 100644 --- a/Libraries/LibWeb/Layout/TextNode.cpp +++ b/Libraries/LibWeb/Layout/TextNode.cpp @@ -57,21 +57,6 @@ static bool is_all_whitespace(const StringView& string) return true; } -const String& TextNode::text_for_style(const CSS::StyleProperties& style) const -{ - static String one_space = " "; - if (is_all_whitespace(dom_node().data())) { - switch (style.white_space().value_or(CSS::WhiteSpace::Normal)) { - case CSS::WhiteSpace::Pre: - case CSS::WhiteSpace::PreWrap: - break; - default: - return one_space; - } - } - return dom_node().data(); -} - void TextNode::paint_fragment(PaintContext& context, const LineBoxFragment& fragment, PaintPhase phase) const { auto& painter = context.painter(); diff --git a/Libraries/LibWeb/Layout/TextNode.h b/Libraries/LibWeb/Layout/TextNode.h index 0752689cc0..03781a22b2 100644 --- a/Libraries/LibWeb/Layout/TextNode.h +++ b/Libraries/LibWeb/Layout/TextNode.h @@ -40,7 +40,6 @@ public: const DOM::Text& dom_node() const { return static_cast(*Node::dom_node()); } - const String& text_for_style(const CSS::StyleProperties&) const; const String& text_for_rendering() const { return m_text_for_rendering; } virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const override; diff --git a/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Libraries/LibWeb/Layout/TreeBuilder.cpp index 46070fa346..ae641afca3 100644 --- a/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -91,18 +91,10 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node) if (dom_node.parent() && !dom_node.parent()->layout_node()) return; - const CSS::StyleProperties* parent_style = nullptr; - if (!m_parent_stack.is_empty() && m_parent_stack.last()->dom_node() && m_parent_stack.last()->dom_node()->is_element()) - parent_style = downcast(*m_parent_stack.last()->dom_node()).specified_css_values(); - auto layout_node = dom_node.create_layout_node(); if (!layout_node) return; - // Discard empty whitespace nodes. This might not be ideal for correctness, but it does make the tree nicer. - if (is(*layout_node) && downcast(*layout_node).text_for_style(*parent_style) == " ") - return; - if (!dom_node.parent()) { m_layout_root = layout_node; } else {