Changeset 50208 in webkit


Ignore:
Timestamp:
Oct 28, 2009 3:18:39 AM (14 years ago)
Author:
xan@webkit.org
Message:

WebCore:

2009-10-28 Xan Lopez <xlopez@igalia.com>

Reviewed by Jan Alonzo.

[Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries
https://bugs.webkit.org/show_bug.cgi?id=25897

Make text controls always implement the text interface, and the
editable text interface when they are not read only. This is what
ATK-users expect.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (getInterfaceMaskFromObject):

WebKit/gtk:

2009-10-28 Xan Lopez <xlopez@igalia.com>

Reviewed by Jan Alonzo.

[Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries
https://bugs.webkit.org/show_bug.cgi?id=25897

Update test to also check that entries implement the AtkText
interface.

  • tests/testatk.c: (run_get_text_tests): (test_webkit_atk_get_text_at_offset_forms): (test_webkit_atk_get_text_at_offset): (main):
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r50207 r50208  
     12009-10-28  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Jan Alonzo.
     4
     5        [Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries
     6        https://bugs.webkit.org/show_bug.cgi?id=25897
     7
     8        Make text controls always implement the text interface, and the
     9        editable text interface when they are not read only. This is what
     10        ATK-users expect.
     11
     12        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     13        (getInterfaceMaskFromObject):
     14
    1152009-10-27  Holger Hans Peter Freyther  <zecke@selfish.org>
    216
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r50140 r50208  
    12311231    if (role == StaticTextRole)
    12321232        interfaceMask |= 1 << WAI_TEXT;
    1233 
    1234     if (coreObject->isAccessibilityRenderObject() && coreObject->isTextControl()) {
    1235         if (coreObject->isReadOnly())
    1236             interfaceMask |= 1 << WAI_TEXT;
    1237         else
     1233    else if (coreObject->isAccessibilityRenderObject() && coreObject->isTextControl()) {
     1234        interfaceMask |= 1 << WAI_TEXT;
     1235        if (!coreObject->isReadOnly())
    12381236            interfaceMask |= 1 << WAI_EDITABLE_TEXT;
    12391237    }
  • trunk/WebKit/gtk/ChangeLog

    r50061 r50208  
     12009-10-28  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Jan Alonzo.
     4
     5        [Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries
     6        https://bugs.webkit.org/show_bug.cgi?id=25897
     7
     8        Update test to also check that entries implement the AtkText
     9        interface.
     10
     11        * tests/testatk.c:
     12        (run_get_text_tests):
     13        (test_webkit_atk_get_text_at_offset_forms):
     14        (test_webkit_atk_get_text_at_offset):
     15        (main):
     16
    1172009-10-26  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
    218
  • trunk/WebKit/gtk/tests/testatk.c

    r47427 r50208  
    5151}
    5252
    53 static void test_webkit_atk_get_text_at_offset(void)
     53static void run_get_text_tests(AtkText* text_obj)
     54{
     55    char* text = atk_text_get_text(text_obj, 0, -1);
     56    g_assert_cmpstr(text, ==, "This is a test. This is the second sentence. And this the third.");
     57    g_free(text);
     58
     59    /* ATK_TEXT_BOUNDARY_CHAR */
     60    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_CHAR,
     61                           0, "T", 0, 1);
     62
     63    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_CHAR,
     64                           0, "h", 1, 2);
     65
     66    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_CHAR,
     67                           0, "", 0, 0);
     68
     69    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_CHAR,
     70                           1, "T", 0, 1);
     71   
     72    /* ATK_TEXT_BOUNDARY_WORD_START */
     73    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
     74                           0, "This ", 0, 5);
     75
     76    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
     77                           4, "This ", 0, 5);
     78
     79    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
     80                           10, "test. ", 10, 16);
     81
     82    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
     83                           58, "third.", 58, 64);
     84
     85    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_START,
     86                           5, "This ", 0, 5);
     87
     88    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_START,
     89                           7, "This ", 0, 5);
     90
     91    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_START,
     92                           0, "is ", 5, 8);
     93
     94    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_START,
     95                           4, "is ", 5, 8);
     96
     97    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_START,
     98                           3, "is ", 5, 8);
     99
     100    /* ATK_TEXT_BOUNDARY_WORD_END */
     101    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
     102                           0, "This", 0, 4);
     103
     104    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
     105                           4, " is", 4, 7);
     106
     107    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
     108                           5, " is", 4, 7);
     109
     110    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
     111                           9, " test", 9, 14);
     112
     113    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_END,
     114                           5, "This", 0, 4);
     115
     116    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_END,
     117                           4, "This", 0, 4);
     118
     119    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_END,
     120                           7, " is", 4, 7);
     121
     122    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_END,
     123                           5, " a", 7, 9);
     124
     125    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_END,
     126                           4, " a", 7, 9);
     127
     128    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
     129                           58, " third", 57, 63);
     130
     131    /* ATK_TEXT_BOUNDARY_SENTENCE_START */
     132    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
     133                           0, "This is a test. ", 0, 16);
     134
     135    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
     136                           15, "This is a test. ", 0, 16);
     137
     138    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
     139                           0, "This is the second sentence. ", 16, 45);
     140
     141    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
     142                           15, "This is the second sentence. ", 16, 45);
     143
     144    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
     145                           16, "This is a test. ", 0, 16);
     146
     147    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
     148                           44, "This is a test. ", 0, 16);
     149
     150    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
     151                           15, "", 0, 0);
     152
     153    /* ATK_TEXT_BOUNDARY_SENTENCE_END */
     154    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     155                           0, "This is a test.", 0, 15);
     156
     157    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     158                           15, " This is the second sentence.", 15, 44);
     159
     160    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     161                           16, " This is the second sentence.", 15, 44);
     162
     163    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     164                           17, " This is the second sentence.", 15, 44);
     165
     166    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     167                           0, " This is the second sentence.", 15, 44);
     168
     169    test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     170                           15, " And this the third.", 44, 64);
     171
     172    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     173                           16, "This is a test.", 0, 15);
     174
     175    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     176                           15, "This is a test.", 0, 15);
     177
     178    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     179                           14, "", 0, 0);
     180
     181    test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
     182                           44, " This is the second sentence.", 15, 44);
     183
     184    /* It's trick to test these properly right now, since our a11y
     185       implementation splits different lines in different a11y
     186       items */
     187    /* ATK_TEXT_BOUNDARY_LINE_START */
     188    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START,
     189                           0, "This is a test. This is the second sentence. And this the third.", 0, 64);
     190
     191    /* ATK_TEXT_BOUNDARY_LINE_END */
     192    test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END,
     193                           0, "This is a test. This is the second sentence. And this the third.", 0, 64);
     194}
     195
     196static void test_webkit_atk_get_text_at_offset_forms(void)
    54197{
    55198    WebKitWebView* webView;
    56     AtkObject *obj;
     199    AtkObject* obj;
    57200    GMainLoop* loop;
    58201    AtkText* text_obj;
    59     char* text;
    60202
    61203    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     
    80222    g_assert(ATK_IS_TEXT(text_obj));
    81223
    82     text = atk_text_get_text(text_obj, 0, -1);
    83     g_assert_cmpstr(text, ==, "This is a test. This is the second sentence. And this the third.");
    84     g_free(text);
    85 
    86     /* ATK_TEXT_BOUNDARY_CHAR */
    87     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_CHAR,
    88                            0, "T", 0, 1);
    89 
    90     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_CHAR,
    91                            0, "h", 1, 2);
    92 
    93     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_CHAR,
    94                            0, "", 0, 0);
    95 
    96     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_CHAR,
    97                            1, "T", 0, 1);
    98    
    99     /* ATK_TEXT_BOUNDARY_WORD_START */
    100     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
    101                            0, "This ", 0, 5);
    102 
    103     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
    104                            4, "This ", 0, 5);
    105 
    106     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
    107                            10, "test. ", 10, 16);
    108 
    109     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_START,
    110                            58, "third.", 58, 64);
    111 
    112     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_START,
    113                            5, "This ", 0, 5);
    114 
    115     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_START,
    116                            7, "This ", 0, 5);
    117 
    118     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_START,
    119                            0, "is ", 5, 8);
    120 
    121     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_START,
    122                            4, "is ", 5, 8);
    123 
    124     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_START,
    125                            3, "is ", 5, 8);
    126 
    127     /* ATK_TEXT_BOUNDARY_WORD_END */
    128     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
    129                            0, "This", 0, 4);
    130 
    131     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
    132                            4, " is", 4, 7);
    133 
    134     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
    135                            5, " is", 4, 7);
    136 
    137     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
    138                            9, " test", 9, 14);
    139 
    140     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_END,
    141                            5, "This", 0, 4);
    142 
    143     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_END,
    144                            4, "This", 0, 4);
    145 
    146     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_WORD_END,
    147                            7, " is", 4, 7);
    148 
    149     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_END,
    150                            5, " a", 7, 9);
    151 
    152     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_WORD_END,
    153                            4, " a", 7, 9);
    154 
    155     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_WORD_END,
    156                            58, " third", 57, 63);
    157 
    158     /* ATK_TEXT_BOUNDARY_SENTENCE_START */
    159     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
    160                            0, "This is a test. ", 0, 16);
    161 
    162     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
    163                            15, "This is a test. ", 0, 16);
    164 
    165     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
    166                            0, "This is the second sentence. ", 16, 45);
    167 
    168     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
    169                            15, "This is the second sentence. ", 16, 45);
    170 
    171     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
    172                            16, "This is a test. ", 0, 16);
    173 
    174     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
    175                            44, "This is a test. ", 0, 16);
    176 
    177     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_START,
    178                            15, "", 0, 0);
    179 
    180     /* ATK_TEXT_BOUNDARY_SENTENCE_END */
    181     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    182                            0, "This is a test.", 0, 15);
    183 
    184     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    185                            15, " This is the second sentence.", 15, 44);
    186 
    187     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    188                            16, " This is the second sentence.", 15, 44);
    189 
    190     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    191                            17, " This is the second sentence.", 15, 44);
    192 
    193     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    194                            0, " This is the second sentence.", 15, 44);
    195 
    196     test_get_text_function(text_obj, atk_text_get_text_after_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    197                            15, " And this the third.", 44, 64);
    198 
    199     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    200                            16, "This is a test.", 0, 15);
    201 
    202     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    203                            15, "This is a test.", 0, 15);
    204 
    205     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    206                            14, "", 0, 0);
    207 
    208     test_get_text_function(text_obj, atk_text_get_text_before_offset, ATK_TEXT_BOUNDARY_SENTENCE_END,
    209                            44, " This is the second sentence.", 15, 44);
    210 
    211     /* It's trick to test these properly right now, since our a11y
    212        implementation splits different lines in different a11y
    213        items */
    214     /* ATK_TEXT_BOUNDARY_LINE_START */
    215     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START,
    216                            0, "This is a test. This is the second sentence. And this the third.", 0, 64);
    217 
    218     /* ATK_TEXT_BOUNDARY_LINE_END */
    219     test_get_text_function(text_obj, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END,
    220                            0, "This is a test. This is the second sentence. And this the third.", 0, 64);
     224    run_get_text_tests(text_obj);
     225
     226    g_object_unref(webView);
     227}
     228
     229static void test_webkit_atk_get_text_at_offset(void)
     230{
     231    WebKitWebView* webView;
     232    AtkObject* obj;
     233    GMainLoop* loop;
     234    AtkText* text_obj;
     235
     236    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     237    g_object_ref_sink(webView);
     238    GtkAllocation alloc = { 0, 0, 800, 600 };
     239    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
     240    webkit_web_view_load_string(webView, contents, NULL, NULL, NULL);
     241    loop = g_main_loop_new(NULL, TRUE);
     242
     243    g_timeout_add(100, (GSourceFunc)bail_out, loop);
     244    g_main_loop_run(loop);
     245
     246    /* Get to the inner AtkText object */
     247    obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
     248    g_assert(obj);
     249    obj = atk_object_ref_accessible_child(obj, 0);
     250    g_assert(obj);
     251    obj = atk_object_ref_accessible_child(obj, 0);
     252    g_assert(obj);
     253
     254    text_obj = ATK_TEXT(obj);
     255    g_assert(ATK_IS_TEXT(text_obj));
     256
     257    run_get_text_tests(text_obj);
    221258
    222259    g_object_unref(webView);
     
    230267    g_test_bug_base("https://bugs.webkit.org/");
    231268    g_test_add_func("/webkit/atk/get_text_at_offset", test_webkit_atk_get_text_at_offset);
     269    g_test_add_func("/webkit/atk/get_text_at_offset_forms", test_webkit_atk_get_text_at_offset_forms);
    232270    return g_test_run ();
    233271}
Note: See TracChangeset for help on using the changeset viewer.