OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 if (treatAsSpace(character)) | 151 if (treatAsSpace(character)) |
152 return spaceCharacter; | 152 return spaceCharacter; |
153 | 153 |
154 if (treatAsZeroWidthSpace(character)) | 154 if (treatAsZeroWidthSpace(character)) |
155 return zeroWidthSpaceCharacter; | 155 return zeroWidthSpaceCharacter; |
156 | 156 |
157 return character; | 157 return character; |
158 } | 158 } |
159 | 159 |
160 static inline bool isNormalizedCanvasSpaceCharacter(UChar32 c) { | 160 static inline bool isNormalizedCanvasSpaceCharacter(UChar32 c) { |
161 // According to specification all space characters should be replaced with 0
x0020 space character. | 161 // According to specification all space characters should be replaced with |
| 162 // 0x0020 space character. |
162 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-el
ement.html#text-preparation-algorithm | 163 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-el
ement.html#text-preparation-algorithm |
163 // The space characters according to specification are : U+0020, U+0009, U+0
00A, U+000C, and U+000D. | 164 // The space characters according to specification are : U+0020, U+0009, |
| 165 // U+000A, U+000C, and U+000D. |
164 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-micros
yntaxes.html#space-character | 166 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-micros
yntaxes.html#space-character |
165 // This function returns true for 0x000B also, so that this is backward comp
atible. | 167 // This function returns true for 0x000B also, so that this is backward |
166 // Otherwise, the test LayoutTests/canvas/philip/tests/2d.text.draw.space.co
llapse.space.html will fail | 168 // compatible. Otherwise, the test |
| 169 // LayoutTests/canvas/philip/tests/2d.text.draw.space.collapse.space.html |
| 170 // will fail |
167 return c == 0x0009 || (c >= 0x000A && c <= 0x000D); | 171 return c == 0x0009 || (c >= 0x000A && c <= 0x000D); |
168 } | 172 } |
169 | 173 |
170 static String normalizeSpaces(const LChar*, unsigned length); | 174 static String normalizeSpaces(const LChar*, unsigned length); |
171 static String normalizeSpaces(const UChar*, unsigned length); | 175 static String normalizeSpaces(const UChar*, unsigned length); |
172 | 176 |
173 static bool isCommonOrInheritedScript(UChar32); | 177 static bool isCommonOrInheritedScript(UChar32); |
174 }; | 178 }; |
175 | 179 |
176 } // namespace blink | 180 } // namespace blink |
177 | 181 |
178 #endif | 182 #endif |
OLD | NEW |