OSDN Git Service

SVGAElementの_tarプロパティの挿入方式を変更
authordhrname <dhrname@users.sourceforge.jp>
Thu, 23 Jan 2014 13:25:55 +0000 (22:25 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 23 Jan 2014 13:25:55 +0000 (22:25 +0900)
org/w3c/dom/svg.js

index 49271ec..02651fc 100644 (file)
@@ -4317,6 +4317,9 @@ SVGTextPositioningElement.prototype._texto = function(evt) {
           if (!isMore && isYokogaki) {\r
             /*字詰めの処理はブラウザに任せておく*/\r
             div = tar._doc.createElement("div");\r
+            sty = div.style;\r
+            sty.textIndent = sty.marginLeft = sty.marginRight = sty.marginTop = sty.paddingTop = sty.paddingLeft = "0px";\r
+            sty.whiteSpace = "nowrap";\r
             div.appendChild(tar._doc.createTextNode(textNode.data));\r
           } else {\r
             div = textNode._tars[i];\r
@@ -4338,8 +4341,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) {
           }\r
           sty.left = p.x + "px";\r
           sty.top = p.y + "px";\r
-          sty.width = "3000px";\r
-          sty.height = "0px";\r
+          sty.width = sty.height = "0px";\r
           sty.marginTop = isYokogaki ? mt : "-5px";\r
           sty.lineHeight = lh;\r
           sty.textDecoration = tedeco;\r
@@ -5063,13 +5065,27 @@ function SVGAElement(_doc) {
     if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {\r
       return; //強制終了させる\r
     }\r
-    if (tar.nextSibling) {\r
-      if (tar.parentNode._tar && tar.nextSibling._tar) {\r
-        tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar);\r
+    var tnext = tar.nextSibling,\r
+    sar = tar._tar,\r
+    spar = tar.parentNode._tar,\r
+    snext = null;\r
+    if (sar && spar) {\r
+      if (!tnext) {\r
+        spar.appendChild(sar);\r
+      } else {\r
+        while(tnext) {\r
+          if (tnext._tar && tnext._tar.parentNode) {\r
+            /*use要素や実体参照は_tarプロパティをもっていないので、無視する*/\r
+            snext = tnext._tar;\r
+            break;\r
+          }\r
+          tnext = tnext.nextSibling;\r
+        }\r
+        snext && (spar = snext.parentNode);\r
+        spar.insertBefore(sar, snext);\r
       }\r
-    } else if (tar.parentNode._tar){\r
-      tar.parentNode._tar.appendChild(tar._tar);\r
     }\r
+    tnext = sar = spar = snext = void 0;\r
     var txts = tar._tar.style;\r
     txts.cursor = "hand";\r
     txts.left = "0px";\r