Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: Source/core/rendering/break_lines.cpp

Issue 811843003: replace COMPILE_ASSERT with static_assert in core/rendering/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/TextAutosizer.h ('k') | Source/core/rendering/style/FillLayer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/rendering/TextAutosizer.h ('k') | Source/core/rendering/style/FillLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698