diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-10 17:54:42 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-10 17:54:42 +0000 |
commit | 2da894c9f540654f4a169b1963974aadd187f260 (patch) | |
tree | 7dddfad4a78c6c05ee0797d281cea7d36eb8638d /ui/gfx/render_text.cc | |
parent | d3711cbf76f23cff553753bddfccf3956ba9ab75 (diff) | |
download | chromium_src-2da894c9f540654f4a169b1963974aadd187f260.zip chromium_src-2da894c9f540654f4a169b1963974aadd187f260.tar.gz chromium_src-2da894c9f540654f4a169b1963974aadd187f260.tar.bz2 |
Revert 113635 (speculative revert for bug 107104)
- Improve RenderTextWin font fallback.
Don't use SCRIPT_UNDEFINED in the case of font fallback,
unless font fallback actually fails to return a script
that can display the characters. This fixes the problem
of some scripts not being properly displayed.
This actually makes RenderTextWin properly validate whether
a text position accepts a cursor, which caused several tests
to fail and revealed some additional issues in RenderTextWin.
The CL includes some modifications to address this.
Some tests are disabled under XP, see:
http://crbug.com/106450
Also, fixes some lint warnings.
BUG=90426
TEST=Run chrome.exe --use-pure-views and paste some Bengali
text into the omnibox. It should show up properly.
Review URL: http://codereview.chromium.org/8575020
TBR=asvitkine@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text.cc')
-rw-r--r-- | ui/gfx/render_text.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc index 10e6590..1dbfb32 100644 --- a/ui/gfx/render_text.cc +++ b/ui/gfx/render_text.cc @@ -68,9 +68,8 @@ void ApplyStyleRangeImpl(gfx::StyleRanges* style_ranges, } 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); @@ -263,8 +262,8 @@ void RenderText::MoveCursorRight(BreakType break_type, bool select) { 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) @@ -443,7 +442,7 @@ SelectionModel RenderText::FindCursorPosition(const Point& point) { // 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) { @@ -505,7 +504,8 @@ SelectionModel RenderText::GetLeftSelectionModel(const SelectionModel& current, 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); @@ -579,7 +579,8 @@ void RenderText::SetSelectionModel(const SelectionModel& model) { 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()); |