Title: [204759] trunk/Source/WebInspectorUI
Revision
204759
Author
commit-qu...@webkit.org
Date
2016-08-22 23:09:33 -0700 (Mon, 22 Aug 2016)

Log Message

Web Inspector: Styles -> Computed -> Box Model shows NaN x NaN for invisible elements
https://bugs.webkit.org/show_bug.cgi?id=161038

Patch by Devin Rousso <dcrousso+web...@gmail.com> on 2016-08-22
Reviewed by Joseph Pecoraro.

* UserInterface/Base/Utilities.js:
Add figureDash variable.

* UserInterface/Views/BoxModelDetailsSectionRow.js:
(WebInspector.BoxModelDetailsSectionRow.prototype._updateMetrics.createElement):
(WebInspector.BoxModelDetailsSectionRow.prototype._updateMetrics.createBoxPartElement):
Moved isNaN check of value to common createElement.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (204758 => 204759)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-08-23 05:56:45 UTC (rev 204758)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-08-23 06:09:33 UTC (rev 204759)
@@ -1,5 +1,20 @@
 2016-08-22  Devin Rousso  <dcrousso+web...@gmail.com>
 
+        Web Inspector: Styles -> Computed -> Box Model shows NaN x NaN for invisible elements
+        https://bugs.webkit.org/show_bug.cgi?id=161038
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Base/Utilities.js:
+        Add figureDash variable.
+
+        * UserInterface/Views/BoxModelDetailsSectionRow.js:
+        (WebInspector.BoxModelDetailsSectionRow.prototype._updateMetrics.createElement):
+        (WebInspector.BoxModelDetailsSectionRow.prototype._updateMetrics.createBoxPartElement):
+        Moved isNaN check of value to common createElement.
+
+2016-08-22  Devin Rousso  <dcrousso+web...@gmail.com>
+
         Web Inspector: Visual styles sidebar should do something sane for SVG elements
         https://bugs.webkit.org/show_bug.cgi?id=148269
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (204758 => 204759)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2016-08-23 05:56:45 UTC (rev 204758)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2016-08-23 06:09:33 UTC (rev 204759)
@@ -25,6 +25,7 @@
 
 var emDash = "\u2014";
 var enDash = "\u2013";
+var figureDash = "\u2012";
 var ellipsis = "\u2026";
 
 Object.defineProperty(Object, "shallowCopy",

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js (204758 => 204759)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js	2016-08-23 05:56:45 UTC (rev 204758)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js	2016-08-23 06:09:33 UTC (rev 204759)
@@ -112,10 +112,13 @@
         function createElement(type, value, name, propertyName, style)
         {
             // Check if the value is a float and whether it should be rounded.
-            var floatValue = parseFloat(value);
-            var shouldRoundValue = (!isNaN(floatValue) && floatValue % 1 !== 0);
+            let floatValue = parseFloat(value);
+            let shouldRoundValue = (!isNaN(floatValue) && floatValue % 1 !== 0);
 
-            var element = document.createElement(type);
+            if (isNaN(floatValue))
+                value = figureDash;
+
+            let element = document.createElement(type);
             element.textContent = shouldRoundValue ? ("~" + Math.round(floatValue * 100) / 100) : value;
             if (shouldRoundValue)
                 element.title = value;
@@ -125,15 +128,14 @@
 
         function createBoxPartElement(style, name, side, suffix)
         {
-            var propertyName = (name !== "position" ? name + "-" : "") + side + suffix;
-            var value = style.propertyForName(propertyName).value;
-            if (value === "" || (name !== "position" && value === "0px"))
-                value = "\u2012";
-            else if (name === "position" && value === "auto")
-                value = "\u2012";
-            value = value.replace(/px$/, "");
+            let propertyName = (name !== "position" ? name + "-" : "") + side + suffix;
+            let value = style.propertyForName(propertyName).value;
+            if (value === "" || (name !== "position" && value === "0px") || (name === "position" && value === "auto"))
+                value = "";
+            else
+                value = value.replace(/px$/, "");
 
-            var element = createElement.call(this, "div", value, name, propertyName, style);
+            let element = createElement.call(this, "div", value, name, propertyName, style);
             element.className = side;
             return element;
         }
@@ -379,9 +381,9 @@
             return;
         }
 
-        if (context.box !== "position" && (!userInput || userInput === "\u2012"))
+        if (context.box !== "position" && (!userInput || userInput === figureDash))
             userInput = "0px";
-        else if (context.box === "position" && (!userInput || userInput === "\u2012"))
+        else if (context.box === "position" && (!userInput || userInput === figureDash))
             userInput = "auto";
 
         userInput = userInput.toLowerCase();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to