Skip to content

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

Merged
MartinZikmund merged 2 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/removal-damage-collapsed
Nov 6, 2026
Merged

MartinZikmund merged 2 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/removal-damage-collapsed

Conversation

@ramezgerges

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

@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Nov 2, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 242684 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • AndroidWindowInsets.png-dark
    • AppBarToggleButtonTest.png-dark
    • AnimatedVisualsTestbedPage.png
    • ApplicationViewSizing.png-dark
    • AppWindowClosing.png-dark
    • Application_DispatcherShutdownMode.png
    • AppWindowPresenters.png-dark
    • AppXamlDefinedResources.png
    • ArcSegment.png-dark
    • Attributed_text_Simple.png
    • Attributed_text_Supserscript.png-dark
    • AutoBorderStretchwithleftmargin.png-dark
    • AutoBorderStretchwithbottommargin.png
    • AutomationProperties_AutomationId.png-dark
    • AutomationPropertiesExtensions_Role.png
    • AutomationProperties_Relations.png
    • AutoSuggestBox_Description.png-dark
    • AutomationProperties_StructureAndProps.png-dark
    • AutoSuggestBox_Description.png
  • skia-windows-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarButtonTest.png-dark
    • AppBarButtonWithIconTest.png-dark
    • ApplicationViewMode.png-dark
    • Application_DispatcherShutdownMode.png
    • AppWindowTitleBar Properties.png-dark
    • Attributed_text_FontSize_Changing.png-dark
    • AuthenticationBroker_Cancel.png
    • AutoBorderStretchwithtopmargin.png
    • AutomationPropertiesExtensions_Role.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBox_Description.png-dark
    • AutoSuggestBox_Description.png
    • BackGesture.png-dark
    • BackGesture.png
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • Border_AntiAlias.png-dark
    • Border_AntiAlias.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 242684 has failed on Uno.UI - CI.

@ramezgerges

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@ramezgerges
ramezgerges force-pushed the dev/rara/removal-damage-collapsed branch from ebe4ef1 to b295617 Compare November 2, 2026 15:09
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 242859 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AppBarButtonTest.png
    • ApplicationViewMode.png-dark
    • AppWindowClosing.png-dark
    • AppWindowPositionAndSize.png
    • Arrange_Performance01.png-dark
    • Attributed_text_Supserscript.png-dark
    • AutoBorderStretchwithleftmargin.png-dark
    • AutomationPropertiesExtensions_Role.png-dark
    • AutomationPropertiesExtensions_Role.png
    • BackGesture.png-dark
    • BackGesture.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • Battery.png-dark
    • Battery.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BorderBottomwithmargins.png-dark
    • BorderBottomwithmargins.png
  • skia-windows-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png-dark
    • AndroidWindowInsets.png
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarToggleButtonTest.png
    • ApplicationViewSpanningRectsPage.png-dark
    • AppWindowClosing.png-dark
    • AppWindowPresenters.png
    • Arrange_Performance01.png-dark
    • Arrange_Performance01.png
    • AutoBorderStretchwithleftmargin.png
    • AutoBorderStretchwithrightmargin.png-dark
    • AutomationProperties_Landmark.png-dark
    • AutomationProperties_Landmark.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_Reason.png-dark
    • AutoSuggestBox_Reason.png
    • BasicAutoSuggestBox.png-dark
    • BasicAutoSuggestBox.png

