https://bugs.webkit.org/show_bug.cgi?id=60730
Reviewed by Sam Weinig.
* editing/TextIterator.cpp:
(WebCore::SearchBuffer::isWordStartMatch): Consider all positions before a CJK ideograph as
word starts.
LayoutTests: Updated results for <rdar://problem/
8970549> WebFindOptionsAtWordStarts still fails with some Japanese words
https://bugs.webkit.org/show_bug.cgi?id=60730
Reviewed by Sam Weinig.
* editing/text-iterator/findString-expected.txt:
* editing/text-iterator/findString.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@86387
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-05-12 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Updated results for <rdar://problem/8970549> WebFindOptionsAtWordStarts still fails with some Japanese words
+ https://bugs.webkit.org/show_bug.cgi?id=60730
+
+ * editing/text-iterator/findString-expected.txt:
+ * editing/text-iterator/findString.html:
+
2011-05-12 Daniel Bates <dbates@rim.com>
Reviewed by Kenneth Rohde Christiansen.
PASS: Got no match as expected.
Searching for ‘動戦士’ in ‘起動戦士’ with options [AtWordStarts]:
+PASS: Got a match at 1,4 as expected.
PASS: Got no match as expected.
Searching for ‘戦士’ in ‘起動戦士’ with options [AtWordStarts]:
PASS: Got no match as expected.
Searching for ‘士’ in ‘起動戦士’ with options [AtWordStarts]:
+PASS: Got a match at 3,4 as expected.
PASS: Got no match as expected.
Searching for ‘a’ in long string with options [AtWordStarts]:
testFindString("LP64", "64", ["AtWordStarts", "TreatMedialCapitalAsWordStart"], [[2, 4], []]);
testFindString("LP64", "P64", ["AtWordStarts", "TreatMedialCapitalAsWordStart"], [[]]);
- testFindString("\u8d77\u52d5\u6226\u58eb", "\u52d5\u6226\u58eb", ["AtWordStarts"], [[]]);
+ testFindString("\u8d77\u52d5\u6226\u58eb", "\u52d5\u6226\u58eb", ["AtWordStarts"], [[1, 4], []]);
testFindString("\u8d77\u52d5\u6226\u58eb", "\u6226\u58eb", ["AtWordStarts"], [[2, 4], []]);
- testFindString("\u8d77\u52d5\u6226\u58eb", "\u58eb", ["AtWordStarts"], [[]]);
+ testFindString("\u8d77\u52d5\u6226\u58eb", "\u58eb", ["AtWordStarts"], [[3, 4], []]);
const searchBufferSize = 8192;
const searchBufferOverlapSize = searchBufferSize / 4;
+2011-05-12 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/8970549> WebFindOptionsAtWordStarts still fails with some Japanese words
+ https://bugs.webkit.org/show_bug.cgi?id=60730
+
+ * editing/TextIterator.cpp:
+ (WebCore::SearchBuffer::isWordStartMatch): Consider all positions before a CJK ideograph as
+ word starts.
+
2011-05-12 Levi Weintraub <leviw@chromium.org>
Reviewed by Eric Seidel.
if (!start)
return true;
+ int size = m_buffer.size();
+ int offset = start;
+ UChar32 firstCharacter;
+ U16_GET(m_buffer.data(), 0, offset, size, firstCharacter);
+
if (m_options & TreatMedialCapitalAsWordStart) {
- int size = m_buffer.size();
- int offset = start;
- UChar32 firstCharacter;
- U16_GET(m_buffer.data(), 0, offset, size, firstCharacter);
UChar32 previousCharacter;
U16_PREV(m_buffer.data(), 0, offset, previousCharacter);
}
}
+ // Chinese and Japanese lack word boundary marks, and there is no clear agreement on what constitutes
+ // a word, so treat the position before any CJK character as a word start.
+ if (Font::isCJKIdeographOrSymbol(firstCharacter))
+ return true;
+
size_t wordBreakSearchStart = start + length;
while (wordBreakSearchStart > start)
wordBreakSearchStart = findNextWordFromIndex(m_buffer.data(), m_buffer.size(), wordBreakSearchStart, false /* backwards */);