Fixing more of bug 283612. Make it possible to re-initialize the editor again, even when not used through midas. Regression from bug 209020. r=brade@comcast.net, sr=bzbarsky@mit.edu

This commit is contained in:
jst%mozilla.jstenback.com 2005-02-25 18:16:20 +00:00
Родитель 0c3d48cbf0
Коммит 76e0723cdc
2 изменённых файлов: 16 добавлений и 6 удалений

Просмотреть файл

@ -95,6 +95,7 @@ nsEditingSession::nsEditingSession()
: mDoneSetup(PR_FALSE) : mDoneSetup(PR_FALSE)
, mCanCreateEditor(PR_FALSE) , mCanCreateEditor(PR_FALSE)
, mScriptsEnabled(PR_TRUE) , mScriptsEnabled(PR_TRUE)
, mProgressListenerRegistered(PR_FALSE)
, mImageAnimationMode(0) , mImageAnimationMode(0)
, mEditorFlags(0) , mEditorFlags(0)
, mEditorStatus(eEditorOK) , mEditorStatus(eEditorOK)
@ -186,7 +187,7 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
// set the flag on the docShell to say that it's editable // set the flag on the docShell to say that it's editable
rv = editorDocShell->MakeEditable(aDoAfterUriLoad); rv = editorDocShell->MakeEditable(aDoAfterUriLoad);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// Setup commands common to plaintext and html editors, // Setup commands common to plaintext and html editors,
// including the document creation observers // including the document creation observers
// the first is an editor controller // the first is an editor controller
@ -511,6 +512,8 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell); nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
if (webProgress) { if (webProgress) {
webProgress->RemoveProgressListener(this); webProgress->RemoveProgressListener(this);
mProgressListenerRegistered = PR_FALSE;
} }
} }
@ -1215,7 +1218,7 @@ nsEditingSession::GetEditorDocShellFromWindow(nsIDOMWindow *aWindow,
nsresult nsresult
nsEditingSession::PrepareForEditing(nsIDOMWindow *aWindow) nsEditingSession::PrepareForEditing(nsIDOMWindow *aWindow)
{ {
if (mDoneSetup) if (mDoneSetup || mProgressListenerRegistered)
return NS_OK; return NS_OK;
mDoneSetup = PR_TRUE; mDoneSetup = PR_TRUE;
@ -1226,10 +1229,15 @@ nsEditingSession::PrepareForEditing(nsIDOMWindow *aWindow)
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell); nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
if (!webProgress) return NS_ERROR_FAILURE; if (!webProgress) return NS_ERROR_FAILURE;
return webProgress->AddProgressListener(this, nsresult rv =
(nsIWebProgress::NOTIFY_STATE_NETWORK | webProgress->AddProgressListener(this,
nsIWebProgress::NOTIFY_STATE_DOCUMENT | (nsIWebProgress::NOTIFY_STATE_NETWORK |
nsIWebProgress::NOTIFY_LOCATION)); nsIWebProgress::NOTIFY_STATE_DOCUMENT |
nsIWebProgress::NOTIFY_LOCATION));
mProgressListenerRegistered = NS_SUCCEEDED(rv);
return rv;
} }
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------

Просмотреть файл

@ -141,6 +141,8 @@ protected:
// off, otherwise false. // off, otherwise false.
PRPackedBool mScriptsEnabled; PRPackedBool mScriptsEnabled;
PRPackedBool mProgressListenerRegistered;
// The image animation mode before it was turned off. // The image animation mode before it was turned off.
PRUint16 mImageAnimationMode; PRUint16 mImageAnimationMode;