| 1 | /* |
| 2 | * Copyright (C) 2010, 2011, 2013 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 | * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef WKBundlePagePrivate_h |
| 27 | #define WKBundlePagePrivate_h |
| 28 | |
| 29 | #include <WebKit/WKBase.h> |
| 30 | #include <WebKit/WKDeprecated.h> |
| 31 | #include <WebKit/WKEvent.h> |
| 32 | #include <WebKit/WKGeometry.h> |
| 33 | #include <WebKit/WKUserContentInjectedFrames.h> |
| 34 | #include <WebKit/WKUserScriptInjectionTime.h> |
| 35 | |
| 36 | #ifdef __cplusplus |
| 37 | extern "C" { |
| 38 | #endif |
| 39 | |
| 40 | enum RenderTreeExternalRepresentationFlags { |
| 41 | RenderTreeShowAllLayers = 1 << 0, |
| 42 | RenderTreeShowLayerNesting = 1 << 1, |
| 43 | RenderTreeShowCompositedLayers = 1 << 2, |
| 44 | RenderTreeShowOverflow = 1 << 3, |
| 45 | RenderTreeShowSVGGeometry = 1 << 4, |
| 46 | RenderTreeShowLayerFragments = 1 << 5, |
| 47 | }; |
| 48 | typedef uint32_t RenderTreeExternalRepresentationBehavior; |
| 49 | |
| 50 | WK_EXPORT void WKBundlePageStopLoading(WKBundlePageRef page); |
| 51 | WK_EXPORT void WKBundlePageSetDefersLoading(WKBundlePageRef page, bool defersLoading) WK_C_API_DEPRECATED; |
| 52 | WK_EXPORT bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef page, WKStringRef commandName); |
| 53 | WK_EXPORT void WKBundlePageClearMainFrameName(WKBundlePageRef page); |
| 54 | WK_EXPORT void WKBundlePageClose(WKBundlePageRef page); |
| 55 | WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef page, RenderTreeExternalRepresentationBehavior); |
| 56 | WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentationForPrinting(WKBundlePageRef page); |
| 57 | WK_EXPORT void WKBundlePageExecuteEditingCommand(WKBundlePageRef page, WKStringRef commandName, WKStringRef argument); |
| 58 | |
| 59 | WK_EXPORT double WKBundlePageGetTextZoomFactor(WKBundlePageRef page); |
| 60 | WK_EXPORT void WKBundlePageSetTextZoomFactor(WKBundlePageRef page, double zoomFactor); |
| 61 | WK_EXPORT double WKBundlePageGetPageZoomFactor(WKBundlePageRef page); |
| 62 | WK_EXPORT void WKBundlePageSetPageZoomFactor(WKBundlePageRef page, double zoomFactor); |
| 63 | |
| 64 | WK_EXPORT void WKBundlePageSetScaleAtOrigin(WKBundlePageRef page, double scale, WKPoint origin); |
| 65 | |
| 66 | WK_EXPORT void WKBundlePageForceRepaint(WKBundlePageRef page); |
| 67 | |
| 68 | WK_EXPORT void WKBundlePageSimulateMouseDown(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time); |
| 69 | WK_EXPORT void WKBundlePageSimulateMouseUp(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time); |
| 70 | WK_EXPORT void WKBundlePageSimulateMouseMotion(WKBundlePageRef page, WKPoint position, double time); |
| 71 | |
| 72 | WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page); |
| 73 | |
| 74 | WK_EXPORT WKRenderObjectRef WKBundlePageCopyRenderTree(WKBundlePageRef page); |
| 75 | WK_EXPORT WKRenderLayerRef WKBundlePageCopyRenderLayerTree(WKBundlePageRef page); |
| 76 | |
| 77 | // FIXME: This function is only still here to keep open source Mac builds building. It doesn't do anything anymore! |
| 78 | // We should remove it as soon as we can. |
| 79 | WK_EXPORT void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold); |
| 80 | |
| 81 | WK_EXPORT void WKBundlePageSetTracksRepaints(WKBundlePageRef page, bool trackRepaints); |
| 82 | WK_EXPORT bool WKBundlePageIsTrackingRepaints(WKBundlePageRef page); |
| 83 | WK_EXPORT void (WKBundlePageRef page); |
| 84 | WK_EXPORT WKArrayRef WKBundlePageCopyTrackedRepaintRects(WKBundlePageRef page); |
| 85 | |
| 86 | WK_EXPORT void WKBundlePageSetComposition(WKBundlePageRef page, WKStringRef text, int from, int length, bool suppressUnderline); |
| 87 | WK_EXPORT bool WKBundlePageHasComposition(WKBundlePageRef page); |
| 88 | WK_EXPORT void WKBundlePageConfirmComposition(WKBundlePageRef page); |
| 89 | WK_EXPORT void WKBundlePageConfirmCompositionWithText(WKBundlePageRef page, WKStringRef text); |
| 90 | |
| 91 | WK_EXPORT void WKBundlePageSetUseDarkAppearance(WKBundlePageRef page, bool useDarkAppearance); |
| 92 | WK_EXPORT bool WKBundlePageIsUsingDarkAppearance(WKBundlePageRef page); |
| 93 | |
| 94 | WK_EXPORT bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeType); |
| 95 | |
| 96 | WK_EXPORT void* WKAccessibilityRootObject(WKBundlePageRef); |
| 97 | WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef); |
| 98 | |
| 99 | WK_EXPORT void WKAccessibilityEnableEnhancedAccessibility(bool); |
| 100 | WK_EXPORT bool WKAccessibilityEnhancedAccessibilityEnabled(); |
| 101 | |
| 102 | WK_EXPORT void (WKBundlePageRef, WKContextMenuItemRef); |
| 103 | WK_EXPORT WKArrayRef (WKBundlePageRef); |
| 104 | WK_EXPORT WKArrayRef (WKBundlePageRef, WKPoint); |
| 105 | |
| 106 | WK_EXPORT void WKBundlePageInsertNewlineInQuotedContent(WKBundlePageRef page); |
| 107 | |
| 108 | // This only works if the SuppressesIncrementalRendering preference is set as well. |
| 109 | typedef unsigned WKRenderingSuppressionToken; |
| 110 | WK_EXPORT WKRenderingSuppressionToken WKBundlePageExtendIncrementalRenderingSuppression(WKBundlePageRef); |
| 111 | WK_EXPORT void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef, WKRenderingSuppressionToken); |
| 112 | |
| 113 | // UserContent API (compatible with Modern API, for WKTR) |
| 114 | WK_EXPORT void WKBundlePageAddUserScript(WKBundlePageRef page, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames); |
| 115 | WK_EXPORT void WKBundlePageAddUserStyleSheet(WKBundlePageRef page, WKStringRef source, WKUserContentInjectedFrames injectedFrames); |
| 116 | WK_EXPORT void (WKBundlePageRef page); |
| 117 | |
| 118 | // Application Cache API, for WKTR. |
| 119 | WK_EXPORT void WKBundlePageClearApplicationCache(WKBundlePageRef page); |
| 120 | WK_EXPORT void WKBundlePageClearApplicationCacheForOrigin(WKBundlePageRef page, WKStringRef origin); |
| 121 | WK_EXPORT void WKBundlePageSetAppCacheMaximumSize(WKBundlePageRef page, uint64_t size); |
| 122 | WK_EXPORT uint64_t WKBundlePageGetAppCacheUsageForOrigin(WKBundlePageRef page, WKStringRef origin); |
| 123 | WK_EXPORT void WKBundlePageSetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin, uint64_t bytes); |
| 124 | WK_EXPORT void (WKBundlePageRef page, WKStringRef origin); |
| 125 | WK_EXPORT WKArrayRef WKBundlePageCopyOriginsWithApplicationCache(WKBundlePageRef page); |
| 126 | |
| 127 | enum { |
| 128 | kWKEventThrottlingBehaviorResponsive = 0, |
| 129 | kWKEventThrottlingBehaviorUnresponsive |
| 130 | }; |
| 131 | |
| 132 | typedef uint32_t WKEventThrottlingBehavior; |
| 133 | |
| 134 | // Passing null in the second parameter clears the override. |
| 135 | WK_EXPORT void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef, WKEventThrottlingBehavior*); |
| 136 | |
| 137 | #if TARGET_OS_IPHONE |
| 138 | WK_EXPORT void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef, bool); |
| 139 | #endif |
| 140 | |
| 141 | #ifdef __cplusplus |
| 142 | } |
| 143 | #endif |
| 144 | |
| 145 | #endif /* WKBundlePagePrivate_h */ |
| 146 | |