Changeset 104905 in webkit
- Timestamp:
- Jan 13, 2012 1:12:46 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r104903 r104905 1 2012-01-13 Mario Sanchez Prada <msanchez@igalia.com> 2 3 [GTK] ATK text-caret-moved and text-selection-changed events not being emitted 4 https://bugs.webkit.org/show_bug.cgi?id=76069 5 6 Reviewed by Martin Robinson. 7 8 Fix bug introduced with patch for Bug 72830. 9 10 * editing/gtk/FrameSelectionGtk.cpp: 11 (WebCore::FrameSelection::notifyAccessibilityForSelectionChange): 12 Pass the right accessibility object associated with the current 13 selection to objectFocusedAndCaretOffsetUnignored. 14 1 15 2012-01-13 Alexandru Chiculita <achicu@adobe.com> 2 16 -
trunk/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp
r104446 r104905 85 85 return; 86 86 87 // Look for the accessibility object for the Frame. 88 AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->rootObjectForFrame(m_frame); 87 RenderObject* focusedNode = m_selection.end().deprecatedNode()->renderer(); 88 AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->getOrCreate(focusedNode); 89 90 // Need to check this as getOrCreate could return 0, 89 91 if (!accessibilityObject) 90 92 return; -
trunk/Source/WebKit/gtk/ChangeLog
r104904 r104905 1 2012-01-13 Mario Sanchez Prada <msanchez@igalia.com> 2 3 [GTK] ATK text-caret-moved and text-selection-changed events not being emitted 4 https://bugs.webkit.org/show_bug.cgi?id=76069 5 6 Reviewed by Martin Robinson. 7 8 Update caret browsing related unit tests to check emissions of 9 'text-caret-moved' and 'text-selection-changed' signals. 10 11 * tests/testatk.c: 12 (textCaretMovedCallback): New callback for 'text-caret-moved'. 13 (testWebkitAtkCaretOffsets): Check emissions of 'text-caret-moved'. 14 (textSelectionChangedCallback): New callback for 'text-selection-changed'. 15 (testWebkitAtkTextSelections): Check emissions of 'text-selection-changed'. 16 1 17 2012-01-12 Mario Sanchez Prada <msanchez@igalia.com> 2 18 -
trunk/Source/WebKit/gtk/tests/testatk.c
r104904 r104905 255 255 } 256 256 257 static gchar* textCaretMovedResult = 0; 258 259 static void textCaretMovedCallback(AtkText* text, gint pos, gpointer data) 260 { 261 g_assert(ATK_IS_TEXT(text)); 262 263 g_free(textCaretMovedResult); 264 AtkRole role = atk_object_get_role(ATK_OBJECT(text)); 265 textCaretMovedResult = g_strdup_printf("|%s|%d|", atk_role_get_name(role), pos); 266 } 267 257 268 static void testWebkitAtkCaretOffsets() 258 269 { … … 268 279 AtkObject* header = atk_object_ref_accessible_child(object, 0); 269 280 g_assert(ATK_IS_TEXT(header)); 281 g_signal_connect(header, "text-caret-moved", G_CALLBACK(textCaretMovedCallback), 0); 282 270 283 gchar* text = atk_text_get_text(ATK_TEXT(header), 0, -1); 271 284 g_assert_cmpstr(text, ==, "A text header"); … … 277 290 gint offset = atk_text_get_caret_offset(ATK_TEXT(header)); 278 291 g_assert_cmpint(offset, ==, 5); 292 g_assert_cmpstr(textCaretMovedResult, ==, "|heading|5|"); 279 293 280 294 AtkObject* paragraph = atk_object_ref_accessible_child(object, 1); 281 295 g_assert(ATK_IS_TEXT(paragraph)); 296 g_signal_connect(paragraph, "text-caret-moved", G_CALLBACK(textCaretMovedCallback), 0); 297 282 298 text = atk_text_get_text(ATK_TEXT(paragraph), 0, -1); 283 299 g_assert_cmpstr(text, ==, "A paragraph with a link in the middle"); … … 289 305 offset = atk_text_get_caret_offset(ATK_TEXT(paragraph)); 290 306 g_assert_cmpint(offset, ==, 5); 307 g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|5|"); 291 308 292 309 result = atk_text_set_caret_offset(ATK_TEXT(paragraph), 20); … … 294 311 offset = atk_text_get_caret_offset(ATK_TEXT(paragraph)); 295 312 g_assert_cmpint(offset, ==, 20); 313 g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|20|"); 296 314 297 315 result = atk_text_set_caret_offset(ATK_TEXT(paragraph), 30); … … 299 317 offset = atk_text_get_caret_offset(ATK_TEXT(paragraph)); 300 318 g_assert_cmpint(offset, ==, 30); 319 g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|30|"); 320 321 AtkObject* link = atk_object_ref_accessible_child(paragraph, 0); 322 g_assert(ATK_IS_TEXT(link)); 323 text = atk_text_get_text(ATK_TEXT(link), 0, -1); 324 g_assert_cmpstr(text, ==, "with a link"); 325 g_free (text); 326 327 result = atk_text_set_caret_offset(ATK_TEXT(link), 5); 328 g_assert_cmpint(result, ==, TRUE); 329 offset = atk_text_get_caret_offset(ATK_TEXT(link)); 330 g_assert_cmpint(offset, ==, 5); 331 /* Positions inside links are reported relative to the paragraph. */ 332 g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|17|"); 301 333 302 334 AtkObject* list = atk_object_ref_accessible_child(object, 2); … … 356 388 g_assert_cmpint(offset, ==, 5); 357 389 390 g_free(textCaretMovedResult); 391 358 392 g_object_unref(header); 359 393 g_object_unref(paragraph); 394 g_object_unref(link); 360 395 g_object_unref(list); 361 396 g_object_unref(listItem); … … 1088 1123 } 1089 1124 1125 static gchar* textSelectionChangedResult = 0; 1126 1127 static void textSelectionChangedCallback(AtkText* text, gpointer data) 1128 { 1129 g_assert(ATK_IS_TEXT(text)); 1130 1131 g_free(textSelectionChangedResult); 1132 AtkRole role = atk_object_get_role(ATK_OBJECT(text)); 1133 int startOffset = 0; 1134 int endOffset = 0; 1135 atk_text_get_selection(ATK_TEXT(text), 0, &startOffset, &endOffset); 1136 textSelectionChangedResult = g_strdup_printf("|%s|%d|%d|", atk_role_get_name(role), startOffset, endOffset); 1137 } 1138 1090 1139 static void testWebkitAtkTextSelections() 1091 1140 { … … 1101 1150 AtkText* paragraph1 = ATK_TEXT(atk_object_ref_accessible_child(object, 0)); 1102 1151 g_assert(ATK_IS_TEXT(paragraph1)); 1152 g_signal_connect(paragraph1, "text-selection-changed", G_CALLBACK(textSelectionChangedCallback), 0); 1103 1153 1104 1154 AtkText* paragraph2 = ATK_TEXT(atk_object_ref_accessible_child(object, 1)); 1105 1155 g_assert(ATK_IS_TEXT(paragraph2)); 1156 g_signal_connect(paragraph2, "text-selection-changed", G_CALLBACK(textSelectionChangedCallback), 0); 1106 1157 1107 1158 AtkText* link = ATK_TEXT(atk_object_ref_accessible_child(ATK_OBJECT(paragraph2), 0)); … … 1139 1190 g_assert(result); 1140 1191 g_assert_cmpint(atk_text_get_n_selections(paragraph1), ==, 1); 1192 g_assert_cmpstr(textSelectionChangedResult, ==, "|paragraph|5|25|"); 1141 1193 selectedText = atk_text_get_selection(paragraph1, 0, &startOffset, &endOffset); 1142 1194 g_assert_cmpint(startOffset, ==, 5); … … 1144 1196 g_assert_cmpstr(selectedText, ==, "agraph with plain te"); 1145 1197 g_free (selectedText); 1198 1146 1199 /* Try removing the selection from other AtkText object (should fail). */ 1147 1200 result = atk_text_remove_selection(paragraph2, 0); … … 1186 1239 g_assert(result); 1187 1240 g_assert_cmpint(atk_text_get_n_selections(paragraph2), ==, 1); 1241 g_assert_cmpstr(textSelectionChangedResult, ==, "|paragraph|27|37|"); 1188 1242 selectedText = atk_text_get_selection(paragraph2, 0, &startOffset, &endOffset); 1189 1243 g_assert_cmpint(startOffset, ==, 27); … … 1234 1288 g_assert_cmpstr(selectedText, ==, "A list"); 1235 1289 g_free (selectedText); 1290 1291 g_free(textSelectionChangedResult); 1236 1292 1237 1293 g_object_unref(paragraph1);
Note: See TracChangeset
for help on using the changeset viewer.