Closed
Bug 292224
Opened 20 years ago
Closed 16 years ago
resize functions that use offsetWidth and -Height stopped working correctly
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 260498
People
(Reporter: reg.remco, Unassigned)
References
(Depends on 1 open bug)
Details
(Keywords: testcase)
Attachments
(2 files, 2 obsolete files)
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b2) Gecko/20050427 Firefox/1.0+
We use the code below to resize a floating div (for a custom user dialog).
It has always worked perfectly (Firefox 1.0.3) but the result is now completely
wrong (to small in height and much to small in width).
Popup.prototype.resize = function(){
if (!this.dialogMinimized){
// set captionTDtitle width to 'auto'
this.captionTDtitle.style.width = 'auto';
// get contentDiv absolute size
var contentDivWidth = this.contentDiv.offsetWidth;
var contentDivHeight = this.contentDiv.offsetHeight;
// get size of caption
var captionWidth = this.captionTDtitle.parentNode.offsetWidth;
var captionHeight = this.caption.offsetHeight;
// scale content
this.content.style.width = (contentDivWidth < captionWidth ? captionWidth
: contentDivWidth) + 'px';
this.content.style.height = (contentDivHeight < captionHeight ?
captionHeight : contentDivHeight) + 'px';
// set captionTDtitle width to 100%
this.captionTDtitle.style.width = '100%';
// scale frame
Popup.scaleFrame(this);
}
}
// scale frame to the content
Popup.scaleFrame = function(ref){
// set frame width & height according to content
ref.frame.style.width = ref.content.offsetWidth + 'px';
ref.frame.style.height = ref.content.offsetHeight + ref.caption.offsetHeight +
'px';
}
Reproducible: Always
Steps to Reproduce:
Create a 'popup' div.
Create elements in the popup
call resize
Actual Results:
The popup sizes much to small
Expected Results:
Until firefox 1.0.3 the popup resizes correctly
This bug came up when trying to fix another bug by installing a nightly build
(050427).
The related bug is 277807
Comment 3•20 years ago
|
||
Reporter, is it possible for you to attach a reduced testcase that shows the
behaviour you describe?
Comment 4•20 years ago
|
||
any errors in javascript console ?
(In reply to comment #4)
> any errors in javascript console ?
No errors at all.
But even if there were errors, javascript console wouldn't show them.
It seems to stop working when you're working with class instances.
(In reply to comment #3)
> Reporter, is it possible for you to attach a reduced testcase that shows the
> behaviour you describe?
It seems that the problem wasn't in the functions posted earlier.
The popup we create is a div containing an iframe created on the fly.
The iframe's onload event is used to set the size of the iframe (and the div).
To get the size of the loaded document we used:
document.documentElement.scrollWidth (and Height)
In Firefox 1.0.2 and 1.0.3 it returns the value we want.
In the nigly build (Gecko/20050427) it returns a completely different value
(much to small).
We now use:
document.body.scrollWidth (and Height)
wich returns the same (wanted) value in all tested versions of firefox.
A quick testcase didn't give me any answers. It seems like it has something to
do with creating the objects on the fly.
I'm however not quite certain if this is a bug now or was a bug before.
If you'd like, I could try to create a testcase this weekend with on the fly
objects.
regards,
Remco
Comment 7•20 years ago
|
||
(In reply to comment #6)
> If you'd like, I could try to create a testcase this weekend with on the fly
> objects.
Remco, any progress with the testcase? A testcase would be much appreciated.
(In reply to comment #7)
> Remco, any progress with the testcase? A testcase would be much appreciated.
Sorry about that, it's still at the top of my todo list though.
(In reply to comment #7)
> Remco, any progress with the testcase? A testcase would be much appreciated.
I first created a document that created elements on the fly then opened a
document in a newly created iframe wich showed the problem.
After some cleaning up it seemed the problem was quite easy to reproduce.
The uploaded testcase shows the difference in the nightly build (050427) that I
used and Firefox 1.0.3.
For document.documentElement.scrollwidth:
- the nightly build returns 192 wich is I think the window's innerwidth
- firefox 1.0.3 returns 208 wich looks like the actual document's width
Regards,
Remco
Attachment #182059 -
Attachment is obsolete: true
Attachment #182060 -
Attachment is obsolete: true
Comment 10•20 years ago
|
||
This changed between 2004-04-30 and 2004-05-01:
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2004-04-30+05%3A00%3A00&maxdate=2004-05-01+10%3A00%3A00&cvsroot=%2Fcvsroot
I think the change happened because of the fix for bug 241694.
Current behavior of Mozilla is probably correct. See bug 57906. Opera8 is doing
the same.
Updated•20 years ago
|
Comment 12•20 years ago
|
||
Yes, I think so.
Updated•19 years ago
|
QA Contact: general → layout
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•