OLD | NEW |
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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 font_list_ = font_list; | 350 font_list_ = font_list; |
351 cached_bounds_and_offset_valid_ = false; | 351 cached_bounds_and_offset_valid_ = false; |
352 ResetLayout(); | 352 ResetLayout(); |
353 } | 353 } |
354 | 354 |
355 void RenderText::SetFont(const Font& font) { | 355 void RenderText::SetFont(const Font& font) { |
356 SetFontList(FontList(font)); | 356 SetFontList(FontList(font)); |
357 } | 357 } |
358 | 358 |
359 void RenderText::SetFontSize(int size) { | 359 void RenderText::SetFontSize(int size) { |
360 font_list_ = font_list_.DeriveFontListWithSize(size); | 360 SetFontList(font_list_.DeriveFontListWithSize(size)); |
361 cached_bounds_and_offset_valid_ = false; | |
362 ResetLayout(); | |
363 } | 361 } |
364 | 362 |
365 void RenderText::SetCursorEnabled(bool cursor_enabled) { | 363 void RenderText::SetCursorEnabled(bool cursor_enabled) { |
366 cursor_enabled_ = cursor_enabled; | 364 cursor_enabled_ = cursor_enabled; |
367 cached_bounds_and_offset_valid_ = false; | 365 cached_bounds_and_offset_valid_ = false; |
368 } | 366 } |
369 | 367 |
370 const Font& RenderText::GetFont() const { | 368 const Font& RenderText::GetFont() const { |
371 return font_list_.GetFonts()[0]; | 369 return font_list_.GetFonts()[0]; |
372 } | 370 } |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 cursor_bounds_ += delta_offset; | 1014 cursor_bounds_ += delta_offset; |
1017 } | 1015 } |
1018 | 1016 |
1019 void RenderText::DrawSelection(Canvas* canvas) { | 1017 void RenderText::DrawSelection(Canvas* canvas) { |
1020 const std::vector<Rect> sel = GetSubstringBounds(selection()); | 1018 const std::vector<Rect> sel = GetSubstringBounds(selection()); |
1021 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) | 1019 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) |
1022 canvas->FillRect(*i, selection_background_focused_color_); | 1020 canvas->FillRect(*i, selection_background_focused_color_); |
1023 } | 1021 } |
1024 | 1022 |
1025 } // namespace gfx | 1023 } // namespace gfx |
OLD | NEW |