| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Dominik Röttsches <dominik.roettsches@access-company.com> | 3 * Copyright (C) 2009 Dominik Röttsches <dominik.roettsches@access-company.com> |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 for (int i = length; i > 0; ) { | 53 for (int i = length; i > 0; ) { |
| 54 int last = i; | 54 int last = i; |
| 55 UChar32 ch; | 55 UChar32 ch; |
| 56 U16_PREV(characters, 0, i, ch); | 56 U16_PREV(characters, 0, i, ch); |
| 57 if (!requiresContextForWordBoundary(ch)) | 57 if (!requiresContextForWordBoundary(ch)) |
| 58 return last; | 58 return last; |
| 59 } | 59 } |
| 60 return 0; | 60 return 0; |
| 61 } | 61 } |
| 62 | 62 |
| 63 #if !PLATFORM(MAC) && !PLATFORM(QT) | 63 #if !PLATFORM(MAC) |
| 64 | 64 |
| 65 int findNextWordFromIndex(const UChar* chars, int len, int position, bool forwar
d) | 65 int findNextWordFromIndex(const UChar* chars, int len, int position, bool forwar
d) |
| 66 { | 66 { |
| 67 TextBreakIterator* it = wordBreakIterator(chars, len); | 67 TextBreakIterator* it = wordBreakIterator(chars, len); |
| 68 | 68 |
| 69 if (forward) { | 69 if (forward) { |
| 70 position = textBreakFollowing(it, position); | 70 position = textBreakFollowing(it, position); |
| 71 while (position != TextBreakDone) { | 71 while (position != TextBreakDone) { |
| 72 // We stop searching when the character preceeding the break | 72 // We stop searching when the character preceeding the break |
| 73 // is alphanumeric. | 73 // is alphanumeric. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 95 | 95 |
| 96 void findWordBoundary(const UChar* chars, int len, int position, int* start, int
* end) | 96 void findWordBoundary(const UChar* chars, int len, int position, int* start, int
* end) |
| 97 { | 97 { |
| 98 TextBreakIterator* it = wordBreakIterator(chars, len); | 98 TextBreakIterator* it = wordBreakIterator(chars, len); |
| 99 *end = textBreakFollowing(it, position); | 99 *end = textBreakFollowing(it, position); |
| 100 if (*end < 0) | 100 if (*end < 0) |
| 101 *end = textBreakLast(it); | 101 *end = textBreakLast(it); |
| 102 *start = textBreakPrevious(it); | 102 *start = textBreakPrevious(it); |
| 103 } | 103 } |
| 104 | 104 |
| 105 #endif // !PLATFORM(MAC) && !PLATFORM(QT) | 105 #endif // !PLATFORM(MAC) |
| 106 | 106 |
| 107 } // namespace WebCore | 107 } // namespace WebCore |
| OLD | NEW |