Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 m_inlineTextBox->characterWidths(widths); | 124 m_inlineTextBox->characterWidths(widths); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void AbstractInlineTextBox::wordBoundaries(Vector<WordBoundaries>& words) const | 127 void AbstractInlineTextBox::wordBoundaries(Vector<WordBoundaries>& words) const |
| 128 { | 128 { |
| 129 if (!m_inlineTextBox) | 129 if (!m_inlineTextBox) |
| 130 return; | 130 return; |
| 131 | 131 |
| 132 String text = this->text(); | 132 String text = this->text(); |
| 133 int len = text.length(); | 133 int len = text.length(); |
| 134 if (!len) | |
|
eseidel
2014/09/04 16:39:49
Should this be moved to after wordBreakIterator if
dmazzoni
2014/09/04 16:46:57
Sure. I was torn between catching the actual crash
| |
| 135 return; | |
| 136 | |
| 134 TextBreakIterator* iterator = wordBreakIterator(text, 0, len); | 137 TextBreakIterator* iterator = wordBreakIterator(text, 0, len); |
| 135 int pos = iterator->first(); | 138 int pos = iterator->first(); |
| 136 while (pos >= 0 && pos < len) { | 139 while (pos >= 0 && pos < len) { |
| 137 int next = iterator->next(); | 140 int next = iterator->next(); |
| 138 if (isWordTextBreak(iterator)) | 141 if (isWordTextBreak(iterator)) |
| 139 words.append(WordBoundaries(pos, next)); | 142 words.append(WordBoundaries(pos, next)); |
| 140 pos = next; | 143 pos = next; |
| 141 } | 144 } |
| 142 } | 145 } |
| 143 | 146 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 155 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); | 158 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); |
| 156 } | 159 } |
| 157 | 160 |
| 158 String result = m_renderText->text().substring(start, len).simplifyWhiteSpac e(WTF::DoNotStripWhiteSpace); | 161 String result = m_renderText->text().substring(start, len).simplifyWhiteSpac e(WTF::DoNotStripWhiteSpace); |
| 159 if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start( ) > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWh itespace()) | 162 if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start( ) > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWh itespace()) |
| 160 return result + " "; | 163 return result + " "; |
| 161 return result; | 164 return result; |
| 162 } | 165 } |
| 163 | 166 |
| 164 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |