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;
55 @class NSMutableURLRequest;
57 @class NSTextFieldCell;
58 @class NSURLConnection;
74 class NSMutableURLRequest;
77 class NSTextFieldCell;
78 class NSURLConnection;
87 // In alphabetical order.
89 extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
90 extern BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
91 extern 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 *),
100 extern CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
101 extern NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
102 extern id (*wkCreateNSURLConnectionDelegateProxy)(void);
103 extern void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
104 extern void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
105 extern void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
106 extern void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
107 extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
108 extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
109 extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
110 extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
111 extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
112 float duration, unsigned state);
113 extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
114 extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
115 extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
116 extern NSString* (*wkGetMIMETypeForExtension)(NSString*);
117 extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*);
118 extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
119 extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
120 extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
121 extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
122 extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
123 extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
124 extern BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
125 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
126 extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
127 extern int (*wkQTMovieDataRate)(QTMovie*);
128 extern void (*wkQTMovieDisableComponent)(uint32_t[5]);
129 extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
130 extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
131 extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
132 extern int (*wkQTMovieGetType)(QTMovie*);
133 extern BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
134 extern void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
135 extern void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
136 extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
137 extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
138 extern void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL);
139 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
140 extern void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
141 extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
142 extern void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform);
143 extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint);
144 extern CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
145 extern void (*wkSetUpFontCache)();
146 extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
147 extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
148 extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
149 extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
150 extern int (*wkGetHTTPPipeliningPriority)(NSURLRequest *);
151 extern void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority);
152 extern void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
153 extern void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
154 extern CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
155 extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *);
157 #ifndef BUILDING_ON_TIGER
158 extern void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
160 #define GLYPH_VECTOR_SIZE (50 * 32)
162 extern void (*wkClearGlyphVector)(void* glyphs);
163 extern OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
164 extern CFStringRef (*wkCopyFullFontName)(CGFontRef font);
165 extern OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
166 extern CGFontRef (*wkGetCGFontFromNSFont)(NSFont*);
167 extern void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm);
168 extern ATSLayoutRecord* (*wkGetGlyphVectorFirstRecord)(void* glyphVector);
169 extern void* wkGetGlyphsForCharacters;
170 extern int (*wkGetGlyphVectorNumGlyphs)(void* glyphVector);
171 extern size_t (*wkGetGlyphVectorRecordSize)(void* glyphVector);
172 extern OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
173 extern void (*wkReleaseStyleGroup)(void* group);
174 extern BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *);
177 extern BOOL (*wkUseSharedMediaUI)();
179 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
180 extern void* wkGetHyphenationLocationBeforeIndex;
182 extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
185 extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
186 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
187 extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
189 extern CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
190 extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
192 typedef struct __WKScrollbarPainter *WKScrollbarPainterRef;
193 extern WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
194 extern WKScrollbarPainterRef (*wkMakeScrollbarReplacementPainter)(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal);
195 extern void (*wkScrollbarPainterSetDelegate)(WKScrollbarPainterRef, id scrollbarPainterDelegate);
196 extern void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
197 extern int (*wkScrollbarThickness)(int controlSize);
198 extern int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
199 extern int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
200 extern CGFloat (*wkScrollbarPainterKnobAlpha)(WKScrollbarPainterRef);
201 extern void (*wkSetScrollbarPainterKnobAlpha)(WKScrollbarPainterRef, CGFloat);
202 extern bool (*wkScrollbarPainterIsHorizontal)(WKScrollbarPainterRef);
203 extern void (*wkScrollbarPainterSetOverlayState)(WKScrollbarPainterRef, int overlayScrollerState);
205 #if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
206 typedef struct __WKScrollbarPainterController *WKScrollbarPainterControllerRef;
207 extern WKScrollbarPainterControllerRef (*wkMakeScrollbarPainterController)(id painterControllerDelegate);
208 extern void (*wkSetPainterForPainterController)(WKScrollbarPainterControllerRef, WKScrollbarPainterRef, bool isHorizontal);
209 extern WKScrollbarPainterRef (*wkVerticalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
210 extern WKScrollbarPainterRef (*wkHorizontalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
211 extern void (*wkSetScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef, int newStyle);
212 extern void (*wkContentAreaScrolled)(WKScrollbarPainterControllerRef);
213 extern void (*wkContentAreaWillPaint)(WKScrollbarPainterControllerRef);
214 extern void (*wkMouseEnteredContentArea)(WKScrollbarPainterControllerRef);
215 extern void (*wkMouseExitedContentArea)(WKScrollbarPainterControllerRef);
216 extern void (*wkMouseMovedInContentArea)(WKScrollbarPainterControllerRef);
217 extern void (*wkWillStartLiveResize)(WKScrollbarPainterControllerRef);
218 extern void (*wkContentAreaResized)(WKScrollbarPainterControllerRef);
219 extern void (*wkWillEndLiveResize)(WKScrollbarPainterControllerRef);
220 extern void (*wkContentAreaDidShow)(WKScrollbarPainterControllerRef);
221 extern void (*wkContentAreaDidHide)(WKScrollbarPainterControllerRef);
224 extern bool (*wkScrollbarPainterUsesOverlayScrollers)(void);