mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1147329 - Handle in-process case for Cut/Copy/Paste feature. r=kanru
This commit is contained in:
parent
7fbc2735a5
commit
08678fac2e
@ -41,7 +41,15 @@ if (!('BrowserElementIsPreloaded' in this)) {
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
|
||||
// general content apps
|
||||
if (isTopBrowserElement(docShell)) {
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
|
||||
}
|
||||
} else {
|
||||
// rocketbar in system app and other in-process case (ex. B2G desktop client)
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
dump("###################################### BrowserElementCopyPaste.js loaded\n");
|
||||
|
||||
let { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
|
||||
let CopyPasteAssistent = {
|
||||
COMMAND_MAP: {
|
||||
'cut': 'cmd_cut',
|
||||
@ -19,7 +21,7 @@ let CopyPasteAssistent = {
|
||||
init: function() {
|
||||
addEventListener('mozcaretstatechanged',
|
||||
this._caretStateChangedHandler.bind(this),
|
||||
/* useCapture = */ true,
|
||||
/* useCapture = */ false,
|
||||
/* wantsUntrusted = */ false);
|
||||
addMessageListener('browser-element-api:call', this._browserAPIHandler.bind(this));
|
||||
},
|
||||
@ -81,6 +83,13 @@ let CopyPasteAssistent = {
|
||||
detail.rect.left += currentRect.left;
|
||||
detail.rect.right += currentRect.left;
|
||||
currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView;
|
||||
|
||||
let targetDocShell = currentWindow
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation);
|
||||
if(targetDocShell.isBrowserOrApp) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sendAsyncMsg('caretstatechanged', detail);
|
||||
|
Loading…
Reference in New Issue
Block a user