From 8f8e722ac9dedc41521f7e9ce84f1bc961a9dde8 Mon Sep 17 00:00:00 2001 From: dhrname Date: Thu, 23 Jan 2014 22:25:55 +0900 Subject: [PATCH] =?utf8?q?SVGAElement=E3=81=AE=5Ftar=E3=83=97=E3=83=AD?= =?utf8?q?=E3=83=91=E3=83=86=E3=82=A3=E3=81=AE=E6=8C=BF=E5=85=A5=E6=96=B9?= =?utf8?q?=E5=BC=8F=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- org/w3c/dom/svg.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/org/w3c/dom/svg.js b/org/w3c/dom/svg.js index 49271ec..02651fc 100644 --- a/org/w3c/dom/svg.js +++ b/org/w3c/dom/svg.js @@ -4317,6 +4317,9 @@ SVGTextPositioningElement.prototype._texto = function(evt) { if (!isMore && isYokogaki) { /*字詰めの処理はブラウザに任せておく*/ div = tar._doc.createElement("div"); + sty = div.style; + sty.textIndent = sty.marginLeft = sty.marginRight = sty.marginTop = sty.paddingTop = sty.paddingLeft = "0px"; + sty.whiteSpace = "nowrap"; div.appendChild(tar._doc.createTextNode(textNode.data)); } else { div = textNode._tars[i]; @@ -4338,8 +4341,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) { } sty.left = p.x + "px"; sty.top = p.y + "px"; - sty.width = "3000px"; - sty.height = "0px"; + sty.width = sty.height = "0px"; sty.marginTop = isYokogaki ? mt : "-5px"; sty.lineHeight = lh; sty.textDecoration = tedeco; @@ -5063,13 +5065,27 @@ function SVGAElement(_doc) { if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) { return; //強制終了させる } - if (tar.nextSibling) { - if (tar.parentNode._tar && tar.nextSibling._tar) { - tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + var tnext = tar.nextSibling, + sar = tar._tar, + spar = tar.parentNode._tar, + snext = null; + if (sar && spar) { + if (!tnext) { + spar.appendChild(sar); + } else { + while(tnext) { + if (tnext._tar && tnext._tar.parentNode) { + /*use要素や実体参照は_tarプロパティをもっていないので、無視する*/ + snext = tnext._tar; + break; + } + tnext = tnext.nextSibling; + } + snext && (spar = snext.parentNode); + spar.insertBefore(sar, snext); } - } else if (tar.parentNode._tar){ - tar.parentNode._tar.appendChild(tar._tar); } + tnext = sar = spar = snext = void 0; var txts = tar._tar.style; txts.cursor = "hand"; txts.left = "0px"; -- 2.11.0