<!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>[169483] 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/169483">169483</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-30 03:58:36 -0700 (Fri, 30 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Tools: [ATK] Added new accessibility signal: text-caret-moved.
Make AccessibilityUIElement.setSelectedTextRange work
as atk_text_set_caret_offset when given offset == 0.
https://bugs.webkit.org/show_bug.cgi?id=132527

Patch by Jarek Czekalski &lt;jarekczek@poczta.onet.pl&gt; on 2014-05-30
Reviewed by Mario Sanchez Prada.

text-caret-moved signal in accessibilityController is needed to
implement tests from Tools/TestWebKitAPI/Tests/WebKitGtk/testatk.c
as LayoutTests. Add the signal to the controller.

* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(setSelectedTextRange): Change return type to bool.
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(setSelectedTextRange): Call atk_text_set_caret_offset and return bool.
* WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
(axObjectEventListener): Add notification name AXTextCaretMoved, allow
for extra arguments passed to handler and use it for text-caret-moved offset.
(WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks):
Connect callback to new listener for ATK:AtkText:text-caret-moved.
Refactor so that failures be reported.
Initialize atk interfaces before trying to connect to them, see
https://bugzilla.gnome.org/show_bug.cgi?id=729922
(WTR::AccessibilityNotificationHandler::disconnectAccessibilityCallbacks):
Simplify code by using a vector in place of dozen variables.
* DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp:
Comment about not synchronizing with accessibilityController.

LayoutTests: [ATK] Convert caret offset tests from testatk.c.
https://bugs.webkit.org/show_bug.cgi?id=132527

Patch by Jarek Czekalski &lt;jarekczek@poczta.onet.pl&gt; on 2014-05-30
Reviewed by Mario Sanchez Prada.

The tests are replicated from testatk.c file, functions
    testWebkitAtkCaretOffsets()
    testWebkitAtkCaretOffsetsAndExtranousWhiteSpaces()
The file was present in webkit1. Removed from trunk in <a href="http://trac.webkit.org/projects/webkit/changeset/166977">r166977</a>, so
the last version was
https://trac.webkit.org/browser/trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/testatk.c?rev=166976
What could not be verified in the same way:

1. Whether element implements ATK_TEXT. If setCaretOffset
succeeds, it confirms that element is text as well. But in cases
when setCaretOffset must fail I see no way to confirm it is text
element.

2. Whether position is correct through a call to
atk_text_get_caret_offset.  text-caret-moved signal value is
tested instead.

Anyway these cases don't look crucial, so they are skipped.

