[Sie-announce] SIEコード [2234] SVGFontElementの修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 12月 21日 (火) 22:33:08 JST


Revision: 2234
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2234
Author:   dhrname
Date:     2010-12-21 22:33:08 +0900 (Tue, 21 Dec 2010)

Log Message:
-----------
SVGFontElementの修正

Modified Paths:
--------------
    branches/06x/066/org/w3c/dom/svg.js

Modified: branches/06x/066/org/w3c/dom/svg.js
===================================================================
--- branches/06x/066/org/w3c/dom/svg.js	2010-12-20 14:15:48 UTC (rev 2233)
+++ branches/06x/066/org/w3c/dom/svg.js	2010-12-21 13:33:08 UTC (rev 2234)
@@ -5188,30 +5188,30 @@
   /*_isExternalは外部から呼び出されたfont要素ならば、真(1)となる*/
   /*boolean or number*/ this._isExternal = 0;
   this.addEventListener("DOMNodeInserted", function(evt){
-    var tar = evt.target, svgns = "http://www.w3.org/2000/svg";
+    var tar = evt.target;
     if (evt.eventPhase === Event.BUBBLING_PHASE) {
       return;
     }
-    var fontFace = tar.getElementsByTagNameNS(svgns, "font-face").item(0);
-    var nefunc = function(evt){
-      var svg = evt.target;
-      /*以下のtarはfont要素*/
-      var familyName = fontFace.getAttributeNS(null, "font-family");
-      var textElements = tar.ownerDocument.getElementsByTagNameNS(svgns, "text");
-      for (var i=0,tli=textElements.length;i<tli;++i) {
-        var ti = textElements[i], style = tar.ownerDocument.defaultView.getComputedStyle(ti, '');
-        if (style.getPropertyValue("font-family", null).indexOf(familyName) > -1) {
-          NAIBU._noie_createFont(ti, tar, true);
+    tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
+      var tar = evt.target, svgns = "http://www.w3.org/2000/svg", fontFace = tar.getElementsByTagNameNS(svgns, "font-face").item(0);
+      var nefunc = function(evt){
+        var svg = evt.target;
+        /*以下のtarはfont要素*/
+        var familyName = fontFace.getAttributeNS(null, "font-family");
+        var textElements = tar.ownerDocument.getElementsByTagNameNS(svgns, "text");
+        for (var i=0,_tar=tar,tli=textElements.length;i<tli;++i) {
+          var ti = textElements[i], style = _tar.ownerDocument.defaultView.getComputedStyle(ti, '');
+          if (style.getPropertyValue("font-family", null).indexOf(familyName) > -1) {
+            NAIBU._noie_createFont(ti, _tar, true);
+          }
         }
+        evt = tar = svg = curt = textElments = svgns = _tar = null;
+      };
+      if (!fontFace.__isLinked || tar._isExternal) {
+        tar.ownerDocument.documentElement._svgload_limited = 0;
+        tar.ownerDocument.documentElement.addEventListener("SVGLoad", nefunc, false);
       }
-      evt = tar = svg = curt = textElments = svgns = null;
-    };
-    if (!fontFace.__isLinked) {
-      tar.ownerDocument.documentElement.addEventListener("SVGLoad", nefunc, false);
-    }
-    if (tar._isExternal) {
-      nefunc({target : tar.ownerDocument.documentElement});
-    }
+    }, false);
   }, false);
   return this;
 };
@@ -5287,7 +5287,7 @@
       tpp = tar.parentNode.parentNode; //tppをfont-face要素としておく
     }
     tar._instance._isExternal = 1;
-    tpp.parentNode.replaceChild(tar._instance, tpp);
+    tpp.parentNode.appendChild(tar._instance);
     evt = tar = tpp = null;
   }, false);
   SVGURIReference.apply(this);




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