mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-01 05:43:46 +00:00
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:
parent
db7c5538a4
commit
d7b005e021
@ -65,7 +65,6 @@
|
|||||||
#include "nsITransactionManager.h"
|
#include "nsITransactionManager.h"
|
||||||
#include "nsIAbsorbingTransaction.h"
|
#include "nsIAbsorbingTransaction.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsIViewManager.h"
|
|
||||||
#include "nsISelection.h"
|
#include "nsISelection.h"
|
||||||
#include "nsISelectionPrivate.h"
|
#include "nsISelectionPrivate.h"
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
@ -242,14 +241,6 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot
|
|||||||
nsCOMPtr<nsINode> document = do_QueryInterface(aDoc);
|
nsCOMPtr<nsINode> document = do_QueryInterface(aDoc);
|
||||||
document->AddMutationObserver(this);
|
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;
|
mUpdateCount=0;
|
||||||
|
|
||||||
/* initialize IME stuff */
|
/* initialize IME stuff */
|
||||||
@ -4178,7 +4169,14 @@ nsresult nsEditor::BeginUpdateViewBatch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Turn off view updating.
|
// 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++;
|
mUpdateCount++;
|
||||||
@ -4220,7 +4218,10 @@ nsresult nsEditor::EndUpdateViewBatch()
|
|||||||
GetFlags(&flags);
|
GetFlags(&flags);
|
||||||
|
|
||||||
// Turn view updating back on.
|
// Turn view updating back on.
|
||||||
if (mViewManager)
|
nsCOMPtr<nsIViewManager> viewManager;
|
||||||
|
if (presShell)
|
||||||
|
viewManager = presShell->GetViewManager();
|
||||||
|
if (viewManager)
|
||||||
{
|
{
|
||||||
PRUint32 updateFlag = NS_VMREFRESH_IMMEDIATE;
|
PRUint32 updateFlag = NS_VMREFRESH_IMMEDIATE;
|
||||||
|
|
||||||
|
@ -657,7 +657,6 @@ protected:
|
|||||||
|
|
||||||
nsWeakPtr mPresShellWeak; // weak reference to the nsIPresShell
|
nsWeakPtr mPresShellWeak; // weak reference to the nsIPresShell
|
||||||
nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController
|
nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController
|
||||||
nsCOMPtr<nsIViewManager> mViewManager;
|
|
||||||
PRInt32 mUpdateCount;
|
PRInt32 mUpdateCount;
|
||||||
nsIViewManager::UpdateViewBatch mBatch;
|
nsIViewManager::UpdateViewBatch mBatch;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user