mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +00:00
LibWeb: Rename FormattingState::ensure() -> get_mutable()
This makes it much more obvious what the difference between get() and get_mutable() is.
This commit is contained in:
parent
0f15d1f947
commit
db5bf6e64c
10 changed files with 49 additions and 51 deletions
|
@ -66,16 +66,14 @@ struct FormattingState {
|
|||
|
||||
void commit();
|
||||
|
||||
NodeState& ensure(NodeWithStyleAndBoxModelMetrics const& box)
|
||||
NodeState& get_mutable(NodeWithStyleAndBoxModelMetrics const& box)
|
||||
{
|
||||
return *nodes.ensure(&box, [] { return make<NodeState>(); });
|
||||
}
|
||||
|
||||
NodeState const& get(NodeWithStyleAndBoxModelMetrics const& box) const
|
||||
{
|
||||
if (!nodes.contains(&box))
|
||||
return const_cast<FormattingState&>(*this).ensure(box);
|
||||
return *nodes.get(&box).value();
|
||||
return const_cast<FormattingState&>(*this).get_mutable(box);
|
||||
}
|
||||
|
||||
HashMap<NodeWithStyleAndBoxModelMetrics const*, NonnullOwnPtr<NodeState>> nodes;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue