Skip to content
Permalink
Browse files
2011-04-11 Mario Sanchez Prada <msanchez@igalia.com>
        Reviewed by Chris Fleizach.

        [GTK] Unskip accessibility/input-slider.html and accessibility/media-element.html
        https://bugs.webkit.org/show_bug.cgi?id=58040

        Unskip passing tests and update expectations.

        * platform/gtk/Skipped: Unskip passing tests.
        * platform/gtk/accessibility/input-slider-expected.txt: Added.
        * platform/gtk/accessibility/input-slider.html: Copied from
        accessibility/input-slider.html and adjusted accordingly.
        * platform/gtk/accessibility/media-element-expected.txt: Added.
        * platform/mac/accessibility/input-slider.html: Moved from
        accessibility/input-slider.html, since it is platform-specific.
        * platform/win/Skipped: Unskipped accessibility/input-slider.html,
        as it's no longer a cross-platform test.
2011-04-11  Mario Sanchez Prada  <msanchez@igalia.com>

        Reviewed by Chris Fleizach.

        [GTK] Unskip accessibility/input-slider.html and accessibility/media-element.html
        https://bugs.webkit.org/show_bug.cgi?id=58040

        Don't expose objects of role SliderThumbRoles in GTK.

        * accessibility/AccessibilitySlider.cpp:
        (WebCore::AccessibilitySlider::addChildren): Allow the platform
        make a final decision before including children in the hierarchy.
        (WebCore::AccessibilitySliderThumb::accessibilityIsIgnored):
        Implemented by relying on accessibilityPlatformIncludesObject().

        * accessibility/gtk/AccessibilityObjectAtk.cpp:
        (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
        Ignore accessibility objects with role SliderThumbRole.

Canonical link: https://commits.webkit.org/73247@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mariospr committed Apr 11, 2011
1 parent fcd2442 commit 14ae2a0bcf90a322d2cb61cf565efd7b84f04392
Showing 11 changed files with 291 additions and 9 deletions.
@@ -1,3 +1,22 @@
2011-04-11 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Chris Fleizach.

[GTK] Unskip accessibility/input-slider.html and accessibility/media-element.html
https://bugs.webkit.org/show_bug.cgi?id=58040

Unskip passing tests and update expectations.

* platform/gtk/Skipped: Unskip passing tests.
* platform/gtk/accessibility/input-slider-expected.txt: Added.
* platform/gtk/accessibility/input-slider.html: Copied from
accessibility/input-slider.html and adjusted accordingly.
* platform/gtk/accessibility/media-element-expected.txt: Added.
* platform/mac/accessibility/input-slider.html: Moved from
accessibility/input-slider.html, since it is platform-specific.
* platform/win/Skipped: Unskipped accessibility/input-slider.html,
as it's no longer a cross-platform test.

2011-04-11 Dirk Pranke <dpranke@chromium.org>

Unreviewed, expectations change.
@@ -340,13 +340,11 @@ accessibility/image-link.html
accessibility/image-map1.html
accessibility/image-map2.html
accessibility/inline-continuations.html
accessibility/input-slider.html
accessibility/internal-link-anchors2.html
accessibility/label-for-control-hittest.html
accessibility/language-attribute.html
accessibility/legend.html
accessibility/lists.html
accessibility/media-element.html
accessibility/onclick-handlers.html
accessibility/placeholder.html
accessibility/plugin.html
@@ -0,0 +1,40 @@
825



** Test slider accessibility attributes
RUN(sliderAXObject = accessibilityController.focusedElement)
EXPECTED (sliderAXObject.minValue == '0') OK
EXPECTED (sliderAXObject.maxValue == '100') OK
EXPECTED (sliderAXObject.childrenCount == '0') OK
EXPECTED (sliderAXObject.role == 'AXRole: slider') OK

** Increment the slider, test slider value and div set on 'update' event
RUN(sliderAXObject.increment())
EXPECTED (sliderInput.value == '55') OK
EXPECTED (valueDiv.innerText == '55') OK

** Decrement the slider, test slider value and div set on 'update' event
RUN(sliderInput.value = 22)
RUN(sliderAXObject.decrement())
EXPECTED (sliderInput.value == '17') OK
EXPECTED (valueDiv.innerText == '17') OK

** Change slider range
RUN(sliderInput.setAttribute('max', 1000))
RUN(sliderInput.setAttribute('min', 500))
EXPECTED (sliderAXObject.minValue == '500') OK
EXPECTED (sliderAXObject.maxValue == '1000') OK

** Re-test incrementing the slider
RUN(sliderInput.value = 600)
RUN(sliderAXObject.increment())
EXPECTED (sliderInput.value == '625') OK
EXPECTED (valueDiv.innerText == '625') OK

** Re-test decrementing the slider
RUN(sliderInput.value = 850)
RUN(sliderAXObject.decrement())
EXPECTED (sliderInput.value == '825') OK
EXPECTED (valueDiv.innerText == '825') OK

@@ -0,0 +1,145 @@
<html>
<head>
<script>
var sliderAXObject;
var thumbAXObject;
var valueDiv;

if (window.layoutTestController)
{
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}

function consoleWrite(text)
{
document.getElementById("console").innerHTML += text + "<br>";
}

function logResult(success, text)
{
if (success)
consoleWrite(text + " <span style='color:green'>OK<" + "/span>");
else
consoleWrite(text + " <span style='color:red'>FAIL<" + "/span>");
}

function testExpected(testFuncString, expected)
{
try {
var observed = eval(testFuncString);
} catch (ex) {
consoleWrite(ex);
return;
}

var success = (observed == expected);
var msg = msg = "EXPECTED (<em>" + testFuncString + " </em> == '<em>" + expected + "</em>')";
if (!success)
msg += ", OBSERVED '<em>" + observed + "</em>'";
logResult(success, msg);
}

function run(testFuncString)
{
consoleWrite("RUN(" + testFuncString + ")");
try {
eval(testFuncString);
} catch (ex) {
consoleWrite(ex);
}
}

function testRanges(min, max)
{
testExpected("sliderAXObject.minValue", min);
testExpected("sliderAXObject.maxValue", max);
}

function testValues(oldValue, direction)
{
// increment and decrement change by 5% of the slider's range
var range = sliderInput.getAttribute('max') - sliderInput.getAttribute('min');
var expected = direction * range * 0.05 + (oldValue * 1);
testExpected("sliderInput.value", expected);
testExpected("valueDiv.innerText", expected);
}

function testIncrement()
{
var oldValue = sliderInput.value;
run("sliderAXObject.increment()");
testValues(oldValue, 1)
}

function testDecrement()
{
var oldValue = sliderInput.value;
run("sliderAXObject.decrement()");
testValues(oldValue, -1)
}

function test()
{
if (!window.accessibilityController)
return;

var oldValue;
var newValue;

valueDiv = document.getElementById("val");
sliderInput = document.getElementById("slider");

sliderInput.focus();

consoleWrite("** Test slider accessibility attributes");
run("sliderAXObject = accessibilityController.focusedElement");
testRanges(0, 100);
testExpected("sliderAXObject.childrenCount", 0);
testExpected("sliderAXObject.role", "AXRole: slider");

consoleWrite("");
consoleWrite("** Increment the slider, test slider value and div set on 'update' event");
testIncrement();

consoleWrite("");
consoleWrite("** Decrement the slider, test slider value and div set on 'update' event");
run("sliderInput.value = 22");
testDecrement();

consoleWrite("");
consoleWrite("** Change slider range");
run("sliderInput.setAttribute('max', 1000)");
run("sliderInput.setAttribute('min', 500)");
testRanges(500, 1000);

consoleWrite("");
consoleWrite("** Re-test incrementing the slider");
run("sliderInput.value = 600");
testIncrement();

consoleWrite("");
consoleWrite("** Re-test decrementing the slider");
run("sliderInput.value = 850");
testDecrement();

layoutTestController.notifyDone();
}

function update(obj)
{
document.getElementById('val').innerText = obj.value;
}
</script>
</head>

<body onload="test()">

<input type=range min=0 max=100 value=50 id=slider onchange="update(this)" >
<span id=val>50</span>

<br><br><br><br>
<div id=console></div>

</body>
</html>
@@ -0,0 +1,39 @@
Dump <video> element controller accessibility object tree at 'canplaythrough' event.

+++++++++++++++++++++++++++++++++++

State at 'canplaythrough' event:

description: AXDescription: video element controller
role: AXRole: tool bar


description: AXDescription: play
role: AXRole: push button


description: AXDescription:
role: AXRole: panel


description: AXDescription:
role: AXRole: slider


description: AXDescription: fast reverse
role: AXRole: push button


description: AXDescription: fast forward
role: AXRole: push button


description: AXDescription: fullscreen
role: AXRole: push button


description: AXDescription: mute
role: AXRole: push button



File renamed without changes.
@@ -526,7 +526,6 @@ accessibility/image-map1.html
accessibility/image-map2.html
accessibility/img-aria-button-alt-tag.html
accessibility/input-image-alt.html
accessibility/input-slider.html
accessibility/internal-link-anchors2.html
accessibility/label-for-control-hittest.html
accessibility/language-attribute.html
@@ -1,3 +1,22 @@
2011-04-11 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Chris Fleizach.

[GTK] Unskip accessibility/input-slider.html and accessibility/media-element.html
https://bugs.webkit.org/show_bug.cgi?id=58040

Don't expose objects of role SliderThumbRoles in GTK.

* accessibility/AccessibilitySlider.cpp:
(WebCore::AccessibilitySlider::addChildren): Allow the platform
make a final decision before including children in the hierarchy.
(WebCore::AccessibilitySliderThumb::accessibilityIsIgnored):
Implemented by relying on accessibilityPlatformIncludesObject().

* accessibility/gtk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
Ignore accessibility objects with role SliderThumbRole.

2011-04-11 Simon Fraser <simon.fraser@apple.com>

Reviewed by Dan Bernstein.
@@ -89,9 +89,17 @@ void AccessibilitySlider::addChildren()

m_haveChildren = true;

AccessibilitySliderThumb* thumb = static_cast<AccessibilitySliderThumb*>(m_renderer->document()->axObjectCache()->getOrCreate(SliderThumbRole));
AXObjectCache* cache = m_renderer->document()->axObjectCache();

AccessibilitySliderThumb* thumb = static_cast<AccessibilitySliderThumb*>(cache->getOrCreate(SliderThumbRole));
thumb->setParentObject(this);
m_children.append(thumb);

// Before actually adding the value indicator to the hierarchy,
// allow the platform to make a final decision about it.
if (thumb->accessibilityIsIgnored())
cache->remove(thumb->axObjectID());
else
m_children.append(thumb);
}

