зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug 279270: when copying images, put only the image data on the clipboard so that applications that prefer text over image data don't just get the image location.
This commit is contained in:
Родитель
68c673e895
Коммит
5153cd8596
|
@ -85,6 +85,9 @@
|
|||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsIClipboardCommands.h"
|
||||
#include "nsICommandManager.h"
|
||||
#include "nsICommandParams.h"
|
||||
#include "nsIContentViewerEdit.h"
|
||||
#include "nsIWebBrowser.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
@ -2907,9 +2910,19 @@ enum BWCOpenDest {
|
|||
- (IBAction)copyImage:(id)sender
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowser> webBrowser = getter_AddRefs([[[self getBrowserWrapper] getBrowserView] getWebBrowser]);
|
||||
nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(webBrowser));
|
||||
if (clipboard)
|
||||
clipboard->CopyImageContents();
|
||||
|
||||
// nsIClipboardCommands::CopyImageContents() copies both the location and the image
|
||||
// by default, which we don't want. Thus se need to go directly to the command manger
|
||||
// to send the command with params to just copy the image.
|
||||
nsCOMPtr<nsICommandManager> commandMgr(do_GetInterface(webBrowser));
|
||||
if (!commandMgr)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsICommandParams> params = do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID);
|
||||
if (params)
|
||||
params->SetLongValue("imageCopy", nsIContentViewerEdit::COPY_IMAGE_DATA);
|
||||
|
||||
(void)commandMgr->DoCommand("cmd_copyImageContents", params, nsnull);
|
||||
}
|
||||
|
||||
- (IBAction)copyImageLocation:(id)sender
|
||||
|
|
Загрузка…
Ссылка в новой задаче