From 447a462be3f9d44c89994c8a5eb44b738d4c8dc6 Mon Sep 17 00:00:00 2001 From: Christy Chen Date: Tue, 25 Aug 2020 22:07:25 -0700 Subject: [PATCH] [Elements] Update hideSearchHighlights codepath this._treeElementForNode(searchResult.node) is the combined of the two lines that get removed in this CL. Even though they are basically the same, this CL change it to use the one-line solution for two reasons: 1. To match how the currentSearchHighlights is done (also calls the one-line solution here https://source.chromium.org/chromium/chromium/src/+/master:third_party/devtools-frontend/src/front_end/elements/ElementsPanel.js;drc=d1a00aacb9ad57775cee6cff5e0dac11b7e1ca59;l=650?originalUrl=https:%2F%2Fcs.chromium.org%2F), so the highlight/un-highlight codepath could be more consistent 2. So we dont need extra steps here to guard against the unhandled exception when treeOutline is null in the two-line solution Bug: 1121459 Change-Id: I680a2e0fbcf141fbea85c7030752b6ce0dd4a30c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2374285 Reviewed-by: Patrick Brosset Reviewed-by: Michael Liao Commit-Queue: Christy Chen --- front_end/elements/ElementsPanel.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/front_end/elements/ElementsPanel.js b/front_end/elements/ElementsPanel.js index f0b8a53625..8ab2cadd9f 100644 --- a/front_end/elements/ElementsPanel.js +++ b/front_end/elements/ElementsPanel.js @@ -670,8 +670,7 @@ export class ElementsPanel extends UI.Panel.Panel { if (!searchResult.node) { return; } - const treeOutline = ElementsTreeOutline.forDOMModel(searchResult.node.domModel()); - const treeElement = treeOutline.findTreeElement(searchResult.node); + const treeElement = this._treeElementForNode(searchResult.node); if (treeElement) { treeElement.hideSearchHighlights(); }