Closed
Bug 67546
Opened 24 years ago
Closed 3 years ago
window.sizeToContent sometimes fails if width >> height
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
RESOLVED
INACTIVE
Future
People
(Reporter: martin.honnen, Unassigned)
Details
(Keywords: dom0)
Attachments
(2 files)
I played around with window.sizeToContent() but it often fails as the following page which creates a randomly sized image as the content demonstrates <HTML> <HEAD> </HEAD> <BODY ONLOAD="window.sizeToContent(); setTimeout('location.reload()', 3000)"> <SCRIPT> var w = Math.floor(Math.random() * (screen.width - 150)) + 100; var h = Math.floor(Math.random() * (screen.height - 250)) + 100; document.write('<IMG SRC="http://www.mozilla.org/images/mozilla-banner.gif" WIDTH="' + w + '" HEIGHT="' + h + '">'); </SCRIPT> </BODY> </HTML> It looks as if the failure occurs more often when the image is much wider than high.
Reporter | ||
Comment 1•24 years ago
|
||
Reporter | ||
Comment 2•24 years ago
|
||
I forgot to tell that I filed this on DOM level 0 as the window object is DOM level 0. The sizeToContent method however is not DOM level 0 so please reassign if necessary
Comment 3•24 years ago
|
||
Reporter, testcase works perfectly for me (linux build 2001-01-30-10). What build/OS are you using?
Reporter | ||
Comment 4•24 years ago
|
||
M07 on Windows 95.
Comment 5•24 years ago
|
||
Reassigning, Ben, please reassign this to the right owner if it aint you.
Assignee: jst → ben
Comment 6•24 years ago
|
||
the testcase worksforme using a cvs build from around 4:15pm today on win2k.
Comment 7•24 years ago
|
||
I see this problem on 2001 022311. By the way, I don't think untrusted webpages should be allowed to call this function -- see bug 60323.
Summary: window.sizeToContent fails to size the window to the content → window.sizeToContent sometimes fails if width >> height
Updated•24 years ago
|
OS: other → Windows 95
Comment 8•23 years ago
|
||
Cc'ing Dan for comment. It seems like we sizeToContent() first and then change the img width/height, in which case it (expectedly) won't work.
Comment 9•23 years ago
|
||
Bug still exist, and I think it's a showstopper! Moz 2001062904 under win95
Comment 11•22 years ago
|
||
Setting target milestone to 'Future' since 'mozilla1.1alpha' has already passed.
Target Milestone: mozilla1.1alpha → Future
Comment 12•22 years ago
|
||
Since not much has happened in this bug for quite some time, I'm submitting a democase. From the beginning, I have assumed that appearance, presence of scrollbars was why people were talking about "failure", "often fails" and was why this bugfile was filed in the first place.
Comment 13•22 years ago
|
||
This demo is highly configurable. One can set all of the relevant values: Delay, StepOfSizeIncrementOrDecrement, etc... including the height attribute of the image. Only WindowResizingBorderWidth should not be changed. One can also remove the <p> </p> around the image element like in the initial testcase report but this does not change anything important in the current demo. The initial screenX/screenY values of 37 from the moveTo(37, 37) are just totally arbitrary values and therefore can be changed. I even tried with an height="100" attribute and IMO this demo convincingly show that sizeToContent() works even when width >> height. When this demo starts, if the horizontal scrollbar is already present, then scrollbars will be present in the first 2 passes (narrow-to-wide and wide-to-narrow). It seems that the first sizeToContent() call never resizes accordingly the window... so the horizontal scrollbar is maintained active, then creates a vertical scrollbar, etc... The bug is somewhere else in my opinion. The sizeToContent() must be calling another function which would be causing the scrollbar behavior. I'm convinced this bug depends on another - already filed - bug. Also, some kind of bad timing might be happening which would generate the creation of scrollbars before the actual call of sizeToContent. XP Pro SP1, Moz. 1.2.1 build 20021130, scr. res. 1024x768
Comment 14•21 years ago
|
||
Workaround: Calling sizeToContent repeatedly, makes the height increasingly closer to the desired result. Calling it a 100 times seems to do the trick :) for( var i = 0; i < 100; i++) window.sizeToContent(); Hey - don't shoot me, I KNOW it's butt ugly
Comment 15•19 years ago
|
||
still exists in: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050618 Firefox/1.0+
Comment 17•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Comment 18•3 years ago
|
||
This is only exposed to chrome callers these days and should maybe be removed...
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•