From 8eb52a9ae0407aa717113d48b540b1abdb0616e8 Mon Sep 17 00:00:00 2001 From: "davemoore@chromium.org" Date: Wed, 9 Mar 2011 16:52:00 +0000 Subject: This will help minimize the area we paint various views, including BrowserView in cros. Before the default when a child's preferred view size changed was to propagate it up and paint everything from the rootview down. This will limit the area to the parts that actually changed size. I expect we may find things that aren't being painted because they were assuming the behavior of Layout(). We should fix this as necessary. Also, a subsequent change will minimize our calls to SchedulePaint(). We frequently do it when we don't need to. BUG=None TEST=ViewTest.SetBoundsPaint Review URL: http://codereview.chromium.org/6531032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77481 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/table/table_view.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'views/controls/table/table_view.cc') diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index f226cd0..59f5d62 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -128,17 +128,6 @@ void TableView::SetSortDescriptors(const SortDescriptors& sort_descriptors) { SendMessage(list_view_, WM_SETREDRAW, static_cast(TRUE), 0); } -void TableView::OnBoundsChanged() { - if (!list_view_) - return; - SendMessage(list_view_, WM_SETREDRAW, static_cast(FALSE), 0); - Layout(); - if ((autosize_columns_ || !column_sizes_valid_) && width() > 0) - ResetColumnSizes(); - UpdateContentOffset(); - SendMessage(list_view_, WM_SETREDRAW, static_cast(TRUE), 0); -} - int TableView::RowCount() const { if (!list_view_) return 0; @@ -1511,6 +1500,17 @@ bool TableView::OnKeyDown(ui::KeyboardCode virtual_keycode) { return false; // Let the key event be processed as ususal. } +void TableView::OnBoundsChanged(const gfx::Rect& previous_bounds) { + if (!list_view_) + return; + SendMessage(list_view_, WM_SETREDRAW, static_cast(FALSE), 0); + Layout(); + if ((autosize_columns_ || !column_sizes_valid_) && width() > 0) + ResetColumnSizes(); + UpdateContentOffset(); + SendMessage(list_view_, WM_SETREDRAW, static_cast(TRUE), 0); +} + int TableView::PreviousSelectedViewIndex(int view_index) { DCHECK_GE(view_index, 0); if (!list_view_ || view_index <= 0) -- cgit v1.1