mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
LibWeb: Add FormattingState::clone()
This makes a deep copy of a FormattingState.
This commit is contained in:
parent
1d05823810
commit
19954dfdf8
1 changed files with 9 additions and 0 deletions
|
@ -66,6 +66,15 @@ struct FormattingState {
|
|||
|
||||
void commit();
|
||||
|
||||
FormattingState clone() const
|
||||
{
|
||||
FormattingState new_state;
|
||||
for (auto& it : nodes) {
|
||||
new_state.nodes.set(it.key, make<NodeState>(*it.value));
|
||||
}
|
||||
return new_state;
|
||||
}
|
||||
|
||||
NodeState& get_mutable(NodeWithStyleAndBoxModelMetrics const& box)
|
||||
{
|
||||
return *nodes.ensure(&box, [] { return make<NodeState>(); });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue