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

Unified Diff: trunk/src/ui/gfx/font_list.cc

Issue 19270002: This caused failures in ui_unittests FontListTest.Fonts_GetHeight_GetBaseline (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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 | « trunk/src/ui/gfx/font_list.h ('k') | trunk/src/ui/gfx/font_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ui/gfx/font_list.cc
===================================================================
--- trunk/src/ui/gfx/font_list.cc (revision 211668)
+++ trunk/src/ui/gfx/font_list.cc (working copy)
@@ -69,21 +69,19 @@
namespace gfx {
-FontList::FontList() : common_height_(-1), common_baseline_(-1) {
+FontList::FontList() {
fonts_.push_back(Font());
}
FontList::FontList(const std::string& font_description_string)
- : font_description_string_(font_description_string),
- common_height_(-1),
- common_baseline_(-1) {
+ : font_description_string_(font_description_string) {
DCHECK(!font_description_string.empty());
// DCHECK description string ends with "px" for size in pixel.
DCHECK(EndsWith(font_description_string, "px", true));
}
FontList::FontList(const std::vector<Font>& fonts)
- : fonts_(fonts), common_height_(-1), common_baseline_(-1) {
+ : fonts_(fonts) {
DCHECK(!fonts.empty());
if (DCHECK_IS_ON()) {
int style = fonts[0].GetStyle();
@@ -95,8 +93,7 @@
}
}
-FontList::FontList(const Font& font)
- : common_height_(-1), common_baseline_(-1) {
+FontList::FontList(const Font& font) {
fonts_.push_back(font);
}
@@ -149,34 +146,6 @@
return FontList(BuildFontDescription(font_names, font_style, size));
}
-int FontList::GetHeight() const {
- if (common_height_ < 0) {
- int ascent = 0;
- int descent = 0;
- const std::vector<Font>& fonts = GetFonts();
- for (std::vector<Font>::const_iterator i = fonts.begin();
- i != fonts.end(); ++i) {
- ascent = std::max(ascent, i->GetBaseline());
- descent = std::max(descent, i->GetHeight() - i->GetBaseline());
- }
- common_height_ = ascent + descent;
- }
- return common_height_;
-}
-
-int FontList::GetBaseline() const {
- if (common_baseline_ < 0) {
- int baseline = 0;
- const std::vector<Font>& fonts = GetFonts();
- for (std::vector<Font>::const_iterator i = fonts.begin();
- i != fonts.end(); ++i) {
- baseline = std::max(baseline, i->GetBaseline());
- }
- common_baseline_ = baseline;
- }
- return common_baseline_;
-}
-
int FontList::GetFontStyle() const {
if (!fonts_.empty())
return fonts_[0].GetStyle();
« no previous file with comments | « trunk/src/ui/gfx/font_list.h ('k') | trunk/src/ui/gfx/font_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698