| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 /** | 114 /** |
| 115 * @return {Element} | 115 * @return {Element} |
| 116 */ | 116 */ |
| 117 _createUserAgentSelectRowElement: function() | 117 _createUserAgentSelectRowElement: function() |
| 118 { | 118 { |
| 119 var userAgent = WebInspector.settings.userAgent.get(); | 119 var userAgent = WebInspector.settings.userAgent.get(); |
| 120 | 120 |
| 121 // When present, the third element lists device metrics separated by 'x'
: | 121 // When present, the third element lists device metrics separated by 'x'
: |
| 122 // - screen width, | 122 // - screen width, |
| 123 // - screen height, | 123 // - screen height, |
| 124 // - device scale factor. | 124 // - device scale factor, |
| 125 // - text autosizing. |
| 125 const userAgents = [ | 126 const userAgents = [ |
| 126 ["Internet Explorer 10", "Mozilla/5.0 (compatible; MSIE 10.0; Window
s NT 6.2; Trident/6.0)"], | 127 ["Internet Explorer 10", "Mozilla/5.0 (compatible; MSIE 10.0; Window
s NT 6.2; Trident/6.0)"], |
| 127 ["Internet Explorer 9", "Mozilla/5.0 (compatible; MSIE 9.0; Windows
NT 6.1; Trident/5.0)"], | 128 ["Internet Explorer 9", "Mozilla/5.0 (compatible; MSIE 9.0; Windows
NT 6.1; Trident/5.0)"], |
| 128 ["Internet Explorer 8", "Mozilla/4.0 (compatible; MSIE 8.0; Windows
NT 6.0; Trident/4.0)"], | 129 ["Internet Explorer 8", "Mozilla/4.0 (compatible; MSIE 8.0; Windows
NT 6.0; Trident/4.0)"], |
| 129 ["Internet Explorer 7", "Mozilla/4.0 (compatible; MSIE 7.0; Windows
NT 6.0)"], | 130 ["Internet Explorer 7", "Mozilla/4.0 (compatible; MSIE 7.0; Windows
NT 6.0)"], |
| 130 | 131 |
| 131 ["Firefox 7 \u2014 Windows", "Mozilla/5.0 (Windows NT 6.1; Intel Mac
OS X 10.6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"], | 132 ["Firefox 7 \u2014 Windows", "Mozilla/5.0 (Windows NT 6.1; Intel Mac
OS X 10.6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"], |
| 132 ["Firefox 7 \u2014 Mac", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.
6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"], | 133 ["Firefox 7 \u2014 Mac", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.
6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"], |
| 133 ["Firefox 4 \u2014 Windows", "Mozilla/5.0 (Windows NT 6.1; rv:2.0.1)
Gecko/20100101 Firefox/4.0.1"], | 134 ["Firefox 4 \u2014 Windows", "Mozilla/5.0 (Windows NT 6.1; rv:2.0.1)
Gecko/20100101 Firefox/4.0.1"], |
| 134 ["Firefox 4 \u2014 Mac", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.
6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"], | 135 ["Firefox 4 \u2014 Mac", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.
6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"], |
| 135 ["Firefox 14 \u2014 Android Mobile", "Mozilla/5.0 (Android; Mobile;
rv:14.0) Gecko/14.0 Firefox/14.0"], | 136 ["Firefox 14 \u2014 Android Mobile", "Mozilla/5.0 (Android; Mobile;
rv:14.0) Gecko/14.0 Firefox/14.0"], |
| 136 ["Firefox 14 \u2014 Android Tablet", "Mozilla/5.0 (Android; Tablet;
rv:14.0) Gecko/14.0 Firefox/14.0"], | 137 ["Firefox 14 \u2014 Android Tablet", "Mozilla/5.0 (Android; Tablet;
rv:14.0) Gecko/14.0 Firefox/14.0"], |
| 137 | 138 |
| 138 ["Chrome \u2014 Android Mobile", "Mozilla/5.0 (Linux; Android 4.0.4;
Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1
025.133 Mobile Safari/535.19", "720x1280x2"], | 139 ["Chrome \u2014 Android Mobile", "Mozilla/5.0 (Linux; Android 4.0.4;
Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1
025.133 Mobile Safari/535.19", "720x1280x2x1"], |
| 139 ["Chrome \u2014 Android Tablet", "Mozilla/5.0 (Linux; Android 4.1.2;
Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.1
66 Safari/535.19", "1920x1200x2"], | 140 ["Chrome \u2014 Android Tablet", "Mozilla/5.0 (Linux; Android 4.1.2;
Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.1
66 Safari/535.19", "1920x1200x2x1"], |
| 140 | 141 |
| 141 ["iPhone \u2014 iOS 7", "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_2 li
ke Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A4449
d Safari/9537.53", "640x1136x2"], | 142 ["iPhone \u2014 iOS 7", "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_2 li
ke Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A4449
d Safari/9537.53", "640x1136x2x1"], |
| 142 ["iPhone \u2014 iOS 6", "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like
Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Sa
fari/8536.25", "640x1136x2"], | 143 ["iPhone \u2014 iOS 6", "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like
Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Sa
fari/8536.25", "640x1136x2x1"], |
| 143 ["iPad \u2014 iOS 7", "Mozilla/5.0 (iPad; CPU OS 7_0_2 like Mac OS X
) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537
.53", "2048x1536x2"], | 144 ["iPad \u2014 iOS 7", "Mozilla/5.0 (iPad; CPU OS 7_0_2 like Mac OS X
) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537
.53", "2048x1536x2x1"], |
| 144 ["iPad \u2014 iOS 6", "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X)
AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.2
5", "1024x768x1"], | 145 ["iPad \u2014 iOS 6", "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X)
AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.2
5", "1024x768x1x0"], |
| 145 | 146 |
| 146 ["Android 2.3 \u2014 Nexus S", "Mozilla/5.0 (Linux; U; Android 2.3.6
; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0
Mobile Safari/533.1", "480x800x1.5"], | 147 ["Android 2.3 \u2014 Nexus S", "Mozilla/5.0 (Linux; U; Android 2.3.6
; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0
Mobile Safari/533.1", "480x800x1.5x1"], |
| 147 ["Android 4.0.2 \u2014 Galaxy Nexus", "Mozilla/5.0 (Linux; U; Androi
d 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko
) Version/4.0 Mobile Safari/534.30", "720x1280x2"], | 148 ["Android 4.0.2 \u2014 Galaxy Nexus", "Mozilla/5.0 (Linux; U; Androi
d 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko
) Version/4.0 Mobile Safari/534.30", "720x1280x2x1"], |
| 148 | 149 |
| 149 ["BlackBerry \u2014 PlayBook 2.1", "Mozilla/5.0 (PlayBook; U; RIM Ta
blet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Saf
ari/536.2+", "1024x600x1"], | 150 ["BlackBerry \u2014 PlayBook 2.1", "Mozilla/5.0 (PlayBook; U; RIM Ta
blet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Saf
ari/536.2+", "1024x600x1x0"], |
| 150 ["BlackBerry \u2014 9900", "Mozilla/5.0 (BlackBerry; U; BlackBerry 9
900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Saf
ari/534.11+", "640x480x1"], | 151 ["BlackBerry \u2014 9900", "Mozilla/5.0 (BlackBerry; U; BlackBerry 9
900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Saf
ari/534.11+", "640x480x1x0"], |
| 151 ["BlackBerry \u2014 BB10", "Mozilla/5.0 (BB10; Touch) AppleWebKit/53
7.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+", "768x1280x1"
], | 152 ["BlackBerry \u2014 BB10", "Mozilla/5.0 (BB10; Touch) AppleWebKit/53
7.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+", "768x1280x1x
0"], |
| 152 | 153 |
| 153 ["MeeGo \u2014 Nokia N9", "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/
534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13", "480x854x1"
], | 154 ["MeeGo \u2014 Nokia N9", "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/
534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13", "480x854x1x
0"], |
| 154 | 155 |
| 155 [WebInspector.UIString("Other..."), "Other"] | 156 [WebInspector.UIString("Other..."), "Other"] |
| 156 ]; | 157 ]; |
| 157 | 158 |
| 158 var fieldsetElement = WebInspector.SettingsTab.createSettingFieldset(Web
Inspector.settings.overrideUserAgent); | 159 var fieldsetElement = WebInspector.SettingsTab.createSettingFieldset(Web
Inspector.settings.overrideUserAgent); |
| 159 var p = fieldsetElement.createChild("p"); | 160 var p = fieldsetElement.createChild("p"); |
| 160 this._selectElement = p.createChild("select"); | 161 this._selectElement = p.createChild("select"); |
| 161 this._otherUserAgentElement = p.createChild("input"); | 162 this._otherUserAgentElement = p.createChild("input"); |
| 162 this._otherUserAgentElement.type = "text"; | 163 this._otherUserAgentElement.type = "text"; |
| 163 this._otherUserAgentElement.value = userAgent; | 164 this._otherUserAgentElement.value = userAgent; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 * @param {boolean} enabled | 288 * @param {boolean} enabled |
| 288 */ | 289 */ |
| 289 _onMetricsCheckboxClicked: function(enabled) | 290 _onMetricsCheckboxClicked: function(enabled) |
| 290 { | 291 { |
| 291 if (enabled && !this._widthOverrideElement.value) | 292 if (enabled && !this._widthOverrideElement.value) |
| 292 this._widthOverrideElement.focus(); | 293 this._widthOverrideElement.focus(); |
| 293 }, | 294 }, |
| 294 | 295 |
| 295 _applyDeviceMetricsUserInput: function() | 296 _applyDeviceMetricsUserInput: function() |
| 296 { | 297 { |
| 297 this._setDeviceMetricsOverride(WebInspector.OverridesSupport.DeviceMetri
cs.parseUserInput(this._widthOverrideElement.value.trim(), this._heightOverrideE
lement.value.trim(), this._deviceScaleFactorOverrideElement.value.trim()), true)
; | 298 this._setDeviceMetricsOverride(WebInspector.OverridesSupport.DeviceMetri
cs.parseUserInput(this._widthOverrideElement.value.trim(), this._heightOverrideE
lement.value.trim(), this._deviceScaleFactorOverrideElement.value.trim(), this._
textAutosizingOverrideCheckbox.checked), true); |
| 298 }, | 299 }, |
| 299 | 300 |
| 300 /** | 301 /** |
| 301 * @param {?WebInspector.OverridesSupport.DeviceMetrics} metrics | 302 * @param {?WebInspector.OverridesSupport.DeviceMetrics} metrics |
| 302 * @param {boolean} userInputModified | 303 * @param {boolean} userInputModified |
| 303 */ | 304 */ |
| 304 _setDeviceMetricsOverride: function(metrics, userInputModified) | 305 _setDeviceMetricsOverride: function(metrics, userInputModified) |
| 305 { | 306 { |
| 306 function setValid(condition, element) | 307 function setValid(condition, element) |
| 307 { | 308 { |
| 308 if (condition) | 309 if (condition) |
| 309 element.removeStyleClass("error-input"); | 310 element.removeStyleClass("error-input"); |
| 310 else | 311 else |
| 311 element.addStyleClass("error-input"); | 312 element.addStyleClass("error-input"); |
| 312 } | 313 } |
| 313 | 314 |
| 314 setValid(metrics && metrics.isWidthValid(), this._widthOverrideElement); | 315 setValid(metrics && metrics.isWidthValid(), this._widthOverrideElement); |
| 315 setValid(metrics && metrics.isHeightValid(), this._heightOverrideElement
); | 316 setValid(metrics && metrics.isHeightValid(), this._heightOverrideElement
); |
| 316 setValid(metrics && metrics.isDeviceScaleFactorValid(), this._deviceScal
eFactorOverrideElement); | 317 setValid(metrics && metrics.isDeviceScaleFactorValid(), this._deviceScal
eFactorOverrideElement); |
| 318 setValid(metrics && metrics.isTextAutosizingValid(), this._textAutosizin
gOverrideCheckbox); |
| 317 | 319 |
| 318 if (!metrics) | 320 if (!metrics) |
| 319 return; | 321 return; |
| 320 | 322 |
| 321 if (!userInputModified) { | 323 if (!userInputModified) { |
| 322 this._widthOverrideElement.value = metrics.widthToInput(); | 324 this._widthOverrideElement.value = metrics.widthToInput(); |
| 323 this._heightOverrideElement.value = metrics.heightToInput(); | 325 this._heightOverrideElement.value = metrics.heightToInput(); |
| 324 this._deviceScaleFactorOverrideElement.value = metrics.deviceScaleFa
ctorToInput(); | 326 this._deviceScaleFactorOverrideElement.value = metrics.deviceScaleFa
ctorToInput(); |
| 327 this._textAutosizingOverrideCheckbox.checked = metrics.textAutosizin
g; |
| 325 } | 328 } |
| 326 | 329 |
| 327 if (metrics.isValid()) { | 330 if (metrics.isValid()) { |
| 328 var value = metrics.toSetting(); | 331 var value = metrics.toSetting(); |
| 329 if (value !== WebInspector.settings.deviceMetrics.get()) | 332 if (value !== WebInspector.settings.deviceMetrics.get()) |
| 330 WebInspector.settings.deviceMetrics.set(value); | 333 WebInspector.settings.deviceMetrics.set(value); |
| 331 } | 334 } |
| 332 }, | 335 }, |
| 333 | 336 |
| 334 /** | 337 /** |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 369 |
| 367 rowElement = tableElement.createChild("tr"); | 370 rowElement = tableElement.createChild("tr"); |
| 368 cellElement = rowElement.createChild("td"); | 371 cellElement = rowElement.createChild("td"); |
| 369 cellElement.appendChild(document.createTextNode(WebInspector.UIString("D
evice scale factor:"))); | 372 cellElement.appendChild(document.createTextNode(WebInspector.UIString("D
evice scale factor:"))); |
| 370 cellElement = rowElement.createChild("td"); | 373 cellElement = rowElement.createChild("td"); |
| 371 this._deviceScaleFactorOverrideElement = this._createInput(cellElement,
"metrics-override-device-scale", String(metrics.deviceScaleFactor || 1), this._a
pplyDeviceMetricsUserInput.bind(this), true); | 374 this._deviceScaleFactorOverrideElement = this._createInput(cellElement,
"metrics-override-device-scale", String(metrics.deviceScaleFactor || 1), this._a
pplyDeviceMetricsUserInput.bind(this), true); |
| 372 | 375 |
| 373 rowElement = tableElement.createChild("tr"); | 376 rowElement = tableElement.createChild("tr"); |
| 374 cellElement = rowElement.createChild("td"); | 377 cellElement = rowElement.createChild("td"); |
| 375 cellElement.colSpan = 2; | 378 cellElement.colSpan = 2; |
| 379 var textAutosizingOverrideElement = this._createNonPersistedCheckbox(Web
Inspector.UIString("Text autosizing enabled"), this._applyDeviceMetricsUserInput
.bind(this)); |
| 380 this._textAutosizingOverrideCheckbox = textAutosizingOverrideElement.get
ElementsByTagName("input")[0]; |
| 381 this._textAutosizingOverrideCheckbox.checked = metrics.textAutosizing; |
| 382 cellElement.appendChild(textAutosizingOverrideElement); |
| 383 |
| 384 rowElement = tableElement.createChild("tr"); |
| 385 cellElement = rowElement.createChild("td"); |
| 386 cellElement.colSpan = 2; |
| 376 var checkbox = WebInspector.SettingsTab.createSettingCheckbox(WebInspect
or.UIString("Fit in window"), WebInspector.settings.deviceFitWindow, true); | 387 var checkbox = WebInspector.SettingsTab.createSettingCheckbox(WebInspect
or.UIString("Fit in window"), WebInspector.settings.deviceFitWindow, true); |
| 377 cellElement.appendChild(checkbox); | 388 cellElement.appendChild(checkbox); |
| 378 | 389 |
| 379 return fieldsetElement; | 390 return fieldsetElement; |
| 380 }, | 391 }, |
| 381 | 392 |
| 382 /** | 393 /** |
| 383 * @return {Element} | 394 * @return {Element} |
| 384 */ | 395 */ |
| 385 _createGeolocationOverrideControl: function() | 396 _createGeolocationOverrideControl: function() |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 }, | 573 }, |
| 563 | 574 |
| 564 _emulateMediaChanged: function(select) | 575 _emulateMediaChanged: function(select) |
| 565 { | 576 { |
| 566 var media = select.options[select.selectedIndex].value; | 577 var media = select.options[select.selectedIndex].value; |
| 567 WebInspector.settings.emulatedCSSMedia.set(media); | 578 WebInspector.settings.emulatedCSSMedia.set(media); |
| 568 }, | 579 }, |
| 569 | 580 |
| 570 __proto__: WebInspector.View.prototype | 581 __proto__: WebInspector.View.prototype |
| 571 } | 582 } |
| OLD | NEW |