mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 01:57:00 +00:00
Bug 855110 - Paris binding for XULCommandEvent, r=peterv
--HG-- extra : rebase_source : cf971d766e2b07a56b0c8b79d1109f6d77eaad27
This commit is contained in:
parent
81fc5e8124
commit
894597f330
@ -20,6 +20,7 @@ nsDOMXULCommandEvent::nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
|
||||
@ -46,7 +47,7 @@ NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetAltKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = Event()->IsAlt();
|
||||
*aIsDown = AltKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -54,7 +55,7 @@ NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetCtrlKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = Event()->IsControl();
|
||||
*aIsDown = CtrlKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -62,7 +63,7 @@ NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetShiftKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = Event()->IsShift();
|
||||
*aIsDown = ShiftKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetMetaKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = Event()->IsMeta();
|
||||
*aIsDown = MetaKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -78,7 +79,7 @@ NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSourceEvent);
|
||||
NS_IF_ADDREF(*aSourceEvent = mSourceEvent);
|
||||
*aSourceEvent = GetSourceEvent().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "mozilla/dom/XULCommandEventBinding.h"
|
||||
|
||||
class nsDOMXULCommandEvent : public nsDOMUIEvent,
|
||||
public nsIDOMXULCommandEvent
|
||||
@ -26,6 +27,52 @@ public:
|
||||
// Forward our inherited virtual methods to the base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return mozilla::dom::XULCommandEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
bool AltKey()
|
||||
{
|
||||
return Event()->IsAlt();
|
||||
}
|
||||
|
||||
bool CtrlKey()
|
||||
{
|
||||
return Event()->IsControl();
|
||||
}
|
||||
|
||||
bool ShiftKey()
|
||||
{
|
||||
return Event()->IsShift();
|
||||
}
|
||||
|
||||
bool MetaKey()
|
||||
{
|
||||
return Event()->IsMeta();
|
||||
}
|
||||
|
||||
already_AddRefed<nsDOMEvent> GetSourceEvent()
|
||||
{
|
||||
nsRefPtr<nsDOMEvent> e =
|
||||
mSourceEvent ? mSourceEvent->InternalDOMEvent() : nullptr;
|
||||
return e.forget();
|
||||
}
|
||||
|
||||
void InitCommandEvent(const nsAString& aType,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
nsIDOMWindow* aView,
|
||||
int32_t aDetail,
|
||||
bool aCtrlKey, bool aAltKey,
|
||||
bool aShiftKey, bool aMetaKey,
|
||||
nsDOMEvent* aSourceEvent,
|
||||
mozilla::ErrorResult& aRv)
|
||||
{
|
||||
aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aView, aDetail,
|
||||
aCtrlKey, aAltKey, aShiftKey, aMetaKey,
|
||||
aSourceEvent);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Convenience accessor for the event
|
||||
nsInputEvent* Event() {
|
||||
|
@ -1115,6 +1115,10 @@ DOMInterfaces = {
|
||||
'headerFile': 'XULDocument.h'
|
||||
},
|
||||
|
||||
'XULCommandEvent': {
|
||||
'nativeType': 'nsDOMXULCommandEvent',
|
||||
},
|
||||
|
||||
'XULElement': {
|
||||
'nativeType': 'nsXULElement',
|
||||
'resultNotAddRefed': [ 'controllers', 'style' ]
|
||||
|
@ -284,6 +284,7 @@ webidl_files = \
|
||||
XMLSerializer.webidl \
|
||||
XMLStylesheetProcessingInstruction.webidl \
|
||||
XPathEvaluator.webidl \
|
||||
XULCommandEvent.webidl \
|
||||
XULDocument.webidl \
|
||||
XULElement.webidl \
|
||||
$(NULL)
|
||||
|
29
dom/webidl/XULCommandEvent.webidl
Normal file
29
dom/webidl/XULCommandEvent.webidl
Normal file
@ -0,0 +1,29 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
|
||||
interface WindowProxy;
|
||||
|
||||
interface XULCommandEvent : UIEvent
|
||||
{
|
||||
readonly attribute boolean ctrlKey;
|
||||
readonly attribute boolean shiftKey;
|
||||
readonly attribute boolean altKey;
|
||||
readonly attribute boolean metaKey;
|
||||
|
||||
readonly attribute Event? sourceEvent;
|
||||
|
||||
[Throws]
|
||||
void initCommandEvent(DOMString type,
|
||||
boolean canBubble,
|
||||
boolean cancelable,
|
||||
WindowProxy? view,
|
||||
long detail,
|
||||
boolean ctrlKey,
|
||||
boolean altKey,
|
||||
boolean shiftKey,
|
||||
boolean metaKey,
|
||||
Event? sourceEvent);
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user