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

Side by Side Diff: ui/gfx/render_text.cc

Issue 10933129: Add RenderText::SetFont() function to simplify some call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/gfx/render_text.h ('k') | ui/gfx/render_text_unittest.cc » ('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/gfx/render_text.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/break_iterator.h" 9 #include "base/i18n/break_iterator.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 cached_bounds_and_offset_valid_ = false; 409 cached_bounds_and_offset_valid_ = false;
410 } 410 }
411 } 411 }
412 412
413 void RenderText::SetFontList(const FontList& font_list) { 413 void RenderText::SetFontList(const FontList& font_list) {
414 font_list_ = font_list; 414 font_list_ = font_list;
415 cached_bounds_and_offset_valid_ = false; 415 cached_bounds_and_offset_valid_ = false;
416 ResetLayout(); 416 ResetLayout();
417 } 417 }
418 418
419 void RenderText::SetFont(const Font& font) {
420 SetFontList(FontList(font));
421 }
422
419 void RenderText::SetFontSize(int size) { 423 void RenderText::SetFontSize(int size) {
420 font_list_ = font_list_.DeriveFontListWithSize(size); 424 font_list_ = font_list_.DeriveFontListWithSize(size);
421 cached_bounds_and_offset_valid_ = false; 425 cached_bounds_and_offset_valid_ = false;
422 ResetLayout(); 426 ResetLayout();
423 } 427 }
424 428
425 void RenderText::SetCursorEnabled(bool cursor_enabled) { 429 void RenderText::SetCursorEnabled(bool cursor_enabled) {
426 cursor_enabled_ = cursor_enabled; 430 cursor_enabled_ = cursor_enabled;
427 cached_bounds_and_offset_valid_ = false; 431 cached_bounds_and_offset_valid_ = false;
428 } 432 }
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 if (cursor_enabled() && cursor_visible() && focused()) { 1011 if (cursor_enabled() && cursor_visible() && focused()) {
1008 const Rect& bounds = GetUpdatedCursorBounds(); 1012 const Rect& bounds = GetUpdatedCursorBounds();
1009 if (bounds.width() != 0) 1013 if (bounds.width() != 0)
1010 canvas->FillRect(bounds, cursor_color_); 1014 canvas->FillRect(bounds, cursor_color_);
1011 else 1015 else
1012 canvas->DrawRect(bounds, cursor_color_); 1016 canvas->DrawRect(bounds, cursor_color_);
1013 } 1017 }
1014 } 1018 }
1015 1019
1016 } // namespace gfx 1020 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698