mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +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
|
@ -97,7 +97,7 @@ int LineBoxFragment::text_index_at(float x) const
|
|||
|
||||
Gfx::FloatRect LineBoxFragment::selection_rect(const Gfx::Font& font) const
|
||||
{
|
||||
auto& selection = layout_node().root().selection();
|
||||
auto selection = layout_node().root().selection().normalized();
|
||||
if (!selection.is_valid())
|
||||
return {};
|
||||
if (!layout_node().is_text())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue