|
From: Jordi M. <do...@us...> - 2002-01-04 14:25:24
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/api
In directory usw-pr-cvs1:/tmp/cvs-serv19253/src/lib/dynapi/api
Modified Files:
dyndocument.js dynlayer.js
Log Message:
Many bugfixes and improvements.
Index: dyndocument.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/dyndocument.js,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** dyndocument.js 2001/11/01 10:40:42 1.19
--- dyndocument.js 2002/01/04 14:25:18 1.20
***************
*** 15,19 ****
this.elm.lyrobj=this;
this.doc.lyrobj=this;
- this.findDimensions();
}
DynDocument.prototype = new DynObject();
--- 15,18 ----
***************
*** 23,28 ****
--- 22,40 ----
};
DynDocument.prototype.specificCreate=function() {
+ this.findDimensions();
+ // Following Silly Patch allows sharing of assignChildren() between DynDocument and DynLayer (IE only)
+ if(is.ie) this.elm.all = this.doc.all
+ this.assignChildren();
DynAPI.addResizeFunction(this+".resizeHandler()");
};
+ DynDocument.prototype._Old_addChild=DynDocument.prototype.addChild;
+ DynDocument.prototype.addChild=function(c) {
+ if(!this.created) this.doc.write(c.getOuterHTML());
+ return this._Old_addChild(c);
+ };
+ DynDocument.prototype.addInflowChild=function(c) {
+ if(!this.created) this.doc.write(c.getOuterHTML(true));
+ return this._Old_addChild(c);
+ };
DynDocument.prototype.specificRemove=function() {
this.elm=null;
***************
*** 49,53 ****
else this.h=this.h-2;
};
- return;
};
DynDocument.prototype.setBgColor = function(color) {
--- 61,64 ----
***************
*** 77,79 ****
}
};
! DynAPI.addLoadFunction("DynAPI.document = DynAPI.addChild(new DynDocument(self));DynAPI.document.all = DynObject.all;")
--- 88,94 ----
}
};
! //If DynLayer was included before DynDocument
! if(DynLayer)DynDocument.prototype.assignChildren=DynLayer.prototype.assignChildren;
!
! DynAPI.document = DynAPI.addChild(new DynDocument(self));
! DynAPI.document.all = DynObject.all;
Index: dynlayer.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/dynlayer.js,v
retrieving revision 1.71
retrieving revision 1.72
diff -C2 -r1.71 -r1.72
*** dynlayer.js 2001/11/11 16:25:18 1.71
--- dynlayer.js 2002/01/04 14:25:18 1.72
***************
*** 28,32 ****
DynLayer.prototype.isDynLayer = true;
DynLayer.prototype.specificCreate=function() {
! if (!this.parent||this.elm) return;
if (is.ns6) {
var parentElement=(this.parent.isDynLayer)?this.parent.elm:this.parent.doc.body;
--- 28,33 ----
DynLayer.prototype.isDynLayer = true;
DynLayer.prototype.specificCreate=function() {
! // Check for this.wasBuiltInline allows inflow layers to skip recreation onResize (NS4)
! if (!this.parent||this.elm||this.wasBuiltInline) return;
if (is.ns6) {
var parentElement=(this.parent.isDynLayer)?this.parent.elm:this.parent.doc.body;
***************
*** 94,102 ****
child.assignChildren();
if (child.z) child.css.zIndex=child.z;
}
} else if(is.ns4) {
for (var i=0; i<l; i++) {
var child=this.children[i];
! var elm=this.doc.layers[child.id];
child.elm=elm;
child.css=elm;
--- 95,106 ----
child.assignChildren();
if (child.z) child.css.zIndex=child.z;
+ if (child.w==null && child.getContentWidth()>0) child.setWidth(child.getContentWidth(), false);
+ if (child.h==null && child.getContentHeight()>0) child.setHeight(child.getContentHeight(), false);
}
} else if(is.ns4) {
for (var i=0; i<l; i++) {
var child=this.children[i];
! // In order to allow inline dynlayers, which are wrapped by a ILAYER. See getOuterHTML()
! var elm=this.doc.layers[child.id]||this.doc.layers[child.id+"C"].document.layers[child.id];
child.elm=elm;
child.css=elm;
***************
*** 108,114 ****
--- 112,123 ----
child.assignChildren();
if (child.z) child.css.zIndex=child.z;
+ if (child.w==null && child.getContentWidth()>0) child.setWidth(child.getContentWidth(), false);
+ if (child.h==null && child.getContentHeight()>0) child.setHeight(child.getContentHeight(), false);
}
}
};
+ //If DynDocument was included before DynLayer
+ if(DynDocument)DynDocument.prototype.assignChildren=DynLayer.prototype.assignChildren;
+
DynLayer.prototype.specificRemove=function() {
if (is.def && this.elm) {
***************
*** 118,132 ****
}
else if (is.ns4 && this.elm) {
! if (!this.parent.doc.recycled) this.parent.doc.recycled=[];
! this.parent.doc.recycled[this.parent.doc.recycled.length]=this.elm;
this.elm.visibility="hide";
}
this.frame = null;
- this.bgImage = null;
- this.bgColor = null;
- this.html = null;
- this.z = null;
- this.w = null;
- this.h = null;
this.elm = null;
this.doc = null;
--- 127,139 ----
}
else if (is.ns4 && this.elm) {
! if(!this.wasBuiltInline) {
! // These can't be reused
! if (!this.parent.doc.recycled) this.parent.doc.recycled=[];
! this.parent.doc.recycled[this.parent.doc.recycled.length]=this.elm;
! }
! this.wasBuiltInline = false
this.elm.visibility="hide";
}
this.frame = null;
this.elm = null;
this.doc = null;
***************
*** 141,158 ****
};
if (is.def) {
! DynLayer.prototype.getOuterHTML=function() {
var s='<div id="'+this.id+'" style="';
if (this.visible==false) s+=' visibility:hidden;';
! if (this.x!=null) s+=' left:'+this.x+'px;';
! if (this.y!=null) s+=' top:'+this.y+'px;';
if (this.w!=null) s+=' width:'+this.w+'px;';
if (this.h!=null) s+=' height:'+this.h+'px;';
if (this.clip) s+=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);';
else if (this.w!=null && this.h!=null) s+=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);';
! if (this.z) s+=' z-index='+this.z+';';
if (this.bgImage!=null) s+=' background-image:url('+this.bgImage+');';
if (this.bgColor!=null) s+=' background-color:'+this.bgColor+';';
if (is.ie55 && this.bgImage==null && this.html==null) s+=' background-image:url('+DynAPI.librarypath+'dynapi/images/common/transparent.gif);';
! s+=' position:absolute;">';
if (this.html!=null) s+=this.html;
for (var i=0; i<this.children.length; i++) s+=this.children[i].getOuterHTML();
--- 148,166 ----
};
if (is.def) {
! DynLayer.prototype.getOuterHTML=function(inflow) {
var s='<div id="'+this.id+'" style="';
if (this.visible==false) s+=' visibility:hidden;';
! if (!inflow && this.x!=null) s+=' left:'+this.x+'px;';
! if (!inflow && this.y!=null) s+=' top:'+this.y+'px;';
if (this.w!=null) s+=' width:'+this.w+'px;';
if (this.h!=null) s+=' height:'+this.h+'px;';
if (this.clip) s+=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);';
else if (this.w!=null && this.h!=null) s+=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);';
! if (this.z!=null) s+=' z-index='+this.z+';';
if (this.bgImage!=null) s+=' background-image:url('+this.bgImage+');';
if (this.bgColor!=null) s+=' background-color:'+this.bgColor+';';
if (is.ie55 && this.bgImage==null && this.html==null) s+=' background-image:url('+DynAPI.librarypath+'dynapi/images/common/transparent.gif);';
! if(!inflow) s+=' position:absolute;'; else s+=' position:relative;';
! s+=' overflow:hidden">';
if (this.html!=null) s+=this.html;
for (var i=0; i<this.children.length; i++) s+=this.children[i].getOuterHTML();
***************
*** 162,175 ****
};
} else if (is.ns4) {
! DynLayer.prototype.getOuterHTML=function() {
! var s='\n<layer id="'+this.id+'"';
if (this.visible==false) s+=' visibility="hide"';
! if (this.x!=null) s+=' left='+this.x;
! if (this.y!=null) s+=' top='+this.y;
if (this.w!=null) s+=' width='+this.w;
if (this.h!=null) s+=' height='+this.h;
if (this.clip) s+=' clip="'+this.clip[3]+','+this.clip[0]+','+this.clip[1]+','+this.clip[2]+'"';
else if (this.w!=null && this.h!=null) s+=' clip="0,0,'+this.w+','+this.h+'"';
! if (this.z) s+=' zIndex='+this.z;
if (this.bgImage!=null) s+=' background="'+this.bgImage+'"';
if (this.bgColor!=null) s+=' bgcolor="'+this.bgColor+'"';
--- 170,194 ----
};
} else if (is.ns4) {
! DynLayer.prototype.getOuterHTML=function(inflow) {
! var s='\n'
! if(inflow) {
! // These should not be recreated on resize
! this.wasBuiltInline = true
!
! s+= '<ilayer id="'+this.id+'C"'
! if (this.w!=null) s+=' width='+this.w+'';
! if (this.h!=null) s+=' height='+this.h+'';
! s+= '">'
! }
!
! s+='<layer id="'+this.id+'"';
if (this.visible==false) s+=' visibility="hide"';
! if (!inflow && this.x!=null) s+=' left='+this.x;
! if (!inflow && this.y!=null) s+=' top='+this.y;
if (this.w!=null) s+=' width='+this.w;
if (this.h!=null) s+=' height='+this.h;
if (this.clip) s+=' clip="'+this.clip[3]+','+this.clip[0]+','+this.clip[1]+','+this.clip[2]+'"';
else if (this.w!=null && this.h!=null) s+=' clip="0,0,'+this.w+','+this.h+'"';
! if (this.z!=null) s+=' zIndex='+this.z;
if (this.bgImage!=null) s+=' background="'+this.bgImage+'"';
if (this.bgColor!=null) s+=' bgcolor="'+this.bgColor+'"';
***************
*** 178,181 ****
--- 197,202 ----
for (var i=0; i<this.children.length; i++) s+=this.children[i].getOuterHTML();
s+='</layer>';
+
+ if(inflow) s+="</ilayer>\n"
return s;
};
***************
*** 222,226 ****
if (is.ns4) this.css.pageX=x;
if (is.ie) {
! if (this.isChild) this.setX(this.parent.getPageX()-x);
else this.setX(x);
}
--- 243,247 ----
if (is.ns4) this.css.pageX=x;
if (is.ie) {
! if (this.isChild) this.setX(x-this.parent.getPageX());
else this.setX(x);
}
***************
*** 232,236 ****
if (is.ns4) this.css.pageY=y;
if (is.ie) {
! if (this.isChild) this.setY(this.parent.getPageY()-y);
else this.setY(y);
}
--- 253,257 ----
if (is.ns4) this.css.pageY=y;
if (is.ie) {
! if (this.isChild) this.setY(y-this.parent.getPageY());
else this.setY(y);
}
***************
*** 369,381 ****
//if this.elm.offsetWidth/Height is not accessed, then ie5mac will return NaN.
else if (is.ie) {
! if (is.platform=="mac") this.elm.offsetWidth=this.elm.offsetWidth;
! return parseInt(this.elm.scrollWidth);
}
else {
var tw = this.elm.style.width;
! this.elm.style.width = "auto";
! var w = this.elm.offsetWidth;
! this.elm.style.width = tw;
! return w;
}
};
--- 390,402 ----
//if this.elm.offsetWidth/Height is not accessed, then ie5mac will return NaN.
else if (is.ie) {
! if (is.platform=="mac") this.elm.offsetWidth=this.elm.offsetWidth;
! return parseInt(this.elm.scrollWidth);
}
else {
var tw = this.elm.style.width;
! this.elm.style.width = "auto";
! var w = this.elm.offsetWidth;
! this.elm.style.width = tw;
! return w;
}
};
***************
*** 393,399 ****
var th = this.elm.style.height;
this.elm.style.height = "auto";
! var h = this.elm.offsetHeight;
! this.elm.style.height = th;
! return h;
}
}
--- 414,420 ----
var th = this.elm.style.height;
this.elm.style.height = "auto";
! var h = this.elm.offsetHeight;
! this.elm.style.height = th;
! return h;
}
}
|