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 r ights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r ights 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 24 matching lines...) Expand all Loading... | |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 void CharacterData::atomize() | 38 void CharacterData::atomize() |
39 { | 39 { |
40 m_data = AtomicString(m_data); | 40 m_data = AtomicString(m_data); |
41 } | 41 } |
42 | 42 |
43 void CharacterData::setData(const String& data) | 43 void CharacterData::setData(const String& data) |
44 { | 44 { |
45 document().dataWillChange(*this); | |
yosin_UTC9
2016/04/28 01:50:28
At glance, calling |dataWillChange()| is enough in
chrishtr
2016/04/28 17:22:01
setData() is an indepenent call site, no?
| |
46 | |
45 const String& nonNullData = !data.isNull() ? data : emptyString(); | 47 const String& nonNullData = !data.isNull() ? data : emptyString(); |
46 if (m_data == nonNullData) | 48 if (m_data == nonNullData) |
47 return; | 49 return; |
48 | 50 |
49 unsigned oldLength = length(); | 51 unsigned oldLength = length(); |
50 | 52 |
51 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(), UpdateFrom NonParser); | 53 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(), UpdateFrom NonParser); |
52 document().didRemoveText(this, 0, oldLength); | 54 document().didRemoveText(this, 0, oldLength); |
53 } | 55 } |
54 | 56 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 return m_data.containsOnlyWhitespace(); | 154 return m_data.containsOnlyWhitespace(); |
153 } | 155 } |
154 | 156 |
155 void CharacterData::setNodeValue(const String& nodeValue) | 157 void CharacterData::setNodeValue(const String& nodeValue) |
156 { | 158 { |
157 setData(nodeValue); | 159 setData(nodeValue); |
158 } | 160 } |
159 | 161 |
160 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep lacedData, unsigned oldLength, unsigned newLength, UpdateSource source, RecalcSt yleBehavior recalcStyleBehavior) | 162 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep lacedData, unsigned oldLength, unsigned newLength, UpdateSource source, RecalcSt yleBehavior recalcStyleBehavior) |
161 { | 163 { |
164 document().dataWillChange(*this); | |
yosin_UTC9
2016/04/28 01:50:28
Should we call this for |source != UpdateFromParse
chrishtr
2016/04/28 17:22:02
Done.
| |
165 | |
162 String oldData = m_data; | 166 String oldData = m_data; |
163 m_data = newData; | 167 m_data = newData; |
164 | 168 |
165 DCHECK(!layoutObject() || isTextNode()); | 169 DCHECK(!layoutObject() || isTextNode()); |
166 if (isTextNode()) | 170 if (isTextNode()) |
167 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength, re calcStyleBehavior); | 171 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength, re calcStyleBehavior); |
168 | 172 |
169 if (source != UpdateFromParser) { | 173 if (source != UpdateFromParser) { |
170 if (getNodeType() == PROCESSING_INSTRUCTION_NODE) | 174 if (getNodeType() == PROCESSING_INSTRUCTION_NODE) |
171 toProcessingInstruction(this)->didAttributeChanged(); | 175 toProcessingInstruction(this)->didAttributeChanged(); |
(...skipping 26 matching lines...) Expand all Loading... | |
198 } | 202 } |
199 InspectorInstrumentation::characterDataModified(this); | 203 InspectorInstrumentation::characterDataModified(this); |
200 } | 204 } |
201 | 205 |
202 int CharacterData::maxCharacterOffset() const | 206 int CharacterData::maxCharacterOffset() const |
203 { | 207 { |
204 return static_cast<int>(length()); | 208 return static_cast<int>(length()); |
205 } | 209 } |
206 | 210 |
207 } // namespace blink | 211 } // namespace blink |
OLD | NEW |