diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-09 16:52:00 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-09 16:52:00 +0000 |
commit | 8eb52a9ae0407aa717113d48b540b1abdb0616e8 (patch) | |
tree | 358644668ef2e16d94c86d04b56bb7c1e8673c4e /views/controls/table | |
parent | 470ed45abe7452e9f72122e0273cc0506114860a (diff) | |
download | chromium_src-8eb52a9ae0407aa717113d48b540b1abdb0616e8.zip chromium_src-8eb52a9ae0407aa717113d48b540b1abdb0616e8.tar.gz chromium_src-8eb52a9ae0407aa717113d48b540b1abdb0616e8.tar.bz2 |
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
Diffstat (limited to 'views/controls/table')
-rw-r--r-- | views/controls/table/table_view.cc | 22 | ||||
-rw-r--r-- | views/controls/table/table_view.h | 9 |
2 files changed, 16 insertions, 15 deletions
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<WPARAM>(TRUE), 0); } -void TableView::OnBoundsChanged() { - if (!list_view_) - return; - SendMessage(list_view_, WM_SETREDRAW, static_cast<WPARAM>(FALSE), 0); - Layout(); - if ((autosize_columns_ || !column_sizes_valid_) && width() > 0) - ResetColumnSizes(); - UpdateContentOffset(); - SendMessage(list_view_, WM_SETREDRAW, static_cast<WPARAM>(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<WPARAM>(FALSE), 0); + Layout(); + if ((autosize_columns_ || !column_sizes_valid_) && width() > 0) + ResetColumnSizes(); + UpdateContentOffset(); + SendMessage(list_view_, WM_SETREDRAW, static_cast<WPARAM>(TRUE), 0); +} + int TableView::PreviousSelectedViewIndex(int view_index) { DCHECK_GE(view_index, 0); if (!list_view_ || view_index <= 0) diff --git a/views/controls/table/table_view.h b/views/controls/table/table_view.h index 620845d..a0181c9 100644 --- a/views/controls/table/table_view.h +++ b/views/controls/table/table_view.h @@ -162,8 +162,6 @@ class TableView : public NativeControl, // Current sort. const SortDescriptors& sort_descriptors() const { return sort_descriptors_; } - virtual void OnBoundsChanged(); - // Returns the number of rows in the TableView. int RowCount() const; @@ -246,7 +244,7 @@ class TableView : public NativeControl, protected: // Overriden to return the position of the first selected row. - virtual gfx::Point GetKeyboardContextMenuLocation(); + virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE; // Subclasses that want to customize the colors of a particular row/column, // must invoke this passing in true. The default value is false, such that @@ -264,7 +262,10 @@ class TableView : public NativeControl, virtual void OnMiddleClick(); // Overridden from NativeControl. Notifies the observer. - virtual bool OnKeyDown(ui::KeyboardCode virtual_keycode); + virtual bool OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE; + + // View override. + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; // Invoked to customize the colors or font at a particular cell. If you // change the colors or font, return true. This is only invoked if |