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

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

Issue 1650243004: [DevTools] Option to show device frames in emulation mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Positioning and context menu fixes, addressing review comments Created 4 years, 10 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/EmulatedDevices.js
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js b/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js
index a204b33b377468e65b58095a53ca80e9019cd51a..3f5be33998bc762acd84a55bf3a7cb7b90a704b0 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js
@@ -133,7 +133,6 @@ WebInspector.EmulatedDevice.fromJSONV1 = function(json)
throw new Error("Emulated device has wrong outline insets");
result.outlineImage = /** @type {string} */ (parseValue(json["outline"], "image", "string"));
}
-
return /** @type {!WebInspector.EmulatedDevice.Orientation} */ (result);
}
@@ -307,6 +306,48 @@ WebInspector.EmulatedDevice.prototype = {
},
/**
+ * @param {!WebInspector.EmulatedDevice.Mode} mode
+ * @return {string}
+ */
+ outlineImage: function(mode)
+ {
+ var orientation = this.orientationByName(mode.orientation);
+ if (!orientation.outlineImage)
+ return "";
+ if (!this._extension)
+ return orientation.outlineImage;
+ return this._extension.module().substituteURL(orientation.outlineImage);
+ },
+
+ /**
+ * @param {!WebInspector.EmulatedDevice.Mode} mode
+ * @return {?Insets|null}
dgozman 2016/02/09 21:15:10 just ?Insets
mmccoy 2016/02/10 20:06:34 Done.
+ */
+ outlineInsets: function(mode)
+ {
+ var orientation = this.orientationByName(mode.orientation);
+ if (!orientation.outlineImage)
+ return null;
+ return orientation.outlineInsets;
+ },
+
+ /**
+ * @param {!WebInspector.EmulatedDevice.Mode} mode
+ * @return {?Object|string}
+ */
+ outlineDimensions: function(mode)
+ {
+ var orientation = this.orientationByName(mode.orientation);
+ if (!orientation.outlineImage)
+ return "";
+ var dimensions = {
+ "width": orientation.width + orientation.outlineInsets.left + orientation.outlineInsets.right,
+ "height": orientation.height + orientation.outlineInsets.top + orientation.outlineInsets.bottom
+ }
+ return dimensions;
+ },
+
+ /**
* @param {string} name
* @return {!WebInspector.EmulatedDevice.Orientation}
*/

Powered by Google App Engine
This is Rietveld 408576698