Bug 1947107 - Rename WhiteSpaceVisibilityKeeper::ReplaceText r=m_kato
Despite the name, it does not replace text of the specified the range. The range is not collapsed only when updating composition string and even in the case, `EditorBase::InsertTextWithTransaction` automatically creates a `CompositionTransaction` and the transaction will delete the existing composition string before inserting the new string. For making the job of the method clearer, this patch renames it as `InsertOrUpdateCompositionString` and it's actually implemented by `InsertTextOrInsertOrUpdateCompositionString`. Differential Revision: https://phabricator.services.mozilla.com/D237525
This commit is contained in:
@@ -1234,15 +1234,14 @@ Result<EditActionResult, nsresult> HTMLEditor::HandleInsertText(
|
||||
return EditActionResult::HandledResult();
|
||||
}
|
||||
|
||||
auto compositionEndPoint = GetLastIMESelectionEndPoint<EditorDOMPoint>();
|
||||
if (!compositionEndPoint.IsSet()) {
|
||||
compositionEndPoint = pointToInsert;
|
||||
}
|
||||
const auto compositionEndPoint =
|
||||
GetLastIMESelectionEndPoint<EditorDOMPoint>();
|
||||
Result<InsertTextResult, nsresult> replaceTextResult =
|
||||
WhiteSpaceVisibilityKeeper::ReplaceText(
|
||||
WhiteSpaceVisibilityKeeper::InsertOrUpdateCompositionString(
|
||||
*this, aInsertionString,
|
||||
EditorDOMRange(pointToInsert, compositionEndPoint),
|
||||
InsertTextTo::ExistingTextNodeIfAvailable);
|
||||
compositionEndPoint.IsSet()
|
||||
? EditorDOMRange(pointToInsert, compositionEndPoint)
|
||||
: EditorDOMRange(pointToInsert));
|
||||
if (MOZ_UNLIKELY(replaceTextResult.isErr())) {
|
||||
NS_WARNING("WhiteSpaceVisibilityKeeper::ReplaceText() failed");
|
||||
return replaceTextResult.propagateErr();
|
||||
|
||||
Reference in New Issue
Block a user