diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 20:51:19 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 20:51:19 +0000 |
commit | a32bd2113f84e91c5d9d06aae77fae0c2e0dcc9b (patch) | |
tree | c8070d3d1315ddc5ca29de2be6015e811ed50fbf /views | |
parent | e27a5f5229ae9c5257569c1c8d0f632c115a5cd7 (diff) | |
download | chromium_src-a32bd2113f84e91c5d9d06aae77fae0c2e0dcc9b.zip chromium_src-a32bd2113f84e91c5d9d06aae77fae0c2e0dcc9b.tar.gz chromium_src-a32bd2113f84e91c5d9d06aae77fae0c2e0dcc9b.tar.bz2 |
Convert Label::GetFont() to unix_hacker style. Original patch by Thiago Farina (see http://codereview.chromium.org/1580002 ), r=me.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1528009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43136 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/checkbox.cc | 2 | ||||
-rw-r--r-- | views/controls/label.h | 3 | ||||
-rw-r--r-- | views/controls/label_unittest.cc | 4 | ||||
-rw-r--r-- | views/controls/link.cc | 14 |
4 files changed, 12 insertions, 11 deletions
diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index 65981a4..3b0b804 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -89,7 +89,7 @@ void Checkbox::Layout() { label_x, 0, std::max(0, width() - label_x - kLabelFocusPaddingHorizontal), height()); - int first_line_height = label_->GetFont().height(); + int first_line_height = label_->font().height(); native_wrapper_->GetView()->SetBounds( 0, ((first_line_height - checkmark_prefsize.height()) / 2), checkmark_prefsize.width(), checkmark_prefsize.height()); diff --git a/views/controls/label.h b/views/controls/label.h index e97d6ec..b2d890e 100644 --- a/views/controls/label.h +++ b/views/controls/label.h @@ -82,8 +82,7 @@ class Label : public View { void SetText(const std::wstring& text); // Return the font used by this label. - // TODO(pkasting): Convert to unix_hacker() style. - gfx::Font GetFont() const { return font_; } + gfx::Font font() const { return font_; } // Return the label text. const std::wstring GetText() const; diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc index ab4b1e9..5ea20b3 100644 --- a/views/controls/label_unittest.cc +++ b/views/controls/label_unittest.cc @@ -22,7 +22,7 @@ TEST(LabelTest, FontPropertyCourier) { std::wstring font_name(L"courier"); gfx::Font font = gfx::Font::CreateFont(font_name, 30); label.SetFont(font); - gfx::Font font_used = label.GetFont(); + gfx::Font font_used = label.font(); EXPECT_EQ(font_name, font_used.FontName()); EXPECT_EQ(30, font_used.FontSize()); } @@ -33,7 +33,7 @@ TEST(LabelTest, FontPropertyArial) { std::wstring font_name(L"arial"); gfx::Font font = gfx::Font::CreateFont(font_name, 30); label.SetFont(font); - gfx::Font font_used = label.GetFont(); + gfx::Font font_used = label.font(); EXPECT_EQ(font_name, font_used.FontName()); EXPECT_EQ(30, font_used.FontSize()); } diff --git a/views/controls/link.cc b/views/controls/link.cc index bf90fea..083870c 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -217,15 +217,17 @@ void Link::SetHighlighted(bool f) { } void Link::ValidateStyle() { - gfx::Font font = GetFont(); - if (enabled_) { - if ((font.style() & gfx::Font::UNDERLINED) == 0) - Label::SetFont(font.DeriveFont(0, font.style() | gfx::Font::UNDERLINED)); + if (!(font().style() & gfx::Font::UNDERLINED)) { + Label::SetFont( + font().DeriveFont(0, font().style() | gfx::Font::UNDERLINED)); + } Label::SetColor(highlighted_ ? highlighted_color_ : normal_color_); } else { - if ((font.style() & gfx::Font::UNDERLINED) != 0) - Label::SetFont(font.DeriveFont(0, font.style() & ~gfx::Font::UNDERLINED)); + if (font().style() & gfx::Font::UNDERLINED) { + Label::SetFont( + font().DeriveFont(0, font().style() & ~gfx::Font::UNDERLINED)); + } Label::SetColor(disabled_color_); } } |