| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 TextBreakIterator* iterator = wordBreakIterator(text, 0, len); | 134 TextBreakIterator* iterator = wordBreakIterator(text, 0, len); |
| 135 |
| 136 // FIXME: When http://crbug.com/411764 is fixed, replace this with an ASSERT
. |
| 137 if (!iterator) |
| 138 return; |
| 139 |
| 135 int pos = iterator->first(); | 140 int pos = iterator->first(); |
| 136 while (pos >= 0 && pos < len) { | 141 while (pos >= 0 && pos < len) { |
| 137 int next = iterator->next(); | 142 int next = iterator->next(); |
| 138 if (isWordTextBreak(iterator)) | 143 if (isWordTextBreak(iterator)) |
| 139 words.append(WordBoundaries(pos, next)); | 144 words.append(WordBoundaries(pos, next)); |
| 140 pos = next; | 145 pos = next; |
| 141 } | 146 } |
| 142 } | 147 } |
| 143 | 148 |
| 144 String AbstractInlineTextBox::text() const | 149 String AbstractInlineTextBox::text() const |
| (...skipping 10 matching lines...) Expand all Loading... |
| 155 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); | 160 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); |
| 156 } | 161 } |
| 157 | 162 |
| 158 String result = m_renderText->text().substring(start, len).simplifyWhiteSpac
e(WTF::DoNotStripWhiteSpace); | 163 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()) | 164 if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start(
) > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWh
itespace()) |
| 160 return result + " "; | 165 return result + " "; |
| 161 return result; | 166 return result; |
| 162 } | 167 } |
| 163 | 168 |
| 164 } // namespace blink | 169 } // namespace blink |
| OLD | NEW |