mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
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.
This commit is contained in:
parent
726edd2d3b
commit
16a47165ee
5 changed files with 21 additions and 14 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue