mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-03 04:52:54 +00:00
Bug 920425 part.8 Use mozilla::WidgetEvent::AsClipboardEvent() r=smaug
This commit is contained in:
parent
d853b14747
commit
abc75d0db8
@ -32,14 +32,15 @@ NS_IMPL_ADDREF_INHERITED(nsDOMClipboardEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMClipboardEvent, nsDOMEvent)
|
||||
|
||||
nsresult
|
||||
nsDOMClipboardEvent::InitClipboardEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
|
||||
nsIDOMDataTransfer* clipboardData)
|
||||
nsDOMClipboardEvent::InitClipboardEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMDataTransfer* aClipboardData)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
InternalClipboardEvent* event = static_cast<InternalClipboardEvent*>(mEvent);
|
||||
event->clipboardData = clipboardData;
|
||||
mEvent->AsClipboardEvent()->clipboardData = aClipboardData;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -57,8 +58,7 @@ nsDOMClipboardEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
|
||||
nsRefPtr<nsDOMDataTransfer> clipboardData;
|
||||
if (e->mEventIsInternal) {
|
||||
InternalClipboardEvent* event =
|
||||
static_cast<InternalClipboardEvent*>(e->mEvent);
|
||||
InternalClipboardEvent* event = e->mEvent->AsClipboardEvent();
|
||||
if (event) {
|
||||
// Always create a clipboardData for the copy event. If this is changed to
|
||||
// support other types of events, make sure that read/write privileges are
|
||||
@ -84,7 +84,7 @@ nsDOMClipboardEvent::GetClipboardData(nsIDOMDataTransfer** aClipboardData)
|
||||
nsIDOMDataTransfer*
|
||||
nsDOMClipboardEvent::GetClipboardData()
|
||||
{
|
||||
InternalClipboardEvent* event = static_cast<InternalClipboardEvent*>(mEvent);
|
||||
InternalClipboardEvent* event = mEvent->AsClipboardEvent();
|
||||
|
||||
if (!event->clipboardData) {
|
||||
if (mEventIsInternal) {
|
||||
|
@ -152,8 +152,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
|
||||
nullptr;
|
||||
break;
|
||||
case NS_CLIPBOARD_EVENT:
|
||||
static_cast<InternalClipboardEvent*>(tmp->mEvent)->clipboardData =
|
||||
nullptr;
|
||||
tmp->mEvent->AsClipboardEvent()->clipboardData = nullptr;
|
||||
break;
|
||||
case NS_MUTATION_EVENT:
|
||||
static_cast<InternalMutationEvent*>(tmp->mEvent)->mRelatedNode =
|
||||
@ -196,8 +195,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
|
||||
break;
|
||||
case NS_CLIPBOARD_EVENT:
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->clipboardData");
|
||||
cb.NoteXPCOMChild(
|
||||
static_cast<InternalClipboardEvent*>(tmp->mEvent)->clipboardData);
|
||||
cb.NoteXPCOMChild(tmp->mEvent->AsClipboardEvent()->clipboardData);
|
||||
break;
|
||||
case NS_MUTATION_EVENT:
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedNode");
|
||||
@ -567,8 +565,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_CLIPBOARD_EVENT:
|
||||
{
|
||||
InternalClipboardEvent* oldClipboardEvent =
|
||||
static_cast<InternalClipboardEvent*>(mEvent);
|
||||
InternalClipboardEvent* oldClipboardEvent = mEvent->AsClipboardEvent();
|
||||
InternalClipboardEvent* clipboardEvent =
|
||||
new InternalClipboardEvent(false, msg);
|
||||
clipboardEvent->AssignClipboardEventData(*oldClipboardEvent, true);
|
||||
|
@ -728,7 +728,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
static_cast<WidgetTextEvent*>(aEvent));
|
||||
case NS_CLIPBOARD_EVENT:
|
||||
return NS_NewDOMClipboardEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<InternalClipboardEvent*>(aEvent));
|
||||
aEvent->AsClipboardEvent());
|
||||
case NS_SVGZOOM_EVENT:
|
||||
return NS_NewDOMSVGZoomEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aEvent));
|
||||
|
Loading…
x
Reference in New Issue
Block a user