Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1488)

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

Issue 1680613002: Adding momentum/overscroll to views:: ScrollViews Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Tableview layout. aaaand I think we are done Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/scrollbar/cocoa_scroll_bar.mm ('k') | ui/views/examples/scroll_view_example.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/table/table_view.cc
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc
index 9ef4fe95a81979c279f87de6411fcd19cdd168a3..0d67a6ffb0f1ab483c938a5d519babac0123fe05 100644
--- a/ui/views/controls/table/table_view.cc
+++ b/ui/views/controls/table/table_view.cc
@@ -305,17 +305,16 @@ int TableView::ViewToModel(int view_index) const {
}
void TableView::Layout() {
- // parent()->parent() is the scrollview. When its width changes we force
- // recalculating column sizes.
- View* scroll_view = parent() ? parent()->parent() : NULL;
+ // When the scroll view width changes, recalculate column sizes.
+ ScrollView* scroll_view = EnclosingScrollView();
if (scroll_view) {
const int scroll_view_width = scroll_view->GetContentsBounds().width();
if (scroll_view_width != last_parent_width_) {
last_parent_width_ = scroll_view_width;
if (!in_set_visible_column_width_) {
- // Layout to the parent (the Viewport), which differs from
+ // Layout to the visible width (the Viewport), which differs from
// |scroll_view_width| when scrollbars are present.
- layout_width_ = parent()->width();
+ layout_width_ = scroll_view->GetVisibleRect().width();
UpdateVisibleColumnSizes();
}
}
« no previous file with comments | « ui/views/controls/scrollbar/cocoa_scroll_bar.mm ('k') | ui/views/examples/scroll_view_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698