Commit 358ef51f authored by Daniel Rubery's avatar Daniel Rubery Committed by Commit Bot

Expand download shelf item width for danger type DEEP_SCANNED_SAFE

In order to avoid cutting off the status label
"Scan complete, no issues identified", expand the width of the download
shelf item to the maximum of the file name label, status label, and
the minimum text width (so short filenames aren't shortened by this
change).

New screenshot: https://screenshot.googleplex.com/YMMaw8r1CRd.png

Bug: 1020418
Change-Id: I6ddcf6beb66526b168bf8b826d13d7be394cfc2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023280
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736144}
parent a389dc4b
......@@ -540,7 +540,13 @@ void DownloadItemView::Layout() {
int status_y =
file_name_y + font_list_.GetBaseline() + kVerticalTextPadding;
status_label_->SetBoundsRect(gfx::Rect(mirrored_x, status_y, kTextWidth,
bool should_expand_for_status_text =
(model_->GetDangerType() ==
download::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_SAFE);
int status_width = should_expand_for_status_text
? status_label_->GetPreferredSize().width()
: kTextWidth;
status_label_->SetBoundsRect(gfx::Rect(mirrored_x, status_y, status_width,
status_font_list_.GetHeight()));
}
......@@ -588,12 +594,12 @@ gfx::Size DownloadItemView::CalculatePreferredSize() const {
GetWarningIconSize()});
width += kEndPadding;
}
} else {
gfx::Size label_size = file_name_label_->GetPreferredSize();
label_size.SetToMax(status_label_->GetPreferredSize());
label_size.SetToMax(gfx::Size(kTextWidth, 0));
width = kStartPadding + DownloadShelf::kProgressIndicatorSize +
kProgressTextPadding + kTextWidth + kEndPadding;
kProgressTextPadding + label_size.width() + kEndPadding;
}
if (mode_ != DANGEROUS_MODE)
......
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