3ae7e475d8336efc27dcf2c51f722cc2db9845a6
[WebKit-https.git] / Source / WebKit / Shared / WebCoreArgumentCoders.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 "ArgumentCoders.h"
29 #include <WebCore/AutoplayEvent.h>
30 #include <WebCore/CacheStorageConnection.h>
31 #include <WebCore/ColorSpace.h>
32 #include <WebCore/DiagnosticLoggingClient.h>
33 #include <WebCore/FrameLoaderTypes.h>
34 #include <WebCore/IndexedDB.h>
35 #include <WebCore/InputMode.h>
36 #include <WebCore/MediaSelectionOption.h>
37 #include <WebCore/NetworkLoadMetrics.h>
38 #include <WebCore/NotificationDirection.h>
39 #include <WebCore/RealtimeMediaSource.h>
40 #include <WebCore/ScrollSnapOffsetsInfo.h>
41 #include <WebCore/ServiceWorkerTypes.h>
42 #include <WebCore/StoredCredentialsPolicy.h>
43 #include <WebCore/WorkerType.h>
44
45 #if ENABLE(APPLE_PAY)
46 #include <WebCore/PaymentHeaders.h>
47 #endif
48
49 #if USE(CURL)
50 #include <WebCore/CurlProxySettings.h>
51 #endif
52
53 #if PLATFORM(COCOA)
54 namespace WTF {
55 class MachSendRight;
56 }
57 #endif
58
59 namespace WebCore {
60 class AffineTransform;
61 class AuthenticationChallenge;
62 class BlobPart;
63 class CertificateInfo;
64 class Color;
65 class Credential;
66 class CubicBezierTimingFunction;
67 class Cursor;
68 class DatabaseDetails;
69 class DragData;
70 class FilterOperation;
71 class FilterOperations;
72 class FloatPoint;
73 class FloatPoint3D;
74 class FloatRect;
75 class FloatRoundedRect;
76 class FloatSize;
77 class FixedPositionViewportConstraints;
78 class HTTPHeaderMap;
79 class IntPoint;
80 class IntRect;
81 class IntSize;
82 class KeyframeValueList;
83 class LayoutSize;
84 class LayoutPoint;
85 class LinearTimingFunction;
86 class Notification;
87 class Path;
88 class ProtectionSpace;
89 class Region;
90 class ResourceError;
91 class ResourceRequest;
92 class ResourceResponse;
93 class SecurityOrigin;
94 class SpringTimingFunction;
95 class StepsTimingFunction;
96 class StickyPositionViewportConstraints;
97 class TextCheckingRequestData;
98 class TransformationMatrix;
99 class UserStyleSheet;
100
101 struct CacheQueryOptions;
102 struct CompositionUnderline;
103 struct DictationAlternative;
104 struct DictionaryPopupInfo;
105 struct EventTrackingRegions;
106 struct ExceptionDetails;
107 struct FontAttributes;
108 struct FileChooserSettings;
109 struct ShareData;
110 struct ShareDataWithParsedURL;
111 struct Length;
112 struct GrammarDetail;
113 struct MimeClassInfo;
114 struct PasteboardImage;
115 struct PasteboardCustomData;
116 struct PasteboardURL;
117 struct PluginInfo;
118 struct PromisedAttachmentInfo;
119 struct RecentSearch;
120 struct ResourceLoadStatistics;
121 struct ScrollableAreaParameters;
122 struct TextCheckingResult;
123 struct TextIndicatorData;
124 struct ViewportAttributes;
125 struct WindowFeatures;
126     
127 template <typename> class RectEdges;
128 using FloatBoxExtent = RectEdges<float>;
129
130 #if PLATFORM(COCOA)
131 struct KeypressCommand;
132 #endif
133
134 #if PLATFORM(IOS_FAMILY)
135 class FloatQuad;
136 class SelectionRect;
137 struct Highlight;
138 struct PasteboardImage;
139 struct PasteboardWebContent;
140 struct ViewportArguments;
141 #endif
142
143 #if ENABLE(DATALIST_ELEMENT)
144 struct DataListSuggestionInformation;
145 #endif
146
147 #if USE(SOUP)
148 struct SoupNetworkProxySettings;
149 #endif
150
151 #if USE(LIBWPE)
152 struct PasteboardWebContent;
153 #endif
154
155 #if ENABLE(CONTENT_FILTERING)
156 class ContentFilterUnblockHandler;
157 #endif
158
159 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
160 class MediaPlaybackTargetContext;
161 #endif
162
163 #if ENABLE(MEDIA_SESSION)
164 class MediaSessionMetadata;
165 #endif
166
167 #if ENABLE(MEDIA_STREAM)
168 struct MediaConstraints;
169 #endif
170
171 #if ENABLE(ATTACHMENT_ELEMENT)
172 struct SerializedAttachmentData;
173 #endif
174
175 #if ENABLE(INDEXED_DATABASE)
176 using IDBKeyPath = Variant<String, Vector<String>>;
177 #endif
178 }
179
180 namespace IPC {
181
182 template<> struct ArgumentCoder<WebCore::AffineTransform> {
183     static void encode(Encoder&, const WebCore::AffineTransform&);
184     static bool decode(Decoder&, WebCore::AffineTransform&);
185 };
186
187 template<> struct ArgumentCoder<WebCore::CacheQueryOptions> {
188     static void encode(Encoder&, const WebCore::CacheQueryOptions&);
189     static bool decode(Decoder&, WebCore::CacheQueryOptions&);
190 };
191
192 template<> struct ArgumentCoder<WebCore::DOMCacheEngine::CacheInfo> {
193     static void encode(Encoder&, const WebCore::DOMCacheEngine::CacheInfo&);
194     static Optional<WebCore::DOMCacheEngine::CacheInfo> decode(Decoder&);
195 };
196
197 template<> struct ArgumentCoder<WebCore::DOMCacheEngine::Record> {
198     static void encode(Encoder&, const WebCore::DOMCacheEngine::Record&);
199     static Optional<WebCore::DOMCacheEngine::Record> decode(Decoder&);
200 };
201
202 template<> struct ArgumentCoder<WebCore::EventTrackingRegions> {
203     static void encode(Encoder&, const WebCore::EventTrackingRegions&);
204     static bool decode(Decoder&, WebCore::EventTrackingRegions&);
205 };
206
207 template<> struct ArgumentCoder<WebCore::TransformationMatrix> {
208     static void encode(Encoder&, const WebCore::TransformationMatrix&);
209     static bool decode(Decoder&, WebCore::TransformationMatrix&);
210 };
211
212 template<> struct ArgumentCoder<WebCore::LinearTimingFunction> {
213     static void encode(Encoder&, const WebCore::LinearTimingFunction&);
214     static bool decode(Decoder&, WebCore::LinearTimingFunction&);
215 };
216
217 template<> struct ArgumentCoder<WebCore::CubicBezierTimingFunction> {
218     static void encode(Encoder&, const WebCore::CubicBezierTimingFunction&);
219     static bool decode(Decoder&, WebCore::CubicBezierTimingFunction&);
220 };
221
222 template<> struct ArgumentCoder<WebCore::StepsTimingFunction> {
223     static void encode(Encoder&, const WebCore::StepsTimingFunction&);
224     static bool decode(Decoder&, WebCore::StepsTimingFunction&);
225 };
226
227 template<> struct ArgumentCoder<WebCore::SpringTimingFunction> {
228     static void encode(Encoder&, const WebCore::SpringTimingFunction&);
229     static bool decode(Decoder&, WebCore::SpringTimingFunction&);
230 };
231
232 template<> struct ArgumentCoder<WebCore::CertificateInfo> {
233     static void encode(Encoder&, const WebCore::CertificateInfo&);
234     static bool decode(Decoder&, WebCore::CertificateInfo&);
235 };
236
237 template<> struct ArgumentCoder<WebCore::FloatPoint> {
238     static void encode(Encoder&, const WebCore::FloatPoint&);
239     static bool decode(Decoder&, WebCore::FloatPoint&);
240     static Optional<WebCore::FloatPoint> decode(Decoder&);
241 };
242
243 template<> struct ArgumentCoder<WebCore::FloatPoint3D> {
244     static void encode(Encoder&, const WebCore::FloatPoint3D&);
245     static bool decode(Decoder&, WebCore::FloatPoint3D&);
246 };
247
248 template<> struct ArgumentCoder<WebCore::FloatRect> {
249     static void encode(Encoder&, const WebCore::FloatRect&);
250     static bool decode(Decoder&, WebCore::FloatRect&);
251     static Optional<WebCore::FloatRect> decode(Decoder&);
252 };
253     
254 template<> struct ArgumentCoder<WebCore::FloatBoxExtent> {
255     static void encode(Encoder&, const WebCore::FloatBoxExtent&);
256     static bool decode(Decoder&, WebCore::FloatBoxExtent&);
257 };
258
259 template<> struct ArgumentCoder<WebCore::FloatSize> {
260     static void encode(Encoder&, const WebCore::FloatSize&);
261     static bool decode(Decoder&, WebCore::FloatSize&);
262 };
263
264 template<> struct ArgumentCoder<WebCore::FloatRoundedRect> {
265     static void encode(Encoder&, const WebCore::FloatRoundedRect&);
266     static bool decode(Decoder&, WebCore::FloatRoundedRect&);
267 };
268
269 #if PLATFORM(IOS_FAMILY)
270 template<> struct ArgumentCoder<WebCore::FloatQuad> {
271     static void encode(Encoder&, const WebCore::FloatQuad&);
272     static Optional<WebCore::FloatQuad> decode(Decoder&);
273 };
274
275 template<> struct ArgumentCoder<WebCore::ViewportArguments> {
276     static void encode(Encoder&, const WebCore::ViewportArguments&);
277     static bool decode(Decoder&, WebCore::ViewportArguments&);
278     static Optional<WebCore::ViewportArguments> decode(Decoder&);
279 };
280 #endif // PLATFORM(IOS_FAMILY)
281
282 template<> struct ArgumentCoder<WebCore::IntPoint> {
283     static void encode(Encoder&, const WebCore::IntPoint&);
284     static bool decode(Decoder&, WebCore::IntPoint&);
285     static Optional<WebCore::IntPoint> decode(Decoder&);
286 };
287
288 template<> struct ArgumentCoder<WebCore::IntRect> {
289     static void encode(Encoder&, const WebCore::IntRect&);
290     static bool decode(Decoder&, WebCore::IntRect&);
291     static Optional<WebCore::IntRect> decode(Decoder&);
292 };
293
294 template<> struct ArgumentCoder<WebCore::IntSize> {
295     static void encode(Encoder&, const WebCore::IntSize&);
296     static bool decode(Decoder&, WebCore::IntSize&);
297     static Optional<WebCore::IntSize> decode(Decoder&);
298 };
299
300 template<> struct ArgumentCoder<WebCore::LayoutSize> {
301     static void encode(Encoder&, const WebCore::LayoutSize&);
302     static bool decode(Decoder&, WebCore::LayoutSize&);
303 };
304
305 template<> struct ArgumentCoder<WebCore::LayoutPoint> {
306     static void encode(Encoder&, const WebCore::LayoutPoint&);
307     static bool decode(Decoder&, WebCore::LayoutPoint&);
308 };
309
310 template<> struct ArgumentCoder<WebCore::Path> {
311     static void encode(Encoder&, const WebCore::Path&);
312     static bool decode(Decoder&, WebCore::Path&);
313     static Optional<WebCore::Path> decode(Decoder&);
314 };
315
316 template<> struct ArgumentCoder<WebCore::Region> {
317     static void encode(Encoder&, const WebCore::Region&);
318     static bool decode(Decoder&, WebCore::Region&);
319 };
320
321 template<> struct ArgumentCoder<WebCore::Length> {
322     static void encode(Encoder&, const WebCore::Length&);
323     static bool decode(Decoder&, WebCore::Length&);
324 };
325
326 template<> struct ArgumentCoder<WebCore::ViewportAttributes> {
327     static void encode(Encoder&, const WebCore::ViewportAttributes&);
328     static bool decode(Decoder&, WebCore::ViewportAttributes&);
329 };
330
331 template<> struct ArgumentCoder<WebCore::MimeClassInfo> {
332     static void encode(Encoder&, const WebCore::MimeClassInfo&);
333     static Optional<WebCore::MimeClassInfo> decode(Decoder&);
334 };
335
336 template<> struct ArgumentCoder<WebCore::PluginInfo> {
337     static void encode(Encoder&, const WebCore::PluginInfo&);
338     static Optional<WebCore::PluginInfo> decode(Decoder&);
339 };
340
341 template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> {
342     static void encode(Encoder&, const WebCore::AuthenticationChallenge&);
343     static bool decode(Decoder&, WebCore::AuthenticationChallenge&);
344 };
345
346 template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
347     static void encode(Encoder&, const WebCore::ProtectionSpace&);
348     static bool decode(Decoder&, WebCore::ProtectionSpace&);
349     static void encodePlatformData(Encoder&, const WebCore::ProtectionSpace&);
350     static bool decodePlatformData(Decoder&, WebCore::ProtectionSpace&);
351 };
352
353 template<> struct ArgumentCoder<WebCore::Credential> {
354     static void encode(Encoder&, const WebCore::Credential&);
355     static bool decode(Decoder&, WebCore::Credential&);
356     static void encodePlatformData(Encoder&, const WebCore::Credential&);
357     static bool decodePlatformData(Decoder&, WebCore::Credential&);
358 };
359
360 template<> struct ArgumentCoder<WebCore::Cursor> {
361     static void encode(Encoder&, const WebCore::Cursor&);
362     static bool decode(Decoder&, WebCore::Cursor&);
363 };
364
365 template<> struct ArgumentCoder<WebCore::ResourceRequest> {
366     static void encode(Encoder&, const WebCore::ResourceRequest&);
367     static bool decode(Decoder&, WebCore::ResourceRequest&);
368     static void encodePlatformData(Encoder&, const WebCore::ResourceRequest&);
369     static bool decodePlatformData(Decoder&, WebCore::ResourceRequest&);
370 };
371
372 template<> struct ArgumentCoder<WebCore::ResourceError> {
373     static void encode(Encoder&, const WebCore::ResourceError&);
374     static bool decode(Decoder&, WebCore::ResourceError&);
375     static void encodePlatformData(Encoder&, const WebCore::ResourceError&);
376     static bool decodePlatformData(Decoder&, WebCore::ResourceError&);
377 };
378
379 template<> struct ArgumentCoder<WebCore::WindowFeatures> {
380     static void encode(Encoder&, const WebCore::WindowFeatures&);
381     static bool decode(Decoder&, WebCore::WindowFeatures&);
382 };
383
384 template<> struct ArgumentCoder<WebCore::Color> {
385     static void encode(Encoder&, const WebCore::Color&);
386     static bool decode(Decoder&, WebCore::Color&);
387     static Optional<WebCore::Color> decode(Decoder&);
388 };
389
390 #if ENABLE(DRAG_SUPPORT)
391 template<> struct ArgumentCoder<WebCore::DragData> {
392     static void encode(Encoder&, const WebCore::DragData&);
393     static bool decode(Decoder&, WebCore::DragData&);
394 };
395 #endif
396
397 #if PLATFORM(COCOA)
398 template<> struct ArgumentCoder<WTF::MachSendRight> {
399     static void encode(Encoder&, const WTF::MachSendRight&);
400     static void encode(Encoder&, WTF::MachSendRight&&);
401     static bool decode(Decoder&, WTF::MachSendRight&);
402 };
403
404 template<> struct ArgumentCoder<WebCore::KeypressCommand> {
405     static void encode(Encoder&, const WebCore::KeypressCommand&);
406     static Optional<WebCore::KeypressCommand> decode(Decoder&);
407 };
408 #endif
409
410 #if PLATFORM(IOS_FAMILY)
411 template<> struct ArgumentCoder<WebCore::SelectionRect> {
412     static void encode(Encoder&, const WebCore::SelectionRect&);
413     static Optional<WebCore::SelectionRect> decode(Decoder&);
414 };
415
416 template<> struct ArgumentCoder<WebCore::Highlight> {
417     static void encode(Encoder&, const WebCore::Highlight&);
418     static bool decode(Decoder&, WebCore::Highlight&);
419 };
420
421 template<> struct ArgumentCoder<WebCore::PasteboardWebContent> {
422     static void encode(Encoder&, const WebCore::PasteboardWebContent&);
423     static bool decode(Decoder&, WebCore::PasteboardWebContent&);
424 };
425
426 template<> struct ArgumentCoder<WebCore::PasteboardImage> {
427     static void encode(Encoder&, const WebCore::PasteboardImage&);
428     static bool decode(Decoder&, WebCore::PasteboardImage&);
429 };
430 #endif
431
432 template<> struct ArgumentCoder<WebCore::PasteboardCustomData> {
433     static void encode(Encoder&, const WebCore::PasteboardCustomData&);
434     static bool decode(Decoder&, WebCore::PasteboardCustomData&);
435 };
436
437 template<> struct ArgumentCoder<WebCore::PasteboardURL> {
438     static void encode(Encoder&, const WebCore::PasteboardURL&);
439     static bool decode(Decoder&, WebCore::PasteboardURL&);
440 };
441
442 #if USE(SOUP)
443 template<> struct ArgumentCoder<WebCore::SoupNetworkProxySettings> {
444     static void encode(Encoder&, const WebCore::SoupNetworkProxySettings&);
445     static bool decode(Decoder&, WebCore::SoupNetworkProxySettings&);
446 };
447 #endif
448
449 #if USE(LIBWPE)
450 template<> struct ArgumentCoder<WebCore::PasteboardWebContent> {
451     static void encode(Encoder&, const WebCore::PasteboardWebContent&);
452     static bool decode(Decoder&, WebCore::PasteboardWebContent&);
453 };
454 #endif
455
456 #if USE(CURL)
457 template<> struct ArgumentCoder<WebCore::CurlProxySettings> {
458     static void encode(Encoder&, const WebCore::CurlProxySettings&);
459     static Optional<WebCore::CurlProxySettings> decode(Decoder&);
460 };
461 #endif
462
463 template<> struct ArgumentCoder<WebCore::CompositionUnderline> {
464     static void encode(Encoder&, const WebCore::CompositionUnderline&);
465     static Optional<WebCore::CompositionUnderline> decode(Decoder&);
466 };
467
468 template<> struct ArgumentCoder<WebCore::DatabaseDetails> {
469     static void encode(Encoder&, const WebCore::DatabaseDetails&);
470     static bool decode(Decoder&, WebCore::DatabaseDetails&);
471 };
472
473 #if ENABLE(DATALIST_ELEMENT)
474 template<> struct ArgumentCoder<WebCore::DataListSuggestionInformation> {
475     static void encode(Encoder&, const WebCore::DataListSuggestionInformation&);
476     static bool decode(Decoder&, WebCore::DataListSuggestionInformation&);
477 };
478 #endif
479
480 template<> struct ArgumentCoder<WebCore::DictationAlternative> {
481     static void encode(Encoder&, const WebCore::DictationAlternative&);
482     static Optional<WebCore::DictationAlternative> decode(Decoder&);
483 };
484
485 template<> struct ArgumentCoder<WebCore::FileChooserSettings> {
486     static void encode(Encoder&, const WebCore::FileChooserSettings&);
487     static bool decode(Decoder&, WebCore::FileChooserSettings&);
488 };
489     
490 template<> struct ArgumentCoder<WebCore::ShareData> {
491     static void encode(Encoder&, const WebCore::ShareData&);
492     static bool decode(Decoder&, WebCore::ShareData&);
493 };
494     
495 template<> struct ArgumentCoder<WebCore::ShareDataWithParsedURL> {
496     static void encode(Encoder&, const WebCore::ShareDataWithParsedURL&);
497     static bool decode(Decoder&, WebCore::ShareDataWithParsedURL&);
498 };
499
500 template<> struct ArgumentCoder<WebCore::GrammarDetail> {
501     static void encode(Encoder&, const WebCore::GrammarDetail&);
502     static Optional<WebCore::GrammarDetail> decode(Decoder&);
503 };
504
505 template<> struct ArgumentCoder<WebCore::TextCheckingRequestData> {
506     static void encode(Encoder&, const WebCore::TextCheckingRequestData&);
507     static bool decode(Decoder&, WebCore::TextCheckingRequestData&);
508 };
509
510 template<> struct ArgumentCoder<WebCore::TextCheckingResult> {
511     static void encode(Encoder&, const WebCore::TextCheckingResult&);
512     static Optional<WebCore::TextCheckingResult> decode(Decoder&);
513 };
514
515 template<> struct ArgumentCoder<WebCore::UserStyleSheet> {
516     static void encode(Encoder&, const WebCore::UserStyleSheet&);
517     static bool decode(Decoder&, WebCore::UserStyleSheet&);
518 };
519
520 template<> struct ArgumentCoder<WebCore::ScrollableAreaParameters> {
521     static void encode(Encoder&, const WebCore::ScrollableAreaParameters&);
522     static bool decode(Decoder&, WebCore::ScrollableAreaParameters&);
523 };
524
525 template<> struct ArgumentCoder<WebCore::FixedPositionViewportConstraints> {
526     static void encode(Encoder&, const WebCore::FixedPositionViewportConstraints&);
527     static bool decode(Decoder&, WebCore::FixedPositionViewportConstraints&);
528 };
529
530 template<> struct ArgumentCoder<WebCore::StickyPositionViewportConstraints> {
531     static void encode(Encoder&, const WebCore::StickyPositionViewportConstraints&);
532     static bool decode(Decoder&, WebCore::StickyPositionViewportConstraints&);
533 };
534
535 #if !USE(COORDINATED_GRAPHICS)
536 template<> struct ArgumentCoder<WebCore::FilterOperations> {
537     static void encode(Encoder&, const WebCore::FilterOperations&);
538     static bool decode(Decoder&, WebCore::FilterOperations&);
539 };
540     
541 template<> struct ArgumentCoder<WebCore::FilterOperation> {
542     static void encode(Encoder&, const WebCore::FilterOperation&);
543 };
544 bool decodeFilterOperation(Decoder&, RefPtr<WebCore::FilterOperation>&);
545 #endif
546
547 template<> struct ArgumentCoder<WebCore::BlobPart> {
548     static void encode(Encoder&, const WebCore::BlobPart&);
549     static Optional<WebCore::BlobPart> decode(Decoder&);
550 };
551
552 #if ENABLE(CONTENT_FILTERING)
553 template<> struct ArgumentCoder<WebCore::ContentFilterUnblockHandler> {
554     static void encode(Encoder&, const WebCore::ContentFilterUnblockHandler&);
555     static bool decode(Decoder&, WebCore::ContentFilterUnblockHandler&);
556 };
557 #endif
558
559 #if ENABLE(MEDIA_SESSION)
560 template<> struct ArgumentCoder<WebCore::MediaSessionMetadata> {
561     static void encode(Encoder&, const WebCore::MediaSessionMetadata&);
562     static bool decode(Decoder&, WebCore::MediaSessionMetadata&);
563 };
564 #endif
565
566 template<> struct ArgumentCoder<WebCore::TextIndicatorData> {
567     static void encode(Encoder&, const WebCore::TextIndicatorData&);
568     static Optional<WebCore::TextIndicatorData> decode(Decoder&);
569 };
570
571 template<> struct ArgumentCoder<WebCore::DictionaryPopupInfo> {
572     static void encode(Encoder&, const WebCore::DictionaryPopupInfo&);
573     static bool decode(Decoder&, WebCore::DictionaryPopupInfo&);
574 };
575
576 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
577 template<> struct ArgumentCoder<WebCore::MediaPlaybackTargetContext> {
578     static void encode(Encoder&, const WebCore::MediaPlaybackTargetContext&);
579     static bool decode(Decoder&, WebCore::MediaPlaybackTargetContext&);
580     static void encodePlatformData(Encoder&, const WebCore::MediaPlaybackTargetContext&);
581     static bool decodePlatformData(Decoder&, WebCore::MediaPlaybackTargetContext&);
582 };
583 #endif
584
585 template<> struct ArgumentCoder<WebCore::RecentSearch> {
586     static void encode(Encoder&, const WebCore::RecentSearch&);
587     static Optional<WebCore::RecentSearch> decode(Decoder&);
588 };
589
590 template<> struct ArgumentCoder<WebCore::ExceptionDetails> {
591     static void encode(Encoder&, const WebCore::ExceptionDetails&);
592     static bool decode(Decoder&, WebCore::ExceptionDetails&);
593 };
594
595 template<> struct ArgumentCoder<WebCore::ResourceLoadStatistics> {
596     static void encode(Encoder&, const WebCore::ResourceLoadStatistics&);
597     static Optional<WebCore::ResourceLoadStatistics> decode(Decoder&);
598 };
599
600 #if ENABLE(APPLE_PAY)
601
602 template<> struct ArgumentCoder<WebCore::Payment> {
603     static void encode(Encoder&, const WebCore::Payment&);
604     static Optional<WebCore::Payment> decode(Decoder&);
605 };
606
607 template<> struct ArgumentCoder<WebCore::PaymentAuthorizationResult> {
608     static void encode(Encoder&, const WebCore::PaymentAuthorizationResult&);
609     static Optional<WebCore::PaymentAuthorizationResult> decode(Decoder&);
610 };
611
612 template<> struct ArgumentCoder<WebCore::PaymentContact> {
613     static void encode(Encoder&, const WebCore::PaymentContact&);
614     static Optional<WebCore::PaymentContact> decode(Decoder&);
615 };
616
617 template<> struct ArgumentCoder<WebCore::PaymentError> {
618     static void encode(Encoder&, const WebCore::PaymentError&);
619     static Optional<WebCore::PaymentError> decode(Decoder&);
620 };
621
622 template<> struct ArgumentCoder<WebCore::PaymentMerchantSession> {
623     static void encode(Encoder&, const WebCore::PaymentMerchantSession&);
624     static Optional<WebCore::PaymentMerchantSession> decode(Decoder&);
625 };
626
627 template<> struct ArgumentCoder<WebCore::PaymentMethod> {
628     static void encode(Encoder&, const WebCore::PaymentMethod&);
629     static Optional<WebCore::PaymentMethod> decode(Decoder&);
630 };
631
632 template<> struct ArgumentCoder<WebCore::PaymentMethodUpdate> {
633     static void encode(Encoder&, const WebCore::PaymentMethodUpdate&);
634     static Optional<WebCore::PaymentMethodUpdate> decode(Decoder&);
635 };
636
637 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest> {
638     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest&);
639     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest&);
640 };
641
642 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ContactFields> {
643     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ContactFields&);
644     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::ContactFields&);
645 };
646
647 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::LineItem> {
648     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::LineItem&);
649     static Optional<WebCore::ApplePaySessionPaymentRequest::LineItem> decode(Decoder&);
650 };
651
652 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities> {
653     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
654     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
655 };
656
657 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> {
658     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
659     static Optional<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> decode(Decoder&);
660 };
661
662 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> {
663     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems&);
664     static Optional<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> decode(Decoder&);
665 };
666
667 template<> struct ArgumentCoder<WebCore::ShippingContactUpdate> {
668     static void encode(Encoder&, const WebCore::ShippingContactUpdate&);
669     static Optional<WebCore::ShippingContactUpdate> decode(Decoder&);
670 };
671
672 template<> struct ArgumentCoder<WebCore::ShippingMethodUpdate> {
673     static void encode(Encoder&, const WebCore::ShippingMethodUpdate&);
674     static Optional<WebCore::ShippingMethodUpdate> decode(Decoder&);
675 };
676
677 #endif
678
679 #if ENABLE(MEDIA_STREAM)
680 template<> struct ArgumentCoder<WebCore::MediaConstraints> {
681     static void encode(Encoder&, const WebCore::MediaConstraints&);
682     static bool decode(Decoder&, WebCore::MediaConstraints&);
683 };
684 #endif
685
686 #if ENABLE(INDEXED_DATABASE)
687
688 template<> struct ArgumentCoder<WebCore::IDBKeyPath> {
689     static void encode(Encoder&, const WebCore::IDBKeyPath&);
690     static bool decode(Decoder&, WebCore::IDBKeyPath&);
691 };
692
693 #endif
694
695 #if ENABLE(SERVICE_WORKER)
696
697 template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientData> {
698     static void encode(Encoder&, const WebCore::ServiceWorkerOrClientData&);
699     static bool decode(Decoder&, WebCore::ServiceWorkerOrClientData&);
700 };
701
702 template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientIdentifier> {
703     static void encode(Encoder&, const WebCore::ServiceWorkerOrClientIdentifier&);
704     static bool decode(Decoder&, WebCore::ServiceWorkerOrClientIdentifier&);
705 };
706
707 #endif
708
709 #if ENABLE(CSS_SCROLL_SNAP)
710
711 template<> struct ArgumentCoder<WebCore::ScrollOffsetRange<float>> {
712     static void encode(Encoder&, const WebCore::ScrollOffsetRange<float>&);
713     static Optional<WebCore::ScrollOffsetRange<float>> decode(Decoder&);
714 };
715
716 #endif
717
718 template<> struct ArgumentCoder<WebCore::MediaSelectionOption> {
719     static void encode(Encoder&, const WebCore::MediaSelectionOption&);
720     static Optional<WebCore::MediaSelectionOption> decode(Decoder&);
721 };
722
723 template<> struct ArgumentCoder<WebCore::PromisedAttachmentInfo> {
724     static void encode(Encoder&, const WebCore::PromisedAttachmentInfo&);
725     static bool decode(Decoder&, WebCore::PromisedAttachmentInfo&);
726 };
727
728 template<> struct ArgumentCoder<Vector<RefPtr<WebCore::SecurityOrigin>>> {
729     static void encode(Encoder&, const Vector<RefPtr<WebCore::SecurityOrigin>>&);
730     static bool decode(Decoder&, Vector<RefPtr<WebCore::SecurityOrigin>>&);
731 };
732
733 template<> struct ArgumentCoder<WebCore::FontAttributes> {
734     static void encode(Encoder&, const WebCore::FontAttributes&);
735     static Optional<WebCore::FontAttributes> decode(Decoder&);
736 };
737
738 #if ENABLE(ATTACHMENT_ELEMENT)
739
740 template<> struct ArgumentCoder<WebCore::SerializedAttachmentData> {
741     static void encode(Encoder&, const WebCore::SerializedAttachmentData&);
742     static Optional<WebCore::SerializedAttachmentData> decode(Decoder&);
743 };
744
745 #endif // ENABLE(ATTACHMENT_ELEMENT)
746
747 } // namespace IPC
748
749 namespace WTF {
750
751 template<> struct EnumTraits<WebCore::ColorSpace> {
752     using values = EnumValues<
753     WebCore::ColorSpace,
754     WebCore::ColorSpace::ColorSpaceSRGB,
755     WebCore::ColorSpace::ColorSpaceLinearRGB,
756     WebCore::ColorSpace::ColorSpaceDisplayP3
757     >;
758 };
759
760 template<> struct EnumTraits<WebCore::AutoplayEvent> {
761     using values = EnumValues<
762         WebCore::AutoplayEvent,
763         WebCore::AutoplayEvent::DidPreventMediaFromPlaying,
764         WebCore::AutoplayEvent::DidPlayMediaWithUserGesture,
765         WebCore::AutoplayEvent::DidAutoplayMediaPastThresholdWithoutUserInterference,
766         WebCore::AutoplayEvent::UserDidInterfereWithPlayback
767     >;
768 };
769
770 template<> struct EnumTraits<WebCore::InputMode> {
771     using values = EnumValues<
772         WebCore::InputMode,
773         WebCore::InputMode::Unspecified,
774         WebCore::InputMode::None,
775         WebCore::InputMode::Text,
776         WebCore::InputMode::Telephone,
777         WebCore::InputMode::Url,
778         WebCore::InputMode::Email,
779         WebCore::InputMode::Numeric,
780         WebCore::InputMode::Decimal,
781         WebCore::InputMode::Search
782     >;
783 };
784
785 template<> struct EnumTraits<WebCore::NetworkLoadPriority> {
786     using values = EnumValues<
787         WebCore::NetworkLoadPriority,
788         WebCore::NetworkLoadPriority::Low,
789         WebCore::NetworkLoadPriority::Medium,
790         WebCore::NetworkLoadPriority::High,
791         WebCore::NetworkLoadPriority::Unknown
792     >;
793 };
794
795 template<> struct EnumTraits<WebCore::NotificationDirection> {
796     using values = EnumValues<
797         WebCore::NotificationDirection,
798         WebCore::NotificationDirection::Auto,
799         WebCore::NotificationDirection::Ltr,
800         WebCore::NotificationDirection::Rtl
801     >;
802 };
803
804 #if ENABLE(INDEXED_DATABASE)
805 template<> struct EnumTraits<WebCore::IndexedDB::GetAllType> {
806     using values = EnumValues<
807         WebCore::IndexedDB::GetAllType,
808         WebCore::IndexedDB::GetAllType::Keys,
809         WebCore::IndexedDB::GetAllType::Values
810     >;
811 };
812 #endif
813
814 #if ENABLE(MEDIA_STREAM)
815 template<> struct EnumTraits<WebCore::RealtimeMediaSource::Type> {
816     using values = EnumValues<
817         WebCore::RealtimeMediaSource::Type,
818         WebCore::RealtimeMediaSource::Type::None,
819         WebCore::RealtimeMediaSource::Type::Audio,
820         WebCore::RealtimeMediaSource::Type::Video
821     >;
822 };
823 #endif
824
825 template<> struct EnumTraits<WebCore::MediaSelectionOption::Type> {
826     using values = EnumValues<
827         WebCore::MediaSelectionOption::Type,
828         WebCore::MediaSelectionOption::Type::Regular,
829         WebCore::MediaSelectionOption::Type::LegibleOff,
830         WebCore::MediaSelectionOption::Type::LegibleAuto
831     >;
832 };
833
834 template <> struct EnumTraits<WebCore::WorkerType> {
835     using values = EnumValues<
836         WebCore::WorkerType,
837         WebCore::WorkerType::Classic,
838         WebCore::WorkerType::Module
839     >;
840 };
841
842 #if USE(CURL)
843 template <> struct EnumTraits<WebCore::CurlProxySettings::Mode> {
844     using values = EnumValues<
845         WebCore::CurlProxySettings::Mode,
846         WebCore::CurlProxySettings::Mode::Default,
847         WebCore::CurlProxySettings::Mode::NoProxy,
848         WebCore::CurlProxySettings::Mode::Custom
849     >;
850 };
851 #endif
852
853 } // namespace WTF