diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp | 105 |
1 files changed, 86 insertions, 19 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 005811ac0..d45e48e88 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 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011, 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 @@ -29,6 +29,7 @@ #include "InjectedBundleBackForwardList.h" #include "InjectedBundleNodeHandle.h" +#include "PageBanner.h" #include "WKAPICast.h" #include "WKArray.h" #include "WKBundleAPICast.h" @@ -50,12 +51,8 @@ #include <WebCore/AccessibilityObject.h> #include <WebCore/Frame.h> #include <WebCore/KURL.h> -#include <WebCore/MIMETypeRegistry.h> #include <WebCore/Page.h> - -#if ENABLE(WEB_INTENTS) -#include "InjectedBundleIntent.h" -#endif +#include <wtf/OwnArrayPtr.h> using namespace WebKit; @@ -167,6 +164,27 @@ WKArrayRef WKBundlePageCopyContextMenuItemTitles(WKBundlePageRef pageRef) #endif } +WKArrayRef WKBundlePageCopyContextMenuAtPointInWindow(WKBundlePageRef pageRef, WKPoint point) +{ +#if ENABLE(CONTEXT_MENUS) + WebContextMenu* contextMenu = toImpl(pageRef)->contextMenuAtPointInWindow(toIntPoint(point)); + if (!contextMenu) + return 0; + + const Vector<WebContextMenuItemData>& items = contextMenu->items(); + size_t arrayLength = items.size(); + + RefPtr<MutableArray> menuArray = MutableArray::create(); + menuArray->reserveCapacity(arrayLength); + for (unsigned i = 0; i < arrayLength; ++i) + menuArray->append(WebContextMenuItem::create(items[i]).get()); + + return toAPI(menuArray.release().leakRef()); +#else + return 0; +#endif +} + void* WKAccessibilityRootObject(WKBundlePageRef pageRef) { #if HAVE(ACCESSIBILITY) @@ -232,6 +250,11 @@ WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pag return toCopiedAPI(toImpl(pageRef)->renderTreeExternalRepresentation()); } +WKStringRef WKBundlePageCopyRenderTreeExternalRepresentationForPrinting(WKBundlePageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->renderTreeExternalRepresentationForPrinting()); +} + void WKBundlePageExecuteEditingCommand(WKBundlePageRef pageRef, WKStringRef name, WKStringRef argument) { toImpl(pageRef)->executeEditingCommand(toWTFString(name), toWTFString(argument)); @@ -294,7 +317,47 @@ void WKBundlePageInstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlay void WKBundlePageUninstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) { - toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef), false); + toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef)); +} + +void WKBundlePageInstallPageOverlayWithAnimation(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) +{ + toImpl(pageRef)->installPageOverlay(toImpl(pageOverlayRef), true); +} + +void WKBundlePageUninstallPageOverlayWithAnimation(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) +{ + toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef), true); +} + +void WKBundlePageSetTopOverhangImage(WKBundlePageRef pageRef, WKImageRef imageRef) +{ +#if PLATFORM(MAC) + toImpl(pageRef)->setTopOverhangImage(toImpl(imageRef)); +#else + UNUSED_PARAM(pageRef); + UNUSED_PARAM(imageRef); +#endif +} + +void WKBundlePageSetBottomOverhangImage(WKBundlePageRef pageRef, WKImageRef imageRef) +{ +#if PLATFORM(MAC) + toImpl(pageRef)->setBottomOverhangImage(toImpl(imageRef)); +#else + UNUSED_PARAM(pageRef); + UNUSED_PARAM(imageRef); +#endif +} + +void WKBundlePageSetHeaderBanner(WKBundlePageRef pageRef, WKBundlePageBannerRef bannerRef) +{ + toImpl(pageRef)->setHeaderPageBanner(toImpl(bannerRef)); +} + +void WKBundlePageSetFooterBanner(WKBundlePageRef pageRef, WKBundlePageBannerRef bannerRef) +{ + toImpl(pageRef)->setFooterPageBanner(toImpl(bannerRef)); } bool WKBundlePageHasLocalDataForURL(WKBundlePageRef pageRef, WKURLRef urlRef) @@ -348,19 +411,15 @@ void WKBundlePageListenForLayoutMilestones(WKBundlePageRef pageRef, WKLayoutMile toImpl(pageRef)->listenForLayoutMilestones(toLayoutMilestones(milestones)); } -void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKBundleIntentRef intentRef) -{ -#if ENABLE(WEB_INTENTS) - toImpl(pageRef)->deliverCoreIntentToFrame(toImpl(frameRef)->frameID(), toImpl(intentRef)->coreIntent()); -#endif -} - -#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef) { +#if ENABLE(INSPECTOR) return toAPI(toImpl(pageRef)->inspector()); -} +#else + UNUSED_PARAM(pageRef); + return 0; #endif +} void WKBundlePageForceRepaint(WKBundlePageRef page) { @@ -443,9 +502,17 @@ void WKBundlePageConfirmCompositionWithText(WKBundlePageRef pageRef, WKStringRef toImpl(pageRef)->confirmCompositionForTesting(toWTFString(text)); } -bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeTypeRef) +bool WKBundlePageCanShowMIMEType(WKBundlePageRef pageRef, WKStringRef mimeTypeRef) +{ + return toImpl(pageRef)->canShowMIMEType(toWTFString(mimeTypeRef)); +} + +WKRenderingSuppressionToken WKBundlePageExtendIncrementalRenderingSuppression(WKBundlePageRef pageRef) { - const String mimeType = toWTFString(mimeTypeRef); + return toImpl(pageRef)->extendIncrementalRenderingSuppression(); +} - return WebCore::MIMETypeRegistry::canShowMIMEType(mimeType); +void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef pageRef, WKRenderingSuppressionToken token) +{ + toImpl(pageRef)->stopExtendingIncrementalRenderingSuppression(token); } |