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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 28 matching lines...) Expand all
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 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 RefPtrWillBeRawPtr<CharacterData> protect(this); 49 RawPtr<CharacterData> protect(this);
50 50
51 unsigned oldLength = length(); 51 unsigned oldLength = length();
52 52
53 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(), UpdateFrom NonParser); 53 setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length(), UpdateFrom NonParser);
54 document().didRemoveText(this, 0, oldLength); 54 document().didRemoveText(this, 0, oldLength);
55 } 55 }
56 56
57 String CharacterData::substringData(unsigned offset, unsigned count, ExceptionSt ate& exceptionState) 57 String CharacterData::substringData(unsigned offset, unsigned count, ExceptionSt ate& exceptionState)
58 { 58 {
59 if (offset > length()) { 59 if (offset > length()) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (document().frame()) 175 if (document().frame())
176 document().frame()->selection().didUpdateCharacterData(this, offsetO fReplacedData, oldLength, newLength); 176 document().frame()->selection().didUpdateCharacterData(this, offsetO fReplacedData, oldLength, newLength);
177 } 177 }
178 178
179 document().incDOMTreeVersion(); 179 document().incDOMTreeVersion();
180 didModifyData(oldData, source); 180 didModifyData(oldData, source);
181 } 181 }
182 182
183 void CharacterData::didModifyData(const String& oldData, UpdateSource source) 183 void CharacterData::didModifyData(const String& oldData, UpdateSource source)
184 { 184 {
185 if (OwnPtrWillBeRawPtr<MutationObserverInterestGroup> mutationRecipients = M utationObserverInterestGroup::createForCharacterDataMutation(*this)) 185 if (RawPtr<MutationObserverInterestGroup> mutationRecipients = MutationObser verInterestGroup::createForCharacterDataMutation(*this))
186 mutationRecipients->enqueueMutationRecord(MutationRecord::createCharacte rData(this, oldData)); 186 mutationRecipients->enqueueMutationRecord(MutationRecord::createCharacte rData(this, oldData));
187 187
188 if (parentNode()) { 188 if (parentNode()) {
189 ContainerNode::ChildrenChange change = {ContainerNode::TextChanged, prev iousSibling(), nextSibling(), ContainerNode::ChildrenChangeSourceAPI}; 189 ContainerNode::ChildrenChange change = {ContainerNode::TextChanged, prev iousSibling(), nextSibling(), ContainerNode::ChildrenChangeSourceAPI};
190 parentNode()->childrenChanged(change); 190 parentNode()->childrenChanged(change);
191 } 191 }
192 192
193 // Skip DOM mutation events if the modification is from parser. 193 // Skip DOM mutation events if the modification is from parser.
194 // Note that mutation observer events will still fire. 194 // Note that mutation observer events will still fire.
195 // Spec: https://html.spec.whatwg.org/multipage/syntax.html#insert-a-charact er 195 // Spec: https://html.spec.whatwg.org/multipage/syntax.html#insert-a-charact er
196 if (source != UpdateFromParser && !isInShadowTree()) { 196 if (source != UpdateFromParser && !isInShadowTree()) {
197 if (document().hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTEN ER)) 197 if (document().hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTEN ER))
198 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMCharact erDataModified, true, nullptr, oldData, m_data)); 198 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMCharact erDataModified, true, nullptr, oldData, m_data));
199 dispatchSubtreeModifiedEvent(); 199 dispatchSubtreeModifiedEvent();
200 } 200 }
201 InspectorInstrumentation::characterDataModified(this); 201 InspectorInstrumentation::characterDataModified(this);
202 } 202 }
203 203
204 int CharacterData::maxCharacterOffset() const 204 int CharacterData::maxCharacterOffset() const
205 { 205 {
206 return static_cast<int>(length()); 206 return static_cast<int>(length());
207 } 207 }
208 208
209 } // namespace blink 209 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698