Title: [248204] trunk/Source/WebInspectorUI
Revision
248204
Author
[email protected]
Date
2019-08-03 16:14:15 -0700 (Sat, 03 Aug 2019)

Log Message

Web Inspector: Elements: Styles: move psuedo-selector rules before inherited rules
https://bugs.webkit.org/show_bug.cgi?id=199950

Reviewed by Joseph Pecoraro.

Since pseudo-selector rules (usually) affect the selected element, or are related to its
content, it's more useful to have them near that element's rules instead of after all of
it's inherited rules.

* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.layout):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (248203 => 248204)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-08-03 20:32:57 UTC (rev 248203)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-08-03 23:14:15 UTC (rev 248204)
@@ -1,5 +1,19 @@
 2019-08-03  Devin Rousso  <[email protected]>
 
+        Web Inspector: Elements: Styles: move psuedo-selector rules before inherited rules
+        https://bugs.webkit.org/show_bug.cgi?id=199950
+
+        Reviewed by Joseph Pecoraro.
+
+        Since pseudo-selector rules (usually) affect the selected element, or are related to its
+        content, it's more useful to have them near that element's rules instead of after all of
+        it's inherited rules.
+
+        * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
+        (WI.SpreadsheetRulesStyleDetailsPanel.prototype.layout):
+
+2019-08-03  Devin Rousso  <[email protected]>
+
         Web Inspector: Elements: Styles: add icons for various CSS rule types
         https://bugs.webkit.org/show_bug.cgi?id=199946
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js (248203 => 248204)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js	2019-08-03 20:32:57 UTC (rev 248203)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js	2019-08-03 23:14:15 UTC (rev 248204)
@@ -300,32 +300,46 @@
                 addSection(preservedSection);
         };
 
-        for (let style of this.nodeStyles.uniqueOrderedStyles)
-            createSection(style);
+        let addedPseudoStyles = false;
+        let addPseudoStyles = () => {
+            if (addedPseudoStyles)
+                return;
 
-        let beforePseudoId = null;
-        let afterPseudoId = null;
-        if (InspectorBackend.domains.CSS.PseudoId) {
-            beforePseudoId = WI.CSSManager.PseudoSelectorNames.Before;
-            afterPseudoId = WI.CSSManager.PseudoSelectorNames.After;
-        } else {
-            // Compatibility (iOS 12.2): CSS.PseudoId did not exist.
-            beforePseudoId = 4;
-            afterPseudoId = 5;
-        }
+            // Add all pseudo styles before any inherited rules.
+            let beforePseudoId = null;
+            let afterPseudoId = null;
+            if (InspectorBackend.domains.CSS.PseudoId) {
+                beforePseudoId = WI.CSSManager.PseudoSelectorNames.Before;
+                afterPseudoId = WI.CSSManager.PseudoSelectorNames.After;
+            } else {
+                // Compatibility (iOS 12.2): CSS.PseudoId did not exist.
+                beforePseudoId = 4;
+                afterPseudoId = 5;
+            }
 
-        for (let [pseudoId, pseudoElementInfo] of this.nodeStyles.pseudoElements) {
-            let pseudoElement = null;
-            if (pseudoId === beforePseudoId)
-                pseudoElement = this.nodeStyles.node.beforePseudoElement();
-            else if (pseudoId === afterPseudoId)
-                pseudoElement = this.nodeStyles.node.afterPseudoElement();
-            addHeader(WI.UIString("Pseudo-Element"), pseudoElement || pseudoId);
+            for (let [pseudoId, pseudoElementInfo] of this.nodeStyles.pseudoElements) {
+                let pseudoElement = null;
+                if (pseudoId === beforePseudoId)
+                    pseudoElement = this.nodeStyles.node.beforePseudoElement();
+                else if (pseudoId === afterPseudoId)
+                    pseudoElement = this.nodeStyles.node.afterPseudoElement();
+                addHeader(WI.UIString("Pseudo-Element"), pseudoElement || pseudoId);
 
-            for (let style of WI.DOMNodeStyles.uniqueOrderedStyles(pseudoElementInfo.orderedStyles))
-                createSection(style);
+                for (let style of WI.DOMNodeStyles.uniqueOrderedStyles(pseudoElementInfo.orderedStyles))
+                    createSection(style);
+            }
+
+            addedPseudoStyles = true;
+        };
+
+        for (let style of this.nodeStyles.uniqueOrderedStyles) {
+            if (style.inherited)
+                addPseudoStyles();
+            createSection(style);
         }
 
+        addPseudoStyles();
+
         this._newRuleSelector = null;
 
         this.element.append(this._emptyFilterResultsElement);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to