Add HACKForceRedraw() to force a redraw until the drawing

problems are solved in Gecko


git-svn-id: svn://10.0.0.236/trunk@24088 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kostello%netscape.com 1999-03-14 00:31:35 +00:00
parent d44739f283
commit 200ff1e40c
4 changed files with 96 additions and 0 deletions

View File

@ -59,6 +59,17 @@
#include "SplitElementTxn.h"
#include "JoinElementTxn.h"
#define HACK_FORCE_REDRAW 1
#ifdef HACK_FORCE_REDRAW
// INCLUDES FOR EVIL HACK TO FOR REDRAW
// BEGIN
#include "nsIViewManager.h"
#include "nsIView.h"
// END
#endif
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
@ -1129,6 +1140,7 @@ NS_IMETHODIMP nsEditor::DeleteText(nsIDOMCharacterData *aElement,
nsresult result = CreateTxnForDeleteText(aElement, aOffset, aLength, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
HACKForceRedraw();
}
return result;
}
@ -1832,6 +1844,35 @@ nsresult nsIEditorSupport::GetChildOffset(nsIDOMNode *aChild, nsIDOMNode *aParen
//END nsEditor Private methods
void nsEditor::HACKForceRedraw()
{
#ifdef HACK_FORCE_REDRAW
// XXXX: Horrible hack! We are doing this because
// of an error in Gecko which is not rendering the
// document after a change via the DOM - gpk 2/11/99
// BEGIN HACK!!!
nsIPresShell* shell = nsnull;
GetPresShell(&shell);
if (nsnull != shell) {
nsIViewManager* viewmgr = nsnull;;
nsIView* view = nsnull;
shell->GetViewManager(&viewmgr);
if (nsnull != viewmgr) {
viewmgr->GetRootView(view);
if (nsnull != view) {
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
}
NS_RELEASE(viewmgr);
}
}
// END HACK
#endif
}
NS_IMETHODIMP nsEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject)
{
nsresult result = NS_ERROR_FAILURE; // we return an error unless we get the index

View File

@ -291,6 +291,13 @@ protected:
*/
NS_IMETHOD CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, EditAggregateTxn **aAggTxn);
protected:
// XXXX: Horrible hack! We are doing this because
// of an error in Gecko which is not rendering the
// document after a change via the DOM - gpk 2/13/99
void HACKForceRedraw(void);
};

View File

@ -59,6 +59,17 @@
#include "SplitElementTxn.h"
#include "JoinElementTxn.h"
#define HACK_FORCE_REDRAW 1
#ifdef HACK_FORCE_REDRAW
// INCLUDES FOR EVIL HACK TO FOR REDRAW
// BEGIN
#include "nsIViewManager.h"
#include "nsIView.h"
// END
#endif
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
@ -1129,6 +1140,7 @@ NS_IMETHODIMP nsEditor::DeleteText(nsIDOMCharacterData *aElement,
nsresult result = CreateTxnForDeleteText(aElement, aOffset, aLength, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
HACKForceRedraw();
}
return result;
}
@ -1832,6 +1844,35 @@ nsresult nsIEditorSupport::GetChildOffset(nsIDOMNode *aChild, nsIDOMNode *aParen
//END nsEditor Private methods
void nsEditor::HACKForceRedraw()
{
#ifdef HACK_FORCE_REDRAW
// XXXX: Horrible hack! We are doing this because
// of an error in Gecko which is not rendering the
// document after a change via the DOM - gpk 2/11/99
// BEGIN HACK!!!
nsIPresShell* shell = nsnull;
GetPresShell(&shell);
if (nsnull != shell) {
nsIViewManager* viewmgr = nsnull;;
nsIView* view = nsnull;
shell->GetViewManager(&viewmgr);
if (nsnull != viewmgr) {
viewmgr->GetRootView(view);
if (nsnull != view) {
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
}
NS_RELEASE(viewmgr);
}
}
// END HACK
#endif
}
NS_IMETHODIMP nsEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject)
{
nsresult result = NS_ERROR_FAILURE; // we return an error unless we get the index

View File

@ -291,6 +291,13 @@ protected:
*/
NS_IMETHOD CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, EditAggregateTxn **aAggTxn);
protected:
// XXXX: Horrible hack! We are doing this because
// of an error in Gecko which is not rendering the
// document after a change via the DOM - gpk 2/13/99
void HACKForceRedraw(void);
};