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

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

Issue 23874007: Rename AttachBehavior to RecalcStyleBehavior (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix enum usage Created 7 years, 3 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
« no previous file with comments | « Source/core/dom/CharacterData.h ('k') | Source/core/dom/ContainerNode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 void CharacterData::appendData(const String& data) 111 void CharacterData::appendData(const String& data)
112 { 112 {
113 String newStr = m_data + data; 113 String newStr = m_data + data;
114 114
115 setDataAndUpdate(newStr, m_data.length(), 0, data.length()); 115 setDataAndUpdate(newStr, m_data.length(), 0, data.length());
116 116
117 // FIXME: Should we call textInserted here? 117 // FIXME: Should we call textInserted here?
118 } 118 }
119 119
120 void CharacterData::insertData(unsigned offset, const String& data, ExceptionSta te& es, AttachBehavior attachBehavior) 120 void CharacterData::insertData(unsigned offset, const String& data, ExceptionSta te& es, RecalcStyleBehavior recalcStyleBehavior)
121 { 121 {
122 if (offset > length()) { 122 if (offset > length()) {
123 es.throwDOMException(IndexSizeError); 123 es.throwDOMException(IndexSizeError);
124 return; 124 return;
125 } 125 }
126 126
127 String newStr = m_data; 127 String newStr = m_data;
128 newStr.insert(data, offset); 128 newStr.insert(data, offset);
129 129
130 setDataAndUpdate(newStr, offset, 0, data.length(), attachBehavior); 130 setDataAndUpdate(newStr, offset, 0, data.length(), recalcStyleBehavior);
131 131
132 document().textInserted(this, offset, data.length()); 132 document().textInserted(this, offset, data.length());
133 } 133 }
134 134
135 void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState& es, AttachBehavior attachBehavior) 135 void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState& es, RecalcStyleBehavior recalcStyleBehavior)
136 { 136 {
137 if (offset > length()) { 137 if (offset > length()) {
138 es.throwDOMException(IndexSizeError); 138 es.throwDOMException(IndexSizeError);
139 return; 139 return;
140 } 140 }
141 141
142 unsigned realCount; 142 unsigned realCount;
143 if (offset + count > length()) 143 if (offset + count > length())
144 realCount = length() - offset; 144 realCount = length() - offset;
145 else 145 else
146 realCount = count; 146 realCount = count;
147 147
148 String newStr = m_data; 148 String newStr = m_data;
149 newStr.remove(offset, realCount); 149 newStr.remove(offset, realCount);
150 150
151 setDataAndUpdate(newStr, offset, count, 0, attachBehavior); 151 setDataAndUpdate(newStr, offset, count, 0, recalcStyleBehavior);
152 152
153 document().textRemoved(this, offset, realCount); 153 document().textRemoved(this, offset, realCount);
154 } 154 }
155 155
156 void CharacterData::replaceData(unsigned offset, unsigned count, const String& d ata, ExceptionState& es) 156 void CharacterData::replaceData(unsigned offset, unsigned count, const String& d ata, ExceptionState& es)
157 { 157 {
158 if (offset > length()) { 158 if (offset > length()) {
159 es.throwDOMException(IndexSizeError); 159 es.throwDOMException(IndexSizeError);
160 return; 160 return;
161 } 161 }
(...skipping 23 matching lines...) Expand all
185 bool CharacterData::containsOnlyWhitespace() const 185 bool CharacterData::containsOnlyWhitespace() const
186 { 186 {
187 return m_data.containsOnlyWhitespace(); 187 return m_data.containsOnlyWhitespace();
188 } 188 }
189 189
190 void CharacterData::setNodeValue(const String& nodeValue) 190 void CharacterData::setNodeValue(const String& nodeValue)
191 { 191 {
192 setData(nodeValue); 192 setData(nodeValue);
193 } 193 }
194 194
195 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep lacedData, unsigned oldLength, unsigned newLength, AttachBehavior attachBehavior ) 195 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep lacedData, unsigned oldLength, unsigned newLength, RecalcStyleBehavior recalcSty leBehavior)
196 { 196 {
197 String oldData = m_data; 197 String oldData = m_data;
198 m_data = newData; 198 m_data = newData;
199 199
200 ASSERT(!renderer() || isTextNode()); 200 ASSERT(!renderer() || isTextNode());
201 if (isTextNode()) 201 if (isTextNode())
202 toText(this)->updateTextRenderer(offsetOfReplacedData, oldLength, attach Behavior); 202 toText(this)->updateTextRenderer(offsetOfReplacedData, oldLength, recalc StyleBehavior);
203 203
204 if (nodeType() == PROCESSING_INSTRUCTION_NODE) 204 if (nodeType() == PROCESSING_INSTRUCTION_NODE)
205 toProcessingInstruction(this)->checkStyleSheet(); 205 toProcessingInstruction(this)->checkStyleSheet();
206 206
207 if (document().frame()) 207 if (document().frame())
208 document().frame()->selection().textWasReplaced(this, offsetOfReplacedDa ta, oldLength, newLength); 208 document().frame()->selection().textWasReplaced(this, offsetOfReplacedDa ta, oldLength, newLength);
209 209
210 document().incDOMTreeVersion(); 210 document().incDOMTreeVersion();
211 didModifyData(oldData); 211 didModifyData(oldData);
212 } 212 }
(...skipping 18 matching lines...) Expand all
231 { 231 {
232 return static_cast<int>(length()); 232 return static_cast<int>(length());
233 } 233 }
234 234
235 bool CharacterData::offsetInCharacters() const 235 bool CharacterData::offsetInCharacters() const
236 { 236 {
237 return true; 237 return true;
238 } 238 }
239 239
240 } // namespace WebCore 240 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/CharacterData.h ('k') | Source/core/dom/ContainerNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698