[Sie-announce] SIEコード [1115] 1, IE8のため、CSS設定の際にはpxという単位を付けるようにした

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 4月 1日 (水) 22:18:15 JST


Revision: 1115
          http://svn.sourceforge.jp/view?root=sie&view=rev&rev=1115
Author:   dhrname
Date:     2009-04-01 22:18:15 +0900 (Wed, 01 Apr 2009)

Log Message:
-----------
1,IE8のため、CSS設定の際にはpxという単位を付けるようにした
2,VMLの生成はouterHTMLを使ってDOM経由で

Modified Paths:
--------------
    branches/04x/046/sie.js

Modified: branches/04x/046/sie.js
===================================================================
--- branches/04x/046/sie.js	2009-03-29 14:30:36 UTC (rev 1114)
+++ branches/04x/046/sie.js	2009-04-01 13:18:15 UTC (rev 1115)
@@ -98,8 +98,8 @@
 //vmlの名前空間をセット(必須)
 function setVMLNameSpace() {
   if (!document.namespaces["v"]) {
-    document.namespaces.add("v","urn:schemas-microsoft-com:vml");
-    document.namespaces.add("o","urn:schemas-microsoft-com:office:office");
+    document.namespaces.add("v","urn:schemas-microsoft-com:vml", "#default#VML");
+    document.namespaces.add("o","urn:schemas-microsoft-com:office:office", "#default#VML");
   }
   var st = document.createStyleSheet();
   var vmlUrl = "behavior: url(#default#VML);display:inline-block;"; //inline-blockはIEのバグ対策
@@ -178,8 +178,8 @@
   this.setObject(c,sw,sh);
   var backr = document.createElement("v:rect"); //背景の作成
   backr.style.position = "absolute";
-  backr.style.width = w;
-  backr.style.height = h;
+  backr.style.width = w+ "px";
+  backr.style.height = h+ "px";
   backr.style.zIndex = -1;
   backr.setAttribute("stroked", "false");
   backr.setAttribute("filled", "false");
@@ -197,11 +197,11 @@
   var bt = -this.vi._ty;
   if (bfl !== 0) { //内部の図形にずれが生じたとき
     bl = bfl;
-    tpstyle.left = -bl;
+    tpstyle.left = -bl+ "px";
   }
   if (bft !== 0) {
     bt = bft;
-    tpstyle.top = -bt;
+    tpstyle.top = -bt+ "px";
   }
   var backright = bl + viewWidth + 1;
   var backdown = bt + viewHeight + 1;
@@ -211,14 +211,14 @@
   for (var i=0,textli=text.length;i<textli;++i) {
     var texti = text[i];
     var tis = texti.style;
-    tis.left = parseFloat(tis.left) + bl;
-    tis.top = parseFloat(tis.top) + bt;
+    tis.left = parseFloat(tis.left) + bl + "px";
+    tis.top = parseFloat(tis.top) + bt + "px";
     var tp = texti.parentNode;
     while (tp.nodeName === "group") { //group要素である限り、さかのぼる
       tp = tp.parentNode;
     }
     if (tp.nodeName === "A") { //先祖要素がa要素ならば
-      tis.marginLeft = -parseFloat(tis.fontSize);
+      tis.marginLeft = -parseFloat(tis.fontSize)+ "px";
       tis.cursor = "hand";
     }
   }
@@ -378,8 +378,8 @@
     this.xlink.set();
     var txts = this.xlink.tar.style;
     txts.cursor = "hand";
-    txts.left = 0;
-    txts.top = 0;
+    txts.left = "0px";
+    txts.top = "0px";
     txts.textDecoration = "none";
   }  catch(e) {stlog.add(e,204);}
 }
@@ -414,16 +414,16 @@
   if (ttp.lastChild.nodeName !== "rect") {
     var backr = document.createElement("v:rect");
     var backrs = backr.style; //ずれを修正するためのもの
-    backrs.width = 1;
-    backrs.height = 1;
-    backrs.left = 0;
-    backrs.top = 0;
+    backrs.width = "1px";
+    backrs.height = "1px";
+    backrs.left = "0px";
+    backrs.top = "0px";
     backr.setAttribute("stroked", "false");
     backr.setAttribute("filled", "false");
     ttp.appendChild(backr);
   }
