[Sie-announce] SIEコード [3095] 0. 89のモジュールを結合

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2011年 11月 16日 (水) 22:43:08 JST


Revision: 3095
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=3095
Author:   dhrname
Date:     2011-11-16 22:43:07 +0900 (Wed, 16 Nov 2011)

Log Message:
-----------
0.89のモジュールを結合

Modified Paths:
--------------
    branches/08x/sie.js

Modified: branches/08x/sie.js
===================================================================
--- branches/08x/sie.js	2011-11-16 11:07:26 UTC (rev 3094)
+++ branches/08x/sie.js	2011-11-16 13:43:07 UTC (rev 3095)
@@ -449,8 +449,6 @@
  *属性ノード。削除不可。
  */
 function Attr() {
-  Node.apply(this);
-  delete this._capter;
   return this;
 };
 Attr.prototype = new Node();                    //ノードのプロトタイプチェーンを作って、継承
@@ -1793,8 +1791,12 @@
     } else if (propertyName === "opacity") {
       this._list._opacity = +value;
     } else if (propertyName === "font-size") {
-      if (/(%|em)/.test(value)) {
-        this._list.fontSize = parseFloat(value);
+      if (/(%|em|ex)/.test(value)) {
+        tg = "_" +RegExP.$1
+        ti[tg] = parseFloat(value);
+      } else {
+        this._em = this._ex = this["_%"] = null;
+        this._list._fontSize = parseFloat(value);
       }
     }
     cssText = void 0;
@@ -1868,6 +1870,7 @@
   this._value = null;
   this._percent = 0; //単位に%が使われていた場合、このプロパティの数値を1%として使う
   this._empercent = 0;
+  this._em = this._ex = this["_%"] = null; //emが単位の場合、getComputedStyleメソッドなどで使う
   /*void*/ this.setFloatValue = function(/*short*/ unitType, /*float*/ floatValue) {
     if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合
       throw new DOMException(DOMException.INVALID_ACCESS_ERR);
@@ -2162,14 +2165,14 @@
 };
 /*CSSStyleDeclaration*/ ViewCSS.prototype.getComputedStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
   var s = new CSSStyleDeclaration(),
-      ct, p;
-  ct = null
-  p = {length:0, _opacity:1, _fontSize:12};
+      el, es,
+      eso = 1;
   //クロージャを利用して、カスケーディングを実現する
   s.getPropertyCSSValue = (function(elt, td, s){
     return function( /*string*/ propertyName) {
       var el = elt,
-      css = null;
+          css = null,
+          n;
       while (el && (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0))) {
         if (el._runtimeStyle && el._runtimeStyle[propertyName]) {
           css = el._runtimeStyle.getPropertyCSSValue(propertyName);
@@ -2190,21 +2193,41 @@
         //デフォルト値を探す
         td && (css = td[propertyName]);
       }
-      if (css && ((css.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) || (css.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
-        css.setRGBColor && css.setRGBColor(s.getPropertyValue("color"));
+      if (css && css.setRGBColor && ((css.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) || (css.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
+        css.setRGBColor(s.getPropertyValue("color"));
+      } else if (css && (css._em || css._ex || css["_%"])) {
+        el = elt;
+        n = 1;
+        while (el) {
+          if (el.style._list._fontSize) {
+            n = el.style._list._fontSize;
+            break;
+          }
+          el = el.parentNode;
+        }
+        if (css._em) {
+          n *= css._em;
+        } else if (css._ex) {
+          n *= css._ex * 0.5;
+        } else if (css["_%"]) {
+          n *= css["_%"] / 100; 
+        }
+        css.cssText = "font-size:" +n+ "px";
       }
       el = void 0;
       return css;
     };
    })(elt, this._defaultCSS, s); //_defaultCSSはデフォルト値の設定
-  if (!!elt.style) {
-    var eso = elt.style._list._opacity || elt._attributeStyle._list._opacity;
-  } else {
-    var eso = 1;
+  el = elt;
+  while (el) {
+    if (el.style) {
+      es = el.style._list._opacity || el._attributeStyle._list._opacity;
+      eso *= es || 1;
+    }
+    el = el.parentNode;
   }
-  s._list._opacity = p._opacity * (eso || 1);
-  s._list._fontSize = p._fontSize;
-  pelt = eso = p = void 0;
+  s._list._opacity = eso;
+  el = pelt = eso = es = void 0;
   s._document = elt.ownerDocument;
   return s;
 };
@@ -2543,7 +2566,8 @@
       if (!!n) {
         n = n[0];
       }
-      if (n === "%") {
+      if (!n) { //軽量化のためにチェックを設ける
+      } else if (n === "%") {
         if (tar._x1width[name]) {
           tea.baseVal._percent = tvw * 0.01;
         } else if (tar._y1height[name]) {
@@ -3032,8 +3056,16 @@
 //                    raises( SVGException );
 /*void*/ this.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){
   this.colorType = colorType;
-  if (rgbColor && ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) || (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
+  if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) && iccColor) {
+    throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR);
+  } else if (colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) {
     this.setRGBColor(rgbColor);
+  } else if (rgbColor && (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
+    this.setRGBColor(rgbColor);
+  } else if ((colorType === /*SVGColor.SVG_COLORTYPE_UNKNOWN*/ 0) && (rgbColor || iccColor)) {
+    throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR);
+  } else if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR_ICCCOLOR*/ 2) && (rgbColor || !iccColor)) {
+    throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR);
   }
   colorType = rgbColor = void 0;
 }
@@ -3552,12 +3584,12 @@
             }
           }
           if (((tar.localName === "g") || (tar.localName === "a")) && (tar.namespaceURI === "http://www.w3.org/2000/svg")) {
-            tar._currentStyle = tar._cacheMatrix = null; //キャッシュを消去
+            tar._cacheMatrix = void 0; //キャッシュを消去
             if (tar.firstChild) {
               slist = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
               for (var i=0,sli=slist.length;i<sli;++i) {
                 tar = slist[i];
-                tar._currentStyle = tar._cacheMatrix = null;
+                tar._cacheMatrix = void 0;
                 evtt = tar.ownerDocument.createEvent("MutationEvents");
                 evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
                 evtt.target = tar;
@@ -4146,7 +4178,8 @@
     }
     backright = bl + viewWidth + 1;
     backdown = bt + viewHeight + 1;
-    trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)";    this._document = s;
+    trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)";
+    this._document = s;
     if ("_svgload_limited" in s.documentElement) {
       /*_svgload_limitedプロパティはXlink言語が使われていない限り、0である。
        *xlink:href属性が指定されるたびに+1となる。
@@ -6440,7 +6473,6 @@
     }
     tnext = tpart = isLast = void 0;
     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
-      evt.target._currentStyle = void 0; //キャッシュが生成されることがあるので削除
       var tar = evt.target,
           ti = tar.firstChild,
           ttp = tar._tar,
@@ -6451,7 +6483,8 @@
           tlen = tar.getComputedTextLength(),
           anchor = style.getPropertyValue("text-anchor"),
           tedeco = style.getPropertyValue("text-decoration"), //text-decorationは継承しないので、個々に設定する
-          ttps = ttp.style;
+          ttps = ttp.style,
+          ae = [];
       ttps.fontSize = n + "px";
       ttps.fontFamily = style.getPropertyValue("font-family");
       ttps.fontStyle = style.getPropertyValue("font-style");
@@ -6484,7 +6517,7 @@
             sty.marginTop = tar._isYokogaki ? -n-5+ "px" : "-5px";
             sty.lineHeight = n+10+ "px";
             sty.textDecoration = tedeco;
-            sty.display = "block";
+            sty.display = "none"
             ttp.appendChild(ti._tars[ij]);
             sty = p = void 0;
           }
@@ -6505,6 +6538,7 @@
           } else if ((ti.localName === "a") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
             ttp = ti._tar;
             ti = ti.firstChild;
+            ae[ae.length] = ti;
             i-=2;
           }
         }
@@ -6513,7 +6547,10 @@
           cursor = style.getPropertyCSSValue("cursor"),
           vis = style.getPropertyCSSValue("visibility"),
           disp = style.getPropertyCSSValue("display"),
-          tts = tar._tar.style;
+          tts = tar._tar.style,
+          tft = tar.firstChild._tars,
+          ttt = tft[0].innerText.charAt(0), //あらかじめ初期化しておく
+          tfti;
       if (color === "none"){
         tts.color = "transparent";
       } else if (color.indexOf("url") === -1) {
@@ -6526,29 +6563,22 @@
         tts.cursor = tc.substring(tc.indexOf(":")+1, tc.length);
         tc = void 0;
       }
-      if (vis && !vis._isDefault) {
-        tts.visibility = vis.cssText.substring(vis.cssText.indexOf(":")+1, vis.cssText.length);
-      }
-       if (disp && !disp._isDefault && (disp.cssText.indexOf("none") > -1)) {
-        tts.display = "none";
-            } else if (disp && !disp._isDefault) {
-        tts.display = "block";
-      }
       if ((tar.x.baseVal.numberOfItems === 1) && (tar.y.baseVal.numberOfItems === 1)
           && tar._isYokogaki && (tar.firstChild.nodeName === "#text")) {
         /*xとy属性が一つの値しか取らないとき、字詰めの処理をすべてブラウザに任せておく。
          *以下では、他のdiv要素のテキストをすべて、最初のdiv要素にまとめている
          */
-        var tft = tar.firstChild._tars,
-            ttt = tft[0].innerText.charAt(0); //あらかじめ初期化しておく
         for (var i=1, tli=tft.length;i<tli;++i) {
-          ttt += tft[i].innerText;
-          tft[i].style.display = "none";
+          tfti = tft[i];
+          ttt += tfti.innerText;
+          tfti.parentNode.removeChild(tfti);
         }
-        tft[0].innerText = ttt;
-        ttt = tft = void 0;
+        //以下でinnerTextやinnerHTMLを使うのは、IE6でエラーとなる可能性がある
+        tft[0].replaceChild(_doc.createTextNode(ttt), tft[0].firstChild);
+        ttt = void 0;
       }
-      var isRect = true;
+      var isRect = true,
+          di = "block";
       if (ttp.lastChild) {
         if (ttp.lastChild.nodeName !== "rect") {
           isRect = false;
@@ -6564,8 +6594,26 @@
         backr.stroked = backr.filled = "false";
         ttp.appendChild(backr);
       }
+      if (vis && !vis._isDefault) {
+        tts.visibility = vis.cssText.substring(vis.cssText.indexOf(":")+1, vis.cssText.length);
+      }
+      /*dipslayプロパティだけは個々に設定しておく必要がある*/
+      if (disp && !disp._isDefault && (disp.cssText.indexOf("none") > -1)) {
+        di = "none";
+            } else if (disp && !disp._isDefault) {
+        di = "block";
+      }
+      for (var i=0, j=0, tli=tft.length;i<tli;++i) {
+        tft[i].style.display = di;
+        while (ae[j]) { //a要素を処理
+          for (var l=0, tli=ae[j]._tars.length;l<tli;++l) {
+            ae[j]._tars[l].style.display = di;
+          }
+          ++j;
+        }
+      }
       delete tar._cacheMatrix;
-      isRect = evt = tar = style = tedeco = tpp = ttpc = style = color = cursor = disp = vis = ttps = backr = backrs = void 0;
+      ae = isRect = evt = tar = style = tedeco = tpp = ttpc = style = color = cursor = disp = vis = ttps = backr = backrs = di = tft = void 0;
     }, false);
     evt = tar = void 0;
   },false);




Sie-announce メーリングリストの案内
アーカイブの一覧に戻る