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

Unified Diff: ui/gfx/render_text.cc

Issue 8819001: Revert 113075 (requested by asvitkine) (requested by asvitkine) (requested by asvitkine) (request... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/render_text.h ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
===================================================================
--- ui/gfx/render_text.cc (revision 113082)
+++ ui/gfx/render_text.cc (working copy)
@@ -67,9 +67,8 @@
} else if (i->range.end() > new_range.end()) {
i->range.set_start(new_range.end());
break;
- } else {
+ } else
NOTREACHED();
- }
}
// Add the new range in its sorted location.
style_ranges->insert(i, style_range);
@@ -189,8 +188,8 @@
MoveCursorTo(position);
}
-bool RenderText::MoveCursorTo(const SelectionModel& model) {
- SelectionModel sel(model);
+bool RenderText::MoveCursorTo(const SelectionModel& selection_model) {
+ SelectionModel sel(selection_model);
size_t text_length = text().length();
// Enforce valid selection model components.
if (sel.selection_start() > text_length)
@@ -369,7 +368,7 @@
// binary searching the cursor position.
// TODO(oshima): use the center of character instead of edge.
// Binary search may not work for language like Arabic.
- while (std::abs(right_pos - left_pos) > 1) {
+ while (std::abs(static_cast<long>(right_pos - left_pos)) > 1) {
int pivot_pos = left_pos + (right_pos - left_pos) / 2;
int pivot = font.GetStringWidth(text().substr(0, pivot_pos));
if (pivot < x) {
@@ -431,7 +430,8 @@
BreakType break_type) {
if (break_type == LINE_BREAK)
return LeftEndSelectionModel();
- size_t pos = std::max<int>(current.selection_end() - 1, 0);
+ size_t pos = std::max(static_cast<long>(current.selection_end() - 1),
+ static_cast<long>(0));
if (break_type == CHARACTER_BREAK)
return SelectionModel(pos, pos, SelectionModel::LEADING);
@@ -505,7 +505,8 @@
selection_model_.set_selection_start(model.selection_start());
DCHECK_LE(model.selection_end(), text().length());
selection_model_.set_selection_end(model.selection_end());
- DCHECK_LT(model.caret_pos(), std::max<size_t>(text().length(), 1));
+ DCHECK_LT(model.caret_pos(),
+ std::max(text().length(), static_cast<size_t>(1)));
selection_model_.set_caret_pos(model.caret_pos());
selection_model_.set_caret_placement(model.caret_placement());
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698