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 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 if (offsetCount.hasOverflowed() || offset + count > length) | 117 if (offsetCount.hasOverflowed() || offset + count > length) |
118 realCount = length - offset; | 118 realCount = length - offset; |
119 else | 119 else |
120 realCount = count; | 120 realCount = count; |
121 | 121 |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
125 void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState&
exceptionState, RecalcStyleBehavior recalcStyleBehavior) | 125 void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState&
exceptionState, RecalcStyleBehavior recalcStyleBehavior) |
126 { | 126 { |
127 unsigned realCount; | 127 unsigned realCount = 0; |
128 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState)
) | 128 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState)
) |
129 return; | 129 return; |
130 | 130 |
131 String newStr = m_data; | 131 String newStr = m_data; |
132 newStr.remove(offset, realCount); | 132 newStr.remove(offset, realCount); |
133 | 133 |
134 setDataAndUpdate(newStr, offset, realCount, 0, recalcStyleBehavior); | 134 setDataAndUpdate(newStr, offset, realCount, 0, recalcStyleBehavior); |
135 | 135 |
136 document().didRemoveText(this, offset, realCount); | 136 document().didRemoveText(this, offset, realCount); |
137 } | 137 } |
138 | 138 |
139 void CharacterData::replaceData(unsigned offset, unsigned count, const String& d
ata, ExceptionState& exceptionState) | 139 void CharacterData::replaceData(unsigned offset, unsigned count, const String& d
ata, ExceptionState& exceptionState) |
140 { | 140 { |
141 unsigned realCount; | 141 unsigned realCount = 0; |
142 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState)
) | 142 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState)
) |
143 return; | 143 return; |
144 | 144 |
145 String newStr = m_data; | 145 String newStr = m_data; |
146 newStr.remove(offset, realCount); | 146 newStr.remove(offset, realCount); |
147 newStr.insert(data, offset); | 147 newStr.insert(data, offset); |
148 | 148 |
149 setDataAndUpdate(newStr, offset, realCount, data.length()); | 149 setDataAndUpdate(newStr, offset, realCount, data.length()); |
150 | 150 |
151 // update the markers for spell checking and grammar checking | 151 // update the markers for spell checking and grammar checking |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 { | 207 { |
208 return static_cast<int>(length()); | 208 return static_cast<int>(length()); |
209 } | 209 } |
210 | 210 |
211 bool CharacterData::offsetInCharacters() const | 211 bool CharacterData::offsetInCharacters() const |
212 { | 212 { |
213 return true; | 213 return true; |
214 } | 214 } |
215 | 215 |
216 } // namespace WebCore | 216 } // namespace WebCore |
OLD | NEW |