svnno****@sourc*****
svnno****@sourc*****
2011年 5月 16日 (月) 19:56:50 JST
Revision: 2682
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2682
Author: dhrname
Date: 2011-05-16 19:56:50 +0900 (Mon, 16 May 2011)
Log Message:
-----------
0.77を統合
Modified Paths:
--------------
trunk/sie.js
Property Changed:
----------------
trunk/sie.js
Modified: trunk/sie.js
===================================================================
--- trunk/sie.js 2011-05-16 10:54:44 UTC (rev 2681)
+++ trunk/sie.js 2011-05-16 10:56:50 UTC (rev 2682)
@@ -976,7 +976,7 @@
var s = new EventListener(useCapture, type, listener), //リスナーを作成
t = type.charAt(0),
that;
- this._capter[this._capter.length] = s; //このノードにリスナーを登録しておく
+ this._capter.push(s); //このノードにリスナーを登録しておく
if ((t !== "D") && (t !== "S") && (type !== "beginEvent") && (type !== "endEvent") && (type !== "repeatEvent")) { //MouseEventsならば
that = this;
that._tar && that._tar.attachEvent("on" +type, (function(node) {
@@ -1024,8 +1024,8 @@
} else if ((etime - td._limit_time_) > 1000) {
/*1秒を超えたらバッファにため込んで後で使う*/
tob = td.implementation._buffer_ || [];
- tob[tob.length] = this;
- tob[tob.length] = evt;
+ tob.push(this);
+ tob.push(evt);
td.implementation._buffer_ = tob;
return true;
}
@@ -1561,7 +1561,7 @@
this.type = CSSRule.STYLE_RULE;
this.selectorText = "";
/*CSSStyleDeclaration*/ this.style = new CSSStyleDeclaration();
- this.style.parentRule = this;
+ this.style.parentRule = null;
return this;
};
CSSStyleRule.prototype = new CSSRule();
@@ -2120,9 +2120,23 @@
CSSStyleSheet.prototype = new StyleSheet();
CSSStyleSheet.constructor = StyleSheet;
/*long*/ CSSStyleSheet.prototype.insertRule = function( /*string*/ rule, /*long*/ index) {
- var s = new CSSStyleRule();
+ var s = new CSSStyleRule(), style = s.style, a, sc = rule.match(/\{[\s\S]+\}/), m;
s.parentStyleSheet = this;
- s.cssText = rule;
+ style.cssText = rule;
+ //style値の解析;
+ sc = sc.replace(/^[^a-z\-]+/, "")
+ .replace(/\:\s+/g, ":")
+ .replace(/\s*;[^a-z\-]*/g, ";");
+ a = sc.split(";");
+ for (var i=0, ali=a.length;i<ali;++i) {
+ ai = a[i],
+ m = ai.split(":");
+ if (ai !== "") {
+ style.setProperty(m[0], m[1]);
+ }
+ ai = m = null;
+ }
+ a = sc = style = null;
this.cssRules.splice(index,s,1);
};
/*void*/ CSSStyleSheet.prototype.deleteRule = function(/*long*/ index) {
@@ -2162,6 +2176,16 @@
q[q.length] = easl[i]; //プレゼンテーション属性を結びつける
}
estl = easl = null;
+ //スタイルシートのルールを結びつける
+ if (elt._rules) {
+ for (var i=0,eli=elt._rules.length;i<eli;++i) {
+ var ei = elt._rules[i].style._list;
+ for (var j=0,esli=ei.length;j<esli;++j) {
+ q[q.length] = ei[j];
+ }
+ }
+ }
+ //inheritの値があれば、削除しておく
for (var i=0,qli=q.length;i<qli;++i) {
if (q[i].cssValueType === csi) {
q.splice(i, 1);
@@ -2235,7 +2259,7 @@
s.title = title;
var nm = new MediaList();
nm.mediaText = media;
- if (media !== "") {
+ if (media && (media !== "")) {
var mes = media.split(","); //文字列をコンマで区切って配列に
for (var i=0,mli=mes.length;i<mli;++i) {
nm.appendMedium(mes[i]); //メディアリストに値を加えていく
@@ -3362,7 +3386,8 @@
*SVGの文書オブジェクト
*/
function SVGDocument(){
- Document.apply(this, arguments);
+ Document.apply(this);
+ DocumentStyle.apply(this);
/*readonly DOMString*/ this.title = "";
/*readonly DOMString*/ this.referrer = document.referrer;
/*readonly DOMString*/ this.domain = document.domain;
@@ -3938,6 +3963,7 @@
/*responseXMLを使うと、時々、空のデータを返すことがあるため(原因は不明)、
*ここでは、responseTextを用いる
*/
+ var dsd = new Date();
var str = this.xmlhttp.responseText,
objei = this._tar,
s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"),
@@ -4153,11 +4179,95 @@
*/
function SVGStyleElement() {
SVGElement.apply(this);
+ LinkStyle.apply(this);
+ /*LinkStyleに関しては、以下の仕様を参照のこと。なお、これはSVG DOMでは継承されていないので要注意。
+ *CSS2 1. Document Object Model Style Sheets
+ * 1.3. Document Extensions
+ * Interface LinkStyle (introduced in DOM Level 2)
+ * http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-LinkStyle
+ */
/*以下はそれぞれ、属性の値に対応している*/
/*DOMString*/ this.xmlspace;
/*DOMString*/ this.type = "text/css";
/*DOMString*/ this.media;
/*DOMString*/ this.title;
+ SVGURIReference.apply(this);
+ this.addEventListener("DOMAttrModified", function(evt){
+ if (evt.attrName === "type") {
+ evt.target.type = evt.newValue;
+ } else if (evt.attrName === "title") {
+ evt.target.title = evt.newValue;
+ }
+ evt = null;
+ }, false);
+ this.addEventListener("SVGLoad", function(evt){
+ var tar = evt.target,
+ sheet = tar.sheet,
+ styleText = tar._text,
+ tod = tar.ownerDocument,
+ style = document.createElement("style"),
+ ri, rsc, scri, rsi;
+ NAIBU._temp_doc = tod;
+ sheet = tod.styleSheets[tod.styleSheets.length] = DOMImplementation.createCSSStyleSheet(tar.title, tar.media);
+ sheet.ownerNode = tar;
+ /*以下は、IEのCSSパーサを使って、スタイルシートのルールを実装していく*/
+ document.documentElement.firstChild.appendChild(style);
+ style.styleSheet.cssText = styleText;
+ for (var i=0, rules=style.styleSheet.rules, rli=rules.length;i<rli;++i) {
+ ri = rules[i];
+ scri = new CSSStyleRule();
+ scri.selectorText = ri.selectorText;
+ scri.style.cssText = ri.style.cssText;
+ rsc = scri.style.cssText.split(";");
+ for (var j=0, rsli=rsc.length;j<rsli;++j) {
+ rsi = rsc[j].split(": ");
+ scri.style.setProperty(rsi[0], rsi[1]);
+ }
+ sheet.cssRules[sheet.cssRules.length] = scri;
+ }
+ tod.documentElement._svgload_limited--;
+ tod.documentElement.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
+ var tar = evt.target,
+ doc = tar.ownerDocument,
+ rules = doc.styleSheets[0] ? doc.styleSheets[0].cssRules : [],
+ selector, ru, tcb = tar.className.baseVal || ".,.";
+ for (var i=0, rli=rules.length;i<rli;++i) {
+ selector = rules[i].selectorText;
+ /*_rulesプロパティはCSSモジュールのgetCoumputedStyleメソッドで使う*/
+ ru = tar._rules || [];
+ if ((selector.indexOf("." +tcb) > -1) || (selector.indexOf("#" +tar.id) > -1)
+ || (tar.nodeName === selector)) {
+ ru[ru.length] = rules[i];
+ }
+ tar._rules = ru;
+ }
+ tar = doc = rules = null;
+ }, true);
+ if (tod.documentElement._svgload_limited < 0) {
+ evt = tod.createEvent("SVGEvents");
+ evt.initEvent("SVGLoad", false, false);
+ tod.documentElement.dispatchEvent(evt);
+ }
+ tar = evt = style = sheet = styleText = tod = i = rules = rli = null;
+ }, false);
+ this.addEventListener("DOMNodeInserted", function(evt){
+ var tar = evt.target;
+ if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
+ if (tar.nodeName === "#cdata-section") {
+ evt.currentTarget._text = tar.data;
+ }
+ return;
+ }
+ tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
+ var tar = evt.target;
+ if ((evt.eventPhase === Event.AT_TARGET) && !tar.getAttributeNodeNS("http://www.w3.org/1999/xlink", "xlink:href")) {
+ var evtt = tar.ownerDocument.createEvent("SVGEvents");
+ evtt.initEvent("SVGLoad", false, false);
+ evt.currentTarget.dispatchEvent(evtt);
+ }
+ tar = evt = null;
+ }, false);
+ }, false);
return this;
};
SVGStyleElement.constructor = SVGElement;
@@ -5149,30 +5259,30 @@
isZ = tar._com._isZ, isC = tar._com._isC;
for (var i=0, tli=tlist.numberOfItems;i<tli;++i) {
var ti = tlist[i],
- tps = ti.pathSegTypeAsLetter,
- t = cname[tps];
+ tps = ti.pathSegTypeAsLetter;
+ dat.push(cname[tps]);
if (isC[tps]) {
/*CTM(mx)の行列と座標(x, y)の積を算出する。数学における表現は以下のとおり
*[ma mc me] [x]
*[mb md mf] * [y]
*[0 0 1 ] [1]
*/
- t += ([_parseInt(ma*ti.x1 + mc*ti.y1 + me, 10),
- _parseInt(mb*ti.x1 + md*ti.y1 + mf, 10),
- _parseInt(ma*ti.x2 + mc*ti.y2 + me, 10),
- _parseInt(mb*ti.x2 + md*ti.y2 + mf, 10),
- _parseInt(ma*ti.x + mc*ti.y + me, 10),
- _parseInt(mb*ti.x + md*ti.y + mf, 10)]).join(" ");
+ dat.push(_parseInt(ma*ti.x1 + mc*ti.y1 + me, 10));
+ dat.push(_parseInt(mb*ti.x1 + md*ti.y1 + mf, 10));
+ dat.push(_parseInt(ma*ti.x2 + mc*ti.y2 + me, 10));
+ dat.push(_parseInt(mb*ti.x2 + md*ti.y2 + mf, 10));
+ dat.push(_parseInt(ma*ti.x + mc*ti.y + me, 10));
+ dat.push(_parseInt(mb*ti.x + md*ti.y + mf, 10));
} else if (!isZ[tps]) {
- t += _parseInt(ma*ti.x + mc*ti.y + me, 10)+ " " +_parseInt(mb*ti.x + md*ti.y + mf, 10);
+ dat.push(_parseInt(ma*ti.x + mc*ti.y + me, 10));
+ dat.push(_parseInt(mb*ti.x + md*ti.y + mf, 10));
}
- dat[i] = t;
}
var vi = tar.ownerDocument.documentElement,
w = vi.width.baseVal.value,
h = vi.height.baseVal.value,
tt = tar._tar;
- dat[dat.length] = " e";
+ dat.push(" e");
tt.path = dat.join(" ");
tt.coordsize = w + " " + h;
NAIBU._setPaint(tar, matrix);
Property changes on: trunk/sie.js
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2646
+ /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2681