Changeset 224286 in webkit


Ignore:
Timestamp:
Nov 1, 2017 12:10:20 PM (6 years ago)
Author:
Nikita Vasilyev
Message:

Web Inspector: Styles Redesign: Hovering over a selector should highlight matching elements on the page
https://bugs.webkit.org/show_bug.cgi?id=179040

Reviewed by Devin Rousso.

  • UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:

(WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
Use mouseenter/mouseleave events instead of mousein/mouseout (as in the old styles sidebar)
to avoid unnecessary events being fired.

(WI.SpreadsheetCSSStyleDeclarationSection.prototype._highlightNodesWithSelector):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._hideDOMNodeHighlight):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r224210 r224286  
     12017-11-01  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: Styles Redesign: Hovering over a selector should highlight matching elements on the page
     4        https://bugs.webkit.org/show_bug.cgi?id=179040
     5
     6        Reviewed by Devin Rousso.
     7
     8        * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
     9        (WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
     10        Use mouseenter/mouseleave events instead of mousein/mouseout (as in the old styles sidebar)
     11        to avoid unnecessary events being fired.
     12
     13        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._highlightNodesWithSelector):
     14        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._hideDOMNodeHighlight):
     15
    1162017-10-30  Nikita Vasilyev  <nvasilyev@apple.com>
    217
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js

    r224174 r224286  
    6565        this._selectorElement = document.createElement("span");
    6666        this._selectorElement.classList.add("selector");
     67        this._selectorElement.addEventListener("mouseenter", this._highlightNodesWithSelector.bind(this));
     68        this._selectorElement.addEventListener("mouseleave", this._hideDOMNodeHighlight.bind(this));
    6769        this._headerElement.append(this._selectorElement);
    6870
     
    370372        this._propertiesEditor.addBlankProperty(appendAfterLast);
    371373    }
     374
     375    _highlightNodesWithSelector()
     376    {
     377        if (!this._style.ownerRule) {
     378            WI.domTreeManager.highlightDOMNode(this._style.node.id);
     379            return;
     380        }
     381
     382        let selectorText = this._selectorElement.textContent.trim();
     383        WI.domTreeManager.highlightSelector(selectorText, this._style.node.ownerDocument.frameIdentifier);
     384    }
     385
     386    _hideDOMNodeHighlight()
     387    {
     388        WI.domTreeManager.hideDOMNodeHighlight();
     389    }
    372390};
    373391
Note: See TracChangeset for help on using the changeset viewer.