<!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>[187606] branches/safari-601.1-branch</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/187606">187606</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-07-30 14:20:34 -0700 (Thu, 30 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/187278">r187278</a>. rdar://problem/19908029</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsChangeLog">branches/safari-601.1-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssentexpectedtxt">branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssenthtml">branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsexpectedtxt">branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationshtml">branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreaccessibilityAXObjectCachecpp">branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreaccessibilityAXObjectCacheh">branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.h</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreaccessibilityAccessibilityNodeObjectcpp">branches/safari-601.1-branch/Source/WebCore/accessibility/AccessibilityNodeObject.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacaccessibilityariamultipleliveregionsnotificationexpectedtxt">branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacaccessibilityariamultipleliveregionsnotificationhtml">branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/ChangeLog (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2015-07-30  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r187278. rdar://problem/19908029
+
+    2015-07-23  Nan Wang  &lt;n_wang@apple.com&gt;
+
+            AX: AccessibilityNodeObject::childrenChanged() generates too many AXLiveRegionChanged notifications
+            https://bugs.webkit.org/show_bug.cgi?id=147211
+            &lt;rdar://problem/19908029&gt;
+
+            Reviewed by Chris Fleizach.
+
+            * platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt:
+            * platform/mac/accessibility/aria-liveregions-notifications-always-sent.html:
+            * platform/mac/accessibility/aria-liveregions-notifications-expected.txt:
+            * platform/mac/accessibility/aria-liveregions-notifications.html:
+            * platform/mac/accessibility/aria-multiple-liveregions-notification-expected.txt: Added.
+            * platform/mac/accessibility/aria-multiple-liveregions-notification.html: Added.
+
+2015-07-30  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r187504. rdar://problem/21915355
</span><span class="cx"> 
</span><span class="cx">     2015-07-28  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssentexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent-expected.txt        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> PASS addedNotification is true
</span><ins>+PASS liveRegionChangeCount == 3 is true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsalwayssenthtml"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-always-sent.html        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -13,23 +13,18 @@
</span><span class="cx"> &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><ins>+    var jsTestIsAsync = true;
</ins><span class="cx"> 
</span><span class="cx">     description(&quot;This tests that ARIA live region notifications are sent even when an assistive technology is not accessing them directly on each update.&quot;);
</span><span class="cx"> 
</span><span class="cx">     if (window.accessibilityController) {
</span><del>-        window.testRunner.waitUntilDone();
</del><span class="cx"> 
</span><del>-        document.getElementById(&quot;liveregion&quot;).focus();
-        liveRegion = window.accessibilityController.focusedElement;
</del><ins>+        liveRegion = accessibilityController.accessibleElementById(&quot;liveregion&quot;);
</ins><span class="cx"> 
</span><span class="cx">         var liveRegionChangeCount = 0;
</span><span class="cx">         function ariaCallback(notification) {
</span><span class="cx">            if (notification == &quot;AXLiveRegionChanged&quot;) {
</span><span class="cx">                liveRegionChangeCount++;
</span><del>-               if (liveRegionChangeCount == 3) {
-                   liveRegion.removeNotificationListener();
-                   window.testRunner.notifyDone();
-               }
</del><span class="cx">            }
</span><span class="cx">         }
</span><span class="cx">         var addedNotification = liveRegion.addNotificationListener(ariaCallback);
</span><span class="lines">@@ -37,11 +32,33 @@
</span><span class="cx"> 
</span><span class="cx">         // this should trigger our live region callback for a new element.
</span><span class="cx">         for (var k = 0; k &lt; 3; k++) {
</span><del>-           var textNode = document.createTextNode(&quot;test&quot; + k);
-           document.getElementById(&quot;liveregion&quot;).appendChild(textNode);
</del><ins>+            // AXLiveRegionsChanged notifications are sent after a delay, so in order to ensure we 
+            // get an notification for each operation we should avoid coalescing which can occur
+            doSetTimeout(k);
</ins><span class="cx">         }
</span><ins>+
+        // add a short delay to check after all the operations if we have exactly three notificaitons
+        setTimeout(&quot;finishTest()&quot;, 200);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    function doSetTimeout(k) {
+        setTimeout(function() {
+            operation(k);
+        }, k * 30);
+    }
+
+    function operation(k) {
+        var textNode = document.createTextNode(&quot;test&quot; + k);
+        document.getElementById(&quot;liveregion&quot;).appendChild(textNode);
+    }
+    
+    function finishTest() {
+        // We should get a total of three live region changes.
+        liveRegion.removeNotificationListener();
+        shouldBeTrue(&quot;liveRegionChangeCount == 3&quot;);
+        finishJSTest();
+    }
+
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationsexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications-expected.txt        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> PASS addedNotification is true
</span><ins>+PASS liveRegionChangeCount == 4 is true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacaccessibilityarialiveregionsnotificationshtml"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-liveregions-notifications.html        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx"> &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><ins>+    var jsTestIsAsync = true;
</ins><span class="cx"> 
</span><span class="cx">     description(&quot;This tests that ARIA live regions are sending out the correct notifications. We perform four operations (add, remove, change text, change alt tag), each one should trigger a live region notification&quot;);
</span><span class="cx"> 
</span><span class="lines">@@ -22,41 +23,58 @@
</span><span class="cx">     function ariaCallback(notification) {
</span><span class="cx">         if (notification == &quot;AXLiveRegionChanged&quot;) {
</span><span class="cx">             liveRegionChangeCount++;
</span><del>-
-            // We should get a total of 4 live region changes.
-            if (liveRegionChangeCount == 4) {
-               liveRegion.removeNotificationListener();
-               window.testRunner.notifyDone();
-            }
</del><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (window.accessibilityController) {
</span><del>-        window.testRunner.waitUntilDone();
</del><span class="cx"> 
</span><del>-        document.getElementById(&quot;liveregion&quot;).focus();
-        liveRegion = window.accessibilityController.focusedElement;
</del><ins>+        liveRegion = accessibilityController.accessibleElementById(&quot;liveregion&quot;);
</ins><span class="cx"> 
</span><span class="cx">         var addedNotification = liveRegion.addNotificationListener(ariaCallback);
</span><span class="cx">         shouldBe(&quot;addedNotification&quot;, &quot;true&quot;);
</span><span class="cx"> 
</span><ins>+        // AXLiveRegionsChanged notifications are sent after a delay, so in order to ensure we 
+        // get an notification for each operation we should avoid coalescing which can occur
+        setTimeout(&quot;textChangeOperation()&quot;, 0);
+        setTimeout(&quot;newElementOperation()&quot;, 30);
+        setTimeout(&quot;alternativeChangeOperation()&quot;, 60);
+        setTimeout(&quot;removeElementOperation()&quot;, 90);
+
+        // add a short delay to check after all the operations if we have exactly four notificaitons
+        setTimeout(&quot;finishTest()&quot;, 200);
+    }
+
+    function textChangeOperation() {
</ins><span class="cx">         // this should trigger our live region callback for a text change.
</span><del>-        document.getElementById(&quot;innerlive&quot;).innerText = &quot;changed text&quot;;
</del><ins>+        document.getElementById(&quot;liveregion&quot;).childNodes[0].innerText = &quot;changed text&quot;;
+    }
</ins><span class="cx"> 
</span><ins>+    function newElementOperation() {
</ins><span class="cx">         // this should trigger our live region callback for a new element.
</span><span class="cx">         document.getElementById(&quot;liveregion&quot;).innerHTML += &quot;new text element&quot;;
</span><ins>+    }
</ins><span class="cx"> 
</span><ins>+    function alternativeChangeOperation() {
</ins><span class="cx">         // this should also trigger our live region change because its a text alternative change. 
</span><span class="cx">         document.getElementById(&quot;image&quot;).setAttribute('alt', &quot;new image text&quot;);
</span><span class="cx"> 
</span><span class="cx">         // Access the accessibility tree here because AX won't post the live region change
</span><span class="cx">         // notification twice when the children have already been marked as dirty.
</span><span class="cx">         liveRegion.childAtIndex(0);
</span><ins>+    }
</ins><span class="cx"> 
</span><ins>+    function removeElementOperation() {
</ins><span class="cx">         // this should trigger our live region callback for a removed element.
</span><span class="cx">         document.getElementById(&quot;liveregion&quot;).removeChild(document.getElementById(&quot;innerlive&quot;)); 
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    function finishTest() {
+        // We should get a total of four live region changes.
+        liveRegion.removeNotificationListener();
+        shouldBeTrue(&quot;liveRegionChangeCount == 4&quot;);
+        finishJSTest();
+    }
+
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacaccessibilityariamultipleliveregionsnotificationexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification-expected.txt (0 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification-expected.txt                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification-expected.txt        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+changed text
+
+new text element
+This tests that ARIA live regions are sending out the correct notifications. We perform two operations to each aria region, at the end it should trigger two live region notifications
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS addedNotification1 is true
+PASS addedNotification2 is true
+PASS liveRegionChangeCount == 2 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacaccessibilityariamultipleliveregionsnotificationhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification.html (0 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/accessibility/aria-multiple-liveregions-notification.html        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+
+&lt;div role=&quot;group&quot; tabindex=0 id=&quot;liveregion1&quot; aria-live=&quot;polite&quot; aria-relevant=&quot;additions&quot;&gt;
+&lt;h3 id=&quot;innerlive&quot;&gt;text&lt;/h3&gt;
+&lt;/div&gt;
+
+&lt;div role=&quot;group&quot; tabindex=0 id=&quot;liveregion2&quot; aria-live=&quot;polite&quot; aria-relevant=&quot;additions&quot;&gt;
+&lt;img src=&quot;test.gif&quot; width=100 height=100 alt=&quot;alt text&quot; tabindex=0 id=&quot;image&quot;&gt;
+&lt;/div&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    var jsTestIsAsync = true;
+
+    description(&quot;This tests that ARIA live regions are sending out the correct notifications. We perform two operations to each aria region, at the end it should trigger two live region notifications&quot;);
+
+    var liveRegion1 = 0;
+    var liveRegion2 = 0;
+    var liveRegionChangeCount = 0;
+    function ariaCallback(notification) {
+        if (notification == &quot;AXLiveRegionChanged&quot;) {
+            liveRegionChangeCount++;
+        }
+    }
+
+    if (window.accessibilityController) {
+
+        liveRegion1 = accessibilityController.accessibleElementById(&quot;liveregion1&quot;);
+        var addedNotification1 = liveRegion1.addNotificationListener(ariaCallback);
+        shouldBe(&quot;addedNotification1&quot;, &quot;true&quot;);
+
+        liveRegion2 = accessibilityController.accessibleElementById(&quot;liveregion2&quot;);
+        var addedNotification2 = liveRegion2.addNotificationListener(ariaCallback);
+        shouldBe(&quot;addedNotification2&quot;, &quot;true&quot;);
+
+        // perform operations on both live regions.
+        textChangeOperation();
+        newElementOperation();
+        alternativeChangeOperation();
+        removeElementOperation();
+
+        // add a short delay to check after all the operations if we have exactly two notificaitons
+        setTimeout(&quot;finishTest()&quot;, 10);
+    }
+
+    function textChangeOperation() {
+        // this should trigger a live region change for a text change.
+        document.getElementById(&quot;innerlive&quot;).innerText = &quot;changed text&quot;;
+    }
+
+    function newElementOperation() {
+        // this should trigger a live region change for a new element.
+        document.getElementById(&quot;liveregion1&quot;).innerHTML += &quot;new text element&quot;;
+    }
+
+    function alternativeChangeOperation() {
+        // this should also trigger a live region change because its a text alternative change. 
+        document.getElementById(&quot;image&quot;).setAttribute('alt', &quot;new image text&quot;);
+    }
+
+    function removeElementOperation() {
+        // this should trigger a live region change for a removed element.
+        document.getElementById(&quot;liveregion2&quot;).removeChild(document.getElementById(&quot;image&quot;)); 
+    }
+
+    function finishTest() {
+        // We should get a total of two live region changes.
+        liveRegion1.removeNotificationListener();
+        liveRegion2.removeNotificationListener();
+        shouldBeTrue(&quot;liveRegionChangeCount == 2&quot;);
+        finishJSTest();
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -1,5 +1,35 @@
</span><span class="cx"> 2015-07-30  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r187278. rdar://problem/19908029
+
+    2015-07-23  Nan Wang  &lt;n_wang@apple.com&gt;
+
+            AX: AccessibilityNodeObject::childrenChanged() generates too many AXLiveRegionChanged notifications
+            https://bugs.webkit.org/show_bug.cgi?id=147211
+            &lt;rdar://problem/19908029&gt;
+
+            Reviewed by Chris Fleizach.
+
+            AccessibilityNodeObject::childrenChanged() can be called repeatedly, generating a live region
+            change notification each time. Sometimes, so many happen that VoiceOver hangs. We can use a timer
+            to make sure that we coalesce these notifications.
+
+            Test: platform/mac/accessibility/aria-multiple-liveregions-notification.html
+
+            * accessibility/AXObjectCache.cpp:
+            (WebCore::AXComputedObjectAttributeCache::getIgnored):
+            (WebCore::AXObjectCache::AXObjectCache):
+            (WebCore::AXObjectCache::~AXObjectCache):
+            (WebCore::AXObjectCache::frameLoadingEventNotification):
+            (WebCore::AXObjectCache::postLiveRegionChangeNotification):
+            (WebCore::AXObjectCache::liveRegionChangedNotificationPostTimerFired):
+            (WebCore::AXObjectCache::handleScrollbarUpdate):
+            * accessibility/AXObjectCache.h:
+            * accessibility/AccessibilityNodeObject.cpp:
+            (WebCore::AccessibilityNodeObject::childrenChanged):
+
+2015-07-30  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r187504. rdar://problem/21915355
</span><span class="cx"> 
</span><span class="cx">     2015-07-28  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.cpp (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.cpp        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.cpp        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx"> 
</span><span class="cx"> // Post value change notifications for password fields or elements contained in password fields at a 40hz interval to thwart analysis of typing cadence
</span><span class="cx"> static double AccessibilityPasswordValueChangeNotificationInterval = 0.025;
</span><ins>+static double AccessibilityLiveRegionChangedNotificationInterval = 0.020;
</ins><span class="cx"> 
</span><span class="cx"> AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(AXID id) const
</span><span class="cx"> {
</span><span class="lines">@@ -132,12 +133,14 @@
</span><span class="cx">     : m_document(document)
</span><span class="cx">     , m_notificationPostTimer(*this, &amp;AXObjectCache::notificationPostTimerFired)
</span><span class="cx">     , m_passwordNotificationPostTimer(*this, &amp;AXObjectCache::passwordNotificationPostTimerFired)
</span><ins>+    , m_liveRegionChangedPostTimer(*this, &amp;AXObjectCache::liveRegionChangedNotificationPostTimerFired)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> AXObjectCache::~AXObjectCache()
</span><span class="cx"> {
</span><span class="cx">     m_notificationPostTimer.stop();
</span><ins>+    m_liveRegionChangedPostTimer.stop();
</ins><span class="cx"> 
</span><span class="cx">     for (const auto&amp; object : m_objects.values()) {
</span><span class="cx">         detachWrapper(object.get(), CacheDestroyed);
</span><span class="lines">@@ -1144,6 +1147,29 @@
</span><span class="cx">     frameLoadingEventPlatformNotification(obj, loadingEvent);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AXObjectCache::postLiveRegionChangeNotification(AccessibilityObject* object)
+{
+    if (m_liveRegionChangedPostTimer.isActive())
+        m_liveRegionChangedPostTimer.stop();
+
+    if (!m_liveRegionObjectsSet.contains(object))
+        m_liveRegionObjectsSet.add(object);
+
+    m_liveRegionChangedPostTimer.startOneShot(AccessibilityLiveRegionChangedNotificationInterval);
+}
+
+void AXObjectCache::liveRegionChangedNotificationPostTimerFired()
+{
+    m_liveRegionChangedPostTimer.stop();
+
+    if (m_liveRegionObjectsSet.isEmpty())
+        return;
+
+    for (auto&amp; object : m_liveRegionObjectsSet)
+        postNotification(object.get(), object-&gt;document(), AXObjectCache::AXLiveRegionChanged);
+    m_liveRegionObjectsSet.clear();
+}
+
</ins><span class="cx"> void AXObjectCache::handleScrollbarUpdate(ScrollView* view)
</span><span class="cx"> {
</span><span class="cx">     if (!view)
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreaccessibilityAXObjectCacheh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.h (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.h        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/Source/WebCore/accessibility/AXObjectCache.h        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -206,6 +206,7 @@
</span><span class="cx">     void postTextReplacementNotification(Node*, AXTextEditType deletionType, const String&amp; deletedText, AXTextEditType insertionType, const String&amp; insertedText, const VisiblePosition&amp;);
</span><span class="cx">     void postTextStateChangeNotification(Node*, const AXTextStateChangeIntent&amp;, const VisibleSelection&amp;);
</span><span class="cx">     void postTextStateChangeNotification(const Position&amp;, const AXTextStateChangeIntent&amp;, const VisibleSelection&amp;);
</span><ins>+    void postLiveRegionChangeNotification(AccessibilityObject*);
</ins><span class="cx"> 
</span><span class="cx">     enum AXLoadingEvent {
</span><span class="cx">         AXLoadingStarted,
</span><span class="lines">@@ -260,6 +261,8 @@
</span><span class="cx"> 
</span><span class="cx">     void notificationPostTimerFired();
</span><span class="cx"> 
</span><ins>+    void liveRegionChangedNotificationPostTimerFired();
+
</ins><span class="cx">     void postTextStateChangeNotification(AccessibilityObject*, const AXTextStateChangeIntent&amp;, const VisibleSelection&amp;);
</span><span class="cx"> 
</span><span class="cx">     bool enqueuePasswordValueChangeNotification(AccessibilityObject*);
</span><span class="lines">@@ -287,6 +290,9 @@
</span><span class="cx">     Timer m_passwordNotificationPostTimer;
</span><span class="cx"> 
</span><span class="cx">     ListHashSet&lt;RefPtr&lt;AccessibilityObject&gt;&gt; m_passwordNotificationsToPost;
</span><ins>+    
+    Timer m_liveRegionChangedPostTimer;
+    ListHashSet&lt;RefPtr&lt;AccessibilityObject&gt;&gt; m_liveRegionObjectsSet;
</ins><span class="cx"> 
</span><span class="cx">     AXTextStateChangeIntent m_textSelectionIntent;
</span><span class="cx">     bool m_isSynchronizingSelection { false };
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreaccessibilityAccessibilityNodeObjectcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (187605 => 187606)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2015-07-30 20:57:36 UTC (rev 187605)
+++ branches/safari-601.1-branch/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2015-07-30 21:20:34 UTC (rev 187606)
</span><span class="lines">@@ -152,8 +152,11 @@
</span><span class="cx">         // In other words, they need to be sent even when the screen reader has not accessed this live region since the last update.
</span><span class="cx"> 
</span><span class="cx">         // If this element supports ARIA live regions, then notify the AT of changes.
</span><ins>+        // Sometimes this function can be called many times within a short period of time, leading to posting too many AXLiveRegionChanged
+        // notifications. To fix this, we used a timer to make sure we only post one notification for the children changes within a pre-defined
+        // time interval.
</ins><span class="cx">         if (parent-&gt;supportsARIALiveRegion())
</span><del>-            cache-&gt;postNotification(parent, parent-&gt;document(), AXObjectCache::AXLiveRegionChanged);
</del><ins>+            cache-&gt;postLiveRegionChangeNotification(parent);
</ins><span class="cx">         
</span><span class="cx">         // If this element is an ARIA text control, notify the AT of changes.
</span><span class="cx">         if ((parent-&gt;isARIATextControl() || parent-&gt;hasContentEditableAttributeSet()) &amp;&amp; !parent-&gt;isNativeTextControl())
</span></span></pre>
</div>
</div>

</body>
</html>