summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authordtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 18:04:59 +0000
committerdtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 18:04:59 +0000
commitf2c4ee3627e6039fd42bd7c0c93e902b72653449 (patch)
tree9f314a639647688d497013f76bbe929b95210523 /views/controls
parent545b13041b565fef5b289030207f5244afe76c07 (diff)
downloadchromium_src-f2c4ee3627e6039fd42bd7c0c93e902b72653449.zip
chromium_src-f2c4ee3627e6039fd42bd7c0c93e902b72653449.tar.gz
chromium_src-f2c4ee3627e6039fd42bd7c0c93e902b72653449.tar.bz2
Another take on menu's. This uses the hosting menu scroll view container as a menubar on which we can fire MENUSTART and MENUEND events. The end result is that we now have the following scenario when a user opens a menu.
1. focus lands on the menu button. 2. down arrow. 3. A "chromium" menu item appears. 4. down arrow (or enter). 5. The first menu item gets focused. The only differences from what we currently have is Jaws/NVDA no longer say "context menu opened" or "applications". The first real menuitem also doesn't get focused when the menu shows. BUG=none. TEST=use NVDA and Jaws to navigate the menu's (opening, closing, submenus, accelerators). Review URL: http://codereview.chromium.org/3155029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/menu/menu_scroll_view_container.cc2
-rw-r--r--views/controls/menu/submenu_view.cc18
-rw-r--r--views/controls/menu/submenu_view.h3
3 files changed, 19 insertions, 4 deletions
diff --git a/views/controls/menu/menu_scroll_view_container.cc b/views/controls/menu/menu_scroll_view_container.cc
index ff7ff22..afdcc16 100644
--- a/views/controls/menu/menu_scroll_view_container.cc
+++ b/views/controls/menu/menu_scroll_view_container.cc
@@ -270,7 +270,7 @@ gfx::Size MenuScrollViewContainer::GetPreferredSize() {
bool MenuScrollViewContainer::GetAccessibleRole(
AccessibilityTypes::Role* role) {
DCHECK(role);
- *role = AccessibilityTypes::ROLE_MENUPOPUP;
+ *role = AccessibilityTypes::ROLE_MENUBAR;
return true;
}
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index ba40933..a6e48d5 100644
--- a/views/controls/menu/submenu_view.cc
+++ b/views/controls/menu/submenu_view.cc
@@ -124,6 +124,11 @@ void SubmenuView::DidChangeBounds(const gfx::Rect& previous,
SchedulePaint();
}
+bool SubmenuView::GetAccessibleRole(AccessibilityTypes::Role* role) {
+ *role = AccessibilityTypes::ROLE_MENUPOPUP;
+ return true;
+}
+
void SubmenuView::PaintChildren(gfx::Canvas* canvas) {
View::PaintChildren(canvas);
@@ -229,7 +234,9 @@ void SubmenuView::ShowAt(gfx::NativeWindow parent,
host_->ShowMenuHost(do_capture);
GetScrollViewContainer()->NotifyAccessibilityEvent(
- AccessibilityTypes::EVENT_MENUPOPUPSTART);
+ AccessibilityTypes::EVENT_MENUSTART);
+
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPSTART);
return;
}
@@ -241,7 +248,9 @@ void SubmenuView::ShowAt(gfx::NativeWindow parent,
host_->Init(parent, bounds, scroll_view_container_, do_capture);
GetScrollViewContainer()->NotifyAccessibilityEvent(
- AccessibilityTypes::EVENT_MENUPOPUPSTART);
+ AccessibilityTypes::EVENT_MENUSTART);
+
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPSTART);
}
void SubmenuView::Reposition(const gfx::Rect& bounds) {
@@ -251,8 +260,10 @@ void SubmenuView::Reposition(const gfx::Rect& bounds) {
void SubmenuView::Close() {
if (host_) {
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPEND);
+
GetScrollViewContainer()->NotifyAccessibilityEvent(
- AccessibilityTypes::EVENT_MENUPOPUPEND);
+ AccessibilityTypes::EVENT_MENUEND);
host_->DestroyMenuHost();
host_ = NULL;
@@ -302,6 +313,7 @@ MenuScrollViewContainer* SubmenuView::GetScrollViewContainer() {
std::wstring accessible_name;
GetMenuItem()->GetAccessibleName(&accessible_name);
scroll_view_container_->SetAccessibleName(accessible_name);
+ SetAccessibleName(accessible_name);
}
return scroll_view_container_;
}
diff --git a/views/controls/menu/submenu_view.h b/views/controls/menu/submenu_view.h
index 85cf95bc..263f988 100644
--- a/views/controls/menu/submenu_view.h
+++ b/views/controls/menu/submenu_view.h
@@ -58,6 +58,9 @@ class SubmenuView : public View {
virtual void DidChangeBounds(const gfx::Rect& previous,
const gfx::Rect& current);
+ // Override from View.
+ virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
+
// Painting.
void PaintChildren(gfx::Canvas* canvas);