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

Unified Diff: ui/gfx/render_text.cc

Issue 1671403002: Switch gfx::Range to use uint32_t instead of size_t. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/range/range.cc ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 1757575b32f7a5e094856d9c74d01ca199f9d3cc..4a5992444cb364b89b1ce7d0fc0471f97b6895b3 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -632,7 +632,8 @@ void RenderText::MoveCursor(BreakType break_type,
bool RenderText::MoveCursorTo(const SelectionModel& model) {
// Enforce valid selection model components.
size_t text_length = text().length();
- Range range(std::min(model.selection().start(), text_length),
+ Range range(std::min(model.selection().start(),
+ static_cast<uint32_t>(text_length)),
std::min(model.caret_pos(), text_length));
// The current model only supports caret positions at valid cursor indices.
if (!IsValidCursorIndex(range.start()) || !IsValidCursorIndex(range.end()))
@@ -644,8 +645,9 @@ bool RenderText::MoveCursorTo(const SelectionModel& model) {
}
bool RenderText::SelectRange(const Range& range) {
- Range sel(std::min(range.start(), text().length()),
- std::min(range.end(), text().length()));
+ uint32_t text_length = static_cast<uint32_t>(text().length());
+ Range sel(std::min(range.start(), text_length),
+ std::min(range.end(), text_length));
// Allow selection bounds at valid indicies amid multi-character graphemes.
if (!IsValidLogicalIndex(sel.start()) || !IsValidLogicalIndex(sel.end()))
return false;
« no previous file with comments | « ui/gfx/range/range.cc ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698