WebCoreSystemInterface.h revision ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb
1/* 2 * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef WebCoreSystemInterface_h 27#define WebCoreSystemInterface_h 28 29#include <ApplicationServices/ApplicationServices.h> 30#include <objc/objc.h> 31 32#if PLATFORM(MAC) && PLATFORM(CA) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 33#include <IOSurface/IOSurface.h> 34#endif 35 36typedef struct _NSRange NSRange; 37 38#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES 39typedef struct CGPoint NSPoint; 40typedef struct CGRect NSRect; 41#else 42typedef struct _NSPoint NSPoint; 43typedef struct _NSRect NSRect; 44#endif 45 46#ifdef __OBJC__ 47@class NSArray; 48@class NSButtonCell; 49@class NSData; 50@class NSDate; 51@class NSEvent; 52@class NSFont; 53@class NSImage; 54@class NSMenu; 55@class NSMutableURLRequest; 56@class NSString; 57@class NSTextFieldCell; 58@class NSURLConnection; 59@class NSURLRequest; 60@class NSURLResponse; 61@class NSView; 62@class QTMovie; 63@class QTMovieView; 64#else 65class NSArray; 66class NSButtonCell; 67class NSData; 68class NSDate; 69class NSEvent; 70class NSFont; 71class NSImage; 72class NSMenu; 73class NSMutableArray; 74class NSMutableURLRequest; 75class NSURLRequest; 76class NSString; 77class NSTextFieldCell; 78class NSURLConnection; 79class NSURLResponse; 80class NSView; 81class QTMovie; 82class QTMovieView; 83#endif 84 85extern "C" { 86 87// In alphabetical order. 88 89extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *); 90extern BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef); 91extern CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *), 92 void (*formFinalize)(CFReadStreamRef, void *), 93 Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 94 CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 95 Boolean (*formCanRead)(CFReadStreamRef, void *), 96 void (*formClose)(CFReadStreamRef, void *), 97 void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 98 void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 99 void *context); 100extern CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef); 101extern NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*); 102extern id (*wkCreateNSURLConnectionDelegateProxy)(void); 103extern void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled); 104extern void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect); 105extern void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect); 106extern void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled); 107extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius); 108extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange); 109extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar); 110extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance); 111extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, 112 float duration, unsigned state); 113extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state); 114extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*); 115extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*); 116extern NSString* (*wkGetMIMETypeForExtension)(NSString*); 117extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*); 118extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response); 119extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response); 120extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response); 121extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous); 122extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point); 123extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize); 124extern BOOL (*wkMediaControllerThemeAvailable)(int themeStyle); 125extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*); 126extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void); 127extern int (*wkQTMovieDataRate)(QTMovie*); 128extern void (*wkQTMovieDisableComponent)(uint32_t[5]); 129extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*); 130extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); 131extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*); 132extern int (*wkQTMovieGetType)(QTMovie*); 133extern BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*); 134extern void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL); 135extern void (*wkQTMovieSelectPreferredAlternates)(QTMovie*); 136extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); 137extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*); 138extern void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL); 139extern void (*wkSetDragImage)(NSImage*, NSPoint offset); 140extern void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL); 141extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL); 142extern void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform); 143extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint); 144extern CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef); 145extern void (*wkSetUpFontCache)(); 146extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream); 147extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error); 148extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream); 149extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); 150extern void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort); 151extern void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString); 152extern CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL); 153extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *); 154 155#ifndef BUILDING_ON_TIGER 156extern void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t); 157#else 158#define GLYPH_VECTOR_SIZE (50 * 32) 159 160extern void (*wkClearGlyphVector)(void* glyphs); 161extern OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs); 162extern CFStringRef (*wkCopyFullFontName)(CGFontRef font); 163extern OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup); 164extern CGFontRef (*wkGetCGFontFromNSFont)(NSFont*); 165extern void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm); 166extern ATSLayoutRecord* (*wkGetGlyphVectorFirstRecord)(void* glyphVector); 167extern void* wkGetGlyphsForCharacters; 168extern int (*wkGetGlyphVectorNumGlyphs)(void* glyphVector); 169extern size_t (*wkGetGlyphVectorRecordSize)(void* glyphVector); 170extern OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs); 171extern void (*wkReleaseStyleGroup)(void* group); 172extern BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *); 173#endif 174 175extern BOOL (*wkUseSharedMediaUI)(); 176 177#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 178extern void* wkGetHyphenationLocationBeforeIndex; 179#else 180extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); 181#endif 182 183extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); 184#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 185extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); 186 187extern CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace); 188extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context); 189 190typedef struct __WKScrollbarPainter *WKScrollbarPainterRef; 191extern WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal); 192extern void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect); 193#endif 194 195} 196 197#endif 198