Commit f80168a6 authored by mario@webkit.org's avatar mario@webkit.org

2011-03-26 Mario Sanchez Prada <msanchez@igalia.com>

        Reviewed by Martin Robinson.

        [GTK] Expose the AtkValue interface for WAI-ARIA sliders
        https://bugs.webkit.org/show_bug.cgi?id=56655

        New test to check WAI-ARIA sliders required attributes.

        * platform/gtk/accessibility/aria-slider-required-attributes-expected.txt: Added.
        * platform/gtk/accessibility/aria-slider-required-attributes.html: Added.
2011-03-26  Mario Sanchez Prada  <msanchez@igalia.com>

        Reviewed by Martin Robinson.

        [GTK] Expose the AtkValue interface for WAI-ARIA sliders
        https://bugs.webkit.org/show_bug.cgi?id=56655

        Implement AtkValue interface for WAI-ARIA sliders.

        Test: platform/gtk/accessibility/aria-slider-required-attributes.html

        * accessibility/gtk/AXObjectCacheAtk.cpp:
        (WebCore::AXObjectCache::postPlatformNotification): Emit the
        'property-change::accessible-value' signal when needed.

        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
        (core): New, returns a core object from an AtkValue.
        (webkitAccessibleValueGetCurrentValue): New, implements AtkValue.
        (webkitAccessibleValueGetMaximumValue): Ditto.
        (webkitAccessibleValueGetMinimumValue): Ditto.
        (webkitAccessibleValueSetCurrentValue): Ditto.
        (webkitAccessibleValueGetMinimumIncrement): Ditto.
        (atkValueInterfaceInit): Ditto.
        (GetAtkInterfaceTypeFromWAIType): Add ATK_TYPE_VALUE.
        (getInterfaceMaskFromObject): Set the WAI_VALUE bit for sliders.

