svnno****@sourc*****
svnno****@sourc*****
2011年 6月 28日 (火) 22:42:47 JST
Revision: 2801
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2801
Author: dhrname
Date: 2011-06-28 22:42:47 +0900 (Tue, 28 Jun 2011)
Log Message:
-----------
ifrmae要素を使って、描画をサンドボックス化
Modified Paths:
--------------
branches/08x/081/org/w3c/dom/svg.js
Modified: branches/08x/081/org/w3c/dom/svg.js
===================================================================
--- branches/08x/081/org/w3c/dom/svg.js 2011-06-26 10:49:29 UTC (rev 2800)
+++ branches/08x/081/org/w3c/dom/svg.js 2011-06-28 13:42:47 UTC (rev 2801)
@@ -1690,8 +1690,27 @@
*ここでは、responseTextを用いる
*/
var dsd = new Date();
+ var ifr = document.createElement("iframe");
+ ifr.marginWidth= "0px";
+ ifr.marginHeight= "0px";
+ ifr.scrolling = "no";
+ ifr.frameBorder = "0";
+ document.body.appendChild(ifr);
+ var _doc = ifr.contentWindow.document;
+ _doc.write("");
+ _doc.close(); // これがないと document.body は null になる
+ if (("namespaces" in _doc) && !_doc.namespaces["v"]) {
+ _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;
+ }
+ _doc.body.style.backgroundColor = document.body.currentStyle.backgroundColor;
var str = this.xmlhttp.responseText,
- _doc = document,
objei = this._tar,
s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"),
tar = s.documentElement,
@@ -1761,11 +1780,14 @@
tar.setAttributeNodeNS(att);
}
str = attr = null;
+ ifr.style.width = tview.width+3+ "px";
+ ifr.style.height = tview.height+3+ "px";
dcp.style.width = tview.width+ "px";
dcp.style.height = tview.height+ "px";
dcp.coordsize = tview.width+ " " +tview.height;
sp.appendChild(dcp);
- objei.parentNode.insertBefore(sp, objei);
+ _doc.body.appendChild(sp);
+ objei.parentNode.insertBefore(ifr, objei);
dcp.appendChild(sdt);
while (fi) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する
n = s.importNode(fi, true);