mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-26 23:35:08 +00:00
9c1bff8485
- Bug 1420865 - Don't check for CONTENT_MAY_CHANGE_TRANSFORM across layer trees. r=mstange, a=RyanVM - Bug 1466991 - Part 1: Factor out ShouldUseXBLScope. r=smaug, a=RyanVM - Bug 1376756 - gtk: while drawing nsTreeBodyFrame, fetch current row attributes for proper style rendering. r=karlt a=jorgk DONTBUILD - Bug 1465458 - Fix launching downloads without a file extension on Windows. r=mak, a=RyanVM - Bug 1470260 - Part 1: Ensure that 'this' stays alive for the duration of the TickRefreshDriver call. r=emilio, a=RyanVM - Bug 1470260 - Part 2: Make RefreshDriverTimer ref-counted and hold a strong ref on it on the stack when nsRefreshDriver::Tick can be reached. r=emilio, a=RyanVM - Bug 1469914 - Prevent the HAL from registering duplicate observers. r=froydnj, a=RyanVM - Bug 1472925 - Keep a strong reference to MediaStreamGraph from GraphDriver. r=padenot, a=RyanVM - Bug 468497: Inform the accessibility FocusManager when a XUL tree's view changes. r=MarcoZ a=jorgk DONTBUILD - Bug 1362303: Avoid crashes when dragging on macOS due to failed allocations of large shmem segments. r=glandium - Bug 1473161 - Add missing bound check in nsContentUtils::DataTransferItemToImage. r=nika, a=RyanVM - Bug 1456294 - Hook ImmAssociateContextEx. r=masayuki, a=RyanVM - Bug 1435319. r=valentin, a=RyanVM - Bug 1478679 - Fix memory leak in LCovCompartment. r=nbp, a=RyanVM - Bug 1468053 - Disable a workaround on macOS 10.14+ for an Apple bug described in bug 378645 involving popup windows that was fixed by Apple. r=mstange, a=RyanVM - Bug 1403945 - Add utility functions to recognize OS X 10.13. r=mstange, a=sledru - Bug 1468053 - Add nsCocoaFeatures::OnMojaveOrLater(). r=haik, a=RyanVM - Bug 1467889 - Adjust some uses of XPCOM strings. r=mrbkap, r=mstange, a=RyanVM - Bug 1474883 - Ensure D2D glyph cache is pruned after rendering 1000 transformed glyphs. r=bas, a=RyanVM - Bug 1450989 - Capture the action and target as part of the form submission creation. r=bz, a=RyanVM - Bug 1473113 - Defer initializing the MAR index until it's needed. r=rstrong, a=RyanVM - Bug 1467363 - Protect access to mTransparentSurface with a lock. r=rhunt, a=RyanVM - Bug 1404274 - Key Evaluation on the cloned JS objects. r=asuth, a=RyanVM - Bug 1480640 - Fix hazard in CopyingStructuredCloneReadCallback. r=baku, a=RyanVM - Bug 1480092 - Cherrypick rev 52add5896661d186dec284ed646a4b33b607d2c7. r=drno a=RyanVM - Bug 1466577 - Race condition in WebSocketChannel::StopSession. r=hurley a=dveditz - Bug 1461307 - Overwrite selection colors of widget which may be referred by IME via IM context with selection colors of GtkTextView. r=karlt, a=RyanVM - Bug 1480521 - Backport fixes from Bug 1479900. r=sfink, a=RyanVM - Bug 1469348 - Fix the problem of download file failed on Mac. r=paolo, a=RyanVM - Bug 1478575 - Unify CamerasChild shutdown paths. r=gcp, a=RyanVM - Bug 1461706 - Sync disabled state of number control regardless of appearance. r=jwatt, a=RyanVM - Bug 1485224 - Make best efforts to write a stack frame atomically. r=froydnj - Bug 1435212 - Add support for FFmpeg 4.0. r=bryce, a=jcristau - Bug 1512882 - Use Windows 7 search icon on Windows 8.x. r=IanN a=IanN - Bug 1496588: Avoid a UB in mozStorageService.cpp. r=froydnj - Bug 1500759 - Root parameter dictionaries in AesTask::Init(). r=keeler, a=lizzard
170 lines
5.4 KiB
C++
170 lines
5.4 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/dom/ContentChild.h"
|
|
#include "mozilla/Unused.h"
|
|
#include "nsArrayUtils.h"
|
|
#include "nsClipboardProxy.h"
|
|
#include "nsISupportsPrimitives.h"
|
|
#include "nsCOMPtr.h"
|
|
#include "nsComponentManagerUtils.h"
|
|
#include "nsXULAppAPI.h"
|
|
#include "nsContentUtils.h"
|
|
#include "nsStringStream.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
NS_IMPL_ISUPPORTS(nsClipboardProxy, nsIClipboard, nsIClipboardProxy)
|
|
|
|
nsClipboardProxy::nsClipboardProxy()
|
|
: mClipboardCaps(false, false)
|
|
{
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsClipboardProxy::SetData(nsITransferable *aTransferable,
|
|
nsIClipboardOwner *anOwner, int32_t aWhichClipboard)
|
|
{
|
|
ContentChild* child = ContentChild::GetSingleton();
|
|
|
|
IPCDataTransfer ipcDataTransfer;
|
|
nsContentUtils::TransferableToIPCTransferable(aTransferable, &ipcDataTransfer,
|
|
false, child, nullptr);
|
|
|
|
bool isPrivateData = false;
|
|
aTransferable->GetIsPrivateData(&isPrivateData);
|
|
nsCOMPtr<nsIPrincipal> requestingPrincipal;
|
|
aTransferable->GetRequestingPrincipal(getter_AddRefs(requestingPrincipal));
|
|
child->SendSetClipboard(ipcDataTransfer, isPrivateData,
|
|
IPC::Principal(requestingPrincipal), aWhichClipboard);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsClipboardProxy::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
|
|
{
|
|
nsTArray<nsCString> types;
|
|
|
|
nsCOMPtr<nsIArray> flavorList;
|
|
aTransferable->FlavorsTransferableCanImport(getter_AddRefs(flavorList));
|
|
if (flavorList) {
|
|
uint32_t flavorCount = 0;
|
|
flavorList->GetLength(&flavorCount);
|
|
for (uint32_t j = 0; j < flavorCount; ++j) {
|
|
nsCOMPtr<nsISupportsCString> flavor = do_QueryElementAt(flavorList, j);
|
|
if (flavor) {
|
|
nsAutoCString flavorStr;
|
|
flavor->GetData(flavorStr);
|
|
if (flavorStr.Length()) {
|
|
types.AppendElement(flavorStr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
nsresult rv;
|
|
IPCDataTransfer dataTransfer;
|
|
ContentChild::GetSingleton()->SendGetClipboard(types, aWhichClipboard, &dataTransfer);
|
|
|
|
auto& items = dataTransfer.items();
|
|
for (uint32_t j = 0; j < items.Length(); ++j) {
|
|
const IPCDataTransferItem& item = items[j];
|
|
|
|
if (item.data().type() == IPCDataTransferData::TnsString) {
|
|
nsCOMPtr<nsISupportsString> dataWrapper =
|
|
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
nsString data = item.data().get_nsString();
|
|
rv = dataWrapper->SetData(data);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper,
|
|
data.Length() * sizeof(char16_t));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
} else if (item.data().type() == IPCDataTransferData::TShmem) {
|
|
// If this is an image, convert it into an nsIInputStream.
|
|
nsCString flavor = item.flavor();
|
|
mozilla::ipc::Shmem data = item.data().get_Shmem();
|
|
if (flavor.EqualsLiteral(kJPEGImageMime) ||
|
|
flavor.EqualsLiteral(kJPGImageMime) ||
|
|
flavor.EqualsLiteral(kPNGImageMime) ||
|
|
flavor.EqualsLiteral(kGIFImageMime)) {
|
|
nsCOMPtr<nsIInputStream> stream;
|
|
|
|
NS_NewCStringInputStream(getter_AddRefs(stream),
|
|
nsDependentCSubstring(data.get<char>(), data.Size<char>()));
|
|
|
|
rv = aTransferable->SetTransferData(flavor.get(), stream, sizeof(nsISupports*));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
} else if (flavor.EqualsLiteral(kNativeHTMLMime) ||
|
|
flavor.EqualsLiteral(kRTFMime) ||
|
|
flavor.EqualsLiteral(kCustomTypesMime)) {
|
|
nsCOMPtr<nsISupportsCString> dataWrapper =
|
|
do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = dataWrapper->SetData(nsDependentCSubstring(data.get<char>(), data.Size<char>()));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = aTransferable->SetTransferData(item.flavor().get(), dataWrapper,
|
|
data.Size<char>());
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
}
|
|
|
|
mozilla::Unused << ContentChild::GetSingleton()->DeallocShmem(data);
|
|
}
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsClipboardProxy::EmptyClipboard(int32_t aWhichClipboard)
|
|
{
|
|
ContentChild::GetSingleton()->SendEmptyClipboard(aWhichClipboard);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsClipboardProxy::HasDataMatchingFlavors(const char **aFlavorList,
|
|
uint32_t aLength, int32_t aWhichClipboard,
|
|
bool *aHasType)
|
|
{
|
|
*aHasType = false;
|
|
|
|
nsTArray<nsCString> types;
|
|
nsCString* t = types.AppendElements(aLength);
|
|
for (uint32_t j = 0; j < aLength; ++j) {
|
|
t[j].Rebind(aFlavorList[j], nsCharTraits<char>::length(aFlavorList[j]));
|
|
}
|
|
|
|
ContentChild::GetSingleton()->SendClipboardHasType(types, aWhichClipboard, aHasType);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsClipboardProxy::SupportsSelectionClipboard(bool *aIsSupported)
|
|
{
|
|
*aIsSupported = mClipboardCaps.supportsSelectionClipboard();
|
|
return NS_OK;
|
|
}
|
|
|
|
|
|
NS_IMETHODIMP
|
|
nsClipboardProxy::SupportsFindClipboard(bool *aIsSupported)
|
|
{
|
|
*aIsSupported = mClipboardCaps.supportsFindClipboard();
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
nsClipboardProxy::SetCapabilities(const ClipboardCapabilities& aClipboardCaps)
|
|
{
|
|
mClipboardCaps = aClipboardCaps;
|
|
}
|