Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: third_party/WebKit/Source/core/dom/CharacterData.cpp

Issue 2637013002: CONTINUED Make FrameSelection to hold non-canonicalized positions (Closed)
Patch Set: 2017-02-08T18:56:19 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
22 22
23 #include "core/dom/CharacterData.h" 23 #include "core/dom/CharacterData.h"
24 24
25 #include "bindings/core/v8/ExceptionState.h" 25 #include "bindings/core/v8/ExceptionState.h"
26 #include "core/dom/Document.h" 26 #include "core/dom/Document.h"
27 #include "core/dom/ExceptionCode.h" 27 #include "core/dom/ExceptionCode.h"
28 #include "core/dom/MutationObserverInterestGroup.h" 28 #include "core/dom/MutationObserverInterestGroup.h"
29 #include "core/dom/MutationRecord.h" 29 #include "core/dom/MutationRecord.h"
30 #include "core/dom/ProcessingInstruction.h" 30 #include "core/dom/ProcessingInstruction.h"
31 #include "core/dom/Text.h" 31 #include "core/dom/Text.h"
32 #include "core/editing/FrameSelection.h"
33 #include "core/events/MutationEvent.h" 32 #include "core/events/MutationEvent.h"
34 #include "core/inspector/InspectorInstrumentation.h" 33 #include "core/inspector/InspectorInstrumentation.h"
35 #include "wtf/CheckedNumeric.h" 34 #include "wtf/CheckedNumeric.h"
36 35
37 namespace blink { 36 namespace blink {
38 37
39 void CharacterData::atomize() { 38 void CharacterData::atomize() {
40 m_data = AtomicString(m_data); 39 m_data = AtomicString(m_data);
41 } 40 }
42 41
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 168 }
170 169
171 void CharacterData::setDataAndUpdate(const String& newData, 170 void CharacterData::setDataAndUpdate(const String& newData,
172 unsigned offsetOfReplacedData, 171 unsigned offsetOfReplacedData,
173 unsigned oldLength, 172 unsigned oldLength,
174 unsigned newLength, 173 unsigned newLength,
175 UpdateSource source) { 174 UpdateSource source) {
176 String oldData = m_data; 175 String oldData = m_data;
177 m_data = newData; 176 m_data = newData;
178 177
179 DCHECK(!layoutObject() || isTextNode()); 178 document().incDOMTreeVersion();
180 if (isTextNode())
181 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength);
182
183 if (source != UpdateFromParser) { 179 if (source != UpdateFromParser) {
184 if (getNodeType() == kProcessingInstructionNode) 180 if (getNodeType() == kProcessingInstructionNode)
185 toProcessingInstruction(this)->didAttributeChanged(); 181 toProcessingInstruction(this)->didAttributeChanged();
186 182
187 document().notifyUpdateCharacterData(this, offsetOfReplacedData, oldLength, 183 document().notifyUpdateCharacterData(this, offsetOfReplacedData, oldLength,
188 newLength); 184 newLength);
189 } 185 }
190 186
191 document().incDOMTreeVersion(); 187 DCHECK(!layoutObject() || isTextNode());
188 if (isTextNode())
189 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength);
190
192 didModifyData(oldData, source); 191 didModifyData(oldData, source);
193 } 192 }
194 193
195 void CharacterData::didModifyData(const String& oldData, UpdateSource source) { 194 void CharacterData::didModifyData(const String& oldData, UpdateSource source) {
196 if (MutationObserverInterestGroup* mutationRecipients = 195 if (MutationObserverInterestGroup* mutationRecipients =
197 MutationObserverInterestGroup::createForCharacterDataMutation(*this)) 196 MutationObserverInterestGroup::createForCharacterDataMutation(*this))
198 mutationRecipients->enqueueMutationRecord( 197 mutationRecipients->enqueueMutationRecord(
199 MutationRecord::createCharacterData(this, oldData)); 198 MutationRecord::createCharacterData(this, oldData));
200 199
201 if (parentNode()) { 200 if (parentNode()) {
(...skipping 14 matching lines...) Expand all
216 dispatchSubtreeModifiedEvent(); 215 dispatchSubtreeModifiedEvent();
217 } 216 }
218 InspectorInstrumentation::characterDataModified(this); 217 InspectorInstrumentation::characterDataModified(this);
219 } 218 }
220 219
221 int CharacterData::maxCharacterOffset() const { 220 int CharacterData::maxCharacterOffset() const {
222 return static_cast<int>(length()); 221 return static_cast<int>(length());
223 } 222 }
224 223
225 } // namespace blink 224 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698