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

Unified Diff: Source/devtools/front_end/OverridesSupport.js

Issue 26929003: Add text autosizing override in the inspector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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: Source/devtools/front_end/OverridesSupport.js
diff --git a/Source/devtools/front_end/OverridesSupport.js b/Source/devtools/front_end/OverridesSupport.js
index 046d2a5d014e61855944c5432dedd12b5cc880d3..53eaee48ec9d9693f32cfbab55f8956f6ace29b9 100644
--- a/Source/devtools/front_end/OverridesSupport.js
+++ b/Source/devtools/front_end/OverridesSupport.js
@@ -61,12 +61,14 @@ WebInspector.OverridesSupport = function()
* @param {number} width
* @param {number} height
* @param {number} deviceScaleFactor
+ * @param {boolean} textAutosizing
*/
-WebInspector.OverridesSupport.DeviceMetrics = function(width, height, deviceScaleFactor)
+WebInspector.OverridesSupport.DeviceMetrics = function(width, height, deviceScaleFactor, textAutosizing)
{
this.width = width;
this.height = height;
this.deviceScaleFactor = deviceScaleFactor;
+ this.textAutosizing = textAutosizing;
}
/**
@@ -76,16 +78,16 @@ WebInspector.OverridesSupport.DeviceMetrics.parseSetting = function(value)
{
if (value) {
var splitMetrics = value.split("x");
- if (splitMetrics.length === 3)
- return new WebInspector.OverridesSupport.DeviceMetrics(parseInt(splitMetrics[0], 10), parseInt(splitMetrics[1], 10), parseFloat(splitMetrics[2]));
+ if (splitMetrics.length === 4)
+ return new WebInspector.OverridesSupport.DeviceMetrics(parseInt(splitMetrics[0], 10), parseInt(splitMetrics[1], 10), parseFloat(splitMetrics[2]), splitMetrics[3] == 1);
skobes 2013/10/16 19:38:09 This would be a lot more readable with each ctor a
pdr. 2013/10/18 01:28:44 Agreed, I refactored this a bit to clean it up.
}
- return new WebInspector.OverridesSupport.DeviceMetrics(0, 0, 1);
+ return new WebInspector.OverridesSupport.DeviceMetrics(0, 0, 1, false);
}
/**
* @return {?WebInspector.OverridesSupport.DeviceMetrics}
*/
-WebInspector.OverridesSupport.DeviceMetrics.parseUserInput = function(widthString, heightString, deviceScaleFactorString)
+WebInspector.OverridesSupport.DeviceMetrics.parseUserInput = function(widthString, heightString, deviceScaleFactorString, textAutosizing)
{
function isUserInputValid(value, isInteger)
{
@@ -108,7 +110,7 @@ WebInspector.OverridesSupport.DeviceMetrics.parseUserInput = function(widthStrin
var height = isHeightValid ? parseInt(heightString || "0", 10) : -1;
var deviceScaleFactor = isDeviceScaleFactorValid ? parseFloat(deviceScaleFactorString) : -1;
- return new WebInspector.OverridesSupport.DeviceMetrics(width, height, deviceScaleFactor);
+ return new WebInspector.OverridesSupport.DeviceMetrics(width, height, deviceScaleFactor, textAutosizing);
}
WebInspector.OverridesSupport.DeviceMetrics.prototype = {
@@ -145,6 +147,14 @@ WebInspector.OverridesSupport.DeviceMetrics.prototype = {
},
/**
+ * @return {boolean}
+ */
+ isTextAutosizingValid: function()
+ {
+ return true;
+ },
+
+ /**
* @return {string}
*/
toSetting: function()
@@ -152,7 +162,7 @@ WebInspector.OverridesSupport.DeviceMetrics.prototype = {
if (!this.isValid())
return "";
- return this.width && this.height ? this.width + "x" + this.height + "x" + this.deviceScaleFactor : "";
+ return this.width && this.height ? this.width + "x" + this.height + "x" + this.deviceScaleFactor + "x" + (this.textAutosizing ? "1" : "0") : "";
},
/**
@@ -351,7 +361,7 @@ WebInspector.OverridesSupport.prototype = {
var active = metrics.width > 0 && metrics.height > 0;
var dipWidth = Math.round(metrics.width / metrics.deviceScaleFactor);
var dipHeight = Math.round(metrics.height / metrics.deviceScaleFactor);
- PageAgent.setDeviceMetricsOverride(dipWidth, dipHeight, metrics.deviceScaleFactor, WebInspector.settings.deviceFitWindow.get());
+ PageAgent.setDeviceMetricsOverride(dipWidth, dipHeight, metrics.deviceScaleFactor, WebInspector.settings.deviceFitWindow.get(), metrics.textAutosizing);
if (active != this._deviceMetricsOverridesActive) {
PageAgent.reload(false);
this._deviceMetricsOverridesActive = active;

Powered by Google App Engine
This is Rietveld 408576698