@ramezgerges
ramezgerges force-pushed the dev/rara/removal-damage-collapsed branch from b295617 to 01384b3 Compare November 3, 2026 16:55
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 243336 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarButtonWithIconTest.png
    • ApplicationViewMode.png-dark
    • Application_DispatcherShutdownMode.png
    • AppXamlDefinedResources.png-dark
    • Arrange_Performance01.png
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithleftmargin.png
    • AutomationProperties_Name.png-dark
    • AutomationProperties_Name.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_SoftKeboard.png-dark
    • AutoSuggestBox_SoftKeboard.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • BasicThemeResources.png-dark
    • BasicThemeResources.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
  • skia-windows-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarButtonTest.png
    • AppBarToggleButtonTest.png
    • ApplicationViewSizing.png-dark
    • AppWindowClosing.png
    • AppWindowTitleBar Properties.png
    • Arrange_Performance01.png
    • Attributed_text_FontSize_Changing.png-dark
    • AutoBorderStretchwithleftmargin.png
    • AutoBorderStretchwithrightmargin.png-dark
    • AutomationProperties_Relations.png
    • AutomationProperties_StructureAndProps.png-dark
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBox_Keyboard.png
    • BasicAutoSuggestBox.png-dark
    • BasicAutoSuggestBox.png
    • BasicThemeResources.png-dark
    • BasicThemeResources.png

@MartinZikmund MartinZikmund added the 7.0 PRs only. For issues, use the Release field. label Nov 4, 2026
@MartinZikmund

Copy link
Copy Markdown
Member

@Mergifyio backport release/stable/7.0

@mergify

mergify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/7.0

✅ Backports have been created

Details

@ramezgerges
ramezgerges force-pushed the dev/rara/removal-damage-collapsed branch from 01384b3 to 84b7706 Compare November 4, 2026 18:21
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@Xiaoy312 Xiaoy312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks right for the reported path. The scrolled content's visual moves through AnchorPoint, which goes through the same translation-only invalidation as the Offset the test uses, so the test models the real scroll. Clearing both flags once they're reported is safe: a later re-insert at a new placement damages the new area, and the old one was already damaged at removal.

Two non-blocking notes inline: one on hardening the test, and one on a follow-up for the ancestor case.

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 243697 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AppBarToggleButtonTest.png-dark
    • AnimatedBackVisualSourceSamplePage.png-dark
    • ApplicationViewSizing.png-dark
    • AppBarButtonWithIconTest.png
    • AppWindowClosing.png
    • ApplicationViewMode.png
    • AppWindowTitleBar Properties.png-dark
    • AppWindowFeatures.png-dark
    • Arrange_Performance01.png-dark
    • AppWindowTitleBar Properties.png
    • Attributed_text_Supserscript.png
    • Attributed_text_Simple.png-dark
    • AutoBorderStretchwithleftmargin.png
    • AuthenticationBroker_Demo.png-dark
    • AutomationProperties_Landmark.png-dark
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_Landmark.png
    • AutomationProperties_Relations.png-dark
    • BackGesture.png-dark
  • skia-windows-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png
    • AndroidWindowInsets.png
    • AnimatedBackVisualSourceSamplePage.png
    • AppBarButtonTest.png-dark
    • AppBarToggleButtonTest.png-dark
    • ApplicationViewMode.png
    • AppWindowClosing.png
    • AppWindowTitleBar Properties.png-dark
    • ArcSegment.png-dark
    • ArcSegment.png
    • AutoBorderStretchwithrightmargin.png-dark
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_Name.png
    • AutomationProperties_Relations.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_BitmapIcon.png-dark
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 243768 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarToggleButtonTest.png
    • ApplicationViewSpanningRectsPage.png-dark
    • AppWindowFeatures.png-dark
    • AppWindowPositionAndSize.png
    • AppXamlDefinedResources.png
    • Attributed_text_FontSize_Changing.png
    • AuthenticationBroker_Cancel.png
    • AuthenticationBroker_Demo.png-dark
    • AutomationProperties_Relations.png-dark
    • AutomationProperties_Relations.png
    • AutoSizedTopLeft.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBox_Icons.png-dark
    • AutoSuggestBox_Icons.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
  • skia-windows-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarButtonTest.png-dark
    • AppBarButtonTest.png
    • AppBar_KeyBoard.png-dark
    • ApplicationViewSizing.png
    • AppWindowFeatures.png-dark
    • AppWindowTitleBar Properties.png-dark
    • ArcSegment.png
    • AuthenticationBroker_Cancel.png-dark
    • AuthenticationBroker_Cancel.png
    • AutomationProperties_Landmark.png
    • AutomationProperties_Name.png-dark
    • AutoSuggestBox_Description.png-dark
    • AutoSuggestBox_Description.png
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics.png-dark
    • Basics.png
    • BezierSegment.png-dark
    • BezierSegment.png

