LayoutTests/ChangeLog

 12014-05-29 Jarek Czekalski <jarekczek@poczta.onet.pl>
 2
 3 [ATK] Convert caret offset tests from testatk.c.
 4 https://bugs.webkit.org/show_bug.cgi?id=132527
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The tests are replicated from testatk.c file, functions
 9 testWebkitAtkCaretOffsets()
 10 testWebkitAtkCaretOffsetsAndExtranousWhiteSpaces()
 11 The file was present in webkit1. Removed from trunk in r166977, so
 12 the last version was
 13 https://trac.webkit.org/browser/trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/testatk.c?rev=166976
 14 What could not be verified in the same way:
 15
 16 1. Whether element implements ATK_TEXT. If setCaretOffset
 17 succeeds, it confirms that element is text as well. But in cases
 18 when setCaretOffset must fail I see no way to confirm it is text
 19 element.
 20
 21 2. Whether position is correct through a call to
 22 atk_text_get_caret_offset. text-caret-moved signal value is
 23 tested instead.
 24
 25 Anyway these cases don't look crucial, so they are skipped.
 26
 27 * platform/gtk/resources/atk-helpers.js: Added.
 28 (setCaretOffset): Added.
 29 * platform/gtk/accessibility/caret-offsets.html: Added.
 30 * platform/gtk/accessibility/caret-offsets-expected.txt: Added.
 31
1322014-05-28 Oliver Hunt <oliver@apple.com>
233
334 Make DOM properties exposed as instance properties use the base object instead of |this|
169433

LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces-expected.txt

 1This paragraph is borked!
 2
 3This 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.
 4
 5On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 6
 7
 8PASS borkedTextLength is 25
 9PASS caretMovedData is "Paragraph|24"
 10PASS caretMovedData is "Paragraph|25"
 11PASS successfullyParsed is true
 12
 13TEST COMPLETE
 14
0

LayoutTests/platform/gtk/accessibility/caret-offsets-and-extraneous-white-spaces.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<script src="../../../resources/js-test-pre.js"></script>
 5<script src="../resources/atk-helpers.js"></script>
 6</head>
 7
 8<body>
 9<p id="borked">This
 10 paragraph
 11 is
 12 borked!</p>
 13
 14<div id="console"></div>
 15
 16<script>
 17var caretMovedData;
 18
 19function globalListener(object, name, offset)
 20{
 21 var role = object.role.replace('AXRole: AX', '');
 22 if (name == 'AXTextCaretMoved') {
 23 caretMovedData += role + '|' + offset;
 24 }
 25}
 26
 27function resetCaretOffsetForObject(object, offset)
 28{
 29 caretMovedData = '';
 30 setCaretOffset(object, offset);
 31}
 32
 33if (window.testRunner) {
 34 testRunner.overridePreference("WebKitEnableCaretBrowsing", true);
 35 testRunner.dumpAsText();
 36}
 37
 38if (window.accessibilityController) {
 39 accessibilityController.addNotificationListener(globalListener);
 40 borked = accessibilityController.accessibleElementById('borked');
 41 prefix = 'AXValue: '
 42 shouldBeTrueQuiet('borked.stringValue.substring(0, 9) == "' + prefix + '"');
 43 borkedTextLength = borked.stringValue.length - prefix.length
 44 shouldBe('borkedTextLength', '25');
 45 resetCaretOffsetForObject(borked, borkedTextLength - 1);
 46 shouldBeEqualToString('caretMovedData', 'Paragraph|24');
 47 resetCaretOffsetForObject(borked, borkedTextLength);
 48 shouldBeEqualToString('caretMovedData', 'Paragraph|25');
 49}
 50
 51description("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.");
 52
 53</script>
 54<script src="../../../resources/js-test-post.js"></script>
 55</body>
 56</html>
0

LayoutTests/platform/gtk/accessibility/caret-offsets-expected.txt

 1A text header
 2
 3A paragraph with a link in the middle
 4
 5A list item
 6Block span in a list item
 7Inline span in a list item
 8Block span in a link in a list item
 9Inline span in a link in a list item
 10
 11a table cell
 12Block span in a link in a table cell
 13Inline span in a link in a table cell
 14Block span in a table cell
 15Inline span in a table cell
 16This test is replicated from old file testatk.c and tests various scenarios of caret movement: setting caret offset and receiving text-caret-moved signal.
 17
 18On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 19
 20
 21PASS root.childrenCount is 5
 22PASS setCaretOffset(h1, 5) is true
 23PASS caretMovedData is "Heading|5"
 24PASS caretMovedData is "Paragraph|5"
 25PASS caretMovedData is "Paragraph|20"
 26PASS caretMovedData is "Paragraph|30"
 27PASS setCaretOffset(link, 5) is true
 28PASS caretMovedData is "Paragraph|17"
 29PASS list.role is "AXRole: AXList"
 30PASS list.childrenCount is 3
 31PASS setCaretOffset(listItem, 1) is false
 32PASS setCaretOffset(listItem, 5) is true
 33PASS caretMovedData is "ListItem|2"
 34PASS comboBox.role is "AXRole: AXComboBox"
 35PASS menuPopup.role is "AXRole: AXMenu"
 36PASS comboBoxOption.role is "AXRole: AXMenuItem"
 37PASS setCaretOffset(comboBoxOption, 1) is false
 38PASS textEntry.role is "AXRole: AXTextField"
 39PASS caretMovedData is "TextField|5"
 40PASS table.role is "AXRole: AXTable"
 41PASS table.childrenCount is 4
 42PASS tableCell.role is "AXRole: AXCell"
 43PASS caretMovedData is "Cell|2"
 44PASS successfullyParsed is true
 45
 46TEST COMPLETE
 47
0

LayoutTests/platform/gtk/accessibility/caret-offsets.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<script src="../../../resources/js-test-pre.js"></script>
 5<script src="../resources/atk-helpers.js"></script>
 6</head>
 7
 8<body id="body">
 9<h1 id='firstChild'>A text header</h1>
 10
 11<p>A paragraph <a href='http://foo.bar.baz/'>with a link</a> in the middle</p>
 12
 13<ol>
 14 <li>A list item</li>
 15 <li><span style='display:block;'>Block span in a list item</span><span>Inline span in a list item</span></li>
 16 <li><a href='foo'><span style='display:block;'>Block span in a link in a list item</span><span>Inline span in a link in a list item</span></a></li>
 17</ol>
 18
 19<select><option selected value='foo'>An option in a combo box</option></select>
 20
 21<input type='text' name='foo' value='foo bar baz' />
 22
 23<table>
 24 <tr>
 25 <td>a table cell</td>
 26 <td></td>
 27 <td><a href='foo'><span style='display:block;'>Block span in a link in a table cell</span><span>Inline span in a link in a table cell</span></a></td>
 28 <td><span style='display:block;'>Block span in a table cell</span><span>Inline span in a table cell</span></td>
 29 </tr>
 30</table>
 31
 32<div id="console"></div>
 33
 34<script>
 35var caretMovedData;
 36
 37function globalListener(object, name, offset)
 38{
 39 var role = object.role.replace('AXRole: AX', '');
 40 if (name == 'AXTextCaretMoved') {
 41 caretMovedData += role + '|' + offset;
 42 }
 43}
 44
 45function resetCaretOffsetForObject(object, offset)
 46{
 47 caretMovedData = '';
 48 setCaretOffset(object, offset);
 49}
 50
 51if (window.testRunner) {
 52 testRunner.overridePreference("WebKitEnableCaretBrowsing", true);
 53 testRunner.dumpAsText();
 54}
 55
 56if (window.accessibilityController) {
 57 accessibilityController.addNotificationListener(globalListener);
 58 root = accessibilityController.accessibleElementById('firstChild').parentElement();
 59 shouldBe('root.childrenCount', '5');
 60
 61 /* It should be possible to place the caret inside a header. */
 62 h1 = root.childAtIndex(0);
 63 caretMovedData = '';
 64 shouldBeTrue('setCaretOffset(h1, 5)');
 65 shouldBeEqualToString('caretMovedData', 'Heading|5');
 66
 67 /* It should be possible to place the caret inside a paragraph and a link. */
 68 p1 = root.childAtIndex(1);
 69 resetCaretOffsetForObject(p1, 5);
 70 shouldBeEqualToString('caretMovedData', 'Paragraph|5');
 71 resetCaretOffsetForObject(p1, 20);
 72 shouldBeEqualToString('caretMovedData', 'Paragraph|20');
 73 resetCaretOffsetForObject(p1, 30);
 74 shouldBeEqualToString('caretMovedData', 'Paragraph|30');
 75 link = p1.childAtIndex(0);
 76 caretMovedData = '';
 77 shouldBeTrue('setCaretOffset(link, 5)');
 78 /* Positions inside links are reported relative to the paragraph. */
 79 shouldBeEqualToString('caretMovedData', 'Paragraph|17');
 80
 81 list = root.childAtIndex(2);
 82 shouldBeEqualToString('list.role', 'AXRole: AXList');
 83 shouldBe('list.childrenCount', '3');
 84 listItem = list.childAtIndex(2);
 85 /* It's not possible to place the caret inside an item's marker. */
 86 shouldBe('setCaretOffset(listItem, 1)', 'false');
 87 /* It should be possible to place the caret inside an item's text. */
 88 caretMovedData = '';
 89 shouldBe('setCaretOffset(listItem, 5)', 'true');
 90 shouldBeEqualToString('caretMovedData', 'ListItem|2');
 91
 92 panel = root.childAtIndex(3);
 93 comboBox = panel.childAtIndex(0);
 94 shouldBeEqualToString('comboBox.role', 'AXRole: AXComboBox');
 95 menuPopup = comboBox.childAtIndex(0);
 96 shouldBeEqualToString('menuPopup.role', 'AXRole: AXMenu');
 97 comboBoxOption = menuPopup.childAtIndex(0);
 98 shouldBeEqualToString('comboBoxOption.role', 'AXRole: AXMenuItem');
 99 /* It's not possible to place the caret inside an option for a combobox. */
 100 shouldBe('setCaretOffset(comboBoxOption, 1)', 'false');
 101 textEntry = panel.childAtIndex(1);
 102 shouldBeEqualToString('textEntry.role', 'AXRole: AXTextField');
 103 resetCaretOffsetForObject(textEntry, 5);
 104 shouldBeEqualToString('caretMovedData', 'TextField|5');
 105
 106 table = root.childAtIndex(4);
 107 shouldBeEqualToString('table.role', 'AXRole: AXTable');
 108 shouldBe('table.childrenCount', '4');
 109 tableCell = table.childAtIndex(0);
 110 shouldBeEqualToString('tableCell.role', 'AXRole: AXCell');
 111 resetCaretOffsetForObject(tableCell, 2);
 112 shouldBeEqualToString('caretMovedData', 'Cell|2');
 113}
 114
 115description("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.");
 116
 117</script>
 118<script src="../../../resources/js-test-post.js"></script>
 119</body>
 120</html>
