SVG Tiny 1.2 – 20081222

B IDL Definitions

This appendix is normative.

This appendix contains the complete IDL for the SVG uDOM.

The SVG uDOM IDL defines the model for the SVG UDOM. Note that the SVG uDOM IDL is defined such that some interfaces have more than one base class. The different standard language bindings for the SVG uDOM are responsible for defining how to map all aspects of the SVG uDOM into the given language, including how the language should implement interfaces with more than one base class.


module dom
{
    valuetype DOMString sequence<unsigned short>;
    typedef Object DOMObject;
    interface Node;
    interface Element;
    interface Document;

    exception DOMException
    {
        unsigned short code;
    };

    const unsigned short      INDEX_SIZE_ERR                 = 1;
    const unsigned short      DOMSTRING_SIZE_ERR             = 2;
    const unsigned short      HIERARCHY_REQUEST_ERR          = 3;
    const unsigned short      WRONG_DOCUMENT_ERR             = 4;
    const unsigned short      INVALID_CHARACTER_ERR          = 5;
    const unsigned short      NO_DATA_ALLOWED_ERR            = 6;
    const unsigned short      NO_MODIFICATION_ALLOWED_ERR    = 7;
    const unsigned short      NOT_FOUND_ERR                  = 8;
    const unsigned short      NOT_SUPPORTED_ERR              = 9;
    const unsigned short      INUSE_ATTRIBUTE_ERR            = 10;
    const unsigned short      INVALID_STATE_ERR              = 11;
    const unsigned short      SYNTAX_ERR                     = 12;
    const unsigned short      INVALID_MODIFICATION_ERR       = 13;
    const unsigned short      NAMESPACE_ERR                  = 14;
    const unsigned short      INVALID_ACCESS_ERR             = 15;
    const unsigned short      VALIDATION_ERR                 = 16;
    const unsigned short      TYPE_MISMATCH_ERR              = 17;

    interface Node
    {
        readonly attribute DOMString namespaceURI;
        readonly attribute DOMString localName;
        readonly attribute Node parentNode;
        readonly attribute Document ownerDocument;
        attribute DOMString textContent;
        Node appendChild(in Node newChild) 
		raises(DOMException);
        Node insertBefore(in Node newChild, in Node refChild) 
		raises(DOMException);
        Node removeChild(in Node oldChild) 
		raises(DOMException);
        Node cloneNode(in boolean deep);
    };

    interface Element : Node, ElementTraversal
    {
        DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName) 
		raises(DOMException);  
        void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, 
                            in DOMString value) 
		                            raises(DOMException);
        DOMString getAttribute(in DOMString name);
        void setAttribute(in DOMString name, in DOMString value) 
		raises(DOMException);
    };

    interface Document : Node
    {
        Element createElementNS(in DOMString namespaceURI, in DOMString qualifiedName) 
		raises(DOMException);
        readonly attribute Element documentElement;
        Element getElementById(in DOMString elementId);
    };

    interface ElementTraversal 
    {
        readonly attribute Element firstElementChild;
        readonly attribute Element lastElementChild;
        readonly attribute Element nextElementSibling;
        readonly attribute Element previousElementSibling;
        readonly attribute unsigned long childElementCount;
    };

    interface Location
    {  
        void assign(in DOMString iri);
        void reload();
    };

    interface Window
    {
        readonly attribute Window parent;
        readonly attribute Location location;
    };

};

module views
{
    interface DocumentView;

    interface AbstractView
    {
        readonly attribute DocumentView document;
    };

    interface DocumentView
    {
        readonly attribute AbstractView defaultView;
    };

};

module events
{
    typedef dom::DOMString DOMString;
    typedef dom::DOMException DOMException;
    typedef dom::Document Document;
    typedef dom::Element Element;
    interface EventTarget;
    interface EventListener;
    interface Event;    

    interface EventTarget
    {
        void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture);
        void removeEventListener(in DOMString type, in EventListener listener, 
                                 in boolean useCapture);
    };

    interface EventListener
    {
        void handleEvent(in Event evt);
    };

    interface Event
    {
        readonly attribute EventTarget target;
        readonly attribute EventTarget currentTarget;
        readonly attribute DOMString type;
        readonly attribute boolean cancelable;
        readonly attribute boolean defaultPrevented;
        void stopPropagation();
        void preventDefault();
    };    

    interface MouseEvent : UIEvent
    {        
        readonly attribute long screenX;        
        readonly attribute long screenY;        
        readonly attribute long clientX;        
        readonly attribute long clientY;        
        readonly attribute unsigned short button;    
    };

    interface MouseWheelEvent : MouseEvent     
    {        
        readonly attribute long wheelDelta;    
    };

    interface TextEvent : UIEvent    
    {        
        readonly attribute DOMString data;    
    };

    interface KeyboardEvent : UIEvent     
    {        
        readonly attribute DOMString keyIdentifier;
    };

    interface UIEvent : Event     
    {        
        readonly attribute long detail;    
    };

    interface ProgressEvent : Event     
    {        
        readonly attribute boolean lengthComputable;        
        readonly attribute unsigned long loaded;        
        readonly attribute unsigned long total;    
    };

};

