| 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 #include <climits> | 8 #include <climits> |
| 9 | 9 |
| 10 #include "base/i18n/break_iterator.h" | 10 #include "base/i18n/break_iterator.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 void RenderText::SetFontList(const FontList& font_list) { | 385 void RenderText::SetFontList(const FontList& font_list) { |
| 386 font_list_ = font_list; | 386 font_list_ = font_list; |
| 387 baseline_ = kInvalidBaseline; | 387 baseline_ = kInvalidBaseline; |
| 388 cached_bounds_and_offset_valid_ = false; | 388 cached_bounds_and_offset_valid_ = false; |
| 389 ResetLayout(); | 389 ResetLayout(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void RenderText::SetFontSize(int size) { | |
| 393 SetFontList(font_list_.DeriveFontListWithSize(size)); | |
| 394 } | |
| 395 | |
| 396 void RenderText::SetCursorEnabled(bool cursor_enabled) { | 392 void RenderText::SetCursorEnabled(bool cursor_enabled) { |
| 397 cursor_enabled_ = cursor_enabled; | 393 cursor_enabled_ = cursor_enabled; |
| 398 cached_bounds_and_offset_valid_ = false; | 394 cached_bounds_and_offset_valid_ = false; |
| 399 } | 395 } |
| 400 | 396 |
| 401 void RenderText::ToggleInsertMode() { | 397 void RenderText::ToggleInsertMode() { |
| 402 insert_mode_ = !insert_mode_; | 398 insert_mode_ = !insert_mode_; |
| 403 cached_bounds_and_offset_valid_ = false; | 399 cached_bounds_and_offset_valid_ = false; |
| 404 } | 400 } |
| 405 | 401 |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 cursor_bounds_ += delta_offset; | 1272 cursor_bounds_ += delta_offset; |
| 1277 } | 1273 } |
| 1278 | 1274 |
| 1279 void RenderText::DrawSelection(Canvas* canvas) { | 1275 void RenderText::DrawSelection(Canvas* canvas) { |
| 1280 const std::vector<Rect> sel = GetSubstringBounds(selection()); | 1276 const std::vector<Rect> sel = GetSubstringBounds(selection()); |
| 1281 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) | 1277 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) |
| 1282 canvas->FillRect(*i, selection_background_focused_color_); | 1278 canvas->FillRect(*i, selection_background_focused_color_); |
| 1283 } | 1279 } |
| 1284 | 1280 |
| 1285 } // namespace gfx | 1281 } // namespace gfx |
| OLD | NEW |