From ae214cfe0e34f3259ea88c617a80139f5ca2551d Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Wed, 10 Feb 2010 20:12:48 +0000 Subject: [PATCH] Add a shadow to the canvas in Firefox (experimental) git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1373 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index e6e3d37a..40a391f8 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -87,8 +87,6 @@ function SvgCanvas(container) var isOpera = !!window.opera, isWebkit = navigator.userAgent.indexOf("AppleWebKit") != -1, support = {}, - htmlns = "http://www.w3.org/1999/xhtml", - mathns = "http://www.w3.org/1998/Math/MathML", // this defines which elements and attributes that we support svgWhiteList = { @@ -673,6 +671,9 @@ function BatchCommand(text) { 'y': 0, 'style': 'pointer-events:none' }); + // Opera has a rendering bug + if (!window.opera) canvasbg.setAttribute("filter", "url(#canvashadow)"); + var rect = svgdoc.createElementNS(svgns, "rect"); assignAttributes(rect, { 'width': '100%', @@ -917,17 +918,25 @@ function BatchCommand(text) { xlinkns = "http://www.w3.org/1999/xlink", xmlns = "http://www.w3.org/XML/1998/namespace", se_ns = "http://svg-edit.googlecode.com", + htmlns = "http://www.w3.org/1999/xhtml", + mathns = "http://www.w3.org/1998/Math/MathML", idprefix = "svg_", svgdoc = container.ownerDocument, - svgroot = svgdoc.createElementNS(svgns, "svg"); - - $(svgroot).attr({ - width: 640, - height: 480, - id: "svgroot", - xmlns: svgns, - "xmlns:xlink": xlinkns - }).appendTo(container); + svgroot = svgdoc.importNode(Utils.text2xml('' + + '' + + '' + + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + '').documentElement, true); + + $(svgroot).appendTo(container); var svgcontent = svgdoc.createElementNS(svgns, "svg"); $(svgcontent).attr({