svnno****@sourc*****
svnno****@sourc*****
2009年 5月 25日 (月) 22:49:08 JST
Revision: 1182 http://svn.sourceforge.jp/view?root=sie&view=rev&rev=1182 Author: dhrname Date: 2009-05-25 22:49:08 +0900 (Mon, 25 May 2009) Log Message: ----------- 0.48統合 Modified Paths: -------------- trunk/sie.js Property Changed: ---------------- trunk/sie.js Modified: trunk/sie.js =================================================================== --- trunk/sie.js 2009-05-24 13:44:20 UTC (rev 1181) +++ trunk/sie.js 2009-05-25 13:49:08 UTC (rev 1182) @@ -90,9 +90,8 @@ } } //他のページに移動する際に起動 -function unsvgtovml(){ - NAIBU = stlog = STLog = STdocument = null; - PaintColor = FontStyle = null; +function unsvgtovml() { + NAIBU = stlog = STLog = null; } //vmlの名前空間をセット(必須) @@ -101,15 +100,11 @@ 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.addRule("v\\:rect",vmlUrl); - st.addRule("v\\:image",vmlUrl); - st.addRule("v\\:fill",vmlUrl); - st.addRule("v\\:stroke",vmlUrl); - st.addRule("o\\:opacity2",vmlUrl); - st.addRule("dn\\:defs","display:none"); - st.addRule("v\\:group", vmlUrl+ "position:relative;width:100%;height:100%;"); - st.addRule("v\\:shape", vmlUrl+ "width:100%;height:100%;"); + 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{position:relative;width:100%;height:100%;" +vmlUrl + + "v\\:shape{width:100%;height:100%;" +vmlUrl; } } @@ -167,8 +162,8 @@ la[i] = new st(li[i], w, h); } this[nodes] = la; - } catch(e) {stlog.add(e,129); - } + li = null; + } catch(e) {stlog.add(e,129);} } SVGtoVML.prototype.set = function stvset(ob) { var w = this.w, h = this.h, c = this.children; @@ -295,7 +290,7 @@ } catch(e){stlog.add(e,3002);} } while (te); } - name = gname = matrix = null; + nods = name = gname = matrix = cmatrix = w = h = null; } //object要素とembed要素の取得を総括して行う @@ -346,13 +341,14 @@ //以下、ツリーとして処理 this.children = []; this.chset(g,this.transformable, w, h); + w = h = null; } catch(e){stlog.add(e,3144);} return this; } STGroupElement.prototype.set = function (sw,sh) { try{ stvsetob(this.children,sw,sh); - delete (this.children); + this.children = this.transformable = null; } catch(e){stlog.addd(e,3145)} } STGroupElement.prototype.chset = SVGtoVML.prototype.chset; @@ -397,6 +393,7 @@ l[i] = new STTSpanElement(li[i],this.dx,this.dy,this.transformable, w, h); } this.tspan = l; + li = w = h = null; } catch(e) {stlog.add(e,129264);} return this; } @@ -457,13 +454,13 @@ tancx = tancy = textLength / 2; } if (this.paint.writingMode.indexOf("tb") === 0) { //縦書きならば、x座標に影響を与えない - tancx = 0; + tancx = -fontSize * 0.04; //さらにディセンダの調整を行う } else { - tancy = 0; + tancy = -fontSize * 0.04; } tts.left = ptm.x - tancx; tts.top = ptm.y - tancy; - p = ptm = tancx = tancy = null; + p = ptm = tancx = tancy = fij = w = h = null; this.textLength = textLength; } catch(e) {stlog.add(e,2831);} p = ptm = tancx = tancy = null; @@ -506,7 +503,7 @@ tts.left = ptm.x+ "px"; tts.top = ptm.y+ "px"; } - p = ptm = null; + p = ptm = w = h = null; //ずれの値を返す return {dx : parseFloat(tts.left), dy : parseFloat(tts.top)} } catch(e) {stlog.add(e,304);} @@ -534,7 +531,7 @@ ele.path = dat; ele.coordsize = w + " " + h; this.paint.set(w, h, ttm); - list = pl = plm = dat = null; + list = pl = plm = dat = this.paint = ttm = this.transformable = w = h = null; } catch(e) {stlog.add(e,257);} } @@ -641,7 +638,7 @@ ele.path = dat + " e"; ele.coordsize = w + " " + h; this.paint.set(w, h, ttm); - dat = this.paint = this.d = preCom = x = y = x0 = y0 = dx = dy = tma = tmb = tmc = tmd = tme = tmf = null; //解放 + dat = this.paint = ttm = this.transformable = this.d = preCom = x = y = x0 = y0 = dx = dy = tma = tmb = tmc = tmd = tme = tmf = w = h = null; //解放 } catch(e) {stlog.add(e,372);} } @@ -745,6 +742,7 @@ this.r = new STLength(ele.getAttribute("r")); this.paint = new NAIBU.PaintColor(ele); this.transformable = NAIBU.transformToCTM(ele,matrix); + w = h = null; } catch(e) {stlog.add(e,450);} return this; } @@ -765,6 +763,7 @@ ele.path = dat; ele.coordsize = w + " " + h; this.paint.set(w, h, ttm); + dat = list = pl = plm = this.paint = ttm = this.transformable = w = h = null; //解放 } catch(e) {stlog.add(e,479);} } @@ -778,6 +777,7 @@ this.ry = new STLength(ele.getAttribute("ry"), h); this.paint = new NAIBU.PaintColor(ele); this.transformable = NAIBU.transformToCTM(ele,matrix); + w = h = null; } catch(e) {stlog.add(e,490);} return this; } @@ -797,6 +797,7 @@ ele.path = dat; ele.coordsize = w + " " + h; this.paint.set(w, h, ttm); + dat = list = pl = plm = this.paint = ttm = this.transformable = w = h = null; //解放 } catch(e) {stlog.add(e,519);} } @@ -808,9 +809,10 @@ this.y = new STLength((rect.getAttribute("y") || 0), h); this.width = new STLength(rect.getAttribute("svgwidth"), w); this.height = new STLength(rect.getAttribute("svgheight"), h); - if (rect.getAttribute("rx") || rect.getAttribute("ry")) { - this.rx = new STLength((rect.getAttribute("rx") || rect.getAttribute("ry")), w); - this.ry = new STLength((rect.getAttribute("ry") || rect.getAttribute("rx")), h); + var rx = rect.getAttribute("rx"), ry = rect.getAttribute("ry"); + if (rx || ry) { + this.rx = new STLength((rx || ry), w); + this.ry = new STLength((ry || rx), h); if (this.rx.value > this.width.value / 2) { //rx属性が幅より大きければ、幅の半分を属性に設定 this.rx.value = this.width.value / 2; } @@ -818,10 +820,9 @@ this.ry.value = this.height.value / 2; } } - } catch(oe) {stlog.add(oe,541);} - try { this.paint = new NAIBU.PaintColor(rect); this.transformable = NAIBU.transformToCTM(rect,matrix); + w = h = rx = ry = null; } catch(ee) {stlog.add(ee,545);} return this; } @@ -847,6 +848,7 @@ ele.path = dat; ele.coordsize = w + " " + h; this.paint.set(w, h, ttm); + dat = list = pl = plm = this.paint = ttm = this.transformable = w = h = null; //解放 } catch(ee) {stlog.add(ee,576);} } @@ -861,6 +863,7 @@ this.xlink = new NAIBU.XLink(ele); this.paint = new NAIBU.PaintColor(ele); this.transformable = NAIBU.transformToCTM(ele,matrix); + w = h = null return this; } STImage.prototype.set = function imagesets(w,h){ @@ -887,6 +890,7 @@ ttfia.Opacity = parseFloat(this.paint.fillopacity)*100; } this.xlink.set(); + dat = pt = this.xlink = this.paint = ttm = this.transformable = w = h = null; //解放 } catch(e) {stlog.set(e,21896);} } @@ -907,6 +911,7 @@ tns.coordorgin = "0 0"; this.paint = new NAIBU.PaintColor(this.xlink.resource); this.paint.tar = tns; + w = h = null; return this; } STUseElement.prototype.set = function(){ @@ -968,7 +973,6 @@ NAIBU.PaintColor.prototype.getParent = function( /*element*/ ele) { var parent = ele.parentNode; if (parent.tagName !== "group" && parent.tagName !== "A") { - NAIBU.PaintColor.rootElement = parent; return null; } else { var cache = this.cache; @@ -1047,6 +1051,7 @@ if (strokeOpacity < 1) { strokeElement.setAttribute("opacity", strokeOpacity); } + strokeOpacity = null; } strokeElement.setAttribute("miterlimit", this.strokemiterlimit); strokeElement.setAttribute("joinstyle", this.strokelinejoin); @@ -1068,6 +1073,7 @@ } } strokeElement.setAttribute("dashstyle", this.strokedasharray); + tsd = strs = null; } } catch(e) {stlog.add(e,720); strokeElement.on = "false";} el.appendChild(strokeElement); @@ -1076,6 +1082,7 @@ if (this.cursor !== "default") { this.tar.style.cursor = this.cursor; } + w = h = null; } //色キーワード NAIBU.PaintColor.prototype.keywords = { @@ -1234,6 +1241,7 @@ } var stops = grad2.getElementsByTagName("stop"); if (!stops) { + grad = grad2 = stops = null; return false; } var length = stops.length; @@ -1329,7 +1337,7 @@ } else { return false; } - stops = type = color = colors = opacity = null; + stops = type = lengh = color = colors = opacity = null; return false; } @@ -1410,12 +1418,12 @@ if (tft) { var coma = tft.match(NAIBU.comaR); //コマンド文字にマッチ translate var list = tft.match(NAIBU.listR); //カッコ内のリストにマッチ (10 20 30...) + var a,b,c,d,e,f,lis,deg,rad,degli,matri; for (var j=0;j<coma.length;j++) { - var lis = list[j], com = coma[j]; - var a,b,c,d,e,f; - var deg = lis.match(NAIBU.degR); - var rad = parseFloat(deg[0]) / 180 * Math.PI; - var degli = deg.length; + lis = list[j], com = coma[j]; + deg = lis.match(NAIBU.degR); + rad = parseFloat(deg[0]) / 180 * Math.PI; + degli = deg.length; if (degli === 6) { a = parseFloat(deg[0]); b = parseFloat(deg[1]); c = parseFloat(deg[2]); d = parseFloat(deg[3]); e = parseFloat(deg[4]); f = parseFloat(deg[5]); } else if (degli === 3) { @@ -1440,11 +1448,11 @@ break; } } - var matri = new Matrix(a,b,c,d,e,f); + matri = new Matrix(a,b,c,d,e,f); matrix = matrix.multiply(matri); - lis = com = matri = deg = rad = null; + lis = com = deg = rad = null; } - list = coma = mat = null; + list = coma = mat = matri = null; } } catch(e) {stlog.add(e,816);} return matrix; @@ -1480,6 +1488,7 @@ var pmt = p.matrixTransform(ttm); F[i++] = pmt.x; F[i++] = pmt.y; + p = pmt = null; } var s = new PList(F); return s; @@ -1492,13 +1501,7 @@ } //Matrix同士の積を算出 Matrix.prototype.multiply = function matrixmultiply( /*Matrix*/ m) { - var a = this.a * m.a + this.c * m.b; - var b = this.b * m.a + this.d * m.b; - var c = this.a * m.c + this.c * m.d; - var d = this.b * m.c + this.d * m.d; - var e = this.a * m.e + this.c * m.f + this.e; - var f = this.b * m.e + this.d * m.f + this.f; - var s = new Matrix(a,b,c,d,e,f); + var s = new Matrix(this.a * m.a + this.c * m.b,this.b * m.a + this.d * m.b,this.a * m.c + this.c * m.d,this.b * m.c + this.d * m.d,this.a * m.e + this.c * m.f + this.e,this.b * m.e + this.d * m.f + this.f); return s; } //行列式 @@ -1726,6 +1729,7 @@ ut = this._tani[tani]; } this.newValueSpecifiedUnits(ut,v); + d = wort = f = v = tani = ut = null; //解放 } catch(e) {stlog.add(e,1133); this.value = 1000;} return this; } @@ -1809,8 +1813,6 @@ case "new": this.tar.setAttribute("target","_blank"); break; - default: - break; } this.tar.setAttribute("href",uri); } @@ -1857,19 +1859,17 @@ return xmlhttp; } var success = true; -//SVGDocumentを収納しておく -var STdocument = new Array(); //IE用。object要素のデータからVMLを作成 function ca( /*object*/ data) { if (success && data.success) { - var dn = data.num-1; try { - var obj = data.obj[dn]; + var obj = data.obj[data.num-1]; var obw = new STLength(obj.getAttribute("width"),obj.clientWidth), obh = new STLength(obj.getAttribute("height"),obj.clientHeight); - var obwidth = obw.value, obheight = obh.value; + var obwidth = obw.value, obheight = obh.value; } catch(e) {stlog.add(e,1209);} //正規表現でソースをVML用に書き換え + //xmlns属性削除はバグが起きないように必須 var dc = data.content .replace(/<!DOCTYPE/, "<!--") .replace(/(?:dtd">|\]>)/, "-->") @@ -1917,23 +1917,22 @@ var ob = document.createElement("v:group"); var obst = ob.style; ob.innerHTML = dc; + data = dc = null; var obc = ob.getElementsByTagName("group").item(0); //obcはSVGのルート要素 var regaw = obc.getAttribute("svgwidth") || obwidth; var regah = obc.getAttribute("svgheight") || obheight; - regw = new STLength(regaw,obwidth); - regh = new STLength(regah,obheight); + var regw = new STLength(regaw,obwidth); + var regh = new STLength(regah,obheight); var regwv = regw.value, reghv = regh.value; obst.width = regwv+ "px"; obst.height = reghv+ "px"; ob.coordsize = regwv +" "+ reghv; - var oba = document.createElement("div"); - oba.setAttribute("id","_NAIBU_outline"); - obj.parentNode.appendChild(oba); - STdocument[dn] = new SVGtoVML(obc,obwidth,obheight,regw,regh); + var STdocument = new SVGtoVML(obc,obwidth,obheight,regw,regh); obj.parentNode.insertBefore(ob,obj); - STdocument[dn].read(ob); - STdocument[dn].set(ob); - data = dc = null; + STdocument.read(ob); + STdocument.set(ob); + STdocument = obw = obh = regw = regh = null; + NAIBU.PaintColor.prototype.cache = {}; //キャッシュの初期化 if (NAIBU.STObject !== void 0) {NAIBU.STObject.next();} } } @@ -1948,7 +1947,7 @@ xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { -fn({success:true, status:xmlhttp.status,content:xmlhttp.responseText,contentType:xmlhttp.getResponseHeader("Content-Type"),obj:ob,num:n}); + fn({success:true,content:xmlhttp.responseText,obj:ob,num:n}); xmlhttp = null; } } Property changes on: trunk/sie.js ___________________________________________________________________ Modified: svn:mergeinfo - /branches/04x/040/sie.js:812-829 /branches/04x/041/sie.js:891-923 /branches/04x/042/sie.js:927-967 /branches/04x/043/sie.js:969-1013 /branches/04x/044/sie.js:1015-1067 /branches/04x/045/sie.js:1069-1078 /branches/04x/046/sie.js:1080-1129 /branches/04x/sie.js:830-1132 + /branches/04x/040/sie.js:812-829 /branches/04x/041/sie.js:891-923 /branches/04x/042/sie.js:927-967 /branches/04x/043/sie.js:969-1013 /branches/04x/044/sie.js:1015-1067 /branches/04x/045/sie.js:1069-1078 /branches/04x/046/sie.js:1080-1129 /branches/04x/047/sie.js:1131-1164 /branches/04x/048/sie.js:1166-1180 /branches/04x/sie.js:830-1181