| 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, 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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 { | 69 { |
| 70 unsigned oldLength = m_data.length(); | 70 unsigned oldLength = m_data.length(); |
| 71 m_data = m_data + string; | 71 m_data = m_data + string; |
| 72 | 72 |
| 73 ASSERT(!renderer() || isTextNode()); | 73 ASSERT(!renderer() || isTextNode()); |
| 74 if (isTextNode()) | 74 if (isTextNode()) |
| 75 toText(this)->updateTextRenderer(oldLength, 0); | 75 toText(this)->updateTextRenderer(oldLength, 0); |
| 76 | 76 |
| 77 document().incDOMTreeVersion(); | 77 document().incDOMTreeVersion(); |
| 78 | 78 |
| 79 if (parentNode()) | 79 if (parentNode()) { |
| 80 parentNode()->childrenChanged(); | 80 ContainerNode::ChildrenChange change = {ContainerNode::TextChanged, prev
iousSibling(), nextSibling(), ContainerNode::ChildrenChangeSourceParser}; |
| 81 parentNode()->childrenChanged(change); |
| 82 } |
| 81 } | 83 } |
| 82 | 84 |
| 83 void CharacterData::appendData(const String& data) | 85 void CharacterData::appendData(const String& data) |
| 84 { | 86 { |
| 85 String newStr = m_data + data; | 87 String newStr = m_data + data; |
| 86 | 88 |
| 87 setDataAndUpdate(newStr, m_data.length(), 0, data.length()); | 89 setDataAndUpdate(newStr, m_data.length(), 0, data.length()); |
| 88 | 90 |
| 89 // FIXME: Should we call textInserted here? | 91 // FIXME: Should we call textInserted here? |
| 90 } | 92 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 187 |
| 186 document().incDOMTreeVersion(); | 188 document().incDOMTreeVersion(); |
| 187 didModifyData(oldData); | 189 didModifyData(oldData); |
| 188 } | 190 } |
| 189 | 191 |
| 190 void CharacterData::didModifyData(const String& oldData) | 192 void CharacterData::didModifyData(const String& oldData) |
| 191 { | 193 { |
| 192 if (OwnPtrWillBeRawPtr<MutationObserverInterestGroup> mutationRecipients = M
utationObserverInterestGroup::createForCharacterDataMutation(*this)) | 194 if (OwnPtrWillBeRawPtr<MutationObserverInterestGroup> mutationRecipients = M
utationObserverInterestGroup::createForCharacterDataMutation(*this)) |
| 193 mutationRecipients->enqueueMutationRecord(MutationRecord::createCharacte
rData(this, oldData)); | 195 mutationRecipients->enqueueMutationRecord(MutationRecord::createCharacte
rData(this, oldData)); |
| 194 | 196 |
| 195 if (parentNode()) | 197 if (parentNode()) { |
| 196 parentNode()->childrenChanged(); | 198 ContainerNode::ChildrenChange change = {ContainerNode::TextChanged, prev
iousSibling(), nextSibling(), ContainerNode::ChildrenChangeSourceAPI}; |
| 199 parentNode()->childrenChanged(change); |
| 200 } |
| 197 | 201 |
| 198 if (!isInShadowTree()) { | 202 if (!isInShadowTree()) { |
| 199 if (document().hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTEN
ER)) | 203 if (document().hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTEN
ER)) |
| 200 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMCharact
erDataModified, true, nullptr, oldData, m_data)); | 204 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMCharact
erDataModified, true, nullptr, oldData, m_data)); |
| 201 dispatchSubtreeModifiedEvent(); | 205 dispatchSubtreeModifiedEvent(); |
| 202 } | 206 } |
| 203 InspectorInstrumentation::characterDataModified(this); | 207 InspectorInstrumentation::characterDataModified(this); |
| 204 } | 208 } |
| 205 | 209 |
| 206 int CharacterData::maxCharacterOffset() const | 210 int CharacterData::maxCharacterOffset() const |
| 207 { | 211 { |
| 208 return static_cast<int>(length()); | 212 return static_cast<int>(length()); |
| 209 } | 213 } |
| 210 | 214 |
| 211 bool CharacterData::offsetInCharacters() const | 215 bool CharacterData::offsetInCharacters() const |
| 212 { | 216 { |
| 213 return true; | 217 return true; |
| 214 } | 218 } |
| 215 | 219 |
| 216 } // namespace WebCore | 220 } // namespace WebCore |
| OLD | NEW |