OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All |
5 * rights reserved. | 5 * rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState)) | 147 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState)) |
148 return; | 148 return; |
149 | 149 |
150 String newStr = m_data; | 150 String newStr = m_data; |
151 newStr.remove(offset, realCount); | 151 newStr.remove(offset, realCount); |
152 newStr.insert(data, offset); | 152 newStr.insert(data, offset); |
153 | 153 |
154 setDataAndUpdate(newStr, offset, realCount, data.length(), | 154 setDataAndUpdate(newStr, offset, realCount, data.length(), |
155 UpdateFromNonParser); | 155 UpdateFromNonParser); |
156 | 156 |
157 // update the markers for spell checking and grammar checking | 157 // Update the markers for spell checking, grammar checking, and text |
158 document().didRemoveText(this, offset, realCount); | 158 // suggestions. didInsertText() must be called first so suggestion markers |
159 // properly track text replacments. | |
159 document().didInsertText(this, offset, data.length()); | 160 document().didInsertText(this, offset, data.length()); |
161 document().didRemoveText(this, offset + data.length(), realCount); | |
rlanday
2017/01/31 19:50:21
I hope this doesn't break anything...presumably we
esprehn
2017/01/31 22:41:34
This probably needs unit tests?
| |
160 } | 162 } |
161 | 163 |
162 String CharacterData::nodeValue() const { | 164 String CharacterData::nodeValue() const { |
163 return m_data; | 165 return m_data; |
164 } | 166 } |
165 | 167 |
166 bool CharacterData::containsOnlyWhitespace() const { | 168 bool CharacterData::containsOnlyWhitespace() const { |
167 return m_data.containsOnlyWhitespace(); | 169 return m_data.containsOnlyWhitespace(); |
168 } | 170 } |
169 | 171 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 dispatchSubtreeModifiedEvent(); | 224 dispatchSubtreeModifiedEvent(); |
223 } | 225 } |
224 InspectorInstrumentation::characterDataModified(this); | 226 InspectorInstrumentation::characterDataModified(this); |
225 } | 227 } |
226 | 228 |
227 int CharacterData::maxCharacterOffset() const { | 229 int CharacterData::maxCharacterOffset() const { |
228 return static_cast<int>(length()); | 230 return static_cast<int>(length()); |
229 } | 231 } |
230 | 232 |
231 } // namespace blink | 233 } // namespace blink |
OLD | NEW |