Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js |
| index 30316e2572210c8b439622bb56c7c1da5537444e..a73ad6edf0814027bd08c69f75961719024c40bd 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js |
| @@ -721,9 +721,10 @@ WebInspector.ExecutionContext.prototype = { |
| * @param {?WebInspector.RemoteObject} originalHandler |
| * @param {!WebInspector.DebuggerModel.Location} location |
| * @param {?WebInspector.RemoteObject} removeFunction |
| + * @param {?WebInspector.RemoteObject} togglePassiveFunction |
| * @param {string=} listenerType |
| */ |
| -WebInspector.EventListener = function(target, type, useCapture, passive, handler, originalHandler, location, removeFunction, listenerType) |
| +WebInspector.EventListener = function(target, type, useCapture, passive, handler, originalHandler, location, removeFunction, togglePassiveFunction, listenerType) |
| { |
| WebInspector.SDKObject.call(this, target); |
| this._type = type; |
| @@ -735,6 +736,7 @@ WebInspector.EventListener = function(target, type, useCapture, passive, handler |
| var script = location.script(); |
| this._sourceURL = script ? script.contentURL() : ""; |
| this._removeFunction = removeFunction; |
| + this._togglePassiveFunction = togglePassiveFunction; |
| this._listenerType = listenerType || "normal"; |
| } |
| @@ -841,6 +843,51 @@ WebInspector.EventListener.prototype = { |
| }, |
| /** |
| + * @return {?WebInspector.RemoteObject} |
| + */ |
| + togglePassiveFunction: function() |
|
caseq
2016/06/01 17:48:11
I don't think this is something we should expose -
dtapuska
2016/06/01 17:54:37
About merging them... I wanted to separate the cho
|
| + { |
| + return this._togglePassiveFunction; |
| + }, |
| + |
| + /** |
| + * @return {!Promise<undefined>} |
| + */ |
| + togglePassive: function() |
| + { |
| + if (!this._togglePassiveFunction) |
| + return Promise.resolve(); |
| + return new Promise(promiseConstructor.bind(this)); |
| + |
| + /** |
| + * @param {function()} success |
| + * @this {WebInspector.EventListener} |
| + */ |
| + function promiseConstructor(success) |
| + { |
| + this._togglePassiveFunction.callFunction(callCustomRemove, [ |
| + WebInspector.RemoteObject.toCallArgument(this._togglePassiveFunction), |
| + WebInspector.RemoteObject.toCallArgument(this._type), |
| + WebInspector.RemoteObject.toCallArgument(this._originalHandler), |
| + WebInspector.RemoteObject.toCallArgument(this._useCapture), |
| + WebInspector.RemoteObject.toCallArgument(this._passive), |
| + ], success); |
| + |
| + /** |
| + * @param {function(string, function(), boolean, boolean)} func |
| + * @param {string} type |
| + * @param {function()} listener |
| + * @param {boolean} useCapture |
| + * @param {boolean} passive |
| + */ |
| + function callCustomRemove(func, type, listener, useCapture, passive) |
|
caseq
2016/06/01 17:48:11
copy-paste hurts :-) Perhaps, extract something li
dtapuska
2016/06/02 16:02:11
Done.
|
| + { |
| + func.call(null, type, listener, useCapture, passive); |
| + } |
| + } |
| + }, |
| + |
| + /** |
| * @return {string} |
| */ |
| listenerType: function() |
| @@ -856,5 +903,16 @@ WebInspector.EventListener.prototype = { |
| this._listenerType = listenerType; |
| }, |
| + /** |
| + * @return {boolean} |
| + */ |
| + isScrollBlockingType: function() |
| + { |
| + return this._type == "touchstart" || |
|
caseq
2016/06/01 17:48:11
s/==/===/g
dtapuska
2016/06/02 16:02:11
Done.
|
| + this._type == "touchmove" || |
| + this._type == "mousewheel" || |
| + this._type == "wheel"; |
| + }, |
| + |
| __proto__: WebInspector.SDKObject.prototype |
| } |