/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
IgnoredErrorResult error;
editorBase->DoReplaceText(textNode, mOffset, mStringToBeReplaced.Length(),
mStringToInsert, error); if (MOZ_UNLIKELY(error.Failed())) {
NS_WARNING("EditorBase::DoReplaceText() failed"); return error.StealNSResult();
} // XXX What should we do if mutation event listener changed the node?
editorBase->RangeUpdaterRef().SelAdjReplaceText(textNode, mOffset,
mStringToBeReplaced.Length(),
mStringToInsert.Length()); return NS_OK;
}
editorBase->DoReplaceText(textNode, mOffset, mStringToInsert.Length(),
mStringToBeReplaced, error); if (MOZ_UNLIKELY(error.Failed())) {
NS_WARNING("EditorBase::DoReplaceText() failed"); return error.StealNSResult();
} // XXX What should we do if mutation event listener changed the node?
editorBase->RangeUpdaterRef().SelAdjReplaceText(textNode, mOffset,
mStringToInsert.Length(),
mStringToBeReplaced.Length());
if (!editorBase->AllowsTransactionsToChangeSelection()) { return NS_OK;
}
// XXX Should we stop setting selection when mutation event listener // modifies the text node?
editorBase->CollapseSelectionTo(
EditorRawDOMPoint(textNode, mOffset + mStringToBeReplaced.Length()),
error); if (MOZ_UNLIKELY(error.ErrorCodeIs(NS_ERROR_EDITOR_DESTROYED))) {
NS_WARNING( "EditorBase::CollapseSelectionTo() caused destroying the editor"); return NS_ERROR_EDITOR_DESTROYED;
}
NS_ASSERTION(!error.Failed(), "EditorBase::CollapseSelectionTo() failed, but ignored"); return NS_OK;
}
editorBase->DoReplaceText(textNode, mOffset, mStringToBeReplaced.Length(),
mStringToInsert, error); if (MOZ_UNLIKELY(error.Failed())) {
NS_WARNING("EditorBase::DoReplaceText() failed"); return error.StealNSResult();
} // XXX What should we do if mutation event listener changed the node?
editorBase->RangeUpdaterRef().SelAdjReplaceText(textNode, mOffset,
mStringToBeReplaced.Length(),
mStringToInsert.Length());
if (!editorBase->AllowsTransactionsToChangeSelection()) { return NS_OK;
}
// XXX Should we stop setting selection when mutation event listener // modifies the text node?
editorBase->CollapseSelectionTo(SuggestPointToPutCaret<EditorRawDOMPoint>(),
error); if (MOZ_UNLIKELY(error.ErrorCodeIs(NS_ERROR_EDITOR_DESTROYED))) {
NS_WARNING( "EditorBase::CollapseSelectionTo() caused destroying the editor"); return NS_ERROR_EDITOR_DESTROYED;
}
NS_ASSERTION(!error.Failed(), "EditorBase::CollapseSelectionTo() failed, but ignored"); return NS_OK;
}
} // namespace mozilla
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.