Changeset 194723 in webkit


Ignore:
Timestamp:
Jan 7, 2016 2:11:33 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Add indicator that element has pseudo-class in DOM tree
https://bugs.webkit.org/show_bug.cgi?id=152680

Patch by Devin Rousso <Devin Rousso> on 2016-01-07
Reviewed by Timothy Hatcher.

  • UserInterface/Views/DOMTreeElement.js:

(WebInspector.DOMTreeElement):
(WebInspector.DOMTreeElement.prototype._nodePseudoClassesDidChange):
Added an event listener to the node for when pseudo-classes change.

  • UserInterface/Views/DOMTreeOutline.css:

(.dom-tree-outline li.pseudo-class-enabled > .selection::before):
(.dom-tree-outline:focus li.selected.pseudo-class-enabled > .selection::before):
Used the hover/selected background style element to ensure that the indicator
is always positioned evenly with the first line of the opening tag.

(.dom-tree-outline li.hovered:not(.selected) .selection):
(.dom-tree-outline li .selection):
(.dom-tree-outline li.selected .selection):
(.dom-tree-outline li.elements-drag-over .selection):
Removed "display: none;" (as well as the "block" declarations) to allow
the ::before pseudo-element to display.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r194717 r194723  
     12016-01-07  Devin Rousso  <dcrousso+webkit@gmail.com>
     2
     3        Web Inspector: Add indicator that element has pseudo-class in DOM tree
     4        https://bugs.webkit.org/show_bug.cgi?id=152680
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * UserInterface/Views/DOMTreeElement.js:
     9        (WebInspector.DOMTreeElement):
     10        (WebInspector.DOMTreeElement.prototype._nodePseudoClassesDidChange):
     11        Added an event listener to the node for when pseudo-classes change.
     12
     13        * UserInterface/Views/DOMTreeOutline.css:
     14        (.dom-tree-outline li.pseudo-class-enabled > .selection::before):
     15        (.dom-tree-outline:focus li.selected.pseudo-class-enabled > .selection::before):
     16        Used the hover/selected background style element to ensure that the indicator
     17        is always positioned evenly with the first line of the opening tag.
     18
     19        (.dom-tree-outline li.hovered:not(.selected) .selection):
     20        (.dom-tree-outline li .selection):
     21        (.dom-tree-outline li.selected .selection):
     22        (.dom-tree-outline li.elements-drag-over .selection):
     23        Removed "display: none;" (as well as the "block" declarations) to allow
     24        the ::before pseudo-element to display.
     25
    1262016-01-07  Devin Rousso  <dcrousso+webkit@gmail.com>
    227
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

    r191519 r194723  
    4545        this._nodeStateChanges = [];
    4646        this._boundNodeChangedAnimationEnd = this._nodeChangedAnimationEnd.bind(this);
     47
     48        node.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged, this._nodePseudoClassesDidChange, this);
    4749    }
    4850
     
    15241526    }
    15251527
     1528    _nodePseudoClassesDidChange(event)
     1529    {
     1530        if (this._elementCloseTag)
     1531            return;
     1532
     1533        this._listItemNode.classList.toggle("pseudo-class-enabled", !!this.representedObject.enabledPseudoClasses.length);
     1534    }
     1535
    15261536    _fireDidChange()
    15271537    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css

    r191488 r194723  
    4141
    4242.dom-tree-outline li.hovered:not(.selected) .selection {
    43     display: block;
    4443    background-color: hsla(209, 100%, 49%, 0.1);
    4544}
    4645
    4746.dom-tree-outline li .selection {
    48     display: none;
    4947    position: absolute;
    5048    left: 0;
     
    5553
    5654.dom-tree-outline li.selected .selection {
    57     display: block;
    5855    background-color: hsl(0, 0%, 83%);
    5956}
    6057
    6158.dom-tree-outline li.elements-drag-over .selection {
    62     display: block;
    6359    margin-top: -2px;
    6460    border-top: 2px solid hsl(209, 100%, 49%);
     
    9995}
    10096
     97.dom-tree-outline li.pseudo-class-enabled > .selection::before {
     98    display: inline-block;
     99    position: absolute;
     100    top: 4px;
     101    left: 2px;
     102    width: 5px;
     103    height: 5px;
     104    content: "";
     105    background-color: hsl(212, 92%, 54%);
     106    border-radius: 50%;
     107}
     108
    101109.dom-tree-outline.single-node li {
    102110    padding-left: 2px;
     
    105113.dom-tree-outline:focus li.selected {
    106114    color: white;
     115}
     116
     117.dom-tree-outline:focus li.selected.pseudo-class-enabled > .selection::before {
     118    background-color: hsl(0, 100%, 100%);
    107119}
    108120
Note: See TracChangeset for help on using the changeset viewer.