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

Side by Side Diff: Source/devtools/front_end/OverridesSupport.js

Issue 212103004: [DevTools] Show device screen size in DIPs. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tests Created 6 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 unified diff | Download patch
OLDNEW
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 }, 454 },
455 455
456 _deviceMetricsChanged: function() 456 _deviceMetricsChanged: function()
457 { 457 {
458 if (this._deviceMetricsChangedListenerMuted) 458 if (this._deviceMetricsChangedListenerMuted)
459 return; 459 return;
460 var metrics = WebInspector.OverridesSupport.DeviceMetrics.parseSetting(W ebInspector.settings.overrideDeviceMetrics.get() ? WebInspector.settings.deviceM etrics.get() : ""); 460 var metrics = WebInspector.OverridesSupport.DeviceMetrics.parseSetting(W ebInspector.settings.overrideDeviceMetrics.get() ? WebInspector.settings.deviceM etrics.get() : "");
461 if (!metrics.isValid()) 461 if (!metrics.isValid())
462 return; 462 return;
463 463
464 var dipWidth = Math.round(metrics.width / metrics.deviceScaleFactor); 464 var dipWidth = Math.round(metrics.width);
465 var dipHeight = Math.round(metrics.height / metrics.deviceScaleFactor); 465 var dipHeight = Math.round(metrics.height);
466 var metricsOverrideEnabled = !!(dipWidth && dipHeight); 466 var metricsOverrideEnabled = !!(dipWidth && dipHeight);
467 467
468 // Disable override without checks. 468 // Disable override without checks.
469 if (metricsOverrideEnabled && WebInspector.OverridesSupport.isInspecting Device()) { 469 if (metricsOverrideEnabled && WebInspector.OverridesSupport.isInspecting Device()) {
470 this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Scree n emulation on the device is not available.")); 470 this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Scree n emulation on the device is not available."));
471 return; 471 return;
472 } 472 }
473 473
474 PageAgent.setDeviceMetricsOverride(dipWidth, dipHeight, metricsOverrideE nabled ? metrics.deviceScaleFactor : 0, WebInspector.settings.emulateViewport.ge t(), WebInspector.settings.deviceFitWindow.get(), metrics.textAutosizing, metric s.fontScaleFactor(), apiCallback.bind(this)); 474 PageAgent.setDeviceMetricsOverride(dipWidth, dipHeight, metricsOverrideE nabled ? metrics.deviceScaleFactor : 0, WebInspector.settings.emulateViewport.ge t(), WebInspector.settings.deviceFitWindow.get(), metrics.textAutosizing, metric s.fontScaleFactor(), apiCallback.bind(this));
475 this.maybeHasActiveOverridesChanged(); 475 this.maybeHasActiveOverridesChanged();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 }, 593 },
594 594
595 __proto__: WebInspector.Object.prototype 595 __proto__: WebInspector.Object.prototype
596 } 596 }
597 597
598 598
599 /** 599 /**
600 * @type {!WebInspector.OverridesSupport} 600 * @type {!WebInspector.OverridesSupport}
601 */ 601 */
602 WebInspector.overridesSupport; 602 WebInspector.overridesSupport;
OLDNEW
« no previous file with comments | « LayoutTests/inspector/device-emulation/device-emulation-test.js ('k') | Source/devtools/front_end/OverridesView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698