diff options
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_); } } |