From 4d3ca59cdb384dc3648f18aba185ec0bcc3b53eb Mon Sep 17 00:00:00 2001 From: Erik Luo Date: Thu, 15 Nov 2018 22:17:45 +0000 Subject: [PATCH] DevTools: do not highlight selected node on DevTools focus Switching windows or using the Element picker may focus the DevTools area with relatedTarget=null. In these cases, re-applying node highlight is not needed. Bug: 905252 Change-Id: Ie3ae228c9cc404f16598ff428d9e593bb90e33e5 Reviewed-on: https://chromium-review.googlesource.com/c/1336910 Commit-Queue: Andrey Lushnikov Reviewed-by: Andrey Lushnikov Cr-Original-Commit-Position: refs/heads/master@{#608541} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: bb1a4687d53112eba231613f92d018c116850eaf --- front_end/elements/ElementsTreeOutline.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front_end/elements/ElementsTreeOutline.js b/front_end/elements/ElementsTreeOutline.js index 27d79ebdae..083d3089f1 100644 --- a/front_end/elements/ElementsTreeOutline.js +++ b/front_end/elements/ElementsTreeOutline.js @@ -550,7 +550,8 @@ Elements.ElementsTreeOutline = class extends UI.TreeOutline { const listItem = event.target.enclosingNodeOrSelfWithNodeName('li'); if (!listItem || !listItem.treeElement || !listItem.treeElement.selected) return; - this._highlightTreeElement(/** @type {!UI.TreeElement} */ (listItem.treeElement), true /* showInfo */); + if (event.relatedTarget) + this._highlightTreeElement(/** @type {!UI.TreeElement} */ (listItem.treeElement), true /* showInfo */); } /**