Chromium Code Reviews

Unified Diff: views/controls/table/table_view.cc

Issue 2812026: Auto-size the views version of the options dialog. (Closed)
Patch Set: Fix autosizing issue with gtk pref pages in chromeos options dialog. Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « views/controls/table/table_view.h ('k') | views/examples/tabbed_pane_example.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/table/table_view.cc
diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc
index 8b86a6ef38cf6e8d969fb91f39b48bf1e5920a4d..7ab4c9118877c9d626d7c6e893c32686a7681e0f 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -64,7 +64,6 @@ TableView::TableView(TableModel* model,
single_selection_(single_selection),
ignore_listview_change_(false),
custom_colors_enabled_(false),
- sized_columns_(false),
autosize_columns_(autosize_columns),
resizable_columns_(resizable_columns),
list_view_(NULL),
@@ -133,10 +132,8 @@ void TableView::DidChangeBounds(const gfx::Rect& previous,
return;
SendMessage(list_view_, WM_SETREDRAW, static_cast<WPARAM>(FALSE), 0);
Layout();
- if ((!sized_columns_ || autosize_columns_) && width() > 0) {
- sized_columns_ = true;
+ if (autosize_columns_ && width() > 0)
ResetColumnSizes();
- }
UpdateContentOffset();
SendMessage(list_view_, WM_SETREDRAW, static_cast<WPARAM>(TRUE), 0);
}
@@ -1551,6 +1548,15 @@ gfx::Font TableView::GetAltTextFont() {
return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
}
+void TableView::VisibilityChanged(View* starting_from, bool is_visible) {
+ // GetClientRect as used by ResetColumnSize to obtain the total width
+ // available to the columns only works when the native control is visible, so
+ // update the column sizes in case we become visible. This depends on
+ // VisibilityChanged() being called in post order on the view tree.
+ if (is_visible && autosize_columns_)
+ ResetColumnSizes();
+}
+
//
// TableSelectionIterator
« no previous file with comments | « views/controls/table/table_view.h ('k') | views/examples/tabbed_pane_example.h » ('j') | no next file with comments »

Powered by Google App Engine