mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:38:10 +00:00
LibWeb: Add LayoutRange::normalized()
We use this to ensure that we're always working with a selection where the start() is before the end() in document order. That simplifies all the logic around this.
This commit is contained in:
parent
706fc3d1aa
commit
9177eea8fe
5 changed files with 61 additions and 1 deletions
|
@ -136,6 +136,17 @@ public:
|
|||
return const_cast<TreeNode*>(this)->next_in_pre_order();
|
||||
}
|
||||
|
||||
bool is_before(const T& other) const
|
||||
{
|
||||
if (this == &other)
|
||||
return false;
|
||||
for (auto* node = this; node; node = node->next_in_pre_order()) {
|
||||
if (node == &other)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
IterationDecision for_each_in_subtree(Callback callback) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue