summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/InjectedBundle/API
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebKit2/WebProcess/InjectedBundle/API
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
downloadqtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/API')
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp34
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h28
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp12
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp2
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp2
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp30
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h4
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h14
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h44
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm64
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.h41
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm61
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h116
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm170
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h48
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm100
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h53
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm142
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.h37
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.mm43
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h47
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm83
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h45
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm129
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h40
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm86
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h36
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h36
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h37
29 files changed, 1501 insertions, 83 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index 2085253ba..7210a9d9e 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -46,13 +46,13 @@ void WKBundleSetClient(WKBundleRef bundleRef, WKBundleClient * wkClient)
void WKBundlePostMessage(WKBundleRef bundleRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef)
{
- toImpl(bundleRef)->postMessage(toImpl(messageNameRef)->string(), toImpl(messageBodyRef));
+ toImpl(bundleRef)->postMessage(toWTFString(messageNameRef), toImpl(messageBodyRef));
}
void WKBundlePostSynchronousMessage(WKBundleRef bundleRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef, WKTypeRef* returnDataRef)
{
RefPtr<APIObject> returnData;
- toImpl(bundleRef)->postSynchronousMessage(toImpl(messageNameRef)->string(), toImpl(messageBodyRef), returnData);
+ toImpl(bundleRef)->postSynchronousMessage(toWTFString(messageNameRef), toImpl(messageBodyRef), returnData);
if (returnDataRef)
*returnDataRef = toAPI(returnData.release().leakRef());
}
@@ -134,7 +134,7 @@ void WKBundleRemoveAllUserContent(WKBundleRef bundleRef, WKBundlePageGroupRef pa
void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef preference, bool enabled)
{
- toImpl(bundleRef)->overrideBoolPreferenceForTestRunner(toImpl(pageGroupRef), toImpl(preference)->string(), enabled);
+ toImpl(bundleRef)->overrideBoolPreferenceForTestRunner(toImpl(pageGroupRef), toWTFString(preference), enabled);
}
void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
@@ -194,12 +194,12 @@ void WKBundleSetSpatialNavigationEnabled(WKBundleRef bundleRef, WKBundlePageGrou
void WKBundleAddOriginAccessWhitelistEntry(WKBundleRef bundleRef, WKStringRef sourceOrigin, WKStringRef destinationProtocol, WKStringRef destinationHost, bool allowDestinationSubdomains)
{
- toImpl(bundleRef)->addOriginAccessWhitelistEntry(toImpl(sourceOrigin)->string(), toImpl(destinationProtocol)->string(), toImpl(destinationHost)->string(), allowDestinationSubdomains);
+ toImpl(bundleRef)->addOriginAccessWhitelistEntry(toWTFString(sourceOrigin), toWTFString(destinationProtocol), toWTFString(destinationHost), allowDestinationSubdomains);
}
void WKBundleRemoveOriginAccessWhitelistEntry(WKBundleRef bundleRef, WKStringRef sourceOrigin, WKStringRef destinationProtocol, WKStringRef destinationHost, bool allowDestinationSubdomains)
{
- toImpl(bundleRef)->removeOriginAccessWhitelistEntry(toImpl(sourceOrigin)->string(), toImpl(destinationProtocol)->string(), toImpl(destinationHost)->string(), allowDestinationSubdomains);
+ toImpl(bundleRef)->removeOriginAccessWhitelistEntry(toWTFString(sourceOrigin), toWTFString(destinationProtocol), toWTFString(destinationHost), allowDestinationSubdomains);
}
void WKBundleResetOriginAccessWhitelists(WKBundleRef bundleRef)
@@ -229,7 +229,7 @@ void WKBundleClearApplicationCache(WKBundleRef bundleRef)
void WKBundleClearApplicationCacheForOrigin(WKBundleRef bundleRef, WKStringRef origin)
{
- toImpl(bundleRef)->clearApplicationCacheForOrigin(toImpl(origin)->string());
+ toImpl(bundleRef)->clearApplicationCacheForOrigin(toWTFString(origin));
}
void WKBundleSetAppCacheMaximumSize(WKBundleRef bundleRef, uint64_t size)
@@ -239,17 +239,17 @@ void WKBundleSetAppCacheMaximumSize(WKBundleRef bundleRef, uint64_t size)
uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundleRef, WKStringRef origin)
{
- return toImpl(bundleRef)->appCacheUsageForOrigin(toImpl(origin)->string());
+ return toImpl(bundleRef)->appCacheUsageForOrigin(toWTFString(origin));
}
void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin, uint64_t bytes)
{
- toImpl(bundleRef)->setApplicationCacheOriginQuota(toImpl(origin)->string(), bytes);
+ toImpl(bundleRef)->setApplicationCacheOriginQuota(toWTFString(origin), bytes);
}
void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin)
{
- toImpl(bundleRef)->resetApplicationCacheOriginQuota(toImpl(origin)->string());
+ toImpl(bundleRef)->resetApplicationCacheOriginQuota(toWTFString(origin));
}
WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundleRef)
@@ -270,7 +270,7 @@ int WKBundleNumberOfPages(WKBundleRef bundleRef, WKBundleFrameRef frameRef, doub
int WKBundlePageNumberForElementById(WKBundleRef bundleRef, WKBundleFrameRef frameRef, WKStringRef idRef, double pageWidthInPixels, double pageHeightInPixels)
{
- return toImpl(bundleRef)->pageNumberForElementById(toImpl(frameRef), toImpl(idRef)->string(), pageWidthInPixels, pageHeightInPixels);
+ return toImpl(bundleRef)->pageNumberForElementById(toImpl(frameRef), toWTFString(idRef), pageWidthInPixels, pageHeightInPixels);
}
WKStringRef WKBundlePageSizeAndMarginsInPixels(WKBundleRef bundleRef, WKBundleFrameRef frameRef, int pageIndex, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft)
@@ -301,12 +301,12 @@ size_t WKBundleGetWorkerThreadCount(WKBundleRef)
void WKBundleSetUserStyleSheetLocation(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef location)
{
- toImpl(bundleRef)->setUserStyleSheetLocation(toImpl(pageGroupRef), toImpl(location)->string());
+ toImpl(bundleRef)->setUserStyleSheetLocation(toImpl(pageGroupRef), toWTFString(location));
}
void WKBundleSetWebNotificationPermission(WKBundleRef bundleRef, WKBundlePageRef pageRef, WKStringRef originStringRef, bool allowed)
{
- toImpl(bundleRef)->setWebNotificationPermission(toImpl(pageRef), toImpl(originStringRef)->string(), allowed);
+ toImpl(bundleRef)->setWebNotificationPermission(toImpl(pageRef), toWTFString(originStringRef), allowed);
}
void WKBundleRemoveAllWebNotificationPermissions(WKBundleRef bundleRef, WKBundlePageRef pageRef)
@@ -323,3 +323,13 @@ void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundleRef, WKBundlePageR
{
toImpl(bundleRef)->setTabKeyCyclesThroughElements(toImpl(pageRef), enabled);
}
+
+void WKBundleSetSerialLoadingEnabled(WKBundleRef bundleRef, bool enabled)
+{
+ toImpl(bundleRef)->setSerialLoadingEnabled(enabled);
+}
+
+void WKBundleDispatchPendingLoadRequests(WKBundleRef bundleRef)
+{
+ toImpl(bundleRef)->dispatchPendingLoadRequests();
+}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index 018ef7970..59c3570bd 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -32,8 +32,6 @@
#include "WKBundlePrivate.h"
#include <WebCore/EditorInsertAction.h>
#include <WebCore/TextAffinity.h>
-#include <WebCore/UserContentTypes.h>
-#include <WebCore/UserScriptTypes.h>
namespace WebCore {
class CSSStyleDeclaration;
@@ -107,32 +105,6 @@ inline WKAffinityType toAPI(WebCore::EAffinity affinity)
return kWKAffinityUpstream;
}
-inline WebCore::UserScriptInjectionTime toUserScriptInjectionTime(WKUserScriptInjectionTime wkInjectedTime)
-{
- switch (wkInjectedTime) {
- case kWKInjectAtDocumentStart:
- return WebCore::InjectAtDocumentStart;
- case kWKInjectAtDocumentEnd:
- return WebCore::InjectAtDocumentEnd;
- }
-
- ASSERT_NOT_REACHED();
- return WebCore::InjectAtDocumentStart;
-}
-
-inline WebCore::UserContentInjectedFrames toUserContentInjectedFrames(WKUserContentInjectedFrames wkInjectedFrames)
-{
- switch (wkInjectedFrames) {
- case kWKInjectInAllFrames:
- return WebCore::InjectInAllFrames;
- case kWKInjectInTopFrameOnly:
- return WebCore::InjectInTopFrameOnly;
- }
-
- ASSERT_NOT_REACHED();
- return WebCore::InjectInAllFrames;
-}
-
} // namespace WebKit
#endif // WKBundleAPICast_h
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index 9a2b9fc00..fe6d79ed8 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -97,12 +97,12 @@ unsigned WKBundleFrameGetNumberOfActiveAnimations(WKBundleFrameRef frameRef)
bool WKBundleFramePauseAnimationOnElementWithId(WKBundleFrameRef frameRef, WKStringRef animationName, WKStringRef elementID, double time)
{
- return toImpl(frameRef)->pauseAnimationOnElementWithId(toImpl(animationName)->string(), toImpl(elementID)->string(), time);
+ return toImpl(frameRef)->pauseAnimationOnElementWithId(toWTFString(animationName), toWTFString(elementID), time);
}
bool WKBundleFramePauseTransitionOnElementWithId(WKBundleFrameRef frameRef, WKStringRef propertyName, WKStringRef elementID, double time)
{
- return toImpl(frameRef)->pauseTransitionOnElementWithId(toImpl(propertyName)->string(), toImpl(elementID)->string(), time);
+ return toImpl(frameRef)->pauseTransitionOnElementWithId(toWTFString(propertyName), toWTFString(elementID), time);
}
void WKBundleFrameSuspendAnimations(WKBundleFrameRef frameRef)
@@ -194,7 +194,7 @@ WKStringRef WKBundleFrameCopyLayerTreeAsText(WKBundleFrameRef frameRef)
bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frameRef, WKURLRef urlRef)
{
- return toImpl(frameRef)->allowsFollowingLink(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()));
+ return toImpl(frameRef)->allowsFollowingLink(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef)));
}
WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frameRef)
@@ -234,12 +234,12 @@ bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frameRef, double*
WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef)
{
- return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
+ return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef))));
}
WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef)
{
- return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
+ return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef))));
}
bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frameRef)
@@ -249,7 +249,7 @@ bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frameRef)
void WKBundleFrameSetTextDirection(WKBundleFrameRef frameRef, WKStringRef directionRef)
{
- toImpl(frameRef)->setTextDirection(toImpl(directionRef)->string());
+ toImpl(frameRef)->setTextDirection(toWTFString(directionRef));
}
WKDataRef WKBundleFrameCopyWebArchive(WKBundleFrameRef frameRef)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp
index ae69a5394..cc22499a0 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp
@@ -52,7 +52,7 @@ void WKBundleInspectorClose(WKBundleInspectorRef inspectorRef)
void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, long callID, WKStringRef script)
{
- return toImpl(inspectorRef)->evaluateScriptForTest(callID, toImpl(script)->string());
+ return toImpl(inspectorRef)->evaluateScriptForTest(callID, toWTFString(script));
}
void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp
index dc13c57fc..66bee90b0 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp
@@ -64,7 +64,7 @@ WKBundleIntentRef WKBundleIntentCreate(WKDictionaryRef dictionaryRef)
MessagePortArray dummyPorts;
ExceptionCode ec;
- RefPtr<Intent> coreIntent = Intent::create(toImpl(action)->string(), toImpl(type)->string(), data ? static_cast<SerializedScriptValue*>(toImpl(data)->internalRepresentation()) : 0, dummyPorts, ec);
+ RefPtr<Intent> coreIntent = Intent::create(toWTFString(action), toWTFString(type), data ? static_cast<SerializedScriptValue*>(toImpl(data)->internalRepresentation()) : 0, dummyPorts, ec);
return toAPI(InjectedBundleIntent::create(coreIntent.get()).leakRef());
#else
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index 15088e7d6..53ddf6107 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -212,12 +212,12 @@ WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pag
void WKBundlePageExecuteEditingCommand(WKBundlePageRef pageRef, WKStringRef name, WKStringRef argument)
{
- toImpl(pageRef)->executeEditingCommand(toImpl(name)->string(), toImpl(argument)->string());
+ toImpl(pageRef)->executeEditingCommand(toWTFString(name), toWTFString(argument));
}
bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef pageRef, WKStringRef name)
{
- return toImpl(pageRef)->isEditingCommandEnabled(toImpl(name)->string());
+ return toImpl(pageRef)->isEditingCommandEnabled(toWTFString(name));
}
void WKBundlePageClearMainFrameName(WKBundlePageRef pageRef)
@@ -277,7 +277,7 @@ void WKBundlePageUninstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverl
bool WKBundlePageHasLocalDataForURL(WKBundlePageRef pageRef, WKURLRef urlRef)
{
- return toImpl(pageRef)->hasLocalDataForURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()));
+ return toImpl(pageRef)->hasLocalDataForURL(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef)));
}
bool WKBundlePageCanHandleRequest(WKURLRequestRef requestRef)
@@ -287,7 +287,7 @@ bool WKBundlePageCanHandleRequest(WKURLRequestRef requestRef)
bool WKBundlePageFindString(WKBundlePageRef pageRef, WKStringRef target, WKFindOptions findOptions)
{
- return toImpl(pageRef)->findStringFromInjectedBundle(toImpl(target)->string(), toFindOptions(findOptions));
+ return toImpl(pageRef)->findStringFromInjectedBundle(toWTFString(target), toFindOptions(findOptions));
}
WKImageRef WKBundlePageCreateSnapshotWithOptions(WKBundlePageRef pageRef, WKRect rect, WKSnapshotOptions options)
@@ -403,7 +403,7 @@ WKArrayRef WKBundlePageCopyTrackedRepaintRects(WKBundlePageRef pageRef)
void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int from, int length)
{
- toImpl(pageRef)->setCompositionForTesting(toImpl(text)->string(), from, length);
+ toImpl(pageRef)->setCompositionForTesting(toWTFString(text), from, length);
}
bool WKBundlePageHasComposition(WKBundlePageRef pageRef)
@@ -418,26 +418,12 @@ void WKBundlePageConfirmComposition(WKBundlePageRef pageRef)
void WKBundlePageConfirmCompositionWithText(WKBundlePageRef pageRef, WKStringRef text)
{
- toImpl(pageRef)->confirmCompositionForTesting(toImpl(text)->string());
+ toImpl(pageRef)->confirmCompositionForTesting(toWTFString(text));
}
bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeTypeRef)
{
- using WebCore::MIMETypeRegistry;
+ const String mimeType = toWTFString(mimeTypeRef);
- const WTF::String mimeType = toImpl(mimeTypeRef)->string();
-
- if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
- return true;
-
- if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
- return true;
-
- if (MIMETypeRegistry::isSupportedMediaMIMEType(mimeType))
- return true;
-
- if (mimeType.startsWith("text/", false))
- return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType);
-
- return false;
+ return WebCore::MIMETypeRegistry::canShowMIMEType(mimeType);
}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index dce7cf862..c2b37894a 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -154,11 +154,13 @@ struct WKBundlePageLoaderClient {
// Version 3
WKBundlePageDidReceiveIntentForFrameCallback didReceiveIntentForFrame;
WKBundlePageRegisterIntentServiceForFrameCallback registerIntentServiceForFrame;
+
+ // Version 4
WKBundlePageDidLayoutCallback didLayout;
};
typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
-enum { kWKBundlePageLoaderClientCurrentVersion = 3 };
+enum { kWKBundlePageLoaderClientCurrentVersion = 4 };
enum {
WKBundlePagePolicyActionPassThrough,
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
index f032c6222..369c4302f 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
@@ -36,18 +36,6 @@
extern "C" {
#endif
-enum WKUserScriptInjectionTime {
- kWKInjectAtDocumentStart,
- kWKInjectAtDocumentEnd
-};
-typedef enum WKUserScriptInjectionTime WKUserScriptInjectionTime;
-
-enum WKUserContentInjectedFrames {
- kWKInjectInAllFrames,
- kWKInjectInTopFrameOnly
-};
-typedef enum WKUserContentInjectedFrames WKUserContentInjectedFrames;
-
// TestRunner only SPI
WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shouldTrackVisitedLinks);
WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool);
@@ -113,6 +101,8 @@ WK_EXPORT void WKBundleSetPageVisibilityState(WKBundleRef bundle, WKBundlePageRe
WK_EXPORT size_t WKBundleGetWorkerThreadCount(WKBundleRef bundle);
WK_EXPORT void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundle, WKBundlePageRef page, bool enabled);
+WK_EXPORT void WKBundleSetSerialLoadingEnabled(WKBundleRef bundle, bool enabled);
+WK_EXPORT void WKBundleDispatchPendingLoadRequests(WKBundleRef bundle);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h
new file mode 100644
index 000000000..4495055cb
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <WebKit2/WKDOMNode.h>
+
+@class WKDOMElement;
+@class WKDOMText;
+
+WK_EXPORT
+@interface WKDOMDocument : WKDOMNode
+
+- (WKDOMElement *)createElement:(NSString *)tagName;
+- (WKDOMText *)createTextNode:(NSString *)data;
+
+@property(readonly) WKDOMElement *body;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
+
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm
new file mode 100644
index 000000000..99f515021
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMDocument.h"
+
+#import "WKDOMInternals.h"
+#import <WebCore/Document.h>
+#import <WebCore/HTMLElement.h>
+#import <WebCore/Text.h>
+
+static inline WebCore::Document* toDocument(WebCore::Node* node)
+{
+ ASSERT(!node || node->isDocumentNode());
+ return static_cast<WebCore::Document*>(node);
+}
+
+@implementation WKDOMDocument
+
+- (WKDOMElement *)createElement:(NSString *)tagName
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ return WebKit::toWKDOMElement(toDocument(_impl.get())->createElement(tagName, ec).get());
+}
+
+- (WKDOMText *)createTextNode:(NSString *)data
+{
+ return WebKit::toWKDOMText(toDocument(_impl.get())->createTextNode(data).get());
+}
+
+- (WKDOMElement *)body
+{
+ return WebKit::toWKDOMElement(toDocument(_impl.get())->body());
+}
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.h
new file mode 100644
index 000000000..aa03cd4d9
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <WebKit2/WKDOMNode.h>
+
+WK_EXPORT
+@interface WKDOMElement : WKDOMNode
+
+- (BOOL)hasAttribute:(NSString *)attribute;
+- (NSString *)getAttribute:(NSString *)attribute;
+- (void)setAttribute:(NSString *)name value:(NSString *)value;
+
+@property(readonly) NSString *tagName;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm
new file mode 100644
index 000000000..72cf5ab40
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMElement.h"
+
+#import "WKDOMInternals.h"
+#import <WebCore/Element.h>
+
+@implementation WKDOMElement
+
+- (BOOL)hasAttribute:(NSString *)attribute
+{
+ return WebCore::toElement(_impl.get())->hasAttribute(attribute);
+}
+
+- (NSString *)getAttribute:(NSString *)attribute
+{
+ return WebCore::toElement(_impl.get())->getAttribute(attribute);
+}
+
+- (void)setAttribute:(NSString *)name value:(NSString *)value
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec;
+ WebCore::toElement(_impl.get())->setAttribute(name, value, ec);
+}
+
+- (NSString *)tagName
+{
+ return WebCore::toElement(_impl.get())->tagName();
+}
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h
new file mode 100644
index 000000000..f33e454cd
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMNode.h"
+#import "WKDOMRange.h"
+#import <WebCore/Node.h>
+#import <WebCore/Range.h>
+#import <wtf/HashMap.h>
+
+namespace WebCore {
+class Element;
+class Document;
+}
+
+@class WKDOMElement;
+@class WKDOMDocument;
+@class WKDOMText;
+
+@interface WKDOMNode () {
+@public
+ RefPtr<WebCore::Node> _impl;
+}
+
+- (id)_initWithImpl:(WebCore::Node*)impl;
+@end
+
+@interface WKDOMRange () {
+@public
+ RefPtr<WebCore::Range> _impl;
+}
+
+- (id)_initWithImpl:(WebCore::Range*)impl;
+@end
+
+namespace WebKit {
+
+template<typename WebCoreType, typename WKDOMType>
+class DOMCache {
+public:
+ DOMCache()
+ {
+ }
+
+ void add(WebCoreType core, WKDOMType kit)
+ {
+ m_map.add(core, kit);
+ }
+
+ WKDOMType get(WebCoreType core)
+ {
+ return m_map.get(core);
+ }
+
+ void remove(WebCoreType core)
+ {
+ m_map.remove(core);
+ }
+
+private:
+ // This class should only ever be used as a singleton.
+ ~DOMCache() = delete;
+
+ HashMap<WebCoreType, WKDOMType> m_map;
+};
+
+// -- Caches --
+
+DOMCache<WebCore::Node*, WKDOMNode *>& WKDOMNodeCache();
+DOMCache<WebCore::Range*, WKDOMRange *>& WKDOMRangeCache();
+
+// -- Node and classes derived from Node. --
+
+WebCore::Node* toWebCoreNode(WKDOMNode *);
+WKDOMNode *toWKDOMNode(WebCore::Node*);
+
+WebCore::Element* toWebCoreElement(WKDOMElement *);
+WKDOMElement *toWKDOMElement(WebCore::Element*);
+
+WebCore::Document* toWebCoreDocument(WKDOMDocument *);
+WKDOMDocument *toWKDOMDocument(WebCore::Document*);
+
+WebCore::Text* toWebCoreText(WKDOMText *);
+WKDOMText *toWKDOMText(WebCore::Text*);
+
+// -- Range. --
+
+WebCore::Range* toWebCoreRange(WKDOMRange *);
+WKDOMRange *toWKDOMRange(WebCore::Range*);
+
+} // namespace WebKit
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm
new file mode 100644
index 000000000..ab9046613
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMInternals.h"
+
+#import <WebCore/Document.h>
+#import <WebCore/Element.h>
+#import <WebCore/Node.h>
+#import <WebCore/Range.h>
+#import <WebCore/Text.h>
+
+// Classes to instantiate.
+#import "WKDOMElement.h"
+#import "WKDOMDocument.h"
+#import "WKDOMText.h"
+
+namespace WebKit {
+
+template<typename WebCoreType, typename WKDOMType>
+static WKDOMType toWKDOMType(WebCoreType impl, DOMCache<WebCoreType, WKDOMType>& cache);
+
+// -- Caches --
+
+DOMCache<WebCore::Node*, WKDOMNode *>& WKDOMNodeCache()
+{
+ typedef DOMCache<WebCore::Node*, WKDOMNode *> Cache;
+ DEFINE_STATIC_LOCAL(Cache, cache, ());
+ return cache;
+}
+
+DOMCache<WebCore::Range*, WKDOMRange *>& WKDOMRangeCache()
+{
+ typedef DOMCache<WebCore::Range*, WKDOMRange *> Cache;
+ DEFINE_STATIC_LOCAL(Cache, cache, ());
+ return cache;
+}
+
+// -- Node and classes derived from Node. --
+
+static Class WKDOMNodeClass(WebCore::Node* impl)
+{
+ switch (impl->nodeType()) {
+ case WebCore::Node::ELEMENT_NODE:
+ return [WKDOMElement class];
+ case WebCore::Node::DOCUMENT_NODE:
+ return [WKDOMDocument class];
+ case WebCore::Node::TEXT_NODE:
+ return [WKDOMText class];
+ case WebCore::Node::ATTRIBUTE_NODE:
+ case WebCore::Node::CDATA_SECTION_NODE:
+ case WebCore::Node::ENTITY_REFERENCE_NODE:
+ case WebCore::Node::ENTITY_NODE:
+ case WebCore::Node::PROCESSING_INSTRUCTION_NODE:
+ case WebCore::Node::COMMENT_NODE:
+ case WebCore::Node::DOCUMENT_TYPE_NODE:
+ case WebCore::Node::DOCUMENT_FRAGMENT_NODE:
+ case WebCore::Node::NOTATION_NODE:
+ case WebCore::Node::XPATH_NAMESPACE_NODE:
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return nil;
+}
+
+static WKDOMNode *initWithImpl(WebCore::Node* impl)
+{
+ return [[WKDOMNodeClass(impl) alloc] _initWithImpl:impl];
+}
+
+WebCore::Node* toWebCoreNode(WKDOMNode *wrapper)
+{
+ return wrapper ? wrapper->_impl.get() : 0;
+}
+
+WKDOMNode *toWKDOMNode(WebCore::Node* impl)
+{
+ return toWKDOMType<WebCore::Node*, WKDOMNode *>(impl, WKDOMNodeCache());
+}
+
+WebCore::Element* toWebCoreElement(WKDOMElement *wrapper)
+{
+ return wrapper ? reinterpret_cast<WebCore::Element*>(wrapper->_impl.get()) : 0;
+}
+
+WKDOMElement *toWKDOMElement(WebCore::Element* impl)
+{
+ return static_cast<WKDOMElement*>(toWKDOMNode(static_cast<WebCore::Node*>(impl)));
+}
+
+WebCore::Document* toWebCoreDocument(WKDOMDocument *wrapper)
+{
+ return wrapper ? reinterpret_cast<WebCore::Document*>(wrapper->_impl.get()) : 0;
+}
+
+WKDOMDocument *toWKDOMDocument(WebCore::Document* impl)
+{
+ return static_cast<WKDOMDocument*>(toWKDOMNode(static_cast<WebCore::Node*>(impl)));
+}
+
+WebCore::Text* toWebCoreText(WKDOMText *wrapper)
+{
+ return wrapper ? reinterpret_cast<WebCore::Text*>(wrapper->_impl.get()) : 0;
+}
+
+WKDOMText *toWKDOMText(WebCore::Text* impl)
+{
+ return static_cast<WKDOMText*>(toWKDOMNode(static_cast<WebCore::Node*>(impl)));
+}
+
+// -- Range. --
+
+static WKDOMRange *initWithImpl(WebCore::Range* impl)
+{
+ return [[WKDOMRange alloc] _initWithImpl:impl];
+}
+
+WebCore::Range* toWebCoreRange(WKDOMRange * wrapper)
+{
+ return wrapper ? wrapper->_impl.get() : 0;
+}
+
+WKDOMRange *toWKDOMRange(WebCore::Range* impl)
+{
+ return toWKDOMType<WebCore::Range*, WKDOMRange *>(impl, WKDOMRangeCache());
+}
+
+// -- Helpers --
+
+template<typename WebCoreType, typename WKDOMType>
+static WKDOMType toWKDOMType(WebCoreType impl, DOMCache<WebCoreType, WKDOMType>& cache)
+{
+ if (!impl)
+ return nil;
+ if (WKDOMType wrapper = cache.get(impl))
+ return [[wrapper retain] autorelease];
+ WKDOMType wrapper = initWithImpl(impl);
+ if (!wrapper)
+ return nil;
+ return [wrapper autorelease];
+}
+
+} // namespace WebKit
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h
new file mode 100644
index 000000000..c0e03937c
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <Foundation/Foundation.h>
+#import <WebKit2/WKBase.h>
+
+@class WKDOMDocument;
+
+WK_EXPORT
+@interface WKDOMNode : NSObject
+
+- (void)insertNode:(WKDOMNode *)node before:(WKDOMNode *)refNode;
+- (void)appendChild:(WKDOMNode *)node;
+
+@property(readonly) WKDOMDocument *document;
+@property(readonly) WKDOMNode *parentNode;
+@property(readonly) WKDOMNode *firstChild;
+@property(readonly) WKDOMNode *lastChild;
+@property(readonly) WKDOMNode *previousSibling;
+@property(readonly) WKDOMNode *nextSibling;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm
new file mode 100644
index 000000000..4308ff3ab
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMNode.h"
+
+#import "WKDOMInternals.h"
+
+@implementation WKDOMNode
+
+- (id)_initWithImpl:(WebCore::Node*)impl
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _impl = impl;
+ WebKit::WKDOMNodeCache().add(impl, self);
+
+ return self;
+}
+
+- (void)dealloc
+{
+ WebKit::WKDOMNodeCache().remove(_impl.get());
+ [super dealloc];
+}
+
+- (void)insertNode:(WKDOMNode *)node before:(WKDOMNode *)refNode
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec;
+ _impl->insertBefore(WebKit::toWebCoreNode(node), WebKit::toWebCoreNode(refNode), ec);
+}
+
+- (void)appendChild:(WKDOMNode *)node
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec;
+ _impl->appendChild(WebKit::toWebCoreNode(node), ec);
+}
+
+- (WKDOMDocument *)document
+{
+ return WebKit::toWKDOMDocument(_impl->document());
+}
+
+- (WKDOMNode *)parentNode
+{
+ return WebKit::toWKDOMNode(_impl->parentNode());
+}
+
+- (WKDOMNode *)firstChild
+{
+ return WebKit::toWKDOMNode(_impl->firstChild());
+}
+
+- (WKDOMNode *)lastChild
+{
+ return WebKit::toWKDOMNode(_impl->lastChild());
+}
+
+- (WKDOMNode *)previousSibling
+{
+ return WebKit::toWKDOMNode(_impl->previousSibling());
+}
+
+- (WKDOMNode *)nextSibling
+{
+ return WebKit::toWKDOMNode(_impl->nextSibling());
+}
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h
new file mode 100644
index 000000000..64ed00ce2
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <Foundation/Foundation.h>
+#import <WebKit2/WKBase.h>
+
+@class WKDOMNode, WKDOMDocument;
+
+WK_EXPORT
+@interface WKDOMRange : NSObject
+
+- (id)initWithDocument:(WKDOMDocument *)document;
+
+- (void)setStart:(WKDOMNode *)node offset:(int)offset;
+- (void)setEnd:(WKDOMNode *)node offset:(int)offset;
+- (void)collapse:(BOOL)toStart;
+- (void)selectNode:(WKDOMNode *)node;
+- (void)selectNodeContents:(WKDOMNode *)node;
+
+@property(readonly, retain) WKDOMNode *startContainer;
+@property(readonly) NSInteger startOffset;
+@property(readonly, retain) WKDOMNode *endContainer;
+@property(readonly) NSInteger endOffset;
+@property(readonly, copy) NSString *text;
+@property(readonly) BOOL isCollapsed;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm
new file mode 100644
index 000000000..1cc408408
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMRange.h"
+
+#import "WKDOMInternals.h"
+#import <WebCore/Document.h>
+
+@implementation WKDOMRange
+
+- (id)_initWithImpl:(WebCore::Range*)impl
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _impl = impl;
+ WebKit::WKDOMRangeCache().add(impl, self);
+
+ return self;
+}
+
+- (id)initWithDocument:(WKDOMDocument *)document
+{
+ RefPtr<WebCore::Range> range = WebCore::Range::create(WebKit::toWebCoreDocument(document));
+ self = [self _initWithImpl:range.get()];
+ if (!self)
+ return nil;
+
+ return self;
+}
+
+- (void)dealloc
+{
+ WebKit::WKDOMRangeCache().remove(_impl.get());
+ [super dealloc];
+}
+
+- (void)setStart:(WKDOMNode *)node offset:(int)offset
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ _impl->setStart(WebKit::toWebCoreNode(node), offset, ec);
+}
+
+- (void)setEnd:(WKDOMNode *)node offset:(int)offset
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ _impl->setEnd(WebKit::toWebCoreNode(node), offset, ec);
+}
+
+- (void)collapse:(BOOL)toStart
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ _impl->collapse(toStart, ec);
+}
+
+- (void)selectNode:(WKDOMNode *)node
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ _impl->selectNode(WebKit::toWebCoreNode(node), ec);
+}
+
+- (void)selectNodeContents:(WKDOMNode *)node
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ _impl->selectNodeContents(WebKit::toWebCoreNode(node), ec);
+}
+
+- (WKDOMNode *)startContainer
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ return WebKit::toWKDOMNode(_impl->startContainer(ec));
+}
+
+- (NSInteger)startOffset
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ return _impl->startOffset(ec);
+}
+
+- (WKDOMNode *)endContainer
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ return WebKit::toWKDOMNode(_impl->endContainer(ec));
+}
+
+- (NSInteger)endOffset
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ return _impl->endOffset(ec);
+}
+
+- (NSString *)text
+{
+ return _impl->text();
+}
+
+- (BOOL)isCollapsed
+{
+ // FIXME: Do something about the exception.
+ WebCore::ExceptionCode ec = 0;
+ return _impl->collapsed(ec);
+}
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.h
new file mode 100644
index 000000000..eb8552e3f
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <WebKit2/WKDOMNode.h>
+
+WK_EXPORT
+@interface WKDOMText : WKDOMNode
+
+@property(readonly) NSString *data;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.mm
new file mode 100644
index 000000000..4f4f627ab
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMText.mm
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+#import "WKDOMText.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMInternals.h"
+#import <WebCore/Text.h>
+
+@implementation WKDOMText
+
+- (NSString *)data
+{
+ return WebCore::toText(_impl.get())->data();
+}
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h
new file mode 100644
index 000000000..e34c18e44
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <Foundation/Foundation.h>
+#import <WebKit2/WKBase.h>
+
+@class WKDOMRange;
+
+WK_EXPORT
+@interface WKDOMTextIterator : NSObject
+
+- (id)initWithRange:(WKDOMRange *)range;
+
+- (void)advance;
+
+@property (readonly) BOOL atEnd;
+@property (readonly) WKDOMRange *currentRange;
+@property (readonly) NSUInteger currentTextLength;
+@property (readonly) const unichar *currentTextPointer;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm
new file mode 100644
index 000000000..0f9ae6191
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKDOMTextIterator.h"
+
+#import "WKDOMInternals.h"
+#import "WKDOMRange.h"
+#import <WebCore/TextIterator.h>
+#import <wtf/OwnPtr.h>
+
+@interface WKDOMTextIterator () {
+@public
+ OwnPtr<WebCore::TextIterator> _textIterator;
+}
+@end
+
+@implementation WKDOMTextIterator
+
+- (id)initWithRange:(WKDOMRange *)range
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _textIterator = adoptPtr(new WebCore::TextIterator(WebKit::toWebCoreRange(range)));
+
+ return self;
+}
+
+- (void)advance
+{
+ _textIterator->advance();
+}
+
+- (BOOL)atEnd
+{
+ return _textIterator->atEnd();
+}
+
+- (WKDOMRange *)currentRange
+{
+ return WebKit::toWKDOMRange(_textIterator->range().get());
+}
+
+- (const unichar *)currentTextPointer
+{
+ return _textIterator->characters();
+}
+
+- (NSUInteger)currentTextLength
+{
+ return _textIterator->length();
+}
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h
new file mode 100644
index 000000000..4a7cc50a6
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <Foundation/Foundation.h>
+#import <WebKit2/WKBase.h>
+
+@class WKWebProcessPlugInController;
+@class WKWebProcessPlugInBrowserContextController;
+
+@protocol WKWebProcessPlugIn <NSObject>
+@optional
+- (void)webProcessPlugInInitialize:(WKWebProcessPlugInController *)plugInController;
+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController;
+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController willDestroyBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController;
+@end
+
+WK_EXPORT
+@interface WKWebProcessPlugInController : NSObject
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm
new file mode 100644
index 000000000..d967ec29b
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKWebProcessPlugIn.h"
+#import "WKWebProcessPlugInInternal.h"
+
+#import "InjectedBundle.h"
+#import "WKBundle.h"
+#import "WKBundleAPICast.h"
+#import "WKRetainPtr.h"
+#import "WKWebProcessPlugInBrowserContextControllerInternal.h"
+#import <wtf/RetainPtr.h>
+
+typedef HashMap<WKBundlePageRef, RetainPtr<WKWebProcessPlugInBrowserContextController *> > BundlePageWrapperCache;
+
+@interface WKWebProcessPlugInController () {
+ RetainPtr<id<WKWebProcessPlugIn> > _principalClassInstance;
+ WKRetainPtr<WKBundleRef> _bundleRef;
+ BundlePageWrapperCache _bundlePageWrapperCache;
+}
+@end
+
+@implementation WKWebProcessPlugInController (Internal)
+
+static void didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
+{
+ WKWebProcessPlugInController *plugInController = (WKWebProcessPlugInController *)clientInfo;
+ id<WKWebProcessPlugIn> principalClassInstance = plugInController->_principalClassInstance.get();
+
+ if ([principalClassInstance respondsToSelector:@selector(webProcessPlugIn:didCreateBrowserContextController:)]) {
+ ASSERT(!plugInController->_bundlePageWrapperCache.contains(page));
+
+ WKWebProcessPlugInBrowserContextController* browserContextController = [[WKWebProcessPlugInBrowserContextController alloc] _initWithBundlePageRef:page];
+ plugInController->_bundlePageWrapperCache.set(page, browserContextController);
+
+ [principalClassInstance webProcessPlugIn:plugInController didCreateBrowserContextController:browserContextController];
+ }
+}
+
+static void willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
+{
+ WKWebProcessPlugInController *plugInController = (WKWebProcessPlugInController *)clientInfo;
+ id<WKWebProcessPlugIn> principalClassInstance = plugInController->_principalClassInstance.get();
+
+ // If we never added the bundle page to the cache, which can happen if webProcessPlugIn:didCreateBrowserContextController: is not implemented,
+ // there is no reason to call webProcessPlugIn:willDestroyBrowserContextController:, so don't.
+ BundlePageWrapperCache::iterator it = plugInController->_bundlePageWrapperCache.find(page);
+ if (it == plugInController->_bundlePageWrapperCache.end()) {
+ ASSERT(![principalClassInstance respondsToSelector:@selector(webProcessPlugIn:didCreateBrowserContextController:)]);
+ return;
+ }
+
+ if ([principalClassInstance respondsToSelector:@selector(webProcessPlugIn:willDestroyBrowserContextController:)])
+ [principalClassInstance webProcessPlugIn:plugInController willDestroyBrowserContextController:it->value.get()];
+
+ plugInController->_bundlePageWrapperCache.remove(it);
+}
+
+static void setUpBundleClient(WKWebProcessPlugInController *plugInController, WKBundleRef bundleRef)
+{
+ WKBundleClient bundleClient;
+ memset(&bundleClient, 0, sizeof(bundleClient));
+
+ bundleClient.version = kWKBundleClientCurrentVersion;
+ bundleClient.clientInfo = plugInController;
+ bundleClient.didCreatePage = didCreatePage;
+ bundleClient.willDestroyPage = willDestroyPage;
+
+ WKBundleSetClient(bundleRef, &bundleClient);
+}
+
+static WKWebProcessPlugInController *sharedInstance;
+
++ (WKWebProcessPlugInController *)_shared
+{
+ ASSERT_WITH_MESSAGE(sharedInstance, "+[WKWebProcessPlugIn _shared] called without first initializing it.");
+ return sharedInstance;
+}
+
+- (id)_initWithPrincipalClassInstance:(id<WKWebProcessPlugIn>)principalClassInstance bundleRef:(WKBundleRef)bundleRef
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _principalClassInstance = principalClassInstance;
+ _bundleRef = bundleRef;
+
+ ASSERT_WITH_MESSAGE(!sharedInstance, "WKWebProcessPlugInController initialized multiple times.");
+ sharedInstance = self;
+
+ setUpBundleClient(self, bundleRef);
+
+ return self;
+}
+
+@end
+
+@implementation WKWebProcessPlugInController
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h
new file mode 100644
index 000000000..5a0db8d05
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <Foundation/Foundation.h>
+#import <WebKit2/WKBase.h>
+
+@class WKDOMDocument;
+
+WK_EXPORT
+@interface WKWebProcessPlugInBrowserContextController : NSObject
+
+@property(readonly) WKDOMDocument *mainFrameDocument;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
new file mode 100644
index 000000000..3d39be033
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#import "config.h"
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKWebProcessPlugInBrowserContextController.h"
+#import "WKWebProcessPlugInBrowserContextControllerInternal.h"
+#import "WKWebProcessPlugInBrowserContextControllerPrivate.h"
+
+#import "WKBundleAPICast.h"
+#import "WKBundlePage.h"
+#import "WKBundlePagePrivate.h"
+#import "WKDOMInternals.h"
+#import "WKRetainPtr.h"
+#import "WebPage.h"
+#import <WebCore/Document.h>
+#import <WebCore/Frame.h>
+
+@interface WKWebProcessPlugInBrowserContextController () {
+ // Underlying WKBundlePageRef.
+ WKRetainPtr<WKBundlePageRef> _bundlePageRef;
+}
+@end
+
+@implementation WKWebProcessPlugInBrowserContextController (Internal)
+
+- (id)_initWithBundlePageRef:(WKBundlePageRef)bundlePageRef
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _bundlePageRef = bundlePageRef;
+
+ return self;
+}
+
+@end
+
+@implementation WKWebProcessPlugInBrowserContextController
+
+- (WKDOMDocument *)mainFrameDocument
+{
+ WebCore::Frame* webCoreMainFrame = WebKit::toImpl(self._bundlePageRef)->mainFrame();
+ if (!webCoreMainFrame)
+ return nil;
+
+ return WebKit::toWKDOMDocument(webCoreMainFrame->document());
+}
+
+@end
+
+@implementation WKWebProcessPlugInBrowserContextController (Private)
+
+- (WKBundlePageRef)_bundlePageRef
+{
+ return _bundlePageRef.get();
+}
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h
new file mode 100644
index 000000000..62f06238a
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKWebProcessPlugInBrowserContextController.h"
+
+@interface WKWebProcessPlugInBrowserContextController (Internal)
+
+- (id)_initWithBundlePageRef:(WKBundlePageRef)bundlePageRef;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h
new file mode 100644
index 000000000..59aac108c
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <WebKit2/WKWebProcessPlugInBrowserContextController.h>
+
+@interface WKWebProcessPlugInBrowserContextController (Private)
+
+@property(readonly) WKBundlePageRef _bundlePageRef;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h
new file mode 100644
index 000000000..58b3cc3f7
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import "WKWebProcessPlugIn.h"
+
+@interface WKWebProcessPlugInController (Internal)
+
++ (WKWebProcessPlugInController *)_shared;
+- (id)_initWithPrincipalClassInstance:(id<WKWebProcessPlugIn>)principalClassInstance bundleRef:(WKBundleRef)bundleRef;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)