From a8ec8337df5aa400289f18013bcdbd2654a42922 Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Mon, 18 Oct 1999 21:59:19 +0000 Subject: [PATCH] some extremely minor cleanup of bugs found by ftang. Thanks, frank. git-svn-id: svn://10.0.0.236/trunk@51036 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/CreateElementTxn.cpp | 11 +++++++---- mozilla/editor/libeditor/base/CreateElementTxn.cpp | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/mozilla/editor/base/CreateElementTxn.cpp b/mozilla/editor/base/CreateElementTxn.cpp index 2a0b87300e8..39123c0ccbe 100644 --- a/mozilla/editor/base/CreateElementTxn.cpp +++ b/mozilla/editor/base/CreateElementTxn.cpp @@ -167,7 +167,8 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) PRInt32 offset=0; if (mRefNode) { - nsEditor::GetChildOffset(mRefNode, mParent, offset); + result = nsEditor::GetChildOffset(mRefNode, mParent, offset); + if (NS_FAILED(result)) return result; } result = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after undo of insert."); @@ -200,9 +201,11 @@ NS_IMETHODIMP CreateElementTxn::Redo(void) if (NS_FAILED(result)) return result; if (!selection) return NS_ERROR_NULL_POINTER; PRInt32 offset=0; - nsEditor::GetChildOffset(mNewNode, mParent, offset); - result = selection->Collapse(mParent, offset); - NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after undo of insert."); + result = nsEditor::GetChildOffset(mNewNode, mParent, offset); + if (NS_FAILED(result)) return result; + + result = selection->Collapse(mParent, offset+1); + NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after redo of insert."); } return result; } diff --git a/mozilla/editor/libeditor/base/CreateElementTxn.cpp b/mozilla/editor/libeditor/base/CreateElementTxn.cpp index 2a0b87300e8..39123c0ccbe 100644 --- a/mozilla/editor/libeditor/base/CreateElementTxn.cpp +++ b/mozilla/editor/libeditor/base/CreateElementTxn.cpp @@ -167,7 +167,8 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) PRInt32 offset=0; if (mRefNode) { - nsEditor::GetChildOffset(mRefNode, mParent, offset); + result = nsEditor::GetChildOffset(mRefNode, mParent, offset); + if (NS_FAILED(result)) return result; } result = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after undo of insert."); @@ -200,9 +201,11 @@ NS_IMETHODIMP CreateElementTxn::Redo(void) if (NS_FAILED(result)) return result; if (!selection) return NS_ERROR_NULL_POINTER; PRInt32 offset=0; - nsEditor::GetChildOffset(mNewNode, mParent, offset); - result = selection->Collapse(mParent, offset); - NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after undo of insert."); + result = nsEditor::GetChildOffset(mNewNode, mParent, offset); + if (NS_FAILED(result)) return result; + + result = selection->Collapse(mParent, offset+1); + NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after redo of insert."); } return result; }