Commit e9daf9e1 authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Only expand download item when status is 'deep scanned safe'.

The following change was made to keep from clipping off the "deep
scanned, safe" status label on download items:
https://chromium.googlesource.com/chromium/src/+/358ef51f54b34961bd2cca2df39b0adc11b5d51d

However, this change allowed the download item's preferred size to
expand in a number of cases where the status label became even
momentarily larger than the default size, resulting in the boundaries of
download items shifting during download on some platforms and for some
files (see associated bug).

This CL restricts the change in the preferred size of the download item
to only happen specifically in the "deep scanned, safe" state,
preventing visual jitter during download.

In the future, it would be good to rewrite the layout code for download
items entirely to use a modern declarative layout, which would allow us
to reason about these kinds of issues and make needed visual changes
much more efficiently.

Bug: 1093343
Change-Id: Ie2492c0fc15209b51db6bf6c3624501e2be388c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2240591
Commit-Queue: Dana Fried <dfried@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777499}
parent d5f58816
......@@ -590,11 +590,14 @@ gfx::Size DownloadItemView::CalculatePreferredSize() const {
width += kEndPadding;
}
} else {
gfx::Size label_size = file_name_label_->GetPreferredSize();
label_size.SetToMax(status_label_->GetPreferredSize());
label_size.SetToMax(gfx::Size(kTextWidth, 0));
int status_width = kTextWidth;
if (model_->GetDangerType() ==
download::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_SAFE) {
status_width =
std::max(status_width, status_label_->GetPreferredSize().width());
}
width = kStartPadding + DownloadShelf::kProgressIndicatorSize +
kProgressTextPadding + label_size.width() + kEndPadding;
kProgressTextPadding + status_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