Limit user-agent interactions based on the touch-action property on iOS
[WebKit-https.git] / Source / WebKit / Shared / WebCoreArgumentCoders.cpp
index 365f592..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>
@@ -46,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>
 #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/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;
@@ -220,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) }};
 }
@@ -262,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();
         }
     }
@@ -327,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)
@@ -341,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;
 }
 
@@ -504,25 +544,6 @@ bool ArgumentCoder<StepsTimingFunction>::decode(Decoder& decoder, StepsTimingFun
     return true;
 }
 
-void ArgumentCoder<FramesTimingFunction>::encode(Encoder& encoder, const FramesTimingFunction& timingFunction)
-{
-    encoder.encodeEnum(timingFunction.type());
-    
-    encoder << timingFunction.numberOfFrames();
-}
-
-bool ArgumentCoder<FramesTimingFunction>::decode(Decoder& decoder, FramesTimingFunction& timingFunction)
-{
-    // Type is decoded by the caller.
-    int numFrames;
-    if (!decoder.decode(numFrames))
-        return false;
-
-    timingFunction.setNumberOfFrames(numFrames);
-
-    return true;
-}
-
 void ArgumentCoder<SpringTimingFunction>::encode(Encoder& encoder, const SpringTimingFunction& timingFunction)
 {
     encoder.encodeEnum(timingFunction.type());
@@ -567,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);
 }
 
@@ -596,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);
 }
 
@@ -637,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);
 }
 
@@ -661,14 +682,14 @@ bool ArgumentCoder<ViewportArguments>::decode(Decoder& decoder, ViewportArgument
     return SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments);
 }
 
-std::optional<ViewportArguments> ArgumentCoder<ViewportArguments>::decode(Decoder& decoder)
+Optional<ViewportArguments> ArgumentCoder<ViewportArguments>::decode(Decoder& decoder)
 {
     ViewportArguments viewportArguments;
     if (!SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments))
-        return std::nullopt;
+        return WTF::nullopt;
     return WTFMove(viewportArguments);
 }
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS_FAMILY)
 
 
 void ArgumentCoder<IntPoint>::encode(Encoder& encoder, const IntPoint& intPoint)
@@ -681,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);
 }
 
@@ -699,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);
 }
 
@@ -717,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);
 }
 
@@ -852,11 +873,11 @@ bool ArgumentCoder<Path>::decode(Decoder& decoder, Path& path)
     return true;
 }
 
-std::optional<Path> ArgumentCoder<Path>::decode(Decoder& decoder)
+Optional<Path> ArgumentCoder<Path>::decode(Decoder& decoder)
 {
     Path path;
     if (!decode(decoder, path))
-        return std::nullopt;
+        return WTF::nullopt;
 
     return path;
 }
@@ -866,24 +887,24 @@ void ArgumentCoder<RecentSearch>::encode(Encoder& encoder, const RecentSearch& r
     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)
@@ -892,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);
@@ -932,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);
@@ -959,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);
 }
@@ -987,26 +1017,26 @@ void ArgumentCoder<PluginInfo>::encode(Encoder& encoder, const PluginInfo& plugi
 #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;
+        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);
@@ -1178,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());
@@ -1334,7 +1364,7 @@ bool ArgumentCoder<ResourceError>::decode(Decoder& decoder, ResourceError& resou
     return true;
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 
 void ArgumentCoder<SelectionRect>::encode(Encoder& encoder, const SelectionRect& selectionRect)
 {
@@ -1352,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);
@@ -1524,11 +1554,11 @@ bool ArgumentCoder<Color>::decode(Decoder& decoder, Color& color)
     return true;
 }
 
-std::optional<Color> ArgumentCoder<Color>::decode(Decoder& decoder)
+Optional<Color> ArgumentCoder<Color>::decode(Decoder& decoder)
 {
     Color color;
     if (!decode(decoder, color))
-        return std::nullopt;
+        return WTF::nullopt;
 
     return color;
 }
@@ -1594,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);
 }
@@ -1638,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;
 
@@ -1730,7 +1760,7 @@ bool ArgumentCoder<PasteboardURL>::decode(Decoder& decoder, PasteboardURL& conte
     return true;
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 
 void ArgumentCoder<Highlight>::encode(Encoder& encoder, const Highlight& highlight)
 {
@@ -1842,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;
@@ -1857,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)
 {
@@ -1866,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) }};
 }
@@ -1917,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)
 {
@@ -1927,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) }};
 }
@@ -1991,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) }};
 }
@@ -2096,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)
@@ -2114,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;
 }
 
@@ -2390,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);
@@ -2438,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);
 }
@@ -2549,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;
@@ -2632,65 +2699,96 @@ void ArgumentCoder<ResourceLoadStatistics>::encode(Encoder& encoder, const WebCo
     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 std::nullopt;    
+        return WTF::nullopt;    
 
     if (!decoder.decode(statistics.topFrameUniqueRedirectsFrom))
-        return std::nullopt;
+        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 std::nullopt;
+        return WTF::nullopt;
     
     // Prevalent Resource
     if (!decoder.decode(statistics.isPrevalentResource))
-        return std::nullopt;
+        return WTF::nullopt;
 
     if (!decoder.decode(statistics.isVeryPrevalentResource))
-        return std::nullopt;
+        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);
 }
@@ -2700,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
@@ -2765,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;
@@ -2798,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;
@@ -2824,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;
@@ -2848,17 +2944,17 @@ 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) }};
 }
@@ -2867,7 +2963,7 @@ void ArgumentCoder<PromisedAttachmentInfo>::encode(Encoder& encoder, const Promi
 {
     encoder << info.blobURL;
     encoder << info.contentType;
-    encoder << info.filename;
+    encoder << info.fileName;
 #if ENABLE(ATTACHMENT_ELEMENT)
     encoder << info.attachmentIdentifier;
 #endif
@@ -2882,7 +2978,7 @@ bool ArgumentCoder<PromisedAttachmentInfo>::decode(Decoder& decoder, PromisedAtt
     if (!decoder.decode(info.contentType))
         return false;
 
-    if (!decoder.decode(info.filename))
+    if (!decoder.decode(info.fileName))
         return false;
 
 #if ENABLE(ATTACHMENT_ELEMENT)
@@ -2919,4 +3015,83 @@ bool ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::decode(Decoder& decoder, Vec
     return true;
 }
 
+void ArgumentCoder<FontAttributes>::encode(Encoder& encoder, const FontAttributes& attributes)
+{
+    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
+}
+
+Optional<FontAttributes> ArgumentCoder<FontAttributes>::decode(Decoder& decoder)
+{
+    FontAttributes attributes;
+
+    if (!decoder.decode(attributes.backgroundColor))
+        return WTF::nullopt;
+
+    if (!decoder.decode(attributes.foregroundColor))
+        return WTF::nullopt;
+
+    if (!decoder.decode(attributes.fontShadow))
+        return WTF::nullopt;
+
+    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)
+
 } // namespace IPC