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

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

Issue 1972213003: [DevTools] More UX fixes in Device Mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 */ 8 */
9 WebInspector.DeviceModeView = function() 9 WebInspector.DeviceModeView = function()
10 { 10 {
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 ctx.drawImage(image, rect.left, rect.top, rect.width, rect.h eight); 447 ctx.drawImage(image, rect.left, rect.top, rect.width, rect.h eight);
448 callback(); 448 callback();
449 } 449 }
450 } 450 }
451 451
452 /** 452 /**
453 * @this {WebInspector.DeviceModeView} 453 * @this {WebInspector.DeviceModeView}
454 */ 454 */
455 function paintScreenshot() 455 function paintScreenshot()
456 { 456 {
457 ctx.strokeStyle = "hsla(0, 0%, 98%, 0.5)";
458 ctx.lineWidth = 1;
459 ctx.setLineDash([10, 10]);
460 ctx.strokeRect(screenRect.left + 1, screenRect.top + 1, screenRe ct.width - 2, screenRect.height - 2);
457 var pageImage = new Image(); 461 var pageImage = new Image();
458 pageImage.src = "data:image/png;base64," + content; 462 pageImage.src = "data:image/png;base64," + content;
459 ctx.drawImage(pageImage, 463 ctx.drawImage(pageImage,
460 visiblePageRect.left, 464 visiblePageRect.left,
461 visiblePageRect.top, 465 visiblePageRect.top,
462 visiblePageRect.width, 466 Math.min(pageImage.naturalWidth, screenRect.width) ,
463 visiblePageRect.height); 467 Math.min(pageImage.naturalHeight, screenRect.heigh t));
464 var mainFrame = mainTarget.resourceTreeModel.mainFrame; 468 var mainFrame = mainTarget.resourceTreeModel.mainFrame;
465 var fileName = mainFrame ? mainFrame.url.trimURL().removeURLFrag ment() : ""; 469 var fileName = mainFrame ? mainFrame.url.trimURL().removeURLFrag ment() : "";
466 if (this._model.type() === WebInspector.DeviceModeModel.Type.Dev ice) 470 if (this._model.type() === WebInspector.DeviceModeModel.Type.Dev ice)
467 fileName += WebInspector.UIString("(%s)", this._model.device ().title); 471 fileName += WebInspector.UIString("(%s)", this._model.device ().title);
468 // Trigger download. 472 // Trigger download.
469 var link = createElement("a"); 473 var link = createElement("a");
470 link.download = fileName + ".png"; 474 link.download = fileName + ".png";
471 link.href = canvas.toDataURL("image/png"); 475 link.href = canvas.toDataURL("image/png");
472 link.click(); 476 link.click();
473 } 477 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 /** 575 /**
572 * @param {number} size 576 * @param {number} size
573 */ 577 */
574 _onMarkerClick: function(size) 578 _onMarkerClick: function(size)
575 { 579 {
576 this._applyCallback.call(null, size); 580 this._applyCallback.call(null, size);
577 }, 581 },
578 582
579 __proto__: WebInspector.VBox.prototype 583 __proto__: WebInspector.VBox.prototype
580 } 584 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698