Bug 1387406 - part4: nsFrameLoader should treat editor as HTMLEditor r?smaug
Editor treated in nsFrameLoader is always HTMLEditor. So, it should treat the editor as is.
MozReview-Commit-ID: 7bZMbLGKsED
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -42,17 +42,16 @@
#include "nsIFrame.h"
#include "nsIScrollableFrame.h"
#include "nsSubDocumentFrame.h"
#include "nsError.h"
#include "nsISHistory.h"
#include "nsISHistoryInternal.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIXULWindow.h"
-#include "nsIEditor.h"
#include "nsIMozBrowserFrame.h"
#include "nsISHistory.h"
#include "NullPrincipal.h"
#include "nsIScriptError.h"
#include "nsGlobalWindow.h"
#include "nsPIWindowRoot.h"
#include "nsLayoutUtils.h"
#include "nsMappedAttributes.h"
@@ -76,16 +75,17 @@
#include "Layers.h"
#include "ClientLayerManager.h"
#include "ContentParent.h"
#include "TabParent.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/GuardObjects.h"
+#include "mozilla/HTMLEditor.h"
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/Element.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "GeckoProfiler.h"
#include "jsapi.h"
@@ -1183,32 +1183,29 @@ nsFrameLoader::Show(int32_t marginWidth,
if (doc) {
nsAutoString designMode;
doc->GetDesignMode(designMode);
if (designMode.EqualsLiteral("on")) {
// Hold on to the editor object to let the document reattach to the
// same editor object, instead of creating a new one.
- nsCOMPtr<nsIEditor> editor;
- nsresult rv = mDocShell->GetEditor(getter_AddRefs(editor));
- NS_ENSURE_SUCCESS(rv, false);
-
+ RefPtr<HTMLEditor> htmlEditor = mDocShell->GetHTMLEditor();
+ Unused << htmlEditor;
doc->SetDesignMode(NS_LITERAL_STRING("off"));
doc->SetDesignMode(NS_LITERAL_STRING("on"));
} else {
// Re-initialize the presentation for contenteditable documents
bool editable = false,
hasEditingSession = false;
mDocShell->GetEditable(&editable);
mDocShell->GetHasEditingSession(&hasEditingSession);
- nsCOMPtr<nsIEditor> editor;
- mDocShell->GetEditor(getter_AddRefs(editor));
- if (editable && hasEditingSession && editor) {
- editor->PostCreate();
+ RefPtr<HTMLEditor> htmlEditor = mDocShell->GetHTMLEditor();
+ if (editable && hasEditingSession && htmlEditor) {
+ htmlEditor->PostCreate();
}
}
}
}
mInShow = false;
if (mHideCalled) {
mHideCalled = false;