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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 1130683005: Nix Windows-specific textfield move-by-word behavior; enable tests. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 32a9e554f60b47127cef9d426aef71a9f410adfa..e83b0a1f0b5d94e810603eb1f5424ac6719ff268 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -842,41 +842,6 @@ SelectionModel RenderTextHarfBuzz::AdjacentWordSelectionModel(
if (!success)
return selection;
- // Match OS specific word break behavior.
-#if defined(OS_WIN)
- size_t pos;
- if (direction == CURSOR_RIGHT) {
- pos = std::min(selection.caret_pos() + 1, text().length());
- while (iter.Advance()) {
- pos = iter.pos();
- if (iter.IsWord() && pos > selection.caret_pos())
- break;
- }
- } else { // direction == CURSOR_LEFT
- // Notes: We always iterate words from the beginning.
- // This is probably fast enough for our usage, but we may
- // want to modify WordIterator so that it can start from the
- // middle of string and advance backwards.
- pos = std::max<int>(selection.caret_pos() - 1, 0);
- while (iter.Advance()) {
- if (iter.IsWord()) {
- size_t begin = iter.pos() - iter.GetString().length();
- if (begin == selection.caret_pos()) {
- // The cursor is at the beginning of a word.
- // Move to previous word.
- break;
- } else if (iter.pos() >= selection.caret_pos()) {
- // The cursor is in the middle or at the end of a word.
- // Move to the top of current word.
- pos = begin;
- break;
- }
- pos = iter.pos() - iter.GetString().length();
- }
- }
- }
- return SelectionModel(pos, CURSOR_FORWARD);
-#else
internal::TextRunList* run_list = GetRunList();
SelectionModel cur(selection);
for (;;) {
@@ -891,7 +856,6 @@ SelectionModel RenderTextHarfBuzz::AdjacentWordSelectionModel(
break;
}
return cur;
-#endif
}
std::vector<Rect> RenderTextHarfBuzz::GetSubstringBounds(const Range& range) {
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698