Skip to content

Truly independent web browser

LibWeb: Stop copying generated text into its layout node

Aliaksandr Kalenik6ddb31a1d0ae
diff --git a/Libraries/LibWeb/Layout/TextNode.cpp b/Libraries/LibWeb/Layout/TextNode.cpp
index 5c0d810c4aa..fdd14c0ba92 100644
--- a/Libraries/LibWeb/Layout/TextNode.cpp
+++ b/Libraries/LibWeb/Layout/TextNode.cpp
@@ -25,10 +25,8 @@ TextNode::TextNode(DOM::Document& document, BindToPreparedArenaSlot bind, Compos
TextNode::~TextNode() = default;
-// The build stamped the row with its characters, which this layout node shares.
GeneratedTextNode::GeneratedTextNode(DOM::Document& document, BindToPreparedArenaSlot bind, Compositing::RustFFI::NodeSlotId slot, RustFFI::NodeKind kind)
: TextNode(document, bind, slot, kind)
- , m_text(Utf16String::adopt_raw(RustFFI::layout_row_generated_text(document_host(), slot)))
{
}
diff --git a/Libraries/LibWeb/Layout/TextNode.h b/Libraries/LibWeb/Layout/TextNode.h
index 9bfc8420703..0a9eb3c50df 100644
--- a/Libraries/LibWeb/Layout/TextNode.h
+++ b/Libraries/LibWeb/Layout/TextNode.h
@@ -34,8 +34,6 @@ public:
// Null for generated text, and for a text node kept after its DOM node was removed.
virtual DOM::Text const* dom_text() const { return static_cast<DOM::Text const*>(Node::dom_node()); }
- virtual Utf16String const& text() const { return dom_node().data(); }
-
Utf16String rendered_text_for_dom() const;
RenderedTextForDOM rendered_text_for_dom_with_offset_mapping() const;
RustFFI::FfiTextSourceRange word_range_at(size_t dom_offset) const;
@@ -50,10 +48,6 @@ public:
virtual ~GeneratedTextNode() override;
virtual DOM::Text const* dom_text() const override { return nullptr; }
- virtual Utf16String const& text() const override { return m_text; }
-
-private:
- Utf16String m_text;
};
template<>
diff --git a/Libraries/LibWeb/Rust/src/layout/shell_reads.rs b/Libraries/LibWeb/Rust/src/layout/shell_reads.rs
index d7f7553bc10..0c253e99132 100644
--- a/Libraries/LibWeb/Rust/src/layout/shell_reads.rs
+++ b/Libraries/LibWeb/Rust/src/layout/shell_reads.rs
@@ -303,18 +303,3 @@ pub extern "C" fn layout_row_has_css_transform(host: &DocumentHost, id: NodeSlot
.is_some_and(|style| crate::painting::style_queries::has_css_transform(rows, id, style))
})
}
-
-/// The characters the generated text row `id` renders, as a raw `AK::Utf16String` representation for which the caller
-/// takes one reference.
-#[unsafe(no_mangle)]
-pub extern "C" fn layout_row_generated_text(host: &DocumentHost, id: NodeSlotId) -> usize {
- let text = host.ask(node_read(), |state| {
- state
- .arena_mut()
- .published_text_source(id, false)
- .data
- .to_utf16()
- .into_owned()
- });
- ak::Utf16String::from_utf16(&text).into_raw()
-}