Limit user-agent interactions based on the touch-action property on iOS
[WebKit-https.git] / Source / WebKit / Shared / WebCoreArgumentCoders.cpp
index f8e357b..54d199e 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "DataReference.h"
 #include "ShareableBitmap.h"
-#include <WebCore/AttachmentTypes.h>
+#include "SharedBufferDataReference.h"
 #include <WebCore/AuthenticationChallenge.h>
 #include <WebCore/BlobPart.h>
 #include <WebCore/CacheQueryOptions.h>
@@ -36,6 +36,7 @@
 #include <WebCore/CompositionUnderline.h>
 #include <WebCore/Credential.h>
 #include <WebCore/Cursor.h>
+#include <WebCore/DataListSuggestionPicker.h>
 #include <WebCore/DatabaseDetails.h>
 #include <WebCore/DictationAlternative.h>
 #include <WebCore/DictionaryPopupInfo.h>
@@ -45,6 +46,7 @@
 #include <WebCore/FileChooser.h>
 #include <WebCore/FilterOperation.h>
 #include <WebCore/FilterOperations.h>
+#include <WebCore/FontAttributes.h>
 #include <WebCore/GraphicsContext.h>
 #include <WebCore/GraphicsLayer.h>
 #include <WebCore/IDBGetResult.h>
@@ -56,7 +58,7 @@
 #include <WebCore/Pasteboard.h>
 #include <WebCore/Path.h>
 #include <WebCore/PluginData.h>
-#include <WebCore/PromisedBlobInfo.h>
+#include <WebCore/PromisedAttachmentInfo.h>
 #include <WebCore/ProtectionSpace.h>
 #include <WebCore/RectEdges.h>
 #include <WebCore/Region.h>
 #include <WebCore/ScrollingConstraints.h>
 #include <WebCore/ScrollingCoordinator.h>
 #include <WebCore/SearchPopupMenu.h>
+#include <WebCore/SecurityOrigin.h>
+#include <WebCore/SerializedAttachmentData.h>
 #include <WebCore/ServiceWorkerClientData.h>
 #include <WebCore/ServiceWorkerClientIdentifier.h>
 #include <WebCore/ServiceWorkerData.h>
+#include <WebCore/ShareData.h>
 #include <WebCore/TextCheckerClient.h>
 #include <WebCore/TextIndicator.h>
 #include <WebCore/TimingFunction.h>
 #include <WebCore/TransformationMatrix.h>
-#include <WebCore/URL.h>
 #include <WebCore/UserStyleSheet.h>
 #include <WebCore/ViewportArguments.h>
 #include <WebCore/WindowFeatures.h>
 #include <pal/SessionID.h>
-#include <wtf/MonotonicTime.h>
-#include <wtf/Seconds.h>
+#include <wtf/URL.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringHash.h>
 
 #include "ArgumentCodersMac.h"
 #endif
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 #include <WebCore/FloatQuad.h>
 #include <WebCore/InspectorOverlay.h>
 #include <WebCore/SelectionRect.h>
 #include <WebCore/SharedBuffer.h>
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS_FAMILY)
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 #include <WebCore/MediaPlaybackTargetContext.h>
 #include <WebCore/MediaConstraints.h>
 #endif
 
