Bug 1387406 - part5: nsXBLWindowKeyHandler should treat editor as HTMLEditor r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 07 Aug 2017 15:08:02 +0900
changeset 643908 bd157a78b4371d9608e5df1fce46ea0cf05e3919
parent 643907 93b170cee6346fa246ce0adbb7530631d1c3fa16
child 725436 631ff7c8731c58c1b5bc270e41323e25f067b160
push id73250
push usermasayuki@d-toybox.com
push dateThu, 10 Aug 2017 07:58:50 +0000
reviewerssmaug
bugs1387406
milestone57.0a1
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
dom/xbl/nsXBLWindowKeyHandler.cpp
--- 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);