mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 948839 Mark special flag of drag over event true if it's consumed on content r=smaug
This commit is contained in:
parent
8afc2e31c5
commit
d8d7cbc27d
@ -487,6 +487,27 @@ nsDOMEvent::PreventDefaultInternal(bool aCalledByDefaultHandler)
|
||||
if (!aCalledByDefaultHandler) {
|
||||
mEvent->mFlags.mDefaultPreventedByContent = true;
|
||||
}
|
||||
|
||||
if (!IsTrusted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WidgetDragEvent* dragEvent = mEvent->AsDragEvent();
|
||||
if (!dragEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(mEvent->currentTarget);
|
||||
if (!node) {
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mEvent->currentTarget);
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
node = win->GetExtantDoc();
|
||||
}
|
||||
if (!nsContentUtils::IsChromeDoc(node->OwnerDoc())) {
|
||||
dragEvent->mDefaultPreventedOnContent = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3571,9 +3571,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
// For now, do this only for dragover.
|
||||
//XXXsmaug dragenter needs some more work.
|
||||
if (aEvent->message == NS_DRAGDROP_OVER && !isChromeDoc) {
|
||||
// Someone has called preventDefault(), check whether is was content.
|
||||
// Someone has called preventDefault(), check whether is was on
|
||||
// content or chrome.
|
||||
dragSession->SetOnlyChromeDrop(
|
||||
!aEvent->mFlags.mDefaultPreventedByContent);
|
||||
!dragEvent->mDefaultPreventedOnContent);
|
||||
}
|
||||
} else if (aEvent->message == NS_DRAGDROP_OVER && !isChromeDoc) {
|
||||
// No one called preventDefault(), so handle drop only in chrome.
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
|
||||
WidgetDragEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget) :
|
||||
WidgetMouseEvent(aIsTrusted, aMessage, aWidget, NS_DRAG_EVENT, eReal),
|
||||
userCancelled(false)
|
||||
userCancelled(false), mDefaultPreventedOnContent(false)
|
||||
{
|
||||
mFlags.mCancelable =
|
||||
(aMessage != NS_DRAGDROP_EXIT_SYNTH &&
|
||||
@ -263,6 +263,8 @@ public:
|
||||
|
||||
// If this is true, user has cancelled the drag operation.
|
||||
bool userCancelled;
|
||||
// If this is true, the drag event's preventDefault() is called on content.
|
||||
bool mDefaultPreventedOnContent;
|
||||
|
||||
// XXX Not tested by test_assign_event_data.html
|
||||
void AssignDragEventData(const WidgetDragEvent& aEvent, bool aCopyTargets)
|
||||
@ -272,6 +274,7 @@ public:
|
||||
dataTransfer = aEvent.dataTransfer;
|
||||
// XXX userCancelled isn't copied, is this instentionally?
|
||||
userCancelled = false;
|
||||
mDefaultPreventedOnContent = aEvent.mDefaultPreventedOnContent;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user