+namespace IPC {
 using namespace WebCore;
 using namespace WebKit;
 
-namespace IPC {
-
 static void encodeSharedBuffer(Encoder& encoder, const SharedBuffer* buffer)
 {
     SharedMemory::Handle handle;
@@ -174,36 +176,6 @@ static bool decodeTypesAndData(Decoder& decoder, Vector<String>& types, Vector<R
     return true;
 }
 
-void ArgumentCoder<MonotonicTime>::encode(Encoder& encoder, const MonotonicTime& time)
-{
-    encoder << time.secondsSinceEpoch().value();
-}
-
-bool ArgumentCoder<MonotonicTime>::decode(Decoder& decoder, MonotonicTime& time)
-{
-    double value;
-    if (!decoder.decode(value))
-        return false;
-
-    time = MonotonicTime::fromRawSeconds(value);
-    return true;
-}
-
-void ArgumentCoder<Seconds>::encode(Encoder& encoder, const Seconds& seconds)
-{
-    encoder << seconds.value();
-}
-
-bool ArgumentCoder<Seconds>::decode(Decoder& decoder, Seconds& seconds)
-{
-    double value;
-    if (!decoder.decode(value))
-        return false;
-
-    seconds = Seconds(value);
-    return true;
-}
-
 void ArgumentCoder<AffineTransform>::encode(Encoder& encoder, const AffineTransform& affineTransform)
 {
     SimpleArgumentCoder<AffineTransform>::encode(encoder, affineTransform);
@@ -250,17 +222,17 @@ void ArgumentCoder<DOMCacheEngine::CacheInfo>::encode(Encoder& encoder, const DO
     encoder << info.name;
 }
 
-auto ArgumentCoder<DOMCacheEngine::CacheInfo>::decode(Decoder& decoder) -> std::optional<DOMCacheEngine::CacheInfo>
+auto ArgumentCoder<DOMCacheEngine::CacheInfo>::decode(Decoder& decoder) -> Optional<DOMCacheEngine::CacheInfo>
 {
-    std::optional<uint64_t> identifier;
+    Optional<uint64_t> identifier;
     decoder >> identifier;
     if (!identifier)
-        return std::nullopt;
+        return WTF::nullopt;
     
-    std::optional<String> name;
+    Optional<String> name;
     decoder >> name;
     if (!name)
-        return std::nullopt;
+        return WTF::nullopt;
     
     return {{ WTFMove(*identifier), WTFMove(*name) }};
 }
@@ -292,64 +264,64 @@ void ArgumentCoder<DOMCacheEngine::Record>::encode(Encoder& encoder, const DOMCa
     });
 }
 
-std::optional<DOMCacheEngine::Record> ArgumentCoder<DOMCacheEngine::Record>::decode(Decoder& decoder)
+Optional<DOMCacheEngine::Record> ArgumentCoder<DOMCacheEngine::Record>::decode(Decoder& decoder)
 {
     uint64_t identifier;
     if (!decoder.decode(identifier))
-        return std::nullopt;
+        return WTF::nullopt;
 
     FetchHeaders::Guard requestHeadersGuard;
     if (!decoder.decode(requestHeadersGuard))
-        return std::nullopt;
+        return WTF::nullopt;
 
     WebCore::ResourceRequest request;
     if (!decoder.decode(request))
-        return std::nullopt;
+        return WTF::nullopt;
 
-    std::optional<WebCore::FetchOptions> options;
+    Optional<WebCore::FetchOptions> options;
     decoder >> options;
     if (!options)
-        return std::nullopt;
+        return WTF::nullopt;
 
     String referrer;
     if (!decoder.decode(referrer))
-        return std::nullopt;
+        return WTF::nullopt;
 
     FetchHeaders::Guard responseHeadersGuard;
     if (!decoder.decode(responseHeadersGuard))
-        return std::nullopt;
+        return WTF::nullopt;
 
     WebCore::ResourceResponse response;
     if (!decoder.decode(response))
-        return std::nullopt;
+        return WTF::nullopt;
 
     uint64_t updateResponseCounter;
     if (!decoder.decode(updateResponseCounter))
-        return std::nullopt;
+        return WTF::nullopt;
 
     uint64_t responseBodySize;
     if (!decoder.decode(responseBodySize))
-        return std::nullopt;
+        return WTF::nullopt;
 
     WebCore::DOMCacheEngine::ResponseBody responseBody;
     bool hasSharedBufferBody;
     if (!decoder.decode(hasSharedBufferBody))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (hasSharedBufferBody) {
         RefPtr<SharedBuffer> buffer;
         if (!decodeSharedBuffer(decoder, buffer))
-            return std::nullopt;
+            return WTF::nullopt;
         if (buffer)
             responseBody = buffer.releaseNonNull();
     } else {
         bool hasFormDataBody;
         if (!decoder.decode(hasFormDataBody))
-            return std::nullopt;
+            return WTF::nullopt;
         if (hasFormDataBody) {
             auto formData = FormData::decode(decoder);
             if (!formData)
-                return std::nullopt;
+                return WTF::nullopt;
             responseBody = formData.releaseNonNull();
         }
     }
@@ -357,10 +329,40 @@ std::optional<DOMCacheEngine::Record> ArgumentCoder<DOMCacheEngine::Record>::dec
     return {{ WTFMove(identifier), WTFMove(updateResponseCounter), WTFMove(requestHeadersGuard), WTFMove(request), WTFMove(options.value()), WTFMove(referrer), WTFMove(responseHeadersGuard), WTFMove(response), WTFMove(responseBody), responseBodySize }};
 }
 
+#if ENABLE(POINTER_EVENTS)
+void ArgumentCoder<TouchActionData>::encode(Encoder& encoder, const TouchActionData& touchActionData)
+{
+    encoder << touchActionData.touchActions << touchActionData.scrollingNodeID << touchActionData.region;
+}
+
+Optional<TouchActionData> ArgumentCoder<TouchActionData>::decode(Decoder& decoder)
+{
+    Optional<OptionSet<TouchAction>> touchActions;
+    decoder >> touchActions;
+    if (!touchActions)
+        return WTF::nullopt;
+
+    Optional<ScrollingNodeID> scrollingNodeID;
+    decoder >> scrollingNodeID;
+    if (!scrollingNodeID)
+        return WTF::nullopt;
+
+    Optional<Region> region;
+    decoder >> region;
+    if (!region)
+        return WTF::nullopt;
+
+    return {{ WTFMove(*touchActions), WTFMove(*scrollingNodeID), WTFMove(*region) }};
+}
+#endif
+
 void ArgumentCoder<EventTrackingRegions>::encode(Encoder& encoder, const EventTrackingRegions& eventTrackingRegions)
 {
     encoder << eventTrackingRegions.asynchronousDispatchRegion;
     encoder << eventTrackingRegions.eventSpecificSynchronousDispatchRegions;
+#if ENABLE(POINTER_EVENTS)
+    encoder << eventTrackingRegions.touchActionData;
+#endif
 }
 
 bool ArgumentCoder<EventTrackingRegions>::decode(Decoder& decoder, EventTrackingRegions& eventTrackingRegions)
@@ -371,8 +373,16 @@ bool ArgumentCoder<EventTrackingRegions>::decode(Decoder& decoder, EventTracking
     HashMap<String, Region> eventSpecificSynchronousDispatchRegions;
     if (!decoder.decode(eventSpecificSynchronousDispatchRegions))
         return false;
+#if ENABLE(POINTER_EVENTS)
+    Vector<TouchActionData> touchActionData;
+    if (!decoder.decode(touchActionData))
+        return false;
+#endif
     eventTrackingRegions.asynchronousDispatchRegion = WTFMove(asynchronousDispatchRegion);
     eventTrackingRegions.eventSpecificSynchronousDispatchRegions = WTFMove(eventSpecificSynchronousDispatchRegions);
+#if ENABLE(POINTER_EVENTS)
+    eventTrackingRegions.touchActionData = WTFMove(touchActionData);
+#endif
     return true;
 }
 
@@ -578,11 +588,11 @@ bool ArgumentCoder<FloatPoint>::decode(Decoder& decoder, FloatPoint& floatPoint)
     return SimpleArgumentCoder<FloatPoint>::decode(decoder, floatPoint);
 }
 
-std::optional<FloatPoint> ArgumentCoder<FloatPoint>::decode(Decoder& decoder)
+Optional<FloatPoint> ArgumentCoder<FloatPoint>::decode(Decoder& decoder)
 {
     FloatPoint floatPoint;
     if (!SimpleArgumentCoder<FloatPoint>::decode(decoder, floatPoint))
-        return std::nullopt;
+        return WTF::nullopt;
     return WTFMove(floatPoint);
 }
 
@@ -607,11 +617,11 @@ bool ArgumentCoder<FloatRect>::decode(Decoder& decoder, FloatRect& floatRect)
     return SimpleArgumentCoder<FloatRect>::decode(decoder, floatRect);
 }
 
-std::optional<FloatRect> ArgumentCoder<FloatRect>::decode(Decoder& decoder)
+Optional<FloatRect> ArgumentCoder<FloatRect>::decode(Decoder& decoder)
 {
     FloatRect floatRect;
     if (!SimpleArgumentCoder<FloatRect>::decode(decoder, floatRect))
-        return std::nullopt;
+        return WTF::nullopt;
     return WTFMove(floatRect);
 }
 
@@ -648,17 +658,17 @@ bool ArgumentCoder<FloatRoundedRect>::decode(Decoder& decoder, FloatRoundedRect&
     return SimpleArgumentCoder<FloatRoundedRect>::decode(decoder, roundedRect);
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 void ArgumentCoder<FloatQuad>::encode(Encoder& encoder, const FloatQuad& floatQuad)
 {
     SimpleArgumentCoder<FloatQuad>::encode(encoder, floatQuad);
 }
 
-std::optional<FloatQuad> ArgumentCoder<FloatQuad>::decode(Decoder& decoder)
+Optional<FloatQuad> ArgumentCoder<FloatQuad>::decode(Decoder& decoder)
 {
     FloatQuad floatQuad;
     if (!SimpleArgumentCoder<FloatQuad>::decode(decoder, floatQuad))
-        return std::nullopt;
+        return WTF::nullopt;
     return WTFMove(floatQuad);
 }
 
@@ -671,7 +681,15 @@ bool ArgumentCoder<ViewportArguments>::decode(Decoder& decoder, ViewportArgument
 {
     return SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments);
 }
-#endif // PLATFORM(IOS)
+
+Optional<ViewportArguments> ArgumentCoder<ViewportArguments>::decode(Decoder& decoder)
+{
+    ViewportArguments viewportArguments;
+    if (!SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments))
+        return WTF::nullopt;
+    return WTFMove(viewportArguments);
+}
+#endif // PLATFORM(IOS_FAMILY)
 
 
 void ArgumentCoder<IntPoint>::encode(Encoder& encoder, const IntPoint& intPoint)
@@ -684,11 +702,11 @@ bool ArgumentCoder<IntPoint>::decode(Decoder& decoder, IntPoint& intPoint)
     return SimpleArgumentCoder<IntPoint>::decode(decoder, intPoint);
 }
 
