resize functions that use offsetWidth and -Height stopped working correctly

RESOLVED DUPLICATE of bug 260498

Status

()

RESOLVED DUPLICATE of bug 260498
14 years ago
10 years ago

People

(Reporter: reg.remco, Unassigned)

Tracking

(Depends on: 1 bug, {testcase})

Trunk
x86
Windows 98
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 2 obsolete attachments)

(Reporter)

Description

14 years ago
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
(Reporter)

Comment 1

14 years ago
Created attachment 182059 [details]
screenshot of correctly sized popup
(Reporter)

Comment 2

14 years ago
Created attachment 182060 [details]
screenshot of incorrect sized popup (to illustrate the amount of deviation)
Reporter, is it possible for you to attach a reduced testcase that shows the
behaviour you describe?
any errors in javascript console ?
(Reporter)

Comment 5

14 years ago
(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.
(Reporter)

Comment 6

14 years ago
(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
(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.

(Reporter)

Comment 8

14 years ago
(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.


(Reporter)

Comment 9

14 years ago
Created attachment 184106 [details]
This should show the problem

(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
(Reporter)

Updated

14 years ago
Attachment #182059 - Attachment is obsolete: true
Attachment #182060 - Attachment is obsolete: true
Component: General → Layout
Keywords: testcase
Product: Firefox → Core
Version: unspecified → Trunk
So this is basically bug 260498, right?
Depends on: 260498
Yes, I think so.
QA Contact: general → layout

Updated

10 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 260498
You need to log in before you can comment on or make changes to this bug.