Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
M118 minibranch: [A11y] When marking entire document dirty, don't rep…
…air parents This fixes a crash that can occur when marking a document dirty. Description of crash: MarkDocumentDirtyWithCleanLayout() iterates all nodes and calls SetNeedsToUpdateChildren(). This performs additional work to ensure that each node, all the way to the root, has a "has dirty descendants" flag set, and walks the parent chain, repairing missing parents if necessary. This extra loop is unnecessary because each node in the tree will already be visited by MarkDocumentDirtyWithCleanLayout(). The code path gets out of control because the calls to RepairMissingParent() end up creating objects as we are marking them all dirty, as well as updating cached values on objects (this was not expected to occur until UpdateTreeIfNeeded()). Finally, children changed events are fired because of the newly created objects. All of these unexpected occurrences result in methods being called on detached objects where that is not expected. Description of fix: Avoid walking parent chains while marking the document dirty. This fix may also be ported to later branches, however, these specific crashes have not been seen there yet. Either way, it is an improvement to avoid the unnecessary parent chain loops while visiting each node. Bug: 1480675, b/305236511, b/305967411, 1493459 Change-Id: Ifc1c803962bfcb98e49a986793d50470754a3580 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4951158 Reviewed-by: Benjamin Beaudry <benjamin.beaudry@microsoft.com> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Commit-Queue: Aaron Leventhal <aleventhal@chromium.org> Cr-Commit-Position: refs/branch-heads/5993_88@{#4} Cr-Branched-From: 1d05652-refs/branch-heads/5993@{#1298} Cr-Branched-From: 5113507-refs/heads/main@{#1192594}
- Loading branch information