@ramezgerges
ramezgerges force-pushed the dev/rara/removal-damage-collapsed branch from 9d565e0 to 9e2b6c3 Compare November 5, 2026 17:54
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 244086 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • AppBarButtonTest.png
    • AndroidWindowInsets.png-dark
    • Application_DispatcherShutdownMode.png-dark
    • AnimatedIconPage.png
    • AppWindowPresenters.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • ArcSegment.png-dark
    • ApplicationViewSizing.png-dark
    • Attributed_text_Simple.png
    • AppWindowClosing.png-dark
    • AuthenticationBroker_Demo.png
    • AppWindowPositionAndSize.png
    • AutomationProperties_Landmark.png-dark
    • Attributed_text_FontSize_Changing.png
    • AutoSizedPathCentered.png-dark
    • AutoBorderStretchwithbottommargin.png-dark
    • AutoSizedPathCentered.png
    • AutoBorderStretchwithtopmargin.png-dark
    • AutoSuggestBox_Keyboard.png-dark
  • skia-windows-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedIconPage.png
    • AppBarButtonTest.png-dark
    • AppBarButtonWithIconTest.png-dark
    • AppBarButtonWithIconTest.png
    • ApplicationViewMode.png-dark
    • ApplicationViewSizing.png
    • AppWindowClosing.png
    • AppWindowFeatures.png-dark
    • Arrange_Performance01.png-dark
    • Arrange_Performance01.png
    • AuthenticationBroker_Cancel.png
    • AuthenticationBroker_Demo.png-dark
    • AutomationProperties_Name.png-dark
    • AutomationProperties_Name.png
    • AutoSuggestBox_BitmapIcon.png-dark
    • AutoSuggestBox_BitmapIcon.png
    • BackGesture.png
    • BadgeNotificationTests.png-dark

ramezgerges and others added 2 commits November 6, 2026 11:36
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 unoplatform#25478

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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]>
@ramezgerges
ramezgerges force-pushed the dev/rara/removal-damage-collapsed branch from 9e2b6c3 to 07b32f5 Compare November 6, 2026 16:37
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 244373 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • AppBarButtonWithIconTest.png-dark
    • AppBar_KeyBoard.png-dark
    • ApplicationViewSizing.png
    • AppWindowPositionAndSize.png
    • Arrange_Performance01.png
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithleftmargin.png
    • AutoBorderStretchwithtopmargin.png-dark
    • AutoBorderStretchwithtopmargin.png
    • AutoSizedTopLeft.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBox_Keyboard.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BitmapIcon_Monochromatic.png-dark
    • BitmapIcon_Monochromatic.png
  • skia-windows-screenshots: 2458 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AndroidWindowInsets.png
    • AppBarButtonWithIconTest.png-dark
    • AnimatedBackVisualSourceSamplePage.png
    • ApplicationViewSizing.png-dark
    • AppBarButtonTest.png
    • AppWindowClosing.png-dark
    • AppBar_KeyBoard.png
    • AppWindowPositionAndSize.png
    • Application_DispatcherShutdownMode.png-dark
    • Arrange_Performance01.png
    • AppWindowPresenters.png-dark
    • AuthenticationBroker_Cancel.png
    • ArcSegment.png
    • AutomationPropertiesExtensions_Role.png-dark
    • Attributed_text_Supserscript.png
    • AutoSizedTopLeft.png
    • AutoBorderStretchwithbottommargin.png-dark
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoBorderStretchwithbottommargin.png

@mergify

mergify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@MartinZikmund
MartinZikmund merged commit ffd911e into unoplatform:master Nov 6, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.0 PRs only. For issues, use the Release field. area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skia Win32: navigating away from a scrolled page leaves its pixels on screen (stale damage region)

5 participants