Bug 1655388 - part 4: Get rid of WhiteSpaceVisiblityKeeper::PrepareToDeleteNode() r=m_kato

Now, the new method is only user of it.  So, we can get rid of it.

Depends on D87031

Differential Revision: https://phabricator.services.mozilla.com/D87032
This commit is contained in:
Masayuki Nakano 2020-08-18 23:03:08 +00:00
parent e844854c69
commit 416bf2f5ad
2 changed files with 11 additions and 31 deletions

View File

@ -63,28 +63,6 @@ template WSRunScanner::TextFragmentData::TextFragmentData(
template WSRunScanner::TextFragmentData::TextFragmentData(
const EditorDOMPointInText& aPoint, const Element* aEditingHost);
nsresult WhiteSpaceVisibilityKeeper::PrepareToDeleteNode(
HTMLEditor& aHTMLEditor, nsIContent* aContent) {
if (NS_WARN_IF(!aContent)) {
return NS_ERROR_INVALID_ARG;
}
EditorRawDOMPoint atContent(aContent);
if (!atContent.IsSet()) {
NS_WARNING("aContent was an orphan node");
return NS_ERROR_INVALID_ARG;
}
nsresult rv = WhiteSpaceVisibilityKeeper::
MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange(
aHTMLEditor, EditorDOMRange(atContent, atContent.NextPoint()));
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv),
"WhiteSpaceVisibilityKeeper::"
"MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange() failed");
return rv;
}
nsresult WhiteSpaceVisibilityKeeper::PrepareToSplitAcrossBlocks(
HTMLEditor& aHTMLEditor, nsCOMPtr<nsINode>* aSplitNode,
int32_t* aSplitOffset) {
@ -1089,10 +1067,18 @@ nsresult WhiteSpaceVisibilityKeeper::DeleteInclusiveNextWhiteSpace(
nsresult WhiteSpaceVisibilityKeeper::DeleteContentNodeAndJoinTextNodesAroundIt(
HTMLEditor& aHTMLEditor, nsIContent& aContentToDelete,
const EditorDOMPoint& aCaretPoint) {
nsresult rv = WhiteSpaceVisibilityKeeper::PrepareToDeleteNode(
aHTMLEditor, &aContentToDelete);
EditorDOMPoint atContent(&aContentToDelete);
if (!atContent.IsSet()) {
NS_WARNING("Deleting content node was an orphan node");
return NS_ERROR_FAILURE;
}
nsresult rv = WhiteSpaceVisibilityKeeper::
MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange(
aHTMLEditor, EditorDOMRange(atContent, atContent.NextPoint()));
if (NS_FAILED(rv)) {
NS_WARNING("WhiteSpaceVisibilityKeeper::PrepareToDeleteNode() failed");
NS_WARNING(
"WhiteSpaceVisibilityKeeper::"
"MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange() failed");
return rv;
}

View File

@ -1226,12 +1226,6 @@ class WhiteSpaceVisibilityKeeper final {
return rv;
}
// PrepareToDeleteNode fixes up ws before and after aContent in preparation
// for aContent to be deleted. Example of fixup: trailingws before
// aContent needs to be removed.
MOZ_CAN_RUN_SCRIPT static nsresult PrepareToDeleteNode(
HTMLEditor& aHTMLEditor, nsIContent* aContent);
// PrepareToSplitAcrossBlocks fixes up ws before and after
// {aSplitNode,aSplitOffset} in preparation for a block parent to be split.
// Note that the aSplitNode and aSplitOffset are adjusted in response to