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

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2011年 11月 3日 (木) 19:58:28 JST


Revision: 3059
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=3059
Author:   dhrname
Date:     2011-11-03 19:58:28 +0900 (Thu, 03 Nov 2011)

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

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

Modified: branches/08x/sie.js
===================================================================
--- branches/08x/sie.js	2011-11-03 10:53:07 UTC (rev 3058)
+++ branches/08x/sie.js	2011-11-03 10:58:28 UTC (rev 3059)
@@ -1644,7 +1644,7 @@
  */
 function CSSStyleDeclaration() {
   this._list = []; //内部のリスト
-  this._def = this._list._fontSize = this._list._opacity = null;
+  this._list._fontSize = this._list._opacity = null;
   return this;
 };
 CSSStyleDeclaration.prototype = {
@@ -1683,10 +1683,6 @@
         return ti;
       }
     }
-    if (this._def) {
-      i = tl = tli = tc = propertyName = void 0;
-      return (this._def[prop]);
-    }
     i = tl = tli = prop = propertyName = void 0;
     return null;
   },
@@ -1761,7 +1757,6 @@
         uri = RegExp.$1;
       } else if (value === "currentColor") {
         paintType = /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102;
-        color = this.getPropertyValue("color") || "rgb(0,0,0)";
       }
       ti.setPaint(paintType, uri, color, null);
       paintType = v1 = uri = color = void 0;
@@ -1773,27 +1768,10 @@
       }
       if (value === "currentColor") {
         ti.colorType = /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3;
-        value = this.getPropertyValue("color") || "rgb(0,0,0)";
       } else {
         ti.colorType = /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1;
       }
       ti.setRGBColor(value);
-    } else if (this._isColor[propertyName]) {
-      if (tg) {  //見つかった場合
-        ti = tg;
-      } else {
-        ti = new CSSPrimitiveValue();
-      }
-      fill = this.getPropertyCSSValue("fill");
-      stroke = this.getPropertyCSSValue("stroke");
-      stop = this.getPropertyCSSValue("stop-color");
-      if (fill && (fill.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102)) {
-        fill.setPaint(fill.paintType, null, value, null);
-      } else if (stroke && (stroke.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102)) {
-        stroke.setPaint(fill.paintType, null, value, null);
-      } else if (stop && (stop.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
-        stop.setRGBColor(value);
-      }
     } else {
       if (tg) {  //見つかった場合
         ti = tg;
@@ -1831,23 +1809,6 @@
       var s = this._list[index].cssText.substring(0, this._list[index].cssText.indexOf(":"));
     }
     return s;
-  },
-  /*_setCSSTextメソッド SIE独自のメソッド。
-   *リストをテキストに変換して、cssTextプロパティに格納しておく。cssTextがsetterである場合は、削除しておくこと。
-   */
-  _setCSSText : function () {
-    var tlist = this._list,
-        list = {}, //SIEの設計上、プロパティが重複してしまう恐れがあるので、重複防止のためのチェックするオブジェクト
-        ti;
-    this.length = tlist.length; //setPropertyメソッドを解さないで処理する場合があるため、lengthプロパティを同値にする
-    for (var i=tlist.length-1;i>=0;--i) {
-      ti = this.item(i);
-      if (!list[ti]) {
-        this.cssText += tlist[i].cssText+ ";";
-        list[ti] = 1;
-      }
-    }
-    tlist = list = ti = i = void 0;
   }
 };
 
@@ -2200,54 +2161,42 @@
   return this;
 };
 /*CSSStyleDeclaration*/ ViewCSS.prototype.getComputedStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
