Reviewed by Adele.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Oct 2006 00:54:14 +0000 (00:54 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Oct 2006 00:54:14 +0000 (00:54 +0000)
        - preparations for making more code C++

        * WebKitPrefix.h: Fixed ifdef so that C++ files get all the precompiled stuff
        that non-C++ files get.

        * Misc/WebKitLogging.h:
        * Misc/WebKitSystemBits.h:
        * Misc/WebLocalizableStrings.h:
        * WebCoreSupport/WebSystemInterface.h:
        Added extern "C".

        * Misc/WebNSViewExtras.h:
        * WebView/WebDataSource.m: (addTypesFromClass):
        * WebView/WebFrameView.m: (addTypesFromClass):
        Eliminated use of the identifier "class".

        * WebView/WebView.m: (-[WebView _goToItem:withLoadType:]): Added a type cast.

        * Plugins/WebBaseNetscapePluginView.m: Added lots of type casts.

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

WebKit/ChangeLog
WebKit/Misc/WebKitLogging.h
WebKit/Misc/WebKitSystemBits.h
WebKit/Misc/WebLocalizableStrings.h
WebKit/Misc/WebNSViewExtras.h
WebKit/Plugins/WebBaseNetscapePluginView.m
WebKit/WebCoreSupport/WebSystemInterface.h
WebKit/WebKitPrefix.h
WebKit/WebView/WebDataSource.m
WebKit/WebView/WebFrameView.m
WebKit/WebView/WebView.m

index 84e84395f68919507ac53f3d21b45568176c5261..e47562c12a1434f340ef6bd2073580e06e06f579 100644 (file)
@@ -1,3 +1,27 @@
+2006-10-11  Darin Adler  <darin@apple.com>
+
+        Reviewed by Adele.
+
+        - preparations for making more code C++
+
+        * WebKitPrefix.h: Fixed ifdef so that C++ files get all the precompiled stuff
+        that non-C++ files get.
+
+        * Misc/WebKitLogging.h:
+        * Misc/WebKitSystemBits.h:
+        * Misc/WebLocalizableStrings.h:
+        * WebCoreSupport/WebSystemInterface.h:
+        Added extern "C".
+
+        * Misc/WebNSViewExtras.h:
+        * WebView/WebDataSource.m: (addTypesFromClass):
+        * WebView/WebFrameView.m: (addTypesFromClass):
+        Eliminated use of the identifier "class".
+
+        * WebView/WebView.m: (-[WebView _goToItem:withLoadType:]): Added a type cast.
+
+        * Plugins/WebBaseNetscapePluginView.m: Added lots of type casts.
+
 2006-10-10  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Maciej.
index 6868e460211f66336f96b527736bf93576abebda..f1a2b21286c1021b4c869fa70dfe0e4e42d7d1c8 100644 (file)
 #define LOG_CHANNEL_PREFIX WebKitLog
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern WTFLogChannel WebKitLogTiming;
 extern WTFLogChannel WebKitLogLoading;
 extern WTFLogChannel WebKitLogFontCache;
@@ -57,3 +61,7 @@ extern WTFLogChannel WebKitLogPluginEvents;
 extern WTFLogChannel WebKitLogIconDatabase;
 
 void WebKitInitializeLoggingChannelsIfNecessary(void);
+
+#ifdef __cplusplus
+}
+#endif
index a46d62ad2940118bc80497b9a7d6844031e9d2d8..3fac7757d1eafd54885ee94236ab180f57b0682b 100644 (file)
 
 #import <Foundation/Foundation.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 vm_size_t WebSystemMainMemory(void);
 int WebNumberOfCPUs(void);
+
+#ifdef __cplusplus
+}
+#endif
index 2f9a00b30528b7cd0c12e5bda4c53dd8f489c000..de4ae03e2af3f58d45a542f3aa964c01537d675b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,8 +33,16 @@ typedef struct {
     NSBundle *bundle;
 } WebLocalizableStringsBundle;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 NSString *WebLocalizedString(WebLocalizableStringsBundle *bundle, const char *key);
 
+#ifdef __cplusplus
+}
+#endif
+
 #ifdef FRAMEWORK_NAME
 
 #define LOCALIZABLE_STRINGS_BUNDLE(F) LOCALIZABLE_STRINGS_BUNDLE_HELPER(F)
index 1550128a57e6082791f521e74580b2798e0eabc2..2a979e1a8a52e1b9ba7f1f26d6f6e19199e4ab26 100644 (file)
@@ -36,7 +36,7 @@
 @interface NSView (WebExtras)
 
 // Returns the nearest enclosing view of the given class, or nil if none.
-- (NSView *)_web_superviewOfClass:(Class)class;
+- (NSView *)_web_superviewOfClass:(Class)viewClass;
 - (WebFrameView *)_web_parentWebFrameView;
 
 // returns whether a drag should begin starting with mouseDownEvent; if the time
