From 60f3e46dc5c29eb956e4142626e97f337311ac1b Mon Sep 17 00:00:00 2001 From: "hwaara%gmail.com" Date: Fri, 22 Sep 2006 11:05:41 +0000 Subject: [PATCH] Remove hack that was put in place for bug 350018 (which is now fixed). r=surkov --- accessible/src/mac/mozAccessible.mm | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/accessible/src/mac/mozAccessible.mm b/accessible/src/mac/mozAccessible.mm index aab8c1b97a01..b84988cf3f7d 100644 --- a/accessible/src/mac/mozAccessible.mm +++ b/accessible/src/mac/mozAccessible.mm @@ -85,6 +85,10 @@ ObjectOrUnignoredAncestor(id anObject) if ((self = [super init])) { mGeckoAccessible = accessible; mIsExpired = NO; + + // Check for OS X "role skew"; the role constants in nsIAccessible.idl need to match the ones + // in nsRoleMap.h. + NS_ASSERTION([AXRoles[nsIAccessible::ROLE_LAST_ENTRY] isEqualToString:@"ROLE_LAST_ENTRY"], "Role skew in the role map!"); } return self; @@ -198,11 +202,8 @@ ObjectOrUnignoredAncestor(id anObject) if (mIsExpired) return nil; -#ifdef DEBUG_hakan - NSLog (@"(%@ hittested at (untranslated) point (%f, %f))", self, point.x, point.y); -#endif - - // convert from cocoa's coordinate system to gecko's. + // Convert from cocoa's coordinate system to gecko's. According to the docs + // the point we're given is guaranteed to be bottom-left screen coordinates. nsPoint geckoPoint; ConvertCocoaToGeckoPoint (point, geckoPoint); @@ -336,18 +337,16 @@ ObjectOrUnignoredAncestor(id anObject) mGeckoAccessible->GetBounds (&x, &y, &width, &height); NSPoint p = NSMakePoint (x, y); - // the coords we get here should be top-left. - // now, even if we're cocoa, it seems that NSAccessibility - // takes notice that our view |isFlipped| so we should - // just give it flipped coords (if we correspond to a ChildView). + // The coords we get from Gecko are top-left screen coordinates. + // Cocoa wants us to return bottom-left screen coordinates. + // This involves two steps: + // 1. Put the rect in the bottom-left coord space + // 2. Subtract the height of the rect's Y-coordinate, to make the + // the rect's origin (0, 0) be in the bottom-left corner. - // workaround for bug 350018; we have the coords in cocoa coordinates, so flip them. float mainScreenHeight = [[[NSScreen screens] objectAtIndex:0] frame].size.height; - p.y = mainScreenHeight - p.y; + p.y = mainScreenHeight - p.y - height; -#ifdef DEBUG_hakan - NSLog (@"[%@ position] = {%f, %f}", self, p.x, p.y); -#endif return [NSValue valueWithPoint:p]; }