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

Unified Diff: base/i18n/break_iterator.cc

Issue 351963002: RenderTextHarfBuzz: Allow mid-glyph cursors in multi-grapheme clusters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fix Created 6 years, 5 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 | « base/i18n/break_iterator.h ('k') | ui/gfx/render_text_harfbuzz.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/break_iterator.cc
diff --git a/base/i18n/break_iterator.cc b/base/i18n/break_iterator.cc
index 8788eb7f1ba757d4614d4a3ee3e47d2d7875be30..89b1d0f1b8071be2a2da7d63fc783ca6638cd305 100644
--- a/base/i18n/break_iterator.cc
+++ b/base/i18n/break_iterator.cc
@@ -138,13 +138,13 @@ bool BreakIterator::SetText(const base::char16* text, const size_t length) {
bool BreakIterator::IsWord() const {
int32_t status = ubrk_getRuleStatus(static_cast<UBreakIterator*>(iter_));
if (break_type_ != BREAK_WORD && break_type_ != RULE_BASED)
- return false;
+ return false;
return status != UBRK_WORD_NONE;
}
bool BreakIterator::IsEndOfWord(size_t position) const {
if (break_type_ != BREAK_WORD && break_type_ != RULE_BASED)
- return false;
+ return false;
UBreakIterator* iter = static_cast<UBreakIterator*>(iter_);
UBool boundary = ubrk_isBoundary(iter, static_cast<int32_t>(position));
@@ -154,7 +154,7 @@ bool BreakIterator::IsEndOfWord(size_t position) const {
bool BreakIterator::IsStartOfWord(size_t position) const {
if (break_type_ != BREAK_WORD && break_type_ != RULE_BASED)
- return false;
+ return false;
UBreakIterator* iter = static_cast<UBreakIterator*>(iter_);
UBool boundary = ubrk_isBoundary(iter, static_cast<int32_t>(position));
@@ -163,6 +163,14 @@ bool BreakIterator::IsStartOfWord(size_t position) const {
return (!!boundary && next_status != UBRK_WORD_NONE);
}
+bool BreakIterator::IsGraphemeBoundary(size_t position) const {
+ if (break_type_ != BREAK_CHARACTER)
+ return false;
+
+ UBreakIterator* iter = static_cast<UBreakIterator*>(iter_);
+ return !!ubrk_isBoundary(iter, static_cast<int32_t>(position));
+}
+
string16 BreakIterator::GetString() const {
DCHECK(prev_ != npos && pos_ != npos);
return string_.substr(prev_, pos_ - prev_);
« no previous file with comments | « base/i18n/break_iterator.h ('k') | ui/gfx/render_text_harfbuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698