Closed Bug 224760 Opened 21 years ago Closed 21 years ago

window.moveTo works only once at identical position

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.6beta

People

(Reporter: ngsheaufeng, Assigned: danm.moz)

References

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 window.moveTo function only work for the first time Mozilla is instantiated. Subsequent refresh to the same page will not work. Such behavior does not happen in IE. Reproducible: Always Steps to Reproduce: 1. Add the following code to the a test page: <script language="Javascript"> <!-- window.moveTo(0,0) window.resizeTo(screen.width,screen.height) //--> </script> 2. Open Mozilla without occupying full screen and run the test page. 3. Resize the browser, move to another location then refresh the page to produce abnormal behavior. Actual Results: When run the tes page for the first time, Mozilla will be moved to the top left corner of the window and then resize to full screen. After resize the browser to smaller window and move to another place, refresh the page will only adjust the window to full screen size without first move to the top left corner. Expected Results: Should be consistently move to top left corner and size to full screen. Test page will behavior correctly and consistently with IE.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached file moveTo testcase
Slightly less annoying and more instructive testcase. It shows that a window can be moved to a given position only once. Afterward, move the window by hand and click all you like on the "move" button. It does nothing until you specify a different position. (Note there's no similar problem with sizing.) There's widget code that simply skips the OS call to move the window if it believes the window is already in that position. This implies that the widget position isn't being updated when the user drags the window by hand.
I s'pose this one's mine.
Assignee: general → danm-moz
See also bug 225432, which might be a duplicate.
Component: Browser-General → DOM Level 0
Blocks: 225432
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.6beta
Sure 'nuf, this fixes the bug. Before this patch the member variable copy of window bounds was updated once when the window was moved via script, and not updated at all when the window was moved by mouse. With this patch it's updated once if by mouse, twice if by script. It'd be cleaner to also remove the now seemingly redundant immediate update of mBounds in the "if by script" method (line 1992) and that does not seem to cause problems. I'm not averse to doing that as well but it does also suggest a similar change in the window sizing code. That's messier and I'm afraid of it. There are several places where comments (in code that predates bugzilla patches) suggest the value should be updated immediately, and then there's the mLastSize stuff that looks like a hack around a layout/drawing problem caused by mBounds being immediately updated. The specific bug for which mLastSize was checked in no longer returns if it's backed out, which really only adds to the confusion. So anyway, this could probably stand cleaning up but that's not what this patch does. By the way as far as I can tell, we've had this bug forever.
Attachment #135424 - Flags: superreview?(bryner)
Attachment #135424 - Flags: review?(ere)
Comment on attachment 135424 [details] [diff] [review] update bounds member variable when window is moved for any reason Oh goody, it seems to fix bug 223901 too (quite logically). r=ere
Attachment #135424 - Flags: review?(ere) → review+
Blocks: 223901
Attachment #135424 - Flags: superreview?(bryner) → superreview+
checked in to 1.6b trunk
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Summary: window.moveTo not working properly → window.moveTo works only once at identical position
*** Bug 225432 has been marked as a duplicate of this bug. ***
*** Bug 223901 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: