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

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

Issue 2837463002: DevTools: allow capturing screenshots from command menu. (Closed)
Patch Set: clean Created 3 years, 8 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
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 04e9011877590f1c69e7b574a105f04b159dad13..e63753bd1cd7ba04073370b59a2e9f355ba3e3ac 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
@@ -307,6 +307,18 @@ Emulation.DeviceModeView = class extends UI.VBox {
element.classList.toggle('hidden', !success);
}
+ /**
+ * @param {!Element} element
+ */
+ setNonEmulatedAvailableSize(element) {
+ if (this._model.type() !== Emulation.DeviceModeModel.Type.None)
+ return;
+ var zoomFactor = UI.zoomManager.zoomFactor();
+ var rect = element.getBoundingClientRect();
+ var availableSize = new UI.Size(Math.max(rect.width * zoomFactor, 1), Math.max(rect.height * zoomFactor, 1));
+ this._model.setAvailableSize(availableSize, availableSize);
+ }
+
_contentAreaResized() {
var zoomFactor = UI.zoomManager.zoomFactor();
var rect = this._contentArea.getBoundingClientRect();
@@ -372,7 +384,7 @@ Emulation.DeviceModeView = class extends UI.VBox {
var pageImage = new Image();
pageImage.src = 'data:image/png;base64,' + screenshot;
pageImage.onload = async () => {
- var scale = window.devicePixelRatio / this._model.scale();
+ var scale = window.devicePixelRatio / UI.zoomManager.zoomFactor() / this._model.scale();
var outlineRect = this._model.outlineRect().scale(scale);
var screenRect = this._model.screenRect().scale(scale);
var visiblePageRect = this._model.visiblePageRect().scale(scale);

Powered by Google App Engine
This is Rietveld 408576698