-  if (!!elt._currentStyle) {
-    /*キャッシュがあれば、それを返す*/
-    return (elt._currentStyle);
-  }
-  var s = new CSSStyleDeclaration();
-  elt._currentStyle = s;
-  //リストを連結することによって、カスケーディングを実現する
-  var pelt = elt.parentNode;
-  if (pelt) {
-    var p = this.getComputedStyle(pelt, pseudoElt)._list;
-  } else {
-    var p = {length:0, _opacity:1, _fontSize:12};
-  }
-  var q = s._list;
-  if (!!elt.style) {
-    var estl = elt.style._list, easl = elt._attributeStyle._list, csi = CSSValue.CSS_INHERIT;
-    for (var i=0,eli=estl.length;i<eli;++i) {
-      q[q.length] = estl[i];
-    }
-    for (var i=0,eli=easl.length;i<eli;++i) {
-      q[q.length] = easl[i];   //プレゼンテーション属性を結びつける
-    }
-    estl = easl = void 0;
-    //スタイルシートのルールを結びつける
-    if (elt._rules) {
-      for (var i=0,eli=elt._rules.length;i<eli;++i) {
-        var ei = elt._rules[i].style._list;
-        for (var j=0,esli=ei.length;j<esli;++j) {
-          q[q.length] = ei[j];
+  var s = new CSSStyleDeclaration(),
+      ct, p;
+  ct = null
+  p = {length:0, _opacity:1, _fontSize:12};
+  //クロージャを利用して、カスケーディングを実現する
+  s.getPropertyCSSValue = (function(elt, td, s){
+    return function( /*string*/ propertyName) {
+      var el = elt,
+      css = null;
+      while (el && (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0))) {
+        if (el._runtimeStyle && el._runtimeStyle[propertyName]) {
+          css = el._runtimeStyle.getPropertyCSSValue(propertyName);
+        } else if (el.style && el.style[propertyName]) {
+          css = el.style.getPropertyCSSValue(propertyName);
+        } else if (el._attributeStyle && el._attributeStyle[propertyName]) {
+          //プレゼンテーション属性を探す
+          css = el._attributeStyle.getPropertyCSSValue(propertyName);
+        } else if (el._rules) {
+          //スタイルシートのルールを探す
+          for (var i=0,eli=el._rules.length;i<eli;++i) {
+            el._rules[i].style[propertyName] && (css = el._rules[i].style.getPropertyCSSValue(propertyName));
+          }
         }
+        el = el.parentNode;
       }
-    }
-    //inheritの値があれば、削除しておく
-    for (var i=0,qli=q.length;i<qli;++i) {
-      if (q[i].cssValueType === csi) {
-        q.splice(i, 1);
-        --qli;
+      if (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0)) {
+        //デフォルト値を探す
+        td && (css = td[propertyName]);
       }
-    }
-  }
-  for (var i=0,pli=p.length;i<pli;++i) {
-    q[q.length] = p[i];
-  }
-  if (elt._runtimeStyle) {
-    q = elt._runtimeStyle._list.concat(q);
-  }
-  s._def = this._defaultCSS;    //デフォルト値の設定
-  s._list =  q;
+      if (css && ((css.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) || (css.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
+        css.setRGBColor && css.setRGBColor(s.getPropertyValue("color"));
+      }
+      el = void 0;
+      return css;
+    };
+   })(elt, this._defaultCSS, s); //_defaultCSSはデフォルト値の設定
   if (!!elt.style) {
     var eso = elt.style._list._opacity || elt._attributeStyle._list._opacity;
   } else {
@@ -2255,7 +2204,7 @@
   }
   s._list._opacity = p._opacity * (eso || 1);
   s._list._fontSize = p._fontSize;
-  pelt = eso = p = q = void 0;
+  pelt = eso = p = void 0;
   s._document = elt.ownerDocument;
   return s;
 };
@@ -2272,29 +2221,29 @@
     var s = new CSSStyleDeclaration(), setProp = s.setProperty;
     tar._runtimeStyle = s;
   }
-  s.setProperty = function(propertyName, value, priority) {
-    setProp.call(s, propertyName, value, priority);
-    var tar = elt, el = tar._tar, isFill = isStroke = false;
-    delete tar._currentStyle;
-    if ((tar.localName === "g") || (tar.localName === "a")) {
-      var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
-      if (sl) {
-        for (var i=0,sli=sl.length;i<sli;++i) {
-          var di = sl[i];
-          delete di._currentStyle;
-          NAIBU._setPaint(di, di.getScreenCTM());
-          di = void 0;
+  s.setProperty = (function(setProp, s){
+    return function(propertyName, value, priority) {
+      setProp.call(s, propertyName, value, priority);
+      var tar = elt, el = tar._tar, isFill = isStroke = false;
+      if ((tar.localName === "g") || (tar.localName === "a")) {
+        var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
+        if (sl) {
+          for (var i=0,sli=sl.length;i<sli;++i) {
+            var di = sl[i];
+            NAIBU._setPaint(di, di.getScreenCTM());
+            di = void 0;
+          }
+          sl = void 0;
         }
-        sl = void 0;
+        el = null;
       }
-      el = null;
-    }
-    if (!el) {
-      return;
-    }
-    NAIBU._setPaint(tar, tar.getScreenCTM());
-    el = tar = value = void 0;
-  }
+      if (!el) {
+        return;
+      }
+      NAIBU._setPaint(tar, tar.getScreenCTM());
+      el = tar = value = void 0;
+    };
+  })(setProp, s);
   return s;
 };
 /*createCSSStyleSheetメソッド
@@ -3083,7 +3032,7 @@
 //                    raises( SVGException );
 /*void*/ this.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){
   this.colorType = colorType;
-  if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) || (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
+  if (rgbColor && ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) || (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) {
     this.setRGBColor(rgbColor);
   }
   colorType = rgbColor = void 0;
@@ -4225,7 +4174,7 @@
       }
     }
     //ビューポートの位置をスクロールで調整 (なお、_txプロパティはSVGSVGElementのSIEコードを参照)
-    ifcw.scroll(-s.documentElement._tx, -s.documentElement._ty);
+    ifcw && ifcw.scroll(-s.documentElement._tx, -s.documentElement._ty);
     s._isLoaded = 1;  //_isLoadedプロパティはevents::dispatchEventメソッドで使う
     s.defaultView._cache = s.defaultView._cache_ele = null;
     oba = _doc = evt = ndoc = objei = tar = tview = objw = objh = n = att = sdt = sp = dcp = backr = sw = sh = style = fontSize = void 0;
@@ -5376,7 +5325,6 @@
   tt.coordsize = vi.width.baseVal.value + " " + vi.height.baseVal.value;
   NAIBU._setPaint(tar, matrix);
   delete tar._cacheMatrix;
-  delete tar._currentStyle;
   evt = tar = dat = t = tx = ty = matrix = tlist = x = y = _parseInt = ma = mb = mc = md = me = mf = vi = isZ = isC = i = tli = tps = ti = cname = tt = void 0;
 };
 _sproto._com = {
@@ -5771,7 +5719,6 @@
       ele.coordsize = w + " " + h;
       NAIBU._setPaint(tar, ctm);
       delete tar._cacheMatrix;
-      delete tar._currentStyle;
       evt = tar = style = list = dat = ele = vi = fontSize = void 0;
     }, false);
     evt = tar = void 0;
@@ -5852,7 +5799,6 @@
         ele.coordsize = w + " " + h;
         NAIBU._setPaint(tar, ctm);
         delete tar._cacheMatrix;
-        delete tar._currentStyle;
         evt = tar = list = style = fontSize = dat = ele = void 0;
     }, false);
     evt = tar = void 0;
@@ -5935,7 +5881,6 @@
       ele.coordsize = w + " " + h;
       NAIBU._setPaint(tar, ctm);
       delete tar._cacheMatrix;
-      delete tar._currentStyle;
       evt = ele = tar = style = fontSize = dat = list = ctm = w = h = void 0;
     }, false);
     evt = tar = void 0;
@@ -6008,7 +5953,6 @@
       ele.coordsize = w + " " + h;
       NAIBU._setPaint(tar, ctm);
       delete tar._cacheMatrix;
-      delete tar._currentStyle;
       evt = ele = tar = style = fontSize = dat = list = ctm = vi = w = h = void 0;
     }, false);
     evt = tar = void 0;
@@ -6097,7 +6041,6 @@
       ele.coordsize = w + " " + h;
       NAIBU._setPaint(tar, ctm);
       delete tar._cacheMatrix;
