Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite loop with patterns on ctx.fill(); #60

Open
murkle opened this issue Oct 20, 2017 · 1 comment
Open

infinite loop with patterns on ctx.fill(); #60

murkle opened this issue Oct 20, 2017 · 1 comment

Comments

@murkle
Copy link

murkle commented Oct 20, 2017

Minimal test case (hangs browser on "ctx.fill();")
http://test.geogebra.org/~mike/canvas2svgPatternBug/imageFill.html

Proof of concept for suggested fix:
http://test.geogebra.org/~mike/canvas2svgPatternBug/imageFill_fixed.html

Changing

while(value.__ctx.__defs.childNodes.length) {
id = value.__ctx.__defs.childNodes[0].getAttribute("id");
this.__ids[id] = id;
this.__defs.appendChild(value.__ctx.__defs.childNodes[0]);
}

to

var len = value.__ctx.__defs.childNodes.length;
for (var i = 0 ; i < len ; i++) {
id = value.__ctx.__defs.childNodes[i].getAttribute("id");
this.__ids[id] = id;
this.__defs.appendChild(value.__ctx.__defs.childNodes[i]);
}

seems to fix it although maybe removing the elements would be better (I guess there's a line of code missing to do that)

@murkle
Copy link
Author

murkle commented Oct 22, 2017

Same as #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant