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
37extern "C" {
38#endif
39
40enum 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};
48typedef uint32_t RenderTreeExternalRepresentationBehavior;
49
50WK_EXPORT void WKBundlePageStopLoading(WKBundlePageRef page);
51WK_EXPORT void WKBundlePageSetDefersLoading(WKBundlePageRef page, bool defersLoading) WK_C_API_DEPRECATED;
52WK_EXPORT bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef page, WKStringRef commandName);
53WK_EXPORT void WKBundlePageClearMainFrameName(WKBundlePageRef page);
54WK_EXPORT void WKBundlePageClose(WKBundlePageRef page);
55WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef page, RenderTreeExternalRepresentationBehavior);
56WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentationForPrinting(WKBundlePageRef page);
57WK_EXPORT void WKBundlePageExecuteEditingCommand(WKBundlePageRef page, WKStringRef commandName, WKStringRef argument);
58
59WK_EXPORT double WKBundlePageGetTextZoomFactor(WKBundlePageRef page);
60WK_EXPORT void WKBundlePageSetTextZoomFactor(WKBundlePageRef page, double zoomFactor);
61WK_EXPORT double WKBundlePageGetPageZoomFactor(WKBundlePageRef page);
62WK_EXPORT void WKBundlePageSetPageZoomFactor(WKBundlePageRef page, double zoomFactor);
63
64WK_EXPORT void WKBundlePageSetScaleAtOrigin(WKBundlePageRef page, double scale, WKPoint origin);
65
66WK_EXPORT void WKBundlePageForceRepaint(WKBundlePageRef page);
67
68WK_EXPORT void WKBundlePageSimulateMouseDown(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time);
69WK_EXPORT void WKBundlePageSimulateMouseUp(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time);
70WK_EXPORT void WKBundlePageSimulateMouseMotion(WKBundlePageRef page, WKPoint position, double time);
71
72WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page);
73
74WK_EXPORT WKRenderObjectRef WKBundlePageCopyRenderTree(WKBundlePageRef page);
75WK_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.
79WK_EXPORT void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold);
80
81WK_EXPORT void WKBundlePageSetTracksRepaints(WKBundlePageRef page, bool trackRepaints);
82WK_EXPORT bool WKBundlePageIsTrackingRepaints(WKBundlePageRef page);
83WK_EXPORT void WKBundlePageResetTrackedRepaints(WKBundlePageRef page);
84WK_EXPORT WKArrayRef WKBundlePageCopyTrackedRepaintRects(WKBundlePageRef page);
85
86WK_EXPORT void WKBundlePageSetComposition(WKBundlePageRef page, WKStringRef text, int from, int length, bool suppressUnderline);
87WK_EXPORT bool WKBundlePageHasComposition(WKBundlePageRef page);
88WK_EXPORT void WKBundlePageConfirmComposition(WKBundlePageRef page);
89WK_EXPORT void WKBundlePageConfirmCompositionWithText(WKBundlePageRef page, WKStringRef text);
90
91WK_EXPORT void WKBundlePageSetUseDarkAppearance(WKBundlePageRef page, bool useDarkAppearance);
92WK_EXPORT bool WKBundlePageIsUsingDarkAppearance(WKBundlePageRef page);
93
94WK_EXPORT bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeType);
95
96WK_EXPORT void* WKAccessibilityRootObject(WKBundlePageRef);
97WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef);
98
99WK_EXPORT void WKAccessibilityEnableEnhancedAccessibility(bool);
100WK_EXPORT bool WKAccessibilityEnhancedAccessibilityEnabled();
101
102WK_EXPORT void WKBundlePageClickMenuItem(WKBundlePageRef, WKContextMenuItemRef);
103WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuItems(WKBundlePageRef);
104WK_EXPORT WKArrayRef WKBundlePageCopyContextMenuAtPointInWindow(WKBundlePageRef, WKPoint);
105
106WK_EXPORT void WKBundlePageInsertNewlineInQuotedContent(WKBundlePageRef page);
107
108// This only works if the SuppressesIncrementalRendering preference is set as well.
109typedef unsigned WKRenderingSuppressionToken;
110WK_EXPORT WKRenderingSuppressionToken WKBundlePageExtendIncrementalRenderingSuppression(WKBundlePageRef);
111WK_EXPORT void WKBundlePageStopExtendingIncrementalRenderingSuppression(WKBundlePageRef, WKRenderingSuppressionToken);
112
113// UserContent API (compatible with Modern API, for WKTR)
114WK_EXPORT void WKBundlePageAddUserScript(WKBundlePageRef page, WKStringRef source, _WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
115WK_EXPORT void WKBundlePageAddUserStyleSheet(WKBundlePageRef page, WKStringRef source, WKUserContentInjectedFrames injectedFrames);
116WK_EXPORT void WKBundlePageRemoveAllUserContent(WKBundlePageRef page);
117
118// Application Cache API, for WKTR.
119WK_EXPORT void WKBundlePageClearApplicationCache(WKBundlePageRef page);
120WK_EXPORT void WKBundlePageClearApplicationCacheForOrigin(WKBundlePageRef page, WKStringRef origin);
121WK_EXPORT void WKBundlePageSetAppCacheMaximumSize(WKBundlePageRef page, uint64_t size);
122WK_EXPORT uint64_t WKBundlePageGetAppCacheUsageForOrigin(WKBundlePageRef page, WKStringRef origin);
123WK_EXPORT void WKBundlePageSetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin, uint64_t bytes);
124WK_EXPORT void WKBundlePageResetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin);
125WK_EXPORT WKArrayRef WKBundlePageCopyOriginsWithApplicationCache(WKBundlePageRef page);
126
127enum {
128 kWKEventThrottlingBehaviorResponsive = 0,
129 kWKEventThrottlingBehaviorUnresponsive
130};
131
132typedef uint32_t WKEventThrottlingBehavior;
133
134// Passing null in the second parameter clears the override.
135WK_EXPORT void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef, WKEventThrottlingBehavior*);
136
137#if TARGET_OS_IPHONE
138WK_EXPORT void WKBundlePageSetUseTestingViewportConfiguration(WKBundlePageRef, bool);
139#endif
140
141#ifdef __cplusplus
142}
143#endif
144
145#endif /* WKBundlePagePrivate_h */
146