Loading editor/base/CreateElementTxn.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -95,12 +95,10 @@ NS_IMETHODIMP CreateElementTxn::Do(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading @@ -121,12 +119,10 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading @@ -141,12 +137,10 @@ NS_IMETHODIMP CreateElementTxn::Redo(void) nsCOMPtr<nsIDOMSelection> selection; result = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); nsresult selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading editor/base/DeleteTextTxn.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -55,10 +55,8 @@ NS_IMETHODIMP DeleteTextTxn::Do(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); selectionResult = selection->Collapse(mElement, mOffset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading @@ -78,10 +76,8 @@ NS_IMETHODIMP DeleteTextTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); selectionResult = selection->Collapse(mElement, mOffset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading editor/base/InsertTextTxn.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -59,13 +59,11 @@ NS_IMETHODIMP InsertTextTxn::Do(void) nsresult result = mPresShell->GetSelection(getter_AddRefs(selection)); NS_ASSERTION(selection,"Could not get selection in InsertTextTxn::Do\n"); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); result = mElement->InsertData(mOffset, mStringToInsert); if (NS_SUCCEEDED(result)) { result = selection->Collapse(mElement, mOffset+mStringToInsert.Length()); NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after insert."); } selection->EndBatchChanges(); } return result; } Loading @@ -80,10 +78,8 @@ NS_IMETHODIMP InsertTextTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; result = mPresShell->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); result = selection->Collapse(mElement, mOffset); NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading editor/base/nsEditor.cpp +39 −21 Original line number Diff line number Diff line Loading @@ -586,6 +586,10 @@ NS_IMETHODIMP nsEditor::Do(nsITransaction *aTxn) { nsresult result = NS_OK; nsCOMPtr<nsIDOMSelection>selection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); if (aTxn) { if (mTxnMgr) { Loading @@ -595,6 +599,8 @@ nsEditor::Do(nsITransaction *aTxn) result = aTxn->Do(); } } selection->EndBatchChanges(); } return result; } Loading @@ -602,6 +608,10 @@ NS_IMETHODIMP nsEditor::Undo(PRUint32 aCount) { nsresult result = NS_OK; nsCOMPtr<nsIDOMSelection>selection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { PRUint32 i=0; Loading @@ -612,6 +622,8 @@ nsEditor::Undo(PRUint32 aCount) break; } } selection->EndBatchChanges(); } return result; } Loading @@ -619,6 +631,10 @@ NS_IMETHODIMP nsEditor::Redo(PRUint32 aCount) { nsresult result = NS_OK; nsCOMPtr<nsIDOMSelection>selection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { PRUint32 i=0; Loading @@ -629,6 +645,8 @@ nsEditor::Redo(PRUint32 aCount) break; } } selection->EndBatchChanges(); } return result; } Loading editor/libeditor/base/CreateElementTxn.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -95,12 +95,10 @@ NS_IMETHODIMP CreateElementTxn::Do(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading @@ -121,12 +119,10 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading @@ -141,12 +137,10 @@ NS_IMETHODIMP CreateElementTxn::Redo(void) nsCOMPtr<nsIDOMSelection> selection; result = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); nsresult selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading Loading
editor/base/CreateElementTxn.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -95,12 +95,10 @@ NS_IMETHODIMP CreateElementTxn::Do(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading @@ -121,12 +119,10 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading @@ -141,12 +137,10 @@ NS_IMETHODIMP CreateElementTxn::Redo(void) nsCOMPtr<nsIDOMSelection> selection; result = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); nsresult selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading
editor/base/DeleteTextTxn.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -55,10 +55,8 @@ NS_IMETHODIMP DeleteTextTxn::Do(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); selectionResult = selection->Collapse(mElement, mOffset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading @@ -78,10 +76,8 @@ NS_IMETHODIMP DeleteTextTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); selectionResult = selection->Collapse(mElement, mOffset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading
editor/base/InsertTextTxn.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -59,13 +59,11 @@ NS_IMETHODIMP InsertTextTxn::Do(void) nsresult result = mPresShell->GetSelection(getter_AddRefs(selection)); NS_ASSERTION(selection,"Could not get selection in InsertTextTxn::Do\n"); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); result = mElement->InsertData(mOffset, mStringToInsert); if (NS_SUCCEEDED(result)) { result = selection->Collapse(mElement, mOffset+mStringToInsert.Length()); NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after insert."); } selection->EndBatchChanges(); } return result; } Loading @@ -80,10 +78,8 @@ NS_IMETHODIMP InsertTextTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; result = mPresShell->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); result = selection->Collapse(mElement, mOffset); NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading
editor/base/nsEditor.cpp +39 −21 Original line number Diff line number Diff line Loading @@ -586,6 +586,10 @@ NS_IMETHODIMP nsEditor::Do(nsITransaction *aTxn) { nsresult result = NS_OK; nsCOMPtr<nsIDOMSelection>selection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); if (aTxn) { if (mTxnMgr) { Loading @@ -595,6 +599,8 @@ nsEditor::Do(nsITransaction *aTxn) result = aTxn->Do(); } } selection->EndBatchChanges(); } return result; } Loading @@ -602,6 +608,10 @@ NS_IMETHODIMP nsEditor::Undo(PRUint32 aCount) { nsresult result = NS_OK; nsCOMPtr<nsIDOMSelection>selection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { PRUint32 i=0; Loading @@ -612,6 +622,8 @@ nsEditor::Undo(PRUint32 aCount) break; } } selection->EndBatchChanges(); } return result; } Loading @@ -619,6 +631,10 @@ NS_IMETHODIMP nsEditor::Redo(PRUint32 aCount) { nsresult result = NS_OK; nsCOMPtr<nsIDOMSelection>selection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { PRUint32 i=0; Loading @@ -629,6 +645,8 @@ nsEditor::Redo(PRUint32 aCount) break; } } selection->EndBatchChanges(); } return result; } Loading
editor/libeditor/base/CreateElementTxn.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -95,12 +95,10 @@ NS_IMETHODIMP CreateElementTxn::Do(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } } Loading @@ -121,12 +119,10 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) nsCOMPtr<nsIDOMSelection> selection; nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset); selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading @@ -141,12 +137,10 @@ NS_IMETHODIMP CreateElementTxn::Redo(void) nsCOMPtr<nsIDOMSelection> selection; result = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(result) && selection) { selection->StartBatchChanges(); PRInt32 offset=0; nsIEditorSupport::GetChildOffset(mNewNode, mParent, offset); nsresult selectionResult = selection->Collapse(mParent, offset); NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert."); selection->EndBatchChanges(); } } return result; Loading