Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Unified Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js

Issue 2010773002: [DevTools] Draw screen border below screen image when taking screenshot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b5951eee8eab64e92044e3c616a99e8ee9bf1fea..b1a1c8693083dbfd0ff1319868c5c59716571b36 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
@@ -410,8 +410,10 @@ WebInspector.DeviceModeView.prototype = {
WebInspector.DOMModel.unmuteHighlight();
WebInspector.inspectorView.restore();
- if (error)
+ if (error) {
+ console.error(error);
return;
+ }
// Create a canvas to splice the images together.
var canvas = createElement("canvas");
@@ -422,6 +424,7 @@ WebInspector.DeviceModeView.prototype = {
var promise = Promise.resolve();
if (this._model.outlineImage())
promise = promise.then(paintImage.bind(null, this._model.outlineImage(), outlineRect));
+ promise = promise.then(drawBorder);
if (this._model.screenImage())
promise = promise.then(paintImage.bind(null, this._model.screenImage(), screenRect));
promise.then(paintScreenshot.bind(this));
@@ -449,15 +452,19 @@ WebInspector.DeviceModeView.prototype = {
}
}
- /**
- * @this {WebInspector.DeviceModeView}
- */
- function paintScreenshot()
+ function drawBorder()
{
ctx.strokeStyle = "hsla(0, 0%, 98%, 0.5)";
ctx.lineWidth = 1;
ctx.setLineDash([10, 10]);
ctx.strokeRect(screenRect.left + 1, screenRect.top + 1, screenRect.width - 2, screenRect.height - 2);
+ }
+
+ /**
+ * @this {WebInspector.DeviceModeView}
+ */
+ function paintScreenshot()
+ {
var pageImage = new Image();
pageImage.src = "data:image/png;base64," + content;
ctx.drawImage(pageImage,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698