Closed Bug 402176 Opened 17 years ago Closed 17 years ago

sanitize/optimize Cocoa nsIWidget move and resize implementations

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jaas, Assigned: jaas)

Details

Attachments

(1 file)

Cocoa's nsIWidget move and resize methods are not well implemented. We should fix all of it with the following goals in mind:

1. Don't do drawing we don't need to. No need to redraw the parent widget.
2. Don't call setFrame more often than we need to.
3. Clean up the code in general. It is just badly written and hard to understand now.
4. More bulletproofing (null checks) would be nice. Obviously we can't move or resize a widget that doesn't exist.
Attached patch fix v1.0Splinter Review
Attachment #287071 - Flags: review?(vladimir)
Note that this is not an attempt to "fix" 355177 - this is simply a step in the right direction should we choose to follow up on that bug.
Comment on attachment 287071 [details] [diff] [review]
fix v1.0


>Index: widget/src/cocoa/nsCocoaWindow.mm
>===================================================================

> NS_IMETHODIMP nsCocoaWindow::Move(PRInt32 aX, PRInt32 aY)

>+  // The point we have is in Gecko coordinates (origin top-left). Convert
>+  // it to Cocoa ones (origin bottom-left).
>+  NSPoint coord = {aX, FlippedScreenY(aY)};
>+  [mWindow setFrameTopLeftPoint:coord];
>+

Hm, is this right?  I realize this is what the old code did, but it seems weird to me -- if we flip the Y coord, why do we call setFrameTopLeftPoint?
I found that odd too and tried to not do that, but if you don't flip the y coord it breaks a lot of things. Windows go to the wrong side of the screen. I had planned to dig into that more after this.
Comment on attachment 287071 [details] [diff] [review]
fix v1.0

Ugh, well, the stuff fixed by this patch is good in any case, but we should figure out the coordinate system stuff.
Attachment #287071 - Flags: review?(vladimir) → review+
Attachment #287071 - Flags: superreview?(roc)
Comment on attachment 287071 [details] [diff] [review]
fix v1.0

@@ -1,8 +1,9 @@
+
 /* -*- Mode: objc; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */

Eliminate
Attachment #287071 - Flags: superreview?(roc) → superreview+
Attachment #287071 - Flags: approval1.9?
This is important enough to block I think.
Flags: blocking1.9+
Attachment #287071 - Flags: approval1.9?
landed on trunk
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: