1/*
2 * Copyright (C) 2010-2018 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#pragma once
27
28#include "DrawingAreaInfo.h"
29#include "LayerTreeContext.h"
30#include "SessionState.h"
31#include "WebCompiledContentRuleListData.h"
32#include "WebCoreArgumentCoders.h"
33#include "WebPageGroupData.h"
34#include "WebPreferencesStore.h"
35#include "WebUserContentControllerDataTypes.h"
36#include <WebCore/ActivityState.h>
37#include <WebCore/Color.h>
38#include <WebCore/FloatSize.h>
39#include <WebCore/IntSize.h>
40#include <WebCore/LayoutMilestone.h>
41#include <WebCore/MediaProducer.h>
42#include <WebCore/PageIdentifier.h>
43#include <WebCore/Pagination.h>
44#include <WebCore/ScrollTypes.h>
45#include <WebCore/UserInterfaceLayoutDirection.h>
46#include <WebCore/ViewportArguments.h>
47#include <pal/SessionID.h>
48#include <wtf/HashMap.h>
49#include <wtf/text/WTFString.h>
50
51#if PLATFORM(MAC)
52#include "ColorSpaceData.h"
53#endif
54
55#if ENABLE(APPLICATION_MANIFEST)
56#include <WebCore/ApplicationManifest.h>
57#endif
58
59namespace IPC {
60class Decoder;
61class Encoder;
62}
63
64namespace WebKit {
65
66struct WebPageCreationParameters {
67 void encode(IPC::Encoder&) const;
68 static Optional<WebPageCreationParameters> decode(IPC::Decoder&);
69
70 WebCore::IntSize viewSize;
71
72 OptionSet<WebCore::ActivityState::Flag> activityState;
73
74 WebPreferencesStore store;
75 DrawingAreaType drawingAreaType;
76 DrawingAreaIdentifier drawingAreaIdentifier;
77 WebPageGroupData pageGroupData;
78
79 bool isEditable;
80
81 WebCore::Color underlayColor;
82
83 bool useFixedLayout;
84 WebCore::IntSize fixedLayoutSize;
85
86 bool alwaysShowsHorizontalScroller;
87 bool alwaysShowsVerticalScroller;
88
89 bool suppressScrollbarAnimations;
90
91 WebCore::Pagination::Mode paginationMode;
92 bool paginationBehavesLikeColumns;
93 double pageLength;
94 double gapBetweenPages;
95 bool paginationLineGridEnabled;
96
97 String userAgent;
98
99 Vector<BackForwardListItemState> itemStates;
100 PAL::SessionID sessionID;
101
102 UserContentControllerIdentifier userContentControllerID;
103 uint64_t visitedLinkTableID;
104 uint64_t websiteDataStoreID;
105 bool canRunBeforeUnloadConfirmPanel;
106 bool canRunModal;
107
108 float deviceScaleFactor;
109 float viewScaleFactor;
110
111 double textZoomFactor { 1 };
112 double pageZoomFactor { 1 };
113
114 float topContentInset;
115
116 float mediaVolume;
117 WebCore::MediaProducer::MutedStateFlags muted;
118 bool mayStartMediaWhenInWindow;
119 bool mediaPlaybackIsSuspended { false };
120
121 WebCore::IntSize viewLayoutSize;
122 bool autoSizingShouldExpandToViewHeight;
123 Optional<WebCore::IntSize> viewportSizeForCSSViewportUnits;
124
125 WebCore::ScrollPinningBehavior scrollPinningBehavior;
126
127 // FIXME: This should be Optional<WebCore::ScrollbarOverlayStyle>, but we would need to
128 // correctly handle enums inside Optionals when encoding and decoding.
129 Optional<uint32_t> scrollbarOverlayStyle;
130
131 bool backgroundExtendsBeyondPage;
132
133 LayerHostingMode layerHostingMode;
134
135 Vector<String> mimeTypesWithCustomContentProviders;
136
137 bool controlledByAutomation;
138 bool isProcessSwap { false };
139
140 bool useDarkAppearance { false };
141 bool useInactiveAppearance { false };
142
143#if PLATFORM(MAC)
144 ColorSpaceData colorSpace;
145 bool useSystemAppearance;
146#endif
147#if PLATFORM(IOS_FAMILY)
148 WebCore::FloatSize screenSize;
149 WebCore::FloatSize availableScreenSize;
150 WebCore::FloatSize overrideScreenSize;
151 float textAutosizingWidth;
152 bool ignoresViewportScaleLimits;
153 WebCore::FloatSize viewportConfigurationViewLayoutSize;
154 double viewportConfigurationLayoutSizeScaleFactor;
155 double viewportConfigurationMinimumEffectiveDeviceWidth;
156 WebCore::FloatSize viewportConfigurationViewSize;
157 WebCore::FloatSize maximumUnobscuredSize;
158 int32_t deviceOrientation { 0 };
159 bool keyboardIsAttached { false };
160 bool canShowWhileLocked { false };
161 Seconds doubleTapForDoubleClickDelay { 350_ms };
162 float doubleTapForDoubleClickRadius { 45 };
163 Optional<WebCore::ViewportArguments> overrideViewportArguments;
164#endif
165#if PLATFORM(COCOA)
166 bool smartInsertDeleteEnabled;
167 Vector<String> additionalSupportedImageTypes;
168#endif
169#if USE(WPE_RENDERER)
170 IPC::Attachment hostFileDescriptor;
171#endif
172 bool appleMailPaginationQuirkEnabled;
173 bool appleMailLinesClampEnabled;
174 bool shouldScaleViewToFitDocument;
175
176 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection;
177 OptionSet<WebCore::LayoutMilestone> observedLayoutMilestones;
178
179 String overrideContentSecurityPolicy;
180 Optional<double> cpuLimit;
181
182 HashMap<String, uint64_t> urlSchemeHandlers;
183
184#if ENABLE(APPLICATION_MANIFEST)
185 Optional<WebCore::ApplicationManifest> applicationManifest;
186#endif
187
188#if ENABLE(SERVICE_WORKER)
189 bool hasRegisteredServiceWorkers { true };
190#endif
191
192 bool needsFontAttributes { false };
193
194 // WebRTC members.
195 bool iceCandidateFilteringEnabled { true };
196 bool enumeratingAllNetworkInterfacesEnabled { false };
197
198 // UserContentController members
199 Vector<std::pair<uint64_t, String>> userContentWorlds;
200 Vector<WebUserScriptData> userScripts;
201 Vector<WebUserStyleSheetData> userStyleSheets;
202 Vector<WebScriptMessageHandlerData> messageHandlers;
203#if ENABLE(CONTENT_EXTENSIONS)
204 Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
205#endif
206
207 Optional<WebCore::Color> backgroundColor;
208
209 Optional<WebCore::PageIdentifier> oldPageID;
210};
211
212} // namespace WebKit
213