svnno****@sourc*****
svnno****@sourc*****
2010年 5月 31日 (月) 22:32:17 JST
Revision: 1859 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1859 Author: dhrname Date: 2010-05-31 22:32:17 +0900 (Mon, 31 May 2010) Log Message: ----------- Modified Paths: -------------- trunk/org/w3c/dom/svg.js Modified: trunk/org/w3c/dom/svg.js =================================================================== --- trunk/org/w3c/dom/svg.js 2010-05-31 13:29:36 UTC (rev 1858) +++ trunk/org/w3c/dom/svg.js 2010-05-31 13:32:17 UTC (rev 1859) @@ -1374,102 +1374,6 @@ }, /*SVGDocument*/ getSVGDocument : function() { } - if (!xmlhttp) { - try { - xmlhttp = new XMLHttpRequest(); - } catch (e) { - xmlhttp = false; - } - } - if (!document.namespaces["v"]) { - document.namespaces.add("v","urn:schemas-microsoft-com:vml"); - document.namespaces.add("o","urn:schemas-microsoft-com:office:office"); - var st = document.createStyleSheet(); - var vmlUrl = "behavior: url(#default#VML);display: inline-block;} "; //inline-blockはIEのバグ対策 - st.cssText = "v\\:rect{" +vmlUrl+ "v\\:image{" +vmlUrl+ "v\\:fill{" +vmlUrl+ "v\\:stroke{" +vmlUrl+ "o\\:opacity2{" +vmlUrl - + "dn\\:defs{display:none}" - + "v\\:group{text-indent:0px;position:relative;width:100%;height:100%;" +vmlUrl - + "v\\:shape{width:100%;height:100%;" +vmlUrl; - } - if (xmlhttp) { - var oba = document.createElement("div"); - oba.setAttribute("id","_NAIBU_outline"); - document.body.appendChild(oba); - //HTML内のobject要素を探し出して、メソッドを結びつける - var obje = document.getElementsByTagName("object"); - for (var i=0, objli=1;i<objli;++i) { - var objei = {style:{}};//obje[i]; - xmlhttp.open("GET", "../svggen/shapes-polygon-01-t.svg", true);//objei.getAttribute("data"), true); - xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - xmlhttp.onreadystatechange = function() { - if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { - /*SVGDocument*/ objei.getSVGDocument = function(){ - /*responseXMLを使うと、時々、空のデータを返すことがあるため(原因は不明)、 - *ここでは、responseTextを用いる - */ - var doc = new ActiveXObject("MSXML2.DomDocument"); - var dew = new Date(); - str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->"); - doc.loadXML(str); - var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); - var tar = s.documentElement; - var sdt = tar._tar, sp = document.createElement("div"), dcp = document.createElement("v:group"); - dcp.style.width = "1237px"; - dcp.style.height = "800px"; - dcp.coordsize = "1237 800"; - sp.appendChild(dcp); - document.body.insertBefore(sp, document.body.lastChild); - dcp.appendChild(sdt) - tar.viewport.top = 0; - tar.viewport.left = 0; - tar.width.baseVal.value = tar.viewport.width = 1237; - tar.height.baseVal.value = tar.viewport.height = 800; - var fi = doc.documentElement.firstChild, n; - var attr = tar.attributes, att; - for (var i=0,atli=attr.length;i<atli;++i) { //NamedNodeMapを検索する - att = this.importNode(attr[i], false); - s.setAttributeNodeNS(att); - } - while (fi) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する - n = s.importNode(fi, true); - tar.appendChild(n); - fi = fi.nextSibling; - } - /*以下では、VMLの要素とHTMLのCSSのプロパティを用いて、背景を - *作り出す作業を行う。これは必須 - */ - var backr = document.createElement("v:rect"); - var w = tar.viewport.width, h = tar.viewport.height, sw = tar.width.baseVal.value, sh = tar.height.baseVal.value; - backr.style.position = "absolute"; - backr.style.width = w+ "px"; - backr.style.height = h+ "px"; - backr.style.zIndex = -1; - backr.stroked = "false"; - backr.filled = "false"; - tar._tar.appendChild(backr); - var trstyle = tar._tar.style; - var tpstyle = objei.style; - trstyle.visibility = "visible"; - trstyle.position = "absolute"; - //以下、画像を切り取り - trstyle.overflow = "hidden"; - var backrs = backr.currentStyle; - var viewWidth = w > sw ? sw : w, viewHeight = h > sh ? sh : h; //ウィンドウ枠の長さを決定する - var bfl = parseFloat(backrs.left), bft = parseFloat(backrs.top); - var bl = -tar._tx, bt = -tar._ty; - var backright = bl + viewWidth + 1; - var backdown = bt + viewHeight + 1; - trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; - alert((new Date()).getTime() - dew.getTime()); - doc = str = fi = attr = null; - return s; - }; - objei.getSVGDocument(); - } - }; - xmlhttp.send(null); - } - } }; /*SVGStyleElement