Bug 1387406 - part5: nsXBLWindowKeyHandler should treat editor as HTMLEditor r?smaug
Editor treated in nsXBLWindowKeyHandler is always HTMLEditor. So, it should treat the editor as is.
MozReview-Commit-ID: 7uE2p8t5cNW
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -17,30 +17,29 @@
#include "nsIDOMElement.h"
#include "nsFocusManager.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsContentUtils.h"
#include "nsXBLPrototypeBinding.h"
#include "nsPIDOMWindow.h"
#include "nsIDocShell.h"
+#include "nsIDOMDocument.h"
+#include "nsISelectionController.h"
#include "nsIPresShell.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
+#include "mozilla/HTMLEditor.h"
#include "mozilla/Move.h"
-#include "nsISelectionController.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/layers/KeyboardMap.h"
-#include "nsIEditor.h"
-#include "nsIHTMLEditor.h"
-#include "nsIDOMDocument.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
class nsXBLSpecialDocInfo : public nsIObserver
{
public:
@@ -575,26 +574,22 @@ nsXBLWindowKeyHandler::IsHTMLEditableFie
return false;
auto* piwin = nsPIDOMWindowOuter::From(focusedWindow);
nsIDocShell *docShell = piwin->GetDocShell();
if (!docShell) {
return false;
}
- nsCOMPtr<nsIEditor> editor;
- docShell->GetEditor(getter_AddRefs(editor));
- nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(editor);
+ RefPtr<HTMLEditor> htmlEditor = docShell->GetHTMLEditor();
if (!htmlEditor) {
return false;
}
- nsCOMPtr<nsIDOMDocument> domDocument;
- editor->GetDocument(getter_AddRefs(domDocument));
- nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDocument);
+ nsCOMPtr<nsIDocument> doc = htmlEditor->GetDocument();
if (doc->HasFlag(NODE_IS_EDITABLE)) {
// Don't need to perform any checks in designMode documents.
return true;
}
nsCOMPtr<nsIDOMElement> focusedElement;
fm->GetFocusedElement(getter_AddRefs(focusedElement));
nsCOMPtr<nsINode> focusedNode = do_QueryInterface(focusedElement);