Title: [131908] trunk
- Revision
- 131908
- Author
- [email protected]
- Date
- 2012-10-19 09:50:59 -0700 (Fri, 19 Oct 2012)
Log Message
VO issues with hidden <legend> and last explicitly labelled element within a group <fieldset>
https://bugs.webkit.org/show_bug.cgi?id=96325
Reviewed by Beth Dakin.
Source/WebCore:
When finding a <legend> for accessibility, we need to consider those that are offscreen. This patch
modifies the original findLegend method to take a parameter to determine what should be done.
Test: accessibility/hidden-legend.html
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::titleUIElement):
* rendering/RenderFieldset.cpp:
(WebCore::RenderFieldset::findLegend):
* rendering/RenderFieldset.h:
LayoutTests:
* accessibility/hidden-legend-expected.txt: Added.
* accessibility/hidden-legend.html: Added.
* platform/chromium/TestExpectations:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (131907 => 131908)
--- trunk/LayoutTests/ChangeLog 2012-10-19 16:45:33 UTC (rev 131907)
+++ trunk/LayoutTests/ChangeLog 2012-10-19 16:50:59 UTC (rev 131908)
@@ -1,3 +1,14 @@
+2012-10-19 Chris Fleizach <[email protected]>
+
+ VO issues with hidden <legend> and last explicitly labelled element within a group <fieldset>
+ https://bugs.webkit.org/show_bug.cgi?id=96325
+
+ Reviewed by Beth Dakin.
+
+ * accessibility/hidden-legend-expected.txt: Added.
+ * accessibility/hidden-legend.html: Added.
+ * platform/chromium/TestExpectations:
+
2012-10-19 Shinya Kawanaka <[email protected]>
Should have a test case where InsertionPoint has a ShadowRoot.
Added: trunk/LayoutTests/accessibility/hidden-legend-expected.txt (0 => 131908)
--- trunk/LayoutTests/accessibility/hidden-legend-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/hidden-legend-expected.txt 2012-10-19 16:50:59 UTC (rev 131908)
@@ -0,0 +1,16 @@
+Pick your favourite colour:
+ red yellow
+Pick your favourite colour: red yellow
+ red yellow
+This tests that the legend is still used as the title UI element even when off-screen (but not when display:none is used)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fieldset1.titleUIElement().isEqual(fieldset1.childAtIndex(0)) is true
+PASS fieldset2.titleUIElement().isEqual(fieldset2.childAtIndex(0)) is true
+PASS fieldset3.titleUIElement() == null || !fieldset3.titleUIElement().isValid is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/hidden-legend.html (0 => 131908)
--- trunk/LayoutTests/accessibility/hidden-legend.html (rev 0)
+++ trunk/LayoutTests/accessibility/hidden-legend.html 2012-10-19 16:50:59 UTC (rev 131908)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""
+
+<style>
+#form2 legend {position:absolute; left:-9999px;}
+#form3 legend {display:none;}
+</style>
+
+<form action="" method="post" id="form1">
+<fieldset tabindex=0 role="group" id="fieldset1">
+<legend>Pick your favourite colour:</legend>
+<input type="radio" name="colours3" value="red3" id="red3"> <label for=""
+<input type="radio" name="colours3" value="yellow3" id="yellow3"> <label for=""
+</fieldset>
+</form>
+
+<form action="" method="post" id="form2">
+<fieldset tabindex=0 role="group" id="fieldset2">
+<legend>Pick your favourite colour:</legend>
+<input type="radio" name="colours3" value="red3" id="red3"> <label for=""
+<input type="radio" name="colours3" value="yellow3" id="yellow3"> <label for=""
+</fieldset>
+</form>
+
+<form action="" method="post" id="form3">
+<fieldset tabindex=0 role="group" id="fieldset3">
+<legend>Pick your favourite colour:</legend>
+<input type="radio" name="colours3" value="red3" id="red3"> <label for=""
+<input type="radio" name="colours3" value="yellow3" id="yellow3"> <label for=""
+</fieldset>
+</form>
+
+<div id="console"></div>
+<script>
+description("This tests that the legend is still used as the title UI element even when off-screen (but not when display:none is used)")
+
+if (window.testRunner && window.accessibilityController) {
+
+ // 1st case: testing when a fieldset uses an unmodified legend. The title UI element
+ // should be the legend (which is the first child).
+ document.getElementById('fieldset1').focus();
+ var fieldset1 = accessibilityController.focusedElement;
+ shouldBeTrue("fieldset1.titleUIElement().isEqual(fieldset1.childAtIndex(0))");
+
+ // 2nd case: a hidden legend should still be the title UI element.
+ document.getElementById('fieldset2').focus();
+ var fieldset2 = accessibilityController.focusedElement;
+ shouldBeTrue("fieldset2.titleUIElement().isEqual(fieldset2.childAtIndex(0))");
+
+ // 3rd case: a legend with display:none should not be a title UI element.
+ document.getElementById('fieldset3').focus();
+ var fieldset3 = accessibilityController.focusedElement;
+ shouldBeTrue("fieldset3.titleUIElement() == null || !fieldset3.titleUIElement().isValid");
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (131907 => 131908)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-10-19 16:45:33 UTC (rev 131907)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-10-19 16:50:59 UTC (rev 131908)
@@ -1419,6 +1419,7 @@
crbug.com/10322 accessibility/visible-elements.html [ Skip ]
webkit.org/b/97359 accessibility/svg-bounds.html [ Skip ]
+webkit.org/b/96529 accessibility/hidden-legend.html [ Skip ]
webkit.org/b/73912 accessibility/aria-checkbox-text.html [ Skip ]
webkit.org/b/99665 accessibility/loading-iframe-sends-notification.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (131907 => 131908)
--- trunk/Source/WebCore/ChangeLog 2012-10-19 16:45:33 UTC (rev 131907)
+++ trunk/Source/WebCore/ChangeLog 2012-10-19 16:50:59 UTC (rev 131908)
@@ -1,3 +1,21 @@
+2012-10-19 Chris Fleizach <[email protected]>
+
+ VO issues with hidden <legend> and last explicitly labelled element within a group <fieldset>
+ https://bugs.webkit.org/show_bug.cgi?id=96325
+
+ Reviewed by Beth Dakin.
+
+ When finding a <legend> for accessibility, we need to consider those that are offscreen. This patch
+ modifies the original findLegend method to take a parameter to determine what should be done.
+
+ Test: accessibility/hidden-legend.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::titleUIElement):
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::findLegend):
+ * rendering/RenderFieldset.h:
+
2012-10-17 Chris Fleizach <[email protected]>
AX: Refactor accessibility name computation so it's more platform independent
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (131907 => 131908)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-10-19 16:45:33 UTC (rev 131907)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-10-19 16:50:59 UTC (rev 131908)
@@ -981,7 +981,7 @@
// if isFieldset is true, the renderer is guaranteed to be a RenderFieldset
if (isFieldset())
- return axObjectCache()->getOrCreate(toRenderFieldset(m_renderer)->findLegend());
+ return axObjectCache()->getOrCreate(toRenderFieldset(m_renderer)->findLegend(RenderFieldset::IncludeFloatingOrOutOfFlow));
Node* element = m_renderer->node();
if (!element)
Modified: trunk/Source/WebCore/rendering/RenderFieldset.cpp (131907 => 131908)
--- trunk/Source/WebCore/rendering/RenderFieldset.cpp 2012-10-19 16:45:33 UTC (rev 131907)
+++ trunk/Source/WebCore/rendering/RenderFieldset.cpp 2012-10-19 16:50:59 UTC (rev 131908)
@@ -123,10 +123,13 @@
return legend;
}
-RenderBox* RenderFieldset::findLegend() const
+RenderBox* RenderFieldset::findLegend(FindLegendOption option) const
{
for (RenderObject* legend = firstChild(); legend; legend = legend->nextSibling()) {
- if (!legend->isFloatingOrOutOfFlowPositioned() && legend->node() && (legend->node()->hasTagName(legendTag)))
+ if (option == IgnoreFloatingOrOutOfFlow && legend->isFloatingOrOutOfFlowPositioned())
+ continue;
+
+ if (legend->node() && (legend->node()->hasTagName(legendTag)))
return toRenderBox(legend);
}
return 0;
Modified: trunk/Source/WebCore/rendering/RenderFieldset.h (131907 => 131908)
--- trunk/Source/WebCore/rendering/RenderFieldset.h 2012-10-19 16:45:33 UTC (rev 131907)
+++ trunk/Source/WebCore/rendering/RenderFieldset.h 2012-10-19 16:50:59 UTC (rev 131908)
@@ -32,7 +32,8 @@
public:
explicit RenderFieldset(Node*);
- RenderBox* findLegend() const;
+ enum FindLegendOption { IgnoreFloatingOrOutOfFlow, IncludeFloatingOrOutOfFlow };
+ RenderBox* findLegend(FindLegendOption = IgnoreFloatingOrOutOfFlow) const;
private:
virtual const char* renderName() const { return "RenderFieldSet"; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes