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

Unified Diff: Source/core/html/HTMLDialogElement.cpp

Issue 70213002: Update the accessibility tree when a modal dialog is opened/closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: sync and remove inert-node-is-hidden.html Created 7 years, 1 month 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 | « Source/core/accessibility/AXObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLDialogElement.cpp
diff --git a/Source/core/html/HTMLDialogElement.cpp b/Source/core/html/HTMLDialogElement.cpp
index 5c9164047b67d9c89f8d47f0c0b389aef57975a5..e2107f10a107364046feb9ba2450fc39f270b092 100644
--- a/Source/core/html/HTMLDialogElement.cpp
+++ b/Source/core/html/HTMLDialogElement.cpp
@@ -27,6 +27,7 @@
#include "core/html/HTMLDialogElement.h"
#include "bindings/v8/ExceptionState.h"
+#include "core/accessibility/AXObjectCache.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/NodeTraversal.h"
#include "core/html/HTMLFormControlElement.h"
@@ -57,6 +58,18 @@ static void runAutofocus(HTMLDialogElement* dialog)
}
}
+static void inertSubtreesChanged(Document& document)
+{
+ // When a modal dialog opens or closes, nodes all over the accessibility
+ // tree can change inertness which means they must be added or removed from
+ // the tree. The most foolproof way is to clear the entire tree and rebuild
+ // it, though a more clever way is probably possible.
+ Document* topDocument = document.topDocument();
+ topDocument->clearAXObjectCache();
+ if (AXObjectCache* cache = topDocument->axObjectCache())
+ cache->childrenChanged(cache->getOrCreate(topDocument));
+}
+
HTMLDialogElement::HTMLDialogElement(Document& document)
: HTMLElement(dialogTag, document)
, m_centeringMode(Uninitialized)
@@ -85,7 +98,11 @@ void HTMLDialogElement::closeDialog(const String& returnValue)
if (!fastHasAttribute(openAttr))
return;
setBooleanAttribute(openAttr, false);
+
+ HTMLDialogElement* activeModalDialog = document().activeModalDialog();
document().removeFromTopLayer(this);
+ if (activeModalDialog == this)
+ inertSubtreesChanged(document());
if (!returnValue.isNull())
m_returnValue = returnValue;
@@ -120,6 +137,7 @@ void HTMLDialogElement::showModal(ExceptionState& es)
runAutofocus(this);
forceLayoutForCentering();
+ inertSubtreesChanged(document());
}
void HTMLDialogElement::setCentered(LayoutUnit centeredPosition)
« no previous file with comments | « Source/core/accessibility/AXObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698