diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-27 10:26:38 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-28 14:17:44 +0100 |
commit | 16a47165ee3646227404e7417070896f36e3a63a (patch) | |
tree | 6f159482d3b98e8e4bd51cc12a970044f95d76fc /Userland/Libraries/LibWeb/Layout/LineBox.cpp | |
parent | 726edd2d3be822e5febefdee1d14af27ea144e80 (diff) | |
download | serenity-16a47165ee3646227404e7417070896f36e3a63a.zip |
LibWeb: Use coordinate instead of WeakPtr for box->fragment connection
Using WeakPtr to remember which LineBoxFragment owns which Box was
imposing some annoying constraints on the layout code. Importantly, it
was forcing us to heap-allocate fragments, which makes it much harder to
clone a FormattingState.
This patch replaces the WeakPtr with a coordinate system instead.
Fragments are referred to by their line box index + fragment index
within the line box.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/LineBox.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/LineBox.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.cpp b/Userland/Libraries/LibWeb/Layout/LineBox.cpp index 3152a43dd8..3a65f89155 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBox.cpp @@ -27,11 +27,6 @@ void LineBox::add_fragment(Node const& layout_node, int start, int length, float m_fragments.append(make<LineBoxFragment>(layout_node, start, length, Gfx::FloatPoint(m_width + leading_size, 0.0f), Gfx::FloatSize(content_width, content_height), border_box_top, border_box_bottom, fragment_type)); } m_width += content_width + leading_size + trailing_size; - - if (is<Box>(layout_node)) { - // FIXME: Move this to FormattingContext! - const_cast<Box&>(static_cast<Box const&>(layout_node)).set_containing_line_box_fragment(m_fragments.last()); - } } void LineBox::trim_trailing_whitespace() |