git-svn-id: svn://svn.chromium.org/blink/trunk@82095 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 07db218d
2011-03-26 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Martin Robinson.
[GTK] Expose the AtkValue interface for WAI-ARIA sliders
https://bugs.webkit.org/show_bug.cgi?id=56655
New test to check WAI-ARIA sliders required attributes.
* platform/gtk/accessibility/aria-slider-required-attributes-expected.txt: Added.
* platform/gtk/accessibility/aria-slider-required-attributes.html: Added.
2011-03-28 Sergio Villar Senin <svillar@igalia.com>
[GTK] Fullscreen tests failing after r82084
......
Accessibility object emitted "focus-event = 1" / Name: "(No name)" / Role: 50
Accessibility object emitted "state-change:focused = 1" / Name: "(No name)" / Role: 50
Accessibility object emitted "load-complete" / Name: "(No name)" / Role: 80
Accessibility object emitted "state-change:busy = 0" / Name: "(No name)" / Role: 80
Accessibility object emitted "property-change:accessible-value" / Name: "(No name)" / Role: 50
Accessibility object emitted "property-change:accessible-value" / Name: "(No name)" / Role: 50
This tests the exposure of attributes for an ARIA slider.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
PASS axSlider.role is 'AXRole: slider'
PASS axSlider.intValue is 50
PASS axSlider.minValue is 0
PASS axSlider.maxValue is 100
PASS axSlider.intValue is 75
PASS axSlider.intValue is 35
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
<script>
var successfullyParsed = false;
function finishTest()
{
layoutTestController.notifyDone();
}
function runTest()
{
slider = document.getElementById("slider");
slider.focus();
axSlider = accessibilityController.focusedElement;
shouldBe("axSlider.role", "'AXRole: slider'");
shouldBe("axSlider.intValue", "50");
shouldBe("axSlider.minValue", "0");
shouldBe("axSlider.maxValue", "100");
slider.setAttribute("aria-valuenow", "75");
shouldBe("axSlider.intValue", "75");
slider.setAttribute("aria-valuenow", "35");
shouldBe("axSlider.intValue", "35");
window.setTimeout("finishTest();", 0);
}
</script>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body" onload="runTest();">
<div role="application">
<span id="slider" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50"></span>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests the exposure of attributes for an ARIA slider.");
if (window.accessibilityController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
if (window.accessibilityController) {
accessibilityController.logAccessibilityEvents();
}
successfullyParsed = true;
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2011-03-26 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Martin Robinson.
[GTK] Expose the AtkValue interface for WAI-ARIA sliders
https://bugs.webkit.org/show_bug.cgi?id=56655
Implement AtkValue interface for WAI-ARIA sliders.
Test: platform/gtk/accessibility/aria-slider-required-attributes.html
* accessibility/gtk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::postPlatformNotification): Emit the
'property-change::accessible-value' signal when needed.
* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(core): New, returns a core object from an AtkValue.
(webkitAccessibleValueGetCurrentValue): New, implements AtkValue.
(webkitAccessibleValueGetMaximumValue): Ditto.
(webkitAccessibleValueGetMinimumValue): Ditto.
(webkitAccessibleValueSetCurrentValue): Ditto.
(webkitAccessibleValueGetMinimumIncrement): Ditto.
(atkValueInterfaceInit): Ditto.
(GetAtkInterfaceTypeFromWAIType): Add ATK_TYPE_VALUE.
(getInterfaceMaskFromObject): Set the WAI_VALUE bit for sliders.
2011-03-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dan Bernstein.
......@@ -143,6 +143,17 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AX
g_signal_emit_by_name(axObject, "state-change", "focused", true);
}
notifyChildrenSelectionChange(coreObject);
} else if (notification == AXValueChanged) {
if (!ATK_IS_VALUE(axObject))
return;
AtkPropertyValues propertyValues;
propertyValues.property_name = "accessible-value";
memset(&propertyValues.new_value, 0, sizeof(GValue));
atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value);
g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL);
}
}
......
......@@ -158,6 +158,11 @@ static AccessibilityObject* core(AtkDocument* document)
return core(ATK_OBJECT(document));
}
static AccessibilityObject* core(AtkValue* value)
{
return core(ATK_OBJECT(value));
}
static gchar* webkit_accessible_text_get_text(AtkText* text, gint startOffset, gint endOffset);
static const gchar* webkit_accessible_get_name(AtkObject* object)
......@@ -2301,6 +2306,63 @@ static void atk_document_interface_init(AtkDocumentIface* iface)
iface->get_document_locale = webkit_accessible_document_get_locale;
}
static void webkitAccessibleValueGetCurrentValue(AtkValue* value, GValue* gValue)
{
memset(gValue, 0, sizeof(GValue));
g_value_init(gValue, G_TYPE_DOUBLE);
g_value_set_double(gValue, core(value)->valueForRange());
}
static void webkitAccessibleValueGetMaximumValue(AtkValue* value, GValue* gValue)
{
memset(gValue, 0, sizeof(GValue));
g_value_init(gValue, G_TYPE_DOUBLE);
g_value_set_double(gValue, core(value)->maxValueForRange());
}
static void webkitAccessibleValueGetMinimumValue(AtkValue* value, GValue* gValue)
{
memset(gValue, 0, sizeof(GValue));
g_value_init(gValue, G_TYPE_DOUBLE);
g_value_set_double(gValue, core(value)->minValueForRange());
}
static gboolean webkitAccessibleValueSetCurrentValue(AtkValue* value, const GValue* gValue)
{
if (!G_VALUE_HOLDS_DOUBLE(gValue) && !G_VALUE_HOLDS_INT(gValue))
return FALSE;
AccessibilityObject* coreObject = core(value);
if (!coreObject->canSetValueAttribute())
return FALSE;
if (G_VALUE_HOLDS_DOUBLE(gValue))
coreObject->setValue(String::number(g_value_get_double(gValue)));
else
coreObject->setValue(String::number(g_value_get_int(gValue)));
return TRUE;
}
static void webkitAccessibleValueGetMinimumIncrement(AtkValue* value, GValue* gValue)
{
memset(gValue, 0, sizeof(GValue));
g_value_init(gValue, G_TYPE_DOUBLE);
// There's not such a thing in the WAI-ARIA specification, thus return zero.
g_value_set_double(gValue, 0.0);
}
static void atkValueInterfaceInit(AtkValueIface* iface)
{
iface->get_current_value = webkitAccessibleValueGetCurrentValue;
iface->get_maximum_value = webkitAccessibleValueGetMaximumValue;
iface->get_minimum_value = webkitAccessibleValueGetMinimumValue;
iface->set_current_value = webkitAccessibleValueSetCurrentValue;
iface->get_minimum_increment = webkitAccessibleValueGetMinimumIncrement;
}
static const GInterfaceInfo AtkInterfacesInitFunctions[] = {
{(GInterfaceInitFunc)atk_action_interface_init,
(GInterfaceFinalizeFunc) 0, 0},
......@@ -2321,6 +2383,8 @@ static const GInterfaceInfo AtkInterfacesInitFunctions[] = {
{(GInterfaceInitFunc)atkHyperlinkImplInterfaceInit,
(GInterfaceFinalizeFunc) 0, 0},
{(GInterfaceInitFunc)atk_document_interface_init,
(GInterfaceFinalizeFunc) 0, 0},
{(GInterfaceInitFunc)atkValueInterfaceInit,
(GInterfaceFinalizeFunc) 0, 0}
};
......@@ -2334,7 +2398,8 @@ enum WAIType {
WAI_TABLE,
WAI_HYPERTEXT,
WAI_HYPERLINK,
WAI_DOCUMENT
WAI_DOCUMENT,
WAI_VALUE,
};
static GType GetAtkInterfaceTypeFromWAIType(WAIType type)
......@@ -2360,6 +2425,8 @@ static GType GetAtkInterfaceTypeFromWAIType(WAIType type)
return ATK_TYPE_HYPERLINK_IMPL;
case WAI_DOCUMENT:
return ATK_TYPE_DOCUMENT;
case WAI_VALUE:
return ATK_TYPE_VALUE;
}
return G_TYPE_INVALID;
......@@ -2431,6 +2498,10 @@ static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject)
if (role == WebAreaRole)
interfaceMask |= 1 << WAI_DOCUMENT;
// Value
if (role == SliderRole)
interfaceMask |= 1 << WAI_VALUE;
return interfaceMask;
}
......
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