0

LayoutTests/platform/gtk/resources/atk-helpers.js

 1function setCaretOffset(accessibleText, offset)
 2{
 3 return accessibleText.setSelectedTextRange(offset, 0);
 4}
0

Tools/ChangeLog

 12014-05-29 Jarek Czekalski <jarekczek@poczta.onet.pl>
 2
 3 [ATK] Added new accessibility signal: text-caret-moved.
 4 Make AccessibilityUIElement.setSelectedTextRange work
 5 as atk_text_set_caret_offset when given offset == 0.
 6 https://bugs.webkit.org/show_bug.cgi?id=132527
 7
 8 Reviewed by NOBODY (OOPS!).
 9
 10 text-caret-moved signal in accessibilityController is needed to
 11 implement tests from Tools/TestWebKitAPI/Tests/WebKitGtk/testatk.c
 12 as LayoutTests. Add the signal to the controller.
 13
 14 * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
 15 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
 16 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
 17 * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
 18 * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
 19 (setSelectedTextRange): Change return type to bool.
 20 * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
 21 (setSelectedTextRange): Call atk_text_set_caret_offset and return bool.
 22 * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
 23 (axObjectEventListener): Add notification name AXTextCaretMoved, allow
 24 for extra arguments passed to handler and use it for text-caret-moved offset.
 25 (WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks):
 26 Connect callback to new listener for ATK:AtkText:text-caret-moved.
 27 Refactor so that failures be reported.
 28 Initialize atk interfaces before trying to connect to them, see
 29 https://bugzilla.gnome.org/show_bug.cgi?id=729922
 30 (WTR::AccessibilityNotificationHandler::disconnectAccessibilityCallbacks):
 31 Simplify code by using a vector in place of dozen variables.
 32 * DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp:
 33 Comment about not synchronizing with accessibilityController.
 34
