mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb: Ensure we're not creating invalid ranges
Our Ranges should maintain the invariant that their offsets are always within range of 0..length (inclusive) of their respective containers. Note that we cannot maintain this in AbstractRange, which is the base for StaticRange and can still have invalid offsets.
This commit is contained in:
parent
c3a5e8e266
commit
cac1d49d21
Notes:
github-actions[bot]
2025-05-15 10:45:34 +00:00
Author: https://github.com/gmta
Commit: cac1d49d21
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4734
Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 3 additions and 0 deletions
|
@ -68,6 +68,9 @@ Range::Range(Document& document)
|
|||
Range::Range(GC::Ref<Node> start_container, WebIDL::UnsignedLong start_offset, GC::Ref<Node> end_container, WebIDL::UnsignedLong end_offset)
|
||||
: AbstractRange(start_container, start_offset, end_container, end_offset)
|
||||
{
|
||||
VERIFY(start_offset <= start_container->length());
|
||||
VERIFY(end_offset <= end_container->length());
|
||||
|
||||
live_ranges().set(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue