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

Unified Diff: Source/devtools/front_end/ui/ShortcutRegistry.js

Issue 655273002: DevTools: zoom is broken in hosted mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments addressed. Created 6 years, 2 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
« no previous file with comments | « Source/devtools/front_end/ui/ActionRegistry.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/ShortcutRegistry.js
diff --git a/Source/devtools/front_end/ui/ShortcutRegistry.js b/Source/devtools/front_end/ui/ShortcutRegistry.js
index b603e89e80f41becd2f8ccfa18699dea2b1ab550..0c2be000ce11f93c8f083e77bf68407f710dedca 100644
--- a/Source/devtools/front_end/ui/ShortcutRegistry.js
+++ b/Source/devtools/front_end/ui/ShortcutRegistry.js
@@ -92,18 +92,41 @@ WebInspector.ShortcutRegistry.prototype = {
var keyModifiers = key >> 8;
var actionIds = this.applicableActions(key);
if (WebInspector.GlassPane.DefaultFocusedViewStack.length > 1) {
- if (actionIds.length && !isPossiblyInputKey())
+ if (event && actionIds.length && !isPossiblyInputKey())
event.consume(true);
return;
}
- for (var i = 0; i < actionIds.length; ++i) {
- if (!isPossiblyInputKey()) {
- if (handler.call(this, actionIds[i]))
- break;
- } else {
- this._pendingActionTimer = setTimeout(handler.bind(this, actionIds[i]), 0);
- break;
+ if (!isPossiblyInputKey())
+ processActionIdsSequentially.call(this);
+ else
+ this._pendingActionTimer = setTimeout(processActionIdsSequentially.bind(this), 0);
+
+ /**
+ * @this {WebInspector.ShortcutRegistry}
+ */
+ function processActionIdsSequentially()
+ {
+ delete this._pendingActionTimer;
+ var actionId = actionIds.shift();
+ if (!actionId)
+ return;
+
+ this._actionRegistry.execute(actionId).then(continueIfNecessary.bind(this));
+
+ /**
+ * @this {WebInspector.ShortcutRegistry}
+ */
+ function continueIfNecessary(result)
+ {
+ // Note that this is a best effort solution - lazily loaded modules won't have a chance to
+ // consume platform event.
+ if (result) {
+ if (event)
+ event.consume(true);
+ return;
+ }
+ processActionIdsSequentially.call(this);
}
}
@@ -133,20 +156,6 @@ WebInspector.ShortcutRegistry.prototype = {
{
return !!(keyModifiers & mod);
}
-
- /**
- * @param {string} actionId
- * @return {boolean}
- * @this {WebInspector.ShortcutRegistry}
- */
- function handler(actionId)
- {
- var result = this._actionRegistry.execute(actionId);
- if (result && event)
- event.consume(true);
- delete this._pendingActionTimer;
- return result;
- }
},
/**
« no previous file with comments | « Source/devtools/front_end/ui/ActionRegistry.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698