Bug 1292592 - load sourceeditor in inspector without iframe;r=bgrins draft
authorFred Lin <gasolin@mozilla.com>
Tue, 20 Sep 2016 13:40:18 +0800
changeset 420486 5b26d0506935a01b662dc68d9691ae9ad2897149
parent 420485 40f8f400737a01edca17c982fecf3788419e1e91
child 420487 32d3ce69e604298d4fc9ae560af66252e013b453
push id31211
push userbmo:gasolin@mozilla.com
push dateTue, 04 Oct 2016 07:17:08 +0000
reviewersbgrins
bugs1292592
milestone52.0a1
Bug 1292592 - load sourceeditor in inspector without iframe;r=bgrins MozReview-Commit-ID: K3ptp0g4RP8
devtools/client/inspector/markup/html-editor.js
devtools/client/inspector/markup/markup.xhtml
--- a/devtools/client/inspector/markup/html-editor.js
+++ b/devtools/client/inspector/markup/html-editor.js
@@ -52,20 +52,18 @@ function HTMLEditor(htmlDocument) {
   config.extraKeys[ctrl("Enter")] = this.hide;
   config.extraKeys.F2 = this.hide;
   config.extraKeys.Esc = this.hide.bind(this, false);
 
   this.container.addEventListener("click", this.hide, false);
   this.editorInner.addEventListener("click", stopPropagation, false);
   this.editor = new Editor(config);
 
-  let iframe = this.editorInner.ownerDocument.createElement("iframe");
-  this.editor.appendTo(this.editorInner, iframe).then(() => {
-    this.hide(false);
-  }).then(null, (err) => console.log(err.message));
+  this.editor.appendToLocalElement(this.editorInner);
+  this.hide(false);
 }
 
 HTMLEditor.prototype = {
 
   /**
    * Need to refresh position by manually setting CSS values, so this will
    * need to be called on resizes and other sizing changes.
    */
--- a/devtools/client/inspector/markup/markup.xhtml
+++ b/devtools/client/inspector/markup/markup.xhtml
@@ -3,19 +3,24 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 <!DOCTYPE html>
 
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
   <link rel="stylesheet" href="chrome://devtools/skin/markup.css" type="text/css"/>
+  <link rel="stylesheet" href="chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css" type="text/css"/>
+  <link rel="stylesheet" href="chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.css" type="text/css"/>
+  <link rel="stylesheet" href="chrome://devtools/content/sourceeditor/codemirror/mozilla.css" type="text/css"/>
 
   <script type="application/javascript;version=1.8"
-          src="chrome://devtools/content/shared/theme-switching.js"/>
+          src="chrome://devtools/content/shared/theme-switching.js"></script>
+  <script type="application/javascript;version=1.8"
+          src="chrome://devtools/content/sourceeditor/codemirror/codemirror.bundle.js"></script>
 
 </head>
 <body class="theme-body devtools-monospace" role="application">
 
 <!-- NOTE THAT WE MAKE EXTENSIVE USE OF HTML COMMENTS IN THIS FILE IN ORDER -->
 <!-- TO MAKE SPANS READABLE WHILST AVOIDING SIGNIFICANT WHITESPACE          -->
 
   <div id="root-wrapper" role="presentation">