summaryrefslogtreecommitdiffstats
path: root/ui/app_list
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 04:42:17 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 04:42:17 +0000
commitccfa43f042db868f6584f9cceef94ca7c4ddf239 (patch)
treef3f3980981147928cae30754448f88d45527d2d0 /ui/app_list
parent8c49a50da6675ed9329b01a1e960c78e42d4ba82 (diff)
downloadchromium_src-ccfa43f042db868f6584f9cceef94ca7c4ddf239.zip
chromium_src-ccfa43f042db868f6584f9cceef94ca7c4ddf239.tar.gz
chromium_src-ccfa43f042db868f6584f9cceef94ca7c4ddf239.tar.bz2
Replace StyleRange with BreakList; update RenderText, etc.
This is a functional rewrite with no observable behavior/appearance changes. (it helps by merging adjacent equivalent styles, reducing artificial run breaks) (it helps disambiguate font/adornment styles for application in layout/drawing) Remove gfx::StyleRange and its use within gfx::RenderText[Win|Linux|Mac]. Add new BreakList class for managing [ranged] colors and styles; add/update tests. Add gfx::TextStyle enum for bold, italic, underline, strike, and diagonal strike. Split ApplyStyleRange into [Set|Apply]Color and [Set|Apply]Style. Split ApplyDefaultStyle and |default_style_| into the first colors_ and styles_. Split up SkiaTextRenderer::DrawDecorations for Underline/Strike/DiagonalStrike. Update ApplyCompositionAndSelectionStyles, add UndoCompositionAndSelectionStyles. Add temporary StyleIterator convenience class for RenderText subclass style iteration. Update RenderText[Win|Linux|Mac], Textfield classes, and other users. Simplify OmniboxResultView (nix bold font, and ClassificationData). Rename gfx::Font::FontStyle::UNDERLINE (was UNDERLINED); TODO(followup): Only break runs for bold/italic, color/adorn while drawing. TODO(followup): Support more custom/ranged colors; merge TextStyle/FontStyle? BUG=90426,164047,131660 TEST=No observable appearance/performance/behavior changes. R=asvitkine@chromium.org,pkasting@chromium.org,sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/11535014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180067 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/app_list')
-rw-r--r--ui/app_list/views/search_result_view.cc19
1 files changed, 5 insertions, 14 deletions
diff --git a/ui/app_list/views/search_result_view.cc b/ui/app_list/views/search_result_view.cc
index 47b9825..85caf54 100644
--- a/ui/app_list/views/search_result_view.cc
+++ b/ui/app_list/views/search_result_view.cc
@@ -64,11 +64,7 @@ gfx::RenderText* CreateRenderText(const string16& text,
const app_list::SearchResult::Tags& tags) {
gfx::RenderText* render_text = gfx::RenderText::CreateInstance();
render_text->SetText(text);
-
- gfx::StyleRange default_style;
- default_style.foreground = kDefaultTextColor;
- render_text->set_default_style(default_style);
- render_text->ApplyDefaultStyle();
+ render_text->SetColor(kDefaultTextColor);
for (app_list::SearchResult::Tags::const_iterator it = tags.begin();
it != tags.end();
@@ -77,17 +73,12 @@ gfx::RenderText* CreateRenderText(const string16& text,
if (it->styles == app_list::SearchResult::Tag::NONE)
continue;
- gfx::StyleRange style;
- style.range = it->range;
-
if (it->styles & app_list::SearchResult::Tag::MATCH)
- style.font_style = gfx::Font::BOLD;
- if (it->styles & app_list::SearchResult::Tag::URL)
- style.foreground = kURLTextColor;
+ render_text->ApplyStyle(gfx::BOLD, true, it->range);
if (it->styles & app_list::SearchResult::Tag::DIM)
- style.foreground = kDimmedTextColor;
-
- render_text->ApplyStyleRange(style);
+ render_text->ApplyColor(kDimmedTextColor, it->range);
+ else if (it->styles & app_list::SearchResult::Tag::URL)
+ render_text->ApplyColor(kURLTextColor, it->range);
}
return render_text;