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

Unified Diff: ui/views/controls/table/table_view.cc

Issue 2769243002: Adjust initial activation/focus Task Manager/Views TableView. (Closed)
Patch Set: sky review Created 3 years, 9 months 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
Index: ui/views/controls/table/table_view.cc
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc
index ab17e37d723aad00bee65cb576e12a2cc833c984..6e05566534e2390c329380af58ea0e358c0ccd37 100644
--- a/ui/views/controls/table/table_view.cc
+++ b/ui/views/controls/table/table_view.cc
@@ -299,12 +299,10 @@ int TableView::ModelToView(int model_index) const {
}
int TableView::ViewToModel(int view_index) const {
- if (!is_sorted())
- return view_index;
DCHECK_GE(view_index, 0) << " negative view_index " << view_index;
DCHECK_LT(view_index, RowCount()) << " out of bounds view_index " <<
view_index;
- return view_to_model_[view_index];
+ return is_sorted() ? view_to_model_[view_index] : view_index;
}
void TableView::Layout() {
@@ -626,8 +624,11 @@ void TableView::OnFocus() {
ScrollView* scroll_view = ScrollView::GetScrollViewForContents(this);
if (scroll_view)
scroll_view->SetHasFocusIndicator(true);
- SchedulePaintForSelection();
+ if (selection_model_.active() == -1 && RowCount())
+ SelectByViewIndex(0);
+
+ SchedulePaintForSelection();
NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true);
}

Powered by Google App Engine
This is Rietveld 408576698