#ifndef __LP64__
#include "CarbonUtils.h"
+
#import <WebKitSystemInterface.h>
-extern CGImageRef _NSCreateImageRef( unsigned char *const bitmapData[5], int pixelsWide, int pixelsHigh, int bitsPerSample, int samplesPerPixel, int bitsPerPixel, int bytesPerRow, BOOL isPlanar, BOOL hasAlpha, NSString *colorSpaceName, CGColorSpaceRef customColorSpace, id sourceObj);
+extern CGImageRef _NSCreateImageRef(unsigned char *const bitmapData[5], int pixelsWide, int pixelsHigh, int bitsPerSample, int samplesPerPixel, int bitsPerPixel, int bytesPerRow, BOOL isPlanar, BOOL hasAlpha, NSString *colorSpaceName, CGColorSpaceRef customColorSpace, id sourceObj);
-static void PoolCleaner( EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void *inUserData );
+static void PoolCleaner(EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void *inUserData);
-static NSAutoreleasePool* sPool;
+static NSAutoreleasePool* sPool;
static unsigned numPools;
static EventLoopRef poolLoop;
-void HIWebViewRegisterClass( void );
+#ifdef BUILDING_ON_TIGER
+
+void HIWebViewRegisterClass(void);
+
+#endif
-void
-WebInitForCarbon()
+void WebInitForCarbon(void)
{
- static bool sAppKitLoaded;
+ static bool sAppKitLoaded;
- if ( !sAppKitLoaded )
- {
- ProcessSerialNumber process;
+ if (!sAppKitLoaded) {
+ ProcessSerialNumber process;
// Force us to register with process server, this ensure that the process
// "flavour" is correctly established.
- GetCurrentProcess( &process );
+ GetCurrentProcess(&process);
NSApplicationLoad();
-
+
+ sAppKitLoaded = true;
+
sPool = [[NSAutoreleasePool allocWithZone:NULL] init];
numPools = WKGetNSAutoreleasePoolCount();
-
- poolLoop = GetCurrentEventLoop ();
- InstallEventLoopIdleTimer( GetMainEventLoop(), 1.0, 0, PoolCleaner, 0, NULL );
-
- sAppKitLoaded = true;
-
+ poolLoop = GetCurrentEventLoop();
+
+ InstallEventLoopIdleTimer(GetMainEventLoop(), 1.0, 0, PoolCleaner, 0, NULL);
+
+#ifdef BUILDING_ON_TIGER
+
HIWebViewRegisterClass();
+
+#endif
+
}
}
techniques available to Carbon apps, MUST create their our pools around
their nested event loops.
*/
-static void
-PoolCleaner( EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void *inUserData )
+static void PoolCleaner(EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void *inUserData)
{
- if ( inState == kEventLoopIdleTimerStarted ) {
- CFStringRef mode = CFRunLoopCopyCurrentMode( (CFRunLoopRef)GetCFRunLoopFromEventLoop( GetCurrentEventLoop() ));
- EventLoopRef thisLoop = GetCurrentEventLoop ();
- if ( CFEqual( mode, kCFRunLoopDefaultMode ) && thisLoop == poolLoop) {
- unsigned currentNumPools = WKGetNSAutoreleasePoolCount()-1;
- if (currentNumPools == numPools){
+ if (inState == kEventLoopIdleTimerStarted) {
+ CFStringRef mode = CFRunLoopCopyCurrentMode((CFRunLoopRef)GetCFRunLoopFromEventLoop(GetCurrentEventLoop()));
+ EventLoopRef thisLoop = GetCurrentEventLoop();
+ if (CFEqual(mode, kCFRunLoopDefaultMode) && thisLoop == poolLoop) {
+ unsigned currentNumPools = WKGetNSAutoreleasePoolCount() - 1;
+ if (currentNumPools == numPools) {
[sPool drain];
-
sPool = [[NSAutoreleasePool allocWithZone:NULL] init];
numPools = WKGetNSAutoreleasePoolCount();
}
}
- CFRelease( mode );
+ CFRelease(mode);
}
}
+2007-08-15 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5410937> HIWebView in SimpleCarbonWeb doesn't seem to be getting adequate invalidation when window is resized
+
+ HIWebViewCreate now just returns a HIViewRef created with HICocoaViewCreate. This eliminates lots of old code and
+ makes HIWebView a better citizen starting with Leopard. The old code paths are still needed for Tiger, so now
+ most of the files in the WebKit/Carbon directory are #ifdef BUILDING_ON_TIGER.
+
+ The Tiger code is unchanged and dosen't exhibit the invalidation problem when the window resizes.
+
+ * Carbon/CarbonUtils.m:
+ (WebInitForCarbon): #ifdef BUILDING_ON_TIGER portions of this code that is not needed on Leopard.
+ * Carbon/CarbonWindowAdapter.h: #ifdef BUILDING_ON_TIGER
+ * Carbon/CarbonWindowAdapter.m: Ditto.
+ * Carbon/CarbonWindowContentView.h: Ditto.
+ * Carbon/CarbonWindowContentView.m: Ditto.
+ * Carbon/CarbonWindowFrame.h: Ditto.
+ * Carbon/CarbonWindowFrame.m: Ditto.
+ * Carbon/HIViewAdapter.h: Ditto.
+ * Carbon/HIViewAdapter.m: Ditto.
+ * Carbon/HIWebView.h: Consolidate two #ifdef __OBJC__ blocks into one.
+ * Carbon/HIWebView.m: Implement Leopard specific HIWebViewCreate, HIWebViewCreateWithClass and HIWebViewGetWebView.
+ (HIWebViewCreate): Call HIWebViewCreateWithClass passing [WebView class].
+ (HIWebViewCreateWithClass): Call HICocoaViewCreate with an instance of the class passed in.
+ (HIWebViewGetWebView): Call HICocoaViewGetView.
+
2007-08-14 Brady Eidson <beidson@apple.com>
Reviewed by Darin, John, Maciej, Oliver, and Tim