-
-
Save xonecas/269cef65524f320cd917 to your computer and use it in GitHub Desktop.
Playing around with the firefox dev tools source.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r e6215e0357fa browser/devtools/responsivedesign/responsivedesign.jsm | |
--- a/browser/devtools/responsivedesign/responsivedesign.jsm Fri Mar 08 13:53:43 2013 -0800 | |
+++ b/browser/devtools/responsivedesign/responsivedesign.jsm Fri Mar 08 19:12:13 2013 -0800 | |
@@ -13,6 +13,7 @@ | |
Cu.import("resource:///modules/devtools/FloatingScrollbars.jsm"); | |
Cu.import("resource:///modules/devtools/EventEmitter.jsm"); | |
Cu.import("resource:///modules/devtools/Target.jsm"); | |
+Cu.import("resource:///modules/devtools/BuiltinCommands.jsm"); | |
this.EXPORTED_SYMBOLS = ["ResponsiveUIManager"]; | |
@@ -158,6 +159,7 @@ | |
this.bound_stopResizing = this.stopResizing.bind(this); | |
this.bound_onDrag = this.onDrag.bind(this); | |
this.bound_onKeypress = this.onKeypress.bind(this); | |
+ this.bound_takeScreenshot = this.takeScreenshot.bind(this); | |
// Events | |
this.tab.addEventListener("TabClose", this); | |
@@ -224,6 +226,7 @@ | |
this.rotatebutton.removeEventListener("command", this.bound_rotate, true); | |
this.addbutton.removeEventListener("command", this.bound_addPreset, true); | |
this.removebutton.removeEventListener("command", this.bound_removePreset, true); | |
+ this.screenshotbutton.removeEventListener("command", this.bound_takeScreenshot, true); | |
// Removed elements. | |
this.container.removeChild(this.toolbar); | |
@@ -334,8 +337,15 @@ | |
this.rotatebutton.className = "devtools-toolbarbutton"; | |
this.rotatebutton.addEventListener("command", this.bound_rotate, true); | |
+ this.screenshotbutton = this.chromeDoc.createElement("toolbarbutton"); | |
+ this.screenshotbutton.setAttribute("tabindex", "1"); | |
+ this.screenshotbutton.setAttribute("label", "screenshot"); // this.strings.GetStringFromName("responsiveUI.screenshot") | |
+ this.screenshotbutton.className = "devtools-toolbarbutton"; | |
+ this.screenshotbutton.addEventListener("command", this.bound_takeScreenshot, true); | |
+ | |
this.toolbar.appendChild(this.menulist); | |
this.toolbar.appendChild(this.rotatebutton); | |
+ this.toolbar.appendChild(this.screenshotbutton); | |
// Resizers | |
this.resizer = this.chromeDoc.createElement("box"); | |
@@ -687,6 +697,16 @@ | |
Services.prefs.setCharPref("devtools.responsiveUI.presets", JSON.stringify(registeredPresets)); | |
}, | |
+ | |
+ /** | |
+ * Take a screenshot | |
+ */ | |
+ takeScreenshot: function RUI_takeScreenshot() { | |
+ // this should bridge commandline > screenshot. How do I reference that | |
+ // method? | |
+ // this does nothing | |
+ BuiltinCommands.screenshot(); | |
+ } | |
} | |
XPCOMUtils.defineLazyGetter(ResponsiveUI.prototype, "strings", function () { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related ticket https://bugzilla.mozilla.org/show_bug.cgi?id=849236