Bug 1540107 - Use nsEditingSession directly in nsDocShellEditorData. r=masayuki

`nsIEditingSession.SetupEditorOnWindow` is used in `nsDocShellEditorData`.
To get rid of it, I would like to use `nsEditSession` directly instead of
`nsIEditingSession`.

Differential Revision: https://phabricator.services.mozilla.com/D25537

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Makoto Kato 2019-04-03 01:56:31 +00:00
Родитель 14f091e326
Коммит 0b3ee4783f
3 изменённых файлов: 8 добавлений и 11 удалений

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

@ -179,6 +179,7 @@
#include "nsDOMCID.h"
#include "nsDOMNavigationTiming.h"
#include "nsDSURIContentListener.h"
#include "nsEditingSession.h"
#include "nsError.h"
#include "nsEscape.h"
#include "nsFocusManager.h"
@ -11795,9 +11796,7 @@ nsDocShell::GetHasEditingSession(bool* aHasEditingSession) {
NS_ENSURE_ARG_POINTER(aHasEditingSession);
if (mEditorData) {
nsCOMPtr<nsIEditingSession> editingSession;
mEditorData->GetEditingSession(getter_AddRefs(editingSession));
*aHasEditingSession = (editingSession.get() != nullptr);
*aHasEditingSession = !!mEditorData->GetEditingSession();
} else {
*aHasEditingSession = false;
}
@ -13275,7 +13274,7 @@ nsDocShell::GetEditingSession(nsIEditingSession** aEditSession) {
return NS_ERROR_FAILURE;
}
mEditorData->GetEditingSession(aEditSession);
*aEditSession = do_AddRef(mEditorData->GetEditingSession()).take();
return *aEditSession ? NS_OK : NS_ERROR_FAILURE;
}

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

@ -58,12 +58,10 @@ bool nsDocShellEditorData::GetEditable() {
return mMakeEditable || (mHTMLEditor != nullptr);
}
nsresult nsDocShellEditorData::GetEditingSession(nsIEditingSession** aResult) {
nsEditingSession* nsDocShellEditorData::GetEditingSession() {
EnsureEditingSession();
NS_ADDREF(*aResult = mEditingSession);
return NS_OK;
return mEditingSession.get();
}
nsresult nsDocShellEditorData::SetHTMLEditor(HTMLEditor* aHTMLEditor) {

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

@ -15,7 +15,7 @@
#include "nsIHTMLDocument.h"
class nsIDocShell;
class nsIEditingSession;
class nsEditingSession;
class nsDocShellEditorData {
public:
@ -24,7 +24,7 @@ class nsDocShellEditorData {
nsresult MakeEditable(bool aWaitForUriLoad);
bool GetEditable();
nsresult GetEditingSession(nsIEditingSession** aResult);
nsEditingSession* GetEditingSession();
mozilla::HTMLEditor* GetHTMLEditor() const { return mHTMLEditor; }
nsresult SetHTMLEditor(mozilla::HTMLEditor* aHTMLEditor);
void TearDownEditor();
@ -39,7 +39,7 @@ class nsDocShellEditorData {
nsIDocShell* mDocShell;
// Only present for the content root docShell. Session is owned here.
nsCOMPtr<nsIEditingSession> mEditingSession;
RefPtr<nsEditingSession> mEditingSession;
// If this frame is editable, store HTML editor here. It's owned here.
RefPtr<mozilla::HTMLEditor> mHTMLEditor;