2 * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef WebCoreSystemInterface_h
27 #define WebCoreSystemInterface_h
29 #include <ApplicationServices/ApplicationServices.h>
30 #include <objc/objc.h>
32 #if PLATFORM(MAC) && PLATFORM(CA) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
33 #include <IOSurface/IOSurface.h>
36 typedef struct _NSRange NSRange;
38 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
39 typedef struct CGPoint NSPoint;
40 typedef struct CGRect NSRect;
42 typedef struct _NSPoint NSPoint;
43 typedef struct _NSRect NSRect;
56 @class NSMutableURLRequest;
58 @class NSTextFieldCell;
60 @class NSURLConnection;
77 class NSMutableURLRequest;
81 class NSTextFieldCell;
82 class NSURLConnection;
91 // In alphabetical order.
93 extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
94 extern BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
95 extern CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *),
96 void (*formFinalize)(CFReadStreamRef, void *),
97 Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
98 CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
99 Boolean (*formCanRead)(CFReadStreamRef, void *),
100 void (*formClose)(CFReadStreamRef, void *),
101 void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
102 void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
104 extern CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
105 extern NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
106 extern id (*wkCreateNSURLConnectionDelegateProxy)(void);
107 extern void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
108 extern void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
109 extern void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
110 extern void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
111 extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
112 extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
113 extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
114 extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
115 extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
116 float duration, unsigned state);
117 extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
118 extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
119 extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
120 extern NSString* (*wkGetMIMETypeForExtension)(NSString*);
121 extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*);
122 extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
123 extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
124 extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
125 extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
126 extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
127 extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
128 extern BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
129 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
130 extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
131 extern int (*wkQTMovieDataRate)(QTMovie*);
132 extern void (*wkQTMovieDisableComponent)(uint32_t[5]);
133 extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
134 extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
135 extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
136 extern int (*wkQTMovieGetType)(QTMovie*);
137 extern BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
138 extern void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
139 extern void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
140 extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
141 extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
142 extern void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL);
143 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
144 extern void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
145 extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
146 extern void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform);
147 extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint);
148 extern CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
149 extern void (*wkSetUpFontCache)();
150 extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
151 extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
152 extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
153 extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
154 extern int (*wkGetHTTPPipeliningPriority)(NSURLRequest *);
155 extern void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority);
156 extern void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
157 extern void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
158 extern CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
159 extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *);
161 #ifndef BUILDING_ON_TIGER
162 extern void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
164 #define GLYPH_VECTOR_SIZE (50 * 32)
166 extern void (*wkClearGlyphVector)(void* glyphs);
167 extern OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
168 extern CFStringRef (*wkCopyFullFontName)(CGFontRef font);
169 extern OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
170 extern CGFontRef (*wkGetCGFontFromNSFont)(NSFont*);
171 extern void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm);
172 extern ATSLayoutRecord* (*wkGetGlyphVectorFirstRecord)(void* glyphVector);
173 extern void* wkGetGlyphsForCharacters;
174 extern int (*wkGetGlyphVectorNumGlyphs)(void* glyphVector);
175 extern size_t (*wkGetGlyphVectorRecordSize)(void* glyphVector);
176 extern OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
177 extern void (*wkReleaseStyleGroup)(void* group);
178 extern BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *);
181 extern BOOL (*wkUseSharedMediaUI)();
183 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
184 extern void* wkGetHyphenationLocationBeforeIndex;
186 extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
189 extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
190 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
191 extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
193 extern CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
194 extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
196 typedef struct __WKScrollbarPainter *WKScrollbarPainterRef;
197 extern WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
198 extern WKScrollbarPainterRef (*wkMakeScrollbarReplacementPainter)(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal);
199 extern void (*wkScrollbarPainterSetDelegate)(WKScrollbarPainterRef, id scrollbarPainterDelegate);
200 extern void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
201 extern int (*wkScrollbarThickness)(int controlSize);
202 extern int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
203 extern int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
204 extern CGFloat (*wkScrollbarPainterKnobAlpha)(WKScrollbarPainterRef);
205 extern void (*wkSetScrollbarPainterKnobAlpha)(WKScrollbarPainterRef, CGFloat);
206 extern CGFloat (*wkScrollbarPainterTrackAlpha)(WKScrollbarPainterRef);
207 extern void (*wkSetScrollbarPainterTrackAlpha)(WKScrollbarPainterRef, CGFloat);
208 extern bool (*wkScrollbarPainterIsHorizontal)(WKScrollbarPainterRef);
209 extern void (*wkScrollbarPainterSetOverlayState)(WKScrollbarPainterRef, int overlayScrollerState);
211 typedef struct __WKScrollbarPainterController *WKScrollbarPainterControllerRef;
212 extern WKScrollbarPainterControllerRef (*wkMakeScrollbarPainterController)(id painterControllerDelegate);
213 extern void (*wkSetPainterForPainterController)(WKScrollbarPainterControllerRef, WKScrollbarPainterRef, bool isHorizontal);
214 extern WKScrollbarPainterRef (*wkVerticalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
215 extern WKScrollbarPainterRef (*wkHorizontalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
216 extern void (*wkSetScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef, int newStyle);
217 extern void (*wkContentAreaScrolled)(WKScrollbarPainterControllerRef);
218 extern void (*wkContentAreaWillPaint)(WKScrollbarPainterControllerRef);
219 extern void (*wkMouseEnteredContentArea)(WKScrollbarPainterControllerRef);
220 extern void (*wkMouseExitedContentArea)(WKScrollbarPainterControllerRef);
221 extern void (*wkMouseMovedInContentArea)(WKScrollbarPainterControllerRef);
222 extern void (*wkWillStartLiveResize)(WKScrollbarPainterControllerRef);
223 extern void (*wkContentAreaResized)(WKScrollbarPainterControllerRef);
224 extern void (*wkWillEndLiveResize)(WKScrollbarPainterControllerRef);
225 extern void (*wkContentAreaDidShow)(WKScrollbarPainterControllerRef);
226 extern void (*wkContentAreaDidHide)(WKScrollbarPainterControllerRef);
228 extern bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
231 extern void (*wkUnregisterUniqueIdForElement)(id element);
232 extern void (*wkAccessibilityHandleFocusChanged)(void);
233 extern CFTypeID (*wkGetAXTextMarkerTypeID)(void);
234 extern CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
235 extern CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
236 extern CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
237 extern CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
238 extern CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
239 extern BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
240 extern AXUIElementRef (*wkCreateAXUIElementRef)(id element);
242 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
243 extern CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
244 extern NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
246 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
247 extern CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
248 extern unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
249 extern NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
250 extern void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
251 extern void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);