• R/O
  • HTTP
  • SSH
  • HTTPS

sie: コミット

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


コミットメタ情報

リビジョンe3475e3588b1caf7cdcae1de1f729ac158a6382a (tree)
日時2015-11-03 23:01:40
作者dhrname <dhrname@user...>
コミッターdhrname

ログメッセージ

Support the inherit and the currentColor keyword

変更サマリ

差分

--- a/org/w3c/dom/smil.js
+++ b/org/w3c/dom/smil.js
@@ -785,17 +785,26 @@ base("$calcMode").up("$attribute").mix( {
785785 /*$fromオブジェクトを作るためのひな形となるオブジェクト*/
786786 $from: base("$from").up(),
787787
788+ /*attributeName属性の値*/
789+ attrName: "",
790+
788791 /*指定した要素の属性値を取得するメソッド*/
789792 _getAttr: function(/*string*/ name, def) {
790793 var nameSpace = null;
791794 if (name.indexOf("xlink:") > -1) {
792795 nameSpace = "http://www.w3.org/1999/xlink";
793796 }
797+ var s = this._ele.getAttributeNS(nameSpace, name);
798+ if (this.element && (s === "inherit")) {
799+ return this.element.ownerDocument.defaultView.getComputedStyle(this.element.parentNode, "").getPropertyValue(this.attrName);
800+ } else if (this.element && (s === "currentColor")) {
801+ return this.element.ownerDocument.defaultView.getComputedStyle(this._ele, "").getPropertyValue("color");
802+ }
794803 /*DOM Level2やIE11では、getAttributeNSメソッドは空文字を返す。他のブラウザではnullを返すことが多い
795804 *
796805 * >the empty string if that attribute does not have a specified or default value
797806 * http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElGetAttrNS*/
798- return (this._ele.getAttributeNS(nameSpace, name) || def);
807+ return (s || def);
799808 },
800809
801810 _ele: document.documentElement,
@@ -827,6 +836,7 @@ base("$calcMode").up("$attribute").mix( {
827836 }
828837 /*_getAttrメソッドで必要*/
829838 this._ele = ele;
839+ this.attrName = this._getAttr("attributeName", "");
830840 /*eleの属性の値を、それぞれオブジェクトに割り当て*/
831841 var $frame = base("$frame"),
832842 begin = $frame.$begin,
@@ -1019,9 +1029,6 @@ base("$calcMode").up("$attribute").mix( {
10191029 /*to属性の値、文字列*/
10201030 to: "",
10211031
1022- /*attributeName属性の値*/
1023- attrName: "",
1024-
10251032 /*指定された属性の規定値*/
10261033 defaultValue: "",
10271034
@@ -1072,7 +1079,6 @@ base("$calcMode").up("$attribute").mix( {
10721079 if (ele && ele.getAttributeNS) {
10731080 this._ele = ele;
10741081 this.to = this._getAttr("to", "");
1075- this.attrName = this._getAttr("attributeName", "");
10761082 this.fill = this._getAttr("fill", "remove");
10771083 }
10781084 var thisele = this.element;
旧リポジトリブラウザで表示