<!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>[182463] releases/WebKitGTK/webkit-2.4</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/182463">182463</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-04-07 05:23:07 -0700 (Tue, 07 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/176076">r176076</a> - AX: [ATK] Accessible focus events are emitted when the selection is changed in non-focused combo boxes
https://bugs.webkit.org/show_bug.cgi?id=137866

Reviewed by Mario Sanchez Prada.

Source/WebCore:

Check that the AccessibilityMenuList is really focused before notifying
the platform that it is focused. Likewise, only notify the platform of
an AccessibilityMenuListOption focus gain if the AccessibilityMenuList
containing that option is expanded.

Test: platform/gtk/accessibility/menu-list-unfocused-notifications.html

* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::notifyChildrenSelectionChange):
(WebCore::AXObjectCache::postPlatformNotification):

LayoutTests:

* platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt: Added.
* platform/gtk/accessibility/menu-list-unfocused-notifications.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreaccessibilityatkAXObjectCacheAtkcpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestsplatformgtkaccessibilitymenulistunfocusednotificationsexpectedtxt">releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit24LayoutTestsplatformgtkaccessibilitymenulistunfocusednotificationshtml">releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit24LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog (182462 => 182463)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog        2015-04-07 12:12:09 UTC (rev 182462)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog        2015-04-07 12:23:07 UTC (rev 182463)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-11-13  Joanmarie Diggs  &lt;jdiggs@igalia.com&gt;
+
+        AX: [ATK] Accessible focus events are emitted when the selection is changed in non-focused combo boxes
+        https://bugs.webkit.org/show_bug.cgi?id=137866
+
+        Reviewed by Mario Sanchez Prada.
+
+        * platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt: Added.
+        * platform/gtk/accessibility/menu-list-unfocused-notifications.html: Added.
+
</ins><span class="cx"> 2014-11-10  Csaba Osztrogonác  &lt;ossy@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Crash in WebCore::Node::getFlag
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestsplatformgtkaccessibilitymenulistunfocusednotificationsexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt (0 => 182463)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt        2015-04-07 12:23:07 UTC (rev 182463)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+ OK
+This tests that changing the selection in a non-focused combo box doesn't result in erroneous focus claims.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Changing focus to button.
+AXFocusedUIElementChanged: AXRole: AXButton
+Focused element is: AXRole: AXButton
+
+Changing selected item in non-focused combobox.
+AXSelectedChildrenChanged: AXRole: AXComboBox
+Focused element is: AXRole: AXButton
+
+Changing selected item in non-focused combobox.
+AXSelectedChildrenChanged: AXRole: AXComboBox
+Focused element is: AXRole: AXButton
+
+AXChildrenAdded: AXRole: AXWebArea
+AXLoadComplete: AXRole: AXWebArea
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24LayoutTestsplatformgtkaccessibilitymenulistunfocusednotificationshtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications.html (0 => 182463)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/platform/gtk/accessibility/menu-list-unfocused-notifications.html        2015-04-07 12:23:07 UTC (rev 182463)
</span><span class="lines">@@ -0,0 +1,49 @@
</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&gt;
+&lt;select id=&quot;combobox&quot;&gt;
+  &lt;option value=&quot;1&quot;&gt;one&lt;/option&gt;
+  &lt;option value=&quot;2&quot;&gt;two&lt;/option&gt;
+  &lt;option value=&quot;3&quot;&gt;three&lt;/option&gt;
+  &lt;option value=&quot;4&quot;&gt;four&lt;/option&gt;
+&lt;/select&gt;
+&lt;button id=&quot;button&quot;&gt;OK&lt;/button&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+window.jsTestIsAsync = true;
+description(&quot;This tests that changing the selection in a non-focused combo box doesn't result in erroneous focus claims.&quot;);
+
+if (window.testRunner &amp;&amp; window.accessibilityController) {
+    accessibilityController.addNotificationListener(function(element, notification) {
+        debug(notification + &quot;: &quot; + element.role);
+    });
+
+    debug(&quot;Changing focus to button.&quot;);
+    document.getElementById('button').focus();
+    debug(&quot;Focused element is: &quot; + accessibilityController.focusedElement.role + &quot;\n&quot;);
+
+    // Programmatic selection changes in the non-focused combo box do not result
+    // in the button losing focus. Therefore the combo box should not claim focus.
+    debug(&quot;Changing selected item in non-focused combobox.&quot;);
+    document.getElementById('combobox').selectedIndex = 3;
+    debug(&quot;Focused element is: &quot; + accessibilityController.focusedElement.role + &quot;\n&quot;);
+
+    // Programmatic selection changes in the non-focused combo box do not result
+    // in the button losing focus. Therefore the combo box should not claim focus.
+    debug(&quot;Changing selected item in non-focused combobox.&quot;);
+    document.getElementById('combobox').selectedIndex = 2;
+    debug(&quot;Focused element is: &quot; + accessibilityController.focusedElement.role + &quot;\n&quot;);
+
+    window.setTimeout(function() {
+        accessibilityController.removeNotificationListener();
+        finishJSTest();
+    }, 0);
+}
+&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="releasesWebKitGTKwebkit24SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (182462 => 182463)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2015-04-07 12:12:09 UTC (rev 182462)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2015-04-07 12:23:07 UTC (rev 182463)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-11-13  Joanmarie Diggs  &lt;jdiggs@igalia.com&gt;
+
+        AX: [ATK] Accessible focus events are emitted when the selection is changed in non-focused combo boxes
+        https://bugs.webkit.org/show_bug.cgi?id=137866
+
+        Reviewed by Mario Sanchez Prada.
+
+        Check that the AccessibilityMenuList is really focused before notifying
+        the platform that it is focused. Likewise, only notify the platform of
+        an AccessibilityMenuListOption focus gain if the AccessibilityMenuList
+        containing that option is expanded.
+
+        Test: platform/gtk/accessibility/menu-list-unfocused-notifications.html
+
+        * accessibility/atk/AXObjectCacheAtk.cpp:
+        (WebCore::notifyChildrenSelectionChange):
+        (WebCore::AXObjectCache::postPlatformNotification):
+
</ins><span class="cx"> 2014-10-29  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Notify Settings object when its Page object goes away.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreaccessibilityatkAXObjectCacheAtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp (182462 => 182463)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp        2015-04-07 12:12:09 UTC (rev 182462)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp        2015-04-07 12:23:07 UTC (rev 182463)
</span><span class="lines">@@ -170,8 +170,12 @@
</span><span class="cx">     if (axItem) {
</span><span class="cx">         bool isSelected = item-&gt;isSelected();
</span><span class="cx">         atk_object_notify_state_change(axItem, ATK_STATE_SELECTED, isSelected);
</span><del>-        g_signal_emit_by_name(axItem, &quot;focus-event&quot;, isSelected);
-        atk_object_notify_state_change(axItem, ATK_STATE_FOCUSED, isSelected);
</del><ins>+        // When the selection changes in a collapsed widget such as a combo box
+        // whose child menu is not showing, that collapsed widget retains focus.
+        if (!object-&gt;isCollapsed()) {
+            g_signal_emit_by_name(axItem, &quot;focus-event&quot;, isSelected);
+            atk_object_notify_state_change(axItem, ATK_STATE_FOCUSED, isSelected);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Update pointers to the previously involved objects.
</span><span class="lines">@@ -194,7 +198,8 @@
</span><span class="cx"> 
</span><span class="cx">     case AXSelectedChildrenChanged:
</span><span class="cx">     case AXMenuListValueChanged:
</span><del>-        if (notification == AXMenuListValueChanged &amp;&amp; coreObject-&gt;isMenuList()) {
</del><ins>+        // Accessible focus claims should not be made if the associated widget is not focused.
+        if (notification == AXMenuListValueChanged &amp;&amp; coreObject-&gt;isMenuList() &amp;&amp; coreObject-&gt;isFocused()) {
</ins><span class="cx">             g_signal_emit_by_name(axObject, &quot;focus-event&quot;, true);
</span><span class="cx">             atk_object_notify_state_change(axObject, ATK_STATE_FOCUSED, true);
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>