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

Side by Side Diff: trunk/src/ui/views/controls/tree/tree_view.cc

Issue 23710009: Revert 219673 "Fix Views Combobox and Tree View text input." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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/tree/tree_view.h" 5 #include "ui/views/controls/tree/tree_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "ui/base/accessibility/accessible_view_state.h" 12 #include "ui/base/accessibility/accessible_view_state.h"
13 #include "ui/base/events/event.h" 13 #include "ui/base/events/event.h"
14 #include "ui/base/keycodes/keyboard_codes.h" 14 #include "ui/base/keycodes/keyboard_codes.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
17 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
18 #include "ui/gfx/rect_conversions.h" 18 #include "ui/gfx/rect_conversions.h"
19 #include "ui/gfx/skia_util.h" 19 #include "ui/gfx/skia_util.h"
20 #include "ui/native_theme/native_theme.h" 20 #include "ui/native_theme/native_theme.h"
21 #include "ui/views/controls/prefix_selector.h" 21 #include "ui/views/controls/prefix_selector.h"
22 #include "ui/views/controls/scroll_view.h" 22 #include "ui/views/controls/scroll_view.h"
23 #include "ui/views/controls/textfield/textfield.h" 23 #include "ui/views/controls/textfield/textfield.h"
24 #include "ui/views/controls/tree/tree_view_controller.h" 24 #include "ui/views/controls/tree/tree_view_controller.h"
25 #include "ui/views/ime/input_method.h"
25 26
26 using ui::TreeModel; 27 using ui::TreeModel;
27 using ui::TreeModelNode; 28 using ui::TreeModelNode;
28 29
29 namespace views { 30 namespace views {
30 31
31 // Insets around the view. 32 // Insets around the view.
32 static const int kHorizontalInset = 2; 33 static const int kHorizontalInset = 2;
33 static const int kVerticalInset = 2; 34 static const int kVerticalInset = 2;
34 // Padding before/after the image. 35 // Padding before/after the image.
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 int max_row = (max_y - kVerticalInset) / row_height_; 593 int max_row = (max_y - kVerticalInset) / row_height_;
593 if ((max_y - kVerticalInset) % row_height_ != 0) 594 if ((max_y - kVerticalInset) % row_height_ != 0)
594 max_row++; 595 max_row++;
595 int current_row = root_row(); 596 int current_row = root_row();
596 PaintRows(canvas, min_row, max_row, &root_, root_depth(), &current_row); 597 PaintRows(canvas, min_row, max_row, &root_, root_depth(), &current_row);
597 } 598 }
598 599
599 void TreeView::OnFocus() { 600 void TreeView::OnFocus() {
600 View::OnFocus(); 601 View::OnFocus();
601 SchedulePaintForNode(selected_node_); 602 SchedulePaintForNode(selected_node_);
603
604 // Notify the InputMethod so that it knows to query the TextInputClient.
605 if (GetInputMethod())
606 GetInputMethod()->OnCaretBoundsChanged(this);
602 } 607 }
603 608
604 void TreeView::OnBlur() { 609 void TreeView::OnBlur() {
605 View::OnBlur();
606 SchedulePaintForNode(selected_node_); 610 SchedulePaintForNode(selected_node_);
607 if (selector_) 611 if (selector_)
608 selector_->OnViewBlur(); 612 selector_->OnViewBlur();
609 } 613 }
610 614
611 bool TreeView::OnClickOrTap(const ui::LocatedEvent& event) { 615 bool TreeView::OnClickOrTap(const ui::LocatedEvent& event) {
612 CommitEdit(); 616 CommitEdit();
613 RequestFocus(); 617 RequestFocus();
614 618
615 int row = (event.y() - kVerticalInset) / row_height_; 619 int row = (event.y() - kVerticalInset) / row_height_;
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 if (!is_expanded_) 1012 if (!is_expanded_)
1009 return max_width; 1013 return max_width;
1010 for (int i = 0; i < child_count(); ++i) { 1014 for (int i = 0; i < child_count(); ++i) {
1011 max_width = std::max(max_width, 1015 max_width = std::max(max_width,
1012 GetChild(i)->GetMaxWidth(indent, depth + 1)); 1016 GetChild(i)->GetMaxWidth(indent, depth + 1));
1013 } 1017 }
1014 return max_width; 1018 return max_width;
1015 } 1019 }
1016 1020
1017 } // namespace views 1021 } // namespace views
OLDNEW
« no previous file with comments | « trunk/src/ui/views/controls/textfield/native_textfield_views.cc ('k') | trunk/src/ui/views/ime/input_method.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698