module smil
{
    typedef events::Event Event;

    interface ElementTimeControl
    {
        void beginElementAt(in float offset);
        void beginElement();
        void endElementAt(in float offset);
        void endElement();
    };

    interface TimeEvent : Event     
    {        
        readonly attribute long detail;    
    };

};

module svg
{
    typedef dom::DOMString DOMString;
    typedef dom::DOMException DOMException;
    typedef dom::DOMObject DOMObject;    
    typedef dom::Document Document;
    typedef dom::Element Element;
    typedef dom::Node Node;
    typedef events::Event Event;
    typedef events::EventListener EventListener;
    typedef events::EventTarget EventTarget;
    interface SVGSVGElement;
    interface SVGRGBColor;
    interface SVGRect;
    interface SVGPoint;
    interface SVGPath;
    interface SVGMatrix;
    interface SVGLocatableElement;
    interface SVGElement;
    interface SVGTimedElement;
    interface SVGAnimationElement;
    interface SVGDocument;
    interface SVGGlobal;

    exception SVGException
    {
        unsigned short code;
    };

    const unsigned short SVG_WRONG_TYPE_ERR         = 0;
    const unsigned short SVG_INVALID_VALUE_ERR      = 1;
    const unsigned short SVG_MATRIX_NOT_INVERTABLE  = 2;

    interface SVGDocument : Document, EventTarget 
    {
    };

    interface SVGUseElement : SVGLocatableElement
    {
    };

    interface SVGElementInstance : EventTarget 
    {
        readonly attribute SVGElement correspondingElement;
        readonly attribute SVGUseElement correspondingUseElement;
    };

    interface SVGSVGElement : SVGLocatableElement, SVGTimedElement
    {
        const unsigned short NAV_AUTO           = 1; 
        const unsigned short NAV_NEXT           = 2; 
        const unsigned short NAV_PREV           = 3; 
        const unsigned short NAV_UP             = 4; 
        const unsigned short NAV_UP_RIGHT       = 5; 
        const unsigned short NAV_RIGHT          = 6; 
        const unsigned short NAV_DOWN_RIGHT     = 7;
        const unsigned short NAV_DOWN           = 8;
        const unsigned short NAV_DOWN_LEFT      = 9;
        const unsigned short NAV_LEFT           = 10;
        const unsigned short NAV_UP_LEFT        = 11;
        attribute float currentScale;
        attribute float currentRotate;
        readonly attribute SVGPoint currentTranslate;
        readonly attribute SVGRect viewport; 
        float getCurrentTime();
        void setCurrentTime(in float seconds);
        SVGMatrix createSVGMatrixComponents(in float a, in float b, in float c, in float d, 
                                            in float e, in float f);
        SVGRect createSVGRect();
        SVGPoint createSVGPoint();
        SVGPath createSVGPath();
        SVGRGBColor createSVGRGBColor(in float red, in float green, in float blue) 
		raises(SVGException);
        void moveFocus(in unsigned short motionType) 
		raises(DOMException);
        void setFocus(in EventTarget theObject) 
		raises(DOMException);
        EventTarget getCurrentFocusedObject();
    };

    interface SVGRGBColor
    {
        attribute unsigned long red;
        attribute unsigned long green;
        attribute unsigned long blue;
    };

    interface SVGRect
    {
        attribute float x;
        attribute float y;
        attribute float width;
        attribute float height;
    };

    interface SVGPoint
    {
        attribute float x;
        attribute float y;
        SVGPoint matrixTransform(in SVGMatrix matrix);
    };

    interface SVGPath
    {
        const unsigned short MOVE_TO = 77;
        const unsigned short LINE_TO = 76;
        const unsigned short CURVE_TO = 67;
        const unsigned short QUAD_TO = 81;
        const unsigned short CLOSE = 90;
        readonly attribute unsigned long numberOfSegments;
        unsigned short getSegment(in unsigned long cmdIndex) 
		raises(DOMException);
        float getSegmentParam(in unsigned long cmdIndex, in unsigned long paramIndex) 
		raises(DOMException);
        void moveTo(in float x, in float y);
        void lineTo(in float x, in float y);
        void quadTo(in float x1, in float y1, in float x2, in float y2);
        void curveTo(in float x1, in float y1, in float x2, in float y2, in float x3, in float y3);
        void close();
    };

