| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 || c == characterTabulation | 65 || c == characterTabulation |
| 66 || c == newlineCharacter | 66 || c == newlineCharacter |
| 67 || c == noBreakSpace; | 67 || c == noBreakSpace; |
| 68 } | 68 } |
| 69 static bool treatAsZeroWidthSpace(UChar c) | 69 static bool treatAsZeroWidthSpace(UChar c) |
| 70 { | 70 { |
| 71 return treatAsZeroWidthSpaceInComplexScript(c) | 71 return treatAsZeroWidthSpaceInComplexScript(c) |
| 72 || c == zeroWidthNonJoiner | 72 || c == zeroWidthNonJoiner |
| 73 || c == zeroWidthJoiner; | 73 || c == zeroWidthJoiner; |
| 74 } | 74 } |
| 75 static bool treatAsZeroWidthSpaceInComplexScript(UChar c) | 75 static bool treatAsZeroWidthSpaceInComplexScript(UChar32 c) |
| 76 { | 76 { |
| 77 return c < 0x20 // ASCII Control Characters | 77 return c < 0x20 // ASCII Control Characters |
| 78 || (c >= 0x7F && c < 0xA0) // ASCII Delete .. No-break space | 78 || (c >= 0x7F && c < 0xA0) // ASCII Delete .. No-break space |
| 79 || c == softHyphen | 79 || c == softHyphen |
| 80 || c == zeroWidthSpace | 80 || c == zeroWidthSpace |
| 81 || (c >= leftToRightMark && c <= rightToLeftMark) | 81 || (c >= leftToRightMark && c <= rightToLeftMark) |
| 82 || (c >= leftToRightEmbed && c <= rightToLeftOverride) | 82 || (c >= leftToRightEmbed && c <= rightToLeftOverride) |
| 83 || c == zeroWidthNoBreakSpace | 83 || c == zeroWidthNoBreakSpace |
| 84 || c == objectReplacementCharacter; | 84 || c == objectReplacementCharacter; |
| 85 } | 85 } |
| 86 static bool treatAsZeroWidthSpaceInComplexScript(LChar c) |
| 87 { |
| 88 return c < 0x20 // ASCII Control Characters |
| 89 || (c >= 0x7F && c < 0xA0) // ASCII Delete .. No-break space |
| 90 || c == softHyphen; |
| 91 } |
| 86 static bool canReceiveTextEmphasis(UChar32); | 92 static bool canReceiveTextEmphasis(UChar32); |
| 87 | 93 |
| 88 static inline UChar normalizeSpaces(UChar character) | 94 static inline UChar normalizeSpaces(UChar character) |
| 89 { | 95 { |
| 90 if (treatAsSpace(character)) | 96 if (treatAsSpace(character)) |
| 91 return space; | 97 return space; |
| 92 | 98 |
| 93 if (treatAsZeroWidthSpace(character)) | 99 if (treatAsZeroWidthSpace(character)) |
| 94 return zeroWidthSpace; | 100 return zeroWidthSpace; |
| 95 | 101 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 110 static String normalizeSpaces(const LChar*, unsigned length); | 116 static String normalizeSpaces(const LChar*, unsigned length); |
| 111 static String normalizeSpaces(const UChar*, unsigned length); | 117 static String normalizeSpaces(const UChar*, unsigned length); |
| 112 | 118 |
| 113 private: | 119 private: |
| 114 Character(); | 120 Character(); |
| 115 }; | 121 }; |
| 116 | 122 |
| 117 } // namespace blink | 123 } // namespace blink |
| 118 | 124 |
| 119 #endif | 125 #endif |
| OLD | NEW |