[WTF] Import std::optional reference implementation as WTF::Optional
[WebKit-https.git] / Source / WebKit2 / Shared / WebPageCreationParameters.h
1 /*
2  * Copyright (C) 2010, 2011, 2015 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 WebPageCreationParameters_h
27 #define WebPageCreationParameters_h
28
29 #include "DrawingAreaInfo.h"
30 #include "LayerTreeContext.h"
31 #include "SessionState.h"
32 #include "WebCoreArgumentCoders.h"
33 #include "WebPageGroupData.h"
34 #include "WebPreferencesStore.h"
35 #include <WebCore/ActivityState.h>
36 #include <WebCore/Color.h>
37 #include <WebCore/FloatSize.h>
38 #include <WebCore/IntSize.h>
39 #include <WebCore/LayoutMilestones.h>
40 #include <WebCore/MediaProducer.h>
41 #include <WebCore/Pagination.h>
42 #include <WebCore/ScrollTypes.h>
43 #include <WebCore/SessionID.h>
44 #include <WebCore/UserInterfaceLayoutDirection.h>
45 #include <wtf/text/WTFString.h>
46
47 #if PLATFORM(MAC)
48 #include "ColorSpaceData.h"
49 #endif
50
51 namespace IPC {
52 class Decoder;
53 class Encoder;
54 }
55
56 namespace WebKit {
57
58 struct WebPageCreationParameters {
59     void encode(IPC::Encoder&) const;
60     static bool decode(IPC::Decoder&, WebPageCreationParameters&);
61
62     WebCore::IntSize viewSize;
63
64     WebCore::ActivityState::Flags activityState;
65     
66     WebPreferencesStore store;
67     DrawingAreaType drawingAreaType;
68     WebPageGroupData pageGroupData;
69
70     bool drawsBackground;
71     bool isEditable;
72
73     WebCore::Color underlayColor;
74
75     bool useFixedLayout;
76     WebCore::IntSize fixedLayoutSize;
77
78     bool suppressScrollbarAnimations;
79
80     WebCore::Pagination::Mode paginationMode;
81     bool paginationBehavesLikeColumns;
82     double pageLength;
83     double gapBetweenPages;
84     bool paginationLineGridEnabled;
85     
86     String userAgent;
87
88     Vector<BackForwardListItemState> itemStates;
89     WebCore::SessionID sessionID;
90     uint64_t highestUsedBackForwardItemID;
91
92     uint64_t userContentControllerID;
93     uint64_t visitedLinkTableID;
94     uint64_t websiteDataStoreID;
95     bool canRunBeforeUnloadConfirmPanel;
96     bool canRunModal;
97
98     float deviceScaleFactor;
99     float viewScaleFactor;
100
101     float topContentInset;
102     
103     float mediaVolume;
104     WebCore::MediaProducer::MutedStateFlags muted;
105     bool mayStartMediaWhenInWindow;
106
107     WebCore::IntSize minimumLayoutSize;
108     bool autoSizingShouldExpandToViewHeight;
109     
110     WebCore::ScrollPinningBehavior scrollPinningBehavior;
111
112     // FIXME: This should be std::optional<WebCore::ScrollbarOverlayStyle>, but we would need to
113     // correctly handle enums inside Optionals when encoding and decoding. 
114     std::optional<uint32_t> scrollbarOverlayStyle;
115
116     bool backgroundExtendsBeyondPage;
117
118     LayerHostingMode layerHostingMode;
119
120     Vector<String> mimeTypesWithCustomContentProviders;
121
122     bool controlledByAutomation;
123
124 #if ENABLE(REMOTE_INSPECTOR)
125     bool allowsRemoteInspection;
126     String remoteInspectionNameOverride;
127 #endif
128
129 #if PLATFORM(MAC)
130     ColorSpaceData colorSpace;
131 #endif
132 #if PLATFORM(IOS)
133     WebCore::FloatSize screenSize;
134     WebCore::FloatSize availableScreenSize;
135     float textAutosizingWidth;
136     bool ignoresViewportScaleLimits;
137 #endif
138     bool appleMailPaginationQuirkEnabled;
139     bool shouldScaleViewToFitDocument;
140
141     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection;
142     WebCore::LayoutMilestones observedLayoutMilestones;
143 };
144
145 } // namespace WebKit
146
147 #endif // WebPageCreationParameters_h