Title: [204754] trunk/Source/WebInspectorUI
Revision
204754
Author
commit-qu...@webkit.org
Date
2016-08-22 21:47:27 -0700 (Mon, 22 Aug 2016)

Log Message

Web Inspector: Add indicator to matched selector being a pseudo-element
https://bugs.webkit.org/show_bug.cgi?id=160893

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

Instead of using "{}" icons for CSS rules, use a "P" icon with the same coloring to identify
that the rule contains a pseudo-selector that is currently being applied to the selected element.

* UserInterface/Base/Utilities.js:
(Array.prototype.toggleIncludes):
Toggles whether or not to include the given value in the array based on its existence or a
"force" flag parameter.

* UserInterface/Images/StyleRuleAuthorPseudo.svg:
* UserInterface/Images/StyleRuleInspectorPseudo.svg:
* UserInterface/Images/StyleRuleUserAgentPseudo.svg:
* UserInterface/Images/StyleRuleUserPseudo.svg:

* UserInterface/Models/CSSRule.js:
(WebInspector.CSSRule.prototype.hasMatchedPseudoElementSelector):

* UserInterface/Models/CSSSelector.js:
(WebInspector.CSSSelector.prototype.isPseudoElementSelector):

* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype.refresh):

* UserInterface/Views/StyleRuleIcons.css:
(.author-style-rule-icon.pseudo-element-selector .icon):
(.user-style-rule-icon.pseudo-element-selector .icon):
(.user-agent-style-rule-icon.pseudo-element-selector .icon):
(.inspector-style-rule-icon.pseudo-element-selector .icon):

 * UserInterface/Views/VisualStyleSelectorTreeItem.js:
(WebInspector.VisualStyleSelectorTreeItem):
(WebInspector.VisualStyleSelectorTreeItem.prototype.get iconClassName):
(WebInspector.VisualStyleSelectorTreeItem.prototype._updateSelectorIcon):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (204753 => 204754)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-08-23 01:49:58 UTC (rev 204753)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-08-23 04:47:27 UTC (rev 204754)
@@ -1,3 +1,43 @@
+2016-08-22  Devin Rousso  <dcrousso+web...@gmail.com>
+
+        Web Inspector: Add indicator to matched selector being a pseudo-element
+        https://bugs.webkit.org/show_bug.cgi?id=160893
+
+        Reviewed by Joseph Pecoraro.
+
+        Instead of using "{}" icons for CSS rules, use a "P" icon with the same coloring to identify
+        that the rule contains a pseudo-selector that is currently being applied to the selected element.
+
+        * UserInterface/Base/Utilities.js:
+        (Array.prototype.toggleIncludes):
+        Toggles whether or not to include the given value in the array based on its existence or a
+        "force" flag parameter.
+
+        * UserInterface/Images/StyleRuleAuthorPseudo.svg:
+        * UserInterface/Images/StyleRuleInspectorPseudo.svg:
+        * UserInterface/Images/StyleRuleUserAgentPseudo.svg:
+        * UserInterface/Images/StyleRuleUserPseudo.svg:
+
+        * UserInterface/Models/CSSRule.js:
+        (WebInspector.CSSRule.prototype.hasMatchedPseudoElementSelector):
+
+        * UserInterface/Models/CSSSelector.js:
+        (WebInspector.CSSSelector.prototype.isPseudoElementSelector):
+
+        * UserInterface/Views/CSSStyleDeclarationSection.js:
+        (WebInspector.CSSStyleDeclarationSection.prototype.refresh):
+
+        * UserInterface/Views/StyleRuleIcons.css:
+        (.author-style-rule-icon.pseudo-element-selector .icon):
+        (.user-style-rule-icon.pseudo-element-selector .icon):
+        (.user-agent-style-rule-icon.pseudo-element-selector .icon):
+        (.inspector-style-rule-icon.pseudo-element-selector .icon):
+
+         * UserInterface/Views/VisualStyleSelectorTreeItem.js:
+        (WebInspector.VisualStyleSelectorTreeItem):
+        (WebInspector.VisualStyleSelectorTreeItem.prototype.get iconClassName):
+        (WebInspector.VisualStyleSelectorTreeItem.prototype._updateSelectorIcon):
+
 2016-08-19  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Make an icon for Code Coverage Profiler

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (204753 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2016-08-23 01:49:58 UTC (rev 204753)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2016-08-23 04:47:27 UTC (rev 204754)
@@ -469,6 +469,21 @@
     }
 });
 
