OSDN Git Service

SVGXXXListインターフェースをすべて、base関数で再定義
authordhrname <sie-developers@lists.sourceforge.jp>
Wed, 10 Sep 2014 13:05:55 +0000 (22:05 +0900)
committerdhrname <sie-developers@lists.sourceforge.jp>
Wed, 10 Sep 2014 13:05:55 +0000 (22:05 +0900)
org/w3c/dom/svg.js

index 6a8662c..483fbad 100644 (file)
@@ -435,39 +435,39 @@ base("$document").$element.up("$svgelement").mix( {
   }\r
 });\r
 \r
-function SVGAnimatedBoolean() {\r
-  /*boolean*/  this.animVal = this.baseVal = true;\r
-};\r
+base("$SVGAnimatedBoolean").mix( {\r
+  /*boolean*/  animVal: true,\r
+                    baseVal: true\r
+} );\r
 \r
-function SVGAnimatedString() {\r
-  /*String*/ this.animVal = this.baseVal = "";\r
-};\r
+base("$SVGAnimatedString").mix( {\r
+  /*String*/ animVal: "",\r
+                 baseVal: ""\r
+} );\r
 \r
-function SVGStringList() {\r
-};\r
-SVGStringList.prototype = Object._create(Array);\r
-(function(){\r
-  /*readonly unsigned long*/ this.numberOfItems = 0;\r
-  /*void*/   this.clear = function(){\r
+base("$SVGStringList").mix(Array.prototype)\r
+ .mix( {\r
+  /*readonly unsigned long*/ numberOfItems: 0,\r
+  /*void*/   clear: function(){\r
     for (var i=0, tli=this.length;i<tli;++i) {\r
       this.pop();\r
     }\r
     this.numberOfItems = 0;\r
-  };\r
-  /*DOMString*/ this.initialize = function(/*DOMString*/ newItem ) {\r
+  },\r
+  /*DOMString*/ initialize: function(/*DOMString*/ newItem ) {\r
     this.clear();\r
     this[0] = newItem;\r
     this.numberOfItems = 1;\r
     return newItem;\r
-  };\r
-  /*DOMString*/ this.getItem = function(/*unsigned long*/ index ) {\r
+  },\r
+  /*DOMString*/ getItem: function(/*unsigned long*/ index ) {\r
     if (index >= this.numberOfItems || index < 0) {\r
       throw (new DOMException(/*DOMException.INDEX_SIZE_ERR*/ 1));\r
     } else {\r
       return (this[index]);\r
     }\r
-  };\r
-  /*DOMString*/ this.insertItemBefore = function(/*DOMString*/ newItem, /*unsigned long*/ index ){\r
+  },\r
+  /*DOMString*/ insertItemBefore: function(/*DOMString*/ newItem, /*unsigned long*/ index ){\r
     if (index >= this.numberOfItems) {\r
       this.appendItem(newItem);\r
     } else {\r
@@ -475,17 +475,17 @@ SVGStringList.prototype = Object._create(Array);
       ++this.numberOfItems;\r
     }\r
     return newItem;\r
-  };\r
-  /*DOMString*/ this.replaceItem = function(/*DOMString*/ newItem, /*unsigned long*/ index ){\r
+  },\r
+  /*DOMString*/ replaceItem: function(/*DOMString*/ newItem, /*unsigned long*/ index ){\r
     if (index >= this.numberOfItems || index < 0) {\r
       throw (new DOMException(/*DOMException.INDEX_SIZE_ERR*/ 1));\r
     } else {\r
       this.splice(index, 1, newItem);\r
     }\r
     return newItem;\r
-  };\r
+  },\r
                   //raises( DOMException, SVGException );\r
-  /*DOMString*/ this.removeItem = function(/*unsigned long*/ index ){\r
+  /*DOMString*/ removeItem: function(/*unsigned long*/ index ){\r
     if (index >= this.numberOfItems || index < 0) {\r
       throw (new DOMException(/*DOMException.INDEX_SIZE_ERR*/ 1));\r
     } else {\r
@@ -493,12 +493,19 @@ SVGStringList.prototype = Object._create(Array);
       --this.numberOfItems;\r
     }\r
     return newItem;\r
-  };\r
-  /*DOMString*/ this.appendItem = function(/*DOMString*/ newItem ){\r
+  },\r
+  /*DOMString*/ appendItem: function(/*DOMString*/ newItem ){\r
     this[this.numberOfItems] = newItem;\r
     ++this.numberOfItems;\r
-  };\r
-}).apply(SVGStringList.prototype);\r
+  }\r
+} )\r
+ .mix( function() { \r
+   this.up("$SVGNumberList");\r
+   this.up("$SVGLengthList");\r
+   this.up("$SVGPointList");\r
+   this.up("$SVGTransformList");\r
+   this.up("$SVGPathSegList");\r
+ } );\r
 \r
 function SVGAnimatedEnumeration() {\r
   /*unsigned short*/ this.baseVal = 0;\r
@@ -518,12 +525,10 @@ function SVGAnimatedNumber() {
   /*float*/ this.baseVal = this.animVal = 0;\r
 };\r
 \r
-function SVGNumberList() {\r
-};\r
-/*SVGUnmberListのメソッドはSVGPathSegListを参照*/\r
+/*SVGUnmberListのメソッドはSVGStringListを参照*/\r
 \r
 function SVGAnimatedNumberList() {\r
-  /*readonly SVGNumberList*/ this.animVal = this.baseVal = new SVGNumberList();\r
+  /*readonly SVGNumberList*/ this.animVal = this.baseVal = base("$SVGStringList").$SVGNumberList.up("$1");\r
 };\r
 /*SVGLengthクラス\r
  *長さを設定する(単位pxに統一する方便として使う)\r
@@ -629,12 +634,11 @@ function SVGAnimatedLength() {
   this.baseVal = new SVGLength();\r
   this.baseVal.unitType = 1;\r
 };\r
-function SVGLengthList() {\r
-};\r
-/*SVGLengthListのメソッドはSVGPathSegListを参照*/\r
+\r
+/*SVGLengthListのメソッドはSVGStringListを参照*/\r
 \r
 function SVGAnimatedLengthList() {\r
-  /*readonly SVGNumberList*/ this.animVal = this.baseVal = new SVGLengthList();\r
+  /*readonly SVGLengthList*/ this.animVal = this.baseVal = base("$SVGStringList").$SVGLengthList.up("$1");;\r
 };\r
 function SVGAngle() {\r
 };\r
@@ -938,7 +942,7 @@ function SVGAnimatedRect() {
   /*unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX : 2\r
 };*/\r
 function SVGStylable() {\r
-  /*readonly attribute SVGAnimatedString*/ this.className = new SVGAnimatedString();\r
+  /*readonly attribute SVGAnimatedString*/ this.className = base("$SVGAnimatedString").up("$1");\r
   ElementCSSInlineStyle.call(this);\r
 };\r
 /*getPresentationAttributeメソッド\r
@@ -957,7 +961,7 @@ function SVGStylable() {
  *SIEでは、もっぱらXLink言語の処理を行う\r
  */\r
 function SVGURIReference() {\r
-  /*readonly SVGAnimatedString*/ this.href = new SVGAnimatedString();\r
+  /*readonly SVGAnimatedString*/ this.href = base("$SVGAnimatedString").up("$1");\r
   this._instance = null; //埋め込みの場合に、読み込んだDOMツリーを結び付けておくプロパティ\r
   this._text = "";\r
   this.addEventListener("DOMAttrModified", function(evt){\r
@@ -1524,7 +1528,7 @@ function SVGFitToViewBox() {
 };\r
 function SVGViewSpec(ele) {\r
   SVGFitToViewBox.apply(this, arguments);\r
-  /*readonly SVGTransformList*/ this.transform = new SVGTransformList();\r
+  /*readonly SVGTransformList*/ this.transform = base("$SVGStringList").$SVGTransformList.up("$1");\r
   /*readonly SVGElement*/       this.viewTarget = ele;\r
   /*readonly DOMString*/        this.viewBoxString = this.preserveAspectRatioString = this.transformString = this.viewTargetString = "";\r
 };\r
@@ -2126,9 +2130,8 @@ SVGPoint.prototype.matrixTransform = function(/*SVGMatrix*/ matrix ) {
   return s;\r
 };\r
 \r
-function SVGPointList() {\r
-};\r
-/*SVGPointListのメソッドはSVGPathSegListを参照*/\r
+\r
+/*SVGPointListのメソッドはSVGStringListを参照*/\r
 \r
 /*SVGMatrix\r
  *行列をあらわすオブジェクト。写像に用いる。以下のように表現できる\r
@@ -2311,16 +2314,15 @@ SVGTransform.prototype = {
   }\r
 };\r
 \r
-function SVGTransformList() {\r
-};\r
-/*SVGTransformListのメソッドはSVGPathSegListを参照*/\r
 \r
-/*SVGTransform*/ SVGTransformList.prototype.createSVGTransformFromMatrix = function(/*SVGMatrix*/ matrix ) {\r
+/*SVGTransformListのメソッドはSVGStringListを参照*/\r
+base("$SVGStringList").$SVGTransformList.mix( {\r
+/*SVGTransform*/ createSVGTransformFromMatrix: function(/*SVGMatrix*/ matrix ) {\r
   var t = new SVGTransform();\r
   t.setMatrix(matrix);\r
   return t;\r
-};\r
-/*SVGTransform*/ SVGTransformList.prototype.consolidate = function() {\r
+},\r
+/*SVGTransform*/ consolidate: function() {\r
   if(this.numberOfItems === 0) {\r
     return null;\r
   } else {\r
@@ -2346,10 +2348,11 @@ function SVGTransformList() {
     m = fm = void 0;\r
     return s;\r
   }\r
-};\r
+}\r
+} );\r
 \r
 function SVGAnimatedTransformList() {\r
-  /*readonly SVGTransformList*/ this.animVal = this.baseVal = new SVGTransformList();\r
+  /*readonly SVGTransformList*/ this.animVal = this.baseVal = base("$SVGStringList").$SVGTransformList.up("$1");\r
 };\r
 function SVGPreserveAspectRatio() {\r
   /*unsigned short*/ this.align = /*SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID*/ 6;\r
@@ -2562,12 +2565,6 @@ function SVGPathSegCurvetoQuadraticSmoothRel() {
   this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL*/ 19;\r
   this.pathSegTypeAsLetter = "t";\r
 };\r
-function SVGPathSegList() {\r
-};\r
-for (var prop in SVGStringList.prototype) { //prototypeのコピーで継承を行う\r
-  SVGNumberList.prototype[prop] = SVGLengthList.prototype[prop] = SVGPointList.prototype[prop] = SVGTransformList.prototype[prop] = SVGPathSegList.prototype[prop] = SVGStringList.prototype[prop];\r
-};\r
-prop = void 0;\r
 \r
 /*documentは引数の変数として登録しておく*/\r
 (function(_doc, _math) {\r
@@ -2708,10 +2705,10 @@ NAIBU._setPaint = function(tar, matrix) {
 function SVGPathElement(_doc) {\r
   this._tar = _doc.createElement("v:shape");\r
   //interface SVGAnimatedPathData\r
-  var sp = SVGPathSegList;\r
-  /*readonly SVGPathSegList*/ this.pathSegList = new sp();\r
+  var sp = base("$SVGStringList").$SVGPathSegList;\r
+  /*readonly SVGPathSegList*/ this.pathSegList = sp.up("$1");\r
   this.animatedPathSegList = this.pathSegList;\r
-  /*readonly SVGPathSegList*/ this.normalizedPathSegList = new sp();\r
+  /*readonly SVGPathSegList*/ this.normalizedPathSegList = sp.up("$1");\r
   sp = _doc = void 0;\r
   this.animatedNormalizedPathSegList = this.normalizedPathSegList;\r
   /*readonly SVGAnimatedNumber*/ this.pathLength = new SVGAnimatedNumber();\r
@@ -3753,7 +3750,7 @@ NAIBU._GenericSVGPolyElement = function (_doc, xclose) {
   this._tar = _doc.createElement("v:shape");\r
   _doc = void 0;\r
   //interface SVGAnimatedPoints\r
-  /*readonly SVGPointList*/   this.animatedPoints = this.points = new SVGPointList();\r
+  /*readonly SVGPointList*/   this.animatedPoints = this.points = base("$SVGStringList").$SVGPointList.up("$1");;\r
   this.addEventListener("DOMAttrModified", function(evt){\r
     var tar = evt.target;\r
     if (evt.attrName === "points") {\r
@@ -4960,14 +4957,14 @@ function SVGFilterPrimitiveStandardAttributes(ele) {
   /*readonly SVGAnimatedLength*/ this.y = new sl();\r
   /*readonly SVGAnimatedLength*/ this.width = new sl();\r
   /*readonly SVGAnimatedLength*/ this.height = new sl();\r
-  /*readonly SVGAnimatedString*/ this.result = new sl();\r
+  /*readonly SVGAnimatedString*/ this.result = base("$SVGAnimatedString").up("$1");\r
   sl = void 0;\r
   };\r
 SVGFilterPrimitiveStandardAttributes.prototype = Object._create(SVGStylable);\r
 \r
 function SVGFEBlendElement() {\r
-  /*readonly SVGAnimatedString*/      this.in1 = new SVGAnimatedString();\r
-  /*readonly SVGAnimatedString*/      this.in2 = new SVGAnimatedString();\r
+  /*readonly SVGAnimatedString*/      this.in1 = base("$SVGAnimatedString").up("$1");\r
+  /*readonly SVGAnimatedString*/      this.in2 = base("$SVGAnimatedString").up("$1");\r
   /*readonly SVGAnimatedEnumeration*/ this.mode = new SVGAnimatedEnumeration();\r
   this._fpsa = SVGFilterPrimitiveStandardAttributes(this);\r
 };\r
@@ -4980,7 +4977,7 @@ function SVGFEBlendElement() {
   /*unsigned short SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN  = 5;*/\r
 \r
 function SVGFEGaussianBlurElement() {\r
-  /*readonly SVGAnimatedString*/ this.in1 = new SVGAnimatedString();\r
+  /*readonly SVGAnimatedString*/ this.in1 = base("$SVGAnimatedString").up("$1");\r
   /*readonly SVGAnimatedNumber*/ this.stdDeviationX = new SVGAnimatedNumber();\r
   /*readonly SVGAnimatedNumber*/ this.stdDeviationY = new SVGAnimatedNumber();\r
   this._fpsa = SVGFilterPrimitiveStandardAttributes(this);\r
@@ -4998,7 +4995,7 @@ function SVGCursorElement() {
 function SVGAElement(_doc) {\r
   this._tar = _doc.createElement("a");\r
   _doc = void 0;\r
-  /*readonly SVGAnimatedString*/ this.target = new SVGAnimatedString();\r
+  /*readonly SVGAnimatedString*/ this.target = base("$SVGAnimatedString").up("$1");\r
   this.target.baseVal = "_self";\r
   this.addEventListener("DOMAttrModified", function(evt){\r
     var tar = evt.target;\r
@@ -5113,7 +5110,7 @@ function SVGAElement(_doc) {
 };\r
 \r
 function SVGViewElement() {\r
-  /*readonly SVGStringList*/ this.viewTarget = new SVGStringList();\r
+  /*readonly SVGStringList*/ this.viewTarget = base("$SVGStringList").up("$1");\r
       //SVGFitToViewBoxのインターフェースを用いる\r
   /*readonly SVGAnimatedRect*/   this.viewBox = new SVGAnimatedRect();\r
   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio();\r
@@ -5968,7 +5965,7 @@ function SVGAnimateMotionElement(){
     /*アニメーション中に変化すべき値をanimValプロパティに入力して、\r
      *baseValと同じような値に設定。\r
      */\r
-    trans.animVal = new SVGTransformList();\r
+    trans.animVal = base("$SVGStringList").$SVGTransformList.up("$1");;\r
     if (trans.baseVal.numberOfItems !== 0) {\r
       trans.animVal.initialize(trans.baseVal.createSVGTransformFromMatrix(trans.baseVal.consolidate().matrix));\r
     } else {\r
@@ -6180,7 +6177,7 @@ function SVGAnimateTransformElement() {
     /*アニメーション中に変化すべき値をanimValプロパティに入力して、\r
      *baseValと同じような値に設定。\r
      */\r
-    trans.animVal = new SVGTransformList();\r
+    trans.animVal = base("$SVGStringList").$SVGTransformList.up("$1");\r
     if (trans.baseVal.numberOfItems !== 0) {\r
       trans.animVal.initialize(trans.baseVal.createSVGTransformFromMatrix(trans.baseVal.getItem(0).matrix));\r
     }\r