summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-29 05:11:00 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-29 05:11:00 +0000
commitca68883a7ecaeee14e48a478065efb278988d0a3 (patch)
tree16a6a29d3d124bde30a6a0e08ea1fd25aff4b25b
parentd14954e8faefd5bcb453ec13709dc5d4f143021a (diff)
downloadchromium_src-ca68883a7ecaeee14e48a478065efb278988d0a3.zip
chromium_src-ca68883a7ecaeee14e48a478065efb278988d0a3.tar.gz
chromium_src-ca68883a7ecaeee14e48a478065efb278988d0a3.tar.bz2
Reverting 14826.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14828 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/app/theme/o2_globe_selected.pngbin2987 -> 0 bytes
-rw-r--r--chrome/app/theme/o2_history_selected.pngbin2932 -> 0 bytes
-rw-r--r--chrome/app/theme/o2_more_selected.pngbin2927 -> 0 bytes
-rw-r--r--chrome/app/theme/o2_search_selected.pngbin2927 -> 0 bytes
-rw-r--r--chrome/app/theme/o2_star_selected.pngbin2985 -> 0 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd5
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc135
8 files changed, 40 insertions, 103 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index fe7a9ef..3930270 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -200,9 +200,6 @@ each locale. -->
<message name="IDS_AUTOCOMPLETE_NO_QUERY" desc="Dummy search term displayed when the user has no query input.">
&lt;enter query&gt;
</message>
- <message name="IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR" desc="The separator between a result in the autocomplete popup and its description.">
- ''' - '''
- </message>
<message name="IDS_HISTORY_TITLE" desc="Title for the history tab.">
History
diff --git a/chrome/app/theme/o2_globe_selected.png b/chrome/app/theme/o2_globe_selected.png
deleted file mode 100644
index 70617cd..0000000
--- a/chrome/app/theme/o2_globe_selected.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/o2_history_selected.png b/chrome/app/theme/o2_history_selected.png
deleted file mode 100644
index 9a2502b..0000000
--- a/chrome/app/theme/o2_history_selected.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/o2_more_selected.png b/chrome/app/theme/o2_more_selected.png
deleted file mode 100644
index bb9616c..0000000
--- a/chrome/app/theme/o2_more_selected.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/o2_search_selected.png b/chrome/app/theme/o2_search_selected.png
deleted file mode 100644
index 4727ab6e..0000000
--- a/chrome/app/theme/o2_search_selected.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/o2_star_selected.png b/chrome/app/theme/o2_star_selected.png
deleted file mode 100644
index 3e84497..0000000
--- a/chrome/app/theme/o2_star_selected.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 6888bad..deff5fc 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -324,11 +324,6 @@
<include name="IDR_O2_MORE" file="o2_more.png" type="BINDATA" />
<include name="IDR_O2_SEARCH" file="o2_search.png" type="BINDATA" />
<include name="IDR_O2_STAR" file="o2_star.png" type="BINDATA" />
- <include name="IDR_O2_GLOBE_SELECTED" file="o2_globe_selected.png" type="BINDATA" />
- <include name="IDR_O2_HISTORY_SELECTED" file="o2_history_selected.png" type="BINDATA" />
- <include name="IDR_O2_MORE_SELECTED" file="o2_more_selected.png" type="BINDATA" />
- <include name="IDR_O2_SEARCH_SELECTED" file="o2_search_selected.png" type="BINDATA" />
- <include name="IDR_O2_STAR_SELECTED" file="o2_star_selected.png" type="BINDATA" />
<include name="IDR_CLOSED_WINDOW" file="closed_window.png" type="BINDATA" />
<if expr="pp_ifdef('_google_chrome')">
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
index dd7a117..54203c9 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -15,28 +15,12 @@
#include "chrome/common/gfx/path.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
-#include "chrome/common/win_util.h"
#include "chrome/views/widget/widget.h"
-#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "skia/include/SkShader.h"
#include "third_party/icu38/public/common/unicode/ubidi.h"
-// Colors for various components of the view.
-static const SkColor kBackgroundColor =
- color_utils::GetSysSkColor(COLOR_WINDOW);
-static const SkColor kSelectedBackgroundColor =
- color_utils::GetSysSkColor(COLOR_HIGHLIGHT);
-static const SkColor kHoverBackgroundColor =
- SkColorSetA(kSelectedBackgroundColor, 127);
-static const SkColor kTextColor =
- color_utils::GetSysSkColor(COLOR_WINDOWTEXT);
-static const SkColor kSelectedTextColor =
- color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT);
-static const SkColor kDimTextColor =
- color_utils::GetSysSkColor(COLOR_GRAYTEXT);
-static const SkColor kSelectedDimTextColor =
- color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT);
+static const SkColor kTransparentColor = SkColorSetARGB(0, 0, 0, 0);
static const SkColor kStandardURLColor = SkColorSetRGB(0, 0x80, 0);
static const SkColor kHighlightURLColor = SkColorSetRGB(0xD0, 0xFF, 0xD0);
static const int kPopupTransparency = 235;
@@ -83,18 +67,14 @@ class AutocompleteResultView : public views::View {
SkBitmap* GetIcon() const;
// Draws the specified |text| into the canvas, using highlighting provided by
- // |classifications|. If |force_dim| is true, ACMatchClassification::DIM is
- // added to all of the classifications. Returns the x position to the right
- // of the string.
- int DrawString(ChromeCanvas* canvas,
+ // |classifications|.
+ void DrawString(ChromeCanvas* canvas,
const std::wstring& text,
const ACMatchClassifications& classifications,
- bool force_dim,
int x,
int y);
- // Draws an individual sub-fragment with the specified style. Returns the x
- // position to the right of the fragment.
+ // Draws an individual sub-fragment with the specified style.
int DrawStringFragment(ChromeCanvas* canvas,
const std::wstring& text,
int style,
@@ -125,17 +105,12 @@ class AutocompleteResultView : public views::View {
// Icons for rows.
static SkBitmap* icon_url_;
- static SkBitmap* icon_url_selected_;
static SkBitmap* icon_history_;
- static SkBitmap* icon_history_selected_;
static SkBitmap* icon_search_;
- static SkBitmap* icon_search_selected_;
static SkBitmap* icon_more_;
- static SkBitmap* icon_more_selected_;
static SkBitmap* icon_star_;
- static SkBitmap* icon_star_selected_;
static int icon_size_;
-
+
static bool initialized_;
static void InitClass();
@@ -144,15 +119,10 @@ class AutocompleteResultView : public views::View {
// static
SkBitmap* AutocompleteResultView::icon_url_ = NULL;
-SkBitmap* AutocompleteResultView::icon_url_selected_ = NULL;
SkBitmap* AutocompleteResultView::icon_history_ = NULL;
-SkBitmap* AutocompleteResultView::icon_history_selected_ = NULL;
SkBitmap* AutocompleteResultView::icon_search_ = NULL;
-SkBitmap* AutocompleteResultView::icon_search_selected_ = NULL;
SkBitmap* AutocompleteResultView::icon_star_ = NULL;
-SkBitmap* AutocompleteResultView::icon_star_selected_ = NULL;
SkBitmap* AutocompleteResultView::icon_more_ = NULL;
-SkBitmap* AutocompleteResultView::icon_more_selected_ = NULL;
int AutocompleteResultView::icon_size_ = 0;
bool AutocompleteResultView::initialized_ = false;
@@ -220,31 +190,16 @@ AutocompleteResultView::~AutocompleteResultView() {
void AutocompleteResultView::Paint(ChromeCanvas* canvas) {
canvas->FillRectInt(GetBackgroundColor(), 0, 0, width(), height());
- int x = MirroredLeftPointForRect(icon_bounds_);
-
// Paint the icon.
- canvas->DrawBitmapInt(*GetIcon(), x, icon_bounds_.y());
-
- const AutocompleteMatch& match = model_->GetMatchAtIndex(model_index_);
+ canvas->DrawBitmapInt(*GetIcon(), icon_bounds_.x(), icon_bounds_.y());
// Paint the text.
- x = MirroredLeftPointForRect(text_bounds_);
- x = DrawString(canvas, match.contents, match.contents_class, false, x,
- text_bounds_.y());
+ const AutocompleteMatch& match = model_->GetMatchAtIndex(model_index_);
+ DrawString(canvas, match.contents, match.contents_class,
+ text_bounds_.x(), text_bounds_.y());
// Paint the description.
- if (!match.description.empty()) {
- std::wstring separator =
- l10n_util::GetString(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR);
- ACMatchClassifications classifications;
- classifications.push_back(
- ACMatchClassification(0, ACMatchClassification::NONE));
- x = DrawString(canvas, separator, classifications, true, x,
- text_bounds_.y());
-
- x = DrawString(canvas, match.description, match.description_class, true, x,
- text_bounds_.y());
- }
+ // TODO(beng): do this.
}
void AutocompleteResultView::Layout() {
@@ -307,33 +262,38 @@ bool AutocompleteResultView::OnMouseDragged(const views::MouseEvent& event) {
SkColor AutocompleteResultView::GetBackgroundColor() const {
if (model_->IsSelectedIndex(model_index_))
- return kSelectedBackgroundColor;
- return hot_ ? kHoverBackgroundColor : kBackgroundColor;
+ return color_utils::GetSysSkColor(COLOR_HIGHLIGHT);
+ if (hot_) {
+ COLORREF color = GetSysColor(COLOR_HIGHLIGHT);
+ return SkColorSetARGB(kHoverRowAlpha, GetRValue(color), GetGValue(color),
+ GetBValue(color));
+ }
+ return kTransparentColor;
}
SkColor AutocompleteResultView::GetTextColor() const {
- return model_->IsSelectedIndex(model_index_) ? kSelectedTextColor
- : kTextColor;
+ if (model_->IsSelectedIndex(model_index_))
+ return color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT);
+ return color_utils::GetSysSkColor(COLOR_WINDOWTEXT);
}
SkBitmap* AutocompleteResultView::GetIcon() const {
- bool selected = model_->IsSelectedIndex(model_index_);
switch (model_->GetMatchAtIndex(model_index_).type) {
case AutocompleteMatch::URL_WHAT_YOU_TYPED:
case AutocompleteMatch::HISTORY_URL:
case AutocompleteMatch::NAVSUGGEST:
- return selected ? icon_url_selected_ : icon_url_;
+ return icon_url_;
case AutocompleteMatch::HISTORY_TITLE:
case AutocompleteMatch::HISTORY_BODY:
case AutocompleteMatch::HISTORY_KEYWORD:
- return selected ? icon_history_selected_ : icon_history_;
+ return icon_history_;
case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED:
case AutocompleteMatch::SEARCH_HISTORY:
case AutocompleteMatch::SEARCH_SUGGEST:
case AutocompleteMatch::SEARCH_OTHER_ENGINE:
- return selected ? icon_search_selected_ : icon_search_;
+ return icon_search_;
case AutocompleteMatch::OPEN_HISTORY_PAGE:
- return selected ? icon_more_selected_ : icon_more_;
+ return icon_more_;
default:
NOTREACHED();
break;
@@ -341,15 +301,14 @@ SkBitmap* AutocompleteResultView::GetIcon() const {
return NULL;
}
-int AutocompleteResultView::DrawString(
+void AutocompleteResultView::DrawString(
ChromeCanvas* canvas,
const std::wstring& text,
const ACMatchClassifications& classifications,
- bool force_dim,
int x,
int y) {
if (!text.length())
- return x;
+ return;
// Check whether or not this text is a URL string.
// A URL string is basically in English with possible included words in
@@ -367,7 +326,7 @@ int AutocompleteResultView::DrawString(
// display direction and should be displayed at once.)
l10n_util::BiDiLineIterator bidi_line;
if (!bidi_line.Open(text, mirroring_context_->enabled(), url))
- return x;
+ return;
const int runs = bidi_line.CountRuns();
// Draw the visual runs.
@@ -411,15 +370,11 @@ int AutocompleteResultView::DrawString(
const int text_start = std::max(run_start, static_cast<int>(i->offset));
const int text_end = std::min(run_end, (i != classifications.end() - 1) ?
static_cast<int>((i + 1)->offset) : run_end);
- int style = i->style;
- if (force_dim)
- style |= ACMatchClassification::DIM;
x += DrawStringFragment(canvas,
text.substr(text_start, text_end - text_start),
- style, x, y);
+ i->style, x, y);
}
}
- return x;
}
int AutocompleteResultView::DrawStringFragment(
@@ -443,15 +398,16 @@ ChromeFont AutocompleteResultView::GetFragmentFont(int style) const {
}
SkColor AutocompleteResultView::GetFragmentTextColor(int style) const {
- bool selected = model_->IsSelectedIndex(model_index_);
if (style & ACMatchClassification::URL) {
// TODO(beng): bring over the contrast logic from the old popup and massage
// these values. See autocomplete_popup_view_win.cc and
// LuminosityContrast etc.
- return selected ? kHighlightURLColor : kStandardURLColor;
+ return model_->IsSelectedIndex(model_index_) ? kHighlightURLColor
+ : kStandardURLColor;
}
+
if (style & ACMatchClassification::DIM)
- return selected ? kSelectedDimTextColor : kDimTextColor;
+ return SkColorSetA(GetTextColor(), 0xAA);
return GetTextColor();
}
@@ -459,15 +415,10 @@ void AutocompleteResultView::InitClass() {
if (!initialized_) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
icon_url_ = rb.GetBitmapNamed(IDR_O2_GLOBE);
- icon_url_selected_ = rb.GetBitmapNamed(IDR_O2_GLOBE_SELECTED);
icon_history_ = rb.GetBitmapNamed(IDR_O2_HISTORY);
- icon_history_selected_ = rb.GetBitmapNamed(IDR_O2_HISTORY_SELECTED);
icon_search_ = rb.GetBitmapNamed(IDR_O2_SEARCH);
- icon_search_selected_ = rb.GetBitmapNamed(IDR_O2_SEARCH_SELECTED);
icon_star_ = rb.GetBitmapNamed(IDR_O2_STAR);
- icon_star_selected_ = rb.GetBitmapNamed(IDR_O2_STAR_SELECTED);
icon_more_ = rb.GetBitmapNamed(IDR_O2_MORE);
- icon_more_selected_ = rb.GetBitmapNamed(IDR_O2_MORE_SELECTED);
// All icons are assumed to be square, and the same size.
icon_size_ = icon_url_->width();
initialized_ = true;
@@ -594,11 +545,6 @@ void AutocompletePopupContentsView::UpdateResultViewsFromResult(
RemoveAllChildViews(true);
for (size_t i = 0; i < result.size(); ++i)
AddChildView(new AutocompleteResultView(this, i, edit_font_));
-
- // Need to schedule a paint here because if we don't and our result count
- // hasn't changed since last time we were shown, we may not repaint to
- // show selection changes.
- SchedulePaint();
}
gfx::Rect AutocompletePopupContentsView::GetPopupBounds() const {
@@ -703,8 +649,11 @@ void AutocompletePopupContentsView::PaintChildren(ChromeCanvas* canvas) {
// Instead, we paint all our children into a second canvas and use that as a
// shader to fill a path representing the round-rect clipping region. This
// yields a nice anti-aliased edge.
- ChromeCanvas contents_canvas(width(), height(), true);
- contents_canvas.FillRectInt(kBackgroundColor, 0, 0, width(), height());
+ gfx::Rect contents_rect = GetLocalBounds(false);
+ ChromeCanvas contents_canvas(contents_rect.width(), contents_rect.height(),
+ true);
+ contents_canvas.FillRectInt(color_utils::GetSysSkColor(COLOR_WINDOW), 0, 0,
+ contents_rect.width(), contents_rect.height());
View::PaintChildren(&contents_canvas);
// We want the contents background to be slightly transparent so we can see
// the blurry glass effect on DWM systems behind. We do this _after_ we paint
@@ -718,13 +667,13 @@ void AutocompletePopupContentsView::PaintChildren(ChromeCanvas* canvas) {
SkShader* shader = SkShader::CreateBitmapShader(
contents_canvas.getDevice()->accessBitmap(false),
- SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode);
+ SkShader::kClamp_TileMode,
+ SkShader::kClamp_TileMode);
paint.setShader(shader);
shader->unref();
gfx::Path path;
- MakeContentsPath(&path, GetLocalBounds(false));
+ MakeContentsPath(&path, contents_rect);
canvas->drawPath(path, paint);
}
@@ -764,10 +713,6 @@ void AutocompletePopupContentsView::MakeContentsPath(
}
void AutocompletePopupContentsView::UpdateBlurRegion() {
- // We only support background blurring on Vista with Aero-Glass enabled.
- if (!win_util::ShouldUseVistaFrame())
- return;
-
// Provide a blurred background effect within the contents region of the
// popup.
DWM_BLURBEHIND bb = {0};