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

Unified Diff: third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js

Issue 1923393006: DevTools: fix styles and input validation in sensor pane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Orientation labels now alpha-beta-gamma Created 4 years, 7 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: third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js b/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js
index 57b415a206b78dd076d3250fe6fd1145f7d28888..08ee5fa626fef308661d1b4c2d182bae2f621992 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js
@@ -85,7 +85,8 @@ WebInspector.Geolocation.parseUserInput = function(latitudeString, longitudeStri
*/
WebInspector.Geolocation.latitudeValidator = function(value)
{
- return !value || (/^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && value >= -90 && value <= 90);
+ var numValue = parseFloat(value);
+ return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && numValue >= -90 && numValue <= 90;
}
/**
@@ -94,7 +95,8 @@ WebInspector.Geolocation.latitudeValidator = function(value)
*/
WebInspector.Geolocation.longitudeValidator = function(value)
{
- return !value || (/^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && value >= -180 && value <= 180);
+ var numValue = parseFloat(value);
+ return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && numValue >= -180 && numValue <= 180;
lushnikov 2016/05/04 17:10:45 Is this regex just a fancy way of saying "this is
luoe 2016/05/04 17:31:10 Not quite. One case, value="1-0", parseFloat("1-0
}
WebInspector.Geolocation.DefaultMockAccuracy = 150;

Powered by Google App Engine
This is Rietveld 408576698