| 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_views.h" | 5 #include "ui/views/controls/tree/tree_view_views.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.h" | 10 #include "base/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/skia_util.h" | 19 #include "ui/gfx/skia_util.h" |
| 19 #include "ui/views/background.h" | 20 #include "ui/views/background.h" |
| 20 #include "ui/views/controls/scroll_view.h" | 21 #include "ui/views/controls/scroll_view.h" |
| 21 #include "ui/views/controls/textfield/textfield.h" | 22 #include "ui/views/controls/textfield/textfield.h" |
| 22 #include "ui/views/controls/tree/tree_view_controller.h" | 23 #include "ui/views/controls/tree/tree_view_controller.h" |
| 23 | 24 |
| 24 using ui::TreeModel; | 25 using ui::TreeModel; |
| 25 using ui::TreeModelNode; | 26 using ui::TreeModelNode; |
| 26 | 27 |
| 27 namespace views { | 28 namespace views { |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 506 } |
| 506 | 507 |
| 507 void TreeView::OnPaint(gfx::Canvas* canvas) { | 508 void TreeView::OnPaint(gfx::Canvas* canvas) { |
| 508 // Don't invoke View::OnPaint so that we can render our own focus border. | 509 // Don't invoke View::OnPaint so that we can render our own focus border. |
| 509 OnPaintBackground(canvas); | 510 OnPaintBackground(canvas); |
| 510 | 511 |
| 511 int min_y, max_y; | 512 int min_y, max_y; |
| 512 { | 513 { |
| 513 SkRect sk_clip_rect; | 514 SkRect sk_clip_rect; |
| 514 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) { | 515 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) { |
| 515 gfx::Rect clip_rect = gfx::SkRectToRect(sk_clip_rect); | 516 // Pixels partially inside the clip rect should be included. |
| 517 gfx::Rect clip_rect = gfx::ToEnclosingRect( |
| 518 gfx::SkRectToRectF(sk_clip_rect)); |
| 516 min_y = clip_rect.y(); | 519 min_y = clip_rect.y(); |
| 517 max_y = clip_rect.bottom(); | 520 max_y = clip_rect.bottom(); |
| 518 } else { | 521 } else { |
| 519 gfx::Rect vis_bounds = GetVisibleBounds(); | 522 gfx::Rect vis_bounds = GetVisibleBounds(); |
| 520 min_y = vis_bounds.y(); | 523 min_y = vis_bounds.y(); |
| 521 max_y = vis_bounds.bottom(); | 524 max_y = vis_bounds.bottom(); |
| 522 } | 525 } |
| 523 } | 526 } |
| 524 | 527 |
| 525 int min_row = std::max(0, (min_y - kVerticalInset) / row_height_); | 528 int min_row = std::max(0, (min_y - kVerticalInset) / row_height_); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 if (!is_expanded_) | 900 if (!is_expanded_) |
| 898 return max_width; | 901 return max_width; |
| 899 for (int i = 0; i < child_count(); ++i) { | 902 for (int i = 0; i < child_count(); ++i) { |
| 900 max_width = std::max(max_width, | 903 max_width = std::max(max_width, |
| 901 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 904 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 902 } | 905 } |
| 903 return max_width; | 906 return max_width; |
| 904 } | 907 } |
| 905 | 908 |
| 906 } // namespace views | 909 } // namespace views |
| OLD | NEW |