Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1624)

Unified Diff: chrome/browser/views/toolbar_view.cc

Issue 15098: Enables restoring of keyboard focus to the the toolbar button that last had f... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/toolbar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/toolbar_view.cc
===================================================================
--- chrome/browser/views/toolbar_view.cc (revision 7334)
+++ chrome/browser/views/toolbar_view.cc (working copy)
@@ -343,28 +343,35 @@
}
void BrowserToolbarView::DidGainFocus() {
- // Find first accessible child (-1 for start search at parent).
- int first_acc_child = GetNextAccessibleViewIndex(-1, false);
+ // Check to see if MSAA focus should be restored to previously focused button,
+ // and if button is an enabled, visibled child of toolbar.
+ if (!acc_focused_view() ||
+ (acc_focused_view()->GetParent()->GetID() != VIEW_ID_TOOLBAR) ||
+ !acc_focused_view()->IsEnabled() ||
+ !acc_focused_view()->IsVisible()) {
+ // Find first accessible child (-1 to start search at parent).
+ int first_acc_child = GetNextAccessibleViewIndex(-1, false);
- // No buttons enabled or visible.
- if (first_acc_child == -1)
- return;
+ // No buttons enabled or visible.
+ if (first_acc_child == -1)
+ return;
- acc_focused_view_ = GetChildViewAt(first_acc_child);
+ set_acc_focused_view(GetChildViewAt(first_acc_child));
+ }
// Default focus is on the toolbar.
int view_index = VIEW_ID_TOOLBAR;
// Set hot-tracking for child, and update focused_view for MSAA focus event.
- if (acc_focused_view_) {
- acc_focused_view_->SetHotTracked(true);
+ if (acc_focused_view()) {
+ acc_focused_view()->SetHotTracked(true);
// Show the tooltip for the view that got the focus.
if (GetWidget()->GetTooltipManager())
GetWidget()->GetTooltipManager()->ShowKeyboardTooltip(acc_focused_view_);
// Update focused_view with MSAA-adjusted child id.
- view_index = acc_focused_view_->GetID();
+ view_index = acc_focused_view()->GetID();
}
HWND hwnd = GetWidget()->GetHWND();
@@ -380,7 +387,6 @@
// Any tooltips that are active should be hidden when toolbar loses focus.
if (GetWidget() && GetWidget()->GetTooltipManager())
GetWidget()->GetTooltipManager()->HideKeyboardTooltip();
- acc_focused_view_ = NULL;
}
jcampan 2008/12/20 02:20:11 I think I saw a case where the button was still sh
bool BrowserToolbarView::OnKeyPressed(const views::KeyEvent& e) {
« no previous file with comments | « chrome/browser/views/toolbar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698