1352014-05-27 Jon Honeycutt <jhoneycutt@apple.com>
236
337 Need an API test for bug #133193 (r169315)
169433

Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp

5757static guint propertyChangedListenerId = 0;
5858static guint visibleDataChangedListenerId = 0;
5959static guint loadCompleteListenerId = 0;
 60// Up to 2014 it was obligatory to mirror the changes from
 61// WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp,
 62// but the habit has been dropped: https://bugs.webkit.org/show_bug.cgi?id=132527#c6
6063static NotificationHandlersMap notificationHandlers;
6164static AccessibilityNotificationHandler* globalNotificationHandler = 0;
6265
169433

Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp

172172JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForLine(int) { return 0; }
173173JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForPosition(int, int) { return 0; }
174174JSRetainPtr<JSStringRef> AccessibilityUIElement::boundsForRange(unsigned, unsigned) { return 0; }
175 void AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned) { }
 175bool AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned) { return false; }
176176JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned, unsigned) { return 0; }
177177JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) { return 0; }
178178bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) { return false; }
169433

Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

202202 JSRetainPtr<JSStringRef> rangeForLine(int);
203203 JSRetainPtr<JSStringRef> rangeForPosition(int x, int y);
204204 JSRetainPtr<JSStringRef> boundsForRange(unsigned location, unsigned length);
205  void setSelectedTextRange(unsigned location, unsigned length);
 205 bool setSelectedTextRange(unsigned location, unsigned length);
206206 JSRetainPtr<JSStringRef> stringForRange(unsigned location, unsigned length);
207207 JSRetainPtr<JSStringRef> attributedStringForRange(unsigned location, unsigned length);
208208 bool attributedStringRangeIsMisspelled(unsigned location, unsigned length);
169433

Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl

161161 [PassContext] unsigned int uiElementCountForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly, boolean immediateDescendantsOnly);
162162 [PassContext] AccessibilityUIElement uiElementForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly, boolean immediateDescendantsOnly);
163163 [PassContext] DOMString selectTextWithCriteria(DOMString ambiguityResolution, object searchStrings, DOMString replacementString, DOMString activity);
164  void setSelectedTextRange(unsigned long location, unsigned long length);
 164 boolean setSelectedTextRange(unsigned long location, unsigned long length);
165165
166166 // Scroll area attributes.
167167 readonly attribute AccessibilityUIElement horizontalScrollbar;
169433

Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp

2929#include <WebKit/WKBundlePage.h>
3030#include <WebKit/WKBundlePagePrivate.h>
3131#include <wtf/HashMap.h>
 32#include <wtf/Vector.h>
3233#include <wtf/gobject/GUniquePtr.h>
3334#include <wtf/text/CString.h>
3435#include <wtf/text/WTFString.h>

3940
4041typedef HashMap<AtkObject*, AccessibilityNotificationHandler*> NotificationHandlersMap;
4142
42 unsigned stateChangeListenerId = 0;
43 unsigned focusEventListenerId = 0;
44 unsigned activeDescendantChangedListenerId = 0;
45 unsigned childrenChangedListenerId = 0;
46 unsigned propertyChangedListenerId = 0;
47 unsigned visibleDataChangedListenerId = 0;
48 unsigned loadCompleteListenerId = 0;
 43WTF::Vector<unsigned> listenerIds;
4944NotificationHandlersMap notificationHandlers;
5045AccessibilityNotificationHandler* globalNotificationHandler = nullptr;
5146bool loggingAccessibilityEvents = false;

8277 if (!accessible || !ATK_IS_OBJECT(accessible))
8378 return true;
8479
 80#if PLATFORM(GTK) || PLATFORM(EFL)
 81 WKBundlePageRef page = InjectedBundle::shared().page()->page();
 82 WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
 83 JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
 84#else
 85 JSContextRef jsContext = nullptr;
 86#endif
 87
8588 GSignalQuery signalQuery;
8689 GUniquePtr<char> signalName;
8790 GUniquePtr<char> signalValue;
8891 const char* notificationName = nullptr;
 92 Vector<JSValueRef> extraArgs;
8993
9094 g_signal_query(signalHint->signal_id, &signalQuery);
9195

112116 notificationName = "AXValueChanged";
113117 } else if (!g_strcmp0(signalQuery.signal_name, "load-complete"))
114118 notificationName = "AXLoadComplete";
115  else
 119 else if (!g_strcmp0(signalQuery.signal_name, "text-caret-moved")) {
 120 notificationName = "AXTextCaretMoved";
116121 signalName.reset(g_strdup(signalQuery.signal_name));
 122 signalValue.reset(g_strdup_printf("%d", g_value_get_int(&paramValues[1])));
 123 JSRetainPtr<JSStringRef> jsSignalValue(Adopt, JSStringCreateWithUTF8CString(signalValue.get()));
 124 extraArgs.append(JSValueMakeString(jsContext, jsSignalValue.get()));
 125 } else
 126 signalName.reset(g_strdup(signalQuery.signal_name));
117127
118128 if (loggingAccessibilityEvents)
119129 printAccessibilityEvent(accessible, signalName.get(), signalValue.get());
120130
121 #if PLATFORM(GTK) || PLATFORM(EFL)
122  WKBundlePageRef page = InjectedBundle::shared().page()->page();
123  WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
124  JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
125 #else
126  JSContextRef jsContext = nullptr;
127 #endif
128131 if (!jsContext)
129132 return true;
130133

132135 JSRetainPtr<JSStringRef> jsNotificationEventName(Adopt, JSStringCreateWithUTF8CString(notificationName));
133136 JSValueRef notificationNameArgument = JSValueMakeString(jsContext, jsNotificationEventName.get());
134137 NotificationHandlersMap::iterator elementNotificationHandler = notificationHandlers.find(accessible);
 138 JSValueRef arguments[5]; // this dimension must be >= 2 + max(extraArgs.size())
 139 arguments[0] = toJS(jsContext, WTF::getPtr(WTR::AccessibilityUIElement::create(accessible)));
 140 arguments[1] = notificationNameArgument;
 141 size_t numOfExtraArgs = extraArgs.size();
 142 for (int i = 0; i < numOfExtraArgs; i++)
 143 arguments[i + 2] = extraArgs[i];
135144 if (elementNotificationHandler != notificationHandlers.end()) {
136  // Listener for one element just gets one argument, the notification name.
137  JSObjectCallAsFunction(jsContext, const_cast<JSObjectRef>(elementNotificationHandler->value->notificationFunctionCallback()), 0, 1, &notificationNameArgument, 0);
 145 // Listener for one element. As arguments, it gets the notification name
 146 // and sometimes extra arguments.
 147 JSObjectCallAsFunction(jsContext,
 148 const_cast<JSObjectRef>(elementNotificationHandler->value->notificationFunctionCallback()),
 149 0, numOfExtraArgs + 1, arguments + 1, 0);
138150 }
139151
140152 if (globalNotificationHandler) {
141  // A global listener gets the element and the notification name as arguments.
142  JSValueRef arguments[2];
143  arguments[0] = toJS(jsContext, WTF::getPtr(WTR::AccessibilityUIElement::create(accessible)));
144  arguments[1] = notificationNameArgument;
145  JSObjectCallAsFunction(jsContext, const_cast<JSObjectRef>(globalNotificationHandler->notificationFunctionCallback()), 0, 2, arguments, 0);
 153 // A global listener gets additionally the element as the first argument.
 154 JSObjectCallAsFunction(jsContext,
 155 const_cast<JSObjectRef>(globalNotificationHandler->notificationFunctionCallback()),
 156 0, numOfExtraArgs + 2, arguments, 0);
146157 }
147158 }
148159

238249 if (!disconnectAccessibilityCallbacks())
239250 return;
240251
 252 const char* signalNames[] = {
 253 "ATK:AtkObject:state-change",
 254 "ATK:AtkObject:state-change",
 255 "ATK:AtkObject:focus-event",
 256 "ATK:AtkObject:active-descendant-changed",
 257 "ATK:AtkObject:children-changed",
 258 "ATK:AtkObject:property-change",
 259 "ATK:AtkObject:visible-data-changed",
 260 "ATK:AtkDocument:load-complete",
 261 "ATK:AtkText:text-caret-moved",
 262 0
 263 };
 264
 265 // Register atk interfaces, otherwise add_global may fail.
 266 GObject* dummyObject = (GObject*)g_object_new(G_TYPE_OBJECT, NULL, NULL);
 267 g_object_unref(atk_no_op_object_new(dummyObject));
 268 g_object_unref(dummyObject);
 269
