mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
We were calling into `Range::set_start_or_end()` indirectly through `::set_start()` and `::set_end()`, but that algorithm only calls for an invocation whenever the start or end of a range needs to be set to a boundary point. If an algorithm step calls for setting the node or offset, we should directly modify the range. The problem with calling into `::set_start_or_end()` is that this algorithm potentially modifies _both_ the start and end of the range, but algorithms trying to update a range's start or end often have explicit steps to take both the start and end into account and end up overcompensating for the start or end offset resulting in an invalid range (e.g. with an end offset beyond a node's length). This makes updating a range's start/end a bit more efficient and removes a piece of ad-hoc code in CharacterData needed to make it work before.
8.9 KiB
8.9 KiB