From svnnotify @ sourceforge.jp Tue Mar 2 20:15:34 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 02 Mar 2010 20:15:34 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjg5XSAgbm9kZVR5cGU=?= =?utf-8?b?44Gu5a6a5pWw44KS6Kit5a6a?= Message-ID: <1267528534.063797.6638.nullmailer@users.sourceforge.jp> Revision: 1689 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1689 Author: dhrname Date: 2010-03-02 20:15:33 +0900 (Tue, 02 Mar 2010) Log Message: ----------- nodeTypeの定数を設定 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-02-28 14:27:42 UTC (rev 1688) +++ branches/ufltima/core.js 2010-03-02 11:15:33 UTC (rev 1689) @@ -76,31 +76,6 @@ interface NodeList; interface NamedNodeMap; interface Element; - - exception DOMException { - unsigned short code; - }; - // ExceptionCode - const unsigned short INDEX_SIZE_ERR = 1; - const unsigned short DOMSTRING_SIZE_ERR = 2; - const unsigned short HIERARCHY_REQUEST_ERR = 3; - const unsigned short WRONG_DOCUMENT_ERR = 4; - const unsigned short INVALID_CHARACTER_ERR = 5; - const unsigned short NO_DATA_ALLOWED_ERR = 6; - const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; - const unsigned short NOT_FOUND_ERR = 8; - const unsigned short NOT_SUPPORTED_ERR = 9; - const unsigned short INUSE_ATTRIBUTE_ERR = 10; - // Introduced in DOM Level 2: - const unsigned short INVALID_STATE_ERR = 11; - // Introduced in DOM Level 2: - const unsigned short SYNTAX_ERR = 12; - // Introduced in DOM Level 2: - const unsigned short INVALID_MODIFICATION_ERR = 13; - // Introduced in DOM Level 2: - const unsigned short NAMESPACE_ERR = 14; - // Introduced in DOM Level 2: - const unsigned short INVALID_ACCESS_ERR = 15; */ function DOMException(n){ Error.apply(this, arguments); @@ -211,26 +186,26 @@ /* Node *ノード(節)はすべての雛形となる重要なものである。削除不可。 - * - // NodeType - const unsigned short ELEMENT_NODE = 1; - const unsigned short ATTRIBUTE_NODE = 2; - const unsigned short TEXT_NODE = 3; - const unsigned short CDATA_SECTION_NODE = 4; - const unsigned short ENTITY_REFERENCE_NODE = 5; - const unsigned short ENTITY_NODE = 6; - const unsigned short PROCESSING_INSTRUCTION_NODE = 7; - const unsigned short COMMENT_NODE = 8; - const unsigned short DOCUMENT_NODE = 9; - const unsigned short DOCUMENT_TYPE_NODE = 10; - const unsigned short DOCUMENT_FRAGMENT_NODE = 11; - const unsigned short NOTATION_NODE = 12; -*/ + */ + function Node(){ this.childNodes = []; this._capter = []; //eventで利用 return this; } +// NodeType +/*const unsigned short*/ Node.ELEMENT_NODE = 1; +/*const unsigned short*/ Node.ATTRIBUTE_NODE = 2; +/*const unsigned short*/ Node.TEXT_NODE = 3; +/*const unsigned short*/ Node.CDATA_SECTION_NODE = 4; +/*const unsigned short*/ Node.ENTITY_REFERENCE_NODE = 5; +/*const unsigned short*/ Node.ENTITY_NODE = 6; +/*const unsigned short*/ Node.PROCESSING_INSTRUCTION_NODE = 7; +/*const unsigned short*/ Node.COMMENT_NODE = 8; +/*const unsigned short*/ Node.DOCUMENT_NODE = 9; +/*const unsigned short*/ Node.DOCUMENT_TYPE_NODE = 10; +/*const unsigned short*/ Node.DOCUMENT_FRAGMENT_NODE = 11; +/*const unsigned short*/ Node.NOTATION_NODE = 12; Node.prototype = { //以下は初期値として設定 tar : null, @@ -327,12 +302,12 @@ /*Node*/ cloneNode : function( /*boolean*/ deep) { var s; switch (this.nodeType) { - case 1: + case Node.ELEMENT_NODE: s = new Element(); s.tagName = this.tagName; s.attributes._copyNode(this.attributes,false); //NamedNodeMapのコピーを行う break; - case 9: + case Node.DOCUMENT_NODE: s = new Document(); break; default: @@ -355,7 +330,7 @@ for (var i=tcn.length-1;i<0;--i) { var tcni = tcn[i], tcnip = tcni.nextSibling; if (tcnip) { //次ノードがnullではなく、かつ、 - if (tcni.nodeType === 3 && tcnip.nodeType === 3) { //現ノードがテキストノード、かつ、次ノードもテキストノードならば + if (tcni.nodeType === Node.TEXT_NODE && tcnip.nodeType === Node.TEXT_NODE) { //現ノードがテキストノード、かつ、次ノードもテキストノードならば tcni.appendData(tcnip.data); //次ノードの文字列データを、現ノード文字列の前に付け加える tcni.legnth = tcni.data.length; this.removeChild(tcnip); //次ノードを排除 @@ -529,7 +504,7 @@ */ function Attr() { Node.apply(this, arguments); - this.nodeType = 2; + this.nodeType = Node.ATTRIBUTE_NODE; return this; }; Attr.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承 @@ -540,7 +515,7 @@ */ function Element() { Node.apply(this, arguments); - this.nodeType = 1; + this.nodeType = Node.ELEMENT_NODE; this.nodeValue = null; this.attributes = new NamedNodeMap(); //属性を収納 return this; @@ -653,7 +628,7 @@ */ function Text() { CharacterData.apply(this, arguments); - this.nodeType = 3; + this.nodeType = Node.TEXT_NODE; this.nodeName = "#text"; return this; }; @@ -678,7 +653,7 @@ *コメントノード。で表現される。削除不可。 */ function Comment() { - this.nodeType = 8; + this.nodeType = Node.COMMENT_NODE; this.nodeName = "#comment"; return this; }; @@ -689,7 +664,7 @@ *CDATA領域を示すノード。で表現される。削除不可。 */ function CDATASection() { - this.nodeType = 4; + this.nodeType = Node.CDATA_SECTION_NODE; this.nodeName = "#cdata-section"; return this; }; @@ -708,7 +683,7 @@ this.systemId = ""; //上同のシステム識別子 this.internalSubset = ""; //内部サブセットの内容(文字列) this.nodeValue = null; - this.nodeType = 10; + this.nodeType = Node.DOCUMENT_TYPE_NODE; return this; }; DocumentType.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承 @@ -721,7 +696,7 @@ this.publicId = null; this.systemId = null; this.nodeValue = null; - this.nodeType = 12; + this.nodeType = Node.NOTATION_NODE; return this; }; Notation.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承 @@ -738,7 +713,7 @@ this.systemId = null; this.notationName = null; //解析対象外実体のための記法名。解析対象実体ではnull this.nodeValue = null; - this.nodeType = 6; + this.nodeType = Node.ENTITY_NODE; return this; }; Entity.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承 @@ -749,7 +724,7 @@ */ function EntityReference() { this.nodeValue = null; - this.nodeType = 5; + this.nodeType = Node.ENTITY_REFERENCE_NODE ; return this; }; EntityReference.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承 @@ -759,7 +734,7 @@ *処理命令ノード。スタイルシート処理命令で使うので、削除不可 */ function ProcessingInstruction() { - this.nodeType = 7; + this.nodeType = Node.PROCESSING_INSTRUCTION_NODE; return this; }; ProcessingInstruction.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承 @@ -771,7 +746,7 @@ function DocumentFragment() { this.nodeName = "#document-fragment"; this.nodeValue = null; - this.nodeType = 11; + this.nodeType = Node.DOCUMENT_FRAGMENT_NODE; return this; }; DocumentFragment.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承 @@ -783,7 +758,7 @@ function Document() { this.nodeName = "#document"; this.nodeValue = null; - this.nodeType = 9; + this.nodeType = Node.DOCUMENT_NODE; this._id = {}; //getElementByIdで使う return this; }; @@ -862,7 +837,7 @@ /*Node*/ Document.prototype.importNode = function( /*Node*/ importedNode, /*boolean*/ deep) { var s; switch (importedNode.nodeType) { - case 1: + case Node.ELEMENT_NODE: s = this.createElementNS(importedNode.namespaceURI, importedNode.nodeName); var attr = importedNode.attributes, att; for (var i=0,atli=attr.length;i Revision: 1690 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1690 Author: dhrname Date: 2010-03-02 20:25:16 +0900 (Tue, 02 Mar 2010) Log Message: ----------- normalizeメソッドのコメントの修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-02 11:15:33 UTC (rev 1689) +++ branches/ufltima/core.js 2010-03-02 11:25:16 UTC (rev 1690) @@ -329,11 +329,11 @@ try { for (var i=tcn.length-1;i<0;--i) { var tcni = tcn[i], tcnip = tcni.nextSibling; - if (tcnip) { //次ノードがnullではなく、かつ、 - if (tcni.nodeType === Node.TEXT_NODE && tcnip.nodeType === Node.TEXT_NODE) { //現ノードがテキストノード、かつ、次ノードもテキストノードならば - tcni.appendData(tcnip.data); //次ノードの文字列データを、現ノード文字列の前に付け加える + if (tcnip) { + if (tcni.nodeType === Node.TEXT_NODE && tcnip.nodeType === Node.TEXT_NODE) { + tcni.appendData(tcnip.data); //次ノードの文字列データを、現ノード文字列の後に付け加える tcni.legnth = tcni.data.length; - this.removeChild(tcnip); //次ノードを排除 + this.removeChild(tcnip); //次ノードを排除 } else { tcni.normalize(); } From svnnotify @ sourceforge.jp Tue Mar 2 20:43:19 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 02 Mar 2010 20:43:19 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjkxXQ==?= Message-ID: <1267530199.393479.13219.nullmailer@users.sourceforge.jp> Revision: 1691 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1691 Author: dhrname Date: 2010-03-02 20:43:19 +0900 (Tue, 02 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/06x/060/sie.js Modified: branches/06x/060/sie.js =================================================================== --- branches/06x/060/sie.js 2010-03-02 11:25:16 UTC (rev 1690) +++ branches/06x/060/sie.js 2010-03-02 11:43:19 UTC (rev 1691) @@ -769,7 +769,7 @@ F[0] = "c"; for (var i = 1; i < F.length; i += 6) { var x1 = F[i], y1 = F[i+1], x2 = F[i+2], y2 = F[i+3]; - F.splice(i, 2, (x + 2 * x1) / 3, (y + 2 * y1) / 3, (2 * x1 + x2) / 3, (2 * y1 + y2) / 3); + F.splice(i, 2, (x + 2*x1) / 3, (y + 2*y1) / 3, (2*x1 + x2) / 3, (2*y1 + y2) / 3); x = x2; y = y2; } return F; From svnnotify @ sourceforge.jp Tue Mar 2 23:24:54 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 02 Mar 2010 23:24:54 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjkyXSAgU1ZHUGF0aEVs?= =?utf-8?b?ZW1lbnTjgavjgYrjgZHjgotub3JtYWxpemVkUGF0aFNlZ0xpc3TjgahwYXRo?= =?utf-8?b?U2VnTGlzdOODl+ODreODkeODhuOCo+OBruWun+ijhQ==?= Message-ID: <1267539894.480511.16042.nullmailer@users.sourceforge.jp> Revision: 1692 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1692 Author: dhrname Date: 2010-03-02 23:24:54 +0900 (Tue, 02 Mar 2010) Log Message: ----------- SVGPathElementにおけるnormalizedPathSegListとpathSegListプロパティの実装 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-02 11:43:19 UTC (rev 1691) +++ branches/ufltima/dom/svg.js 2010-03-02 14:24:54 UTC (rev 1692) @@ -1306,8 +1306,231 @@ this.addEventListener("DOMAttrModified", function(evt){ var tar = evt.target; if (evt.attrName === "d") { - var tnlist = tar.normalizedPathSegList, tlist = tar.pathSegList; + var tnl = tar.normalizedPathSegList, tlist = tar.pathSegList, D = [], _parseFloat = parseFloat; + /*d属性の値を正規表現を用いて、二次元配列Dに変換している。もし、d属性の値が"M 20 30 L20 40"ならば、 + *JSONにおける表現は以下のとおり + *D = s[["M", 20, 30], ["L", 20 40]] + */ + var dd = evt.newValue + .replace(/\-/g, " -") + .replace(/,/g, " ") + .replace(/([a-yA-Y])/g, ",$1 ") + .replace(/([zZ])/g, ",$1 1") + .replace(/,/, "") + .split(","); + for (var i=0, dli=dd.length;i 1) { + r1 = Math.sqrt(lamda) * r1; + r2 = Math.sqrt(lamda) * r2; + sds = 0; + } else{ + var seif = 1; + if (ti.largeArcFlag === fS) { + seif = -1; + } + sds = seif * Math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd)); + } + var txd = sds*r1*ryd / r2, tyd = -1 * sds*r2*rxd / r1; + var tx = cpsi*txd - spsi*tyd + (rx+cx)/2, ty = spsi*txd + cpsi*tyd + (ry+cy)/2; + var s1 = this.CVAngle(1,0,(rxd-txd)/r1, (ryd-tyd)/r2); + var dr = this.CVAngle((rxd-txd)/r1, (ryd-tyd)/r2, (-rxd-txd)/r1, (-ryd-tyd)/r2); + if (!fS && dr > 0) { + dr -= 2*Math.PI; + } else if (fS && dr < 0) { + dr += 2*Math.PI; + } + var sse = dr * 2 / Math.PI; + var seg = Math.ceil(sse<0 ? -1*sse : sse); + var segr = dr / seg; + var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); + var cpsir1 = cpsi * r1, cpsir2 = cpsi * r2; + var spsir1 = spsi * r1, spsir2 = spsi * r2; + var mc = Math.cos(s1); + var ms = Math.sin(s1); + var x2 = rx - t * (cpsir1*ms + spsir2*mc), y2 = ry - t * (spsir1*ms - cpsir2*mc); + for (var i = 0; i < seg; ++i) { + s1 += segr; + mc = Math.cos(s1); + ms = Math.sin(s1); + var x3 = cpsir1*mc - spsir2*ms + tx, y3 = spsir1*mc + cpsir2*ms + ty; + var dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(x3, y3, x2, y2, x3-dx, y3-dy)); + x2 = x3 + dx; + y2 = y3 + dy; + } + } else if (dii === "S") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { + var x1 = 2*tg.x - tg.x2; + var y1 = 2*tg.y - tg.y2; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2, ti.y2)); + } + } + } else if (dii === "s") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { + var x1 = 2*tg.x - tg.x2; + var y1 = 2*tg.y - tg.y2; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); + } + } + } else if (dii === "T" || dii === "t") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "Q" || tg.pathSegTypeAsLetter === "q") { + var x1 = 2*tg.x - tg.x1; + var y1 = 2*tg.y - tg.y1; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); + } + } + } else if (dii === "H" || dii === "h") { + tnl.appendItem(tar.createSVGPathSegLinetoABS(cx, ry)); + } else if (dii === "V" || dii === "v") { + tnl.appendItem(tar.createSVGPathSegLinetoABS(rx, cy)); + } + } } evt.stopPropagation(); } @@ -1326,21 +1549,26 @@ var tar = evt.target, matrix = tar.getScreenCTM(), tlist = tar.normalizedPathSegList; var dat = "", ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f,; for (var i=0, tli=tlist.numberOfItems;i Revision: 1693 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1693 Author: dhrname Date: 2010-03-03 22:37:17 +0900 (Wed, 03 Mar 2010) Log Message: ----------- d属性の解析の場所をSVGPathElementからSVGSVGElementに移した Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-02 14:24:54 UTC (rev 1692) +++ branches/ufltima/dom/svg.js 2010-03-03 13:37:17 UTC (rev 1693) @@ -291,7 +291,13 @@ *valueInSpecifiedUnitsプロパティはpxに統一する前の数値。valueプロパティはpxに統一した後の数値 */ function SVGLength() { - return this; + /*readonly attribute unsigned short*/ this.unitType = SVGLength.SVG_LENGTHTYPE_UNKNOWN; + /*attribute float*/ this.value = 0; + // raises DOMException on setting + /*attribute float*/ this.valueInSpecifiedUnits = 0; + // raises DOMException on setting + /*attribute DOMString*/ this.valueAsString; + // raises DOMException on setting return this; }; // Length Unit Types /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_UNKNOWN = 0; @@ -621,6 +627,253 @@ *随時、属性の値をDOMプロパティに変換しておくリスナー登録 */ this.addEventListener("DOMAttrModified", function(evt){ + var tar = evt.target, ea = evt.attrName, _parseFloat = parseFloat; + if (!!tar[ea]) { + var tea = tar[ea]; + if (tea instanceof SVGAnimatedLength) { + tea.baseVal.newValueSpecified(te.unitType, _parseFloat(evt.newValue)); + } + } + }, true); + this.addEventListener("DOMAttrModified", function(evt){ + var tar = evt.target; + if (evt.attrName === "d") { + var tnl = tar.normalizedPathSegList, tlist = tar.pathSegList, D = [], _parseFloat = parseFloat; + /*d属性の値を正規表現を用いて、二次元配列Dに変換している。もし、d属性の値が"M 20 30 L20 40"ならば、 + *JSONにおける表現は以下のとおり + *D = s[["M", 20, 30], ["L", 20 40]] + */ + var dd = evt.newValue + .replace(/\-/g, " -") + .replace(/,/g, " ") + .replace(/([a-yA-Y])/g, ",$1 ") + .replace(/([zZ])/g, ",$1 1") + .replace(/,/, "") + .split(","); + for (var i=0, dli=dd.length;i 1) { + r1 = Math.sqrt(lamda) * r1; + r2 = Math.sqrt(lamda) * r2; + sds = 0; + } else{ + var seif = 1; + if (ti.largeArcFlag === fS) { + seif = -1; + } + sds = seif * Math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd)); + } + var txd = sds*r1*ryd / r2, tyd = -1 * sds*r2*rxd / r1; + var tx = cpsi*txd - spsi*tyd + (rx+cx)/2, ty = spsi*txd + cpsi*tyd + (ry+cy)/2; + var rad = Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1) - Math.atan2(0, 1); + var s1 = (rad >= 0) ? rad : 2 * Math.PI + rad; + rad = Math.atan2((-ryd-tyd)/r2, (-rxd-txd)/r1) - Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1); + var dr = (rad >= 0) ? rad : 2 * Math.PI + rad; + if (!fS && dr > 0) { + dr -= 2*Math.PI; + } else if (fS && dr < 0) { + dr += 2*Math.PI; + } + var sse = dr * 2 / Math.PI; + var seg = Math.ceil(sse<0 ? -1*sse : sse); + var segr = dr / seg; + var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); + var cpsir1 = cpsi * r1, cpsir2 = cpsi * r2; + var spsir1 = spsi * r1, spsir2 = spsi * r2; + var mc = Math.cos(s1); + var ms = Math.sin(s1); + var x2 = rx - t * (cpsir1*ms + spsir2*mc), y2 = ry - t * (spsir1*ms - cpsir2*mc); + for (var i = 0; i < seg; ++i) { + s1 += segr; + mc = Math.cos(s1); + ms = Math.sin(s1); + var x3 = cpsir1*mc - spsir2*ms + tx, y3 = spsir1*mc + cpsir2*ms + ty; + var dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(x3, y3, x2, y2, x3-dx, y3-dy)); + x2 = x3 + dx; + y2 = y3 + dy; + } + } else if (dii === "S") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { + var x1 = 2*tg.x - tg.x2; + var y1 = 2*tg.y - tg.y2; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2, ti.y2)); + } + } + } else if (dii === "s") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { + var x1 = 2*tg.x - tg.x2; + var y1 = 2*tg.y - tg.y2; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); + } + } + } else if (dii === "T" || dii === "t") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "Q" || tg.pathSegTypeAsLetter === "q") { + var x1 = 2*tg.x - tg.x1; + var y1 = 2*tg.y - tg.y1; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); + } + } + } else if (dii === "H" || dii === "h") { + tnl.appendItem(tar.createSVGPathSegLinetoABS(cx, ry)); + } else if (dii === "V" || dii === "v") { + tnl.appendItem(tar.createSVGPathSegLinetoABS(rx, cy)); + } + } + } + } + }, true); + this.addEventListener("DOMAttrModified", function(evt){ var name = evt.attrName, tar = evt.target; if (!!CSS2Properties[name] || name.indexOf("-") > -1) { tar._attributeStyle.setProperty(name, evt.newValue, ""); @@ -1303,238 +1556,6 @@ /*readonly SVGPathSegList*/ this.animatedPathSegList = this.pathSegList = new SVGPathSegList(); /*readonly SVGPathSegList*/ this.animatedNormalizedPathSegList = this.normalizedPathSegList = new SVGPathSegList(); /*readonly SVGAnimatedNumber*/ this.pathLength = new SVGAnimatedNumber(); - this.addEventListener("DOMAttrModified", function(evt){ - var tar = evt.target; - if (evt.attrName === "d") { - var tnl = tar.normalizedPathSegList, tlist = tar.pathSegList, D = [], _parseFloat = parseFloat; - /*d属性の値を正規表現を用いて、二次元配列Dに変換している。もし、d属性の値が"M 20 30 L20 40"ならば、 - *JSONにおける表現は以下のとおり - *D = s[["M", 20, 30], ["L", 20 40]] - */ - var dd = evt.newValue - .replace(/\-/g, " -") - .replace(/,/g, " ") - .replace(/([a-yA-Y])/g, ",$1 ") - .replace(/([zZ])/g, ",$1 1") - .replace(/,/, "") - .split(","); - for (var i=0, dli=dd.length;i 1) { - r1 = Math.sqrt(lamda) * r1; - r2 = Math.sqrt(lamda) * r2; - sds = 0; - } else{ - var seif = 1; - if (ti.largeArcFlag === fS) { - seif = -1; - } - sds = seif * Math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd)); - } - var txd = sds*r1*ryd / r2, tyd = -1 * sds*r2*rxd / r1; - var tx = cpsi*txd - spsi*tyd + (rx+cx)/2, ty = spsi*txd + cpsi*tyd + (ry+cy)/2; - var s1 = this.CVAngle(1,0,(rxd-txd)/r1, (ryd-tyd)/r2); - var dr = this.CVAngle((rxd-txd)/r1, (ryd-tyd)/r2, (-rxd-txd)/r1, (-ryd-tyd)/r2); - if (!fS && dr > 0) { - dr -= 2*Math.PI; - } else if (fS && dr < 0) { - dr += 2*Math.PI; - } - var sse = dr * 2 / Math.PI; - var seg = Math.ceil(sse<0 ? -1*sse : sse); - var segr = dr / seg; - var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); - var cpsir1 = cpsi * r1, cpsir2 = cpsi * r2; - var spsir1 = spsi * r1, spsir2 = spsi * r2; - var mc = Math.cos(s1); - var ms = Math.sin(s1); - var x2 = rx - t * (cpsir1*ms + spsir2*mc), y2 = ry - t * (spsir1*ms - cpsir2*mc); - for (var i = 0; i < seg; ++i) { - s1 += segr; - mc = Math.cos(s1); - ms = Math.sin(s1); - var x3 = cpsir1*mc - spsir2*ms + tx, y3 = spsir1*mc + cpsir2*ms + ty; - var dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(x3, y3, x2, y2, x3-dx, y3-dy)); - x2 = x3 + dx; - y2 = y3 + dy; - } - } else if (dii === "S") { - if (i !== 0) { - var tg = tlist.getItem(i-1); - if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { - var x1 = 2*tg.x - tg.x2; - var y1 = 2*tg.y - tg.y2; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2, ti.y2)); - } - } - } else if (dii === "s") { - if (i !== 0) { - var tg = tlist.getItem(i-1); - if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { - var x1 = 2*tg.x - tg.x2; - var y1 = 2*tg.y - tg.y2; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); - } - } - } else if (dii === "T" || dii === "t") { - if (i !== 0) { - var tg = tlist.getItem(i-1); - if (tg.pathSegTypeAsLetter === "Q" || tg.pathSegTypeAsLetter === "q") { - var x1 = 2*tg.x - tg.x1; - var y1 = 2*tg.y - tg.y1; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); - } - } - } else if (dii === "H" || dii === "h") { - tnl.appendItem(tar.createSVGPathSegLinetoABS(cx, ry)); - } else if (dii === "V" || dii === "v") { - tnl.appendItem(tar.createSVGPathSegLinetoABS(rx, cy)); - } - } - } - evt.stopPropagation(); - } - }); /*以下の処理は、このpath要素ノードがDOMツリーに追加されて初めて、 *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。 */ @@ -1546,7 +1567,7 @@ /*以下の処理は、normalizedpathSegListとCTMに基づいて、 *SVGのd属性をVMLに変換していく処理である。 */ - var tar = evt.target, matrix = tar.getScreenCTM(), tlist = tar.normalizedPathSegList; + var tar = evt.target, matrix = tar.getScreenCTM(), tlist = tar.normalizedPathSegList, _parseInt = parseInt; var dat = "", ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f,; for (var i=0, tli=tlist.numberOfItems;i Revision: 1694 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1694 Author: dhrname Date: 2010-03-03 23:35:52 +0900 (Wed, 03 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-03 13:37:17 UTC (rev 1693) +++ branches/ufltima/dom/svg.js 2010-03-03 14:35:52 UTC (rev 1694) @@ -292,12 +292,9 @@ */ function SVGLength() { /*readonly attribute unsigned short*/ this.unitType = SVGLength.SVG_LENGTHTYPE_UNKNOWN; - /*attribute float*/ this.value = 0; - // raises DOMException on setting - /*attribute float*/ this.valueInSpecifiedUnits = 0; - // raises DOMException on setting + /*attribute float*/ this.value = 0; //利用単位における値 + /*attribute float*/ this.valueInSpecifiedUnits = 0; //unitTypeにおける値 /*attribute DOMString*/ this.valueAsString; - // raises DOMException on setting return this; }; // Length Unit Types /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_UNKNOWN = 0; @@ -312,14 +309,22 @@ /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PT = 9; /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PC = 10; +/*newValueSpedifiedUnitsメソッド + *新しくunitTypeにおける値を設定する + *2pxならば、x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 2);となる + */ SVGLength.prototype.newValueSpecifiedUnits = function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) { - this.unitType = unitType; - /*float*/ this.value = valueInSpecifiedUnits * this._n[unitType-1]; - /*float*/ this.valueInSpecifiedUnits = valueInSpecifiedUnits; -} + this.value = 1; + this.convertToSpecifiedUnits((unitType); + this.value *= this.valueInSpecifiedUnits; + this.valueInSpecifiedUnits = valueInSpecifiedUnits; + this.valuAsString = valueInSpecifiedUnits + this._s[unitType-1]; +}; SVGLength.prototype.convertToSpecifiedUnits = function (/*unsigned short*/ unitType) { this.unitType = unitType; + //[1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15] this.valueInSpecifiedUnits = this.value / this._n[unitType-1]; + this.valuAsString = this.valueInSpecifedUnits + this._s[unitType-1]; }; function SVGAnimatedLength() { @@ -601,10 +606,10 @@ *それぞれ、svg要素の同名属性に対応。たとえば、xならば、x属性に対応している *1000というのは、W3Cで触れていないため、独自の初期値を採用 */ - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*DOMString*/ this.contentScriptType = "application/ecmascript"; //古い仕様では、text/ecmascript /*DOMString*/ this.contentStyleType = "text/css"; /*readonly SVGRect*/ this.viewport = this.createSVGRect(); @@ -1000,10 +1005,10 @@ function SVGUseElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); //use要素のx属性に対応(以下、同様) - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); //use要素のx属性に対応(以下、同様) + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGElementInstance*/ this.instanceRoot = new SVGElementInstance(); //参照先インスタンスのルート /*readonly SVGElementInstance*/ this.animatedInstanceRoot = this.instanceRoot;//アニメの最中のインスタンス。静止中は通常 this._xlink = new SVGURIReference(this); //XLink言語のURI参照 @@ -1042,10 +1047,10 @@ function SVGImageElement() { SVGElement.apply(this, arguments); //以下は、与えられた属性の値に対応する - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio(); return this; }; @@ -1764,12 +1769,12 @@ function SVGRectElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(-1); - /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(-1); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(); return this; }; SVGRectElement.constructor = SVGElement; @@ -1777,9 +1782,9 @@ function SVGCircleElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(); return this; }; SVGCircleElement.constructor = SVGElement; @@ -1787,10 +1792,10 @@ function SVGEllipseElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(); return this; }; SVGEllipseElement.constructor = SVGElement; @@ -1798,10 +1803,10 @@ function SVGLineElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(); return this; }; SVGLineElement.constructor = SVGElement; @@ -1827,7 +1832,7 @@ function SVGTextContentElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.textLength = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.textLength = new SVGAnimatedLength(); /*readonly SVGAnimatedEnumeration*/ this.lengthAdjust = new SVGAnimatedEnumeration(SVGTextContentElement.LENGTHADJUST_UNKNOWN); return this; }; @@ -2009,11 +2014,11 @@ function SVGMarkerElement(){ SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.refX = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.refY = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.refX = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.refY = new SVGAnimatedLength(); /*readonly SVGAnimatedEnumeration*/ this.markerUnits = new SVGAnimatedEnumeration(); - /*readonly SVGAnimatedLength*/ this.markerWidth = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.markerHeight = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.markerWidth = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.markerHeight = new SVGAnimatedLength(); /*readonly SVGAnimatedEnumeration*/ this.orientType = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedAngle*/ this.orientAngle = new SVGAnimatedAngle(); //SVGFitToViewBoxのインターフェースを用いる @@ -2082,10 +2087,10 @@ function SVGLinearGradientElement() { SVGGradientElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(); return this; }; SVGLinearGradientElement.constructor = SVGGradientElement; @@ -2093,11 +2098,11 @@ function SVGRadialGradientElement() { SVGGradientElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.fx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.fy = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.fx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.fy = new SVGAnimatedLength(); return this; }; SVGRadialGradientElement.constructor = SVGGradientElement; @@ -2116,10 +2121,10 @@ /*readonly SVGAnimatedEnumeration*/ this.patternUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedEnumeration*/ this.patternContentUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedTransformList*/ this.patternTransform = new SVGAnimatedTransformList(); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); this._xlink = new SVGURIReference(this); //SVGFitToViewBoxのインターフェースを用いる /*readonly SVGAnimatedRect*/ this.viewBox = new SVGAnimatedRect(); @@ -2142,10 +2147,10 @@ SVGElement.apply(this, arguments); /*readonly SVGAnimatedEnumeration*/ this.maskUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedEnumeration*/ this.maskContentUnits = new SVGAnimatedEnumeration(); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); return this; }; SVGMaskElement.constructor = SVGElement; @@ -2155,10 +2160,10 @@ SVGElement.apply(this, arguments); /*readonly SVGAnimatedEnumeration*/ this.filterUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedEnumeration*/ this.primitiveUnits = new SVGAnimatedEnumeration(); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGAnimatedInteger*/ this.filterResX = new SVGAnimatedInteger(); /*readonly SVGAnimatedInteger*/ this.filterResY = new SVGAnimatedInteger(); this._xlink = new SVGURIReference(this); @@ -2171,11 +2176,11 @@ function SVGFilterPrimitiveStandardAttributes(ele) { SVGStylable.apply(this, arguments); this._tar = ele; - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(0); - /*readonly SVGAnimatedString*/ this.result = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); + /*readonly SVGAnimatedString*/ this.result = new SVGAnimatedLength(); }; SVGFilterPrimitiveStandardAttributes.constructor = SVGStylable; SVGFilterPrimitiveStandardAttributes.prototype = new SVGStylable(); @@ -2214,8 +2219,8 @@ function SVGCursorElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); this._xlink = new SVGURIReference(this); return this; }; From svnnotify @ sourceforge.jp Thu Mar 4 23:35:45 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 04 Mar 2010 23:35:45 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjk1XSAg5LiN6KaB44Gq?= =?utf-8?b?44Kz44Oh44Oz44OI44KS6Zmk5Y67?= Message-ID: <1267713345.475232.25189.nullmailer@users.sourceforge.jp> Revision: 1695 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1695 Author: dhrname Date: 2010-03-04 23:35:45 +0900 (Thu, 04 Mar 2010) Log Message: ----------- 不要なコメントを除去 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-03 14:35:52 UTC (rev 1694) +++ branches/ufltima/core.js 2010-03-04 14:35:45 UTC (rev 1695) @@ -469,7 +469,7 @@ if (offset + count > this.length) { //offsetとcountの和が文字全体の長さを超える場合、offsetから最後までのを取り出す count = this.length - offset; } - var s = this.data.substr(offset, count); //Stringのsubstrを用いて、count分の文字列を取り出す + var s = this.data.substr(offset, count); return s; }; /*void*/ CharacterData.prototype.appendData = function( /*string*/ arg) { @@ -644,7 +644,7 @@ } var nnode = this.ownerDocument.createTextNode(next); if (this.parentNode) { - this.parentNode.insertBefore(nnode, this.nextSibling); //親要素があれば、このノードの次の兄弟ノードとしてnnodeを入れる + this.parentNode.insertBefore(nnode, this.nextSibling); } return nnode; }; From svnnotify @ sourceforge.jp Thu Mar 4 23:36:28 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 04 Mar 2010 23:36:28 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjk2XSAgRXZlbnTjga50?= =?utf-8?b?aW1lU3RhbXDjg5fjg63jg5Hjg4bjgqPjgpLkv67mraM=?= Message-ID: <1267713388.308194.26556.nullmailer@users.sourceforge.jp> Revision: 1696 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1696 Author: dhrname Date: 2010-03-04 23:36:28 +0900 (Thu, 04 Mar 2010) Log Message: ----------- EventのtimeStampプロパティを修正 Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-04 14:35:45 UTC (rev 1695) +++ branches/ufltima/dom/events.js 2010-03-04 14:36:28 UTC (rev 1696) @@ -167,7 +167,9 @@ } } }; - +/*Eventクラス + *イベントの雛形となる。プロパティもすべて含めて、必須 + */ function Event(evt) { if (!evt) { var evt = { ctrlKey:null, shiftKey:null, altKey:null, clientX:null, clientY:null}; @@ -178,7 +180,7 @@ /*unsigned short*/ this.eventPhase = Event.CAPTURING_PHASE; /*boolean*/ this.bubbles = false; /*boolean*/ this.cancelable = false; - /*DOMTimeStamp*/ this.timeStamp = new Date(); + /*DOMTimeStamp*/ this.timeStamp = (new Date()).getTime(); this._stop = false; //stopPropagationメソッドで使う this._default = true; //preventDefaultメソッドで使う return this; From svnnotify @ sourceforge.jp Thu Mar 4 23:36:57 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 04 Mar 2010 23:36:57 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjk3XSAgU1ZHTGVuZ3Ro?= =?utf-8?b?44KS5a6f6KOF?= Message-ID: <1267713417.606631.26826.nullmailer@users.sourceforge.jp> Revision: 1697 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1697 Author: dhrname Date: 2010-03-04 23:36:57 +0900 (Thu, 04 Mar 2010) Log Message: ----------- SVGLengthを実装 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-04 14:36:28 UTC (rev 1696) +++ branches/ufltima/dom/svg.js 2010-03-04 14:36:57 UTC (rev 1697) @@ -311,20 +311,52 @@ /*newValueSpedifiedUnitsメソッド *新しくunitTypeにおける値を設定する - *2pxならば、x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 2);となる + *例:2pxならば、x.newValueSpecifiedUnits(5, 2);となる */ SVGLength.prototype.newValueSpecifiedUnits = function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) { this.value = 1; this.convertToSpecifiedUnits((unitType); - this.value *= this.valueInSpecifiedUnits; + this.value = valueInSpecifiedUnits * this.valueInSpecifiedUnits; this.valueInSpecifiedUnits = valueInSpecifiedUnits; - this.valuAsString = valueInSpecifiedUnits + this._s[unitType-1]; + this.valuAsString = valueInSpecifiedUnits + this._s; }; +/*convertToSpecifiedUnitsメソッド + *valueプロパティを書き換えずに、単位だけを変換する + *例:2cmをmmに変換したい場合 + * x.newValueSpecifiedUnits(6, 2); + * x.convertToSpecifiedUnits(7); + * alert(x.valueAsString); //20mm + */ SVGLength.prototype.convertToSpecifiedUnits = function (/*unsigned short*/ unitType) { - this.unitType = unitType; - //[1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15] - this.valueInSpecifiedUnits = this.value / this._n[unitType-1]; - this.valuAsString = this.valueInSpecifedUnits + this._s[unitType-1]; + this.unitType = unitType, un = unitType - 1, n = 1; + //this._sは単位の文字列を表す + if (un === SVGLength.SVG_LENGTHTYPE_NUMBER) { + this._s = ""; + } else if (un === SVGLength.SVG_LENGTHTYPE_PERCENTAGE) { + n = 0.01; + this._s = "%" + } else if (un === SVGLength.SVG_LENGTHTYPE_EMS) { + this._s = "em"; + } else if (un === SVGLength.SVG_LENGTHTYPE_EXS) { + this._s = "ex"; + } else if (un === SVGLength.SVG_LENGTHTYPE_CM) { + n = 35.43307; + this._s = "cm"; + } else if (un === SVGLength.SVG_LENGTHTYPE_MM) { + n = 3.543307; + this._s = "mm"; + } else if (un === SVGLength.SVG_LENGTHTYPE_IN) { + n = 90; + this._s = "in"; + } else if (un === SVGLength.SVG_LENGTHTYPE_PT) { + n = 1.25; + this._s = "pt"; + } else if (un === SVGLength.SVG_LENGTHTYPE_PC) { + n = 15; + this._s = "pc"; + } + this.valueInSpecifiedUnits = this.value / n; + this.valuAsString = this.valueInSpecifedUnits + this._s; }; function SVGAnimatedLength() { From svnnotify @ sourceforge.jp Thu Mar 4 23:48:34 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 04 Mar 2010 23:48:34 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjk4XSAgZ2V0Q1RN44Gq?= =?utf-8?b?44Gp44KS5L+u5q2j?= Message-ID: <1267714114.850167.8307.nullmailer@users.sourceforge.jp> Revision: 1698 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1698 Author: dhrname Date: 2010-03-04 23:48:34 +0900 (Thu, 04 Mar 2010) Log Message: ----------- getCTMなどを修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-04 14:36:57 UTC (rev 1697) +++ branches/ufltima/dom/svg.js 2010-03-04 14:48:34 UTC (rev 1698) @@ -139,6 +139,7 @@ *すべてのSVG関連要素の雛形となるオブジェクト */ function SVGElement() { + Element.call(this, arguments); /*String*/ this.id = null; //id属性の値 /*String*/ this.xmlbase = null; //xml:base属性の値 /*SVGSVGElement*/ this.ownerSVGElement; //ルート要素であるsvg要素 @@ -166,26 +167,27 @@ /*getCTMメソッド *CTMとは現在の利用座標系に対する変換行列 *注意点として、SVG1.1とSVG Tiny1.2では内容が異なる。たとえば、 - *1.1のgetCTMメソッドが1.2において、getScreenCTMという名前に変更されている。また、1.2ではgetCTMが言及されていない + *1.2ではgetCTMが言及されていない *もし、要素の中心座標を取得したい人がいれば、transformプロパティのconsolidateメソッドを使うこと */ /*SVGMatrix*/ SVGElement.prototype.getCTM = function() { - return (this.getScreenCTM()); -}; - -/*SVGMatrix*/ SVGElement.prototype.getScreenCTM = function(){ var s; if (this.parentNode) { - s = this.parentNode.getScreenCTM().multiply(this.transform.consolidate()); + s = this.parentNode.getCTM().multiply(this.transform.consolidate()); } else { s = this.transform.consolidate(); } return s; }; +/*SVGMatrix*/ SVGElement.prototype.getScreenCTM = function(){ + var s = this.getCTM.multiply(this.ownerDocument.currentView.transform.consolidate()); + return s; +}; + /*getTransformToElementメソッド *これは、あるelementへの変換行列を計算して返す - *たとえば、親要素から子要素への変換行列を算出することが可能 + *たとえばある要素から別の要素への引越しをする際の変換行列を算出することが可能 */ /*SVGMatrix*/ SVGElement.prototype.getTransformToElement = function(/*SVGElement*/ element ){ var s = this.getScreenCTM().inverse().multiply(element.getScreenCTM()); @@ -292,7 +294,7 @@ */ function SVGLength() { /*readonly attribute unsigned short*/ this.unitType = SVGLength.SVG_LENGTHTYPE_UNKNOWN; - /*attribute float*/ this.value = 0; //利用単位における値 + /*attribute float*/ this.value = SVGLength.SVG_LENGTHTYPE_UNKNOWN; //利用単位における値 /*attribute float*/ this.valueInSpecifiedUnits = 0; //unitTypeにおける値 /*attribute DOMString*/ this.valueAsString; }; From svnnotify @ sourceforge.jp Sat Mar 6 19:32:01 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 06 Mar 2010 19:32:01 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNjk5XSAxLCAg44Kz44O8?= =?utf-8?b?44OJ44Gu5pW05b2i?= Message-ID: <1267871521.697263.20626.nullmailer@users.sourceforge.jp> Revision: 1699 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1699 Author: dhrname Date: 2010-03-06 19:32:01 +0900 (Sat, 06 Mar 2010) Log Message: ----------- 1, コードの整形 2, style属性の解析を行う処理をした 3, getScreenCTMメソッドの修正 4, マップの名前を修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-04 14:48:34 UTC (rev 1698) +++ branches/ufltima/dom/svg.js 2010-03-06 10:32:01 UTC (rev 1699) @@ -140,11 +140,13 @@ */ function SVGElement() { Element.call(this, arguments); - /*String*/ this.id = null; //id属性の値 - /*String*/ this.xmlbase = null; //xml:base属性の値 - /*SVGSVGElement*/ this.ownerSVGElement; //ルート要素であるsvg要素 + /*String*/ this.id = null; //id属性の値 + /*String*/ this.xmlbase = null; //xml:base属性の値 + /*SVGSVGElement*/ this.ownerSVGElement; //ルート要素であるsvg要素 /*readonly SVGElement*/ this.viewportElement; //ビューポートを形成する要素(多くはsvg要素) SVGStylable.call(this, arguments); //ElementCSSInlineStyleのインタフェースを継承 + /*readonly attribute SVGElement*/ this.nearestViewportElement = null; + /*readonly attribute SVGElement*/ this.farthestViewportElement = null; /*interface SVGTransformable : SVGLocatable *TransformListはtransform属性を行列で表現したあとのリスト構造 */ @@ -157,9 +159,9 @@ /*interface SVGLocatable*/ /*SVGRect*/ SVGElement.prototype.getBBox = function(){ var s = new SVGRect(); - s.x = this._tar.clientLeft; - s.y = this._tar.clientTop; - s.width = this._tar.clientWidth; + s.x = this._tar.clientLeft; + s.y = this._tar.clientTop; + s.width = this._tar.clientWidth; s.height = this._tar.clientHeight; return s; }; @@ -181,6 +183,9 @@ }; /*SVGMatrix*/ SVGElement.prototype.getScreenCTM = function(){ + if (this.parentNode) { + return null; + } var s = this.getCTM.multiply(this.ownerDocument.currentView.transform.consolidate()); return s; }; @@ -317,7 +322,7 @@ */ SVGLength.prototype.newValueSpecifiedUnits = function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) { this.value = 1; - this.convertToSpecifiedUnits((unitType); + this.convertToSpecifiedUnits(unitType); this.value = valueInSpecifiedUnits * this.valueInSpecifiedUnits; this.valueInSpecifiedUnits = valueInSpecifiedUnits; this.valuAsString = valueInSpecifiedUnits + this._s; @@ -369,8 +374,8 @@ function SVGColor() { CSSValue.call(this, arguments); /*readonly unsigned short*/ this.colorType = SVGColor.SVG_COLORTYPE_UNKNOWN; - /*readonly css::RGBColor*/ this.rgbColor = new RGBColor(); - /*readonly SVGICCColor*/ this.iccColor; + /*readonly css::RGBColor*/ this.rgbColor = new RGBColor(); + /*readonly SVGICCColor*/ this.iccColor; return this; }; @@ -547,11 +552,11 @@ }; function SVGRect() { - /*float*/ this.x = 0; + /*float*/ this.x = 0; // raises DOMException on setting - /*float*/ this.y = 0; + /*float*/ this.y = 0; // raises DOMException on setting - /*float*/ this.width = 0; + /*float*/ this.width = 0; // raises DOMException on setting /*float*/ this.height = 0; // raises DOMException on setting @@ -574,6 +579,27 @@ /*readonly attribute css::CSSStyleDeclaration*/ this.style = new CSSStyleDeclaration(); this._runtimeStyle = new CSSStyleDeclaration(); //getOverrideStyleメソッドで利用する this._attributeStyle = new CSSStyleDeclaration(); //プレゼンテーション属性の値を格納する + //styleのcssTextプロパティを解析するリスナーを登録しておく + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + var style = evt.target.style, n = false; + for (var i=0, sli=style.length;i -1) { tar._attributeStyle.setProperty(name, evt.newValue, ""); + } else if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば } else if (name === "transform") { } else if (name === "style") { + tar.style.cssText = evt.newValue; } else if (name === "class") { - } else if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば + tar.className = evt.newValue; } else if (name.indexOf("on") === 0) { //event属性ならば + var s = eval("(function(){" +evt.newValue+ "})"); + tar.addEventListener(name.substring(2, name.length-1), s, false); } evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); tar.dispatchEvent(evt); //描画を開始するために、dispatchEventメソッドを使う - evt = name = null; + evt = name = tar = null; }, false); return this; }; @@ -1607,7 +1663,7 @@ *SVGのd属性をVMLに変換していく処理である。 */ var tar = evt.target, matrix = tar.getScreenCTM(), tlist = tar.normalizedPathSegList, _parseInt = parseInt; - var dat = "", ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f,; + var dat = "", ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f; for (var i=0, tli=tlist.numberOfItems;i Revision: 1700 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1700 Author: dhrname Date: 2010-03-06 19:39:01 +0900 (Sat, 06 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-06 10:32:01 UTC (rev 1699) +++ branches/ufltima/dom/svg.js 2010-03-06 10:39:01 UTC (rev 1700) @@ -976,7 +976,7 @@ tar.className = evt.newValue; } else if (name.indexOf("on") === 0) { //event属性ならば var s = eval("(function(){" +evt.newValue+ "})"); - tar.addEventListener(name.substring(2, name.length-1), s, false); + tar.addEventListener(name.substring(2, name.length), s, false); } evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); tar.dispatchEvent(evt); //描画を開始するために、dispatchEventメソッドを使う From svnnotify @ sourceforge.jp Sat Mar 6 20:07:55 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 06 Mar 2010 20:07:55 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzAxXSAgcmVtb3ZlUHJv?= =?utf-8?b?cGVydHnjg6Hjgr3jg4Pjg4njga7kv67mraM=?= Message-ID: <1267873675.502312.3801.nullmailer@users.sourceforge.jp> Revision: 1701 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1701 Author: dhrname Date: 2010-03-06 20:07:55 +0900 (Sat, 06 Mar 2010) Log Message: ----------- removePropertyメソッドの修正 Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-06 10:39:01 UTC (rev 1700) +++ branches/ufltima/dom/css.js 2010-03-06 11:07:55 UTC (rev 1701) @@ -223,6 +223,7 @@ var tg = this.getPropertyCSSValue(propertyName); if (tg) { //見つかった場合 this._list.splice(tg._num,1); //Arrayのspliceを利用して、リストからCSSValueオブジェクトを排除 + --this.length; } }, /*getPropertyPriorityメソッド From svnnotify @ sourceforge.jp Sat Mar 6 20:08:24 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 06 Mar 2010 20:08:24 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzAyXSAgc3R5bGXlsZ4=?= =?utf-8?b?5oCn6Kej5p6Q44Gu5L+u5q2j?= Message-ID: <1267873704.941845.5418.nullmailer@users.sourceforge.jp> Revision: 1702 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1702 Author: dhrname Date: 2010-03-06 20:08:24 +0900 (Sat, 06 Mar 2010) Log Message: ----------- style属性解析の修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-06 11:07:55 UTC (rev 1701) +++ branches/ufltima/dom/svg.js 2010-03-06 11:08:24 UTC (rev 1702) @@ -151,6 +151,21 @@ *TransformListはtransform属性を行列で表現したあとのリスト構造 */ /*readonly attribute SVGAnimatedTransformList*/ this.transform = new SVGAnimatedTransformList(); +  //描画の際、SVGStylabaleで指定しておいたプロパティの処理をする + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + var style = evt.target.style, sc = style.cssText; + if (!!!sc._rewrite) { + //style属性値の解析 + sc = sc.replace(/\:\s+/g, ":") + .replace(/\s*;[^a-z\-]*/g, ";"); + var a = sc.split(";"); + for (var i=0, ali=a.length;i Revision: 1703 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1703 Author: dhrname Date: 2010-03-06 20:49:26 +0900 (Sat, 06 Mar 2010) Log Message: ----------- transform属性の実装 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-06 11:08:24 UTC (rev 1702) +++ branches/ufltima/dom/svg.js 2010-03-06 11:49:26 UTC (rev 1703) @@ -964,7 +964,53 @@ if (!!CSS2Properties[name] || name.indexOf("-") > -1) { tar._attributeStyle.setProperty(name, evt.newValue, ""); } else if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば - } else if (name === "transform") { + tar.id = evt.newValue; + } else if (name === "transform" && !!evt.transform) { + var tft = evt.newValue, degR = /[\-\d\.e]+/g, _parseFloat = parseFloat; + var coma = tft.match(/[A-Za-z]+(?=\s*\()/g); //コマンド文字にマッチ translate + var list = tft.match(/\([^\)]+\)/g); //カッコ内のリストにマッチ (10 20 30...) + var a,b,c,d,e,f,lis,deg,rad,degli; + for (var j=0,cli=coma.length;j Revision: 1704 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1704 Author: dhrname Date: 2010-03-06 20:52:55 +0900 (Sat, 06 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-06 11:49:26 UTC (rev 1703) +++ branches/ufltima/dom/svg.js 2010-03-06 11:52:55 UTC (rev 1704) @@ -965,11 +965,12 @@ tar._attributeStyle.setProperty(name, evt.newValue, ""); } else if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば tar.id = evt.newValue; - } else if (name === "transform" && !!evt.transform) { + } else if (name === "transform" && !!tar.transform) { var tft = evt.newValue, degR = /[\-\d\.e]+/g, _parseFloat = parseFloat; - var coma = tft.match(/[A-Za-z]+(?=\s*\()/g); //コマンド文字にマッチ translate - var list = tft.match(/\([^\)]+\)/g); //カッコ内のリストにマッチ (10 20 30...) + var coma = tft.match(/[A-Za-z]+(?=\s*\()/g); //コマンド文字にマッチ translate + var list = tft.match(/\([^\)]+\)/g); //カッコ内のリストにマッチ (10 20 30...) var a,b,c,d,e,f,lis,deg,rad,degli; + //transform属性の値を、SVGTransformListであるtransformプロパティに結びつける for (var j=0,cli=coma.length;j Revision: 1705 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1705 Author: dhrname Date: 2010-03-07 23:36:53 +0900 (Sun, 07 Mar 2010) Log Message: ----------- createDocumentメソッドの修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-06 11:52:55 UTC (rev 1704) +++ branches/ufltima/core.js 2010-03-07 14:36:53 UTC (rev 1705) @@ -175,13 +175,13 @@ } else { s = new Document(); } - s.documentElement = s.createElementNS(ns,qname); //ルート要素を作る s.implementation = this; s.doctype = doctype; + s.documentElement = s.createElementNS(ns,qname); //ルート要素を作る return s; } catch(e){alert(e.message);} }, - "http://www.w3.org/xmlns/1998": {} + "http://www.w3.org/2000/xmlns": {} } /* Node @@ -887,8 +887,10 @@ } if (namespaceURI) { var ti = this.implementation; - if (!!ti[namespaceURI] && !!ti[namespaceURI][localName]) { //もし、名前空間とローカル名によって、オブジェクトがあった場合 + if (!!ti[namespaceURI]) { + if (!!ti[namespaceURI][localName]) { //もし、名前空間とローカル名によって、オブジェクトがあった場合 ele = new (ti[namespaceURI][localName]); + } } else { ele = new Element(); } From svnnotify @ sourceforge.jp Sun Mar 7 23:37:17 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 07 Mar 2010 23:37:17 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzA2XSAgR2V0U1ZHRG9j?= =?utf-8?b?dW1lbnTjgqTjg7Pjgr/jg7zjg5Xjgqfjg7zjgrnjga7lrp/oo4U=?= Message-ID: <1267972637.331460.19193.nullmailer@users.sourceforge.jp> Revision: 1706 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1706 Author: dhrname Date: 2010-03-07 23:37:17 +0900 (Sun, 07 Mar 2010) Log Message: ----------- GetSVGDocumentインターフェースの実装 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-07 14:36:53 UTC (rev 1705) +++ branches/ufltima/dom/svg.js 2010-03-07 14:37:17 UTC (rev 1706) @@ -1197,14 +1197,48 @@ SVGSwitchElement.prototype = new SVGElement(); function GetSVGDocument() { - var obje = document.getElementsByTagName("object"); //HTML内のobject要素を探し出して、メソッドを結びつける - for (var i=0;i|\]>)/,"-->"); + doc.loadXML(str); + var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); + return s; + }; + } + }; + xmlhttp.send(null); + alert(objei.getSVGDocument()); + } + } }; + /*SVGStyleElement *style要素をあらわすオブジェクト */ @@ -1678,9 +1712,13 @@ *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。 */ this.addEventListener("DOMNodeInserted", function(evt){ + var tar = evt.target; if (evt.eventPhase === Event.BUBBLING_PHASE) { return; //強制終了させる } + if (tar.hasAttributeNS(null, "d")) { + tar.setAttributeNS(null, "d", tar.getAttributeNS(null, "d")); + } evt.target.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ /*以下の処理は、normalizedpathSegListとCTMに基づいて、 *SVGのd属性をVMLに変換していく処理である。 @@ -1727,8 +1765,8 @@ tar._tar.path = dat + " e"; tar._tar.coordsize = w + " " + h; matrix = dat = x = y = null; - }); - }); + }, false); + }, false); return this; }; SVGPathElement.constructor = SVGElement; @@ -1888,6 +1926,57 @@ /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(); + this.addEventListener("DOMNodeInserted", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; //強制終了させる + } + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + var tar = evt.target; + var rx = tar.hasAttributeNS(null, "rx"), ry = tar.hasAttributeNS(null, "ry"); + var x = this.x.baseVal.value, y = this.y.baseVal.value, xw = x + this.width.baseVal.value, yh = y + this.height.baseVal.value; + var list; + if (rx || ry) { + var thrx = this.rx.baseVal, thry = thry.baseVal; + thrx.value = rx ? thrx.value : thry.value; + thry.value = ry ? thry.value : thrx.value; + //rx属性が幅より大きければ、幅の半分を属性に設定(ry属性は高さと比較する) + var twidth = this.width.baseVal.value, theight = this.height.baseVal.value; + if (thrx.value > twidth / 2) { + thrx.value = twidth / 2; + } + if (thry.value > theight / 2) { + thry.value = theight / 2; + } + var rxv = thrx.value, ryv = thry.value; + var rrx = rxv * 0.55228, rry = ryv * 0.55228; + var a = xw - rxv, b = x + rxv, c = y + ryv, d = yh - ryv; + list = ["m",b,y, "l",a,y, "c",a+rrx,y,xw,c-rry,xw,c, "l",xw,d, "c",xw,d+rry,a+rrx,yh,a,yh, "l",b,yh, "c",b-rrx,yh,x,d+rry,x,d, "l",x,c, "c",x,c-rry,b-rrx,y,b,y]; + } else { + list = ["m",x,y, "l",x,yh, xw,yh, xw,y, "x e"]; + } + //以下は、配列listそのものをCTMで座標変換していく処理 + var par = tar.ownerSVGElement, ctm = tar.getScreenCTM(); + for (var i=0, lili=list.length;i Revision: 1707 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1707 Author: dhrname Date: 2010-03-08 23:39:21 +0900 (Mon, 08 Mar 2010) Log Message: ----------- 1, SVGSVGElementとSVGDocumentの修正 2, Errorオブジェクトの呼び出しを、SVGExceptionに変更 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-07 14:37:17 UTC (rev 1706) +++ branches/ufltima/dom/svg.js 2010-03-08 14:39:21 UTC (rev 1707) @@ -635,6 +635,13 @@ /*readonly DOMString*/ this.domain = document.domain; /*readonly DOMString*/ this.URL = document.location; /*readonly SVGSVGElement*/ this.rootElement; + //以下は、結び付けられる前のノードの属性処理を行う + this.addEventListener("DOMAttrModified", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; + } + evt.target.dispatchEvent(evt); + }, true}; return this; }; SVGDocument.constructor = Document; @@ -676,17 +683,17 @@ */ /*float*/ this.currentScale = 1; /*readonly SVGPoint*/ this.currentTranslate = this.createSVGPoint(); - this.currentTranslate.x = 0; - this.currentTranslate.y = 0; //SVGFitToViewBoxのインターフェースを用いる /*readonly SVGAnimatedRect*/ this.viewBox = this.currentView.viewBox; /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = this.currentView.preserveAspectRatio; /*unsigned short*/ this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE; - /*DOMAttrModifiedイベントは、子要素の属性の修正、追加があるたびに、ルート要素まで - *浮上する性質がある。以下は、それを利用して、 + /*DOMAttrModifiedイベントを利用して、 *随時、属性の値をDOMプロパティに変換しておくリスナー登録 */ this.addEventListener("DOMAttrModified", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; + } var tar = evt.target, ea = evt.attrName, _parseFloat = parseFloat; if (!!tar[ea]) { var tea = tar[ea]; @@ -717,11 +724,16 @@ var type = tea.unitType; } if (tea instanceof SVGAnimatedLength) { - tea.baseVal.newValueSpecified(type, _parseFloat(evt.newValue)); + var s = _parseFloat(evt.newValue); + s = isNaN(s) ? 0 : s; + tea.baseVal.newValueSpecified(type, ); } } }, true); this.addEventListener("DOMAttrModified", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; + } var tar = evt.target; if (evt.attrName === "d") { var tnl = tar.normalizedPathSegList, tlist = tar.pathSegList, D = [], _parseFloat = parseFloat; @@ -960,6 +972,9 @@ } }, true); this.addEventListener("DOMAttrModified", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; + } var name = evt.attrName, tar = evt.target; if (!!CSS2Properties[name] || name.indexOf("-") > -1) { tar._attributeStyle.setProperty(name, evt.newValue, ""); @@ -1327,7 +1342,7 @@ s.f = (this.b * this.e - this.a * this.f) / n; return s; } else { - throw (new Error(SVGException.SVG_MATRIX_NOT_INVERTABLE)) + throw (new SVGException(SVGException.SVG_MATRIX_NOT_INVERTABLE)) } }, /*SVGMatrix*/ translate : function(/*float*/ x, /*float*/ y ) { @@ -1367,7 +1382,7 @@ //座標(x, y)と原点の角度の分だけ、回転する /*SVGMatrix*/ rotateFromVector : function(/*float*/ x, /*float*/ y ) { if (x === 0 || y === 0) { - throw (new Error(SVGException.SVG_INVALID_VALUE_ERR)) + throw (new SVGException(SVGException.SVG_INVALID_VALUE_ERR)) } var m = this.rotate(Math.atan2(y, x)); var s = this.multiply(m); From svnnotify @ sourceforge.jp Tue Mar 9 23:39:20 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 09 Mar 2010 23:39:20 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzA4XSAxLCAgU1ZHTGVu?= =?utf-8?b?Z3Ro44Gu44Oh44K944OD44OJ44KS5L+u5q2j?= Message-ID: <1268145560.344819.7092.nullmailer@users.sourceforge.jp> Revision: 1708 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1708 Author: dhrname Date: 2010-03-09 23:39:20 +0900 (Tue, 09 Mar 2010) Log Message: ----------- 1, SVGLengthのメソッドを修正 2, 属性の解析の位置を、それぞれの該当する要素オブジェクトに移した Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-08 14:39:21 UTC (rev 1707) +++ branches/ufltima/dom/svg.js 2010-03-09 14:39:20 UTC (rev 1708) @@ -166,6 +166,109 @@ style.cssText._rewrite = 1; } }, false) + this.addEventListener("DOMAttrModified", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; + } + var name = evt.attrName, tar = evt.target, _parseFloat = parseFloat; + if (!!CSS2Properties[name] || name.indexOf("-") > -1) { + tar._attributeStyle.setProperty(name, evt.newValue, ""); + } else if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば + tar.id = evt.newValue; + } else if (name === "transform" && !!tar.transform) { + var tft = evt.newValue, degR = /[\-\d\.e]+/g; + var coma = tft.match(/[A-Za-z]+(?=\s*\()/g); //コマンド文字にマッチ translate + var list = tft.match(/\([^\)]+\)/g); //カッコ内のリストにマッチ (10 20 30...) + var a,b,c,d,e,f,lis,deg,rad,degli; + //transform属性の値を、SVGTransformListであるtransformプロパティに結びつける + for (var j=0,cli=coma.length;j 1) { - r1 = Math.sqrt(lamda) * r1; - r2 = Math.sqrt(lamda) * r2; - sds = 0; - } else{ - var seif = 1; - if (ti.largeArcFlag === fS) { - seif = -1; - } - sds = seif * Math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd)); - } - var txd = sds*r1*ryd / r2, tyd = -1 * sds*r2*rxd / r1; - var tx = cpsi*txd - spsi*tyd + (rx+cx)/2, ty = spsi*txd + cpsi*tyd + (ry+cy)/2; - var rad = Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1) - Math.atan2(0, 1); - var s1 = (rad >= 0) ? rad : 2 * Math.PI + rad; - rad = Math.atan2((-ryd-tyd)/r2, (-rxd-txd)/r1) - Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1); - var dr = (rad >= 0) ? rad : 2 * Math.PI + rad; - if (!fS && dr > 0) { - dr -= 2*Math.PI; - } else if (fS && dr < 0) { - dr += 2*Math.PI; - } - var sse = dr * 2 / Math.PI; - var seg = Math.ceil(sse<0 ? -1*sse : sse); - var segr = dr / seg; - var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); - var cpsir1 = cpsi * r1, cpsir2 = cpsi * r2; - var spsir1 = spsi * r1, spsir2 = spsi * r2; - var mc = Math.cos(s1); - var ms = Math.sin(s1); - var x2 = rx - t * (cpsir1*ms + spsir2*mc), y2 = ry - t * (spsir1*ms - cpsir2*mc); - for (var i = 0; i < seg; ++i) { - s1 += segr; - mc = Math.cos(s1); - ms = Math.sin(s1); - var x3 = cpsir1*mc - spsir2*ms + tx, y3 = spsir1*mc + cpsir2*ms + ty; - var dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(x3, y3, x2, y2, x3-dx, y3-dy)); - x2 = x3 + dx; - y2 = y3 + dy; - } - } else if (dii === "S") { - if (i !== 0) { - var tg = tlist.getItem(i-1); - if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { - var x1 = 2*tg.x - tg.x2; - var y1 = 2*tg.y - tg.y2; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2, ti.y2)); - } - } - } else if (dii === "s") { - if (i !== 0) { - var tg = tlist.getItem(i-1); - if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { - var x1 = 2*tg.x - tg.x2; - var y1 = 2*tg.y - tg.y2; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); - } - } - } else if (dii === "T" || dii === "t") { - if (i !== 0) { - var tg = tlist.getItem(i-1); - if (tg.pathSegTypeAsLetter === "Q" || tg.pathSegTypeAsLetter === "q") { - var x1 = 2*tg.x - tg.x1; - var y1 = 2*tg.y - tg.y1; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); - } - } - } else if (dii === "H" || dii === "h") { - tnl.appendItem(tar.createSVGPathSegLinetoABS(cx, ry)); - } else if (dii === "V" || dii === "v") { - tnl.appendItem(tar.createSVGPathSegLinetoABS(rx, cy)); - } - } - } - } - }, true); - this.addEventListener("DOMAttrModified", function(evt){ - if (evt.eventPhase === Event.BUBBLING_PHASE) { - return; - } - var name = evt.attrName, tar = evt.target; - if (!!CSS2Properties[name] || name.indexOf("-") > -1) { - tar._attributeStyle.setProperty(name, evt.newValue, ""); - } else if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば - tar.id = evt.newValue; - } else if (name === "transform" && !!tar.transform) { - var tft = evt.newValue, degR = /[\-\d\.e]+/g, _parseFloat = parseFloat; - var coma = tft.match(/[A-Za-z]+(?=\s*\()/g); //コマンド文字にマッチ translate - var list = tft.match(/\([^\)]+\)/g); //カッコ内のリストにマッチ (10 20 30...) - var a,b,c,d,e,f,lis,deg,rad,degli; - //transform属性の値を、SVGTransformListであるtransformプロパティに結びつける - for (var j=0,cli=coma.length;j 1) { + r1 = Math.sqrt(lamda) * r1; + r2 = Math.sqrt(lamda) * r2; + sds = 0; + } else{ + var seif = 1; + if (ti.largeArcFlag === fS) { + seif = -1; + } + sds = seif * Math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd)); + } + var txd = sds*r1*ryd / r2, tyd = -1 * sds*r2*rxd / r1; + var tx = cpsi*txd - spsi*tyd + (rx+cx)/2, ty = spsi*txd + cpsi*tyd + (ry+cy)/2; + var rad = Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1) - Math.atan2(0, 1); + var s1 = (rad >= 0) ? rad : 2 * Math.PI + rad; + rad = Math.atan2((-ryd-tyd)/r2, (-rxd-txd)/r1) - Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1); + var dr = (rad >= 0) ? rad : 2 * Math.PI + rad; + if (!fS && dr > 0) { + dr -= 2*Math.PI; + } else if (fS && dr < 0) { + dr += 2*Math.PI; + } + var sse = dr * 2 / Math.PI; + var seg = Math.ceil(sse<0 ? -1*sse : sse); + var segr = dr / seg; + var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); + var cpsir1 = cpsi * r1, cpsir2 = cpsi * r2; + var spsir1 = spsi * r1, spsir2 = spsi * r2; + var mc = Math.cos(s1); + var ms = Math.sin(s1); + var x2 = rx - t * (cpsir1*ms + spsir2*mc), y2 = ry - t * (spsir1*ms - cpsir2*mc); + for (var i = 0; i < seg; ++i) { + s1 += segr; + mc = Math.cos(s1); + ms = Math.sin(s1); + var x3 = cpsir1*mc - spsir2*ms + tx, y3 = spsir1*mc + cpsir2*ms + ty; + var dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(x3, y3, x2, y2, x3-dx, y3-dy)); + x2 = x3 + dx; + y2 = y3 + dy; + } + } else if (dii === "S") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { + var x1 = 2*tg.x - tg.x2; + var y1 = 2*tg.y - tg.y2; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2, ti.y2)); + } + } + } else if (dii === "s") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { + var x1 = 2*tg.x - tg.x2; + var y1 = 2*tg.y - tg.y2; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); + } + } + } else if (dii === "T" || dii === "t") { + if (i !== 0) { + var tg = tlist.getItem(i-1); + if (tg.pathSegTypeAsLetter === "Q" || tg.pathSegTypeAsLetter === "q") { + var x1 = 2*tg.x - tg.x1; + var y1 = 2*tg.y - tg.y1; + tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); + } + } + } else if (dii === "H" || dii === "h") { + tnl.appendItem(tar.createSVGPathSegLinetoABS(cx, ry)); + } else if (dii === "V" || dii === "v") { + tnl.appendItem(tar.createSVGPathSegLinetoABS(rx, cy)); + } + } + } + } + }, false); /*以下の処理は、このpath要素ノードがDOMツリーに追加されて初めて、 *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。 */ @@ -1731,9 +1779,6 @@ if (evt.eventPhase === Event.BUBBLING_PHASE) { return; //強制終了させる } - if (tar.hasAttributeNS(null, "d")) { - tar.setAttributeNS(null, "d", tar.getAttributeNS(null, "d")); - } evt.target.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ /*以下の処理は、normalizedpathSegListとCTMに基づいて、 *SVGのd属性をVMLに変換していく処理である。 From svnnotify @ sourceforge.jp Tue Mar 9 23:39:39 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 09 Mar 2010 23:39:39 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzA5XQ==?= Message-ID: <1268145579.499979.7235.nullmailer@users.sourceforge.jp> Revision: 1709 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1709 Author: dhrname Date: 2010-03-09 23:39:39 +0900 (Tue, 09 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-09 14:39:20 UTC (rev 1708) +++ branches/ufltima/core.js 2010-03-09 14:39:39 UTC (rev 1709) @@ -847,7 +847,7 @@ if (deep) { var ch = importedNode.childNodes, n; for (var i=0,chli=ch.length;i Revision: 1710 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1710 Author: dhrname Date: 2010-03-09 23:42:22 +0900 (Tue, 09 Mar 2010) Log Message: ----------- importNodeメソッドの修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-09 14:39:39 UTC (rev 1709) +++ branches/ufltima/core.js 2010-03-09 14:42:22 UTC (rev 1710) @@ -857,9 +857,9 @@ s.nodeValue = importedNode.nodeValue; break; case Node.TEXT_NODE: + s = this.createTextNode(importNode.data); case Node.COMMENT_NODE: - s = importedNode.cloneNode(false); - s.ownerDocument = this; + s = importedNode.createComment(importNode.data); break; case Node.DOCUMENT_FRAGMENT_NODE: //document_fragment_node break; From svnnotify @ sourceforge.jp Wed Mar 10 19:25:19 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 10 Mar 2010 19:25:19 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzExXSAgRWxlbWVudA==?= =?utf-8?b?44Guc2V0QXR0cmlidXRlTlPjg6Hjgr3jg4Pjg4njgpLkv67mraM=?= Message-ID: <1268216719.494424.446.nullmailer@users.sourceforge.jp> Revision: 1711 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1711 Author: dhrname Date: 2010-03-10 19:25:19 +0900 (Wed, 10 Mar 2010) Log Message: ----------- ElementのsetAttributeNSメソッドを修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-09 14:42:22 UTC (rev 1710) +++ branches/ufltima/core.js 2010-03-10 10:25:19 UTC (rev 1711) @@ -550,31 +550,14 @@ } }; /*void*/ Element.prototype.setAttributeNS = function( /*string*/ namespaceURI, /*string*/ qualifiedName, /*string*/ value) { - var localName = ""; - if (qualifiedName.indexOf(":") !== -1){ //もし、:が文字内に含まれていれば - var p = qualifiedName.split(":"); //:を区分に切り分けて、配列pに - localName = p[1]; - } else { - localName = qualifiedName; + var atn = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); + atn.nodeValue = value; + atn.value = value; + this.setAttributeNodeNS(atn); + atn.ownerElement = this; + if (atn.localName === "id") { //id属性であったならば + this.ownerDocument._id[value] = this; //ドキュメントに登録しておく } - var n = this.getAttributeNodeNS(namespaceURI, localName); //属性ノードを取得する - if (n) { //該当する属性ノードがあれば、 - n.nodeValue = value; - n.value = value; - /*注意 - *ここで接頭語(属性ノードのprefix)も、qualifiedNameの接頭語にあわせて書き換えられるべきであるが、軽量化のため、省略する - */ - } else { - var atn = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); - atn.nodeValue = value; - atn.value = value; - this.setAttributeNodeNS(atn); - atn.ownerElement = this; - if (qualifiedName === "id" && !namespaceURI) { //id属性であったならば - this.ownerDocument._id[value] = this; //ドキュメントに登録しておく - } - } - localName = null; }; /*void*/ Element.prototype.removeAttributeNS = function( /*string*/ namespaceURI, /*string*/ localName) { }; From svnnotify @ sourceforge.jp Wed Mar 10 20:24:31 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 10 Mar 2010 20:24:31 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzEyXSAgRG9jdW1lbnQ=?= =?utf-8?b?44GuaW1wb3J0Tm9kZeODoeOCveODg+ODieOCkuWun+ijhQ==?= Message-ID: <1268220271.315232.11797.nullmailer@users.sourceforge.jp> Revision: 1712 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1712 Author: dhrname Date: 2010-03-10 20:24:31 +0900 (Wed, 10 Mar 2010) Log Message: ----------- DocumentのimportNodeメソッドを実装 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-10 10:25:19 UTC (rev 1711) +++ branches/ufltima/core.js 2010-03-10 11:24:31 UTC (rev 1712) @@ -819,6 +819,9 @@ */ /*Node*/ Document.prototype.importNode = function( /*Node*/ importedNode, /*boolean*/ deep) { var s; + /*以下の処理は引き渡されたimportNodeがMSXMLによって解析された + *データであることを前提にしている + */ switch (importedNode.nodeType) { case Node.ELEMENT_NODE: s = this.createElementNS(importedNode.namespaceURI, importedNode.nodeName); @@ -842,10 +845,38 @@ case Node.TEXT_NODE: s = this.createTextNode(importNode.data); case Node.COMMENT_NODE: - s = importedNode.createComment(importNode.data); + s = this.createComment(importNode.data); break; - case Node.DOCUMENT_FRAGMENT_NODE: //document_fragment_node + case Node.DOCUMENT_FRAGMENT_NODE: + s = this.createDocumentFragment(); + if (deep) { + var ch = importedNode.childNodes, n; + for (var i=0,chli=ch.length;i Revision: 1713 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1713 Author: dhrname Date: 2010-03-10 20:28:29 +0900 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-10 11:24:31 UTC (rev 1712) +++ branches/ufltima/core.js 2010-03-10 11:28:29 UTC (rev 1713) @@ -421,7 +421,7 @@ var tgans = this.getNamedItemNS(arg.namespaceURI, arg.localName); if (tgans) { //ノードがすでにあるならば、 var s = this[this._num]; - this[this._num] = node; + this[this._num] = arg; return s; } else { if ( arg.ownerElement !== void 0) { //ノードがもはや別の要素で使われている From svnnotify @ sourceforge.jp Wed Mar 10 20:38:41 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 10 Mar 2010 20:38:41 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzE0XQ==?= Message-ID: <1268221121.488164.28081.nullmailer@users.sourceforge.jp> Revision: 1714 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1714 Author: dhrname Date: 2010-03-10 20:38:41 +0900 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-10 11:28:29 UTC (rev 1713) +++ branches/ufltima/core.js 2010-03-10 11:38:41 UTC (rev 1714) @@ -553,8 +553,8 @@ var atn = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); atn.nodeValue = value; atn.value = value; + atn.ownerElement = this; this.setAttributeNodeNS(atn); - atn.ownerElement = this; if (atn.localName === "id") { //id属性であったならば this.ownerDocument._id[value] = this; //ドキュメントに登録しておく } From svnnotify @ sourceforge.jp Wed Mar 10 20:39:14 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 10 Mar 2010 20:39:14 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzE2XQ==?= Message-ID: <1268221154.913236.29028.nullmailer@users.sourceforge.jp> Revision: 1716 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1716 Author: dhrname Date: 2010-03-10 20:39:14 +0900 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-10 11:39:02 UTC (rev 1715) +++ branches/ufltima/dom/svg.js 2010-03-10 11:39:14 UTC (rev 1716) @@ -1053,6 +1053,7 @@ str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->"); doc.loadXML(str); var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); + s.importNode(doc.documentElement); return s; }; } From svnnotify @ sourceforge.jp Wed Mar 10 23:35:43 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 10 Mar 2010 23:35:43 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzE3XQ==?= Message-ID: <1268231743.332034.26048.nullmailer@users.sourceforge.jp> Revision: 1717 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1717 Author: dhrname Date: 2010-03-10 23:35:43 +0900 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-10 11:39:14 UTC (rev 1716) +++ branches/ufltima/dom/events.js 2010-03-10 14:35:43 UTC (rev 1717) @@ -171,9 +171,6 @@ *イベントの雛形となる。プロパティもすべて含めて、必須 */ function Event(evt) { - if (!evt) { - var evt = { ctrlKey:null, shiftKey:null, altKey:null, clientX:null, clientY:null}; - } /*DOMString*/ this.type; /*EventTarget*/ this.target; /*EventTarget*/ this.currentTarget = null; @@ -207,12 +204,22 @@ return this; }*/ /*Event*/ Document.prototype.createEvent = function( /*string*/ eventType) { - var evt = new Event(window.event); + var evt; + if (eventType === "MutationEvents") { + evt = new MutationEvent(); + } else if (eventType === "MouseEvents") { + evt = new MouseEvent(window.event); + } else if (eventType === "UIEvents") { + evt = new MouseEvent(window.event); + } else { + evt = new Event(); + } evt.type = eventType; return evt; }; function UIEvent() { + Event.call(this, arguments); /*views::AbstractView*/ this.view; /*long*/ this.detail = 0; return this; @@ -226,6 +233,7 @@ this.view = viewArg; }; function MouseEvent(evt) { + UIEvent.call(this, arguments); /*long*/ this.screenX; /*long*/ this.screenY; /*long*/ this.clientX = 0; @@ -244,6 +252,7 @@ }; function MutationEvent(){ + Event.call(this, arguments); /*Node*/ this.relatedNode; /*string*/ this.prevValue; /*string*/ this.newValue; @@ -275,7 +284,7 @@ /*Node*/ NamedNodeMap.prototype.setNamedItemNS = function(/*Node*/ arg) { var tgans = this.getNamedItemNS(arg.namespaceURI, arg.localName); /*ここから*/ - var evt = arg.ownerElement.ownerDocument.createEvent("MutationEvents"); + var evt = arg.ownerDocument.createEvent("MutationEvents"); /*ここまで追加*/ if (tgans) { //ノードがすでにあるならば、 var s = this[this._num]; From svnnotify @ sourceforge.jp Wed Mar 10 23:35:54 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 10 Mar 2010 23:35:54 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzE4XQ==?= Message-ID: <1268231754.033687.26217.nullmailer@users.sourceforge.jp> Revision: 1718 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1718 Author: dhrname Date: 2010-03-10 23:35:53 +0900 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-10 14:35:43 UTC (rev 1717) +++ branches/ufltima/dom/svg.js 2010-03-10 14:35:53 UTC (rev 1718) @@ -1043,7 +1043,7 @@ var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i Revision: 1719 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1719 Author: dhrname Date: 2010-03-10 23:36:58 +0900 (Wed, 10 Mar 2010) Log Message: ----------- setAttributeNSメソッドとsetAttributeNodeNSメソッドを修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-10 14:35:53 UTC (rev 1718) +++ branches/ufltima/core.js 2010-03-10 14:36:58 UTC (rev 1719) @@ -553,7 +553,6 @@ var atn = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); atn.nodeValue = value; atn.value = value; - atn.ownerElement = this; this.setAttributeNodeNS(atn); if (atn.localName === "id") { //id属性であったならば this.ownerDocument._id[value] = this; //ドキュメントに登録しておく @@ -566,12 +565,11 @@ return s; }; /*Attr*/ Element.prototype.setAttributeNodeNS = function( /*Attr*/ newAttr){ - if (newAttr.ownerElement !== void 0) { - if (newAttr.ownerElement.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合 - throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR)); - } + if (newAttr.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合 + throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR)); } var s = this.attributes.setNamedItemNS(newAttr); + newAttr.ownerElement = this; return s; }; /*NodeList(Array)*/ Element.prototype.getElementsByTagNameNS = function( /*string*/ namespaceURI, /*string*/ localName) { @@ -769,6 +767,7 @@ /*Text*/ Document.prototype.createTextNode = function( /*string*/ data) { var s = new Text(); s.data = s.nodeValue = data; + s.ownerDocument = this; return s; }; /*createCommentメソッド @@ -777,6 +776,7 @@ /*Comment*/ Document.prototype.createComment = function( /*string*/ data) { var s = new Comment(); s.nodeValue = data; + s.ownerDocument = this; return s; }; /*createCDATASectionメソッド @@ -785,6 +785,7 @@ /*CDATASection*/ Document.prototype.createCDATASection = function( /*string*/ data) { var s = new CDATASection(); s.nodeValue = data; + s.ownerDocument = this; return s; }; /*createProcessingInstructionメソッド @@ -794,6 +795,7 @@ var s = new ProcessingInstruction(); s.target = s.nodeName = target; s.data = s.nodeValue = data; + s.ownerDocument = this; return s; }; /*createAttribute @@ -807,6 +809,7 @@ /*EntityReference*/ Document.prototype.createEntityReference = function( /*string*/ name) { var s = new EntityReference(); s.nodeName = name; + s.ownerDocument = this; return s; }; /*getElementsByTagNameメソッド @@ -828,6 +831,7 @@ var attr = importedNode.attributes, att; for (var i=0,atli=attr.length;i Revision: 1720 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1720 Author: dhrname Date: 2010-03-10 23:46:05 +0900 (Wed, 10 Mar 2010) Log Message: ----------- ownerElementプロパティの関係で、setNamedItemNSではなく、setAttributeNodeNSメソッドを上書きする Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-10 14:36:58 UTC (rev 1719) +++ branches/ufltima/dom/events.js 2010-03-10 14:46:05 UTC (rev 1720) @@ -277,36 +277,28 @@ /*unsigned short*/ MutationEvent.ADDITION = 2; /*unsigned short*/ MutationEvent.REMOVAL = 3; -/*MutationEventsの発動のために、setNamedItemNSを上書きする。ファイル統合やmakeの際は、 +/*MutationEventsの発動のために、setAttributeNodeNSを上書きする。ファイル統合やmakeの際は、 *重複するのでコアモジュールのメソッドは削除する。モジュールテストを行うために、 *このような形式をとることにする。なお、追加部分には区別を付けるために、前後にコメントを挿入する。 */ -/*Node*/ NamedNodeMap.prototype.setNamedItemNS = function(/*Node*/ arg) { - var tgans = this.getNamedItemNS(arg.namespaceURI, arg.localName); +/*Attr*/ Element.prototype.setAttributeNodeNS = function( /*Attr*/ newAttr){ + if (newAttr.ownerDocument !== this.ownerDocument) { //所属ドキュメントが違う場合 + throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR)); + } + var s = this.attributes.setNamedItemNS(newAttr); + newAttr.ownerElement = this; /*ここから*/ - var evt = arg.ownerDocument.createEvent("MutationEvents"); - /*ここまで追加*/ - if (tgans) { //ノードがすでにあるならば、 - var s = this[this._num]; - this[this._num] = arg; - /*ここから*/ - evt.initMutationEvent("DOMAttrModified", true, false, arg, null, arg.nodeName, arg.nodeName, MutationEvent.MODIFICATION); - arg.ownerElement.dispatchEvent(evt); //このとき、MutationEventsが発動 - /*ここまで追加*/ - return s; + var evt = this.ownerDocument.createEvent("MutationEvents"); + if (!s) { //ノードがすでにあるならば + evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeName, newAttr.nodeName, MutationEvent.MODIFICATION); + this.dispatchEvent(evt); //このとき、MutationEventsが発動 } else { - if ( arg.ownerElement !== void 0) { //ノードがもはや別の要素で使われている - throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR)); - } - this[this.length] = arg; //新たに、argを項目として追加する - this.length += 1; - /*ここから*/ - evt.initMutationEvent("DOMAttrModified", true, false, arg, null, arg.nodeName, arg.nodeName, MutationEvent.ADDITION); - arg.ownerElement.dispatchEvent(evt); - /*ここまで追加*/ - return null; + evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeName, newAttr.nodeName, MutationEvent.ADDITION); + this.dispatchEvent(evt); } evt = null; + /*ここまで追加*/ + return s; }; /*Node*/ Node.prototype.insertBefore = function( /*Node*/ n, ref) { From svnnotify @ sourceforge.jp Thu Mar 11 20:10:37 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 11 Mar 2010 20:10:37 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzIxXQ==?= Message-ID: <1268305837.246554.29554.nullmailer@users.sourceforge.jp> Revision: 1721 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1721 Author: dhrname Date: 2010-03-11 20:10:37 +0900 (Thu, 11 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-10 14:46:05 UTC (rev 1720) +++ branches/ufltima/core.js 2010-03-11 11:10:37 UTC (rev 1721) @@ -831,8 +831,7 @@ var attr = importedNode.attributes, att; for (var i=0,atli=attr.length;i Revision: 1722 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1722 Author: dhrname Date: 2010-03-11 20:11:19 +0900 (Thu, 11 Mar 2010) Log Message: ----------- SVGSVGElementと、そのgetScreenCTMメソッドの修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-11 11:10:37 UTC (rev 1721) +++ branches/ufltima/dom/svg.js 2010-03-11 11:11:19 UTC (rev 1722) @@ -783,13 +783,17 @@ /*readonly SVGAnimatedRect*/ this.viewBox = this.currentView.viewBox; /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = this.currentView.preserveAspectRatio; /*unsigned short*/ this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE; + this._tx = 0; + this._ty = 0; /*DOMAttrModifiedイベントを利用して、 *随時、属性の値をDOMプロパティに変換しておくリスナー登録 */ this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ - var ttps = evt.target._tar.style; - ttps.marginLeft = this._tx+ "px"; - ttps.marginTop = this._ty+ "px"; + var tar = evt.target; + tar.getScreenCTM(); //this._tx, _tyプロパティを設定するために呼び出す + var ttps = tar._tar.style; + ttps.marginLeft = tar._tx+ "px"; + ttps.marginTop = tar._ty+ "px"; }, false); return this; }; @@ -834,9 +838,12 @@ s.setMatrix(matrix); return s; }; -/*SVGMatrix*/ SVGElement.prototype.getScreenCTM = function(){ +/*getScreenCTM + *SVGElement(SVGLocatable)で指定しておいたメソッドであるが、ここで、算出方法が違うため、再定義をする + */ +/*SVGMatrix*/ SVGSVGElement.prototype.getScreenCTM = function(){ var vw = this.viewport.width, vh = this.viewport.height; - var vB = this.currentView.viewBox, par = this.currentView.preserveAspectRatio; + var vB = this.currentView.viewBox.baseVal, par = this.currentView.preserveAspectRatio.baseVal; if (!vB) { this._tx = this._ty = 0; return this.createSVGMatrix(); From svnnotify @ sourceforge.jp Thu Mar 11 23:28:29 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 11 Mar 2010 23:28:29 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzIzXSAgdmlld0JveA==?= =?utf-8?b?5bGe5oCn44GocHJlc2VydmVBc3BlY3RSYXRpb+WxnuaAp+OBruOCteODnQ==?= =?utf-8?b?44O844OI?= Message-ID: <1268317709.167064.28625.nullmailer@users.sourceforge.jp> Revision: 1723 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1723 Author: dhrname Date: 2010-03-11 23:28:28 +0900 (Thu, 11 Mar 2010) Log Message: ----------- viewBox属性とpreserveAspectRatio属性のサポート Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-11 11:11:19 UTC (rev 1722) +++ branches/ufltima/dom/svg.js 2010-03-11 14:28:28 UTC (rev 1723) @@ -772,7 +772,7 @@ /*DOMString*/ this.contentStyleType = "text/css"; /*readonly SVGRect*/ this.viewport = this.createSVGRect(); /*boolean*/ this.useCurrentView = false; //ズームなど加工がされていれば、true - /*readonly SVGViewSpec*/ this.currentView = new SVGViewSpec(); + /*readonly SVGViewSpec*/ this.currentView = new SVGViewSpec(this); /*もし、画像をズームやパンしたとき、どのような倍率になるかを *以下のプロパティを使って次の行列で示すことができる *2x3 行列 [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y] @@ -788,6 +788,50 @@ /*DOMAttrModifiedイベントを利用して、 *随時、属性の値をDOMプロパティに変換しておくリスナー登録 */ + this.addEventListener("DOMAttrModified", function(evt){ + var tar = evt.target, name = evt.attrName; + if (name === "viewBox") { + var tv = tar.vewBox.baseVal; + var ovb = vb.replace(/^\s+|\s+$/g, "").split(/[\s,]+/); + tv.x = parseFloat(ovb[0]); + tv.y = parseFloat(ovb[1]); + tv.width = parseFloat(ovb[2]); + tv.height = parseFloat(ovb[3]); + } else if (name === "preserveAspectRatio") { + var par = evt.newValue, tp = tar.preserveAspectRatio.baseVal; + var sa = 1, mos = SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN; + if (!!par.match(/x(Min|Mid|Max)Y(Min|Mid|Max)(?:\s+(meet|slice))?/)) { + switch (RegExp.$1) { + case "Min": + sa += 1; + break; + case "Mid": + sa += 2; + break; + case "Max": + sa += 3; + break; + } + switch (RegExp.$2) { + case "Min": + break; + case "Mid": + sa += 3; + break; + case "Max": + sa += 6; + break; + } + if (RegExp.$3 === "slice") { + mos = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE; + } else { + mos = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; + } + } + tp.align = sa; + tp.meetOrSlice = mos; + } + }, false); this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ var tar = evt.target; tar.getScreenCTM(); //this._tx, _tyプロパティを設定するために呼び出す @@ -920,7 +964,6 @@ /*readonly DOMString*/ this.preserveAspectRatioString = ""; /*readonly DOMString*/ this.transformString = ""; /*readonly DOMString*/ this.viewTargetString = ""; - this._tar = ele; return this; }; SVGViewSpec.constructor = SVGFitToViewBox; @@ -1050,7 +1093,7 @@ var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i Revision: 1724 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1724 Author: dhrname Date: 2010-03-13 20:12:48 +0900 (Sat, 13 Mar 2010) Log Message: ----------- insertBeforeとremoveChildメソッドの部分を修正 Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-11 14:28:28 UTC (rev 1723) +++ branches/ufltima/dom/events.js 2010-03-13 11:12:48 UTC (rev 1724) @@ -290,10 +290,10 @@ /*ここから*/ var evt = this.ownerDocument.createEvent("MutationEvents"); if (!s) { //ノードがすでにあるならば - evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeName, newAttr.nodeName, MutationEvent.MODIFICATION); + evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeValue, newAttr.nodeName, MutationEvent.MODIFICATION); this.dispatchEvent(evt); //このとき、MutationEventsが発動 } else { - evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeName, newAttr.nodeName, MutationEvent.ADDITION); + evt.initMutationEvent("DOMAttrModified", true, false, newAttr, s.nodeValue, newAttr.nodeValue, newAttr.nodeName, MutationEvent.ADDITION); this.dispatchEvent(evt); } evt = null; @@ -343,12 +343,14 @@ evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); n.dispatchEvent(evt); var descend = this.getElementsByTagNameNS("*", "*"); //全子孫要素を取得 - for (var i=0,dli=descend.length;i Revision: 1725 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1725 Author: dhrname Date: 2010-03-13 20:14:40 +0900 (Sat, 13 Mar 2010) Log Message: ----------- 1, baseValプロパティを付けていない部分があったので、それを修正追加 2, VMLの名前空間を付ける作業を追加 3, 作業2に伴い、windowオブジェクトのonloadイベントに登録する作業を追加 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-13 11:12:48 UTC (rev 1724) +++ branches/ufltima/dom/svg.js 2010-03-13 11:14:40 UTC (rev 1725) @@ -182,7 +182,7 @@ var a,b,c,d,e,f,lis,deg,rad,degli; //transform属性の値を、SVGTransformListであるtransformプロパティに結びつける for (var j=0,cli=coma.length;j|\]>)/,"-->"); doc.loadXML(str); var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); - s.importNode(doc.documentElement); + s.importNode(doc.documentElement, true); return s; }; alert(objei.getSVGDocument()); @@ -1329,6 +1339,7 @@ function SVGTransformList() { /*readonly unsigned long*/ this.numberOfItems = 0; + this._list = []; return this; }; for (var prop in SVGStringList.prototype) { //prototypeのコピーで継承を行う @@ -1874,6 +1885,8 @@ } } } + var vi = tar.ownerDocument.documentElement.viewport; + var w = vi.width, h = vi.hight; tar._tar.path = dat + " e"; tar._tar.coordsize = w + " " + h; matrix = dat = x = y = null; @@ -2083,7 +2096,8 @@ } var dat = list.join(" "); //VMLに結び付けていく - var ele = tar._tar; + var ele = tar._tar, vi = tar.ownerDocument.documentElement.viewport; + var w = vi.width, h = vi.hight; ele.path = dat; ele.coordsize = w + " " + h; list = dat = ele = null; @@ -2825,4 +2839,13 @@ view: SVGViewElement, vkern: SVGVKernElement }; -GetSVGDocument(); \ No newline at end of file +NAIBU.addEvent = function(evt,lis){ + if (window.addEventListener) { + window.addEventListener(evt, lis, false); + } else if (window.attachEvent) { + window.attachEvent('on'+evt, lis); + } else { + window['on'+evt] = lis; + } +}; +NAIBU.addEvent("load", GetSVGDocument); \ No newline at end of file From svnnotify @ sourceforge.jp Sat Mar 13 20:15:06 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 13 Mar 2010 20:15:06 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzI2XQ==?= Message-ID: <1268478906.458525.9528.nullmailer@users.sourceforge.jp> Revision: 1726 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1726 Author: dhrname Date: 2010-03-13 20:15:06 +0900 (Sat, 13 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-13 11:14:40 UTC (rev 1725) +++ branches/ufltima/core.js 2010-03-13 11:15:06 UTC (rev 1726) @@ -829,17 +829,18 @@ case Node.ELEMENT_NODE: s = this.createElementNS(importedNode.namespaceURI, importedNode.nodeName); var attr = importedNode.attributes, att; - for (var i=0,atli=attr.length;i Revision: 1727 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1727 Author: dhrname Date: 2010-03-13 21:07:38 +0900 (Sat, 13 Mar 2010) Log Message: ----------- Eventの重複問題を解決する修正 Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-13 11:15:06 UTC (rev 1726) +++ branches/ufltima/dom/events.js 2010-03-13 12:07:38 UTC (rev 1727) @@ -116,7 +116,7 @@ s[s.length] = te; te = te.parentNode; } while (te); - s.unshift(this.ownerDocument); + s[s.length] = this.ownerDocument; /*最初に捕獲フェーズでDOMツリーを下っていき、イベントのターゲットについたら、 *そこで、浮上フェーズとして折り返すように、反復処理をおこなう */ @@ -192,7 +192,8 @@ /*void*/ initEvent : function( /*string*/ eventTypeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg) { this.type = eventTypeArg; this.bubbles = canBubbleArg; - this.cacelable = cancelableArg; + this.cancelable = cancelableArg; + this.eventPhase = Event.CAPTURING_PHASE; //初期化 } }; // PhaseType @@ -340,6 +341,8 @@ *挿入されたときに発火する。間接的な挿入とは、サブツリーを作っておいて、それをいっぺんに挿入する場合など。 *このイベントは浮上しないことに注意を要する */ + evt = this.ownerDocument.createEvent("MutationEvents"); + evt.target = n; evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); n.dispatchEvent(evt); var descend = this.getElementsByTagNameNS("*", "*"); //全子孫要素を取得 @@ -380,6 +383,8 @@ di = null; } } + evt = this.ownerDocument.createEvent("MutationEvents"); + evt.target = ele; evt.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null); ele.dispatchEvent(evt); evt = descend = null; From svnnotify @ sourceforge.jp Sat Mar 13 21:56:38 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 13 Mar 2010 21:56:38 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzI4XSAgc3Zn6KaB57Sg?= =?utf-8?b?44Gu5p6g44Gu44CM55S75YOP5YiH44KK5Y+W44KK44CN5Yem55CG44KS6L+9?= =?utf-8?b?5Yqg?= Message-ID: <1268484998.412603.8333.nullmailer@users.sourceforge.jp> Revision: 1728 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1728 Author: dhrname Date: 2010-03-13 21:56:38 +0900 (Sat, 13 Mar 2010) Log Message: ----------- svg要素の枠の「画像切り取り」処理を追加 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-13 12:07:38 UTC (rev 1727) +++ branches/ufltima/dom/svg.js 2010-03-13 12:56:38 UTC (rev 1728) @@ -972,6 +972,18 @@ function SVGGElement() { SVGElement.apply(this, arguments); this._tar = document.createElement("v:group"); + /*以下の処理は、このpath要素ノードがDOMツリーに追加されて初めて、 + *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。 + */ + this.addEventListener("DOMNodeInserted", function(evt){ + var tar = evt.target; + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; //強制終了させる + } + tar.parentNode._tar.appendChild(tar._tar); + evt.target.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ + }, false); + }, false); return this; }; SVGGElement.constructor = SVGElement; @@ -1102,7 +1114,7 @@ //HTML内のobject要素を探し出して、メソッドを結びつける var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i|\]>)/,"-->"); doc.loadXML(str); var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); + var tar = s.documentElement, sdt = s.documentElement._tar; + document.body.insertBefore(sdt, document.body.lastChild); + /*以下では、VMLの要素とHTMLのCSSのプロパティを用いて、背景を + *作り出す作業を行う。これは必須 + */ + var backr = document.createElement("v:rect"); + var w = tar.viewport.width, h = tar.viewport.height, sw = tar.width.baseVal, sh = tar.height.baseVal; + backr.style.position = "absolute"; + backr.style.width = w+ "px"; + backr.style.height = h+ "px"; + backr.style.zIndex = -1; + backr.stroked = "false"; + backr.filled = "false"; + tar._tar.appendChild(backr); + var trstyle = tar._tar.style; + var tpstyle = objei.style; + trstyle.visibility = "visible"; + //以下、画像を切り取り + trstyle.overflow = "hidden"; + var backrs = backr.currentStyle; + var viewWidth = w > sw ? sw : w, viewHeight = h > sh ? sh : h; //ウィンドウ枠の長さを決定する + var bfl = parseFloat(backrs.left), bft = parseFloat(backrs.top); + var bl = -tar._tx, bt = -tar._ty; + if (bfl !== 0 && !isNaN(bfl)) { //内部の図形にずれが生じたとき(isNaNはIE8でautoがデフォルト値のため) + bl = bfl; + tpstyle.left = -bl+ "px"; + } + if (bft !== 0 && !isNaN(bfl)) { + bt = bft; + tpstyle.top = -bt+ "px"; + } + var backright = bl + viewWidth + 1; + var backdown = bt + viewHeight + 1; + trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; s.importNode(doc.documentElement, true); return s; }; From svnnotify @ sourceforge.jp Sun Mar 14 21:45:07 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 14 Mar 2010 21:45:07 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzI5XSAgaW1wb3J0Tm9k?= =?utf-8?b?ZeODoeOCveODg+ODieOBqGdldEVsZW1lbnRzQnlUYWdOYW1lTlPjg6Hjgr0=?= =?utf-8?b?44OD44OJ44KS5L+u5q2j?= Message-ID: <1268570707.381919.6414.nullmailer@users.sourceforge.jp> Revision: 1729 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1729 Author: dhrname Date: 2010-03-14 21:45:06 +0900 (Sun, 14 Mar 2010) Log Message: ----------- importNodeメソッドとgetElementsByTagNameNSメソッドを修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-13 12:56:38 UTC (rev 1728) +++ branches/ufltima/core.js 2010-03-14 12:45:06 UTC (rev 1729) @@ -576,16 +576,19 @@ var s = [], n = 0; var tno = this.childNodes; for (var i=0,tcli = tno.length;i Revision: 1730 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1730 Author: dhrname Date: 2010-03-14 21:46:18 +0900 (Sun, 14 Mar 2010) Log Message: ----------- handleEventメソッドに例外処理を追加。 それに伴い、STLogオブジェクトをsvgモジュールから、eventモジュールに移した Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-14 12:45:06 UTC (rev 1729) +++ branches/ufltima/dom/events.js 2010-03-14 12:46:18 UTC (rev 1730) @@ -54,6 +54,22 @@ * PURPOSE. * See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ +//以下は例外処理のログをとるためのもの。開発者以外は削除すること +var stlog = new STLog(true); +function STLog(jou) { +this.jo = jou; +if (this.jo) { + this.p = document.createElement("div"); + this.p.innerHTML = "

