Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: ui/gfx/font_list.cc

Issue 142523003: Renames gfx::FontList::Derive* family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/font_list.h ('k') | ui/gfx/font_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_list.cc
diff --git a/ui/gfx/font_list.cc b/ui/gfx/font_list.cc
index bb4c954227e88df8bb5e15dbb1404d1a98fc235d..e2e57e72ec769834bf1751da11583a1d05a2226d 100644
--- a/ui/gfx/font_list.cc
+++ b/ui/gfx/font_list.cc
@@ -173,27 +173,12 @@ void FontList::SetDefaultFontDescription(const std::string& font_description) {
g_default_font_list = NULL;
}
-FontList FontList::DeriveFontList(int font_style) const {
- return DeriveFontListWithSizeDeltaAndStyle(0, font_style);
-}
-
-FontList FontList::DeriveFontListWithSize(int size) const {
- DCHECK_GT(size, 0);
- return DeriveFontListWithSizeDeltaAndStyle(size - GetFontSize(),
- GetFontStyle());
-}
-
-FontList FontList::DeriveFontListWithSizeDelta(int size_delta) const {
- return DeriveFontListWithSizeDeltaAndStyle(size_delta, GetFontStyle());
-}
-
-FontList FontList::DeriveFontListWithSizeDeltaAndStyle(int size_delta,
- int style) const {
+FontList FontList::Derive(int size_delta, int font_style) const {
// If there is a font vector, derive from that.
if (!fonts_.empty()) {
std::vector<Font> fonts = fonts_;
for (size_t i = 0; i < fonts.size(); ++i)
- fonts[i] = fonts[i].DeriveFont(size_delta, style);
+ fonts[i] = fonts[i].DeriveFont(size_delta, font_style);
return FontList(fonts);
}
@@ -203,9 +188,25 @@ FontList FontList::DeriveFontListWithSizeDeltaAndStyle(int size_delta,
int old_style;
ParseFontDescriptionString(font_description_string_, &font_names,
&old_style, &old_size);
- int size = old_size + size_delta;
- DCHECK_GT(size, 0);
- return FontList(font_names, style, size);
+ const int size = std::max(1, old_size + size_delta);
+ return FontList(font_names, font_style, size);
+}
+
+FontList FontList::DeriveWithSizeDelta(int size_delta) const {
+ return Derive(size_delta, GetFontStyle());
+}
+
+FontList FontList::DeriveWithStyle(int font_style) const {
+ return Derive(0, font_style);
+}
+
+FontList FontList::DeriveFontListWithSizeDelta(int size_delta) const {
+ return Derive(size_delta, GetFontStyle());
+}
+
+FontList FontList::DeriveFontListWithSizeDeltaAndStyle(int size_delta,
+ int font_style) const {
+ return Derive(size_delta, font_style);
}
int FontList::GetHeight() const {
« no previous file with comments | « ui/gfx/font_list.h ('k') | ui/gfx/font_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698