2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2006-12-01 14:09:53 +03:00
|
|
|
|
2014-02-26 09:23:57 +04:00
|
|
|
#include "mozilla/dom/CommandEvent.h"
|
2013-09-25 15:21:20 +04:00
|
|
|
#include "mozilla/MiscEvents.h"
|
2014-02-26 09:23:57 +04:00
|
|
|
#include "prtime.h"
|
2006-12-01 14:09:53 +03:00
|
|
|
|
2014-02-26 09:23:57 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-09-27 10:20:54 +04:00
|
|
|
|
2014-02-26 09:23:57 +04:00
|
|
|
CommandEvent::CommandEvent(EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
WidgetCommandEvent* aEvent)
|
2014-03-05 04:37:43 +04:00
|
|
|
: Event(aOwner, aPresContext,
|
2018-07-30 15:20:47 +03:00
|
|
|
aEvent ? aEvent : new WidgetCommandEvent())
|
2006-12-01 14:09:53 +03:00
|
|
|
{
|
2016-03-28 07:29:42 +03:00
|
|
|
mEvent->mTime = PR_Now();
|
2006-12-01 14:09:53 +03:00
|
|
|
if (aEvent) {
|
2011-10-17 18:59:28 +04:00
|
|
|
mEventIsInternal = false;
|
2006-12-01 14:09:53 +03:00
|
|
|
} else {
|
2011-10-17 18:59:28 +04:00
|
|
|
mEventIsInternal = true;
|
2006-12-01 14:09:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-09 19:17:08 +03:00
|
|
|
void
|
2014-02-26 09:23:57 +04:00
|
|
|
CommandEvent::GetCommand(nsAString& aCommand)
|
2006-12-01 14:09:53 +03:00
|
|
|
{
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* command = mEvent->AsCommandEvent()->mCommand;
|
2006-12-01 14:09:53 +03:00
|
|
|
if (command) {
|
|
|
|
command->ToString(aCommand);
|
|
|
|
} else {
|
|
|
|
aCommand.Truncate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-26 09:23:57 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2006-12-01 14:09:53 +03:00
|
|
|
|
2014-02-26 09:23:57 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
2015-08-12 14:39:31 +03:00
|
|
|
already_AddRefed<CommandEvent>
|
|
|
|
NS_NewDOMCommandEvent(EventTarget* aOwner,
|
2014-02-26 09:23:57 +04:00
|
|
|
nsPresContext* aPresContext,
|
|
|
|
WidgetCommandEvent* aEvent)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CommandEvent> it =
|
2015-08-12 14:39:31 +03:00
|
|
|
new CommandEvent(aOwner, aPresContext, aEvent);
|
|
|
|
return it.forget();
|
2006-12-01 14:09:53 +03:00
|
|
|
}
|