-      delete tar._currentStyle;
       evt = ele = tar = dat = list = ctm = w = h = vi = void 0;
     }, false);
     evt = tar = void 0;
@@ -6509,10 +6452,10 @@
           anchor = style.getPropertyValue("text-anchor"),
           tedeco = style.getPropertyValue("text-decoration"), //text-decorationは継承しないので、個々に設定する
           ttps = ttp.style;
-      style._setCSSText();
-      ttps.cssText = style.cssText;
       ttps.fontSize = n + "px";
       ttps.fontFamily = style.getPropertyValue("font-family");
+      ttps.fontStyle = style.getPropertyValue("font-style");
+      ttps.fontWeight = style.getPropertyValue("font-weight");
       /*ここでの変数jは前回ノードまでの総文字数*/
       for (var i=0, j=0, tli=tar.getNumberOfChars();i<tli;++i) {
         if (ti) {
@@ -6622,7 +6565,6 @@
         ttp.appendChild(backr);
       }
       delete tar._cacheMatrix;
-      delete tar._currentStyle;
       isRect = evt = tar = style = tedeco = tpp = ttpc = style = color = cursor = disp = vis = ttps = backr = backrs = void 0;
     }, false);
     evt = tar = void 0;
@@ -7171,6 +7113,7 @@
       st = "new";
     }
     tar.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", st);
+    tar._tar.style.color = tar.ownerDocument.defaultView.getComputedStyle(tar, "").getPropertyValue("fill");
     tar = evt = void 0;
   }, false);
   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
@@ -7187,47 +7130,45 @@
   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
     var tar = evt.target;
     tar._tar.setAttribute("target", tar.target.baseVal);
-    tar = void 0;
-  }, false);
-  this.addEventListener("click", function(evt){
-    var tar = evt.target;
     if (tar.href.baseVal.indexOf(".svg") !== -1) { //もし、リンク先がSVGファイルならば
-      var sd = document.body,
-          ob, nd;
-      sd.lastChild.innerHTML = "<object data='" +tar.href.baseVal.split("#")[0]+ "' width='" +screen.width+ "' height='" +screen.height+ "' type='image/svg+xml'></object>";
-      if (tar.target.baseVal === "_self") {
-        nd = tar.ownerDocument._iframe;
-        nd.parentNode.insertBefore(sd.lastChild.firstChild, nd);
-        ob = nd.nextSibling;
-        if (ob && (ob.tagName === "OBJECT")) {
-          nd.previousSibling.setAttribute("width", ob.getAttribute("width"));
-          nd.previousSibling.setAttribute("height", ob.getAttribute("height"));
-          nd.parentNode.removeChild(ob);
-        }
-        ob = NAIBU._search([nd.previousSibling]);
-        nd.parentNode.removeChild(nd);
-      } else {
-        sd.appendChild(sd.lastChild.firstChild);
-        while (sd.firstChild !== sd.lastChild) {     //オブジェクト要素以外を除去
-          sd.removeChild(sd.firstChild);
-        }
-        ob = NAIBU._search([sd.lastChild]);
-      }
-      NAIBU.doc = new ActiveXObject("MSXML2.DomDocument");
-      evt.preventDefault();
-      ob._next = {
-        _init: (function (ob) {
-          return (function(){
-            document.title = ob.getSVGDocument().title;
-            ob = void 0;
-          });
-        })(ob)
-      };
-      ob._init();
-      sd = ob = nd = void 0;
-    } else {
-      location.href = tar.href.baseVal;
+      tar.addEventListener("click", function(evt){
+          var tar = evt.target,
+              sd = document.body,
+              ob, nd;
+          sd.lastChild.innerHTML = "<object data='" +tar.href.baseVal.split("#")[0]+ "' width='" +screen.width+ "' height='" +screen.height+ "' type='image/svg+xml'></object>";
+          if (tar.target.baseVal === "_self") {
+            nd = tar.ownerDocument._iframe;
+            nd.parentNode.insertBefore(sd.lastChild.firstChild, nd);
+            ob = nd.nextSibling;
+            if (ob && (ob.tagName === "OBJECT")) {
+              nd.previousSibling.setAttribute("width", ob.getAttribute("width"));
+              nd.previousSibling.setAttribute("height", ob.getAttribute("height"));
+              nd.parentNode.removeChild(ob);
+            }
+            ob = NAIBU._search([nd.previousSibling]);
+            nd.parentNode.removeChild(nd);
+          } else {
+            sd.appendChild(sd.lastChild.firstChild);
+            while (sd.firstChild !== sd.lastChild) {     //オブジェクト要素以外を除去
+              sd.removeChild(sd.firstChild);
+            }
+            ob = NAIBU._search([sd.lastChild]);
+          }
+          NAIBU.doc = new ActiveXObject("MSXML2.DomDocument");
+          evt.preventDefault();
+          ob._next = {
+            _init: (function (ob) {
+              return (function(){
+                document.title = ob.getSVGDocument().title;
+                ob = void 0;
+              });
+            })(ob)
+          };
+          ob._init();
+          sd = ob = nd = void 0;
+      }, false);
     }
+    tar = void 0;
   }, false);
   SVGURIReference.apply(this, arguments);
   return this;
