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

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: Add optional flag in protocol.json 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
« no previous file with comments | « Source/core/page/Settings.cpp ('k') | Source/devtools/front_end/OverridesView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/OverridesSupport.js
diff --git a/Source/devtools/front_end/OverridesSupport.js b/Source/devtools/front_end/OverridesSupport.js
index 77c6755900043a23bc5e89fa29c50e356ab16626..7acd55b1c197bff4cd03282c9fabd991c52c5fb3 100644
--- a/Source/devtools/front_end/OverridesSupport.js
+++ b/Source/devtools/front_end/OverridesSupport.js
@@ -62,12 +62,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;
}
/**
@@ -75,18 +77,26 @@ WebInspector.OverridesSupport.DeviceMetrics = function(width, height, deviceScal
*/
WebInspector.OverridesSupport.DeviceMetrics.parseSetting = function(value)
{
+ var width = 0;
+ var height = 0;
+ var deviceScaleFactor = 1;
+ var textAutosizing = false;
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) {
+ width = parseInt(splitMetrics[0], 10);
+ height = parseInt(splitMetrics[1], 10);
+ deviceScaleFactor = parseFloat(splitMetrics[2]);
+ textAutosizing = splitMetrics[3] == 1;
+ }
}
- return new WebInspector.OverridesSupport.DeviceMetrics(0, 0, 1);
+ return new WebInspector.OverridesSupport.DeviceMetrics(width, height, deviceScaleFactor, textAutosizing);
}
/**
* @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)
{
@@ -109,7 +119,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 = {
@@ -146,6 +156,14 @@ WebInspector.OverridesSupport.DeviceMetrics.prototype = {
},
/**
+ * @return {boolean}
+ */
+ isTextAutosizingValid: function()
+ {
+ return true;
+ },
+
+ /**
* @return {string}
*/
toSetting: function()
@@ -153,7 +171,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") : "";
},
/**
@@ -352,7 +370,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;
« no previous file with comments | « Source/core/page/Settings.cpp ('k') | Source/devtools/front_end/OverridesView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698