Repository navigation
fix: drop the redundant SVG mask so removed elements can be collected - #5208
Open
Arthur031221 wants to merge 1 commit into
Open
Arthur031221 wants to merge 1 commit into
Arthur031221 wants to merge 1 commit into
Conversation
The interaction prompt icon in every shadow root referenced a mask with url(#B), which makes Chromium keep the shadow tree of a removed element alive. Signed-off-by: Arthur031221 <124417490+Arthur031221@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issue
Related to #5062.
Description
In Chromium browsers, every
<model-viewer>that is removed from the page stays in memory, including its canvas. Pages that swap models in a list or a route (the flow in #5062) grew by about 17 MB per removed 700x500 element at a device pixel ratio of 3.The interaction prompt icon in each shadow root points a path at a mask with
url(#B), and Chromium keeps the shadow tree of such an element alive through its style cache. The mask is a white rectangle around the path's own bounds, so this removes the<defs>, the<mask>and themaskattribute.Testing
With a
WeakRefand--expose-gc, 10 of 10 removed elements stayed alive before and 1 of 10 after. Added a spec inmodel-viewer-base-spec.tsthat the shadow root has no mask, and ran it on Chromium.Assisted by Claude/Codex.