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

Unified Diff: ui/views/window/dialog_client_view.cc

Issue 2932523003: Fix Harmony popover buttons being flush with their content. (Closed)
Patch Set: too much padding for bubbles Created 3 years, 6 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/window/dialog_client_view.cc
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index a9414fb419fdfd6e68bf511993ba4fda84e86a7d..180b22b96d77adb04f6199e8f1f0165db30bd9f0 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -347,17 +347,6 @@ void DialogClientView::SetupLayout() {
if (std::count(views.begin(), views.end(), nullptr) == kNumButtons)
return;
- gfx::Insets insets = button_row_insets_;
- LayoutProvider* const layout_provider = LayoutProvider::Get();
- // Support dialogs that clear |button_row_insets_| to do their own layout.
- // They expect GetDialogRelatedControlVerticalSpacing() in this case.
- if (insets.top() == 0 &&
Bret 2017/06/07 22:52:18 Removing this block reduces the pre-Harmony conten
- !ui::MaterialDesignController::IsSecondaryUiMaterial()) {
- const int top =
- layout_provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL);
- insets.Set(top, insets.left(), insets.bottom(), insets.right());
- }
-
// The |resize_percent| constants. There's only one stretchy column (padding
// to the left of ok/cancel buttons).
constexpr float kFixed = 0.f;
@@ -366,6 +355,7 @@ void DialogClientView::SetupLayout() {
// Button row is [ extra <pad+stretchy> second <pad> third ]. Ensure the <pad>
// column is zero width if there isn't a button on either side.
// GetExtraViewSpacing() handles <pad+stretchy>.
+ LayoutProvider* const layout_provider = LayoutProvider::Get();
const int button_spacing = (ok_button_ && cancel_button_)
? layout_provider->GetDistanceMetric(
DISTANCE_RELATED_BUTTON_HORIZONTAL)
@@ -376,7 +366,7 @@ void DialogClientView::SetupLayout() {
// Rather than giving |button_row_container_| a Border, incorporate the insets
// into the layout. This simplifies min/max size calculations.
- column_set->AddPaddingColumn(kFixed, insets.left());
+ column_set->AddPaddingColumn(kFixed, button_row_insets_.left());
column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, kFixed,
GridLayout::USE_PREF, 0, 0);
column_set->AddPaddingColumn(kStretchy, GetExtraViewSpacing());
@@ -385,14 +375,15 @@ void DialogClientView::SetupLayout() {
column_set->AddPaddingColumn(kFixed, button_spacing);
column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, kFixed,
GridLayout::USE_PREF, 0, 0);
- column_set->AddPaddingColumn(kFixed, insets.right());
+ column_set->AddPaddingColumn(kFixed, button_row_insets_.right());
// Track which columns to link sizes under MD.
constexpr int kViewToColumnIndex[] = {1, 3, 5};
int link[] = {-1, -1, -1};
size_t link_index = 0;
- layout->StartRowWithPadding(kFixed, kButtonRowId, kFixed, insets.top());
+ layout->StartRowWithPadding(kFixed, kButtonRowId, kFixed,
+ button_row_insets_.top());
for (size_t view_index = 0; view_index < kNumButtons; ++view_index) {
if (views[view_index]) {
layout->AddView(views[view_index]);
@@ -416,7 +407,7 @@ void DialogClientView::SetupLayout() {
else
column_set->LinkColumnSizes(link[0], link[1], link[2], -1);
- layout->AddPaddingRow(kFixed, insets.bottom());
+ layout->AddPaddingRow(kFixed, button_row_insets_.bottom());
// The default focus is lost when child views are added back into the dialog.
// This restores focus if the button is still available.

Powered by Google App Engine
This is Rietveld 408576698