From 081021bcfa1685a26cb34f4c40117fc73a4fb80a Mon Sep 17 00:00:00 2001 From: "beng@google.com" Date: Wed, 13 May 2009 21:37:15 +0000 Subject: Fix some issues with the omnibox2 popup: - turn off transparency when glass isn't active - make transparency when glass is active more opaque - decrease the size of text to match the current omnibox popup - make dim text in highlighted rows invert. Review URL: http://codereview.chromium.org/113242 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16003 0039d316-1c4b-4281-b951-d872f2087c98 --- .../views/autocomplete/autocomplete_popup_contents_view.cc | 14 ++++++++++---- .../views/autocomplete/autocomplete_popup_contents_view.h | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index d62465f..61c6681 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -39,7 +39,8 @@ static const SkColor kSelectedDimTextColor = color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT); static const SkColor kStandardURLColor = SkColorSetRGB(0, 0x80, 0); static const SkColor kHighlightURLColor = SkColorSetRGB(0xD0, 0xFF, 0xD0); -static const int kPopupTransparency = 235; +static const int kGlassPopupTransparency = 240; +static const int kOpaquePopupTransparency = 255; static const int kHoverRowAlpha = 0x40; // The minimum distance between the top and bottom of the icon and the top or // bottom of the row. "Minimum" is used because the vertical padding may be @@ -56,6 +57,9 @@ static const int kRowRightPadding = 3; // The horizontal distance between the right edge of the icon and the left edge // of the text. static const int kIconTextSpacing = 9; +// The size delta between the font used for the edit and the result rows. Passed +// to ChromeFont::DeriveFont. +static const int kEditFontAdjust = -1; class AutocompleteResultView : public views::View { public: @@ -650,7 +654,7 @@ AutocompletePopupContentsView::AutocompletePopupContentsView( model_(new AutocompletePopupModel(this, edit_model, profile)), edit_view_(edit_view), popup_positioner_(popup_positioner), - edit_font_(font) { + result_font_(font.DeriveFont(kEditFontAdjust)) { set_border(new PopupBorder); } @@ -658,7 +662,7 @@ void AutocompletePopupContentsView::UpdateResultViewsFromResult( const AutocompleteResult& result) { RemoveAllChildViews(true); for (size_t i = 0; i < result.size(); ++i) - AddChildView(new AutocompleteResultView(this, i, edit_font_)); + AddChildView(new AutocompleteResultView(this, i, result_font_)); Layout(); } @@ -854,7 +858,9 @@ void AutocompletePopupContentsView::MakeCanvasTransparent( ChromeCanvas* canvas) { // Allow the window blur effect to show through the popup background. SkPaint paint; - paint.setColor(SkColorSetARGB(kPopupTransparency, 255, 255, 255)); + SkColor transparency = win_util::ShouldUseVistaFrame() ? + kGlassPopupTransparency : kOpaquePopupTransparency; + paint.setColor(SkColorSetARGB(transparency, 255, 255, 255)); paint.setPorterDuffXfermode(SkPorterDuff::kDstIn_Mode); paint.setStyle(SkPaint::kFill_Style); canvas->FillRectInt(0, 0, canvas->getDevice()->width(), diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h index 1f4b04a..6b39c79 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h @@ -99,9 +99,9 @@ class AutocompletePopupContentsView : public views::View, // An object that tells the popup how to position itself. AutocompletePopupPositioner* popup_positioner_; - // The font used by the edit that created us. This is used by the result - // views to synthesize a suitable display font. - ChromeFont edit_font_; + // The font that we should use for result rows. This is based on the font used + // by the edit that created us. + ChromeFont result_font_; DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); }; -- cgit v1.1