Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @param {number} latitude | 7 * @param {number} latitude |
| 8 * @param {number} longitude | 8 * @param {number} longitude |
| 9 * @param {boolean} error | 9 * @param {boolean} error |
| 10 */ | 10 */ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 var longitude = isLongitudeValid ? parseFloat(longitudeString) : -1; | 78 var longitude = isLongitudeValid ? parseFloat(longitudeString) : -1; |
| 79 return new WebInspector.Geolocation(latitude, longitude, !!errorStatus); | 79 return new WebInspector.Geolocation(latitude, longitude, !!errorStatus); |
| 80 } | 80 } |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * @param {string} value | 83 * @param {string} value |
| 84 * @return {boolean} | 84 * @return {boolean} |
| 85 */ | 85 */ |
| 86 WebInspector.Geolocation.latitudeValidator = function(value) | 86 WebInspector.Geolocation.latitudeValidator = function(value) |
| 87 { | 87 { |
| 88 return !value || (/^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && value > = -90 && value <= 90); | 88 return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && value >= -90 && va lue <= 90; |
|
lushnikov
2016/05/02 19:25:57
value >= -90
while we're here - let's not use imp
luoe
2016/05/02 21:46:17
Done.
| |
| 89 } | 89 } |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * @param {string} value | 92 * @param {string} value |
| 93 * @return {boolean} | 93 * @return {boolean} |
| 94 */ | 94 */ |
| 95 WebInspector.Geolocation.longitudeValidator = function(value) | 95 WebInspector.Geolocation.longitudeValidator = function(value) |
| 96 { | 96 { |
| 97 return !value || (/^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && value > = -180 && value <= 180); | 97 return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && value >= -180 && v alue <= 180; |
|
lushnikov
2016/05/02 19:25:57
ditto
luoe
2016/05/02 21:46:17
Done, using parseFloat.
| |
| 98 } | 98 } |
| 99 | 99 |
| 100 WebInspector.Geolocation.DefaultMockAccuracy = 150; | 100 WebInspector.Geolocation.DefaultMockAccuracy = 150; |
| OLD | NEW |