1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:47: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:
Andreas Kling 2022-02-27 10:26:38 +01:00
parent 726edd2d3b
commit 16a47165ee
5 changed files with 21 additions and 14 deletions

View file

@ -6,14 +6,13 @@
#pragma once
#include <AK/Weakable.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
#include <LibWeb/Forward.h>
namespace Web::Layout {
class LineBoxFragment : public Weakable<LineBoxFragment> {
class LineBoxFragment {
friend class LineBox;
public: