Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: ui/gfx/render_text.cc

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/platform_font_mac.mm ('k') | ui/gfx/screen_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/platform_font_mac.mm ('k') | ui/gfx/screen_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698