* The parent element, onto whom to attach the initial DOM structure.
*/
public SvgGraphicsContext(Widget parent) {
this.parent = parent;
// the root SVG node
Element rootNode = DOM.createElementNS(DOM.NS_SVG, "svg");
String sWidth = Integer.toString(width);
String sHeight = Integer.toString(height);
DOM.setElementAttribute(rootNode, "width", sWidth);
DOM.setElementAttribute(rootNode, "height", sHeight);
DOM.setElementAttribute(rootNode, "viewBox", "0 0 " + sWidth + " " + sHeight);
DOM.setElementAttribute(rootNode, "xml:base", GWT.getHostPageBaseURL());
helper = new DomHelper(rootNode, Namespace.SVG);
// Point style definitions:
defsGroup = new Composite("style_defs");
defs = helper.drawGroup(null, defsGroup, "defs");
// Append to parent: we need a top div or the svg is blocked by any peer div !!!
Element divNode = DOM.createElementNS(DOM.NS_HTML, "div");
DOM.setStyleAttribute(divNode, "position", "absolute");
DOM.setStyleAttribute(divNode, "width", "100%");
DOM.setStyleAttribute(divNode, "height", "100%");
id = DOM.createUniqueId();
divNode.setId(id);
parent.getElement().appendChild(divNode);
divNode.appendChild(rootNode);
}