Ejemplo n.º 1
0
  public static void build(State s) {
    PROTOTYPE = new ObjectLabel(DOMObjects.MOUSE_EVENT_PROTOTYPE, ObjectLabel.Kind.OBJECT);
    INSTANCES = new ObjectLabel(DOMObjects.MOUSE_EVENT_INSTANCES, ObjectLabel.Kind.OBJECT);

    // Prototype object
    s.newObject(PROTOTYPE);
    s.writeInternalPrototype(PROTOTYPE, Value.makeObject(UIEvent.PROTOTYPE));

    // Multiplied object
    s.newObject(INSTANCES);
    s.writeInternalPrototype(INSTANCES, Value.makeObject(PROTOTYPE));

    /*
     * Properties.
     */
    createDOMProperty(s, INSTANCES, "screenX", Value.makeAnyNum().setReadOnly());
    createDOMProperty(s, INSTANCES, "screenY", Value.makeAnyNum().setReadOnly());
    createDOMProperty(s, INSTANCES, "clientX", Value.makeAnyNum().setReadOnly());
    createDOMProperty(s, INSTANCES, "clientY", Value.makeAnyNum().setReadOnly());
    createDOMProperty(s, INSTANCES, "ctrlKey", Value.makeAnyBool().setReadOnly());
    createDOMProperty(s, INSTANCES, "shiftKey", Value.makeAnyBool().setReadOnly());
    createDOMProperty(s, INSTANCES, "altKey", Value.makeAnyBool().setReadOnly());
    createDOMProperty(s, INSTANCES, "metaKey", Value.makeAnyBool().setReadOnly());
    createDOMProperty(s, INSTANCES, "button", Value.makeAnyNumUInt().setReadOnly());
    createDOMProperty(
        s, INSTANCES, "relatedTarget", DOMFunctions.makeAnyHTMLElement().setReadOnly());

    // DOM Level 0
    createDOMProperty(s, INSTANCES, "offsetX", Value.makeAnyNum().setReadOnly());
    createDOMProperty(s, INSTANCES, "offsetY", Value.makeAnyNum().setReadOnly());
    createDOMProperty(s, INSTANCES, "layerX", Value.makeAnyNum().setReadOnly());
    createDOMProperty(s, INSTANCES, "layerY", Value.makeAnyNum().setReadOnly());

    /*
     * Functions.
     */
    createDOMFunction(s, PROTOTYPE, DOMObjects.MOUSE_EVENT_INIT_MOUSE_EVENT, "initMouseEvent", 15);

    // Multiplied Object
    s.multiplyObject(INSTANCES);
    INSTANCES = INSTANCES.makeSingleton().makeSummary();

    // DOM Registry
    DOMRegistry.registerMouseEventLabel(INSTANCES);
  }
Ejemplo n.º 2
0
  public static void build(State s) {
    CONSTRUCTOR =
        new ObjectLabel(DOMObjects.HTMLBASEELEMENT_CONSTRUCTOR, ObjectLabel.Kind.FUNCTION);
    PROTOTYPE = new ObjectLabel(DOMObjects.HTMLBASEELEMENT_PROTOTYPE, ObjectLabel.Kind.OBJECT);
    INSTANCES = new ObjectLabel(DOMObjects.HTMLBASEELEMENT_INSTANCES, ObjectLabel.Kind.OBJECT);

    // Constructor Object
    s.newObject(CONSTRUCTOR);
    s.writePropertyWithAttributes(
        CONSTRUCTOR, "length", Value.makeNum(0).setAttributes(true, true, true));
    s.writePropertyWithAttributes(
        CONSTRUCTOR, "prototype", Value.makeObject(PROTOTYPE).setAttributes(true, true, true));
    s.writeInternalPrototype(CONSTRUCTOR, Value.makeObject(InitialStateBuilder.OBJECT_PROTOTYPE));
    s.writeProperty(DOMWindow.WINDOW, "HTMLBaseElement", Value.makeObject(CONSTRUCTOR));

    // Prototype Object
    s.newObject(PROTOTYPE);
    s.writeInternalPrototype(PROTOTYPE, Value.makeObject(HTMLElement.ELEMENT_PROTOTYPE));

    // Multiplied Object
    s.newObject(INSTANCES);
    s.writeInternalPrototype(INSTANCES, Value.makeObject(PROTOTYPE));

    /*
     * Properties.
     */
    // DOM LEVEL 1
    createDOMProperty(s, INSTANCES, "href", Value.makeAnyStr());
    createDOMProperty(s, INSTANCES, "target", Value.makeAnyStr());

    s.multiplyObject(INSTANCES);
    INSTANCES = INSTANCES.makeSingleton().makeSummary();

    /*
     * Functions.
     */
    // No functions.
  }