Title: [186708] trunk/Source/WebInspectorUI
Revision
186708
Author
[email protected]
Date
2015-07-11 01:42:35 -0700 (Sat, 11 Jul 2015)

Log Message

Web Inspector: Warning icon tooltip for numbers with no units could be improved
https://bugs.webkit.org/show_bug.cgi?id=146859

Reviewed by Timothy Hatcher.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded):
If the property's value is incorrect and is comprised of only numbers, that must mean that the value needs
to have units (like "px") after the number.  Added another warning icon case to support this scenario.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (186707 => 186708)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-07-11 06:55:48 UTC (rev 186707)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-07-11 08:42:35 UTC (rev 186708)
@@ -1,3 +1,16 @@
+2015-07-11  Devin Rousso  <[email protected]>
+
+        Web Inspector: Warning icon tooltip for numbers with no units could be improved
+        https://bugs.webkit.org/show_bug.cgi?id=146859
+
+        Reviewed by Timothy Hatcher.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded):
+        If the property's value is incorrect and is comprised of only numbers, that must mean that the value needs
+        to have units (like "px") after the number.  Added another warning icon case to support this scenario.
+
 2015-07-10  Timothy Hatcher  <[email protected]>
 
         Web Inspector: Use -apple-system instead of -webkit-system-font

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (186707 => 186708)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-07-11 06:55:48 UTC (rev 186707)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-07-11 08:42:35 UTC (rev 186708)
@@ -488,6 +488,7 @@
 localizedStrings["The 'webkit' prefix is not necessary.\nClick to insert a duplicate without the prefix."] = "The 'webkit' prefix is not necessary.\nClick to insert a duplicate without the prefix.";
 localizedStrings["The property '%s' is not supported."] = "The property '%s' is not supported.";
 localizedStrings["The value '%s' is not supported for this property.\nClick to delete and open autocomplete."] = "The value '%s' is not supported for this property.\nClick to delete and open autocomplete.";
+localizedStrings["The value '%s' needs units.\nClick to add 'px' to the value."] = "The value '%s' needs units.\nClick to add 'px' to the value.";
 localizedStrings["The  %s \ntable is empty."] = "The  %s \ntable is empty.";
 localizedStrings["This property needs a value.\nClick to open autocomplete."] = "This property needs a value.\nClick to open autocomplete.";
 localizedStrings["Time until the load event fired, click to show the Network Requests timeline"] = "Time until the load event fired, click to show the Network Requests timeline";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (186707 => 186708)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-11 06:55:48 UTC (rev 186707)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-11 08:42:35 UTC (rev 186708)
@@ -1073,14 +1073,23 @@
 
             this._codeMirror.markText(start, end, {className: "invalid"});
 
-            var valueReplacement = property.value.length ? WebInspector.UIString("The value '%s' is not supported for this property.\nClick to delete and open autocomplete.").format(property.value) : WebInspector.UIString("This property needs a value.\nClick to open autocomplete.");
+            if (/^(?:\d+)$/.test(property.value)) {
+                invalidMarkerInfo = {
+                    position: start,
+                    title: WebInspector.UIString("The value '%s' needs units.\nClick to add 'px' to the value.").format(property.value),
+                    correction: property.name + ": " + property.value + "px;",
+                    autocomplete: false
+                };
+            } else {
+                var valueReplacement = property.value.length ? WebInspector.UIString("The value '%s' is not supported for this property.\nClick to delete and open autocomplete.").format(property.value) : WebInspector.UIString("This property needs a value.\nClick to open autocomplete.");
 
-            invalidMarkerInfo = {
-                position: start,
-                title: valueReplacement,
-                correction: property.name + ": ",
-                autocomplete: true
-            };
+                invalidMarkerInfo = {
+                    position: start,
+                    title: valueReplacement,
+                    correction: property.name + ": ",
+                    autocomplete: true
+                };
+            }
         } else if (!instancesOfProperty.call(this, "-webkit-" + property.name) && WebInspector.CSSCompletions.cssNameCompletions.propertyRequiresWebkitPrefix(property.name)) {
             // The property is valid and exists in the rule while its prefixed version does not.
             invalidMarkerInfo = {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to