Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: Source/core/dom/Document.cpp

Issue 1213203002: Move AXObjectCache::remove so it is after ContainerNode::detach Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/accessibility/AXARIAGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 54ab2be7d7b9cd06c5957495d4213e434870a6bb..1e286b4ed3df9fb86d245d73529ca26dfc5c19e8 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -2195,6 +2195,18 @@ void Document::detach(const AttachContext& context)
m_layoutView = nullptr;
ContainerNode::detach(context);
+ if (this != &axObjectCacheOwner()) {
+ if (AXObjectCache* cache = existingAXObjectCache()) {
+ // Documents that are not a root document use the AXObjectCache in
+ // their root document. Node::removedFrom is called after the
+ // document has been detached so it can't find the root document.
+ // We do the removals here instead.
+ for (Node& node : NodeTraversal::descendantsOf(*this)) {
+ cache->remove(&node);
+ }
+ }
+ }
+
styleEngine().didDetach();
frameHost()->eventHandlerRegistry().documentDetached(*this);
« no previous file with comments | « no previous file | Source/modules/accessibility/AXARIAGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698