Commit 569dd7ce authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

DevTools: zoom is broken in hosted mode

BUG=423737

Review URL: https://codereview.chromium.org/655273002

git-svn-id: svn://svn.chromium.org/blink/trunk@183808 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9dad71ab
......@@ -708,7 +708,7 @@ WebInspector.SourcesPanel.prototype = {
/**
* @param {string} buttonId
* @param {string} buttonTitle
* @param {function(!Event=):boolean} handler
* @param {function(!Event=)} handler
* @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts
* @return {!WebInspector.StatusBarButton}
*/
......@@ -730,12 +730,9 @@ WebInspector.SourcesPanel.prototype = {
*/
_createButtonAndRegisterShortcutsForAction: function(buttonId, buttonTitle, actionId)
{
/**
* @return {boolean}
*/
function handler()
{
return WebInspector.actionRegistry.execute(actionId);
WebInspector.actionRegistry.execute(actionId);
}
var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsForAction(actionId);
return this._createButtonAndRegisterShortcuts(buttonId, buttonTitle, handler, shortcuts);
......
......@@ -50,21 +50,21 @@ WebInspector.ActionRegistry.prototype = {
/**
* @param {string} actionId
* @return {boolean}
* @return {!Promise.<boolean>}
*/
execute: function(actionId)
{
var extension = this._actionsById.get(actionId);
console.assert(extension, "No action found for actionId '" + actionId + "'");
extension.instancePromise().then(handleAction).done();
return !!extension;
return extension.instancePromise().then(handleAction);
/**
* @param {!Object} actionDelegate
* @return {boolean}
*/
function handleAction(actionDelegate)
{
/** @type {!WebInspector.ActionDelegate} */(actionDelegate).handleAction(WebInspector.context);
return /** @type {!WebInspector.ActionDelegate} */(actionDelegate).handleAction(WebInspector.context);
}
}
}
......@@ -79,7 +79,8 @@ WebInspector.ActionDelegate = function()
WebInspector.ActionDelegate.prototype = {
/**
* @param {!WebInspector.Context} context
* @return {boolean}
* @return {boolean} True if handled. Note that lazily loaded modules won't be able to consume
* platform events from their actions.
*/
handleAction: function(context) {}
}
......
......@@ -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;
}
},
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment