• R/O
  • HTTP
  • SSH
  • HTTPS

sie: コミット

ブラウザでSVGを表示するSIEの開発 (SIE - to display SVG on legacy browsers)


コミットメタ情報

リビジョンd83dcf93c96f831db38136bd298727e3fb73272f (tree)
日時2016-06-21 20:57:51
作者dhrname <dhrname@user...>
コミッターdhrname

ログメッセージ

Modify the

変更サマリ

差分

--- a/org/w3c/dom/smil.js
+++ b/org/w3c/dom/smil.js
@@ -1580,16 +1580,10 @@ base("$calcMode").up("$attribute").mix( {
15801580 *小数点以下の桁数を決めるdegitsプロパティの値も大きくしておく*/
15811581 degits: 15,
15821582
1583- /*$animateElementオブジェクトのtocallメソッドをオーバライド*/
1584- tocall: function (advance) {
1585- if (this.numberOfList < 0) {
1586- throw new Error("Number of The List Error");
1587- }
1588- var playList = this.element.__transformList,
1589- currentItem = playList[this.numberOfList];
1590- currentItem.value = this.type+ "(" +this.$animateElement.tocall.call(this, advance)+ ")";
1591- currentItem.isPlaying = true;
1592- var s = this.defaultValue || "";
1583+ /*tocallメソッド(後述の$motionElementオブジェクトも含む)で使うメソッド
1584+ * __transformListの値を結合して、文字列として返す*/
1585+ joinList: function(s) {
1586+ var playList = this.element.__transformList;
15931587 for (var i=0;i<playList.length;++i) {
15941588 var item = playList[i],
15951589 value = item.value;
@@ -1601,7 +1595,19 @@ base("$calcMode").up("$attribute").mix( {
16011595 s = value;
16021596 }
16031597 }
1604- return s;
1598+ return s.trim();
1599+ },
1600+
1601+ /*$animateElementオブジェクトのtocallメソッドをオーバライド*/
1602+ tocall: function (advance) {
1603+ if (this.numberOfList < 0) {
1604+ throw new Error("Number of The List Error");
1605+ }
1606+ var currentItem = this.element.__transformList[this.numberOfList];
1607+ currentItem.value = this.type+ "(" +this.$animateElement.tocall.call(this, advance)+ ")";
1608+ currentItem.isPlaying = true;
1609+ currentItem.isSum = this.isSum;
1610+ return this.joinList(this.defaultValue || "");
16051611 },
16061612
16071613 /*後の_setFrameメソッドで使うダミー*/
@@ -1686,6 +1692,10 @@ base("$calcMode").up("$attribute").mix( {
16861692 }
16871693 } )
16881694 .up("$motionElement")
1695+ .mix( function() {
1696+ /*setRFrameメソッドを再定義*/
1697+ this._setFrame = this.$animateElement._setFrame;
1698+ })
16891699 .mix( {
16901700 numberOfList: -1,
16911701 mode: "paced",
@@ -1703,12 +1713,22 @@ base("$calcMode").up("$attribute").mix( {
17031713
17041714 path: document.createElementNS("http://www.w3.org/2000/svg", "path"),
17051715
1706- /*_tocallメソッドを置き換えるためのメソッド
1716+ /*tocallメソッドのオーバライド*/
1717+ tocall: function(advance) {
1718+ /*モーションは仕様の関係上、かならず、CTMの一番初めに置かれ、前置積となる
1719+ * なお、__transformListプロパティはtransform属性の値であり、CTMを表現する。
1720+ * 必ず、CTMの一番目に設定する*/
1721+ var s = "translate(" +this.$animateElement.tocall.call(this, advance)+ ") "
1722+ + (this.defaultValue || "");
1723+ return this.joinList(s);
1724+ },
1725+
1726+ /*$animateElement.tocallメソッドを置き換えるためのメソッド
17071727 * mpath要素が指定されたときか、path属性のときにのみ使われる*/
17081728 _tocallForPath: function(advance) {
17091729 /*全体の距離から、現在進めている距離を算出して、そこから、現在点を導き出す*/
17101730 var point = this.path.getPointAtLength(advance * this.path.getTotalLength());
1711- return "translate(" +point.x+ "," +point.y+ ")";
1731+ return point.x+ "," +point.y;
17121732 }
17131733 } )
17141734 .on("init", function (ele) {
@@ -1717,18 +1737,24 @@ base("$calcMode").up("$attribute").mix( {
17171737 }
17181738 /*type属性で変更されないように($animateTransformElementのinitメソッドを参照のこと)*/
17191739 this.type = "translate";
1740+ /*isSumプロパティは常にtrueにしておく。animateTransform要素とは挙動が違うため
1741+ * また、$aniamteTransformElementのtocallメソッド参照*/
1742+ this.isSum = true;
17201743 this.mode = this.getAttr("mode", "paced");
17211744 this.path = this.path.cloneNode(true);
17221745 var mpath = ele.getElementsByTagNameNS(this.path.namespaceURI, "mpath");
1746+ var list = this.element.__transformList;
1747+ /*$animateは後で、プロパティを書き換えるために使う。tocallメソッドも参照*/
1748+ var $animate = this.$animateElement;
17231749 if (mpath.length) {
17241750 var p = ele.ownerDocument.getElementById(
17251751 mpath[0].getAttributeNS("http://www.w3.org/1999/xlink", "href").slice(1)
17261752 );
17271753 p && this.path.setAttributeNS(null, "d", p.getAttributeNS(null, "d"));
1728- this.tocall = this._tocallForPath;
1754+ this.$animateElement = $animate.up().mix ( {tocall: this._tocallForPath} );
17291755 } else if (ele.hasAttributeNS(null, "path")) {
17301756 this.path.setAttributeNS(null, "d", ele.getAttributeNS(null, "path"));
1731- this.tocall = this._tocallForPath;
1757+ this.$animateElement = $animate.up().mix ( {tocall: this._tocallForPath} );
17321758 }
17331759 } );
17341760
旧リポジトリブラウザで表示