svnno****@sourc*****
svnno****@sourc*****
2011年 8月 18日 (木) 21:47:06 JST
Revision: 2876 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2876 Author: dhrname Date: 2011-08-18 21:47:06 +0900 (Thu, 18 Aug 2011) Log Message: ----------- 0.83 module unified Modified Paths: -------------- branches/08x/sie.js Modified: branches/08x/sie.js =================================================================== --- branches/08x/sie.js 2011-08-18 10:33:46 UTC (rev 2875) +++ branches/08x/sie.js 2011-08-18 12:47:06 UTC (rev 2876) @@ -470,7 +470,7 @@ *(getAttributeとsetAttributeは普及しているので機能させる */ /*string*/ Element.prototype.getAttribute = function( /*string*/ name) { - return (this.getAttributeNS("http://www.w3.org/2000/svg", name)); + return (this.getAttributeNS(null, name)); }; /*void*/ Element.prototype.setAttribute = function( /*string*/ name, /*string*/ value) { this.setAttributeNS(null, name, value); @@ -1884,7 +1884,7 @@ this._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) this.cssValueType = CSSValue.CSS_PRIMITIVE_VALUE; this.primitiveType = CSSPrimitiveValue.CSS_UNKNOWN; - this._value = 1; + this._value = null; this._percent = 0; //単位に%が使われていた場合、このプロパティの数値を1%として使う this._empercent = 0; /*void*/ this.setFloatValue = function(/*short*/ unitType, /*float*/ floatValue) { @@ -1902,41 +1902,45 @@ if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合 throw new DOMException(DOMException.INVALID_ACCESS_ERR); } - var tc = this.cssText, - n = tc.charAt(tc.length-1), - type = 0, - s = +(tc.match(this._regd)); - s = isNaN(s) ? 0 : s; - if (n >= "0" && n <= "9") { - type = /*CSSPrimitiveValue.CSS_NUMBER*/ 1; - if (unitType === 1) { - unitType = tc = n = type = null; - return s; + if (this._value || (this._value === 0)) { //すでに、setFloatValueメソッドによって_valueプロパティが設定されていた場合 + return (this._value / this._n[unitType-1]); + } else { + var tc = this.cssText, + n = tc.charAt(tc.length-1), + type = 0, + s = +(tc.match(this._regd)); + s = isNaN(s) ? 0 : s; + if (n >= "0" && n <= "9") { + type = /*CSSPrimitiveValue.CSS_NUMBER*/ 1; + if (unitType === 1) { + unitType = tc = n = type = null; + return s; + } + } else if (n === "%") { + s *= this._percent; + type = /*CSSPrimitiveValue.CSS_PERCENTAGE*/ 2; + } else if ((n === "m") && (tc.charAt(tc.length-2) === "e")) { + s *= this._empercent; + type = /*CSSPrimitiveValue.CSS_EMS*/ 3; + } else if ((n === "x") && (tc.charAt(tc.length-2) === "e")) { + type = /*CSSPrimitiveValue.CSS_EXS*/ 4; + } else if ((n === "x") && (tc.charAt(tc.length-2) === "p")) { + type = /*CSSPrimitiveValue.CSS_PX*/ 5; + } else if ((n === "m") && (tc.charAt(tc.length-2) === "c")) { + type = /*CSSPrimitiveValue.CSS_CM*/ 6; + } else if ((n === "m") && (tc.charAt(tc.length-2) === "m")) { + type = /*CSSPrimitiveValue.CSS_MM*/ 7; + } else if (n === "n") { + type = /*CSSPrimitiveValue.CSS_IN*/ 8; + } else if (n === "t") { + type = /*CSSPrimitiveValue.CSS_PT*/ 9; + } else if (n === "c") { + type = /*CSSPrimitiveValue.CSS_PC*/ 10; } - } else if (n === "%") { - s *= this._percent; - type = /*CSSPrimitiveValue.CSS_PERCENTAGE*/ 2; - } else if ((n === "m") && (tc.charAt(tc.length-2) === "e")) { - s *= this._empercent; - type = /*CSSPrimitiveValue.CSS_EMS*/ 3; - } else if ((n === "x") && (tc.charAt(tc.length-2) === "e")) { - type = /*CSSPrimitiveValue.CSS_EXS*/ 4; - } else if ((n === "x") && (tc.charAt(tc.length-2) === "p")) { - type = /*CSSPrimitiveValue.CSS_PX*/ 5; - } else if ((n === "m") && (tc.charAt(tc.length-2) === "c")) { - type = /*CSSPrimitiveValue.CSS_CM*/ 6; - } else if ((n === "m") && (tc.charAt(tc.length-2) === "m")) { - type = /*CSSPrimitiveValue.CSS_MM*/ 7; - } else if (n === "n") { - type = /*CSSPrimitiveValue.CSS_IN*/ 8; - } else if (n === "t") { - type = /*CSSPrimitiveValue.CSS_PT*/ 9; - } else if (n === "c") { - type = /*CSSPrimitiveValue.CSS_PC*/ 10; + s = s * this._n[type-1] / this._n[unitType-1]; + tc = n = type = unitType = null; + return s; } - this._value = s * this._n[type-1]; //値はあらかじめ、利用しやすいように変換しておく - tc = n = type = s = null; - return (this._value / this._n[unitType-1]); }; /*void*/ this.setStringValue = function(/*short*/ stringType, /*string*/ stringValue) { if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合 @@ -3045,9 +3049,9 @@ throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR); } } - this.rgbColor.red.cssText = s[0]; - this.rgbColor.green.cssText = s[1]; - this.rgbColor.blue.cssText = s[2]; + this.rgbColor.red.setFloatValue(/*CSSPrimitiveValue.CSS_NUMBER*/ 1, s[0]); + this.rgbColor.green.setFloatValue(1, s[1]); + this.rgbColor.blue.setFloatValue(1, s[2]); rgbColor = s = _parseInt = null; }; @@ -3984,8 +3988,9 @@ *ここでは、responseTextを用いる */ var ifr = this._tar.previousSibling, + ifcw = ifr.contentWindow, _doc; - if (ifr.contentWindow) { + if (ifcw) { ifr.contentWindow.screen.updateInterval = 999; _doc = ifr.contentWindow.document; _doc.write(""); @@ -4014,15 +4019,15 @@ sp = _doc.createElement("div"), dcp = _doc.createElement("v:group"), backr = _doc.createElement("v:rect"), - style, fontSize, w, h, sw, sh, trstyle, tpstyle, backrs, viewWidth, viewHeight, - bfl, bft, bl, backright, backdown, text, + style, fontSize, sw, sh, trstyle, tpstyle, backrs, + bfl, bft, bl, text, _parseFloat = parseFloat, ndoc = NAIBU.doc, oba = _doc.createElement("div"); //obaはradialGradient要素で使う oba.setAttribute("id","_NAIBU_outline"); _doc.body.appendChild(oba); sp.style.margin = "-2px,-0px,0px,-2px" - if (ifr.contentWindow) { + if (ifcw) { _doc.body.style.backgroundColor = objei.parentNode.currentStyle.backgroundColor; } s._document_ = _doc; //_document_プロパティはradialGradient要素やNAIBU._setPaintなどで使う @@ -4086,7 +4091,7 @@ dcp.style.height = tview.height+ "px"; dcp.coordsize = tview.width+ " " +tview.height; sp.appendChild(dcp); - if (ifr.contentWindow) { + if (ifcw) { _doc.body.appendChild(sp); } else { this._tar.parentNode.insertBefore(sp, this._tar); @@ -4107,13 +4112,11 @@ tar.y.baseVal._emToUnit(fontSize); tar.width.baseVal._emToUnit(fontSize); tar.height.baseVal._emToUnit(fontSize); - 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"; + backr.style.width = tview.width+ "px"; + backr.style.height = tview.height+ "px"; backr.style.zIndex = -1; backr.stroked = "false"; backr.filled = "false"; @@ -4122,15 +4125,11 @@ tpstyle = objei.style; trstyle.visibility = "visible"; trstyle.position = "absolute"; - /*以下、画像を切り取り*/ trstyle.overflow = "hidden"; backrs = backr.currentStyle; - /*ウィンドウ枠の長さを決定する*/ - viewWidth = w > sw ? sw : w; - viewHeight = h > sh ? sh : h; bfl = _parseFloat(backrs.left); bft = _parseFloat(backrs.top); - bl = -tar._tx; + bl = -tar._tx; //blやbtは、ずれを調整するのに使う bt = -tar._ty; if (bfl !== 0 && !isNaN(bfl)) { //内部の図形にずれが生じたとき(isNaNはIE8でautoがデフォルト値のため) bl = bfl; @@ -4140,9 +4139,6 @@ bt = bft; dcp.style.top = -bt+ "px"; } - 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) { /*_svgload_limitedプロパティはXlink言語が使われていない限り、0である。 @@ -4171,13 +4167,13 @@ } } s.defaultView._cache = s.defaultView._cache_ele = null; - oba = _doc = evt = _doc = objei = tar = tview = objw = objh = n = att = sdt = sp = dcp = backr = w = h = sw = sh = style = fontSize = null; - trstyle = tpstyle = backrs = viewWidth = viewHeight = text = texti = i = bfl = bft = bl = bt = backdown = backright = text = _parseFloat = null; + oba = _doc = evt = _doc = objei = tar = tview = objw = objh = n = att = sdt = sp = dcp = backr = sw = sh = style = fontSize = null; + trstyle = tpstyle = backrs = text = texti = i = bfl = bft = bl = bt = text = _parseFloat = null; /*IEのメモリリーク対策として、空関数を入力*/ this.xmlhttp.onreadystatechange = NAIBU.emptyFunction; if (this._next) { - ifr.contentWindow && (ifr.contentWindow.screen.updateInterval = 0); - ifr = s = null; + ifcw && (ifr.contentWindow.screen.updateInterval = 0); + ifr = ifcw = s = null; this._next._init(); } else { /*全要素の読み込みが終了した場合*/ @@ -4191,7 +4187,7 @@ dbufli = dbuf.length, s, evt; if (dbufli === 0) { - clearInterval(Event._buff); + clearInterval(NAIBU._buff); } else { for (var i=0;i<50;++i) { s = dbuf[n]; @@ -4211,9 +4207,9 @@ } dbuf = n = dbufli = null; }, 1); - ifr = s = null; + ifr = ifcw = s = null; } else { - ifr = s = null; + ifr = ifcw = s = null; NAIBU.Time.start(); } delete NAIBU.doc; @@ -6795,7 +6791,7 @@ /*再度、設定。css.jsのsetPropertyを参照*/ sstyle.setProperty("color", sstyle.getPropertyValue("color")); } - color[i] = "rgb(" +ci.rgbColor.red.cssText+ "," +ci.rgbColor.green.cssText+ "," +ci.rgbColor.blue.cssText+ ")"; + color[i] = "rgb(" +ci.rgbColor.red.getFloatValue(1)+ "," +ci.rgbColor.green.getFloatValue(1)+ "," +ci.rgbColor.blue.getFloatValue(1)+ ")"; colors[i] = stop.offset.baseVal + " " + color[i]; opacity[i] = (sstyle.getPropertyValue("stop-opacity") || 1) * t.getPropertyValue("fill-opacity") * t.getPropertyValue("opacity"); }