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

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: Simplify OmniboxResultView; Rename StyleBreak; cleanup. 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 unified diff | Download patch | Annotate | Revision Log
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 // Set an underline iff the link is enabled and |underline_| is true.
208 // true. 208 if ((enabled() && underline_) != (font().GetStyle() & gfx::Font::UNDERLINE)) {
Alexei Svitkine (slow) 2013/01/22 19:20:21 This is not correct. The result of (font().GetSty
msw 2013/01/22 22:27:24 Adjusted, thanks for the catch (worked trivially i
209 if ((enabled() && underline_) ==
210 !(font().GetStyle() & gfx::Font::UNDERLINED)) {
211 Label::SetFont(font().DeriveFont(0, enabled() && underline_ ? 209 Label::SetFont(font().DeriveFont(0, enabled() && underline_ ?
212 (font().GetStyle() | gfx::Font::UNDERLINED) : 210 (font().GetStyle() | gfx::Font::UNDERLINE) :
213 (font().GetStyle() & ~gfx::Font::UNDERLINED))); 211 (font().GetStyle() & ~gfx::Font::UNDERLINE)));
214 } 212 }
215 } 213 }
216 214
217 } // namespace views 215 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698