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

Is there an infinite loop in drawImage? #12

Open
Validark opened this issue Mar 7, 2022 · 0 comments
Open

Is there an infinite loop in drawImage? #12

Validark opened this issue Mar 7, 2022 · 0 comments

Comments

@Validark
Copy link

Validark commented Mar 7, 2022

Found this code in the drawImage method in context.js:

svgcanvas/context.js

Lines 1140 to 1144 in 3991b8e

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

Does defs.childNodes.length ever change? Was this supposed to call defs.childNodes.shift()?

More context:

svgcanvas/context.js

Lines 1134 to 1151 in 3991b8e

if (image instanceof Context) {
//canvas2svg mock canvas context. In the future we may want to clone nodes instead.
//also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context.
svg = image.getSvg().cloneNode(true);
if (svg.childNodes && svg.childNodes.length > 1) {
defs = svg.childNodes[0];
while(defs.childNodes.length) {
id = defs.childNodes[0].getAttribute("id");
this.__ids[id] = id;
this.__defs.appendChild(defs.childNodes[0]);
}
group = svg.childNodes[1];
if (group) {
this.__applyTransformation(group, matrix);
parent.appendChild(group);
}
}
} else if (image.nodeName === "CANVAS" || image.nodeName === "IMG") {

Update, this might be the same as:

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