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

Side by Side Diff: Source/devtools/front_end/Dialog.js

Issue 218613013: DevTools: Decouple shortcuts from actions, introduce shortcut contexts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased patch Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/Context.js ('k') | Source/devtools/front_end/Drawer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 */ 35 */
36 WebInspector.Dialog = function(relativeToElement, delegate) 36 WebInspector.Dialog = function(relativeToElement, delegate)
37 { 37 {
38 this._delegate = delegate; 38 this._delegate = delegate;
39 this._relativeToElement = relativeToElement; 39 this._relativeToElement = relativeToElement;
40 40
41 this._glassPane = new WebInspector.GlassPane(); 41 this._glassPane = new WebInspector.GlassPane();
42 // Install glass pane capturing events. 42 // Install glass pane capturing events.
43 this._glassPane.element.tabIndex = 0; 43 this._glassPane.element.tabIndex = 0;
44 this._glassPane.element.addEventListener("focus", this._onGlassPaneFocus.bin d(this), false); 44 this._glassPane.element.addEventListener("focus", this._onGlassPaneFocus.bin d(this), false);
45 this._glassPane.element.addEventListener("keydown", this._onGlassPaneKeyDown .bind(this), false);
45 46
46 this._element = this._glassPane.element.createChild("div"); 47 this._element = this._glassPane.element.createChild("div");
47 this._element.tabIndex = 0; 48 this._element.tabIndex = 0;
48 this._element.addEventListener("focus", this._onFocus.bind(this), false); 49 this._element.addEventListener("focus", this._onFocus.bind(this), false);
49 this._element.addEventListener("keydown", this._onKeyDown.bind(this), false) ; 50 this._element.addEventListener("keydown", this._onKeyDown.bind(this), false) ;
50 this._closeKeys = [ 51 this._closeKeys = [
51 WebInspector.KeyboardShortcut.Keys.Enter.code, 52 WebInspector.KeyboardShortcut.Keys.Enter.code,
52 WebInspector.KeyboardShortcut.Keys.Esc.code, 53 WebInspector.KeyboardShortcut.Keys.Esc.code,
53 ]; 54 ];
54 55
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 96
96 delete WebInspector.Dialog._instance; 97 delete WebInspector.Dialog._instance;
97 this._glassPane.dispose(); 98 this._glassPane.dispose();
98 }, 99 },
99 100
100 _onGlassPaneFocus: function(event) 101 _onGlassPaneFocus: function(event)
101 { 102 {
102 this._hide(); 103 this._hide();
103 }, 104 },
104 105
106 /**
107 * @param {?Event} event
108 */
109 _onGlassPaneKeyDown: function(event)
110 {
111 var actions = WebInspector.KeyboardShortcut.applicableActions(/** @type {!KeyboardEvent} */ (event));
112 for (var i = 0; i < actions.length; ++i) {
113 if (actions[i].descriptor()["executeInDialog"])
114 return;
115 }
116 if (actions.length)
117 event.consume(true);
118 },
119
105 _onFocus: function(event) 120 _onFocus: function(event)
106 { 121 {
107 this._delegate.focus(); 122 this._delegate.focus();
108 }, 123 },
109 124
110 _position: function() 125 _position: function()
111 { 126 {
112 this._delegate.position(this._element, this._relativeToElement); 127 this._delegate.position(this._element, this._relativeToElement);
113 }, 128 },
114 129
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 { 213 {
199 return WebInspector.Dialog._modalHostView; 214 return WebInspector.Dialog._modalHostView;
200 }; 215 };
201 216
202 WebInspector.Dialog.modalHostRepositioned = function() 217 WebInspector.Dialog.modalHostRepositioned = function()
203 { 218 {
204 if (WebInspector.Dialog._instance) 219 if (WebInspector.Dialog._instance)
205 WebInspector.Dialog._instance._position(); 220 WebInspector.Dialog._instance._position();
206 }; 221 };
207 222
OLDNEW
« no previous file with comments | « Source/devtools/front_end/Context.js ('k') | Source/devtools/front_end/Drawer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698