svnno****@sourc*****
svnno****@sourc*****
2011年 8月 6日 (土) 19:27:35 JST
Revision: 2848
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2848
Author: dhrname
Date: 2011-08-06 19:27:35 +0900 (Sat, 06 Aug 2011)
Log Message:
-----------
0.82 統合
Modified Paths:
--------------
trunk/sie.js
Property Changed:
----------------
trunk/sie.js
Modified: trunk/sie.js
===================================================================
--- trunk/sie.js 2011-08-06 10:24:11 UTC (rev 2847)
+++ trunk/sie.js 2011-08-06 10:27:35 UTC (rev 2848)
@@ -1,4 +1,4 @@
-/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
+/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
*公式ページは http://sie.sourceforge.jp/
*利用方法は <script defer="defer" type="text/javascript" src="sie.js"></script>
*http://sie.sourceforge.jp/
@@ -3983,14 +3983,7 @@
/*responseXMLを使うと、時々、空のデータを返すことがあるため(原因は不明)、
*ここでは、responseTextを用いる
*/
- var ifr = document.createElement("iframe");
- ifr.marginWidth = ifr.marginHeight = "0px"; //このマージン設定がないと、全体がずれてしまう
- ifr.scrolling = "no";
- ifr.frameBorder = "0";
- /*iframe要素を使って、描画のプロセスを分離する
- *したがって、_docはdocumentとは別のオブジェクトとなる
- */
- this._tar.parentNode.insertBefore(ifr, this._tar);
+ var ifr = this._tar.previousSibling;
ifr.contentWindow.screen.updateInterval = 999;
var _doc = ifr.contentWindow.document;
_doc.write("");
@@ -4169,8 +4162,7 @@
}
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 = null;
- text = _parseFloat = null;
+ trstyle = tpstyle = backrs = viewWidth = viewHeight = text = texti = i = bfl = bft = bl = bt = backdown = backright = text = _parseFloat = null;
/*IEのメモリリーク対策として、空関数を入力*/
this.xmlhttp.onreadystatechange = NAIBU.emptyFunction;
if (this._next) {
@@ -4209,9 +4201,9 @@
}
dbuf = n = dbufli = null;
}, 1);
- s = null;
+ ifr = s = null;
} else {
- s = null;
+ ifr = s = null;
NAIBU.Time.start();
}
delete NAIBU.doc;
@@ -6504,8 +6496,8 @@
sty.top = p.y + "px";
sty.width = "0px";
sty.height = "0px";
- sty.marginTop = tar._isYokogaki ? -n+ "px" : "0px";
- sty.lineHeight = n+ "px";
+ sty.marginTop = tar._isYokogaki ? -n-10+ "px" : "-10px";
+ sty.lineHeight = n+10+ "px";
ttp.appendChild(ti._tars[ij]);
sty = p = null;
}
@@ -6530,7 +6522,10 @@
}
}
}
- var color = style.getPropertyValue("fill");
+ var color = style.getPropertyValue("fill"),
+ cursor = style.getPropertyCSSValue("cursor"),
+ vis = style.getPropertyCSSValue("visibility"),
+ disp = style.getPropertyCSSValue("display");
if (color === "none"){
tar._tar.style.color = "transparent";
} else if (color.indexOf("url") === -1) {
@@ -6538,14 +6533,19 @@
} else {
tar._tar.style.color = "black";
}
- var cursor = style.getPropertyValue("cursor");
- if (cursor !== "auto" && cursor !== "") {
- tar._tar.style.cursor = cursor;
+ if (cursor && !cursor._isDefault) { //初期値でないならば
+ var tc = cursor.cssText;
+ el.style.cursor = tc.substring(tc.indexOf(":")+1, tc.length);
+ tc = null;
}
- var vis = style.getPropertyValue("visibility");
- if (vis !== "visiblee") {
- tar._tar.style.visibility = vis;
+ if (vis && !vis._isDefault) {
+ el.style.visibility = vis.cssText.substring(vis.cssText.indexOf(":")+1, vis.cssText.length);
}
+ if (disp && !disp._isDefault && (disp.cssText.indexOf("none") > -1)) {
+ el.style.display = "none";
+ } else if (disp && !disp._isDefault) {
+ el.style.display = "block";
+ }
var isRect = true;
if (ttp.lastChild) {
if (ttp.lastChild.nodeName !== "rect") {
@@ -6567,7 +6567,7 @@
}
delete tar._cacheMatrix;
delete tar._currentStyle;
- isRect = evt = tar = style = tpp = ttpc = null;
+ isRect = evt = tar = style = tpp = ttpc = style = color = cursor = disp = vis = null;
}, false);
evt = tar = null;
},false);
@@ -8297,14 +8297,19 @@
doc = data = null;
};
NAIBU._noie_createFont = function(/*Element*/ ti, /*Element*/ font, /*boolean*/ isMSIE) {
- var style = ti.ownerDocument.defaultView.getComputedStyle(ti, ''), svgns = "http://www.w3.org/2000/svg";
- //isTategakiは縦書きならば真
- var isTategaki = ti.getAttributeNS(null, "writing-mode") || ti.parentNode.getAttributeNS(null, "writing-mode"), horizOrVert = isTategaki ? "vert-adv-y" : "horiz-adv-x";
- var node = ti.firstChild, data, glyphs = font.getElementsByTagNameNS(svgns, "glyph");
- var em = parseFloat(font.getElementsByTagNameNS(svgns, "font-face").item(0).getAttribute("units-per-em") || 1000);
- var advX = parseFloat( (font.getAttributeNS(null, horizOrVert) || em) ); //字幅の設定
- var dx = parseFloat(ti.getAttributeNS(null, "x") || 0), fontSize = parseFloat(style.getPropertyValue("font-size")), dy = parseFloat(ti.getAttributeNS(null, "y") || 0), fe = fontSize / em;
- var ds = false, npdlist = ["fill",
+ var style = ti.ownerDocument.defaultView.getComputedStyle(ti, ''),
+ svgns = "http://www.w3.org/2000/svg",
+ //isTategakiは縦書きならば真
+ isTategaki = ti.getAttributeNS(null, "writing-mode") || ti.parentNode.getAttributeNS(null, "writing-mode"),
+ horizOrVert = isTategaki ? "vert-adv-y" : "horiz-adv-x",
+ node = ti.firstChild, data, glyphs = font.getElementsByTagNameNS(svgns, "glyph"),
+ em = parseFloat(font.getElementsByTagNameNS(svgns, "font-face").item(0).getAttributeNS(null, "units-per-em") || 1000),
+ advX = parseFloat( (font.getAttributeNS(null, horizOrVert) || em) ), //字幅の設定
+ dx = parseFloat(ti.getAttributeNS(null, "x") || 0),
+ dy = parseFloat(ti.getAttributeNS(null, "y") || 0),
+ fontSize = parseFloat(style.getPropertyValue("font-size")),
+ fe = fontSize / em;
+ ds = false, npdlist = ["fill",
"fill-opacity",
"stroke",
"stroke-width",
@@ -8315,15 +8320,6 @@
"stroke-opacity",
"opacity",
"cursor"];
- if (isMSIE) {
- var rand = "n" +Math.random();
- ti._tar.firstChild.setAttribute("id", rand);
- var titf = ti.ownerDocument._document_.getElementById(rand);
- /*IEのみ、font-sizeは自動で調整されている(つまり、DOMからよびだされた)ものを使った方がよい*/
- fontSize = parseFloat(titf.currentStyle.fontSize);
- fe = fontSize / em;
- rand = titf = null;
- }
if (/a/[-1] === 'a') { //Firefoxならば
ds = true;
} else if (isMSIE || isTategaki) {
@@ -8472,7 +8468,8 @@
*/
NAIBU._main = (function() {
stlog = new STLog(false);
- var xmlhttp; //XMLHttpオブジェクトを生成
+ var xmlhttp, //XMLHttpオブジェクトを生成
+ _doc = document; //documentのエイリアスを作成
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
@@ -8491,24 +8488,25 @@
}
NAIBU.xmlhttp = xmlhttp;
var nd;
- if (("namespaces" in document) && !document.namespaces["v"]) {
+ if (("namespaces" in _doc) && !_doc.namespaces["v"]) {
NAIBU.doc = new ActiveXObject("MSXML2.DomDocument");
nd = NAIBU.doc;
- document.namespaces.add("v","urn:schemas-microsoft-com:vml");
- document.namespaces.add("o","urn:schemas-microsoft-com:office:office");
- var st = document.createStyleSheet();
+ _doc.namespaces.add("v","urn:schemas-microsoft-com:vml");
+ _doc.namespaces.add("o","urn:schemas-microsoft-com:office:office");
+ var st = _doc.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;
}
- var ary = document.getElementsByTagName("script");
+ var ary = _doc.getElementsByTagName("script");
//全script要素をチェックして、type属性がimage/svg+xmlならば、中身をSVGとして処理する
- for (var i=0; i < ary.length; ++i) {
- var hoge = ary[i].type;
- if (ary[i].type === "image/svg+xml") {
- var ait = ary[i].text;
+ for (var i=0; ary[i]; ++i) {
+ var ai = ary[i],
+ hoge = ai.type;
+ if (ai.type === "image/svg+xml") {
+ var ait = ai.text;
if (sieb_s && ait.match(/<svg/)) {
//ソース内のタグを除去
ait = ait.replace(/<.+?>/g, "");
@@ -8516,7 +8514,7 @@
ait = ait.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/&/g, "&");
}
if (NAIBU.isMSIE) {
- var gsd = new GetSVGDocument(ary[i]);
+ var gsd = new GetSVGDocument(ai);
gsd.xmlhttp = {
readyState : 4,
status : 200,
@@ -8526,29 +8524,55 @@
} else {
var base = location.href.replace(/\/[^\/]+?$/,"/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/
ait = ait.replace(/\shref=(['"a-z]+?):\/\//g, " target='_top' xlink:href=$1://").replace(/\shref=(.)/g, " target='_top' xlink:href=$1"+base);
- var s = NAIBU.textToSVG(ait,ary[i].getAttribute("width"),ary[i].getAttribute("height"));
- ary[i].parentNode.insertBefore(s,ary[i]);
+ var s = NAIBU.textToSVG(ait,ai.getAttribute("width"),ai.getAttribute("height"));
+ ai.parentNode.insertBefore(s,ai);
}
- ait = null;
+ ai = ait = null;
}
hoge = null;
}
NAIBU.doc = nd;
nd = ary = null;
if (xmlhttp && NAIBU.isMSIE) {
- if (!!document.createElementNS && !!document.createElementNS( "http://www.w3.org/2000/svg", "svg").createSVGRect) { //IE9ならば
+ if (!!_doc.createElementNS && !!_doc.createElementNS( "http://www.w3.org/2000/svg", "svg").createSVGRect) { //IE9ならば
} else { //IE6-8ならば
- var oba = document.createElement("div");
- oba.setAttribute("id","_NAIBU_outline");
- document.body.appendChild(oba);
- var ob = document.getElementsByTagName("object"), em = document.getElementsByTagName("embed");
- var i = 0, s=[];
- for (;i<ob.length;++i) {
- s[s.length] = new GetSVGDocument(ob[i]);
+ var ob = _doc.getElementsByTagName("object"),
+ em = _doc.getElementsByTagName("embed"),
+ i = 0,
+ s=[],
+ ifr, obi, n;
+ for (;ob[i];++i) {
+ obi = ob[i];
+ s[s.length] = new GetSVGDocument(obi);
+ ifr = _doc.createElement("iframe");
+ ifr.style.background = "black";
+ n = obi.getAttribute("width");
+ n && ifr.setAttribute("width", n);
+ n = obi.getAttribute("height");
+ n && ifr.setAttribute("height", n);
+ ifr.marginWidth = ifr.marginHeight = "0px"; //このマージン設定がないと、全体がずれてしまう
+ ifr.scrolling = "no";
+ ifr.frameBorder = "0";
+ /*iframe要素を使って、描画のプロセスを分離する
+ *したがって、_docはdocumentとは別のオブジェクトとなる
+ */
+ obi.parentNode.insertBefore(ifr, obi);
}
- for (i=0;i<em.length;++i) {
- s[s.length] = new GetSVGDocument(em[i]);
+ for (i=0;em[i];++i) {
+ obi = em[i];
+ s[s.length] = new GetSVGDocument(obi);
+ ifr = _doc.createElement("iframe");
+ ifr.style.background = "black";
+ n = obi.getAttribute("width");
+ n && ifr.setAttribute("width", n);
+ n = obi.getAttribute("height");
+ n && ifr.setAttribute("height", n);
+ ifr.marginWidth = ifr.marginHeight = "0px"; //このマージン設定がないと、全体がずれてしまう
+ ifr.scrolling = "no";
+ ifr.frameBorder = "0";
+ obi.parentNode.insertBefore(ifr, obi);
}
+ ob = em = i = obi = ifr = null;
for (i=0;i<s.length;++i) {
if (i < s.length-1) {
s[i]._next = s[i+1]
@@ -8560,17 +8584,17 @@
s = null;
}
} else {
- var ob = document.getElementsByTagName("object");
+ var ob = _doc.getElementsByTagName("object");
for (var i=0;i<ob.length;++i) {
if (ob[i].contentDocument) {
NAIBU._fontSearchURI({target:{ownerDocument:ob[i].contentDocument}});
} else if (ob[i].getSVGDocument) {
- ob[i].getSVGDocument().documentElement.addEventListener("SVGLoad", NAIBU._fontSearchURI, false);
+ ob[i].getSVGDocument()._docElement.addEventListener("SVGLoad", NAIBU._fontSearchURI, false);
} else {
}
}
}
- xmlhttp = null;
+ xmlhttp = _doc = null;
});
NAIBU.addEvent("load", NAIBU._main);
NAIBU.utf16 = function ( /*string*/ s) {
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-2817
+ /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-2847