svnno****@sourc*****
svnno****@sourc*****
2011年 8月 19日 (金) 20:21:29 JST
Revision: 2878 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2878 Author: dhrname Date: 2011-08-19 20:21:29 +0900 (Fri, 19 Aug 2011) Log Message: ----------- 0.83 統合 Modified Paths: -------------- trunk/sie.js Property Changed: ---------------- trunk/sie.js Modified: trunk/sie.js =================================================================== --- trunk/sie.js 2011-08-19 11:09:18 UTC (rev 2877) +++ trunk/sie.js 2011-08-19 11:21:29 UTC (rev 2878) @@ -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などで使う @@ -4088,7 +4093,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); @@ -4109,13 +4114,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"; @@ -4124,15 +4127,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; @@ -4142,9 +4141,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である。 @@ -4173,13 +4169,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 { /*全要素の読み込みが終了した場合*/ @@ -4193,7 +4189,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]; @@ -4213,9 +4209,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; @@ -6797,7 +6793,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"); } 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/047/sie.js:1131-1164 /branches/04x/048/sie.js:1166-1180 /branches/04x/sie.js:830-1181 /branches/05x/050/sie.js:1183-1201 /branches/05x/051/sie.js:1207-1323 /branches/05x/052/sie.js:1325-1352 /branches/05x/053/sie.js:1354-1400 /branches/05x/054/sie.js:1403-1422 /branches/05x/055/sie.js:1424-1454 /branches/05x/056/sie.js:1456-1491 /branches/05x/057/sie.js:1496-1523 /branches/05x/058/sie.js:1526-1590 /branches/05x/sie.js:1183-1594 /branches/06x/060/sie.js:1603-1850 /branches/06x/sie.js:1599-2355 /branches/07x/sie.js:2357-2748 /branches/08x/sie.js:2750-2857 + /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 /branches/05x/050/sie.js:1183-1201 /branches/05x/051/sie.js:1207-1323 /branches/05x/052/sie.js:1325-1352 /branches/05x/053/sie.js:1354-1400 /branches/05x/054/sie.js:1403-1422 /branches/05x/055/sie.js:1424-1454 /branches/05x/056/sie.js:1456-1491 /branches/05x/057/sie.js:1496-1523 /branches/05x/058/sie.js:1526-1590 /branches/05x/sie.js:1183-1594 /branches/06x/060/sie.js:1603-1850 /branches/06x/sie.js:1599-2355 /branches/07x/sie.js:2357-2748 /branches/08x/sie.js:2750-2877