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

Unified Diff: Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 343343003: DevTools: [Styles] Add "px" suffix to numbers on arrow up/down (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/elements/StylesSidebarPane.js
diff --git a/Source/devtools/front_end/elements/StylesSidebarPane.js b/Source/devtools/front_end/elements/StylesSidebarPane.js
index e5459e7a4cd0ecf6fb87144b2cb43246458e2c46..a54c56d33549ebd7c78118d0bc3e88f6eb3b8d60 100644
--- a/Source/devtools/front_end/elements/StylesSidebarPane.js
+++ b/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -3285,8 +3285,22 @@ WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = {
this._sidebarPane.applyStyleText(this._sidebarPane.nameElement.textContent + ": " + this._sidebarPane.valueElement.textContent, false, false, false);
}
+ /**
+ * @param {string} prefix
+ * @param {number} number
+ * @param {string} suffix
+ * @return {string}
+ * @this {WebInspector.StylesSidebarPane.CSSPropertyPrompt}
+ */
+ function customNumberHandler(prefix, number, suffix)
+ {
+ if (number !== 0 && !suffix.length && WebInspector.CSSMetadata.isLengthProperty(this._sidebarPane.property.name))
+ suffix = "px";
+ return prefix + number + suffix;
+ }
+
// Handle numeric value increment/decrement only at this point.
- if (!this._isEditingName && WebInspector.handleElementValueModifications(event, this._sidebarPane.valueElement, finishHandler.bind(this), this._isValueSuggestion.bind(this)))
+ if (!this._isEditingName && WebInspector.handleElementValueModifications(event, this._sidebarPane.valueElement, finishHandler.bind(this), this._isValueSuggestion.bind(this), customNumberHandler.bind(this)))
return true;
return false;
« no previous file with comments | « Source/devtools/front_end/elements/MetricsSidebarPane.js ('k') | Source/devtools/front_end/sdk/CSSMetadata.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698