Commit e009dc37 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

SharesheetTargetButton has multi-line label

We avoid the check failure
Check failed: GetMultiLine()
in Label::SetMaximumWidth(),
called by SharesheetTargetButton::SetLabelProperties()


Bug: 1132748
Change-Id: I9d5c12e01954f1abb80592a70967218ab37c8d2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2440724
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Melissa Zhang <melzhang@chromium.org>
Reviewed-by: default avatarMelissa Zhang <melzhang@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812612}
parent 4827d5fa
...@@ -76,10 +76,11 @@ SharesheetTargetButton::SharesheetTargetButton( ...@@ -76,10 +76,11 @@ SharesheetTargetButton::SharesheetTargetButton(
SetLabelProperties(secondary_label); SetLabelProperties(secondary_label);
accessible_name = base::StrCat( accessible_name = base::StrCat(
{display_name, base::ASCIIToUTF16(" "), secondary_display_name}); {display_name, base::ASCIIToUTF16(" "), secondary_display_name});
} else { // As there is a secondary label, don't let the initial label stretch across
// If there is no secondary label, let the initial label stretch across
// multiple lines. // multiple lines.
label->SetMultiLine(true); label->SetMultiLine(false);
secondary_label->SetMultiLine(false);
} else {
label->SetMaxLines(kButtonMaxLines); label->SetMaxLines(kButtonMaxLines);
} }
...@@ -91,11 +92,11 @@ SharesheetTargetButton::SharesheetTargetButton( ...@@ -91,11 +92,11 @@ SharesheetTargetButton::SharesheetTargetButton(
void SharesheetTargetButton::SetLabelProperties(views::Label* label) { void SharesheetTargetButton::SetLabelProperties(views::Label* label) {
label->SetLineHeight(kButtonLineHeight); label->SetLineHeight(kButtonLineHeight);
label->SetMultiLine(true);
label->SetMaximumWidth(kButtonTextMaxWidth); label->SetMaximumWidth(kButtonTextMaxWidth);
label->SetBackgroundColor(SK_ColorTRANSPARENT); label->SetBackgroundColor(SK_ColorTRANSPARENT);
label->SetHandlesTooltips(true); label->SetHandlesTooltips(true);
label->SetTooltipText(label->GetText()); label->SetTooltipText(label->GetText());
label->SetMultiLine(false);
label->SetAutoColorReadabilityEnabled(false); label->SetAutoColorReadabilityEnabled(false);
label->SetHorizontalAlignment(gfx::ALIGN_CENTER); label->SetHorizontalAlignment(gfx::ALIGN_CENTER);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment