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 Roettsches <dominik.roettsches@access-company.com> | 3 * Copyright (C) 2009 Dominik Roettsches <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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return 0; | 59 return 0; |
60 } | 60 } |
61 | 61 |
62 int findNextWordFromIndex(const UChar* chars, int len, int position, bool forwar
d) | 62 int findNextWordFromIndex(const UChar* chars, int len, int position, bool forwar
d) |
63 { | 63 { |
64 TextBreakIterator* it = wordBreakIterator(chars, len); | 64 TextBreakIterator* it = wordBreakIterator(chars, len); |
65 | 65 |
66 if (forward) { | 66 if (forward) { |
67 position = it->following(position); | 67 position = it->following(position); |
68 while (position != TextBreakDone) { | 68 while (position != TextBreakDone) { |
69 // We stop searching when the character preceeding the break | 69 // We stop searching when the character preceding the break |
70 // is alphanumeric. | 70 // is alphanumeric. |
71 if (position < len && isAlphanumeric(chars[position - 1])) | 71 if (position < len && isAlphanumeric(chars[position - 1])) |
72 return position; | 72 return position; |
73 | 73 |
74 position = it->following(position); | 74 position = it->following(position); |
75 } | 75 } |
76 | 76 |
77 return len; | 77 return len; |
78 } else { | 78 } else { |
79 position = it->preceding(position); | 79 position = it->preceding(position); |
(...skipping 20 matching lines...) Expand all Loading... |
100 } | 100 } |
101 | 101 |
102 int findWordEndBoundary(const UChar* chars, int len, int position) | 102 int findWordEndBoundary(const UChar* chars, int len, int position) |
103 { | 103 { |
104 TextBreakIterator* it = wordBreakIterator(chars, len); | 104 TextBreakIterator* it = wordBreakIterator(chars, len); |
105 int end = it->following(position); | 105 int end = it->following(position); |
106 return end < 0 ? it->last() : end; | 106 return end < 0 ? it->last() : end; |
107 } | 107 } |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |