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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2278203003: DevTools: Allow shadow-editor value manipulation with arrow keys and mousewheel (Closed)
Patch Set: Check key pressed inside createReplacementString Created 4 years, 4 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 | « third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
index c5714f56dc119e77f9722b7264ed33349b319af8..afc621e66eac605b51e4860db4ea843fd01f9d77 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -392,19 +392,19 @@ WebInspector._modifiedHexValue = function(hexString, event)
{
var direction = WebInspector._valueModificationDirection(event);
if (!direction)
- return hexString;
+ return null;
var mouseEvent = /** @type {!MouseEvent} */(event);
var number = parseInt(hexString, 16);
if (isNaN(number) || !isFinite(number))
- return hexString;
+ return null;
var hexStrLen = hexString.length;
var channelLen = hexStrLen / 3;
// Colors are either rgb or rrggbb.
if (channelLen !== 1 && channelLen !== 2)
- return hexString;
+ return null;
// Precision modifier keys work with both mousewheel and up/down keys.
// When ctrl is pressed, increase R by 1.
@@ -443,7 +443,7 @@ WebInspector._modifiedFloatNumber = function(number, event)
{
var direction = WebInspector._valueModificationDirection(event);
if (!direction)
- return number;
+ return null;
var mouseEvent = /** @type {!MouseEvent} */(event);
@@ -481,30 +481,27 @@ WebInspector._modifiedFloatNumber = function(number, event)
WebInspector.createReplacementString = function(wordString, event, customNumberHandler)
{
var replacementString;
- var prefix, suffix, number;
-
+ var prefix = "";
+ var suffix = "";
+ var number = null;
var matches;
matches = /(.*#)([\da-fA-F]+)(.*)/.exec(wordString);
if (matches && matches.length) {
prefix = matches[1];
suffix = matches[3];
number = WebInspector._modifiedHexValue(matches[2], event);
-
- replacementString = customNumberHandler ? customNumberHandler(prefix, number, suffix) : prefix + number + suffix;
} else {
matches = /(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/.exec(wordString);
if (matches && matches.length) {
prefix = matches[1];
suffix = matches[3];
number = WebInspector._modifiedFloatNumber(parseFloat(matches[2]), event);
-
- // Need to check for null explicitly.
- if (number === null)
- return null;
-
- replacementString = customNumberHandler ? customNumberHandler(prefix, number, suffix) : prefix + number + suffix;
}
}
+ // Need to check for null explicitly.
+ if (number === null)
+ return null;
+ replacementString = customNumberHandler ? customNumberHandler(prefix, number, suffix) : prefix + number + suffix;
return replacementString || null;
}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698