Fixed 3433802. Written by Ed. Carbon WebView doesn't detach native view when removed.
authorrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Sep 2003 22:31:00 +0000 (22:31 +0000)
committerrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Sep 2003 22:31:00 +0000 (22:31 +0000)
        Reviewed by Richard.

        * Carbon.subproj/HIWebView.m:
        (OwningWindowChanged):

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

WebKit/Carbon.subproj/HIWebView.m
WebKit/ChangeLog

index 12f9bf4..ad6b320 100644 (file)
@@ -700,34 +700,41 @@ OwningWindowChanged(
        WindowRef                       oldWindow,
        WindowRef                       newWindow )
 {
-       if ( newWindow )
-       {
+    if ( newWindow ){
         WindowAttributes       attrs;
         
-       OSStatus err = GetWindowProperty(newWindow, NSAppKitPropertyCreator, NSCarbonWindowPropertyTag, sizeof(NSWindow *), NULL, &view->fKitWindow);
-               if ( err != noErr )
-               {
-                       const EventTypeSpec kWindowEvents[] = {
-                { kEventClassWindow, kEventWindowClosed },
-                { kEventClassMouse, kEventMouseMoved },
-                { kEventClassMouse, kEventMouseUp },
-                { kEventClassMouse, kEventMouseDragged },
-                { kEventClassMouse, kEventMouseWheelMoved }
+        OSStatus err = GetWindowProperty(newWindow, NSAppKitPropertyCreator, NSCarbonWindowPropertyTag, sizeof(NSWindow *), NULL, &view->fKitWindow);
+        if ( err != noErr )
+        {
+            const EventTypeSpec kWindowEvents[] = {
+            { kEventClassWindow, kEventWindowClosed },
+            { kEventClassMouse, kEventMouseMoved },
+            { kEventClassMouse, kEventMouseUp },
+            { kEventClassMouse, kEventMouseDragged },
+            { kEventClassMouse, kEventMouseWheelMoved }
             };
-
-                       view->fKitWindow = [[CarbonWindowAdapter alloc] initWithCarbonWindowRef: newWindow takingOwnership: NO disableOrdering:NO carbon:YES];
-               SetWindowProperty(newWindow, NSAppKitPropertyCreator, NSCarbonWindowPropertyTag, sizeof(NSWindow *), &view->fKitWindow);
-               
-                       InstallWindowEventHandler( newWindow, WindowHandler, GetEventTypeCount( kWindowEvents ), kWindowEvents, newWindow, NULL );
-               }
-               
-               [[view->fKitWindow contentView] addSubview:view->fWebView];
-
+            
+            view->fKitWindow = [[CarbonWindowAdapter alloc] initWithCarbonWindowRef: newWindow takingOwnership: NO disableOrdering:NO carbon:YES];
+            SetWindowProperty(newWindow, NSAppKitPropertyCreator, NSCarbonWindowPropertyTag, sizeof(NSWindow *), &view->fKitWindow);
+            
+            InstallWindowEventHandler( newWindow, WindowHandler, GetEventTypeCount( kWindowEvents ), kWindowEvents, newWindow, NULL );
+        }
+        
+        [[view->fKitWindow contentView] addSubview:view->fWebView];
+        
         GetWindowAttributes( newWindow, &attrs );
         view->fIsComposited = ( ( attrs & kWindowCompositingAttribute ) != 0 );
-
-               SyncFrame( view );        
-       }
+        
+        SyncFrame( view );        
+    }
+    else
+    {
+        // Be sure to detach the cocoa view, too.
+        if ( view->fWebView )
+            [view->fWebView removeFromSuperview];
+        
+        view->fKitWindow = NULL; // break the ties that bind
+    }
 }
 
 //-------------------------------------------------------------------------------------
index 85717ba..3373227 100644 (file)
@@ -1,5 +1,14 @@
 2003-09-25  Richard Williamson   <rjw@apple.com>
 
+       Fixed 3433802.  Written by Ed.  Carbon WebView doesn't detach native view when removed.
+
+        Reviewed by Richard.
+
+        * Carbon.subproj/HIWebView.m:
+        (OwningWindowChanged):
+
+2003-09-25  Richard Williamson   <rjw@apple.com>
+
        Fixed 3433488.  Written by Ed.  WebKit doesn't sync window visibility when new webview added to visible window.
 
         Reviewed by Richard.