Commit e5057d1f authored by Brandon Maslen's avatar Brandon Maslen Committed by Commit Bot

Update PermissionPromptBubbleView to better handle small prompts

Recently PermissionPromptBubbleView::CalculatePreferredSize was added
to ensure permission prompts do not expand too large when large
prompt text is present. While this helped ensure the prompt respected
the same max bubble width used elsewhere in Chromium it also caused
small prompts to become larger to fill the space.

This change updates the CalculatePreferredSized impl to take into
account the preferred size of the context along with the max size and
use the smaller of the two.


Bug: 1054699
Change-Id: Ie3237d50bafd1b19dae9928b8d2c834dc37c9ba5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067081
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743492}
parent f1545e0e
......@@ -133,8 +133,9 @@ base::string16 PermissionPromptBubbleView::GetWindowTitle() const {
}
gfx::Size PermissionPromptBubbleView::CalculatePreferredSize() const {
const int width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_BUBBLE_PREFERRED_WIDTH);
const int width = std::min(views::View::CalculatePreferredSize().width(),
ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_BUBBLE_PREFERRED_WIDTH));
return gfx::Size(width, GetHeightForWidth(width));
}
......
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