-std::optional<WebCore::IntPoint> ArgumentCoder<IntPoint>::decode(Decoder& decoder)
+Optional<WebCore::IntPoint> ArgumentCoder<IntPoint>::decode(Decoder& decoder)
 {
     IntPoint intPoint;
     if (!SimpleArgumentCoder<IntPoint>::decode(decoder, intPoint))
-        return std::nullopt;
+        return WTF::nullopt;
     return WTFMove(intPoint);
 }
 
@@ -702,11 +720,11 @@ bool ArgumentCoder<IntRect>::decode(Decoder& decoder, IntRect& intRect)
     return SimpleArgumentCoder<IntRect>::decode(decoder, intRect);
 }
 
-std::optional<IntRect> ArgumentCoder<IntRect>::decode(Decoder& decoder)
+Optional<IntRect> ArgumentCoder<IntRect>::decode(Decoder& decoder)
 {
     IntRect rect;
     if (!decode(decoder, rect))
-        return std::nullopt;
+        return WTF::nullopt;
     return WTFMove(rect);
 }
 
@@ -720,11 +738,11 @@ bool ArgumentCoder<IntSize>::decode(Decoder& decoder, IntSize& intSize)
     return SimpleArgumentCoder<IntSize>::decode(decoder, intSize);
 }
 
-std::optional<IntSize> ArgumentCoder<IntSize>::decode(Decoder& decoder)
+Optional<IntSize> ArgumentCoder<IntSize>::decode(Decoder& decoder)
 {
     IntSize intSize;
     if (!SimpleArgumentCoder<IntSize>::decode(decoder, intSize))
-        return std::nullopt;
+        return WTF::nullopt;
     return WTFMove(intSize);
 }
 
@@ -855,29 +873,38 @@ bool ArgumentCoder<Path>::decode(Decoder& decoder, Path& path)
     return true;
 }
 
+Optional<Path> ArgumentCoder<Path>::decode(Decoder& decoder)
+{
+    Path path;
+    if (!decode(decoder, path))
+        return WTF::nullopt;
+
+    return path;
+}
+
 void ArgumentCoder<RecentSearch>::encode(Encoder& encoder, const RecentSearch& recentSearch)
 {
     encoder << recentSearch.string << recentSearch.time;
 }
 
-std::optional<RecentSearch> ArgumentCoder<RecentSearch>::decode(Decoder& decoder)
+Optional<RecentSearch> ArgumentCoder<RecentSearch>::decode(Decoder& decoder)
 {
-    std::optional<String> string;
+    Optional<String> string;
     decoder >> string;
     if (!string)
-        return std::nullopt;
+        return WTF::nullopt;
     
-    std::optional<WallTime> time;
+    Optional<WallTime> time;
     decoder >> time;
     if (!time)
-        return std::nullopt;
+        return WTF::nullopt;
     
     return {{ WTFMove(*string), WTFMove(*time) }};
 }
 
 template<> struct ArgumentCoder<Region::Span> {
     static void encode(Encoder&, const Region::Span&);
-    static std::optional<Region::Span> decode(Decoder&);
+    static Optional<Region::Span> decode(Decoder&);
 };
 
 void ArgumentCoder<Region::Span>::encode(Encoder& encoder, const Region::Span& span)
@@ -886,15 +913,15 @@ void ArgumentCoder<Region::Span>::encode(Encoder& encoder, const Region::Span& s
     encoder << (uint64_t)span.segmentIndex;
 }
 
-std::optional<Region::Span> ArgumentCoder<Region::Span>::decode(Decoder& decoder)
+Optional<Region::Span> ArgumentCoder<Region::Span>::decode(Decoder& decoder)
 {
     Region::Span span;
     if (!decoder.decode(span.y))
-        return std::nullopt;
+        return WTF::nullopt;
     
     uint64_t segmentIndex;
     if (!decoder.decode(segmentIndex))
-        return std::nullopt;
+        return WTF::nullopt;
     
     span.segmentIndex = segmentIndex;
     return WTFMove(span);
@@ -926,6 +953,15 @@ bool ArgumentCoder<Region>::decode(Decoder& decoder, Region& region)
     return true;
 }
 
+Optional<Region> ArgumentCoder<Region>::decode(Decoder& decoder)
+{
+    Region region;
+    if (!decode(decoder, region))
+        return WTF::nullopt;
+
+    return region;
+}
+
 void ArgumentCoder<Length>::encode(Encoder& encoder, const Length& length)
 {
     SimpleArgumentCoder<Length>::encode(encoder, length);
@@ -953,15 +989,15 @@ void ArgumentCoder<MimeClassInfo>::encode(Encoder& encoder, const MimeClassInfo&
     encoder << mimeClassInfo.type << mimeClassInfo.desc << mimeClassInfo.extensions;
 }
 
-std::optional<MimeClassInfo> ArgumentCoder<MimeClassInfo>::decode(Decoder& decoder)
+Optional<MimeClassInfo> ArgumentCoder<MimeClassInfo>::decode(Decoder& decoder)
 {
     MimeClassInfo mimeClassInfo;
     if (!decoder.decode(mimeClassInfo.type))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(mimeClassInfo.desc))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(mimeClassInfo.extensions))
-        return std::nullopt;
+        return WTF::nullopt;
 
     return WTFMove(mimeClassInfo);
 }
@@ -975,32 +1011,32 @@ void ArgumentCoder<PluginInfo>::encode(Encoder& encoder, const PluginInfo& plugi
     encoder << pluginInfo.mimes;
     encoder << pluginInfo.isApplicationPlugin;
     encoder.encodeEnum(pluginInfo.clientLoadPolicy);
-#if PLATFORM(MAC)
     encoder << pluginInfo.bundleIdentifier;
+#if PLATFORM(MAC)
     encoder << pluginInfo.versionString;
 #endif
 }
 
-std::optional<WebCore::PluginInfo> ArgumentCoder<PluginInfo>::decode(Decoder& decoder)
+Optional<WebCore::PluginInfo> ArgumentCoder<PluginInfo>::decode(Decoder& decoder)
 {
     PluginInfo pluginInfo;
     if (!decoder.decode(pluginInfo.name))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(pluginInfo.file))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(pluginInfo.desc))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(pluginInfo.mimes))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(pluginInfo.isApplicationPlugin))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decodeEnum(pluginInfo.clientLoadPolicy))
-        return std::nullopt;
-#if PLATFORM(MAC)
+        return WTF::nullopt;
     if (!decoder.decode(pluginInfo.bundleIdentifier))
-        return std::nullopt;
+        return WTF::nullopt;
+#if PLATFORM(MAC)
     if (!decoder.decode(pluginInfo.versionString))
-        return std::nullopt;
+        return WTF::nullopt;
 #endif
 
     return WTFMove(pluginInfo);
@@ -1172,7 +1208,7 @@ static bool decodeOptionalImage(Decoder& decoder, RefPtr<Image>& image)
     return decodeImage(decoder, image);
 }
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
 void ArgumentCoder<Cursor>::encode(Encoder& encoder, const Cursor& cursor)
 {
     encoder.encodeEnum(cursor.type());
@@ -1250,6 +1286,14 @@ void ArgumentCoder<ResourceRequest>::encode(Encoder& encoder, const ResourceRequ
     encoder << resourceRequest.cachePartition();
     encoder << resourceRequest.hiddenFromInspector();
 
+#if USE(SYSTEM_PREVIEW)
+    if (resourceRequest.isSystemPreview()) {
+        encoder << true;
+        encoder << resourceRequest.systemPreviewRect();
+    } else
+        encoder << false;
+#endif
+
     if (resourceRequest.encodingRequiresPlatformData()) {
         encoder << true;
         encodePlatformData(encoder, resourceRequest);
@@ -1271,6 +1315,20 @@ bool ArgumentCoder<ResourceRequest>::decode(Decoder& decoder, ResourceRequest& r
         return false;
     resourceRequest.setHiddenFromInspector(isHiddenFromInspector);
 
+#if USE(SYSTEM_PREVIEW)
+    bool isSystemPreview;
+    if (!decoder.decode(isSystemPreview))
+        return false;
+    resourceRequest.setSystemPreview(isSystemPreview);
+
+    if (isSystemPreview) {
+        IntRect systemPreviewRect;
+        if (!decoder.decode(systemPreviewRect))
+            return false;
+        resourceRequest.setSystemPreviewRect(systemPreviewRect);
+    }
+#endif
+
     bool hasPlatformData;
     if (!decoder.decode(hasPlatformData))
         return false;
@@ -1282,15 +1340,31 @@ bool ArgumentCoder<ResourceRequest>::decode(Decoder& decoder, ResourceRequest& r
 
 void ArgumentCoder<ResourceError>::encode(Encoder& encoder, const ResourceError& resourceError)
 {
+    encoder.encodeEnum(resourceError.type());
+    if (resourceError.type() == ResourceError::Type::Null)
+        return;
     encodePlatformData(encoder, resourceError);
 }
 
 bool ArgumentCoder<ResourceError>::decode(Decoder& decoder, ResourceError& resourceError)
 {
-    return decodePlatformData(decoder, resourceError);
+    ResourceError::Type type;
+    if (!decoder.decodeEnum(type))
+        return false;
+
+    if (type == ResourceError::Type::Null) {
+        resourceError = { };
+        return true;
+    }
+
+    if (!decodePlatformData(decoder, resourceError))
+        return false;
+
+    resourceError.setType(type);
+    return true;
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 
 void ArgumentCoder<SelectionRect>::encode(Encoder& encoder, const SelectionRect& selectionRect)
 {
@@ -1308,59 +1382,59 @@ void ArgumentCoder<SelectionRect>::encode(Encoder& encoder, const SelectionRect&
     encoder << selectionRect.isHorizontal();
 }
 
-std::optional<SelectionRect> ArgumentCoder<SelectionRect>::decode(Decoder& decoder)
+Optional<SelectionRect> ArgumentCoder<SelectionRect>::decode(Decoder& decoder)
 {
     SelectionRect selectionRect;
     IntRect rect;
     if (!decoder.decode(rect))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setRect(rect);
 
     uint32_t direction;
     if (!decoder.decode(direction))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setDirection((TextDirection)direction);
 
     int intValue;
     if (!decoder.decode(intValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setMinX(intValue);
 
     if (!decoder.decode(intValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setMaxX(intValue);
 
     if (!decoder.decode(intValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setMaxY(intValue);
 
     if (!decoder.decode(intValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setLineNumber(intValue);
 
     bool boolValue;
     if (!decoder.decode(boolValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setIsLineBreak(boolValue);
 
     if (!decoder.decode(boolValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setIsFirstOnLine(boolValue);
 
     if (!decoder.decode(boolValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setIsLastOnLine(boolValue);
 
     if (!decoder.decode(boolValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setContainsStart(boolValue);
 
     if (!decoder.decode(boolValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setContainsEnd(boolValue);
 
     if (!decoder.decode(boolValue))
-        return std::nullopt;
+        return WTF::nullopt;
     selectionRect.setIsHorizontal(boolValue);
 
     return WTFMove(selectionRect);
@@ -1480,6 +1554,15 @@ bool ArgumentCoder<Color>::decode(Decoder& decoder, Color& color)
     return true;
 }
 
+Optional<Color> ArgumentCoder<Color>::decode(Decoder& decoder)
+{
+    Color color;
+    if (!decode(decoder, color))
+        return WTF::nullopt;
+
+    return color;
+}
+
 #if ENABLE(DRAG_SUPPORT)
 void ArgumentCoder<DragData>::encode(Encoder& encoder, const DragData& dragData)
 {
@@ -1541,18 +1624,18 @@ void ArgumentCoder<CompositionUnderline>::encode(Encoder& encoder, const Composi
     encoder << underline.color;
 }
 
-std::optional<CompositionUnderline> ArgumentCoder<CompositionUnderline>::decode(Decoder& decoder)
+Optional<CompositionUnderline> ArgumentCoder<CompositionUnderline>::decode(Decoder& decoder)
 {
     CompositionUnderline underline;
 
     if (!decoder.decode(underline.startOffset))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(underline.endOffset))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(underline.thick))
-        return std::nullopt;
+        return WTF::nullopt;
     if (!decoder.decode(underline.color))
-        return std::nullopt;
+        return WTF::nullopt;
 
     return WTFMove(underline);
 }
@@ -1585,11 +1668,11 @@ bool ArgumentCoder<DatabaseDetails>::decode(Decoder& decoder, DatabaseDetails& d
     if (!decoder.decode(currentUsage))
         return false;
 
-    double creationTime;
+    Optional<WallTime> creationTime;
     if (!decoder.decode(creationTime))
         return false;
 
-    double modificationTime;
+    Optional<WallTime> modificationTime;
     if (!decoder.decode(modificationTime))
         return false;
 
@@ -1597,6 +1680,29 @@ bool ArgumentCoder<DatabaseDetails>::decode(Decoder& decoder, DatabaseDetails& d
     return true;
 }
 
+#if ENABLE(DATALIST_ELEMENT)
+void ArgumentCoder<DataListSuggestionInformation>::encode(Encoder& encoder, const WebCore::DataListSuggestionInformation& info)
+{
+    encoder.encodeEnum(info.activationType);
+    encoder << info.suggestions;
+    encoder << info.elementRect;
+}
+
+bool ArgumentCoder<DataListSuggestionInformation>::decode(Decoder& decoder, WebCore::DataListSuggestionInformation& info)
+{
+    if (!decoder.decodeEnum(info.activationType))
+        return false;
+
+    if (!decoder.decode(info.suggestions))
+        return false;
+
+    if (!decoder.decode(info.elementRect))
+        return false;
+
+    return true;
+}
+#endif
+
 void ArgumentCoder<PasteboardCustomData>::encode(Encoder& encoder, const PasteboardCustomData& data)
 {
     encoder << data.origin;
@@ -1622,7 +1728,39 @@ bool ArgumentCoder<PasteboardCustomData>::decode(Decoder& decoder, PasteboardCus
     return true;
 }
 
-#if PLATFORM(IOS)
+void ArgumentCoder<PasteboardURL>::encode(Encoder& encoder, const PasteboardURL& content)
+{
+    encoder << content.url;
+    encoder << content.title;
+#if PLATFORM(MAC)
+    encoder << content.userVisibleForm;
+#endif
+#if PLATFORM(GTK)
+    encoder << content.markup;
+#endif
+}
+
+bool ArgumentCoder<PasteboardURL>::decode(Decoder& decoder, PasteboardURL& content)
+{
+    if (!decoder.decode(content.url))
+        return false;
+
+    if (!decoder.decode(content.title))
+        return false;
+
+#if PLATFORM(MAC)
+    if (!decoder.decode(content.userVisibleForm))
+        return false;
+#endif
+#if PLATFORM(GTK)
+    if (!decoder.decode(content.markup))
+        return false;
+#endif
+
+    return true;
+}
+
+#if PLATFORM(IOS_FAMILY)
 
 void ArgumentCoder<Highlight>::encode(Encoder& encoder, const Highlight& highlight)
 {
@@ -1660,23 +1798,6 @@ bool ArgumentCoder<Highlight>::decode(Decoder& decoder, Highlight& highlight)
     return true;
 }
 
-void ArgumentCoder<PasteboardURL>::encode(Encoder& encoder, const PasteboardURL& content)
-{
-    encoder << content.url;
-    encoder << content.title;
-}
-
-bool ArgumentCoder<PasteboardURL>::decode(Decoder& decoder, PasteboardURL& content)
-{
-    if (!decoder.decode(content.url))
-        return false;
-
-    if (!decoder.decode(content.title))
-        return false;
-
-    return true;
-}
-
 void ArgumentCoder<PasteboardWebContent>::encode(Encoder& encoder, const PasteboardWebContent& content)
 {
     encoder << content.contentOrigin;
@@ -1751,7 +1872,7 @@ bool ArgumentCoder<PasteboardImage>::decode(Decoder& decoder, PasteboardImage& p
 
 #endif
 
-#if PLATFORM(WPE)
+#if USE(LIBWPE)
 void ArgumentCoder<PasteboardWebContent>::encode(Encoder& encoder, const PasteboardWebContent& content)
 {
     encoder << content.text;
@@ -1766,7 +1887,7 @@ bool ArgumentCoder<PasteboardWebContent>::decode(Decoder& decoder, PasteboardWeb
         return false;
     return true;
 }
-#endif // PLATFORM(WPE)
+#endif // USE(LIBWPE)
 
 void ArgumentCoder<DictationAlternative>::encode(Encoder& encoder, const DictationAlternative& dictationAlternative)
 {
@@ -1775,22 +1896,22 @@ void ArgumentCoder<DictationAlternative>::encode(Encoder& encoder, const Dictati
     encoder << dictationAlternative.dictationContext;
 }
 
-std::optional<DictationAlternative> ArgumentCoder<DictationAlternative>::decode(Decoder& decoder)
+Optional<DictationAlternative> ArgumentCoder<DictationAlternative>::decode(Decoder& decoder)
 {
-    std::optional<unsigned> rangeStart;
+    Optional<unsigned> rangeStart;
     decoder >> rangeStart;
     if (!rangeStart)
-        return std::nullopt;
+        return WTF::nullopt;
     
-    std::optional<unsigned> rangeLength;
+    Optional<unsigned> rangeLength;
     decoder >> rangeLength;
     if (!rangeLength)
-        return std::nullopt;
+        return WTF::nullopt;
     
-    std::optional<uint64_t> dictationContext;
+    Optional<uint64_t> dictationContext;
     decoder >> dictationContext;
     if (!dictationContext)
-        return std::nullopt;
+        return WTF::nullopt;
     
     return {{ WTFMove(*rangeStart), WTFMove(*rangeLength), WTFMove(*dictationContext) }};
 }
@@ -1826,7 +1947,39 @@ bool ArgumentCoder<FileChooserSettings>::decode(Decoder& decoder, FileChooserSet
 
     return true;
 }
+    
+void ArgumentCoder<ShareData>::encode(Encoder& encoder, const ShareData& settings)
+{
+    encoder << settings.title;
+    encoder << settings.text;
+    encoder << settings.url;
+}
 
+bool ArgumentCoder<ShareData>::decode(Decoder& decoder, ShareData& settings)
+{
+    if (!decoder.decode(settings.title))
+        return false;
+    if (!decoder.decode(settings.text))
+        return false;
+    if (!decoder.decode(settings.url))
+        return false;
+    return true;
+}
+    
+void ArgumentCoder<ShareDataWithParsedURL>::encode(Encoder& encoder, const ShareDataWithParsedURL& settings)
+{
+    encoder << settings.shareData;
+    encoder << settings.url;
+}
+
+bool ArgumentCoder<ShareDataWithParsedURL>::decode(Decoder& decoder, ShareDataWithParsedURL& settings)
+{
+    if (!decoder.decode(settings.shareData))
+        return false;
+    if (!decoder.decode(settings.url))
+        return false;
+    return true;
+}
 
 void ArgumentCoder<GrammarDetail>::encode(Encoder& encoder, const GrammarDetail& detail)
 {
@@ -1836,27 +1989,27 @@ void ArgumentCoder<GrammarDetail>::encode(Encoder& encoder, const GrammarDetail&
     encoder << detail.userDescription;
 }
 
-std::optional<GrammarDetail> ArgumentCoder<GrammarDetail>::decode(Decoder& decoder)
+Optional<GrammarDetail> ArgumentCoder<GrammarDetail>::decode(Decoder& decoder)
 {
-    std::optional<int> location;
+    Optional<int> location;
     decoder >> location;
     if (!location)
-        return std::nullopt;
+        return WTF::nullopt;
 
-    std::optional<int> length;
+    Optional<int> length;
     decoder >> length;
     if (!length)
-        return std::nullopt;
+        return WTF::nullopt;
 
-    std::optional<Vector<String>> guesses;
+    Optional<Vector<String>> guesses;
     decoder >> guesses;
     if (!guesses)
-        return std::nullopt;
+        return WTF::nullopt;
 
-    std::optional<String> userDescription;
+    Optional<String> userDescription;
     decoder >> userDescription;
     if (!userDescription)
-        return std::nullopt;
+        return WTF::nullopt;
 
     return {{ WTFMove(*location), WTFMove(*length), WTFMove(*guesses), WTFMove(*userDescription) }};
 }
@@ -1865,7 +2018,7 @@ void ArgumentCoder<TextCheckingRequestData>::encode(Encoder& encoder, const Text
 {
     encoder << request.sequence();
     encoder << request.text();
-    encoder << request.mask();
+    encoder << request.checkingTypes();
     encoder.encodeEnum(request.processType());
 }
 
@@ -1879,15 +2032,15 @@ bool ArgumentCoder<TextCheckingRequestData>::decode(Decoder& decoder, TextChecki
     if (!decoder.decode(text))
         return false;
 
-    TextCheckingTypeMask mask;
-    if (!decoder.decode(mask))
+    OptionSet<TextCheckingType> checkingTypes;
+    if (!decoder.decode(checkingTypes))
         return false;
 
     TextCheckingProcessType processType;
     if (!decoder.decodeEnum(processType))
         return false;
 
-    request = TextCheckingRequestData(sequence, text, mask, processType);
+    request = TextCheckingRequestData { sequence, text, checkingTypes, processType };
     return true;
 }
 
@@ -1900,31 +2053,31 @@ void ArgumentCoder<TextCheckingResult>::encode(Encoder& encoder, const TextCheck
     encoder << result.replacement;
 }
 
-std::optional<TextCheckingResult> ArgumentCoder<TextCheckingResult>::decode(Decoder& decoder)
+Optional<TextCheckingResult> ArgumentCoder<TextCheckingResult>::decode(Decoder& decoder)
 {
     TextCheckingType type;
     if (!decoder.decodeEnum(type))
-        return std::nullopt;
+        return WTF::nullopt;
     
-    std::optional<int> location;
+    Optional<int> location;
     decoder >> location;
     if (!location)
-        return std::nullopt;
+        return WTF::nullopt;
 
-    std::optional<int> length;
+    Optional<int> length;
     decoder >> length;
     if (!length)
-        return std::nullopt;
+        return WTF::nullopt;
 
-    std::optional<Vector<GrammarDetail>> details;
+    Optional<Vector<GrammarDetail>> details;
     decoder >> details;
     if (!details)
-        return std::nullopt;
+        return WTF::nullopt;
 
-    std::optional<String> replacement;
+    Optional<String> replacement;
     decoder >> replacement;
     if (!replacement)
-        return std::nullopt;
+        return WTF::nullopt;
 
     return {{ WTFMove(type), WTFMove(*location), WTFMove(*length), WTFMove(*details), WTFMove(*replacement) }};
 }
@@ -2005,6 +2158,8 @@ void ArgumentCoder<ScrollableAreaParameters>::encode(Encoder& encoder, const Scr
 
     encoder << parameters.hasEnabledHorizontalScrollbar;
     encoder << parameters.hasEnabledVerticalScrollbar;
+
+    encoder << parameters.useDarkAppearanceForScrollbars;
 }
 
 bool ArgumentCoder<ScrollableAreaParameters>::decode(Decoder& decoder, ScrollableAreaParameters& params)
@@ -2023,7 +2178,10 @@ bool ArgumentCoder<ScrollableAreaParameters>::decode(Decoder& decoder, Scrollabl
         return false;
     if (!decoder.decode(params.hasEnabledVerticalScrollbar))
         return false;
-    
+
+    if (!decoder.decode(params.useDarkAppearanceForScrollbars))
+        return false;
+
     return true;
 }
 
@@ -2169,6 +2327,9 @@ void ArgumentCoder<FilterOperation>::encode(Encoder& encoder, const FilterOperat
     case FilterOperation::CONTRAST:
         encoder << downcast<BasicComponentTransferFilterOperation>(filter).amount();
         break;
+    case FilterOperation::APPLE_INVERT_LIGHTNESS:
+        ASSERT_NOT_REACHED(); // APPLE_INVERT_LIGHTNESS is only used in -apple-color-filter.
+        break;
     case FilterOperation::BLUR:
         encoder << downcast<BlurFilterOperation>(filter).stdDeviation();
         break;
@@ -2219,6 +2380,9 @@ bool decodeFilterOperation(Decoder& decoder, RefPtr<FilterOperation>& filter)
         filter = BasicComponentTransferFilterOperation::create(amount, type);
         break;
     }
+    case FilterOperation::APPLE_INVERT_LIGHTNESS:
+        ASSERT_NOT_REACHED(); // APPLE_INVERT_LIGHTNESS is only used in -apple-color-filter.
+        break;
     case FilterOperation::BLUR: {
         Length stdDeviation;
         if (!decoder.decode(stdDeviation))
@@ -2293,33 +2457,33 @@ void ArgumentCoder<BlobPart>::encode(Encoder& encoder, const BlobPart& blobPart)
     }
 }
 
-std::optional<BlobPart> ArgumentCoder<BlobPart>::decode(Decoder& decoder)
+Optional<BlobPart> ArgumentCoder<BlobPart>::decode(Decoder& decoder)
 {
     BlobPart blobPart;
 
-    std::optional<uint32_t> type;
+    Optional<uint32_t> type;
     decoder >> type;
     if (!type)
-        return std::nullopt;
+        return WTF::nullopt;
 
     switch (*type) {
     case BlobPart::Data: {
-        std::optional<Vector<uint8_t>> data;
+        Optional<Vector<uint8_t>> data;
         decoder >> data;
         if (!data)
-            return std::nullopt;
+            return WTF::nullopt;
         blobPart = BlobPart(WTFMove(*data));
         break;
     }
     case BlobPart::Blob: {
         URL url;
         if (!decoder.decode(url))
-            return std::nullopt;
+            return WTF::nullopt;
         blobPart = BlobPart(url);
         break;
     }
     default:
-        return std::nullopt;
+        return WTF::nullopt;
     }
 
     return WTFMove(blobPart);
@@ -2341,43 +2505,43 @@ void ArgumentCoder<TextIndicatorData>::encode(Encoder& encoder, const TextIndica
     encodeOptionalImage(encoder, textIndicatorData.contentImageWithoutSelection.get());
 }
 
-std::optional<TextIndicatorData> ArgumentCoder<TextIndicatorData>::decode(Decoder& decoder)
+Optional<TextIndicatorData> ArgumentCoder<TextIndicatorData>::decode(Decoder& decoder)
 {
     TextIndicatorData textIndicatorData;
     if (!decoder.decode(textIndicatorData.selectionRectInRootViewCoordinates))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decode(textIndicatorData.textBoundingRectInRootViewCoordinates))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decode(textIndicatorData.textRectsInBoundingRectCoordinates))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decode(textIndicatorData.contentImageWithoutSelectionRectInRootViewCoordinates))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decode(textIndicatorData.contentImageScaleFactor))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decode(textIndicatorData.estimatedBackgroundColor))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decodeEnum(textIndicatorData.presentationTransition))
-        return std::nullopt;
+        return WTF::nullopt;
 
     uint64_t options;
     if (!decoder.decode(options))
-        return std::nullopt;
+        return WTF::nullopt;
     textIndicatorData.options = static_cast<TextIndicatorOptions>(options);
 
     if (!decodeOptionalImage(decoder, textIndicatorData.contentImage))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decodeOptionalImage(decoder, textIndicatorData.contentImageWithHighlight))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decodeOptionalImage(decoder, textIndicatorData.contentImageWithoutSelection))
-        return std::nullopt;
+        return WTF::nullopt;
 
     return WTFMove(textIndicatorData);
 }
@@ -2452,7 +2616,7 @@ bool ArgumentCoder<DictionaryPopupInfo>::decode(IPC::Decoder& decoder, Dictionar
     if (!decoder.decode(result.origin))
         return false;
 
-    std::optional<TextIndicatorData> textIndicator;
+    Optional<TextIndicatorData> textIndicator;
     decoder >> textIndicator;
     if (!textIndicator)
         return false;
@@ -2519,62 +2683,112 @@ void ArgumentCoder<ResourceLoadStatistics>::encode(Encoder& encoder, const WebCo
     // Storage access
     encoder << statistics.storageAccessUnderTopFrameOrigins;
 
+    // Top frame stats
+    encoder << statistics.topFrameUniqueRedirectsTo;
+    encoder << statistics.topFrameUniqueRedirectsFrom;
+
     // Subframe stats
     encoder << statistics.subframeUnderTopFrameOrigins;
     
     // Subresource stats
     encoder << statistics.subresourceUnderTopFrameOrigins;
     encoder << statistics.subresourceUniqueRedirectsTo;
-    
+    encoder << statistics.subresourceUniqueRedirectsFrom;
+
     // Prevalent Resource
     encoder << statistics.isPrevalentResource;
+    encoder << statistics.isVeryPrevalentResource;
     encoder << statistics.dataRecordsRemoved;
+
+#if ENABLE(WEB_API_STATISTICS)
+    encoder << statistics.fontsFailedToLoad;
+    encoder << statistics.fontsSuccessfullyLoaded;
+    encoder << statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs;
+    
+    encoder << statistics.canvasActivityRecord;
+    
+    encoder << statistics.navigatorFunctionsAccessed;
+    encoder << statistics.screenFunctionsAccessed;
+#endif
 }
 
-std::optional<ResourceLoadStatistics> ArgumentCoder<ResourceLoadStatistics>::decode(Decoder& decoder)
+Optional<ResourceLoadStatistics> ArgumentCoder<ResourceLoadStatistics>::decode(Decoder& decoder)
 {
     ResourceLoadStatistics statistics;
     if (!decoder.decode(statistics.highLevelDomain))
-        return std::nullopt;
+        return WTF::nullopt;
     
     double lastSeenTimeAsDouble;
     if (!decoder.decode(lastSeenTimeAsDouble))
-        return std::nullopt;
+        return WTF::nullopt;
     statistics.lastSeen = WallTime::fromRawSeconds(lastSeenTimeAsDouble);
     
     // User interaction
     if (!decoder.decode(statistics.hadUserInteraction))
-        return std::nullopt;
+        return WTF::nullopt;
 
     double mostRecentUserInteractionTimeAsDouble;
     if (!decoder.decode(mostRecentUserInteractionTimeAsDouble))
-        return std::nullopt;
+        return WTF::nullopt;
     statistics.mostRecentUserInteractionTime = WallTime::fromRawSeconds(mostRecentUserInteractionTimeAsDouble);
 
     if (!decoder.decode(statistics.grandfathered))
-        return std::nullopt;
+        return WTF::nullopt;
 
     // Storage access
     if (!decoder.decode(statistics.storageAccessUnderTopFrameOrigins))
-        return std::nullopt;
+        return WTF::nullopt;
+
+    // Top frame stats
+    if (!decoder.decode(statistics.topFrameUniqueRedirectsTo))
+        return WTF::nullopt;    
+
+    if (!decoder.decode(statistics.topFrameUniqueRedirectsFrom))
+        return WTF::nullopt;
 
     // Subframe stats
     if (!decoder.decode(statistics.subframeUnderTopFrameOrigins))
-        return std::nullopt;
+        return WTF::nullopt;
     
     // Subresource stats
     if (!decoder.decode(statistics.subresourceUnderTopFrameOrigins))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decode(statistics.subresourceUniqueRedirectsTo))
-        return std::nullopt;
+        return WTF::nullopt;
+    
+    if (!decoder.decode(statistics.subresourceUniqueRedirectsFrom))
+        return WTF::nullopt;
     
     // Prevalent Resource
     if (!decoder.decode(statistics.isPrevalentResource))
-        return std::nullopt;
+        return WTF::nullopt;
 
+    if (!decoder.decode(statistics.isVeryPrevalentResource))
+        return WTF::nullopt;
+    
     if (!decoder.decode(statistics.dataRecordsRemoved))
-        return std::nullopt;
+        return WTF::nullopt;
+    
+#if ENABLE(WEB_API_STATISTICS)
+    if (!decoder.decode(statistics.fontsFailedToLoad))
+        return WTF::nullopt;
+    
+    if (!decoder.decode(statistics.fontsSuccessfullyLoaded))
+        return WTF::nullopt;
+    
+    if (!decoder.decode(statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs))
+        return WTF::nullopt;
+    
+    if (!decoder.decode(statistics.canvasActivityRecord))
+        return WTF::nullopt;
+    
+    if (!decoder.decode(statistics.navigatorFunctionsAccessed))
+        return WTF::nullopt;
+    
+    if (!decoder.decode(statistics.screenFunctionsAccessed))
+        return WTF::nullopt;
+#endif
 
     return WTFMove(statistics);
 }
@@ -2584,19 +2798,17 @@ void ArgumentCoder<MediaConstraints>::encode(Encoder& encoder, const WebCore::Me
 {
     encoder << constraint.mandatoryConstraints
         << constraint.advancedConstraints
-        << constraint.deviceIDHashSalt
         << constraint.isValid;
 }
 
 bool ArgumentCoder<MediaConstraints>::decode(Decoder& decoder, WebCore::MediaConstraints& constraints)
 {
-    std::optional<WebCore::MediaTrackConstraintSetMap> mandatoryConstraints;
+    Optional<WebCore::MediaTrackConstraintSetMap> mandatoryConstraints;
     decoder >> mandatoryConstraints;
     if (!mandatoryConstraints)
         return false;
     constraints.mandatoryConstraints = WTFMove(*mandatoryConstraints);
     return decoder.decode(constraints.advancedConstraints)
-        && decoder.decode(constraints.deviceIDHashSalt)
         && decoder.decode(constraints.isValid);
 }
 #endif
@@ -2649,14 +2861,14 @@ bool ArgumentCoder<ServiceWorkerOrClientData>::decode(Decoder& decoder, ServiceW
     if (!decoder.decode(isServiceWorkerData))
         return false;
     if (isServiceWorkerData) {
-        std::optional<ServiceWorkerData> workerData;
+        Optional<ServiceWorkerData> workerData;
         decoder >> workerData;
         if (!workerData)
             return false;
 
         data = WTFMove(*workerData);
     } else {
-        std::optional<ServiceWorkerClientData> clientData;
+        Optional<ServiceWorkerClientData> clientData;
         decoder >> clientData;
         if (!clientData)
             return false;
@@ -2682,14 +2894,14 @@ bool ArgumentCoder<ServiceWorkerOrClientIdentifier>::decode(Decoder& decoder, Se
     if (!decoder.decode(isServiceWorkerIdentifier))
         return false;
     if (isServiceWorkerIdentifier) {
-        std::optional<ServiceWorkerIdentifier> workerIdentifier;
+        Optional<ServiceWorkerIdentifier> workerIdentifier;
         decoder >> workerIdentifier;
         if (!workerIdentifier)
             return false;
 
         identifier = WTFMove(*workerIdentifier);
     } else {
-        std::optional<ServiceWorkerClientIdentifier> clientIdentifier;
+        Optional<ServiceWorkerClientIdentifier> clientIdentifier;
         decoder >> clientIdentifier;
         if (!clientIdentifier)
             return false;
@@ -2708,16 +2920,16 @@ void ArgumentCoder<ScrollOffsetRange<float>>::encode(Encoder& encoder, const Scr
     encoder << range.end;
 }
 
-auto ArgumentCoder<ScrollOffsetRange<float>>::decode(Decoder& decoder) -> std::optional<WebCore::ScrollOffsetRange<float>>
+auto ArgumentCoder<ScrollOffsetRange<float>>::decode(Decoder& decoder) -> Optional<WebCore::ScrollOffsetRange<float>>
 {
     WebCore::ScrollOffsetRange<float> range;
     float start;
     if (!decoder.decode(start))
-        return std::nullopt;
+        return WTF::nullopt;
 
     float end;
     if (!decoder.decode(end))
-        return std::nullopt;
+        return WTF::nullopt;
 
     range.start = start;
     range.end = end;
@@ -2732,30 +2944,33 @@ void ArgumentCoder<MediaSelectionOption>::encode(Encoder& encoder, const MediaSe
     encoder << option.type;
 }
 
-std::optional<MediaSelectionOption> ArgumentCoder<MediaSelectionOption>::decode(Decoder& decoder)
+Optional<MediaSelectionOption> ArgumentCoder<MediaSelectionOption>::decode(Decoder& decoder)
 {
-    std::optional<String> displayName;
+    Optional<String> displayName;
     decoder >> displayName;
     if (!displayName)
-        return std::nullopt;
+        return WTF::nullopt;
     
-    std::optional<MediaSelectionOption::Type> type;
+    Optional<MediaSelectionOption::Type> type;
     decoder >> type;
     if (!type)
-        return std::nullopt;
+        return WTF::nullopt;
     
     return {{ WTFMove(*displayName), WTFMove(*type) }};
 }
 
-void ArgumentCoder<PromisedBlobInfo>::encode(Encoder& encoder, const PromisedBlobInfo& info)
+void ArgumentCoder<PromisedAttachmentInfo>::encode(Encoder& encoder, const PromisedAttachmentInfo& info)
 {
     encoder << info.blobURL;
     encoder << info.contentType;
-    encoder << info.filename;
+    encoder << info.fileName;
+#if ENABLE(ATTACHMENT_ELEMENT)
+    encoder << info.attachmentIdentifier;
+#endif
     encodeTypesAndData(encoder, info.additionalTypes, info.additionalData);
 }
 
-bool ArgumentCoder<PromisedBlobInfo>::decode(Decoder& decoder, PromisedBlobInfo& info)
+bool ArgumentCoder<PromisedAttachmentInfo>::decode(Decoder& decoder, PromisedAttachmentInfo& info)
 {
     if (!decoder.decode(info.blobURL))
         return false;
@@ -2763,50 +2978,118 @@ bool ArgumentCoder<PromisedBlobInfo>::decode(Decoder& decoder, PromisedBlobInfo&
     if (!decoder.decode(info.contentType))
         return false;
 
-    if (!decoder.decode(info.filename))
+    if (!decoder.decode(info.fileName))
         return false;
 
+#if ENABLE(ATTACHMENT_ELEMENT)
+    if (!decoder.decode(info.attachmentIdentifier))
+        return false;
+#endif
+
     if (!decodeTypesAndData(decoder, info.additionalTypes, info.additionalData))
         return false;
 
     return true;
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-
-void ArgumentCoder<AttachmentInfo>::encode(Encoder& encoder, const AttachmentInfo& info)
+void ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::encode(Encoder& encoder, const Vector<RefPtr<SecurityOrigin>>& origins)
 {
-    bool dataIsNull = !info.data;
-    encoder << info.contentType << info.name << info.filePath << dataIsNull;
-    if (!dataIsNull) {
-        SharedBufferDataReference dataReference { info.data.get() };
-        encoder << static_cast<DataReference&>(dataReference);
+    encoder << static_cast<uint64_t>(origins.size());
+    for (auto& origin : origins)
+        encoder << *origin;
+}
+    
+bool ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::decode(Decoder& decoder, Vector<RefPtr<SecurityOrigin>>& origins)
+{
+    uint64_t dataSize;
+    if (!decoder.decode(dataSize))
+        return false;
+
+    origins.reserveInitialCapacity(dataSize);
+    for (uint64_t i = 0; i < dataSize; ++i) {
+        auto decodedOriginRefPtr = SecurityOrigin::decode(decoder);
+        if (!decodedOriginRefPtr)
+            return false;
+        origins.uncheckedAppend(decodedOriginRefPtr.releaseNonNull());
     }
+    return true;
 }
 
-bool ArgumentCoder<AttachmentInfo>::decode(Decoder& decoder, AttachmentInfo& info)
+void ArgumentCoder<FontAttributes>::encode(Encoder& encoder, const FontAttributes& attributes)
 {
-    if (!decoder.decode(info.contentType))
-        return false;
+    encoder << attributes.backgroundColor << attributes.foregroundColor << attributes.fontShadow << attributes.hasUnderline << attributes.hasStrikeThrough << attributes.textLists;
+    encoder.encodeEnum(attributes.horizontalAlignment);
+    encoder.encodeEnum(attributes.subscriptOrSuperscript);
+#if PLATFORM(COCOA)
+    bool hasFont = attributes.font;
+    encoder << hasFont;
+    if (hasFont)
+        IPC::encode(encoder, attributes.font.get());
+#endif
+}
 
-    if (!decoder.decode(info.name))
-        return false;
+Optional<FontAttributes> ArgumentCoder<FontAttributes>::decode(Decoder& decoder)
+{
+    FontAttributes attributes;
 
-    if (!decoder.decode(info.filePath))
-        return false;
+    if (!decoder.decode(attributes.backgroundColor))
+        return WTF::nullopt;
 
-    bool dataIsNull = true;
-    if (!decoder.decode(dataIsNull))
-        return false;
+    if (!decoder.decode(attributes.foregroundColor))
+        return WTF::nullopt;
 
-    if (!dataIsNull) {
-        DataReference dataReference;
-        if (!decoder.decode(dataReference))
-            return false;
-        info.data = SharedBuffer::create(dataReference.data(), dataReference.size());
-    }
+    if (!decoder.decode(attributes.fontShadow))
+        return WTF::nullopt;
 
-    return true;
+    if (!decoder.decode(attributes.hasUnderline))
+        return WTF::nullopt;
+
+    if (!decoder.decode(attributes.hasStrikeThrough))
+        return WTF::nullopt;
+
+    if (!decoder.decode(attributes.textLists))
+        return WTF::nullopt;
+
+    if (!decoder.decodeEnum(attributes.horizontalAlignment))
+        return WTF::nullopt;
+
+    if (!decoder.decodeEnum(attributes.subscriptOrSuperscript))
+        return WTF::nullopt;
+
+#if PLATFORM(COCOA)
+    bool hasFont = false;
+    if (!decoder.decode(hasFont))
+        return WTF::nullopt;
+
+    if (hasFont && !IPC::decode(decoder, attributes.font))
+        return WTF::nullopt;
+#endif
+
+    return attributes;
+}
+
+#if ENABLE(ATTACHMENT_ELEMENT)
+
+void ArgumentCoder<SerializedAttachmentData>::encode(IPC::Encoder& encoder, const WebCore::SerializedAttachmentData& data)
+{
+    encoder << data.identifier << data.mimeType << IPC::SharedBufferDataReference { data.data.get() };
+}
+
+Optional<SerializedAttachmentData> ArgumentCoder<WebCore::SerializedAttachmentData>::decode(IPC::Decoder& decoder)
+{
+    String identifier;
+    if (!decoder.decode(identifier))
+        return WTF::nullopt;
+
+    String mimeType;
+    if (!decoder.decode(mimeType))
+        return WTF::nullopt;
+
+    IPC::DataReference data;
+    if (!decoder.decode(data))
+        return WTF::nullopt;
+
+    return {{ WTFMove(identifier), WTFMove(mimeType), WebCore::SharedBuffer::create(data.data(), data.size()) }};
 }
 
 #endif // ENABLE(ATTACHMENT_ELEMENT)