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

Unified Diff: chrome/browser/ui/views/payments/payment_request_sheet_controller.cc

Issue 2782303002: [Web Payments] Constrain the dialog inner views to parent's width (Closed)
Patch Set: Created 3 years, 9 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: chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
index 03a6d0bb6a3eb29c387bd52f0bf0180bbbac8be0..aad45471a898bb7ed0d9d4e3638fa222c2c1b311 100644
--- a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
@@ -100,13 +100,22 @@ PaymentRequestSheetController::CreatePaymentView() {
// |content_view| will go into a views::ScrollView so it needs to be sized now
// otherwise it'll be sized to the ScrollView's viewport height, preventing
// the scroll bar from ever being shown.
- content_view_->SizeToPreferredSize();
+ views::View* pane = new views::View;
+ views::GridLayout* pane_layout = new views::GridLayout(pane);
+ views::ColumnSet* pane_columns = pane_layout->AddColumnSet(0);
+ pane_columns->AddColumn(
+ views::GridLayout::Alignment::FILL, views::GridLayout::Alignment::LEADING,
+ 0, views::GridLayout::SizeType::FIXED, kDialogWidth, kDialogWidth);
+ pane->SetLayoutManager(pane_layout);
+ pane_layout->StartRow(0, 0);
+ pane_layout->AddView(content_view_);
+ pane->SizeToPreferredSize();
std::unique_ptr<views::ScrollView> scroll =
base::MakeUnique<views::ScrollView>();
scroll->EnableViewPortLayer();
scroll->set_hide_horizontal_scrollbar(true);
- scroll->SetContents(content_view_);
+ scroll->SetContents(pane);
layout->AddView(scroll.release());
layout->StartRow(0, 0);

Powered by Google App Engine
This is Rietveld 408576698