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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 | 469 |
470 // Chinese and Japanese lack word boundary marks, and there is no clear agre
ement on what constitutes | 470 // Chinese and Japanese lack word boundary marks, and there is no clear agre
ement on what constitutes |
471 // a word, so treat the position before any CJK character as a word start. | 471 // a word, so treat the position before any CJK character as a word start. |
472 if (Character::isCJKIdeographOrSymbol(firstCharacter)) | 472 if (Character::isCJKIdeographOrSymbol(firstCharacter)) |
473 return true; | 473 return true; |
474 | 474 |
475 size_t wordBreakSearchStart = start + length; | 475 size_t wordBreakSearchStart = start + length; |
476 while (wordBreakSearchStart > start) | 476 while (wordBreakSearchStart > start) |
477 wordBreakSearchStart = findNextWordFromIndex(m_buffer.data(), m_buffer.s
ize(), wordBreakSearchStart, false /* backwards */); | 477 wordBreakSearchStart = findNextWordFromIndex(m_buffer.data(), m_buffer.s
ize(), wordBreakSearchStart, false /* backwards */); |
478 return wordBreakSearchStart == start; | 478 if (wordBreakSearchStart != start) |
| 479 return false; |
| 480 if (m_options & WholeWord) |
| 481 return static_cast<int>(start + length) == findWordEndBoundary(m_buffer.
data(), m_buffer.size(), wordBreakSearchStart); |
| 482 return true; |
479 } | 483 } |
480 | 484 |
481 inline size_t SearchBuffer::search(size_t& start) | 485 inline size_t SearchBuffer::search(size_t& start) |
482 { | 486 { |
483 size_t size = m_buffer.size(); | 487 size_t size = m_buffer.size(); |
484 if (m_atBreak) { | 488 if (m_atBreak) { |
485 if (!size) | 489 if (!size) |
486 return 0; | 490 return 0; |
487 } else { | 491 } else { |
488 if (size != m_buffer.capacity()) | 492 if (size != m_buffer.capacity()) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 resultEnd = collapseTo; | 665 resultEnd = collapseTo; |
662 return; | 666 return; |
663 } | 667 } |
664 } | 668 } |
665 | 669 |
666 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 670 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
667 computeRangeIterator.calculateCharacterSubrange(matchStart, matchLength, res
ultStart, resultEnd); | 671 computeRangeIterator.calculateCharacterSubrange(matchStart, matchLength, res
ultStart, resultEnd); |
668 } | 672 } |
669 | 673 |
670 } // namespace blink | 674 } // namespace blink |
OLD | NEW |