index c5faaa0c70e0a4ca3ba8f3c757043c0e3bfff986..1ab69ed7e13c80396cd4637482b97456e7a307bc 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <WebKit/WebBaseNetscapePluginView.h>
-
+#import "WebBaseNetscapePluginView.h"
+
+#import "WebDataSourceInternal.h"
+#import "WebDefaultUIDelegate.h"
+#import "WebFrameBridge.h"
+#import "WebFrameInternal.h" 
+#import "WebFrameView.h"
+#import "WebKitLogging.h"
+#import "WebKitNSStringExtras.h"
+#import "WebNSDataExtras.h"
+#import "WebNSDictionaryExtras.h"
+#import "WebNSObjectExtras.h"
+#import "WebNSURLExtras.h"
+#import "WebNSURLRequestExtras.h"
+#import "WebNSViewExtras.h"
+#import "WebNetscapePluginPackage.h"
+#import "WebNetscapePluginStream.h"
+#import "WebNullPluginView.h"
+#import "WebPreferences.h"
+#import "WebViewInternal.h"
 #import <Accelerate/Accelerate.h>
+#import <Carbon/Carbon.h>
 #import <JavaScriptCore/Assertions.h>
-#import <WebKit/DOMPrivate.h>
-#import <WebKit/WebFrameBridge.h>
-#import <WebKit/WebDataSourceInternal.h>
-#import <WebKit/WebDefaultUIDelegate.h>
-#import <WebKit/WebFrameInternal.h> 
+#import <JavaScriptCore/npruntime_impl.h>
 #import <WebCore/WebFrameLoader.h> 
-#import <WebKit/WebFrameView.h>
-#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebKitNSStringExtras.h>
-#import <WebKit/WebNetscapePluginStream.h>
-#import <WebKit/WebNullPluginView.h>
-#import <WebKit/WebNSDataExtras.h>
-#import <WebKit/WebNSDictionaryExtras.h>
-#import <WebKit/WebNSObjectExtras.h>
-#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebNSURLRequestExtras.h>
-#import <WebKit/WebNSViewExtras.h>
-#import <WebKit/WebNetscapePluginPackage.h>
-#import <WebKit/WebPreferences.h>
-#import <WebKit/WebViewInternal.h>
-
+#import <WebKit/DOMPrivate.h>
 #import <WebKit/WebUIDelegate.h>
 #import <WebKitSystemInterface.h>
-#import <JavaScriptCore/npruntime_impl.h>
-
-#import <Carbon/Carbon.h>
-
 #import <objc/objc-runtime.h>
 
 // Send null events 50 times a second when active, so plug-ins like Flash get high frame rates.
@@ -241,7 +238,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     
     CGrafPtr oldPort;
     GetPort(&oldPort);    
-    SetPort(GetWindowPort([currentWindow windowRef]));
+    SetPort(GetWindowPort((WindowRef)[currentWindow windowRef]));
     
     MovePortTo(contentRect.origin.x, /* Flip Y */ windowHeight - NSMaxY(contentRect));
     PortSize(contentRect.size.width, contentRect.size.height);
@@ -261,7 +258,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         [self fixWindowPort];
 #endif
     
-    WindowRef windowRef = [[self currentWindow] windowRef];
+    WindowRef windowRef = (WindowRef)[[self currentWindow] windowRef];
     ASSERT(windowRef);
     
     // Use AppKit to convert view coordinates to NSWindow coordinates.
@@ -344,7 +341,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
             nPort.qdPort.porty = (int32)-boundsInWindow.origin.y;
             window.window = &nPort;
 
-            PortState_QD *qdPortState = malloc(sizeof(PortState_QD));
+            PortState_QD *qdPortState = (PortState_QD*)malloc(sizeof(PortState_QD));
             portState = (PortState)qdPortState;
             
             GetPort(&qdPortState->oldPort);    
@@ -430,7 +427,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
 
             PortState_CG *cgPortState = (PortState_CG *)malloc(sizeof(PortState_CG));
             portState = (PortState)cgPortState;
-            cgPortState->context = [[NSGraphicsContext currentContext] graphicsPort];
+            cgPortState->context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
             
             // Update the plugin's window/context
             nPort.cgPort.window = windowRef;
