Title: [253348] trunk/Source/WebInspectorUI
Revision
253348
Author
[email protected]
Date
2019-12-10 15:01:47 -0800 (Tue, 10 Dec 2019)

Log Message

Web Inspector: REGRESSION(r251038): Elements: Computed: implicit shorthands are not shown when "Prefer Shorthands" is enabled
https://bugs.webkit.org/show_bug.cgi?id=205035
<rdar://problem/57773470>

Reviewed by Brian Burg.

The computed style treats most shorthand properties as "implicit", meaning that if "Prefer
Shorthands" is enabled, we won't show the shorthand properties unless "Show All" is also
enabled. The frontend can fix this by checking to see if there are any non-implicit longhand
values for each shorthand value, and therefore decide not to hide the "implicit" shorthand.

* UserInterface/Views/ComputedStyleSection.js:
(WI.ComputedStyleSection.prototype.get propertiesToRender):
(WI.ComputedStyleSection.prototype.get propertiesToRender.hasNonImplicitLonghand): Added.
Drive-by: filter the list of properties to render before sorting them for performance.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (253347 => 253348)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-12-10 22:40:16 UTC (rev 253347)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-12-10 23:01:47 UTC (rev 253348)
@@ -1,5 +1,23 @@
 2019-12-10  Devin Rousso  <[email protected]>
 
+        Web Inspector: REGRESSION(r251038): Elements: Computed: implicit shorthands are not shown when "Prefer Shorthands" is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=205035
+        <rdar://problem/57773470>
+
+        Reviewed by Brian Burg.
+
+        The computed style treats most shorthand properties as "implicit", meaning that if "Prefer
+        Shorthands" is enabled, we won't show the shorthand properties unless "Show All" is also
+        enabled. The frontend can fix this by checking to see if there are any non-implicit longhand
+        values for each shorthand value, and therefore decide not to hide the "implicit" shorthand.
+
+        * UserInterface/Views/ComputedStyleSection.js:
+        (WI.ComputedStyleSection.prototype.get propertiesToRender):
+        (WI.ComputedStyleSection.prototype.get propertiesToRender.hasNonImplicitLonghand): Added.
+        Drive-by: filter the list of properties to render before sorting them for performance.
+
+2019-12-10  Devin Rousso  <[email protected]>
+
         REGRESSION(r252523): Web Inspector: Styles: semicolon is wrongly positioned in multiline values
         https://bugs.webkit.org/show_bug.cgi?id=205034
         <rdar://problem/57772846>

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.js (253347 => 253348)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.js	2019-12-10 22:40:16 UTC (rev 253347)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.js	2019-12-10 23:01:47 UTC (rev 253348)
@@ -140,17 +140,36 @@
         else
             properties = this._style.properties;
 
-        properties.sort((a, b) => a.name.extendedLocaleCompare(b.name));
+        let propertyNameMap = new Map(properties.map((property) => [property.canonicalName, property]));
 
+        function hasNonImplicitLonghand(property) {
+            if (property.canonicalName === "all")
+                return false;
+
+            let longhandPropertyNames = WI.CSSKeywordCompletions.LonghandNamesForShorthandProperty.get(property.canonicalName);
+            if (!longhandPropertyNames)
+                return false;
+
+            for (let longhandPropertyName of longhandPropertyNames) {
+                let property = propertyNameMap.get(longhandPropertyName);
+                if (property && !property.implicit)
+                    return true;
+            }
+
+            return false;
+        }
+
         let hideVariables = this._propertyVisibilityMode === ComputedStyleSection.PropertyVisibilityMode.HideVariables;
         let hideNonVariables = this._propertyVisibilityMode === ComputedStyleSection.PropertyVisibilityMode.HideNonVariables;
 
-        return properties.filter((property) => {
+        properties = properties.filter((property) => {
             if (this._alwaysShowPropertyNames.has(property.canonicalName))
                 return true;
 
-            if (property.implicit && !this._showsImplicitProperties)
-                return false;
+            if (property.implicit && !this._showsImplicitProperties) {
+                if (!(this._showsShorthandsInsteadOfLonghands && property.isShorthand && hasNonImplicitLonghand(property)))
+                    return false;
+            }
 
             if (this._showsShorthandsInsteadOfLonghands) {
                 if (property.shorthandPropertyNames.length)
@@ -166,6 +185,9 @@
 
             return true;
         });
+
+        properties.sort((a, b) => a.name.extendedLocaleCompare(b.name));
+        return properties;
     }
 
     layout()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to