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

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

Issue 539603002: adoptNode wasn't clearing the accessibility cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add doctype, get rid of <html>, <head>, <body> Created 6 years, 3 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 | « LayoutTests/accessibility/adopt-node-causes-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/TreeScopeAdopter.cpp
diff --git a/Source/core/dom/TreeScopeAdopter.cpp b/Source/core/dom/TreeScopeAdopter.cpp
index 471396f739e2c89ce7db8209076a1dd3b31832da..60a3a4727ecf656df81078cd5ffccb34cf9d96f0 100644
--- a/Source/core/dom/TreeScopeAdopter.cpp
+++ b/Source/core/dom/TreeScopeAdopter.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "core/dom/TreeScopeAdopter.h"
+#include "core/accessibility/AXObjectCache.h"
#include "core/dom/Attr.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
@@ -48,15 +49,18 @@ void TreeScopeAdopter::moveTreeToNewScope(Node& root) const
Document& oldDocument = oldScope().document();
Document& newDocument = newScope().document();
bool willMoveToNewDocument = oldDocument != newDocument;
+ AXObjectCache* axObjectCache = oldDocument.existingAXObjectCache();
if (willMoveToNewDocument)
oldDocument.incDOMTreeVersion();
for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) {
updateTreeScope(*node);
- if (willMoveToNewDocument)
+ if (willMoveToNewDocument) {
+ if (axObjectCache)
+ axObjectCache->remove(node);
moveNodeToNewDocument(*node, oldDocument, newDocument);
- else if (node->hasRareData()) {
+ } else if (node->hasRareData()) {
NodeRareData* rareData = node->rareData();
if (rareData->nodeLists())
rareData->nodeLists()->adoptTreeScope();
« no previous file with comments | « LayoutTests/accessibility/adopt-node-causes-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698