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