svnno****@sourc*****
svnno****@sourc*****
2011年 1月 14日 (金) 19:27:48 JST
Revision: 2299
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2299
Author: dhrname
Date: 2011-01-14 19:27:48 +0900 (Fri, 14 Jan 2011)
Log Message:
-----------
0.67統合
Modified Paths:
--------------
trunk/sie.js
Modified: trunk/sie.js
===================================================================
--- trunk/sie.js 2011-01-14 10:14:20 UTC (rev 2298)
+++ trunk/sie.js 2011-01-14 10:27:48 UTC (rev 2299)
@@ -1116,7 +1116,7 @@
}
}
var ed = evt._default
- evt = te = s = d = tce = n = sli = slii = dn = null;
+ evt = te = s = d = tce = n = sli = slii = dn = i = null;
return ed;
};
@@ -1126,27 +1126,24 @@
this._listener = listener;
return this;
};
+
EventListener.prototype = {
/*void*/ handleEvent : function( /*Event*/ evt) {
-// try {
+ try {
var ph = evt.eventPhase, cap = this._cap;
- if (ph === Event.CAPTURING_PHASE) { //イベントフェーズが捕獲段階であることを示し
+ if (ph === /*Event.CAPTURING_PHASE*/ 1) { //イベントフェーズが捕獲段階であることを示し
cap = cap ? false : true; //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。
}
if (!cap && (evt.type === this._type)) {
this._listener(evt);
}
evt = ph = cap = null;
-/* } catch (e) {
- var evtt = evt.target.ownerDocument.createEvent("SVGEvents");
- evtt.target = evt.target;
- evtt.initEvent("SVGError", true, false);
- evt.target.dispatchEvent(evtt);
- stlog.add(e, 200);
- evtt = null;
- };*/
+ } catch (e) {
+
+ }
}
};
+
/*Eventクラス
*イベントの雛形となる。プロパティもすべて含めて、必須
*/
@@ -1179,7 +1176,6 @@
this.type = eventTypeArg;
this.bubbles = canBubbleArg;
this.cancelable = cancelableArg;
- this.eventPhase = Event.CAPTURING_PHASE; //初期化
}
};
/*Documentノードに直接結びつける
@@ -1269,6 +1265,7 @@
this.newValue = newValueArg;
this.attrName = attrNameArg;
this.attrChange = attrChangeArg;
+ typeArg = canBubbleArg = cancelableArg = relatedNodeArg = prevValueArg = newValueArg = attrNameArg = attrChangeArg = null;
};
// attrChangeType
/*unsigned short*/ MutationEvent.MODIFICATION = 1;
@@ -1671,7 +1668,7 @@
*/
function CSSStyleDeclaration() {
this._list = []; //内部のリスト
- this._list._fontSize = this._list._opacity = null;
+ this._def = this._list._fontSize = this._list._opacity = null;
return this;
};
CSSStyleDeclaration.prototype = {
@@ -1694,6 +1691,7 @@
*CSSValueオブジェクトを返す。このメソッドは判別に用いているので、削除不可。
*/
/*CSSValue*/ getPropertyCSSValue : function( /*string*/ propertyName) {
+ var prop = propertyName;
propertyName += ":";
if (propertyName === ":") { //どんなデータ型でも、文字列に変換する機能をJavaScriptが持つことに注意
return null;
@@ -1702,11 +1700,15 @@
var ti = this._list[i], tc = ti.cssText;
if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
ti._empercents = this._list._fontSize;
- propertyName = null;
+ tc = prop = propertyName = null;
return ti;
}
}
- propertyName = null;
+ if (this._def) {
+ tc = propertyName = null;
+ return (this._def[prop]);
+ }
+ prop = propertyName = null;
return null;
},
/*removePropertyメソッド
@@ -2127,8 +2129,6 @@
/*interface ViewCSS : views::AbstractView {*/
Document.prototype.defaultView = new ViewCSS();
function ViewCSS(){
- this._cache = null;
- this._cache_ele = null;
return this;
};
/*CSSStyleDeclaration*/ ViewCSS.prototype.getComputedStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
@@ -2143,18 +2143,20 @@
if (pelt) {
var p = this.getComputedStyle(pelt, pseudoElt)._list;
} else {
- var p = this._defaultCSS; //デフォルト値の設定
+ var p = {length:0, _opacity:1, _fontSize:12};
}
var q = s._list;
if (!!elt.style) {
- for (var i=0,eli=elt.style._list.length;i<eli;++i) {
- q[q.length] = elt.style._list[i];
+ 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=elt._attributeStyle._list.length;i<eli;++i) {
- q[q.length] = elt._attributeStyle._list[i]; //プレゼンテーション属性を結びつける
+ for (var i=0,eli=easl.length;i<eli;++i) {
+ q[q.length] = easl[i]; //プレゼンテーション属性を結びつける
}
+ estl = easl = null;
for (var i=0,qli=q.length;i<qli;++i) {
- if (q[i].cssValueType === CSSValue.CSS_INHERIT) {
+ if (q[i].cssValueType === csi) {
q.splice(i, 1);
--qli;
}
@@ -2163,6 +2165,7 @@
for (var i=0,pli=p.length;i<pli;++i) {
q[q.length] = p[i];
}
+ s._def = this._defaultCSS; //デフォルト値の設定
s._list = q;
if (!!elt.style) {
var eso = elt.style._list._opacity || elt._attributeStyle._list._opacity;
@@ -2873,6 +2876,7 @@
/*attribute float*/ this.valueInSpecifiedUnits = SVGLength.SVG_LENGTHTYPE_UNKNOWN; //unitTypeにおける値
/*attribute DOMString*/ this.valueAsString;
this._percent = 0.01; //単位に%が使われていた場合、このプロパティの数値を1%として使う
+ return this;
};
// Length Unit Types
/*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_UNKNOWN = 0;
@@ -2887,43 +2891,44 @@
/*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PT = 9;
/*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PC = 10;
+SVGLength.prototype = {
/*newValueSpedifiedUnitsメソッド
*新しくunitTypeにおける値を設定する
*例:2pxならば、x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 2);となる
*/
-SVGLength.prototype.newValueSpecifiedUnits = function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) {
- var n = 1, _s = ""; //nは各単位から利用単位への変換数値。_sは単位の文字列を表す
- if (unitType === SVGLength.SVG_LENGTHTYPE_NUMBER) {
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_PERCENTAGE) {
- n = this._percent;
- _s = "%"
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_EMS) {
- n = this._percent * 100;
- _s = "em";
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_EXS) {
- _s = "ex";
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_CM) {
- n = 35.43307;
- _s = "cm";
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_MM) {
- n = 3.543307;
- _s = "mm";
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_IN) {
- n = 90;
- _s = "in";
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_PT) {
- n = 1.25;
- _s = "pt";
- } else if (unitType === SVGLength.SVG_LENGTHTYPE_PC) {
- n = 15;
- _s = "pc";
- }
- this.unitType = unitType;
- this.value = valueInSpecifiedUnits * n;
- this.valueInSpecifiedUnits = valueInSpecifiedUnits;
- this.valuAsString = valueInSpecifiedUnits + _s;
- n = _s = null;
-};
+ newValueSpecifiedUnits : function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) {
+ var n = 1, _s = ""; //nは各単位から利用単位への変換数値。_sは単位の文字列を表す
+ if (unitType === SVGLength.SVG_LENGTHTYPE_NUMBER) {
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_PERCENTAGE) {
+ n = this._percent;
+ _s = "%"
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_EMS) {
+ n = this._percent * 100;
+ _s = "em";
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_EXS) {
+ _s = "ex";
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_CM) {
+ n = 35.43307;
+ _s = "cm";
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_MM) {
+ n = 3.543307;
+ _s = "mm";
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_IN) {
+ n = 90;
+ _s = "in";
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_PT) {
+ n = 1.25;
+ _s = "pt";
+ } else if (unitType === SVGLength.SVG_LENGTHTYPE_PC) {
+ n = 15;
+ _s = "pc";
+ }
+ this.unitType = unitType;
+ this.value = valueInSpecifiedUnits * n;
+ this.valueInSpecifiedUnits = valueInSpecifiedUnits;
+ this.valuAsString = valueInSpecifiedUnits + _s;
+ n = _s = null;
+ },
/*convertToSpecifiedUnitsメソッド
*valueプロパティを書き換えずに、単位だけを変換する
*例:2cmをmmに変換したい場合
@@ -2931,10 +2936,10 @@
* x.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_MM);
* alert(x.valueAsString); //20mm
*/
-SVGLength.prototype.convertToSpecifiedUnits = function (/*unsigned short*/ unitType) {
- this.newValueSpecifiedUnits(unitType, this.valueInSpecifiedUnits);
+ convertToSpecifiedUnits : function (/*unsigned short*/ unitType) {
+ this.newValueSpecifiedUnits(unitType, this.valueInSpecifiedUnits);
+ }
};
-
function SVGAnimatedLength() {
/*readonly SVGLength*/ this.animVal;
this.baseVal = new SVGLength();
@@ -3356,7 +3361,7 @@
} else {
tar._text = xmlhttp.responseText;
}
- } else {
+ } else if (!!tar._tar) {
tar._tar.src = uri;
}
var ev = tar.ownerDocument.createEvent("SVGEvents");
@@ -3535,6 +3540,7 @@
};
/*SVGLength*/ SVGSVGElement.prototype.createSVGLength = function(){
var s = new SVGLength();
+ s.unitType = /*SVG_LENGTHTYPE_NUMBER*/ 1;
return s;
};
/*SVGPoint*/ SVGSVGElement.prototype.createSVGPoint = function(){
@@ -3915,6 +3921,7 @@
*/
NAIBU.doc.validateOnParse = false;
NAIBU.doc.resolveExternals = false;
+ NAIBU.doc.preserveWhiteSpace = true;
NAIBU.doc.loadXML(str);
/*IE6-8のみで使えるupdateIntervalは、
*描画間隔の調整が可能。デフォルトは0。
@@ -4042,7 +4049,8 @@
}
}
s.defaultView._cache = s.defaultView._cache_ele = null;
- s = evt = null;
+ s = evt = objei = tar = tview = objw = objh = n = att = sdt = sp = dcp = backr = w = h = sw = sh = null;
+ trstyle = tpstyle = backrs = viewWidth = viewHeight = text = bfl = bft = bl = bt = backdown = backright = null;
/*IEのメモリリーク対策として、空関数を入力*/
this.xmlhttp.onreadystatechange = NAIBU.emptyFunction;
if (this._next) {
@@ -5049,7 +5057,7 @@
tar._tar.coordsize = w + " " + h;
NAIBU._setPaint(tar, matrix);
delete tar._cacheMatrix, tar._currentStyle;
- evt = tar = dat = w = h = matrix = tlist = x = y = _parseInt = ma = mb = mc = md = me = mf = vi = isZ = isM = isL = isC = null;
+ evt = tar = dat = w = h = matrix = tlist = x = y = _parseInt = ma = mb = mc = md = me = mf = vi = isZ = isM = isL = isC = i = tli = tps = ti = null;
}, false);
evt = tar = null;
}, false);
@@ -5825,6 +5833,10 @@
/*Bubblingフェーズの時にはもう、div要素をDOMツリーに挿入しておく必要があるため、
*あらかじめ、Capturingフェーズで処理しておく
*/
+ if ((evt.eventPhase === Event.CAPTURING_PHASE) && (tar.localName === "a") && (tar.namespaceURI === "http://www.w3.org/2000/svg") && tar.firstChild) {
+ /*a要素の場合はtarをすりかえておく*/
+ tar = tar.firstChild;
+ }
if ((evt.eventPhase === Event.CAPTURING_PHASE) && (tar.nodeType === Node.TEXT_NODE) && !!!tar._tars) {
/*Textノードにdiv要素を格納したリストをプロパティとして蓄えておく*/
tar._tars = [];
@@ -5996,6 +6008,10 @@
++n;
}
chars += tli;
+ if (ti.parentNode && (ti.parentNode.localName === "a")) { //a要素が親である場合は、tiを親に戻しておく
+ ti = ti.parentNode;
+ }
+ ti = ti.nextSibling;
} else if ((ti.localName === "tspan") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
/*現在のテキスト位置(x,y)の分だけ、tspan要素をずらしておく。
*さらに、現在のテキスト位置を更新する
@@ -6017,8 +6033,13 @@
n += tg;
chars += tg;
p = tg = null;
+ ti = ti.nextSibling;
+ } else if ((ti.localName === "a") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
+ /*a要素のテキストノードも処理する*/
+ ti = ti.firstChild;
+ } else {
+ ti = ti.nextSibling;
}
- ti = ti.nextSibling;
}
tar._isYokogaki = isYokogaki //getEndPositionOfCharメソッドなどで使う
tar = ti = tp = ptx = pty = tx = ty = chars = style = x = y = isYokogaki = null;
@@ -6172,12 +6193,12 @@
var n = parseFloat(style.getPropertyValue("font-size")) * Math.sqrt(Math.abs(tar.getScreenCTM()._determinant()));
ttp.style.fontSize = n + "px";
ttp.style.fontFamily = style.getPropertyValue("font-family");
- var tod = tar.ownerDocument.documentElement;
+ var tod = tar.ownerDocument.documentElement, ttpc = ttp; //ttpcはttpのキャッシュ
var tlen = tar.getComputedTextLength(), anchor = style.getPropertyValue("text-anchor");
/*ここでの変数jは前回ノードまでの総文字数*/
for (var i=0, j=0, tli=tar.getNumberOfChars();i<tli;++i) {
if (ti) {
- if (!!ti._tars) {
+ if (!!ti._tars && (ti._tars.length !== 0)) {
var ij = (i > j) ? i - j : j - i
var sty = ti._tars[ij].style, p = tar.getStartPositionOfChar(i);
sty.position = "absolute";
@@ -6204,8 +6225,12 @@
sty = p = null;
}
if (ti.nodeName === "#text") {
- if ((ti.data.length+j) <= i+1) {
+ if ((ti.data.length+j) <= i+1) { //テキストノード内の文字をすべて処理し終えれば
j = j + ti.data.length;
+ if (ti.parentNode.localName === "a") {
+ ti = ti.parentNode;
+ ttp = ttpc;
+ }
ti = ti.nextSibling;
}
} else if (!!ti.getNumberOfChars) {
@@ -6213,6 +6238,10 @@
j = j + ti.getNumberOfChars();
ti = ti.nextSibling;
}
+ } else if ((ti.localName === "a") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
+ ttp = ti._tar;
+ ti = ti.firstChild;
+ --i;
}
}
}
@@ -6252,7 +6281,7 @@
ttp.appendChild(backr);
}
delete tar._cacheMatrix, tar._currentStyle;
- isRect = evt = tar = style = null;
+ isRect = evt = tar = style = tpp = ttpc = null;
}, false);
evt = tar = null;
},false);
@@ -6721,7 +6750,7 @@
SVGCursorElement.prototype = new SVGElement();
function SVGAElement() {
- SVGElement.apply(this, arguments);
+ SVGElement.apply(this);
this._tar = document.createElement("a");
/*readonly SVGAnimatedString*/ this.target = new SVGAnimatedString();
this.addEventListener("DOMAttrModified", function(evt){
@@ -6739,9 +6768,6 @@
this.addEventListener("DOMNodeInserted", function(evt){
var tar = evt.target;
if (evt.eventPhase === Event.BUBBLING_PHASE) {
- if ((tar.parentNode === evt.currentTarget) && (tar.nodeType === Node.TEXT_NODE)) { //直接Textノードが指定されれば
- evt.currentTarget._tar.appendChild(document.createTextNode(tar.data));
- }
return; //強制終了させる
}
if (tar.nextSibling) {
@@ -7841,9 +7867,13 @@
"opacity",
"cursor"];
if (isMSIE) {
- /*IEのみ、font-sizeは自動で調整されているものを使った方がよい*/
- fontSize = parseFloat(ti._tar.currentStyle.fontSize);
+ var rand = "n" +Math.random();
+ ti._tar.firstChild.setAttribute("id", rand);
+ var titf = document.getElementById(rand);
+ /*IEのみ、font-sizeは自動で調整されている(つまり、DOMからよびだされた)ものを使った方がよい*/
+ fontSize = parseFloat(titf.currentStyle.fontSize);
fe = fontSize / em;
+ rand = titf = null;
}
if (/a/[-1] === 'a') { //Firefoxならば
ds = true;
@@ -7852,6 +7882,9 @@
}
if (ds){
while(node) {
+ if (!glyphs) {
+ break;
+ }
data = node.data;
if (data !== void 0) { //dataがある場合
var advanceX = [], glyphData = [];
@@ -7917,20 +7950,20 @@
}
if (isMSIE) {
var style = ti.ownerDocument.getOverrideStyle(ti, null);
- style.setProperty("display", "none");
+ style.setProperty("visibility", "hidden");
style = null;
} else {
ti.setAttributeNS(null, "opacity", "0");
}
}
- data = isTategaki = horizOrVert = em = advX = dx = dy = fontSize = style = svgns = null;
+ data = isTategaki = horizOrVert = em = advX = dx = dy = fontSize = style = svgns = node = null;
};
/*以下は、getComputedStyleメソッドで使うために、CSS2Propertiesの_listプロパティに、
*CSSprimitiveValueのリストを収納している。なお、その際に、writingModeなどはwriting-modeに変更している
*/
(function(){
- var s = new CSSStyleDeclaration();
+ var s = new CSSStyleDeclaration(), n = 0;
for (var i in CSS2Properties) {
if(CSS2Properties.hasOwnProperty(i)) {
var t = i.replace(/([A-Z])/, "-");
@@ -7941,13 +7974,15 @@
}
t = t.replace(/\-/, u);
s.setProperty(t, CSS2Properties[i]);
+ s._list[t] = s._list[n]; //この処理はCSSモジュールのgetCoputedStyleメソッドのため
+ ++n;
p = m = i = t = u = null;
}
}
s._list._opacity = 1;
s._list._fontSize = 12;
CSS2Properties._list = s._list;
- Document.prototype.defaultView._defaultCSS = CSS2Properties._list;
+ Document.prototype.defaultView._defaultCSS = s._list;
s = null;
})();
@@ -8110,4 +8145,4 @@
};
NAIBU.addEvent("unload", unsvgtovml);
//IEならばtrue
-NAIBU.isMSIE = /*@cc_on!@*/false;
+NAIBU.isMSIE = /*@cc_on!@*/false;
\ No newline at end of file