diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/API/c')
46 files changed, 899 insertions, 472 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index bc0ca142e..b1baace96 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,10 +29,17 @@ #include "APIArray.h" #include "APIData.h" #include "InjectedBundle.h" +#include "InjectedBundleScriptWorld.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" #include "WKBundlePrivate.h" +#include "WebConnection.h" +#include "WebFrame.h" +#include "WebPage.h" +#include "WebPageGroupProxy.h" +#include <WebCore/DatabaseTracker.h> +using namespace WebCore; using namespace WebKit; WKTypeID WKBundleGetTypeID() @@ -55,7 +62,7 @@ void WKBundlePostSynchronousMessage(WKBundleRef bundleRef, WKStringRef messageNa RefPtr<API::Object> returnData; toImpl(bundleRef)->postSynchronousMessage(toWTFString(messageNameRef), toImpl(messageBodyRef), returnData); if (returnDataRef) - *returnDataRef = toAPI(returnData.release().leakRef()); + *returnDataRef = toAPI(returnData.leakRef()); } WKConnectionRef WKBundleGetApplicationConnection(WKBundleRef bundleRef) @@ -63,26 +70,6 @@ WKConnectionRef WKBundleGetApplicationConnection(WKBundleRef bundleRef) return toAPI(toImpl(bundleRef)->webConnectionToUIProcess()); } -void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundleRef, bool shouldTrackVisitedLinks) -{ - toImpl(bundleRef)->setShouldTrackVisitedLinks(shouldTrackVisitedLinks); -} - -void WKBundleRemoveAllVisitedLinks(WKBundleRef bundleRef) -{ - toImpl(bundleRef)->removeAllVisitedLinks(); -} - -void WKBundleActivateMacFontAscentHack(WKBundleRef bundleRef) -{ - toImpl(bundleRef)->activateMacFontAscentHack(); -} - -void WKBundleSetCacheModel(WKBundleRef bundleRef, uint32_t cacheModel) -{ - toImpl(bundleRef)->setCacheModel(cacheModel); -} - void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundleRef) { toImpl(bundleRef)->garbageCollectJavaScriptObjects(); @@ -98,12 +85,7 @@ size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundleRef) return toImpl(bundleRef)->javaScriptObjectsCount(); } -void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundleRef, bool accept) -{ - toImpl(bundleRef)->setAlwaysAcceptCookies(accept); -} - -void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef) +void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, _WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef) { toImpl(bundleRef)->addUserScript(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserScriptInjectionTime(injectionTimeRef), toUserContentInjectedFrames(injectedFramesRef)); } @@ -153,6 +135,11 @@ void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundleRef, WKBundlePageG toImpl(bundleRef)->setAllowFileAccessFromFileURLs(toImpl(pageGroupRef), enabled); } +void WKBundleSetAllowStorageAccessFromFileURLS(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool needsQuirk) +{ + toImpl(bundleRef)->setNeedsStorageAccessFromFileURLsQuirk(toImpl(pageGroupRef), needsQuirk); +} + void WKBundleSetMinimumLogicalFontSize(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, int size) { toImpl(bundleRef)->setMinimumLogicalFontSize(toImpl(pageGroupRef), size); @@ -163,11 +150,6 @@ void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundleRef, WKBundlePageGroupR toImpl(bundleRef)->setFrameFlatteningEnabled(toImpl(pageGroupRef), enabled); } -void WKBundleSetPluginsEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) -{ - toImpl(bundleRef)->setPluginsEnabled(toImpl(pageGroupRef), enabled); -} - void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) { toImpl(bundleRef)->setJavaScriptCanAccessClipboard(toImpl(pageGroupRef), enabled); @@ -178,6 +160,11 @@ void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundleRef, WKBundlePageGroupR toImpl(bundleRef)->setPrivateBrowsingEnabled(toImpl(pageGroupRef), enabled); } +void WKBundleSetUseDashboardCompatibilityMode(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) +{ + toImpl(bundleRef)->setUseDashboardCompatibilityMode(toImpl(pageGroupRef), enabled); +} + void WKBundleSetPopupBlockingEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) { toImpl(bundleRef)->setPopupBlockingEnabled(toImpl(pageGroupRef), enabled); @@ -218,50 +205,15 @@ void WKBundleReportException(JSContextRef context, JSValueRef exception) InjectedBundle::reportException(context, exception); } -void WKBundleClearAllDatabases(WKBundleRef bundleRef) +void WKBundleClearAllDatabases(WKBundleRef) { - toImpl(bundleRef)->clearAllDatabases(); + DatabaseTracker::singleton().deleteAllDatabasesImmediately(); } void WKBundleSetDatabaseQuota(WKBundleRef bundleRef, uint64_t quota) { - toImpl(bundleRef)->setDatabaseQuota(quota); -} - -void WKBundleClearApplicationCache(WKBundleRef bundleRef) -{ - toImpl(bundleRef)->clearApplicationCache(); -} - -void WKBundleClearApplicationCacheForOrigin(WKBundleRef bundleRef, WKStringRef origin) -{ - toImpl(bundleRef)->clearApplicationCacheForOrigin(toWTFString(origin)); -} - -void WKBundleSetAppCacheMaximumSize(WKBundleRef bundleRef, uint64_t size) -{ - toImpl(bundleRef)->setAppCacheMaximumSize(size); -} - -uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundleRef, WKStringRef origin) -{ - return toImpl(bundleRef)->appCacheUsageForOrigin(toWTFString(origin)); -} - -void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin, uint64_t bytes) -{ - toImpl(bundleRef)->setApplicationCacheOriginQuota(toWTFString(origin), bytes); -} - -void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin) -{ - toImpl(bundleRef)->resetApplicationCacheOriginQuota(toWTFString(origin)); -} - -WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundleRef) -{ - RefPtr<API::Array> origins = toImpl(bundleRef)->originsWithApplicationCache(); - return toAPI(origins.release().leakRef()); + // Historically, we've used the following (somewhat nonsensical) string for the databaseIdentifier of local files. + DatabaseTracker::singleton().setQuota(*SecurityOriginData::fromDatabaseIdentifier("file__0"), quota); } WKDataRef WKBundleCreateWKDataFromUInt8Array(WKBundleRef bundle, JSContextRef context, JSValueRef data) @@ -318,23 +270,3 @@ void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundleRef, WKBundlePageR { toImpl(bundleRef)->setTabKeyCyclesThroughElements(toImpl(pageRef), enabled); } - -void WKBundleSetSerialLoadingEnabled(WKBundleRef bundleRef, bool enabled) -{ - toImpl(bundleRef)->setSerialLoadingEnabled(enabled); -} - -void WKBundleSetShadowDOMEnabled(WKBundleRef bundleRef, bool enabled) -{ - toImpl(bundleRef)->setShadowDOMEnabled(enabled); -} - -void WKBundleSetSeamlessIFramesEnabled(WKBundleRef bundleRef, bool enabled) -{ - toImpl(bundleRef)->setSeamlessIFramesEnabled(enabled); -} - -void WKBundleDispatchPendingLoadRequests(WKBundleRef bundleRef) -{ - toImpl(bundleRef)->dispatchPendingLoadRequests(); -} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h index 3a3308328..60014f78e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h @@ -27,7 +27,7 @@ #define WKBundle_h #include <JavaScriptCore/JavaScript.h> -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -68,21 +68,6 @@ typedef struct WKBundleClientV1 { WKBundleDidReceiveMessageToPageCallback didReceiveMessageToPage; } WKBundleClientV1; -enum { kWKBundleClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 1 }; -typedef struct WKBundleClient { - int version; - const void * clientInfo; - - // Version 0. - WKBundleDidCreatePageCallback didCreatePage; - WKBundleWillDestroyPageCallback willDestroyPage; - WKBundleDidInitializePageGroupCallback didInitializePageGroup; - WKBundleDidReceiveMessageCallback didReceiveMessage; - - // Version 1. - WKBundleDidReceiveMessageToPageCallback didReceiveMessageToPage; -} WKBundleClient WK_DEPRECATED("Use an explicit versioned struct instead"); - WK_EXPORT WKTypeID WKBundleGetTypeID(); WK_EXPORT void WKBundleSetClient(WKBundleRef bundle, WKBundleClientBase* client); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h index 15ac158bd..a165038eb 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h @@ -23,8 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKBundleAPICast_h -#define WKBundleAPICast_h +#pragma once #include "WKSharedAPICast.h" #include "WKBundlePage.h" @@ -33,32 +32,31 @@ #include <WebCore/EditorInsertAction.h> #include <WebCore/TextAffinity.h> -namespace WebCore { - class CSSStyleDeclaration; -} - namespace WebKit { class InjectedBundle; class InjectedBundleBackForwardList; class InjectedBundleBackForwardListItem; +class InjectedBundleCSSStyleDeclarationHandle; class InjectedBundleDOMWindowExtension; +class InjectedBundleFileHandle; class InjectedBundleHitTestResult; class InjectedBundleNavigationAction; class InjectedBundleNodeHandle; class InjectedBundleRangeHandle; class InjectedBundleScriptWorld; class PageBanner; -class PageOverlay; class WebFrame; class WebInspector; class WebPage; class WebPageGroupProxy; +class WebPageOverlay; WK_ADD_API_MAPPING(WKBundleBackForwardListItemRef, InjectedBundleBackForwardListItem) WK_ADD_API_MAPPING(WKBundleBackForwardListRef, InjectedBundleBackForwardList) -WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, WebCore::CSSStyleDeclaration) +WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, InjectedBundleCSSStyleDeclarationHandle) WK_ADD_API_MAPPING(WKBundleDOMWindowExtensionRef, InjectedBundleDOMWindowExtension) +WK_ADD_API_MAPPING(WKBundleFileHandleRef, InjectedBundleFileHandle) WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame) WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult) WK_ADD_API_MAPPING(WKBundleInspectorRef, WebInspector) @@ -66,7 +64,7 @@ WK_ADD_API_MAPPING(WKBundleNavigationActionRef, InjectedBundleNavigationAction) WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle) WK_ADD_API_MAPPING(WKBundlePageBannerRef, PageBanner) WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy) -WK_ADD_API_MAPPING(WKBundlePageOverlayRef, PageOverlay) +WK_ADD_API_MAPPING(WKBundlePageOverlayRef, WebPageOverlay) WK_ADD_API_MAPPING(WKBundlePageRef, WebPage) WK_ADD_API_MAPPING(WKBundleRangeHandleRef, InjectedBundleRangeHandle) WK_ADD_API_MAPPING(WKBundleRef, InjectedBundle) @@ -75,15 +73,12 @@ WK_ADD_API_MAPPING(WKBundleScriptWorldRef, InjectedBundleScriptWorld) inline WKInsertActionType toAPI(WebCore::EditorInsertAction action) { switch (action) { - case WebCore::EditorInsertActionTyped: + case WebCore::EditorInsertAction::Typed: return kWKInsertActionTyped; - break; - case WebCore::EditorInsertActionPasted: + case WebCore::EditorInsertAction::Pasted: return kWKInsertActionPasted; - break; - case WebCore::EditorInsertActionDropped: + case WebCore::EditorInsertAction::Dropped: return kWKInsertActionDropped; - break; } ASSERT_NOT_REACHED(); return kWKInsertActionTyped; @@ -94,15 +89,11 @@ inline WKAffinityType toAPI(WebCore::EAffinity affinity) switch (affinity) { case WebCore::UPSTREAM: return kWKAffinityUpstream; - break; case WebCore::DOWNSTREAM: return kWKAffinityDownstream; - break; } ASSERT_NOT_REACHED(); return kWKAffinityUpstream; } } // namespace WebKit - -#endif // WKBundleAPICast_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h index 7aa573aa6..03e36e051 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h @@ -26,7 +26,7 @@ #ifndef WKBundleBackForwardList_h #define WKBundleBackForwardList_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp index 755bf3ecc..c6ef6ad6c 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp @@ -79,6 +79,6 @@ bool WKBundleBackForwardListItemHasCachedPageExpired(WKBundleBackForwardListItem WKArrayRef WKBundleBackForwardListItemCopyChildren(WKBundleBackForwardListItemRef itemRef) { - return toAPI(toImpl(itemRef)->children().leakRef()); + return toAPI(&toImpl(itemRef)->children().leakRef()); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h index 5ad9abe79..409c16faf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h @@ -26,7 +26,7 @@ #ifndef WKBundleBackForwardListItem_h #define WKBundleBackForwardListItem_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.cpp index 6e5bd62a8..fc381f46a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.cpp @@ -27,7 +27,9 @@ #include "WKBundleDOMWindowExtension.h" #include "InjectedBundleDOMWindowExtension.h" +#include "InjectedBundleScriptWorld.h" #include "WKBundleAPICast.h" +#include "WebFrame.h" using namespace WebKit; @@ -39,7 +41,7 @@ WKTypeID WKBundleDOMWindowExtensionGetTypeID() WKBundleDOMWindowExtensionRef WKBundleDOMWindowExtensionCreate(WKBundleFrameRef frame, WKBundleScriptWorldRef world) { RefPtr<InjectedBundleDOMWindowExtension> extension = InjectedBundleDOMWindowExtension::create(toImpl(frame), toImpl(world)); - return toAPI(extension.release().leakRef()); + return toAPI(extension.leakRef()); } WKBundleFrameRef WKBundleDOMWindowExtensionGetFrame(WKBundleDOMWindowExtensionRef extension) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.h index 409a74289..61a3a753b 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleDOMWindowExtension.h @@ -26,7 +26,7 @@ #ifndef WKBundleDOMWindowExtension_h #define WKBundleDOMWindowExtension_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp new file mode 100644 index 000000000..da8cae86e --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2015 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 "WKBundleFileHandleRef.h" + +#include "InjectedBundleFileHandle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleFileHandleGetTypeID() +{ + return toAPI(InjectedBundleFileHandle::APIType); +} + +WKBundleFileHandleRef WKBundleFileHandleCreateWithPath(WKStringRef pathRef) +{ + return toAPI(InjectedBundleFileHandle::create(toWTFString(pathRef)).leakRef()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h new file mode 100644 index 000000000..e1a16fb69 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2015 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 WKBundleFileHandleRef_h +#define WKBundleFileHandleRef_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleFileHandleGetTypeID(); + +WK_EXPORT WKBundleFileHandleRef WKBundleFileHandleCreateWithPath(WKStringRef path); + +#ifdef __cplusplus +} +#endif + + +#endif /* WKBundleFileHandleRef_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index 91279cb78..4c0c6aed3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -28,16 +28,23 @@ #include "WKBundleFramePrivate.h" #include "APIArray.h" +#include "APISecurityOrigin.h" +#include "InjectedBundleFileHandle.h" #include "InjectedBundleHitTestResult.h" +#include "InjectedBundleNodeHandle.h" +#include "InjectedBundleRangeHandle.h" +#include "InjectedBundleScriptWorld.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" #include "WKData.h" #include "WebFrame.h" -#include "WebSecurityOrigin.h" +#include "WebPage.h" #include <WebCore/Document.h> +#include <WebCore/FocusController.h> #include <WebCore/Frame.h> #include <WebCore/FrameLoader.h> #include <WebCore/FrameView.h> +#include <WebCore/Page.h> using namespace WebCore; using namespace WebKit; @@ -88,7 +95,7 @@ WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frameRef) WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frameRef) { - return toAPI(toImpl(frameRef)->childFrames().leakRef()); + return toAPI(&toImpl(frameRef)->childFrames().leakRef()); } JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frameRef) @@ -116,6 +123,11 @@ JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef fr return toImpl(frameRef)->jsWrapperForWorld(toImpl(rangeHandleRef), toImpl(worldRef)); } +JSValueRef WKBundleFrameGetJavaScriptWrapperForFileForWorld(WKBundleFrameRef frameRef, WKBundleFileHandleRef fileHandleRef, WKBundleScriptWorldRef worldRef) +{ + return toImpl(frameRef)->jsWrapperForWorld(toImpl(fileHandleRef), toImpl(worldRef)); +} + WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frameRef) { return toCopiedAPI(toImpl(frameRef)->name()); @@ -228,6 +240,11 @@ void WKBundleFrameSetTextDirection(WKBundleFrameRef frameRef, WKStringRef direct toImpl(frameRef)->setTextDirection(toWTFString(directionRef)); } +void WKBundleFrameSetAccessibleName(WKBundleFrameRef frameRef, WKStringRef accessibleNameRef) +{ + toImpl(frameRef)->setAccessibleName(toWTFString(accessibleNameRef)); +} + WKDataRef WKBundleFrameCopyWebArchive(WKBundleFrameRef frameRef) { return WKBundleFrameCopyWebArchiveFilteringSubframes(frameRef, 0, 0); @@ -235,7 +252,7 @@ WKDataRef WKBundleFrameCopyWebArchive(WKBundleFrameRef frameRef) WKDataRef WKBundleFrameCopyWebArchiveFilteringSubframes(WKBundleFrameRef frameRef, WKBundleFrameFrameFilterCallback frameFilterCallback, void* context) { -#if PLATFORM(MAC) +#if PLATFORM(COCOA) RetainPtr<CFDataRef> data = toImpl(frameRef)->webArchiveData(frameFilterCallback, context); if (data) return WKDataCreate(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get())); @@ -268,5 +285,14 @@ WKSecurityOriginRef WKBundleFrameCopySecurityOrigin(WKBundleFrameRef frameRef) if (!coreFrame) return 0; - return toCopiedAPI(coreFrame->document()->securityOrigin()); + return toCopiedAPI(&coreFrame->document()->securityOrigin()); +} + +void WKBundleFrameFocus(WKBundleFrameRef frameRef) +{ + Frame* coreFrame = toImpl(frameRef)->coreFrame(); + if (!coreFrame) + return; + + coreFrame->page()->focusController().setFocusedFrame(coreFrame); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h index 8c2b875f5..6654f0029 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h @@ -27,9 +27,9 @@ #define WKBundleFrame_h #include <JavaScriptCore/JavaScript.h> -#include <WebKit2/WKBase.h> -#include <WebKit2/WKFrame.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKFrame.h> +#include <WebKit/WKGeometry.h> #ifdef __cplusplus extern "C" { @@ -55,6 +55,7 @@ WK_EXPORT WKBundleFrameRef WKBundleFrameForJavaScriptContext(JSContextRef contex WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForNodeForWorld(WKBundleFrameRef frame, WKBundleNodeHandleRef nodeHandle, WKBundleScriptWorldRef world); WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef frame, WKBundleRangeHandleRef rangeHandle, WKBundleScriptWorldRef world); +WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForFileForWorld(WKBundleFrameRef frame, WKBundleFileHandleRef fileHandle, WKBundleScriptWorldRef world); WK_EXPORT WKBundlePageRef WKBundleFrameGetPage(WKBundleFrameRef frame); @@ -73,6 +74,8 @@ WK_EXPORT bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frame, d WK_EXPORT WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frame, WKURLRef url); WK_EXPORT WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frame, WKURLRef url); +WK_EXPORT void WKBundleFrameSetAccessibleName(WKBundleFrameRef frame, WKStringRef accessibleName); + WK_EXPORT WKDataRef WKBundleFrameCopyWebArchive(WKBundleFrameRef frame); typedef bool (*WKBundleFrameFrameFilterCallback)(WKBundleFrameRef frame, WKBundleFrameRef subframe, void* context); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h index fa5cb759d..0e83d35c8 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h @@ -27,8 +27,8 @@ #define WKBundleFramePrivate_h #include <JavaScriptCore/JavaScript.h> -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> #ifndef __cplusplus #include <stdbool.h> @@ -54,6 +54,8 @@ WK_EXPORT WKBundleHitTestResultRef WKBundleFrameCreateHitTestResult(WKBundleFram WK_EXPORT bool WKBundleFrameHandlesPageScaleGesture(WKBundleFrameRef frame); +WK_EXPORT void WKBundleFrameFocus(WKBundleFrameRef frame); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp index 60a4c68b0..2f6d2d04c 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp @@ -30,6 +30,7 @@ #include "InjectedBundleNodeHandle.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" +#include "WebFrame.h" using namespace WebKit; @@ -41,7 +42,13 @@ WKTypeID WKBundleHitTestResultGetTypeID() WKBundleNodeHandleRef WKBundleHitTestResultCopyNodeHandle(WKBundleHitTestResultRef hitTestResultRef) { RefPtr<InjectedBundleNodeHandle> nodeHandle = toImpl(hitTestResultRef)->nodeHandle(); - return toAPI(nodeHandle.release().leakRef()); + return toAPI(nodeHandle.leakRef()); +} + +WKBundleNodeHandleRef WKBundleHitTestResultCopyURLElementHandle(WKBundleHitTestResultRef hitTestResultRef) +{ + RefPtr<InjectedBundleNodeHandle> urlElementNodeHandle = toImpl(hitTestResultRef)->urlElementHandle(); + return toAPI(urlElementNodeHandle.leakRef()); } WKBundleFrameRef WKBundleHitTestResultGetFrame(WKBundleHitTestResultRef hitTestResultRef) @@ -84,6 +91,11 @@ bool WKBundleHitTestResultMediaHasAudio(WKBundleHitTestResultRef hitTestResultRe return toImpl(hitTestResultRef)->mediaHasAudio(); } +bool WKBundleHitTestResultIsDownloadableMedia(WKBundleHitTestResultRef hitTestResultRef) +{ + return toImpl(hitTestResultRef)->isDownloadableMedia(); +} + WKBundleHitTestResultMediaType WKBundleHitTestResultGetMediaType(WKBundleHitTestResultRef hitTestResultRef) { return toAPI(toImpl(hitTestResultRef)->mediaType()); @@ -108,3 +120,8 @@ WKStringRef WKBundleHitTestResultCopyLinkTitle(WKBundleHitTestResultRef hitTestR { return toCopiedAPI(toImpl(hitTestResultRef)->linkTitle()); } + +WKStringRef WKBundleHitTestResultCopyLinkSuggestedFilename(WKBundleHitTestResultRef hitTestResultRef) +{ + return toCopiedAPI(toImpl(hitTestResultRef)->linkSuggestedFilename()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h index 839e9850d..66388bf8d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h @@ -26,8 +26,8 @@ #ifndef WKBundleHitTestResult_h #define WKBundleHitTestResult_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> #ifdef __cplusplus extern "C" { @@ -43,6 +43,7 @@ typedef uint32_t WKBundleHitTestResultMediaType; WK_EXPORT WKTypeID WKBundleHitTestResultGetTypeID(); WK_EXPORT WKBundleNodeHandleRef WKBundleHitTestResultCopyNodeHandle(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT WKBundleNodeHandleRef WKBundleHitTestResultCopyURLElementHandle(WKBundleHitTestResultRef hitTestResult); WK_EXPORT WKBundleFrameRef WKBundleHitTestResultGetFrame(WKBundleHitTestResultRef hitTestResult); WK_EXPORT WKBundleFrameRef WKBundleHitTestResultGetTargetFrame(WKBundleHitTestResultRef hitTestResult); @@ -53,6 +54,7 @@ WK_EXPORT WKURLRef WKBundleHitTestResultCopyAbsoluteLinkURL(WKBundleHitTestResul WK_EXPORT WKURLRef WKBundleHitTestResultCopyAbsoluteMediaURL(WKBundleHitTestResultRef hitTestResult); WK_EXPORT bool WKBundleHitTestResultMediaIsInFullscreen(WKBundleHitTestResultRef hitTestResult); WK_EXPORT bool WKBundleHitTestResultMediaHasAudio(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT bool WKBundleHitTestResultIsDownloadableMedia(WKBundleHitTestResultRef hitTestResultRef); WK_EXPORT WKBundleHitTestResultMediaType WKBundleHitTestResultGetMediaType(WKBundleHitTestResultRef hitTestResult); WK_EXPORT WKRect WKBundleHitTestResultGetImageRect(WKBundleHitTestResultRef hitTestResult); @@ -60,6 +62,7 @@ WK_EXPORT bool WKBundleHitTestResultGetIsSelected(WKBundleHitTestResultRef hitTe WK_EXPORT WKStringRef WKBundleHitTestResultCopyLinkLabel(WKBundleHitTestResultRef hitTestResult); WK_EXPORT WKStringRef WKBundleHitTestResultCopyLinkTitle(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT WKStringRef WKBundleHitTestResultCopyLinkSuggestedFilename(WKBundleHitTestResultRef hitTestResult); #ifdef __cplusplus } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h index f10b7b400..86a897e39 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h @@ -26,7 +26,7 @@ #ifndef WKBundleInitialize_h #define WKBundleInitialize_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp index 554cf3cd8..7c9324fd7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,40 +35,30 @@ using namespace WebKit; WKTypeID WKBundleInspectorGetTypeID() { -#if ENABLE(INSPECTOR) return toAPI(WebInspector::APIType); -#else - return toAPI(API::Object::Type::Null); -#endif } void WKBundleInspectorShow(WKBundleInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->show(); -#endif } void WKBundleInspectorClose(WKBundleInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->close(); -#endif } -void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, long callID, WKStringRef script) +void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, WKStringRef script) { -#if ENABLE(INSPECTOR) - toImpl(inspectorRef)->evaluateScriptForTest(callID, toWTFString(script)); -#endif + toImpl(inspectorRef)->evaluateScriptForTest(toWTFString(script)); } void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled) { -#if ENABLE(INSPECTOR) + toImpl(inspectorRef)->showTimelines(); + if (enabled) toImpl(inspectorRef)->startPageProfiling(); else toImpl(inspectorRef)->stopPageProfiling(); -#endif } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h index 20d070995..ddc3318b7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h @@ -26,7 +26,7 @@ #ifndef WKBundleInspector_h #define WKBundleInspector_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifndef __cplusplus #include <stdbool.h> @@ -41,7 +41,7 @@ WK_EXPORT WKTypeID WKBundleInspectorGetTypeID(); WK_EXPORT void WKBundleInspectorShow(WKBundleInspectorRef inspector); WK_EXPORT void WKBundleInspectorClose(WKBundleInspectorRef inspector); -WK_EXPORT void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspector, long callID, WKStringRef script); +WK_EXPORT void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspector, WKStringRef script); WK_EXPORT void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspector, bool enabled); #ifdef __cplusplus diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp index c26ec3ecf..a3c363e19 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "WKBundleNavigationAction.h" +#include "WKBundleNavigationActionPrivate.h" #include "InjectedBundleHitTestResult.h" #include "InjectedBundleNavigationAction.h" @@ -57,11 +58,26 @@ WKEventMouseButton WKBundleNavigationActionGetEventMouseButton(WKBundleNavigatio WKBundleHitTestResultRef WKBundleNavigationActionCopyHitTestResult(WKBundleNavigationActionRef navigationActionRef) { RefPtr<InjectedBundleHitTestResult> hitTestResult = toImpl(navigationActionRef)->hitTestResult(); - return toAPI(hitTestResult.release().leakRef()); + return toAPI(hitTestResult.leakRef()); } WKBundleNodeHandleRef WKBundleNavigationActionCopyFormElement(WKBundleNavigationActionRef navigationActionRef) { RefPtr<InjectedBundleNodeHandle> formElement = toImpl(navigationActionRef)->formElement(); - return toAPI(formElement.release().leakRef()); + return toAPI(formElement.leakRef()); +} + +bool WKBundleNavigationActionGetShouldOpenExternalURLs(WKBundleNavigationActionRef navigationActionRef) +{ + return toImpl(navigationActionRef)->shouldOpenExternalURLs(); +} + +bool WKBundleNavigationActionGetShouldTryAppLinks(WKBundleNavigationActionRef navigationActionRef) +{ + return toImpl(navigationActionRef)->shouldTryAppLinks(); +} + +WKStringRef WKBundleNavigationActionCopyDownloadAttribute(WKBundleNavigationActionRef navigationActionRef) +{ + return toCopiedAPI(toImpl(navigationActionRef)->downloadAttribute()); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h index 03f083a29..3b95cf1bf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h @@ -26,9 +26,9 @@ #ifndef WKBundleNavigationAction_h #define WKBundleNavigationAction_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKEvent.h> -#include <WebKit2/WKPageLoadTypes.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKEvent.h> +#include <WebKit/WKPageLoadTypes.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h new file mode 100644 index 000000000..25d164059 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2015 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 WKBundleNavigationActionPrivate_h +#define WKBundleNavigationActionPrivate_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT bool WKBundleNavigationActionGetShouldOpenExternalURLs(WKBundleNavigationActionRef); +WK_EXPORT bool WKBundleNavigationActionGetShouldTryAppLinks(WKBundleNavigationActionRef); +WK_EXPORT WKStringRef WKBundleNavigationActionCopyDownloadAttribute(WKBundleNavigationActionRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKBundleNavigationActionPrivate_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp index cb3f9b6e6..46cfa34a0 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp @@ -28,13 +28,29 @@ #include "WKBundleNodeHandlePrivate.h" #include "InjectedBundleNodeHandle.h" +#include "InjectedBundleRangeHandle.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" #include "WebFrame.h" #include "WebImage.h" +#include <WebCore/HTMLTextFormControlElement.h> using namespace WebKit; +static WebCore::AutoFillButtonType toAutoFillButtonType(WKAutoFillButtonType wkAutoFillButtonType) +{ + switch (wkAutoFillButtonType) { + case kWKAutoFillButtonTypeNone: + return WebCore::AutoFillButtonType::None; + case kWKAutoFillButtonTypeContacts: + return WebCore::AutoFillButtonType::Contacts; + case kWKAutoFillButtonTypeCredentials: + return WebCore::AutoFillButtonType::Credentials; + } + ASSERT_NOT_REACHED(); + return WebCore::AutoFillButtonType::None; +} + WKTypeID WKBundleNodeHandleGetTypeID() { return toAPI(InjectedBundleNodeHandle::APIType); @@ -43,13 +59,13 @@ WKTypeID WKBundleNodeHandleGetTypeID() WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef contextRef, JSObjectRef objectRef) { RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(contextRef, objectRef); - return toAPI(nodeHandle.release().leakRef()); + return toAPI(nodeHandle.leakRef()); } WKBundleNodeHandleRef WKBundleNodeHandleCopyDocument(WKBundleNodeHandleRef nodeHandleRef) { RefPtr<InjectedBundleNodeHandle> nodeHandle = toImpl(nodeHandleRef)->document(); - return toAPI(nodeHandle.release().leakRef()); + return toAPI(nodeHandle.leakRef()); } WKRect WKBundleNodeHandleGetRenderRect(WKBundleNodeHandleRef nodeHandleRef, bool* isReplaced) @@ -60,7 +76,13 @@ WKRect WKBundleNodeHandleGetRenderRect(WKBundleNodeHandleRef nodeHandleRef, bool WKImageRef WKBundleNodeHandleCopySnapshotWithOptions(WKBundleNodeHandleRef nodeHandleRef, WKSnapshotOptions options) { RefPtr<WebImage> image = toImpl(nodeHandleRef)->renderedImage(toSnapshotOptions(options)); - return toAPI(image.release().leakRef()); + return toAPI(image.leakRef()); +} + +WKBundleRangeHandleRef WKBundleNodeHandleCopyVisibleRange(WKBundleNodeHandleRef nodeHandleRef) +{ + RefPtr<InjectedBundleRangeHandle> rangeHandle = toImpl(nodeHandleRef)->visibleRange(); + return toAPI(rangeHandle.leakRef()); } WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef elementHandleRef) @@ -73,14 +95,34 @@ void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htm toImpl(htmlInputElementHandleRef)->setHTMLInputElementValueForUser(toWTFString(valueRef)); } -bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef) +void WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool enabled) { - return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutofilled(); + toImpl(htmlInputElementHandleRef)->setHTMLInputElementSpellcheckEnabled(enabled); } -void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled) +bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandleRef) +{ + return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFilled(); +} + +void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled) +{ + toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilled(filled); +} + +bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef) +{ + return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFillButtonEnabled(); +} + +void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabledWithButtonType(WKBundleNodeHandleRef htmlInputElementHandleRef, WKAutoFillButtonType autoFillButtonType) +{ + toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFillButtonEnabled(toAutoFillButtonType(autoFillButtonType)); +} + +WKRect WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds(WKBundleNodeHandleRef htmlInputElementHandleRef) { - toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutofilled(filled); + return toAPI(toImpl(htmlInputElementHandleRef)->htmlInputElementAutoFillButtonBounds()); } bool WKBundleNodeHandleGetHTMLInputElementLastChangeWasUserEdit(WKBundleNodeHandleRef htmlInputElementHandleRef) @@ -96,23 +138,43 @@ bool WKBundleNodeHandleGetHTMLTextAreaElementLastChangeWasUserEdit(WKBundleNodeH WKBundleNodeHandleRef WKBundleNodeHandleCopyHTMLTableCellElementCellAbove(WKBundleNodeHandleRef htmlTableCellElementHandleRef) { RefPtr<InjectedBundleNodeHandle> nodeHandle = toImpl(htmlTableCellElementHandleRef)->htmlTableCellElementCellAbove(); - return toAPI(nodeHandle.release().leakRef()); + return toAPI(nodeHandle.leakRef()); } WKBundleFrameRef WKBundleNodeHandleCopyDocumentFrame(WKBundleNodeHandleRef documentHandleRef) { RefPtr<WebFrame> frame = toImpl(documentHandleRef)->documentFrame(); - return toAPI(frame.release().leakRef()); + return toAPI(frame.leakRef()); } WKBundleFrameRef WKBundleNodeHandleCopyHTMLFrameElementContentFrame(WKBundleNodeHandleRef htmlFrameElementHandleRef) { RefPtr<WebFrame> frame = toImpl(htmlFrameElementHandleRef)->htmlFrameElementContentFrame(); - return toAPI(frame.release().leakRef()); + return toAPI(frame.leakRef()); } WKBundleFrameRef WKBundleNodeHandleCopyHTMLIFrameElementContentFrame(WKBundleNodeHandleRef htmlIFrameElementHandleRef) { RefPtr<WebFrame> frame = toImpl(htmlIFrameElementHandleRef)->htmlIFrameElementContentFrame(); - return toAPI(frame.release().leakRef()); + return toAPI(frame.leakRef()); +} + +// Deprecated - use WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef). +bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef) +{ + return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFilled(); +} + +// Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef, bool). +void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled) +{ + toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilled(filled); +} + +// Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabledWithButtonType(WKBundleNodeHandleRef, WKAutoFillButtonType). +void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool enabled) +{ + WebCore::AutoFillButtonType autoFillButtonType = enabled ? WebCore::AutoFillButtonType::Credentials : WebCore::AutoFillButtonType::None; + + toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFillButtonEnabled(autoFillButtonType); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h index 3cdad1761..6b0bfe958 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h @@ -26,7 +26,7 @@ #ifndef WKBundleNodeHandle_h #define WKBundleNodeHandle_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h index 1ad192915..634541d48 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h @@ -27,14 +27,21 @@ #define WKBundleNodeHandlePrivate_h #include <JavaScriptCore/JavaScript.h> -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> -#include <WebKit2/WKImage.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> +#include <WebKit/WKImage.h> #ifdef __cplusplus extern "C" { #endif +enum { + kWKAutoFillButtonTypeNone, + kWKAutoFillButtonTypeCredentials, + kWKAutoFillButtonTypeContacts +}; +typedef uint8_t WKAutoFillButtonType; + WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef context, JSObjectRef object); /* Convenience Operations */ @@ -45,14 +52,19 @@ WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCopyDocument(WKBundleNodeHandl WK_EXPORT WKRect WKBundleNodeHandleGetRenderRect(WKBundleNodeHandleRef nodeHandle, bool* isReplaced); WK_EXPORT WKImageRef WKBundleNodeHandleCopySnapshotWithOptions(WKBundleNodeHandleRef nodeHandle, WKSnapshotOptions options); +WK_EXPORT WKBundleRangeHandleRef WKBundleNodeHandleCopyVisibleRange(WKBundleNodeHandleRef nodeHandle); /* Element Specific Operations */ WK_EXPORT WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef elementHandle); /* HTMLInputElement Specific Operations */ WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value); -WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle); -WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled); +WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled(WKBundleNodeHandleRef htmlInputElementHandle, bool enabled); +WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle); +WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled); +WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle); +WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabledWithButtonType(WKBundleNodeHandleRef htmlInputElementHandle, WKAutoFillButtonType autoFillButtonType); +WK_EXPORT WKRect WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds(WKBundleNodeHandleRef htmlInputElementHandle); WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementLastChangeWasUserEdit(WKBundleNodeHandleRef htmlInputElementHandle); /* HTMLTextAreaElement Specific Operations */ @@ -70,6 +82,14 @@ WK_EXPORT WKBundleFrameRef WKBundleNodeHandleCopyHTMLFrameElementContentFrame(WK /* HTMLIFrameElement Specific Operations */ WK_EXPORT WKBundleFrameRef WKBundleNodeHandleCopyHTMLIFrameElementContentFrame(WKBundleNodeHandleRef htmlIFrameElementHandle); + +/* Deprecated - use WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef) */ +WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle); +/* Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef, bool) */ +WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled); +/* Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef, WKAutoFillButtonType)*/ +WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle, bool enabled); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index a7a4855e3..94ab4da75 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011, 2013 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011, 2013, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,6 +33,9 @@ #include "APIURLRequest.h" #include "InjectedBundleBackForwardList.h" #include "InjectedBundleNodeHandle.h" +#include "InjectedBundlePageEditorClient.h" +#include "InjectedBundlePageFormClient.h" +#include "InjectedBundlePageUIClient.h" #include "PageBanner.h" #include "WKAPICast.h" #include "WKArray.h" @@ -44,14 +47,22 @@ #include "WebFrame.h" #include "WebFullScreenManager.h" #include "WebImage.h" +#include "WebInspector.h" #include "WebPage.h" +#include "WebPageGroupProxy.h" +#include "WebPageOverlay.h" #include "WebRenderLayer.h" #include "WebRenderObject.h" #include <WebCore/AXObjectCache.h> #include <WebCore/AccessibilityObject.h> +#include <WebCore/ApplicationCacheStorage.h> #include <WebCore/MainFrame.h> #include <WebCore/Page.h> +#include <WebCore/PageOverlay.h> +#include <WebCore/PageOverlayController.h> +#include <WebCore/SecurityOriginData.h> #include <WebCore/URL.h> +#include <WebCore/WheelEventTestTrigger.h> #include <wtf/StdLibExtras.h> using namespace WebKit; @@ -64,7 +75,7 @@ WKTypeID WKBundlePageGetTypeID() void WKBundlePageSetContextMenuClient(WKBundlePageRef pageRef, WKBundlePageContextMenuClientBase* wkClient) { #if ENABLE(CONTEXT_MENUS) - toImpl(pageRef)->initializeInjectedBundleContextMenuClient(wkClient); + toImpl(pageRef)->setInjectedBundleContextMenuClient(std::make_unique<InjectedBundlePageContextMenuClient>(wkClient)); #else UNUSED_PARAM(pageRef); UNUSED_PARAM(wkClient); @@ -73,12 +84,12 @@ void WKBundlePageSetContextMenuClient(WKBundlePageRef pageRef, WKBundlePageConte void WKBundlePageSetEditorClient(WKBundlePageRef pageRef, WKBundlePageEditorClientBase* wkClient) { - toImpl(pageRef)->initializeInjectedBundleEditorClient(wkClient); + toImpl(pageRef)->setInjectedBundleEditorClient(wkClient ? std::make_unique<InjectedBundlePageEditorClient>(*wkClient) : std::make_unique<API::InjectedBundle::EditorClient>()); } void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClientBase* wkClient) { - toImpl(pageRef)->initializeInjectedBundleFormClient(wkClient); + toImpl(pageRef)->setInjectedBundleFormClient(std::make_unique<InjectedBundlePageFormClient>(wkClient)); } void WKBundlePageSetPageLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClientBase* wkClient) @@ -98,7 +109,7 @@ void WKBundlePageSetPolicyClient(WKBundlePageRef pageRef, WKBundlePagePolicyClie void WKBundlePageSetUIClient(WKBundlePageRef pageRef, WKBundlePageUIClientBase* wkClient) { - toImpl(pageRef)->initializeInjectedBundleUIClient(wkClient); + toImpl(pageRef)->setInjectedBundleUIClient(std::make_unique<InjectedBundlePageUIClient>(wkClient)); } void WKBundlePageSetFullScreenClient(WKBundlePageRef pageRef, WKBundlePageFullScreenClientBase* wkClient) @@ -147,11 +158,6 @@ void WKBundlePageDidExitFullScreen(WKBundlePageRef pageRef) #endif } -void WKBundlePageSetDiagnosticLoggingClient(WKBundlePageRef pageRef, WKBundlePageDiagnosticLoggingClientBase* client) -{ - toImpl(pageRef)->initializeInjectedBundleDiagnosticLoggingClient(client); -} - WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef pageRef) { return toAPI(toImpl(pageRef)->pageGroup()); @@ -165,7 +171,7 @@ WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef) void WKBundlePageClickMenuItem(WKBundlePageRef pageRef, WKContextMenuItemRef item) { #if ENABLE(CONTEXT_MENUS) - toImpl(pageRef)->contextMenu()->itemSelected(*toImpl(item)->data()); + toImpl(pageRef)->contextMenu()->itemSelected(toImpl(item)->data()); #else UNUSED_PARAM(pageRef); UNUSED_PARAM(item); @@ -183,7 +189,7 @@ static PassRefPtr<API::Array> contextMenuItems(const WebContextMenu& contextMenu for (const auto& item : items) menuItems.uncheckedAppend(WebContextMenuItem::create(item)); - return API::Array::create(std::move(menuItems)); + return API::Array::create(WTFMove(menuItems)); } #endif @@ -214,6 +220,11 @@ WKArrayRef WKBundlePageCopyContextMenuAtPointInWindow(WKBundlePageRef pageRef, W #endif } +void WKBundlePageInsertNewlineInQuotedContent(WKBundlePageRef pageRef) +{ + toImpl(pageRef)->insertNewlineInQuotedContent(); +} + void* WKAccessibilityRootObject(WKBundlePageRef pageRef) { #if HAVE(ACCESSIBILITY) @@ -264,6 +275,22 @@ void* WKAccessibilityFocusedObject(WKBundlePageRef pageRef) #endif } +void WKAccessibilityEnableEnhancedAccessibility(bool enable) +{ +#if HAVE(ACCESSIBILITY) + WebCore::AXObjectCache::setEnhancedUserInterfaceAccessibility(enable); +#endif +} + +bool WKAccessibilityEnhancedAccessibilityEnabled() +{ +#if HAVE(ACCESSIBILITY) + return WebCore::AXObjectCache::accessibilityEnhancedUserInterfaceEnabled(); +#else + return false; +#endif +} + void WKBundlePageStopLoading(WKBundlePageRef pageRef) { toImpl(pageRef)->stopLoading(); @@ -336,27 +363,27 @@ WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef pageRe void WKBundlePageInstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) { - toImpl(pageRef)->installPageOverlay(toImpl(pageOverlayRef)); + toImpl(pageRef)->mainFrame()->pageOverlayController().installPageOverlay(*toImpl(pageOverlayRef)->coreOverlay(), WebCore::PageOverlay::FadeMode::DoNotFade); } void WKBundlePageUninstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) { - toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef)); + toImpl(pageRef)->mainFrame()->pageOverlayController().uninstallPageOverlay(*toImpl(pageOverlayRef)->coreOverlay(), WebCore::PageOverlay::FadeMode::DoNotFade); } void WKBundlePageInstallPageOverlayWithAnimation(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) { - toImpl(pageRef)->installPageOverlay(toImpl(pageOverlayRef), true); + toImpl(pageRef)->mainFrame()->pageOverlayController().installPageOverlay(*toImpl(pageOverlayRef)->coreOverlay(), WebCore::PageOverlay::FadeMode::Fade); } void WKBundlePageUninstallPageOverlayWithAnimation(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) { - toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef), true); + toImpl(pageRef)->mainFrame()->pageOverlayController().uninstallPageOverlay(*toImpl(pageOverlayRef)->coreOverlay(), WebCore::PageOverlay::FadeMode::Fade); } void WKBundlePageSetTopOverhangImage(WKBundlePageRef pageRef, WKImageRef imageRef) { -#if PLATFORM(MAC) && !PLATFORM(IOS) +#if PLATFORM(MAC) toImpl(pageRef)->setTopOverhangImage(toImpl(imageRef)); #else UNUSED_PARAM(pageRef); @@ -366,7 +393,7 @@ void WKBundlePageSetTopOverhangImage(WKBundlePageRef pageRef, WKImageRef imageRe void WKBundlePageSetBottomOverhangImage(WKBundlePageRef pageRef, WKImageRef imageRef) { -#if PLATFORM(MAC) && !PLATFORM(IOS) +#if PLATFORM(MAC) toImpl(pageRef)->setBottomOverhangImage(toImpl(imageRef)); #else UNUSED_PARAM(pageRef); @@ -404,7 +431,7 @@ bool WKBundlePageFindString(WKBundlePageRef pageRef, WKStringRef target, WKFindO WKImageRef WKBundlePageCreateSnapshotWithOptions(WKBundlePageRef pageRef, WKRect rect, WKSnapshotOptions options) { RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), 1, toSnapshotOptions(options)); - return toAPI(webImage.release().leakRef()); + return toAPI(webImage.leakRef()); } WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options) @@ -412,19 +439,19 @@ WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef pageRef, SnapshotOptions snapshotOptions = snapshotOptionsFromImageOptions(options); snapshotOptions |= SnapshotOptionsInViewCoordinates; RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), 1, snapshotOptions); - return toAPI(webImage.release().leakRef()); + return toAPI(webImage.leakRef()); } WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options) { RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), 1, snapshotOptionsFromImageOptions(options)); - return toAPI(webImage.release().leakRef()); + return toAPI(webImage.leakRef()); } WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef pageRef, WKRect rect, double scaleFactor, WKImageOptions options) { RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), scaleFactor, snapshotOptionsFromImageOptions(options)); - return toAPI(webImage.release().leakRef()); + return toAPI(webImage.leakRef()); } double WKBundlePageGetBackingScaleFactor(WKBundlePageRef pageRef) @@ -439,12 +466,7 @@ void WKBundlePageListenForLayoutMilestones(WKBundlePageRef pageRef, WKLayoutMile WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef) { -#if ENABLE(INSPECTOR) return toAPI(toImpl(pageRef)->inspector()); -#else - UNUSED_PARAM(pageRef); - return 0; -#endif } void WKBundlePageForceRepaint(WKBundlePageRef page) @@ -505,7 +527,7 @@ void WKBundlePageResetTrackedRepaints(WKBundlePageRef pageRef) WKArrayRef WKBundlePageCopyTrackedRepaintRects(WKBundlePageRef pageRef) { - return toAPI(toImpl(pageRef)->trackedRepaintRects().leakRef()); + return toAPI(&toImpl(pageRef)->trackedRepaintRects().leakRef()); } void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int from, int length) @@ -542,3 +564,143 @@ void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef pa { toImpl(pageRef)->stopExtendingIncrementalRenderingSuppression(token); } + +bool WKBundlePageIsUsingEphemeralSession(WKBundlePageRef pageRef) +{ + return toImpl(pageRef)->usesEphemeralSession(); +} + +bool WKBundlePageIsControlledByAutomation(WKBundlePageRef pageRef) +{ + return toImpl(pageRef)->isControlledByAutomation(); +} + +#if TARGET_OS_IPHONE +void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef pageRef, bool useTestingViewportConfiguration) +{ + toImpl(pageRef)->setUseTestingViewportConfiguration(useTestingViewportConfiguration); +} +#endif + +void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef pageRef) +{ + WebKit::WebPage* webPage = toImpl(pageRef); + WebCore::Page* page = webPage ? webPage->corePage() : nullptr; + + if (!page) + return; + + page->ensureTestTrigger(); +} + +void WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, void* context) +{ + if (!callback) + return; + + WebKit::WebPage* webPage = toImpl(pageRef); + WebCore::Page* page = webPage ? webPage->corePage() : nullptr; + if (!page || !page->expectsWheelEventTriggers()) + return; + + page->ensureTestTrigger().setTestCallbackAndStartNotificationTimer([=]() { + callback(context); + }); +} + +void WKBundlePagePostMessage(WKBundlePageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef) +{ + toImpl(pageRef)->postMessage(toWTFString(messageNameRef), toImpl(messageBodyRef)); +} + +void WKBundlePagePostSynchronousMessageForTesting(WKBundlePageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef, WKTypeRef* returnDataRef) +{ + WebPage* page = toImpl(pageRef); + page->layoutIfNeeded(); + + RefPtr<API::Object> returnData; + page->postSynchronousMessageForTesting(toWTFString(messageNameRef), toImpl(messageBodyRef), returnData); + if (returnDataRef) + *returnDataRef = toAPI(returnData.leakRef()); +} + +void WKBundlePageAddUserScript(WKBundlePageRef pageRef, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames) +{ + toImpl(pageRef)->addUserScript(toWTFString(source), toUserContentInjectedFrames(injectedFrames), toUserScriptInjectionTime(injectionTime)); +} + +void WKBundlePageAddUserStyleSheet(WKBundlePageRef pageRef, WKStringRef source, WKUserContentInjectedFrames injectedFrames) +{ + toImpl(pageRef)->addUserStyleSheet(toWTFString(source), toUserContentInjectedFrames(injectedFrames)); +} + +void WKBundlePageRemoveAllUserContent(WKBundlePageRef pageRef) +{ + toImpl(pageRef)->removeAllUserContent(); +} + +WKStringRef WKBundlePageCopyGroupIdentifier(WKBundlePageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->pageGroup()->identifier()); +} + +void WKBundlePageClearApplicationCache(WKBundlePageRef page) +{ + toImpl(page)->corePage()->applicationCacheStorage().deleteAllEntries(); +} + +void WKBundlePageClearApplicationCacheForOrigin(WKBundlePageRef page, WKStringRef origin) +{ + toImpl(page)->corePage()->applicationCacheStorage().deleteCacheForOrigin(WebCore::SecurityOrigin::createFromString(toImpl(origin)->string())); +} + +void WKBundlePageSetAppCacheMaximumSize(WKBundlePageRef page, uint64_t size) +{ + toImpl(page)->corePage()->applicationCacheStorage().setMaximumSize(size); +} + +uint64_t WKBundlePageGetAppCacheUsageForOrigin(WKBundlePageRef page, WKStringRef origin) +{ + return toImpl(page)->corePage()->applicationCacheStorage().diskUsageForOrigin(WebCore::SecurityOrigin::createFromString(toImpl(origin)->string())); +} + +void WKBundlePageSetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin, uint64_t bytes) +{ + toImpl(page)->corePage()->applicationCacheStorage().storeUpdatedQuotaForOrigin(WebCore::SecurityOrigin::createFromString(toImpl(origin)->string()).ptr(), bytes); +} + +void WKBundlePageResetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin) +{ + toImpl(page)->corePage()->applicationCacheStorage().storeUpdatedQuotaForOrigin(WebCore::SecurityOrigin::createFromString(toImpl(origin)->string()).ptr(), toImpl(page)->corePage()->applicationCacheStorage().defaultOriginQuota()); +} + +WKArrayRef WKBundlePageCopyOriginsWithApplicationCache(WKBundlePageRef page) +{ + HashSet<RefPtr<WebCore::SecurityOrigin>> origins; + toImpl(page)->corePage()->applicationCacheStorage().getOriginsWithCache(origins); + + Vector<RefPtr<API::Object>> originIdentifiers; + originIdentifiers.reserveInitialCapacity(origins.size()); + + for (const auto& origin : origins) + originIdentifiers.uncheckedAppend(API::String::create(WebCore::SecurityOriginData::fromSecurityOrigin(*origin).databaseIdentifier())); + + return toAPI(&API::Array::create(WTFMove(originIdentifiers)).leakRef()); +} + +void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef page, WKEventThrottlingBehavior* behavior) +{ + std::optional<WebCore::EventThrottlingBehavior> behaviorValue; + if (behavior) { + switch (*behavior) { + case kWKEventThrottlingBehaviorResponsive: + behaviorValue = WebCore::EventThrottlingBehavior::Responsive; + break; + case kWKEventThrottlingBehaviorUnresponsive: + behaviorValue = WebCore::EventThrottlingBehavior::Unresponsive; + break; + } + } + + toImpl(page)->corePage()->setEventThrottlingBehaviorOverride(behaviorValue); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index 6c3ac2a26..de2ead3de 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,18 +27,17 @@ #define WKBundlePage_h #include <JavaScriptCore/JavaScript.h> -#include <WebKit2/WKBase.h> -#include <WebKit2/WKBundlePageContextMenuClient.h> -#include <WebKit2/WKBundlePageDiagnosticLoggingClient.h> -#include <WebKit2/WKBundlePageEditorClient.h> -#include <WebKit2/WKBundlePageFormClient.h> -#include <WebKit2/WKBundlePageFullScreenClient.h> -#include <WebKit2/WKBundlePageLoaderClient.h> -#include <WebKit2/WKBundlePagePolicyClient.h> -#include <WebKit2/WKBundlePageResourceLoadClient.h> -#include <WebKit2/WKBundlePageUIClient.h> -#include <WebKit2/WKFindOptions.h> -#include <WebKit2/WKImage.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKBundlePageContextMenuClient.h> +#include <WebKit/WKBundlePageEditorClient.h> +#include <WebKit/WKBundlePageFormClient.h> +#include <WebKit/WKBundlePageFullScreenClient.h> +#include <WebKit/WKBundlePageLoaderClient.h> +#include <WebKit/WKBundlePagePolicyClient.h> +#include <WebKit/WKBundlePageResourceLoadClient.h> +#include <WebKit/WKBundlePageUIClient.h> +#include <WebKit/WKFindOptions.h> +#include <WebKit/WKImage.h> #ifndef __cplusplus #include <stdbool.h> @@ -65,7 +64,6 @@ WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundleP WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClientBase* client); WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClientBase* client); WK_EXPORT void WKBundlePageSetFullScreenClient(WKBundlePageRef page, WKBundlePageFullScreenClientBase* client); -WK_EXPORT void WKBundlePageSetDiagnosticLoggingClient(WKBundlePageRef page, WKBundlePageDiagnosticLoggingClientBase* client); WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page); WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page); @@ -107,6 +105,22 @@ WK_EXPORT void WKBundlePageListenForLayoutMilestones(WKBundlePageRef page, WKLay WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page); +WK_EXPORT bool WKBundlePageIsUsingEphemeralSession(WKBundlePageRef page); + +WK_EXPORT bool WKBundlePageIsControlledByAutomation(WKBundlePageRef page); + +WK_EXPORT void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef page); + +WK_EXPORT WKStringRef WKBundlePageCopyGroupIdentifier(WKBundlePageRef page); + +typedef void (*WKBundlePageTestNotificationCallback)(void* context); +WK_EXPORT void WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context); + +WK_EXPORT void WKBundlePagePostMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody); + +// Switches a connection into a fully synchronous mode, so all messages become synchronous until we get a response. +WK_EXPORT void WKBundlePagePostSynchronousMessageForTesting(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageBanner.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageBanner.cpp new file mode 100644 index 000000000..be0955e1c --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageBanner.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2013 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 "WKBundlePageBanner.h" + +#include "PageBanner.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundlePageBannerGetTypeID() +{ + return toAPI(PageBanner::APIType); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageDiagnosticLoggingClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageBanner.h index f0dc04139..13525724c 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageDiagnosticLoggingClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageBanner.h @@ -23,32 +23,46 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKBundlePageDiagnosticLoggingClient_h -#define WKBundlePageDiagnosticLoggingClient_h +#ifndef WKBundlePageBanner_h +#define WKBundlePageBanner_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKEvent.h> +#include <WebKit/WKGeometry.h> -typedef void (*WKBundlePageDiagnosticLoggingCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef description, WKStringRef success, const void* clientInfo); +#ifndef __cplusplus +#include <stdbool.h> +#endif -typedef struct WKBundlePageDiagnosticLoggingClientBase { +#ifdef __cplusplus +extern "C" { +#endif + +// Page banner client. +typedef bool (*WKBundlePageBannerMouseDownCallback)(WKBundlePageBannerRef pageBanner, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); +typedef bool (*WKBundlePageBannerMouseUpCallback)(WKBundlePageBannerRef pageBanner, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); +typedef bool (*WKBundlePageBannerMouseMovedCallback)(WKBundlePageBannerRef pageBanner, WKPoint position, const void* clientInfo); +typedef bool (*WKBundlePageBannerMouseDraggedCallback)(WKBundlePageBannerRef pageBanner, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); + +typedef struct WKBundlePageBannerClientBase { int version; const void * clientInfo; -} WKBundlePageDiagnosticLoggingClientBase; +} WKBundlePageBannerClientBase; -typedef struct WKBundlePageDiagnosticLoggingClientV0 { - WKBundlePageDiagnosticLoggingClientBase base; +typedef struct WKBundlePageBannerClientV0 { + WKBundlePageBannerClientBase base; // Version 0. - WKBundlePageDiagnosticLoggingCallback logDiagnosticMessage; -} WKBundlePageDiagnosticLoggingClientV0; + WKBundlePageBannerMouseDownCallback mouseDown; + WKBundlePageBannerMouseUpCallback mouseUp; + WKBundlePageBannerMouseMovedCallback mouseMoved; + WKBundlePageBannerMouseDraggedCallback mouseDragged; +} WKBundlePageBannerClientV0; -enum { kWKBundlePageDiagnosticLoggingClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 }; -typedef struct WKBundlePageDiagnosticLoggingClient { - int version; - const void * clientInfo; +WK_EXPORT WKTypeID WKBundlePageBannerGetTypeID(); - // Version 0. - WKBundlePageDiagnosticLoggingCallback logDiagnosticMessage; -} WKBundlePageDiagnosticLoggingClient WK_DEPRECATED("Use an explicit versioned struct instead"); +#ifdef __cplusplus +} +#endif -#endif // WKBundlePageDiagnosticLoggingClient_h +#endif // WKBundlePageBanner_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h index 55cdb18a3..00b1f048a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h @@ -26,9 +26,10 @@ #ifndef WKBundlePageContextMenuClient_h #define WKBundlePageContextMenuClient_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> typedef void (*WKBundlePageGetContextMenuFromDefaultContextMenuCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKArrayRef defaultMenu, WKArrayRef* newMenu, WKTypeRef* userData, const void* clientInfo); +typedef void (*WKBundlePagePrepareForActionMenuCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKTypeRef* userData, const void* clientInfo); typedef struct WKBundlePageContextMenuClientBase { int version; @@ -38,17 +39,16 @@ typedef struct WKBundlePageContextMenuClientBase { typedef struct WKBundlePageContextMenuClientV0 { WKBundlePageContextMenuClientBase base; - // Version 0. WKBundlePageGetContextMenuFromDefaultContextMenuCallback getContextMenuFromDefaultMenu; } WKBundlePageContextMenuClientV0; -enum { kWKBundlePageContextMenuClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 }; -typedef struct WKBundlePageContextMenuClient { - int version; - const void * clientInfo; +typedef struct WKBundlePageContextMenuClientV1 { + WKBundlePageContextMenuClientBase base; - // Version 0. WKBundlePageGetContextMenuFromDefaultContextMenuCallback getContextMenuFromDefaultMenu; -} WKBundlePageContextMenuClient WK_DEPRECATED("Use an explicit versioned struct instead"); + + // This is actually about immediate actions; we should consider deprecating and renaming. + WKBundlePagePrepareForActionMenuCallback prepareForActionMenu; +} WKBundlePageContextMenuClientV1; #endif // WKBundlePageContextMenuClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h index 570d4e6f2..998e3e8da 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h @@ -26,7 +26,7 @@ #ifndef WKBundlePageEditorClient_h #define WKBundlePageEditorClient_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> enum { kWKInsertActionTyped = 0, @@ -114,28 +114,4 @@ typedef struct WKBundlePageEditorClientV1 { WKBundlePageDidWriteToPasteboard didWriteToPasteboard; } WKBundlePageEditorClientV1; -enum { kWKBundlePageEditorClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 1 }; -typedef struct WKBundlePageEditorClient { - int version; - const void * clientInfo; - - // Version 0. - WKBundlePageShouldBeginEditingCallback shouldBeginEditing; - WKBundlePageShouldEndEditingCallback shouldEndEditing; - WKBundlePageShouldInsertNodeCallback shouldInsertNode; - WKBundlePageShouldInsertTextCallback shouldInsertText; - WKBundlePageShouldDeleteRangeCallback shouldDeleteRange; - WKBundlePageShouldChangeSelectedRange shouldChangeSelectedRange; - WKBundlePageShouldApplyStyle shouldApplyStyle; - WKBundlePageEditingNotification didBeginEditing; - WKBundlePageEditingNotification didEndEditing; - WKBundlePageEditingNotification didChange; - WKBundlePageEditingNotification didChangeSelection; - - // Version 1. - WKBundlePageWillWriteToPasteboard willWriteToPasteboard; - WKBundlePageGetPasteboardDataForRange getPasteboardDataForRange; - WKBundlePageDidWriteToPasteboard didWriteToPasteboard; -} WKBundlePageEditorClient WK_DEPRECATED("Use an explicit versioned struct instead"); - #endif // WKBundlePageEditorClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h index 5bd3ed428..3fc33b98d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h @@ -26,7 +26,8 @@ #ifndef WKBundlePageFormClient_h #define WKBundlePageFormClient_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKBundlePageEditorClient.h> typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); typedef void (*WKBundlePageTextFieldDidEndEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); @@ -91,26 +92,4 @@ typedef struct WKBundlePageFormClientV2 { WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls; } WKBundlePageFormClientV2; -enum { kWKBundlePageFormClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 2 }; -typedef struct WKBundlePageFormClient { - int version; - const void * clientInfo; - - // Version 0. - WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; - WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; - WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; - WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; - WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField; - WKBundlePageWillSubmitFormCallback willSubmitForm; - - // Version 1. - WKBundlePageWillSendSubmitEventCallback willSendSubmitEvent; - - // version 2. - WKBundlePageDidFocusTextFieldCallback didFocusTextField; - WKBundlePageShouldNotifyOnFormChangesCallback shouldNotifyOnFormChanges; - WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls; -} WKBundlePageFormClient WK_DEPRECATED("Use an explicit versioned struct instead"); - #endif // WKBundlePageFormClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFullScreenClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFullScreenClient.h index 38fe5d38c..687fb122b 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFullScreenClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFullScreenClient.h @@ -26,8 +26,8 @@ #ifndef WKBundlePageFullScreenClient_h #define WKBundlePageFullScreenClient_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> typedef bool (*WKBundlePageSupportsFullScreen)(WKBundlePageRef page, WKFullScreenKeyboardRequestType requestType); typedef void (*WKBundlePageEnterFullScreenForElement)(WKBundlePageRef page, WKBundleNodeHandleRef element); @@ -64,20 +64,4 @@ typedef struct WKBundlePageFullScreenClientV1 { WKBundlePageCloseFullScreen closeFullScreen; } WKBundlePageFullScreenClientV1; -enum { kWKBundlePageFullScreenClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 1 }; -typedef struct WKBundlePageFullScreenClient { - int version; - const void * clientInfo; - - // Version 0: - WKBundlePageSupportsFullScreen supportsFullScreen; - WKBundlePageEnterFullScreenForElement enterFullScreenForElement; - WKBundlePageExitFullScreenForElement exitFullScreenForElement; - - // Version 1: - WKBundlePageBeganEnterFullScreen beganEnterFullScreen; - WKBundlePageBeganExitFullScreen beganExitFullScreen; - WKBundlePageCloseFullScreen closeFullScreen; -} WKBundlePageFullScreenClient WK_DEPRECATED("Use an explicit versioned struct instead"); - #endif // WKBundlePageFullScreenClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h index e0bf64525..2438943b8 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h @@ -26,7 +26,7 @@ #ifndef WKBundlePageGroup_h #define WKBundlePageGroup_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h index 0224a6f7b..ee142dedf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h @@ -26,8 +26,8 @@ #ifndef WKBundlePageLoaderClient_h #define WKBundlePageLoaderClient_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKPageLoadTypes.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKPageLoadTypes.h> typedef void (*WKBundlePageDidStartProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); typedef void (*WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); @@ -61,7 +61,7 @@ typedef void (*WKBundlePageDidLayoutCallback)(WKBundlePageRef page, WKLayoutMile typedef void (*WKBundlePageFeaturesUsedInPageCallback)(WKBundlePageRef page, WKArrayRef featureStrings, const void *clientInfo); typedef void (*WKBundlePageWillLoadURLRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKTypeRef userData, const void *clientInfo); typedef void (*WKBundlePageWillLoadDataRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo); -typedef void (*WKBundlePageWillDestroyFrame)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); +typedef WKStringRef (*WKBundlePageUserAgentForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo); typedef struct WKBundlePageLoaderClientBase { int version; @@ -403,14 +403,12 @@ typedef struct WKBundlePageLoaderClientV7 { WKBundlePageWillLoadDataRequestCallback willLoadDataRequest; // Version 7 - WKBundlePageWillDestroyFrame willDestroyFrame; + void * willDestroyFrame_unavailable; } WKBundlePageLoaderClientV7; -enum { kWKBundlePageLoaderClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 7 }; -typedef struct WKBundlePageLoaderClient { - int version; - const void * clientInfo; - +typedef struct WKBundlePageLoaderClientV8 { + WKBundlePageLoaderClientBase base; + // Version 0. WKBundlePageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; @@ -430,7 +428,7 @@ typedef struct WKBundlePageLoaderClient { WKBundlePageDidCancelClientRedirectForFrameCallback didCancelClientRedirectForFrame; WKBundlePageWillPerformClientRedirectForFrameCallback willPerformClientRedirectForFrame; WKBundlePageDidHandleOnloadEventsForFrameCallback didHandleOnloadEventsForFrame; - + // Version 1. WKBundlePageDidLayoutForFrameCallback didLayoutForFrame; void * didNewFirstVisuallyNonEmptyLayout_unavailable; @@ -444,23 +442,26 @@ typedef struct WKBundlePageLoaderClient { // Version 2 WKBundlePageDidFinishProgressCallback didFinishProgress; WKBundlePageShouldForceUniversalAccessFromLocalURLCallback shouldForceUniversalAccessFromLocalURL; - + // Version 3 void * didReceiveIntentForFrame_unavailable; void * registerIntentServiceForFrame_unavailable; - + // Version 4 WKBundlePageDidLayoutCallback didLayout; - + // Version 5 WKBundlePageFeaturesUsedInPageCallback featuresUsedInPage; // Version 6 WKBundlePageWillLoadURLRequestCallback willLoadURLRequest; WKBundlePageWillLoadDataRequestCallback willLoadDataRequest; - + // Version 7 - WKBundlePageWillDestroyFrame willDestroyFrame; -} WKBundlePageLoaderClient WK_DEPRECATED("Use an explicit versioned struct instead"); + void * willDestroyFrame_unavailable; + + // Version 8 + WKBundlePageUserAgentForURLCallback userAgentForURL; +} WKBundlePageLoaderClientV8; #endif // WKBundlePageLoaderClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp index bba8626a5..bfecd33fa 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp @@ -27,15 +27,24 @@ #include "WKBundlePageOverlay.h" #include "APIClient.h" -#include "PageOverlay.h" +#include "InjectedBundleRangeHandle.h" #include "WKAPICast.h" +#include "WKArray.h" #include "WKBundleAPICast.h" +#include "WKNumber.h" +#include "WKRetainPtr.h" +#include "WKSharedAPICast.h" +#include "WKStringPrivate.h" +#include "WebPage.h" #include <WebCore/GraphicsContext.h> +#include <WebCore/PageOverlay.h> +#include <WebCore/PlatformMouseEvent.h> +#include <WebKit/WebPageOverlay.h> namespace API { template<> struct ClientTraits<WKBundlePageOverlayClientBase> { - typedef std::tuple<WKBundlePageOverlayClientV0> Versions; + typedef std::tuple<WKBundlePageOverlayClientV0, WKBundlePageOverlayClientV1> Versions; }; template<> struct ClientTraits<WKBundlePageOverlayAccessibilityClientBase> { @@ -47,7 +56,7 @@ template<> struct ClientTraits<WKBundlePageOverlayAccessibilityClientBase> { using namespace WebCore; using namespace WebKit; -class PageOverlayClientImpl : API::Client<WKBundlePageOverlayClientBase>, public PageOverlay::Client { +class PageOverlayClientImpl : API::Client<WKBundlePageOverlayClientBase>, public WebPageOverlay::Client { public: explicit PageOverlayClientImpl(WKBundlePageOverlayClientBase* client) { @@ -60,83 +69,144 @@ public: } private: - // PageOverlay::Client. - virtual void pageOverlayDestroyed(PageOverlay*) - { - delete this; - } - - virtual void willMoveToWebPage(PageOverlay* pageOverlay, WebPage* page) + // WebPageOverlay::Client. + void willMoveToPage(WebPageOverlay& pageOverlay, WebPage* page) override { if (!m_client.willMoveToPage) return; - m_client.willMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.base.clientInfo); + m_client.willMoveToPage(toAPI(&pageOverlay), toAPI(page), m_client.base.clientInfo); } - virtual void didMoveToWebPage(PageOverlay* pageOverlay, WebPage* page) + void didMoveToPage(WebPageOverlay& pageOverlay, WebPage* page) override { if (!m_client.didMoveToPage) return; - m_client.didMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.base.clientInfo); + m_client.didMoveToPage(toAPI(&pageOverlay), toAPI(page), m_client.base.clientInfo); } - virtual void drawRect(PageOverlay* pageOverlay, GraphicsContext& graphicsContext, const IntRect& dirtyRect) + void drawRect(WebPageOverlay& pageOverlay, GraphicsContext& graphicsContext, const IntRect& dirtyRect) override { if (!m_client.drawRect) return; - m_client.drawRect(toAPI(pageOverlay), graphicsContext.platformContext(), toAPI(dirtyRect), m_client.base.clientInfo); + m_client.drawRect(toAPI(&pageOverlay), graphicsContext.platformContext(), toAPI(dirtyRect), m_client.base.clientInfo); } - virtual bool mouseEvent(PageOverlay* pageOverlay, const WebMouseEvent& event) + bool mouseEvent(WebPageOverlay& pageOverlay, const PlatformMouseEvent& event) override { switch (event.type()) { - case WebEvent::MouseDown: { + case PlatformMouseEvent::Type::MousePressed: { if (!m_client.mouseDown) return false; - return m_client.mouseDown(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo); + return m_client.mouseDown(toAPI(&pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo); } - case WebEvent::MouseUp: { + case PlatformMouseEvent::Type::MouseReleased: { if (!m_client.mouseUp) return false; - return m_client.mouseUp(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo); + return m_client.mouseUp(toAPI(&pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo); } - case WebEvent::MouseMove: { - if (event.button() == WebMouseEvent::NoButton) { + case PlatformMouseEvent::Type::MouseMoved: { + if (event.button() == MouseButton::NoButton) { if (!m_client.mouseMoved) return false; - return m_client.mouseMoved(toAPI(pageOverlay), toAPI(event.position()), m_client.base.clientInfo); + return m_client.mouseMoved(toAPI(&pageOverlay), toAPI(event.position()), m_client.base.clientInfo); } // This is a MouseMove event with a mouse button pressed. Call mouseDragged. if (!m_client.mouseDragged) return false; - return m_client.mouseDragged(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo); + return m_client.mouseDragged(toAPI(&pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo); } default: return false; } } - - virtual WKTypeRef copyAccessibilityAttributeValue(PageOverlay* pageOverlay, WKStringRef attribute, WKTypeRef parameter) + +#if PLATFORM(MAC) + DDActionContext *actionContextForResultAtPoint(WebPageOverlay& pageOverlay, WebCore::FloatPoint location, RefPtr<WebCore::Range>& rangeHandle) override + { + if (m_client.actionContextForResultAtPoint) { + WKBundleRangeHandleRef apiRange = nullptr; + DDActionContext *actionContext = (DDActionContext *)m_client.actionContextForResultAtPoint(toAPI(&pageOverlay), WKPointMake(location.x(), location.y()), &apiRange, m_client.base.clientInfo); + + if (apiRange) + rangeHandle = toImpl(apiRange)->coreRange(); + + return actionContext; + } + + return nil; + } + + void dataDetectorsDidPresentUI(WebPageOverlay& pageOverlay) override + { + if (!m_client.dataDetectorsDidPresentUI) + return; + + m_client.dataDetectorsDidPresentUI(toAPI(&pageOverlay), m_client.base.clientInfo); + } + + void dataDetectorsDidChangeUI(WebPageOverlay& pageOverlay) override + { + if (!m_client.dataDetectorsDidChangeUI) + return; + + m_client.dataDetectorsDidChangeUI(toAPI(&pageOverlay), m_client.base.clientInfo); + } + + void dataDetectorsDidHideUI(WebPageOverlay& pageOverlay) override + { + if (!m_client.dataDetectorsDidHideUI) + return; + + m_client.dataDetectorsDidHideUI(toAPI(&pageOverlay), m_client.base.clientInfo); + } +#endif // PLATFORM(MAC) + + bool copyAccessibilityAttributeStringValueForPoint(WebPageOverlay& pageOverlay, String attribute, WebCore::FloatPoint parameter, String& value) override { if (!m_accessibilityClient.client().copyAccessibilityAttributeValue) - return 0; - return m_accessibilityClient.client().copyAccessibilityAttributeValue(toAPI(pageOverlay), attribute, parameter, m_accessibilityClient.client().base.clientInfo); + return false; + auto wkType = m_accessibilityClient.client().copyAccessibilityAttributeValue(toAPI(&pageOverlay), toCopiedAPI(attribute), WKPointCreate(WKPointMake(parameter.x(), parameter.y())), m_accessibilityClient.client().base.clientInfo); + if (toImpl(wkType)->type() != API::String::APIType) + return false; + value = toWTFString(static_cast<WKStringRef>(wkType)); + return true; } - virtual WKArrayRef copyAccessibilityAttributeNames(PageOverlay* pageOverlay, bool paramerizedNames) + bool copyAccessibilityAttributeBoolValueForPoint(WebPageOverlay& pageOverlay, String attribute, WebCore::FloatPoint parameter, bool& value) override { + if (!m_accessibilityClient.client().copyAccessibilityAttributeValue) + return false; + auto wkType = m_accessibilityClient.client().copyAccessibilityAttributeValue(toAPI(&pageOverlay), toCopiedAPI(attribute), WKPointCreate(WKPointMake(parameter.x(), parameter.y())), m_accessibilityClient.client().base.clientInfo); + if (toImpl(wkType)->type() != API::Boolean::APIType) + return false; + value = WKBooleanGetValue(static_cast<WKBooleanRef>(wkType)); + return true; + } + + Vector<String> copyAccessibilityAttributeNames(WebPageOverlay& pageOverlay, bool paramerizedNames) override + { + Vector<String> names; if (!m_accessibilityClient.client().copyAccessibilityAttributeNames) - return 0; - return m_accessibilityClient.client().copyAccessibilityAttributeNames(toAPI(pageOverlay), paramerizedNames, m_accessibilityClient.client().base.clientInfo); + return names; + auto wkNames = m_accessibilityClient.client().copyAccessibilityAttributeNames(toAPI(&pageOverlay), paramerizedNames, m_accessibilityClient.client().base.clientInfo); + + size_t count = WKArrayGetSize(wkNames); + for (size_t k = 0; k < count; k++) { + WKTypeRef item = WKArrayGetItemAtIndex(wkNames, k); + if (toImpl(item)->type() == API::String::APIType) + names.append(toWTFString(static_cast<WKStringRef>(item))); + } + + return names; } API::Client<WKBundlePageOverlayAccessibilityClientBase> m_accessibilityClient; @@ -144,25 +214,18 @@ private: WKTypeID WKBundlePageOverlayGetTypeID() { - return toAPI(PageOverlay::APIType); + return toAPI(WebPageOverlay::APIType); } WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClientBase* wkClient) { - if (wkClient && wkClient->version) - return 0; - auto clientImpl = std::make_unique<PageOverlayClientImpl>(wkClient); - - // FIXME: Looks like this leaks the clientImpl. - return toAPI(PageOverlay::create(clientImpl.release()).leakRef()); + return toAPI(&WebPageOverlay::create(WTFMove(clientImpl)).leakRef()); } void WKBundlePageOverlaySetAccessibilityClient(WKBundlePageOverlayRef bundlePageOverlayRef, WKBundlePageOverlayAccessibilityClientBase* client) { - if (client && client->version) - return; - static_cast<PageOverlayClientImpl*>(toImpl(bundlePageOverlayRef)->client())->setAccessibilityClient(client); + static_cast<PageOverlayClientImpl&>(toImpl(bundlePageOverlayRef)->client()).setAccessibilityClient(client); } void WKBundlePageOverlaySetNeedsDisplay(WKBundlePageOverlayRef bundlePageOverlayRef, WKRect rect) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h index c96bb4cf3..ae76a5f77 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h @@ -26,9 +26,9 @@ #ifndef WKBundlePageOverlay_h #define WKBundlePageOverlay_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKEvent.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKEvent.h> +#include <WebKit/WKGeometry.h> #ifndef __cplusplus #include <stdbool.h> @@ -49,6 +49,11 @@ typedef bool (*WKBundlePageOverlayMouseUpCallback)(WKBundlePageOverlayRef pageOv typedef bool (*WKBundlePageOverlayMouseMovedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, const void* clientInfo); typedef bool (*WKBundlePageOverlayMouseDraggedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); +typedef void* (*WKBundlePageOverlayActionContextForResultAtPointCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKBundleRangeHandleRef* rangeHandle, const void* clientInfo); +typedef void (*WKBundlePageOverlayDataDetectorsDidPresentUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo); +typedef void (*WKBundlePageOverlayDataDetectorsDidChangeUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo); +typedef void (*WKBundlePageOverlayDataDetectorsDidHideUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo); + typedef struct WKBundlePageOverlayClientBase { int version; const void * clientInfo; @@ -57,7 +62,6 @@ typedef struct WKBundlePageOverlayClientBase { typedef struct WKBundlePageOverlayClientV0 { WKBundlePageOverlayClientBase base; - // Version 0. WKBundlePageOverlayWillMoveToPageCallback willMoveToPage; WKBundlePageOverlayDidMoveToPageCallback didMoveToPage; WKBundlePageOverlayDrawRectCallback drawRect; @@ -67,12 +71,9 @@ typedef struct WKBundlePageOverlayClientV0 { WKBundlePageOverlayMouseDraggedCallback mouseDragged; } WKBundlePageOverlayClientV0; -enum { kWKBundlePageOverlayClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 }; -typedef struct WKBundlePageOverlayClient { - int version; - const void * clientInfo; +typedef struct WKBundlePageOverlayClientV1 { + WKBundlePageOverlayClientBase base; - // Version 0. WKBundlePageOverlayWillMoveToPageCallback willMoveToPage; WKBundlePageOverlayDidMoveToPageCallback didMoveToPage; WKBundlePageOverlayDrawRectCallback drawRect; @@ -80,7 +81,12 @@ typedef struct WKBundlePageOverlayClient { WKBundlePageOverlayMouseUpCallback mouseUp; WKBundlePageOverlayMouseMovedCallback mouseMoved; WKBundlePageOverlayMouseDraggedCallback mouseDragged; -} WKBundlePageOverlayClient WK_DEPRECATED("Use an explicit versioned struct instead"); + + WKBundlePageOverlayActionContextForResultAtPointCallback actionContextForResultAtPoint; + WKBundlePageOverlayDataDetectorsDidPresentUI dataDetectorsDidPresentUI; + WKBundlePageOverlayDataDetectorsDidChangeUI dataDetectorsDidChangeUI; + WKBundlePageOverlayDataDetectorsDidHideUI dataDetectorsDidHideUI; +} WKBundlePageOverlayClientV1; typedef WKTypeRef (*WKAccessibilityAttributeValueCallback)(WKBundlePageOverlayRef pageOverlay, WKStringRef attribute, WKTypeRef parameter, const void* clientInfo); typedef WKArrayRef (*WKAccessibilityAttributeNamesCallback)(WKBundlePageOverlayRef pageOverlay, bool parameterizedNames, const void* clientInfo); @@ -98,16 +104,6 @@ typedef struct WKBundlePageOverlayAccessibilityClientV0 { WKAccessibilityAttributeNamesCallback copyAccessibilityAttributeNames; } WKBundlePageOverlayAccessibilityClientV0; -enum { kWKBundlePageOverlayAccessibilityClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 }; -typedef struct WKBundlePageOverlayAccessibilityClient { - int version; - const void * clientInfo; - - // Version 0. - WKAccessibilityAttributeValueCallback copyAccessibilityAttributeValue; - WKAccessibilityAttributeNamesCallback copyAccessibilityAttributeNames; -} WKBundlePageOverlayAccessibilityClient WK_DEPRECATED("Use an explicit versioned struct instead"); - WK_EXPORT WKTypeID WKBundlePageOverlayGetTypeID(); WK_EXPORT WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClientBase* client); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePolicyClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePolicyClient.h index a421c6742..cb2ef16b3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePolicyClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePolicyClient.h @@ -26,7 +26,7 @@ #ifndef WKBundlePagePolicyClient_h #define WKBundlePagePolicyClient_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> enum { WKBundlePagePolicyActionPassThrough, @@ -54,16 +54,4 @@ typedef struct WKBundlePagePolicyClientV0 { WKBundlePageUnableToImplementPolicyCallback unableToImplementPolicy; } WKBundlePagePolicyClientV0; -enum { kWKBundlePagePolicyClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 }; -typedef struct WKBundlePagePolicyClient { - int version; - const void * clientInfo; - - // Version 0. - WKBundlePageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; - WKBundlePageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; - WKBundlePageDecidePolicyForResponseCallback decidePolicyForResponse; - WKBundlePageUnableToImplementPolicyCallback unableToImplementPolicy; -} WKBundlePagePolicyClient WK_DEPRECATED("Use an explicit versioned struct instead"); - #endif // WKBundlePagePolicyClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h index 2461c3826..0458d966a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h @@ -26,9 +26,11 @@ #ifndef WKBundlePagePrivate_h #define WKBundlePagePrivate_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKEvent.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKEvent.h> +#include <WebKit/WKGeometry.h> +#include <WebKit/WKUserContentInjectedFrames.h> +#include <WebKit/WKUserScriptInjectionTime.h> #ifdef __cplusplus extern "C" { @@ -80,16 +82,48 @@ WK_EXPORT bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeType WK_EXPORT void* WKAccessibilityRootObject(WKBundlePageRef); WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef); -WK_EXPORT WKStringRef WKBundlePageCopyContextMenuItemTitle(WKContextMenuItemRef); +WK_EXPORT void WKAccessibilityEnableEnhancedAccessibility(bool); +WK_EXPORT bool WKAccessibilityEnhancedAccessibilityEnabled(); + WK_EXPORT void WKBundlePageClickMenuItem(WKBundlePageRef, WKContextMenuItemRef); WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuItems(WKBundlePageRef); WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuAtPointInWindow(WKBundlePageRef, WKPoint); +WK_EXPORT void WKBundlePageInsertNewlineInQuotedContent(WKBundlePageRef page); + // This only works if the SuppressesIncrementalRendering preference is set as well. typedef unsigned WKRenderingSuppressionToken; WK_EXPORT WKRenderingSuppressionToken WKBundlePageExtendIncrementalRenderingSuppression(WKBundlePageRef); WK_EXPORT void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef, WKRenderingSuppressionToken); +// UserContent API (compatible with Modern API, for WKTR) +WK_EXPORT void WKBundlePageAddUserScript(WKBundlePageRef page, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames); +WK_EXPORT void WKBundlePageAddUserStyleSheet(WKBundlePageRef page, WKStringRef source, WKUserContentInjectedFrames injectedFrames); +WK_EXPORT void WKBundlePageRemoveAllUserContent(WKBundlePageRef page); + +// Application Cache API, for WKTR. +WK_EXPORT void WKBundlePageClearApplicationCache(WKBundlePageRef page); +WK_EXPORT void WKBundlePageClearApplicationCacheForOrigin(WKBundlePageRef page, WKStringRef origin); +WK_EXPORT void WKBundlePageSetAppCacheMaximumSize(WKBundlePageRef page, uint64_t size); +WK_EXPORT uint64_t WKBundlePageGetAppCacheUsageForOrigin(WKBundlePageRef page, WKStringRef origin); +WK_EXPORT void WKBundlePageSetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin, uint64_t bytes); +WK_EXPORT void WKBundlePageResetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin); +WK_EXPORT WKArrayRef WKBundlePageCopyOriginsWithApplicationCache(WKBundlePageRef page); + +enum { + kWKEventThrottlingBehaviorResponsive = 0, + kWKEventThrottlingBehaviorUnresponsive +}; + +typedef uint32_t WKEventThrottlingBehavior; + +// Passing null in the second parameter clears the override. +WK_EXPORT void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef, WKEventThrottlingBehavior*); + +#if TARGET_OS_IPHONE +WK_EXPORT void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef, bool); +#endif + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageResourceLoadClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageResourceLoadClient.h index 2acde682c..fee6cc2e7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageResourceLoadClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageResourceLoadClient.h @@ -26,7 +26,7 @@ #ifndef WKBundlePageResourceLoadClient_h #define WKBundlePageResourceLoadClient_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> typedef void (*WKBundlePageDidInitiateLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, bool pageIsProvisionallyLoading, const void* clientInfo); typedef WKURLRequestRef (*WKBundlePageWillSendRequestForFrameCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, WKURLResponseRef redirectResponse, const void *clientInfo); @@ -76,25 +76,4 @@ typedef struct WKBundlePageResourceLoadClientV1 { WKBundlePageShouldUseCredentialStorageCallback shouldUseCredentialStorage; } WKBundlePageResourceLoadClientV1; -enum { kWKBundlePageResourceLoadClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 1 }; -typedef struct WKBundlePageResourceLoadClient { - int version; - const void * clientInfo; - - // Version 0. - WKBundlePageDidInitiateLoadForResourceCallback didInitiateLoadForResource; - - // willSendRequestForFrame is supposed to return a retained reference to the URL request. - WKBundlePageWillSendRequestForFrameCallback willSendRequestForFrame; - - WKBundlePageDidReceiveResponseForResourceCallback didReceiveResponseForResource; - WKBundlePageDidReceiveContentLengthForResourceCallback didReceiveContentLengthForResource; - WKBundlePageDidFinishLoadForResourceCallback didFinishLoadForResource; - WKBundlePageDidFailLoadForResourceCallback didFailLoadForResource; - - // Version 1. - WKBundlePageShouldCacheResponseCallback shouldCacheResponse; - WKBundlePageShouldUseCredentialStorageCallback shouldUseCredentialStorage; -} WKBundlePageResourceLoadClient WK_DEPRECATED("Use an explicit versioned struct instead"); - #endif // WKBundlePageResourceLoadClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h index e29656eb7..e07a6b2e6 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h @@ -26,8 +26,8 @@ #ifndef WKBundlePageUIClient_h #define WKBundlePageUIClient_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKEvent.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKEvent.h> enum { WKBundlePageUIElementVisibilityUnknown, @@ -54,6 +54,7 @@ typedef WKStringRef (*WKBundlePagePlugInCreateStartLabelTitleCallback)(WKStringR typedef WKStringRef (*WKBundlePagePlugInCreateStartLabelSubtitleCallback)(WKStringRef mimeType, const void *clientInfo); typedef WKStringRef (*WKBundlePagePlugInCreateExtraStyleSheetCallback)(const void *clientInfo); typedef WKStringRef (*WKBundlePagePlugInCreateExtraScriptCallback)(const void *clientInfo); +typedef void (*WKBundlePageDidClickAutoFillButtonCallback)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo); typedef struct WKBundlePageUIClientBase { int version; @@ -133,10 +134,8 @@ typedef struct WKBundlePageUIClientV2 { WKBundlePagePlugInCreateExtraScriptCallback createPlugInExtraScript; } WKBundlePageUIClientV2; -enum { kWKBundlePageUIClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 2 }; -typedef struct WKBundlePageUIClient { - int version; - const void * clientInfo; +typedef struct WKBundlePageUIClientV3 { + WKBundlePageUIClientBase base; // Version 0. WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole; @@ -163,6 +162,13 @@ typedef struct WKBundlePageUIClient { WKBundlePagePlugInCreateStartLabelSubtitleCallback createPlugInStartLabelSubtitle; WKBundlePagePlugInCreateExtraStyleSheetCallback createPlugInExtraStyleSheet; WKBundlePagePlugInCreateExtraScriptCallback createPlugInExtraScript; -} WKBundlePageUIClient WK_DEPRECATED("Use an explicit versioned struct instead"); + + // Version 3. + void* unused3; + void* unused4; + void* unused5; + + WKBundlePageDidClickAutoFillButtonCallback didClickAutoFillButton; +} WKBundlePageUIClientV3; #endif // WKBundlePageUIClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index f7d7e25dc..047afb19d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,35 +26,31 @@ #ifndef WKBundlePrivate_h #define WKBundlePrivate_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifndef __cplusplus #include <stdbool.h> #endif #include <JavaScriptCore/JSBase.h> -#include <WebKit2/WKUserContentInjectedFrames.h> -#include <WebKit2/WKUserScriptInjectionTime.h> +#include <WebKit/WKUserContentInjectedFrames.h> +#include <WebKit/WKUserScriptInjectionTime.h> #ifdef __cplusplus extern "C" { #endif -// TestRunner only SPI -WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shouldTrackVisitedLinks); -WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool); -WK_EXPORT void WKBundleRemoveAllVisitedLinks(WKBundleRef bundle); -WK_EXPORT void WKBundleActivateMacFontAscentHack(WKBundleRef bundle); -WK_EXPORT void WKBundleSetCacheModel(WKBundleRef bundle, uint32_t cacheModel); +// TestRunner only SPIs. // Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use. WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef preference, bool enabled); WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); +WK_EXPORT void WKBundleSetAllowStorageAccessFromFileURLS(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool needsQuirk); WK_EXPORT void WKBundleSetMinimumLogicalFontSize(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, int size); WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); -WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); +WK_EXPORT void WKBundleSetUseDashboardCompatibilityMode(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetAuthorAndUserStylesEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetSpatialNavigationEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); @@ -73,7 +69,7 @@ WK_EXPORT WKDataRef WKBundleCreateWKDataFromUInt8Array(WKBundleRef bundle, JSCon WK_EXPORT void WKBundleSetAsynchronousSpellCheckingEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled); // UserContent API -WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames); +WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames); WK_EXPORT void WKBundleAddUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames); WK_EXPORT void WKBundleRemoveUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url); WK_EXPORT void WKBundleRemoveUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url); @@ -85,15 +81,6 @@ WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle, WKBundlePageGrou WK_EXPORT void WKBundleClearAllDatabases(WKBundleRef bundle); WK_EXPORT void WKBundleSetDatabaseQuota(WKBundleRef bundle, uint64_t); -// Application Cache API -WK_EXPORT void WKBundleClearApplicationCache(WKBundleRef bundle); -WK_EXPORT void WKBundleClearApplicationCacheForOrigin(WKBundleRef bundle, WKStringRef origin); -WK_EXPORT void WKBundleSetAppCacheMaximumSize(WKBundleRef bundle, uint64_t size); -WK_EXPORT uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundle, WKStringRef origin); -WK_EXPORT void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin, uint64_t bytes); -WK_EXPORT void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin); -WK_EXPORT WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundle); - // Garbage collection API WK_EXPORT void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundle); WK_EXPORT void WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(WKBundleRef bundle, bool waitUntilDone); @@ -102,10 +89,6 @@ WK_EXPORT size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundle); WK_EXPORT bool WKBundleIsProcessingUserGesture(WKBundleRef bundle); WK_EXPORT void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundle, WKBundlePageRef page, bool enabled); -WK_EXPORT void WKBundleSetSerialLoadingEnabled(WKBundleRef bundle, bool enabled); -WK_EXPORT void WKBundleSetShadowDOMEnabled(WKBundleRef bundle, bool enabled); -WK_EXPORT void WKBundleSetSeamlessIFramesEnabled(WKBundleRef bundle, bool enabled); -WK_EXPORT void WKBundleDispatchPendingLoadRequests(WKBundleRef bundle); #ifdef __cplusplus } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp index fb2f7d05f..43717c915 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp @@ -30,6 +30,8 @@ #include "InjectedBundleRangeHandle.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" +#include "WebImage.h" +#include <WebCore/IntRect.h> using namespace WebKit; @@ -41,5 +43,17 @@ WKTypeID WKBundleRangeHandleGetTypeID() WKBundleRangeHandleRef WKBundleRangeHandleCreate(JSContextRef contextRef, JSObjectRef objectRef) { RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(contextRef, objectRef); - return toAPI(rangeHandle.release().leakRef()); + return toAPI(rangeHandle.leakRef()); +} + +WKRect WKBundleRangeHandleGetBoundingRectInWindowCoordinates(WKBundleRangeHandleRef rangeHandleRef) +{ + WebCore::IntRect boundingRect = toImpl(rangeHandleRef)->boundingRectInWindowCoordinates(); + return WKRectMake(boundingRect.x(), boundingRect.y(), boundingRect.width(), boundingRect.height()); +} + +WKImageRef WKBundleRangeHandleCopySnapshotWithOptions(WKBundleRangeHandleRef rangeHandleRef, WKSnapshotOptions options) +{ + RefPtr<WebImage> image = toImpl(rangeHandleRef)->renderedImage(toSnapshotOptions(options)); + return toAPI(image.leakRef()); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h index 8d1d35928..b3d542440 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h @@ -26,7 +26,7 @@ #ifndef WKBundleRangeHandle_h #define WKBundleRangeHandle_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h index 54f845024..c6ab5bff2 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h @@ -27,7 +27,9 @@ #define WKBundleRangeHandlePrivate_h #include <JavaScriptCore/JavaScript.h> -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> +#include <WebKit/WKImage.h> #ifdef __cplusplus extern "C" { @@ -35,6 +37,9 @@ extern "C" { WK_EXPORT WKBundleRangeHandleRef WKBundleRangeHandleCreate(JSContextRef context, JSObjectRef object); +WK_EXPORT WKRect WKBundleRangeHandleGetBoundingRectInWindowCoordinates(WKBundleRangeHandleRef rangeHandle); +WK_EXPORT WKImageRef WKBundleRangeHandleCopySnapshotWithOptions(WKBundleRangeHandleRef rangeHandle, WKSnapshotOptions options); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp index 87ccf11e9..b7bd8b302 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp @@ -40,7 +40,7 @@ WKTypeID WKBundleScriptWorldGetTypeID() WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld() { RefPtr<InjectedBundleScriptWorld> world = InjectedBundleScriptWorld::create(); - return toAPI(world.release().leakRef()); + return toAPI(world.leakRef()); } WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld() @@ -52,3 +52,13 @@ void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorldRef) { toImpl(scriptWorldRef)->clearWrappers(); } + +void WKBundleScriptWorldMakeAllShadowRootsOpen(WKBundleScriptWorldRef scriptWorldRef) +{ + toImpl(scriptWorldRef)->makeAllShadowRootsOpen(); +} + +WKStringRef WKBundleScriptWorldCopyName(WKBundleScriptWorldRef scriptWorldRef) +{ + return toCopiedAPI(toImpl(scriptWorldRef)->name()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h index 013cdc9a3..325359d1e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h @@ -26,7 +26,7 @@ #ifndef WKBundleScriptWorld_h #define WKBundleScriptWorld_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -37,6 +37,8 @@ WK_EXPORT WKTypeID WKBundleScriptWorldGetTypeID(); WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld(); WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld(); WK_EXPORT void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorld); +WK_EXPORT void WKBundleScriptWorldMakeAllShadowRootsOpen(WKBundleScriptWorldRef scriptWorld); +WK_EXPORT WKStringRef WKBundleScriptWorldCopyName(WKBundleScriptWorldRef scriptWorld); #ifdef __cplusplus } |