diff options
author | dtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-24 23:20:08 +0000 |
---|---|---|
committer | dtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-24 23:20:08 +0000 |
commit | 8ab402196ee4dc510e0162010789d43b96b54243 (patch) | |
tree | ee061500a2a3cacd6f6fb9419e4fb2a6f5f4e39e /views | |
parent | 01b12ba89a6117a849ac2537d58991c76f2f2da2 (diff) | |
download | chromium_src-8ab402196ee4dc510e0162010789d43b96b54243.zip chromium_src-8ab402196ee4dc510e0162010789d43b96b54243.tar.gz chromium_src-8ab402196ee4dc510e0162010789d43b96b54243.tar.bz2 |
Fix radiobuttons and connect up child widgets again.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2806030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/accessibility/accessibility_types.h | 1 | ||||
-rw-r--r-- | views/accessibility/view_accessibility.cc | 5 | ||||
-rw-r--r-- | views/controls/button/radio_button.cc | 7 | ||||
-rw-r--r-- | views/controls/button/radio_button.h | 3 | ||||
-rw-r--r-- | views/controls/native_control_win.cc | 6 |
5 files changed, 19 insertions, 3 deletions
diff --git a/views/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h index 7dd991c..79108b1 100644 --- a/views/accessibility/accessibility_types.h +++ b/views/accessibility/accessibility_types.h @@ -55,6 +55,7 @@ class AccessibilityTypes { ROLE_PANE, ROLE_PROGRESSBAR, ROLE_PUSHBUTTON, + ROLE_RADIOBUTTON, ROLE_SCROLLBAR, ROLE_SEPARATOR, ROLE_STATICTEXT, diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc index 3613d99..179c9f6 100644 --- a/views/accessibility/view_accessibility.cc +++ b/views/accessibility/view_accessibility.cc @@ -292,7 +292,8 @@ STDMETHODIMP ViewAccessibility::get_accChild(VARIANT var_child, child_view = view_->GetChildViewAt(var_child.lVal - 1); // Parents handle leaf IAccessible's. - if (child_view && child_view->GetChildViewCount() == 0) + if (child_view && child_view->GetChildViewCount() == 0 && + !child_view->child_widget()) return S_FALSE; } else { // Child is located elsewhere in this view's subtree. @@ -826,6 +827,8 @@ int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { return ROLE_SYSTEM_PROGRESSBAR; case AccessibilityTypes::ROLE_PUSHBUTTON: return ROLE_SYSTEM_PUSHBUTTON; + case AccessibilityTypes::ROLE_RADIOBUTTON: + return ROLE_SYSTEM_RADIOBUTTON; case AccessibilityTypes::ROLE_SCROLLBAR: return ROLE_SYSTEM_SCROLLBAR; case AccessibilityTypes::ROLE_SEPARATOR: diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc index 45e3da7..d7953e1 100644 --- a/views/controls/button/radio_button.cc +++ b/views/controls/button/radio_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -60,6 +60,11 @@ void RadioButton::SetChecked(bool checked) { //////////////////////////////////////////////////////////////////////////////// // RadioButton, View overrides: +bool RadioButton::GetAccessibleRole(AccessibilityTypes::Role* role) { + *role = AccessibilityTypes::ROLE_RADIOBUTTON; + return true; +} + View* RadioButton::GetSelectedViewForGroup(int group_id) { std::vector<View*> views; GetRootView()->GetViewsWithGroup(group_id, &views); diff --git a/views/controls/button/radio_button.h b/views/controls/button/radio_button.h index 3882ec2..980395f 100644 --- a/views/controls/button/radio_button.h +++ b/views/controls/button/radio_button.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -24,6 +24,7 @@ class RadioButton : public Checkbox { virtual void SetChecked(bool checked); // Overridden from View: + virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); virtual View* GetSelectedViewForGroup(int group_id); virtual bool IsGroupFocusTraversable() const; virtual void OnMouseReleased(const MouseEvent& event, bool canceled); diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc index c73d17c..217fee1 100644 --- a/views/controls/native_control_win.cc +++ b/views/controls/native_control_win.cc @@ -92,6 +92,12 @@ void NativeControlWin::VisibilityChanged(View* starting_from, bool is_visible) { void NativeControlWin::Focus() { DCHECK(native_view()); SetFocus(native_view()); + + // Since we are being wrapped by a view, accessibility should receive + // the super class as the focused view. + View* parent_view = GetParent(); + if (parent_view->HasFocus()) + parent_view->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); } //////////////////////////////////////////////////////////////////////////////// |