Skip to content

fix(composition): Damage a removed subtree where it was last replayed (backport #25908) - #26191

Closed
mergify[bot] wants to merge 2 commits into
release/stable/7.0from
mergify/bp/release/stable/7.0/pr-25908
Closed

mergify[bot] wants to merge 2 commits into
release/stable/7.0from
mergify/bp/release/stable/7.0/pr-25908

Conversation

@mergify

@mergify mergify Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25478

PR Type:

🐞 Bugfix

What changed? 🚀

Navigating away from a page whose ScrollViewer had been scrolled left parts of the old page on screen, at their scrolled positions. A full repaint (resize) cleared them.

Partial repaint only redraws the reported damage. A stable subtree (enough visuals, unchanged for enough frames) is recorded once into a cached children picture. Scrolling moves that subtree without changing it, so RenderChildrenStep replays the cached picture under the new matrix and doesn't walk its descendants. Their _lastRenderBounds therefore stay at the pre-scroll positions. The subtree root keeps _childrenContentDamageRect up to date on every moved replay, but ContributeRemovalDamage only damaged each visual's own _lastRenderBounds. Removing the page repainted the stale positions and never the area its content actually occupied.

ContributeRemovalDamage now also damages:

  • _childrenContentDamageRect, the area a collapsed subtree was last replayed at;
  • _shadowFallbackDamageRect, the cached shadow recording's area, which is replayed the same way.

Like _lastRenderBounds, both flags are cleared once reported, so a visual inserted elsewhere later starts with no stale rects. The descendants' stale bounds are still damaged as before, which is harmless over-damage.

Not covered: a collapsed subtree whose root is an ancestor of the removed visual, moved without being re-walked. Scrolling invalidates the pictures above the scrolled content, so the reported scenario doesn't go through that path.

Validation

  • New runtime test Given_Visual_Damage.When_Scrolled_Collapsed_Subtree_Is_Removed_Then_Its_Current_Area_Is_Damaged. It builds root → page → scroller → content (enough visuals to collapse), lets the content collapse, scrolls the scroller by 100px, then removes the page and checks the damage covers the content's current position.
    • On master it fails: the removal damage only covers the pre-scroll positions (around y = 1 and y = 11).
    • With the fix it passes.
  • Given_Visual_Damage and Given_CompositionTarget on Skia desktop (Win32): 30 passed, 0 failed, 1 inconclusive (WebGPU-only), 1 skipped (minimized-window case).
  • Not run: the Wayfarer app from the issue against this build.

PR Checklist ✅

🤖 Generated with Claude Code


This is an automatic backport of pull request #25908 done by [Mergify](https://mergify.com).

ramezgerges and others added 2 commits November 6, 2026 21:02
A stable subtree moved by an ancestor (a scrolled page) is replayed from its
cached children picture, so its descendants are not walked and keep the
bounds they had before the move. Removing it damaged those old bounds only,
leaving its pixels on screen. Removal now also damages the replayed area
each collapsed subtree tracks.

Fixes #25478

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 3efde89)
The collapsed-subtree test now asserts the scroller's children were
replayed from their cached picture (it is the scroller, not the
content, that collapses once the scroll moves it), so it can't pass by
walking the marker. A sibling test covers the drop-shadow fallback,
which replays its own recording of the subtree under a scroll.

Both fail without their branch in ContributeRemovalDamage.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 07b32f5)
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Nov 6, 2026
@MartinZikmund
MartinZikmund deleted the mergify/bp/release/stable/7.0/pr-25908 branch November 12, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants