Changeset 72673 in webkit
- Timestamp:
- Nov 24, 2010 7:56:49 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r72672 r72673 1 2010-11-24 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r72499. 4 http://trac.webkit.org/changeset/72499 5 https://bugs.webkit.org/show_bug.cgi?id=50022 6 7 This change is causing crashes on the bots. (Requested by 8 mrobinson on #webkit). 9 10 * accessibility/AccessibilityMenuListOption.cpp: 11 (WebCore::AccessibilityMenuListOption::nameForMSAA): 12 * accessibility/AccessibilityMenuListOption.h: 13 * accessibility/gtk/AXObjectCacheAtk.cpp: 14 (WebCore::AXObjectCache::postPlatformNotification): 15 * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: 16 (setAtkStateSetFromCoreObject): 17 (optionFromList): 18 (optionFromSelection): 19 (webkit_accessible_selection_add_selection): 20 (webkit_accessible_selection_clear_selection): 21 (webkit_accessible_selection_get_selection_count): 22 (webkit_accessible_selection_is_child_selected): 23 (webkit_accessible_selection_remove_selection): 24 (webkit_accessible_text_get_text): 25 (getInterfaceMaskFromObject): 26 * platform/gtk/PopupMenuGtk.cpp: 27 (WebCore::PopupMenuGtk::show): 28 1 29 2010-11-24 Patrick Gansterer <paroga@webkit.org> 2 30 -
trunk/WebCore/accessibility/AccessibilityMenuListOption.cpp
r72499 r72673 92 92 String AccessibilityMenuListOption::nameForMSAA() const 93 93 { 94 return st ringValue();94 return static_cast<HTMLOptionElement*>(m_element.get())->text(); 95 95 } 96 96 … … 111 111 } 112 112 113 String AccessibilityMenuListOption::stringValue() const114 {115 return static_cast<HTMLOptionElement*>(m_element.get())->text();116 }117 118 113 } // namespace WebCore -
trunk/WebCore/accessibility/AccessibilityMenuListOption.h
r72499 r72673 60 60 virtual bool canSetSelectedAttribute() const; 61 61 virtual IntRect elementRect() const; 62 virtual String stringValue() const;63 62 64 63 RefPtr<HTMLElement> m_element; -
trunk/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp
r72499 r72673 96 96 void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification) 97 97 { 98 AtkObject* axObject = coreObject->wrapper();99 if (!axObject)100 return;101 102 98 if (notification == AXCheckedStateChanged) { 103 99 if (!coreObject->isCheckboxOrRadio()) 104 100 return; 105 g_signal_emit_by_name(axObject, "state-change", "checked", coreObject->isChecked()); 106 } else if (notification == AXMenuListValueChanged) { 107 if (!coreObject->isMenuList()) 108 return; 109 g_signal_emit_by_name(axObject, "focus-event", true); 110 g_signal_emit_by_name(axObject, "state-change", "focused", true); 101 g_signal_emit_by_name(coreObject->wrapper(), "state-change", "checked", coreObject->isChecked()); 111 102 } else if (notification == AXSelectedChildrenChanged) 112 103 notifyChildrenSelectionChange(coreObject); -
trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
r72499 r72673 59 59 #include "RenderListMarker.h" 60 60 #include "RenderText.h" 61 #include "SelectElement.h"62 61 #include "TextEncoding.h" 63 62 #include "TextIterator.h" … … 502 501 } 503 502 504 if (coreObject->canSetExpandedAttribute())505 atk_state_set_add_state(stateSet, ATK_STATE_EXPANDABLE);506 507 if (coreObject->isExpanded())508 atk_state_set_add_state(stateSet, ATK_STATE_EXPANDED);509 510 503 if (coreObject->canSetFocusAttribute()) 511 504 atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE); … … 702 695 // Selection (for controls) 703 696 704 static AccessibilityObject* listObjectForSelection(AtkSelection* selection)705 {706 AccessibilityObject* coreSelection = core(selection);707 708 // Only list boxes and menu lists supported so far.709 if (!coreSelection->isListBox() && !coreSelection->isMenuList())710 return 0;711 712 // For list boxes the list object is just itself.713 if (coreSelection->isListBox())714 return coreSelection;715 716 // For menu lists we need to return the first accessible child,717 // with role MenuListPopupRole, since that's the one holding the list718 // of items with role MenuListOptionRole.719 AccessibilityObject::AccessibilityChildrenVector children = coreSelection->children();720 if (!children.size())721 return 0;722 723 AccessibilityObject* listObject = children.at(0).get();724 if (!listObject->isMenuListPopup())725 return 0;726 727 return listObject;728 }729 730 697 static AccessibilityObject* optionFromList(AtkSelection* selection, gint i) 731 698 { … … 734 701 return 0; 735 702 736 // Need to select the proper list object depending on the type. 737 AccessibilityObject* listObject = listObjectForSelection(selection); 738 if (!listObject) 739 return 0; 740 741 AccessibilityRenderObject::AccessibilityChildrenVector options = listObject->children(); 703 AccessibilityRenderObject::AccessibilityChildrenVector options = core(selection)->children(); 742 704 if (i < static_cast<gint>(options.size())) 743 705 return options.at(i).get(); … … 751 713 752 714 AccessibilityObject* coreSelection = core(selection); 753 if (!coreSelection || !coreSelection->isAccessibilityRenderObject() ||i < 0)715 if (!coreSelection || i < 0) 754 716 return 0; 755 717 756 718 AccessibilityRenderObject::AccessibilityChildrenVector selectedItems; 757 719 if (coreSelection->isListBox()) 758 coreSelection->selectedChildren(selectedItems); 759 else if (coreSelection->isMenuList()) { 760 RenderObject* renderer = toAccessibilityRenderObject(coreSelection)->renderer(); 761 if (!renderer) 762 return 0; 763 764 SelectElement* selectNode = toSelectElement(static_cast<Element*>(renderer->node())); 765 int selectedIndex = selectNode->selectedIndex(); 766 const Vector<Element*> listItems = selectNode->listItems(); 767 768 if (selectedIndex < 0 || selectedIndex >= static_cast<int>(listItems.size())) 769 return 0; 770 771 return optionFromList(selection, selectedIndex); 772 } 720 static_cast<AccessibilityListBox*>(coreSelection)->selectedChildren(selectedItems); 721 722 // TODO: Combo boxes 773 723 774 724 if (i < static_cast<gint>(selectedItems.size())) … … 779 729 780 730 static gboolean webkit_accessible_selection_add_selection(AtkSelection* selection, gint i) 731 { 732 AccessibilityObject* option = optionFromList(selection, i); 733 if (option && core(selection)->isListBox()) { 734 AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityListBoxOption*>(option); 735 listBoxOption->setSelected(true); 736 return listBoxOption->isSelected(); 737 } 738 739 return false; 740 } 741 742 static gboolean webkit_accessible_selection_clear_selection(AtkSelection* selection) 781 743 { 782 744 AccessibilityObject* coreSelection = core(selection); … … 784 746 return false; 785 747 786 AccessibilityObject* option = optionFromList(selection, i);787 if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) {788 option->setSelected(true);789 return option->isSelected();790 }791 792 return false;793 }794 795 static gboolean webkit_accessible_selection_clear_selection(AtkSelection* selection)796 {797 AccessibilityObject* coreSelection = core(selection);798 if (!coreSelection)799 return false;800 801 748 AccessibilityRenderObject::AccessibilityChildrenVector selectedItems; 802 if (coreSelection->isListBox() || coreSelection->isMenuList()) {749 if (coreSelection->isListBox()) { 803 750 // Set the list of selected items to an empty list; then verify that it worked. 804 751 AccessibilityListBox* listBox = static_cast<AccessibilityListBox*>(coreSelection); … … 825 772 { 826 773 AccessibilityObject* coreSelection = core(selection); 827 if (!coreSelection || !coreSelection->isAccessibilityRenderObject()) 828 return 0; 829 830 if (coreSelection->isListBox()) { 774 if (coreSelection && coreSelection->isListBox()) { 831 775 AccessibilityRenderObject::AccessibilityChildrenVector selectedItems; 832 coreSelection->selectedChildren(selectedItems);776 static_cast<AccessibilityListBox*>(coreSelection)->selectedChildren(selectedItems); 833 777 return static_cast<gint>(selectedItems.size()); 834 778 } 835 779 836 if (coreSelection->isMenuList()) {837 RenderObject* renderer = toAccessibilityRenderObject(coreSelection)->renderer();838 if (!renderer)839 return 0;840 841 SelectElement* selectNode = toSelectElement(static_cast<Element*>(renderer->node()));842 int selectedIndex = selectNode->selectedIndex();843 const Vector<Element*> listItems = selectNode->listItems();844 845 return selectedIndex >= 0 && selectedIndex < static_cast<int>(listItems.size());846 }847 848 780 return 0; 849 781 } … … 851 783 static gboolean webkit_accessible_selection_is_child_selected(AtkSelection* selection, gint i) 852 784 { 853 AccessibilityObject* coreSelection = core(selection);854 if (!coreSelection)855 return 0;856 857 785 AccessibilityObject* option = optionFromList(selection, i); 858 if (option && (coreSelection->isListBox() || coreSelection->isMenuList()))859 return option->isSelected();786 if (option && core(selection)->isListBox()) 787 return static_cast<AccessibilityListBoxOption*>(option)->isSelected(); 860 788 861 789 return false; … … 864 792 static gboolean webkit_accessible_selection_remove_selection(AtkSelection* selection, gint i) 865 793 { 866 AccessibilityObject* coreSelection = core(selection);867 if (!coreSelection)868 return 0;869 870 794 // TODO: This is only getting called if i == 0. What is preventing the rest? 871 795 AccessibilityObject* option = optionFromSelection(selection, i); 872 if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) { 873 option->setSelected(false); 874 return !option->isSelected(); 796 if (option && core(selection)->isListBox()) { 797 AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityListBoxOption*>(option); 798 listBoxOption->setSelected(false); 799 return !listBoxOption->isSelected(); 875 800 } 876 801 … … 1045 970 if (coreObject->isTextControl()) 1046 971 ret = coreObject->doAXStringForRange(PlainTextRange(start, length)); 1047 else { 1048 ret = coreObject->stringValue().substring(start, length); 1049 if (!ret) 1050 ret = coreObject->textUnderElement().substring(start, length); 1051 } 972 else 973 ret = coreObject->textUnderElement().substring(start, length); 1052 974 1053 975 if (!ret.length()) { … … 2256 2178 2257 2179 // Action 2258 // As the implementation of the AtkAction interface is a very 2259 // basic one (just relays in executing the default action for each 2260 // object, and only supports having one action per object), it is 2261 // better just to implement this interface for every instance of 2262 // the WebKitAccessible class and let WebCore decide what to do. 2263 interfaceMask |= 1 << WAI_ACTION; 2264 2265 // Hyperlink 2266 if (coreObject->isLink()) 2267 interfaceMask |= 1 << WAI_HYPERLINK; 2180 if (!coreObject->actionVerb().isEmpty()) { 2181 interfaceMask |= 1 << WAI_ACTION; 2182 2183 if (!coreObject->accessibilityIsIgnored() && coreObject->isLink()) 2184 interfaceMask |= 1 << WAI_HYPERLINK; 2185 } 2268 2186 2269 2187 // Selection 2270 if (coreObject->isListBox() || coreObject->isMenuList())2188 if (coreObject->isListBox()) 2271 2189 interfaceMask |= 1 << WAI_SELECTION; 2272 2190 2273 2191 // Text & Editable Text 2274 if (role == StaticTextRole || coreObject->isMenuListOption())2192 if (role == StaticTextRole) 2275 2193 interfaceMask |= 1 << WAI_TEXT; 2276 2194 else if (coreObject->isAccessibilityRenderObject()) { -
trunk/WebCore/platform/gtk/PopupMenuGtk.cpp
r72499 r72673 59 59 gtk_container_foreach(GTK_CONTAINER(m_popup.get()), reinterpret_cast<GtkCallback>(menuRemoveItem), this); 60 60 61 int x = 0; 62 int y = 0; 63 GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())); 64 if (window) 65 gdk_window_get_origin(window, &x, &y); 61 int x, y; 62 gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())), &x, &y); 66 63 m_menuPosition = view->contentsToWindow(rect.location()); 67 64 m_menuPosition = IntPoint(m_menuPosition.x() + x, m_menuPosition.y() + y + rect.height()); -
trunk/WebKit/gtk/ChangeLog
r72634 r72673 1 2010-11-24 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r72499. 4 http://trac.webkit.org/changeset/72499 5 https://bugs.webkit.org/show_bug.cgi?id=50022 6 7 This change is causing crashes on the bots. (Requested by 8 mrobinson on #webkit). 9 10 * tests/testatk.c: 11 (main): 12 1 13 2010-11-23 Xan Lopez <xlopez@igalia.com> 2 14 -
trunk/WebKit/gtk/tests/testatk.c
r72499 r72673 45 45 static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo</th><th>bar</th><th colspan='2'>baz</th></tr><tr><th>qux</th><td>1</td><td>2</td><td>3</td></tr><tr><th rowspan='2'>quux</th><td>4</td><td>5</td><td>6</td></tr><tr><td>6</td><td>7</td><td>8</td></tr><tr><th>corge</th><td>9</td><td>10</td><td>11</td></tr></table><table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table></body></html>"; 46 46 47 static const char* comboBoxSelector = "<html><body><select><option selected value='foo'>foo</option><option value='bar'>bar</option></select></body></html>";48 49 47 static const char* formWithTextInputs = "<html><body><form><input type='text' name='entry' /></form></body></html>"; 50 48 … … 222 220 testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 223 221 0, "This is a test. This is the second sentence. And this the third.", 0, 64); 224 }225 226 static void testWebkitAtkComboBox()227 {228 WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());229 g_object_ref_sink(webView);230 GtkAllocation allocation = { 0, 0, 800, 600 };231 gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);232 webkit_web_view_load_string(webView, comboBoxSelector, 0, 0, 0);233 234 /* Wait for the accessible objects to be created. */235 waitForAccessibleObjects();236 237 AtkObject* object = gtk_widget_get_accessible(GTK_WIDGET(webView));238 g_assert(object);239 240 AtkObject* formObject = atk_object_ref_accessible_child(object, 0);241 g_assert(formObject);242 243 AtkObject* comboBox = atk_object_ref_accessible_child(formObject, 0);244 g_assert(ATK_IS_OBJECT(comboBox));245 246 AtkObject* menuPopup = atk_object_ref_accessible_child(comboBox, 0);247 g_assert(ATK_IS_OBJECT(menuPopup));248 249 AtkObject* item1 = atk_object_ref_accessible_child(menuPopup, 0);250 g_assert(ATK_IS_OBJECT(item1));251 252 AtkObject* item2 = atk_object_ref_accessible_child(menuPopup, 1);253 g_assert(ATK_IS_OBJECT(item2));254 255 /* Check roles. */256 g_assert(atk_object_get_role(comboBox) == ATK_ROLE_COMBO_BOX);257 g_assert(atk_object_get_role(menuPopup) == ATK_ROLE_MENU);258 g_assert(atk_object_get_role(item1) == ATK_ROLE_MENU_ITEM);259 g_assert(atk_object_get_role(item2) == ATK_ROLE_MENU_ITEM);260 261 /* Check the implementation of the AtkSelection interface. */262 g_assert(ATK_IS_SELECTION(comboBox));263 AtkSelection* atkSelection = ATK_SELECTION(comboBox);264 g_assert_cmpint(atk_selection_get_selection_count(atkSelection), ==, 1);265 g_assert(atk_selection_is_child_selected(atkSelection, 0));266 g_assert(!atk_selection_is_child_selected(atkSelection, 1));267 AtkObject* selectedItem = atk_selection_ref_selection(atkSelection, 0);268 g_assert(selectedItem == item1);269 g_object_unref(selectedItem);270 271 /* Check the implementations of the AtkAction interface. */272 g_assert(ATK_IS_ACTION(comboBox));273 AtkAction* atkAction = ATK_ACTION(comboBox);274 g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);275 g_assert(atk_action_do_action(atkAction, 0));276 277 g_assert(ATK_IS_ACTION(menuPopup));278 atkAction = ATK_ACTION(menuPopup);279 g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);280 g_assert(atk_action_do_action(atkAction, 0));281 282 g_assert(ATK_IS_ACTION(item1));283 atkAction = ATK_ACTION(item1);284 g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);285 g_assert(atk_action_do_action(atkAction, 0));286 287 g_assert(ATK_IS_ACTION(item2));288 atkAction = ATK_ACTION(item2);289 g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);290 g_assert(atk_action_do_action(atkAction, 0));291 292 /* After selecting the second item, selection should have changed. */293 g_assert_cmpint(atk_selection_get_selection_count(atkSelection), ==, 1);294 g_assert(!atk_selection_is_child_selected(atkSelection, 0));295 g_assert(atk_selection_is_child_selected(atkSelection, 1));296 selectedItem = atk_selection_ref_selection(atkSelection, 0);297 g_assert(selectedItem == item2);298 g_object_unref(selectedItem);299 300 /* Check the implementation of the AtkText interface. */301 g_assert(ATK_IS_TEXT(item1));302 AtkText* atkText = ATK_TEXT(item1);303 char *text = atk_text_get_text(atkText, 0, -1);304 g_assert_cmpstr(text, ==, "foo");305 g_free(text);306 text = atk_text_get_text(atkText, 0, 2);307 g_assert_cmpstr(text, ==, "fo");308 g_free(text);309 310 g_assert(ATK_IS_TEXT(item2));311 atkText = ATK_TEXT(item2);312 text = atk_text_get_text(atkText, 0, -1);313 g_assert_cmpstr(text, ==, "bar");314 g_free(text);315 text = atk_text_get_text(atkText, 1, 3);316 g_assert_cmpstr(text, ==, "ar");317 g_free(text);318 319 g_object_unref(formObject);320 g_object_unref(comboBox);321 g_object_unref(menuPopup);322 g_object_unref(item1);323 g_object_unref(item2);324 g_object_unref(webView);325 222 } 326 223 … … 1315 1212 1316 1213 g_test_bug_base("https://bugs.webkit.org/"); 1317 g_test_add_func("/webkit/atk/comboBox", testWebkitAtkComboBox);1318 1214 g_test_add_func("/webkit/atk/getTextAtOffset", testWebkitAtkGetTextAtOffset); 1319 1215 g_test_add_func("/webkit/atk/getTextAtOffsetForms", testWebkitAtkGetTextAtOffsetForms);
Note: See TracChangeset
for help on using the changeset viewer.