diff --git a/jso/apis/src/main/java/org/teavm/jso/browser/Window.java b/jso/apis/src/main/java/org/teavm/jso/browser/Window.java index 2c2dad463..fb87f1e71 100644 --- a/jso/apis/src/main/java/org/teavm/jso/browser/Window.java +++ b/jso/apis/src/main/java/org/teavm/jso/browser/Window.java @@ -181,4 +181,7 @@ public abstract class Window implements JSObject, WindowEventTarget, StorageProv @JSBody(params = "uri", script = "return decodeURIComponent(uri);") public static native String decodeURIComponent(String uri); + + @JSProperty + public abstract double getDevicePixelRatio(); } diff --git a/jso/apis/src/main/java/org/teavm/jso/core/JSArrayReader.java b/jso/apis/src/main/java/org/teavm/jso/core/JSArrayReader.java index 15652d55d..5291de9a6 100644 --- a/jso/apis/src/main/java/org/teavm/jso/core/JSArrayReader.java +++ b/jso/apis/src/main/java/org/teavm/jso/core/JSArrayReader.java @@ -19,11 +19,6 @@ import org.teavm.jso.JSIndexer; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; -/** - * - * @author Alexey Andreev - * @param - */ public interface JSArrayReader extends JSObject { @JSProperty int getLength(); diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLDocument.java b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLDocument.java index 3f90b2830..43cbe816c 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLDocument.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLDocument.java @@ -43,7 +43,7 @@ public interface HTMLDocument extends Document, EventTarget { HTMLBodyElement getBody(); @JSProperty - HTMLElement getHead(); + HTMLHeadElement getHead(); @JSProperty int getScrollLeft(); @@ -60,4 +60,17 @@ public interface HTMLDocument extends Document, EventTarget { @Override NodeList querySelectorAll(String selectors); + + @JSProperty + HTMLElement getActiveElement(); + + @JSProperty + boolean isDesignMode(); + + @JSProperty + void setDesignMode(boolean value); + + void execCommand(String commandName, boolean showDefaultUI, String valueArgument); + + void execCommand(String commandName); } diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLFormElement.java b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLFormElement.java new file mode 100644 index 000000000..863527006 --- /dev/null +++ b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLFormElement.java @@ -0,0 +1,90 @@ +/* + * Copyright 2018 Alexey Andreev. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.jso.dom.html; + +import org.teavm.jso.JSIndexer; +import org.teavm.jso.JSProperty; + +public interface HTMLFormElement extends HTMLElement { + @JSProperty + String getAcceptCharset(); + + @JSProperty + void setAcceptCharset(String value); + + @JSProperty + String getAction(); + + @JSProperty + void setAction(String value); + + @JSProperty + String getAutocomplete(); + + @JSProperty + void setAutocomplete(String value); + + @JSProperty + String getEnctype(); + + @JSProperty + void setEnctype(String enctype); + + @JSProperty + String getEncoding(); + + @JSProperty + void setEncoding(String value); + + @JSProperty + String getMethod(); + + @JSProperty + void setMethod(String value); + + @JSProperty + String getName(); + + @JSProperty + void setName(String name); + + @JSProperty + boolean isNoValidate(); + + @JSProperty + void setNoValidate(boolean value); + + @JSProperty + String getTarget(); + + @JSProperty + void setTarget(String value); + + @JSIndexer + HTMLElement get(String name); + + @JSIndexer + HTMLElement get(int index); + + @JSProperty + int getLength(); + + void submit(); + + void reset(); + + boolean checkValidity(); +} diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLInputElement.java b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLInputElement.java index 6a4050805..0caf32df9 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLInputElement.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLInputElement.java @@ -65,4 +65,6 @@ public interface HTMLInputElement extends HTMLElement { @JSProperty void setValue(String value); + + void select(); } diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLTextAreaElement.java b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLTextAreaElement.java new file mode 100644 index 000000000..898382917 --- /dev/null +++ b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLTextAreaElement.java @@ -0,0 +1,144 @@ +/* + * Copyright 2018 Alexey Andreev. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.jso.dom.html; + +import org.teavm.jso.JSProperty; + +public interface HTMLTextAreaElement extends HTMLElement { + @JSProperty + String getAutocomplete(); + + @JSProperty + void setAutocomplete(String value); + + @JSProperty + boolean isAutofocus(); + + @JSProperty + void setAutofocus(boolean value); + + @JSProperty + int getCols(); + + @JSProperty + void setCols(int cols); + + @JSProperty + String getDirName(); + + @JSProperty + void setDirName(String value); + + @JSProperty + boolean isDisabled(); + + @JSProperty + void setDisabled(boolean value); + + @JSProperty + HTMLFormElement getForm(); + + @JSProperty + int getMaxLength(); + + @JSProperty + void setMaxLength(int value); + + @JSProperty + int getMinLength(); + + @JSProperty + void setMinLength(int value); + + @JSProperty + String getName(); + + @JSProperty + void setName(String value); + + @JSProperty + String getPlaceholder(); + + @JSProperty + void setPlaceholder(String value); + + @JSProperty + boolean isReadOnly(); + + @JSProperty + void setReadOnly(boolean value); + + @JSProperty + int getRows(); + + @JSProperty + void setRows(int rows); + + @JSProperty + String getWrap(); + + @JSProperty + void setWrap(String value); + + @JSProperty + String getType(); + + @JSProperty + String getDefaultValue(); + + @JSProperty + void setDefaultValue(String value); + + @JSProperty + String getValue(); + + @JSProperty + void setValue(String value); + + @JSProperty + int getTextLength(); + + + void select(); + + @JSProperty + int getSelectionStart(); + + @JSProperty + void setSelectionStart(int value); + + @JSProperty + int getSelectionEnd(); + + @JSProperty + void setSelectionEnd(int value); + + @JSProperty + String getSelectionDirection(); + + @JSProperty + void setSelectionDirection(String value); + + void setRangeText(String replacement); + + void setRangeText(String replacement, int start, int end, String selectionMode); + + void setRangeText(String replacement, int start, int end); + + void setSelectionRange(int start, int end, String direction); + + void setSelectionRange(int start, int end); +} diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/ArrayBufferView.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/ArrayBufferView.java index 9810293b2..76921ec5c 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/ArrayBufferView.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/ArrayBufferView.java @@ -15,8 +15,10 @@ */ package org.teavm.jso.typedarrays; +import org.teavm.jso.JSByRef; import org.teavm.jso.JSObject; import org.teavm.jso.JSProperty; +import org.teavm.jso.core.JSArrayReader; public abstract class ArrayBufferView implements JSObject { protected ArrayBufferView() { @@ -28,6 +30,37 @@ public abstract class ArrayBufferView implements JSObject { @JSProperty public abstract int getByteLength(); + @JSProperty + public abstract int getByteOffset(); + @JSProperty public abstract ArrayBuffer getBuffer(); + + public abstract void set(ArrayBufferView other, int offset); + + public abstract void set(ArrayBufferView other); + + public abstract void set(JSArrayReader other, int offset); + + public abstract void set(JSArrayReader other); + + public abstract void set(@JSByRef byte[] other, int offset); + + public abstract void set(@JSByRef byte[] other); + + public abstract void set(@JSByRef short[] other, int offset); + + public abstract void set(@JSByRef short[] other); + + public abstract void set(@JSByRef int[] other, int offset); + + public abstract void set(@JSByRef int[] other); + + public abstract void set(@JSByRef float[] other, int offset); + + public abstract void set(@JSByRef float[] other); + + public abstract void set(@JSByRef double[] other, int offset); + + public abstract void set(@JSByRef double[] other); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/DataView.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/DataView.java index a87524b92..dd851a37f 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/DataView.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/DataView.java @@ -20,23 +20,23 @@ import org.teavm.jso.JSBody; public abstract class DataView extends ArrayBufferView { public abstract byte getInt8(int byteOffset); - public abstract short getUInt8(int byteOffset); + public abstract short getUint8(int byteOffset); public abstract short getInt16(int byteOffset); public abstract short getInt16(int byteOffset, boolean littleEndian); - public abstract int getUInt16(int byteOffset); + public abstract int getUint16(int byteOffset); - public abstract int getUInt16(int byteOffset, boolean littleEndian); + public abstract int getUint16(int byteOffset, boolean littleEndian); public abstract int getInt32(int byteOffset); public abstract int getInt32(int byteOffset, boolean littleEndian); - public abstract int getUInt32(int byteOffset); + public abstract int getUint32(int byteOffset); - public abstract int getUInt32(int byteOffset, boolean littleEndian); + public abstract int getUint32(int byteOffset, boolean littleEndian); public abstract float getFloat32(int byteOffset); @@ -48,23 +48,23 @@ public abstract class DataView extends ArrayBufferView { public abstract void setInt8(int byteOffset, int value); - public abstract void setUInt8(int byteOffset, int value); + public abstract void setUint8(int byteOffset, int value); public abstract void setInt16(int byteOffset, int value); public abstract void setInt16(int byteOffset, int value, boolean littleEndian); - public abstract void setUInt16(int byteOffset, int value); + public abstract void setUint16(int byteOffset, int value); - public abstract void setUInt16(int byteOffset, int value, boolean littleEndian); + public abstract void setUint16(int byteOffset, int value, boolean littleEndian); public abstract void setInt32(int byteOffset, int value); public abstract void setInt32(int byteOffset, int value, boolean littleEndian); - public abstract void setUInt32(int byteOffset, int value); + public abstract void setUint32(int byteOffset, int value); - public abstract void setUInt32(int byteOffset, int value, boolean littleEndian); + public abstract void setUint32(int byteOffset, int value, boolean littleEndian); public abstract void setFloat32(int byteOffset, float value); @@ -77,6 +77,12 @@ public abstract class DataView extends ArrayBufferView { @JSBody(params = "buffer", script = "return new DataView(buffer);") public static native DataView create(ArrayBuffer buffer); - @JSBody(params = {"buffer", "offset", "length"}, script = "return new DataView(buffer, offset, length);") + @JSBody(params = "buffer", script = "return new DataView(buffer);") + public static native DataView create(ArrayBufferView buffer); + + @JSBody(params = { "buffer", "offset", "length" }, script = "return new DataView(buffer, offset, length);") public static native DataView create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new DataView(buffer, offset);") + public static native DataView create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float32Array.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float32Array.java index bd8ab94e1..64647df3a 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float32Array.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float32Array.java @@ -31,6 +31,12 @@ public abstract class Float32Array extends ArrayBufferView { @JSBody(params = "buffer", script = "return new Float32Array(buffer);") public static native Float32Array create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Float32Array(buffer);") + public static native Float32Array create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new Float32Array(buffer, offset, length);") public static native Float32Array create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Float32Array(buffer, offset);") + public static native Float32Array create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float64Array.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float64Array.java index 9d55f32ab..d1379f931 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float64Array.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Float64Array.java @@ -31,6 +31,12 @@ public abstract class Float64Array extends ArrayBufferView { @JSBody(params = "buffer", script = "return new Float64Array(buffer);") public static native Float64Array create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Float64Array(buffer);") + public static native Float64Array create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new Float64Array(buffer, offset, length);") public static native Float64Array create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Float64Array(buffer, offset);") + public static native Float64Array create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int16Array.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int16Array.java index 03c9e134c..caaa5d0bf 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int16Array.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int16Array.java @@ -31,6 +31,12 @@ public abstract class Int16Array extends ArrayBufferView { @JSBody(params = "buffer", script = "return new Int16Array(buffer);") public static native Int16Array create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Int16Array(buffer);") + public static native Int16Array create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new Int16Array(buffer, offset, length);") public static native Int16Array create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Int16Array(buffer, offset);") + public static native Int16Array create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int32Array.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int32Array.java index 8b98f03d8..0f92358c9 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int32Array.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int32Array.java @@ -16,6 +16,7 @@ package org.teavm.jso.typedarrays; import org.teavm.jso.JSBody; +import org.teavm.jso.JSByRef; import org.teavm.jso.JSIndexer; public abstract class Int32Array extends ArrayBufferView { @@ -25,12 +26,22 @@ public abstract class Int32Array extends ArrayBufferView { @JSIndexer public abstract void set(int index, int value); + public abstract void set(@JSByRef int[] data, int offset); + + public abstract void set(@JSByRef int[] data); + @JSBody(params = "length", script = "return new Int32Array(length);") public static native Int32Array create(int length); @JSBody(params = "buffer", script = "return new Int32Array(buffer);") public static native Int32Array create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Int32Array(buffer);") + public static native Int32Array create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new Int32Array(buffer, offset, length);") public static native Int32Array create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Int32Array(buffer, offset);") + public static native Int32Array create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int8Array.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int8Array.java index dae9f06fe..ed42d640c 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int8Array.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Int8Array.java @@ -31,6 +31,12 @@ public abstract class Int8Array extends ArrayBufferView { @JSBody(params = "buffer", script = "return new Int8Array(buffer);") public static native Int8Array create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Int8Array(buffer);") + public static native Int8Array create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new Int8Array(buffer, offset, length);") public static native Int8Array create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Int8Array(buffer, offset);") + public static native Int8Array create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint16Array.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint16Array.java index 9680b83cc..177975a0f 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint16Array.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint16Array.java @@ -31,6 +31,12 @@ public abstract class Uint16Array extends ArrayBufferView { @JSBody(params = "buffer", script = "return new Uint16Array(buffer);") public static native Uint16Array create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Uint16Array(buffer);") + public static native Uint16Array create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new Uint16Array(buffer, offset, length);") public static native Uint16Array create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Uint16Array(buffer, offset);") + public static native Uint16Array create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8Array.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8Array.java index 89d851ab7..dbb1fc959 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8Array.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8Array.java @@ -31,6 +31,12 @@ public abstract class Uint8Array extends ArrayBufferView { @JSBody(params = "buffer", script = "return new Uint8Array(buffer);") public static native Uint8Array create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Uint8Array(buffer);") + public static native Uint8Array create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new Uint8Array(buffer, offset, length);") public static native Uint8Array create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Uint8Array(buffer, offset);") + public static native Uint8Array create(ArrayBuffer buffer, int offset); } diff --git a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8ClampedArray.java b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8ClampedArray.java index ab072d0db..6fbdb6545 100644 --- a/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8ClampedArray.java +++ b/jso/apis/src/main/java/org/teavm/jso/typedarrays/Uint8ClampedArray.java @@ -31,7 +31,13 @@ public abstract class Uint8ClampedArray extends ArrayBufferView { @JSBody(params = "buffer", script = "return new Uint8ClampedArray(buffer);") public static native Uint8ClampedArray create(ArrayBuffer buffer); + @JSBody(params = "buffer", script = "return new Uint8ClampedArray(buffer);") + public static native Uint8ClampedArray create(ArrayBufferView buffer); + @JSBody(params = { "buffer", "offset", "length" }, script = "return new " + "Uint8ClampedArray(buffer, offset, length);") public static native Uint8ClampedArray create(ArrayBuffer buffer, int offset, int length); + + @JSBody(params = { "buffer", "offset" }, script = "return new Uint8ClampedArray(buffer, offset);") + public static native Uint8ClampedArray create(ArrayBuffer buffer, int offset); }