mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 895274 part.79 Rename NS_DRAGDROP_END to eDragEnd r=smaug (d8af0a9474) - Bug 895274 part.80 Rename NS_DRAGDROP_DRAG to eDrag r=smaug (c52b1e9051) - Bug 895274 part.81 Rename NS_DRAGDROP_OVER to eDragOver r=smaug (1575b62285) - Bug 1199336 - Fix jank/hangs dragging files into the browser due to O(n^2) behavior in the Cocoa widget drag-and-drop code. r=mstange (d08bf7eb39) - Bug 895274 part.82 Rename NS_DRAGDROP_ENTER to eDragEnter r=smaug (a4cc62f29b) - Bug 895274 part.83 Rename NS_DRAGDROP_EXIT to eDragExit r=smaug (a9bc6efbc6) - Bug 895274 part.84 Rename NS_DRAGDROP_DRAGDROP to eLegacyDragDrop r=smaug (1e0e2fc36c) - Bug 895274 part.85 Rename NS_DRAGDROP_GESTURE to eLegacyDragGesture r=smaug (02b65c9714) - Bug 895274 part.86 Rename NS_XUL_EVENT_START to eXULEventFirst r=smaug (fdbf788d30) - Bug 895274 part.87 Rename NS_XUL_POPUP_SHOWING to eXULPopupShowing r=smaug (be6db4598b) - Bug 895274 part.88 Rename NS_XUL_POPUP_SHOWN to eXULPopupShown r=smaug (aa31f0604c) - Bug 895274 part.89 Rename NS_XUL_POPUP_HIDING to eXULPopupHiding r=smaug (31aa9bba3f) - Bug 895274 part.90 Rename NS_XUL_POPUP_HIDDEN to eXULPopupHidden r=smaug (3a16c46a47) - Bug 895274 part.91 Rename NS_XUL_BROADCAST to eXULBroadcast r=smaug (1f6a9ba826) - Bug 895274 part.92 Rename NS_XUL_COMMAND_UPDATE to eXULCommandUpdate r=smaug (a905f91d85) - Bug 895274 part.93 Rename NS_XULCOMMAND_EVENT_START to eXULCommandEventFirst r=smaug (676ccd9544) - Bug 895274 part.94 Rename NS_XUL_COMMAND to eXULCommand r=smaug (d91d925b72) - Bug 895274 part.104 Rename NS_PAGETRANSITION_START to ePageTransitionEventFirst r=smaug (0e481eb39c) - Bug 895274 part.105 Rename NS_PAGE_SHOW to ePageShow r=smaug (f45dc12913) - Bug 895274 part.106 Rename NS_PAGE_HIDE to ePageHide r=smaug (b3985be873) - Bug 895274 part.107 Get rid of NS_SVG_ABORT and NS_SVG_ERROR due to unused r=smaug (d129144cd4) - Bug 895274 part.108 Rename NS_SVG_EVENT_START to eSVGEventFirst r=smaug (3cbb4f9e36) - Bug 895274 part.109 Rename NS_SVG_LOAD to eSVGLoad r=smaug (bf00acdd16) - Bug 895274 part.110 Rename NS_SVG_UNLOAD to eSVGUnload r=smaug (e14939e8d5) - Bug 895274 part.111 Rename NS_SVG_RESIZE to eSVGResize r=smaug (b81017a3dc) - Bug 895274 part.112 Rename NS_SVG_SCROLL to eSVGScroll r=smaug (9b0ce02714) - Bug 895274 part.113 Rename NS_SVGZOOM_EVENT_START to eSVGZoomEventFirst r=smaug (ee1f48e8b4) - Bug 895274 part.114 Rename NS_SVG_ZOOM to eSVGZoom r=smaug (8274e50f8c)
This commit is contained in:
@@ -5447,7 +5447,7 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
||||
// For draggesture and dragstart events, the data transfer object is
|
||||
// created before the event fires, so it should already be set. For other
|
||||
// drag events, get the object from the drag session.
|
||||
NS_ASSERTION(aDragEvent->mMessage != NS_DRAGDROP_GESTURE &&
|
||||
NS_ASSERTION(aDragEvent->mMessage != eLegacyDragGesture &&
|
||||
aDragEvent->mMessage != eDragStart,
|
||||
"draggesture event created without a dataTransfer");
|
||||
|
||||
@@ -5476,7 +5476,7 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
||||
|
||||
bool isCrossDomainSubFrameDrop = false;
|
||||
if (aDragEvent->mMessage == eDrop ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_DRAGDROP) {
|
||||
aDragEvent->mMessage == eLegacyDragDrop) {
|
||||
isCrossDomainSubFrameDrop = CheckForSubFrameDrop(dragSession, aDragEvent);
|
||||
}
|
||||
|
||||
@@ -5490,16 +5490,15 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
|
||||
// for the dragenter and dragover events, initialize the drop effect
|
||||
// from the drop action, which platform specific widget code sets before
|
||||
// the event is fired based on the keyboard state.
|
||||
if (aDragEvent->mMessage == NS_DRAGDROP_ENTER ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_OVER) {
|
||||
if (aDragEvent->mMessage == eDragEnter || aDragEvent->mMessage == eDragOver) {
|
||||
uint32_t action, effectAllowed;
|
||||
dragSession->GetDragAction(&action);
|
||||
aDragEvent->dataTransfer->GetEffectAllowedInt(&effectAllowed);
|
||||
aDragEvent->dataTransfer->SetDropEffectInt(FilterDropEffect(action, effectAllowed));
|
||||
}
|
||||
else if (aDragEvent->mMessage == eDrop ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_DRAGDROP ||
|
||||
aDragEvent->mMessage == NS_DRAGDROP_END) {
|
||||
aDragEvent->mMessage == eLegacyDragDrop ||
|
||||
aDragEvent->mMessage == eDragEnd) {
|
||||
// For the drop and dragend events, set the drop effect based on the
|
||||
// last value that the dropEffect had. This will have been set in
|
||||
// EventStateManager::PostHandleEvent for the last dragenter or
|
||||
|
||||
@@ -3081,7 +3081,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
}
|
||||
} else if (msg == eMouseDown && aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
gMouseDown = true;
|
||||
} else if ((msg == eMouseUp || msg == NS_DRAGDROP_END) &&
|
||||
} else if ((msg == eMouseUp || msg == eDragEnd) &&
|
||||
aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
gMouseDown = false;
|
||||
if (gDragServiceDisabled) {
|
||||
|
||||
@@ -89,7 +89,7 @@ DataTransfer::DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
|
||||
if (aEventMessage == NS_CUT ||
|
||||
aEventMessage == NS_COPY ||
|
||||
aEventMessage == eDragStart ||
|
||||
aEventMessage == NS_DRAGDROP_GESTURE) {
|
||||
aEventMessage == eLegacyDragGesture) {
|
||||
mReadOnly = false;
|
||||
} else if (mIsExternal) {
|
||||
if (aEventMessage == NS_PASTE) {
|
||||
@@ -134,7 +134,7 @@ DataTransfer::DataTransfer(nsISupports* aParent,
|
||||
// draggesture and dragstart events are the only times when items are
|
||||
// modifiable, but those events should have been using the first constructor
|
||||
// above.
|
||||
NS_ASSERTION(aEventMessage != NS_DRAGDROP_GESTURE &&
|
||||
NS_ASSERTION(aEventMessage != eLegacyDragGesture &&
|
||||
aEventMessage != eDragStart,
|
||||
"invalid event type for DataTransfer constructor");
|
||||
}
|
||||
@@ -270,7 +270,7 @@ FileList*
|
||||
DataTransfer::GetFiles(ErrorResult& aRv)
|
||||
{
|
||||
if (mEventMessage != eDrop &&
|
||||
mEventMessage != NS_DRAGDROP_DRAGDROP &&
|
||||
mEventMessage != eLegacyDragDrop &&
|
||||
mEventMessage != NS_PASTE) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -615,8 +615,7 @@ DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
|
||||
// only allow access to the data with the same principal.
|
||||
nsIPrincipal* principal = nullptr;
|
||||
if (mIsCrossDomainSubFrameDrop ||
|
||||
(mEventMessage != eDrop &&
|
||||
mEventMessage != NS_DRAGDROP_DRAGDROP &&
|
||||
(mEventMessage != eDrop && mEventMessage != eLegacyDragDrop &&
|
||||
mEventMessage != NS_PASTE &&
|
||||
!nsContentUtils::IsCallerChrome())) {
|
||||
principal = nsContentUtils::SubjectPrincipal();
|
||||
|
||||
@@ -758,7 +758,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
case NS_XUL_COMMAND:
|
||||
case eXULCommand:
|
||||
abuse = openControlled;
|
||||
break;
|
||||
default:
|
||||
|
||||
+22
-22
@@ -179,15 +179,15 @@ EVENT(dblclick,
|
||||
EventNameType_HTMLXUL,
|
||||
eMouseEventClass)
|
||||
EVENT(drag,
|
||||
NS_DRAGDROP_DRAG,
|
||||
eDrag,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragend,
|
||||
NS_DRAGDROP_END,
|
||||
eDragEnd,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragenter,
|
||||
NS_DRAGDROP_ENTER,
|
||||
eDragEnter,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragleave,
|
||||
@@ -195,7 +195,7 @@ EVENT(dragleave,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragover,
|
||||
NS_DRAGDROP_OVER,
|
||||
eDragOver,
|
||||
EventNameType_HTMLXUL,
|
||||
eDragEventClass)
|
||||
EVENT(dragstart,
|
||||
@@ -512,11 +512,11 @@ WINDOW_EVENT(online,
|
||||
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
WINDOW_EVENT(pagehide,
|
||||
NS_PAGE_HIDE,
|
||||
ePageHide,
|
||||
EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
WINDOW_EVENT(pageshow,
|
||||
NS_PAGE_SHOW,
|
||||
ePageShow,
|
||||
EventNameType_HTMLBodyOrFramesetOnly,
|
||||
eBasicEventClass)
|
||||
WINDOW_EVENT(popstate,
|
||||
@@ -704,7 +704,7 @@ NON_IDL_EVENT(compositionend,
|
||||
EventNameType_XUL,
|
||||
eCompositionEventClass)
|
||||
NON_IDL_EVENT(command,
|
||||
NS_XUL_COMMAND,
|
||||
eXULCommand,
|
||||
EventNameType_XUL,
|
||||
eInputEventClass)
|
||||
NON_IDL_EVENT(close,
|
||||
@@ -712,39 +712,39 @@ NON_IDL_EVENT(close,
|
||||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(popupshowing,
|
||||
NS_XUL_POPUP_SHOWING,
|
||||
eXULPopupShowing,
|
||||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(popupshown,
|
||||
NS_XUL_POPUP_SHOWN,
|
||||
eXULPopupShown,
|
||||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(popuphiding,
|
||||
NS_XUL_POPUP_HIDING,
|
||||
eXULPopupHiding,
|
||||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(popuphidden,
|
||||
NS_XUL_POPUP_HIDDEN,
|
||||
eXULPopupHidden,
|
||||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(broadcast,
|
||||
NS_XUL_BROADCAST,
|
||||
eXULBroadcast,
|
||||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(commandupdate,
|
||||
NS_XUL_COMMAND_UPDATE,
|
||||
eXULCommandUpdate,
|
||||
EventNameType_XUL,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(dragexit,
|
||||
NS_DRAGDROP_EXIT,
|
||||
eDragExit,
|
||||
EventNameType_XUL,
|
||||
eDragEventClass)
|
||||
NON_IDL_EVENT(dragdrop,
|
||||
NS_DRAGDROP_DRAGDROP,
|
||||
eLegacyDragDrop,
|
||||
EventNameType_XUL,
|
||||
eDragEventClass)
|
||||
NON_IDL_EVENT(draggesture,
|
||||
NS_DRAGDROP_GESTURE,
|
||||
eLegacyDragGesture,
|
||||
EventNameType_XUL,
|
||||
eDragEventClass)
|
||||
NON_IDL_EVENT(overflow,
|
||||
@@ -758,24 +758,24 @@ NON_IDL_EVENT(underflow,
|
||||
|
||||
// Various SVG events
|
||||
NON_IDL_EVENT(SVGLoad,
|
||||
NS_SVG_LOAD,
|
||||
eSVGLoad,
|
||||
EventNameType_None,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(SVGUnload,
|
||||
NS_SVG_UNLOAD,
|
||||
eSVGUnload,
|
||||
EventNameType_None,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(SVGResize,
|
||||
NS_SVG_RESIZE,
|
||||
eSVGResize,
|
||||
EventNameType_None,
|
||||
eBasicEventClass)
|
||||
NON_IDL_EVENT(SVGScroll,
|
||||
NS_SVG_SCROLL,
|
||||
eSVGScroll,
|
||||
EventNameType_None,
|
||||
eBasicEventClass)
|
||||
|
||||
NON_IDL_EVENT(SVGZoom,
|
||||
NS_SVG_ZOOM,
|
||||
eSVGZoom,
|
||||
EventNameType_None,
|
||||
eSVGZoomEventClass)
|
||||
|
||||
@@ -783,7 +783,7 @@ NON_IDL_EVENT(SVGZoom,
|
||||
#ifndef MESSAGE_TO_EVENT
|
||||
// This is a bit hackish, but SVG's event names are weird.
|
||||
NON_IDL_EVENT(zoom,
|
||||
NS_SVG_ZOOM,
|
||||
eSVGZoom,
|
||||
EventNameType_SVGSVG,
|
||||
eBasicEventClass)
|
||||
#endif
|
||||
|
||||
@@ -662,16 +662,16 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
FlushPendingEvents(aPresContext);
|
||||
break;
|
||||
}
|
||||
case NS_DRAGDROP_GESTURE:
|
||||
case eLegacyDragGesture:
|
||||
if (Prefs::ClickHoldContextMenu()) {
|
||||
// an external drag gesture event came in, not generated internally
|
||||
// by Gecko. Make sure we get rid of the click-hold timer.
|
||||
KillClickHoldTimer();
|
||||
}
|
||||
break;
|
||||
case NS_DRAGDROP_OVER:
|
||||
// eDrop is fired before NS_DRAGDROP_DRAGDROP so send
|
||||
// the enter/exit events before eDrop.
|
||||
case eDragOver:
|
||||
// eDrop is fired before eLegacyDragDrop so send the enter/exit events
|
||||
// before eDrop.
|
||||
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
|
||||
break;
|
||||
|
||||
@@ -1209,8 +1209,8 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
|
||||
}
|
||||
case eDragEventClass:
|
||||
switch (aEvent.mMessage) {
|
||||
case NS_DRAGDROP_OVER:
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case eDragOver:
|
||||
case eDragExit:
|
||||
case eDrop:
|
||||
return true;
|
||||
default:
|
||||
@@ -1683,7 +1683,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||
FillInEventFromGestureDown(&startEvent);
|
||||
|
||||
WidgetDragEvent gestureEvent(aEvent->mFlags.mIsTrusted,
|
||||
NS_DRAGDROP_GESTURE, widget);
|
||||
eLegacyDragGesture, widget);
|
||||
FillInEventFromGestureDown(&gestureEvent);
|
||||
|
||||
startEvent.dataTransfer = gestureEvent.dataTransfer = dataTransfer;
|
||||
@@ -1742,7 +1742,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
// Note that frame event handling doesn't care about NS_DRAGDROP_GESTURE,
|
||||
// Note that frame event handling doesn't care about eLegacyDragGesture,
|
||||
// which is just as well since we don't really know which frame to
|
||||
// send it to
|
||||
|
||||
@@ -3187,8 +3187,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_ENTER:
|
||||
case NS_DRAGDROP_OVER:
|
||||
case eDragEnter:
|
||||
case eDragOver:
|
||||
{
|
||||
NS_ASSERTION(aEvent->mClass == eDragEventClass, "Expected a drag event");
|
||||
|
||||
@@ -3277,13 +3277,13 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
// For now, do this only for dragover.
|
||||
//XXXsmaug dragenter needs some more work.
|
||||
if (aEvent->mMessage == NS_DRAGDROP_OVER && !isChromeDoc) {
|
||||
if (aEvent->mMessage == eDragOver && !isChromeDoc) {
|
||||
// Someone has called preventDefault(), check whether is was on
|
||||
// content or chrome.
|
||||
dragSession->SetOnlyChromeDrop(
|
||||
!dragEvent->mDefaultPreventedOnContent);
|
||||
}
|
||||
} else if (aEvent->mMessage == NS_DRAGDROP_OVER && !isChromeDoc) {
|
||||
} else if (aEvent->mMessage == eDragOver && !isChromeDoc) {
|
||||
// No one called preventDefault(), so handle drop only in chrome.
|
||||
dragSession->SetOnlyChromeDrop(true);
|
||||
}
|
||||
@@ -3312,7 +3312,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
|
||||
WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
|
||||
NS_DRAGDROP_DRAGDROP, widget);
|
||||
eLegacyDragDrop, widget);
|
||||
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
event.refPoint = mouseEvent->refPoint;
|
||||
@@ -3335,9 +3335,9 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
ClearGlobalActiveContent(this);
|
||||
break;
|
||||
}
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case eDragExit:
|
||||
// make sure to fire the enter and exit_synth events after the
|
||||
// NS_DRAGDROP_EXIT event, otherwise we'll clean up too early
|
||||
// eDragExit event, otherwise we'll clean up too early
|
||||
GenerateDragDropEnterExit(presContext, aEvent->AsDragEvent());
|
||||
break;
|
||||
|
||||
@@ -4319,7 +4319,7 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||
|
||||
switch(aDragEvent->mMessage) {
|
||||
case NS_DRAGDROP_OVER:
|
||||
case eDragOver:
|
||||
{
|
||||
// when dragging from one frame to another, events are fired in the
|
||||
// order: dragexit, dragenter, dragleave
|
||||
@@ -4336,11 +4336,11 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
getter_AddRefs(lastContent));
|
||||
|
||||
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
||||
aDragEvent, NS_DRAGDROP_EXIT,
|
||||
aDragEvent, eDragExit,
|
||||
targetContent, lastContent, sLastDragOverFrame);
|
||||
}
|
||||
|
||||
FireDragEnterOrExit(aPresContext, aDragEvent, NS_DRAGDROP_ENTER,
|
||||
FireDragEnterOrExit(aPresContext, aDragEvent, eDragEnter,
|
||||
lastContent, targetContent, mCurrentTarget);
|
||||
|
||||
if (sLastDragOverFrame) {
|
||||
@@ -4354,7 +4354,7 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case eDragExit:
|
||||
{
|
||||
//This is actually the window mouse exit event.
|
||||
if (sLastDragOverFrame) {
|
||||
@@ -4364,7 +4364,7 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
|
||||
nsRefPtr<nsPresContext> lastDragOverFramePresContext = sLastDragOverFrame->PresContext();
|
||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||
aDragEvent, NS_DRAGDROP_EXIT,
|
||||
aDragEvent, eDragExit,
|
||||
nullptr, lastContent, sLastDragOverFrame);
|
||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||
aDragEvent, eDragLeave,
|
||||
@@ -4413,17 +4413,15 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// adjust the drag hover if the dragenter event was cancelled or this is a drag exit
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
aMessage == NS_DRAGDROP_EXIT) {
|
||||
SetContentState((aMessage == NS_DRAGDROP_ENTER) ?
|
||||
aTargetContent : nullptr,
|
||||
if (status == nsEventStatus_eConsumeNoDefault || aMessage == eDragExit) {
|
||||
SetContentState((aMessage == eDragEnter) ? aTargetContent : nullptr,
|
||||
NS_EVENT_STATE_DRAGOVER);
|
||||
}
|
||||
|
||||
// collect any changes to moz cursor settings stored in the event's
|
||||
// data transfer.
|
||||
if (aMessage == eDragLeave || aMessage == NS_DRAGDROP_EXIT ||
|
||||
aMessage == NS_DRAGDROP_ENTER) {
|
||||
if (aMessage == eDragLeave || aMessage == eDragExit ||
|
||||
aMessage == eDragEnter) {
|
||||
UpdateDragDataTransfer(&event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
||||
}
|
||||
return;
|
||||
case eMouseMove:
|
||||
case NS_DRAGDROP_OVER: {
|
||||
case eDragOver: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsReal()) {
|
||||
// If the cursor is moving to be outside the frame,
|
||||
|
||||
@@ -2198,15 +2198,15 @@ TabChild::RecvRealDragEvent(const WidgetDragEvent& aEvent,
|
||||
bool canDrop = true;
|
||||
if (!dragSession || NS_FAILED(dragSession->GetCanDrop(&canDrop)) ||
|
||||
!canDrop) {
|
||||
localEvent.mMessage = NS_DRAGDROP_EXIT;
|
||||
localEvent.mMessage = eDragExit;
|
||||
}
|
||||
} else if (aEvent.mMessage == NS_DRAGDROP_OVER) {
|
||||
} else if (aEvent.mMessage == eDragOver) {
|
||||
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);
|
||||
dragService->FireDragEventAtSource(eDrag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1729,8 +1729,7 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
|
||||
if (dragEvent && mInstance) {
|
||||
WidgetEvent* ievent = aEvent->GetInternalNSEvent();
|
||||
if (ievent && ievent->mFlags.mIsTrusted &&
|
||||
ievent->mMessage != NS_DRAGDROP_ENTER &&
|
||||
ievent->mMessage != NS_DRAGDROP_OVER) {
|
||||
ievent->mMessage != eDragEnter && ievent->mMessage != eDragOver) {
|
||||
aEvent->PreventDefault();
|
||||
}
|
||||
|
||||
|
||||
@@ -511,10 +511,10 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
|
||||
if (presShell && IsRoot()) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (mPreviousScale != mCurrentScale) {
|
||||
InternalSVGZoomEvent svgZoomEvent(true, NS_SVG_ZOOM);
|
||||
InternalSVGZoomEvent svgZoomEvent(true, eSVGZoom);
|
||||
presShell->HandleDOMEventWithTarget(this, &svgZoomEvent, &status);
|
||||
} else {
|
||||
WidgetEvent svgScrollEvent(true, NS_SVG_SCROLL);
|
||||
WidgetEvent svgScrollEvent(true, eSVGScroll);
|
||||
presShell->HandleDOMEventWithTarget(this, &svgScrollEvent, &status);
|
||||
}
|
||||
InvalidateTransformNotifyFrame();
|
||||
@@ -590,7 +590,7 @@ SVGSVGElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
nsresult
|
||||
SVGSVGElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->mMessage == NS_SVG_LOAD) {
|
||||
if (aVisitor.mEvent->mMessage == eSVGLoad) {
|
||||
if (mTimedDocumentRoot) {
|
||||
mTimedDocumentRoot->Begin();
|
||||
// Set 'resample needed' flag, so that if any script calls a DOM method
|
||||
|
||||
@@ -31,7 +31,7 @@ SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalSVGZoomEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalSVGZoomEvent(false, NS_SVG_ZOOM))
|
||||
aEvent ? aEvent : new InternalSVGZoomEvent(false, eSVGZoom))
|
||||
, mPreviousScale(0)
|
||||
, mNewScale(0)
|
||||
{
|
||||
|
||||
@@ -891,7 +891,7 @@ XULDocument::ExecuteOnBroadcastHandlerFor(Element* aBroadcaster,
|
||||
|
||||
// This is the right <observes> element. Execute the
|
||||
// |onbroadcast| event handler
|
||||
WidgetEvent event(true, NS_XUL_BROADCAST);
|
||||
WidgetEvent event(true, eXULBroadcast);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
|
||||
@@ -401,7 +401,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
||||
}
|
||||
#endif
|
||||
|
||||
WidgetEvent event(true, NS_XUL_COMMAND_UPDATE);
|
||||
WidgetEvent event(true, eXULCommandUpdate);
|
||||
EventDispatcher::Dispatch(content, nullptr, &event);
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
@@ -1276,16 +1276,16 @@ nsXULElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
(IsAnyOfXULElements(nsGkAtoms::scrollbar, nsGkAtoms::scrollcorner)) &&
|
||||
(aVisitor.mEvent->mMessage == eMouseClick ||
|
||||
aVisitor.mEvent->mMessage == eMouseDoubleClick ||
|
||||
aVisitor.mEvent->mMessage == NS_XUL_COMMAND ||
|
||||
aVisitor.mEvent->mMessage == eXULCommand ||
|
||||
aVisitor.mEvent->mMessage == eContextMenu ||
|
||||
aVisitor.mEvent->mMessage == eDragStart ||
|
||||
aVisitor.mEvent->mMessage == NS_DRAGDROP_GESTURE)) {
|
||||
aVisitor.mEvent->mMessage == eLegacyDragGesture)) {
|
||||
// Don't propagate these events from native anonymous scrollbar.
|
||||
aVisitor.mCanHandle = true;
|
||||
aVisitor.mParentTarget = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
if (aVisitor.mEvent->mMessage == NS_XUL_COMMAND &&
|
||||
if (aVisitor.mEvent->mMessage == eXULCommand &&
|
||||
aVisitor.mEvent->mClass == eInputEventClass &&
|
||||
aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this) &&
|
||||
!IsXULElement(nsGkAtoms::command)) {
|
||||
|
||||
@@ -371,17 +371,17 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
// you don't need to check if the QI succeeded before each call.
|
||||
switch (internalEvent->mMessage) {
|
||||
// dragenter
|
||||
case NS_DRAGDROP_ENTER: {
|
||||
case eDragEnter: {
|
||||
nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent);
|
||||
return DragEnter(dragEvent);
|
||||
}
|
||||
// dragover
|
||||
case NS_DRAGDROP_OVER: {
|
||||
case eDragOver: {
|
||||
nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent);
|
||||
return DragOver(dragEvent);
|
||||
}
|
||||
// dragexit
|
||||
case NS_DRAGDROP_EXIT: {
|
||||
case eDragExit: {
|
||||
nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent);
|
||||
return DragExit(dragEvent);
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
|
||||
|
||||
switch (aEvent.mMessage) {
|
||||
case eMouseMove:
|
||||
case NS_DRAGDROP_OVER: {
|
||||
case eDragOver: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent.AsMouseEvent();
|
||||
if (!mouseEvent->IsReal()) {
|
||||
return;
|
||||
|
||||
@@ -317,9 +317,8 @@ nsComboboxControlFrame::ShowPopup(bool aShowPopup)
|
||||
|
||||
// fire a popup dom event
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, aShowPopup ?
|
||||
NS_XUL_POPUP_SHOWING : NS_XUL_POPUP_HIDING, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
WidgetMouseEvent event(true, aShowPopup ? eXULPopupShowing : eXULPopupHiding,
|
||||
nullptr, WidgetMouseEvent::eReal);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = PresContext()->GetPresShell();
|
||||
if (shell)
|
||||
|
||||
@@ -346,7 +346,7 @@ NS_IMETHODIMP nsXULPopupShownEvent::Run()
|
||||
popup->SetPopupState(ePopupShown);
|
||||
}
|
||||
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWN, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupShown, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
return EventDispatcher::Dispatch(mPopup, mPresContext, &event);
|
||||
}
|
||||
|
||||
@@ -1095,7 +1095,7 @@ nsXULPopupManager::HidePopupCallback(nsIContent* aPopup,
|
||||
// send the popuphidden event synchronously. This event has no default
|
||||
// behaviour.
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupHidden, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
EventDispatcher::Dispatch(aPopup, aPopupFrame->PresContext(),
|
||||
&event, nullptr, &status);
|
||||
@@ -1331,7 +1331,7 @@ nsXULPopupManager::FirePopupShowingEvent(nsIContent* aPopup,
|
||||
mOpeningPopup = aPopup;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWING, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupShowing, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
// coordinates are relative to the root widget
|
||||
@@ -1411,7 +1411,7 @@ nsXULPopupManager::FirePopupHidingEvent(nsIContent* aPopup,
|
||||
nsCOMPtr<nsIPresShell> presShell = aPresContext->PresShell();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_HIDING, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupHiding, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
EventDispatcher::Dispatch(aPopup, aPresContext, &event, nullptr, &status);
|
||||
|
||||
|
||||
@@ -2583,7 +2583,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
InvalidateRow(mMouseOverRow);
|
||||
mMouseOverRow = -1;
|
||||
}
|
||||
} else if (aEvent->mMessage == NS_DRAGDROP_ENTER) {
|
||||
} else if (aEvent->mMessage == eDragEnter) {
|
||||
if (!mSlots)
|
||||
mSlots = new Slots();
|
||||
|
||||
@@ -2600,7 +2600,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
mSlots->mDropRow = -1;
|
||||
mSlots->mDropOrient = -1;
|
||||
mSlots->mDragAction = GetDropEffect(aEvent);
|
||||
} else if (aEvent->mMessage == NS_DRAGDROP_OVER) {
|
||||
} else if (aEvent->mMessage == eDragOver) {
|
||||
// The mouse is hovering over this tree. If we determine things are
|
||||
// different from the last time, invalidate the drop feedback at the old
|
||||
// position, query the view to see if the current location is droppable,
|
||||
@@ -2733,7 +2733,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
mSlots->mDropOrient = -1;
|
||||
mSlots->mIsDragging = false;
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault; // already handled the drop
|
||||
} else if (aEvent->mMessage == NS_DRAGDROP_EXIT) {
|
||||
} else if (aEvent->mMessage == eDragExit) {
|
||||
// this event was meant for another frame, so ignore it
|
||||
if (!mSlots)
|
||||
return NS_OK;
|
||||
|
||||
@@ -21,7 +21,7 @@ nsHtml5SVGLoadDispatcher::nsHtml5SVGLoadDispatcher(nsIContent* aElement)
|
||||
NS_IMETHODIMP
|
||||
nsHtml5SVGLoadDispatcher::Run()
|
||||
{
|
||||
WidgetEvent event(true, NS_SVG_LOAD);
|
||||
WidgetEvent event(true, eSVGLoad);
|
||||
event.mFlags.mBubbles = false;
|
||||
// Do we care about forcing presshell creation if it hasn't happened yet?
|
||||
// That is, should this code flush or something? Does it really matter?
|
||||
|
||||
+27
-30
@@ -102,27 +102,26 @@ NS_EVENT_MESSAGE(eFocus, eFocusEventFirst)
|
||||
NS_EVENT_MESSAGE(eBlur, eFocusEventFirst + 1)
|
||||
|
||||
NS_EVENT_MESSAGE(eDragDropEventFirst, 1400)
|
||||
NS_EVENT_MESSAGE(NS_DRAGDROP_ENTER, eDragDropEventFirst)
|
||||
NS_EVENT_MESSAGE(NS_DRAGDROP_OVER, eDragDropEventFirst + 1)
|
||||
NS_EVENT_MESSAGE(NS_DRAGDROP_EXIT, eDragDropEventFirst + 2)
|
||||
NS_EVENT_MESSAGE(NS_DRAGDROP_DRAGDROP, eDragDropEventFirst + 3)
|
||||
NS_EVENT_MESSAGE(NS_DRAGDROP_GESTURE, eDragDropEventFirst + 4)
|
||||
NS_EVENT_MESSAGE(NS_DRAGDROP_DRAG, eDragDropEventFirst + 5)
|
||||
NS_EVENT_MESSAGE(NS_DRAGDROP_END, eDragDropEventFirst + 6)
|
||||
NS_EVENT_MESSAGE(eDragEnter, eDragDropEventFirst)
|
||||
NS_EVENT_MESSAGE(eDragOver, eDragDropEventFirst + 1)
|
||||
NS_EVENT_MESSAGE(eDragExit, eDragDropEventFirst + 2)
|
||||
NS_EVENT_MESSAGE(eLegacyDragDrop, eDragDropEventFirst + 3)
|
||||
NS_EVENT_MESSAGE(eLegacyDragGesture, eDragDropEventFirst + 4)
|
||||
NS_EVENT_MESSAGE(eDrag, eDragDropEventFirst + 5)
|
||||
NS_EVENT_MESSAGE(eDragEnd, eDragDropEventFirst + 6)
|
||||
NS_EVENT_MESSAGE(eDragStart, eDragDropEventFirst + 7)
|
||||
NS_EVENT_MESSAGE(eDrop, eDragDropEventFirst + 8)
|
||||
NS_EVENT_MESSAGE(eDragLeave, eDragDropEventFirst + 9)
|
||||
NS_EVENT_MESSAGE(eDragDropEventLast, eDragLeave)
|
||||
|
||||
// Events for popups
|
||||
NS_EVENT_MESSAGE(NS_XUL_EVENT_START, 1500)
|
||||
NS_EVENT_MESSAGE(NS_XUL_POPUP_SHOWING, NS_XUL_EVENT_START)
|
||||
NS_EVENT_MESSAGE(NS_XUL_POPUP_SHOWN, NS_XUL_EVENT_START + 1)
|
||||
NS_EVENT_MESSAGE(NS_XUL_POPUP_HIDING, NS_XUL_EVENT_START + 2)
|
||||
NS_EVENT_MESSAGE(NS_XUL_POPUP_HIDDEN, NS_XUL_EVENT_START + 3)
|
||||
// NS_XUL_COMMAND used to be here (NS_XUL_EVENT_START + 4)
|
||||
NS_EVENT_MESSAGE(NS_XUL_BROADCAST, NS_XUL_EVENT_START + 5)
|
||||
NS_EVENT_MESSAGE(NS_XUL_COMMAND_UPDATE, NS_XUL_EVENT_START + 6)
|
||||
// XUL specific events
|
||||
NS_EVENT_MESSAGE(eXULEventFirst, 1500)
|
||||
NS_EVENT_MESSAGE(eXULPopupShowing, eXULEventFirst)
|
||||
NS_EVENT_MESSAGE(eXULPopupShown, eXULEventFirst + 1)
|
||||
NS_EVENT_MESSAGE(eXULPopupHiding, eXULEventFirst + 2)
|
||||
NS_EVENT_MESSAGE(eXULPopupHidden, eXULEventFirst + 3)
|
||||
NS_EVENT_MESSAGE(eXULBroadcast, eXULEventFirst + 5)
|
||||
NS_EVENT_MESSAGE(eXULCommandUpdate, eXULEventFirst + 6)
|
||||
|
||||
// Scroll events
|
||||
NS_EVENT_MESSAGE(NS_MOUSE_SCROLL_START, 1600)
|
||||
@@ -187,26 +186,24 @@ NS_EVENT_MESSAGE(eLegacyDOMFocusIn, eLegacyUIEventFirst + 1)
|
||||
NS_EVENT_MESSAGE(eLegacyDOMFocusOut, eLegacyUIEventFirst + 2)
|
||||
|
||||
// pagetransition events
|
||||
NS_EVENT_MESSAGE(NS_PAGETRANSITION_START, 2700)
|
||||
NS_EVENT_MESSAGE(NS_PAGE_SHOW, NS_PAGETRANSITION_START + 1)
|
||||
NS_EVENT_MESSAGE(NS_PAGE_HIDE, NS_PAGETRANSITION_START + 2)
|
||||
NS_EVENT_MESSAGE(ePageTransitionEventFirst, 2700)
|
||||
NS_EVENT_MESSAGE(ePageShow, ePageTransitionEventFirst + 1)
|
||||
NS_EVENT_MESSAGE(ePageHide, ePageTransitionEventFirst + 2)
|
||||
|
||||
// SVG events
|
||||
NS_EVENT_MESSAGE(NS_SVG_EVENT_START, 2800)
|
||||
NS_EVENT_MESSAGE(NS_SVG_LOAD, NS_SVG_EVENT_START)
|
||||
NS_EVENT_MESSAGE(NS_SVG_UNLOAD, NS_SVG_EVENT_START + 1)
|
||||
NS_EVENT_MESSAGE(NS_SVG_ABORT, NS_SVG_EVENT_START + 2)
|
||||
NS_EVENT_MESSAGE(NS_SVG_ERROR, NS_SVG_EVENT_START + 3)
|
||||
NS_EVENT_MESSAGE(NS_SVG_RESIZE, NS_SVG_EVENT_START + 4)
|
||||
NS_EVENT_MESSAGE(NS_SVG_SCROLL, NS_SVG_EVENT_START + 5)
|
||||
NS_EVENT_MESSAGE(eSVGEventFirst, 2800)
|
||||
NS_EVENT_MESSAGE(eSVGLoad, eSVGEventFirst)
|
||||
NS_EVENT_MESSAGE(eSVGUnload, eSVGEventFirst + 1)
|
||||
NS_EVENT_MESSAGE(eSVGResize, eSVGEventFirst + 4)
|
||||
NS_EVENT_MESSAGE(eSVGScroll, eSVGEventFirst + 5)
|
||||
|
||||
// SVG Zoom events
|
||||
NS_EVENT_MESSAGE(NS_SVGZOOM_EVENT_START, 2900)
|
||||
NS_EVENT_MESSAGE(NS_SVG_ZOOM, NS_SVGZOOM_EVENT_START)
|
||||
NS_EVENT_MESSAGE(eSVGZoomEventFirst, 2900)
|
||||
NS_EVENT_MESSAGE(eSVGZoom, eSVGZoomEventFirst)
|
||||
|
||||
// XUL command events
|
||||
NS_EVENT_MESSAGE(NS_XULCOMMAND_EVENT_START, 3000)
|
||||
NS_EVENT_MESSAGE(NS_XUL_COMMAND, NS_XULCOMMAND_EVENT_START)
|
||||
NS_EVENT_MESSAGE(eXULCommandEventFirst, 3000)
|
||||
NS_EVENT_MESSAGE(eXULCommand, eXULCommandEventFirst)
|
||||
|
||||
// Cut, copy, paste events
|
||||
NS_EVENT_MESSAGE(NS_CUTCOPYPASTE_EVENT_START, 3100)
|
||||
|
||||
@@ -322,9 +322,7 @@ public:
|
||||
, mDefaultPreventedOnContent(false)
|
||||
{
|
||||
mFlags.mCancelable =
|
||||
(aMessage != NS_DRAGDROP_EXIT &&
|
||||
aMessage != eDragLeave &&
|
||||
aMessage != NS_DRAGDROP_END);
|
||||
(aMessage != eDragExit && aMessage != eDragLeave && aMessage != eDragEnd);
|
||||
}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override
|
||||
|
||||
@@ -99,13 +99,13 @@ bool
|
||||
WidgetEvent::HasDragEventMessage() const
|
||||
{
|
||||
switch (mMessage) {
|
||||
case NS_DRAGDROP_ENTER:
|
||||
case NS_DRAGDROP_OVER:
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case NS_DRAGDROP_DRAGDROP:
|
||||
case NS_DRAGDROP_GESTURE:
|
||||
case NS_DRAGDROP_DRAG:
|
||||
case NS_DRAGDROP_END:
|
||||
case eDragEnter:
|
||||
case eDragOver:
|
||||
case eDragExit:
|
||||
case eLegacyDragDrop:
|
||||
case eLegacyDragGesture:
|
||||
case eDrag:
|
||||
case eDragEnd:
|
||||
case eDragStart:
|
||||
case eDrop:
|
||||
case eDragLeave:
|
||||
|
||||
+14
-13
@@ -3152,7 +3152,7 @@ GLPresenter::EndFrame()
|
||||
// in our native NSView (it is set in |draggingEntered:|). It is unset when the
|
||||
// drag session ends for this view, either with the mouse exiting or when a drop
|
||||
// occurs in this view.
|
||||
NSPasteboard* globalDragPboard = nil;
|
||||
NSPasteboardWrapper* globalDragPboard = nil;
|
||||
|
||||
// gLastDragView and gLastDragMouseDownEvent are used to communicate information
|
||||
// to the drag service during drag invocation (starting a drag in from the view).
|
||||
@@ -5715,23 +5715,24 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
if (aMessage == NS_DRAGDROP_ENTER)
|
||||
if (aMessage == eDragEnter) {
|
||||
mDragService->StartDragSession();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
mDragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
if (dragSession) {
|
||||
if (aMessage == NS_DRAGDROP_OVER) {
|
||||
if (aMessage == eDragOver) {
|
||||
// fire the drag event at the source. Just ignore whether it was
|
||||
// cancelled or not as there isn't actually a means to stop the drag
|
||||
mDragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
||||
mDragService->FireDragEventAtSource(eDrag);
|
||||
dragSession->SetCanDrop(false);
|
||||
} else if (aMessage == eDrop) {
|
||||
// We make the assumption that the dragOver handlers have correctly set
|
||||
// the |canDrop| property of the Drag Session.
|
||||
bool canDrop = false;
|
||||
if (!NS_SUCCEEDED(dragSession->GetCanDrop(&canDrop)) || !canDrop) {
|
||||
[self doDragAction:NS_DRAGDROP_EXIT sender:aSender];
|
||||
[self doDragAction:eDragExit sender:aSender];
|
||||
|
||||
nsCOMPtr<nsIDOMNode> sourceNode;
|
||||
dragSession->GetSourceNode(getter_AddRefs(sourceNode));
|
||||
@@ -5772,9 +5773,8 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
|
||||
if (dragSession) {
|
||||
switch (aMessage) {
|
||||
case NS_DRAGDROP_ENTER:
|
||||
case NS_DRAGDROP_OVER:
|
||||
{
|
||||
case eDragEnter:
|
||||
case eDragOver: {
|
||||
uint32_t dragAction;
|
||||
dragSession->GetDragAction(&dragAction);
|
||||
|
||||
@@ -5790,7 +5790,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
|
||||
return [self dragOperationFromDragAction:dragAction];
|
||||
}
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case eDragExit:
|
||||
case eDrop: {
|
||||
nsCOMPtr<nsIDOMNode> sourceNode;
|
||||
dragSession->GetSourceNode(getter_AddRefs(sourceNode));
|
||||
@@ -5825,9 +5825,10 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
// Set the global drag pasteboard that will be used for this drag session.
|
||||
// This will be set back to nil when the drag session ends (mouse exits
|
||||
// the view or a drop happens within the view).
|
||||
globalDragPboard = [[sender draggingPasteboard] retain];
|
||||
globalDragPboard =
|
||||
[[NSPasteboardWrapper alloc] initWithPasteboard:[sender draggingPasteboard]];
|
||||
|
||||
return [self doDragAction:NS_DRAGDROP_ENTER sender:sender];
|
||||
return [self doDragAction:eDragEnter sender:sender];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NSDragOperationNone);
|
||||
}
|
||||
@@ -5836,7 +5837,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
{
|
||||
MOZ_LOG(sCocoaLog, LogLevel::Info, ("ChildView draggingUpdated: entered\n"));
|
||||
|
||||
return [self doDragAction:NS_DRAGDROP_OVER sender:sender];
|
||||
return [self doDragAction:eDragOver sender:sender];
|
||||
}
|
||||
|
||||
- (void)draggingExited:(id <NSDraggingInfo>)sender
|
||||
@@ -5844,7 +5845,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
MOZ_LOG(sCocoaLog, LogLevel::Info, ("ChildView draggingExited: entered\n"));
|
||||
|
||||
nsAutoRetainCocoaObject kungFuDeathGrip(self);
|
||||
[self doDragAction:NS_DRAGDROP_EXIT sender:sender];
|
||||
[self doDragAction:eDragExit sender:sender];
|
||||
NS_IF_RELEASE(mDragService);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,16 @@ extern NSString* const kCorePboardType_url;
|
||||
extern NSString* const kCorePboardType_urld;
|
||||
extern NSString* const kCorePboardType_urln;
|
||||
|
||||
@interface NSPasteboardWrapper : NSObject
|
||||
{
|
||||
NSPasteboard* mPasteboard;
|
||||
NSArray* mFilenames;
|
||||
}
|
||||
- (id)initWithPasteboard:(NSPasteboard*)aPasteboard;
|
||||
- (id)propertyListForType:(NSString*)aType;
|
||||
- (NSPasteboard*)pasteboard;
|
||||
@end
|
||||
|
||||
class nsDragService : public nsBaseDragService
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -35,7 +35,7 @@ extern PRLogModuleInfo* sCocoaLog;
|
||||
|
||||
extern void EnsureLogInitialized();
|
||||
|
||||
extern NSPasteboard* globalDragPboard;
|
||||
extern NSPasteboardWrapper* globalDragPboard;
|
||||
extern NSView* gLastDragView;
|
||||
extern NSEvent* gLastDragMouseDownEvent;
|
||||
extern bool gUserCancelledDrag;
|
||||
@@ -49,6 +49,46 @@ NSString* const kCorePboardType_url = @"CorePasteboardFlavorType 0x75726C20"; /
|
||||
NSString* const kCorePboardType_urld = @"CorePasteboardFlavorType 0x75726C64"; // 'urld' desc
|
||||
NSString* const kCorePboardType_urln = @"CorePasteboardFlavorType 0x75726C6E"; // 'urln' title
|
||||
|
||||
@implementation NSPasteboardWrapper
|
||||
- (id)initWithPasteboard:(NSPasteboard*)aPasteboard
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
mPasteboard = [aPasteboard retain];
|
||||
mFilenames = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)propertyListForType:(NSString *)aType
|
||||
{
|
||||
if (![aType isEqualToString:NSFilenamesPboardType]) {
|
||||
return [mPasteboard propertyListForType:aType];
|
||||
}
|
||||
|
||||
if (!mFilenames) {
|
||||
mFilenames = [[mPasteboard propertyListForType:aType] retain];
|
||||
}
|
||||
|
||||
return mFilenames;
|
||||
}
|
||||
|
||||
- (NSPasteboard*) pasteboard
|
||||
{
|
||||
return mPasteboard;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[mPasteboard release];
|
||||
mPasteboard = nil;
|
||||
|
||||
[mFilenames release];
|
||||
mFilenames = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@end
|
||||
|
||||
nsDragService::nsDragService()
|
||||
{
|
||||
mNativeDragView = nil;
|
||||
@@ -401,7 +441,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
||||
flavorStr.EqualsLiteral(kURLMime) ||
|
||||
flavorStr.EqualsLiteral(kURLDataMime) ||
|
||||
flavorStr.EqualsLiteral(kURLDescriptionMime)) {
|
||||
NSString* pString = [globalDragPboard stringForType:pboardType];
|
||||
NSString* pString = [[globalDragPboard pasteboard] stringForType:pboardType];
|
||||
if (!pString)
|
||||
continue;
|
||||
|
||||
@@ -500,17 +540,17 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, bool *_retval)
|
||||
NSString *pboardType = nil;
|
||||
|
||||
if (dataFlavor.EqualsLiteral(kFileMime)) {
|
||||
NSString* availableType = [globalDragPboard availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||
NSString* availableType = [[globalDragPboard pasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||
if (availableType && [availableType isEqualToString:NSFilenamesPboardType])
|
||||
*_retval = true;
|
||||
}
|
||||
else if (dataFlavor.EqualsLiteral(kURLMime)) {
|
||||
NSString* availableType = [globalDragPboard availableTypeFromArray:[NSArray arrayWithObject:kCorePboardType_url]];
|
||||
NSString* availableType = [[globalDragPboard pasteboard] availableTypeFromArray:[NSArray arrayWithObject:kCorePboardType_url]];
|
||||
if (availableType && [availableType isEqualToString:kCorePboardType_url])
|
||||
*_retval = true;
|
||||
}
|
||||
else if (nsClipboard::IsStringType(dataFlavor, &pboardType)) {
|
||||
NSString* availableType = [globalDragPboard availableTypeFromArray:[NSArray arrayWithObject:pboardType]];
|
||||
NSString* availableType = [[globalDragPboard pasteboard] availableTypeFromArray:[NSArray arrayWithObject:pboardType]];
|
||||
if (availableType && [availableType isEqualToString:pboardType])
|
||||
*_retval = true;
|
||||
}
|
||||
@@ -534,7 +574,7 @@ nsDragService::GetNumDropItems(uint32_t* aNumItems)
|
||||
}
|
||||
|
||||
// if there is a clipboard and there is something on it, then there is at least 1 item
|
||||
NSArray* clipboardTypes = [globalDragPboard types];
|
||||
NSArray* clipboardTypes = [[globalDragPboard pasteboard] types];
|
||||
if (globalDragPboard && [clipboardTypes count] > 0)
|
||||
*aNumItems = 1;
|
||||
else
|
||||
|
||||
@@ -353,7 +353,7 @@ nsEventStatus nsMenuX::MenuOpened()
|
||||
}
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWN, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupShown, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
nsCOMPtr<nsIContent> popupContent;
|
||||
@@ -377,7 +377,7 @@ void nsMenuX::MenuClosed()
|
||||
mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::open, true);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupHidden, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
nsCOMPtr<nsIContent> popupContent;
|
||||
@@ -558,7 +558,7 @@ void nsMenuX::LoadSubMenu(nsIContent* inMenuContent)
|
||||
bool nsMenuX::OnOpen()
|
||||
{
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWING, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupShowing, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
nsCOMPtr<nsIContent> popupContent;
|
||||
@@ -575,7 +575,7 @@ bool nsMenuX::OnOpen()
|
||||
// must potentially be updated.
|
||||
|
||||
// Get new popup content first since it might have changed as a result of the
|
||||
// NS_XUL_POPUP_SHOWING event above.
|
||||
// eXULPopupShowing event above.
|
||||
GetMenuPopupContent(getter_AddRefs(popupContent));
|
||||
if (!popupContent)
|
||||
return true;
|
||||
@@ -596,7 +596,7 @@ bool nsMenuX::OnClose()
|
||||
return true;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(true, NS_XUL_POPUP_HIDING, nullptr,
|
||||
WidgetMouseEvent event(true, eXULPopupHiding, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
nsCOMPtr<nsIContent> popupContent;
|
||||
|
||||
@@ -228,7 +228,7 @@ OnSourceGrabEventAfter(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||
sMotionEvent = gdk_event_copy(event);
|
||||
|
||||
// Update the cursor position. The last of these recorded gets used for
|
||||
// the NS_DRAGDROP_END event.
|
||||
// the eDragEnd event.
|
||||
nsDragService *dragService = static_cast<nsDragService*>(user_data);
|
||||
dragService->SetDragEndPoint(nsIntPoint(event->motion.x_root,
|
||||
event->motion.y_root));
|
||||
@@ -1819,8 +1819,7 @@ nsDragService::RunScheduledTask()
|
||||
MOZ_LOG(sDragLm, LogLevel::Debug,
|
||||
("nsDragService: dispatch drag leave (%p)\n",
|
||||
mTargetWindow.get()));
|
||||
mTargetWindow->
|
||||
DispatchDragEvent(NS_DRAGDROP_EXIT, mTargetWindowPoint, 0);
|
||||
mTargetWindow->DispatchDragEvent(eDragExit, mTargetWindowPoint, 0);
|
||||
|
||||
if (!mSourceNode) {
|
||||
// The drag that was initiated in a different app. End the drag
|
||||
@@ -1991,10 +1990,10 @@ nsDragService::DispatchMotionEvents()
|
||||
{
|
||||
mCanDrop = false;
|
||||
|
||||
FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
||||
FireDragEventAtSource(eDrag);
|
||||
|
||||
mTargetWindow->
|
||||
DispatchDragEvent(NS_DRAGDROP_OVER, mTargetWindowPoint, mTargetTime);
|
||||
mTargetWindow->DispatchDragEvent(eDragOver, mTargetWindowPoint,
|
||||
mTargetTime);
|
||||
}
|
||||
|
||||
// Returns true if the drop was successful
|
||||
@@ -2007,7 +2006,7 @@ nsDragService::DispatchDropEvent()
|
||||
if (mTargetWindow->IsDestroyed())
|
||||
return FALSE;
|
||||
|
||||
EventMessage msg = mCanDrop ? eDrop : NS_DRAGDROP_EXIT;
|
||||
EventMessage msg = mCanDrop ? eDrop : eDragExit;
|
||||
|
||||
mTargetWindow->DispatchDragEvent(msg, mTargetWindowPoint, mTargetTime);
|
||||
|
||||
|
||||
@@ -3227,7 +3227,7 @@ nsWindow::DispatchDragEvent(EventMessage aMsg, const nsIntPoint& aRefPoint,
|
||||
{
|
||||
WidgetDragEvent event(true, aMsg, this);
|
||||
|
||||
if (aMsg == NS_DRAGDROP_OVER) {
|
||||
if (aMsg == eDragOver) {
|
||||
InitDragEvent(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ nsBaseDragService::EndDragSession(bool aDoneDrag)
|
||||
mEndingSession = true;
|
||||
|
||||
if (aDoneDrag && !mSuppressLevel)
|
||||
FireDragEventAtSource(NS_DRAGDROP_END);
|
||||
FireDragEventAtSource(eDragEnd);
|
||||
|
||||
if (mDragPopup) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
@@ -409,7 +409,7 @@ nsBaseDragService::FireDragEventAtSource(uint32_t aMsg)
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetDragEvent event(true, static_cast<EventMessage>(aMsg), nullptr);
|
||||
event.inputSource = mInputSource;
|
||||
if (aMsg == NS_DRAGDROP_END) {
|
||||
if (aMsg == eDragEnd) {
|
||||
event.refPoint.x = mEndDragPoint.x;
|
||||
event.refPoint.y = mEndDragPoint.y;
|
||||
event.userCancelled = mUserCancelled;
|
||||
|
||||
@@ -2602,11 +2602,11 @@ case _value: eventName.AssignLiteral(_name) ; break
|
||||
switch(aGuiEvent->mMessage)
|
||||
{
|
||||
_ASSIGN_eventName(eBlur,"eBlur");
|
||||
_ASSIGN_eventName(NS_DRAGDROP_GESTURE,"NS_DND_GESTURE");
|
||||
_ASSIGN_eventName(eLegacyDragGesture,"eLegacyDragGesture");
|
||||
_ASSIGN_eventName(eDrop,"eDrop");
|
||||
_ASSIGN_eventName(NS_DRAGDROP_ENTER,"NS_DND_ENTER");
|
||||
_ASSIGN_eventName(NS_DRAGDROP_EXIT,"NS_DND_EXIT");
|
||||
_ASSIGN_eventName(NS_DRAGDROP_OVER,"NS_DND_OVER");
|
||||
_ASSIGN_eventName(eDragEnter,"eDragEnter");
|
||||
_ASSIGN_eventName(eDragExit,"eDragExit");
|
||||
_ASSIGN_eventName(eDragOver,"eDragOver");
|
||||
_ASSIGN_eventName(NS_EDITOR_INPUT,"NS_EDITOR_INPUT");
|
||||
_ASSIGN_eventName(eFocus,"eFocus");
|
||||
_ASSIGN_eventName(eFormSelect,"eFormSelect");
|
||||
@@ -2632,8 +2632,8 @@ case _value: eventName.AssignLiteral(_name) ; break
|
||||
_ASSIGN_eventName(eUnload,"eUnload");
|
||||
_ASSIGN_eventName(eHashChange,"eHashChange");
|
||||
_ASSIGN_eventName(eReadyStateChange,"eReadyStateChange");
|
||||
_ASSIGN_eventName(NS_XUL_BROADCAST, "NS_XUL_BROADCAST");
|
||||
_ASSIGN_eventName(NS_XUL_COMMAND_UPDATE, "NS_XUL_COMMAND_UPDATE");
|
||||
_ASSIGN_eventName(eXULBroadcast, "eXULBroadcast");
|
||||
_ASSIGN_eventName(eXULCommandUpdate, "eXULCommandUpdate");
|
||||
|
||||
#undef _ASSIGN_eventName
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ nsNativeDragTarget::DragEnter(LPDATAOBJECT pIDataSource,
|
||||
winDragService->SetIDataObject(pIDataSource);
|
||||
|
||||
// Now process the native drag state and then dispatch the event
|
||||
ProcessDrag(NS_DRAGDROP_ENTER, grfKeyState, ptl, pdwEffect);
|
||||
ProcessDrag(eDragEnter, grfKeyState, ptl, pdwEffect);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -340,9 +340,9 @@ nsNativeDragTarget::DragOver(DWORD grfKeyState,
|
||||
GetDropTargetHelper()->DragOver(&pt, *pdwEffect);
|
||||
}
|
||||
|
||||
mDragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
|
||||
mDragService->FireDragEventAtSource(eDrag);
|
||||
// Now process the native drag state and then dispatch the event
|
||||
ProcessDrag(NS_DRAGDROP_OVER, grfKeyState, ptl, pdwEffect);
|
||||
ProcessDrag(eDragOver, grfKeyState, ptl, pdwEffect);
|
||||
|
||||
this->Release();
|
||||
|
||||
@@ -362,7 +362,7 @@ nsNativeDragTarget::DragLeave()
|
||||
}
|
||||
|
||||
// dispatch the event into Gecko
|
||||
DispatchDragDropEvent(NS_DRAGDROP_EXIT, gDragLastPoint);
|
||||
DispatchDragDropEvent(eDragExit, gDragLastPoint);
|
||||
|
||||
nsCOMPtr<nsIDragSession> currentDragSession;
|
||||
mDragService->GetCurrentSession(getter_AddRefs(currentDragSession));
|
||||
|
||||
Reference in New Issue
Block a user