OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return result->applySpacingToCopy(m_spacing, wordRun); | 98 return result->applySpacingToCopy(m_spacing, wordRun); |
99 } | 99 } |
100 | 100 |
101 bool nextWord(RefPtr<ShapeResult>* wordResult) | 101 bool nextWord(RefPtr<ShapeResult>* wordResult) |
102 { | 102 { |
103 return shapeToEndIndex(wordResult, nextWordEndIndex()); | 103 return shapeToEndIndex(wordResult, nextWordEndIndex()); |
104 } | 104 } |
105 | 105 |
106 static bool isWordDelimiter(UChar ch) | 106 static bool isWordDelimiter(UChar ch) |
107 { | 107 { |
108 return ch == spaceCharacter || ch == tabulationCharacter; | 108 return ch == spaceCharacter || ch == tabulationCharacter |
| 109 || ch == '.' || ch == ','; |
109 } | 110 } |
110 | 111 |
111 unsigned nextWordEndIndex() | 112 unsigned nextWordEndIndex() |
112 { | 113 { |
113 const unsigned length = m_textRun.length(); | 114 const unsigned length = m_textRun.length(); |
114 if (m_startIndex >= length) | 115 if (m_startIndex >= length) |
115 return 0; | 116 return 0; |
116 | 117 |
117 if (m_startIndex + 1u == length || isWordDelimiter(m_textRun[m_startInde
x])) | 118 if (m_startIndex + 1u == length || isWordDelimiter(m_textRun[m_startInde
x])) |
118 return m_startIndex + 1; | 119 return m_startIndex + 1; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 const Font* m_font; | 220 const Font* m_font; |
220 ShapeResultSpacing m_spacing; | 221 ShapeResultSpacing m_spacing; |
221 float m_widthSoFar; // Used only when allowTabs() | 222 float m_widthSoFar; // Used only when allowTabs() |
222 unsigned m_startIndex : 31; | 223 unsigned m_startIndex : 31; |
223 unsigned m_shapeByWord : 1; | 224 unsigned m_shapeByWord : 1; |
224 }; | 225 }; |
225 | 226 |
226 } // namespace blink | 227 } // namespace blink |
227 | 228 |
228 #endif // CachingWordShapeIterator_h | 229 #endif // CachingWordShapeIterator_h |
OLD | NEW |