mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1234118 - Delete code for supporting 'do-command' and 'copypaste-docommand'. r=mtseng, r=smaug
These two events are the leftovers for support copy/paste/cut/selectall operations from old text_selection_dialog.js in Gaia. The code for handling them can be removed since text_selection_dialog.js was removed in bug 1221462.
This commit is contained in:
parent
3ea4315c52
commit
ad85502078
@ -68,15 +68,6 @@ const OBSERVED_EVENTS = [
|
|||||||
'invalid-widget'
|
'invalid-widget'
|
||||||
];
|
];
|
||||||
|
|
||||||
const COMMAND_MAP = {
|
|
||||||
'cut': 'cmd_cut',
|
|
||||||
'copy': 'cmd_copyAndCollapseToEnd',
|
|
||||||
'copyImage': 'cmd_copyImage',
|
|
||||||
'copyLink': 'cmd_copyLink',
|
|
||||||
'paste': 'cmd_paste',
|
|
||||||
'selectall': 'cmd_selectAll'
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The BrowserElementChild implements one half of <iframe mozbrowser>.
|
* The BrowserElementChild implements one half of <iframe mozbrowser>.
|
||||||
* (The other half is, unsurprisingly, BrowserElementParent.)
|
* (The other half is, unsurprisingly, BrowserElementParent.)
|
||||||
@ -278,7 +269,6 @@ BrowserElementChild.prototype = {
|
|||||||
"activate-next-paint-listener": this._activateNextPaintListener.bind(this),
|
"activate-next-paint-listener": this._activateNextPaintListener.bind(this),
|
||||||
"set-input-method-active": this._recvSetInputMethodActive.bind(this),
|
"set-input-method-active": this._recvSetInputMethodActive.bind(this),
|
||||||
"deactivate-next-paint-listener": this._deactivateNextPaintListener.bind(this),
|
"deactivate-next-paint-listener": this._deactivateNextPaintListener.bind(this),
|
||||||
"do-command": this._recvDoCommand,
|
|
||||||
"find-all": this._recvFindAll.bind(this),
|
"find-all": this._recvFindAll.bind(this),
|
||||||
"find-next": this._recvFindNext.bind(this),
|
"find-next": this._recvFindNext.bind(this),
|
||||||
"clear-match": this._recvClearMatch.bind(this),
|
"clear-match": this._recvClearMatch.bind(this),
|
||||||
@ -407,15 +397,6 @@ BrowserElementChild.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_isCommandEnabled: function(cmd) {
|
|
||||||
let command = COMMAND_MAP[cmd];
|
|
||||||
if (!command) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return docShell.isCommandEnabled(command);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spin in a nested event loop until we receive a unblock-modal-prompt message for
|
* Spin in a nested event loop until we receive a unblock-modal-prompt message for
|
||||||
* this window.
|
* this window.
|
||||||
@ -1196,14 +1177,16 @@ BrowserElementChild.prototype = {
|
|||||||
_recvFireCtxCallback: function(data) {
|
_recvFireCtxCallback: function(data) {
|
||||||
debug("Received fireCtxCallback message: (" + data.json.menuitem + ")");
|
debug("Received fireCtxCallback message: (" + data.json.menuitem + ")");
|
||||||
|
|
||||||
|
let doCommandIfEnabled = (command) => {
|
||||||
|
if (docShell.isCommandEnabled(command)) {
|
||||||
|
docShell.doCommand(command);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (data.json.menuitem == 'copy-image') {
|
if (data.json.menuitem == 'copy-image') {
|
||||||
// Set command
|
doCommandIfEnabled('cmd_copyImage');
|
||||||
data.json.command = 'copyImage';
|
|
||||||
this._recvDoCommand(data);
|
|
||||||
} else if (data.json.menuitem == 'copy-link') {
|
} else if (data.json.menuitem == 'copy-link') {
|
||||||
// Set command
|
doCommandIfEnabled('cmd_copyLink');
|
||||||
data.json.command = 'copyLink';
|
|
||||||
this._recvDoCommand(data);
|
|
||||||
} else if (data.json.menuitem in this._ctxHandlers) {
|
} else if (data.json.menuitem in this._ctxHandlers) {
|
||||||
this._ctxHandlers[data.json.menuitem].click();
|
this._ctxHandlers[data.json.menuitem].click();
|
||||||
this._ctxHandlers = {};
|
this._ctxHandlers = {};
|
||||||
@ -1382,12 +1365,6 @@ BrowserElementChild.prototype = {
|
|||||||
docShell.contentViewer.fullZoom = data.json.zoom;
|
docShell.contentViewer.fullZoom = data.json.zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
_recvDoCommand: function(data) {
|
|
||||||
if (this._isCommandEnabled(data.json.command)) {
|
|
||||||
docShell.doCommand(COMMAND_MAP[data.json.command]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_recvGetAudioChannelVolume: function(data) {
|
_recvGetAudioChannelVolume: function(data) {
|
||||||
debug("Received getAudioChannelVolume message: (" + data.json.id + ")");
|
debug("Received getAudioChannelVolume message: (" + data.json.id + ")");
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ var CopyPasteAssistent = {
|
|||||||
switch (e.data.msg_name) {
|
switch (e.data.msg_name) {
|
||||||
case 'copypaste-do-command':
|
case 'copypaste-do-command':
|
||||||
if (this._isCommandEnabled(e.data.command)) {
|
if (this._isCommandEnabled(e.data.command)) {
|
||||||
docShell.doCommand(COMMAND_MAP[e.data.command]);
|
docShell.doCommand(this.COMMAND_MAP[e.data.command]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,6 @@ function BrowserElementParent() {
|
|||||||
this._pendingDOMFullscreen = false;
|
this._pendingDOMFullscreen = false;
|
||||||
|
|
||||||
Services.obs.addObserver(this, 'oop-frameloader-crashed', /* ownsWeak = */ true);
|
Services.obs.addObserver(this, 'oop-frameloader-crashed', /* ownsWeak = */ true);
|
||||||
Services.obs.addObserver(this, 'copypaste-docommand', /* ownsWeak = */ true);
|
|
||||||
Services.obs.addObserver(this, 'ask-children-to-execute-copypaste-command', /* ownsWeak = */ true);
|
Services.obs.addObserver(this, 'ask-children-to-execute-copypaste-command', /* ownsWeak = */ true);
|
||||||
Services.obs.addObserver(this, 'back-docommand', /* ownsWeak = */ true);
|
Services.obs.addObserver(this, 'back-docommand', /* ownsWeak = */ true);
|
||||||
|
|
||||||
@ -1295,11 +1294,6 @@ BrowserElementParent.prototype = {
|
|||||||
this._fireFatalError();
|
this._fireFatalError();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'copypaste-docommand':
|
|
||||||
if (this._isAlive() && this._frameElement.isEqualNode(subject.wrappedJSObject)) {
|
|
||||||
this._sendAsyncMsg('do-command', { command: data });
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'ask-children-to-execute-copypaste-command':
|
case 'ask-children-to-execute-copypaste-command':
|
||||||
if (this._isAlive() && this._frameElement == subject.wrappedJSObject) {
|
if (this._isAlive() && this._frameElement == subject.wrappedJSObject) {
|
||||||
this._sendAsyncMsg('copypaste-do-command', { command: data });
|
this._sendAsyncMsg('copypaste-do-command', { command: data });
|
||||||
|
@ -86,8 +86,14 @@ function runTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doCommand(cmd) {
|
function doCommand(cmd) {
|
||||||
Services.obs.notifyObservers({wrappedJSObject: SpecialPowers.unwrap(iframeInner)},
|
var COMMAND_MAP = {
|
||||||
'copypaste-docommand', cmd);
|
'cut': 'cmd_cut',
|
||||||
|
'copy': 'cmd_copyAndCollapseToEnd',
|
||||||
|
'paste': 'cmd_paste',
|
||||||
|
'selectall': 'cmd_selectAll'
|
||||||
|
};
|
||||||
|
var script = 'data:,docShell.doCommand("' + COMMAND_MAP[cmd] + '");';
|
||||||
|
mm.loadFrameScript(script, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dispatchTest(e) {
|
function dispatchTest(e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user