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

Unified Diff: ui/views/controls/link.cc

Issue 11535014: Replace StyleRange with BreakList; update RenderText, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 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/ui_unittests.gypi ('k') | ui/views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/link.cc
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index 04c83ac3af628bce83147af1514656a4ca576ae8..94aaa60730029cb80f276d780ece2e40d7e5f7db 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -204,14 +204,12 @@ void Link::SetPressed(bool pressed) {
}
void Link::RecalculateFont() {
- // The font should be underlined iff the link is enabled and |underline_| is
- // true.
- if ((enabled() && underline_) ==
- !(font().GetStyle() & gfx::Font::UNDERLINED)) {
- Label::SetFont(font().DeriveFont(0, enabled() && underline_ ?
- (font().GetStyle() | gfx::Font::UNDERLINED) :
- (font().GetStyle() & ~gfx::Font::UNDERLINED)));
- }
+ // Underline the link iff it is enabled and |underline_| is true.
+ const int style = font().GetStyle();
+ const int intended_style = (enabled() && underline_) ?
+ (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE);
+ if (style != intended_style)
+ Label::SetFont(font().DeriveFont(0, intended_style));
}
} // namespace views
« no previous file with comments | « ui/ui_unittests.gypi ('k') | ui/views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698