OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 */ | 7 */ |
8 WebInspector.EmulatedDevice = function() | 8 WebInspector.EmulatedDevice = function() |
9 { | 9 { |
10 /** @type {string} */ | 10 /** @type {string} */ |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 /** | 113 /** |
114 * @param {*} json | 114 * @param {*} json |
115 * @return {!WebInspector.EmulatedDevice.Orientation} | 115 * @return {!WebInspector.EmulatedDevice.Orientation} |
116 */ | 116 */ |
117 function parseOrientation(json) | 117 function parseOrientation(json) |
118 { | 118 { |
119 var result = {}; | 119 var result = {}; |
120 | 120 |
121 result.width = parseIntValue(json, "width"); | 121 result.width = parseIntValue(json, "width"); |
122 if (result.width < 0 || result.width > WebInspector.OverridesSupport
.MaxDeviceSize) | 122 if (result.width < 0 || result.width > WebInspector.DeviceModeModel.
MaxDeviceSize || result.width < WebInspector.DeviceModeModel.MinDeviceSize) |
123 throw new Error("Emulated device has wrong width: " + result.wid
th); | 123 throw new Error("Emulated device has wrong width: " + result.wid
th); |
124 | 124 |
125 result.height = parseIntValue(json, "height"); | 125 result.height = parseIntValue(json, "height"); |
126 if (result.height < 0 || result.height > WebInspector.OverridesSuppo
rt.MaxDeviceSize) | 126 if (result.height < 0 || result.height > WebInspector.DeviceModeMode
l.MaxDeviceSize || result.height < WebInspector.DeviceModeModel.MinDeviceSize) |
127 throw new Error("Emulated device has wrong height: " + result.he
ight); | 127 throw new Error("Emulated device has wrong height: " + result.he
ight); |
128 | 128 |
129 var outlineInsets = parseValue(json["outline"], "insets", "object",
null); | 129 var outlineInsets = parseValue(json["outline"], "insets", "object",
null); |
130 if (outlineInsets) { | 130 if (outlineInsets) { |
131 result.outlineInsets = parseInsets(outlineInsets); | 131 result.outlineInsets = parseInsets(outlineInsets); |
132 if (result.outlineInsets.left < 0 || result.outlineInsets.top <
0) | 132 if (result.outlineInsets.left < 0 || result.outlineInsets.top <
0) |
133 throw new Error("Emulated device has wrong outline insets"); | 133 throw new Error("Emulated device has wrong outline insets"); |
134 result.outlineImage = /** @type {string} */ (parseValue(json["ou
tline"], "image", "string")); | 134 result.outlineImage = /** @type {string} */ (parseValue(json["ou
tline"], "image", "string")); |
135 } | 135 } |
136 | 136 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 if (deviceById.has(title)) | 532 if (deviceById.has(title)) |
533 to[i].copyShowFrom(/** @type {!WebInspector.EmulatedDevice} */ (
deviceById.get(title))); | 533 to[i].copyShowFrom(/** @type {!WebInspector.EmulatedDevice} */ (
deviceById.get(title))); |
534 } | 534 } |
535 }, | 535 }, |
536 | 536 |
537 __proto__: WebInspector.Object.prototype | 537 __proto__: WebInspector.Object.prototype |
538 } | 538 } |
539 | 539 |
540 /** @type {!WebInspector.EmulatedDevicesList} */ | 540 /** @type {!WebInspector.EmulatedDevicesList} */ |
541 WebInspector.emulatedDevicesList; | 541 WebInspector.emulatedDevicesList; |
OLD | NEW |