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

Side by Side Diff: ui/views/controls/table/table_view.cc

Issue 2785473003: views::TableView - request focus on tap. (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/controls/table/table_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/table/table_view.h" 5 #include "ui/views/controls/table/table_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } else if (event.GetClickCount() == 1) { 402 } else if (event.GetClickCount() == 1) {
403 ui::ListSelectionModel new_model; 403 ui::ListSelectionModel new_model;
404 ConfigureSelectionModelForEvent(event, &new_model); 404 ConfigureSelectionModelForEvent(event, &new_model);
405 SetSelectionModel(new_model); 405 SetSelectionModel(new_model);
406 } 406 }
407 407
408 return true; 408 return true;
409 } 409 }
410 410
411 void TableView::OnGestureEvent(ui::GestureEvent* event) { 411 void TableView::OnGestureEvent(ui::GestureEvent* event) {
412 if (event->type() != ui::ET_GESTURE_TAP) 412 if (event->type() != ui::ET_GESTURE_TAP_DOWN)
413 return; 413 return;
414 414
415 RequestFocus();
416
415 const int row = event->y() / row_height_; 417 const int row = event->y() / row_height_;
416 if (row < 0 || row >= RowCount()) 418 if (row < 0 || row >= RowCount())
417 return; 419 return;
418 420
419 event->StopPropagation(); 421 event->StopPropagation();
420 ui::ListSelectionModel new_model; 422 ui::ListSelectionModel new_model;
421 ConfigureSelectionModelForEvent(*event, &new_model); 423 ConfigureSelectionModelForEvent(*event, &new_model);
422 SetSelectionModel(new_model); 424 SetSelectionModel(new_model);
423 } 425 }
424 426
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 if (tooltip) 949 if (tooltip)
948 *tooltip = text; 950 *tooltip = text;
949 if (tooltip_origin) { 951 if (tooltip_origin) {
950 tooltip_origin->SetPoint(cell_bounds.x(), 952 tooltip_origin->SetPoint(cell_bounds.x(),
951 cell_bounds.y() + kTextVerticalPadding); 953 cell_bounds.y() + kTextVerticalPadding);
952 } 954 }
953 return true; 955 return true;
954 } 956 }
955 957
956 } // namespace views 958 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/table/table_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698