[iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
[WebKit-https.git] / Source / WebKit / mac / WebCoreSupport / WebSystemInterface.mm
1 /*
2  * Copyright 2006, 2007, 2008, 2009, 2010, 2011 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  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer. 
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution. 
13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission. 
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #import "WebSystemInterface.h"
30
31 // Needed for builds not using PCH to expose BUILDING_ macros, see bug 32753.
32 #include <wtf/Platform.h>
33
34 #import <WebCore/WebCoreSystemInterface.h>
35 #import <WebKitSystemInterface.h>
36
37 #define INIT(function) wk##function = WK##function
38
39 void InitWebCoreSystemInterface(void)
40 {
41     static bool didInit;
42     if (didInit)
43         return;
44
45 #if !PLATFORM(IOS)
46     INIT(AdvanceDefaultButtonPulseAnimation);
47 #endif
48     INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
49 #if !PLATFORM(IOS)
50     INIT(CGContextGetShouldSmoothFonts);
51 #endif
52     INIT(CGPatternCreateWithImageAndTransform);
53     INIT(CGContextResetClip);
54 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
55     INIT(CGContextDrawsWithCorrectShadowOffsets);
56 #endif
57 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
58     INIT(CTFontTransformGlyphs);
59 #endif
60     INIT(CopyCFLocalizationPreferredName);
61     INIT(CopyCONNECTProxyResponse);
62     INIT(CopyNSURLResponseStatusLine);
63 #if PLATFORM(MAC)
64     INIT(CopyNSURLResponseCertificateChain);
65 #endif
66     INIT(CreateCustomCFReadStream);
67 #if !PLATFORM(IOS)
68     INIT(DrawCapsLockIndicator);
69     INIT(DrawBezeledTextArea);
70     INIT(DrawBezeledTextFieldCell);
71     INIT(DrawFocusRing);
72     INIT(DrawMediaUIPart);
73     INIT(DrawMediaSliderTrack);
74     INIT(DrawTextFieldCellFocusRing);
75     INIT(GetExtensionsForMIMEType);
76     INIT(GetFontInLanguageForCharacter);
77     INIT(GetFontInLanguageForRange);
78     INIT(GetGlyphTransformedAdvances);
79 #endif
80     INIT(GetHTTPPipeliningPriority);
81     INIT(GetMIMETypeForExtension);
82     INIT(GetNSURLResponseLastModifiedDate);
83 #if !PLATFORM(IOS)
84     INIT(SignedPublicKeyAndChallengeString);
85     INIT(GetPreferredExtensionForMIMEType);
86     INIT(GetWheelEventDeltas);
87 #if PLATFORM(MAC)
88     INIT(GetNSEventKeyChar);
89 #endif
90     INIT(HitTestMediaUIPart);
91 #endif
92     INIT(InitializeMaximumHTTPConnectionCountPerHost);
93 #if !PLATFORM(IOS)
94     INIT(MeasureMediaUIPart);
95     INIT(CreateMediaUIBackgroundView);
96     INIT(CreateMediaUIControl);
97     INIT(WindowSetAlpha);
98     INIT(WindowSetScaledFrame);
99     INIT(PopupMenu);
100     INIT(SetCGFontRenderingMode);
101 #endif
102     INIT(SetBaseCTM);
103     INIT(SetCONNECTProxyAuthorizationForStream);
104     INIT(SetCONNECTProxyForStream);
105 #if !PLATFORM(IOS)
106     INIT(SetDragImage);
107 #endif
108     INIT(SetHTTPPipeliningMaximumPriority);
109     INIT(SetHTTPPipeliningPriority);
110     INIT(SetHTTPPipeliningMinimumFastLanePriority);
111     INIT(SetNSURLConnectionDefersCallbacks);
112     INIT(SetNSURLRequestShouldContentSniff);
113     INIT(SetPatternPhaseInUserSpace);
114     INIT(CGContextIsPDFContext);
115     INIT(GetUserToBaseCTM);
116     INIT(SetUpFontCache);
117     INIT(SignalCFReadStreamEnd);
118     INIT(SignalCFReadStreamError);
119     INIT(SignalCFReadStreamHasBytes);
120 #if ENABLE(VIDEO) && !PLATFORM(IOS)
121     INIT(QTIncludeOnlyModernMediaFileTypes);
122     INIT(QTMovieDataRate);
123     INIT(QTMovieDisableComponent);
124     INIT(QTMovieMaxTimeLoaded);
125     INIT(QTMovieMaxTimeLoadedChangeNotification);
126     INIT(QTMovieMaxTimeSeekable);
127     INIT(QTMovieGetType);
128     INIT(QTMovieHasClosedCaptions);
129     INIT(QTMovieResolvedURL);
130     INIT(QTMovieSetShowClosedCaptions);
131     INIT(QTMovieSelectPreferredAlternates);
132     INIT(QTMovieViewSetDrawSynchronously);
133     INIT(QTGetSitesInMediaDownloadCache);
134     INIT(QTClearMediaDownloadCacheForSite);
135     INIT(QTClearMediaDownloadCache);
136 #endif
137
138 #if !PLATFORM(IOS)
139     INIT(GetGlyphsForCharacters);
140 #endif
141     INIT(GetVerticalGlyphsForCharacters);
142 #if PLATFORM(IOS)
143     INIT(ExecutableWasLinkedOnOrAfterIOSVersion);
144     INIT(GetDeviceClass);
145     INIT(GetViewportScreenSize);
146     INIT(GetScreenScaleFactor);
147     INIT(IsGB18030ComplianceRequired);
148 #endif
149
150     INIT(CreateCTLineWithUniCharProvider);
151
152 #if !PLATFORM(IOS_SIMULATOR)
153     INIT(IOSurfaceContextCreate);
154     INIT(IOSurfaceContextCreateImage);
155 #endif
156     INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
157     INIT(CTRunGetInitialAdvance);
158 #if !PLATFORM(IOS)
159     INIT(RecommendedScrollerStyle);
160     INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
161     INIT(SetCrashReportApplicationSpecificInformation);
162     INIT(CopyDefaultSearchProviderDisplayName);
163     INIT(AVAssetResolvedURL);
164     INIT(Cursor);
165 #endif
166
167 #if USE(CFNETWORK)
168     INIT(GetDefaultHTTPCookieStorage);
169     INIT(CopyCredentialFromCFPersistentStorage);
170     INIT(SetCFURLRequestShouldContentSniff);
171     INIT(CFURLRequestCopyHTTPRequestBodyParts);
172     INIT(CFURLRequestSetHTTPRequestBodyParts);
173     INIT(SetRequestStorageSession);
174 #endif
175
176 #if !PLATFORM(IOS)
177 #if PLATFORM(MAC)
178     INIT(SpeechSynthesisGetVoiceIdentifiers);
179     INIT(SpeechSynthesisGetDefaultVoiceIdentifierForLocale);
180 #endif
181     INIT(GetAXTextMarkerTypeID);
182     INIT(GetAXTextMarkerRangeTypeID);
183     INIT(CreateAXTextMarker);
184     INIT(GetBytesFromAXTextMarker);
185     INIT(CreateAXTextMarkerRange);
186     INIT(CopyAXTextMarkerRangeStart);
187     INIT(CopyAXTextMarkerRangeEnd);
188     INIT(AccessibilityHandleFocusChanged);
189     INIT(CreateAXUIElementRef);
190     INIT(UnregisterUniqueIdForElement);
191 #endif
192     INIT(CreatePrivateStorageSession);
193     INIT(CopyRequestWithStorageSession);
194     INIT(CopyHTTPCookieStorage);
195     INIT(GetHTTPCookieAcceptPolicy);
196 #if PLATFORM(MAC)
197     INIT(HTTPCookies);
198 #endif
199     INIT(HTTPCookiesForURL);
200     INIT(SetHTTPCookiesForURL);
201 #if PLATFORM(MAC)
202     INIT(DeleteAllHTTPCookies);
203 #endif
204     INIT(DeleteHTTPCookie);
205
206     INIT(GetCFURLResponseMIMEType);
207     INIT(GetCFURLResponseURL);
208     INIT(GetCFURLResponseHTTPResponse);
209     INIT(CopyCFURLResponseSuggestedFilename);
210     INIT(SetCFURLResponseMIMEType);
211
212 #if !PLATFORM(IOS)
213     INIT(SetMetadataURL);
214 #endif
215
216 #if PLATFORM(MAC)
217     // FIXME: We should stop using this file in Chromium.
218
219     INIT(DestroyRenderingResources);
220
221 #if !PLATFORM(IOS)
222     INIT(CreateVMPressureDispatchOnMainQueue);
223 #endif
224
225 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
226     INIT(CreateMemoryStatusPressureCriticalDispatchOnMainQueue);
227 #endif
228
229 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
230     INIT(ExecutableWasLinkedOnOrBeforeLion);
231 #endif
232
233     INIT(CGPathAddRoundedRect);
234
235     INIT(CFURLRequestAllowAllPostCaching);
236
237 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
238     INIT(NSElasticDeltaForTimeDelta);
239     INIT(NSElasticDeltaForReboundDelta);
240     INIT(NSReboundDeltaForElasticDelta);
241 #endif
242
243 #if ENABLE(PUBLIC_SUFFIX_LIST)
244     INIT(IsPublicSuffix);
245 #endif
246
247 #if ENABLE(CACHE_PARTITIONING)
248     INIT(CachePartitionKey);
249 #endif
250
251 #endif
252     didInit = true;
253 }