例外処理のログ

"; + document.body.insertBefore(this.p,document.body.firstChild); +} + return this; +} +STLog.prototype.add = function(e,code) { +if (this.jo) { + this.p.innerHTML += "

"+code+":"+e.message+"

"; +} +} /* // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.idl @@ -146,7 +162,7 @@ } } var d = evt._default - evt = null; + evt = te = s = null; return d; }; @@ -158,13 +174,17 @@ }; EventListener.prototype = { /*void*/ handleEvent : function( /*Event*/ evt) { - var ph = evt.eventPhase, cap = this._cap; - if (ph === Event.CAPTURING_PHASE) { //イベントフェーズが捕獲段階であることを示し - cap = cap ? false : true; //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。 + try { + var ph = evt.eventPhase, cap = this._cap; + if (ph === Event.CAPTURING_PHASE) { //イベントフェーズが捕獲段階であることを示し + cap = cap ? false : true; //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。 + } + if (!cap && evt.type === this._type) { + this._listener(evt); + } + } catch (e) { + stlog.add(e, 186); } - if (!cap && evt.type === this._type) { - this._listener(evt); - } } }; /*Eventクラス From svnnotify @ sourceforge.jp Sun Mar 14 21:47:21 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 14 Mar 2010 21:47:21 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzMxXSAgZ2V0Q1RN44Oh?= =?utf-8?b?44K944OD44OJ44KSdHJhbnNmb3Jt5bGe5oCn44GM56m644Gn44GC44KL5aC0?= =?utf-8?b?5ZCI44KC5a++5b+c44Gn44GN44KL44KI44GG44Gr5L+u5q2j?= Message-ID: <1268570841.807430.9640.nullmailer@users.sourceforge.jp> Revision: 1731 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1731 Author: dhrname Date: 2010-03-14 21:47:21 +0900 (Sun, 14 Mar 2010) Log Message: ----------- getCTMメソッドをtransform属性が空である場合も対応できるように修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-14 12:46:18 UTC (rev 1730) +++ branches/ufltima/dom/svg.js 2010-03-14 12:47:21 UTC (rev 1731) @@ -60,22 +60,6 @@ //documentを速くするために /*@cc_on _d=document;eval('var document=_d')@*/ -//以下は例外処理のログをとるためのもの。開発者以外は削除すること -var stlog = new STLog(true); -function STLog(jou) { -this.jo = jou; -if (this.jo) { - this.p = document.createElement("div"); - this.p.innerHTML = "

