AX: Can't always increment web sliders.

https://bugs.webkit.org/show_bug.cgi?id=127451

Reviewed by Chris Fleizach.

Source/WebCore:

Clamping the decrement/increment amount to one when necessary (if a percent change would result in a change of less than one).

Test: accessibility/range-alter-by-percent.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::changeValueByPercent):

LayoutTests:

Adding range-alter-by-percent.html to compliment the existing range-alter-by-step.html test.

* accessibility/range-alter-by-percent-expected.txt: Added.
* accessibility/range-alter-by-percent.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3c1693c7
2014-01-22 Samuel White <samuel_white@apple.com>
AX: Can't always increment web sliders.
https://bugs.webkit.org/show_bug.cgi?id=127451
Reviewed by Chris Fleizach.
Adding range-alter-by-percent.html to compliment the existing range-alter-by-step.html test.
* accessibility/range-alter-by-percent-expected.txt: Added.
* accessibility/range-alter-by-percent.html: Added.
2014-01-22 Chris Fleizach <cfleizach@apple.com>
AX: WebKit concatenates name of all toolbar buttons in the apple.com video player
This tests that decrement and increment alter a range type input element by five percent or one (whichever is larger) when no step is specified.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS largeRange.intValue is 50
PASS largeRange.intValue is 55
PASS largeRange.intValue is 60
PASS largeRange.intValue is 55
PASS largeRange.intValue is 50
PASS smallRange.intValue is 5
PASS smallRange.intValue is 6
PASS smallRange.intValue is 7
PASS smallRange.intValue is 6
PASS smallRange.intValue is 5
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<title>Range Alter by Percent</title>
</head>
<body>
<!-- Range type input elements are altered by five percent if they have no step specified. -->
<!-- Implicit step size of five when decrement/increment is called. -->
<input id="largeRange" max="100" min="0" type="range" value="50">
<!-- Implicit step size of one when decrement/increment is called (because five percent would give us less than one). -->
<input id="smallRange" max="10" min="0" type="range" value="5">
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that decrement and increment alter a range type input element by five percent or one (whichever is larger) when no step is specified.");
if (window.accessibilityController) {
// Large range.
var largeRange = accessibilityController.accessibleElementById("largeRange");
shouldBe("largeRange.intValue", "50");
largeRange.increment();
shouldBe("largeRange.intValue", "55");
largeRange.increment();
shouldBe("largeRange.intValue", "60");
largeRange.decrement();
shouldBe("largeRange.intValue", "55");
largeRange.decrement();
shouldBe("largeRange.intValue", "50");
// Small range.
var smallRange = accessibilityController.accessibleElementById("smallRange");
shouldBe("smallRange.intValue", "5");
smallRange.increment();
shouldBe("smallRange.intValue", "6");
smallRange.increment();
shouldBe("smallRange.intValue", "7");
smallRange.decrement();
shouldBe("smallRange.intValue", "6");
smallRange.decrement();
shouldBe("smallRange.intValue", "5");
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
2014-01-22 Samuel White <samuel_white@apple.com>
AX: Can't always increment web sliders.
https://bugs.webkit.org/show_bug.cgi?id=127451
Reviewed by Chris Fleizach.
Clamping the decrement/increment amount to one when necessary (if a percent change would result in a change of less than one).
Test: accessibility/range-alter-by-percent.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::changeValueByPercent):
2014-01-22 Myles C. Maxfield <mmaxfield@apple.com>
Remove CSS3_TEXT_DECORATION define
......@@ -1096,9 +1096,14 @@ void AccessibilityNodeObject::changeValueByStep(bool increase)
void AccessibilityNodeObject::changeValueByPercent(float percentChange)
{
float range = maxValueForRange() - minValueForRange();
float step = range * (percentChange / 100);
float value = valueForRange();
value += range * (percentChange / 100);
// Make sure the specified percent will cause a change of one integer step or larger.
if (fabs(step) < 1)
step = fabs(percentChange) * (1 / percentChange);
value += step;
setValue(String::number(value));
axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged);
......
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