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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js

Issue 2377193004: [DevTools] Rework some focus code. (Closed)
Patch Set: FocusRestorer Created 4 years, 3 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/ui/SearchableView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js b/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js
index 1d07127968c558d94888cf20f6bbf88f5b29d86d..d68913b3b4b5fbe13f96aa64cd9a1783ad3380de 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js
@@ -94,7 +94,6 @@ WebInspector.SearchableView = function(searchable, settingName)
this._searchNavigationNextElement.addEventListener("click", this._onNextButtonSearch.bind(this), false);
this._searchNavigationNextElement.title = WebInspector.UIString("Search Next");
- this._searchInputElement.addEventListener("mousedown", this._onSearchFieldManualFocus.bind(this), false); // when the search field is manually selected
this._searchInputElement.addEventListener("keydown", this._onSearchKeyDown.bind(this), true);
this._searchInputElement.addEventListener("input", this._onInput.bind(this), false);
@@ -250,7 +249,7 @@ WebInspector.SearchableView.prototype = {
closeSearch: function()
{
this.cancelSearch();
- if (WebInspector.currentFocusElement() && WebInspector.currentFocusElement().isDescendant(this._footerElementContainer))
+ if (this._footerElementContainer.hasFocus())
this.focus();
},
@@ -364,7 +363,7 @@ WebInspector.SearchableView.prototype = {
this.cancelSearch();
var queryCandidate;
- if (WebInspector.currentFocusElement() !== this._searchInputElement) {
+ if (!this._searchInputElement.hasFocus()) {
var selection = this._searchInputElement.getComponentSelection();
if (selection.rangeCount)
queryCandidate = selection.toString().replace(/\r?\n.*/, "");
@@ -392,14 +391,6 @@ WebInspector.SearchableView.prototype = {
/**
* @param {!Event} event
*/
- _onSearchFieldManualFocus: function(event)
- {
- WebInspector.setCurrentFocusElement(/** @type {?Node} */ (event.target));
- },
-
- /**
- * @param {!Event} event
- */
_onSearchKeyDown: function(event)
{
if (isEscKey(event)) {

Powered by Google App Engine
This is Rietveld 408576698