mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1357206 part 1. Move conversion of the new textarea/input value to DOM linebreaks to before we check whether the new value matches the old value. r=ehsan
Otherwise we end up calling into editor code and doing a bunch of work even though the value hasn't actually changed, when a value with \r in it is set repeatedly.
This commit is contained in:
parent
12bc4392d8
commit
107496cc39
@ -2523,19 +2523,19 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
|
||||
|
||||
AutoWeakFrame weakFrame(mBoundFrame);
|
||||
|
||||
// \r is an illegal character in the dom, but people use them,
|
||||
// so convert windows and mac platform linebreaks to \n:
|
||||
if (newValue.FindChar(char16_t('\r')) != -1) {
|
||||
if (!nsContentUtils::PlatformToDOMLineBreaks(newValue, fallible)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// this is necessary to avoid infinite recursion
|
||||
if (!currentValue.Equals(newValue))
|
||||
{
|
||||
ValueSetter valueSetter(mEditor);
|
||||
|
||||
// \r is an illegal character in the dom, but people use them,
|
||||
// so convert windows and mac platform linebreaks to \n:
|
||||
if (newValue.FindChar(char16_t('\r')) != -1) {
|
||||
if (!nsContentUtils::PlatformToDOMLineBreaks(newValue, fallible)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mEditor->GetDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc) {
|
||||
|
Loading…
Reference in New Issue
Block a user