Commit da288119 authored by Andrew Xu's avatar Andrew Xu Committed by Commit Bot

[Multipaste] Tweak HTML image scaling strategy

This CL changes the scaling strategy for the images rendered from
HTML code a little bit: shrink the image if it is higher/wider than the
available space.

Bug: 1146556
Change-Id: Ie690bfc3da293eee7c3371bd8892d21b3532f91a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536431
Auto-Submit: Andrew Xu <andrewxu@chromium.org>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827086}
parent d72ad686
......@@ -287,14 +287,11 @@ class ClipboardHistoryBitmapItemView::BitmapContentsView
scaling_up_ratio = 1.f;
else
scaling_up_ratio = std::fmin(width_ratio, height_ratio);
DCHECK_LE(scaling_up_ratio, 1.f);
break;
}
case ui::ClipboardInternalFormat::kHtml: {
if (width_ratio >= 1.f || height_ratio >= 1.f)
scaling_up_ratio = 1.f;
else
scaling_up_ratio =
std::fmin(std::fmax(width_ratio, height_ratio), 1.f);
scaling_up_ratio = std::fmax(width_ratio, height_ratio);
break;
}
default:
......@@ -302,7 +299,6 @@ class ClipboardHistoryBitmapItemView::BitmapContentsView
break;
}
DCHECK_LE(scaling_up_ratio, 1.f);
DCHECK_GT(scaling_up_ratio, 0.f);
image_view_->SetImage(image_view_->original_image(),
......
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