| Index: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
|
| index e554590f7ba4a7bd9af511f32418a3ecd1fc4bf2..bd1495dad53a66520cea358bb97f843c15f85e88 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
|
| @@ -470,6 +470,47 @@ Emulation.DeviceModeView = class extends UI.VBox {
|
| }
|
| }
|
| }
|
| +
|
| + captureFullHeightScreenshot() {
|
| + var mainTarget = SDK.targetManager.mainTarget();
|
| + if (!mainTarget)
|
| + return;
|
| + SDK.DOMModel.muteHighlight();
|
| + this._model.captureFullHeightScreenshot(screenshotCaptured.bind(this));
|
| +
|
| + /**
|
| + * @param {?Protocol.Error} error
|
| + * @param {string} content
|
| + * @this {Emulation.DeviceModeView}
|
| + */
|
| + function screenshotCaptured(error, content) {
|
| + SDK.DOMModel.unmuteHighlight();
|
| + if (error) {
|
| + console.error(error);
|
| + return;
|
| + }
|
| + var canvas = createElement('canvas');
|
| + var pageImage = new Image();
|
| + pageImage.src = 'data:image/png;base64,' + content;
|
| + pageImage.onload = () => {
|
| + var ctx = canvas.getContext('2d');
|
| + ctx.imageSmoothingEnabled = false;
|
| + canvas.width = pageImage.width;
|
| + canvas.height = pageImage.height;
|
| + ctx.drawImage(pageImage, 0, 0);
|
| + var url = mainTarget && mainTarget.inspectedURL();
|
| + var fileName = url ? url.trimURL().removeURLFragment() : '';
|
| + if (this._model.type() === Emulation.DeviceModeModel.Type.Device)
|
| + fileName += Common.UIString('(%s)', this._model.device().title);
|
| + var link = createElement('a');
|
| + link.download = fileName + '.png';
|
| + canvas.toBlob(function(blob) {
|
| + link.href = URL.createObjectURL(blob);
|
| + link.click();
|
| + });
|
| + }
|
| + }
|
| + }
|
| };
|
|
|
| /**
|
|
|