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

Side by Side Diff: chrome/browser/ui/views/payments/order_summary_view_controller.cc

Issue 2829103002: [Web Payments] Properly constrain label width in order summary (Closed)
Patch Set: Add comment. Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" 5 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // The vertical spacing for these rows is slightly different than the spacing 51 // The vertical spacing for these rows is slightly different than the spacing
52 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets. 52 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets.
53 constexpr int kRowVerticalInset = 12; 53 constexpr int kRowVerticalInset = 12;
54 layout->SetInsets(kRowVerticalInset, 54 layout->SetInsets(kRowVerticalInset,
55 payments::kPaymentRequestRowHorizontalInsets, 55 payments::kPaymentRequestRowHorizontalInsets,
56 kRowVerticalInset, 56 kRowVerticalInset,
57 payments::kPaymentRequestRowHorizontalInsets); 57 payments::kPaymentRequestRowHorizontalInsets);
58 58
59 row->SetLayoutManager(layout); 59 row->SetLayoutManager(layout);
60 views::ColumnSet* columns = layout->AddColumnSet(0); 60 views::ColumnSet* columns = layout->AddColumnSet(0);
61 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 61 // The first column has resize_percent = 1 so that it streches all the way
62 0, views::GridLayout::USE_PREF, 0, 0); 62 // across the row up to the amount label. This way the first label elides as
63 columns->AddPaddingColumn(1, 0); 63 // required.
64 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1,
65 views::GridLayout::USE_PREF, 0, 0);
64 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 66 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
65 0, views::GridLayout::USE_PREF, 0, 0); 67 0, views::GridLayout::USE_PREF, 0, 0);
66 68
67 layout->StartRow(0, 0); 69 layout->StartRow(0, 0);
68 layout->AddView(new views::Label(label)); 70 layout->AddView(new views::Label(label));
69 views::StyledLabel::RangeStyleInfo style_info; 71 views::StyledLabel::RangeStyleInfo style_info;
70 if (bold_amount) 72 if (bold_amount)
71 style_info.weight = gfx::Font::Weight::BOLD; 73 style_info.weight = gfx::Font::Weight::BOLD;
72 74
73 std::unique_ptr<views::StyledLabel> amount_label = 75 std::unique_ptr<views::StyledLabel> amount_label =
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 total_label_value, true, 158 total_label_value, true,
157 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) 159 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL)
158 .release()); 160 .release());
159 } 161 }
160 162
161 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { 163 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) {
162 pay_button_->SetEnabled(enabled); 164 pay_button_->SetEnabled(enabled);
163 } 165 }
164 166
165 } // namespace payments 167 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698