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

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

Issue 318653003: [DevTools] Fix integer/double values in emulation input fields. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/elements/OverridesView.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 254
255 WebInspector.OverridesSupport.DeviceOrientation.clearDeviceOrientationOverride = function() 255 WebInspector.OverridesSupport.DeviceOrientation.clearDeviceOrientationOverride = function()
256 { 256 {
257 PageAgent.clearDeviceOrientationOverride(); 257 PageAgent.clearDeviceOrientationOverride();
258 } 258 }
259 259
260 /** 260 /**
261 * @param {string} value 261 * @param {string} value
262 */ 262 */
263 WebInspector.OverridesSupport.inputValidator = function(value) 263 WebInspector.OverridesSupport.integerInputValidator = function(value)
264 { 264 {
265 if (value >= 0 && value <= 10000) 265 if (/^[\d]+$/.test(value) && value >= 0 && value <= 10000)
266 return ""; 266 return "";
267 return WebInspector.UIString("Value must be non-negative integer"); 267 return WebInspector.UIString("Value must be non-negative integer");
268 } 268 }
269
270 /**
271 * @param {string} value
272 */
273 WebInspector.OverridesSupport.doubleInputValidator = function(value)
274 {
275 if (/^[\d]+(\.\d+)?|\.\d+$/.test(value) && value >= 0 && value <= 10000)
apavlov 2014/06/04 11:42:06 This forbids the ".5" format common in the US
dgozman 2014/06/04 12:43:20 There is a special \.\d+ branch for this format.
apavlov 2014/06/04 12:53:56 Right, missed it.
276 return "";
277 return WebInspector.UIString("Value must be non-negative integer");
apavlov 2014/06/04 11:42:06 integer -> float
dgozman 2014/06/04 12:43:20 Done.
278 }
269 279
270 // Third element lists device metrics separated by 'x': 280 // Third element lists device metrics separated by 'x':
271 // - screen width, 281 // - screen width,
272 // - screen height, 282 // - screen height,
273 // - device scale factor, 283 // - device scale factor,
274 WebInspector.OverridesSupport._phones = [ 284 WebInspector.OverridesSupport._phones = [
275 ["Apple iPhone 3GS", 285 ["Apple iPhone 3GS",
276 "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWeb Kit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5", 286 "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWeb Kit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
277 "320x480x1"], 287 "320x480x1"],
278 ["Apple iPhone 4", 288 ["Apple iPhone 4",
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 }, 942 },
933 943
934 __proto__: WebInspector.Object.prototype 944 __proto__: WebInspector.Object.prototype
935 } 945 }
936 946
937 947
938 /** 948 /**
939 * @type {!WebInspector.OverridesSupport} 949 * @type {!WebInspector.OverridesSupport}
940 */ 950 */
941 WebInspector.overridesSupport; 951 WebInspector.overridesSupport;
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/OverridesView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698