<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191931] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191931">191931</a></dd>
<dt>Author</dt> <dd>n_wang@apple.com</dd>
<dt>Date</dt> <dd>2015-11-02 17:52:38 -0800 (Mon, 02 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>AX: Add support for ARIA 1.1 attribute 'aria-modal' for dialog and alertdialog
https://bugs.webkit.org/show_bug.cgi?id=138566
Reviewed by Chris Fleizach.
Source/WebCore:
Added support for aria-modal attribute on dialog/alertdialog roles.
When modal dialog is displayed, all other contents will be unaccessible.
Tests: accessibility/aria-modal-multiple-dialogs.html
accessibility/aria-modal.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::~AXObjectCache):
(WebCore::AXObjectCache::findAriaModalNodes):
(WebCore::AXObjectCache::updateCurrentAriaModalNode):
(WebCore::AXObjectCache::isNodeVisible):
(WebCore::AXObjectCache::ariaModalNode):
(WebCore::AXObjectCache::focusedImageMapUIElement):
(WebCore::AXObjectCache::remove):
(WebCore::AXObjectCache::handleAttributeChanged):
(WebCore::AXObjectCache::handleAriaModalChange):
(WebCore::AXObjectCache::labelChanged):
* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::handleActiveDescendantChanged):
(WebCore::AXObjectCache::handleAriaExpandedChange):
(WebCore::AXObjectCache::handleAriaRoleChanged):
(WebCore::AXObjectCache::handleAriaModalChange):
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
(WebCore::AXObjectCache::handleScrollbarUpdate):
(WebCore::AXObjectCache::handleAttributeChanged):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::ariaCurrentState):
(WebCore::AccessibilityObject::isAriaModalDescendant):
(WebCore::AccessibilityObject::ignoredFromARIAModalPresence):
(WebCore::AccessibilityObject::hasTagName):
(WebCore::AccessibilityObject::defaultObjectInclusion):
* accessibility/AccessibilityObject.h:
* html/HTMLAttributeNames.in:
LayoutTests:
* accessibility/aria-modal-expected.txt: Added.
* accessibility/aria-modal-multiple-dialogs-expected.txt: Added.
* accessibility/aria-modal-multiple-dialogs.html: Added.
* accessibility/aria-modal.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCacheh">trunk/Source/WebCore/accessibility/AXObjectCache.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAttributeNamesin">trunk/Source/WebCore/html/HTMLAttributeNames.in</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilityariamodalexpectedtxt">trunk/LayoutTests/accessibility/aria-modal-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariamodalmultipledialogsexpectedtxt">trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariamodalmultipledialogshtml">trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariamodalhtml">trunk/LayoutTests/accessibility/aria-modal.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191930 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-03 01:19:17 UTC (rev 191930)
+++ trunk/LayoutTests/ChangeLog        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-11-02 Nan Wang <n_wang@apple.com>
+
+ AX: Add support for ARIA 1.1 attribute 'aria-modal' for dialog and alertdialog
+ https://bugs.webkit.org/show_bug.cgi?id=138566
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/aria-modal-expected.txt: Added.
+ * accessibility/aria-modal-multiple-dialogs-expected.txt: Added.
+ * accessibility/aria-modal-multiple-dialogs.html: Added.
+ * accessibility/aria-modal.html: Added.
+
</ins><span class="cx"> 2015-11-02 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Modern IDB: IBDObjectStore.delete() support.
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariamodalexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/aria-modal-expected.txt (0 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-modal-expected.txt         (rev 0)
+++ trunk/LayoutTests/accessibility/aria-modal-expected.txt        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+This tests that aria-modal on dialog makes other elements inert.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS backgroundAccessible() is false
+PASS backgroundAccessible() is true
+PASS backgroundAccessible() is false
+PASS okBtn.isIgnored is false
+PASS backgroundAccessible() is true
+PASS backgroundAccessible() is true
+PASS backgroundAccessible() is false
+PASS backgroundAccessible() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Other page content with a dummy focusable element
+
+Display a dialog
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariamodalmultipledialogsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs-expected.txt (0 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs-expected.txt         (rev 0)
+++ trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs-expected.txt        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+This tests that aria-modal works correctly on multiple dialogs
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS backgroundAccessible() is true
+PASS backgroundAccessible() is false
+PASS dialog1Accessible() is true
+PASS backgroundAccessible() is false
+PASS dialog1Accessible() is false
+PASS closeBtn.isIgnored is false
+PASS backgroundAccessible() is false
+PASS dialog1Accessible() is true
+PASS backgroundAccessible() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Other page content with a dummy focusable element
+
+Display a dialog
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariamodalmultipledialogshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs.html (0 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs.html         (rev 0)
+++ trunk/LayoutTests/accessibility/aria-modal-multiple-dialogs.html        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+
+<style>
+.box-hidden {
+ display: none;
+}
+</style>
+
+<body id="body">
+
+<div id="bg">
+<p id="bgContent">Other page content with <a href="#">a dummy focusable element</a></p>
+<p><a onclick="toggleDialog(document.getElementById('box'),'show'); return false;" href="#" role="button" id="displayBtn">Display a dialog</a></p>
+</div>
+
+<div role="dialog" aria-labelledby="myDialog" id="box" class="box-hidden" tabindex="-1">
+ <h3 id="myDialog">Just an example.</h3>
+ <button id="ok" onclick="toggleDialog(document.getElementById('box'),'hide');" class="close-button">OK</button>
+ <button onclick="toggleDialog(document.getElementById('box2'),'show');" id="new">New</button>
+</div>
+
+<div role="dialog" aria-labelledby="myDialog2" id="box2" class="box-hidden" tabindex="-1">
+ <h3 id="myDialog2">Another dialog.</h3>
+ <button id="close" onclick="toggleDialog(document.getElementById('box2'),'hide');" class="close-button">Close</button>
+</div>
+
+
+<script>
+
+ description("This tests that aria-modal works correctly on multiple dialogs");
+
+ if (window.accessibilityController) {
+ // Background should be accessible after loading.
+ shouldBeTrue("backgroundAccessible()");
+
+ // Click the display button, dialog1 shows and background becomes unaccessible.
+ document.getElementById("displayBtn").click();
+ shouldBeFalse("backgroundAccessible()");
+ shouldBeTrue("dialog1Accessible()");
+
+ // Click the new button, dialog2 shows and background/dialog1 should both be unaccessible.
+ document.getElementById("new").click();
+ shouldBeFalse("backgroundAccessible()");
+ shouldBeFalse("dialog1Accessible()");
+ var closeBtn = accessibilityController.accessibleElementById("close");
+ shouldBeFalse("closeBtn.isIgnored");
+
+ // Close dialog2, dialog1 should become accessible but not the background
+ document.getElementById("close").click();
+ shouldBeFalse("backgroundAccessible()");
+ shouldBeTrue("dialog1Accessible()");
+
+ // Close dialog1, background should be accessible.
+ document.getElementById("ok").click();
+ shouldBeTrue("backgroundAccessible()");
+ }
+
+ function backgroundAccessible() {
+ var displayBtn = accessibilityController.accessibleElementById("displayBtn");
+ var bgContent = accessibilityController.accessibleElementById("bgContent");
+ if (!displayBtn || !bgContent)
+ return false;
+ return !displayBtn.isIgnored && !bgContent.isIgnored;
+ }
+
+ function dialog1Accessible() {
+ var okBtn = accessibilityController.accessibleElementById("ok");
+ var newBtn = accessibilityController.accessibleElementById("new");
+ if (!okBtn || !newBtn)
+ return false;
+ return !okBtn.isIgnored && !newBtn.isIgnored;
+ }
+
+ function toggleDialog(dialog, sh) {
+ if (sh == "show") {
+ // show the dialog
+ dialog.style.display = 'block';
+ dialog.setAttribute("aria-modal", "true");
+ } else {
+ dialog.style.display = 'none';
+ dialog.setAttribute("aria-modal", "false");
+ }
+}
+
+</script>
+
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariamodalhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/aria-modal.html (0 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-modal.html         (rev 0)
+++ trunk/LayoutTests/accessibility/aria-modal.html        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+
+<body id="body">
+
+<div id="bg">
+<p id="bgContent">Other page content with <a href="#">a dummy focusable element</a></p>
+<p><a onclick="toggleDialog('show'); return false;" href="#" role="button" id="displayBtn">Display a dialog</a></p>
+</div>
+
+<div role="dialog" aria-modal="true" aria-labelledby="myDialog" id="box" class="box-hidden" tabindex="-1">
+ <h3 id="myDialog">Just an example.</h3>
+ <button id="ok" onclick="toggleDialog('hide');" class="close-button">OK</button>
+ <button onclick="toggleDialog('hide');" class="close-button">Cancel</button>
+</div>
+
+
+<script>
+
+ description("This tests that aria-modal on dialog makes other elements inert.");
+
+ if (window.accessibilityController) {
+ // Background should be unaccessible after loading, since the
+ // dialog is displayed and aria-modal=true.
+ shouldBeFalse("backgroundAccessible()");
+
+ // Close the dialog, background should be accessible.
+ document.getElementById("ok").click();
+ shouldBeTrue("backgroundAccessible()");
+
+ // Click the display button, dialog shows and background becomes unaccessible.
+ document.getElementById("displayBtn").click();
+ shouldBeFalse("backgroundAccessible()");
+ var okBtn = accessibilityController.accessibleElementById("ok");
+ shouldBeFalse("okBtn.isIgnored");
+
+ // Test the case that aria-modal=true when dialog is hidden won't affect other objects.
+ // 1. Dialog not rendered
+ document.getElementById("ok").click();
+ document.getElementById("box").setAttribute("aria-modal", "true");
+ shouldBeTrue("backgroundAccessible()");
+ // 2. Dialog is aria hidden
+ document.getElementById("displayBtn").click();
+ document.getElementById("box").setAttribute("aria-hidden", "true");
+ shouldBeTrue("backgroundAccessible()");
+ document.getElementById("box").setAttribute("aria-hidden", "false");
+ shouldBeFalse("backgroundAccessible()");
+
+ // Test modal dialog is removed from DOM tree.
+ var dialog = document.getElementById("box");
+ dialog.parentNode.removeChild(dialog);
+ shouldBeTrue("backgroundAccessible()");
+ }
+
+ function backgroundAccessible() {
+ var displayBtn = accessibilityController.accessibleElementById("displayBtn");
+ var bgContent = accessibilityController.accessibleElementById("bgContent");
+
+ if (!displayBtn || !bgContent)
+ return false;
+
+ return !displayBtn.isIgnored && !bgContent.isIgnored;
+ }
+
+ function toggleDialog(sh) {
+ dialog = document.getElementById("box");
+ if (sh == "show") {
+ // show the dialog
+ dialog.style.display = 'block';
+ dialog.setAttribute("aria-modal", "true");
+ } else {
+ dialog.style.display = 'none';
+ dialog.setAttribute("aria-modal", "false");
+ }
+}
+
+</script>
+
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191930 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-03 01:19:17 UTC (rev 191930)
+++ trunk/Source/WebCore/ChangeLog        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2015-11-02 Nan Wang <n_wang@apple.com>
+
+ AX: Add support for ARIA 1.1 attribute 'aria-modal' for dialog and alertdialog
+ https://bugs.webkit.org/show_bug.cgi?id=138566
+
+ Reviewed by Chris Fleizach.
+
+ Added support for aria-modal attribute on dialog/alertdialog roles.
+ When modal dialog is displayed, all other contents will be unaccessible.
+
+ Tests: accessibility/aria-modal-multiple-dialogs.html
+ accessibility/aria-modal.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::AXObjectCache):
+ (WebCore::AXObjectCache::~AXObjectCache):
+ (WebCore::AXObjectCache::findAriaModalNodes):
+ (WebCore::AXObjectCache::updateCurrentAriaModalNode):
+ (WebCore::AXObjectCache::isNodeVisible):
+ (WebCore::AXObjectCache::ariaModalNode):
+ (WebCore::AXObjectCache::focusedImageMapUIElement):
+ (WebCore::AXObjectCache::remove):
+ (WebCore::AXObjectCache::handleAttributeChanged):
+ (WebCore::AXObjectCache::handleAriaModalChange):
+ (WebCore::AXObjectCache::labelChanged):
+ * accessibility/AXObjectCache.h:
+ (WebCore::AXObjectCache::handleActiveDescendantChanged):
+ (WebCore::AXObjectCache::handleAriaExpandedChange):
+ (WebCore::AXObjectCache::handleAriaRoleChanged):
+ (WebCore::AXObjectCache::handleAriaModalChange):
+ (WebCore::AXObjectCache::handleFocusedUIElementChanged):
+ (WebCore::AXObjectCache::handleScrollbarUpdate):
+ (WebCore::AXObjectCache::handleAttributeChanged):
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::ariaCurrentState):
+ (WebCore::AccessibilityObject::isAriaModalDescendant):
+ (WebCore::AccessibilityObject::ignoredFromARIAModalPresence):
+ (WebCore::AccessibilityObject::hasTagName):
+ (WebCore::AccessibilityObject::defaultObjectInclusion):
+ * accessibility/AccessibilityObject.h:
+ * html/HTMLAttributeNames.in:
+
</ins><span class="cx"> 2015-11-02 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Modern IDB: IBDObjectStore.delete() support.
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (191930 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-11-03 01:19:17 UTC (rev 191930)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -142,7 +142,9 @@
</span><span class="cx"> , m_notificationPostTimer(*this, &AXObjectCache::notificationPostTimerFired)
</span><span class="cx"> , m_passwordNotificationPostTimer(*this, &AXObjectCache::passwordNotificationPostTimerFired)
</span><span class="cx"> , m_liveRegionChangedPostTimer(*this, &AXObjectCache::liveRegionChangedNotificationPostTimerFired)
</span><ins>+ , m_currentAriaModalNode(nullptr)
</ins><span class="cx"> {
</span><ins>+ findAriaModalNodes();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> AXObjectCache::~AXObjectCache()
</span><span class="lines">@@ -157,6 +159,91 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void AXObjectCache::findAriaModalNodes()
+{
+ // Traverse the DOM tree to look for the aria-modal=true nodes.
+ for (Element* element = ElementTraversal::firstWithin(document().rootNode()); element; element = ElementTraversal::nextIncludingPseudo(*element)) {
+
+ // Must have dialog or alertdialog role
+ if (!nodeHasRole(element, "dialog") && !nodeHasRole(element, "alertdialog"))
+ continue;
+ if (!equalIgnoringCase(element->fastGetAttribute(aria_modalAttr), "true"))
+ continue;
+
+ m_ariaModalNodesSet.add(element);
+ }
+
+ // Set the current valid aria-modal node if possible.
+ updateCurrentAriaModalNode();
+}
+
+void AXObjectCache::updateCurrentAriaModalNode()
+{
+ // There might be multiple nodes with aria-modal=true set.
+ // We use this function to pick the one we want.
+ m_currentAriaModalNode = nullptr;
+ if (m_ariaModalNodesSet.isEmpty())
+ return;
+
+ // We only care about the nodes which are visible.
+ ListHashSet<RefPtr<Node>> visibleNodes;
+ for (auto& object : m_ariaModalNodesSet) {
+ if (isNodeVisible(object))
+ visibleNodes.add(object);
+ }
+
+ if (visibleNodes.isEmpty())
+ return;
+
+ // If any of the node are keyboard focused, we want to pick that.
+ Node* focusedNode = document().focusedElement();
+ for (auto& object : visibleNodes) {
+ if (focusedNode != nullptr && focusedNode->isDescendantOf(object.get())) {
+ m_currentAriaModalNode = object.get();
+ break;
+ }
+ }
+
+ // If none of the nodes are focused, we want to pick the last dialog in the DOM.
+ if (!m_currentAriaModalNode)
+ m_currentAriaModalNode = visibleNodes.last().get();
+}
+
+bool AXObjectCache::isNodeVisible(Node* node) const
+{
+ if (!is<Element>(node))
+ return false;
+
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
+ return false;
+ const RenderStyle& style = renderer->style();
+ if (style.display() == NONE || style.visibility() != VISIBLE)
+ return false;
+
+ // We also need to consider aria hidden status.
+ if (!isNodeAriaVisible(node))
+ return false;
+
+ return true;
+}
+
+Node* AXObjectCache::ariaModalNode()
+{
+ // This function returns the valid aria modal node.
+ if (m_ariaModalNodesSet.isEmpty())
+ return nullptr;
+
+ // Check the current valid aria modal node first.
+ // Usually when one dialog sets aria-modal=true, that dialog is the one we want.
+ if (isNodeVisible(m_currentAriaModalNode))
+ return m_currentAriaModalNode;
+
+ // Recompute the valid aria modal node when m_currentAriaModalNode is null or hidden.
+ updateCurrentAriaModalNode();
+ return isNodeVisible(m_currentAriaModalNode) ? m_currentAriaModalNode : nullptr;
+}
+
</ins><span class="cx"> AccessibilityObject* AXObjectCache::focusedImageMapUIElement(HTMLAreaElement* areaElement)
</span><span class="cx"> {
</span><span class="cx"> // Find the corresponding accessibility object for the HTMLAreaElement. This should be
</span><span class="lines">@@ -571,6 +658,12 @@
</span><span class="cx"> remove(axID);
</span><span class="cx"> m_nodeObjectMapping.remove(node);
</span><span class="cx">
</span><ins>+ // Cleanup for aria modal nodes.
+ if (m_currentAriaModalNode == node)
+ m_currentAriaModalNode = nullptr;
+ if (m_ariaModalNodesSet.contains(node))
+ m_ariaModalNodesSet.remove(node);
+
</ins><span class="cx"> if (node->renderer()) {
</span><span class="cx"> remove(node->renderer());
</span><span class="cx"> return;
</span><span class="lines">@@ -1248,10 +1341,34 @@
</span><span class="cx"> childrenChanged(element->parentNode(), element);
</span><span class="cx"> else if (attrName == aria_invalidAttr)
</span><span class="cx"> postNotification(element, AXObjectCache::AXInvalidStatusChanged);
</span><ins>+ else if (attrName == aria_modalAttr)
+ handleAriaModalChange(element);
</ins><span class="cx"> else
</span><span class="cx"> postNotification(element, AXObjectCache::AXAriaAttributeChanged);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void AXObjectCache::handleAriaModalChange(Node* node)
+{
+ if (!is<Element>(node))
+ return;
+
+ if (!nodeHasRole(node, "dialog") && !nodeHasRole(node, "alertdialog"))
+ return;
+
+ stopCachingComputedObjectAttributes();
+ if (equalIgnoringCase(downcast<Element>(*node).fastGetAttribute(aria_modalAttr), "true")) {
+ // Add the newly modified node to the modal nodes set, and set it to be the current valid aria modal node.
+ // We will recompute the current valid aria modal node in ariaModalNode() when this node is not visible.
+ m_ariaModalNodesSet.add(node);
+ m_currentAriaModalNode = node;
+ } else {
+ // Remove the node from the modal nodes set. There might be other visible modal nodes, so we recompute here.
+ m_ariaModalNodesSet.remove(node);
+ updateCurrentAriaModalNode();
+ }
+ startCachingComputedObjectAttributesUntilTreeMutates();
+}
+
</ins><span class="cx"> void AXObjectCache::labelChanged(Element* element)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(is<HTMLLabelElement>(*element));
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (191930 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.h        2015-11-03 01:19:17 UTC (rev 191930)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -128,6 +128,9 @@
</span><span class="cx"> void handleScrolledToAnchor(const Node* anchorNode);
</span><span class="cx"> void handleAriaExpandedChange(Node*);
</span><span class="cx"> void handleScrollbarUpdate(ScrollView*);
</span><ins>+
+ void handleAriaModalChange(Node*);
+ Node* ariaModalNode();
</ins><span class="cx">
</span><span class="cx"> void handleAttributeChanged(const QualifiedName& attrName, Element*);
</span><span class="cx"> void recomputeIsIgnored(RenderObject* renderer);
</span><span class="lines">@@ -271,6 +274,11 @@
</span><span class="cx"> void handleMenuOpened(Node*);
</span><span class="cx"> void handleLiveRegionCreated(Node*);
</span><span class="cx"> void handleMenuItemSelected(Node*);
</span><ins>+
+ // aria-modal related
+ void findAriaModalNodes();
+ void updateCurrentAriaModalNode();
+ bool isNodeVisible(Node*) const;
</ins><span class="cx">
</span><span class="cx"> Document& m_document;
</span><span class="cx"> HashMap<AXID, RefPtr<AccessibilityObject>> m_objects;
</span><span class="lines">@@ -293,6 +301,9 @@
</span><span class="cx">
</span><span class="cx"> Timer m_liveRegionChangedPostTimer;
</span><span class="cx"> ListHashSet<RefPtr<AccessibilityObject>> m_liveRegionObjectsSet;
</span><ins>+
+ Node* m_currentAriaModalNode;
+ ListHashSet<Node*> m_ariaModalNodesSet;
</ins><span class="cx">
</span><span class="cx"> AXTextStateChangeIntent m_textSelectionIntent;
</span><span class="cx"> bool m_isSynchronizingSelection { false };
</span><span class="lines">@@ -348,6 +359,7 @@
</span><span class="cx"> inline void AXObjectCache::handleActiveDescendantChanged(Node*) { }
</span><span class="cx"> inline void AXObjectCache::handleAriaExpandedChange(Node*) { }
</span><span class="cx"> inline void AXObjectCache::handleAriaRoleChanged(Node*) { }
</span><ins>+inline void AXObjectCache::handleAriaModalChange(Node*) { }
</ins><span class="cx"> inline void AXObjectCache::handleFocusedUIElementChanged(Node*, Node*) { }
</span><span class="cx"> inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
</span><span class="cx"> inline void AXObjectCache::handleAttributeChanged(const QualifiedName&, Element*) { }
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (191930 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2015-11-03 01:19:17 UTC (rev 191930)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "AccessibilityTable.h"
</span><span class="cx"> #include "DOMTokenList.h"
</span><span class="cx"> #include "Editor.h"
</span><ins>+#include "ElementIterator.h"
</ins><span class="cx"> #include "EventHandler.h"
</span><span class="cx"> #include "FloatRect.h"
</span><span class="cx"> #include "FocusController.h"
</span><span class="lines">@@ -1846,6 +1847,45 @@
</span><span class="cx"> return ARIACurrentTrue;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool AccessibilityObject::isAriaModalDescendant(Node* ariaModalNode) const
+{
+ if (!ariaModalNode || !this->element())
+ return false;
+
+ if (this->element() == ariaModalNode)
+ return true;
+
+ // ARIA 1.1 aria-modal, indicates whether an element is modal when displayed.
+ // For the decendants of the modal object, they should also be considered as aria-modal=true.
+ for (auto& ancestor : elementAncestors(this->element())) {
+ if (&ancestor == ariaModalNode)
+ return true;
+ }
+ return false;
+}
+
+bool AccessibilityObject::ignoredFromARIAModalPresence() const
+{
+ // We shouldn't ignore the top node.
+ if (!node() || !node()->parentNode())
+ return false;
+
+ AXObjectCache* cache = axObjectCache();
+ if (!cache)
+ return false;
+
+ // ariaModalNode is the current displayed modal dialog.
+ Node* ariaModalNode = cache->ariaModalNode();
+ if (!ariaModalNode)
+ return false;
+
+ // We only want to ignore the objects within the same frame as the modal dialog.
+ if (ariaModalNode->document().frame() != this->frame())
+ return false;
+
+ return !isAriaModalDescendant(ariaModalNode);
+}
+
</ins><span class="cx"> bool AccessibilityObject::hasTagName(const QualifiedName& tagName) const
</span><span class="cx"> {
</span><span class="cx"> Node* node = this->node();
</span><span class="lines">@@ -2786,6 +2826,9 @@
</span><span class="cx"> if (isARIAHidden())
</span><span class="cx"> return IgnoreObject;
</span><span class="cx">
</span><ins>+ if (ignoredFromARIAModalPresence())
+ return IgnoreObject;
+
</ins><span class="cx"> if (isPresentationalChildOfAriaRole())
</span><span class="cx"> return IgnoreObject;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (191930 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2015-11-03 01:19:17 UTC (rev 191930)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -631,6 +631,10 @@
</span><span class="cx"> const AtomicString& roleDescription() const;
</span><span class="cx"> AccessibilityARIACurrentState ariaCurrentState() const;
</span><span class="cx">
</span><ins>+ // This function checks if the object should be ignored when there's a modal dialog displayed.
+ bool ignoredFromARIAModalPresence() const;
+ bool isAriaModalDescendant(Node*) const;
+
</ins><span class="cx"> bool supportsARIASetSize() const;
</span><span class="cx"> bool supportsARIAPosInSet() const;
</span><span class="cx"> int ariaSetSize() const;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAttributeNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (191930 => 191931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAttributeNames.in        2015-11-03 01:19:17 UTC (rev 191930)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in        2015-11-03 01:52:38 UTC (rev 191931)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> aria-labelledby
</span><span class="cx"> aria-level
</span><span class="cx"> aria-live
</span><ins>+aria-modal
</ins><span class="cx"> aria-multiline
</span><span class="cx"> aria-multiselectable
</span><span class="cx"> aria-orientation
</span></span></pre>
</div>
</div>
</body>
</html>