2015-05-03 19:32:37 +00: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 11:12:37 +00: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-05-22 20:37:32 +00:00
|
|
|
|
|
|
|
// This class implements a XUL "command" event. See nsIDOMXULCommandEvent.idl
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
#ifndef mozilla_dom_XULCommandEvent_h_
|
|
|
|
#define mozilla_dom_XULCommandEvent_h_
|
2006-05-22 20:37:32 +00:00
|
|
|
|
2014-02-28 14:58:43 +00:00
|
|
|
#include "mozilla/dom/UIEvent.h"
|
2013-03-28 14:19:10 +00:00
|
|
|
#include "mozilla/dom/XULCommandEventBinding.h"
|
2014-02-28 14:58:43 +00:00
|
|
|
#include "nsIDOMXULCommandEvent.h"
|
2006-05-22 20:37:32 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-02-28 14:58:43 +00:00
|
|
|
class XULCommandEvent : public UIEvent,
|
2014-02-28 14:58:42 +00:00
|
|
|
public nsIDOMXULCommandEvent
|
2006-05-22 20:37:32 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-02-28 14:58:42 +00:00
|
|
|
XULCommandEvent(EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
WidgetInputEvent* aEvent);
|
2006-05-22 20:37:32 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2014-02-28 14:58:43 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, UIEvent)
|
2006-05-22 20:37:32 +00:00
|
|
|
NS_DECL_NSIDOMXULCOMMANDEVENT
|
|
|
|
|
|
|
|
// Forward our inherited virtual methods to the base class
|
2014-02-28 14:58:43 +00:00
|
|
|
NS_FORWARD_TO_UIEVENT
|
2006-05-22 20:37:32 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
|
2013-03-28 14:19:10 +00:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
return XULCommandEventBinding::Wrap(aCx, this, aGivenProto);
|
2013-03-28 14:19:10 +00:00
|
|
|
}
|
|
|
|
|
2013-10-18 06:10:26 +00:00
|
|
|
bool AltKey();
|
|
|
|
bool CtrlKey();
|
|
|
|
bool ShiftKey();
|
|
|
|
bool MetaKey();
|
2013-03-28 14:19:10 +00:00
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
already_AddRefed<Event> GetSourceEvent()
|
2013-03-28 14:19:10 +00:00
|
|
|
{
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<Event> e =
|
2013-03-28 14:19:10 +00:00
|
|
|
mSourceEvent ? mSourceEvent->InternalDOMEvent() : nullptr;
|
|
|
|
return e.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitCommandEvent(const nsAString& aType,
|
|
|
|
bool aCanBubble, bool aCancelable,
|
2016-01-30 17:05:36 +00:00
|
|
|
nsGlobalWindow* aView,
|
2013-03-28 14:19:10 +00:00
|
|
|
int32_t aDetail,
|
|
|
|
bool aCtrlKey, bool aAltKey,
|
|
|
|
bool aShiftKey, bool aMetaKey,
|
2016-01-30 17:05:36 +00:00
|
|
|
Event* aSourceEvent)
|
2013-03-28 14:19:10 +00:00
|
|
|
{
|
2016-01-30 17:05:36 +00:00
|
|
|
InitCommandEvent(aType, aCanBubble, aCancelable, aView->AsInner(),
|
|
|
|
aDetail, aCtrlKey, aAltKey, aShiftKey, aMetaKey,
|
|
|
|
aSourceEvent);
|
2013-03-28 14:19:10 +00:00
|
|
|
}
|
|
|
|
|
2009-06-30 07:56:40 +00:00
|
|
|
protected:
|
2014-07-08 21:23:17 +00:00
|
|
|
~XULCommandEvent() {}
|
|
|
|
|
2009-06-30 07:56:40 +00:00
|
|
|
nsCOMPtr<nsIDOMEvent> mSourceEvent;
|
2006-05-22 20:37:32 +00:00
|
|
|
};
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-08-12 11:39:31 +00:00
|
|
|
already_AddRefed<mozilla::dom::XULCommandEvent>
|
|
|
|
NS_NewDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
mozilla::WidgetInputEvent* aEvent);
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
#endif // mozilla_dom_XULCommandEvent_h_
|