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

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

Issue 2189583004: [not for review - epic CL] Adding Elastic+Momentum+Layered scrolling to views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Combined rebase 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
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 9ce94cc4519a6e53df4bc9314ec1a624ff9832dd..6c80d78ab1c4e0e3eeacf26c226ed125a767d52a 100644
--- a/ui/views/controls/table/table_view.cc
+++ b/ui/views/controls/table/table_view.cc
@@ -317,17 +317,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();
}
}

Powered by Google App Engine
This is Rietveld 408576698