2010-11-24 Sheriff Bot <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r72499.
        http://trac.webkit.org/changeset/72499
        https://bugs.webkit.org/show_bug.cgi?id=50022

        This change is causing crashes on the bots. (Requested by
        mrobinson on #webkit).

        * accessibility/AccessibilityMenuListOption.cpp:
        (WebCore::AccessibilityMenuListOption::nameForMSAA):
        * accessibility/AccessibilityMenuListOption.h:
        * accessibility/gtk/AXObjectCacheAtk.cpp:
        (WebCore::AXObjectCache::postPlatformNotification):
        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
        (setAtkStateSetFromCoreObject):
        (optionFromList):
        (optionFromSelection):
        (webkit_accessible_selection_add_selection):
        (webkit_accessible_selection_clear_selection):
        (webkit_accessible_selection_get_selection_count):
        (webkit_accessible_selection_is_child_selected):
        (webkit_accessible_selection_remove_selection):
        (webkit_accessible_text_get_text):
        (getInterfaceMaskFromObject):
        * platform/gtk/PopupMenuGtk.cpp:
        (WebCore::PopupMenuGtk::show):
2010-11-24  Sheriff Bot  <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r72499.
        http://trac.webkit.org/changeset/72499
        https://bugs.webkit.org/show_bug.cgi?id=50022

        This change is causing crashes on the bots. (Requested by
        mrobinson on #webkit).

        * tests/testatk.c:
        (main):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9e1d311e
2010-11-24 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r72499.
http://trac.webkit.org/changeset/72499
https://bugs.webkit.org/show_bug.cgi?id=50022
This change is causing crashes on the bots. (Requested by
mrobinson on #webkit).
* accessibility/AccessibilityMenuListOption.cpp:
(WebCore::AccessibilityMenuListOption::nameForMSAA):
* accessibility/AccessibilityMenuListOption.h:
* accessibility/gtk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(setAtkStateSetFromCoreObject):
(optionFromList):
(optionFromSelection):
(webkit_accessible_selection_add_selection):
(webkit_accessible_selection_clear_selection):
(webkit_accessible_selection_get_selection_count):
(webkit_accessible_selection_is_child_selected):
(webkit_accessible_selection_remove_selection):
(webkit_accessible_text_get_text):
(getInterfaceMaskFromObject):
* platform/gtk/PopupMenuGtk.cpp:
(WebCore::PopupMenuGtk::show):
2010-11-24 Patrick Gansterer <paroga@webkit.org>
Reviewed by Csaba Osztrogonác.
......@@ -91,7 +91,7 @@ void AccessibilityMenuListOption::setSelected(bool b)
String AccessibilityMenuListOption::nameForMSAA() const
{
return stringValue();
return static_cast<HTMLOptionElement*>(m_element.get())->text();
}
bool AccessibilityMenuListOption::canSetSelectedAttribute() const
......@@ -110,9 +110,4 @@ IntRect AccessibilityMenuListOption::elementRect() const
return grandparent->elementRect();
}
String AccessibilityMenuListOption::stringValue() const
{
return static_cast<HTMLOptionElement*>(m_element.get())->text();
}
} // namespace WebCore
......@@ -59,7 +59,6 @@ private:
virtual void setSelected(bool);
virtual bool canSetSelectedAttribute() const;
virtual IntRect elementRect() const;
virtual String stringValue() const;
RefPtr<HTMLElement> m_element;
AccessibilityMenuListPopup* m_popup;
......
......@@ -95,19 +95,10 @@ static void notifyChildrenSelectionChange(AccessibilityObject* object)
void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification)
{
AtkObject* axObject = coreObject->wrapper();
if (!axObject)
return;
if (notification == AXCheckedStateChanged) {
if (!coreObject->isCheckboxOrRadio())
return;
g_signal_emit_by_name(axObject, "state-change", "checked", coreObject->isChecked());
} else if (notification == AXMenuListValueChanged) {
if (!coreObject->isMenuList())
return;
g_signal_emit_by_name(axObject, "focus-event", true);
g_signal_emit_by_name(axObject, "state-change", "focused", true);
g_signal_emit_by_name(coreObject->wrapper(), "state-change", "checked", coreObject->isChecked());
} else if (notification == AXSelectedChildrenChanged)
notifyChildrenSelectionChange(coreObject);
}
......
......@@ -58,7 +58,6 @@
#include "RenderListItem.h"
#include "RenderListMarker.h"
#include "RenderText.h"
#include "SelectElement.h"
#include "TextEncoding.h"
#include "TextIterator.h"
#include "WebKitAccessibleHyperlink.h"
......@@ -501,12 +500,6 @@ static void setAtkStateSetFromCoreObject(AccessibilityObject* coreObject, AtkSta
atk_state_set_add_state(stateSet, ATK_STATE_SENSITIVE);
}
if (coreObject->canSetExpandedAttribute())
atk_state_set_add_state(stateSet, ATK_STATE_EXPANDABLE);
if (coreObject->isExpanded())
atk_state_set_add_state(stateSet, ATK_STATE_EXPANDED);
if (coreObject->canSetFocusAttribute())
atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE);
......@@ -701,44 +694,13 @@ static void atk_action_interface_init(AtkActionIface* iface)
// Selection (for controls)
static AccessibilityObject* listObjectForSelection(AtkSelection* selection)
{
AccessibilityObject* coreSelection = core(selection);
// Only list boxes and menu lists supported so far.
if (!coreSelection->isListBox() && !coreSelection->isMenuList())
return 0;
// For list boxes the list object is just itself.
if (coreSelection->isListBox())
return coreSelection;
// For menu lists we need to return the first accessible child,
// with role MenuListPopupRole, since that's the one holding the list
// of items with role MenuListOptionRole.
AccessibilityObject::AccessibilityChildrenVector children = coreSelection->children();
if (!children.size())
return 0;
AccessibilityObject* listObject = children.at(0).get();
if (!listObject->isMenuListPopup())
return 0;
return listObject;
}
static AccessibilityObject* optionFromList(AtkSelection* selection, gint i)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection || i < 0)
return 0;
// Need to select the proper list object depending on the type.
AccessibilityObject* listObject = listObjectForSelection(selection);
if (!listObject)
return 0;
AccessibilityRenderObject::AccessibilityChildrenVector options = listObject->children();
AccessibilityRenderObject::AccessibilityChildrenVector options = core(selection)->children();
if (i < static_cast<gint>(options.size()))
return options.at(i).get();
......@@ -750,26 +712,14 @@ static AccessibilityObject* optionFromSelection(AtkSelection* selection, gint i)
// i is the ith selection as opposed to the ith child.
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || i < 0)
if (!coreSelection || i < 0)
return 0;
AccessibilityRenderObject::AccessibilityChildrenVector selectedItems;
if (coreSelection->isListBox())
coreSelection->selectedChildren(selectedItems);
else if (coreSelection->isMenuList()) {
RenderObject* renderer = toAccessibilityRenderObject(coreSelection)->renderer();
if (!renderer)
return 0;
SelectElement* selectNode = toSelectElement(static_cast<Element*>(renderer->node()));
int selectedIndex = selectNode->selectedIndex();
const Vector<Element*> listItems = selectNode->listItems();
static_cast<AccessibilityListBox*>(coreSelection)->selectedChildren(selectedItems);
if (selectedIndex < 0 || selectedIndex >= static_cast<int>(listItems.size()))
return 0;
return optionFromList(selection, selectedIndex);
}
// TODO: Combo boxes
if (i < static_cast<gint>(selectedItems.size()))
return selectedItems.at(i).get();
......@@ -779,14 +729,11 @@ static AccessibilityObject* optionFromSelection(AtkSelection* selection, gint i)
static gboolean webkit_accessible_selection_add_selection(AtkSelection* selection, gint i)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection)
return false;
AccessibilityObject* option = optionFromList(selection, i);
if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) {
option->setSelected(true);
return option->isSelected();
if (option && core(selection)->isListBox()) {
AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityListBoxOption*>(option);
listBoxOption->setSelected(true);
return listBoxOption->isSelected();
}
return false;
......@@ -799,7 +746,7 @@ static gboolean webkit_accessible_selection_clear_selection(AtkSelection* select
return false;
AccessibilityRenderObject::AccessibilityChildrenVector selectedItems;
if (coreSelection->isListBox() || coreSelection->isMenuList()) {
if (coreSelection->isListBox()) {
// Set the list of selected items to an empty list; then verify that it worked.
AccessibilityListBox* listBox = static_cast<AccessibilityListBox*>(coreSelection);
listBox->setSelectedChildren(selectedItems);
......@@ -824,54 +771,32 @@ static AtkObject* webkit_accessible_selection_ref_selection(AtkSelection* select
static gint webkit_accessible_selection_get_selection_count(AtkSelection* selection)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection || !coreSelection->isAccessibilityRenderObject())
return 0;
if (coreSelection->isListBox()) {
if (coreSelection && coreSelection->isListBox()) {
AccessibilityRenderObject::AccessibilityChildrenVector selectedItems;
coreSelection->selectedChildren(selectedItems);
static_cast<AccessibilityListBox*>(coreSelection)->selectedChildren(selectedItems);
return static_cast<gint>(selectedItems.size());
}
if (coreSelection->isMenuList()) {
RenderObject* renderer = toAccessibilityRenderObject(coreSelection)->renderer();
if (!renderer)
return 0;
SelectElement* selectNode = toSelectElement(static_cast<Element*>(renderer->node()));
int selectedIndex = selectNode->selectedIndex();
const Vector<Element*> listItems = selectNode->listItems();
return selectedIndex >= 0 && selectedIndex < static_cast<int>(listItems.size());
}
return 0;
}
static gboolean webkit_accessible_selection_is_child_selected(AtkSelection* selection, gint i)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection)
return 0;
AccessibilityObject* option = optionFromList(selection, i);
if (option && (coreSelection->isListBox() || coreSelection->isMenuList()))
return option->isSelected();
if (option && core(selection)->isListBox())
return static_cast<AccessibilityListBoxOption*>(option)->isSelected();
return false;
}
static gboolean webkit_accessible_selection_remove_selection(AtkSelection* selection, gint i)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection)
return 0;
// TODO: This is only getting called if i == 0. What is preventing the rest?
AccessibilityObject* option = optionFromSelection(selection, i);
if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) {
option->setSelected(false);
return !option->isSelected();
if (option && core(selection)->isListBox()) {
AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityListBoxOption*>(option);
listBoxOption->setSelected(false);
return !listBoxOption->isSelected();
}
return false;
......@@ -1044,11 +969,8 @@ static gchar* webkit_accessible_text_get_text(AtkText* text, gint startOffset, g
if (coreObject->isTextControl())
ret = coreObject->doAXStringForRange(PlainTextRange(start, length));
else {
ret = coreObject->stringValue().substring(start, length);
if (!ret)
ret = coreObject->textUnderElement().substring(start, length);
}
else
ret = coreObject->textUnderElement().substring(start, length);
if (!ret.length()) {
// This can happen at least with anonymous RenderBlocks (e.g. body text amongst paragraphs)
......@@ -2255,23 +2177,19 @@ static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject)
AccessibilityRole role = coreObject->roleValue();
// Action
// As the implementation of the AtkAction interface is a very
// basic one (just relays in executing the default action for each
// object, and only supports having one action per object), it is
// better just to implement this interface for every instance of
// the WebKitAccessible class and let WebCore decide what to do.
interfaceMask |= 1 << WAI_ACTION;
if (!coreObject->actionVerb().isEmpty()) {
interfaceMask |= 1 << WAI_ACTION;
// Hyperlink
if (coreObject->isLink())
interfaceMask |= 1 << WAI_HYPERLINK;
if (!coreObject->accessibilityIsIgnored() && coreObject->isLink())
interfaceMask |= 1 << WAI_HYPERLINK;
}
// Selection
if (coreObject->isListBox() || coreObject->isMenuList())
if (coreObject->isListBox())
interfaceMask |= 1 << WAI_SELECTION;
// Text & Editable Text
if (role == StaticTextRole || coreObject->isMenuListOption())
if (role == StaticTextRole)
interfaceMask |= 1 << WAI_TEXT;
else if (coreObject->isAccessibilityRenderObject()) {
if (coreObject->isTextControl()) {
......
......@@ -58,11 +58,8 @@ void PopupMenuGtk::show(const IntRect& rect, FrameView* view, int index)
} else
gtk_container_foreach(GTK_CONTAINER(m_popup.get()), reinterpret_cast<GtkCallback>(menuRemoveItem), this);
int x = 0;
int y = 0;
GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient()));
if (window)
gdk_window_get_origin(window, &x, &y);
int x, y;
gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())), &x, &y);
m_menuPosition = view->contentsToWindow(rect.location());
m_menuPosition = IntPoint(m_menuPosition.x() + x, m_menuPosition.y() + y + rect.height());
m_indexMap.clear();
......
2010-11-24 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r72499.
http://trac.webkit.org/changeset/72499
https://bugs.webkit.org/show_bug.cgi?id=50022
This change is causing crashes on the bots. (Requested by
mrobinson on #webkit).
* tests/testatk.c:
(main):
2010-11-23 Xan Lopez <xlopez@igalia.com>
Reviewed by Martin Robinson.
......
......@@ -44,8 +44,6 @@ static const char* contentsInTable = "<html><body><table><tr><td>foo</td><td>bar
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>";
static const char* comboBoxSelector = "<html><body><select><option selected value='foo'>foo</option><option value='bar'>bar</option></select></body></html>";
static const char* formWithTextInputs = "<html><body><form><input type='text' name='entry' /></form></body></html>";
static const char* hypertextAndHyperlinks = "<html><body><p>A paragraph with no links at all</p><p><a href='http://foo.bar.baz/'>A line</a> with <a href='http://bar.baz.foo/'>a link in the middle</a> as well as at the beginning and <a href='http://baz.foo.bar/'>at the end</a></p></body></html>";
......@@ -223,107 +221,6 @@ static void runGetTextTests(AtkText* textObject)
0, "This is a test. This is the second sentence. And this the third.", 0, 64);
}
static void testWebkitAtkComboBox()
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_ref_sink(webView);
GtkAllocation allocation = { 0, 0, 800, 600 };
gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);
webkit_web_view_load_string(webView, comboBoxSelector, 0, 0, 0);
/* Wait for the accessible objects to be created. */
waitForAccessibleObjects();
AtkObject* object = gtk_widget_get_accessible(GTK_WIDGET(webView));
g_assert(object);
AtkObject* formObject = atk_object_ref_accessible_child(object, 0);
g_assert(formObject);
AtkObject* comboBox = atk_object_ref_accessible_child(formObject, 0);
g_assert(ATK_IS_OBJECT(comboBox));
AtkObject* menuPopup = atk_object_ref_accessible_child(comboBox, 0);
g_assert(ATK_IS_OBJECT(menuPopup));
AtkObject* item1 = atk_object_ref_accessible_child(menuPopup, 0);
g_assert(ATK_IS_OBJECT(item1));
AtkObject* item2 = atk_object_ref_accessible_child(menuPopup, 1);
g_assert(ATK_IS_OBJECT(item2));
/* Check roles. */
g_assert(atk_object_get_role(comboBox) == ATK_ROLE_COMBO_BOX);
g_assert(atk_object_get_role(menuPopup) == ATK_ROLE_MENU);
g_assert(atk_object_get_role(item1) == ATK_ROLE_MENU_ITEM);
g_assert(atk_object_get_role(item2) == ATK_ROLE_MENU_ITEM);
/* Check the implementation of the AtkSelection interface. */
g_assert(ATK_IS_SELECTION(comboBox));
AtkSelection* atkSelection = ATK_SELECTION(comboBox);
g_assert_cmpint(atk_selection_get_selection_count(atkSelection), ==, 1);
g_assert(atk_selection_is_child_selected(atkSelection, 0));
g_assert(!atk_selection_is_child_selected(atkSelection, 1));
AtkObject* selectedItem = atk_selection_ref_selection(atkSelection, 0);
g_assert(selectedItem == item1);
g_object_unref(selectedItem);
/* Check the implementations of the AtkAction interface. */
g_assert(ATK_IS_ACTION(comboBox));
AtkAction* atkAction = ATK_ACTION(comboBox);
g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);
g_assert(atk_action_do_action(atkAction, 0));
g_assert(ATK_IS_ACTION(menuPopup));
atkAction = ATK_ACTION(menuPopup);
g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);
g_assert(atk_action_do_action(atkAction, 0));
g_assert(ATK_IS_ACTION(item1));
atkAction = ATK_ACTION(item1);
g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);
g_assert(atk_action_do_action(atkAction, 0));
g_assert(ATK_IS_ACTION(item2));
atkAction = ATK_ACTION(item2);
g_assert_cmpint(atk_action_get_n_actions(atkAction), ==, 1);
g_assert(atk_action_do_action(atkAction, 0));
/* After selecting the second item, selection should have changed. */
g_assert_cmpint(atk_selection_get_selection_count(atkSelection), ==, 1);
g_assert(!atk_selection_is_child_selected(atkSelection, 0));
g_assert(atk_selection_is_child_selected(atkSelection, 1));
selectedItem = atk_selection_ref_selection(atkSelection, 0);
g_assert(selectedItem == item2);
g_object_unref(selectedItem);
/* Check the implementation of the AtkText interface. */
g_assert(ATK_IS_TEXT(item1));
AtkText* atkText = ATK_TEXT(item1);
char *text = atk_text_get_text(atkText, 0, -1);
g_assert_cmpstr(text, ==, "foo");
g_free(text);
text = atk_text_get_text(atkText, 0, 2);
g_assert_cmpstr(text, ==, "fo");
g_free(text);
g_assert(ATK_IS_TEXT(item2));
atkText = ATK_TEXT(item2);
text = atk_text_get_text(atkText, 0, -1);
g_assert_cmpstr(text, ==, "bar");
g_free(text);
text = atk_text_get_text(atkText, 1, 3);
g_assert_cmpstr(text, ==, "ar");
g_free(text);
g_object_unref(formObject);
g_object_unref(comboBox);
g_object_unref(menuPopup);
g_object_unref(item1);
g_object_unref(item2);
g_object_unref(webView);
}
static void testWebkitAtkGetTextAtOffsetForms()
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
......@@ -1314,7 +1211,6 @@ int main(int argc, char** argv)
gtk_test_init(&argc, &argv, 0);
g_test_bug_base("https://bugs.webkit.org/");
g_test_add_func("/webkit/atk/comboBox", testWebkitAtkComboBox);
g_test_add_func("/webkit/atk/getTextAtOffset", testWebkitAtkGetTextAtOffset);
g_test_add_func("/webkit/atk/getTextAtOffsetForms", testWebkitAtkGetTextAtOffsetForms);
g_test_add_func("/webkit/atk/getTextAtOffsetNewlines", testWebkitAtkGetTextAtOffsetNewlines);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment