svnno****@sourc*****
svnno****@sourc*****
2009年 9月 19日 (土) 23:20:06 JST
Revision: 1273
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1273
Author: dhrname
Date: 2009-09-19 23:20:06 +0900 (Sat, 19 Sep 2009)
Log Message:
-----------
コメントを増やした
Modified Paths:
--------------
branches/DOM/org/w3c/core.js
branches/DOM/org/w3c/dom/svg.js
Modified: branches/DOM/org/w3c/core.js
===================================================================
--- branches/DOM/org/w3c/core.js 2009-09-19 11:16:19 UTC (rev 1272)
+++ branches/DOM/org/w3c/core.js 2009-09-19 14:20:06 UTC (rev 1273)
@@ -196,8 +196,8 @@
*/
/*Document*/ DOMImplementation.createDocument = function( /*string*/ ns, qname, /*DocumentType*/ doctype) {
try {
- if (ns === "http://www.w3.org/svg/2000") {
- var s = new SVGDocument();
+ if (ns === "http://www.w3.org/svg/2000") { //名前空間がSVGに属しているのであれば、
+ var s = new SVGDocument(); //SVGDocumentを作る(要svg.js)
} else {
var s = new Document();
}
@@ -340,7 +340,7 @@
case 1:
s = new Element();
s.tagName = this.tagName;
- s.attributes._copyNode(this.attributes,false);
+ s.attributes._copyNode(this.attributes,false); //NamedNodeMapのコピーを行う
break;
case 9:
s = new Document();
@@ -465,7 +465,7 @@
if ( arg.ownerElement !== void 0) { //ノードがもはや別の要素で使われている
throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
}
- this[this.length] = arg;
+ this[this.length] = arg; //新たに、argを項目として追加する
this.length += 1;
return null;
}
@@ -589,13 +589,12 @@
};
/*void*/ Element.prototype.setAttributeNS = function( /*string*/ namespaceURI, /*string*/ qualifiedName, /*string*/ value) {
var localName = "";
- if (qualifiedName.indexOf(":") !== -1){
- var p = qualifiedName.split(":");
+ if (qualifiedName.indexOf(":") !== -1){ //もし、:が文字内に含まれていれば
+ var p = qualifiedName.split(":"); //:を区分に切り分けて、配列pに
localName = p[1];
} else {
localName = qualifiedName;
}
-
var n = this.getAttributeNodeNS(namespaceURI, localName); //属性ノードを取得する
if (n) { //該当する属性ノードがあれば、
n.nodeValue = value;
@@ -637,8 +636,8 @@
this.set(this.w, this.h);
}
var tn = this[localName];
- if (tn !== void 0) { //属性が定義されていれば
- if (typeof tn === "string"){//文字列の場合
+ if (tn !== void 0) { //属性が定義されていれば
+ if (typeof tn === "string"){ //文字列の場合
this[tn] = value;
} else if (tn instanceof STLength) { //長さの場合
this[tn].newValueSpecifiedUnits(this[tn].uniType, parseFloat(value));
@@ -925,13 +924,13 @@
case 1:
s = this.createElementNS(importedNode.namespaceURI, importedNode.nodeName);
var attr = importedNode.attributes, att;
- for (var i=0,atli=attr.length;i<atli;i++) { //NamedNodeMapを検索
+ for (var i=0,atli=attr.length;i<atli;i++) { //NamedNodeMapを検索する
att = this.importNode(attr[i], false);
s.attributes.setNamedItemNS(att);
}
if (deep) {
var ch = importedNode.childNodes, n;
- for (var i=0,chli=ch.length;i<chli;i++) {
+ for (var i=0,chli=ch.length;i<chli;i++) { //子ノードを検索して、子供がいれば、importNodeメソッドを再帰的に実行する
n = this.importNode(ch[i],true);
s.appendChild(n);
}
Modified: branches/DOM/org/w3c/dom/svg.js
===================================================================
--- branches/DOM/org/w3c/dom/svg.js 2009-09-19 11:16:19 UTC (rev 1272)
+++ branches/DOM/org/w3c/dom/svg.js 2009-09-19 14:20:06 UTC (rev 1273)
@@ -1976,9 +1976,9 @@
// raises DOMException on setting
/*float*/ this.y = 0;
// raises DOMException on setting
- /*float*/ this.width = 1000;
+ /*float*/ this.width = 0;
// raises DOMException on setting
- /*float*/ this.height = 1000;
+ /*float*/ this.height = 0;
// raises DOMException on setting
return this;
};
@@ -2079,6 +2079,7 @@
SVGDocument.prototype = new Document(); //ノードのプロトタイプチェーンを作って、継承
function SVGSVGElement() {
+ SVGElement.apply(this, arguments);
/* SVGElement,
SVGTests,
SVGLangSpace,
@@ -2099,63 +2100,110 @@
/*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0);
/*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000);
/*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000);
- /*DOMString*/ this.contentScriptType = "application/ecmascript"; //古い仕様では、text/ecmascript
- // raises DOMException on setting
- /*DOMString*/ this.contentStyleType = "text/css";
- // raises DOMException on setting
- /*readonly SVGRect*/ this.viewport = new SVGRect();
- /*readonly float*/ this.pixelUnitToMillimeterX;
- /*readonly float*/ this.pixelUnitToMillimeterY;
- /*readonly float*/ this.screenPixelToMillimeterX;
- /*readonly float*/ this.screenPixelToMillimeterY;
- /*boolean*/ this.useCurrentView = false;
- // raises DOMException on setting
- /*readonly SVGViewSpec*/ this.currentView = new SVGViewSpec();
+ /*DOMString*/ this.contentScriptType = "application/ecmascript"; //古い仕様では、text/ecmascript
+ /*DOMString*/ this.contentStyleType = "text/css";
+ /*readonly SVGRect*/ this.viewport = this.createSVGRect();
+ /*boolean*/ this.useCurrentView = false;
+ /*readonly SVGViewSpec*/ this.currentView = new SVGViewSpec();
/*もし、画像をズームやパンしたとき、どのような倍率になるかを次の行列で示すことができる
*2x3 行列 [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y]
*/
- /*float*/ this.currentScale = 1;
+ /*float*/ this.currentScale = 1;
// raises DOMException on setting
- /*readonly SVGPoint*/ this.currentTranslate = new SVGPoint();
- this.currentTranslate.x = 0; this.currentTranslate.y = 0;
+ /*readonly SVGPoint*/ this.currentTranslate = this.createSVGPoint();
+ this.currentTranslate.x = 0;
+ this.currentTranslate.y = 0;
//SVGFitToViewBoxのインターフェースを用いる
- /*readonly SVGAnimatedRect*/ this.viewBox = this.currentView.viewBox;
+ /*readonly SVGAnimatedRect*/ this.viewBox = this.currentView.viewBox;
/*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = this.currentView.preserveAspectRatio;
+ /*unsigned short*/ this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE;
return this;
};
SVGSVGElement.constructor = SVGElement;
SVGSVGElement.prototype = new SVGElement();
with(SVGSVGElement) {
- /*unsigned long*/ suspendRedraw = function( in unsigned long max_wait_milliseconds );
- /*void*/ unsuspendRedraw = function( in unsigned long suspend_handle_id )
+ /*unsigned long*/ suspendRedraw = function(/*unsigned long*/ max_wait_milliseconds ){
+
+ }
+ /*void*/ unsuspendRedraw = function(/*unsigned long*/ suspend_handle_id ){
+
+ }
//raises( DOMException );
- /*void*/ unsuspendRedrawAll = function( );
- /*void*/ forceRedraw = function( );
- /*void*/ pauseAnimations = function( );
- /*void*/ unpauseAnimations = function( );
- /*boolean*/ animationsPaused = function( );
- /*float*/ getCurrentTime = function( );
- /*void*/ setCurrentTime = function( in float seconds );
- /*StaticNodeList*/ getIntersectionList = function( in SVGRect rect, in SVGElement referenceElement );
- /*StaticNodeList*/ getEnclosureList = function( in SVGRect rect, in SVGElement referenceElement );
- /*boolean*/ checkIntersection = function( in SVGElement element, in SVGRect rect );
- /*boolean*/ checkEnclosure = function( in SVGElement element, in SVGRect rect );
- /*void*/ deselectAll = function( );
- /*SVGNumber*/ createSVGNumber = function( );
- /*SVGLength*/ createSVGLength = function( );
- /*SVGAngle*/ createSVGAngle = function( );
- /*SVGPoint*/ createSVGPoint = function( );
- /*SVGMatrix*/ createSVGMatrix = function( );
- /*SVGRect*/ createSVGRect = function( );
- /*SVGTransform*/ createSVGTransform = function( );
- /*SVGTransform*/ createSVGTransformFromMatrix = function( in SVGMatrix matrix );
+ /*void*/ unsuspendRedrawAll = function(){
+
+ }
+ /*void*/ forceRedraw = function(){
+
+ }
+ /*void*/ pauseAnimations = function(){
+
+ }
+ /*void*/ unpauseAnimations = function(){
+
+ }
+ /*boolean*/ animationsPaused = function(){
+
+ }
+ /*float*/ getCurrentTime = function(){
+
+ }
+ /*void*/ setCurrentTime = function( in float seconds ){
+
+ }
+ /*StaticNodeList*/ getIntersectionList = function( in SVGRect rect, in SVGElement referenceElement ){
+
+ }
+ /*StaticNodeList*/ getEnclosureList = function( in SVGRect rect, in SVGElement referenceElement ){
+
+ }
+ /*boolean*/ checkIntersection = function( in SVGElement element, in SVGRect rect ){
+
+ }
+ /*boolean*/ checkEnclosure = function( in SVGElement element, in SVGRect rect ){
+
+ }
+ /*void*/ deselectAll = function(){
+
+ }
+ /*SVGNumber*/ createSVGNumber = function(){
+ var s = new SVGNumber();
+ s.value = 0;
+ return s;
+ }
+ /*SVGLength*/ createSVGLength = function(){
+ var s = new SVGLength(0);
+ return s;
+ }
+ /*SVGAngle*/ createSVGAngle = function(){
+ //SVGAngleは軽量化のため、作成していない
+ }
+ /*SVGPoint*/ createSVGPoint = function(){
+ var s = new SVGPoint();
+ return s;
+ }
+ /*SVGMatrix*/ createSVGMatrix = function(){
+ var s = new SVGMatrix(1,0,0,1,0,0);
+ return s;
+ }
+ /*SVGRect*/ createSVGRect = function(){
+ var s = new SVGRect();
+ return s;
+ }
+ /*SVGTransform*/ createSVGTransform = function(){
+ var s = this.createSVGTransformFromMatrix(this.createSVGMatrix());
+ return s;
+ }
+ /*SVGTransform*/ createSVGTransformFromMatrix = function(/*SVGMatrix*/ matrix )){
+ var s = new SVGTransform();
+ s.setMatrix(matrix);
+ return s;
+};
/*interface SVGZoomAndPan*/
// Zoom and Pan Types
- const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0;
- const unsigned short SVG_ZOOMANDPAN_DISABLE = 1;
- const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2;
- unsigned short zoomAndPan;
- // raises DOMException on setting
+SVGZoomAndPan = {
+ /*const unsigned short*/ SVG_ZOOMANDPAN_UNKNOWN : 0,
+ /*const unsigned short*/ SVG_ZOOMANDPAN_DISABLE : 1,
+ /*const unsigned short*/ SVG_ZOOMANDPAN_MAGNIFY : 2
};
function SVGFitToViewBox() {
/*readonly SVGAnimatedRect*/ this.viewBox = new SVGAnimatedRect();
@@ -2177,39 +2225,46 @@
SVGViewSpec.constructor = SVGFitToViewBox;
SVGViewSpec.prototype = new SVGFitToViewBox();
- interface SVGGElement :
+function SVGGElement() {
+ SVGElement.apply(this, arguments);
+ return this;
+};
+SVGGElement.constructor = SVGElement;
+SVGGElement.prototype = new SVGElement();
+
+function SVGDefsElement() {
+ SVGElement.apply(this, arguments);
+ return this;
+};
+SVGDefsElement.constructor = SVGElement;
+SVGDefsElement.prototype = new SVGElement();
+
+function SVGDescElement() {
+ SVGElement.apply(this, arguments);
+ return this;
+}
+SVGDescElement.constructor = SVGElement;
+SVGDescElement.prototype = new SVGElement();
+
+function SVGTitleElement() {
+ SVGElement.apply(this, arguments);
+ try {
+ this.ownerDocument.title = this.firstChild.nodeValue;
+ } catch(e){}
+ return this;
+}
+SVGTitleElement.constructor = SVGElement;
+SVGTitleElement.prototype = new SVGElement();
+
+function SVGSymbolElement() {
+ SVGElement.apply(this, arguments);
+ return this;
+}
+SVGDefsElement.constructor = SVGElement;
+SVGDefsElement.prototype = new SVGElement();
+
+function SVGUseElement :
SVGElement,
- SVGTests,
- SVGLangSpace,
- SVGExternalResourcesRequired,
- SVGStylable,
- SVGTransformable,
- events::EventTarget {};
- interface SVGDefsElement :
- SVGElement,
- SVGTests,
- SVGLangSpace,
- SVGExternalResourcesRequired,
- SVGStylable,
- SVGTransformable,
- events::EventTarget {};
- interface SVGDescElement :
- SVGElement,
- SVGLangSpace,
- SVGStylable {};
- interface SVGTitleElement :
- SVGElement,
- SVGLangSpace,
- SVGStylable {};
- interface SVGSymbolElement :
- SVGElement,
- SVGLangSpace,
- SVGExternalResourcesRequired,
- SVGStylable,
- SVGFitToViewBox,
- events::EventTarget {};
- interface SVGUseElement :
- SVGElement,
SVGURIReference,
SVGTests,
SVGLangSpace,