mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Assert that nodes share shadow-including root in BP calculation
Previously, it was assumed that nodes must share the same root, prior to the calculation of their relative boundary point positions. This is no longer the case, since `Selection.setBaseAndExtent()` now accepts anchor and focus nodes that may be in different shadow trees.
This commit is contained in:
parent
a7b3360fb6
commit
163b8a69e3
Notes:
github-actions[bot]
2024-12-03 14:32:29 +00:00
Author: https://github.com/tcl3
Commit: 163b8a69e3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2703
3 changed files with 82 additions and 1 deletions
|
@ -120,7 +120,9 @@ GC::Ref<Node> Range::root() const
|
|||
RelativeBoundaryPointPosition position_of_boundary_point_relative_to_other_boundary_point(GC::Ref<Node> node_a, u32 offset_a, GC::Ref<Node> node_b, u32 offset_b)
|
||||
{
|
||||
// 1. Assert: nodeA and nodeB have the same root.
|
||||
VERIFY(&node_a->root() == &node_b->root());
|
||||
// NOTE: Nodes may not share the same root if they belong to different shadow trees,
|
||||
// so we assert that they share the same shadow-including root instead.
|
||||
VERIFY(&node_a->shadow_including_root() == &node_b->shadow_including_root());
|
||||
|
||||
// 2. If nodeA is nodeB, then return equal if offsetA is offsetB, before if offsetA is less than offsetB, and after if offsetA is greater than offsetB.
|
||||
if (node_a == node_b) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue