Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
[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
100     UserContentControllerIdentifier userContentControllerID;
101     uint64_t visitedLinkTableID;
102     uint64_t websiteDataStoreID;
103     bool canRunBeforeUnloadConfirmPanel;
104     bool canRunModal;
105
106     float deviceScaleFactor;
107     float viewScaleFactor;
108
109     float topContentInset;
110     
111     float mediaVolume;
112     WebCore::MediaProducer::MutedStateFlags muted;
113     bool mayStartMediaWhenInWindow;
114
115     WebCore::IntSize minimumLayoutSize;
116     bool autoSizingShouldExpandToViewHeight;
117     std::optional<WebCore::IntSize> viewportSizeForCSSViewportUnits;
118     
119     WebCore::ScrollPinningBehavior scrollPinningBehavior;
120
121     // FIXME: This should be std::optional<WebCore::ScrollbarOverlayStyle>, but we would need to
122     // correctly handle enums inside Optionals when encoding and decoding. 
123     std::optional<uint32_t> scrollbarOverlayStyle;
124
125     bool backgroundExtendsBeyondPage;
126
127     LayerHostingMode layerHostingMode;
128
129     Vector<String> mimeTypesWithCustomContentProviders;
130
131     bool controlledByAutomation;
132
133 #if ENABLE(REMOTE_INSPECTOR)
134     bool allowsRemoteInspection;
135     String remoteInspectionNameOverride;
136 #endif
137
138 #if PLATFORM(MAC)
139     ColorSpaceData colorSpace;
140     bool useSystemAppearance;
141     bool defaultAppearance;
142 #endif
143 #if PLATFORM(IOS)
144     WebCore::FloatSize screenSize;
145     WebCore::FloatSize availableScreenSize;
146     WebCore::FloatSize overrideScreenSize;
147     float textAutosizingWidth;
148     bool ignoresViewportScaleLimits;
149     WebCore::FloatSize viewportConfigurationMinimumLayoutSize;
150     WebCore::FloatSize viewportConfigurationViewSize;
151     WebCore::FloatSize maximumUnobscuredSize;
152 #endif
153 #if PLATFORM(COCOA)
154     bool smartInsertDeleteEnabled;
155 #endif
156     bool appleMailPaginationQuirkEnabled;
157     bool appleMailLinesClampEnabled;
158     bool shouldScaleViewToFitDocument;
159
160     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection;
161     WebCore::LayoutMilestones observedLayoutMilestones;
162
163     String overrideContentSecurityPolicy;
164     std::optional<double> cpuLimit;
165
166     HashMap<String, uint64_t> urlSchemeHandlers;
167
168 #if ENABLE(APPLICATION_MANIFEST)
169     std::optional<WebCore::ApplicationManifest> applicationManifest;
170 #endif
171
172 #if ENABLE(SERVICE_WORKER)
173     bool hasRegisteredServiceWorkers { true };
174 #endif
175
176     // WebRTC members.
177     bool iceCandidateFilteringEnabled { true };
178     bool enumeratingAllNetworkInterfacesEnabled { false };
179
180     // UserContentController members
181     Vector<std::pair<uint64_t, String>> userContentWorlds;
182     Vector<WebUserScriptData> userScripts;
183     Vector<WebUserStyleSheetData> userStyleSheets;
184     Vector<WebScriptMessageHandlerData> messageHandlers;
185 #if ENABLE(CONTENT_EXTENSIONS)
186     Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
187 #endif
188 };
189
190 } // namespace WebKit