Skip to content

Commit

Permalink
Fix live range updating logic
Browse files Browse the repository at this point in the history
  • Loading branch information
domfarolino committed Nov 7, 2024
1 parent 906d710 commit 8d24d3b
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2910,16 +2910,17 @@ a <var>child</var>, run these steps:

<li><p>Let <var>index</var> be <var>node</var>'s <a for=tree>index</a>.

<li><p>For each <a>live range</a> whose <a for=range>start node</a> is an
<a>inclusive descendant</a> of <var>node</var>, set its <a for=range>start</a> to
(<var>parent</var>, <var>index</var>).

<li><p>For each <a>live range</a> whose <a for=range>end node</a> is an <a>inclusive descendant</a>
of <var>node</var>, set its <a for=range>end</a> to (<var>parent</var>, <var>index</var>).

<li><p>For each <a>live range</a> whose <a for=range>start node</a> is <var>parent</var> and
<a for=range>start offset</a> is greater than <var>index</var>, decrease its
<a for=range>start offset</a> by 1.
<li>
<p>For each <a>live range</a> whose <a for=range>start node</a> is <var>parent</var> and
<a for=range>start offset</a> is greater than <var>index</var>, decrease its
<a for=range>start offset</a> by 1.</p>

<p class="note">Note that unlike the traditional <a for=/ lt="remove">removal</a> case, we do not
need to update <a>live range</a> state when their <a for=range>start node</a> or
<a for=range>end node</a> is an <a>inclusive descendant</a> of the <var>node</var>. This is
because said <a>nodes</a> do not get removed from their <a>tree</a>, so ranges associated with
them stay intact.</p>
</li>

<li><p>For each <a>live range</a> whose <a for=range>end node</a> is <var>parent</var> and
<a for=range>end offset</a> is greater than <var>index</var>, decrease its
Expand Down Expand Up @@ -3004,13 +3005,6 @@ a <var>child</var>, run these steps:

<li><a>Queue a tree mutation record</a> for <var>parent</var> with <var>nodes</var>, « »,
<var>previousSibling</var>, and <var>child</var>.</p></li>

<li>
<p>Run the <a>children changed steps</a> for <var>parent</var>.</p>

<p class="XXX">TODO(domfarolino): Before merging, do a full audit on children changed steps, and
write tests.</p>
</li>
</ol>


Expand Down

0 comments on commit 8d24d3b

Please sign in to comment.