Backed out changesets 33d37539c4ab and 55524bdeb708 (bug 936092) for suspicion of causing e10s test_bug417418.html asserts on Linux.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2015-04-08 13:52:21 -04:00
parent 3fe946af75
commit 1b034b250f
35 changed files with 43 additions and 878 deletions

View File

@ -32,7 +32,6 @@
#include "nsServiceManagerUtils.h"
#include "nsNetUtil.h"
#include "nsIFile.h"
#include "nsFrameLoader.h"
#include "nsIWebNavigation.h"
#include "nsIDocShell.h"
#include "nsIContent.h"
@ -53,7 +52,6 @@
#include "mozilla/dom/DataTransfer.h"
#include "nsIMIMEInfo.h"
#include "nsRange.h"
#include "TabParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLAreaElement.h"
@ -416,21 +414,8 @@ DragDataProducer::Produce(DataTransfer* aDataTransfer,
dsti && dsti->ItemType() == nsIDocShellTreeItem::typeChrome;
// In chrome shells, only allow dragging inside editable areas.
if (isChromeShell && !editingElement) {
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(mTarget);
if (flo) {
nsRefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
if (fl) {
TabParent* tp = static_cast<TabParent*>(fl->GetRemoteBrowser());
if (tp) {
// We have a TabParent, so it may have data for dnd in case the child
// process started a dnd session.
tp->AddInitialDnDDataTo(aDataTransfer);
}
}
}
if (isChromeShell && !editingElement)
return NS_OK;
}
if (isChromeShell && textControl) {
// Only use the selection if the target node is in the selection.

View File

@ -35,14 +35,11 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/DOMTypes.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/HTMLContentElement.h"
#include "mozilla/dom/HTMLShadowElement.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabParent.h"
@ -7200,94 +7197,3 @@ nsContentUtils::CallOnAllRemoteChildren(nsIDOMWindow* aWindow,
}
}
void
nsContentUtils::TransferablesToIPCTransferables(nsISupportsArray* aTransferables,
nsTArray<IPCDataTransfer>& aIPC,
mozilla::dom::nsIContentChild* aChild,
mozilla::dom::nsIContentParent* aParent)
{
aIPC.Clear();
MOZ_ASSERT((aChild && !aParent) || (!aChild && aParent));
if (aTransferables) {
uint32_t transferableCount = 0;
aTransferables->Count(&transferableCount);
for (uint32_t i = 0; i < transferableCount; ++i) {
IPCDataTransfer* dt = aIPC.AppendElement();
nsCOMPtr<nsISupports> genericItem;
aTransferables->GetElementAt(i, getter_AddRefs(genericItem));
nsCOMPtr<nsITransferable> item(do_QueryInterface(genericItem));
if (item) {
nsCOMPtr<nsISupportsArray> flavorList;
item->FlavorsTransferableCanExport(getter_AddRefs(flavorList));
if (flavorList) {
uint32_t flavorCount = 0;
flavorList->Count(&flavorCount);
for (uint32_t j = 0; j < flavorCount; ++j) {
nsCOMPtr<nsISupportsCString> flavor = do_QueryElementAt(flavorList, j);
if (!flavor) {
continue;
}
nsAutoCString flavorStr;
flavor->GetData(flavorStr);
if (!flavorStr.Length()) {
continue;
}
nsCOMPtr<nsISupports> data;
uint32_t dataLen = 0;
item->GetTransferData(flavorStr.get(), getter_AddRefs(data), &dataLen);
nsCOMPtr<nsISupportsString> text = do_QueryInterface(data);
if (text) {
nsAutoString dataAsString;
text->GetData(dataAsString);
IPCDataTransferItem* item = dt->items().AppendElement();
item->flavor() = nsCString(flavorStr);
item->data() = nsString(dataAsString);
} else {
nsCOMPtr<nsISupportsInterfacePointer> sip =
do_QueryInterface(data);
if (sip) {
sip->GetData(getter_AddRefs(data));
}
nsCOMPtr<FileImpl> fileImpl;
nsCOMPtr<nsIFile> file = do_QueryInterface(data);
if (file) {
fileImpl = new FileImplFile(file, false);
ErrorResult rv;
fileImpl->GetSize(rv);
fileImpl->GetLastModified(rv);
} else {
fileImpl = do_QueryInterface(data);
}
if (fileImpl) {
IPCDataTransferItem* item = dt->items().AppendElement();
item->flavor() = nsCString(flavorStr);
if (aChild) {
item->data() =
mozilla::dom::BlobChild::GetOrCreate(aChild,
static_cast<FileImpl*>(fileImpl.get()));
} else if (aParent) {
item->data() =
mozilla::dom::BlobParent::GetOrCreate(aParent,
static_cast<FileImpl*>(fileImpl.get()));
}
} else {
// This is a hack to support kFilePromiseMime.
// On Windows there just needs to be an entry for it,
// and for OSX we need to create
// nsContentAreaDragDropDataProvider as nsIFlavorDataProvider.
if (flavorStr.EqualsLiteral(kFilePromiseMime)) {
IPCDataTransferItem* item = dt->items().AppendElement();
item->flavor() = nsCString(flavorStr);
item->data() = NS_ConvertUTF8toUTF16(flavorStr);
}
}
}
}
}
}
}
}
}

View File

@ -87,7 +87,6 @@ class nsIScriptGlobalObject;
class nsIScriptSecurityManager;
class nsIStringBundle;
class nsIStringBundleService;
class nsISupportsArray;
class nsISupportsHashKey;
class nsIURI;
class nsIWidget;
@ -121,10 +120,7 @@ namespace dom {
class DocumentFragment;
class Element;
class EventTarget;
class IPCDataTransfer;
class NodeInfo;
class nsIContentChild;
class nsIContentParent;
class Selection;
class TabParent;
} // namespace dom
@ -2291,10 +2287,6 @@ public:
CallOnRemoteChildFunction aCallback,
void* aArg);
static void TransferablesToIPCTransferables(nsISupportsArray* aTransferables,
nsTArray<mozilla::dom::IPCDataTransfer>& aIPC,
mozilla::dom::nsIContentChild* aChild,
mozilla::dom::nsIContentParent* aParent);
private:
static bool InitializeEventTable();

View File

