mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
LibWeb: Start making our layout system "transactional"
This patch adds a map of Layout::Node to FormattingState::NodeState. Instead of updating layout nodes incrementally as layout progresses through the formatting contexts, all updates are now written to the corresponding NodeState instead. At the end of layout, FormattingState::commit() is called, which transfers all the values from the NodeState objects to the Node. This will soon allow us to perform completely non-destructive layouts which don't affect the tree. Note that there are many imperfections here, and still many places where we assign to the NodeState, but later read directly from the Node instead. I'm just committing at this stage to make subsequent diffs easier to understand.
This commit is contained in:
parent
561612f219
commit
c9700e100e
27 changed files with 754 additions and 571 deletions
|
@ -23,7 +23,7 @@ public:
|
|||
Trailing,
|
||||
};
|
||||
|
||||
LineBoxFragment(Node& layout_node, int start, int length, const Gfx::FloatPoint& offset, const Gfx::FloatSize& size, Type type)
|
||||
LineBoxFragment(Node const& layout_node, int start, int length, const Gfx::FloatPoint& offset, const Gfx::FloatSize& size, Type type)
|
||||
: m_layout_node(layout_node)
|
||||
, m_start(start)
|
||||
, m_length(length)
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Node& layout_node() const { return m_layout_node; }
|
||||
Node const& layout_node() const { return m_layout_node; }
|
||||
int start() const { return m_start; }
|
||||
int length() const { return m_length; }
|
||||
const Gfx::FloatRect absolute_rect() const;
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
Gfx::FloatRect selection_rect(const Gfx::Font&) const;
|
||||
|
||||
private:
|
||||
Node& m_layout_node;
|
||||
Node const& m_layout_node;
|
||||
int m_start { 0 };
|
||||
int m_length { 0 };
|
||||
Gfx::FloatPoint m_offset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue