| 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 29 matching lines...) Expand all Loading... |
| 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 const String& nonNullData = !data.isNull() ? data : emptyString(); | 45 const String& nonNullData = !data.isNull() ? data : emptyString(); |
| 46 if (m_data == nonNullData) | 46 if (m_data == nonNullData) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 RawPtr<CharacterData> protect(this); | 49 RawPtr<CharacterData> protect(this); |
| 50 document().dataWillChange(*this); |
| 50 | 51 |
| 51 unsigned oldLength = length(); | 52 unsigned oldLength = length(); |
| 52 | 53 |
| 53 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(), UpdateFrom
NonParser); | 54 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(), UpdateFrom
NonParser); |
| 54 document().didRemoveText(this, 0, oldLength); | 55 document().didRemoveText(this, 0, oldLength); |
| 55 } | 56 } |
| 56 | 57 |
| 57 String CharacterData::substringData(unsigned offset, unsigned count, ExceptionSt
ate& exceptionState) | 58 String CharacterData::substringData(unsigned offset, unsigned count, ExceptionSt
ate& exceptionState) |
| 58 { | 59 { |
| 59 if (offset > length()) { | 60 if (offset > length()) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return m_data.containsOnlyWhitespace(); | 155 return m_data.containsOnlyWhitespace(); |
| 155 } | 156 } |
| 156 | 157 |
| 157 void CharacterData::setNodeValue(const String& nodeValue) | 158 void CharacterData::setNodeValue(const String& nodeValue) |
| 158 { | 159 { |
| 159 setData(nodeValue); | 160 setData(nodeValue); |
| 160 } | 161 } |
| 161 | 162 |
| 162 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep
lacedData, unsigned oldLength, unsigned newLength, UpdateSource source, RecalcSt
yleBehavior recalcStyleBehavior) | 163 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep
lacedData, unsigned oldLength, unsigned newLength, UpdateSource source, RecalcSt
yleBehavior recalcStyleBehavior) |
| 163 { | 164 { |
| 165 if (source != UpdateFromParser) |
| 166 document().dataWillChange(*this); |
| 167 |
| 164 String oldData = m_data; | 168 String oldData = m_data; |
| 165 m_data = newData; | 169 m_data = newData; |
| 166 | 170 |
| 167 DCHECK(!layoutObject() || isTextNode()); | 171 DCHECK(!layoutObject() || isTextNode()); |
| 168 if (isTextNode()) | 172 if (isTextNode()) |
| 169 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength, re
calcStyleBehavior); | 173 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength, re
calcStyleBehavior); |
| 170 | 174 |
| 171 if (source != UpdateFromParser) { | 175 if (source != UpdateFromParser) { |
| 172 if (getNodeType() == PROCESSING_INSTRUCTION_NODE) | 176 if (getNodeType() == PROCESSING_INSTRUCTION_NODE) |
| 173 toProcessingInstruction(this)->didAttributeChanged(); | 177 toProcessingInstruction(this)->didAttributeChanged(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 200 } | 204 } |
| 201 InspectorInstrumentation::characterDataModified(this); | 205 InspectorInstrumentation::characterDataModified(this); |
| 202 } | 206 } |
| 203 | 207 |
| 204 int CharacterData::maxCharacterOffset() const | 208 int CharacterData::maxCharacterOffset() const |
| 205 { | 209 { |
| 206 return static_cast<int>(length()); | 210 return static_cast<int>(length()); |
| 207 } | 211 } |
| 208 | 212 |
| 209 } // namespace blink | 213 } // namespace blink |
| OLD | NEW |