| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 466 } |
| 467 | 467 |
| 468 // Chinese and Japanese lack word boundary marks, and there is no clear agre
ement on what constitutes | 468 // Chinese and Japanese lack word boundary marks, and there is no clear agre
ement on what constitutes |
| 469 // a word, so treat the position before any CJK character as a word start. | 469 // a word, so treat the position before any CJK character as a word start. |
| 470 if (Character::isCJKIdeographOrSymbol(firstCharacter)) | 470 if (Character::isCJKIdeographOrSymbol(firstCharacter)) |
| 471 return true; | 471 return true; |
| 472 | 472 |
| 473 size_t wordBreakSearchStart = start + length; | 473 size_t wordBreakSearchStart = start + length; |
| 474 while (wordBreakSearchStart > start) | 474 while (wordBreakSearchStart > start) |
| 475 wordBreakSearchStart = findNextWordFromIndex(m_buffer.data(), m_buffer.s
ize(), wordBreakSearchStart, false /* backwards */); | 475 wordBreakSearchStart = findNextWordFromIndex(m_buffer.data(), m_buffer.s
ize(), wordBreakSearchStart, false /* backwards */); |
| 476 return wordBreakSearchStart == start; | 476 if (wordBreakSearchStart != start) |
| 477 return false; |
| 478 if (m_options & WholeWord) |
| 479 return static_cast<int>(start + length) == findWordEndBoundary(m_buffer.
data(), m_buffer.size(), wordBreakSearchStart); |
| 480 return true; |
| 477 } | 481 } |
| 478 | 482 |
| 479 inline size_t SearchBuffer::search(size_t& start) | 483 inline size_t SearchBuffer::search(size_t& start) |
| 480 { | 484 { |
| 481 size_t size = m_buffer.size(); | 485 size_t size = m_buffer.size(); |
| 482 if (m_atBreak) { | 486 if (m_atBreak) { |
| 483 if (!size) | 487 if (!size) |
| 484 return 0; | 488 return 0; |
| 485 } else { | 489 } else { |
| 486 if (size != m_buffer.capacity()) | 490 if (size != m_buffer.capacity()) |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 resultEnd = collapseTo; | 663 resultEnd = collapseTo; |
| 660 return; | 664 return; |
| 661 } | 665 } |
| 662 } | 666 } |
| 663 | 667 |
| 664 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 668 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
| 665 computeRangeIterator.calculateCharacterSubrange(matchStart, matchLength, res
ultStart, resultEnd); | 669 computeRangeIterator.calculateCharacterSubrange(matchStart, matchLength, res
ultStart, resultEnd); |
| 666 } | 670 } |
| 667 | 671 |
| 668 } // namespace blink | 672 } // namespace blink |
| OLD | NEW |