2011-04-11 Mario Sanchez Prada <msanchez@igalia.com>
authormario@webkit.org <mario@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 19:44:10 +0000 (19:44 +0000)
committermario@webkit.org <mario@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 19:44:10 +0000 (19:44 +0000)
        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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83479 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/gtk/accessibility/input-slider-expected.txt [new file with mode: 0644]
LayoutTests/platform/gtk/accessibility/input-slider.html [new file with mode: 0644]
LayoutTests/platform/gtk/accessibility/media-element-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/input-slider.html [moved from LayoutTests/accessibility/input-slider.html with 100% similarity]
LayoutTests/platform/win/Skipped
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilitySlider.cpp
Source/WebCore/accessibility/AccessibilitySlider.h
Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp

index 43d68ea..51ef8a3 100644 (file)
@@ -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.
index 04729c1..848a4e0 100644 (file)
@@ -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
diff --git a/LayoutTests/platform/gtk/accessibility/input-slider-expected.txt b/LayoutTests/platform/gtk/accessibility/input-slider-expected.txt
new file mode 100644 (file)
index 0000000..ffc494e
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/platform/gtk/accessibility/input-slider.html b/LayoutTests/platform/gtk/accessibility/input-slider.html
new file mode 100644 (file)
index 0000000..38e8d37
--- /dev/null
@@ -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>
diff --git a/LayoutTests/platform/gtk/accessibility/media-element-expected.txt b/LayoutTests/platform/gtk/accessibility/media-element-expected.txt
new file mode 100644 (file)
index 0000000..fd5e589
--- /dev/null
@@ -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
+
+
+
index 8bf2b71..fd83f42 100644 (file)
@@ -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
index a4c87f2..777d55c 100644 (file)
@@ -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.
index d4433a2..01d185d 100644 (file)
@@ -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
index 406c3ab..80a988b 100644 (file)
@@ -80,9 +80,10 @@ public:
     virtual IntSize size() const;
     virtual IntRect elementRect() const;
 
+    virtual bool accessibilityIsIgnored() const;
+
 private:
     AccessibilitySliderThumb();
-    virtual bool accessibilityIsIgnored() const { return false; }
 
     AccessibilitySlider* m_parentSlider;
 };
index 850bcbe..a9fd54b 100644 (file)
@@ -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;