OSDN Git Service

SVGTextPositioningElementの変数の整理
authordhrname <dhrname@users.sourceforge.jp>
Thu, 23 Jan 2014 12:25:33 +0000 (21:25 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 23 Jan 2014 12:25:33 +0000 (21:25 +0900)
org/w3c/dom/svg.js

index bd268d8..49271ec 100644 (file)
@@ -4274,15 +4274,12 @@ SVGTextPositioningElement.prototype._texto = function(evt) {
       n = parseFloat(style.getPropertyValue("font-size")) * deter,\r
       mt = -n-5+ "px",\r
       lh = n+10+ "px",\r
-      tod = tar.ownerDocument.documentElement,\r
-      ttpc = ttp, //ttpcはttpのキャッシュ\r
       tlen = tar.getComputedTextLength(),\r
       anchor = style.getPropertyValue("text-anchor"),\r
       isMiddle = (anchor === "middle"),\r
       isEnd = (anchor === "end"),\r
       tedeco = style.getPropertyValue("text-decoration"), //text-decorationは継承しないので、個々に設定する\r
       ttps = ttp.style,\r
-      ae = [],\r
       lts = parseFloat(style.getPropertyValue("letter-spacing")),\r
       wds = parseFloat(style.getPropertyValue("word-spacing"));\r
   ttps.fontSize = n + "px"; //nは算出された文字の大きさ (CSSではなく、SVG独自のCTM方式による)\r
@@ -4317,7 +4314,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) {
             div, sty;\r
         for (var i=0, dlen=divs.length;i<dlen;++i) {\r
           var p = tar.getStartPositionOfChar(pos+i);\r
-          if (!isMore) {\r
+          if (!isMore && isYokogaki) {\r
             /*字詰めの処理はブラウザに任せておく*/\r
             div = tar._doc.createElement("div");\r
             div.appendChild(tar._doc.createTextNode(textNode.data));\r
@@ -4341,13 +4338,14 @@ SVGTextPositioningElement.prototype._texto = function(evt) {
           }\r
           sty.left = p.x + "px";\r
           sty.top = p.y + "px";\r
-          sty.width = sty.height = "0px";\r
+          sty.width = "3000px";\r
+          sty.height = "0px";\r
           sty.marginTop = isYokogaki ? mt : "-5px";\r
           sty.lineHeight = lh;\r
           sty.textDecoration = tedeco;\r
           sty.display = "none";\r
           ttp.appendChild(div);\r
-          if (!isMore) {\r
+          if (!isMore && isYokogaki) {\r
             break;\r
           }\r
         }\r
@@ -4370,10 +4368,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) {
       cursor = style.getPropertyCSSValue("cursor"),\r
       vis = style.getPropertyCSSValue("visibility"),\r
       disp = style.getPropertyCSSValue("display"),\r
-      tts = tar._tar.style,\r
-      tft = tar.firstChild._tars, //空白のテキストノードの場合、tftがundefinedになる恐れがある\r
-      ttt = "", //あらかじめ初期化しておく\r
-      tfti;\r
+      tts = tar._tar.style;\r
   if (color === "none"){\r
     tts.color = "transparent";\r
   } else if (color.indexOf("url") === -1) {\r
@@ -4414,23 +4409,12 @@ SVGTextPositioningElement.prototype._texto = function(evt) {
   } else if (disp && !disp._isDefault) {\r
     di = "block";\r
   }\r
-  var jt = tar._tar.firstChild,\r
-      j = 0;\r
+  var jt = tar._tar.firstChild;\r
   while (jt) {\r
     jt.style.display = di;\r
     jt = jt.nextSibling;\r
   }\r
-  while (ae[j]) { //a要素内部のテキストノードの処理\r
-    tft = ae[j]._tars;\r
-    ttt = tft[0] ? tft[0].innerText.charAt(0) : "";\r
-    tftfunc(tft);\r
-    for (var l=0, tli=tft.length;l<tli;++l) {\r
-      tft[l].style.display = di;\r
-    }\r
-    l = void 0;\r
-    ++j;\r
-  }\r
-  tar._cacheMatrix = anchor = isEnd = isMiddle = searchChild = tstylefunc = isMore = mt = lh = tftfunc = ae = isRect = evt = tar = style = tedeco = tpp = ttpc = style = color = cursor = disp = vis = ttps = backr = backrs = di = tft = jt = lts = deter = void 0;\r
+  tar._cacheMatrix = anchor = isEnd = isMiddle = searchChild = tstylefunc = isMore = mt = lh = isRect = evt = tar = style = tedeco = style = color = cursor = disp = vis = ttps = backr = backrs = di = jt = lts = deter = void 0;\r
 };\r
 \r
 function SVGTextElement(_doc) {\r