Title: [87111] trunk
Revision
87111
Author
[email protected]
Date
2011-05-23 17:31:14 -0700 (Mon, 23 May 2011)

Log Message

VO doesn't work with HTML5 range (slider) input @step attribute
https://bugs.webkit.org/show_bug.cgi?id=61298

Reviewed by David Kilzer.

Source/WebCore: 

Test: platform/mac/accessibility/range-alter-by-step.html

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::stepValueForRange):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::alterSliderValue):
(WebCore::AccessibilityRenderObject::increment):
(WebCore::AccessibilityRenderObject::decrement):
(WebCore::AccessibilityRenderObject::stepValueForRange):
(WebCore::AccessibilityRenderObject::changeValueByStep):
* accessibility/AccessibilityRenderObject.h:

LayoutTests: 

* platform/mac/accessibility/range-alter-by-step-expected.txt: Added.
* platform/mac/accessibility/range-alter-by-step.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (87110 => 87111)


--- trunk/LayoutTests/ChangeLog	2011-05-24 00:29:10 UTC (rev 87110)
+++ trunk/LayoutTests/ChangeLog	2011-05-24 00:31:14 UTC (rev 87111)
@@ -1,3 +1,13 @@
+2011-05-23  Chris Fleizach  <[email protected]>
+
+        Reviewed by David Kilzer.
+
+        VO doesn't work with HTML5 range (slider) input @step attribute
+        https://bugs.webkit.org/show_bug.cgi?id=61298
+
+        * platform/mac/accessibility/range-alter-by-step-expected.txt: Added.
+        * platform/mac/accessibility/range-alter-by-step.html: Added.
+
 2011-05-23  Ryosuke Niwa  <[email protected]>
 
         Rebaselines work better if we had the new lines at the end of each file.

Added: trunk/LayoutTests/platform/mac/accessibility/range-alter-by-step-expected.txt (0 => 87111)


--- trunk/LayoutTests/platform/mac/accessibility/range-alter-by-step-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/range-alter-by-step-expected.txt	2011-05-24 00:31:14 UTC (rev 87111)
@@ -0,0 +1,20 @@
+
+This test makes sure that if a range type has a step value, that increment and decrement work.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS obj.intValue is 25
+PASS obj.intValue is 50
+PASS obj.intValue is 75
+PASS obj.intValue is 100
+PASS obj.intValue is 100
+PASS obj.intValue is 75
+PASS obj.intValue is 50
+PASS obj.intValue is 25
+PASS obj.intValue is 0
+PASS obj.intValue is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/range-alter-by-step.html (0 => 87111)


--- trunk/LayoutTests/platform/mac/accessibility/range-alter-by-step.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/range-alter-by-step.html	2011-05-24 00:31:14 UTC (rev 87111)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<input type="range" min="0" max="100" value="25" step="25" id="range1"/>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This test makes sure that if a range type has a step value, that increment and decrement work.");
+
+    if (window.accessibilityController) {
+
+          // ARIA determinate progressbar
+          document.getElementById("range1").focus();
+          var obj = accessibilityController.focusedElement;
+          
+          shouldBe("obj.intValue", "25");
+
+          obj.increment();
+          shouldBe("obj.intValue", "50");
+
+          obj.increment();
+          shouldBe("obj.intValue", "75");
+
+          obj.increment();
+          shouldBe("obj.intValue", "100");
+
+          obj.increment();
+          shouldBe("obj.intValue", "100");
+
+          obj.decrement();
+          shouldBe("obj.intValue", "75");
+
+          obj.decrement();
+          shouldBe("obj.intValue", "50");
+
+          obj.decrement();
+          shouldBe("obj.intValue", "25");
+
+          obj.decrement();
+          shouldBe("obj.intValue", "0");
+
+          obj.decrement();
+          shouldBe("obj.intValue", "0");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (87110 => 87111)


--- trunk/Source/WebCore/ChangeLog	2011-05-24 00:29:10 UTC (rev 87110)
+++ trunk/Source/WebCore/ChangeLog	2011-05-24 00:31:14 UTC (rev 87111)
@@ -1,3 +1,22 @@
+2011-05-23  Chris Fleizach  <[email protected]>
+
+        Reviewed by David Kilzer.
+
+        VO doesn't work with HTML5 range (slider) input @step attribute
+        https://bugs.webkit.org/show_bug.cgi?id=61298
+
+        Test: platform/mac/accessibility/range-alter-by-step.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::stepValueForRange):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::alterSliderValue):
+        (WebCore::AccessibilityRenderObject::increment):
+        (WebCore::AccessibilityRenderObject::decrement):
+        (WebCore::AccessibilityRenderObject::stepValueForRange):
+        (WebCore::AccessibilityRenderObject::changeValueByStep):
+        * accessibility/AccessibilityRenderObject.h:
+
 2011-05-23  Gavin Peters  <[email protected]>
 
         Reviewed by Adam Barth.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (87110 => 87111)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2011-05-24 00:29:10 UTC (rev 87110)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2011-05-24 00:31:14 UTC (rev 87111)
