Reviewed by Adele.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2007 05:36:21 +0000 (05:36 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2007 05:36:21 +0000 (05:36 +0000)
        <rdar://problem/4619663> REGRESSION (NativePopup): Popup menu doesn't draw at the correct vertical position (9816)

        * platform/mac/PopupMenuMac.mm:
        (WebCore::PopupMenu::show): Make a temporary dummy view with the
        passed in rect, since AppKit will use the view bounds to determine
        what area to exclude when popping up a menu moved to the top of
        the screen.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20006 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/mac/PopupMenuMac.mm

index 4996704f9fd61e9c09baffb1bb14f3edc3ab603a..10a5a8b0ffc3dc709a9479ddd747092027789176 100644 (file)
@@ -1,3 +1,15 @@
+2007-03-06  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Adele.
+
+        <rdar://problem/4619663> REGRESSION (NativePopup): Popup menu doesn't draw at the correct vertical position (9816)
+        
+        * platform/mac/PopupMenuMac.mm:
+        (WebCore::PopupMenu::show): Make a temporary dummy view with the
+        passed in rect, since AppKit will use the view bounds to determine
+        what area to exclude when popping up a menu moved to the top of
+        the screen.
+
 2007-03-06  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Maciej Stachowiak.
index a7c2ff3fc9e2ec8738f1bb5386f1d9be493b65ed..ef631913efa1b41ca797fe54b2a120216281887b 100644 (file)
@@ -117,7 +117,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
     
     NSPoint location;
     NSFont* font = client()->clientStyle()->font().primaryFont()->getNSFont();
-    
+
     // These values were borrowed from AppKit to match their placement of the menu.
     const int popOverHorizontalAdjust = -10;
     const int popUnderHorizontalAdjust = 6;
@@ -142,9 +142,15 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
     NSEvent* event = [frame->eventHandler()->currentNSEvent() retain];
     
     RefPtr<PopupMenu> protector(this);
+
+    RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:r]);
+    [view addSubview:dummyView.get()];
+    location = [dummyView.get() convertPoint:location fromView:view];
     
     frame->willPopupMenu(menu);
-    wkPopupMenu(menu, location, roundf(NSWidth(r)), view, index, font);
+    wkPopupMenu(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font);
+
+    [dummyView.get() removeFromSuperview];
 
     if (client()) {
         int newIndex = [m_popup.get() indexOfSelectedItem];