Changeset 44622 in webkit
- Timestamp:
- Jun 11, 2009 11:46:17 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r44617 r44622 1 2009-06-12 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Gustavo Noronha. 4 5 https://bugs.webkit.org/show_bug.cgi?id=25609 6 [GTK] Implement support for get_selection and get_n_selections 7 8 Only use the VisibleSelection object if it actually belongs to the 9 object we are using. 10 11 This is pretty hacky-ish, but I can't seem to find a direct API to 12 get the VisibleSelection for a given object, only the global one. 13 14 * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: 15 (selectionBelongsToObject): 16 (webkit_accessible_text_get_n_selections): 17 (webkit_accessible_text_get_selection): 18 1 19 2009-06-03 Eric Seidel <eric@webkit.org> 2 20 -
trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
r44592 r44622 611 611 } 612 612 613 static bool selectionBelongsToObject(AccessibilityObject *coreObject, VisibleSelection& selection) 614 { 615 if (!coreObject->isAccessibilityRenderObject()) 616 return false; 617 618 Node* node = static_cast<AccessibilityRenderObject*>(coreObject)->renderer()->node(); 619 return node == selection.base().containerNode(); 620 } 621 613 622 static gint webkit_accessible_text_get_n_selections(AtkText* text) 614 623 { … … 618 627 // We don't support multiple selections for now, so there's only 619 628 // two possibilities 620 return selection.isNone() ? 0 : 1; 629 // Also, we don't want to do anything if the selection does not 630 // belong to the currently selected object. We have to check since 631 // there's no way to get the selection for a given object, only 632 // the global one (the API is a bit confusing) 633 return !selectionBelongsToObject(coreObject, selection) || selection.isNone() ? 0 : 1; 621 634 } 622 635 623 636 static gchar* webkit_accessible_text_get_selection(AtkText* text, gint selection_num, gint* start_offset, gint* end_offset) 624 637 { 625 if (selection_num != 0) { 626 // WebCore does not support multiple selection, so anything but 0 does not make sense for now. 638 AccessibilityObject* coreObject = core(text); 639 VisibleSelection selection = coreObject->selection(); 640 641 // WebCore does not support multiple selection, so anything but 0 does not make sense for now. 642 // Also, we don't want to do anything if the selection does not 643 // belong to the currently selected object. We have to check since 644 // there's no way to get the selection for a given object, only 645 // the global one (the API is a bit confusing) 646 if (selection_num != 0 || !selectionBelongsToObject(coreObject, selection)) { 627 647 *start_offset = *end_offset = 0; 628 648 return NULL; 629 649 } 630 650 631 AccessibilityObject* coreObject = core(text);632 VisibleSelection selection = coreObject->selection();633 651 *start_offset = selection.start().offsetInContainerNode(); 634 652 *end_offset = selection.end().offsetInContainerNode();
Note: See TracChangeset
for help on using the changeset viewer.