@@ -354,6 +354,7 @@
     virtual float valueForRange() const { return 0.0f; }
     virtual float maxValueForRange() const { return 0.0f; }
     virtual float minValueForRange() const { return 0.0f; }
+    virtual float stepValueForRange() const { return 0.0f; }
     virtual AccessibilityObject* selectedRadioButton() { return 0; }
     virtual AccessibilityObject* selectedTabItem() { return 0; }    
     virtual int layoutCount() const { return 0; }

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (87110 => 87111)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-05-24 00:29:10 UTC (rev 87110)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-05-24 00:31:14 UTC (rev 87111)
@@ -879,20 +879,25 @@
     return 0;
 }
 
-void AccessibilityRenderObject::increment()
+void AccessibilityRenderObject::alterSliderValue(bool increase)
 {
     if (roleValue() != SliderRole)
         return;
+
+    if (!getAttribute(stepAttr).isEmpty())
+        changeValueByStep(increase);
+    else
+        changeValueByPercent(increase ? 5 : -5);
+}
     
-    changeValueByPercent(5);
+void AccessibilityRenderObject::increment()
+{
+    alterSliderValue(true);
 }
 
 void AccessibilityRenderObject::decrement()
 {
-    if (roleValue() != SliderRole)
-        return;
-    
-    changeValueByPercent(-5);
+    alterSliderValue(false);
 }
 
 static Element* siblingWithAriaRole(String role, Node* node)
@@ -1080,6 +1085,11 @@
     return getAttribute(aria_valuetextAttr).string();
 }
     
+float AccessibilityRenderObject::stepValueForRange() const
+{
+    return getAttribute(stepAttr).toFloat();
+}
+    
 float AccessibilityRenderObject::valueForRange() const
 {
     if (!isProgressIndicator() && !isSlider() && !isScrollbar())
@@ -2206,6 +2216,18 @@
     }
 }
 
+void AccessibilityRenderObject::changeValueByStep(bool increase)
+{
+    float step = stepValueForRange();
+    float value = valueForRange();
+    
+    value += increase ? step : -step;
+
+    setValue(String::number(value));
+    
+    axObjectCache()->postNotification(m_renderer, AXObjectCache::AXValueChanged, true);
+}
+    
 void AccessibilityRenderObject::changeValueByPercent(float percentChange)
 {
     float range = maxValueForRange() - minValueForRange();

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (87110 => 87111)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2011-05-24 00:29:10 UTC (rev 87110)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2011-05-24 00:31:14 UTC (rev 87111)
@@ -119,6 +119,7 @@
     virtual float valueForRange() const;
     virtual float maxValueForRange() const;
     virtual float minValueForRange() const;
+    virtual float stepValueForRange() const;
     virtual AccessibilityObject* selectedRadioButton();
     virtual AccessibilityObject* selectedTabItem();
     virtual int layoutCount() const;
@@ -279,6 +280,8 @@
     AccessibilityRole determineAriaRoleAttribute() const;
 
     bool isTabItemSelected() const;
+    void alterSliderValue(bool increase);
+    void changeValueByStep(bool increase);
     bool isNativeCheckboxOrRadio() const;
     IntRect checkboxOrRadioRect() const;
     void addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to