зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1728708 Part 2 - Rename WordBreaker::NextWord() to WordBreaker::Next(). r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D124302
This commit is contained in:
Родитель
1083821003
Коммит
69a841c529
|
@ -180,8 +180,7 @@ WordRange WordBreaker::FindWord(const char16_t* aText, uint32_t aTextLen,
|
|||
return range;
|
||||
}
|
||||
|
||||
int32_t WordBreaker::NextWord(const char16_t* aText, uint32_t aLen,
|
||||
uint32_t aPos) {
|
||||
int32_t WordBreaker::Next(const char16_t* aText, uint32_t aLen, uint32_t aPos) {
|
||||
WordBreakClass c1, c2;
|
||||
uint32_t cur = aPos;
|
||||
if (cur == aLen) {
|
||||
|
|
|
@ -28,7 +28,7 @@ class WordBreaker {
|
|||
const char16_t* aText2, uint32_t aTextLen2);
|
||||
WordRange FindWord(const char16_t* aText1, uint32_t aTextLen1,
|
||||
uint32_t aOffset);
|
||||
int32_t NextWord(const char16_t* aText, uint32_t aLen, uint32_t aPos);
|
||||
int32_t Next(const char16_t* aText, uint32_t aLen, uint32_t aPos);
|
||||
|
||||
private:
|
||||
~WordBreaker() = default;
|
||||
|
|
|
@ -115,9 +115,9 @@ bool TestASCIIWB(mozilla::intl::WordBreaker* lb, const char* in,
|
|||
uint32_t res[256];
|
||||
int32_t curr = 0;
|
||||
|
||||
for (i = 0, curr = lb->NextWord(eng1.get(), eng1.Length(), curr);
|
||||
for (i = 0, curr = lb->Next(eng1.get(), eng1.Length(), curr);
|
||||
curr != NS_WORDBREAKER_NEED_MORE_TEXT && i < 256;
|
||||
curr = lb->NextWord(eng1.get(), eng1.Length(), curr), i++) {
|
||||
curr = lb->Next(eng1.get(), eng1.Length(), curr), i++) {
|
||||
res[i] = curr != NS_WORDBREAKER_NEED_MORE_TEXT ? curr : eng1.Length();
|
||||
}
|
||||
|
||||
|
@ -164,13 +164,13 @@ void TestPrintWordWithBreak() {
|
|||
NS_ConvertASCIItoUTF16 fragText(wb[i]);
|
||||
|
||||
int32_t cur = 0;
|
||||
cur = wbk->NextWord(fragText.get(), fragText.Length(), cur);
|
||||
cur = wbk->Next(fragText.get(), fragText.Length(), cur);
|
||||
uint32_t start = 0;
|
||||
for (uint32_t j = 0; cur != NS_WORDBREAKER_NEED_MORE_TEXT; j++) {
|
||||
result.Append(Substring(fragText, start, cur - start));
|
||||
result.Append('^');
|
||||
start = (cur >= 0 ? cur : cur - start);
|
||||
cur = wbk->NextWord(fragText.get(), fragText.Length(), cur);
|
||||
cur = wbk->Next(fragText.get(), fragText.Length(), cur);
|
||||
}
|
||||
|
||||
result.Append(Substring(fragText, fragText.Length() - start));
|
||||
|
@ -258,8 +258,7 @@ void TestNextWordBreakWithComplexLanguage() {
|
|||
|
||||
int32_t offset = 0;
|
||||
while (offset != NS_WORDBREAKER_NEED_MORE_TEXT) {
|
||||
int32_t newOffset =
|
||||
wbk->NextWord(fragText.get(), fragText.Length(), offset);
|
||||
int32_t newOffset = wbk->Next(fragText.get(), fragText.Length(), offset);
|
||||
ASSERT_NE(offset, newOffset);
|
||||
offset = newOffset;
|
||||
}
|
||||
|
|
|
@ -8145,8 +8145,7 @@ ClusterIterator::ClusterIterator(nsTextFrame* aTextFrame, int32_t aPosition,
|
|||
mozilla::intl::WordBreaker* wordBreaker = nsContentUtils::WordBreaker();
|
||||
int32_t nextWord = textStart > 0 ? textStart - 1 : textStart;
|
||||
while (true) {
|
||||
nextWord =
|
||||
wordBreaker->NextWord(aContext.get(), aContext.Length(), nextWord);
|
||||
nextWord = wordBreaker->Next(aContext.get(), aContext.Length(), nextWord);
|
||||
if (NS_WORDBREAKER_NEED_MORE_TEXT == nextWord ||
|
||||
nextWord > textStart + textLen) {
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче