[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
cfleizach at apple.com
cfleizach at apple.com
Wed Mar 17 18:10:11 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit cc371c691065a4e5b07d68ee3ece215f5c8b13c8
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Mar 2 21:15:46 2010 +0000
aria-label isn't respected on option elements
https://bugs.webkit.org/show_bug.cgi?id=35400
Reviewed by Beth Dakin.
WebCore:
When aria-label is used on an <option> element, it can take three forms.
An option in a multi-select list, a popup button and the menu that is displayed
from the popup button. This patches the three requisite locations so that if
aria-label is used, the correct accessibility text is returned.
Test: platform/mac/accessibility/option-with-arialabel.html
* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::stringValue):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::getAttribute):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::getAttribute):
(WebCore::AccessibilityRenderObject::stringValue):
* platform/PopupMenuClient.h:
* platform/mac/PopupMenuMac.mm:
(WebCore::PopupMenu::populate):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::itemAccessibilityText):
* rendering/RenderMenuList.h:
* rendering/RenderTextControlSingleLine.h:
(WebCore::RenderTextControlSingleLine::itemAccessibilityText):
WebKit/chromium:
* src/SuggestionsPopupMenuClient.h:
(WebKit::SuggestionsPopupMenuClient::itemAccessibilityText):
LayoutTests:
* platform/mac/accessibility/option-with-arialabel-expected.txt: Added.
* platform/mac/accessibility/option-with-arialabel.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55425 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8a81a54..880c3fd 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-02 Chris Fleizach <cfleizach at apple.com>
+
+ Reviewed by Beth Dakin.
+
+ aria-label isn't respected on option elements
+ https://bugs.webkit.org/show_bug.cgi?id=35400
+
+ * platform/mac/accessibility/option-with-arialabel-expected.txt: Added.
+ * platform/mac/accessibility/option-with-arialabel.html: Added.
+
2010-03-02 Kent Tamura <tkent at chromium.org>
Reviewed by Shinichiro Hamaji.
diff --git a/LayoutTests/platform/mac/accessibility/option-with-arialabel-expected.txt b/LayoutTests/platform/mac/accessibility/option-with-arialabel-expected.txt
new file mode 100644
index 0000000..245e6be
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/option-with-arialabel-expected.txt
@@ -0,0 +1,13 @@
+
+This tests that aria-label can be set on options.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS popup.stringValue is 'AXValue: Fahrenheit'
+PASS selectbox.childAtIndex(0).stringValue is 'AXValue: Fahrenheit'
+PASS selectbox.childAtIndex(1).stringValue is 'AXValue: Celsius'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/option-with-arialabel.html b/LayoutTests/platform/mac/accessibility/option-with-arialabel.html
new file mode 100644
index 0000000..dbff720
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/option-with-arialabel.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<select id="deg1" tabindex=0>
+ <option aria-label="Fahrenheit">F</option>
+ <option aria-label="Celsius">C</option>
+</select>
+
+<select id="deg2" tabindex=0 multiple>
+ <option aria-label="Fahrenheit">F</option>
+ <option aria-label="Celsius">C</option>
+</select>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that aria-label can be set on options.");
+
+ if (window.accessibilityController) {
+
+ // Test the value of the popup.
+ document.getElementById("deg1").focus();
+ var popup = accessibilityController.focusedElement;
+ shouldBe("popup.stringValue", "'AXValue: Fahrenheit'");
+
+ // Test the values in a multi-select list box.
+ document.getElementById("deg2").focus();
+ var selectbox = accessibilityController.focusedElement;
+ shouldBe("selectbox.childAtIndex(0).stringValue", "'AXValue: Fahrenheit'");
+ shouldBe("selectbox.childAtIndex(1).stringValue", "'AXValue: Celsius'");
+ }
+
+ successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5028cd1..9bbcae3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2010-03-02 Chris Fleizach <cfleizach at apple.com>
+
+ Reviewed by Beth Dakin.
+
+ aria-label isn't respected on option elements
+ https://bugs.webkit.org/show_bug.cgi?id=35400
+
+ When aria-label is used on an <option> element, it can take three forms.
+ An option in a multi-select list, a popup button and the menu that is displayed
+ from the popup button. This patches the three requisite locations so that if
+ aria-label is used, the correct accessibility text is returned.
+
+ Test: platform/mac/accessibility/option-with-arialabel.html
+
+ * accessibility/AccessibilityListBoxOption.cpp:
+ (WebCore::AccessibilityListBoxOption::stringValue):
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::getAttribute):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::getAttribute):
+ (WebCore::AccessibilityRenderObject::stringValue):
+ * platform/PopupMenuClient.h:
+ * platform/mac/PopupMenuMac.mm:
+ (WebCore::PopupMenu::populate):
+ * rendering/RenderMenuList.cpp:
+ (WebCore::RenderMenuList::itemAccessibilityText):
+ * rendering/RenderMenuList.h:
+ * rendering/RenderTextControlSingleLine.h:
+ (WebCore::RenderTextControlSingleLine::itemAccessibilityText):
+
2010-03-02 Mads Ager <ager at chromium.org>
Reviewed by Adam Barth.
@@ -1345,7 +1376,6 @@
* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/CodeGeneratorJS.pm:
->>>>>>> .r55317
2010-02-26 Alex Milowski <alex at milowski.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/accessibility/AccessibilityListBoxOption.cpp b/WebCore/accessibility/AccessibilityListBoxOption.cpp
index 6a77dac..9bf5a4d 100644
--- a/WebCore/accessibility/AccessibilityListBoxOption.cpp
+++ b/WebCore/accessibility/AccessibilityListBoxOption.cpp
@@ -128,6 +128,10 @@ String AccessibilityListBoxOption::stringValue() const
if (!m_optionElement)
return String();
+ const AtomicString& ariaLabel = getAttribute(m_optionElement, aria_labelAttr);
+ if (!ariaLabel.isNull())
+ return ariaLabel;
+
if (m_optionElement->hasTagName(optionTag))
return static_cast<HTMLOptionElement*>(m_optionElement)->text();
diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp
index 70750da..85538da 100644
--- a/WebCore/accessibility/AccessibilityObject.cpp
+++ b/WebCore/accessibility/AccessibilityObject.cpp
@@ -835,6 +835,18 @@ const String& AccessibilityObject::actionVerb() const
}
}
+const AtomicString& AccessibilityObject::getAttribute(Node* node, const QualifiedName& attribute)
+{
+ if (!node)
+ return nullAtom;
+
+ if (!node->isElementNode())
+ return nullAtom;
+
+ Element* element = static_cast<Element*>(node);
+ return element->getAttribute(attribute);
+}
+
// Lacking concrete evidence of orientation, horizontal means width > height. vertical is height > width;
AccessibilityOrientation AccessibilityObject::orientation() const
{
diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h
index e4b1d99..231b711 100644
--- a/WebCore/accessibility/AccessibilityObject.h
+++ b/WebCore/accessibility/AccessibilityObject.h
@@ -446,7 +446,8 @@ public:
virtual void handleActiveDescendantChanged() { }
static AccessibilityRole ariaRoleToWebCoreRole(const String&);
-
+ static const AtomicString& getAttribute(Node*, const QualifiedName&);
+
virtual VisiblePositionRange visiblePositionRange() const { return VisiblePositionRange(); }
virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const { return VisiblePositionRange(); }
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index aaa28ae..613aaab 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -69,6 +69,7 @@
#include "RenderTheme.h"
#include "RenderView.h"
#include "RenderWidget.h"
+#include "SelectElement.h"
#include "SelectionController.h"
#include "Text.h"
#include "TextIterator.h"
@@ -547,15 +548,7 @@ AccessibilityObject* AccessibilityRenderObject::selectedTabItem()
const AtomicString& AccessibilityRenderObject::getAttribute(const QualifiedName& attribute) const
{
- Node* node = m_renderer->node();
- if (!node)
- return nullAtom;
-
- if (!node->isElementNode())
- return nullAtom;
-
- Element* element = static_cast<Element*>(node);
- return element->getAttribute(attribute);
+ return AccessibilityObject::getAttribute(m_renderer->node(), attribute);
}
Element* AccessibilityRenderObject::anchorElement() const
@@ -898,8 +891,17 @@ String AccessibilityRenderObject::stringValue() const
if (m_renderer->isText())
return textUnderElement();
- if (m_renderer->isMenuList())
+ if (m_renderer->isMenuList()) {
+ // RenderMenuList will go straight to the text() of its selected item.
+ // This has to be overriden in the case where the selected item has an aria label
+ SelectElement* selectNode = toSelectElement(static_cast<Element*>(m_renderer->node()));
+ Element* selectedOption = selectNode->listItems()[selectNode->selectedIndex()];
+ String overridenDescription = AccessibilityObject::getAttribute(selectedOption, aria_labelAttr);
+ if (!overridenDescription.isNull())
+ return overridenDescription;
+
return toRenderMenuList(m_renderer)->text();
+ }
if (m_renderer->isListMarker())
return toRenderListMarker(m_renderer)->text();
diff --git a/WebCore/platform/PopupMenuClient.h b/WebCore/platform/PopupMenuClient.h
index 2614fe2..69fdb89 100644
--- a/WebCore/platform/PopupMenuClient.h
+++ b/WebCore/platform/PopupMenuClient.h
@@ -40,6 +40,7 @@ public:
virtual String itemText(unsigned listIndex) const = 0;
virtual String itemToolTip(unsigned listIndex) const = 0;
+ virtual String itemAccessibilityText(unsigned listIndex) const = 0;
virtual bool itemIsEnabled(unsigned listIndex) const = 0;
virtual PopupMenuStyle itemStyle(unsigned listIndex) const = 0;
virtual PopupMenuStyle menuStyle() const = 0;
diff --git a/WebCore/platform/mac/PopupMenuMac.mm b/WebCore/platform/mac/PopupMenuMac.mm
index 22f1e5b..0ecaa13 100644
--- a/WebCore/platform/mac/PopupMenuMac.mm
+++ b/WebCore/platform/mac/PopupMenuMac.mm
@@ -20,6 +20,7 @@
#import "config.h"
#import "PopupMenu.h"
+#import "AXObjectCache.h"
#import "Chrome.h"
#import "ChromeClient.h"
#import "EventHandler.h"
@@ -100,6 +101,13 @@ void PopupMenu::populate()
[menuItem setEnabled:client()->itemIsEnabled(i)];
[menuItem setToolTip:client()->itemToolTip(i)];
[string release];
+
+ // Allow the accessible text of the item to be overriden if necessary.
+ if (AXObjectCache::accessibilityEnabled()) {
+ NSString *accessibilityOverride = client()->itemAccessibilityText(i);
+ if ([accessibilityOverride length])
+ [menuItem accessibilitySetOverrideValue:accessibilityOverride forAttribute:NSAccessibilityDescriptionAttribute];
+ }
}
}
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index 05a9873..5adcb9a 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -25,6 +25,7 @@
#include "RenderMenuList.h"
#include "AXObjectCache.h"
+#include "AccessibilityObject.h"
#include "CSSStyleSelector.h"
#include "Frame.h"
#include "FrameView.h"
@@ -334,6 +335,17 @@ String RenderMenuList::itemText(unsigned listIndex) const
return String();
}
+String RenderMenuList::itemAccessibilityText(unsigned listIndex) const
+{
+ // Allow the accessible name be changed if necessary.
+ SelectElement* select = toSelectElement(static_cast<Element*>(node()));
+ const Vector<Element*>& listItems = select->listItems();
+ if (listIndex >= listItems.size())
+ return String();
+
+ return AccessibilityObject::getAttribute(listItems[listIndex], aria_labelAttr);
+}
+
String RenderMenuList::itemToolTip(unsigned listIndex) const
{
SelectElement* select = toSelectElement(static_cast<Element*>(node()));
diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h
index a5aa041..f3c1b55 100644
--- a/WebCore/rendering/RenderMenuList.h
+++ b/WebCore/rendering/RenderMenuList.h
@@ -75,6 +75,7 @@ private:
// PopupMenuClient methods
virtual String itemText(unsigned listIndex) const;
virtual String itemToolTip(unsigned listIndex) const;
+ virtual String itemAccessibilityText(unsigned listIndex) const;
virtual bool itemIsEnabled(unsigned listIndex) const;
virtual PopupMenuStyle itemStyle(unsigned listIndex) const;
virtual PopupMenuStyle menuStyle() const;
diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h
index aa1f1e3..e1bcc84 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.h
+++ b/WebCore/rendering/RenderTextControlSingleLine.h
@@ -101,6 +101,7 @@ private:
virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
virtual String itemText(unsigned listIndex) const;
virtual String itemToolTip(unsigned) const { return String(); }
+ virtual String itemAccessibilityText(unsigned) const { return String(); }
virtual bool itemIsEnabled(unsigned listIndex) const;
virtual PopupMenuStyle itemStyle(unsigned listIndex) const;
virtual PopupMenuStyle menuStyle() const;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 61cb009..3e69e87 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-02 Chris Fleizach <cfleizach at apple.com>
+
+ Reviewed by Beth Dakin.
+
+ aria-label isn't respected on option elements
+ https://bugs.webkit.org/show_bug.cgi?id=35400
+
+ * src/SuggestionsPopupMenuClient.h:
+ (WebKit::SuggestionsPopupMenuClient::itemAccessibilityText):
+
2010-03-02 Mads Ager <ager at chromium.org>
Reviewed by Adam Barth.
diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.h b/WebKit/chromium/src/SuggestionsPopupMenuClient.h
index edc4c09..77b3890 100644
--- a/WebKit/chromium/src/SuggestionsPopupMenuClient.h
+++ b/WebKit/chromium/src/SuggestionsPopupMenuClient.h
@@ -63,6 +63,7 @@ public:
virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
virtual WebCore::String itemText(unsigned listIndex) const;
virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); }
+ virtual WebCore::String itemAccessibilityText(unsigned lastIndex) const { return WebCore::String(); }
virtual bool itemIsEnabled(unsigned listIndex) const { return true; }
virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const;
virtual WebCore::PopupMenuStyle menuStyle() const;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list