2 * Copyright (C) 2007, 2008, 2009 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 WebKitSystemInterface_h
27 #define WebKitSystemInterface_h
29 struct CGAffineTransform;
33 struct IDirect3DDevice9;
35 struct WKCACFUpdateRectEnumerator;
37 typedef struct _CACFLayer* CACFLayerRef;
38 typedef const struct __CFData* CFDataRef;
39 typedef const struct __CFString* CFStringRef;
40 typedef double CFTimeInterval;
41 typedef struct CGColor* CGColorRef;
42 typedef struct CGContext* CGContextRef;
43 typedef unsigned short CGFontIndex;
44 typedef struct CGFont* CGFontRef;
45 typedef CGFontIndex CGGlyph;
46 typedef wchar_t UChar;
47 typedef struct _CFURLCredential* CFURLCredentialRef;
48 typedef struct _CFURLResponse* CFURLResponseRef;
49 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
50 typedef struct _CFURLRequest* CFMutableURLRequestRef;
51 typedef const struct _CFURLRequest* CFURLRequestRef;
52 typedef struct __CFHTTPMessage* CFHTTPMessageRef;
53 typedef const struct __CFNumber* CFNumberRef;
54 typedef struct __CFReadStream* CFReadStreamRef;
55 typedef const struct __CFURL* CFURLRef;
56 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
57 typedef struct tagLOGFONTW LOGFONTW;
58 typedef LOGFONTW LOGFONT;
59 typedef struct _CACFLayer *CACFLayerRef;
60 typedef struct __CVBuffer *CVBufferRef;
61 typedef CVBufferRef CVImageBufferRef;
62 typedef CVImageBufferRef CVPixelBufferRef;
63 typedef struct _CAImageQueue *CAImageQueueRef;
64 typedef unsigned long CFTypeID;
66 void wkSetFontSmoothingLevel(int type);
67 int wkGetFontSmoothingLevel();
68 void wkSetFontSmoothingContrast(CGFloat);
69 CGFloat wkGetFontSmoothingContrast();
70 void wkSystemFontSmoothingChanged();
71 uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
72 void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
73 void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
74 void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
75 void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
76 void wkSetUpFontCache(size_t s);
78 void wkSetPatternBaseCTM(CGContextRef, CGAffineTransform);
79 void wkSetPatternPhaseInUserSpace(CGContextRef, CGPoint phasePoint);
80 CGAffineTransform wkGetUserToBaseCTM(CGContextRef);
82 void wkDrawFocusRing(CGContextRef, CGColorRef, float radius);
84 CFDictionaryRef wkGetSSLCertificateInfo(CFURLResponseRef);
85 void* wkGetSSLPeerCertificateData(CFDictionaryRef);
86 CFHTTPCookieStorageRef wkGetDefaultHTTPCookieStorage();
87 void wkSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool);
88 CFStringRef wkCopyFoundationCacheDirectory();
89 void wkSetClientCertificateInSSLProperties(CFMutableDictionaryRef, CFDataRef);
91 CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
92 void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
94 unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
96 void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
97 void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
98 CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
100 CFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace);
102 CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
105 enum wkCAImageQueueFlags {
106 kWKCAImageQueueAsync = 1U << 0,
107 kWKCAImageQueueFill = 1U << 1,
108 kWKCAImageQueueProtected = 1U << 2,
109 kWKCAImageQueueUseCleanAperture = 1U << 3,
110 kWKCAImageQueueUseAspectRatio = 1U << 4,
111 kWKCAImageQueueLowQualityColor = 1U << 5,
114 enum wkWKCAImageQueueImageType {
115 kWKCAImageQueueNil = 1,
116 kWKCAImageQueueSurface,
117 kWKCAImageQueueBuffer,
118 kWKCAImageQueueIOSurface,
121 enum wkWKCAImageQueueImageFlags {
122 kWKCAImageQueueOpaque = 1U << 0,
123 kWKCAImageQueueFlush = 1U << 1,
124 kWKCAImageQueueWillFlush = 1U << 2,
125 kWKCAImageQueueFlipped = 1U << 3,
126 kWKCAImageQueueWaitGPU = 1U << 4,
129 typedef void (*wkCAImageQueueReleaseCallback)(unsigned int type, uint64_t id, void *info);
130 CAImageQueueRef wkCAImageQueueCreate(uint32_t width, uint32_t height, uint32_t capacity);
131 void wkCAImageQueueInvalidate(CAImageQueueRef iq);
132 size_t wkCAImageQueueCollect(CAImageQueueRef iq);
133 bool wkCAImageQueueInsertImage(CAImageQueueRef iq, CFTimeInterval t, unsigned int type, uint64_t id, uint32_t flags, wkCAImageQueueReleaseCallback release, void *info);
134 uint64_t wkCAImageQueueRegisterPixelBuffer(CAImageQueueRef iq, void *data, size_t data_size, size_t rowbytes, size_t width, size_t height, OSType pixel_format, CFDictionaryRef attachments, uint32_t flags);
135 void wkCAImageQueueSetFlags(CAImageQueueRef iq, uint32_t mask, uint32_t flags);
136 uint32_t wkCAImageQueueGetFlags(CAImageQueueRef iq);
137 CFTypeID wkCAImageQueueGetTypeID(void);
139 WKCACFContext* wkCACFContextCreate();
140 void wkCACFContextDestroy(WKCACFContext*);
142 void wkCACFContextSetLayer(WKCACFContext*, CACFLayerRef);
143 void wkCACFContextFlush(WKCACFContext*);
145 void wkCACFContextInitializeD3DDevice(WKCACFContext*, IDirect3DDevice9*);
146 void wkCACFContextReleaseD3DResources(WKCACFContext*);
148 bool wkCACFContextBeginUpdate(WKCACFContext*, void* buffer, size_t bufferSize, CFTimeInterval time, const CGRect& bounds, const CGRect dirtyRects[], size_t dirtyRectCount);
149 void wkCACFContextRenderUpdate(WKCACFContext*);
150 void wkCACFContextFinishUpdate(WKCACFContext*);
151 void wkCACFContextAddUpdateRect(WKCACFContext*, const CGRect&);
153 WKCACFUpdateRectEnumerator* wkCACFContextCopyUpdateRectEnumerator(WKCACFContext*);
154 const CGRect* wkCACFUpdateRectEnumeratorNextRect(WKCACFUpdateRectEnumerator*);
155 void wkCACFUpdateRectEnumeratorRelease(WKCACFUpdateRectEnumerator*);
157 #endif // WebKitSystemInterface_h