I have implemented the necessary changes for fixing the NS4 resize bug
following your suggestions. I ended up in simply changing dyndocument.js and
dynlayer.js.
I have not checked wether these changes affect memory usage, but I have a
feeling that recreating layers will not cause leaking (NS itself destroys
the original layers on resize, and the recycled array is set to "[]" in the
specificCreate function). Maybe somebody with a working leak testsuite will
test this out.
Here's my CVS diff (I don't have CVS access so I could not check in my
changes):
/// START /////////////////////////////
cvs -z9 diff (in directory C:\dynapi\src\lib\dynapi\api\)
cvs server: Diffing .
Index: dyndocument.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/dyndocument.js,v
retrieving revision 1.12
diff -r1.12 dyndocument.js
16a17
> DynAPI.addResizeFunction(this+".resizeHandler()");
58a60,68
> DynDocument.prototype.resizeHandler=function() {
> var w=this.w;
> var h=this.h;
> this.findDimensions();
> if (is.ns4 && (w!=this.w || h!=this.h)) {
> var l=this.children.length;
> for (var i=0;i<l;i++) this.children[i].specificCreate(true);
> };
> };
60d69
< DynAPI.addResizeFunction("if (DynAPI.document)
DynAPI.document.findDimensions();");
Index: dynlayer.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/dynlayer.js,v
retrieving revision 1.51
diff -r1.51 dynlayer.js
29,30c29,30
< DynLayer.prototype.specificCreate=function() {
< if (this.created||!this.parent||this.elm!=null) return;
---
> DynLayer.prototype.specificCreate=function(recreate) {
> if (!recreate&&(this.created||!this.parent||this.elm!=null)) return null;
50c50
< if (recycled && recycled.length>0) {
---
> if (recycled && recycled.length>0 && !recreate) {
53a54
> if (recreate) this.parent.doc.recycled=[];
*****CVS exited normally with code 1*****
/// STOP /////////////////////////////
Best regards,
Christof
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Michael
> Pemberton
> Sent: Sunday, May 27, 2001 2:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [Dynapi-Help] Resize issues...
>
>
> I just made the alterations to the afroapi and they are GREAT.
>
> I suggest that instead we use the following method:
> - use a variable to override the use of recycled layers. this
> would mean 1
> specificCreate method, not 2.
> - I found that there was no need to recreate the children of
> layers. these
> were atomatically recreated when the parent is. That way, we only need to
> recreate the children of the dyndocument.
> - since NS4 is the only browser that requires this redraw, the
> method should
> only be called by ns4.
> - if the browser being used IS ns4, we need to NOT add the
> findDimensions()
> call as a resize event.
>
> other than that, all seems fine for inserting it into the CVS.
> version 2.60,
> here we come : )
>
> Christof Pohl wrote:
>
> > Hi everybody!
> >
> > Using specificCreate didn't work for me when using removeChild before
> > resizing the browser window. specificCreate will try to use the
> layers from
> > the parent.doc.recycled[] array. These "recycled" layers didn't show up
> > after resize as far as I can remember...
> >
> > First of all, I added a function to DynObject, which will call
> > specificRecreate:
> >
> > DynObject.prototype.recreate=function() {
> > if (this.created) this.specificRecreate();
> > var l=this.children.length;
> > for (var i=0;i<l;i++) this.children[i].recreate();
> > };
> > DynObject.prototype.specificRecreate=function() {};
> >
> > The specificRecreate function is identical to specificCreate besides not
> > using recycled layers (it will always use "new Layer()") and paying
> > attention to changed clipping values.
> >
> > Furthermore, I have extended DynDocument:
> >
> > DynDocument.prototype.resizeHandler=function() {
> > // checks for changed width or height in NS4
> > var w=this.getWidth();
> > var h=this.getHeight();
> > this.findDimensions();
> > if (is.ns4 && (w!=this.getWidth() || h!=this.getHeight())) {
> > l=this.children.length;
> > for( var i=0;i<l;i++) this.children[i].recreate();
> > };
> > };
> >
> > Last but not least, I have added this line to the DynDocument()
> constructor:
> >
> > DynAPI.addResizeFunction(this+".resizeHandler()");
> >
> > which will automatically add the resize check to the onresize event.
> >
> > Please note that I'm using a highly customized version of DynAPI for my
> > current projects which is adepted to my needs, so the above
> code might not
> > run out of the box with DynAPI 2.53. If somebody's interested, I will
> > implement NS4 DynLayer recreation for the current DynAPI CVS version on
> > Sunday...
> >
> > Best regards,
> >
> > Christof
> >
> > > Michael Pemberton wrote:
> > >
> > > if you look more closely at the dynlayer code, you'll see
> that there is no
> > > longer a createElement or deleteElement method. These were
> > > removed and replaced
> > > with the more global specificCreate and specificRemove methods.
> > >
> > > I am not sure exactly how the new methods, it may be possible to
> > > use these as
> > > part of the redraw.
> > >
> > > Doug Melvin wrote:
> > >
> > > > that's the stuff..
> > > > Can we use that?
> > > > ----- Original Message -----
> > > > From: "Joachim Lundgren" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Thursday, May 24, 2001 7:06 PM
> > > > Subject: Re: [Dynapi-Help] Resize issues...
> > > >
> > > > > At 2001-05-25 00:46, you wrote:
> > > > > >Your right, a dynlayer is a layer.
> > > > > >I meant that they use no divs or spans, only layers,
> while we do, at
> > > > least
> > > > > >in the widgets.
> > > > > >I was just trying to figure out how come you could resize
> > > their page as
> > > > much
> > > > > >as you want, in NS4.
> > > > > >They don't use any onresize handler that I can see.
> > > > >
> > > > > It isn't needed. When resizing NS4 the browser just
> throws away the
> > > > representation and recreates the HTML part. The different URLs
> > > you all have
> > > > given examples of use document.write() WHILE the page is
> > > loading, not after
> > > > as is done in DynAPI.onLoad().
> > > > >
> > > > > The "fix" that was in the code previously had something along
> > > these lines:
> > > > >
> > > > > DynDocument.resizeHandler = function() {
> > > > > var dyndoc = this.dyndoc;
> > > > > var w = dyndoc.getWidth();
> > > > > var h = dyndoc.getHeight();
> > > > > dyndoc.findDimensions();
> > > > > if(is.ns4 && (w!=dyndoc.getWidth() ||
> h!=dyndoc.getHeight()))
> > > > > dyndoc.recreateAll();
> > > > > if(DynAPI.onResize)
> > > > > DynAPI.onResize();
> > > > > }
> > > > >
> > > > > window.onresize = DynDocument.resizeHandler;
> > > > >
> > > > > DynDocument.prototype.recreateAll = function() {
> > > > > this.setBgColor(this.bgColor);
> > > > > this.setFgColor(this.fgColor);
> > > > > for(var i=0; i<this.children.length; i++) {
> > > > > var child = this.children[i];
> > > > > if(child.created) {
> > > > > child.elm = null; // !!!!!!
> > > > > child.deleteElement();
> > > > > child.createElement();
> > > > > }
> > > > > }
> > > > > }
> > > > >
> > > > > I think the deleteElement method was also fixed to handle
> this case.
> > > > >
> > > > > /Lunna
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Dynapi-Help mailing list
> > > > > [EMAIL PROTECTED]
> > > > > http://lists.sourceforge.net/lists/listinfo/dynapi-help
> > > >
> > > > _______________________________________________
> > > > Dynapi-Help mailing list
> > > > [EMAIL PROTECTED]
> > > > http://lists.sourceforge.net/lists/listinfo/dynapi-help
> > >
> > > --
> > > Michael Pemberton
> > > [EMAIL PROTECTED]
> > > ICQ: 12107010
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Dynapi-Help mailing list
> > > [EMAIL PROTECTED]
> > > http://lists.sourceforge.net/lists/listinfo/dynapi-help
> > >
> >
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
> --
> Michael Pemberton
> [EMAIL PROTECTED]
> ICQ: 12107010
>
>
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help