const AtomicString& AccessibilitySlider::getAttribute(const QualifiedName& attribute) const
@@ -181,4 +189,15 @@ IntSize AccessibilitySliderThumb::size() const
return elementRect().size();
}

bool AccessibilitySliderThumb::accessibilityIsIgnored() const
{
AccessibilityObjectInclusion decision = accessibilityPlatformIncludesObject();
if (decision == IncludeObject)
return false;
if (decision == IgnoreObject)
return true;

return false;
}

} // namespace WebCore
@@ -80,9 +80,10 @@ class AccessibilitySliderThumb : public AccessibilityObject {
virtual IntSize size() const;
virtual IntRect elementRect() const;

virtual bool accessibilityIsIgnored() const;

private:
AccessibilitySliderThumb();
virtual bool accessibilityIsIgnored() const { return false; }

AccessibilitySlider* m_parentSlider;
};
@@ -40,9 +40,14 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO
if (!parent)
return DefaultBehavior;

if (roleValue() == SplitterRole)
AccessibilityRole role = roleValue();
if (role == SplitterRole)
return IncludeObject;

// We expose the slider as a whole but not its value indicator.
if (role == SliderThumbRole)
return IgnoreObject;

// When a list item is made up entirely of children (e.g. paragraphs)
// the list item gets ignored. We need it.
if (isGroup() && parent->isList())
@@ -52,8 +57,6 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO
if (parent->isPasswordField() || parent->isTextControl())
return IgnoreObject;

AccessibilityRole role = roleValue();

// Include all tables, even layout tables. The AT can decide what to do with each.
if (role == CellRole || role == TableRole)
return IncludeObject;

0 comments on commit 14ae2a0

Please sign in to comment.