例外処理のログ

"; - document.body.insertBefore(this.p,document.body.firstChild); -} - return this; -} -STLog.prototype.add = function(e,code) { -if (this.jo) { - this.p.innerHTML += "

"+code+":"+e.message+"

"; -} -} /* // File: svg.idl #ifndef _SVG_IDL_ @@ -261,7 +245,7 @@ if (tea instanceof SVGAnimatedLength) { var s = _parseFloat(evt.newValue); s = isNaN(s) ? 0 : s; - tea.baseVal.newValueSpecified(type, s); + tea.baseVal.newValueSpecifiedUnits(type, s); } } } @@ -292,11 +276,18 @@ */ /*SVGMatrix*/ SVGElement.prototype.getCTM = function() { var s; + var m = this.transform.baseVal.consolidate(); + if (m) { + m = m.matrix; + } else { + m = this.ownerDocument.documentElement.createSVGMatrix(); + } if (this.parentNode) { - s = this.parentNode.getCTM().multiply(this.transform.baseVal.consolidate() || this.ownerDocument.documentElement.createSVGMatrix()); + s = this.parentNode.getCTM().multiply(m); } else { - s = this.transform.baseVal.consolidate() || this.ownerDocument.documentElement.createSVGMatrix(); + s = m; } + m = null; return s; }; @@ -1115,7 +1106,7 @@ var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i Revision: 1732 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1732 Author: dhrname Date: 2010-03-14 23:20:06 +0900 (Sun, 14 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-14 12:47:21 UTC (rev 1731) +++ branches/ufltima/dom/svg.js 2010-03-14 14:20:06 UTC (rev 1732) @@ -1110,8 +1110,10 @@ xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { - //responsXMLはDTD処理を行う可能性があるため、ここでは使わない /*SVGDocument*/ objei.getSVGDocument = function(){ + /*responseXMLを使うと、時々、空のデータを返すことがあるため(原因は不明)、 + *ここでは、responseTextを用いる + */ var doc = new ActiveXObject("MSXML2.DomDocument"); str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->"); doc.loadXML(str); From svnnotify @ sourceforge.jp Sun Mar 14 23:21:14 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 14 Mar 2010 23:21:14 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzMzXSAgaW1wb3J0Tm9k?= =?utf-8?b?ZeODoeOCveODg+ODieOBq+OBiuOBhOOBpuOAgeWtkOimgee0oOOBjOOBqg==?= =?utf-8?b?44GE5aC05ZCI44Gu5a++5b+c44Gr6Zai44GX44Gm5L+u5q2j?= Message-ID: <1268576474.153956.3359.nullmailer@users.sourceforge.jp> Revision: 1733 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1733 Author: dhrname Date: 2010-03-14 23:21:14 +0900 (Sun, 14 Mar 2010) Log Message: ----------- importNodeメソッドにおいて、子要素がない場合の対応に関して修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-14 14:20:06 UTC (rev 1732) +++ branches/ufltima/core.js 2010-03-14 14:21:14 UTC (rev 1733) @@ -837,10 +837,11 @@ s.setAttributeNodeNS(att); } if (deep) { - var ch = importedNode.childNodes, n; - for (var i=0,chli=ch.length;i Revision: 1734 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1734 Author: dhrname Date: 2010-03-15 23:22:43 +0900 (Mon, 15 Mar 2010) Log Message: ----------- 関数GetSVGDocumentを修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-14 14:21:14 UTC (rev 1733) +++ branches/ufltima/dom/svg.js 2010-03-15 14:22:43 UTC (rev 1734) @@ -1118,7 +1118,8 @@ str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->"); doc.loadXML(str); var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); - var tar = s.documentElement, sdt = s.documentElement._tar; + var tar = s.documentElement; + var sdt = tar._tar; document.body.insertBefore(sdt, document.body.lastChild); /*以下では、VMLの要素とHTMLのCSSのプロパティを用いて、背景を *作り出す作業を行う。これは必須 @@ -1152,7 +1153,12 @@ var backright = bl + viewWidth + 1; var backdown = bt + viewHeight + 1; trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; - s.importNode(doc.documentElement, true); + var fi = doc.documentElement.firstChild, sdoce = s.documentElement, n; + while (fi) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する + n = s.importNode(fi, true); + sdoce.appendChild(n); + fi = fi.nextSibling; + } return s; }; alert(objei.getSVGDocument()); From svnnotify @ sourceforge.jp Mon Mar 15 23:29:48 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 15 Mar 2010 23:29:48 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzM1XQ==?= Message-ID: <1268663388.214315.8686.nullmailer@users.sourceforge.jp> Revision: 1735 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1735 Author: dhrname Date: 2010-03-15 23:29:48 +0900 (Mon, 15 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-15 14:22:43 UTC (rev 1734) +++ branches/ufltima/dom/svg.js 2010-03-15 14:29:48 UTC (rev 1735) @@ -1121,11 +1121,13 @@ var tar = s.documentElement; var sdt = tar._tar; document.body.insertBefore(sdt, document.body.lastChild); + tar.viewport.width = 1000; + tar.viewport.height = 1000; /*以下では、VMLの要素とHTMLのCSSのプロパティを用いて、背景を *作り出す作業を行う。これは必須 */ var backr = document.createElement("v:rect"); - var w = 1000/*tar.viewport.width*/, h = 1000/*tar.viewport.height*/, sw = tar.width.baseVal, sh = tar.height.baseVal; + var w = tar.viewport.width, h = tar.viewport.height, sw = tar.width.baseVal, sh = tar.height.baseVal; backr.style.position = "absolute"; backr.style.width = w+ "px"; backr.style.height = h+ "px"; From svnnotify @ sourceforge.jp Mon Mar 15 23:44:14 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 15 Mar 2010 23:44:14 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzM2XSAgaGFuZGxlRXZl?= =?utf-8?b?bnTjg6Hjgr3jg4Pjg4njgpLkv67mraM=?= Message-ID: <1268664254.435274.28551.nullmailer@users.sourceforge.jp> Revision: 1736 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1736 Author: dhrname Date: 2010-03-15 23:44:14 +0900 (Mon, 15 Mar 2010) Log Message: ----------- handleEventメソッドを修正 Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-15 14:29:48 UTC (rev 1735) +++ branches/ufltima/dom/events.js 2010-03-15 14:44:14 UTC (rev 1736) @@ -179,7 +179,7 @@ if (ph === Event.CAPTURING_PHASE) { //イベントフェーズが捕獲段階であることを示し cap = cap ? false : true; //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。 } - if (!cap && evt.type === this._type) { + if (!cap && (evt.type === this._type)) { this._listener(evt); } } catch (e) { From svnnotify @ sourceforge.jp Tue Mar 16 20:24:24 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 16 Mar 2010 20:24:24 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzM3XSAgcGF0aOimgQ==?= =?utf-8?b?57Sg44GuZOWxnuaAp+OCkuOBhOOBj+OBpOOBi+S/ruatow==?= Message-ID: <1268738664.226113.5640.nullmailer@users.sourceforge.jp> Revision: 1737 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1737 Author: dhrname Date: 2010-03-16 20:24:24 +0900 (Tue, 16 Mar 2010) Log Message: ----------- path要素のd属性をいくつか修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-15 14:44:14 UTC (rev 1736) +++ branches/ufltima/dom/svg.js 2010-03-16 11:24:24 UTC (rev 1737) @@ -249,9 +249,10 @@ } } } - evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); - tar.dispatchEvent(evt); //描画を開始するために、dispatchEventメソッドを使う - evt = name = tar = null; + var evtt = tar.ownerDocument.createEvent("MutationEvents"); + evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); + tar.dispatchEvent(evtt); //描画を開始するために、dispatchEventメソッドを使う + evtt = name = tar = null; }, false); return this; }; @@ -394,6 +395,7 @@ function SVGNumberList() { /*readonly unsigned long*/ this.numberOfItems = 0; + this._list = []; //リストの本体 return this; }; for (var prop in SVGStringList.prototype) { //prototypeのコピーで継承を行う @@ -1628,6 +1630,7 @@ }; function SVGPathSegList() { /*readonly unsigned long*/ this.numberOfItems = 0; + this._list = []; //リストの本体 return this; }; for (var prop in SVGStringList.prototype) { //prototypeのコピーで継承を行う @@ -1729,19 +1732,20 @@ tlist.appendItem(s); } } + D = null; /*以下の処理は、pathSegListからnormalizedPathSegListへの *変換をする処理。相対座標を絶対座標に変換して、M、L、Cコマンドに正規化していく */ - var cx = cy = 0; //現在セグメントの終了点の絶対座標を示す (相対座標を絶対座標に変換するときに使用) - var xn = yn = 0; //subpath の始点の絶対座標を示す (SコマンドやTコマンドなどで使用) - for (var i=0, tli=tlist.numberOfItems;i 1) { - r1 = Math.sqrt(lamda) * r1; - r2 = Math.sqrt(lamda) * r2; - sds = 0; - } else{ - var seif = 1; - if (ti.largeArcFlag === fS) { - seif = -1; + (function(ti, cx, cy, rx, ry, tar) { //変数を隠蔽するためのfunction + /*以下は、Arctoを複数のCuvetoに変換する処理 + *SVG 1.1 「F.6 Elliptical arc implementation notes」の章を参照 + *http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes + */ + var fS = ti.sweepFlag, psai = ti.angle; + if (ti.r1 === 0 || ti.r2 === 0) { + return; } - sds = seif * Math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd)); - } - var txd = sds*r1*ryd / r2, tyd = -1 * sds*r2*rxd / r1; - var tx = cpsi*txd - spsi*tyd + (rx+cx)/2, ty = spsi*txd + cpsi*tyd + (ry+cy)/2; - var rad = Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1) - Math.atan2(0, 1); - var s1 = (rad >= 0) ? rad : 2 * Math.PI + rad; - rad = Math.atan2((-ryd-tyd)/r2, (-rxd-txd)/r1) - Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1); - var dr = (rad >= 0) ? rad : 2 * Math.PI + rad; - if (!fS && dr > 0) { - dr -= 2*Math.PI; - } else if (fS && dr < 0) { - dr += 2*Math.PI; - } - var sse = dr * 2 / Math.PI; - var seg = Math.ceil(sse<0 ? -1*sse : sse); - var segr = dr / seg; - var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); - var cpsir1 = cpsi * r1, cpsir2 = cpsi * r2; - var spsir1 = spsi * r1, spsir2 = spsi * r2; - var mc = Math.cos(s1); - var ms = Math.sin(s1); - var x2 = rx - t * (cpsir1*ms + spsir2*mc), y2 = ry - t * (spsir1*ms - cpsir2*mc); - for (var i = 0; i < seg; ++i) { - s1 += segr; - mc = Math.cos(s1); - ms = Math.sin(s1); - var x3 = cpsir1*mc - spsir2*ms + tx, y3 = spsir1*mc + cpsir2*ms + ty; - var dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(x3, y3, x2, y2, x3-dx, y3-dy)); - x2 = x3 + dx; - y2 = y3 + dy; - } + var r1 = Math.abs(ti.r1); + var r2 = Math.abs(ti.r2); + var ctx = (rx - cx) / 2, cty = (ry - cy) / 2; + var cpsi = Math.cos(psai * Math.PI / 180), spsi = Math.sin(psai * Math.PI / 180); + var rxd = cpsi*ctx + spsi*cty, ryd = -1*spsi*ctx + cpsi*cty; + var rxdd = rxd * rxd, rydd = ryd * ryd; + var r1x = r1 * r1, r2y = r2 * r2; + var lamda = rxdd/r1x + rydd/r2y; + var sds; + if (lamda > 1) { + r1 = Math.sqrt(lamda) * r1; + r2 = Math.sqrt(lamda) * r2; + sds = 0; + } else{ + var seif = 1; + if (ti.largeArcFlag === fS) { + seif = -1; + } + sds = seif * Math.sqrt((r1x*r2y - r1x*rydd - r2y*rxdd) / (r1x*rydd + r2y*rxdd)); + } + var txd = sds*r1*ryd / r2, tyd = -1 * sds*r2*rxd / r1; + var tx = cpsi*txd - spsi*tyd + (rx+cx)/2, ty = spsi*txd + cpsi*tyd + (ry+cy)/2; + var rad = Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1) - Math.atan2(0, 1); + var s1 = (rad >= 0) ? rad : 2 * Math.PI + rad; + rad = Math.atan2((-ryd-tyd)/r2, (-rxd-txd)/r1) - Math.atan2((ryd-tyd)/r2, (rxd-txd)/r1); + var dr = (rad >= 0) ? rad : 2 * Math.PI + rad; + if (!fS && dr > 0) { + dr -= 2*Math.PI; + } else if (fS && dr < 0) { + dr += 2*Math.PI; + } + var sse = dr * 2 / Math.PI; + var seg = Math.ceil(sse<0 ? -1*sse : sse); + var segr = dr / seg; + var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2); + var cpsir1 = cpsi * r1, cpsir2 = cpsi * r2; + var spsir1 = spsi * r1, spsir2 = spsi * r2; + var mc = Math.cos(s1); + var ms = Math.sin(s1); + var x2 = rx - t * (cpsir1*ms + spsir2*mc), y2 = ry - t * (spsir1*ms - cpsir2*mc); + for (var n = 0; n < seg; ++n) { + s1 += segr; + mc = Math.cos(s1); + ms = Math.sin(s1); + var x3 = cpsir1*mc - spsir2*ms + tx, y3 = spsir1*mc + cpsir2*ms + ty; + var dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(x3, y3, x2, y2, x3-dx, y3-dy)); + x2 = x3 + dx; + y2 = y3 + dy; + } + })(ti, cx, cy, rx, ry, tar); } else if (dii === "S") { - if (i !== 0) { - var tg = tlist.getItem(i-1); + if (j !== 0) { + var tg = tlist.getItem(j-1); if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { var x1 = 2*tg.x - tg.x2; var y1 = 2*tg.y - tg.y2; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2, ti.y2)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, x1, y1, ti.x2, ti.y2)); } } } else if (dii === "s") { - if (i !== 0) { - var tg = tlist.getItem(i-1); + if (j !== 0) { + var tg = tlist.getItem(j-1); if (tg.pathSegTypeAsLetter === "C" || tg.pathSegTypeAsLetter === "c") { var x1 = 2*tg.x - tg.x2; var y1 = 2*tg.y - tg.y2; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); } } } else if (dii === "T" || dii === "t") { - if (i !== 0) { - var tg = tlist.getItem(i-1); + if (j !== 0) { + var tg = tlist.getItem(j-1); if (tg.pathSegTypeAsLetter === "Q" || tg.pathSegTypeAsLetter === "q") { var x1 = 2*tg.x - tg.x1; var y1 = 2*tg.y - tg.y1; - tnl.appendItem(tar.createSVGPathSegCurvetoCubicABS(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); } } } else if (dii === "H" || dii === "h") { - tnl.appendItem(tar.createSVGPathSegLinetoABS(cx, ry)); + tnl.appendItem(tar.createSVGPathSegLinetoAbs(cx, ry)); } else if (dii === "V" || dii === "v") { - tnl.appendItem(tar.createSVGPathSegLinetoABS(rx, cy)); + tnl.appendItem(tar.createSVGPathSegLinetoAbs(rx, cy)); } } } @@ -1900,25 +1906,19 @@ if (tps === "z" || tps === "Z") { dat += " x "; } else { - /*CTM(maなど)の行列と座標(x, y)の積を算出する。数学における表現は以下のとおり - *[ma mc me] [x] - *[mb md mf] * [y] - *[0 0 1 ] [1] - */ - var x = _parseInt(ma * ti.x + mc * ti.y + me, 10); //_parseIntはparseIntのエイリアスであり、値を丸めるのに使う - var y = _parseInt(mb * ti.x * md * ti.y + mf, 10); - x += " "; //文字列型に変換しておき、空白で区切りを付ける - y += " "; - dat += x; - dat += y; if (tps === "M") { - dat = "m" + dat; + dat += "m"; } else if (tps === "L") { - dat = "l" + dat; + dat += "l"; } else if (tps === "C") { - dat = "c" + dat; - x = _parseInt(ma * ti.x1 + mc * ti.y1 + me, 10); - y = _parseInt(mb * ti.x1 * md * ti.y1 + mf, 10); + dat += "c"; + /*CTM(maなど)の行列と座標(x, y)の積を算出する。数学における表現は以下のとおり + *[ma mc me] [x] + *[mb md mf] * [y] + *[0 0 1 ] [1] + */ + var x = _parseInt(ma * ti.x1 + mc * ti.y1 + me, 10); + var y = _parseInt(mb * ti.x1 * md * ti.y1 + mf, 10); x += " "; y += " "; dat += x; @@ -1930,6 +1930,12 @@ dat += x; dat += y; } + var x = _parseInt(ma * ti.x + mc * ti.y + me, 10); //_parseIntはparseIntのエイリアスであり、値を丸めるのに使う + var y = _parseInt(mb * ti.x * md * ti.y + mf, 10); + x += " "; //文字列型に変換しておき、空白で区切りを付ける + y += " "; + dat += x; + dat += y; } } var vi = tar.ownerDocument.documentElement.viewport; @@ -1953,10 +1959,11 @@ }; /*SVGPathSegClosePath*/ SVGPathElement.prototype.createSVGPathSegClosePath = function() { - return (new SVGPathSegClosePath()); + var _SVGPathSegClosePath = SVGPathSegClosePath; + return (new _SVGPathSegClosePath()); }; /*SVGPathSegMovetoAbs*/ SVGPathElement.prototype.createSVGPathSegMovetoAbs = function(/*float*/ x, /*float*/ y ) { - var s = new SVGPathSegMovetoAbs(); + var _SVGPathSegMovetoAbs = SVGPathSegMovetoAbs, s = new _SVGPathSegMovetoAbs(); s.x = x; s.y = y; return s; @@ -1980,7 +1987,7 @@ return s; }; /*SVGPathSegCurvetoCubicAbs*/ SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs = function(/*float*/ x, /*float*/ y, /*float*/ x1, /*float*/ y1, /*float*/ x2, /*float*/ y2 ) { - var s = new SVGPathSegCurvetoCubicAbs(); + var _SVGPathSegCurvetoCubicAbs = SVGPathSegCurvetoCubicAbs, s = new _SVGPathSegCurvetoCubicAbs(); s.x = x; s.y = y; s.x1 = x1; From svnnotify @ sourceforge.jp Thu Mar 18 19:38:39 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 18 Mar 2010 19:38:39 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzM4XSAgRE9NRXhjZXB0?= =?utf-8?b?aW9u44Gu44Oh44OD44K744O844K45paH56ug44KS5YWl5Yqb?= Message-ID: <1268908719.403187.5921.nullmailer@users.sourceforge.jp> Revision: 1738 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1738 Author: dhrname Date: 2010-03-18 19:38:39 +0900 (Thu, 18 Mar 2010) Log Message: ----------- DOMExceptionのメッセージ文章を入力 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-16 11:24:24 UTC (rev 1737) +++ branches/ufltima/core.js 2010-03-18 10:38:39 UTC (rev 1738) @@ -80,6 +80,24 @@ function DOMException(n){ Error.apply(this, arguments); this.code = n; + var s = [ + "Index Size Error (入力値が大きすぎるか、マイナスの値ではありませんか)", + "DOMString Size Error (テキストの指定範囲が文字数を超えていませんか)", + "Hierarchy Request Error (先祖ノードを子ノードとして付け加えることができないようです)", + "Wrong Document Error (ノードがどこのドキュメントノードに属しているかお確かめください)", + "Invalid Character Error (入力された文字列に認識できない記号を使っているか、文字列が空ではないでしょうか)", + "No Data Allowed Error", + "No Modification Allowed Error", + "Not Found Error (お探しになっているノードが見つかりませんでした)", + "Not Supported Error (指定されたノード型とは別の型をご用意ください)", + "Inuse Attribute Error (その属性ノードはすでに他の要素へ属していないでしょうか)", + "Invalid State Error", + "Syntax Error", + "Invalid Modification Error", + "Namespace Error", + "Invalid Access Error" + ]; + this.message = s[n]; return this; /*DOMSTRING_SIZE_ERR テキストの指定された範囲がDOMStringに合致しない。 2 From svnnotify @ sourceforge.jp Thu Mar 18 19:41:19 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 18 Mar 2010 19:41:19 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzM5XSAgRE9NRXhjZXB0?= =?utf-8?b?aW9u44Gu44Oh44OD44K744O844K45paH56ug44KS6L+95Yqg?= Message-ID: <1268908879.384040.9110.nullmailer@users.sourceforge.jp> Revision: 1739 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1739 Author: dhrname Date: 2010-03-18 19:41:19 +0900 (Thu, 18 Mar 2010) Log Message: ----------- DOMExceptionのメッセージ文章を追加 Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-18 10:38:39 UTC (rev 1738) +++ branches/ufltima/dom/events.js 2010-03-18 10:41:19 UTC (rev 1739) @@ -96,9 +96,12 @@ */ function EventException() { DOMException.call(this,arguments); + if (this.code === 0) { + this.message = "Uuspecified Event Type Error (イベントの型を定義されましたか)"; + } return this; }; -/*unsigned short*/ EventException.UNSPECIFIED_EVENT_TYPE_ERR = 0; //イベントの型が定義されていないエラー +/*unsigned short*/ EventException.UNSPECIFIED_EVENT_TYPE_ERR = 0; EventException.prototype = new DOMException(); EventException.constructor = DOMException; From svnnotify @ sourceforge.jp Thu Mar 18 19:42:21 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 18 Mar 2010 19:42:21 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQwXSAxLCAgU1ZHRXhj?= =?utf-8?b?ZXB0aW9u44Gu44Oh44OD44K744O844K45paH56ug44KS5YWl5Yqb?= Message-ID: <1268908941.949000.10648.nullmailer@users.sourceforge.jp> Revision: 1740 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1740 Author: dhrname Date: 2010-03-18 19:42:21 +0900 (Thu, 18 Mar 2010) Log Message: ----------- 1, SVGExceptionのメッセージ文章を入力 2, SVGPathElementのバグを修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-18 10:41:19 UTC (rev 1739) +++ branches/ufltima/dom/svg.js 2010-03-18 10:42:21 UTC (rev 1740) @@ -110,6 +110,13 @@ */ function SVGException(code) { /*unsigned short*/ this.code = code; + if (this.code === SVGException.SVG_WRONG_TYPE_ERR) { + this.message = "SVG Wrong Type Error (SVGの型が一致しないのではないでしょうか)"; + } else if (this.code === SVGException.SVG_INVALID_VALUE_ERR) { + this.message = "SVG Invalid Value Error (SVGに認識できない数値が使われていませんか)"; + } else if (this.code === SVGException.SVG_MATRIX_NOT_INVERTABLE) { + this.message = "SVG Matrix Not Invertable (SVGで指定された逆行列ができるかどうかお確かめください)"; + } return this; }; SVGException.constructor = Error; @@ -1917,21 +1924,21 @@ *[mb md mf] * [y] *[0 0 1 ] [1] */ - var x = _parseInt(ma * ti.x1 + mc * ti.y1 + me, 10); - var y = _parseInt(mb * ti.x1 * md * ti.y1 + mf, 10); + var x = _parseInt(ma*ti.x1 + mc*ti.y1 + me, 10); + var y = _parseInt(mb*ti.x1 + md*ti.y1 + mf, 10); x += " "; y += " "; dat += x; dat += y; - x = _parseInt(ma * ti.x2 + mc * ti.y2 + me, 10); - y = _parseInt(mb * ti.x2 * md * ti.y2 + mf, 10); + x = _parseInt(ma*ti.x2 + mc*ti.y2 + me, 10); + y = _parseInt(mb*ti.x2 + md*ti.y2 + mf, 10); x += " "; y += " "; dat += x; dat += y; } - var x = _parseInt(ma * ti.x + mc * ti.y + me, 10); //_parseIntはparseIntのエイリアスであり、値を丸めるのに使う - var y = _parseInt(mb * ti.x * md * ti.y + mf, 10); + var x = _parseInt(ma*ti.x + mc*ti.y + me, 10); //_parseIntはparseIntのエイリアスであり、値を丸めるのに使う + var y = _parseInt(mb*ti.x + md*ti.y + mf, 10); x += " "; //文字列型に変換しておき、空白で区切りを付ける y += " "; dat += x; From svnnotify @ sourceforge.jp Thu Mar 18 23:36:40 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 18 Mar 2010 23:36:40 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQxXSAxLCAgZ2V0Q1RN?= =?utf-8?b?44Oh44K944OD44OJ44Gr44Gv44Kt44Oj44OD44K344Ol44KS55So44GE44Gm?= =?utf-8?b?44CB6auY6YCf5YyW44GX44Gf?= Message-ID: <1268923000.706903.4629.nullmailer@users.sourceforge.jp> Revision: 1741 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1741 Author: dhrname Date: 2010-03-18 23:36:40 +0900 (Thu, 18 Mar 2010) Log Message: ----------- 1, getCTMメソッドにはキャッシュを用いて、高速化した 2, xml:base属性への対応 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-18 10:42:21 UTC (rev 1740) +++ branches/ufltima/dom/svg.js 2010-03-18 14:36:40 UTC (rev 1741) @@ -220,6 +220,8 @@ } else if (name.indexOf("on") === 0) { //event属性ならば var s = eval("(function(){" +evt.newValue+ "})"); tar.addEventListener(name.substring(2, name.length), s, false); + } else if (evt.relatedNode.nodeName === "xml:base") { //xml:base属性ならば + tar.xmlbase = evt.newValue; } else { if (!!tar[name]) { var tea = tar[name]; @@ -256,10 +258,13 @@ } } } - var evtt = tar.ownerDocument.createEvent("MutationEvents"); - evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); - tar.dispatchEvent(evtt); //描画を開始するために、dispatchEventメソッドを使う - evtt = name = tar = null; + if (tar.parentNode) { + var evtt = tar.ownerDocument.createEvent("MutationEvents"); + evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); + tar.dispatchEvent(evtt); //描画を開始するために、dispatchEventメソッドを使う + evtt = null; + } + name = tar = null; }, false); return this; }; @@ -284,18 +289,23 @@ */ /*SVGMatrix*/ SVGElement.prototype.getCTM = function() { var s; - var m = this.transform.baseVal.consolidate(); - if (m) { - m = m.matrix; + if (!!this._cacheMatrix) { //キャッシュがあれば + s = this._cacheMatrix; } else { - m = this.ownerDocument.documentElement.createSVGMatrix(); + var m = this.transform.baseVal.consolidate(); + if (m) { + m = m.matrix; + } else { + m = this.ownerDocument.documentElement.createSVGMatrix(); + } + if (this.parentNode) { + s = this.parentNode.getCTM().multiply(m); + } else { + s = m; + } + m = null; + this._cacheMatrix = s; //キャッシュをためて次回で使う } - if (this.parentNode) { - s = this.parentNode.getCTM().multiply(m); - } else { - s = m; - } - m = null; return s; }; From svnnotify @ sourceforge.jp Sat Mar 20 20:44:25 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 20 Mar 2010 20:44:25 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQyXSAgSUU444Gu5qiZ?= =?utf-8?b?5rqW44Oi44O844OJ44Gn44KC6KGo56S644Gn44GN44KL44KI44GG44Gr5pS5?= =?utf-8?b?6Imv?= Message-ID: <1269085465.413508.28451.nullmailer@users.sourceforge.jp> Revision: 1742 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1742 Author: dhrname Date: 2010-03-20 20:44:25 +0900 (Sat, 20 Mar 2010) Log Message: ----------- IE8の標準モードでも表示できるように改良 ルートに当たるv:group要素に、position:absoluteを追加したことで改良 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-18 14:36:40 UTC (rev 1741) +++ branches/ufltima/dom/svg.js 2010-03-20 11:44:25 UTC (rev 1742) @@ -781,7 +781,13 @@ /*DOMString*/ this.contentScriptType = "application/ecmascript"; //古い仕様では、text/ecmascript /*DOMString*/ this.contentStyleType = "text/css"; /*readonly SVGRect*/ this.viewport = this.createSVGRect(); - /*boolean*/ this.useCurrentView = false; //ズームなど加工がされていれば、true + /*useCurrentViewプロパティ + * view要素やハイパーリンクなどで呼び出された場合、true。それ以外の通常表示はfalse。 + */ + /*boolean*/ this.useCurrentView = false; + /*currentViewプロパティ + * ズームやパンがされていない初期表示のviewBoxプロパティなどを示す。通常はDOM属性と連動 + */ /*readonly SVGViewSpec*/ this.currentView = new SVGViewSpec(this); /*もし、画像をズームやパンしたとき、どのような倍率になるかを *以下のプロパティを使って次の行列で示すことができる @@ -789,7 +795,9 @@ */ /*float*/ this.currentScale = 1; /*readonly SVGPoint*/ this.currentTranslate = this.createSVGPoint(); - //SVGFitToViewBoxのインターフェースを用いる + /*以下は、SVGFitToViewBoxのインターフェースを用いる + *もし、ズームやパンがあれば、真っ先にこれらのプロパティを別のオブジェクトに変更すること + */ /*readonly SVGAnimatedRect*/ this.viewBox = this.currentView.viewBox; /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = this.currentView.preserveAspectRatio; /*unsigned short*/ this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE; @@ -807,6 +815,7 @@ tv.y = parseFloat(ovb[1]); tv.width = parseFloat(ovb[2]); tv.height = parseFloat(ovb[3]); + tar.viewBox.baseVal._isUsed = 1; } else if (name === "preserveAspectRatio") { var par = evt.newValue, tp = tar.preserveAspectRatio.baseVal; var sa = 1, mos = SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN; @@ -897,8 +906,12 @@ */ /*SVGMatrix*/ SVGSVGElement.prototype.getScreenCTM = function(){ var vw = this.viewport.width, vh = this.viewport.height; - var vB = this.currentView.viewBox.baseVal, par = this.currentView.preserveAspectRatio.baseVal; - if (!vB) { + if (!this.useCurrentView) { + var vB = this.viewBox.baseVal, par = this.preserveAspectRatio.baseVal; + } else { + var vB = this.currentView.viewBox.baseVal, par = this.currentView.preserveAspectRatio.baseVal; + } + if (!!!vB._isUsed) { //viewBox属性が指定されていなければ this._tx = this._ty = 0; return this.createSVGMatrix(); } else { @@ -1016,9 +1029,7 @@ function SVGTitleElement() { SVGElement.apply(this, arguments); - try { - this.ownerDocument.title = this.firstChild.nodeValue; - } catch(e){} + this.ownerDocument.title = this.firstChild.nodeValue; return this; } SVGTitleElement.constructor = SVGElement; @@ -1130,6 +1141,7 @@ xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { /*SVGDocument*/ objei.getSVGDocument = function(){ + var dew = new Date(); /*responseXMLを使うと、時々、空のデータを返すことがあるため(原因は不明)、 *ここでは、responseTextを用いる */ @@ -1140,8 +1152,17 @@ var tar = s.documentElement; var sdt = tar._tar; document.body.insertBefore(sdt, document.body.lastChild); + alert((new Date()).getTime() - dew.getTime()); + tar.viewport.top = 0; + tar.viewport.left = 0; tar.viewport.width = 1000; tar.viewport.height = 1000; + var fi = doc.documentElement.firstChild, sdoce = s.documentElement, n; + while (fi) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する + n = s.importNode(fi, true); + sdoce.appendChild(n); + fi = fi.nextSibling; + } /*以下では、VMLの要素とHTMLのCSSのプロパティを用いて、背景を *作り出す作業を行う。これは必須 */ @@ -1157,6 +1178,7 @@ var trstyle = tar._tar.style; var tpstyle = objei.style; trstyle.visibility = "visible"; + trstyle.position = "absolute"; //以下、画像を切り取り trstyle.overflow = "hidden"; var backrs = backr.currentStyle; @@ -1174,15 +1196,9 @@ var backright = bl + viewWidth + 1; var backdown = bt + viewHeight + 1; trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; - var fi = doc.documentElement.firstChild, sdoce = s.documentElement, n; - while (fi) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する - n = s.importNode(fi, true); - sdoce.appendChild(n); - fi = fi.nextSibling; - } return s; }; - alert(objei.getSVGDocument()); + objei.getSVGDocument(); } }; xmlhttp.send(null); From svnnotify @ sourceforge.jp Sat Mar 20 20:45:26 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 20 Mar 2010 20:45:26 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQzXQ==?= Message-ID: <1269085526.093518.29813.nullmailer@users.sourceforge.jp> Revision: 1743 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1743 Author: dhrname Date: 2010-03-20 20:45:26 +0900 (Sat, 20 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-20 11:44:25 UTC (rev 1742) +++ branches/ufltima/dom/svg.js 2010-03-20 11:45:26 UTC (rev 1743) @@ -1152,7 +1152,6 @@ var tar = s.documentElement; var sdt = tar._tar; document.body.insertBefore(sdt, document.body.lastChild); - alert((new Date()).getTime() - dew.getTime()); tar.viewport.top = 0; tar.viewport.left = 0; tar.viewport.width = 1000; @@ -1196,6 +1195,7 @@ var backright = bl + viewWidth + 1; var backdown = bt + viewHeight + 1; trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; + alert((new Date()).getTime() - dew.getTime()); return s; }; objei.getSVGDocument(); From svnnotify @ sourceforge.jp Sun Mar 21 23:12:50 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 21 Mar 2010 23:12:50 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQ0XQ==?= Message-ID: <1269180770.193513.15226.nullmailer@users.sourceforge.jp> Revision: 1744 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1744 Author: dhrname Date: 2010-03-21 23:12:50 +0900 (Sun, 21 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-20 11:45:26 UTC (rev 1743) +++ branches/ufltima/dom/svg.js 2010-03-21 14:12:50 UTC (rev 1744) @@ -530,9 +530,9 @@ }); } var s = rgbColor.match(/\d+/g); - this.rgbColor.r.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[0])); - this.rgbColor.g.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[1])); - this.rgbColor.b.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[2])); + this.rgbColor.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[0])); + this.rgbColor.green.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[1])); + this.rgbColor.blue.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[2])); }; // raises( SVGException ); @@ -1975,6 +1975,81 @@ var w = vi.width, h = vi.hight; tar._tar.path = dat + " e"; tar._tar.coordsize = w + " " + h; + var style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""); + var _urlreg = /url\(#([^)]+)/, isNone = { + none: 1 + }; + var el = tar._tar, fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke"); + if (isNone[fill.cssText]) { + el.filled = "false"; + } else { + var fillElement = document.createElement("v:fill"); + var isRadial = false; + try { + if (_urlreg.test(fill.cssText)) { //fill属性の値がurl(#id)ならば、idを設定したグラデーション関連要素を呼び出す + } else { + fill.setColor(SVGColor.SVG_COLORTYPE_RGBCOLOR, fill.cssText, null); + var fc = fill.rgbColor; + fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")"); + var fillOpacity = parseFloat(style.getProperty("fill-opacity")) * parseFloat(style.getProperty("opacity")); //opacityを掛け合わせる + if (fillOpacity < 1) { + fillElement.setAttribute("opacity", fillOpacity+""); + } + } + } catch(e) {stlog.add(e,682); fillElement.on = "true"; + fillElement.color = "black";} + if (!isRadial) { + el.appendChild(fillElement); + } + isRadial = fillOpacity = null; + } + if (isNone[stroke]) { + el.stroked = "false"; + } else { + var strokeElement = document.createElement("v:stroke"); + var sw = tar.ownerDocument.documentElement.createSVGLength(parseFloat(style.getProperty("stroke-width")));//, Math.sqrt((w*w + h*h) / 2)); + var swx = sw.value * Math.sqrt(Math.abs(matrix.determinant())); + strokeElement.setAttribute("weight", swx + "px"); + if (!_urlreg.test(stroke.cssText)) { + strokeElement.setAttribute("color", style.color(style.stroke)); + var strokeOpacity = style.strokeopacity * style.opacity; //opacityを掛け合わせる + if (swx < 1) { + strokeOpacity *= swx; //太さが1px未満なら色を薄くする + } + if (strokeOpacity < 1) { + strokeElement.setAttribute("opacity", strokeOpacity); + } + strokeOpacity = null; + } + strokeElement.setAttribute("miterlimit", style.strokemiterlimit); + strokeElement.setAttribute("joinstyle", style.strokelinejoin); + if (style.strokelinecap === "butt") { + strokeElement.setAttribute("endcap", "flat"); + } else { + strokeElement.setAttribute("endcap", style.strokelinecap); + } + var tsd = style.getPropertyValue("stroke-dasharray"); + if (!isNone[tsd]) { + if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合 + var strs = tsd.split(","); + for (var i = 0, sli = strs.length; i < sli; ++i) { + strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(style.strokewidth)); //精密ではないので注意 + } + style.strokedasharray = strs.join(" "); + if (strs.length % 2 === 1) { + style.strokedasharray += " " + style.strokedasharray; + } + } + strokeElement.setAttribute("dashstyle", style.strokedasharray); + tsd = strs = null; + } + el.appendChild(strokeElement); + sw = tsd = null; + } + if (style.cursor !== "default") { + el.style.cursor = style.cursor; + } + w = h = null; matrix = dat = x = y = null; }, false); }, false); From svnnotify @ sourceforge.jp Mon Mar 22 20:09:39 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 22 Mar 2010 20:09:39 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQ1XQ==?= Message-ID: <1269256179.868854.27754.nullmailer@users.sourceforge.jp> Revision: 1745 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1745 Author: dhrname Date: 2010-03-22 20:09:39 +0900 (Mon, 22 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-21 14:12:50 UTC (rev 1744) +++ branches/ufltima/dom/svg.js 2010-03-22 11:09:39 UTC (rev 1745) @@ -516,7 +516,7 @@ /*void*/ SVGColor.prototype.setRGBColor = function(/*DOMString*/ rgbColor ){ this.cssText = rgbColor; - var tkr = this.keywords[rgbColor]; + var tkr = this._keywords[rgbColor]; if (tkr !== void 0) { rgbColor = tkr; } From svnnotify @ sourceforge.jp Mon Mar 22 20:26:28 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 22 Mar 2010 20:26:28 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQ2XQ==?= Message-ID: <1269257188.695476.18353.nullmailer@users.sourceforge.jp> Revision: 1746 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1746 Author: dhrname Date: 2010-03-22 20:26:28 +0900 (Mon, 22 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-22 11:09:39 UTC (rev 1745) +++ branches/ufltima/dom/svg.js 2010-03-22 11:26:28 UTC (rev 1746) @@ -2472,6 +2472,7 @@ SVGColor.apply(this, arguments); /*readonly unsigned short*/ this.paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN; /*readonly DOMString*/ this.uri = null; + return this; }; SVGPaint.constructor = SVGColor; SVGPaint.prototype = new SVGColor(); From svnnotify @ sourceforge.jp Mon Mar 22 20:27:03 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 22 Mar 2010 20:27:03 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQ3XSAgQ1NTUHJpbWl0?= =?utf-8?b?aXZlVmFsdWXjgqrjg5bjgrjjgqfjgq/jg4jjga7jg6Hjgr3jg4Pjg4njgao=?= =?utf-8?b?44Gp44KS5L+u5q2j?= Message-ID: <1269257223.330200.18579.nullmailer@users.sourceforge.jp> Revision: 1747 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1747 Author: dhrname Date: 2010-03-22 20:27:03 +0900 (Mon, 22 Mar 2010) Log Message: ----------- CSSPrimitiveValueオブジェクトのメソッドなどを修正 Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-22 11:26:28 UTC (rev 1746) +++ branches/ufltima/dom/css.js 2010-03-22 11:27:03 UTC (rev 1747) @@ -287,6 +287,7 @@ CSSValue.call(this, arguments); this.cssValueType = CSSValue.CSS_PRIMITIVE_VALUE; this.primitiveType = CSSPrimitiveValue.CSS_UNKNOWN; + this._value = 1; this._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) return this; }; @@ -324,7 +325,7 @@ throw new DOMException(DOMException.INVALID_ACCESS_ERR); } this.primitiveType = unitType; - this.value = floatValue * this._n[unitType-1]; //値はあらかじめ、利用しやすいように変換しておく + this._value = floatValue * this._n[unitType-1]; //値はあらかじめ、利用しやすいように変換しておく }; /*getFloatValueメソッド *別の単位に変換可能。 @@ -333,37 +334,57 @@ if (CSSPrimitiveValue.CSS_UNKNOWN >= unitType && unitType >= CSSPrimitiveValue.CSS_STRING) { //浮動小数点数単位型をサポートしないCSS単位である場合 throw new DOMException(DOMException.INVALID_ACCESS_ERR); } - return (this.value / this._n[unitType-1]); + return (this._value / this._n[unitType-1]); }; /*void*/ CSSPrimitiveValue.prototype.setStringValue = function(/*short*/ stringType, /*string*/ stringValue) { if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合 throw new DOMException(DOMException.INVALID_ACCESS_ERR); } - this.value = stringValue; + this.cssText = stringValue; }; /*string*/ CSSPrimitiveValue.prototype.getStringValue = function() { if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合 throw new DOMException(DOMException.INVALID_ACCESS_ERR); } - return (this.value); + return (this.cssText); }; /*Counter*/ CSSPrimitiveValue.prototype.getCounterValue = function() { if (this.primitiveType !== CSSPrimitiveValue.CSS_COUNTER) { //Counter型ではないとき throw new DOMException(DOMException.INVALID_ACCESS_ERR); } - return (this.value); + return (new Counter()); }; /*Rect*/ CSSPrimitiveValue.prototype.getRectValue = function() { if (this.primitiveType !== CSSPrimitiveValue.CSS_RECT) { //Rect型ではないとき throw new DOMException(DOMException.INVALID_ACCESS_ERR); } - return (this.value); + return (new Rect()); }; /*RGBColor*/ CSSPrimitiveValue.prototype.getRGBColorValue = function() { if (this.primitiveType !== CSSPrimitiveValue.CSS_RGBCOLOR) { //RGBColor型ではないとき throw new DOMException(DOMException.INVALID_ACCESS_ERR); } - return (this.value); + var s = new RGBColor(); + var rgbColor = this.cssText; + var tkr = SVGColor.prototype._keywords[rgbColor]; + if (tkr !== void 0) { + rgbColor = tkr; + } + if (rgbColor.indexOf("%", 5) > 0) { // %を含むrgb形式の場合 + rgbColor = rgbColor.replace(/[\d.]+%/g, function(t) { + return Math.round((2.55 * parseFloat(t))); + }); + } else if (rgbColor.indexOf("#") > 0) { //#を含む場合 + rgbColor = rgbColor.replace(/[\dA-F][\dA-F]/g, function(t) { + return parseInt(t, 16); + }); + } + var n = rgbColor.match(/\d+/g); + s.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[0])); + s.green.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[1])); + s.blue.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[2])); + n = rgbColor = null; + return (s); }; /*CSSValueList From svnnotify @ sourceforge.jp Mon Mar 22 23:26:08 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 22 Mar 2010 23:26:08 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQ4XSAgZ2V0UHJvcGVy?= =?utf-8?b?dHlWYWx1ZeODoeOCveODg+ODieOCkuS/ruatow==?= Message-ID: <1269267968.439644.27202.nullmailer@users.sourceforge.jp> Revision: 1748 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1748 Author: dhrname Date: 2010-03-22 23:26:08 +0900 (Mon, 22 Mar 2010) Log Message: ----------- getPropertyValueメソッドを修正 Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-22 11:27:03 UTC (rev 1747) +++ branches/ufltima/dom/css.js 2010-03-22 14:26:08 UTC (rev 1748) @@ -209,8 +209,28 @@ /*CSSValue*/ getPropertyCSSValue : function( /*string*/ propertyName) { propertyName += ":"; for (var i=0,tli=this._list.length;i -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 + var ti = this._list[i], tc = ti.cssText; + if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 + if (propertyName === "fill" || propertyName === "stroke") { //fill、strokeプロパティは別途、SVGPaintで処理 + ti = new SVGPaint(); + var _urlreg = /url\(#([^)]+)/; + var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null; + if (tc.indexOf("none") > -1) { + paintType = SVGPaint.SVG_PAINTTYPE_NONE; + } else if (tc.indexOf("currentColor") > -1) { + paintType = SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR; + color = style.getPropertyValue("color"); + } else { + if (_urlreg.test(tc)) { //fill属性の値がurl(#id)ならば + paintType = SVGPaint.SVG_PAINTTYPE_URI; + uri = RegExp.$1; + } else { + paintType = SVGPaint.SVG_PAINTTYPE_RGBCOLOR; + color = tc.substring(tc.indexOf(":")+1, tc.length); + } + } + ti.setPaint(paintType, uri, color, null); + } return ti; } } @@ -670,7 +690,7 @@ s._list = s._list.concat(elt.ownerDocument.getOverrideStyle(elt)._list); //まず、上書きスタイルシートから処理 s._list = s._list.concat(elt.style._list); s._list = s._list.concat(elt._attributeStyle._list); //プレゼンテーション属性を結びつける - elt = elt.parentNode; + elt = elt.parentNode; } while (elt); s._list = s._list.concat(CSS2Properties._list); //デフォルト値の設定 return s; From svnnotify @ sourceforge.jp Mon Mar 22 23:26:16 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Mon, 22 Mar 2010 23:26:16 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzQ5XQ==?= Message-ID: <1269267976.714100.27284.nullmailer@users.sourceforge.jp> Revision: 1749 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1749 Author: dhrname Date: 2010-03-22 23:26:16 +0900 (Mon, 22 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-22 14:26:08 UTC (rev 1748) +++ branches/ufltima/dom/svg.js 2010-03-22 14:26:16 UTC (rev 1749) @@ -1975,44 +1975,34 @@ var w = vi.width, h = vi.hight; tar._tar.path = dat + " e"; tar._tar.coordsize = w + " " + h; + /*以下では、スタイルシートを用いて、fill-とstroke-関連の + *処理を行う。SVGPaintインターフェースをも用いる + */ var style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""); - var _urlreg = /url\(#([^)]+)/, isNone = { - none: 1 - }; var el = tar._tar, fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke"); - if (isNone[fill.cssText]) { - el.filled = "false"; - } else { + if (fill.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { var fillElement = document.createElement("v:fill"); var isRadial = false; - try { - if (_urlreg.test(fill.cssText)) { //fill属性の値がurl(#id)ならば、idを設定したグラデーション関連要素を呼び出す - } else { - fill.setColor(SVGColor.SVG_COLORTYPE_RGBCOLOR, fill.cssText, null); - var fc = fill.rgbColor; - fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")"); - var fillOpacity = parseFloat(style.getProperty("fill-opacity")) * parseFloat(style.getProperty("opacity")); //opacityを掛け合わせる - if (fillOpacity < 1) { - fillElement.setAttribute("opacity", fillOpacity+""); - } + var fc = fill.rgbColor; + fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")"); + var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる + if (fillOpacity < 1) { + fillElement.setAttribute("opacity", fillOpacity+""); } - } catch(e) {stlog.add(e,682); fillElement.on = "true"; - fillElement.color = "black";} if (!isRadial) { el.appendChild(fillElement); } isRadial = fillOpacity = null; } - if (isNone[stroke]) { - el.stroked = "false"; - } else { + if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { var strokeElement = document.createElement("v:stroke"); var sw = tar.ownerDocument.documentElement.createSVGLength(parseFloat(style.getProperty("stroke-width")));//, Math.sqrt((w*w + h*h) / 2)); - var swx = sw.value * Math.sqrt(Math.abs(matrix.determinant())); + var swx = sw.value * Math.sqrt(Math.abs(matrix._determinant())); strokeElement.setAttribute("weight", swx + "px"); - if (!_urlreg.test(stroke.cssText)) { - strokeElement.setAttribute("color", style.color(style.stroke)); - var strokeOpacity = style.strokeopacity * style.opacity; //opacityを掛け合わせる + if (!stroke.uri) { + var fc = stroke.rgbColor; + strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")"); + var strokeOpacity = parseFloat(style.getPropertyValue("stroke-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる if (swx < 1) { strokeOpacity *= swx; //太さが1px未満なら色を薄くする } @@ -2021,36 +2011,36 @@ } strokeOpacity = null; } - strokeElement.setAttribute("miterlimit", style.strokemiterlimit); - strokeElement.setAttribute("joinstyle", style.strokelinejoin); - if (style.strokelinecap === "butt") { + strokeElement.setAttribute("miterlimit", style.getPropertyValue("stroke-miterlimit")); + strokeElement.setAttribute("joinstyle", style.getPropertyValue("stroke-linejoin")); + if (style.getPropertyValue("stroke-linecap") === "butt") { strokeElement.setAttribute("endcap", "flat"); } else { - strokeElement.setAttribute("endcap", style.strokelinecap); + strokeElement.setAttribute("endcap", style.getPropertyValue("stroke-linecap")); } var tsd = style.getPropertyValue("stroke-dasharray"); if (!isNone[tsd]) { if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合 var strs = tsd.split(","); for (var i = 0, sli = strs.length; i < sli; ++i) { - strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(style.strokewidth)); //精密ではないので注意 + strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(style.getPropertyValue("stroke-width"))); //精密ではないので注意 } - style.strokedasharray = strs.join(" "); + var strokedasharray = strs.join(" "); if (strs.length % 2 === 1) { - style.strokedasharray += " " + style.strokedasharray; + strokedasharray += " " + strokedasharray; } } - strokeElement.setAttribute("dashstyle", style.strokedasharray); + strokeElement.setAttribute("dashstyle", strokedasharray); tsd = strs = null; } el.appendChild(strokeElement); sw = tsd = null; } - if (style.cursor !== "default") { - el.style.cursor = style.cursor; + var cursor = style.getPropertyValue("cursor"); + if (cursor !== "default") { + el.style.cursor = cursor; } - w = h = null; - matrix = dat = x = y = null; + cursor = w = h = matrix = dat = x = y = null; }, false); }, false); return this; From svnnotify @ sourceforge.jp Wed Mar 24 23:10:26 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 24 Mar 2010 23:10:26 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzUwXQ==?= Message-ID: <1269439826.521363.2907.nullmailer@users.sourceforge.jp> Revision: 1750 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1750 Author: dhrname Date: 2010-03-24 23:10:26 +0900 (Wed, 24 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-22 14:26:16 UTC (rev 1749) +++ branches/ufltima/dom/css.js 2010-03-24 14:10:26 UTC (rev 1750) @@ -185,6 +185,7 @@ */ function CSSStyleDeclaration() { this.cssText = ""; + this.cssText._rewrite = 1; /*long*/ this.length = 0; /*CSSRule*/ this.parentRule = null; this._list = []; //内部のリスト @@ -197,8 +198,8 @@ /*string*/ getPropertyValue : function( /*string*/ propertyName) { var tg = this.getPropertyCSSValue(propertyName); if (tg) { //見つかった場合 - var pn = new RegExp(propertyName+":\s*"); - return (tg.cssText.replace(pn, "")); + var tc = tg.cssText; + return (tc.substring(tc.indexOf(":")+1, tc.length)); } else { return ""; } @@ -210,16 +211,17 @@ propertyName += ":"; for (var i=0,tli=this._list.length;i -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 - if (propertyName === "fill" || propertyName === "stroke") { //fill、strokeプロパティは別途、SVGPaintで処理 + if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 + if (propertyName === "fill:" || propertyName === "stroke:") { //fill、strokeプロパティは別途、SVGPaintで処理 ti = new SVGPaint(); + ti.cssText = tc; var _urlreg = /url\(#([^)]+)/; var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null; if (tc.indexOf("none") > -1) { paintType = SVGPaint.SVG_PAINTTYPE_NONE; } else if (tc.indexOf("currentColor") > -1) { paintType = SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR; - color = style.getPropertyValue("color"); + color = this.getPropertyValue("color"); } else { if (_urlreg.test(tc)) { //fill属性の値がurl(#id)ならば paintType = SVGPaint.SVG_PAINTTYPE_URI; @@ -687,7 +689,6 @@ var s = new CSSStyleDeclaration(); do { //リストを連結することによって、カスケーディングを実現する - s._list = s._list.concat(elt.ownerDocument.getOverrideStyle(elt)._list); //まず、上書きスタイルシートから処理 s._list = s._list.concat(elt.style._list); s._list = s._list.concat(elt._attributeStyle._list); //プレゼンテーション属性を結びつける elt = elt.parentNode; From svnnotify @ sourceforge.jp Wed Mar 24 23:10:59 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 24 Mar 2010 23:10:59 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzUxXQ==?= Message-ID: <1269439859.636211.3196.nullmailer@users.sourceforge.jp> Revision: 1751 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1751 Author: dhrname Date: 2010-03-24 23:10:59 +0900 (Wed, 24 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-24 14:10:26 UTC (rev 1750) +++ branches/ufltima/dom/svg.js 2010-03-24 14:10:59 UTC (rev 1751) @@ -156,7 +156,7 @@ } style.cssText._rewrite = 1; } - }, false) + }, true) this.addEventListener("DOMAttrModified", function(evt){ if (evt.eventPhase === Event.BUBBLING_PHASE) { return; @@ -515,7 +515,6 @@ SVGColor.constructor = CSSValue; /*void*/ SVGColor.prototype.setRGBColor = function(/*DOMString*/ rgbColor ){ - this.cssText = rgbColor; var tkr = this._keywords[rgbColor]; if (tkr !== void 0) { rgbColor = tkr; @@ -533,7 +532,7 @@ this.rgbColor.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[0])); this.rgbColor.green.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[1])); this.rgbColor.blue.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[2])); -}; + }; // raises( SVGException ); /*void*/ SVGColor.prototype.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){ @@ -545,137 +544,153 @@ // raises( SVGException ); //色キーワード SVGColor.prototype._keywords = { - aliceblue: "#F0F8FF", - antiquewhite: "#FAEBD7", - aquamarine: "#7FFFD4", - azure: "#F0FFFF", - beige: "#F5F5DC", - bisque: "#FFE4C4", - blanchedalmond: "#FFEBCD", - blueviolet: "#8A2BE2", - brown: "#A52A2A", - burlywood: "#DEB887", - cadetblue: "#5F9EA0", - chartreuse: "#7FFF00", - chocolate: "#D2691E", - coral: "#FF7F50", - cornflowerblue: "#6495ED", - cornsilk: "#FFF8DC", - crimson: "#DC143C", - cyan: "#00FFFF", - darkblue: "#00008B", - darkcyan: "#008B8B", - darkgoldenrod: "#B8860B", - darkgray: "#A9A9A9", - darkgreen: "#006400", - darkgrey: "#A9A9A9", - darkkhaki: "#BDB76B", - darkmagenta: "#8B008B", - darkolivegreen: "#556B2F", - darkorange: "#FF8C00", - darkorchid: "#9932CC", - darkred: "#8B0000", - darksalmon: "#E9967A", - darkseagreen: "#8FBC8F", - darkslateblue: "#483D8B", - darkslategray: "#2F4F4F", - darkslategrey: "#2F4F4F", - darkturquoise: "#00CED1", - darkviolet: "#9400D3", - deeppink: "#FF1493", - deepskyblue: "#00BFFF", - dimgray: "#696969", - dimgrey: "#696969", - dodgerblue: "#1E90FF", - firebrick: "#B22222", - floralwhite: "#FFFAF0", - forestgreen: "#228B22", - gainsboro: "#DCDCDC", - ghostwhite: "#F8F8FF", - gold: "#FFD700", - goldenrod: "#DAA520", - grey: "#808080", - greenyellow: "#ADFF2F", - honeydew: "#F0FFF0", - hotpink: "#FF69B4", - indianred: "#CD5C5C", - indigo: "#4B0082", - ivory: "#FFFFF0", - khaki: "#F0E68C", - lavender: "#E6E6FA", - lavenderblush: "#FFF0F5", - lawngreen: "#7CFC00", - lemonchiffon: "#FFFACD", - lightblue: "#ADD8E6", - lightcoral: "#F08080", - lightcyan: "#E0FFFF", - lightgoldenrodyellow: "#FAFAD2", - lightgray: "#D3D3D3", - lightgreen: "#90EE90", - lightgrey: "#D3D3D3", - lightpink: "#FFB6C1", - lightsalmon: "#FFA07A", - lightseagreen: "#20B2AA", - lightskyblue: "#87CEFA", - lightslategray: "#778899", - lightslategrey: "#778899", - lightsteelblue: "#B0C4DE", - lightyellow: "#FFFFE0", - limegreen: "#32CD32", - linen: "#FAF0E6", - magenta: "#FF00FF", - mediumaquamarine: "#66CDAA", - mediumblue: "#0000CD", - mediumorchid: "#BA55D3", - mediumpurple: "#9370DB", - mediumseagreen: "#3CB371", - mediumslateblue: "#7B68EE", - mediumspringgreen: "#00FA9A", - mediumturquoise: "#48D1CC", - mediumvioletred: "#C71585", - midnightblue: "#191970", - mintcream: "#F5FFFA", - mistyrose: "#FFE4E1", - moccasin: "#FFE4B5", - navajowhite: "#FFDEAD", - oldlace: "#FDF5E6", - olivedrab: "#6B8E23", - orange: "#FFA500", - orangered: "#FF4500", - orchid: "#DA70D6", - palegoldenrod: "#EEE8AA", - palegreen: "#98FB98", - paleturquoise: "#AFEEEE", - palevioletred: "#DB7093", - papayawhip: "#FFEFD5", - peachpuff: "#FFDAB9", - peru: "#CD853F", - pink: "#FFC0CB", - plum: "#DDA0DD", - powderblue: "#B0E0E6", - rosybrown: "#BC8F8F", - royalblue: "#4169E1", - saddlebrown: "#8B4513", - salmon: "#FA8072", - sandybrown: "#F4A460", - seagreen: "#2E8B57", - seashell: "#FFF5EE", - sienna: "#A0522D", - skyblue: "#87CEEB", - slateblue: "#6A5ACD", - slategray: "#708090", - slategrey: "#708090", - snow: "#FFFAFA", - springgreen: "#00FF7F", - steelblue: "#4682B4", - tan: "#D2B48C", - thistle: "#D8BFD8", - tomato: "#FF6347", - turquoise: "#40E0D0", - violet: "#EE82EE", - wheat: "#F5DEB3", - whitesmoke: "#F5F5F5", - yellowgreen: "#9ACD32" + aliceblue: "rgb(240, 248, 255)", + antiquewhite: "rgb(250, 235, 215)", + aqua: "rgb( 0, 255, 255)", + aquamarine: "rgb(127, 255, 212)", + azure: "rgb(240, 255, 255)", + beige: "rgb(245, 245, 220)", + bisque: "rgb(255, 228, 196)", + black: "rgb( 0, 0, 0)", + blanchedalmond:"rgb(255, 235, 205)", + blue: "rgb( 0, 0, 255)", + blueviolet: "rgb(138, 43, 226)", + brown: "rgb(165, 42, 42)", + burlywood: "rgb(222, 184, 135)", + cadetblue: "rgb( 95, 158, 160)", + chartreuse: "rgb(127, 255, 0)", + chocolate: "rgb(210, 105, 30)", + coral: "rgb(255, 127, 80)", + cornflowerblue:"rgb(100, 149, 237)", + cornsilk: "rgb(255, 248, 220)", + crimson: "rgb(220, 20, 60)", + cyan: "rgb( 0, 255, 255)", + darkblue: "rgb( 0, 0, 139)", + darkcyan: "rgb( 0, 139, 139)", + darkgoldenrod:"rgb(184, 134, 11)", + darkgray: "rgb(169, 169, 169)", + darkgreen: "rgb( 0, 100, 0)", + darkgrey: "rgb(169, 169, 169)", + darkkhaki: "rgb(189, 183, 107)", + darkmagenta: "rgb(139, 0, 139)", + darkolivegreen:"rgb( 85, 107, 47)", + darkorange: "rgb(255, 140, 0)", + darkorchid: "rgb(153, 50, 204)", + darkred: "rgb(139, 0, 0)", + darksalmon: "rgb(233, 150, 122)", + darkseagreen: "rgb(143, 188, 143)", + darkslateblue:"rgb( 72, 61, 139)", + darkslategray:"rgb( 47, 79, 79)", + darkslategrey:"rgb( 47, 79, 79)", + darkturquoise:"rgb( 0, 206, 209)", + darkviolet: "rgb(148, 0, 211)", + deeppink: "rgb(255, 20, 147)", + deepskyblue: "rgb( 0, 191, 255)", + dimgray: "rgb(105, 105, 105)", + dimgrey: "rgb(105, 105, 105)", + dodgerblue: "rgb( 30, 144, 255)", + firebrick: "rgb(178, 34, 34)", + floralwhite: "rgb(255, 250, 240)", + forestgreen: "rgb( 34, 139, 34)", + fuchsia: "rgb(255, 0, 255)", + gainsboro: "rgb(220, 220, 220)", + ghostwhite: "rgb(248, 248, 255)", + gold: "rgb(255, 215, 0)", + goldenrod: "rgb(218, 165, 32)", + gray: "rgb(128, 128, 128)", + grey: "rgb(128, 128, 128)", + green: "rgb( 0, 128, 0)", + greenyellow: "rgb(173, 255, 47)", + honeydew: "rgb(240, 255, 240)", + hotpink: "rgb(255, 105, 180)", + indianred: "rgb(205, 92, 92)", + indigo: "rgb( 75, 0, 130)", + ivory: "rgb(255, 255, 240)", + khaki: "rgb(240, 230, 140)", + lavender: "rgb(230, 230, 250)", + lavenderblush:"rgb(255, 240, 245)", + lawngreen: "rgb(124, 252, 0)", + lemonchiffon: "rgb(255, 250, 205)", + lightblue: "rgb(173, 216, 230)", + lightcoral: "rgb(240, 128, 128)", + lightcyan: "rgb(224, 255, 255)", + lightgoldenrodyellow:"rgb(250, 250, 210)", + lightgray: "rgb(211, 211, 211)", + lightgreen: "rgb(144, 238, 144)", + lightgrey: "rgb(211, 211, 211)", + lightpink: "rgb(255, 182, 193)", + lightsalmon: "rgb(255, 160, 122)", + lightseagree: "rgb( 32, 178, 170)", + lightskyblue: "rgb(135, 206, 250)", + lightslategray:"rgb(119, 136, 153)", + lightslategrey:"rgb(119, 136, 153)", + lightsteelblue:"rgb(176, 196, 222)", + lightyellow: "rgb(255, 255, 224)", + lime: "rgb( 0, 255, 0)", + limegreen: "rgb( 50, 205, 50)", + linen: "rgb(250, 240, 230)", + magenta: "rgb(255, 0, 255)", + maroon: "rgb(128, 0, 0)", + mediumaquamarine:"rgb(102, 205, 170)", + mediumblue: "rgb( 0, 0, 205)", + mediumorchid: "rgb(186, 85, 211)", + mediumpurple: "rgb(147, 112, 219)", + mediumseagreen:"rgb( 60, 179, 113)", + mediumslateblue:"rgb(123, 104, 238)", + mediumspringgreen:"rgb( 0, 250, 154)", + mediumturquoise:"rgb( 72, 209, 204)", + mediumvioletred:"rgb(199, 21, 133)", + midnightblue: "rgb( 25, 25, 112)", + mintcream: "rgb(245, 255, 250)", + mistyrose: "rgb(255, 228, 225)", + moccasin: "rgb(255, 228, 181)", + navajowhite: "rgb(255, 222, 173)", + navy: "rgb( 0, 0, 128)", + oldlace: "rgb(253, 245, 230)", + olive: "rgb(128, 128, 0)", + olivedrab: "rgb(107, 142, 35)", + orange: "rgb(255, 165, 0)", + orangered: "rgb(255, 69, 0)", + orchid: "rgb(218, 112, 214)", + palegoldenrod: "rgb(238, 232, 170)", + palegreen: "rgb(152, 251, 152)", + paleturquoise: "rgb(175, 238, 238)", + palevioletred: "rgb(219, 112, 147)", + papayawhip: "rgb(255, 239, 213)", + peachpuff: "rgb(255, 218, 185)", + peru: "rgb(205, 133, 63)", + pink: "rgb(255, 192, 203)", + plum: "rgb(221, 160, 221)", + powderblue: "rgb(176, 224, 230)", + purple: "rgb(128, 0, 128)", + red: "rgb(255, 0, 0)", + rosybrown: "rgb(188, 143, 143)", + royalblue: "rgb( 65, 105, 225)", + saddlebrown: "rgb(139, 69, 19)", + salmon: "rgb(250, 128, 114)", + sandybrown: "rgb(244, 164, 96)", + seagreen: "rgb( 46, 139, 87)", + seashell: "rgb(255, 245, 238)", + sienna: "rgb(160, 82, 45)", + silver: "rgb(192, 192, 192)", + skyblue: "rgb(135, 206, 235)", + slateblue: "rgb(106, 90, 205)", + slategray: "rgb(112, 128, 144)", + slategrey: "rgb(112, 128, 144)", + snow: "rgb(255, 250, 250)", + springgreen: "rgb( 0, 255, 127)", + steelblue: "rgb( 70, 130, 180)", + tan: "rgb(210, 180, 140)", + teal: "rgb( 0, 128, 128)", + thistle: "rgb(216, 191, 216)", + tomato: "rgb(255, 99, 71)", + turquoise: "rgb( 64, 224, 208)", + violet: "rgb(238, 130, 238)", + wheat: "rgb(245, 222, 179)", + white: "rgb(255, 255, 255)", + whitesmoke: "rgb(245, 245, 245)", + yellow: "rgb(255, 255, 0)", + yellowgreen: "rgb(154, 205, 50)" }; function SVGRect() { @@ -1136,16 +1151,16 @@ var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i|\]>)/,"-->"); doc.loadXML(str); var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); @@ -1983,8 +1998,8 @@ if (fill.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { var fillElement = document.createElement("v:fill"); var isRadial = false; - var fc = fill.rgbColor; - fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")"); + var fc = fill.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER; + fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる if (fillOpacity < 1) { fillElement.setAttribute("opacity", fillOpacity+""); @@ -1992,7 +2007,7 @@ if (!isRadial) { el.appendChild(fillElement); } - isRadial = fillOpacity = null; + fc = isRadial = fillOpacity = null; } if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { var strokeElement = document.createElement("v:stroke"); @@ -2000,8 +2015,8 @@ var swx = sw.value * Math.sqrt(Math.abs(matrix._determinant())); strokeElement.setAttribute("weight", swx + "px"); if (!stroke.uri) { - var fc = stroke.rgbColor; - strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")"); + var fc = stroke.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER; + strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); var strokeOpacity = parseFloat(style.getPropertyValue("stroke-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる if (swx < 1) { strokeOpacity *= swx; //太さが1px未満なら色を薄くする @@ -2009,7 +2024,7 @@ if (strokeOpacity < 1) { strokeElement.setAttribute("opacity", strokeOpacity); } - strokeOpacity = null; + fc = num = strokeOpacity = null; } strokeElement.setAttribute("miterlimit", style.getPropertyValue("stroke-miterlimit")); strokeElement.setAttribute("joinstyle", style.getPropertyValue("stroke-linejoin")); From svnnotify @ sourceforge.jp Wed Mar 24 23:34:08 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 24 Mar 2010 23:34:08 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzUyXSAgc3R5bGXlsZ4=?= =?utf-8?b?5oCn44Gu5paH5a2X5YiX44GM56m644Gu5aC05ZCI44Gu5a++5Yem44KS44GX?= =?utf-8?b?44Gf?= Message-ID: <1269441248.924546.2310.nullmailer@users.sourceforge.jp> Revision: 1752 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1752 Author: dhrname Date: 2010-03-24 23:34:08 +0900 (Wed, 24 Mar 2010) Log Message: ----------- style属性の文字列が空の場合の対処をした Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-24 14:10:59 UTC (rev 1751) +++ branches/ufltima/dom/svg.js 2010-03-24 14:34:08 UTC (rev 1752) @@ -145,7 +145,7 @@   //描画の際、SVGStylabaleで指定しておいたプロパティの処理をする this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var style = evt.target.style, sc = style.cssText; - if (!!!sc._rewrite) { + if (!!!sc._rewrite && (sc !== "")) { //style属性値の解析 sc = sc.replace(/\:\s+/g, ":") .replace(/\s*;[^a-z\-]*/g, ";"); From svnnotify @ sourceforge.jp Thu Mar 25 23:22:38 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 25 Mar 2010 23:22:38 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzUzXSAxLCAgc3R5bGU=?= =?utf-8?b?5bGe5oCn44Gu5Yem55CG44Gr6Zai44GZ44KL5aSJ5pu0?= Message-ID: <1269526958.262266.3575.nullmailer@users.sourceforge.jp> Revision: 1753 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1753 Author: dhrname Date: 2010-03-25 23:22:38 +0900 (Thu, 25 Mar 2010) Log Message: ----------- 1, style属性の処理に関する変更 2, SVGColorのsetRGBColorメソッドを修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-24 14:34:08 UTC (rev 1752) +++ branches/ufltima/dom/svg.js 2010-03-25 14:22:38 UTC (rev 1753) @@ -143,20 +143,6 @@ */ /*readonly attribute SVGAnimatedTransformList*/ this.transform = new SVGAnimatedTransformList();   //描画の際、SVGStylabaleで指定しておいたプロパティの処理をする - this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { - var style = evt.target.style, sc = style.cssText; - if (!!!sc._rewrite && (sc !== "")) { - //style属性値の解析 - sc = sc.replace(/\:\s+/g, ":") - .replace(/\s*;[^a-z\-]*/g, ";"); - var a = sc.split(";"); - for (var i=0, ali=a.length;i 0) { //#を含む場合 - rgbColor = rgbColor.replace(/[\dA-F][\dA-F]/g, function(s) { - return parseInt(s, 16); - }); + } else if (rgbColor.indexOf("#") === 0) { //#を含む場合 + rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) { + return (parseInt(s, 16)+","); + }) + .replace(/#/, "rgb("); + rgbColor += ")"; } var s = rgbColor.match(/\d+/g); this.rgbColor.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[0])); @@ -1996,7 +1997,7 @@ var style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""); var el = tar._tar, fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke"); if (fill.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { - var fillElement = document.createElement("v:fill"); + var fillElement = !!this.fillElement ? this.fillElement : document.createElement("v:fill"); var isRadial = false; var fc = fill.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER; fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); @@ -2004,7 +2005,7 @@ if (fillOpacity < 1) { fillElement.setAttribute("opacity", fillOpacity+""); } - if (!isRadial) { + if (!isRadial && !!!this.fillElement) { el.appendChild(fillElement); } fc = isRadial = fillOpacity = null; From svnnotify @ sourceforge.jp Thu Mar 25 23:23:25 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 25 Mar 2010 23:23:25 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzU0XQ==?= Message-ID: <1269527005.399552.4654.nullmailer@users.sourceforge.jp> Revision: 1754 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1754 Author: dhrname Date: 2010-03-25 23:23:25 +0900 (Thu, 25 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-25 14:22:38 UTC (rev 1753) +++ branches/ufltima/dom/css.js 2010-03-25 14:23:25 UTC (rev 1754) @@ -215,14 +215,14 @@ if (propertyName === "fill:" || propertyName === "stroke:") { //fill、strokeプロパティは別途、SVGPaintで処理 ti = new SVGPaint(); ti.cssText = tc; - var _urlreg = /url\(#([^)]+)/; - var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null; + var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null; if (tc.indexOf("none") > -1) { paintType = SVGPaint.SVG_PAINTTYPE_NONE; } else if (tc.indexOf("currentColor") > -1) { paintType = SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR; color = this.getPropertyValue("color"); } else { + var _urlreg = /url\(#([^)]+)/; if (_urlreg.test(tc)) { //fill属性の値がurl(#id)ならば paintType = SVGPaint.SVG_PAINTTYPE_URI; uri = RegExp.$1; @@ -310,9 +310,9 @@ this.cssValueType = CSSValue.CSS_PRIMITIVE_VALUE; this.primitiveType = CSSPrimitiveValue.CSS_UNKNOWN; this._value = 1; - this._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) return this; }; + CSSPrimitiveValue.CSS_UNKNOWN = 0; CSSPrimitiveValue.CSS_NUMBER = 1; CSSPrimitiveValue.CSS_PERCENTAGE = 2; @@ -341,6 +341,7 @@ CSSPrimitiveValue.CSS_RGBCOLOR = 25; CSSPrimitiveValue.prototype = new CSSValue(); CSSPrimitiveValue.constructor = CSSValue; +CSSPrimitiveValue.prototype._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) /*void*/ CSSPrimitiveValue.prototype.setFloatValue = function(/*short*/ unitType, /*float*/ floatValue) { if (CSSPrimitiveValue.CSS_UNKNOWN >= unitType && unitType >= CSSPrimitiveValue.CSS_STRING) { //浮動小数点数単位型をサポートしないCSS単位である場合 @@ -396,9 +397,9 @@ rgbColor = rgbColor.replace(/[\d.]+%/g, function(t) { return Math.round((2.55 * parseFloat(t))); }); - } else if (rgbColor.indexOf("#") > 0) { //#を含む場合 - rgbColor = rgbColor.replace(/[\dA-F][\dA-F]/g, function(t) { - return parseInt(t, 16); + } else if (rgbColor.indexOf("#") > -1) { //#を含む場合 + rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) { + return parseInt(s, 16); }); } var n = rgbColor.match(/\d+/g); From svnnotify @ sourceforge.jp Thu Mar 25 23:27:08 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 25 Mar 2010 23:27:08 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzU1XSAgc2V0UkdCQ29s?= =?utf-8?b?b3Ljg6Hjgr3jg4Pjg4njga7mm7Tjgarjgovkv67mraM=?= Message-ID: <1269527228.463718.9696.nullmailer@users.sourceforge.jp> Revision: 1755 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1755 Author: dhrname Date: 2010-03-25 23:27:08 +0900 (Thu, 25 Mar 2010) Log Message: ----------- setRGBColorメソッドの更なる修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-25 14:23:25 UTC (rev 1754) +++ branches/ufltima/dom/svg.js 2010-03-25 14:27:08 UTC (rev 1755) @@ -525,9 +525,7 @@ } else if (rgbColor.indexOf("#") === 0) { //#を含む場合 rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) { return (parseInt(s, 16)+","); - }) - .replace(/#/, "rgb("); - rgbColor += ")"; + }); } var s = rgbColor.match(/\d+/g); this.rgbColor.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(s[0])); From svnnotify @ sourceforge.jp Thu Mar 25 23:35:07 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 25 Mar 2010 23:35:07 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzU2XQ==?= Message-ID: <1269527707.774408.20385.nullmailer@users.sourceforge.jp> Revision: 1756 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1756 Author: dhrname Date: 2010-03-25 23:35:07 +0900 (Thu, 25 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-25 14:27:08 UTC (rev 1755) +++ branches/ufltima/dom/svg.js 2010-03-25 14:35:07 UTC (rev 1756) @@ -2010,7 +2010,7 @@ } if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { var strokeElement = document.createElement("v:stroke"); - var sw = tar.ownerDocument.documentElement.createSVGLength(parseFloat(style.getProperty("stroke-width")));//, Math.sqrt((w*w + h*h) / 2)); + var sw = tar.ownerDocument.documentElement.createSVGLength(parseFloat(style.getPropertyValue("stroke-width")));//, Math.sqrt((w*w + h*h) / 2)); var swx = sw.value * Math.sqrt(Math.abs(matrix._determinant())); strokeElement.setAttribute("weight", swx + "px"); if (!stroke.uri) { @@ -2033,7 +2033,7 @@ strokeElement.setAttribute("endcap", style.getPropertyValue("stroke-linecap")); } var tsd = style.getPropertyValue("stroke-dasharray"); - if (!isNone[tsd]) { + if (tsd !== "none") { if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合 var strs = tsd.split(","); for (var i = 0, sli = strs.length; i < sli; ++i) { From svnnotify @ sourceforge.jp Thu Mar 25 23:43:22 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 25 Mar 2010 23:43:22 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzU3XQ==?= Message-ID: <1269528202.974607.30283.nullmailer@users.sourceforge.jp> Revision: 1757 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1757 Author: dhrname Date: 2010-03-25 23:43:22 +0900 (Thu, 25 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-25 14:35:07 UTC (rev 1756) +++ branches/ufltima/dom/svg.js 2010-03-25 14:43:22 UTC (rev 1757) @@ -2005,8 +2005,11 @@ } if (!isRadial && !!!this.fillElement) { el.appendChild(fillElement); + this.fillElement = fillElement; //キャッシュを作る } fc = isRadial = fillOpacity = null; + } else { + el.filled = "false"; } if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { var strokeElement = document.createElement("v:stroke"); @@ -2049,6 +2052,8 @@ } el.appendChild(strokeElement); sw = tsd = null; + } else { + el.stroked = "false"; } var cursor = style.getPropertyValue("cursor"); if (cursor !== "default") { From svnnotify @ sourceforge.jp Thu Mar 25 23:43:33 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 25 Mar 2010 23:43:33 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzU4XQ==?= Message-ID: <1269528213.858063.30409.nullmailer@users.sourceforge.jp> Revision: 1758 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1758 Author: dhrname Date: 2010-03-25 23:43:33 +0900 (Thu, 25 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-25 14:43:22 UTC (rev 1757) +++ branches/ufltima/dom/events.js 2010-03-25 14:43:33 UTC (rev 1758) @@ -177,7 +177,6 @@ }; EventListener.prototype = { /*void*/ handleEvent : function( /*Event*/ evt) { - try { var ph = evt.eventPhase, cap = this._cap; if (ph === Event.CAPTURING_PHASE) { //イベントフェーズが捕獲段階であることを示し cap = cap ? false : true; //このオブジェクト(EventListenr)が捕獲フェーズを指定するならば、リスナーを作動させる。指定しなければ、作動しない。 @@ -185,9 +184,6 @@ if (!cap && (evt.type === this._type)) { this._listener(evt); } - } catch (e) { - stlog.add(e, 186); - } } }; /*Eventクラス From svnnotify @ sourceforge.jp Thu Mar 25 23:45:25 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Thu, 25 Mar 2010 23:45:25 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzU5XQ==?= Message-ID: <1269528325.030294.606.nullmailer@users.sourceforge.jp> Revision: 1759 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1759 Author: dhrname Date: 2010-03-25 23:45:24 +0900 (Thu, 25 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-25 14:43:33 UTC (rev 1758) +++ branches/ufltima/dom/svg.js 2010-03-25 14:45:24 UTC (rev 1759) @@ -1150,7 +1150,7 @@ var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i Revision: 1760 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1760 Author: dhrname Date: 2010-03-27 00:09:53 +0900 (Sat, 27 Mar 2010) Log Message: ----------- グラデーション関連の修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-25 14:45:24 UTC (rev 1759) +++ branches/ufltima/dom/svg.js 2010-03-26 15:09:53 UTC (rev 1760) @@ -737,8 +737,7 @@ /*SVGURIReferenceオブジェクトはURI参照を用いる要素に適用される *SIEでは、もっぱらXLink言語の処理を行う */ -function SVGURIReference( /*element*/ ele) { - this._tar = ele; +function SVGURIReference() { /*readonly SVGAnimatedString*/ this.href = new SVGAnimatedString(); return this; }; @@ -863,6 +862,10 @@ } tp.align = sa; tp.meetOrSlice = mos; + } else if (name === "width") { + tar.viewport.width = tar.width.baseVal.value; //width属性があれば、viewportの値を上書きする + } else if (name === "height") { + tar.viewport.height = tar.height.baseVal.value; } }, false); this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ @@ -1995,7 +1998,7 @@ var style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""); var el = tar._tar, fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke"); if (fill.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { - var fillElement = !!this.fillElement ? this.fillElement : document.createElement("v:fill"); + var fillElement = !!tar.fillElement ? tar.fillElement : document.createElement("v:fill"); var isRadial = false; var fc = fill.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER; fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); @@ -2003,9 +2006,9 @@ if (fillOpacity < 1) { fillElement.setAttribute("opacity", fillOpacity+""); } - if (!isRadial && !!!this.fillElement) { + if (!isRadial && !!!tar.fillElement) { el.appendChild(fillElement); - this.fillElement = fillElement; //キャッシュを作る + tar.fillElement = fillElement; //キャッシュを作る } fc = isRadial = fillOpacity = null; } else { @@ -2571,10 +2574,44 @@ function SVGGradientElement() { SVGElement.apply(this, arguments); + SVGURIReference.apply(this, arguments); /*readonly SVGAnimatedEnumeration*/ this.gradientUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedTransformList*/ this.gradientTransform = new SVGAnimatedTransformList(); /*readonly SVGAnimatedEnumeration*/ this.spreadMethod = new SVGAnimatedEnumeration(); - this._xlink = new SVGURIReference(this); + this.addEventListener("DOMNodeInserted", function(evt) { + var grad = evt.target, ele = evt._tar; //eleはv:fill要素やv:stroke要素のノードを収納 + if (!!!ele) { //まだ、path要素などが設定されていない場合 + return; + } + if (grad) { + var grad2 = grad; + while (grad2 && !grad2.hasChildNodes()) { //stopを子要素に持つgradient要素を探す + grad2.getAttributeNS("http://www.w3.org/xlink/1999", "xlink:href").match(/#(.+)/); + grad2 = evt.target.ownerDocument.getElementById(RegExp.$1); + } + var stops = grad2.getElementsByTagNameNS(null, "stop"); + if (!stops) { + grad = grad2 = stops = null; + return; + } + var length = stops.length; + var color = [], colors = [], opacity = []; + for (var i = 0; i < length; ++i) { + var stop = stops[i]; + color[i] = this.color(stop.style.stopcolor || stop.getAttribute("stopcolor")) || "black"; + colors[i] = stop.getAttribute("offset") + " " + color[i]; + opacity[i] = (stop.style.stopopacity || stop.getAttribute("stopopacity") || 1) * this.fillopacity * this.opacity; + } + ele.setAttribute("method", "none"); + ele.setAttribute("color", color[0]); + ele.setAttribute("color2", color[length-1]); + ele.setAttribute("colors", colors.join(",")); + // When colors attribute is used, the meanings of opacity and o:opacity2 are reversed. + ele.setAttribute("opacity", opacity[length-1]+ ""); + ele.setAttribute("o:opacity2", opacity[0]+ ""); + grad = ele = stops = lengh = color = colors = opacity = null; + } + }, false); return this; }; SVGGradientElement.constructor = SVGElement; @@ -2591,6 +2628,19 @@ /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(); + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + var grad = evt.target, ele = evt._tar, angle = 270; + if (!!!ele) { //まだ、path要素などが設定されていない場合 + return; + } + angle = 270 - Math.atan2(this.y2.baseVal.value-this.y1.baseVal.value, this.x2.baseVal.value-this.x1.baseVal.value) * 180 / Math.PI; + if (angle >= 360) { + angle -= 360; + } + ele.setAttribute("type", "gradient"); + ele.setAttribute("angle", angle + ""); + grad = angle = null; + }, false); return this; }; SVGLinearGradientElement.constructor = SVGGradientElement; @@ -2603,6 +2653,65 @@ /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.fx = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.fy = new SVGAnimatedLength(); + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + var grad = evt.target, ele = evt._tar; + if (!!!ele) { //まだ、path要素などが設定されていない場合 + return; + } + ele.setAttribute("type", "gradientTitle"); + ele.setAttribute("focus", "100%"); + ele.setAttribute("focusposition", "0.5 0.5"); + if (this.tar.getAttribute("tag") === "rect") { + var cx = parseFloat((grad.getAttribute("cx") || "0.5")); + var cy = parseFloat((grad.getAttribute("cy") || "0.5")); + var r = rx = ry = parseFloat((grad.getAttribute("r") || "0.5")); + var el = this.w, et = this.h, er = 0, eb = 0; + var data = this.tar.path.value; + var units = grad.getAttribute("gradientUnits"); + if (!units || units === "objectBoundingBox") { + //%の場合は小数点に変換(10% -> 0.1) + cx = cx > 1 ? cx/100 : cx; cy = cy > 1 ? cy/100 : cy; r = r > 1 ? r/100 : r; + //要素の境界領域を求める(四隅の座標を求める) + var degis = data.match(/[0-9\-]+/g); + for (var i=0,degisli=degis.length;i nx ? nx : el; + et = et > ny ? ny : et; + er = er > nx ? er : nx; + eb = eb > ny ? eb : ny; nx = ny = null; + } + degis = null; + cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et); + } + var gt = grad.getAttribute("gradientTransform"); + if (gt) { + grad.setAttribute("transform",gt); + matrix = NAIBU.transformToCTM(grad, matrix); + } + el = cx - rx; et = cy - ry; er = cx + rx; eb = cy + ry; + var rrx = rx * 0.55228, rry = ry * 0.55228; + var list = ["m", cx,et, "c", cx-rrx,et, el,cy-rry, el,cy, el,cy+rry, cx-rrx,eb, cx,eb, cx+rrx,eb, er,cy+rry, er,cy, er,cy-rry, cx+rrx,et, cx,et, "x e"]; + var pl = new PList(list); + var plm = pl.matrixTransform(matrix); + var ellipse = plm.list.join(" "); + var outline = document.getElementById("_NAIBU_outline"); + var background = document.createElement("div"), bstyle = background.style; + bstyle.position = "absolute"; + bstyle.display = "inline-block"; + bstyle.textAlign = "left"; bstyle.top = "0px"; bstyle.left = "0px"; bstyle.width = this.w+ "px"; bstyle.height = this.h+ "px"; + outline.appendChild(background); + bstyle.filter = "progid:DXImageTransform.Microsoft.Compositor"; + background.filters.item('DXImageTransform.Microsoft.Compositor').Function = 23; + var circle = '' +ele.outerHTML+ ''; + background.innerHTML = ''; + background.filters[0].apply(); + background.innerHTML = circle; + background.filters[0].play(); + this.tar.parentNode.insertBefore(background, this.tar); + this.tar.filled = "false"; + ellipse = circle = data = list = pl = plm = gt = cx = cy = r = null; + } + }, false); return this; }; SVGRadialGradientElement.constructor = SVGGradientElement; From svnnotify @ sourceforge.jp Sat Mar 27 23:04:22 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sat, 27 Mar 2010 23:04:22 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzYxXSAg44Kt44Oj44Oh?= =?utf-8?b?44Or5b2i5byP44Gu5aSJ5o+b44Gr44Gk44GE44Gm5L+u5q2j?= Message-ID: <1269698662.179297.32000.nullmailer@users.sourceforge.jp> Revision: 1761 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1761 Author: dhrname Date: 2010-03-27 23:04:22 +0900 (Sat, 27 Mar 2010) Log Message: ----------- キャメル形式の変換について修正 Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-26 15:09:53 UTC (rev 1760) +++ branches/ufltima/dom/css.js 2010-03-27 14:04:22 UTC (rev 1761) @@ -648,11 +648,17 @@ *CSSprimitiveValueのリストを収納している。なお、その際に、writingModeなどはwriting-modeに変更している */ (function(){ - var s = [], az = /([A-Z])/g; + var s = []; for (var i in CSS2Properties) { if(CSS2Properties.hasOwnProperty(i)) { var n = s[s.length] = new CSSPrimitiveValue(); - t = i.replace(az, "-" +RegExp.$1.toLowerCase()); + var t = i.replace(/([A-Z])/, "-"); + if (!!RegExp.$1) { + var u = "-" +RegExp.$1.toLowerCase(); + } else { + var u = "-"; + } + t = t.replace(/\-/, u); n.cssText += t; n.cssText += ":"; n.cssText += CSS2Properties[i]; @@ -660,7 +666,6 @@ } } CSS2Properties._list = s; - az = null; })(); function CSSStyleSheet() { From svnnotify @ sourceforge.jp Sun Mar 28 23:18:08 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 28 Mar 2010 23:18:08 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzYyXSAgZ2V0RWxlbWVu?= =?utf-8?b?dHNCeVRhZ05hbWVOU+ODoeOCveODg+ODieOCkuWtkOimgee0oOOCguaOog==?= =?utf-8?b?57Si44Gn44GN44KL44KI44GG44Gr5L+u5q2j?= Message-ID: <1269785888.680116.8511.nullmailer@users.sourceforge.jp> Revision: 1762 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1762 Author: dhrname Date: 2010-03-28 23:18:08 +0900 (Sun, 28 Mar 2010) Log Message: ----------- getElementsByTagNameNSメソッドを子要素も探索できるように修正 Modified Paths: -------------- branches/ufltima/core.js Modified: branches/ufltima/core.js =================================================================== --- branches/ufltima/core.js 2010-03-27 14:04:22 UTC (rev 1761) +++ branches/ufltima/core.js 2010-03-28 14:18:08 UTC (rev 1762) @@ -596,21 +596,21 @@ for (var i=0,tcli = tno.length;i Revision: 1763 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1763 Author: dhrname Date: 2010-03-28 23:19:07 +0900 (Sun, 28 Mar 2010) Log Message: ----------- v:fill要素とv:stroke要素のキャッシュをきかせた Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-28 14:18:08 UTC (rev 1762) +++ branches/ufltima/dom/svg.js 2010-03-28 14:19:07 UTC (rev 1763) @@ -1998,7 +1998,7 @@ var style = tar.ownerDocument.defaultView.getComputedStyle(tar, ""); var el = tar._tar, fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke"); if (fill.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { - var fillElement = !!tar.fillElement ? tar.fillElement : document.createElement("v:fill"); + var fillElement = !!tar._fillElement ? tar._fillElement : document.createElement("v:fill"); var isRadial = false; var fc = fill.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER; fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); @@ -2006,16 +2006,16 @@ if (fillOpacity < 1) { fillElement.setAttribute("opacity", fillOpacity+""); } - if (!isRadial && !!!tar.fillElement) { + if (!isRadial && !!!tar._fillElement) { el.appendChild(fillElement); - tar.fillElement = fillElement; //キャッシュを作る + tar._fillElement = fillElement; //キャッシュを作る } fc = isRadial = fillOpacity = null; } else { el.filled = "false"; } if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) { - var strokeElement = document.createElement("v:stroke"); + var strokeElement = !!tar._strokeElement ? tar._strokeElement : document.createElement("v:stroke"); var sw = tar.ownerDocument.documentElement.createSVGLength(parseFloat(style.getPropertyValue("stroke-width")));//, Math.sqrt((w*w + h*h) / 2)); var swx = sw.value * Math.sqrt(Math.abs(matrix._determinant())); strokeElement.setAttribute("weight", swx + "px"); @@ -2054,6 +2054,9 @@ tsd = strs = null; } el.appendChild(strokeElement); + if (!!!tar._strokeElement) { + tar._strokeElement = strokeElement; + } sw = tsd = null; } else { el.stroked = "false"; From svnnotify @ sourceforge.jp Sun Mar 28 23:19:48 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 28 Mar 2010 23:19:48 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzY0XSAgQ1NTMlByb3Bl?= =?utf-8?b?cnRpZXPjga7kuKbjgbPmm7/jgYjjgavjgojjgovmnIDpganljJY=?= Message-ID: <1269785988.988020.9683.nullmailer@users.sourceforge.jp> Revision: 1764 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1764 Author: dhrname Date: 2010-03-28 23:19:48 +0900 (Sun, 28 Mar 2010) Log Message: ----------- CSS2Propertiesの並び替えによる最適化 Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-28 14:19:07 UTC (rev 1763) +++ branches/ufltima/dom/css.js 2010-03-28 14:19:48 UTC (rev 1764) @@ -458,6 +458,22 @@ *さらにSVG CSSを付け加えている */ var CSS2Properties = { + fill : "black", + fillOpacity : "1", + fillRule : "nonzero", + stroke : "none", + strokeDasharray : "none", + strokeDashoffset : "0", + strokeLinecap : "butt", + strokeLinejoin : "miter", + strokeMiterlimit : "4", + strokeOpacity : "1", + strokeWidth : "1", + +//# Gradient properties: + + stopColor : "black", + stopOpacity : "1", azimuth : "center", // raises(dom::DOMException) on setting //簡略プロパティに関しては、初期値を再考せよ @@ -599,11 +615,6 @@ floodOpacity : "1", lightingColor : "white", -//# Gradient properties: - - stopColor : "black", - stopOpacity : "1", - //# Interactivity properties: pointerEvents : "visiblePainted", @@ -614,23 +625,12 @@ colorInterpolationFilters : "linearRGB", colorProfile : "auto", colorRendering : "auto", - fill : "black", - fillOpacity : "1", - fillRule : "nonzero", imageRendering : "auto", marker : "", markerEnd : "none", markerMid : "none", markerStart : "none", shapeRendering : "auto", - stroke : "none", - strokeDasharray : "none", - strokeDashoffset : "0", - strokeLinecap : "butt", - strokeLinejoin : "miter", - strokeMiterlimit : "4", - strokeOpacity : "1", - strokeWidth : "1", textRendering : "auto", //# Text properties: From svnnotify @ sourceforge.jp Sun Mar 28 23:20:31 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Sun, 28 Mar 2010 23:20:31 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzY1XSAgRE9NTm9kZUlu?= =?utf-8?b?c2VydGVkSW50b0RvY3VtZW5044Kk44OZ44Oz44OI44Gu5pyA6YGp5YyW44Go?= =?utf-8?b?5L+u5q2j?= Message-ID: <1269786031.184964.11674.nullmailer@users.sourceforge.jp> Revision: 1765 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1765 Author: dhrname Date: 2010-03-28 23:20:31 +0900 (Sun, 28 Mar 2010) Log Message: ----------- DOMNodeInsertedIntoDocumentイベントの最適化と修正 Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-28 14:19:48 UTC (rev 1764) +++ branches/ufltima/dom/events.js 2010-03-28 14:20:31 UTC (rev 1765) @@ -364,7 +364,10 @@ evt.target = n; evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); n.dispatchEvent(evt); - var descend = this.getElementsByTagNameNS("*", "*"); //全子孫要素を取得 + if (!(n instanceof Element)) { //子要素がないので終了 + return n; + } + var descend = n.getElementsByTagNameNS("*", "*"); //全子孫要素を取得 if (descend) { for (var i=0,dli=descend.length;i Revision: 1766 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1766 Author: dhrname Date: 2010-03-29 23:15:44 +0900 (Mon, 29 Mar 2010) Log Message: ----------- 効率を上げて、さらに高速化 Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-28 14:20:31 UTC (rev 1765) +++ branches/ufltima/dom/css.js 2010-03-29 14:15:44 UTC (rev 1766) @@ -459,9 +459,9 @@ */ var CSS2Properties = { fill : "black", + stroke : "none", fillOpacity : "1", fillRule : "nonzero", - stroke : "none", strokeDasharray : "none", strokeDashoffset : "0", strokeLinecap : "butt", @@ -469,6 +469,16 @@ strokeMiterlimit : "4", strokeOpacity : "1", strokeWidth : "1", + opacity : "1", + writingMode : "lr-tb", + fontFamily : "inline", + fontSize : "inline", + fontSizeAdjust : "none", + fontStretch : "normal", + fontStyle : "normal", + fontVariant : "normal", + fontWeight : "normal", + font : "inline", //# Gradient properties: @@ -524,14 +534,6 @@ elevation : "level", emptyCells : "show", cssFloat : "inline", - font : "inline", - fontFamily : "inline", - fontSize : "inline", - fontSizeAdjust : "none", - fontStretch : "normal", - fontStyle : "normal", - fontVariant : "normal", - fontWeight : "normal", height : "auto", left : "auot", letterSpacing : "normal", @@ -605,7 +607,6 @@ clipPath : "none", clipRule : "nonzero", mask : "none", - opacity : "1", //# Filter Effects properties: @@ -641,8 +642,7 @@ glyphOrientationHorizontal : "0deg", glyphOrientationVertical : "auto", kerning : "auto", - textAnchor : "start", - writingMode : "lr-tb" + textAnchor : "start" }; /*以下は、getComputedStyleメソッドで使うために、CSS2Propertiesの_listプロパティに、 *CSSprimitiveValueのリストを収納している。なお、その際に、writingModeなどはwriting-modeに変更している From svnnotify @ sourceforge.jp Tue Mar 30 23:43:49 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 30 Mar 2010 23:43:49 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzY3XSAgZ2V0T3ZlcnJp?= =?utf-8?b?ZGVTdHlsZeODoeOCveODg+ODieOBruS/ruatow==?= Message-ID: <1269960229.798524.9636.nullmailer@users.sourceforge.jp> Revision: 1767 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1767 Author: dhrname Date: 2010-03-30 23:43:49 +0900 (Tue, 30 Mar 2010) Log Message: ----------- getOverrideStyleメソッドの修正 Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-29 14:15:44 UTC (rev 1766) +++ branches/ufltima/dom/css.js 2010-03-30 14:43:49 UTC (rev 1767) @@ -709,7 +709,6 @@ */ /*function DocumentCSS : stylesheets::DocumentStyle {*/ /*CSSStyleDeclaration*/ Document.prototype.getOverrideStyle = function( /*Element*/ elt, /*string*/ pseudoElt) { - return (elt._runtimeStyle); }; /*createCSSStyleSheetメソッド *文書のスタイルシートを作成 From svnnotify @ sourceforge.jp Tue Mar 30 23:44:32 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Tue, 30 Mar 2010 23:44:32 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzY4XSAgU1ZHU3R5bGFi?= =?utf-8?b?bGXjgqTjg7Pjgr/jg7zjg5Xjgqfjg7zjgrnjga7kv67mraPjgajjgZfjgaY=?= =?utf-8?b?44CBX3J1bnRpbWVTdHlsZeODl+ODreODkeODhuOCo+OCkuWJiumZpOOBlw==?= =?utf-8?b?44Gf?= Message-ID: <1269960272.273270.10847.nullmailer@users.sourceforge.jp> Revision: 1768 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1768 Author: dhrname Date: 2010-03-30 23:44:32 +0900 (Tue, 30 Mar 2010) Log Message: ----------- SVGStylableインターフェースの修正として、_runtimeStyleプロパティを削除した Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-30 14:43:49 UTC (rev 1767) +++ branches/ufltima/dom/svg.js 2010-03-30 14:44:32 UTC (rev 1768) @@ -718,7 +718,6 @@ function SVGStylable() { /*readonly attribute SVGAnimatedString*/ this.className = new SVGAnimatedString(); /*readonly attribute css::CSSStyleDeclaration*/ this.style = new CSSStyleDeclaration(); - this._runtimeStyle = new CSSStyleDeclaration(); //getOverrideStyleメソッドで利用する this._attributeStyle = new CSSStyleDeclaration(); //プレゼンテーション属性の値を格納する //styleのcssTextプロパティを解析するリスナーを登録しておく }; @@ -1840,7 +1839,7 @@ tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); x1 = y1 = null; } else if (dii === "A" || dii === "a") { - (function(ti, cx, cy, rx, ry, tar) { //変数を隠蔽するためのfunction + (function(ti, cx, cy, rx, ry, tar, tnl) { //変数を隠蔽するためのfunction /*以下は、Arctoを複数のCuvetoに変換する処理 *SVG 1.1 「F.6 Elliptical arc implementation notes」の章を参照 *http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes @@ -1899,7 +1898,7 @@ x2 = x3 + dx; y2 = y3 + dy; } - })(ti, cx, cy, rx, ry, tar); + })(ti, cx, cy, rx, ry, tar, tnl); } else if (dii === "S") { if (j !== 0) { var tg = tlist.getItem(j-1); From svnnotify @ sourceforge.jp Wed Mar 31 23:19:24 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 31 Mar 2010 23:19:24 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzY5XSAgU1ZHR0VsZW1l?= =?utf-8?b?bnTjga5hcHBlbmRDaGlsZOOBq+mWouOBmeOCi+WkieabtA==?= Message-ID: <1270045164.286122.13847.nullmailer@users.sourceforge.jp> Revision: 1769 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1769 Author: dhrname Date: 2010-03-31 23:19:24 +0900 (Wed, 31 Mar 2010) Log Message: ----------- SVGGElementのappendChildに関する変更 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-30 14:44:32 UTC (rev 1768) +++ branches/ufltima/dom/svg.js 2010-03-31 14:19:24 UTC (rev 1769) @@ -1011,7 +1011,7 @@ function SVGGElement() { SVGElement.apply(this, arguments); this._tar = document.createElement("v:group"); - /*以下の処理は、このpath要素ノードがDOMツリーに追加されて初めて、 + /*以下の処理は、この子要素ノードがDOMツリーに追加されて初めて、 *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。 */ this.addEventListener("DOMNodeInserted", function(evt){ @@ -1019,7 +1019,11 @@ if (evt.eventPhase === Event.BUBBLING_PHASE) { return; //強制終了させる } - tar.parentNode._tar.appendChild(tar._tar); + if (tar.nextSibling) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } else { + tar.parentNode._tar.appendChild(tar._tar); + } evt.target.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ }, false); }, false); From svnnotify @ sourceforge.jp Wed Mar 31 23:37:21 2010 From: svnnotify @ sourceforge.jp (svnnotify @ sourceforge.jp) Date: Wed, 31 Mar 2010 23:37:21 +0900 Subject: [Sie-announce] =?utf-8?b?U0lF44Kz44O844OJIFsxNzcwXSAgc3Zn6KaB57Sg?= =?utf-8?b?44Gr6Zai44GZ44KL5bGe5oCn44Gu5L+u5q2j?= Message-ID: <1270046241.466669.2619.nullmailer@users.sourceforge.jp> Revision: 1770 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1770 Author: dhrname Date: 2010-03-31 23:37:21 +0900 (Wed, 31 Mar 2010) Log Message: ----------- svg要素に関する属性の修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-31 14:19:24 UTC (rev 1769) +++ branches/ufltima/dom/svg.js 2010-03-31 14:37:21 UTC (rev 1770) @@ -427,8 +427,8 @@ */ function SVGLength() { /*readonly attribute unsigned short*/ this.unitType = SVGLength.SVG_LENGTHTYPE_UNKNOWN; - /*attribute float*/ this.value = SVGLength.SVG_LENGTHTYPE_UNKNOWN; //利用単位における値 - /*attribute float*/ this.valueInSpecifiedUnits = 0; //unitTypeにおける値 + /*attribute float*/ this.value = 0; //利用単位における値 + /*attribute float*/ this.valueInSpecifiedUnits = SVGLength.SVG_LENGTHTYPE_UNKNOWN; //unitTypeにおける値 /*attribute DOMString*/ this.valueAsString; }; // Length Unit Types @@ -861,10 +861,6 @@ } tp.align = sa; tp.meetOrSlice = mos; - } else if (name === "width") { - tar.viewport.width = tar.width.baseVal.value; //width属性があれば、viewportの値を上書きする - } else if (name === "height") { - tar.viewport.height = tar.height.baseVal.value; } }, false); this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ @@ -921,6 +917,9 @@ *SVGElement(SVGLocatable)で指定しておいたメソッドであるが、ここで、算出方法が違うため、再定義をする */ /*SVGMatrix*/ SVGSVGElement.prototype.getScreenCTM = function(){ + if (!!this._cacheScreenCTM) { //キャッシュがあれば + return this._cacheScreenCTM; + } var vw = this.viewport.width, vh = this.viewport.height; if (!this.useCurrentView) { var vB = this.viewBox.baseVal, par = this.preserveAspectRatio.baseVal; @@ -979,6 +978,7 @@ var m = this.createSVGMatrix(); m.a = xr; m.d = yr; + this._cacheScreenCTM = m; //キャッシュを作っておく return m; }; @@ -1156,7 +1156,7 @@ var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i Revision: 1771 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1771 Author: dhrname Date: 2010-03-31 23:46:18 +0900 (Wed, 31 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-31 14:37:21 UTC (rev 1770) +++ branches/ufltima/dom/svg.js 2010-03-31 14:46:18 UTC (rev 1771) @@ -1555,14 +1555,14 @@ this.pathSegType = SVGPathSeg.PATHSEG_LINETO_ABS; this.pathSegTypeAsLetter = "L"; return this; - }; +}; function SVGPathSegLinetoRel() { /*float*/ this.x; /*float*/ this.y; this.pathSegType = SVGPathSeg.PATHSEG_LINETO_REL; this.pathSegTypeAsLetter = "l"; return this; - }; +}; function SVGPathSegCurvetoCubicAbs() { /*float*/ this.x; /*float*/ this.y; @@ -1573,7 +1573,7 @@ this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS; this.pathSegTypeAsLetter = "C"; return this; - }; +}; function SVGPathSegCurvetoCubicRel() { /*float*/ this.x; /*float*/ this.y;