OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2007, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2007, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0,
0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0)
}, // } | 107 { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0,
0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0)
}, // } |
108 { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0,
0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0)
}, // ~ | 108 { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0,
0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0)
}, // ~ |
109 { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0,
0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0)
}, // DEL | 109 { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0,
0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0)
}, // DEL |
110 }; | 110 }; |
111 | 111 |
112 #undef B | 112 #undef B |
113 #undef F | 113 #undef F |
114 #undef DI | 114 #undef DI |
115 #undef AL | 115 #undef AL |
116 | 116 |
117 COMPILE_ASSERT(WTF_ARRAY_LENGTH(asciiLineBreakTable) == asciiLineBreakTableLastC
har - asciiLineBreakTableFirstChar + 1, TestLineBreakTableConsistency); | 117 static_assert(WTF_ARRAY_LENGTH(asciiLineBreakTable) == asciiLineBreakTableLastCh
ar - asciiLineBreakTableFirstChar + 1, "asciiLineBreakTable should be consistent
"); |
118 | 118 |
119 static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh) | 119 static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh) |
120 { | 120 { |
121 // Don't allow line breaking between '-' and a digit if the '-' may mean a m
inus sign in the context, | 121 // Don't allow line breaking between '-' and a digit if the '-' may mean a m
inus sign in the context, |
122 // while allow breaking in 'ABCD-1234' and '1234-5678' which may be in long
URLs. | 122 // while allow breaking in 'ABCD-1234' and '1234-5678' which may be in long
URLs. |
123 if (ch == '-' && isASCIIDigit(nextCh)) | 123 if (ch == '-' && isASCIIDigit(nextCh)) |
124 return isASCIIAlphanumeric(lastCh); | 124 return isASCIIAlphanumeric(lastCh); |
125 | 125 |
126 // If both ch and nextCh are ASCII characters, use a lookup table for enhanc
ed speed and for compatibility | 126 // If both ch and nextCh are ASCII characters, use a lookup table for enhanc
ed speed and for compatibility |
127 // with other browsers (see comments for asciiLineBreakTable for details). | 127 // with other browsers (see comments for asciiLineBreakTable for details). |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 int nextBreakablePositionBreakAll(LazyLineBreakIterator& lazyBreakIterator, int
pos) | 225 int nextBreakablePositionBreakAll(LazyLineBreakIterator& lazyBreakIterator, int
pos) |
226 { | 226 { |
227 String string = lazyBreakIterator.string(); | 227 String string = lazyBreakIterator.string(); |
228 if (string.is8Bit()) | 228 if (string.is8Bit()) |
229 return nextBreakablePositionBreakAll<LChar>(lazyBreakIterator, string.ch
aracters8(), string.length(), pos); | 229 return nextBreakablePositionBreakAll<LChar>(lazyBreakIterator, string.ch
aracters8(), string.length(), pos); |
230 return nextBreakablePositionBreakAll<UChar>(lazyBreakIterator, string.charac
ters16(), string.length(), pos); | 230 return nextBreakablePositionBreakAll<UChar>(lazyBreakIterator, string.charac
ters16(), string.length(), pos); |
231 } | 231 } |
232 | 232 |
233 } // namespace blink | 233 } // namespace blink |
OLD | NEW |