baebaf4d41008965a56f4c1c3f21ace873ea4326
[WebKit-https.git] / Source / WebKit / Shared / WebPageCreationParameters.h
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/LayoutMilestones.h>
41 #include <WebCore/MediaProducer.h>
42 #include <WebCore/Pagination.h>
43 #include <WebCore/ScrollTypes.h>
44 #include <WebCore/UserInterfaceLayoutDirection.h>
45 #include <pal/SessionID.h>
46 #include <wtf/HashMap.h>
47 #include <wtf/text/WTFString.h>
48
49 #if PLATFORM(MAC)
50 #include "ColorSpaceData.h"
51 #endif
52
53 #if ENABLE(APPLICATION_MANIFEST)
54 #include <WebCore/ApplicationManifest.h>
55 #endif
56
57 namespace IPC {
58 class Decoder;
59 class Encoder;
60 }
61
62 namespace WebKit {
63
64 struct WebPageCreationParameters {
65     void encode(IPC::Encoder&) const;
66     static std::optional<WebPageCreationParameters> decode(IPC::Decoder&);
67
68     WebCore::IntSize viewSize;
69
70     WebCore::ActivityState::Flags activityState;
71     
72     WebPreferencesStore store;
73     DrawingAreaType drawingAreaType;
74     WebPageGroupData pageGroupData;
75
76     bool drawsBackground;
77     bool isEditable;
78
79     WebCore::Color underlayColor;
80
81     bool useFixedLayout;
82     WebCore::IntSize fixedLayoutSize;
83
84     bool alwaysShowsHorizontalScroller;
85     bool alwaysShowsVerticalScroller;
86
87     bool suppressScrollbarAnimations;
88
89     WebCore::Pagination::Mode paginationMode;
90     bool paginationBehavesLikeColumns;
91     double pageLength;
92     double gapBetweenPages;
93     bool paginationLineGridEnabled;
94     
95     String userAgent;
96
97     Vector<BackForwardListItemState> itemStates;
98     PAL::SessionID sessionID;
99     uint64_t highestUsedBackForwardItemID;
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     float topContentInset;
111     
112     float mediaVolume;
113     WebCore::MediaProducer::MutedStateFlags muted;
114     bool mayStartMediaWhenInWindow;
115
116     WebCore::IntSize minimumLayoutSize;
117     bool autoSizingShouldExpandToViewHeight;
118     std::optional<WebCore::IntSize> viewportSizeForCSSViewportUnits;
119     
120     WebCore::ScrollPinningBehavior scrollPinningBehavior;
121
122     // FIXME: This should be std::optional<WebCore::ScrollbarOverlayStyle>, but we would need to
123     // correctly handle enums inside Optionals when encoding and decoding. 
124     std::optional<uint32_t> scrollbarOverlayStyle;
125
126     bool backgroundExtendsBeyondPage;
127
128     LayerHostingMode layerHostingMode;
129
130     Vector<String> mimeTypesWithCustomContentProviders;
131
132     bool controlledByAutomation;
133
134 #if ENABLE(REMOTE_INSPECTOR)
135     bool allowsRemoteInspection;
136     String remoteInspectionNameOverride;
137 #endif
138
139 #if PLATFORM(MAC)
140     ColorSpaceData colorSpace;
141     bool useSystemAppearance;
142     bool defaultAppearance;
143 #endif
144 #if PLATFORM(IOS)
145     WebCore::FloatSize screenSize;
146     WebCore::FloatSize availableScreenSize;
147     WebCore::FloatSize overrideScreenSize;
148     float textAutosizingWidth;
149     bool ignoresViewportScaleLimits;
150     WebCore::FloatSize viewportConfigurationMinimumLayoutSize;
151     WebCore::FloatSize viewportConfigurationViewSize;
152     WebCore::FloatSize maximumUnobscuredSize;
153 #endif
154 #if PLATFORM(COCOA)
155     bool smartInsertDeleteEnabled;
156 #endif
157     bool appleMailPaginationQuirkEnabled;
158     bool appleMailLinesClampEnabled;
159     bool shouldScaleViewToFitDocument;
160
161     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection;
162     WebCore::LayoutMilestones observedLayoutMilestones;
163
164     String overrideContentSecurityPolicy;
165     std::optional<double> cpuLimit;
166
167     HashMap<String, uint64_t> urlSchemeHandlers;
168
169 #if ENABLE(APPLICATION_MANIFEST)
170     std::optional<WebCore::ApplicationManifest> applicationManifest;
171 #endif
172
173 #if ENABLE(SERVICE_WORKER)
174     bool hasRegisteredServiceWorkers { true };
175 #endif
176
177     // WebRTC members.
178     bool iceCandidateFilteringEnabled { true };
179     bool enumeratingAllNetworkInterfacesEnabled { false };
180
181     // UserContentController members
182     Vector<std::pair<uint64_t, String>> userContentWorlds;
183     Vector<WebUserScriptData> userScripts;
184     Vector<WebUserStyleSheetData> userStyleSheets;
185     Vector<WebScriptMessageHandlerData> messageHandlers;
186 #if ENABLE(CONTENT_EXTENSIONS)
187     Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
188 #endif
189 };
190
191 } // namespace WebKit