From 2ab12a8d891ad61ba7a01ffb22065017f97322f7 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 16 Jun 2020 16:02:54 +0100 Subject: [PATCH] Default modes to vertical and horizontal orientation This reduces `emulated_devices/module.json` from 44KB to 40KB. R=jacktfranklin@chromium.org Bug: 1095614 Change-Id: I772a3e4e371c1f0d391ab7039f342ba36957270d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2248179 Commit-Queue: Tim van der Lippe Reviewed-by: Jack Franklin --- front_end/emulated_devices/module.json | 348 +++---------------------- front_end/emulation/EmulatedDevices.js | 5 +- 2 files changed, 33 insertions(+), 320 deletions(-) diff --git a/front_end/emulated_devices/module.json b/front_end/emulated_devices/module.json index afabc5ef1b..cb5ef61b8c 100644 --- a/front_end/emulated_devices/module.json +++ b/front_end/emulated_devices/module.json @@ -21,17 +21,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -74,17 +64,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -127,17 +107,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -180,17 +150,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -215,17 +175,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -249,17 +199,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -290,17 +230,7 @@ "model": "Nexus 4", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -547,17 +477,7 @@ "model": "Nexus 6", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -606,17 +526,7 @@ "model": "Nexus 6P", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -648,17 +558,7 @@ "model": "Pixel 2", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -690,17 +590,7 @@ "model": "Pixel 2 XL", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -731,17 +621,7 @@ "model": "LGMS323", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -765,17 +645,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -799,17 +669,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -833,17 +693,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -867,17 +717,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -908,17 +748,7 @@ "model": "GT-I9300", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -950,17 +780,7 @@ "model": "SM-G900P", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -985,17 +805,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -1019,17 +829,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true", - "type": "tablet", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "tablet" } }, { @@ -1053,17 +853,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", - "type": "tablet", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "tablet" } }, { @@ -1106,17 +896,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", - "type": "tablet", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "tablet" } }, { @@ -1141,17 +921,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", - "type": "tablet", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "tablet" } }, { @@ -1175,17 +945,7 @@ "mobile" ], "user-agent": "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+", - "type": "tablet", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "tablet" } }, { @@ -1216,17 +976,7 @@ "model": "Nexus 10", "mobile": false }, - "type": "tablet", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "tablet" } }, { @@ -1257,17 +1007,7 @@ "model": "Nexus 7", "mobile": false }, - "type": "tablet", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "tablet" } }, { @@ -1298,17 +1038,7 @@ "model": "SM-N900T", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -1339,17 +1069,7 @@ "model": "GT-N7100", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { @@ -1481,17 +1201,7 @@ "model": "Moto G (4)", "mobile": true }, - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical" - }, - { - "title": "default", - "orientation": "horizontal" - } - ] + "type": "phone" } }, { diff --git a/front_end/emulation/EmulatedDevices.js b/front_end/emulation/EmulatedDevices.js index aafd9a288c..c3f8c60003 100644 --- a/front_end/emulation/EmulatedDevices.js +++ b/front_end/emulation/EmulatedDevices.js @@ -244,7 +244,10 @@ export class EmulatedDevice { throw new Error('Emulated device \'' + result.title + '\'has dual screen without spanned orientations'); } - const modes = parseValue(json, 'modes', 'object', []); + const modes = parseValue(json, 'modes', 'object', [ + {'title': 'default', 'orientation': 'vertical'}, + {'title': 'default', 'orientation': 'horizontal'}, + ]); if (!Array.isArray(modes)) { throw new Error('Emulated device modes must be an array'); }