@@ -8020,7 +7961,8 @@
       var tar = evt.target,
           attrName = tar.getAttributeNS(null, "attributeName"),
           ttr = tar.targetElement,
-          fstyle = tar.ownerDocument.defaultView.getComputedStyle(ttr, "");
+          fstyle = tar.ownerDocument.defaultView.getComputedStyle(ttr, ""),
+          css, n;
       if (!tar._values[0]) {
         tar._values[0] = fstyle.getPropertyValue(attrName);
       }
@@ -8029,13 +7971,19 @@
         if (tar._values[i] === "currentColor") {
           to.setRGBColor(fstyle.getPropertyValue("color") || "black");
         } else if (tar._values[i] === "inherit") {
-          to.setRGBColor(fstyle.getPropertyValue(attrName) || "black");
+          /*いったん、cssValueTypeプロパティをinheritに指定して、継承元のオブジェクトを取得*/
+          css = fstyle.getPropertyCSSValue(attrName);
+          n = css.cssValueType;
+          css.cssValueType = /*CSSValue.CSS_INHERIT*/ 0;
+          to = fstyle.getPropertyCSSValue(attrName);
+          css.cssValueType = n;
         } else {
           to.setRGBColor(tar._values[i]);
         }
         tar._valueList[tar._valueList.length] = to;
         to = void 0;
       }
+      tar = ttr = fstyle = css = n = attrName = void 0;
     }, false);
   }, false);
   this.addEventListener("beginEvent", function(evt) {
@@ -8043,9 +7991,6 @@
         attrName = tar.getAttributeNS(null, "attributeName"),
         style = tar.ownerDocument.getOverrideStyle(tar.targetElement, ""),
         fstyle = tar.ownerDocument.defaultView.getComputedStyle(tar.targetElement, "");
-    if (tar._values[0] !== null) {
-      style.setProperty(attrName, tar._values[0], null);
-    }
     tar._frame = function() {
       var _tar = tar;
       /*公式に関しては、SMIL2.0 Animation Moduleの単純アニメーション関数の項を参照
@@ -8083,13 +8028,16 @@
           b = fb + (tc.blue.getFloatValue(num) - fb) * durd;
       style.setProperty(attrName, "rgb(" +Math.ceil(r)+ "," +Math.ceil(g)+ "," +Math.ceil(b)+ ")", null);
       _tar = d = n = tg = fc = tc = fr = fg = fb = num = r = g = b = void 0;
-    }
+    };
+    tar._frame();
   }, false);
   this.addEventListener("endEvent", function(evt) {
     var tar = evt.target;
-    var evtt = tar.ownerDocument.createEvent("MutationEvents");
-    evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
-    tar.targetElement.dispatchEvent(evtt);
+    if (!fill || (fill === "remove")) {
+      var evtt = tar.ownerDocument.createEvent("MutationEvents");
+      evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
+      tar.targetElement.dispatchEvent(evtt);
+    }
     tar._frame = evt = evtt = void 0;
   }, false);
   this.addEventListener("repeatEvent", function(evt) {




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