@@ -515,7 +512,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         case NPDrawingModelQuickDraw:
         {
             PortState_QD *qdPortState = (PortState_QD *)portState;
-            WindowRef windowRef = [[self currentWindow] windowRef];
+            WindowRef windowRef = (WindowRef)[[self currentWindow] windowRef];
             CGrafPtr port = GetWindowPort(windowRef);
             if (qdPortState->forUpdate)
                 ValidWindowRgn(windowRef, qdPortState->clipRegion);
@@ -637,7 +634,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     
     [self getCarbonEvent:&event];
     event.what = activateEvt;
-    WindowRef windowRef = [[self window] windowRef];
+    WindowRef windowRef = (WindowRef)[[self window] windowRef];
     event.message = (unsigned long)windowRef;
     if (activate) {
         event.modifiers |= activeFlag;
@@ -655,7 +652,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     
     [self getCarbonEvent:&event];
     event.what = updateEvt;
-    WindowRef windowRef = [[self window] windowRef];
+    WindowRef windowRef = (WindowRef)[[self window] windowRef];
     event.message = (unsigned long)windowRef;
 
     BOOL acceptedEvent = [self sendEvent:&event];
@@ -727,7 +724,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     };
     
     if (!keyEventHandler) {
-        InstallEventHandler(GetWindowEventTarget([[self window] windowRef]),
+        InstallEventHandler(GetWindowEventTarget((WindowRef)[[self window] windowRef]),
                             NewEventHandlerUPP(TSMEventHandler),
                             GetEventTypeCount(sTSMEvents),
                             sTSMEvents,
@@ -903,7 +900,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         LOG_ERROR("GetEventParameter failed with error: %d", status);
         return noErr;
     }
-    char *buffer = malloc(numBytes);
+    char *buffer = (char *)malloc(numBytes);
     status = GetEventParameter(rawKeyEventRef, kEventParamKeyMacCharCodes, typeChar, NULL, numBytes, NULL, buffer);
     if (status != noErr) {
         LOG_ERROR("GetEventParameter failed with error: %d", status);
@@ -1205,7 +1202,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     [plugin open];
     
     // Initialize drawingModel to an invalid value so that we can detect when the plugin does not specify a drawingModel
-    drawingModel = -1;
+    drawingModel = (NPDrawingModel)-1;
     
     // Plug-ins are "windowed" by default.  On MacOS, windowed plug-ins share the same window and graphics port as the main
     // browser window.  Windowless plug-ins are rendered off-screen, then copied into the main browser window.
@@ -1294,7 +1291,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     [NSObject cancelPreviousPerformRequestsWithTarget:self];
 
     // Setting the window type to 0 ensures that NPP_SetWindow will be called if the plug-in is restarted.
-    lastSetWindow.type = 0;
+    lastSetWindow.type = (NPWindowType)0;
     
     NPError npErr;
     npErr = NPP_Destroy(instance, NULL);
@@ -1498,7 +1495,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         if (printedPluginBitmap) {
             // Flip the bitmap before drawing because the QuickDraw port is flipped relative
             // to this view.
-            CGContextRef cgContext = [[NSGraphicsContext currentContext] graphicsPort];
+            CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
             CGContextSaveGState(cgContext);
             NSRect bounds = [self bounds];
             CGContextTranslateCTM(cgContext, 0.0f, NSHeight(bounds));
@@ -1513,7 +1510,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         NSImage *aglOffscreenImage = [self _aglOffscreenImageForDrawingInRect:rect];
         if (aglOffscreenImage) {
             // Flip the context before drawing because the CGL context is flipped relative to this view.
-            CGContextRef cgContext = [[NSGraphicsContext currentContext] graphicsPort];
+            CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
             CGContextSaveGState(cgContext);
             NSRect bounds = [self bounds];
             CGContextTranslateCTM(cgContext, 0.0f, NSHeight(bounds));
@@ -1550,7 +1547,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     ASSERT(drawingModel == NPDrawingModelQuickDraw);
     
     // Make a call to the secret QuickDraw API that makes QuickTime calm down.
-    WindowRef windowRef = [[self window] windowRef];
+    WindowRef windowRef = (WindowRef)[[self window] windowRef];
     if (!windowRef) {
         return;
     }
@@ -1664,7 +1661,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     [self sendActivateEvent:YES];
     [self setNeedsDisplay:YES];
     [self restartNullEvents];
-    SetUserFocusWindow([[self window] windowRef]);
+    SetUserFocusWindow((WindowRef)[[self window] windowRef]);
 }
 
 - (void)windowResignedKey:(NSNotification *)notification
@@ -1716,7 +1713,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     if (!NPP_GetValue)
         return NULL;
         
-    void *value = NULL;
+    NPObject *value = NULL;
     [self willCallPlugInFunction];
     NPError error = NPP_GetValue(instance, NPPVpluginScriptableNPObject, &value);
     [self didCallPlugInFunction];
@@ -2129,7 +2126,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         case NPDrawingModelQuickDraw:
         {
             Rect qdRect;
-            GetRegionBounds(invalidRegion, &qdRect);
+            GetRegionBounds((NPQDRegion)invalidRegion, &qdRect);
             invalidRect = NSMakeRect(qdRect.left, qdRect.top, qdRect.right - qdRect.left, qdRect.bottom - qdRect.top);
         }
         break;
@@ -2180,7 +2177,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
             if (!element)
                 return NPERR_GENERIC_ERROR;
             
-            NPObject *plugInScriptObject = [element _NPObject];
+            NPObject *plugInScriptObject = (NPObject *)[element _NPObject];
 
             // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess>
             if (plugInScriptObject)
@@ -2259,7 +2256,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
                 return NPERR_GENERIC_ERROR;
             
             // Check for valid, supported drawing model
-            NPDrawingModel newDrawingModel = (NPDrawingModel)value;
+            NPDrawingModel newDrawingModel = (NPDrawingModel)(uintptr_t)value;
             switch (newDrawingModel) {
                 // Supported drawing models:
 #ifndef NP_NO_QUICKDRAW
@@ -2503,9 +2500,9 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     // Attach the AGL context to its window
     GLboolean success;
 #ifdef AGL_VERSION_3_0
-    success = aglSetWindowRef(aglContext, [aglWindow windowRef]);
+    success = aglSetWindowRef(aglContext, (WindowRef)[aglWindow windowRef]);
 #else
-    success = aglSetDrawable(aglContext, (AGLDrawable)GetWindowPort([aglWindow windowRef]));
+    success = aglSetDrawable(aglContext, (AGLDrawable)GetWindowPort((WindowRef)[aglWindow windowRef]));
 #endif
     if (!success) {
         LOG_ERROR("Could not set AGL drawable: %s", aglErrorString(aglGetError()));
index 1bde734c235ecbd417688d814aa1795cd7cb9439..6e2027900df08ebabbbe1e4e23844ab54b39622e 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void InitWebCoreSystemInterface(void);
+
+#ifdef __cplusplus
+}
+#endif
index 18c5f691043584034d0ec289aaab0349b75b1e8c..faebb3a2dc5e2471643a9aead7936df69b643419 100644 (file)
@@ -51,7 +51,7 @@
 #include <cstddef>
 #include <new>
 
-#else
+#endif
 
 #import <ApplicationServices/ApplicationServices.h>
 #import <Carbon/Carbon.h>
@@ -61,5 +61,3 @@
 #endif
 
 #include <JavaScriptCore/Platform.h>
-
-#endif
index cc2a6647e9178431b86ed51279dd0521eb842f9d..5a74bfd692d9cae8981d38e4993a3a84b1be11e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 @implementation WebDataSource (WebFileInternal)
 
-- (void)_setRepresentation: (id<WebDocumentRepresentation>)representation
+- (void)_setRepresentation:(id<WebDocumentRepresentation>)representation
 {
     [_private->representation release];
     _private->representation = [representation retain];
     _private->representationFinishedLoading = NO;
 }
 
-static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class class, NSArray *supportTypes)
+static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCClass, NSArray *supportTypes)
 {
     NSEnumerator *enumerator = [supportTypes objectEnumerator];
     ASSERT(enumerator != nil);
@@ -107,7 +107,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class class,
     while ((mime = [enumerator nextObject]) != nil) {
         // Don't clobber previously-registered classes.
         if ([allTypes objectForKey:mime] == nil)
-            [allTypes setObject:class forKey:mime];
+            [allTypes setObject:objCClass forKey:mime];
     }
 }
 
index b1c3dad533a11eb9557ea3fe3062824c466bf2c3..62a2980a04ff97958c467736d072e5ac9590cb37 100644 (file)
@@ -244,7 +244,7 @@ enum {
     return (height < overlap) ? height / 2 : height - overlap;
 }
 
-static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class class, NSArray *supportTypes)
+static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCClass, NSArray *supportTypes)
 {
     NSEnumerator *enumerator = [supportTypes objectEnumerator];
     ASSERT(enumerator != nil);
@@ -252,7 +252,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class class,
     while ((mime = [enumerator nextObject]) != nil) {
         // Don't clobber previously-registered classes.
         if ([allTypes objectForKey:mime] == nil)
-            [allTypes setObject:class forKey:mime];
+            [allTypes setObject:objCClass forKey:mime];
     }
 }
 
index 62841ad5f7cdbda6ad461a6fc930868be39f8e6d..eefe33a3919417f413609b4fbfe076eef4510523 100644 (file)
@@ -799,7 +799,7 @@ static bool debugWidget = true;
 
     // abort any current load if we're going back/forward
     [[self mainFrame] stopLoading];
-    [[self mainFrame] _goToItem:item withLoadType:type];
+    [[self mainFrame] _goToItem:item withLoadType:(FrameLoadType)type];
 }
 
 - (void)_loadBackForwardListFromOtherView:(WebView *)otherView