Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
| index a15b39a0ccea3dff0f1e678ed7805db4dbfe87d2..56485f980a9d430fe33c5c2cc1f301aa34633eda 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
| @@ -41,7 +41,7 @@ WebInspector.Dialog = function() |
| this.contentElement.createChild("content"); |
| this.contentElement.tabIndex = 0; |
| this.contentElement.addEventListener("focus", this._onFocus.bind(this), false); |
| - this.contentElement.addEventListener("keydown", this._onKeyDown.bind(this), false); |
| + this._keyDownBound = this._onKeyDown.bind(this); |
| this._wrapsContent = false; |
| this._dimmed = false; |
| @@ -50,7 +50,6 @@ WebInspector.Dialog = function() |
| } |
| /** |
| - * TODO(dgozman): remove this method (it's only used for shortcuts handling). |
| * @return {boolean} |
| */ |
| WebInspector.Dialog.hasInstance = function() |
| @@ -58,6 +57,12 @@ WebInspector.Dialog.hasInstance = function() |
| return !!WebInspector.Dialog._instance; |
| } |
| +WebInspector.Dialog.focus = function() |
|
dgozman
2016/06/30 17:06:55
Unused.
luoe
2016/06/30 17:48:05
Done.
|
| +{ |
| + if (WebInspector.Dialog._instance) |
| + WebInspector.Dialog._instance.focus(); |
| +} |
| + |
| WebInspector.Dialog.prototype = { |
| /** |
| * @override |
| @@ -73,6 +78,7 @@ WebInspector.Dialog.prototype = { |
| this._glassPane = new WebInspector.GlassPane(document, this._dimmed); |
| this._glassPane.element.addEventListener("click", this._onGlassPaneClick.bind(this), false); |
| + this.element.ownerDocument.body.addEventListener("keydown", this._keyDownBound, false); |
| // When a dialog closes, focus should be restored to the previous focused element when |
| // possible, otherwise the default inspector view element. |
| @@ -89,6 +95,7 @@ WebInspector.Dialog.prototype = { |
| */ |
| detach: function() |
| { |
| + this.element.ownerDocument.body.removeEventListener("keydown", this._keyDownBound, false); |
| WebInspector.Widget.prototype.detach.call(this); |
| this._glassPane.dispose(); |