@ -24,7 +24,6 @@
#include "nsIScriptContext.h"
#include "nsIDocument.h"
#include "nsIScriptGlobalObject.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DataTransferBinding.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/BindingUtils.h"
@ -83,6 +82,7 @@ DataTransfer::DataTransfer(nsISupports* aParent, uint32_t aEventType,
mDragImageX(0),
mDragImageY(0)
{
MOZ_ASSERT(mParent);
// For these events, we want to be able to add data to the data transfer, so
// clear the readonly state. Otherwise, the data is already present. For
// external usage, cache the data from the native clipboard or drag.
@ -300,16 +300,10 @@ DataTransfer::GetFiles(ErrorResult& aRv)
nsCOMPtr<nsIFile> file = do_QueryInterface(supports);
nsRefPtr<File> domFile;
if (file) {
domFile = File::CreateFromFile(GetParentObject(), file);
} else {
nsCOMPtr<FileImpl> fileImpl = do_QueryInterface(supports);
if (!fileImpl) {
continue;
}
domFile = new File(GetParentObject(), static_cast<FileImpl*>(fileImpl.get()));
}
if (!file)
continue;
nsRefPtr<File> domFile = File::CreateFromFile(GetParentObject(), file);
if (!mFiles->Append(domFile)) {
aRv.Throw(NS_ERROR_FAILURE);
@ -861,6 +855,13 @@ DataTransfer::GetTransferables(nsIDOMNode* aDragTarget)
{
MOZ_ASSERT(aDragTarget);
nsCOMPtr<nsISupportsArray> transArray =
do_CreateInstance("@mozilla.org/supports-array;1");
if (!transArray) {
return nullptr;
}
nsCOMPtr<nsINode> dragNode = do_QueryInterface(aDragTarget);
if (!dragNode) {
return nullptr;
@ -870,23 +871,12 @@ DataTransfer::GetTransferables(nsIDOMNode* aDragTarget)
if (!doc) {
return nullptr;
}
return GetTransferables(doc->GetLoadContext());
}
already_AddRefed<nsISupportsArray>
DataTransfer::GetTransferables(nsILoadContext* aLoadContext)
{
nsCOMPtr<nsISupportsArray> transArray =
do_CreateInstance("@mozilla.org/supports-array;1");
if (!transArray) {
return nullptr;
}
nsILoadContext* loadContext = doc->GetLoadContext();
uint32_t count = mItems.Length();
for (uint32_t i = 0; i < count; i++) {
nsCOMPtr<nsITransferable> transferable = GetTransferable(i, aLoadContext);
nsCOMPtr<nsITransferable> transferable = GetTransferable(i, loadContext);
if (transferable) {
transArray->AppendElement(transferable);
}
@ -1263,20 +1253,5 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
aItem.mData = variant;
}
void
DataTransfer::FillAllExternalData()
{
if (mIsExternal) {
for (uint32_t i = 0; i < mItems.Length(); ++i) {
nsTArray<TransferItem>& itemArray = mItems[i];
for (uint32_t j = 0; j < itemArray.Length(); ++j) {
if (!itemArray[j].mData) {
FillInExternalData(itemArray[j], i);
}
}
}
}
}
} // namespace dom
} // namespace mozilla

View File

@ -185,7 +185,6 @@ public:
// converts the data into an array of nsITransferable objects to be used for
// drag and drop or clipboard operations.
already_AddRefed<nsISupportsArray> GetTransferables(nsIDOMNode* aDragTarget);
already_AddRefed<nsISupportsArray> GetTransferables(nsILoadContext* aLoadContext);
// converts the data for a single item at aIndex into an nsITransferable object.
already_AddRefed<nsITransferable> GetTransferable(uint32_t aIndex,
@ -240,9 +239,6 @@ protected:
// clipboard for a given index.
void FillInExternalData(TransferItem& aItem, uint32_t aIndex);
friend class ContentParent;
void FillAllExternalData();
void MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
mozilla::ErrorResult& aRv);

View File

@ -15,7 +15,6 @@
#include "mozilla/TextComposition.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/UIEvent.h"
@ -82,7 +81,6 @@
#include "nsIController.h"
#include "nsICommandParams.h"
#include "mozilla/Services.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/HTMLLabelElement.h"
#include "mozilla/Preferences.h"
@ -1111,29 +1109,6 @@ EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
*aStatus = nsEventStatus_eConsumeNoDefault;
return remote->SendRealTouchEvent(*aEvent->AsTouchEvent());
}
case eDragEventClass: {
if (remote->Manager()->IsContentParent()) {
remote->Manager()->AsContentParent()->MaybeInvokeDragSession(remote);
}
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
uint32_t dropEffect = nsIDragService::DRAGDROP_ACTION_NONE;
uint32_t action = nsIDragService::DRAGDROP_ACTION_NONE;
if (dragSession) {
dragSession->DragEventDispatchedToChildProcess();
dragSession->GetDragAction(&action);
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
if (initialDataTransfer) {
initialDataTransfer->GetDropEffectInt(&dropEffect);
}
}
bool retval = remote->SendRealDragEvent(*aEvent->AsDragEvent(),
action, dropEffect);
return retval;
}
default: {
MOZ_CRASH("Attempt to send non-whitelisted event?");
}
@ -1190,13 +1165,6 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
default:
return false;
}
case eDragEventClass:
switch (aEvent.message) {
case NS_DRAGDROP_OVER:
case NS_DRAGDROP_EXIT:
case NS_DRAGDROP_DROP:
return true;
}
default:
return false;
}
@ -1528,12 +1496,6 @@ EventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
}
}
void
EventStateManager::BeginTrackingRemoteDragGesture(nsIContent* aContent)
{
mGestureDownContent = aContent;
mGestureDownFrameOwner = aContent;
}
//
// StopTrackingDragGesture
@ -1635,9 +1597,8 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsCOMPtr<nsIContent> eventContent, targetContent;
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(eventContent));
if (eventContent)
DetermineDragTargetAndDefaultData(window, eventContent, dataTransfer,
getter_AddRefs(selection),
getter_AddRefs(targetContent));
DetermineDragTarget(window, eventContent, dataTransfer,
getter_AddRefs(selection), getter_AddRefs(targetContent));
// Stop tracking the drag gesture now. This should stop us from
// reentering GenerateDragGesture inside DOM event processing.
@ -1733,11 +1694,11 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
} // GenerateDragGesture
void
EventStateManager::DetermineDragTargetAndDefaultData(nsPIDOMWindow* aWindow,
nsIContent* aSelectionTarget,
DataTransfer* aDataTransfer,
nsISelection** aSelection,
nsIContent** aTargetNode)
EventStateManager::DetermineDragTarget(nsPIDOMWindow* aWindow,
nsIContent* aSelectionTarget,
DataTransfer* aDataTransfer,
nsISelection** aSelection,
nsIContent** aTargetNode)
{
*aTargetNode = nullptr;
@ -3190,7 +3151,6 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// "none". This way, if the event is just ignored, no drop will be
// allowed.
uint32_t dropEffect = nsIDragService::DRAGDROP_ACTION_NONE;
uint32_t action = nsIDragService::DRAGDROP_ACTION_NONE;
if (nsEventStatus_eConsumeNoDefault == *aStatus) {
// if the event has a dataTransfer set, use it.
if (dragEvent->dataTransfer) {
@ -3208,6 +3168,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// based on the effectAllowed below.
dataTransfer = initialDataTransfer;
uint32_t action;
dragSession->GetDragAction(&action);
// filter the drop effect based on the action. Use UNINITIALIZED as
@ -3229,6 +3190,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// effectAllowed state doesn't include that type of action. If the
// dropEffect is "none", then the action will be 'none' so a drop will
// not be allowed.
uint32_t action = nsIDragService::DRAGDROP_ACTION_NONE;
if (effectAllowed == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED ||
dropEffect & effectAllowed)
action = dropEffect;
@ -3252,12 +3214,6 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// No one called preventDefault(), so handle drop only in chrome.
dragSession->SetOnlyChromeDrop(true);
}
if (ContentChild* child = ContentChild::GetSingleton()) {
child->SendUpdateDropEffect(action, dropEffect);
}
if (dispatchedToContentProcess) {
dragSession->SetCanDrop(true);
}
// now set the drop effect in the initial dataTransfer. This ensures
// that we can get the desired drop effect in the drop event.

View File

@ -755,9 +755,6 @@ protected:
void BeginTrackingDragGesture(nsPresContext* aPresContext,
WidgetMouseEvent* aDownEvent,
nsIFrame* aDownFrame);
friend class mozilla::dom::TabParent;
void BeginTrackingRemoteDragGesture(nsIContent* aContent);
void StopTrackingDragGesture();
void GenerateDragGesture(nsPresContext* aPresContext,
WidgetMouseEvent* aEvent);
@ -772,11 +769,11 @@ protected:
* aSelection - [out] set to the selection to be dragged
* aTargetNode - [out] the draggable node, or null if there isn't one
*/
void DetermineDragTargetAndDefaultData(nsPIDOMWindow* aWindow,
nsIContent* aSelectionTarget,
dom::DataTransfer* aDataTransfer,
nsISelection** aSelection,
nsIContent** aTargetNode);
void DetermineDragTarget(nsPIDOMWindow* aWindow,
nsIContent* aSelectionTarget,
dom::DataTransfer* aDataTransfer,
nsISelection** aSelection,
nsIContent** aTargetNode);
/*
* Perform the default handling for the dragstart/draggesture event and set up a

View File

@ -29,7 +29,6 @@
#include "mozilla/dom/ContentBridgeChild.h"
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/DOMStorageIPC.h"
#include "mozilla/dom/ExternalHelperAppChild.h"
#include "mozilla/dom/PCrashReporterChild.h"
@ -70,7 +69,6 @@
#include "mozInlineSpellChecker.h"
#include "nsIConsoleListener.h"
#include "nsICycleCollectorListener.h"
#include "nsIDragService.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIMemoryReporter.h"
@ -2730,64 +2728,6 @@ NextWindowID()
return (processBits << kWindowIDWindowBits) | windowBits;
}
bool
ContentChild::RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
const uint32_t& aAction)
{
nsCOMPtr<nsIDragService> dragService =
do_GetService("@mozilla.org/widget/dragservice;1");
if (dragService) {
dragService->StartDragSession();
nsCOMPtr<nsIDragSession> session;
dragService->GetCurrentSession(getter_AddRefs(session));
if (session) {
session->SetDragAction(aAction);
nsCOMPtr<DataTransfer> dataTransfer =
new DataTransfer(nullptr, NS_DRAGDROP_START, false, -1);
for (uint32_t i = 0; i < aTransfers.Length(); ++i) {
auto& items = aTransfers[i].items();
for (uint32_t j = 0; j < items.Length(); ++j) {
const IPCDataTransferItem& item = items[j];
nsCOMPtr<nsIWritableVariant> variant =
do_CreateInstance(NS_VARIANT_CONTRACTID);
NS_ENSURE_TRUE(variant, false);
if (item.data().type() == IPCDataTransferData::TnsString) {
const nsString& data = item.data().get_nsString();
variant->SetAsAString(data);
} else if (item.data().type() == IPCDataTransferData::TPBlobChild) {
BlobChild* blob = static_cast<BlobChild*>(item.data().get_PBlobChild());
nsRefPtr<FileImpl> fileImpl = blob->GetBlobImpl();
variant->SetAsISupports(fileImpl);
}
dataTransfer->SetDataWithPrincipal(NS_ConvertUTF8toUTF16(item.flavor()),
variant, i,
nsContentUtils::GetSystemPrincipal());
}
}
session->SetDataTransfer(dataTransfer);
}
}
return true;
}
bool
ContentChild::RecvEndDragSession(const bool& aDoneDrag,
const bool& aUserCancelled)
{
nsCOMPtr<nsIDragService> dragService =
do_GetService("@mozilla.org/widget/dragservice;1");
if (dragService) {
if (aUserCancelled) {
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
if (dragSession) {
dragSession->UserCancelled();
}
}
dragService->EndDragSession(aDoneDrag);
}
return true;
}
} // namespace dom
} // namespace mozilla

View File

@ -396,11 +396,6 @@ public:
const OptionalURIParams& aDomain) override;
virtual bool RecvShutdown() override;
virtual bool
RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
const uint32_t& aAction) override;
virtual bool RecvEndDragSession(const bool& aDoneDrag,
const bool& aUserCancelled) override;
#ifdef ANDROID
gfxIntSize GetScreenSize() { return mScreenSize; }
#endif

View File

@ -38,7 +38,6 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
#include "mozilla/dom/DataStoreService.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/DOMStorageIPC.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/File.h"
@ -104,7 +103,6 @@
#include "nsIDocument.h"
#include "nsIDOMGeoGeolocation.h"
#include "nsIDOMGeoPositionError.h"
#include "nsIDragService.h"
#include "mozilla/dom/WakeLock.h"
#include "nsIDOMWindow.h"
#include "nsIExternalProtocolService.h"
@ -4809,62 +4807,6 @@ ContentParent::RecvSetOfflinePermission(const Principal& aPrincipal)
return true;
}
void
ContentParent::MaybeInvokeDragSession(TabParent* aParent)
{
nsCOMPtr<nsIDragService> dragService =
do_GetService("@mozilla.org/widget/dragservice;1");
if (dragService && dragService->MaybeAddChildProcess(this)) {
// We need to send transferable data to child process.
nsCOMPtr<nsIDragSession> session;
dragService->GetCurrentSession(getter_AddRefs(session));
if (session) {
nsTArray<IPCDataTransfer> dataTransfers;
nsCOMPtr<nsIDOMDataTransfer> domTransfer;
session->GetDataTransfer(getter_AddRefs(domTransfer));
nsCOMPtr<DataTransfer> transfer = do_QueryInterface(domTransfer);
if (!transfer) {
// Pass NS_DRAGDROP_DROP to get DataTransfer with external
// drag formats cached.
transfer = new DataTransfer(nullptr, NS_DRAGDROP_DROP, true, -1);
session->SetDataTransfer(transfer);
}
// Note, even though this fills the DataTransfer object with
// external data, the data is usually transfered over IPC lazily when
// needed.
transfer->FillAllExternalData();
nsCOMPtr<nsILoadContext> lc = aParent ?
aParent->GetLoadContext() : nullptr;
nsCOMPtr<nsISupportsArray> transferables =
transfer->GetTransferables(lc);
nsContentUtils::TransferablesToIPCTransferables(transferables,
dataTransfers,
nullptr,
this);
uint32_t action;
session->GetDragAction(&action);
mozilla::unused << SendInvokeDragSession(dataTransfers, action);
}
}
}
bool
ContentParent::RecvUpdateDropEffect(const uint32_t& aDragAction,
const uint32_t& aDropEffect)
{
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
if (dragSession) {
dragSession->SetDragAction(aDragAction);
nsCOMPtr<nsIDOMDataTransfer> dt;
dragSession->GetDataTransfer(getter_AddRefs(dt));
if (dt) {
dt->SetDropEffectInt(aDropEffect);
}
dragSession->UpdateDragEffect();
}
return true;
}
} // namespace dom
} // namespace mozilla

View File

@ -371,7 +371,6 @@ public:
virtual bool RecvFinishShutdown() override;
void MaybeInvokeDragSession(TabParent* aParent);
protected:
void OnChannelConnected(int32_t pid) override;
virtual void ActorDestroy(ActorDestroyReason why) override;
@ -823,8 +822,6 @@ private:
virtual bool RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
PDocAccessibleParent* aParentDoc, const uint64_t& aParentID) override;
virtual bool RecvUpdateDropEffect(const uint32_t& aDragAction,
const uint32_t& aDropEffect) override;
// If you add strong pointers to cycle collected objects here, be sure to
// release these objects in ShutDownProcess. See the comment there for more
// details.

View File

@ -135,22 +135,5 @@ union BlobConstructorParams
ParentBlobConstructorParams;
};
union IPCDataTransferData
{
nsString;
PBlob;
};
struct IPCDataTransferItem
{
nsCString flavor;
IPCDataTransferData data;
};
struct IPCDataTransfer
{
IPCDataTransferItem[] items;
};
} // namespace dom
} // namespace mozilla

View File

@ -45,7 +45,6 @@ using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetDragEvent from "ipc/nsGUIEventIPC.h";
using struct nsRect from "nsRect.h";
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
@ -514,9 +513,6 @@ parent:
prio(high) sync DispatchMouseEvent(WidgetMouseEvent event);
prio(high) sync DispatchKeyboardEvent(WidgetKeyboardEvent event);
InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
nsCString visualData, uint32_t width, uint32_t height,
uint32_t stride, uint8_t format, int32_t dragAreaX, int32_t dragAreaY);
child:
/**
* Notify the remote browser that it has been Show()n on this
@ -584,7 +580,6 @@ child:
MouseWheelEvent(WidgetWheelEvent event, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
RealTouchEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
RealTouchMoveEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
RealDragEvent(WidgetDragEvent aEvent, uint32_t aDragAction, uint32_t aDropEffect);
/**
* @see nsIDOMWindowUtils sendKeyEvent.

View File

@ -570,9 +570,6 @@ child:
prio(high) sync GetProfile()
returns (nsCString aProfile);
InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action);
EndDragSession(bool aDoneDrag, bool aUserCancelled);
NuwaFreeze();
async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, OptionalURIParams aDomain);
@ -944,7 +941,6 @@ parent:
*/
async FinishShutdown();
UpdateDropEffect(uint32_t aDragAction, uint32_t aDropEffect);
both:
AsyncMessage(nsString aMessage, ClonedMessageData aData,
CpowEntry[] aCpows, Principal aPrincipal);

View File

@ -2409,44 +2409,6 @@ TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
return RecvRealTouchEvent(aEvent, aGuid, aInputBlockId);
}
bool
TabChild::RecvRealDragEvent(const WidgetDragEvent& aEvent,
const uint32_t& aDragAction,
const uint32_t& aDropEffect)
{
WidgetDragEvent localEvent(aEvent);
localEvent.widget = mWidget;
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
if (dragSession) {
dragSession->SetDragAction(aDragAction);
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
if (initialDataTransfer) {
initialDataTransfer->SetDropEffectInt(aDropEffect);
}
}
if (aEvent.message == NS_DRAGDROP_DROP) {
bool canDrop = true;
if (!dragSession || NS_FAILED(dragSession->GetCanDrop(&canDrop)) ||
!canDrop) {
localEvent.message = NS_DRAGDROP_EXIT;
}
} else if (aEvent.message == NS_DRAGDROP_OVER) {
nsCOMPtr<nsIDragService> dragService =
do_GetService("@mozilla.org/widget/dragservice;1");
if (dragService) {
// This will dispatch 'drag' event at the source if the
// drag transaction started in this process.
dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
}
}
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
return true;
}
void
TabChild::RequestNativeKeyBindings(AutoCacheNativeKeyCommands* aAutoCache,
WidgetKeyboardEvent* aEvent)

View File

@ -350,9 +350,6 @@ public:
const bool& aIgnoreRootScrollFrame) override;
virtual bool RecvRealMouseMoveEvent(const mozilla::WidgetMouseEvent& event) override;
virtual bool RecvRealMouseButtonEvent(const mozilla::WidgetMouseEvent& event) override;
virtual bool RecvRealDragEvent(const WidgetDragEvent& aEvent,
const uint32_t& aDragAction,
const uint32_t& aDropEffect) override;
virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event,
const MaybeNativeKeyBinding& aBindings) override;
virtual bool RecvMouseWheelEvent(const mozilla::WidgetWheelEvent& event,

View File

@ -12,13 +12,11 @@
#include "mozIApplication.h"
#include "mozilla/BrowserElementParent.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
#include "mozilla/dom/ServiceWorkerRegistrar.h"
#include "mozilla/dom/indexedDB/ActorsParent.h"
#include "mozilla/plugins/PluginWidgetParent.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/Hal.h"
#include "mozilla/ipc/DocumentRendererParent.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
@ -31,9 +29,7 @@
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/unused.h"
#include "BlobParent.h"
#include "nsCOMPtr.h"
#include "nsContentAreaDragDrop.h"
#include "nsContentPermissionHelper.h"
#include "nsContentUtils.h"
#include "nsDebug.h"
@ -80,7 +76,6 @@
#include "nsNetCID.h"
#include "nsIAuthInformation.h"
#include "nsIAuthPromptCallback.h"
#include "SourceSurfaceRawData.h"
#include "nsAuthInformationHolder.h"
#include "nsICancelable.h"
#include "gfxPrefs.h"
@ -279,8 +274,6 @@ TabParent::TabParent(nsIContentParent* aManager,
, mAppPackageFileDescriptorSent(false)
, mSendOfflineStatus(true)
, mChromeFlags(aChromeFlags)
, mDragAreaX(0)
, mDragAreaY(0)
, mInitedByParent(false)
, mTabId(aTabId)
, mCreatingWindow(false)
@ -1209,17 +1202,6 @@ TabParent::GetLayoutDeviceToCSSScale()
: 0.0f);
}
bool
TabParent::SendRealDragEvent(WidgetDragEvent& event, uint32_t aDragAction,
uint32_t aDropEffect)
{
if (mIsDestroyed) {
return false;
}
event.refPoint += GetChildProcessOffset();
return PBrowserParent::SendRealDragEvent(event, aDragAction, aDropEffect);
}
CSSPoint TabParent::AdjustTapToChildWidget(const CSSPoint& aPoint)
{
return aPoint + (LayoutDevicePoint(mChildProcessOffsetAtTouchStart) * GetLayoutDeviceToCSSScale());
@ -2953,109 +2935,6 @@ TabParent::RecvAsyncAuthPrompt(const nsCString& aUri,
return rv == NS_OK;
}
bool
TabParent::RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
const uint32_t& aAction,
const nsCString& aVisualDnDData,
const uint32_t& aWidth, const uint32_t& aHeight,
const uint32_t& aStride, const uint8_t& aFormat,
const int32_t& aDragAreaX, const int32_t& aDragAreaY)
{
mInitialDataTransferItems.Clear();
nsPresContext* pc = mFrameElement->OwnerDoc()->GetShell()->GetPresContext();
EventStateManager* esm = pc->EventStateManager();
for (uint32_t i = 0; i < aTransfers.Length(); ++i) {
auto& items = aTransfers[i].items();
nsTArray<DataTransferItem>* itemArray = mInitialDataTransferItems.AppendElement();
for (uint32_t j = 0; j < items.Length(); ++j) {
const IPCDataTransferItem& item = items[j];
DataTransferItem* localItem = itemArray->AppendElement();
localItem->mFlavor = item.flavor();
if (item.data().type() == IPCDataTransferData::TnsString) {
localItem->mType = DataTransferItem::DataType::eString;
localItem->mStringData = item.data().get_nsString();
} else {
localItem->mType = DataTransferItem::DataType::eBlob;
BlobParent* blobParent =
static_cast<BlobParent*>(item.data().get_PBlobParent());
if (blobParent) {
localItem->mBlobData = blobParent->GetBlobImpl();
}
}
}
}
if (Manager()->IsContentParent()) {
nsCOMPtr<nsIDragService> dragService =
do_GetService("@mozilla.org/widget/dragservice;1");
if (dragService) {
dragService->MaybeAddChildProcess(Manager()->AsContentParent());
}
}
if (aVisualDnDData.IsEmpty()) {
mDnDVisualization = nullptr;
} else {
mDnDVisualization =
new mozilla::gfx::SourceSurfaceRawData();
mozilla::gfx::SourceSurfaceRawData* raw =
static_cast<mozilla::gfx::SourceSurfaceRawData*>(mDnDVisualization.get());
raw->InitWrappingData(
reinterpret_cast<uint8_t*>(const_cast<nsCString&>(aVisualDnDData).BeginWriting()),
mozilla::gfx::IntSize(aWidth, aHeight), aStride,
static_cast<mozilla::gfx::SurfaceFormat>(aFormat), false);
raw->GuaranteePersistance();
}
mDragAreaX = aDragAreaX;
mDragAreaY = aDragAreaY;
esm->BeginTrackingRemoteDragGesture(mFrameElement);
return true;
}
void
TabParent::AddInitialDnDDataTo(DataTransfer* aDataTransfer)
{
for (uint32_t i = 0; i < mInitialDataTransferItems.Length(); ++i) {
nsTArray<DataTransferItem>& itemArray = mInitialDataTransferItems[i];
for (uint32_t j = 0; j < itemArray.Length(); ++j) {
DataTransferItem& item = itemArray[j];
nsCOMPtr<nsIWritableVariant> variant =
do_CreateInstance(NS_VARIANT_CONTRACTID);
if (!variant) {
break;
}
// Special case kFilePromiseMime so that we get the right
// nsIFlavorDataProvider for it.
if (item.mFlavor.EqualsLiteral(kFilePromiseMime)) {
nsRefPtr<nsISupports> flavorDataProvider =
new nsContentAreaDragDropDataProvider();
variant->SetAsISupports(flavorDataProvider);
} else if (item.mType == DataTransferItem::DataType::eString) {
variant->SetAsAString(item.mStringData);
} else if (item.mType == DataTransferItem::DataType::eBlob) {
variant->SetAsISupports(item.mBlobData);
}
// Using system principal here, since once the data is on parent process
// side, it can be handled as being from browser chrome or OS.
aDataTransfer->SetDataWithPrincipal(NS_ConvertUTF8toUTF16(item.mFlavor),
variant, i,
nsContentUtils::GetSystemPrincipal());
}
}
mInitialDataTransferItems.Clear();
}
void
TabParent::TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
int32_t& aDragAreaX, int32_t& aDragAreaY)
{
aSurface = mDnDVisualization.forget();
aDragAreaX = mDragAreaX;
aDragAreaY = mDragAreaY;
}
NS_IMETHODIMP
FakeChannel::OnAuthAvailable(nsISupports *aContext, nsIAuthInformation *aAuthInfo)
{

View File

@ -13,9 +13,7 @@
#include "mozilla/dom/PFilePickerParent.h"
#include "mozilla/dom/TabContext.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/File.h"
#include "mozilla/WritingModes.h"
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsIAuthPromptProvider.h"
#include "nsIBrowserDOMWindow.h"
@ -54,17 +52,11 @@ namespace widget {
struct IMENotification;
}
namespace gfx {
class SourceSurface;
class DataSourceSurface;
}
namespace dom {
class ClonedMessageData;
class nsIContentParent;
class Element;
class DataTransfer;
struct StructuredCloneData;
class TabParent final : public PBrowserParent
@ -278,8 +270,6 @@ public:
int32_t aCharCode, int32_t aModifiers,
bool aPreventDefault);
bool SendRealMouseEvent(mozilla::WidgetMouseEvent& event);
bool SendRealDragEvent(mozilla::WidgetDragEvent& aEvent, uint32_t aDragAction,
uint32_t aDropEffect);
bool SendMouseWheelEvent(mozilla::WidgetWheelEvent& event);
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& event);
bool SendRealTouchEvent(WidgetTouchEvent& event);
@ -376,18 +366,6 @@ public:
bool RequestNotifyLayerTreeCleared();
bool LayerTreeUpdate(bool aActive);
virtual bool
RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
const uint32_t& aAction,
const nsCString& aVisualDnDData,
const uint32_t& aWidth, const uint32_t& aHeight,
const uint32_t& aStride, const uint8_t& aFormat,
const int32_t& aDragAreaX, const int32_t& aDragAreaY) override;
void AddInitialDnDDataTo(DataTransfer* aDataTransfer);
void TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
int32_t& aDragAreaX, int32_t& aDragAreaY);
protected:
bool ReceiveMessage(const nsString& aMessage,
bool aSync,
@ -493,24 +471,6 @@ private:
uint32_t mChromeFlags;
struct DataTransferItem
{
nsCString mFlavor;
nsString mStringData;
nsRefPtr<mozilla::dom::FileImpl> mBlobData;
enum DataType
{
eString,
eBlob
};
DataType mType;
};
nsTArray<nsTArray<DataTransferItem>> mInitialDataTransferItems;
mozilla::RefPtr<gfx::DataSourceSurface> mDnDVisualization;
int32_t mDragAreaX;
int32_t mDragAreaY;
// When true, the TabParent is initialized without child side's request.
// When false, the TabParent is initialized by window.open() from child side.
bool mInitedByParent;

View File

@ -136,7 +136,6 @@ LOCAL_INCLUDES += [
'/embedding/components/printingui/ipc',
'/extensions/cookie',
'/extensions/spellcheck/src',
'/gfx/2d',
'/hal/sandbox',
'/layout/base',
'/netwerk/base',

View File

@ -910,7 +910,7 @@ nsDocShellTreeOwner::HandleEvent(nsIDOMEvent* aEvent)
nsIWebNavigation* webnav = static_cast<nsIWebNavigation *>(mWebBrowser);
nsAutoString link, name;
if (webnav && NS_SUCCEEDED(handler->DropLink(dragEvent, name, true, link))) {
if (webnav && NS_SUCCEEDED(handler->DropLink(dragEvent, link, false, name))) {
if (!link.IsEmpty()) {
webnav->LoadURI(link.get(), 0, nullptr, nullptr, nullptr);
}

View File

@ -3,7 +3,7 @@ support-files = head.js
[browser_autoscroll_disabled.js]
skip-if = e10s # Bug ?????? - test touches content (getElementById on the content document)
[browser_browserDrop.js]
skip-if = buildapp == 'mulet' || e10s # Relies on drop to be handled in the parent process
skip-if = buildapp == 'mulet'
[browser_bug295977_autoscroll_overflow.js]
skip-if = e10s # Bug 921935 - focusmanager issues with e10s
[browser_bug594509.js]

View File

@ -1260,9 +1260,7 @@
</handler>
<handler event="drop" group="system">
<![CDATA[
// No need to handle "drop" in e10s, since nsDocShellTreeOwner.cpp in the child process
// handles that case using "@mozilla.org/content/dropped-link-handler;1" service.
if (!this.droppedLinkHandler || event.defaultPrevented || this.isRemoteBrowser)
if (!this.droppedLinkHandler || event.defaultPrevented)
return;
let name = { };

View File

@ -306,13 +306,6 @@ public:
class WidgetDragEvent : public WidgetMouseEvent
{
private:
friend class mozilla::dom::PBrowserParent;
friend class mozilla::dom::PBrowserChild;
protected:
WidgetDragEvent()
{
}
public:
virtual WidgetDragEvent* AsDragEvent() override { return this; }

View File

@ -485,10 +485,6 @@ nsDragService::EndDragSession(bool aDoneDrag)
// unset our drag action
SetDragAction(DRAGDROP_ACTION_NONE);
// We're done with the drag context.
mTargetDragContextForRemote = nullptr;
return nsBaseDragService::EndDragSession(aDoneDrag);
}
@ -1041,7 +1037,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
}
void
nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext)
nsDragService::ReplyToDragMotion()
{
PR_LOG(sDragLm, PR_LOG_DEBUG,
("nsDragService::ReplyToDragMotion %d", mCanDrop));
@ -1056,16 +1052,13 @@ nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext)
case DRAGDROP_ACTION_LINK:
action = GDK_ACTION_LINK;
break;
case DRAGDROP_ACTION_NONE:
action = (GdkDragAction)0;
break;
default:
action = GDK_ACTION_MOVE;
break;
}
}
gdk_drag_status(aDragContext, action, mTargetTime);
gdk_drag_status(mTargetDragContext, action, mTargetTime);
}
void
@ -1892,16 +1885,12 @@ nsDragService::RunScheduledTask()
// protocol is used.
if (task == eDragTaskMotion || positionHasChanged) {
UpdateDragAction();
TakeDragEventDispatchedToChildProcess(); // Clear the old value.
DispatchMotionEvents();
if (task == eDragTaskMotion) {
if (TakeDragEventDispatchedToChildProcess()) {
mTargetDragContextForRemote = mTargetDragContext;
} else {
// Reply to tell the source whether we can drop and what
// action would be taken.
ReplyToDragMotion(mTargetDragContext);
}
// Reply to tell the source whether we can drop and what
// action would be taken.
ReplyToDragMotion();
}
}
@ -1976,16 +1965,6 @@ nsDragService::UpdateDragAction()
SetDragAction(action);
}
NS_IMETHODIMP
nsDragService::UpdateDragEffect()
{
if (mTargetDragContextForRemote) {
ReplyToDragMotion(mTargetDragContextForRemote);
mTargetDragContextForRemote = nullptr;
}
return NS_OK;
}
void
nsDragService::DispatchMotionEvents()
{

View File

@ -75,8 +75,6 @@ public:
NS_IMETHOD IsDataFlavorSupported (const char *aDataFlavor,
bool *_retval) override;
NS_IMETHOD UpdateDragEffect() override;
// Methods called from nsWindow to handle responding to GTK drag
// destination signals
@ -163,9 +161,6 @@ private:
// motion or drop events. mTime records the corresponding timestamp.
nsCountedRef<GtkWidget> mTargetWidget;
nsCountedRef<GdkDragContext> mTargetDragContext;
// mTargetDragContextForRemote is set while waiting for a reply from
// a child process.
nsCountedRef<GdkDragContext> mTargetDragContextForRemote;
guint mTargetTime;
// is it OK to drop on us?
@ -213,7 +208,7 @@ private:
gboolean RunScheduledTask();
void UpdateDragAction();
void DispatchMotionEvents();
void ReplyToDragMotion(GdkDragContext* aDragContext);
void ReplyToDragMotion();
gboolean DispatchDropEvent();
};