* platform/gtk/resources/atk-helpers.js: Added.
(setCaretOffset): Added.
* platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces-expected.txt: Added.
* platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces.html: Added.
* platform/gtk/accessibility/caret-offsets-expected.txt: Added.
* platform/gtk/accessibility/caret-offsets.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeatkAccessibilityCallbacksAtkcpp">trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleatkAccessibilityNotificationHandlerAtkcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleatkAccessibilityUIElementAtkcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleiosAccessibilityUIElementIOSmm">trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformgtkaccessibilitycaretoffsetsandextraneouswhitespacesexpectedtxt">trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkaccessibilitycaretoffsetsandextraneouswhitespaceshtml">trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces.html</a></li>
<li><a href="#trunkLayoutTestsplatformgtkaccessibilitycaretoffsetsexpectedtxt">trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkaccessibilitycaretoffsetshtml">trunk/LayoutTests/platform/gtk/accessibility/caret-offsets.html</a></li>
<li>trunk/LayoutTests/platform/gtk/resources/</li>
<li><a href="#trunkLayoutTestsplatformgtkresourcesatkhelpersjs">trunk/LayoutTests/platform/gtk/resources/atk-helpers.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/LayoutTests/ChangeLog        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2014-05-30  Jarek Czekalski  &lt;jarekczek@poczta.onet.pl&gt;
+
+        [ATK] Convert caret offset tests from testatk.c.
+        https://bugs.webkit.org/show_bug.cgi?id=132527
+
+        Reviewed by Mario Sanchez Prada.
+
+        The tests are replicated from testatk.c file, functions
+            testWebkitAtkCaretOffsets()
+            testWebkitAtkCaretOffsetsAndExtranousWhiteSpaces()
+        The file was present in webkit1. Removed from trunk in r166977, so
+        the last version was
+        https://trac.webkit.org/browser/trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/testatk.c?rev=166976
+        What could not be verified in the same way:
+
+        1. Whether element implements ATK_TEXT. If setCaretOffset
+        succeeds, it confirms that element is text as well. But in cases
+        when setCaretOffset must fail I see no way to confirm it is text
+        element.
+
+        2. Whether position is correct through a call to
+        atk_text_get_caret_offset.  text-caret-moved signal value is
+        tested instead.
+
+        Anyway these cases don't look crucial, so they are skipped.
+
+        * platform/gtk/resources/atk-helpers.js: Added.
+        (setCaretOffset): Added.
+        * platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces-expected.txt: Added.
+        * platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces.html: Added.
+        * platform/gtk/accessibility/caret-offsets-expected.txt: Added.
+        * platform/gtk/accessibility/caret-offsets.html: Added.
+
</ins><span class="cx"> 2014-05-28  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Roll r168668 back in.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkaccessibilitycaretoffsetsandextraneouswhitespacesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces-expected.txt (0 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces-expected.txt        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+This paragraph is borked!
+
+This test is replicated from old file testatk.c and tests text length, setting caret offset and receiving text-caret-moved signal on a paragraph with lots of whitespace.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS borkedTextLength is 25
+PASS caretMovedData is &quot;Paragraph|24&quot;
+PASS caretMovedData is &quot;Paragraph|25&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformgtkaccessibilitycaretoffsetsandextraneouswhitespaceshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces.html (0 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces.html                                (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces.html        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -0,0 +1,56 @@
</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;script src=&quot;../resources/atk-helpers.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+&lt;p id=&quot;borked&quot;&gt;This
+                          paragraph
+                                                      is
+                                                                                                                                                                                                                                                                                                                                                                            borked!&lt;/p&gt;
+
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+var caretMovedData;
+
+function globalListener(object, name, offset)
+{
+    var role = object.role.replace('AXRole: AX', '');
+    if (name == 'AXTextCaretMoved') {
+        caretMovedData += role + '|' + offset;
+    }
+}
+
+function resetCaretOffsetForObject(object, offset)
+{
+    caretMovedData = '';
+    setCaretOffset(object, offset);
+}
+
+if (window.testRunner) {
+    testRunner.overridePreference(&quot;WebKitEnableCaretBrowsing&quot;, true);
+    testRunner.dumpAsText();
+}
+
+if (window.accessibilityController) {
+    accessibilityController.addNotificationListener(globalListener);
+    borked = accessibilityController.accessibleElementById('borked');
+    prefix = 'AXValue: '
+    shouldBeTrueQuiet('borked.stringValue.substring(0, 9) == &quot;' + prefix + '&quot;');
+    borkedTextLength = borked.stringValue.length - prefix.length
+    shouldBe('borkedTextLength', '25');
+    resetCaretOffsetForObject(borked, borkedTextLength - 1);
+    shouldBeEqualToString('caretMovedData', 'Paragraph|24');
+    resetCaretOffsetForObject(borked, borkedTextLength);
+    shouldBeEqualToString('caretMovedData', 'Paragraph|25');
+}
+
+description(&quot;This test is replicated from old file testatk.c and tests text length, setting caret offset and receiving text-caret-moved signal on a paragraph with lots of whitespace.&quot;);
+
+&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="trunkLayoutTestsplatformgtkaccessibilitycaretoffsetsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-expected.txt (0 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-offsets-expected.txt        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+A text header
+
+A paragraph with a link in the middle
+
+A list item
+Block span in a list item
+Inline span in a list item
+Block span in a link in a list item
+Inline span in a link in a list item
+  
+a table cell                
+Block span in a link in a table cell
+Inline span in a link in a table cell        
+Block span in a table cell
+Inline span in a table cell
+This test is replicated from old file testatk.c and tests various scenarios of caret movement: setting caret offset and receiving text-caret-moved signal.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS root.childrenCount is 5
+PASS setCaretOffset(h1, 5) is true
+PASS caretMovedData is &quot;Heading|5&quot;
+PASS caretMovedData is &quot;Paragraph|5&quot;
+PASS caretMovedData is &quot;Paragraph|20&quot;
+PASS caretMovedData is &quot;Paragraph|30&quot;
+PASS setCaretOffset(link, 5) is true
+PASS caretMovedData is &quot;Paragraph|17&quot;
+PASS list.role is &quot;AXRole: AXList&quot;
+PASS list.childrenCount is 3
+PASS setCaretOffset(listItem, 1) is false
+PASS setCaretOffset(listItem, 5) is true
+PASS caretMovedData is &quot;ListItem|2&quot;
+PASS comboBox.role is &quot;AXRole: AXComboBox&quot;
+PASS menuPopup.role is &quot;AXRole: AXMenu&quot;
+PASS comboBoxOption.role is &quot;AXRole: AXMenuItem&quot;
+PASS setCaretOffset(comboBoxOption, 1) is false
+PASS textEntry.role is &quot;AXRole: AXTextField&quot;
+PASS caretMovedData is &quot;TextField|5&quot;
+PASS table.role is &quot;AXRole: AXTable&quot;
+PASS table.childrenCount is 4
+PASS tableCell.role is &quot;AXRole: AXCell&quot;
+PASS caretMovedData is &quot;Cell|2&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformgtkaccessibilitycaretoffsetshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/accessibility/caret-offsets.html (0 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/accessibility/caret-offsets.html                                (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-offsets.html        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -0,0 +1,120 @@
</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;script src=&quot;../resources/atk-helpers.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body id=&quot;body&quot;&gt;
+&lt;h1 id='firstChild'&gt;A text header&lt;/h1&gt;
+
+&lt;p&gt;A paragraph &lt;a href='http://foo.bar.baz/'&gt;with a link&lt;/a&gt; in the middle&lt;/p&gt;
+
+&lt;ol&gt;
+  &lt;li&gt;A list item&lt;/li&gt;
+  &lt;li&gt;&lt;span style='display:block;'&gt;Block span in a list item&lt;/span&gt;&lt;span&gt;Inline span in a list item&lt;/span&gt;&lt;/li&gt;
+  &lt;li&gt;&lt;a href='foo'&gt;&lt;span style='display:block;'&gt;Block span in a link in a list item&lt;/span&gt;&lt;span&gt;Inline span in a link in a list item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;select&gt;&lt;option selected value='foo'&gt;An option in a combo box&lt;/option&gt;&lt;/select&gt;
+
+&lt;input type='text' name='foo' value='foo bar baz' /&gt;
+
+&lt;table&gt;
+  &lt;tr&gt;
+    &lt;td&gt;a table cell&lt;/td&gt;
+    &lt;td&gt;&lt;/td&gt;
+    &lt;td&gt;&lt;a href='foo'&gt;&lt;span style='display:block;'&gt;Block span in a link in a table cell&lt;/span&gt;&lt;span&gt;Inline span in a link in a table cell&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
+    &lt;td&gt;&lt;span style='display:block;'&gt;Block span in a table cell&lt;/span&gt;&lt;span&gt;Inline span in a table cell&lt;/span&gt;&lt;/td&gt;
+  &lt;/tr&gt;
+&lt;/table&gt;
+
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+var caretMovedData;
+
+function globalListener(object, name, offset)
+{
+    var role = object.role.replace('AXRole: AX', '');
+    if (name == 'AXTextCaretMoved') {
+        caretMovedData += role + '|' + offset;
+    }
+}
+
+function resetCaretOffsetForObject(object, offset)
+{
+    caretMovedData = '';
+    setCaretOffset(object, offset);
+}
+
+if (window.testRunner) {
+    testRunner.overridePreference(&quot;WebKitEnableCaretBrowsing&quot;, true);
+    testRunner.dumpAsText();
+}
+
+if (window.accessibilityController) {
+    accessibilityController.addNotificationListener(globalListener);
+    root = accessibilityController.accessibleElementById('firstChild').parentElement();
+    shouldBe('root.childrenCount', '5');
+
+    /* It should be possible to place the caret inside a header. */
+    h1 = root.childAtIndex(0);
+    caretMovedData = '';
+    shouldBeTrue('setCaretOffset(h1, 5)');
+    shouldBeEqualToString('caretMovedData', 'Heading|5');
+
+    /* It should be possible to place the caret inside a paragraph and a link. */
+    p1 = root.childAtIndex(1);
+    resetCaretOffsetForObject(p1, 5);
+    shouldBeEqualToString('caretMovedData', 'Paragraph|5');
+    resetCaretOffsetForObject(p1, 20);
+    shouldBeEqualToString('caretMovedData', 'Paragraph|20');
+    resetCaretOffsetForObject(p1, 30);
+    shouldBeEqualToString('caretMovedData', 'Paragraph|30');
+    link = p1.childAtIndex(0);
+    caretMovedData = '';
+    shouldBeTrue('setCaretOffset(link, 5)');
+    /* Positions inside links are reported relative to the paragraph. */
+    shouldBeEqualToString('caretMovedData', 'Paragraph|17');
+
+    list = root.childAtIndex(2);
+    shouldBeEqualToString('list.role', 'AXRole: AXList');
+    shouldBe('list.childrenCount', '3');
+    listItem = list.childAtIndex(2);
+    /* It's not possible to place the caret inside an item's marker. */
+    shouldBe('setCaretOffset(listItem, 1)', 'false');
+    /* It should be possible to place the caret inside an item's text. */
+    caretMovedData = '';
+    shouldBe('setCaretOffset(listItem, 5)', 'true');
+    shouldBeEqualToString('caretMovedData', 'ListItem|2');
+
+    panel = root.childAtIndex(3);
+    comboBox = panel.childAtIndex(0);
+    shouldBeEqualToString('comboBox.role', 'AXRole: AXComboBox');
+    menuPopup = comboBox.childAtIndex(0);
+    shouldBeEqualToString('menuPopup.role', 'AXRole: AXMenu');
+    comboBoxOption = menuPopup.childAtIndex(0);
+    shouldBeEqualToString('comboBoxOption.role', 'AXRole: AXMenuItem');
+    /* It's not possible to place the caret inside an option for a combobox. */
+    shouldBe('setCaretOffset(comboBoxOption, 1)', 'false');
+    textEntry = panel.childAtIndex(1);
+    shouldBeEqualToString('textEntry.role', 'AXRole: AXTextField');
+    resetCaretOffsetForObject(textEntry, 5);
+    shouldBeEqualToString('caretMovedData', 'TextField|5');
+
+    table = root.childAtIndex(4);
+    shouldBeEqualToString('table.role', 'AXRole: AXTable');
+    shouldBe('table.childrenCount', '4');
+    tableCell = table.childAtIndex(0);
+    shouldBeEqualToString('tableCell.role', 'AXRole: AXCell');
+    resetCaretOffsetForObject(tableCell, 2);
+    shouldBeEqualToString('caretMovedData', 'Cell|2');
+}
+
+description(&quot;This test is replicated from old file testatk.c and tests various scenarios of caret movement: setting caret offset and receiving text-caret-moved signal.&quot;);
+
+&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="trunkLayoutTestsplatformgtkresourcesatkhelpersjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/resources/atk-helpers.js (0 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/resources/atk-helpers.js                                (rev 0)
+++ trunk/LayoutTests/platform/gtk/resources/atk-helpers.js        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+function setCaretOffset(accessibleText, offset)
+{
+    return accessibleText.setSelectedTextRange(offset, 0);
+}
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/ChangeLog        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-05-30  Jarek Czekalski  &lt;jarekczek@poczta.onet.pl&gt;
+
+        [ATK] Added new accessibility signal: text-caret-moved.
+        Make AccessibilityUIElement.setSelectedTextRange work
+        as atk_text_set_caret_offset when given offset == 0.
+        https://bugs.webkit.org/show_bug.cgi?id=132527
+
+        Reviewed by Mario Sanchez Prada.
+
+        text-caret-moved signal in accessibilityController is needed to
+        implement tests from Tools/TestWebKitAPI/Tests/WebKitGtk/testatk.c
+        as LayoutTests. Add the signal to the controller.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (setSelectedTextRange): Change return type to bool.
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (setSelectedTextRange): Call atk_text_set_caret_offset and return bool.
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
+        (axObjectEventListener): Add notification name AXTextCaretMoved, allow
+        for extra arguments passed to handler and use it for text-caret-moved offset.
+        (WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks):
+        Connect callback to new listener for ATK:AtkText:text-caret-moved.
+        Refactor so that failures be reported.
+        Initialize atk interfaces before trying to connect to them, see
+        https://bugzilla.gnome.org/show_bug.cgi?id=729922
+        (WTR::AccessibilityNotificationHandler::disconnectAccessibilityCallbacks):
+        Simplify code by using a vector in place of dozen variables.
+        * DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp:
+        Comment about not synchronizing with accessibilityController.
+
</ins><span class="cx"> 2014-05-29  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Add a WebKit2 Performance bot.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeatkAccessibilityCallbacksAtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -57,6 +57,9 @@
</span><span class="cx"> static guint propertyChangedListenerId = 0;
</span><span class="cx"> static guint visibleDataChangedListenerId = 0;
</span><span class="cx"> static guint loadCompleteListenerId = 0;
</span><ins>+// Up to 2014 it was obligatory to mirror the changes from
+// WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp,
+// but the habit has been dropped: https://bugs.webkit.org/show_bug.cgi?id=132527#c6
</ins><span class="cx"> static NotificationHandlersMap notificationHandlers;
</span><span class="cx"> static AccessibilityNotificationHandler* globalNotificationHandler = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx"> JSRetainPtr&lt;JSStringRef&gt; AccessibilityUIElement::rangeForLine(int) { return 0; }
</span><span class="cx"> JSRetainPtr&lt;JSStringRef&gt; AccessibilityUIElement::rangeForPosition(int, int) { return 0; }
</span><span class="cx"> JSRetainPtr&lt;JSStringRef&gt; AccessibilityUIElement::boundsForRange(unsigned, unsigned) { return 0; }
</span><del>-void AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned) { }
</del><ins>+bool AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned) { return false; }
</ins><span class="cx"> JSRetainPtr&lt;JSStringRef&gt; AccessibilityUIElement::stringForRange(unsigned, unsigned) { return 0; }
</span><span class="cx"> JSRetainPtr&lt;JSStringRef&gt; AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) { return 0; }
</span><span class="cx"> bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) { return false; }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx">     JSRetainPtr&lt;JSStringRef&gt; rangeForLine(int);
</span><span class="cx">     JSRetainPtr&lt;JSStringRef&gt; rangeForPosition(int x, int y);
</span><span class="cx">     JSRetainPtr&lt;JSStringRef&gt; boundsForRange(unsigned location, unsigned length);
</span><del>-    void setSelectedTextRange(unsigned location, unsigned length);
</del><ins>+    bool setSelectedTextRange(unsigned location, unsigned length);
</ins><span class="cx">     JSRetainPtr&lt;JSStringRef&gt; stringForRange(unsigned location, unsigned length);
</span><span class="cx">     JSRetainPtr&lt;JSStringRef&gt; attributedStringForRange(unsigned location, unsigned length);
</span><span class="cx">     bool attributedStringRangeIsMisspelled(unsigned location, unsigned length);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx">     [PassContext] unsigned int uiElementCountForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly, boolean immediateDescendantsOnly);
</span><span class="cx">     [PassContext] AccessibilityUIElement uiElementForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly, boolean immediateDescendantsOnly);
</span><span class="cx">     [PassContext] DOMString selectTextWithCriteria(DOMString ambiguityResolution, object searchStrings, DOMString replacementString, DOMString activity);
</span><del>-    void setSelectedTextRange(unsigned long location, unsigned long length);
</del><ins>+    boolean setSelectedTextRange(unsigned long location, unsigned long length);
</ins><span class="cx"> 
</span><span class="cx">     // Scroll area attributes.
</span><span class="cx">     readonly attribute AccessibilityUIElement horizontalScrollbar;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleatkAccessibilityNotificationHandlerAtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &lt;WebKit/WKBundlePage.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKBundlePagePrivate.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><ins>+#include &lt;wtf/Vector.h&gt;
</ins><span class="cx"> #include &lt;wtf/gobject/GUniquePtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -39,13 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;AtkObject*, AccessibilityNotificationHandler*&gt; NotificationHandlersMap;
</span><span class="cx"> 
</span><del>-unsigned stateChangeListenerId = 0;
-unsigned focusEventListenerId = 0;
-unsigned activeDescendantChangedListenerId = 0;
-unsigned childrenChangedListenerId = 0;
-unsigned propertyChangedListenerId = 0;
-unsigned visibleDataChangedListenerId = 0;
-unsigned loadCompleteListenerId = 0;
</del><ins>+WTF::Vector&lt;unsigned&gt; listenerIds;
</ins><span class="cx"> NotificationHandlersMap notificationHandlers;
</span><span class="cx"> AccessibilityNotificationHandler* globalNotificationHandler = nullptr;
</span><span class="cx"> bool loggingAccessibilityEvents = false;
</span><span class="lines">@@ -82,10 +77,19 @@
</span><span class="cx">     if (!accessible || !ATK_IS_OBJECT(accessible))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(GTK) || PLATFORM(EFL)
+    WKBundlePageRef page = InjectedBundle::shared().page()-&gt;page();
+    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
+    JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
+#else
+    JSContextRef jsContext = nullptr;
+#endif
+
</ins><span class="cx">     GSignalQuery signalQuery;
</span><span class="cx">     GUniquePtr&lt;char&gt; signalName;
</span><span class="cx">     GUniquePtr&lt;char&gt; signalValue;
</span><span class="cx">     const char* notificationName = nullptr;
</span><ins>+    Vector&lt;JSValueRef&gt; extraArgs;
</ins><span class="cx"> 
</span><span class="cx">     g_signal_query(signalHint-&gt;signal_id, &amp;signalQuery);
</span><span class="cx"> 
</span><span class="lines">@@ -112,19 +116,18 @@
</span><span class="cx">             notificationName = &quot;AXValueChanged&quot;;
</span><span class="cx">     } else if (!g_strcmp0(signalQuery.signal_name, &quot;load-complete&quot;))
</span><span class="cx">         notificationName = &quot;AXLoadComplete&quot;;
</span><del>-    else
</del><ins>+    else if (!g_strcmp0(signalQuery.signal_name, &quot;text-caret-moved&quot;)) {
+        notificationName = &quot;AXTextCaretMoved&quot;;
</ins><span class="cx">         signalName.reset(g_strdup(signalQuery.signal_name));
</span><ins>+        signalValue.reset(g_strdup_printf(&quot;%d&quot;, g_value_get_int(&amp;paramValues[1])));
+        JSRetainPtr&lt;JSStringRef&gt; jsSignalValue(Adopt, JSStringCreateWithUTF8CString(signalValue.get()));
+        extraArgs.append(JSValueMakeString(jsContext, jsSignalValue.get()));
+    } else
+        signalName.reset(g_strdup(signalQuery.signal_name));
</ins><span class="cx"> 
</span><span class="cx">     if (loggingAccessibilityEvents)
</span><span class="cx">         printAccessibilityEvent(accessible, signalName.get(), signalValue.get());
</span><span class="cx"> 
</span><del>-#if PLATFORM(GTK) || PLATFORM(EFL)
-    WKBundlePageRef page = InjectedBundle::shared().page()-&gt;page();
-    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
-    JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
-#else
-    JSContextRef jsContext = nullptr;
-#endif
</del><span class="cx">     if (!jsContext)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="lines">@@ -132,17 +135,25 @@
</span><span class="cx">         JSRetainPtr&lt;JSStringRef&gt; jsNotificationEventName(Adopt, JSStringCreateWithUTF8CString(notificationName));
</span><span class="cx">         JSValueRef notificationNameArgument = JSValueMakeString(jsContext, jsNotificationEventName.get());
</span><span class="cx">         NotificationHandlersMap::iterator elementNotificationHandler = notificationHandlers.find(accessible);
</span><ins>+        JSValueRef arguments[5]; // this dimension must be &gt;= 2 + max(extraArgs.size())
+        arguments[0] = toJS(jsContext, WTF::getPtr(WTR::AccessibilityUIElement::create(accessible)));
+        arguments[1] = notificationNameArgument;
+        size_t numOfExtraArgs = extraArgs.size();
+        for (int i = 0; i &lt; numOfExtraArgs; i++)
+            arguments[i + 2] = extraArgs[i];
</ins><span class="cx">         if (elementNotificationHandler != notificationHandlers.end()) {
</span><del>-            // Listener for one element just gets one argument, the notification name.
-            JSObjectCallAsFunction(jsContext, const_cast&lt;JSObjectRef&gt;(elementNotificationHandler-&gt;value-&gt;notificationFunctionCallback()), 0, 1, &amp;notificationNameArgument, 0);
</del><ins>+            // Listener for one element. As arguments, it gets the notification name
+            // and sometimes extra arguments.
+            JSObjectCallAsFunction(jsContext,
+                const_cast&lt;JSObjectRef&gt;(elementNotificationHandler-&gt;value-&gt;notificationFunctionCallback()),
+                0, numOfExtraArgs + 1, arguments + 1, 0);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (globalNotificationHandler) {
</span><del>-            // A global listener gets the element and the notification name as arguments.
-            JSValueRef arguments[2];
-            arguments[0] = toJS(jsContext, WTF::getPtr(WTR::AccessibilityUIElement::create(accessible)));
-            arguments[1] = notificationNameArgument;
-            JSObjectCallAsFunction(jsContext, const_cast&lt;JSObjectRef&gt;(globalNotificationHandler-&gt;notificationFunctionCallback()), 0, 2, arguments, 0);
</del><ins>+            // A global listener gets additionally the element as the first argument.
+            JSObjectCallAsFunction(jsContext,
+                const_cast&lt;JSObjectRef&gt;(globalNotificationHandler-&gt;notificationFunctionCallback()),
+                0, numOfExtraArgs + 2, arguments, 0);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -238,14 +249,35 @@
</span><span class="cx">     if (!disconnectAccessibilityCallbacks())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    const char* signalNames[] = {
+        &quot;ATK:AtkObject:state-change&quot;,
+        &quot;ATK:AtkObject:state-change&quot;,
+        &quot;ATK:AtkObject:focus-event&quot;,
+        &quot;ATK:AtkObject:active-descendant-changed&quot;,
+        &quot;ATK:AtkObject:children-changed&quot;,
+        &quot;ATK:AtkObject:property-change&quot;,
+        &quot;ATK:AtkObject:visible-data-changed&quot;,
+        &quot;ATK:AtkDocument:load-complete&quot;,
+        &quot;ATK:AtkText:text-caret-moved&quot;,
+        0
+    };
+
+    // Register atk interfaces, otherwise add_global may fail.
+    GObject* dummyObject = (GObject*)g_object_new(G_TYPE_OBJECT, NULL, NULL);
+    g_object_unref(atk_no_op_object_new(dummyObject));
+    g_object_unref(dummyObject);
+
</ins><span class="cx">     // Add global listeners for AtkObject's signals.
</span><del>-    stateChangeListenerId = atk_add_global_event_listener(axObjectEventListener, &quot;ATK:AtkObject:state-change&quot;);
-    focusEventListenerId = atk_add_global_event_listener(axObjectEventListener, &quot;ATK:AtkObject:focus-event&quot;);
-    activeDescendantChangedListenerId = atk_add_global_event_listener(axObjectEventListener, &quot;ATK:AtkObject:active-descendant-changed&quot;);
-    childrenChangedListenerId = atk_add_global_event_listener(axObjectEventListener, &quot;ATK:AtkObject:children-changed&quot;);
-    propertyChangedListenerId = atk_add_global_event_listener(axObjectEventListener, &quot;ATK:AtkObject:property-change&quot;);
-    visibleDataChangedListenerId = atk_add_global_event_listener(axObjectEventListener, &quot;ATK:AtkObject:visible-data-changed&quot;);
-    loadCompleteListenerId = atk_add_global_event_listener(axObjectEventListener, &quot;ATK:AtkDocument:load-complete&quot;);
</del><ins>+    for (const char** signalName = signalNames; *signalName; signalName++) {
+        unsigned id = atk_add_global_event_listener(axObjectEventListener, *signalName);
+        if (!id) {
+            String message = String::format(&quot;atk_add_global_event_listener failed for signal %s\n&quot;, *signalName);
+            InjectedBundle::shared().outputText(message);
+            continue;
+        }
+
+        listenerIds.append(id);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool AccessibilityNotificationHandler::disconnectAccessibilityCallbacks()
</span><span class="lines">@@ -255,34 +287,11 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     // AtkObject signals.
</span><del>-    if (stateChangeListenerId) {
-        atk_remove_global_event_listener(stateChangeListenerId);
-        stateChangeListenerId = 0;
</del><ins>+    for (int i = 0; i &lt; listenerIds.size(); i++) {
+        ASSERT(listenerIds[i]);
+        atk_remove_global_event_listener(listenerIds[i]);
</ins><span class="cx">     }
</span><del>-    if (focusEventListenerId) {
-        atk_remove_global_event_listener(focusEventListenerId);
-        focusEventListenerId = 0;
-    }
-    if (activeDescendantChangedListenerId) {
-        atk_remove_global_event_listener(activeDescendantChangedListenerId);
-        activeDescendantChangedListenerId = 0;
-    }
-    if (childrenChangedListenerId) {
-        atk_remove_global_event_listener(childrenChangedListenerId);
-        childrenChangedListenerId = 0;
-    }
-    if (propertyChangedListenerId) {
-        atk_remove_global_event_listener(propertyChangedListenerId);
-        propertyChangedListenerId = 0;
-    }
-    if (visibleDataChangedListenerId) {
-        atk_remove_global_event_listener(visibleDataChangedListenerId);
-        visibleDataChangedListenerId = 0;
-    }
-    if (loadCompleteListenerId) {
-        atk_remove_global_event_listener(loadCompleteListenerId);
-        loadCompleteListenerId = 0;
-    }
</del><ins>+    listenerIds.clear();
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleatkAccessibilityUIElementAtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -1580,12 +1580,15 @@
</span><span class="cx">     return JSStringCreateWithUTF8CString(selection.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
</del><ins>+bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
</ins><span class="cx"> {
</span><span class="cx">     if (!ATK_IS_TEXT(m_element.get()))
</span><del>-        return;
</del><ins>+        return false;
</ins><span class="cx"> 
</span><del>-    atk_text_set_selection(ATK_TEXT(m_element.get()), 0, location, location + length);
</del><ins>+    if (length)
+        return atk_text_set_caret_offset(ATK_TEXT(m_element.get()), location);
+
+    return atk_text_set_selection(ATK_TEXT(m_element.get()), 0, location, location + length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AccessibilityUIElement::increment()
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleiosAccessibilityUIElementIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -562,8 +562,9 @@
</span><span class="cx">     return JSStringCreateWithCharacters(0, 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
</del><ins>+bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
</ins><span class="cx"> {
</span><ins>+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AccessibilityUIElement::increment()
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (169482 => 169483)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2014-05-30 02:11:16 UTC (rev 169482)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2014-05-30 10:58:36 UTC (rev 169483)
</span><span class="lines">@@ -1364,13 +1364,15 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
</del><ins>+bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
</ins><span class="cx"> {
</span><span class="cx">     NSRange textRange = NSMakeRange(location, length);
</span><span class="cx">     NSValue *textRangeValue = [NSValue valueWithRange:textRange];
</span><span class="cx">     BEGIN_AX_OBJC_EXCEPTIONS
</span><span class="cx">     [m_element accessibilitySetValue:textRangeValue forAttribute:NSAccessibilitySelectedTextRangeAttribute];
</span><span class="cx">     END_AX_OBJC_EXCEPTIONS
</span><ins>+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AccessibilityUIElement::increment()
</span></span></pre>
</div>
</div>

</body>
</html>