| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 base::i18n::TextDirection RenderText::GetDisplayTextDirection() { | 764 base::i18n::TextDirection RenderText::GetDisplayTextDirection() { |
| 765 return GetTextDirection(GetDisplayText()); | 765 return GetTextDirection(GetDisplayText()); |
| 766 } | 766 } |
| 767 | 767 |
| 768 VisualCursorDirection RenderText::GetVisualDirectionOfLogicalEnd() { | 768 VisualCursorDirection RenderText::GetVisualDirectionOfLogicalEnd() { |
| 769 return GetDisplayTextDirection() == base::i18n::LEFT_TO_RIGHT ? | 769 return GetDisplayTextDirection() == base::i18n::LEFT_TO_RIGHT ? |
| 770 CURSOR_RIGHT : CURSOR_LEFT; | 770 CURSOR_RIGHT : CURSOR_LEFT; |
| 771 } | 771 } |
| 772 | 772 |
| 773 SizeF RenderText::GetStringSizeF() { | 773 SizeF RenderText::GetStringSizeF() { |
| 774 return GetStringSize(); | 774 return gfx::SizeF(GetStringSize()); |
| 775 } | 775 } |
| 776 | 776 |
| 777 float RenderText::GetContentWidthF() { | 777 float RenderText::GetContentWidthF() { |
| 778 const float string_size = GetStringSizeF().width(); | 778 const float string_size = GetStringSizeF().width(); |
| 779 // The cursor is drawn one pixel beyond the int-enclosed text bounds. | 779 // The cursor is drawn one pixel beyond the int-enclosed text bounds. |
| 780 return cursor_enabled_ ? std::ceil(string_size) + 1 : string_size; | 780 return cursor_enabled_ ? std::ceil(string_size) + 1 : string_size; |
| 781 } | 781 } |
| 782 | 782 |
| 783 int RenderText::GetContentWidth() { | 783 int RenderText::GetContentWidth() { |
| 784 return ToCeiledInt(GetContentWidthF()); | 784 return ToCeiledInt(GetContentWidthF()); |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 | 1516 |
| 1517 SetDisplayOffset(display_offset_.x() + delta_x); | 1517 SetDisplayOffset(display_offset_.x() + delta_x); |
| 1518 } | 1518 } |
| 1519 | 1519 |
| 1520 void RenderText::DrawSelection(Canvas* canvas) { | 1520 void RenderText::DrawSelection(Canvas* canvas) { |
| 1521 for (const Rect& s : GetSubstringBounds(selection())) | 1521 for (const Rect& s : GetSubstringBounds(selection())) |
| 1522 canvas->FillRect(s, selection_background_focused_color_); | 1522 canvas->FillRect(s, selection_background_focused_color_); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 } // namespace gfx | 1525 } // namespace gfx |
| OLD | NEW |