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