From 279fa86a3c89ea5f137f3d2856622ef42df11a97 Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Thu, 14 May 2015 09:53:32 -0700 Subject: [PATCH 1/2] Fixed nullpointer when creating iterator on TreeMap where root node is null. --- .../src/main/java/org/teavm/classlib/java/util/TTreeMap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTreeMap.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTreeMap.java index 585944995..3b265c1c4 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTreeMap.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTreeMap.java @@ -691,7 +691,7 @@ public class TTreeMap extends TAbstractMap implements TCloneable, TS public EntryIterator(TTreeMap owner, TreeNode[] path, TreeNode to, boolean reverse) { this.owner = owner; modCount = owner.modCount; - this.path = TArrays.copyOf(path, owner.root.height); + this.path = TArrays.copyOf(path, owner.root == null ? 0 : owner.root.height); depth = path.length; this.to = to; this.reverse = reverse; From 66d5c7269d0372b3d3c9dcf2f69ca1936af1c1f1 Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Thu, 14 May 2015 12:47:57 -0700 Subject: [PATCH 2/2] Added CanvasGradient.addColorStop method. --- .../main/java/org/teavm/dom/canvas/CanvasGradient.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasGradient.java b/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasGradient.java index b374669fd..ba48b01d0 100644 --- a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasGradient.java +++ b/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasGradient.java @@ -22,4 +22,14 @@ import org.teavm.jso.JSObject; * @author Alexey Andreev */ public interface CanvasGradient extends JSObject { + + /** + * The CanvasGradient.addColorStop() method adds a new stop, defined by an + * offset and a color, to the gradient. If the offset is not between 0 and 1, + * an INDEX_SIZE_ERR is raised, if the color can't be parsed as a CSS color, + * a SYNTAX_ERR is raised. + * @param offset Offset between 0 and 1 + * @param color A CSS parseable color. + */ + void addColorStop(double offset, String color); }