Add color filter SVG as child of canvas element

Avoid adding to body, which can affect document layout.
This commit is contained in:
Mike Welsh 2019-06-25 15:50:22 -07:00
parent 64d6ea6f3f
commit 3263255e60
1 changed files with 2 additions and 3 deletions

View File

@ -44,6 +44,7 @@ impl WebCanvasRenderBackend {
svg.set_attribute("width", "0"); svg.set_attribute("width", "0");
svg.set_attribute("height", "0"); svg.set_attribute("height", "0");
//svg.set_attribute("style", "display: none;");
svg.set_attribute_ns( svg.set_attribute_ns(
Some("http://www.w3.org/2000/xmlns/"), Some("http://www.w3.org/2000/xmlns/"),
"xmlns:xlink", "xmlns:xlink",
@ -92,9 +93,7 @@ impl WebCanvasRenderBackend {
svg.append_child(&svg_defs.clone()) svg.append_child(&svg_defs.clone())
.map_err(|_| "append_child failed")?; .map_err(|_| "append_child failed")?;
let body = document let body = canvas
.body()
.unwrap()
.append_child(&svg) .append_child(&svg)
.map_err(|_| "append_child failed")?; .map_err(|_| "append_child failed")?;