Commit 94157cab authored by mitz@apple.com's avatar mitz@apple.com

Source/WebCore: <rdar://problem/8970549> WebFindOptionsAtWordStarts still...

Source/WebCore: <rdar://problem/8970549> WebFindOptionsAtWordStarts still fails with some Japanese words
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: http://svn.webkit.org/repository/webkit/trunk@86387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ba37113a
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.
......@@ -104,6 +104,7 @@ Searching for ‘P64’ in ‘LP64’ with options [AtWordStarts, TreatMedialCap
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]:
......@@ -111,6 +112,7 @@ PASS: Got a match at 2,4 as expected.
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]:
......
......@@ -71,9 +71,9 @@
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.
......@@ -2040,11 +2040,12 @@ inline bool SearchBuffer::isWordStartMatch(size_t start, size_t length) const
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);
......@@ -2076,6 +2077,11 @@ inline bool SearchBuffer::isWordStartMatch(size_t start, size_t length) const
}
}
// 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 */);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment