Commit 6e4a073a authored by Erik Luo's avatar Erik Luo Committed by Commit Bot

DevTools: only hide highlight when active property is set

When highlighting the active property, we used to always hide the
overlay highlight, even if no active property was being highlighted.
This CL checks that we do not hide unrelated highlights.

Screenshot: https://imgur.com/a/W0zFEqq

Bug: 918957
Change-Id: I118369e64af4062994221a5a79e8b0e16989b665
Reviewed-on: https://chromium-review.googlesource.com/c/1394986Reviewed-by: default avatarJoel Einbinder <einbinder@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620002}
parent 2a16f2ba
...@@ -64,6 +64,7 @@ Elements.StylesSidebarPane = class extends Elements.ElementsSidebarPane { ...@@ -64,6 +64,7 @@ Elements.StylesSidebarPane = class extends Elements.ElementsSidebarPane {
this._isEditingStyle = false; this._isEditingStyle = false;
/** @type {?RegExp} */ /** @type {?RegExp} */
this._filterRegex = null; this._filterRegex = null;
this._isActivePropertyHighlighted = false;
this.contentElement.classList.add('styles-pane'); this.contentElement.classList.add('styles-pane');
...@@ -392,10 +393,13 @@ Elements.StylesSidebarPane = class extends Elements.ElementsSidebarPane { ...@@ -392,10 +393,13 @@ Elements.StylesSidebarPane = class extends Elements.ElementsSidebarPane {
* @param {?Elements.StylePropertyTreeElement} treeElement * @param {?Elements.StylePropertyTreeElement} treeElement
*/ */
_setActiveProperty(treeElement) { _setActiveProperty(treeElement) {
if (this._isActivePropertyHighlighted)
SDK.OverlayModel.hideDOMNodeHighlight();
this._isActivePropertyHighlighted = false;
if (!this.node()) if (!this.node())
return; return;
SDK.OverlayModel.hideDOMNodeHighlight();
if (!treeElement || treeElement.overloaded() || treeElement.inherited()) if (!treeElement || treeElement.overloaded() || treeElement.inherited())
return; return;
...@@ -405,6 +409,7 @@ Elements.StylesSidebarPane = class extends Elements.ElementsSidebarPane { ...@@ -405,6 +409,7 @@ Elements.StylesSidebarPane = class extends Elements.ElementsSidebarPane {
if (!treeElement.name.startsWith(mode)) if (!treeElement.name.startsWith(mode))
continue; continue;
this.node().domModel().overlayModel().highlightDOMNodeWithConfig(this.node().id, {mode, selectors}); this.node().domModel().overlayModel().highlightDOMNodeWithConfig(this.node().id, {mode, selectors});
this._isActivePropertyHighlighted = true;
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment