1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

LibWeb: Update live DOM ranges on Text and CharacterData mutations

Taking care of the FIXMEs I added in earlier patches. :^)
This commit is contained in:
Andreas Kling 2022-03-21 20:05:25 +01:00
parent c74b1b6d65
commit 1254758b00
4 changed files with 60 additions and 11 deletions

View file

@ -18,6 +18,12 @@
namespace Web::DOM {
HashTable<Range*>& Range::live_ranges()
{
static HashTable<Range*> ranges;
return ranges;
}
NonnullRefPtr<Range> Range::create(HTML::Window& window)
{
return Range::create(window.associated_document());
@ -46,6 +52,12 @@ Range::Range(Document& document)
Range::Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset)
: AbstractRange(start_container, start_offset, end_container, end_offset)
{
live_ranges().set(this);
}
Range::~Range()
{
live_ranges().remove(this);
}
// https://dom.spec.whatwg.org/#concept-range-root