Title: [246855] trunk/Source/WebInspectorUI
Revision
246855
Author
[email protected]
Date
2019-06-26 16:25:18 -0700 (Wed, 26 Jun 2019)

Log Message

Web Inspector: REGRESSION: Elements: the forced pseudo-class indicator isn't visible when hovering
https://bugs.webkit.org/show_bug.cgi?id=199166

Reviewed by Matt Baker.

Make the pseudo-class indicator into its own element instead of being a `::before`.

* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement):
(WI.DOMTreeElement.prototype.updateSelectionArea):
(WI.DOMTreeElement.prototype.updateTitle):
(WI.DOMTreeElement.prototype._updatePseudoClassIndicator): Added.
(WI.DOMTreeElement.prototype.get pseudoClassesEnabled): Deleted.
(WI.DOMTreeElement.prototype._nodePseudoClassesDidChange): Deleted.

* UserInterface/Views/DOMTreeOutline.css:
(.tree-outline.dom):
(.tree-outline.dom li .pseudo-class-indicator): Added.
(body[dir=ltr] .tree-outline.dom li .pseudo-class-indicator): Added.
(body[dir=rtl] .tree-outline.dom li .pseudo-class-indicator): Added.
(.tree-outline.dom:focus li.selected .pseudo-class-indicator): Added.
(.tree-outline.dom li.pseudo-class-enabled > .selection-area::before): Deleted.
(body[dir=ltr] .tree-outline.dom li.pseudo-class-enabled > .selection-area::before): Deleted.
(body[dir=rtl] .tree-outline.dom li.pseudo-class-enabled > .selection-area::before): Deleted.
(.tree-outline.dom:focus li.selected.pseudo-class-enabled > .selection-area::before): Deleted.

* UserInterface/Views/FormattedValue.css:
(.formatted-node > .tree-outline.dom):
Adjust the indent of any `DOMTreeOutline` so there's more room for the pseudo-class
indicator, such as in the Console.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (246854 => 246855)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-06-26 23:20:47 UTC (rev 246854)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-06-26 23:25:18 UTC (rev 246855)
@@ -1,3 +1,36 @@
+2019-06-26  Devin Rousso  <[email protected]>
+
+        Web Inspector: REGRESSION: Elements: the forced pseudo-class indicator isn't visible when hovering
+        https://bugs.webkit.org/show_bug.cgi?id=199166
+
+        Reviewed by Matt Baker.
+
+        Make the pseudo-class indicator into its own element instead of being a `::before`.
+
+        * UserInterface/Views/DOMTreeElement.js:
+        (WI.DOMTreeElement):
+        (WI.DOMTreeElement.prototype.updateSelectionArea):
+        (WI.DOMTreeElement.prototype.updateTitle):
+        (WI.DOMTreeElement.prototype._updatePseudoClassIndicator): Added.
+        (WI.DOMTreeElement.prototype.get pseudoClassesEnabled): Deleted.
+        (WI.DOMTreeElement.prototype._nodePseudoClassesDidChange): Deleted.
+
+        * UserInterface/Views/DOMTreeOutline.css:
+        (.tree-outline.dom):
+        (.tree-outline.dom li .pseudo-class-indicator): Added.
+        (body[dir=ltr] .tree-outline.dom li .pseudo-class-indicator): Added.
+        (body[dir=rtl] .tree-outline.dom li .pseudo-class-indicator): Added.
+        (.tree-outline.dom:focus li.selected .pseudo-class-indicator): Added.
+        (.tree-outline.dom li.pseudo-class-enabled > .selection-area::before): Deleted.
+        (body[dir=ltr] .tree-outline.dom li.pseudo-class-enabled > .selection-area::before): Deleted.
+        (body[dir=rtl] .tree-outline.dom li.pseudo-class-enabled > .selection-area::before): Deleted.
+        (.tree-outline.dom:focus li.selected.pseudo-class-enabled > .selection-area::before): Deleted.
+
+        * UserInterface/Views/FormattedValue.css:
+        (.formatted-node > .tree-outline.dom):
+        Adjust the indent of any `DOMTreeOutline` so there's more room for the pseudo-class
+        indicator, such as in the Console.
+
 2019-06-25  Matt Baker  <[email protected]>
 
         Web Inspector: Elements: show shadow DOM by default

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.css (246854 => 246855)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.css	2019-06-26 23:20:47 UTC (rev 246854)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.css	2019-06-26 23:25:18 UTC (rev 246855)
@@ -34,7 +34,7 @@
 .content-view.dom-tree.show-gutter .tree-outline.dom {
     -webkit-padding-start: 20px;
 
-    --item-pseudo-class-enabled-selection-before-start: 17px;
+    --item-pseudo-class-indicator-start: 17px;
 }
 
 .content-view.dom-tree .tree-outline.dom li .status-image {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (246854 => 246855)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2019-06-26 23:20:47 UTC (rev 246854)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2019-06-26 23:25:18 UTC (rev 246855)
@@ -52,7 +52,7 @@
         this._recentlyModifiedAttributes = new Map;
         this._closeTagTreeElement = null;
 
-        node.addEventListener(WI.DOMNode.Event.EnabledPseudoClassesChanged, this._nodePseudoClassesDidChange, this);
+        node.addEventListener(WI.DOMNode.Event.EnabledPseudoClassesChanged, this._updatePseudoClassIndicator, this);
 
         this._ignoreSingleTextChild = false;
         this._forceUpdateTitle = false;
@@ -393,7 +393,7 @@
 
         // If there's no reason to have a selection area, remove the DOM element.
         let indicatesTreeOutlineState = this.treeOutline && (this.treeOutline.dragOverTreeElement === this || this.selected || this._animatingHighlight);
-        if (!this.hovered && !this.pseudoClassesEnabled && !indicatesTreeOutlineState) {
+        if (!this.hovered && !indicatesTreeOutlineState) {
             if (this._selectionElement) {
                 this._selectionElement.remove();
                 this._selectionElement = null;
@@ -1292,6 +1292,7 @@
         this._selectionElement = null;
         this.updateSelectionArea();
         this._highlightSearchResults();
+        this._updatePseudoClassIndicator();
         this._updateBreakpointStatus();
     }
 
@@ -1840,11 +1841,6 @@
         element.classList.add("node-state-changed");
     }
 
-    get pseudoClassesEnabled()
-    {
-        return !!this.representedObject.enabledPseudoClasses.length;
-    }
-
     get isNodeHidden()
     {
         let classes = this.representedObject.getAttribute("class");
@@ -1851,13 +1847,23 @@
         return classes && classes.includes(WI.DOMTreeElement.HideElementStyleSheetIdOrClassName);
     }
 
-    _nodePseudoClassesDidChange(event)
+    _updatePseudoClassIndicator()
     {
-        if (this._elementCloseTag)
+        if (!this.listItemElement || this._elementCloseTag)
             return;
 
-        this.updateSelectionArea();
-        this.listItemElement.classList.toggle("pseudo-class-enabled", !!this.representedObject.enabledPseudoClasses.length);
+        if (this.representedObject.enabledPseudoClasses.length) {
+            if (!this._pseudoClassIndicatorElement) {
+                this._pseudoClassIndicatorElement = document.createElement("div");
+                this._pseudoClassIndicatorElement.classList.add("pseudo-class-indicator");
+            }
+            this.listItemElement.insertBefore(this._pseudoClassIndicatorElement, this.listItemElement.firstChild);
+        } else {
+            if (this._pseudoClassIndicatorElement) {
+                this._pseudoClassIndicatorElement.remove();
+                this._pseudoClassIndicatorElement = null;
+            }
+        }
     }
 
     handleEvent(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css (246854 => 246855)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css	2019-06-26 23:20:47 UTC (rev 246854)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css	2019-06-26 23:25:18 UTC (rev 246855)
@@ -38,7 +38,7 @@
     background-color: transparent !important;
     color: var(--text-color);
 
-    --item-pseudo-class-enabled-selection-before-start: 2px;
+    --item-pseudo-class-indicator-start: 2px;
 
     --sublist-margin-start: 4px;
     --sublist-padding-start: 1px;
@@ -131,25 +131,29 @@
     -webkit-margin-end: var(--item-padding-end);
 }
 
-.tree-outline.dom li.pseudo-class-enabled > .selection-area::before {
+.tree-outline.dom li .pseudo-class-indicator {
     display: inline-block;
     position: absolute;
-    top: 4px;
     width: 5px;
     height: 5px;
+    margin-top: 4px;
     content: "";
     background-color: var(--glyph-color-active);
     border-radius: 50%;
 }
 
-body[dir=ltr] .tree-outline.dom li.pseudo-class-enabled > .selection-area::before {
-    left: var(--item-pseudo-class-enabled-selection-before-start);
+body[dir=ltr] .tree-outline.dom li .pseudo-class-indicator {
+    left: var(--item-pseudo-class-indicator-start);
 }
 
-body[dir=rtl] .tree-outline.dom li.pseudo-class-enabled > .selection-area::before {
-    right: var(--item-pseudo-class-enabled-selection-before-start);
+body[dir=rtl] .tree-outline.dom li .pseudo-class-indicator {
+    right: var(--item-pseudo-class-indicator-start);
 }
 
+.tree-outline.dom:focus li.selected .pseudo-class-indicator {
+    background-color: var(--selected-foreground-color);
+}
+
 .tree-outline.dom.single-node li {
     -webkit-padding-start: 2px;
 }
@@ -158,10 +162,6 @@
     color: white;
 }
 
-.tree-outline.dom:focus li.selected.pseudo-class-enabled > .selection-area::before {
-    background-color: hsl(0, 100%, 100%);
-}
-
 .tree-outline.dom:focus li.selected * {
     color: inherit;
 }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css (246854 => 246855)


--- trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css	2019-06-26 23:20:47 UTC (rev 246854)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css	2019-06-26 23:25:18 UTC (rev 246855)
@@ -65,7 +65,8 @@
 .formatted-node > .tree-outline.dom {
     display: block !important;
     padding: 0;
-    margin-left: -2px;
+
+    --item-pseudo-class-indicator-start: -2px;
 }
 
 .formatted-node > .tree-outline.dom li {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to