View File

@ -145,7 +145,6 @@ UNIFIED_SOURCES += [
'nsClipboardProxy.cpp',
'nsColorPickerProxy.cpp',
'nsContentProcessWidgetFactory.cpp',
'nsDragServiceProxy.cpp',
'nsFilePickerProxy.cpp',
'nsHTMLFormatConverter.cpp',
'nsIdleService.cpp',
@ -219,8 +218,6 @@ MSVC_ENABLE_PGO = True
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'/dom/base',
'/dom/ipc',
'/layout/base',
'/layout/forms',
'/layout/generic',

View File

@ -36,9 +36,6 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/unused.h"
#include "nsFrameLoader.h"
#include "TabParent.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
@ -54,7 +51,6 @@ using namespace mozilla::image;
nsBaseDragService::nsBaseDragService()
: mCanDrop(false), mOnlyChromeDrop(false), mDoingDrag(false),
mHasImage(false), mUserCancelled(false),
mDragEventDispatchedToChildProcess(false),
mDragAction(DRAGDROP_ACTION_NONE), mTargetSize(0,0),
mImageX(0), mImageY(0), mScreenX(-1), mScreenY(-1), mSuppressLevel(0),
mInputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
@ -350,14 +346,7 @@ nsBaseDragService::EndDragSession(bool aDoneDrag)
}
}
for (uint32_t i = 0; i < mChildProcesses.Length(); ++i) {
mozilla::unused << mChildProcesses[i]->SendEndDragSession(aDoneDrag,
mUserCancelled);
}
mChildProcesses.Clear();
mDoingDrag = false;
mCanDrop = false;
// release the source we've been holding on to.
mSourceDocument = nullptr;
@ -372,7 +361,6 @@ nsBaseDragService::EndDragSession(bool aDoneDrag)
mImageY = 0;
mScreenX = -1;
mScreenY = -1;
mEndDragPoint = nsIntPoint(0, 0);
mInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
return NS_OK;
@ -468,34 +456,6 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
*aPresContext = presShell->GetPresContext();
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(dragNode);
if (flo) {
nsRefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
if (fl) {
mozilla::dom::TabParent* tp =
static_cast<mozilla::dom::TabParent*>(fl->GetRemoteBrowser());
if (tp) {
int32_t x, y;
tp->TakeDragVisualization(*aSurface, x, y);
if (*aSurface) {
if (mImage) {
// Just clear the surface if chrome has overridden it with an image.
*aSurface = nullptr;
} else {
nsIFrame* f = fl->GetOwnerContent()->GetPrimaryFrame();
if (f) {
aScreenDragRect->x = x;
aScreenDragRect->y = y;
aScreenDragRect->width = (*aSurface)->GetSize().width;
aScreenDragRect->height = (*aSurface)->GetSize().height;
}
return NS_OK;
}
}
}
}
}
// convert mouse position to dev pixels of the prescontext
int32_t sx = aScreenX, sy = aScreenY;
ConvertToUnscaledDevPixels(*aPresContext, &sx, &sy);
@ -709,33 +669,3 @@ nsBaseDragService::Unsuppress()
--mSuppressLevel;
return NS_OK;
}
NS_IMETHODIMP
nsBaseDragService::UserCancelled()
{
mUserCancelled = true;
return NS_OK;
}
NS_IMETHODIMP
nsBaseDragService::UpdateDragEffect()
{
return NS_OK;
}
NS_IMETHODIMP
nsBaseDragService::DragEventDispatchedToChildProcess()
{
mDragEventDispatchedToChildProcess = true;
return NS_OK;
}
bool
nsBaseDragService::MaybeAddChildProcess(mozilla::dom::ContentParent* aChild)
{
if (!mChildProcesses.Contains(aChild)) {
mChildProcesses.AppendElement(aChild);
return true;
}
return false;
}

View File

@ -15,9 +15,7 @@
#include "nsRect.h"
#include "nsPoint.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsTArray.h"
// translucency level for drag images
#define DRAG_TRANSLUCENCY 0.65
@ -114,15 +112,6 @@ protected:
*/
void OpenDragPopup();
// Returns true if a drag event was dispatched to a child process after
// the previous TakeDragEventDispatchedToChildProcess() call.
bool TakeDragEventDispatchedToChildProcess()
{
bool retval = mDragEventDispatchedToChildProcess;
mDragEventDispatchedToChildProcess = false;
return retval;
}
bool mCanDrop;
bool mOnlyChromeDrop;
bool mDoingDrag;
@ -131,8 +120,6 @@ protected:
// true if the user cancelled the drag operation
bool mUserCancelled;
bool mDragEventDispatchedToChildProcess;
uint32_t mDragAction;
nsSize mTargetSize;
nsCOMPtr<nsIDOMNode> mSourceNode;
@ -166,8 +153,6 @@ protected:
// The input source of the drag event. Possible values are from nsIDOMMouseEvent.
uint16_t mInputSource;
nsTArray<nsRefPtr<mozilla::dom::ContentParent>> mChildProcesses;
};
#endif // nsBaseDragService_h__

View File

@ -9,7 +9,6 @@
#include "nsWidgetsCID.h"
#include "nsClipboardProxy.h"
#include "nsColorPickerProxy.h"
#include "nsDragServiceProxy.h"
#include "nsFilePickerProxy.h"
#include "nsScreenManagerProxy.h"
@ -19,13 +18,11 @@ using namespace mozilla;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerProxy)
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
@ -34,8 +31,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
Module::CONTENT_PROCESS_ONLY },
{ &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
{ &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
{ &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
{ &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerProxyConstructor,
@ -48,7 +43,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::CONTENT_PROCESS_ONLY },
{ nullptr }
};

View File

@ -1,87 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 "nsDragServiceProxy.h"
#include "nsIDocument.h"
#include "nsISupportsPrimitives.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/unused.h"
#include "nsContentUtils.h"
NS_IMPL_ISUPPORTS_INHERITED0(nsDragServiceProxy, nsBaseDragService)
nsDragServiceProxy::nsDragServiceProxy()
{
}
nsDragServiceProxy::~nsDragServiceProxy()
{
}
NS_IMETHODIMP
nsDragServiceProxy::InvokeDragSession(nsIDOMNode* aDOMNode,
nsISupportsArray* aArrayTransferables,
nsIScriptableRegion* aRegion,
uint32_t aActionType)
{
nsresult rv = nsBaseDragService::InvokeDragSession(aDOMNode,
aArrayTransferables,
aRegion,
aActionType);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMDocument> sourceDocument;
aDOMNode->GetOwnerDocument(getter_AddRefs(sourceDocument));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(sourceDocument);
NS_ENSURE_STATE(doc->GetDocShell());
mozilla::dom::TabChild* child =
mozilla::dom::TabChild::GetFrom(doc->GetDocShell());
NS_ENSURE_STATE(child);
nsTArray<mozilla::dom::IPCDataTransfer> dataTransfers;
nsContentUtils::TransferablesToIPCTransferables(aArrayTransferables,
dataTransfers,
child->Manager(),
nullptr);
if (mHasImage || mSelection) {
nsIntRect dragRect;
nsPresContext* pc;
mozilla::RefPtr<mozilla::gfx::SourceSurface> surface;
DrawDrag(mSourceNode, aRegion, mScreenX, mScreenY,
&dragRect, &surface, &pc);
if (surface) {
mozilla::RefPtr<mozilla::gfx::DataSourceSurface> dataSurface =
surface->GetDataSurface();
mozilla::gfx::DataSourceSurface::MappedSurface map;
dataSurface->Map(mozilla::gfx::DataSourceSurface::MapType::READ, &map);
mozilla::gfx::IntSize size = dataSurface->GetSize();
mozilla::CheckedInt32 requiredBytes =
mozilla::CheckedInt32(map.mStride) * mozilla::CheckedInt32(size.height);
size_t bufLen = requiredBytes.isValid() ? requiredBytes.value() : 0;
mozilla::gfx::SurfaceFormat format = dataSurface->GetFormat();
// Surface data handling is totally nuts. This is the magic one needs to
// know to access the data.
bufLen = bufLen - map.mStride + (size.width * BytesPerPixel(format));
nsDependentCString dragImage(reinterpret_cast<char*>(map.mData), bufLen);
mozilla::unused <<
child->SendInvokeDragSession(dataTransfers, aActionType, dragImage,
size.width, size.height, map.mStride,
static_cast<uint8_t>(format),
dragRect.x, dragRect.y);
dataSurface->Unmap();
StartDragSession();
return NS_OK;
}
}
mozilla::unused << child->SendInvokeDragSession(dataTransfers, aActionType,
nsCString(),
0, 0, 0, 0, 0, 0);
StartDragSession();
return NS_OK;
}

View File

@ -1,27 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/. */
#ifndef NSDRAGSERVICEPROXY_H
#define NSDRAGSERVICEPROXY_H
#include "nsBaseDragService.h"
class nsDragServiceProxy : public nsBaseDragService
{
public:
nsDragServiceProxy();
NS_DECL_ISUPPORTS_INHERITED
// nsIDragService
NS_IMETHOD InvokeDragSession(nsIDOMNode* aDOMNode,
nsISupportsArray* anArrayTransferables,
nsIScriptableRegion* aRegion,
uint32_t aActionType) override;
private:
virtual ~nsDragServiceProxy();
};
#endif // NSDRAGSERVICEPROXY_H

View File

@ -215,29 +215,6 @@ struct ParamTraits<mozilla::WidgetMouseEvent>
}
};
template<>
struct ParamTraits<mozilla::WidgetDragEvent>
{
typedef mozilla::WidgetDragEvent paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam));
WriteParam(aMsg, aParam.userCancelled);
WriteParam(aMsg, aParam.mDefaultPreventedOnContent);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
bool rv =
ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->userCancelled) &&
ReadParam(aMsg, aIter, &aResult->mDefaultPreventedOnContent);
return rv;
}
};
template<>
struct ParamTraits<mozilla::WidgetPointerEvent>
{

View File

@ -15,17 +15,7 @@ interface nsIDOMDragEvent;
interface nsIDOMDataTransfer;
interface nsISelection;
%{C++
namespace mozilla {
namespace dom {
class ContentParent;
} // namespace dom
} // namespace mozilla
%}
[ptr] native ContentParentPtr(mozilla::dom::ContentParent);
[scriptable, uuid(009d4489-4568-4896-9442-19717dd00f15), builtinclass]
[scriptable, uuid(82B58ADA-F490-4C3D-B737-1057C4F1D052), builtinclass]
interface nsIDragService : nsISupports
{
const long DRAGDROP_ACTION_NONE = 0;
@ -124,8 +114,6 @@ interface nsIDragService : nsISupports
void unsuppress();
[noscript] void dragMoved(in long aX, in long aY);
[notxpcom, nostdcall] boolean maybeAddChildProcess(in ContentParentPtr aChild);
};

View File

@ -19,7 +19,7 @@ interface nsIDOMDocument;
interface nsIDOMNode;
interface nsIDOMDataTransfer;
[scriptable, uuid(25bce737-73f0-43c7-bc20-c71044a73c5a)]
[scriptable, uuid(fde41f6a-c710-46f8-a0a8-1ff76ca4ff57)]
interface nsIDragSession : nsISupports
{
/**
@ -80,15 +80,7 @@ interface nsIDragSession : nsISupports
* Check to set if any of the native data on the clipboard matches this data flavor
*/
boolean isDataFlavorSupported ( in string aDataFlavor ) ;
void userCancelled();
void dragEventDispatchedToChildProcess();
// Called when nsIDragSession implementation should update the UI for the
// drag-and-drop based on the data got from the child process in response to
// NS_DRAGDROP_OVER sent from parent process to child process.
void updateDragEffect();
};

View File

@ -6,7 +6,6 @@
#include "nsPrintSettingsImpl.h"
#include "nsReadableUtils.h"
#include "nsIPrintSession.h"
#include "nsRefPtr.h"
#define DEFAULT_MARGIN_WIDTH 0.5