Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Unified Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js

Issue 2672083004: [DevTools] Search in Elements tab is not working for newly added elements (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js
index fab103e3cd75237967b1aadd9579034955290831..d1df3ed80347291c8548cb0e2a71d3b58f22e69d 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js
@@ -464,8 +464,7 @@ Elements.ElementsPanel = class extends UI.Panel {
*/
performSearch(searchConfig, shouldJump, jumpBackwards) {
var query = searchConfig.query;
- // Call searchCanceled since it will reset everything we need before doing a new search.
- this.searchCanceled();
+ this._hideSearchHighlights();
const whitespaceTrimmedQuery = query.trim();
if (!whitespaceTrimmedQuery.length)
@@ -498,10 +497,18 @@ Elements.ElementsPanel = class extends UI.Panel {
this._searchableView.updateSearchMatchesCount(this._searchResults.length);
if (!this._searchResults.length)
return;
- this._currentSearchResultIndex = -1;
+ if (this._currentSearchResultIndex === undefined || this._currentSearchResultIndex > this._searchResults.length)
+ this._currentSearchResultIndex = -1;
+
+ var index = this._currentSearchResultIndex;
- if (shouldJump)
- this._jumpToSearchResult(jumpBackwards ? -1 : 0);
+ if (shouldJump) {
+ if (index === -1)
+ index = jumpBackwards ? -1 : 0;
+ else
+ index = jumpBackwards ? index - 1 : index + 1;
+ this._jumpToSearchResult(index);
+ }
}
}
@@ -553,7 +560,6 @@ Elements.ElementsPanel = class extends UI.Panel {
}
_jumpToSearchResult(index) {
- this._hideSearchHighlights();
Oleksii Kadurin 2017/02/07 23:57:18 Removed this one because from now every request fo
this._currentSearchResultIndex = (index + this._searchResults.length) % this._searchResults.length;
this._highlightCurrentSearchResult();
}

Powered by Google App Engine
This is Rietveld 408576698