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 <jarekczek@poczta.onet.pl> 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 <jarekczek@poczta.onet.pl> 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 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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169483 268f45cc-cd09-0410-ab3c-d52691b4dbfc