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

Unified Diff: ui/app_list/views/search_result_tile_item_list_view.cc

Issue 2972243002: Fix app list item indexing bug. (Closed)
Patch Set: oshima's comments. Created 3 years, 5 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/app_list/views/search_result_tile_item_list_view.cc
diff --git a/ui/app_list/views/search_result_tile_item_list_view.cc b/ui/app_list/views/search_result_tile_item_list_view.cc
index ae0cba3d82a04852ee322565c091073b2df8fcc9..35dd2a1e2bca758af5695eeb1fc1a60e7bf451f4 100644
--- a/ui/app_list/views/search_result_tile_item_list_view.cc
+++ b/ui/app_list/views/search_result_tile_item_list_view.cc
@@ -169,7 +169,12 @@ void SearchResultTileItemListView::UpdateSelectedIndex(int old_selected,
}
bool SearchResultTileItemListView::OnKeyPressed(const ui::KeyEvent& event) {
- if (selected_index() >= 0 && child_at(selected_index())->OnKeyPressed(event))
+ int selection_index = selected_index();
+ // Also count the separator when Play Store app search feature is enabled.
+ const int child_index = is_play_store_app_search_enabled_
+ ? selection_index * 2 + 1
+ : selection_index;
+ if (selection_index >= 0 && child_at(child_index)->OnKeyPressed(event))
return true;
int dir = 0;
@@ -204,7 +209,7 @@ bool SearchResultTileItemListView::OnKeyPressed(const ui::KeyEvent& event) {
if (dir == 0)
return false;
- int selection_index = selected_index() + dir;
+ selection_index = selection_index + dir;
if (IsValidSelectionIndex(selection_index)) {
SetSelectedIndex(selection_index);
return true;
« no previous file with comments | « ui/app_list/views/search_result_list_view_unittest.cc ('k') | ui/app_list/views/search_result_tile_item_list_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698