-  tts.width = 0;
-  tts.height = 0;
+  tts.width = "0px";
+  tts.height = "0px";
   this.paint.fset(w,h,ttm);
   } catch(e) {stlog.add(e,236);}
   try {
@@ -497,15 +497,15 @@
   try {
   var tts = this.tar.style;
   tts.position = "relative";
-  tts.left = (this.dx ? this.dx.value : 0) + dd.dx;
-  tts.top = (this.dy ? this.dy.value : 0) + dd.dy;
+  tts.left = (this.dx ? this.dx.value : 0) + dd.dx+ "px";
+  tts.top = (this.dy ? this.dy.value : 0) + dd.dy+ "px";
   var p, ptm;
   if (this.x && this.y) { //x属性とy属性が指定されていたならば(注:仕様と相違がある可能性?)。
     p = new Point(this.x.value, this.y.value);
     ptm = p.matrixTransform(this.transformable);
     tts.position = "absolute";
-    tts.left = ptm.x;
-    tts.top = ptm.y;
+    tts.left = ptm.x+ "px";
+    tts.top = ptm.y+ "px";
   }
   p = ptm = null;
   //ずれの値を返す
@@ -873,10 +873,10 @@
     ts.position = "absolute";
     var pt = new Point(this.x.value, this.y.value);
     var ptt = pt.matrixTransform(ttm);
-    ts.left = ptt.x;
-    ts.top =  ptt.y;
-    ts.width = this.width.value * ttm.a;
-    ts.height = this.height.value * ttm.d;
+    ts.left = ptt.x+ "px";
+    ts.top =  ptt.y+ "px";
+    ts.width = this.width.value * ttm.a+ "px";
+    ts.height = this.height.value * ttm.d+ "px";
     if (ttm.b !== 0 || ttm.c !== 0 || this.paint.fillopacity != 1) {//フィルター プロパティを使うと、PNGの透過性がなくなるので注意
       ts.filter = "progid:DXImageTransform.Microsoft.Matrix progid:DXImageTransform.Microsoft.Alpha";
       var ttfi = this.tar.filters.item('DXImageTransform.Microsoft.Matrix');
@@ -1310,7 +1310,7 @@
     var outline = document.getElementById("_NAIBU_outline");
     var background = document.createElement("div");
     background.style.position = "absolute";
-    background.style.textAlign = "left"; background.style.top = 0; background.style.left = 0; background.style.width = this.w; background.style.height = this.h;
+    background.style.textAlign = "left"; background.style.top = "0px"; background.style.left = "0px"; background.style.width = this.w+ "px"; background.style.height = this.h+ "px";
     outline.appendChild(background);
     background.style.filter = "progid:DXImageTransform.Microsoft.Compositor";
     background.filters.item('DXImageTransform.Microsoft.Compositor').Function = 23;
@@ -1390,10 +1390,11 @@
   var tts = this.tar.style;
   tts.whiteSpace = "nowrap";
   tts.color = this.fill === "none" ? "transparent"  :  this.fill;
-  this.fontSize = tts.fontSize = fontset(this["font-size"],w,h,matrix);
+  this.fontSize = fontset(this["font-size"],w,h,matrix);
+  tts.fontSize = this.fontSize+ "px";
   if (this.cursor !== "default") {tts.cursor = this.cursor;}
   this.writingMode = tts.writingMode;
-  tts.marginTop = (this.writingMode === "tb-rl") ? 0 : -parseFloat(tts.fontSize);
+  tts.marginTop = (this.writingMode === "tb-rl") ? "0px" : -parseFloat(tts.fontSize)+ "px";
  } catch(e){stlog.add(e,1185);}
 }
 
@@ -1598,8 +1599,10 @@
     }
   }
   var ttps =  this.tar.parentNode.style;
-  ttps.marginLeft = this._tx = tx;
-  ttps.marginTop = this._ty = ty;
+  this._tx = tx;
+  this._ty = ty;
+  ttps.marginLeft = this._tx+ "px";
+  ttps.marginTop = this._ty+ "px";
   var m = new Matrix(xr, 0, 0, yr, 0, 0);
   return m;
   } catch(e) {stlog.add(e,1031);}
@@ -1915,13 +1918,14 @@
   var obst = ob.style;
   ob.innerHTML = dc;
   var obc = ob.getElementsByTagName("group").item(0);  //obcはSVGのルート要素
+  obc.outerHTML = obc.outerHTML //IE8の標準モード対策
   var regaw = obc.getAttribute("svgwidth") || obwidth;
   var regah = obc.getAttribute("svgheight") || obheight;
   regw = new STLength(regaw,obwidth);
   regh = new STLength(regah,obheight);
   var regwv = regw.value,  reghv = regh.value;
-  obst.width = regwv;
-  obst.height = reghv;
+  obst.width = regwv+ "px";
+  obst.height = reghv+ "px";
   ob.setAttribute("coordsize",regwv  +" "+  reghv);
   var dn = new Date();
   STdocument[dn] = new SVGtoVML(obc,obwidth,obheight,regw,regh);




Sie-announce メーリングリストの案内
Back to archive index