diff options
Diffstat (limited to 'Source/WebCore/dom/KeyboardEvent.idl')
-rw-r--r-- | Source/WebCore/dom/KeyboardEvent.idl | 126 |
1 files changed, 42 insertions, 84 deletions
diff --git a/Source/WebCore/dom/KeyboardEvent.idl b/Source/WebCore/dom/KeyboardEvent.idl index a42059a5c..757c07793 100644 --- a/Source/WebCore/dom/KeyboardEvent.idl +++ b/Source/WebCore/dom/KeyboardEvent.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006 Apple Inc. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -19,97 +19,55 @@ */ [ - ConstructorConditional=DOM4_EVENTS_CONSTRUCTOR, - ConstructorTemplate=Event, + Constructor(DOMString type, optional KeyboardEventInit eventInitDict), ] interface KeyboardEvent : UIEvent { -#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - // KeyLocationCode - const unsigned long KEY_LOCATION_STANDARD = 0x00; - const unsigned long KEY_LOCATION_LEFT = 0x01; - const unsigned long KEY_LOCATION_RIGHT = 0x02; - const unsigned long KEY_LOCATION_NUMPAD = 0x03; -#endif - -#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; - const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; - const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; - const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; - // FIXME: The following constants are defined in the specification but - // not yet supported. - // const unsigned long DOM_KEY_LOCATION_MOBILE = 0x04; - // const unsigned long DOM_KEY_LOCATION_JOYSTICK = 0x05; -#endif - - [InitializedByEventConstructor] readonly attribute DOMString keyIdentifier; - [InitializedByEventConstructor] readonly attribute unsigned long location; - [InitializedByEventConstructor, ImplementedAs=location] readonly attribute unsigned long keyLocation; // Deprecated. - [InitializedByEventConstructor] readonly attribute boolean ctrlKey; - [InitializedByEventConstructor] readonly attribute boolean shiftKey; - [InitializedByEventConstructor] readonly attribute boolean altKey; - [InitializedByEventConstructor] readonly attribute boolean metaKey; - readonly attribute boolean altGraphKey; + const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; + const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; + const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; -#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - boolean getModifierState([Default=Undefined] optional DOMString keyIdentifierArg); -#endif + [Conditional=KEYBOARD_KEY_ATTRIBUTE] readonly attribute DOMString key; + [Conditional=KEYBOARD_CODE_ATTRIBUTE] readonly attribute DOMString code; + readonly attribute unsigned long location; - // FIXME: this does not match the version in the DOM spec. - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long location, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey, - [Default=Undefined] optional boolean altGraphKey); + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + readonly attribute boolean altKey; + readonly attribute boolean metaKey; + readonly attribute boolean repeat; - // WebKit Extensions -#if (!defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT) && (!defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT) - readonly attribute long keyCode; - readonly attribute long charCode; - - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long location, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); -#endif + readonly attribute boolean isComposing; -#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // For backward compatibility. - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long keyLocation, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey, - [Default=Undefined] optional boolean altGraphKey); + boolean getModifierState(DOMString keyArg); - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long keyLocation, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); -#endif + // Everything below is legacy. + readonly attribute DOMString keyIdentifier; + [ImplementedAs=location] readonly attribute unsigned long keyLocation; + readonly attribute boolean altGraphKey; + readonly attribute unsigned long charCode; + readonly attribute unsigned long keyCode; + readonly attribute unsigned long which; + // FIXME: this does not match the version in the DOM spec. + // FIXME: Using "undefined" as default parameter value is wrong. + void initKeyboardEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false, + optional DOMWindow? view = null, optional DOMString keyIdentifier = "undefined", optional unsigned long location = 0, + optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false, optional boolean altGraphKey = false); }; +dictionary KeyboardEventInit : EventModifierInit { + DOMString key = ""; + DOMString code = ""; + unsigned long location = 0; + boolean repeat = false; + boolean isComposing = false; + + // This members are not in the specification but are needed to initialize the corresponding legacy + // attributes we still support on KeyboardEvent for backward compatibility. + DOMString keyIdentifier = ""; + unsigned long keyLocation; + unsigned long charCode = 0; + unsigned long keyCode = 0; + unsigned long which = 0; +}; |