241270 // Add global listeners for AtkObject's signals.
242  stateChangeListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:state-change");
243  focusEventListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:focus-event");
244  activeDescendantChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:active-descendant-changed");
245  childrenChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:children-changed");
246  propertyChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:property-change");
247  visibleDataChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:visible-data-changed");
248  loadCompleteListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkDocument:load-complete");
 271 for (const char** signalName = signalNames; *signalName; signalName++) {
 272 unsigned id = atk_add_global_event_listener(axObjectEventListener, *signalName);
 273 if (!id) {
 274 String message = String::format("atk_add_global_event_listener failed for signal %s\n", *signalName);
 275 InjectedBundle::shared().outputText(message);
 276 continue;
 277 }
 278
 279 listenerIds.append(id);
 280 }
249281}
250282
251283bool AccessibilityNotificationHandler::disconnectAccessibilityCallbacks()

255287 return false;
256288
257289 // AtkObject signals.
258  if (stateChangeListenerId) {
259  atk_remove_global_event_listener(stateChangeListenerId);
260  stateChangeListenerId = 0;
 290 for (int i = 0; i < listenerIds.size(); i++) {
 291 ASSERT(listenerIds[i]);
 292 atk_remove_global_event_listener(listenerIds[i]);
261293 }
262  if (focusEventListenerId) {
263  atk_remove_global_event_listener(focusEventListenerId);
264  focusEventListenerId = 0;
265  }
266  if (activeDescendantChangedListenerId) {
267  atk_remove_global_event_listener(activeDescendantChangedListenerId);
268  activeDescendantChangedListenerId = 0;
269  }
270  if (childrenChangedListenerId) {
271  atk_remove_global_event_listener(childrenChangedListenerId);
272  childrenChangedListenerId = 0;
273  }
274  if (propertyChangedListenerId) {
275  atk_remove_global_event_listener(propertyChangedListenerId);
276  propertyChangedListenerId = 0;
277  }
278  if (visibleDataChangedListenerId) {
279  atk_remove_global_event_listener(visibleDataChangedListenerId);
280  visibleDataChangedListenerId = 0;
281  }
282  if (loadCompleteListenerId) {
283  atk_remove_global_event_listener(loadCompleteListenerId);
284  loadCompleteListenerId = 0;
285  }
 294 listenerIds.clear();
286295 return true;
287296}
288297
169433

Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

15801580 return JSStringCreateWithUTF8CString(selection.get());
15811581}
15821582
1583 void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
 1583bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
15841584{
15851585 if (!ATK_IS_TEXT(m_element.get()))
1586  return;
 1586 return false;
15871587
1588  atk_text_set_selection(ATK_TEXT(m_element.get()), 0, location, location + length);
 1588 if (length)
 1589 return atk_text_set_caret_offset(ATK_TEXT(m_element.get()), location);
 1590
 1591 return atk_text_set_selection(ATK_TEXT(m_element.get()), 0, location, location + length);
15891592}
15901593
15911594void AccessibilityUIElement::increment()
169433

Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

562562 return JSStringCreateWithCharacters(0, 0);
563563}
564564
565 void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
 565bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
566566{
 567 return false;
567568}
568569
569570void AccessibilityUIElement::increment()
169433

Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

13641364 return nullptr;
13651365}
13661366
1367 void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
 1367bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
13681368{
13691369 NSRange textRange = NSMakeRange(location, length);
13701370 NSValue *textRangeValue = [NSValue valueWithRange:textRange];

13711371 BEGIN_AX_OBJC_EXCEPTIONS
13721372 [m_element accessibilitySetValue:textRangeValue forAttribute:NSAccessibilitySelectedTextRangeAttribute];
13731373 END_AX_OBJC_EXCEPTIONS
 1374
 1375 return true;
13741376}
13751377
13761378void AccessibilityUIElement::increment()
169433