зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1110030 - part5 - Expose KeyboardEventInit dictionary. r=masayuki, r=smaug
This commit is contained in:
Родитель
c602eedc7e
Коммит
c2b718ebb8
|
@ -136,6 +136,41 @@ KeyboardEvent::GetCode(nsAString& aCodeName)
|
|||
mEvent->AsKeyboardEvent()->GetDOMCodeName(aCodeName);
|
||||
}
|
||||
|
||||
void KeyboardEvent::GetInitDict(KeyboardEventInit& aParam)
|
||||
{
|
||||
GetKey(aParam.mKey);
|
||||
GetCode(aParam.mCode);
|
||||
aParam.mLocation = Location();
|
||||
aParam.mRepeat = Repeat();
|
||||
aParam.mIsComposing = IsComposing();
|
||||
|
||||
// legacy attributes
|
||||
aParam.mKeyCode = KeyCode();
|
||||
aParam.mCharCode = CharCode();
|
||||
aParam.mWhich = Which();
|
||||
|
||||
// modifiers from EventModifierInit
|
||||
aParam.mCtrlKey = CtrlKey();
|
||||
aParam.mShiftKey = ShiftKey();
|
||||
aParam.mAltKey = AltKey();
|
||||
aParam.mMetaKey = MetaKey();
|
||||
|
||||
WidgetKeyboardEvent* internalEvent = mEvent->AsKeyboardEvent();
|
||||
aParam.mModifierAltGraph = internalEvent->IsAltGraph();
|
||||
aParam.mModifierCapsLock = internalEvent->IsCapsLocked();
|
||||
aParam.mModifierFn = internalEvent->IsFn();
|
||||
aParam.mModifierFnLock = internalEvent->IsFnLocked();
|
||||
aParam.mModifierNumLock = internalEvent->IsNumLocked();
|
||||
aParam.mModifierOS = internalEvent->IsOS();
|
||||
aParam.mModifierScrollLock = internalEvent->IsScrollLocked();
|
||||
aParam.mModifierSymbol = internalEvent->IsSymbol();
|
||||
aParam.mModifierSymbolLock = internalEvent->IsSymbolLocked();
|
||||
|
||||
// EventInit
|
||||
aParam.mBubbles = internalEvent->mFlags.mBubbles;
|
||||
aParam.mCancelable = internalEvent->mFlags.mCancelable;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
KeyboardEvent::GetCharCode(uint32_t* aCharCode)
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
uint32_t Location();
|
||||
|
||||
void GetCode(nsAString& aCode);
|
||||
void GetInitDict(KeyboardEventInit& aParam);
|
||||
|
||||
void InitKeyEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
|
||||
nsGlobalWindow* aView, bool aCtrlKey, bool aAltKey,
|
||||
|
|
|
@ -29,6 +29,11 @@ interface KeyboardEvent : UIEvent
|
|||
readonly attribute DOMString key;
|
||||
[Pref="dom.keyboardevent.code.enabled"]
|
||||
readonly attribute DOMString code;
|
||||
|
||||
// This returns the initialized dictionary for generating a
|
||||
// same-type keyboard event
|
||||
[Cached, ChromeOnly, Constant]
|
||||
readonly attribute KeyboardEventInit initDict;
|
||||
};
|
||||
|
||||
dictionary KeyboardEventInit : EventModifierInit
|
||||
|
|
Загрузка…
Ссылка в новой задаче