Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 722 gfx::Rect row_bounds = GetForegroundBoundsForNode(selected_node_); | 722 gfx::Rect row_bounds = GetForegroundBoundsForNode(selected_node_); |
| 723 row_bounds.set_x( | 723 row_bounds.set_x( |
| 724 GetMirroredXWithWidthInView(row_bounds.x(), row_bounds.width())); | 724 GetMirroredXWithWidthInView(row_bounds.x(), row_bounds.width())); |
| 725 row_bounds.set_x(row_bounds.x() + text_offset_); | 725 row_bounds.set_x(row_bounds.x() + text_offset_); |
| 726 row_bounds.set_width(row_bounds.width() - text_offset_); | 726 row_bounds.set_width(row_bounds.width() - text_offset_); |
| 727 row_bounds.Inset(kTextHorizontalPadding, kTextVerticalPadding); | 727 row_bounds.Inset(kTextHorizontalPadding, kTextVerticalPadding); |
| 728 row_bounds.Inset(-empty_editor_size_.width() / 2, | 728 row_bounds.Inset(-empty_editor_size_.width() / 2, |
| 729 -(empty_editor_size_.height() - font_list_.GetHeight()) / 2); | 729 -(empty_editor_size_.height() - font_list_.GetHeight()) / 2); |
| 730 // Give a little extra space for editing. | 730 // Give a little extra space for editing. |
| 731 row_bounds.set_width(row_bounds.width() + 50); | 731 row_bounds.set_width(row_bounds.width() + 50); |
| 732 // The text field could be bigger than the content area of the parent. Scroll | |
| 733 // the parent by the bounds to make sure that we don't paint outside the | |
| 734 // content area. | |
|
Peter Kasting
2017/04/12 02:17:05
Nit: "Bigger than the content area" is a little mi
ananta
2017/04/12 02:46:49
Done.
| |
| 735 ScrollRectToVisible(row_bounds); | |
| 732 editor_->SetBoundsRect(row_bounds); | 736 editor_->SetBoundsRect(row_bounds); |
| 733 editor_->Layout(); | 737 editor_->Layout(); |
| 734 } | 738 } |
| 735 | 739 |
| 736 void TreeView::SchedulePaintForNode(InternalNode* node) { | 740 void TreeView::SchedulePaintForNode(InternalNode* node) { |
| 737 if (!node) | 741 if (!node) |
| 738 return; // Explicitly allow NULL to be passed in. | 742 return; // Explicitly allow NULL to be passed in. |
| 739 SchedulePaintInRect(GetBackgroundBoundsForNode(node)); | 743 SchedulePaintInRect(GetBackgroundBoundsForNode(node)); |
| 740 } | 744 } |
| 741 | 745 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1097 if (!is_expanded_) | 1101 if (!is_expanded_) |
| 1098 return max_width; | 1102 return max_width; |
| 1099 for (int i = 0; i < child_count(); ++i) { | 1103 for (int i = 0; i < child_count(); ++i) { |
| 1100 max_width = std::max(max_width, | 1104 max_width = std::max(max_width, |
| 1101 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1105 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 1102 } | 1106 } |
| 1103 return max_width; | 1107 return max_width; |
| 1104 } | 1108 } |
| 1105 | 1109 |
| 1106 } // namespace views | 1110 } // namespace views |
| OLD | NEW |