diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C')
24 files changed, 458 insertions, 36 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h index a440c6f..81c2f5f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -37,11 +37,13 @@ #include "WKPage.h" #include "WKPreferencesPrivate.h" #include "WKProtectionSpaceTypes.h" +#include "WKResourceCacheManager.h" #include "WKSharedAPICast.h" #include <WebCore/CookieJar.h> #include <WebCore/Credential.h> #include <WebCore/FrameLoaderTypes.h> #include <WebCore/ProtectionSpace.h> +#include <WebCore/Settings.h> namespace WebKit { @@ -182,6 +184,44 @@ inline WKFontSmoothingLevel toAPI(FontSmoothingLevel level) return kWKFontSmoothingLevelMedium; } +inline WKEditableLinkBehavior toAPI(WebCore::EditableLinkBehavior behavior) +{ + switch (behavior) { + case WebCore::EditableLinkDefaultBehavior: + return kWKEditableLinkBehaviorDefault; + case WebCore::EditableLinkAlwaysLive: + return kWKEditableLinkBehaviorAlwaysLive; + case WebCore::EditableLinkOnlyLiveWithShiftKey: + return kWKEditableLinkBehaviorOnlyLiveWithShiftKey; + case WebCore::EditableLinkLiveWhenNotFocused: + return kWKEditableLinkBehaviorLiveWhenNotFocused; + case WebCore::EditableLinkNeverLive: + return kWKEditableLinkBehaviorNeverLive; + } + + ASSERT_NOT_REACHED(); + return kWKEditableLinkBehaviorNeverLive; +} + +inline WebCore::EditableLinkBehavior toEditableLinkBehavior(WKEditableLinkBehavior wkBehavior) +{ + switch (wkBehavior) { + case kWKEditableLinkBehaviorDefault: + return WebCore::EditableLinkDefaultBehavior; + case kWKEditableLinkBehaviorAlwaysLive: + return WebCore::EditableLinkAlwaysLive; + case kWKEditableLinkBehaviorOnlyLiveWithShiftKey: + return WebCore::EditableLinkOnlyLiveWithShiftKey; + case kWKEditableLinkBehaviorLiveWhenNotFocused: + return WebCore::EditableLinkLiveWhenNotFocused; + case kWKEditableLinkBehaviorNeverLive: + return WebCore::EditableLinkNeverLive; + } + + ASSERT_NOT_REACHED(); + return WebCore::EditableLinkNeverLive; +} + inline WKProtectionSpaceServerType toAPI(WebCore::ProtectionSpaceServerType type) { switch (type) { @@ -246,9 +286,9 @@ inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersis inline ResourceCachesToClear toResourceCachesToClear(WKResourceCachesToClear wkResourceCachesToClear) { switch (wkResourceCachesToClear) { - case kWKAllResourceCaches: + case WKResourceCachesToClearAll: return AllResourceCaches; - case kWKInMemoryResourceCachesOnly: + case WKResourceCachesToClearInMemoryOnly: return InMemoryResourceCachesOnly; } diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp index 5f6a222..00dc6da 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp @@ -45,3 +45,8 @@ WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef itemRef) { return toCopiedAPI(toImpl(itemRef)->title()); } + +WKURLRef WKBackForwardListItemCopyOriginalURL(WKBackForwardListItemRef itemRef) +{ + return toCopiedURLAPI(toImpl(itemRef)->originalURL()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h index b0bf1de..3810d15 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h @@ -36,6 +36,7 @@ WK_EXPORT WKTypeID WKBackForwardListItemGetTypeID(); WK_EXPORT WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef item); WK_EXPORT WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef item); +WK_EXPORT WKURLRef WKBackForwardListItemCopyOriginalURL(WKBackForwardListItemRef item); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index bf196b7..063f3ea 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -84,9 +84,9 @@ void WKContextSetDownloadClient(WKContextRef contextRef, const WKContextDownload toImpl(contextRef)->initializeDownloadClient(wkClient); } -void WKContextDownloadURLRequest(WKContextRef contextRef, const WKURLRequestRef requestRef) +WKDownloadRef WKContextDownloadURLRequest(WKContextRef contextRef, const WKURLRequestRef requestRef) { - toImpl(contextRef)->download(0, toImpl(requestRef)->resourceRequest()); + return toAPI(toImpl(contextRef)->download(0, toImpl(requestRef)->resourceRequest())); } void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef contextRef, WKTypeRef userDataRef) @@ -148,16 +148,6 @@ void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef, toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string()); } -void WKContextClearResourceCaches(WKContextRef contextRef, WKResourceCachesToClear cachesToClear) -{ - toImpl(contextRef)->clearResourceCaches(toResourceCachesToClear(cachesToClear)); -} - -void WKContextClearApplicationCache(WKContextRef contextRef) -{ - toImpl(contextRef)->clearApplicationCache(); -} - WKCookieManagerRef WKContextGetCookieManager(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->cookieManagerProxy()); @@ -227,3 +217,18 @@ void WKContextSetLocalStorageDirectory(WKContextRef contextRef, WKStringRef loca { toImpl(contextRef)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string()); } + +void WKContextDisableProcessTermination(WKContextRef contextRef) +{ + toImpl(contextRef)->disableProcessTermination(); +} + +void WKContextEnableProcessTermination(WKContextRef contextRef) +{ + toImpl(contextRef)->enableProcessTermination(); +} + +void _WKContextSetHTTPPipeliningEnabled(WKContextRef contextRef, bool enabled) +{ + toImpl(contextRef)->setHTTPPipeliningEnabled(enabled); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index 606574f..6e8e4c0 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -39,12 +39,6 @@ enum { }; typedef uint32_t WKCacheModel; -enum { - kWKAllResourceCaches = 0, - kWKInMemoryResourceCachesOnly = 1 -}; -typedef uint32_t WKResourceCachesToClear; - // Injected Bundle Client typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo); typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo); @@ -115,7 +109,7 @@ WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, const WKCo WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, const WKContextHistoryClient* client); WK_EXPORT void WKContextSetDownloadClient(WKContextRef context, const WKContextDownloadClient* client); -WK_EXPORT void WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request); +WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request); WK_EXPORT void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef context, WKTypeRef userData); WK_EXPORT void WKContextPostMessageToInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody); @@ -125,9 +119,6 @@ WK_EXPORT void WKContextAddVisitedLink(WKContextRef context, WKStringRef visited WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel); WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context); -WK_EXPORT void WKContextClearResourceCaches(WKContextRef context, WKResourceCachesToClear cachesToClear); -WK_EXPORT void WKContextClearApplicationCache(WKContextRef context); - WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval); WK_EXPORT void WKContextStopMemorySampler(WKContextRef context); diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h index 5fd7dd3..153ef3e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -61,6 +61,13 @@ WK_EXPORT void WKContextSetIconDatabasePath(WKContextRef context, WKStringRef ic WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory); WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringRef localStorageDirectory); +// FIXME: This is a workaround for testing purposes only and should be removed once a better +// solution has been found for testing. +WK_EXPORT void WKContextDisableProcessTermination(WKContextRef context); +WK_EXPORT void WKContextEnableProcessTermination(WKContextRef context); + +WK_EXPORT void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.h b/Source/WebKit2/UIProcess/API/C/WKFrame.h index 334a27b..eec939e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFrame.h +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.h @@ -36,12 +36,12 @@ extern "C" { #endif -enum WKFrameLoadState { +enum { kWKFrameLoadStateProvisional = 0, kWKFrameLoadStateCommitted = 1, kWKFrameLoadStateFinished = 2 }; -typedef enum WKFrameLoadState WKFrameLoadState; +typedef uint32_t WKFrameLoadState; WK_EXPORT WKTypeID WKFrameGetTypeID(); diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp index c8e87a0..8e9327f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp @@ -36,6 +36,13 @@ WKTypeID WKIconDatabaseGetTypeID() return toAPI(WebIconDatabase::APIType); } +void WKIconDatabaseSetIconDatabaseClient(WKIconDatabaseRef iconDatabaseRef, const WKIconDatabaseClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(iconDatabaseRef)->initializeIconDatabaseClient(wkClient); +} + void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURLRef) { toImpl(iconDatabaseRef)->retainIconForPageURL(toWTFString(pageURLRef)); @@ -50,3 +57,18 @@ void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabaseRef) { toImpl(iconDatabaseRef)->enableDatabaseCleanup(); } + +void WKIconDatabaseRemoveAllIcons(WKIconDatabaseRef iconDatabaseRef) +{ + toImpl(iconDatabaseRef)->removeAllIcons(); +} + +void WKIconDatabaseCheckIntegrityBeforeOpening(WKIconDatabaseRef iconDatabaseRef) +{ + toImpl(iconDatabaseRef)->checkIntegrityBeforeOpening(); +} + +void WKIconDatabaseClose(WKIconDatabaseRef iconDatabaseRef) +{ + toImpl(iconDatabaseRef)->close(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h index 1ea1860..ece3399 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h +++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h @@ -32,12 +32,31 @@ extern "C" { #endif +// IconDatabase Client. +typedef void (*WKIconDatabaseDidChangeIconForPageURLCallback)(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo); +typedef void (*WKIconDatabaseDidRemoveAllIconsCallback)(WKIconDatabaseRef iconDatabase, const void* clientInfo); + +struct WKIconDatabaseClient { + int version; + const void * clientInfo; + WKIconDatabaseDidChangeIconForPageURLCallback didChangeIconForPageURL; + WKIconDatabaseDidRemoveAllIconsCallback didRemoveAllIcons; +}; +typedef struct WKIconDatabaseClient WKIconDatabaseClient; + WK_EXPORT WKTypeID WKIconDatabaseGetTypeID(); +WK_EXPORT void WKIconDatabaseSetIconDatabaseClient(WKIconDatabaseRef iconDatabase, const WKIconDatabaseClient* client); + WK_EXPORT void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); WK_EXPORT void WKIconDatabaseReleaseIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); WK_EXPORT void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabase); +WK_EXPORT void WKIconDatabaseRemoveAllIcons(WKIconDatabaseRef iconDatabase); +WK_EXPORT void WKIconDatabaseCheckIntegrityBeforeOpening(WKIconDatabaseRef iconDatabase); + +WK_EXPORT void WKIconDatabaseClose(WKIconDatabaseRef iconDatabase); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index 7061e39..18bc5a7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -32,6 +32,7 @@ #include "WebBackForwardList.h" #include "WebData.h" #include "WebPageProxy.h" +#include "WebProcessProxy.h" #ifdef __BLOCKS__ #include <Block.h> @@ -46,7 +47,7 @@ WKTypeID WKPageGetTypeID() WKContextRef WKPageGetContext(WKPageRef pageRef) { - return toAPI(toImpl(pageRef)->context()); + return toAPI(toImpl(pageRef)->process()->context()); } WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef) diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index 03f49f7..72405a3 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -41,6 +41,12 @@ extern "C" { #endif +enum { + kWKFocusDirectionBackward = 0, + kWKFocusDirectionForward = 1 +}; +typedef uint32_t WKFocusDirection; + typedef void (*WKPageCallback)(WKPageRef page, const void* clientInfo); // FrameLoad Client @@ -149,6 +155,9 @@ typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKDictionaryRef typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo); typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo); +typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo); +typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageUnfocusCallback)(WKPageRef page, const void *clientInfo); typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo); typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo); typedef void (*WKPageMissingPluginButtonClickedCallback)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); @@ -181,6 +190,9 @@ struct WKPageUIClient { WKPageCreateNewPageCallback createNewPage; WKPageCallback showPage; WKPageCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; WKPageRunJavaScriptAlertCallback runJavaScriptAlert; WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 0122531..449a1e8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -29,6 +29,7 @@ #include "WKAPICast.h" #include "WebPreferences.h" +#include <WebCore/Settings.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -71,6 +72,16 @@ bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->loadsImagesAutomatically(); } +void WKPreferencesSetLoadsSiteIconsIgnoringImageLoadingPreference(WKPreferencesRef preferencesRef, bool loadsSiteIconsIgnoringImageLoadingPreference) +{ + toImpl(preferencesRef)->setLoadsSiteIconsIgnoringImageLoadingPreference(loadsSiteIconsIgnoringImageLoadingPreference); +} + +bool WKPreferencesGetLoadsSiteIconsIgnoringImageLoadingPreference(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->loadsSiteIconsIgnoringImageLoadingPreference(); +} + void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef, bool offlineWebApplicationCacheEnabled) { toImpl(preferencesRef)->setOfflineWebApplicationCacheEnabled(offlineWebApplicationCacheEnabled); @@ -251,6 +262,16 @@ uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->minimumFontSize(); } +void WKPreferencesSetEditableLinkBehavior(WKPreferencesRef preferencesRef, WKEditableLinkBehavior wkBehavior) +{ + toImpl(preferencesRef)->setEditableLinkBehavior(toEditableLinkBehavior(wkBehavior)); +} + +WKEditableLinkBehavior WKPreferencesGetEditableLinkBehavior(WKPreferencesRef preferencesRef) +{ + return toAPI(static_cast<WebCore::EditableLinkBehavior>(toImpl(preferencesRef)->editableLinkBehavior())); +} + void WKPreferencesSetDefaultTextEncodingName(WKPreferencesRef preferencesRef, WKStringRef name) { toImpl(preferencesRef)->setDefaultTextEncodingName(toWTFString(name)); diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h index f2486bf..930f23d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -50,6 +50,10 @@ WK_EXPORT void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef prefere WK_EXPORT bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferences); // Defaults to false. +WK_EXPORT void WKPreferencesSetLoadsSiteIconsIgnoringImageLoadingPreference(WKPreferencesRef preferences, bool loadsSiteIconsIgnoringImageLoadingPreference); +WK_EXPORT bool WKPreferencesGetLoadsSiteIconsIgnoringImageLoadingPreference(WKPreferencesRef preferences); + +// Defaults to false. WK_EXPORT void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences, bool offlineWebApplicationCacheEnabled); WK_EXPORT bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences); diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index ddf1b9a..d67db14 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -43,10 +43,23 @@ enum WKFontSmoothingLevel { }; typedef enum WKFontSmoothingLevel WKFontSmoothingLevel; +enum WKEditableLinkBehavior { + kWKEditableLinkBehaviorDefault, + kWKEditableLinkBehaviorAlwaysLive, + kWKEditableLinkBehaviorOnlyLiveWithShiftKey, + kWKEditableLinkBehaviorLiveWhenNotFocused, + kWKEditableLinkBehaviorNeverLive +}; +typedef enum WKEditableLinkBehavior WKEditableLinkBehavior; + // Defaults to kWKFontSmoothingLevelMedium. WK_EXPORT void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef, WKFontSmoothingLevel); WK_EXPORT WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef); +// Defaults to EditableLinkNeverLive. +WK_EXPORT void WKPreferencesSetEditableLinkBehavior(WKPreferencesRef preferencesRef, WKEditableLinkBehavior); +WK_EXPORT WKEditableLinkBehavior WKPreferencesGetEditableLinkBehavior(WKPreferencesRef preferencesRef); + // Defaults to false. WK_EXPORT void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef); diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp index 483beeb..a5711e0 100644 --- a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp @@ -41,12 +41,12 @@ void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef cacheManage toImpl(cacheManagerRef)->getCacheOrigins(ArrayCallback::create(context, callback)); } -void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManagerRef, WKSecurityOriginRef originRef) +void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManagerRef, WKSecurityOriginRef originRef, WKResourceCachesToClear cachesToClear) { - toImpl(cacheManagerRef)->clearCacheForOrigin(toImpl(originRef)); + toImpl(cacheManagerRef)->clearCacheForOrigin(toImpl(originRef), toResourceCachesToClear(cachesToClear)); } -void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManagerRef) +void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManagerRef, WKResourceCachesToClear cachesToClear) { - toImpl(cacheManagerRef)->clearCacheForAllOrigins(); + toImpl(cacheManagerRef)->clearCacheForAllOrigins(toResourceCachesToClear(cachesToClear)); } diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h index 479169d..80c4531 100644 --- a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h @@ -32,13 +32,19 @@ extern "C" { #endif +enum { + WKResourceCachesToClearAll = 0, + WKResourceCachesToClearInMemoryOnly = 1 +}; +typedef uint32_t WKResourceCachesToClear; + WK_EXPORT WKTypeID WKResourceCacheManagerGetTypeID(); typedef void (*WKResourceCacheManagerGetCacheOriginsFunction)(WKArrayRef, WKErrorRef, void*); WK_EXPORT void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef contextRef, void* context, WKResourceCacheManagerGetCacheOriginsFunction function); -WK_EXPORT void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManger, WKSecurityOriginRef origin); -WK_EXPORT void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager); +WK_EXPORT void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManger, WKSecurityOriginRef origin, WKResourceCachesToClear cachesToClear); +WK_EXPORT void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager, WKResourceCachesToClear cachesToClear); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp index 5e50dd8..40e4a0e 100644 --- a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp +++ b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp @@ -34,8 +34,8 @@ using namespace WebKit; using namespace WebCore; -CGImageRef WKIconDatabaseGetCGImageForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef) +CGImageRef WKIconDatabaseTryGetCGImageForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef, WKSize size) { Image* image = toImpl(iconDatabaseRef)->imageForPageURL(toWTFString(urlRef)); - return image ? image->getCGImageRef() : 0; + return image ? image->getFirstCGImageRefOfSize(IntSize(static_cast<int>(size.width), static_cast<int>(size.height))) : 0; } diff --git a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h index 48cf5bf..62ae82e 100644 --- a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h +++ b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h @@ -28,12 +28,13 @@ #include <CoreGraphics/CGImage.h> #include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT CGImageRef WKIconDatabaseGetCGImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef urlString); +WK_EXPORT CGImageRef WKIconDatabaseTryGetCGImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef urlString, WKSize size); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h index 09cf06f..24891f5 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h @@ -30,14 +30,25 @@ #error "Please #include \"WKAPICast.h\" instead of this file directly." #endif +#include "WebGrammarDetail.h" +#include <WebCore/TextCheckerClient.h> + namespace WebKit { class WebView; class WebEditCommandProxy; +class WebTextChecker; WK_ADD_API_MAPPING(WKViewRef, WebView) WK_ADD_API_MAPPING(WKEditCommandRef, WebEditCommandProxy) +WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker) +WK_ADD_API_MAPPING(WKGrammarDetailRef, WebGrammarDetail) +inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail) +{ + return ProxyingRefPtr<WebGrammarDetail>(WebGrammarDetail::create(grammarDetail)); } +} // namespace WebKit + #endif // WKAPICastWin_h diff --git a/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp new file mode 100644 index 0000000..5ab0fc4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKGrammarDetail.h" + +#include "APIObject.h" +#include "ImmutableArray.h" +#include "WKAPICast.h" +#include "WebGrammarDetail.h" + +using namespace WebKit; + +WKTypeID WKGrammarDetailGetTypeID() +{ + return toAPI(APIObject::TypeGrammarDetail); +} + +WKGrammarDetailRef WKGrammarDetailCreate(int location, int length, WKArrayRef guesses, WKStringRef userDescription) +{ + RefPtr<WebGrammarDetail> detail = WebGrammarDetail::create(location, length, toImpl(guesses), toWTFString(userDescription)); + return toAPI(detail.release().releaseRef()); +} + +int WKGrammarDetailGetLocation(WKGrammarDetailRef grammarDetailRef) +{ + return toImpl(grammarDetailRef)->location(); +} + +int WKGrammarDetailGetLength(WKGrammarDetailRef grammarDetailRef) +{ + return toImpl(grammarDetailRef)->length(); +} + +WKArrayRef WKGrammarDetailCopyGuesses(WKGrammarDetailRef grammarDetailRef) +{ + return toAPI(toImpl(grammarDetailRef)->guesses().leakRef()); +} + +WKStringRef WKGrammarDetailCopyUserDescription(WKGrammarDetailRef grammarDetailRef) +{ + return toCopiedAPI(toImpl(grammarDetailRef)->userDescription()); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h new file mode 100644 index 0000000..c187ce6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKGrammarDetail_h +#define WKGrammarDetail_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGrammarDetailGetTypeID(); +WK_EXPORT WKGrammarDetailRef WKGrammarDetailCreate(int location, int length, WKArrayRef guesses, WKStringRef userDescription); + +WK_EXPORT int WKGrammarDetailGetLocation(WKGrammarDetailRef grammarDetailRef); +WK_EXPORT int WKGrammarDetailGetLength(WKGrammarDetailRef grammarDetailRef); +WK_EXPORT WKArrayRef WKGrammarDetailCopyGuesses(WKGrammarDetailRef grammarDetailRef); +WK_EXPORT WKStringRef WKGrammarDetailCopyUserDescription(WKGrammarDetailRef grammarDetailRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGrammarDetail_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp new file mode 100644 index 0000000..3329da2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKTextChecker.h" + +#include "WKAPICast.h" +#include "WebPageProxy.h" +#include "WebTextChecker.h" + +using namespace WebKit; + +void WKTextCheckerSetClient(const WKTextCheckerClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + WebTextChecker::shared()->setClient(wkClient); +} + +void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool enabled) +{ + WebTextChecker::shared()->continuousSpellCheckingEnabledStateChanged(enabled); +} + +void WKTextCheckerGrammarCheckingEnabledStateChanged(bool enabled) +{ + WebTextChecker::shared()->grammarCheckingEnabledStateChanged(enabled); +} + +void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection) +{ + WebTextChecker::shared()->checkSpelling(toImpl(page), startBeforeSelection); +} + +void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word) +{ + WebTextChecker::shared()->changeSpellingToWord(toImpl(page), toWTFString(word)); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h new file mode 100644 index 0000000..31a855d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKTextChecker_h +#define WKTextChecker_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// TextChecker Client +typedef bool (*WKTextCheckerContinousSpellCheckingAllowed)(const void *clientInfo); +typedef bool (*WKTextCheckerContinousSpellCheckingEnabled)(const void *clientInfo); +typedef void (*WKTextCheckerSetContinousSpellCheckingEnabled)(bool enabled, const void *clientInfo); +typedef bool (*WKTextCheckerGrammarCheckingEnabled)(const void *clientInfo); +typedef void (*WKTextCheckerSetGrammarCheckingEnabled)(bool enabled, const void *clientInfo); +typedef uint64_t (*WKTextCheckerUniqueSpellDocumentTag)(WKPageRef page, const void *clientInfo); +typedef void (*WKTextCheckerCloseSpellDocumentWithTag)(uint64_t tag, const void *clientInfo); +typedef void (*WKTextCheckerCheckSpellingOfString)(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void *clientInfo); +typedef void (*WKTextCheckerCheckGrammarOfString)(uint64_t tag, WKStringRef text, WKArrayRef* grammarDetails, int32_t* badGrammarLocation, int32_t* badGrammarLength, const void *clientInfo); +typedef bool (*WKTextCheckerSpellingUIIsShowing)(const void *clientInfo); +typedef void (*WKTextCheckerToggleSpellingUIIsShowing)(const void *clientInfo); +typedef void (*WKTextCheckerUpdateSpellingUIWithMisspelledWord)(uint64_t tag, WKStringRef misspelledWord, const void *clientInfo); +typedef void (*WKTextCheckerUpdateSpellingUIWithGrammarString)(uint64_t tag, WKStringRef badGrammarPhrase, WKGrammarDetailRef grammarDetail, const void *clientInfo); +typedef WKArrayRef (*WKTextCheckerGuessesForWord)(uint64_t tag, WKStringRef word, const void *clientInfo); +typedef void (*WKTextCheckerLearnWord)(uint64_t tag, WKStringRef word, const void *clientInfo); +typedef void (*WKTextCheckerIgnoreWord)(uint64_t tag, WKStringRef word, const void *clientInfo); + +struct WKTextCheckerClient { + int version; + const void * clientInfo; + WKTextCheckerContinousSpellCheckingAllowed continuousSpellCheckingAllowed; + WKTextCheckerContinousSpellCheckingEnabled continuousSpellCheckingEnabled; + WKTextCheckerSetContinousSpellCheckingEnabled setContinuousSpellCheckingEnabled; + WKTextCheckerGrammarCheckingEnabled grammarCheckingEnabled; + WKTextCheckerSetGrammarCheckingEnabled setGrammarCheckingEnabled; + WKTextCheckerUniqueSpellDocumentTag uniqueSpellDocumentTag; + WKTextCheckerCloseSpellDocumentWithTag closeSpellDocumentWithTag; + WKTextCheckerCheckSpellingOfString checkSpellingOfString; + WKTextCheckerCheckGrammarOfString checkGrammarOfString; + WKTextCheckerSpellingUIIsShowing spellingUIIsShowing; + WKTextCheckerToggleSpellingUIIsShowing toggleSpellingUIIsShowing; + WKTextCheckerUpdateSpellingUIWithMisspelledWord updateSpellingUIWithMisspelledWord; + WKTextCheckerUpdateSpellingUIWithGrammarString updateSpellingUIWithGrammarString; + WKTextCheckerGuessesForWord guessesForWord; + WKTextCheckerLearnWord learnWord; + WKTextCheckerIgnoreWord ignoreWord; +}; +typedef struct WKTextCheckerClient WKTextCheckerClient; + +WK_EXPORT void WKTextCheckerSetClient(const WKTextCheckerClient* client); + +WK_EXPORT void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool); +WK_EXPORT void WKTextCheckerGrammarCheckingEnabledStateChanged(bool); + +WK_EXPORT void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection); +WK_EXPORT void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word); + +#ifdef __cplusplus +} +#endif + +#endif /* WKTextChecker_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h index c8ac44c..8b5e5b2 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h @@ -43,12 +43,16 @@ typedef uint32_t WKViewUndoType; typedef void (*WKViewRegisterEditCommandCallback)(WKViewRef, WKEditCommandRef, WKViewUndoType undoOrRedo, const void *clientInfo); typedef void (*WKViewClearAllEditCommandsCallback)(WKViewRef, const void *clientInfo); +typedef bool (*WKViewCanUndoRedoCallback)(WKViewRef, WKViewUndoType undoOrRedo, const void *clientInfo); +typedef void (*WKViewExecuteUndoRedoCallback)(WKViewRef, WKViewUndoType undoOrRedo, const void *clientInfo); struct WKViewUndoClient { int version; const void * clientInfo; WKViewRegisterEditCommandCallback registerEditCommand; WKViewClearAllEditCommandsCallback clearAllEditCommands; + WKViewCanUndoRedoCallback canUndoRedo; + WKViewExecuteUndoRedoCallback executeUndoRedo; }; typedef struct WKViewUndoClient WKViewUndoClient; |