diff --git a/mozilla/editor/base/nsEditor.cpp b/mozilla/editor/base/nsEditor.cpp index cac534a41a8..47ebcae1f26 100644 --- a/mozilla/editor/base/nsEditor.cpp +++ b/mozilla/editor/base/nsEditor.cpp @@ -749,21 +749,25 @@ NS_IMETHODIMP nsEditor::BeginTransaction() { NS_PRECONDITION(mUpdateCount>=0, "bad state"); + + nsCOMPtrselection; + nsresult selectionResult = GetSelection(getter_AddRefs(selection)); + if (NS_SUCCEEDED(selectionResult) && selection) { + selection->StartBatchChanges(); + } + if (nsnull!=mViewManager) { if (0==mUpdateCount) mViewManager->DisableRefresh(); mUpdateCount++; } + if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { mTxnMgr->BeginBatch(); } - nsCOMPtrselection; - nsresult selectionResult = GetSelection(getter_AddRefs(selection)); - if (NS_SUCCEEDED(selectionResult) && selection) { - selection->StartBatchChanges(); - } + return NS_OK; } @@ -771,21 +775,28 @@ NS_IMETHODIMP nsEditor::EndTransaction() { NS_PRECONDITION(mUpdateCount>0, "bad state"); - if (nsnull!=mViewManager) - { - mUpdateCount--; - if (0==mUpdateCount) - mViewManager->EnableRefresh(); - } + if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { mTxnMgr->EndBatch(); } + + if (nsnull!=mViewManager) + { + mUpdateCount--; + if (0==mUpdateCount) + { + mViewManager->EnableRefresh(); + HACKForceRedraw(); + } + } + nsCOMPtrselection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->EndBatchChanges(); } + return NS_OK; } @@ -1320,7 +1331,7 @@ NS_IMETHODIMP nsEditor::DeleteText(nsIDOMCharacterData *aElement, nsresult result = CreateTxnForDeleteText(aElement, aOffset, aLength, &txn); if (NS_SUCCEEDED(result)) { result = Do(txn); - HACKForceRedraw(); + // HACKForceRedraw(); } return result; } @@ -3022,7 +3033,7 @@ nsEditor::SetPreeditText(const nsString& aStringToInsert) mIMESelectionRange->SetEnd(node, offset); EndTransaction(); - HACKForceRedraw(); + // HACKForceRedraw(); return result; } diff --git a/mozilla/editor/base/nsHTMLEditor.cpp b/mozilla/editor/base/nsHTMLEditor.cpp index 30d0845cefb..68b3163d548 100644 --- a/mozilla/editor/base/nsHTMLEditor.cpp +++ b/mozilla/editor/base/nsHTMLEditor.cpp @@ -229,7 +229,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBreak() // of an error in Gecko which is not rendering the // document after a change via the DOM - gpk 2/13/99 // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result; @@ -258,7 +258,7 @@ NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) // of an error in Gecko which is not rendering the // document after a change via the DOM - gpk 2/13/99 // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result; @@ -1846,7 +1846,7 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, ns // of an error in Gecko which is not rendering the // document after a change via the DOM - gpk 2/13/99 // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result; diff --git a/mozilla/editor/base/nsTextEditor.cpp b/mozilla/editor/base/nsTextEditor.cpp index 6be65f43dbf..2cb23ef491b 100644 --- a/mozilla/editor/base/nsTextEditor.cpp +++ b/mozilla/editor/base/nsTextEditor.cpp @@ -451,7 +451,7 @@ NS_IMETHODIMP nsTextEditor::SetTextProperty(nsIAtom *aProperty, } if (gNoisy) {DebugDumpContent(); } // DEBUG //HACK TO DRAW CHANGES - HACKForceRedraw(); + // HACKForceRedraw(); //END HACK return result; } @@ -796,7 +796,7 @@ NS_IMETHODIMP nsTextEditor::DeleteSelection(nsIEditor::ECollapsedSelectionAction // of an error in Gecko which is not rendering the // document after a change via the DOM - gpk 2/13/99 // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result; @@ -830,7 +830,7 @@ NS_IMETHODIMP nsTextEditor::InsertText(const nsString& aStringToInsert) placeholderTxn->SetAbsorb(PR_FALSE); // this ends the merging of txns into placeholderTxn // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result; } diff --git a/mozilla/editor/libeditor/base/nsEditor.cpp b/mozilla/editor/libeditor/base/nsEditor.cpp index cac534a41a8..47ebcae1f26 100644 --- a/mozilla/editor/libeditor/base/nsEditor.cpp +++ b/mozilla/editor/libeditor/base/nsEditor.cpp @@ -749,21 +749,25 @@ NS_IMETHODIMP nsEditor::BeginTransaction() { NS_PRECONDITION(mUpdateCount>=0, "bad state"); + + nsCOMPtrselection; + nsresult selectionResult = GetSelection(getter_AddRefs(selection)); + if (NS_SUCCEEDED(selectionResult) && selection) { + selection->StartBatchChanges(); + } + if (nsnull!=mViewManager) { if (0==mUpdateCount) mViewManager->DisableRefresh(); mUpdateCount++; } + if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { mTxnMgr->BeginBatch(); } - nsCOMPtrselection; - nsresult selectionResult = GetSelection(getter_AddRefs(selection)); - if (NS_SUCCEEDED(selectionResult) && selection) { - selection->StartBatchChanges(); - } + return NS_OK; } @@ -771,21 +775,28 @@ NS_IMETHODIMP nsEditor::EndTransaction() { NS_PRECONDITION(mUpdateCount>0, "bad state"); - if (nsnull!=mViewManager) - { - mUpdateCount--; - if (0==mUpdateCount) - mViewManager->EnableRefresh(); - } + if ((nsITransactionManager *)nsnull!=mTxnMgr.get()) { mTxnMgr->EndBatch(); } + + if (nsnull!=mViewManager) + { + mUpdateCount--; + if (0==mUpdateCount) + { + mViewManager->EnableRefresh(); + HACKForceRedraw(); + } + } + nsCOMPtrselection; nsresult selectionResult = GetSelection(getter_AddRefs(selection)); if (NS_SUCCEEDED(selectionResult) && selection) { selection->EndBatchChanges(); } + return NS_OK; } @@ -1320,7 +1331,7 @@ NS_IMETHODIMP nsEditor::DeleteText(nsIDOMCharacterData *aElement, nsresult result = CreateTxnForDeleteText(aElement, aOffset, aLength, &txn); if (NS_SUCCEEDED(result)) { result = Do(txn); - HACKForceRedraw(); + // HACKForceRedraw(); } return result; } @@ -3022,7 +3033,7 @@ nsEditor::SetPreeditText(const nsString& aStringToInsert) mIMESelectionRange->SetEnd(node, offset); EndTransaction(); - HACKForceRedraw(); + // HACKForceRedraw(); return result; } diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 30d0845cefb..68b3163d548 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -229,7 +229,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBreak() // of an error in Gecko which is not rendering the // document after a change via the DOM - gpk 2/13/99 // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result; @@ -258,7 +258,7 @@ NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) // of an error in Gecko which is not rendering the // document after a change via the DOM - gpk 2/13/99 // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result; @@ -1846,7 +1846,7 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, ns // of an error in Gecko which is not rendering the // document after a change via the DOM - gpk 2/13/99 // BEGIN HACK!!! - HACKForceRedraw(); + // HACKForceRedraw(); // END HACK return result;