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 == ','; | |
110 } | 109 } |
111 | 110 |
112 unsigned nextWordEndIndex() | 111 unsigned nextWordEndIndex() |
113 { | 112 { |
114 const unsigned length = m_textRun.length(); | 113 const unsigned length = m_textRun.length(); |
115 if (m_startIndex >= length) | 114 if (m_startIndex >= length) |
116 return 0; | 115 return 0; |
117 | 116 |
118 if (m_startIndex + 1u == length || isWordDelimiter(m_textRun[m_startInde
x])) | 117 if (m_startIndex + 1u == length || isWordDelimiter(m_textRun[m_startInde
x])) |
119 return m_startIndex + 1; | 118 return m_startIndex + 1; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 const Font* m_font; | 219 const Font* m_font; |
221 ShapeResultSpacing m_spacing; | 220 ShapeResultSpacing m_spacing; |
222 float m_widthSoFar; // Used only when allowTabs() | 221 float m_widthSoFar; // Used only when allowTabs() |
223 unsigned m_startIndex : 31; | 222 unsigned m_startIndex : 31; |
224 unsigned m_shapeByWord : 1; | 223 unsigned m_shapeByWord : 1; |
225 }; | 224 }; |
226 | 225 |
227 } // namespace blink | 226 } // namespace blink |
228 | 227 |
229 #endif // CachingWordShapeIterator_h | 228 #endif // CachingWordShapeIterator_h |
OLD | NEW |