+Object.defineProperty(Array.prototype, "toggleIncludes",
+{
+    value: function(value, force)
+    {
+        let exists = this.includes(value);
+        if (exists === !!force)
+            return;
+
+        if (exists)
+            this.remove(value);
+        else
+            this.push(value);
+    }
+});
+
 Object.defineProperty(Array.prototype, "insertAtIndex",
 {
     value: function(value, index)

Added: trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleAuthorPseudo.svg (0 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleAuthorPseudo.svg	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleAuthorPseudo.svg	2016-08-23 04:47:27 UTC (rev 204754)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2016 Apple Inc. All rights reserved. -->
+<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
+    <path fill="rgb(148, 183, 219)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 Z"/>
+    <path fill="rgb(106, 136, 170)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 M 13 2 C 13.550781 2 14 2.449219 14 3 L 14 13 C 14 13.550781 13.550781 14 13 14 L 3 14 C 2.449219 14 2 13.550781 2 13 L 2 3 C 2 2.449219 2.449219 2 3 2 L 13 2"/>
+    <path fill="white" d="M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 Z M 5 12 L 5 4 L 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906 8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 Z"/>
+    <path fill="rgb(113, 146, 184)" d="M 7.78125 6.679688 L 7.78125 6.113281 C 8.019531 6.136719 8.117188 6.1875 8.144531 6.203125 C 8.140625 6.210938 8.148438 6.242188 8.148438 6.292969 C 8.148438 6.441406 8.105469 6.496094 8.015625 6.566406 C 7.953125 6.613281 7.875 6.648438 7.78125 6.679688 M 8.042969 3 L 4 3 L 4 13 L 7.78125 13 L 7.78125 9.863281 C 8.988281 9.824219 9.96875 9.507812 10.707031 8.925781 C 11.550781 8.257812 12 7.289062 12 6.125 C 12 4.753906 11.402344 4.035156 10.902344 3.675781 C 10.265625 3.222656 9.332031 3 8.042969 3 M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 L 6.78125 7.769531 M 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906
  8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 L 5 12 L 5 4 L 8.042969 4"/>
+</svg>

Added: trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleInspectorPseudo.svg (0 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleInspectorPseudo.svg	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleInspectorPseudo.svg	2016-08-23 04:47:27 UTC (rev 204754)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2016 Apple Inc. All rights reserved. -->
+<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
+    <path fill="rgb(165, 202, 164)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 Z"/>
+    <path fill="rgb(118, 153, 116)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 M 13 2 C 13.550781 2 14 2.449219 14 3 L 14 13 C 14 13.550781 13.550781 14 13 14 L 3 14 C 2.449219 14 2 13.550781 2 13 L 2 3 C 2 2.449219 2.449219 2 3 2 L 13 2"/>
+    <path fill="white" d="M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 Z M 5 12 L 5 4 L 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906 8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 Z"/>
+    <path fill="rgb(128, 166, 126)" d="M 7.78125 6.679688 L 7.78125 6.113281 C 8.019531 6.136719 8.117188 6.1875 8.144531 6.203125 C 8.140625 6.210938 8.148438 6.242188 8.148438 6.292969 C 8.148438 6.441406 8.105469 6.496094 8.015625 6.566406 C 7.953125 6.613281 7.875 6.648438 7.78125 6.679688 M 8.042969 3 L 4 3 L 4 13 L 7.78125 13 L 7.78125 9.863281 C 8.988281 9.824219 9.96875 9.507812 10.707031 8.925781 C 11.550781 8.257812 12 7.289062 12 6.125 C 12 4.753906 11.402344 4.035156 10.902344 3.675781 C 10.265625 3.222656 9.332031 3 8.042969 3 M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 L 6.78125 7.769531 M 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906
  8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 L 5 12 L 5 4 L 8.042969 4"/>
+</svg>

Added: trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleUserAgentPseudo.svg (0 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleUserAgentPseudo.svg	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleUserAgentPseudo.svg	2016-08-23 04:47:27 UTC (rev 204754)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2016 Apple Inc. All rights reserved. -->
+<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
+    <path fill="rgb(236, 151, 153)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 Z"/>
+    <path fill="rgb(191, 109, 113)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 M 13 2 C 13.550781 2 14 2.449219 14 3 L 14 13 C 14 13.550781 13.550781 14 13 14 L 3 14 C 2.449219 14 2 13.550781 2 13 L 2 3 C 2 2.449219 2.449219 2 3 2 L 13 2"/>
+    <path fill="white" d="M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 Z M 5 12 L 5 4 L 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906 8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 Z"/>
+    <path fill="rgb(204, 116, 121)" d="M 7.78125 6.679688 L 7.78125 6.113281 C 8.019531 6.136719 8.117188 6.1875 8.144531 6.203125 C 8.140625 6.210938 8.148438 6.242188 8.148438 6.292969 C 8.148438 6.441406 8.105469 6.496094 8.015625 6.566406 C 7.953125 6.613281 7.875 6.648438 7.78125 6.679688 M 8.042969 3 L 4 3 L 4 13 L 7.78125 13 L 7.78125 9.863281 C 8.988281 9.824219 9.96875 9.507812 10.707031 8.925781 C 11.550781 8.257812 12 7.289062 12 6.125 C 12 4.753906 11.402344 4.035156 10.902344 3.675781 C 10.265625 3.222656 9.332031 3 8.042969 3 M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 L 6.78125 7.769531 M 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906
  8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 L 5 12 L 5 4 L 8.042969 4"/>
+</svg>

Added: trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleUserPseudo.svg (0 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleUserPseudo.svg	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/StyleRuleUserPseudo.svg	2016-08-23 04:47:27 UTC (rev 204754)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2016 Apple Inc. All rights reserved. -->
+<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16">
+    <path fill="rgb(246, 222, 146)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 Z"/>
+    <path fill="rgb(204, 181, 108)" d="M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 M 13 2 C 13.550781 2 14 2.449219 14 3 L 14 13 C 14 13.550781 13.550781 14 13 14 L 3 14 C 2.449219 14 2 13.550781 2 13 L 2 3 C 2 2.449219 2.449219 2 3 2 L 13 2"/>
+    <path fill="white" d="M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 Z M 5 12 L 5 4 L 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906 8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 Z"/>
+    <path fill="rgb(216, 193, 115)" d="M 7.78125 6.679688 L 7.78125 6.113281 C 8.019531 6.136719 8.117188 6.1875 8.144531 6.203125 C 8.140625 6.210938 8.148438 6.242188 8.148438 6.292969 C 8.148438 6.441406 8.105469 6.496094 8.015625 6.566406 C 7.953125 6.613281 7.875 6.648438 7.78125 6.679688 M 8.042969 3 L 4 3 L 4 13 L 7.78125 13 L 7.78125 9.863281 C 8.988281 9.824219 9.96875 9.507812 10.707031 8.925781 C 11.550781 8.257812 12 7.289062 12 6.125 C 12 4.753906 11.402344 4.035156 10.902344 3.675781 C 10.265625 3.222656 9.332031 3 8.042969 3 M 6.78125 7.769531 L 7.136719 7.769531 C 7.757812 7.769531 8.246094 7.636719 8.605469 7.371094 C 8.96875 7.105469 9.148438 6.746094 9.148438 6.292969 C 9.148438 5.496094 8.59375 5.097656 7.488281 5.097656 L 6.78125 5.097656 L 6.78125 7.769531 M 8.042969 4 C 9.105469 4 9.863281 4.164062 10.316406 4.488281 C 10.773438 4.816406 11 5.359375 11 6.125 C 11 6.988281 10.695312 7.660156 10.085938 8.144531 C 9.480469 8.625 8.628906
  8.863281 7.535156 8.863281 L 6.78125 8.863281 L 6.78125 12 L 5 12 L 5 4 L 8.042969 4"/>
+</svg>

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js (204753 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js	2016-08-23 01:49:58 UTC (rev 204753)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSRule.js	2016-08-23 04:47:27 UTC (rev 204754)
@@ -155,6 +155,14 @@
         return this._matchedSelectorText;
     }
 
+    hasMatchedPseudoElementSelector()
+    {
+        if (this.nodeStyles && this.nodeStyles.node && this.nodeStyles.node.isPseudoElement())
+            return true;
+
+        return this.matchedSelectors.some((selector) => selector.isPseudoElementSelector());
+    }
+
     get style()
     {
         return this._style;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js (204753 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js	2016-08-23 01:49:58 UTC (rev 204753)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js	2016-08-23 04:47:27 UTC (rev 204754)
@@ -56,4 +56,9 @@
 
         return false;
     }
+
+    isPseudoElementSelector()
+    {
+        return WebInspector.CSSStyleManager.PseudoElementNames.some((name) => this._text.includes(`:${name}`));
+    }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (204753 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js	2016-08-23 01:49:58 UTC (rev 204753)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js	2016-08-23 04:47:27 UTC (rev 204754)
@@ -217,11 +217,16 @@
             var matchedSelectorIndices = this._style.ownerRule.matchedSelectorIndices;
             var alwaysMatch = !matchedSelectorIndices.length;
             if (selectors.length) {
+                var hasMatchingPseudoElementSelector = false;
                 for (var i = 0; i < selectors.length; ++i) {
                     appendSelector.call(this, selectors[i], alwaysMatch || matchedSelectorIndices.includes(i));
                     if (i < selectors.length - 1)
                         this._selectorElement.append(", ");
+
+                    if (matchedSelectorIndices.includes(i) && selectors[i].isPseudoElementSelector())
+                        hasMatchingPseudoElementSelector = true;
                 }
+                this._element.classList.toggle(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName, hasMatchingPseudoElementSelector);
             } else
                 appendSelectorTextKnownToMatch.call(this, this._style.ownerRule.selectorText);
 
@@ -670,6 +675,7 @@
 WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName = "selector-locked";
 WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName = "last-in-group";
 WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName = "matched";
+WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName = "pseudo-element-selector";
 
 WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName = "author-style-rule-icon";
 WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName = "user-style-rule-icon";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/StyleRuleIcons.css (204753 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Views/StyleRuleIcons.css	2016-08-23 01:49:58 UTC (rev 204753)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StyleRuleIcons.css	2016-08-23 04:47:27 UTC (rev 204754)
@@ -27,18 +27,34 @@
     content: url(../Images/StyleRuleAuthor.svg);
 }
 
+.author-style-rule-icon.pseudo-element-selector .icon {
+    content: url(../Images/StyleRuleAuthorPseudo.svg);
+}
+
 .user-style-rule-icon .icon {
     content: url(../Images/StyleRuleUser.svg);
 }
 
+.user-style-rule-icon.pseudo-element-selector .icon {
+    content: url(../Images/StyleRuleUserPseudo.svg);
+}
+
 .user-agent-style-rule-icon .icon {
     content: url(../Images/StyleRuleUserAgent.svg);
 }
 
+.user-agent-style-rule-icon.pseudo-element-selector .icon {
+    content: url(../Images/StyleRuleUserAgentPseudo.svg);
+}
+
 .inspector-style-rule-icon .icon {
     content: url(../Images/StyleRuleInspector.svg);
 }
 
+.inspector-style-rule-icon.pseudo-element-selector .icon {
+    content: url(../Images/StyleRuleInspectorPseudo.svg);
+}
+
 .inherited-style-rule-icon .icon {
     content: url(../Images/StyleRuleInherited.svg);
 }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js (204753 => 204754)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js	2016-08-23 01:49:58 UTC (rev 204753)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js	2016-08-23 04:47:27 UTC (rev 204754)
@@ -53,13 +53,17 @@
             break;
         }
 
+        let iconClasses = [iconClassName];
+        if (style.ownerRule && style.ownerRule.hasMatchedPseudoElementSelector())
+            iconClasses.push(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName);
+
         title = title.trim();
 
-        super(["visual-style-selector-item", iconClassName], title, subtitle, style);
+        super(["visual-style-selector-item", ...iconClasses], title, subtitle, style);
 
         this._delegate = delegate;
 
-        this._iconClassName = iconClassName;
+        this._iconClasses = iconClasses;
         this._lastValue = title;
         this._enableEditing = true;
         this._hasInvalidSelector = false;
@@ -69,7 +73,7 @@
 
     get iconClassName()
     {
-        return this._iconClassName;
+        return this._iconClasses.join(" ");
     }
 
     get selectorText()
@@ -272,6 +276,9 @@
 
         this._iconElement.title = null;
         this.mainTitleElement.title = null;
+
+        let hasMatchedPseudoElementSelector = this.representedObject.ownerRule && this.representedObject.ownerRule.hasMatchedPseudoElementSelector();
+        this._iconClasses.toggleIncludes(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName, hasMatchedPseudoElementSelector);
     }
 
     _handleIconElementClicked(event)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to