mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
LibWeb: Add FormattingState::clone()
This makes a deep copy of a FormattingState.
This commit is contained in:
parent
1d05823810
commit
19954dfdf8
Notes:
sideshowbarker
2024-07-17 18:07:32 +09:00
Author: https://github.com/awesomekling
Commit: 19954dfdf8
1 changed files with 9 additions and 0 deletions
|
@ -66,6 +66,15 @@ struct FormattingState {
|
||||||
|
|
||||||
void commit();
|
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)
|
NodeState& get_mutable(NodeWithStyleAndBoxModelMetrics const& box)
|
||||||
{
|
{
|
||||||
return *nodes.ensure(&box, [] { return make<NodeState>(); });
|
return *nodes.ensure(&box, [] { return make<NodeState>(); });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue