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

Unified Diff: ash/common/system/tray/fixed_sized_scroll_view.cc

Issue 2496873002: Try to fix layout of scroll views in TrayDetailsViews. (Closed)
Patch Set: Created 4 years, 1 month 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: ash/common/system/tray/fixed_sized_scroll_view.cc
diff --git a/ash/common/system/tray/fixed_sized_scroll_view.cc b/ash/common/system/tray/fixed_sized_scroll_view.cc
index 4bc89220354cb76bb65108bd524b0fc8f2d64306..52bf75ac0c8af6541a6261c486bf79650b258987 100644
--- a/ash/common/system/tray/fixed_sized_scroll_view.cc
+++ b/ash/common/system/tray/fixed_sized_scroll_view.cc
@@ -28,7 +28,8 @@ FixedSizedScrollView::~FixedSizedScrollView() {}
void FixedSizedScrollView::SetContentsView(views::View* view) {
SetContents(view);
- view->SetBoundsRect(gfx::Rect(view->GetPreferredSize()));
+ if (!UseMd())
+ view->SetBoundsRect(gfx::Rect(view->GetPreferredSize()));
}
void FixedSizedScrollView::SetFixedSize(const gfx::Size& size) {
@@ -45,6 +46,9 @@ void FixedSizedScrollView::set_fixed_size(const gfx::Size& size) {
}
gfx::Size FixedSizedScrollView::GetPreferredSize() const {
+ if (UseMd())
+ return views::View::GetPreferredSize();
+
gfx::Size size =
fixed_size_.IsEmpty() ? contents()->GetPreferredSize() : fixed_size_;
gfx::Insets insets = GetInsets();
@@ -53,10 +57,8 @@ gfx::Size FixedSizedScrollView::GetPreferredSize() const {
}
void FixedSizedScrollView::Layout() {
- if (UseMd()) {
- views::ScrollView::Layout();
- return;
- }
+ if (UseMd())
+ return views::ScrollView::Layout();
gfx::Rect bounds = gfx::Rect(contents()->GetPreferredSize());
bounds.set_width(std::max(0, width() - GetScrollBarWidth()));
« no previous file with comments | « no previous file | ash/common/system/tray/tray_details_view.h » ('j') | ash/common/system/tray/tray_details_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698