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

Side by Side 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, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ui_unittests.gypi ('k') | ui/views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/link.h" 5 #include "ui/views/controls/link.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (pressed_ != pressed) { 197 if (pressed_ != pressed) {
198 pressed_ = pressed; 198 pressed_ = pressed;
199 Label::SetEnabledColor(pressed_ ? 199 Label::SetEnabledColor(pressed_ ?
200 requested_pressed_color_ : requested_enabled_color_); 200 requested_pressed_color_ : requested_enabled_color_);
201 RecalculateFont(); 201 RecalculateFont();
202 SchedulePaint(); 202 SchedulePaint();
203 } 203 }
204 } 204 }
205 205
206 void Link::RecalculateFont() { 206 void Link::RecalculateFont() {
207 // The font should be underlined iff the link is enabled and |underline_| is 207 // Underline the link iff it is enabled and |underline_| is true.
208 // true. 208 const int style = font().GetStyle();
209 if ((enabled() && underline_) == 209 const int intended_style = (enabled() && underline_) ?
210 !(font().GetStyle() & gfx::Font::UNDERLINED)) { 210 (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE);
211 Label::SetFont(font().DeriveFont(0, enabled() && underline_ ? 211 if (style != intended_style)
212 (font().GetStyle() | gfx::Font::UNDERLINED) : 212 Label::SetFont(font().DeriveFont(0, intended_style));
213 (font().GetStyle() & ~gfx::Font::UNDERLINED)));
214 }
215 } 213 }
216 214
217 } // namespace views 215 } // namespace views
OLDNEW
« 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