diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:25:10 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:25:10 -0500 |
commit | 8b8c65072aedef94610748ce92c2ed3a19fd5517 (patch) | |
tree | 8614d386acf5db7a77b08d19a5854a7d75dab015 /b2g/components/Screenshot.jsm | |
parent | 8c3a46bd13a0660a3ff1e0379dbf515873a852d2 (diff) | |
download | UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar.gz UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar.lz UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar.xz UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.zip |
Purge b2g/
Diffstat (limited to 'b2g/components/Screenshot.jsm')
-rw-r--r-- | b2g/components/Screenshot.jsm | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/b2g/components/Screenshot.jsm b/b2g/components/Screenshot.jsm deleted file mode 100644 index e6f809375..000000000 --- a/b2g/components/Screenshot.jsm +++ /dev/null @@ -1,43 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -'use strict'; - -const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - -Cu.import('resource://gre/modules/XPCOMUtils.jsm'); - -XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy", "resource://gre/modules/SystemAppProxy.jsm"); - -this.EXPORTED_SYMBOLS = ['Screenshot']; - -var Screenshot = { - get: function screenshot_get() { - let systemAppFrame = SystemAppProxy.getFrame(); - let window = systemAppFrame.ownerDocument.defaultView; - let document = window.document; - - var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); - var docRect = document.body.getBoundingClientRect(); - var width = docRect.width; - var height = docRect.height; - - // Convert width and height from CSS pixels (potentially fractional) - // to device pixels (integer). - var scale = window.devicePixelRatio; - canvas.setAttribute('width', Math.round(width * scale)); - canvas.setAttribute('height', Math.round(height * scale)); - - var context = canvas.getContext('2d'); - var flags = - context.DRAWWINDOW_DRAW_CARET | - context.DRAWWINDOW_DRAW_VIEW | - context.DRAWWINDOW_USE_WIDGET_LAYERS; - context.scale(scale, scale); - context.drawWindow(window, 0, 0, width, height, 'rgb(255,255,255)', flags); - - return canvas.mozGetAsFile('screenshot', 'image/png'); - } -}; -this.Screenshot = Screenshot; |