Commit 9080a8ec authored by Vasilii Sukhanov's avatar Vasilii Sukhanov Committed by Commit Bot

Truncate password in the drop-down.

Currently ellipsis is added to the value but it should be just truncated.

Bug: 869394
Change-Id: I68cee8a70a45564ace59512356489c195327ca1c
Reviewed-on: https://chromium-review.googlesource.com/1156696Reviewed-by: default avatarTommy Martino <tmartino@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579604}
parent 8b36b40d
......@@ -128,6 +128,9 @@ class AutofillPopupItemView : public AutofillPopupRowView {
// The description view can be nullptr.
virtual views::View* CreateDescriptionLabel();
// Creates a description label iff the description text isn't empty.
views::Label* CreateDescriptionLabelInternal() const;
private:
void AddSpacerWithSize(int spacer_width,
bool resize,
......@@ -370,6 +373,10 @@ views::View* AutofillPopupItemView::CreateValueLabel() {
}
views::View* AutofillPopupItemView::CreateDescriptionLabel() {
return CreateDescriptionLabelInternal();
}
views::Label* AutofillPopupItemView::CreateDescriptionLabelInternal() const {
const base::string16& description_text =
popup_view_->controller()->GetElidedLabelAt(line_number_);
if (!description_text.empty()) {
......@@ -442,9 +449,12 @@ views::View* PasswordPopupSuggestionView::CreateValueLabel() {
}
views::View* PasswordPopupSuggestionView::CreateDescriptionLabel() {
views::View* label = AutofillPopupSuggestionView::CreateDescriptionLabel();
return label ? new ConstrainedWidthView(label, kAutofillPopupPasswordMaxWidth)
: nullptr;
views::Label* label = CreateDescriptionLabelInternal();
if (!label)
return nullptr;
label->SetElideBehavior(gfx::TRUNCATE);
return new ConstrainedWidthView(label, kAutofillPopupPasswordMaxWidth);
}
PasswordPopupSuggestionView::PasswordPopupSuggestionView(
......
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