WebKitSystemInterface.h revision 65f03d4f644ce73618e5f4f50dd694b26f55ae12
1/* 2 * Copyright (C) 2007, 2008, 2009 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 WebKitSystemInterface_h 27#define WebKitSystemInterface_h 28 29struct CGAffineTransform; 30struct CGPoint; 31struct CGRect; 32struct CGSize; 33struct IDirect3DDevice9; 34struct WKCACFContext; 35struct WKCACFUpdateRectEnumerator; 36 37typedef struct _CACFLayer* CACFLayerRef; 38typedef const struct __CFData* CFDataRef; 39typedef const struct __CFString* CFStringRef; 40typedef double CFTimeInterval; 41typedef struct CGColor* CGColorRef; 42typedef struct CGContext* CGContextRef; 43typedef unsigned short CGFontIndex; 44typedef struct CGFont* CGFontRef; 45typedef CGFontIndex CGGlyph; 46typedef wchar_t UChar; 47typedef struct _CFURLResponse* CFURLResponseRef; 48typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef; 49typedef struct _CFURLRequest* CFMutableURLRequestRef; 50typedef const struct _CFURLRequest* CFURLRequestRef; 51typedef struct __CFHTTPMessage* CFHTTPMessageRef; 52typedef const struct __CFNumber* CFNumberRef; 53typedef struct __CFReadStream* CFReadStreamRef; 54typedef const struct __CFURL* CFURLRef; 55typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef; 56typedef struct tagLOGFONTW LOGFONTW; 57typedef LOGFONTW LOGFONT; 58typedef struct _CACFLayer *CACFLayerRef; 59typedef struct __CVBuffer *CVBufferRef; 60typedef CVBufferRef CVImageBufferRef; 61typedef CVImageBufferRef CVPixelBufferRef; 62typedef struct _CAImageQueue *CAImageQueueRef; 63typedef unsigned long CFTypeID; 64typedef struct _CFURLCredential* WKCFURLCredentialRef; 65 66void wkSetFontSmoothingLevel(int type); 67int wkGetFontSmoothingLevel(); 68void wkSetFontSmoothingContrast(CGFloat); 69CGFloat wkGetFontSmoothingContrast(); 70void wkSystemFontSmoothingChanged(); 71uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing); 72void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle); 73void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs); 74void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance); 75void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count); 76void wkSetUpFontCache(size_t s); 77 78void wkSetPatternBaseCTM(CGContextRef, CGAffineTransform); 79void wkSetPatternPhaseInUserSpace(CGContextRef, CGPoint phasePoint); 80CGAffineTransform wkGetUserToBaseCTM(CGContextRef); 81 82void wkDrawFocusRing(CGContextRef, CGColorRef, float radius); 83 84CFDictionaryRef wkGetSSLCertificateInfo(CFURLResponseRef); 85void* wkGetSSLPeerCertificateData(CFDictionaryRef); 86void* wkGetSSLCertificateChainContext(CFDictionaryRef); 87CFHTTPCookieStorageRef wkGetDefaultHTTPCookieStorage(); 88CFHTTPCookieStorageRef wkCreatePrivateHTTPCookieStorage(); 89void wkSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool); 90CFStringRef wkCopyFoundationCacheDirectory(); 91void wkSetClientCertificateInSSLProperties(CFMutableDictionaryRef, CFDataRef); 92 93CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef); 94void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts); 95 96unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount); 97 98void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort); 99void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString); 100CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL); 101 102WKCFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace); 103 104CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode); 105 106 107enum wkCAImageQueueFlags { 108 kWKCAImageQueueAsync = 1U << 0, 109 kWKCAImageQueueFill = 1U << 1, 110 kWKCAImageQueueProtected = 1U << 2, 111 kWKCAImageQueueUseCleanAperture = 1U << 3, 112 kWKCAImageQueueUseAspectRatio = 1U << 4, 113 kWKCAImageQueueLowQualityColor = 1U << 5, 114}; 115 116enum wkWKCAImageQueueImageType { 117 kWKCAImageQueueNil = 1, 118 kWKCAImageQueueSurface, 119 kWKCAImageQueueBuffer, 120 kWKCAImageQueueIOSurface, 121}; 122 123enum wkWKCAImageQueueImageFlags { 124 kWKCAImageQueueOpaque = 1U << 0, 125 kWKCAImageQueueFlush = 1U << 1, 126 kWKCAImageQueueWillFlush = 1U << 2, 127 kWKCAImageQueueFlipped = 1U << 3, 128 kWKCAImageQueueWaitGPU = 1U << 4, 129}; 130 131typedef void (*wkCAImageQueueReleaseCallback)(unsigned int type, uint64_t id, void *info); 132CAImageQueueRef wkCAImageQueueCreate(uint32_t width, uint32_t height, uint32_t capacity); 133void wkCAImageQueueInvalidate(CAImageQueueRef iq); 134size_t wkCAImageQueueCollect(CAImageQueueRef iq); 135bool wkCAImageQueueInsertImage(CAImageQueueRef iq, CFTimeInterval t, unsigned int type, uint64_t id, uint32_t flags, wkCAImageQueueReleaseCallback release, void *info); 136uint64_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); 137void wkCAImageQueueSetFlags(CAImageQueueRef iq, uint32_t mask, uint32_t flags); 138uint32_t wkCAImageQueueGetFlags(CAImageQueueRef iq); 139CFTypeID wkCAImageQueueGetTypeID(void); 140 141WKCACFContext* wkCACFContextCreate(); 142void wkCACFContextDestroy(WKCACFContext*); 143 144void wkCACFContextSetLayer(WKCACFContext*, CACFLayerRef); 145void wkCACFContextFlush(WKCACFContext*); 146 147CFTimeInterval wkCACFContextGetLastCommitTime(WKCACFContext*); 148CFTimeInterval wkCACFContextGetNextUpdateTime(WKCACFContext*); 149 150void* wkCACFContextGetUserData(WKCACFContext*); 151void wkCACFContextSetUserData(WKCACFContext*, void*); 152 153void* wkCACFLayerGetContextUserData(CACFLayerRef); 154 155void wkCACFContextSetD3DDevice(WKCACFContext*, IDirect3DDevice9*); 156void wkCACFContextReleaseD3DResources(WKCACFContext*); 157 158bool wkCACFContextBeginUpdate(WKCACFContext*, void* buffer, size_t bufferSize, CFTimeInterval time, const CGRect& bounds, const CGRect dirtyRects[], size_t dirtyRectCount); 159void wkCACFContextRenderUpdate(WKCACFContext*); 160void wkCACFContextFinishUpdate(WKCACFContext*); 161void wkCACFContextAddUpdateRect(WKCACFContext*, const CGRect&); 162 163WKCACFUpdateRectEnumerator* wkCACFContextCopyUpdateRectEnumerator(WKCACFContext*); 164const CGRect* wkCACFUpdateRectEnumeratorNextRect(WKCACFUpdateRectEnumerator*); 165void wkCACFUpdateRectEnumeratorRelease(WKCACFUpdateRectEnumerator*); 166 167CFDictionaryRef wkCFURLRequestCreateSerializableRepresentation(CFURLRequestRef cfRequest, CFTypeRef tokenNull); 168CFURLRequestRef wkCFURLRequestCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull); 169CFDictionaryRef wkCFURLResponseCreateSerializableRepresentation(CFURLResponseRef cfResponse, CFTypeRef tokenNull); 170CFURLResponseRef wkCFURLResponseCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull); 171 172typedef enum { 173 WKMediaUIPartFullscreenButton = 0, 174 WKMediaUIPartMuteButton, 175 WKMediaUIPartPlayButton, 176 WKMediaUIPartSeekBackButton, 177 WKMediaUIPartSeekForwardButton, 178 WKMediaUIPartTimelineSlider, 179 WKMediaUIPartTimelineSliderThumb, 180 WKMediaUIPartRewindButton, 181 WKMediaUIPartSeekToRealtimeButton, 182 WKMediaUIPartShowClosedCaptionsButton, 183 WKMediaUIPartHideClosedCaptionsButton, 184 WKMediaUIPartUnMuteButton, 185 WKMediaUIPartPauseButton, 186 WKMediaUIPartBackground, 187 WKMediaUIPartCurrentTimeDisplay, 188 WKMediaUIPartTimeRemainingDisplay, 189 WKMediaUIPartStatusDisplay, 190 WKMediaUIPartControlsPanel, 191 WKMediaUIPartVolumeSliderContainer, 192 WKMediaUIPartVolumeSlider, 193 WKMediaUIPartVolumeSliderThumb 194} WKMediaUIPart; 195 196typedef enum { 197 WKMediaControllerThemeClassic = 1, 198 WKMediaControllerThemeQuickTime = 2 199} WKMediaControllerThemeStyle; 200 201typedef enum { 202 WKMediaControllerFlagDisabled = 1 << 0, 203 WKMediaControllerFlagPressed = 1 << 1, 204 WKMediaControllerFlagDrawEndCaps = 1 << 3, 205 WKMediaControllerFlagFocused = 1 << 4 206} WKMediaControllerThemeState; 207 208#ifdef __cplusplus 209extern "C" { 210#endif 211 212bool WKMediaControllerThemeAvailable(int themeStyle); 213bool WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point); 214void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize); 215void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state); 216void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state); 217 218#ifdef __cplusplus 219} 220#endif 221 222#endif // WebKitSystemInterface_h 223