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

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

Issue 2106863006: Get rid of unused parameter RecalcStyleBehavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-30T13:23:43 Created 4 years, 5 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 void CharacterData::appendData(const String& data) 72 void CharacterData::appendData(const String& data)
73 { 73 {
74 String newStr = m_data + data; 74 String newStr = m_data + data;
75 75
76 setDataAndUpdate(newStr, m_data.length(), 0, data.length(), UpdateFromNonPar ser); 76 setDataAndUpdate(newStr, m_data.length(), 0, data.length(), UpdateFromNonPar ser);
77 77
78 // FIXME: Should we call textInserted here? 78 // FIXME: Should we call textInserted here?
79 } 79 }
80 80
81 void CharacterData::insertData(unsigned offset, const String& data, ExceptionSta te& exceptionState, RecalcStyleBehavior recalcStyleBehavior) 81 void CharacterData::insertData(unsigned offset, const String& data, ExceptionSta te& exceptionState)
82 { 82 {
83 if (offset > length()) { 83 if (offset > length()) {
84 exceptionState.throwDOMException(IndexSizeError, "The offset " + String: :number(offset) + " is greater than the node's length (" + String::number(length ()) + ")."); 84 exceptionState.throwDOMException(IndexSizeError, "The offset " + String: :number(offset) + " is greater than the node's length (" + String::number(length ()) + ").");
85 return; 85 return;
86 } 86 }
87 87
88 String newStr = m_data; 88 String newStr = m_data;
89 newStr.insert(data, offset); 89 newStr.insert(data, offset);
90 90
91 setDataAndUpdate(newStr, offset, 0, data.length(), UpdateFromNonParser, reca lcStyleBehavior); 91 setDataAndUpdate(newStr, offset, 0, data.length(), UpdateFromNonParser);
92 92
93 document().didInsertText(this, offset, data.length()); 93 document().didInsertText(this, offset, data.length());
94 } 94 }
95 95
96 static bool validateOffsetCount(unsigned offset, unsigned count, unsigned length , unsigned& realCount, ExceptionState& exceptionState) 96 static bool validateOffsetCount(unsigned offset, unsigned count, unsigned length , unsigned& realCount, ExceptionState& exceptionState)
97 { 97 {
98 if (offset > length) { 98 if (offset > length) {
99 exceptionState.throwDOMException(IndexSizeError, "The offset " + String: :number(offset) + " is greater than the node's length (" + String::number(length ) + ")."); 99 exceptionState.throwDOMException(IndexSizeError, "The offset " + String: :number(offset) + " is greater than the node's length (" + String::number(length ) + ").");
100 return false; 100 return false;
101 } 101 }
102 102
103 CheckedNumeric<unsigned> offsetCount = offset; 103 CheckedNumeric<unsigned> offsetCount = offset;
104 offsetCount += count; 104 offsetCount += count;
105 105
106 if (!offsetCount.IsValid() || offset + count > length) 106 if (!offsetCount.IsValid() || offset + count > length)
107 realCount = length - offset; 107 realCount = length - offset;
108 else 108 else
109 realCount = count; 109 realCount = count;
110 110
111 return true; 111 return true;
112 } 112 }
113 113
114 void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState& exceptionState, RecalcStyleBehavior recalcStyleBehavior) 114 void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState& exceptionState)
115 { 115 {
116 unsigned realCount = 0; 116 unsigned realCount = 0;
117 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState) ) 117 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState) )
118 return; 118 return;
119 119
120 String newStr = m_data; 120 String newStr = m_data;
121 newStr.remove(offset, realCount); 121 newStr.remove(offset, realCount);
122 122
123 setDataAndUpdate(newStr, offset, realCount, 0, UpdateFromNonParser, recalcSt yleBehavior); 123 setDataAndUpdate(newStr, offset, realCount, 0, UpdateFromNonParser);
124 124
125 document().didRemoveText(this, offset, realCount); 125 document().didRemoveText(this, offset, realCount);
126 } 126 }
127 127
128 void CharacterData::replaceData(unsigned offset, unsigned count, const String& d ata, ExceptionState& exceptionState) 128 void CharacterData::replaceData(unsigned offset, unsigned count, const String& d ata, ExceptionState& exceptionState)
129 { 129 {
130 unsigned realCount = 0; 130 unsigned realCount = 0;
131 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState) ) 131 if (!validateOffsetCount(offset, count, length(), realCount, exceptionState) )
132 return; 132 return;
133 133
(...skipping 16 matching lines...) Expand all
150 bool CharacterData::containsOnlyWhitespace() const 150 bool CharacterData::containsOnlyWhitespace() const
151 { 151 {
152 return m_data.containsOnlyWhitespace(); 152 return m_data.containsOnlyWhitespace();
153 } 153 }
154 154
155 void CharacterData::setNodeValue(const String& nodeValue) 155 void CharacterData::setNodeValue(const String& nodeValue)
156 { 156 {
157 setData(nodeValue); 157 setData(nodeValue);
158 } 158 }
159 159
160 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep lacedData, unsigned oldLength, unsigned newLength, UpdateSource source, RecalcSt yleBehavior recalcStyleBehavior) 160 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep lacedData, unsigned oldLength, unsigned newLength, UpdateSource source)
161 { 161 {
162 if (source != UpdateFromParser) 162 if (source != UpdateFromParser)
163 document().dataWillChange(*this); 163 document().dataWillChange(*this);
164 164
165 String oldData = m_data; 165 String oldData = m_data;
166 m_data = newData; 166 m_data = newData;
167 167
168 DCHECK(!layoutObject() || isTextNode()); 168 DCHECK(!layoutObject() || isTextNode());
169 if (isTextNode()) 169 if (isTextNode())
170 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength, re calcStyleBehavior); 170 toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength);
171 171
172 if (source != UpdateFromParser) { 172 if (source != UpdateFromParser) {
173 if (getNodeType() == PROCESSING_INSTRUCTION_NODE) 173 if (getNodeType() == PROCESSING_INSTRUCTION_NODE)
174 toProcessingInstruction(this)->didAttributeChanged(); 174 toProcessingInstruction(this)->didAttributeChanged();
175 175
176 if (document().frame()) 176 if (document().frame())
177 document().frame()->selection().didUpdateCharacterData(this, offsetO fReplacedData, oldLength, newLength); 177 document().frame()->selection().didUpdateCharacterData(this, offsetO fReplacedData, oldLength, newLength);
178 } 178 }
179 179
180 document().incDOMTreeVersion(); 180 document().incDOMTreeVersion();
(...skipping 20 matching lines...) Expand all
201 } 201 }
202 InspectorInstrumentation::characterDataModified(this); 202 InspectorInstrumentation::characterDataModified(this);
203 } 203 }
204 204
205 int CharacterData::maxCharacterOffset() const 205 int CharacterData::maxCharacterOffset() const
206 { 206 {
207 return static_cast<int>(length()); 207 return static_cast<int>(length());
208 } 208 }
209 209
210 } // namespace blink 210 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/CharacterData.h ('k') | third_party/WebKit/Source/core/dom/Text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698