public static Value evaluate( DOMObjects nativeObject, FunctionCalls.CallInfo call, State s, Solver.SolverInterface c) { switch (nativeObject) { case MOUSE_EVENT_INIT_MOUSE_EVENT: { NativeFunctions.expectParameters(nativeObject, call, c, 15, 15); /* Value typeArg =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); /* Value canBubbleArg =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 1)); /* Value cancelableArg =*/ Conversion.toBoolean( NativeFunctions.readParameter(call, s, 2)); // View arg not checked /* Value detailArg =*/ Conversion.toNumber(NativeFunctions.readParameter(call, s, 4), c); /* Value screenXArg =*/ Conversion.toNumber(NativeFunctions.readParameter(call, s, 5), c); /* Value screenYArg =*/ Conversion.toNumber(NativeFunctions.readParameter(call, s, 6), c); /* Value clientXArg =*/ Conversion.toNumber(NativeFunctions.readParameter(call, s, 7), c); /* Value clientYArg =*/ Conversion.toNumber(NativeFunctions.readParameter(call, s, 8), c); /* Value ctrlKeyArg =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 9)); /* Value altKeyArg =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 10)); /* Value shiftKeyArg =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 11)); /* Value metaKeyArg =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 12)); /* Value buttonArg =*/ Conversion.toNumber(NativeFunctions.readParameter(call, s, 13), c); /* Value relatedTargetArg =*/ DOMConversion.toEventTarget( NativeFunctions.readParameter(call, s, 14), c); return Value.makeUndef(); } default: throw new UnsupportedOperationException("Unsupported Native Object: " + nativeObject); } }
/** Transfer Functions. */ public static Value evaluate(DOMObjects nativeObject, CallInfo call, Solver.SolverInterface c) { State s = c.getState(); switch (nativeObject) { case ELEMENT_GET_ATTRIBUTE: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); return Value.makeAnyStr(); } case ELEMENT_SET_ATTRIBUTE: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); /* Value value =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); return Value.makeUndef(); } case ELEMENT_REMOVE_ATTRIBUTE: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); return Value.makeUndef(); } case ELEMENT_GET_ATTRIBUTE_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value namespace =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); return Value.makeAnyStr(); } case ELEMENT_GET_ATTRIBUTE_NODE: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); return Value.makeObject(DOMAttr.INSTANCES); } case ELEMENT_GET_ATTRIBUTE_NODE_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value namespace =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); return Value.makeObject(DOMAttr.INSTANCES); } case ELEMENT_GET_BOUNDING_CLIENT_RECT: { NativeFunctions.expectParameters(nativeObject, call, c, 0, 0); return Value.makeObject(ClientBoundingRect.INSTANCES); } case ELEMENT_GET_ELEMENTS_BY_TAGNAME: { // TODO: needs precision, but cannot do like document.getElementsByTagName() bc. State is // for everything NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); return Value.makeObject(DOMNodeList.INSTANCES); } case ELEMENT_GET_ELEMENTS_BY_TAGNAME_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value namespace =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); return Value.makeObject(DOMNodeList.INSTANCES); } case ELEMENT_HAS_ATTRIBUTE: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); return Value.makeAnyBool(); } case ELEMENT_HAS_ATTRIBUTE_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value namespace =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); return Value.makeAnyBool(); } case ELEMENT_REMOVE_ATTRIBUTE_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value namespaceURI =*/ Conversion.toString( NativeFunctions.readParameter(call, s, 0), c); /* Value localName =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); return Value.makeUndef(); } case ELEMENT_REMOVE_ATTRIBUTE_NODE: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); return DOMConversion.toAttr(NativeFunctions.readParameter(call, s, 0), c); } case ELEMENT_SET_ATTRIBUTE_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 3, 3); /* Value namespace =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c) .joinNull(); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); /* Value value =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 2), c); return Value.makeUndef(); } case ELEMENT_SET_ATTRIBUTE_NODE: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); /* Value newAttr =*/ DOMConversion.toAttr(NativeFunctions.readParameter(call, s, 0), c); return Value.makeObject(DOMAttr.INSTANCES).joinNull(); } case ELEMENT_SET_ATTRIBUTE_NODE_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); /* Value newAttr =*/ DOMConversion.toAttr(NativeFunctions.readParameter(call, s, 0), c); return Value.makeObject(DOMAttr.INSTANCES).joinNull(); } case ELEMENT_SET_ID_ATTRIBUTE: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value name =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 0), c); /* Value isId =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 1)); return Value.makeUndef(); } case ELEMENT_SET_ID_ATTRIBUTE_NS: { NativeFunctions.expectParameters(nativeObject, call, c, 3, 3); /* Value namespaceURI =*/ Conversion.toString( NativeFunctions.readParameter(call, s, 0), c); /* Value localName =*/ Conversion.toString(NativeFunctions.readParameter(call, s, 1), c); /* Value isId =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 2)); return Value.makeUndef(); } case ELEMENT_SET_ID_ATTRIBUTE_NODE: { NativeFunctions.expectParameters(nativeObject, call, c, 2, 2); /* Value idAttr =*/ DOMConversion.toAttr(NativeFunctions.readParameter(call, s, 0), c); /* Value isId =*/ Conversion.toBoolean(NativeFunctions.readParameter(call, s, 1)); return Value.makeUndef(); } case ELEMENT_QUERY_SELECTOR_ALL: { NativeFunctions.expectParameters(nativeObject, call, c, 1, 1); return Value.makeObject(DOMNodeList.INSTANCES); } default: { throw new AnalysisException("Unknown Native Object: " + nativeObject); } } }