svnno****@sourc*****
svnno****@sourc*****
2011年 3月 21日 (月) 22:49:46 JST
Revision: 2498 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2498 Author: dhrname Date: 2011-03-21 22:49:46 +0900 (Mon, 21 Mar 2011) Log Message: ----------- GetSVGDocumentの_caメソッドをvar文について整理 Modified Paths: -------------- branches/07x/073/org/w3c/dom/svg.js Modified: branches/07x/073/org/w3c/dom/svg.js =================================================================== --- branches/07x/073/org/w3c/dom/svg.js 2011-03-21 11:52:46 UTC (rev 2497) +++ branches/07x/073/org/w3c/dom/svg.js 2011-03-21 13:49:46 UTC (rev 2498) @@ -1646,7 +1646,19 @@ *ここでは、responseTextを用いる */ var dsd = new Date(); - str = this.xmlhttp.responseText; + var str = this.xmlhttp.responseText, + objei = this._tar, + s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"), + tar = s.documentElement, + tview = tar.viewport, + objw, objh, fi, n, attr, att, + sdt = tar._tar, + sp = document.createElement("div"), + dcp = document.createElement("v:group"), + backr = document.createElement("v:rect"), + style, fontSize, w, h, sw, sh, trstyle, tpstyle, backrs, viewWidth, viewHeight, + bfl, bft, bl, backright, backdown, text, + _parseFloat = parseFloat; NAIBU.doc.async = false; /*下記のプロパティについては、Microsoftのサイトを参照 *ResolveExternals Property [Second-level DOM] @@ -1663,7 +1675,6 @@ *スクロール時にバグが起きるので、0に戻してやる必要がある。 */ screen.updateInterval = 999; - var objei = this._tar; if (/&[^;]+;/.test(str)) { /*以下の処理は、実体参照を使ったとき *代替の処理を用いて、実体参照を処理するもの @@ -1678,8 +1689,6 @@ NAIBU.doc.loadXML(tmp); tmp = null; } - var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); - var tar = s.documentElement, tview = tar.viewport; tview.top = 0; tview.left = 0; tview.width = objei.clientWidth; @@ -1690,22 +1699,22 @@ if (tar.viewport.height < 24) { //IEの標準モードではclientHeightプロパティの値が小さくなることがある tar.viewport.height = screen.width; } - var objw = objei.getAttribute("width"), objh = objei.getAttribute("height"); + objw = objei.getAttribute("width"); + objh = objei.getAttribute("height"); if (objw) { tar.setAttributeNS(null, "width", objw); } if (objh) { tar.setAttributeNS(null, "height", objh); } - var fi = NAIBU.doc.documentElement.firstChild, n; - var attr = NAIBU.doc.documentElement.attributes, att; + fi = NAIBU.doc.documentElement.firstChild; + attr = NAIBU.doc.documentElement.attributes; /*ルート要素のNamedNodeMapを検索する*/ for (var i=0,atli=attr.length;i<atli;++i) { att = s.importNode(attr[i], false); tar.setAttributeNodeNS(att); } str = attr = null; - var sdt = tar._tar, sp = document.createElement("div"), dcp = document.createElement("v:group"); dcp.style.width = tview.width+ "px"; dcp.style.height = tview.height+ "px"; dcp.coordsize = tview.width+ " " +tview.height; @@ -1721,13 +1730,16 @@ /*以下では、VMLの要素とHTMLのCSSのプロパティを用いて、背景を *作り出す作業を行う。これは必須 */ - var backr = document.createElement("v:rect"), style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""); - var fontSize = parseFloat(style.getPropertyValue("font-size")); + style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""); + fontSize = parseFloat(style.getPropertyValue("font-size")); tar.x.baseVal._emToUnit(fontSize); tar.y.baseVal._emToUnit(fontSize); tar.width.baseVal._emToUnit(fontSize); tar.height.baseVal._emToUnit(fontSize); - var w = tview.width, h = tview.height, sw = tar.width.baseVal.value, sh = tar.height.baseVal.value; + w = tview.width; + h = tview.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"; @@ -1735,17 +1747,20 @@ backr.stroked = "false"; backr.filled = "false"; tar._tar.appendChild(backr); - var trstyle = tar._tar.style; - var tpstyle = objei.style; + trstyle = tar._tar.style; + tpstyle = objei.style; trstyle.visibility = "visible"; trstyle.position = "absolute"; /*以下、画像を切り取り*/ trstyle.overflow = "hidden"; - var backrs = backr.currentStyle; + 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; + viewWidth = w > sw ? sw : w; + viewHeight = h > sh ? sh : h; + bfl = parseFloat(backrs.left); + bft = parseFloat(backrs.top); + bl = -tar._tx; + bt = -tar._ty; if (bfl !== 0 && !isNaN(bfl)) { //内部の図形にずれが生じたとき(isNaNはIE8でautoがデフォルト値のため) bl = bfl; dcp.style.left = -bl+ "px"; @@ -1754,8 +1769,8 @@ bt = bft; dcp.style.top = -bt+ "px"; } - var backright = bl + viewWidth + 1; - var backdown = bt + viewHeight + 1; + backright = bl + viewWidth + 1; + backdown = bt + viewHeight + 1; trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; this._document = s; if ("_svgload_limited" in s.documentElement) { @@ -1774,7 +1789,7 @@ } } //以下、テキストの位置を修正 - var text = s.documentElement._tar.getElementsByTagName("div"), _parseFloat = parseFloat; + text = s.documentElement._tar.getElementsByTagName("div"); for (var i=0,textli=text.length;i<textli;++i) { var texti = text[i]; if (texti.firstChild.nodeName !== "shape") { //radialGradient用のdiv要素でないならば