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

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

Issue 2188133002: Scroll with Layers in views::ScrollView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollTrack
Patch Set: DCHECK for no layer Created 4 years, 4 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