    interface SVGMatrix
    {
        float getComponent(in unsigned long index) 
		raises(DOMException);
        SVGMatrix mMultiply(in SVGMatrix secondMatrix);
        SVGMatrix inverse() 
		raises(SVGException);
        SVGMatrix mTranslate(in float x, in float y);
        SVGMatrix mScale(in float scaleFactor);
        SVGMatrix mRotate(in float angle);
    };

    interface SVGLocatable
    { 
        SVGRect   getBBox();
        SVGMatrix getScreenCTM();
        SVGRect   getScreenBBox();
    };

    interface SVGLocatableElement : SVGElement, SVGLocatable
    {
    };

    interface TraitAccess
    {
        DOMString getTrait(in DOMString name) 
		raises(DOMException);
        DOMString getTraitNS(in DOMString namespaceURI, in DOMString name) 
		raises(DOMException);
        float getFloatTrait(in DOMString name) 
		raises(DOMException);
        sequence<float> getFloatListTrait(in DOMString name) 
		raises(DOMException);
        SVGMatrix getMatrixTrait(in DOMString name) 
		raises(DOMException);
        SVGRect getRectTrait(in DOMString name) 
		raises(DOMException);
        SVGPath getPathTrait(in DOMString name) 
		raises(DOMException);
        SVGRGBColor getRGBColorTrait(in DOMString name) 
		raises(DOMException);
        DOMString getPresentationTrait(in DOMString name) 
		raises(DOMException);
        DOMString getPresentationTraitNS(in DOMString namespaceURI, in DOMString name) 
		raises(DOMException);
        float getFloatPresentationTrait(in DOMString name) 
		raises(DOMException);
        sequence<float> getFloatListPresentationTrait(in DOMString name) 
		raises(DOMException);
        SVGMatrix getMatrixPresentationTrait(in DOMString name) 
		raises(DOMException);
        SVGRect getRectPresentationTrait(in DOMString name) 
		raises(DOMException);
        SVGPath getPathPresentationTrait(in DOMString name) 
		raises(DOMException);
        SVGRGBColor getRGBColorPresentationTrait(in DOMString name) 
		raises(DOMException);
        void setTrait(in DOMString name, in DOMString value) 
		raises(DOMException);
        void setTraitNS(in DOMString namespaceURI, in DOMString name, in DOMString value) 
		raises(DOMException);
        void setFloatTrait(in DOMString name, in float value) 
		raises(DOMException);
        void setFloatListTrait(in DOMString name, in sequence<float> value) 
		raises(DOMException);
        void setMatrixTrait(in DOMString name, in SVGMatrix matrix) 
		raises(DOMException);
        void setRectTrait(in DOMString name, in SVGRect rect) 
		raises(DOMException);
        void setPathTrait(in DOMString name, in SVGPath path) 
		raises(DOMException);
        void setRGBColorTrait(in DOMString name, in SVGRGBColor color) 
		raises(DOMException);
    };

    interface SVGElement : Element, EventTarget, TraitAccess
    {
        attribute DOMString id;
    };

    interface SVGTimedElement : SVGElement, smil::ElementTimeControl
    {
        void pauseElement();
        void resumeElement();
        readonly attribute boolean isPaused; 
    };

    interface SVGAnimationElement : SVGTimedElement
    {
    };

    interface SVGVisualMediaElement : SVGLocatableElement, SVGTimedElement 
    {
    };

    interface SVGTimer : events::EventTarget
    {
       attribute long delay;
       attribute long repeatInterval;
       readonly attribute boolean running;    
       void start();
       void stop();
    };

    interface SVGGlobal
    {
       SVGTimer createTimer(in long initialInterval, in long repeatInterval);
       void getURL(in DOMString iri, in AsyncStatusCallback callback);
       void postURL(in DOMString iri, in DOMString data, in AsyncStatusCallback callback, 
                    in DOMString type, in DOMString encoding);
       Node parseXML(in DOMString data, in Document contextDoc);
    };

    interface AsyncStatusCallback 
    {
        void operationComplete(in AsyncURLStatus status);
    };

    interface AsyncURLStatus 
    {
        readonly attribute boolean success;
        readonly attribute DOMString contentType;
        readonly attribute DOMString content;
    };

    interface EventListenerInitializer2
    {
        void initializeEventListeners(in Element scriptElement);
        EventListener createEventListener(in Element handlerElement);
    };

};