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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 438 |
439 void RenderText::SetObscured(bool obscured) { | 439 void RenderText::SetObscured(bool obscured) { |
440 if (obscured != obscured_) { | 440 if (obscured != obscured_) { |
441 obscured_ = obscured; | 441 obscured_ = obscured; |
442 cached_bounds_and_offset_valid_ = false; | 442 cached_bounds_and_offset_valid_ = false; |
443 ResetLayout(); | 443 ResetLayout(); |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 void RenderText::SetDisplayRect(const Rect& r) { | 447 void RenderText::SetDisplayRect(const Rect& r) { |
448 if (r.width() != display_rect_.width()) | |
449 ResetLayout(); | |
450 display_rect_ = r; | 448 display_rect_ = r; |
451 cached_bounds_and_offset_valid_ = false; | 449 cached_bounds_and_offset_valid_ = false; |
452 } | 450 } |
453 | 451 |
454 void RenderText::SetCursorPosition(size_t position) { | 452 void RenderText::SetCursorPosition(size_t position) { |
455 MoveCursorTo(position, false); | 453 MoveCursorTo(position, false); |
456 } | 454 } |
457 | 455 |
458 void RenderText::MoveCursor(BreakType break_type, | 456 void RenderText::MoveCursor(BreakType break_type, |
459 VisualCursorDirection direction, | 457 VisualCursorDirection direction, |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 if (cursor_enabled() && cursor_visible() && focused()) { | 1007 if (cursor_enabled() && cursor_visible() && focused()) { |
1010 const Rect& bounds = GetUpdatedCursorBounds(); | 1008 const Rect& bounds = GetUpdatedCursorBounds(); |
1011 if (bounds.width() != 0) | 1009 if (bounds.width() != 0) |
1012 canvas->FillRect(bounds, cursor_color_); | 1010 canvas->FillRect(bounds, cursor_color_); |
1013 else | 1011 else |
1014 canvas->DrawRect(bounds, cursor_color_); | 1012 canvas->DrawRect(bounds, cursor_color_); |
1015 } | 1013 } |
1016 } | 1014 } |
1017 | 1015 |
1018 } // namespace gfx | 1016 } // namespace gfx |
OLD | NEW |