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

Unified Diff: base/i18n/char_iterator.cc

Issue 23522018: RenderTextWin: Break runs between any two characters that are not in the same code block (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use CharIterator Created 7 years, 3 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
Index: base/i18n/char_iterator.cc
diff --git a/base/i18n/char_iterator.cc b/base/i18n/char_iterator.cc
index 25efc518694c0fd480253b82f9e55dd3b598d406..58d0652e2e19f81c59f3b53e4ba5f0e2efb95fb4 100644
--- a/base/i18n/char_iterator.cc
+++ b/base/i18n/char_iterator.cc
@@ -36,6 +36,12 @@ bool UTF8CharIterator::Advance() {
return true;
}
+void UTF8CharIterator::SetPosition(int32 position) {
+ U8_SET_CP_START(str_, position, array_pos_);
+ next_pos_ = array_pos_;
+ U8_NEXT(str_, next_pos_, len_, char_);
+}
+
UTF16CharIterator::UTF16CharIterator(const string16* str)
: str_(reinterpret_cast<const char16*>(str->data())),
len_(str->size()),
@@ -73,6 +79,13 @@ bool UTF16CharIterator::Advance() {
return true;
}
+void UTF16CharIterator::SetPosition(int32 position) {
+ array_pos_ = position;
+ U16_SET_CP_START(str_, 0, array_pos_);
+ next_pos_ = array_pos_;
+ ReadChar();
+}
+
void UTF16CharIterator::ReadChar() {
// This is actually a huge macro, so is worth having in a separate function.
U16_NEXT(str_, next_pos_, len_, char_);
« no previous file with comments | « base/i18n/char_iterator.h ('k') | ui/gfx/render_text_win.cc » ('j') | ui/gfx/render_text_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698