diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 02:27:17 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 02:27:17 +0000 |
commit | 077592dcf7750c927ca0cc14481fbf555b1eb229 (patch) | |
tree | 448b0a1edde016cbdf2ed34cfbfe448cda59bfd3 | |
parent | c45becf86d2f4f1ce09d31546fabb1765d97028a (diff) | |
download | chromium_src-077592dcf7750c927ca0cc14481fbf555b1eb229.zip chromium_src-077592dcf7750c927ca0cc14481fbf555b1eb229.tar.gz chromium_src-077592dcf7750c927ca0cc14481fbf555b1eb229.tar.bz2 |
Fit the Views high contrast bubble text to the width of its links.
Make the text only as wide as the links below.
Previously, the text was wider (fit to 500px).
The window can still be too thin and clip the bubble.
This just alleviates more cases in reasonable way.
See bubble/min-width pics at http://crbug.com/350508#c8
BUG=350508
R=dmazzoni@chromium.org
TEST=Switching Windows to a High-Contrast-Black theme with a thin browser window clips off less of the bubble (and can display the whole bubble more frequently).
Review URL: https://codereview.chromium.org/210363002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259105 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/views/accessibility/invert_bubble_view.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/ui/views/accessibility/invert_bubble_view.cc b/chrome/browser/ui/views/accessibility/invert_bubble_view.cc index 55d816b..07b7f26 100644 --- a/chrome/browser/ui/views/accessibility/invert_bubble_view.cc +++ b/chrome/browser/ui/views/accessibility/invert_bubble_view.cc @@ -31,7 +31,6 @@ const char kDarkThemeSearchUrl[] = "https://chrome.google.com/webstore/search-themes/dark"; const char kLearnMoreUrl[] = "https://groups.google.com/a/googleproductforums.com/d/topic/chrome/Xrco2HsXS-8/discussion"; -const int kBubbleWidth = 500; class InvertBubbleView : public views::BubbleDelegateView, public views::LinkListener { @@ -75,10 +74,8 @@ void InvertBubbleView::Init() { rb.GetFontList(ui::ResourceBundle::MediumFont); views::Label* title = new views::Label( - l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION), - original_font_list.Derive(2, gfx::Font::BOLD)); + base::string16(), original_font_list.Derive(2, gfx::Font::BOLD)); title->SetMultiLine(true); - title->SizeToFit(kBubbleWidth); learn_more_ = new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); learn_more_->SetFontList(original_font_list); @@ -89,8 +86,7 @@ void InvertBubbleView::Init() { high_contrast_->SetFontList(original_font_list); high_contrast_->set_listener(this); - dark_theme_ = - new views::Link(l10n_util::GetStringUTF16(IDS_DARK_THEME)); + dark_theme_ = new views::Link(l10n_util::GetStringUTF16(IDS_DARK_THEME)); dark_theme_->SetFontList(original_font_list); dark_theme_->set_listener(this); @@ -117,6 +113,11 @@ void InvertBubbleView::Init() { layout->AddView(learn_more_); layout->AddView(close_); + // Fit the message to the width of the links in the bubble. + const gfx::Size size(GetPreferredSize()); + title->SetText(l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION)); + title->SizeToFit(size.width()); + // Switching to high-contrast mode has a nasty habit of causing Chrome // top-level windows to lose focus, so closing the bubble on deactivate // makes it disappear before the user has even seen it. This forces the |