WebCoreSystemInterface.mm revision 2bde8e466a4451c7319e3a072d118917957d6554
1/*
2 * Copyright 2006, 2007, 2008, 2009, 2010 Apple Computer, 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#import "config.h"
27#import "WebCoreSystemInterface.h"
28#import <Foundation/Foundation.h>
29
30void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
31BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
32CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
33NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
34NSString* (*wkCreateURLPasteboardFlavorTypeName)(void);
35NSString* (*wkCreateURLNPasteboardFlavorTypeName)(void);
36void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
37void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
38void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
39void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
40void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
41NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
42NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
43BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
44void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
45    float duration, unsigned state);
46BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
47void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
48void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
49BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
50NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
51CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
52NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
53NSString* (*wkGetMIMETypeForExtension)(NSString*);
54NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
55NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
56BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
57void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
58void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
59unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
60int (*wkQTMovieDataRate)(QTMovie*);
61void (*wkQTMovieDisableComponent)(uint32_t[5]);
62float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
63NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
64float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
65int (*wkQTMovieGetType)(QTMovie*);
66BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
67void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
68void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
69void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
70void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
71void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL);
72void (*wkSetDragImage)(NSImage*, NSPoint offset);
73void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform);
74void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
75CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
76void (*wkSetUpFontCache)();
77void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
78void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
79void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
80CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *),
81    void (*formFinalize)(CFReadStreamRef, void *),
82    Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
83    CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
84    Boolean (*formCanRead)(CFReadStreamRef, void *),
85    void (*formClose)(CFReadStreamRef, void *),
86    void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
87    void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
88    void *context);
89void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
90void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
91id (*wkCreateNSURLConnectionDelegateProxy)(void);
92unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
93int (*wkGetHTTPPipeliningPriority)(NSURLRequest *);
94void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority);
95void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
96void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
97CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
98BOOL (*wkIsLatchingWheelEvent)(NSEvent *);
99
100#ifndef BUILDING_ON_TIGER
101void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
102#else
103void (*wkClearGlyphVector)(void* glyphs);
104OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
105CFStringRef (*wkCopyFullFontName)(CGFontRef font);
106OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
107CGFontRef (*wkGetCGFontFromNSFont)(NSFont*);
108void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm);
109ATSLayoutRecord* (*wkGetGlyphVectorFirstRecord)(void* glyphVector);
110void* wkGetGlyphsForCharacters;
111int (*wkGetGlyphVectorNumGlyphs)(void* glyphVector);
112size_t (*wkGetGlyphVectorRecordSize)(void* glyphVector);
113OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
114void (*wkReleaseStyleGroup)(void* group);
115ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*);
116BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *);
117#endif
118
119#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
120void* wkGetHyphenationLocationBeforeIndex;
121#else
122CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
123#endif
124
125CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
126#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
127CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
128
129CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
130CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
131
132WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
133WKScrollbarPainterRef (*wkMakeScrollbarReplacementPainter)(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal);
134void (*wkScrollbarPainterSetDelegate)(WKScrollbarPainterRef, id scrollbarPainterDelegate);
135void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
136void (*wkScrollbarPainterForceFlashScrollers)(WKScrollbarPainterControllerRef);
137int (*wkScrollbarThickness)(int controlSize);
138int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
139int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
140CGFloat (*wkScrollbarPainterKnobAlpha)(WKScrollbarPainterRef);
141void (*wkSetScrollbarPainterKnobAlpha)(WKScrollbarPainterRef, CGFloat);
142CGFloat (*wkScrollbarPainterTrackAlpha)(WKScrollbarPainterRef);
143void (*wkSetScrollbarPainterTrackAlpha)(WKScrollbarPainterRef, CGFloat);
144bool (*wkScrollbarPainterIsHorizontal)(WKScrollbarPainterRef);
145void (*wkScrollbarPainterSetOverlayState)(WKScrollbarPainterRef, int overlayScrollerState);
146
147WKScrollbarPainterControllerRef (*wkMakeScrollbarPainterController)(id painterControllerDelegate);
148void (*wkSetPainterForPainterController)(WKScrollbarPainterControllerRef, WKScrollbarPainterRef, bool isHorizontal);
149WKScrollbarPainterRef (*wkVerticalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
150WKScrollbarPainterRef (*wkHorizontalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
151void (*wkSetScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef, int newStyle);
152void (*wkContentAreaScrolled)(WKScrollbarPainterControllerRef);
153void (*wkContentAreaWillPaint)(WKScrollbarPainterControllerRef);
154void (*wkMouseEnteredContentArea)(WKScrollbarPainterControllerRef);
155void (*wkMouseExitedContentArea)(WKScrollbarPainterControllerRef);
156void (*wkMouseMovedInContentArea)(WKScrollbarPainterControllerRef);
157void (*wkWillStartLiveResize)(WKScrollbarPainterControllerRef);
158void (*wkContentAreaResized)(WKScrollbarPainterControllerRef);
159void (*wkWillEndLiveResize)(WKScrollbarPainterControllerRef);
160void (*wkContentAreaDidShow)(WKScrollbarPainterControllerRef);
161void (*wkContentAreaDidHide)(WKScrollbarPainterControllerRef);
162
163bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
164#endif
165
166void (*wkUnregisterUniqueIdForElement)(id element);
167void (*wkAccessibilityHandleFocusChanged)(void);
168CFTypeID (*wkGetAXTextMarkerTypeID)(void);
169CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
170CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
171CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
172CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
173CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
174BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
175AXUIElementRef (*wkCreateAXUIElementRef)(id element);
176
177CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
178NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
179CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
180unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
181NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
182void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
183void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
184
185CFStringRef (*wkGetCFURLResponseMIMEType)(CFURLResponseRef);
186CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef);
187CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef);
188CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
189void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);
190