Bug 567701 - Don't store a view manager pointer in nsEditor; retrieve it lazily; r=roc

(transplanted from 752f109a5d1157b0e6d024a5e5ccf484c6437304)

--HG--
extra : transplant_source : u/%10%9A%5D%11W%B0%E6%D0%24%A5%E5%CC%F4%84%C6Cs%04
This commit is contained in:
Ehsan Akhgari 2010-05-23 22:13:00 -04:00
parent db7c5538a4
commit d7b005e021
2 changed files with 12 additions and 12 deletions

View File

@ -65,7 +65,6 @@
#include "nsITransactionManager.h"
#include "nsIAbsorbingTransaction.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
#include "nsISelectionController.h"
@ -242,14 +241,6 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot
nsCOMPtr<nsINode> document = do_QueryInterface(aDoc);
document->AddMutationObserver(this);
// Set up the DTD
// XXX - in the long run we want to get this from the document, but there
// is no way to do that right now. So we leave it null here and set
// up a nav html dtd in nsHTMLEditor::Init
mViewManager = ps->GetViewManager();
if (!mViewManager) {return NS_ERROR_NULL_POINTER;}
mUpdateCount=0;
/* initialize IME stuff */
@ -4178,7 +4169,14 @@ nsresult nsEditor::BeginUpdateViewBatch()
}
// Turn off view updating.
mBatch.BeginUpdateViewBatch(mViewManager);
nsCOMPtr<nsIPresShell> ps;
GetPresShell(getter_AddRefs(ps));
if (ps) {
nsCOMPtr<nsIViewManager> viewManager = ps->GetViewManager();
if (viewManager) {
mBatch.BeginUpdateViewBatch(viewManager);
}
}
}
mUpdateCount++;
@ -4220,7 +4218,10 @@ nsresult nsEditor::EndUpdateViewBatch()
GetFlags(&flags);
// Turn view updating back on.
if (mViewManager)
nsCOMPtr<nsIViewManager> viewManager;
if (presShell)
viewManager = presShell->GetViewManager();
if (viewManager)
{
PRUint32 updateFlag = NS_VMREFRESH_IMMEDIATE;

View File

@ -657,7 +657,6 @@ protected:
nsWeakPtr mPresShellWeak; // weak reference to the nsIPresShell
nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController
nsCOMPtr<nsIViewManager> mViewManager;
PRInt32 mUpdateCount;
nsIViewManager::UpdateViewBatch mBatch;