WebKit Bugzilla
Attachment 357415 Details for
Bug 192728
: wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192728-20181215223545.patch (text/plain), 3.06 MB, created by
Chris Dumez
on 2018-12-15 22:35:49 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-12-15 22:35:49 PST
Size:
3.06 MB
patch
obsolete
>Subversion Revision: 239255 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 8ae72c07e00a225d900c91b4f162f2a822871f22..2b221bdd39ea786a0eb8205a57efa055f4448415 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,30 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * API/*: >+ * Scripts/*: >+ * assembler/*: >+ * b3/*: >+ * bytecode/*: >+ * bytecompiler/*: >+ * debugger/*: >+ * dfg/*: >+ * ftl/*: >+ * heap/*: >+ * inspector/*: >+ * jit/*: >+ * llint/*: >+ * parser/*: >+ * runtime/*: >+ * tools/*: >+ * wasm/*: >+ * yarr/*: >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index ca0e856cd23f95af1f2ce81d9197641aa41cb742..109c9149480eb2a20a37e407ae3baa24b4cfc4d8 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Update optional's move-constructor and move-assignment operator to disengage the value being moved from. >+ Rename to optional to Optional, make_optional() to makeOptional(), and move class from std to WTF namespace. >+ >+ Based on patch by David Kilzer. >+ >+ * wtf/*: >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6ab25aaa8e1fe46aa4004e4caebbda23442cc37d..1148c22b375470c81156e5265429a33c4299bf87 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,32 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Modules/*: >+ * animation/*: >+ * bindings/*: >+ * crypto/*: >+ * css/*: >+ * dom/*: >+ * editing/*: >+ * fileapi/*: >+ * html/*: >+ * inspector/*: >+ * layout/*: >+ * loader/*: >+ * mathml/*: >+ * page/*: >+ * platform/*: >+ * plugins/*: >+ * rendering/*: >+ * testing/*: >+ * workers/*: >+ * xml/*: >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index d975a1638e1e83e69455a52886e9664862e7083a..a798fac7ff2d382a6824998d6a3dfb4a0adb611c 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,13 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * pal/*: >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WebDriver/ChangeLog b/Source/WebDriver/ChangeLog >index e7d028618cc810c6e6a1a4da059b7ec3ed4160a0..ce882974343012a2debb57b69607dc9207f46dae 100644 >--- a/Source/WebDriver/ChangeLog >+++ b/Source/WebDriver/ChangeLog >@@ -1,3 +1,13 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * : >+ > 2018-11-29 Tomas Popela <tpopela@redhat.com> > > [WebDriver] Fix clang warnings in Session.cpp >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b98194b95370519f7b9e2f1e3e0cbfd99ac736a5..6c93d29305413bb47f5651b355ab634deb42fb60 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * NetworkProcess/*: >+ * Platform/*: >+ * Scripts/*: >+ * Shared/*: >+ * UIProcess/*: >+ * WebProcess/*: >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 0916b4e4d56cfd0649d5ec2a59dc6b4bb31913ad..03be05e45c58402810b7c6bce65143b866ecf1a0 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DOM/*: >+ * Plugins/*: >+ * WebCoreSupport/*: >+ * WebView/*: >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index 40ac05381fb7d06946dbb44a0e1e461918b2c03f..0c3235cc52486f1baabad60268bb7018c416e55f 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,14 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Plugins/*: >+ * WebCoreSupport/*: >+ > 2018-12-12 Fujii Hironori <Hironori.Fujii@sony.com> > > [Win][Clang][WebKitLegacy] warning: expected a qualified name after 'typename' of COMEnumVariant and COMPropertyBag >diff --git a/Source/JavaScriptCore/API/glib/JSCCallbackFunction.cpp b/Source/JavaScriptCore/API/glib/JSCCallbackFunction.cpp >index 3006fca5d495a8b78f00db363bf0ac3f4c29e2fb..7007659db17343c8bf8188cbbda2bb14503f3a52 100644 >--- a/Source/JavaScriptCore/API/glib/JSCCallbackFunction.cpp >+++ b/Source/JavaScriptCore/API/glib/JSCCallbackFunction.cpp >@@ -53,7 +53,7 @@ static JSObjectRef callAsConstructor(JSContextRef callerContext, JSObjectRef con > > const ClassInfo JSCCallbackFunction::s_info = { "CallbackFunction", &InternalFunction::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCCallbackFunction) }; > >-JSCCallbackFunction* JSCCallbackFunction::create(VM& vm, JSGlobalObject* globalObject, const String& name, Type type, JSCClass* jscClass, GRefPtr<GClosure>&& closure, GType returnType, std::optional<Vector<GType>>&& parameters) >+JSCCallbackFunction* JSCCallbackFunction::create(VM& vm, JSGlobalObject* globalObject, const String& name, Type type, JSCClass* jscClass, GRefPtr<GClosure>&& closure, GType returnType, WTF::Optional<Vector<GType>>&& parameters) > { > Structure* structure = globalObject->glibCallbackFunctionStructure(); > JSCCallbackFunction* function = new (NotNull, allocateCell<JSCCallbackFunction>(vm.heap)) JSCCallbackFunction(vm, structure, type, jscClass, WTFMove(closure), returnType, WTFMove(parameters)); >@@ -61,7 +61,7 @@ JSCCallbackFunction* JSCCallbackFunction::create(VM& vm, JSGlobalObject* globalO > return function; > } > >-JSCCallbackFunction::JSCCallbackFunction(VM& vm, Structure* structure, Type type, JSCClass* jscClass, GRefPtr<GClosure>&& closure, GType returnType, std::optional<Vector<GType>>&& parameters) >+JSCCallbackFunction::JSCCallbackFunction(VM& vm, Structure* structure, Type type, JSCClass* jscClass, GRefPtr<GClosure>&& closure, GType returnType, WTF::Optional<Vector<GType>>&& parameters) > : InternalFunction(vm, structure, APICallbackFunction::call<JSCCallbackFunction>, type == Type::Constructor ? APICallbackFunction::construct<JSCCallbackFunction> : nullptr) > , m_functionCallback(callAsFunction) > , m_constructCallback(callAsConstructor) >diff --git a/Source/JavaScriptCore/API/glib/JSCCallbackFunction.h b/Source/JavaScriptCore/API/glib/JSCCallbackFunction.h >index 17e3210227f115c440f5f275e9ab74eadbc540aa..15cc947da03f5a643cf193784037d95716e112e2 100644 >--- a/Source/JavaScriptCore/API/glib/JSCCallbackFunction.h >+++ b/Source/JavaScriptCore/API/glib/JSCCallbackFunction.h >@@ -52,7 +52,7 @@ public: > Constructor > }; > >- static JSCCallbackFunction* create(VM&, JSGlobalObject*, const String& name, Type, JSCClass*, GRefPtr<GClosure>&&, GType, std::optional<Vector<GType>>&&); >+ static JSCCallbackFunction* create(VM&, JSGlobalObject*, const String& name, Type, JSCClass*, GRefPtr<GClosure>&&, GType, WTF::Optional<Vector<GType>>&&); > static void destroy(JSCell*); > > static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) >@@ -69,7 +69,7 @@ public: > private: > static IsoSubspace* subspaceForImpl(VM&); > >- JSCCallbackFunction(VM&, Structure*, Type, JSCClass*, GRefPtr<GClosure>&&, GType, std::optional<Vector<GType>>&&); >+ JSCCallbackFunction(VM&, Structure*, Type, JSCClass*, GRefPtr<GClosure>&&, GType, WTF::Optional<Vector<GType>>&&); > > JSObjectCallAsFunctionCallback functionCallback() { return m_functionCallback; } > JSObjectCallAsConstructorCallback constructCallback() { return m_constructCallback; } >@@ -80,7 +80,7 @@ private: > GRefPtr<JSCClass> m_class; > GRefPtr<GClosure> m_closure; > GType m_returnType; >- std::optional<Vector<GType>> m_parameters; >+ WTF::Optional<Vector<GType>> m_parameters; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/API/glib/JSCClass.cpp b/Source/JavaScriptCore/API/glib/JSCClass.cpp >index 652928e4a9b91424b4944ff6289bfdd360f4bb74..df9f81aaab6810a1dc3262695089b5f93440858d 100644 >--- a/Source/JavaScriptCore/API/glib/JSCClass.cpp >+++ b/Source/JavaScriptCore/API/glib/JSCClass.cpp >@@ -552,7 +552,7 @@ JSCClass* jsc_class_get_parent(JSCClass* jscClass) > return jscClass->priv->parentClass; > } > >-static GRefPtr<JSCValue> jscClassCreateConstructor(JSCClass* jscClass, const char* name, GCallback callback, gpointer userData, GDestroyNotify destroyNotify, GType returnType, std::optional<Vector<GType>>&& parameters) >+static GRefPtr<JSCValue> jscClassCreateConstructor(JSCClass* jscClass, const char* name, GCallback callback, gpointer userData, GDestroyNotify destroyNotify, GType returnType, WTF::Optional<Vector<GType>>&& parameters) > { > JSCClassPrivate* priv = jscClass->priv; > GRefPtr<GClosure> closure = adoptGRef(g_cclosure_new(callback, userData, reinterpret_cast<GClosureNotify>(reinterpret_cast<GCallback>(destroyNotify)))); >@@ -689,10 +689,10 @@ JSCValue* jsc_class_add_constructor_variadic(JSCClass* jscClass, const char* nam > if (!name) > name = priv->name.data(); > >- return jscClassCreateConstructor(jscClass, name ? name : priv->name.data(), callback, userData, destroyNotify, returnType, std::nullopt).leakRef(); >+ return jscClassCreateConstructor(jscClass, name ? name : priv->name.data(), callback, userData, destroyNotify, returnType, WTF::nullopt).leakRef(); > } > >-static void jscClassAddMethod(JSCClass* jscClass, const char* name, GCallback callback, gpointer userData, GDestroyNotify destroyNotify, GType returnType, std::optional<Vector<GType>>&& parameters) >+static void jscClassAddMethod(JSCClass* jscClass, const char* name, GCallback callback, gpointer userData, GDestroyNotify destroyNotify, GType returnType, WTF::Optional<Vector<GType>>&& parameters) > { > JSCClassPrivate* priv = jscClass->priv; > GRefPtr<GClosure> closure = adoptGRef(g_cclosure_new(callback, userData, reinterpret_cast<GClosureNotify>(reinterpret_cast<GCallback>(destroyNotify)))); >@@ -798,7 +798,7 @@ void jsc_class_add_method_variadic(JSCClass* jscClass, const char* name, GCallba > g_return_if_fail(callback); > g_return_if_fail(jscClass->priv->context); > >- jscClassAddMethod(jscClass, name, callback, userData, destroyNotify, returnType, std::nullopt); >+ jscClassAddMethod(jscClass, name, callback, userData, destroyNotify, returnType, WTF::nullopt); > } > > /** >diff --git a/Source/JavaScriptCore/API/glib/JSCValue.cpp b/Source/JavaScriptCore/API/glib/JSCValue.cpp >index 6e274f89f437b63c9592572342f970539caae19d..1e74ce37dcfebb3a47cd150e01bb6559e1d376bc 100644 >--- a/Source/JavaScriptCore/API/glib/JSCValue.cpp >+++ b/Source/JavaScriptCore/API/glib/JSCValue.cpp >@@ -1105,7 +1105,7 @@ void jsc_value_object_define_property_accessor(JSCValue* value, const char* prop > JSC_TYPE_VALUE, value, G_TYPE_STRING, propertyName, JSC_TYPE_VALUE, descriptor.get(), G_TYPE_NONE)); > } > >-static GRefPtr<JSCValue> jscValueFunctionCreate(JSCContext* context, const char* name, GCallback callback, gpointer userData, GDestroyNotify destroyNotify, GType returnType, std::optional<Vector<GType>>&& parameters) >+static GRefPtr<JSCValue> jscValueFunctionCreate(JSCContext* context, const char* name, GCallback callback, gpointer userData, GDestroyNotify destroyNotify, GType returnType, WTF::Optional<Vector<GType>>&& parameters) > { > GRefPtr<GClosure> closure = adoptGRef(g_cclosure_new(callback, userData, reinterpret_cast<GClosureNotify>(reinterpret_cast<GCallback>(destroyNotify)))); > JSC::ExecState* exec = toJS(jscContextGetJSContext(context)); >@@ -1207,7 +1207,7 @@ JSCValue* jsc_value_new_function_variadic(JSCContext* context, const char* name, > g_return_val_if_fail(JSC_IS_CONTEXT(context), nullptr); > g_return_val_if_fail(callback, nullptr); > >- return jscValueFunctionCreate(context, name, callback, userData, destroyNotify, returnType, std::nullopt).leakRef(); >+ return jscValueFunctionCreate(context, name, callback, userData, destroyNotify, returnType, WTF::nullopt).leakRef(); > } > > /** >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result >index 26fe0e6e0aae3326ed1922276a6fb26a241d7ee4..fc1e99623ebdca2319b79669a49a7b0fcb65dc4c 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result >@@ -159,7 +159,7 @@ const char* s_builtinPromiseRejectPromiseCode = > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); } >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); } > JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR > >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result >index 4d7cd22dbfd0cb5a96fc74a0af6020ddc7905c2f..b5a94937ff27c920f8b0002af0691338c9b0cbcc 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result >@@ -158,7 +158,7 @@ const char* s_builtinPromiseFulfillPromiseCode = > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); } >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); } > JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR > >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result >index 7b776020537d06f0d77cd06be8d2b6a7bacfda68..247b97abdbe9a788c5317bb987cf00eda8cf1728 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result >@@ -281,7 +281,7 @@ const char* s_builtinPrototypeTestCode = > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); } >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); } > JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR > >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result >index b2b72cdbb89af041d4972d1f9b8d170a95f6b41b..b74db98c2e06575dfbba5d673893b9e3de507329 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result >@@ -282,7 +282,7 @@ const char* s_builtinPrototypeTestCode = > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); } >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); } > JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR > >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result >index 660daa25641c570b931602b412df4ce1a62ba322..eab9f74917c4209d4ff74edf02e452937596bd89 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result >@@ -213,7 +213,7 @@ const char* s_builtinConstructorOfCode = > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); } >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); } > JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR > >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result >index 6ff597f54e62f7d160b829f3adc8fd9ccd3a6d92..c05a2fc163df1c95eea102b16744d2f836dfb193 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result >@@ -212,7 +212,7 @@ const char* s_builtinConstructorFromCode = > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); } >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); } > JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR > >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result >index bb121175be8d8f296ceadd146e89d30cacf933dd..0571bd1e277ba6a6b09bc704db09f8306f2d91e2 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result >@@ -142,7 +142,7 @@ const char* s_internalClashingNamesIsReadableStreamLockedCode = > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); } >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); } > JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR > >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result >index b8bcfb847e015052ea669f312f5f35ffedcd86c8..3e2acdefe995473a2a817736d792612ac436fda0 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result >@@ -220,7 +220,7 @@ const char* s_anotherGuardedInternalBuiltinLetsFetchCode = > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ >- return clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result >index d4d41bf0c3dc7155b14ccc14872f4a650b4db919..262447804e79bc04bb4dca021df090e1b8b625c5 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result >@@ -190,7 +190,7 @@ const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode = > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ >- return clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result >index 59254ce2ce09116f20d6c5a1b64d511f255d58d7..38f78de523872288e42d4f563e526a40d1279c4e 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result >@@ -190,7 +190,7 @@ const char* s_guardedBuiltinIsReadableStreamLockedCode = > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ >- return clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result >index 65dd3e843105cc9bedd733416a11f57b71c98011..8f5d32020d5ec8f91e38798edc3dcd7395cd52c7 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result >@@ -222,7 +222,7 @@ const char* s_guardedInternalBuiltinIsReadableStreamLockedCode = > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ >- return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result >index 06c935ac814982a8917b146ac00161d83efdf4b7..e6ff62f709848a56666635db77f86ad78a5d8bf8 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result >@@ -184,7 +184,7 @@ const char* s_unguardedBuiltinIsReadableStreamLockedCode = > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ >- return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result >index b24bca3caa5cd008dc88c29675d4341a3801fbb6..e5639fdc0b216c5046047fa9585a32f3c7ca86a2 100644 >--- a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result >+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result >@@ -275,7 +275,7 @@ const char* s_xmlCasingTestUrlCasingTestCode = > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ > {\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ >- return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >diff --git a/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py >index 907a6d717c910cb07299509c61df846a9c701efc..4c293cc297fbe019865c9b1c0415a22768e570b4 100644 >--- a/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py >+++ b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py >@@ -85,7 +85,7 @@ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ > {\\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >@@ -96,7 +96,7 @@ ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ > {\\ >- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ >+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ > } > ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >@@ -108,7 +108,7 @@ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ > {\\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\ >- return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \\ >+ return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \\ > } > ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >@@ -120,7 +120,7 @@ ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ > {\\ > JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\ >- return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \\ >+ return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \\ > } > ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) > #undef DEFINE_BUILTIN_GENERATOR >diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h b/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h >index d91921a11102ce7706dcf38f2dcfa2552d7dacbf..e8f1c1ac6a91e3af892221b0efc327bb0c60645b 100644 >--- a/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h >+++ b/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h >@@ -3835,7 +3835,7 @@ public: > return static_cast<RelationalCondition>(Assembler::invert(static_cast<Assembler::Condition>(cond))); > } > >- static std::optional<ResultCondition> commuteCompareToZeroIntoTest(RelationalCondition cond) >+ static WTF::Optional<ResultCondition> commuteCompareToZeroIntoTest(RelationalCondition cond) > { > switch (cond) { > case Equal: >@@ -3848,7 +3848,7 @@ public: > return PositiveOrZero; > break; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h >index ec52181a2c2df580b35ce309df397ff3d554ac4e..7539f49886d97f49179faf6b5ad8c5e765818db7 100644 >--- a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h >+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h >@@ -3123,7 +3123,7 @@ public: > } > } > >- static std::optional<ResultCondition> commuteCompareToZeroIntoTest(RelationalCondition cond) >+ static WTF::Optional<ResultCondition> commuteCompareToZeroIntoTest(RelationalCondition cond) > { > switch (cond) { > case Equal: >@@ -3136,7 +3136,7 @@ public: > return PositiveOrZero; > break; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/JavaScriptCore/b3/B3CheckSpecial.cpp b/Source/JavaScriptCore/b3/B3CheckSpecial.cpp >index 7c5372ac5e271141993f78be1683e0931853c895..db2cdd54508212ec5ba1550c4ee625a882323987 100644 >--- a/Source/JavaScriptCore/b3/B3CheckSpecial.cpp >+++ b/Source/JavaScriptCore/b3/B3CheckSpecial.cpp >@@ -111,7 +111,7 @@ Inst CheckSpecial::hiddenBranch(const Inst& inst) const > void CheckSpecial::forEachArg(Inst& inst, const ScopedLambda<Inst::EachArgCallback>& callback) > { > using namespace Air; >- std::optional<Width> optionalDefArgWidth; >+ WTF::Optional<Width> optionalDefArgWidth; > Inst hidden = hiddenBranch(inst); > hidden.forEachArg( > [&] (Arg& arg, Arg::Role role, Bank bank, Width width) { >@@ -123,7 +123,7 @@ void CheckSpecial::forEachArg(Inst& inst, const ScopedLambda<Inst::EachArgCallba > callback(inst.args[1 + index], role, bank, width); > }); > >- std::optional<unsigned> firstRecoverableIndex; >+ WTF::Optional<unsigned> firstRecoverableIndex; > if (m_checkKind.opcode == BranchAdd32 || m_checkKind.opcode == BranchAdd64) > firstRecoverableIndex = 1; > forEachArgImpl(numB3Args(inst), m_numCheckArgs + 1, inst, m_stackmapRole, firstRecoverableIndex, callback, optionalDefArgWidth); >@@ -150,11 +150,11 @@ bool CheckSpecial::admitsExtendedOffsetAddr(Inst& inst, unsigned argIndex) > return admitsStack(inst, argIndex); > } > >-std::optional<unsigned> CheckSpecial::shouldTryAliasingDef(Inst& inst) >+WTF::Optional<unsigned> CheckSpecial::shouldTryAliasingDef(Inst& inst) > { >- if (std::optional<unsigned> branchDef = hiddenBranch(inst).shouldTryAliasingDef()) >+ if (WTF::Optional<unsigned> branchDef = hiddenBranch(inst).shouldTryAliasingDef()) > return *branchDef + 1; >- return std::nullopt; >+ return WTF::nullopt; > } > > CCallHelpers::Jump CheckSpecial::generate(Inst& inst, CCallHelpers& jit, GenerationContext& context) >diff --git a/Source/JavaScriptCore/b3/B3CheckSpecial.h b/Source/JavaScriptCore/b3/B3CheckSpecial.h >index b9183fae9c851819b03760d795c9c44a86445d8c..e667a9f38687ce7e2ff85848ad6f88ba80d76eb4 100644 >--- a/Source/JavaScriptCore/b3/B3CheckSpecial.h >+++ b/Source/JavaScriptCore/b3/B3CheckSpecial.h >@@ -124,7 +124,7 @@ protected: > bool isValid(Air::Inst&) final; > bool admitsStack(Air::Inst&, unsigned argIndex) final; > bool admitsExtendedOffsetAddr(Air::Inst&, unsigned) final; >- std::optional<unsigned> shouldTryAliasingDef(Air::Inst&) final; >+ WTF::Optional<unsigned> shouldTryAliasingDef(Air::Inst&) final; > > // NOTE: the generate method will generate the hidden branch and then register a LatePath that > // generates the stackmap. Super crazy dude! >diff --git a/Source/JavaScriptCore/b3/B3Common.cpp b/Source/JavaScriptCore/b3/B3Common.cpp >index 661020e66b09807944ec6d6fb88feada2b5574f1..c5c39a771ecaea7a61fbfee37ffd8dc667797c7a 100644 >--- a/Source/JavaScriptCore/b3/B3Common.cpp >+++ b/Source/JavaScriptCore/b3/B3Common.cpp >@@ -65,12 +65,12 @@ bool shouldSaveIRBeforePhase() > return Options::verboseValidationFailure(); > } > >-std::optional<GPRReg> pinnedExtendedOffsetAddrRegister() >+WTF::Optional<GPRReg> pinnedExtendedOffsetAddrRegister() > { > #if CPU(ARM64) > return static_cast<GPRReg>(+MacroAssembler::dataTempRegister); > #elif CPU(X86_64) >- return std::nullopt; >+ return WTF::nullopt; > #else > #error Unhandled architecture. > #endif >diff --git a/Source/JavaScriptCore/b3/B3Common.h b/Source/JavaScriptCore/b3/B3Common.h >index d0d7dd38ac92d5fa36d51974471aa669d21bc17e..d6da06532cf503fea689086e50fa4f03ad477498 100644 >--- a/Source/JavaScriptCore/b3/B3Common.h >+++ b/Source/JavaScriptCore/b3/B3Common.h >@@ -182,7 +182,7 @@ inline unsigned defaultOptLevel() > return Options::defaultB3OptLevel(); > } > >-std::optional<GPRReg> pinnedExtendedOffsetAddrRegister(); >+WTF::Optional<GPRReg> pinnedExtendedOffsetAddrRegister(); > > } } // namespace JSC::B3 > >diff --git a/Source/JavaScriptCore/b3/B3LowerToAir.cpp b/Source/JavaScriptCore/b3/B3LowerToAir.cpp >index 006527af68d345f5e80c84c40e78dfc540f7ee21..e84ebda6124a668985e93fc96c6b54ae20a70af2 100644 >--- a/Source/JavaScriptCore/b3/B3LowerToAir.cpp >+++ b/Source/JavaScriptCore/b3/B3LowerToAir.cpp >@@ -448,12 +448,12 @@ private: > } > > template<typename Int, typename = Value::IsLegalOffset<Int>> >- std::optional<unsigned> scaleForShl(Value* shl, Int offset, std::optional<Width> width = std::nullopt) >+ WTF::Optional<unsigned> scaleForShl(Value* shl, Int offset, WTF::Optional<Width> width = WTF::nullopt) > { > if (shl->opcode() != Shl) >- return std::nullopt; >+ return WTF::nullopt; > if (!shl->child(1)->hasInt32()) >- return std::nullopt; >+ return WTF::nullopt; > unsigned logScale = shl->child(1)->asInt32(); > if (shl->type() == Int32) > logScale &= 31; >@@ -463,10 +463,10 @@ private: > // to signed since that's what all of our APIs want. > int64_t bigScale = static_cast<uint64_t>(1) << static_cast<uint64_t>(logScale); > if (!isRepresentableAs<int32_t>(bigScale)) >- return std::nullopt; >+ return WTF::nullopt; > unsigned scale = static_cast<int32_t>(bigScale); > if (!Arg::isValidIndexForm(scale, offset, width)) >- return std::nullopt; >+ return WTF::nullopt; > return scale; > } > >@@ -492,7 +492,7 @@ private: > Value* right = address->child(1); > > auto tryIndex = [&] (Value* index, Value* base) -> Arg { >- std::optional<unsigned> scale = scaleForShl(index, offset, width); >+ WTF::Optional<unsigned> scale = scaleForShl(index, offset, width); > if (!scale) > return Arg(); > if (m_locked.contains(index->child(0)) || m_locked.contains(base)) >@@ -2088,7 +2088,7 @@ private: > } > > auto tryShl = [&] (Value* shl, Value* other) -> bool { >- std::optional<unsigned> scale = scaleForShl(shl, offset); >+ WTF::Optional<unsigned> scale = scaleForShl(shl, offset); > if (!scale) > return false; > if (!canBeInternal(shl)) >diff --git a/Source/JavaScriptCore/b3/B3Opcode.cpp b/Source/JavaScriptCore/b3/B3Opcode.cpp >index dc1024979341b3f6a155db78c20234926725f176..a137f70fd22f2f62fb3d89a394bac1ed170c286d 100644 >--- a/Source/JavaScriptCore/b3/B3Opcode.cpp >+++ b/Source/JavaScriptCore/b3/B3Opcode.cpp >@@ -36,7 +36,7 @@ IGNORE_RETURN_TYPE_WARNINGS_BEGIN > > namespace JSC { namespace B3 { > >-std::optional<Opcode> invertedCompare(Opcode opcode, Type type) >+WTF::Optional<Opcode> invertedCompare(Opcode opcode, Type type) > { > switch (opcode) { > case Equal: >@@ -46,19 +46,19 @@ std::optional<Opcode> invertedCompare(Opcode opcode, Type type) > case LessThan: > if (isInt(type)) > return GreaterEqual; >- return std::nullopt; >+ return WTF::nullopt; > case GreaterThan: > if (isInt(type)) > return LessEqual; >- return std::nullopt; >+ return WTF::nullopt; > case LessEqual: > if (isInt(type)) > return GreaterThan; >- return std::nullopt; >+ return WTF::nullopt; > case GreaterEqual: > if (isInt(type)) > return LessThan; >- return std::nullopt; >+ return WTF::nullopt; > case Above: > return BelowEqual; > case Below: >@@ -68,7 +68,7 @@ std::optional<Opcode> invertedCompare(Opcode opcode, Type type) > case BelowEqual: > return Above; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/JavaScriptCore/b3/B3Opcode.h b/Source/JavaScriptCore/b3/B3Opcode.h >index 25f3af1557de09f7ea45544029a6c73bdcf8efe3..5a2a6f0eebf2f7bbe8e5f583da3de4057efbd1c9 100644 >--- a/Source/JavaScriptCore/b3/B3Opcode.h >+++ b/Source/JavaScriptCore/b3/B3Opcode.h >@@ -374,7 +374,7 @@ inline bool isCheckMath(Opcode opcode) > } > } > >-std::optional<Opcode> invertedCompare(Opcode, Type); >+WTF::Optional<Opcode> invertedCompare(Opcode, Type); > > inline Opcode constPtrOpcode() > { >diff --git a/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp b/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp >index 516917bb15998b8dfea66917a3cd901cd7df80c4..daae2432c5b5bf44d8ec3f16f709e03c0cc57a23 100644 >--- a/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp >+++ b/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp >@@ -60,7 +60,7 @@ void PatchpointSpecial::forEachArg(Inst& inst, const ScopedLambda<Inst::EachArgC > callback(inst.args[argIndex++], role, inst.origin->resultBank(), inst.origin->resultWidth()); > } > >- forEachArgImpl(0, argIndex, inst, SameAsRep, std::nullopt, callback, std::nullopt); >+ forEachArgImpl(0, argIndex, inst, SameAsRep, WTF::nullopt, callback, WTF::nullopt); > argIndex += inst.origin->numChildren(); > > for (unsigned i = patchpoint->numGPScratchRegisters; i--;) >diff --git a/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp b/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp >index cfd1a1e42d4dd4a6af49e39316860686b712e2ba..9505da41de1caae165a5eabbe1aaf25b5cb5b6c2 100644 >--- a/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp >+++ b/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp >@@ -75,8 +75,8 @@ RegisterSet StackmapSpecial::extraEarlyClobberedRegs(Inst& inst) > > void StackmapSpecial::forEachArgImpl( > unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, >- Inst& inst, RoleMode roleMode, std::optional<unsigned> firstRecoverableIndex, >- const ScopedLambda<Inst::EachArgCallback>& callback, std::optional<Width> optionalDefArgWidth) >+ Inst& inst, RoleMode roleMode, WTF::Optional<unsigned> firstRecoverableIndex, >+ const ScopedLambda<Inst::EachArgCallback>& callback, WTF::Optional<Width> optionalDefArgWidth) > { > StackmapValue* value = inst.origin->as<StackmapValue>(); > ASSERT(value); >diff --git a/Source/JavaScriptCore/b3/B3StackmapSpecial.h b/Source/JavaScriptCore/b3/B3StackmapSpecial.h >index 6e8eac328df18b1c602f54b456f903bd9a537c0e..4359f9f2d2771b323beedf709ddf621e870c73b4 100644 >--- a/Source/JavaScriptCore/b3/B3StackmapSpecial.h >+++ b/Source/JavaScriptCore/b3/B3StackmapSpecial.h >@@ -59,8 +59,8 @@ protected: > // subclasses that implement that. > void forEachArgImpl( > unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, >- Air::Inst&, RoleMode, std::optional<unsigned> firstRecoverableIndex, >- const ScopedLambda<Air::Inst::EachArgCallback>&, std::optional<Width> optionalDefArgWidth); >+ Air::Inst&, RoleMode, WTF::Optional<unsigned> firstRecoverableIndex, >+ const ScopedLambda<Air::Inst::EachArgCallback>&, WTF::Optional<Width> optionalDefArgWidth); > > bool isValidImpl( > unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, >diff --git a/Source/JavaScriptCore/b3/B3Value.cpp b/Source/JavaScriptCore/b3/B3Value.cpp >index e76afe579603e54ddad85b135b3246577bca17f2..9abb00b46326aef7ecb8bc17ac0c76d768c5eb1f 100644 >--- a/Source/JavaScriptCore/b3/B3Value.cpp >+++ b/Source/JavaScriptCore/b3/B3Value.cpp >@@ -459,7 +459,7 @@ Value* Value::invertedCompare(Procedure& proc) const > { > if (!numChildren()) > return nullptr; >- if (std::optional<Opcode> invertedOpcode = B3::invertedCompare(opcode(), child(0)->type())) { >+ if (WTF::Optional<Opcode> invertedOpcode = B3::invertedCompare(opcode(), child(0)->type())) { > ASSERT(!kind().hasExtraBits()); > return proc.add<Value>(*invertedOpcode, type(), origin(), children()); > } >diff --git a/Source/JavaScriptCore/b3/air/AirAllocateRegistersByGraphColoring.cpp b/Source/JavaScriptCore/b3/air/AirAllocateRegistersByGraphColoring.cpp >index c282d5005d666cfdf9e17e4a956c1683ed450216..cb55b522a3e2602aa58499e456ccf0071358f756 100644 >--- a/Source/JavaScriptCore/b3/air/AirAllocateRegistersByGraphColoring.cpp >+++ b/Source/JavaScriptCore/b3/air/AirAllocateRegistersByGraphColoring.cpp >@@ -1673,7 +1673,7 @@ protected: > m_worklistMoves.startAddingLowPriorityMoves(); > for (BasicBlock* block : m_code) { > for (Inst& inst : *block) { >- if (std::optional<unsigned> defArgIndex = inst.shouldTryAliasingDef()) { >+ if (WTF::Optional<unsigned> defArgIndex = inst.shouldTryAliasingDef()) { > Arg op1 = inst.args[*defArgIndex - 2]; > Arg op2 = inst.args[*defArgIndex - 1]; > Arg dest = inst.args[*defArgIndex]; >diff --git a/Source/JavaScriptCore/b3/air/AirArg.h b/Source/JavaScriptCore/b3/air/AirArg.h >index 964548beded5474e052067ef1350f98c54a25b70..2bb42a61134ed414679dd6276ae89fe0b9ef6795 100644 >--- a/Source/JavaScriptCore/b3/air/AirArg.h >+++ b/Source/JavaScriptCore/b3/air/AirArg.h >@@ -586,7 +586,7 @@ public: > } > > // If you don't pass a Width, this optimistically assumes that you're using the right width. >- static bool isValidScale(unsigned scale, std::optional<Width> width = std::nullopt) >+ static bool isValidScale(unsigned scale, WTF::Optional<Width> width = WTF::nullopt) > { > switch (scale) { > case 1: >@@ -1181,7 +1181,7 @@ public: > } > > template<typename Int, typename = Value::IsLegalOffset<Int>> >- static bool isValidAddrForm(Int offset, std::optional<Width> width = std::nullopt) >+ static bool isValidAddrForm(Int offset, WTF::Optional<Width> width = WTF::nullopt) > { > if (isX86()) > return true; >@@ -1207,7 +1207,7 @@ public: > } > > template<typename Int, typename = Value::IsLegalOffset<Int>> >- static bool isValidIndexForm(unsigned scale, Int offset, std::optional<Width> width = std::nullopt) >+ static bool isValidIndexForm(unsigned scale, Int offset, WTF::Optional<Width> width = WTF::nullopt) > { > if (!isValidScale(scale, width)) > return false; >@@ -1221,7 +1221,7 @@ public: > // If you don't pass a width then this optimistically assumes that you're using the right width. But > // the width is relevant to validity, so passing a null width is only useful for assertions. Don't > // pass null widths when cascading through Args in the instruction selector! >- bool isValidForm(std::optional<Width> width = std::nullopt) const >+ bool isValidForm(WTF::Optional<Width> width = WTF::nullopt) const > { > switch (kind()) { > case Invalid: >diff --git a/Source/JavaScriptCore/b3/air/AirCode.cpp b/Source/JavaScriptCore/b3/air/AirCode.cpp >index 2bf11fb17ea33e976d79a4044d63b52ab3a2ce4d..cd0c2ec52efe5a73216e3dae38ce85c93fc972b7 100644 >--- a/Source/JavaScriptCore/b3/air/AirCode.cpp >+++ b/Source/JavaScriptCore/b3/air/AirCode.cpp >@@ -192,14 +192,14 @@ bool Code::isEntrypoint(BasicBlock* block) const > return false; > } > >-std::optional<unsigned> Code::entrypointIndex(BasicBlock* block) const >+WTF::Optional<unsigned> Code::entrypointIndex(BasicBlock* block) const > { > RELEASE_ASSERT(m_entrypoints.size()); > for (unsigned i = 0; i < m_entrypoints.size(); ++i) { > if (m_entrypoints[i].block() == block) > return i; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > void Code::setCalleeSaveRegisterAtOffsetList(RegisterAtOffsetList&& registerAtOffsetList, StackSlot* slot) >diff --git a/Source/JavaScriptCore/b3/air/AirCode.h b/Source/JavaScriptCore/b3/air/AirCode.h >index 2969cead5f30c3900fced7bea5f7ef1394c2e0eb..c4284d6d93261e2462f09849c336fc829bec12f6 100644 >--- a/Source/JavaScriptCore/b3/air/AirCode.h >+++ b/Source/JavaScriptCore/b3/air/AirCode.h >@@ -170,7 +170,7 @@ public: > const FrequentedBlock& entrypoint(unsigned index) const { return m_entrypoints[index]; } > bool isEntrypoint(BasicBlock*) const; > // Note: It is only valid to call this function after LowerEntrySwitch. >- std::optional<unsigned> entrypointIndex(BasicBlock*) const; >+ WTF::Optional<unsigned> entrypointIndex(BasicBlock*) const; > > // Note: We allow this to be called even before we set m_entrypoints just for convenience to users of this API. > // However, if you call this before setNumEntrypoints, setNumEntrypoints will overwrite this value. >diff --git a/Source/JavaScriptCore/b3/air/AirCustom.h b/Source/JavaScriptCore/b3/air/AirCustom.h >index 62abfc65257cb791ea9a336967473bf1263071c6..a2670ba7fca74d3d79fe7f71605591ecb339ce3c 100644 >--- a/Source/JavaScriptCore/b3/air/AirCustom.h >+++ b/Source/JavaScriptCore/b3/air/AirCustom.h >@@ -88,7 +88,7 @@ struct PatchCustom { > return inst.args[0].special()->admitsExtendedOffsetAddr(inst, argIndex); > } > >- static std::optional<unsigned> shouldTryAliasingDef(Inst& inst) >+ static WTF::Optional<unsigned> shouldTryAliasingDef(Inst& inst) > { > return inst.args[0].special()->shouldTryAliasingDef(inst); > } >diff --git a/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp b/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp >index 60a8cc035ff129059105ed65ecf253326c8e5399..ffa580451f60f3222d731ca98c63c8efc2f3d709 100644 >--- a/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp >+++ b/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp >@@ -121,11 +121,11 @@ private: > else if (isSpillSlot(inst.args[1])) > func(SlotConst(inst.args[1].stackSlot(), inst.args[0].value())); > } else if (isSpillSlot(inst.args[0]) && inst.args[1].isReg()) { >- if (std::optional<int64_t> constant = m_state.constantFor(inst.args[0])) >+ if (WTF::Optional<int64_t> constant = m_state.constantFor(inst.args[0])) > func(RegConst(inst.args[1].reg(), *constant)); > func(RegSlot(inst.args[1].reg(), inst.args[0].stackSlot(), RegSlot::AllBits)); > } else if (inst.args[0].isReg() && isSpillSlot(inst.args[1])) { >- if (std::optional<int64_t> constant = m_state.constantFor(inst.args[0])) >+ if (WTF::Optional<int64_t> constant = m_state.constantFor(inst.args[0])) > func(SlotConst(inst.args[1].stackSlot(), *constant)); > func(RegSlot(inst.args[0].reg(), inst.args[1].stackSlot(), RegSlot::AllBits)); > } >@@ -138,11 +138,11 @@ private: > else if (isSpillSlot(inst.args[1])) > func(SlotConst(inst.args[1].stackSlot(), static_cast<uint32_t>(inst.args[0].value()))); > } else if (isSpillSlot(inst.args[0]) && inst.args[1].isReg()) { >- if (std::optional<int64_t> constant = m_state.constantFor(inst.args[0])) >+ if (WTF::Optional<int64_t> constant = m_state.constantFor(inst.args[0])) > func(RegConst(inst.args[1].reg(), static_cast<uint32_t>(*constant))); > func(RegSlot(inst.args[1].reg(), inst.args[0].stackSlot(), RegSlot::ZExt32)); > } else if (inst.args[0].isReg() && isSpillSlot(inst.args[1])) { >- if (std::optional<int64_t> constant = m_state.constantFor(inst.args[0])) >+ if (WTF::Optional<int64_t> constant = m_state.constantFor(inst.args[0])) > func(SlotConst(inst.args[1].stackSlot(), static_cast<int32_t>(*constant))); > func(RegSlot(inst.args[0].reg(), inst.args[1].stackSlot(), RegSlot::Match32)); > } >@@ -504,19 +504,19 @@ private: > return nullptr; > } > >- std::optional<int64_t> constantFor(const Arg& arg) >+ WTF::Optional<int64_t> constantFor(const Arg& arg) > { > if (arg.isReg()) { > if (const RegConst* alias = getRegConst(arg.reg())) > return alias->constant; >- return std::nullopt; >+ return WTF::nullopt; > } > if (arg.isStack()) { > if (const SlotConst* alias = getSlotConst(arg.stackSlot())) > return alias->constant; >- return std::nullopt; >+ return WTF::nullopt; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > void clobber(const Arg& arg) >diff --git a/Source/JavaScriptCore/b3/air/AirGenerate.cpp b/Source/JavaScriptCore/b3/air/AirGenerate.cpp >index d532ed5c561d91589f1c3f4023192f70ea0477e2..f3b57717cb23e236a3730df483eee119e9e3d866 100644 >--- a/Source/JavaScriptCore/b3/air/AirGenerate.cpp >+++ b/Source/JavaScriptCore/b3/air/AirGenerate.cpp >@@ -207,7 +207,7 @@ void generate(Code& code, CCallHelpers& jit) > if (disassembler) > disassembler->startBlock(block, jit); > >- if (std::optional<unsigned> entrypointIndex = code.entrypointIndex(block)) { >+ if (WTF::Optional<unsigned> entrypointIndex = code.entrypointIndex(block)) { > ASSERT(code.isEntrypoint(block)); > > if (disassembler) >diff --git a/Source/JavaScriptCore/b3/air/AirInst.h b/Source/JavaScriptCore/b3/air/AirInst.h >index f2c0f02b3ccd011c0ad297f78c38d7bfe0f41576..b8307c22747a8efcf769105f9f75c5c042871ba4 100644 >--- a/Source/JavaScriptCore/b3/air/AirInst.h >+++ b/Source/JavaScriptCore/b3/air/AirInst.h >@@ -199,7 +199,7 @@ struct Inst { > // For example, > // Add Tmp1, Tmp2, Tmp3 > // returns 2 if 0 and 1 benefit from aliasing to Tmp3. >- std::optional<unsigned> shouldTryAliasingDef(); >+ WTF::Optional<unsigned> shouldTryAliasingDef(); > > // This computes a hash for comparing this to JSAir's Inst. > unsigned jsHash() const; >diff --git a/Source/JavaScriptCore/b3/air/AirInstInlines.h b/Source/JavaScriptCore/b3/air/AirInstInlines.h >index 835b1054c1adf27c6f01b644ffe749c4b753fef6..61fa98f05ea3756a1f6d468b95cea2aff9521a2e 100644 >--- a/Source/JavaScriptCore/b3/air/AirInstInlines.h >+++ b/Source/JavaScriptCore/b3/air/AirInstInlines.h >@@ -116,10 +116,10 @@ inline bool Inst::admitsExtendedOffsetAddr(Arg& arg) > return admitsExtendedOffsetAddr(&arg - &args[0]); > } > >-inline std::optional<unsigned> Inst::shouldTryAliasingDef() >+inline WTF::Optional<unsigned> Inst::shouldTryAliasingDef() > { > if (!isX86()) >- return std::nullopt; >+ return WTF::nullopt; > > switch (kind.opcode) { > case Add32: >@@ -147,7 +147,7 @@ inline std::optional<unsigned> Inst::shouldTryAliasingDef() > case MulFloat: > #if CPU(X86) || CPU(X86_64) > if (MacroAssembler::supportsAVX()) >- return std::nullopt; >+ return WTF::nullopt; > #endif > if (args.size() == 3) > return 2; >@@ -178,7 +178,7 @@ inline std::optional<unsigned> Inst::shouldTryAliasingDef() > default: > break; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > inline bool isShiftValid(const Inst& inst) >diff --git a/Source/JavaScriptCore/b3/air/AirSpecial.cpp b/Source/JavaScriptCore/b3/air/AirSpecial.cpp >index e825767b04d8ab3b9cec75af4e91980a8929057b..394d6ad5c63f3676d649536e6a06c9c6a914fcae 100644 >--- a/Source/JavaScriptCore/b3/air/AirSpecial.cpp >+++ b/Source/JavaScriptCore/b3/air/AirSpecial.cpp >@@ -50,9 +50,9 @@ CString Special::name() const > return out.toCString(); > } > >-std::optional<unsigned> Special::shouldTryAliasingDef(Inst&) >+WTF::Optional<unsigned> Special::shouldTryAliasingDef(Inst&) > { >- return std::nullopt; >+ return WTF::nullopt; > } > > bool Special::isTerminal(Inst&) >diff --git a/Source/JavaScriptCore/b3/air/AirSpecial.h b/Source/JavaScriptCore/b3/air/AirSpecial.h >index 504050d2b18bce87c0e4108287f3b2ebcd6eb16c..56902d3d6ade5b0325c8bc48d41b982746be56e1 100644 >--- a/Source/JavaScriptCore/b3/air/AirSpecial.h >+++ b/Source/JavaScriptCore/b3/air/AirSpecial.h >@@ -56,7 +56,7 @@ public: > virtual bool isValid(Inst&) = 0; > virtual bool admitsStack(Inst&, unsigned argIndex) = 0; > virtual bool admitsExtendedOffsetAddr(Inst&, unsigned argIndex) = 0; >- virtual std::optional<unsigned> shouldTryAliasingDef(Inst&); >+ virtual WTF::Optional<unsigned> shouldTryAliasingDef(Inst&); > > // This gets called on for each Inst that uses this Special. Note that there is no way to > // guarantee that a Special gets used from just one Inst, because Air might taildup late. So, >diff --git a/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp b/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp >index 0366f21845998397725b0f93b0633ded52dddbee..c8d39b2bcd6e0367e6abfbfea3ca6d3ba99a9d59 100644 >--- a/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp >+++ b/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp >@@ -163,7 +163,7 @@ UnlinkedFunctionExecutable* BuiltinExecutables::createExecutable(VM& vm, const S > unsigned lineCount = 0; > unsigned endColumn = 0; > unsigned offsetOfLastNewline = 0; >- std::optional<unsigned> offsetOfSecondToLastNewline; >+ WTF::Optional<unsigned> offsetOfSecondToLastNewline; > for (unsigned i = 0; i < view.length(); ++i) { > if (characters[i] == '\n') { > if (lineCount) >diff --git a/Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp b/Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp >index 6b5e68e9f5e95eb6320cee8529a27d9efee945e7..ff29bec590178f0033552a47bda381faeccf28bd 100644 >--- a/Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp >+++ b/Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp >@@ -130,7 +130,7 @@ private: > > if (m_storages.size() <= index) > m_storages.resize(index + 1); >- if (std::optional<Storage> storage = m_storages[index]) >+ if (WTF::Optional<Storage> storage = m_storages[index]) > return *storage; > > Identifier identifier = Identifier::fromUid(PrivateName()); >@@ -153,7 +153,7 @@ private: > UnlinkedCodeBlock* m_codeBlock; > InstructionStreamWriter& m_instructions; > BytecodeGraph m_graph; >- Vector<std::optional<Storage>> m_storages; >+ Vector<WTF::Optional<Storage>> m_storages; > Yields m_yields; > Strong<SymbolTable> m_generatorFrameSymbolTable; > int m_generatorFrameSymbolTableIndex; >diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >index 0e80517f7b9f9963c30b9b127e460bb97ba3ebb5..82293f18aa23cebcdc957c8a355377bb9712cee3 100644 >--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp >+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >@@ -3066,29 +3066,29 @@ void CodeBlock::setPCToCodeOriginMap(std::unique_ptr<PCToCodeOriginMap>&& map) > m_pcToCodeOriginMap = WTFMove(map); > } > >-std::optional<CodeOrigin> CodeBlock::findPC(void* pc) >+WTF::Optional<CodeOrigin> CodeBlock::findPC(void* pc) > { > if (m_pcToCodeOriginMap) { >- if (std::optional<CodeOrigin> codeOrigin = m_pcToCodeOriginMap->findPC(pc)) >+ if (WTF::Optional<CodeOrigin> codeOrigin = m_pcToCodeOriginMap->findPC(pc)) > return codeOrigin; > } > > for (auto iter = m_stubInfos.begin(); !!iter; ++iter) { > StructureStubInfo* stub = *iter; > if (stub->containsPC(pc)) >- return std::optional<CodeOrigin>(stub->codeOrigin); >+ return WTF::Optional<CodeOrigin>(stub->codeOrigin); > } > >- if (std::optional<CodeOrigin> codeOrigin = m_jitCode->findPC(this, pc)) >+ if (WTF::Optional<CodeOrigin> codeOrigin = m_jitCode->findPC(this, pc)) > return codeOrigin; > >- return std::nullopt; >+ return WTF::nullopt; > } > #endif // ENABLE(JIT) > >-std::optional<unsigned> CodeBlock::bytecodeOffsetFromCallSiteIndex(CallSiteIndex callSiteIndex) >+WTF::Optional<unsigned> CodeBlock::bytecodeOffsetFromCallSiteIndex(CallSiteIndex callSiteIndex) > { >- std::optional<unsigned> bytecodeOffset; >+ WTF::Optional<unsigned> bytecodeOffset; > JITCode::JITType jitType = this->jitType(); > if (jitType == JITCode::InterpreterThunk || jitType == JITCode::BaselineJIT) { > #if USE(JSVALUE64) >diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h >index e7c66e25340f86d6a0aa9b408a8ca6d447daac2b..246546774b99b996891021a6144c000e2d71b99f 100644 >--- a/Source/JavaScriptCore/bytecode/CodeBlock.h >+++ b/Source/JavaScriptCore/bytecode/CodeBlock.h >@@ -239,7 +239,7 @@ public: > void expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, > int& startOffset, int& endOffset, unsigned& line, unsigned& column) const; > >- std::optional<unsigned> bytecodeOffsetFromCallSiteIndex(CallSiteIndex); >+ WTF::Optional<unsigned> bytecodeOffsetFromCallSiteIndex(CallSiteIndex); > > void getICStatusMap(const ConcurrentJSLocker&, ICStatusMap& result); > void getICStatusMap(ICStatusMap& result); >@@ -851,7 +851,7 @@ public: > > #if ENABLE(JIT) > void setPCToCodeOriginMap(std::unique_ptr<PCToCodeOriginMap>&&); >- std::optional<CodeOrigin> findPC(void* pc); >+ WTF::Optional<CodeOrigin> findPC(void* pc); > #endif > > bool hasTailCalls() const { return m_unlinkedCode->hasTailCalls(); } >diff --git a/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp b/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp >index 6769ba03be6a9a223fcacc809c7c5cb9b66bfd46..7f22b66a50cb606430aed8f28ae7710d394239b8 100644 >--- a/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp >+++ b/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp >@@ -229,7 +229,7 @@ GetByIdStatus GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback( > std::unique_ptr<CallLinkStatus> callLinkStatus; > JSFunction* intrinsicFunction = nullptr; > FunctionPtr<OperationPtrTag> customAccessorGetter; >- std::optional<DOMAttributeAnnotation> domAttribute; >+ WTF::Optional<DOMAttributeAnnotation> domAttribute; > > switch (access.type()) { > case AccessCase::Load: >diff --git a/Source/JavaScriptCore/bytecode/GetByIdVariant.cpp b/Source/JavaScriptCore/bytecode/GetByIdVariant.cpp >index 8ae40e33cd955e137e3fdcc6ce54c020a007e11e..00bc507f308acf39e712923fccf9bba86ce51449 100644 >--- a/Source/JavaScriptCore/bytecode/GetByIdVariant.cpp >+++ b/Source/JavaScriptCore/bytecode/GetByIdVariant.cpp >@@ -38,7 +38,7 @@ GetByIdVariant::GetByIdVariant( > std::unique_ptr<CallLinkStatus> callLinkStatus, > JSFunction* intrinsicFunction, > FunctionPtr<OperationPtrTag> customAccessorGetter, >- std::optional<DOMAttributeAnnotation> domAttribute) >+ WTF::Optional<DOMAttributeAnnotation> domAttribute) > : m_structureSet(structureSet) > , m_conditionSet(conditionSet) > , m_offset(offset) >diff --git a/Source/JavaScriptCore/bytecode/GetByIdVariant.h b/Source/JavaScriptCore/bytecode/GetByIdVariant.h >index 02f107da4762ca304a74ad2e8cf591b026816dc5..4f5ac43c19348d6134705926ef1c1c7836b8498c 100644 >--- a/Source/JavaScriptCore/bytecode/GetByIdVariant.h >+++ b/Source/JavaScriptCore/bytecode/GetByIdVariant.h >@@ -47,7 +47,7 @@ public: > std::unique_ptr<CallLinkStatus> = nullptr, > JSFunction* = nullptr, > FunctionPtr<OperationPtrTag> customAccessorGetter = nullptr, >- std::optional<DOMAttributeAnnotation> = std::nullopt); >+ WTF::Optional<DOMAttributeAnnotation> = WTF::nullopt); > > ~GetByIdVariant(); > >@@ -67,7 +67,7 @@ public: > JSFunction* intrinsicFunction() const { return m_intrinsicFunction; } > Intrinsic intrinsic() const { return m_intrinsicFunction ? m_intrinsicFunction->intrinsic() : NoIntrinsic; } > FunctionPtr<OperationPtrTag> customAccessorGetter() const { return m_customAccessorGetter; } >- std::optional<DOMAttributeAnnotation> domAttribute() const { return m_domAttribute; } >+ WTF::Optional<DOMAttributeAnnotation> domAttribute() const { return m_domAttribute; } > > bool isPropertyUnset() const { return offset() == invalidOffset; } > >@@ -90,7 +90,7 @@ private: > std::unique_ptr<CallLinkStatus> m_callLinkStatus; > JSFunction* m_intrinsicFunction; > FunctionPtr<OperationPtrTag> m_customAccessorGetter; >- std::optional<DOMAttributeAnnotation> m_domAttribute; >+ WTF::Optional<DOMAttributeAnnotation> m_domAttribute; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp b/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp >index e7698f9bd3a522f6ee4659e6cb56f5405783f1ee..eb1cbcc1389568a2413b2cd8a3c8f28a01b17141 100644 >--- a/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp >+++ b/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp >@@ -52,7 +52,7 @@ GetterSetterAccessCase::GetterSetterAccessCase(VM& vm, JSCell* owner, AccessType > std::unique_ptr<AccessCase> GetterSetterAccessCase::create( > VM& vm, JSCell* owner, AccessType type, PropertyOffset offset, Structure* structure, const ObjectPropertyConditionSet& conditionSet, > bool viaProxy, WatchpointSet* additionalSet, FunctionPtr<OperationPtrTag> customGetter, JSObject* customSlotBase, >- std::optional<DOMAttributeAnnotation> domAttribute, std::unique_ptr<PolyProtoAccessChain> prototypeAccessChain) >+ WTF::Optional<DOMAttributeAnnotation> domAttribute, std::unique_ptr<PolyProtoAccessChain> prototypeAccessChain) > { > switch (type) { > case Getter: >diff --git a/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.h b/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.h >index e9bd55ee5ce4848b5958686eef2e5f3bfe32957d..80467de2de162c9ae6d480697f1859270a282457 100644 >--- a/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.h >+++ b/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.h >@@ -41,7 +41,7 @@ public: > // actually somewhat likely because of how we do buffering of new cases. > CallLinkInfo* callLinkInfo() const { return m_callLinkInfo.get(); } > JSObject* customSlotBase() const { return m_customSlotBase.get(); } >- std::optional<DOMAttributeAnnotation> domAttribute() const { return m_domAttribute; } >+ WTF::Optional<DOMAttributeAnnotation> domAttribute() const { return m_domAttribute; } > > bool hasAlternateBase() const override; > JSObject* alternateBase() const override; >@@ -51,7 +51,7 @@ public: > static std::unique_ptr<AccessCase> create( > VM&, JSCell* owner, AccessType, PropertyOffset, Structure*, > const ObjectPropertyConditionSet&, bool viaProxy, WatchpointSet* additionalSet, FunctionPtr<OperationPtrTag> customGetter, >- JSObject* customSlotBase, std::optional<DOMAttributeAnnotation>, std::unique_ptr<PolyProtoAccessChain>); >+ JSObject* customSlotBase, WTF::Optional<DOMAttributeAnnotation>, std::unique_ptr<PolyProtoAccessChain>); > > static std::unique_ptr<AccessCase> create(VM&, JSCell* owner, AccessType, Structure*, PropertyOffset, > const ObjectPropertyConditionSet&, std::unique_ptr<PolyProtoAccessChain>, >@@ -72,7 +72,7 @@ private: > WriteBarrier<JSObject> m_customSlotBase; > std::unique_ptr<CallLinkInfo> m_callLinkInfo; > FunctionPtr<OperationPtrTag> m_customAccessor; >- std::optional<DOMAttributeAnnotation> m_domAttribute; >+ WTF::Optional<DOMAttributeAnnotation> m_domAttribute; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >index 71b13748dee01a5d8d9699c9f6f81ce5ba3f1a27..db30411a72deb9755f5032e5e3ea68790a793615 100644 >--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >@@ -133,7 +133,7 @@ void UnlinkedFunctionExecutable::visitChildren(JSCell* cell, SlotVisitor& visito > visitor.append(thisObject->m_unlinkedCodeBlockForConstruct); > } > >-FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& passedParentSource, std::optional<int> overrideLineNumber, Intrinsic intrinsic) >+FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& passedParentSource, WTF::Optional<int> overrideLineNumber, Intrinsic intrinsic) > { > const SourceCode& parentSource = !m_isBuiltinDefaultClassConstructor ? passedParentSource : BuiltinExecutables::defaultConstructorSourceCode(constructorKind()); > unsigned firstLine = parentSource.firstLine().oneBasedInt() + m_firstLineOffset; >@@ -174,7 +174,7 @@ FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& p > > UnlinkedFunctionExecutable* UnlinkedFunctionExecutable::fromGlobalCode( > const Identifier& name, ExecState& exec, const SourceCode& source, >- JSObject*& exception, int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition) >+ JSObject*& exception, int overrideLineNumber, WTF::Optional<int> functionConstructorParametersEndPosition) > { > ParserError error; > VM& vm = exec.vm(); >diff --git a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >index 313d66609439d7bc00deb213164b29136cd62d16..5685f3470c682ce5e10fbfbd536b55732bf69c3c 100644 >--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >@@ -107,9 +107,9 @@ public: > > static UnlinkedFunctionExecutable* fromGlobalCode( > const Identifier&, ExecState&, const SourceCode&, JSObject*& exception, >- int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition); >+ int overrideLineNumber, WTF::Optional<int> functionConstructorParametersEndPosition); > >- JS_EXPORT_PRIVATE FunctionExecutable* link(VM&, const SourceCode& parentSource, std::optional<int> overrideLineNumber = std::nullopt, Intrinsic = NoIntrinsic); >+ JS_EXPORT_PRIVATE FunctionExecutable* link(VM&, const SourceCode& parentSource, WTF::Optional<int> overrideLineNumber = WTF::nullopt, Intrinsic = NoIntrinsic); > > void clearCode(VM& vm) > { >diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >index 5f69aba5dc9ea65a6421ee4f226e2b192b166a2e..71eff15247eb8f976da169f43b17e984a6fcaf1b 100644 >--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >@@ -4099,7 +4099,7 @@ RegisterID* BytecodeGenerator::emitGetTemplateObject(RegisterID* dst, TaggedTemp > ASSERT(string->raw()); > rawStrings.append(string->raw()->impl()); > if (!string->cooked()) >- cookedStrings.append(std::nullopt); >+ cookedStrings.append(WTF::nullopt); > else > cookedStrings.append(string->cooked()->impl()); > } >diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >index b39c14e26e3bfcc8d9721b6d447ab1c5555217ba..a293795d2df91fe253438cf7bfbdda110e420c8d 100644 >--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >@@ -564,7 +564,7 @@ namespace JSC { > RegisterID* emitNodeForProperty(RegisterID* dst, ExpressionNode* node) > { > if (node->isString()) { >- if (std::optional<uint32_t> index = parseIndex(static_cast<StringNode*>(node)->value())) >+ if (WTF::Optional<uint32_t> index = parseIndex(static_cast<StringNode*>(node)->value())) > return emitLoad(dst, jsNumber(index.value())); > } > return emitNode(dst, node); >@@ -1222,7 +1222,7 @@ namespace JSC { > Vector<LexicalScopeStackEntry> m_lexicalScopeStack; > > Vector<TDZMap> m_TDZStack; >- std::optional<size_t> m_varScopeLexicalScopeStackIndex; >+ WTF::Optional<size_t> m_varScopeLexicalScopeStackIndex; > void pushTDZVariables(const VariableEnvironment&, TDZCheckOptimization, TDZRequirement); > > ScopeNode* const m_scopeNode; >diff --git a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >index 23a14b9673046c92f4488e64dad430f20f1571f6..ca86c8147a7ab0d1963691e6e92332717f1a33a3 100644 >--- a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >+++ b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >@@ -694,7 +694,7 @@ void PropertyListNode::emitPutConstantProperty(BytecodeGenerator& generator, Reg > return; > } > if (const auto* identifier = node.name()) { >- std::optional<uint32_t> optionalIndex = parseIndex(*identifier); >+ WTF::Optional<uint32_t> optionalIndex = parseIndex(*identifier); > if (!optionalIndex) { > generator.emitDirectPutById(newObj, *identifier, value.get(), node.putType()); > return; >@@ -2089,7 +2089,7 @@ RegisterID* BinaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* > OpcodeID opcodeID = this->opcodeID(); > > if (opcodeID == op_less || opcodeID == op_lesseq || opcodeID == op_greater || opcodeID == op_greatereq) { >- auto isUInt32 = [&] (ExpressionNode* node) -> std::optional<UInt32Result> { >+ auto isUInt32 = [&] (ExpressionNode* node) -> WTF::Optional<UInt32Result> { > if (node->isBinaryOpNode() && static_cast<BinaryOpNode*>(node)->opcodeID() == op_urshift) > return UInt32Result::UInt32; > if (node->isNumber() && static_cast<NumberNode*>(node)->isIntegerNode()) { >@@ -2097,7 +2097,7 @@ RegisterID* BinaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* > if (value.isInt32() && value.asInt32() >= 0) > return UInt32Result::Constant; > } >- return std::nullopt; >+ return WTF::nullopt; > }; > auto leftResult = isUInt32(m_expr1); > auto rightResult = isUInt32(m_expr2); >@@ -4304,7 +4304,7 @@ void ObjectPatternNode::bindValue(BytecodeGenerator& generator, RegisterID* rhs) > RefPtr<RegisterID> temp = generator.newTemporary(); > RefPtr<RegisterID> propertyName; > if (!target.propertyExpression) { >- std::optional<uint32_t> optionalIndex = parseIndex(target.propertyName); >+ WTF::Optional<uint32_t> optionalIndex = parseIndex(target.propertyName); > if (!optionalIndex) > generator.emitGetById(temp.get(), rhs, target.propertyName); > else { >diff --git a/Source/JavaScriptCore/debugger/Debugger.cpp b/Source/JavaScriptCore/debugger/Debugger.cpp >index c59071d187199db811601b0142fe37e8274dcda0..bd4f4e2efcae0cb8e7d9827d7536ad4f53cc6a4a 100644 >--- a/Source/JavaScriptCore/debugger/Debugger.cpp >+++ b/Source/JavaScriptCore/debugger/Debugger.cpp >@@ -364,7 +364,7 @@ void Debugger::resolveBreakpoint(Breakpoint& breakpoint, SourceProvider* sourceP > unsigned column = breakpoint.column ? breakpoint.column : Breakpoint::unspecifiedColumn; > > DebuggerParseData& parseData = debuggerParseData(breakpoint.sourceID, sourceProvider); >- std::optional<JSTextPosition> resolvedPosition = parseData.pausePositions.breakpointLocationForLineColumn((int)line, (int)column); >+ WTF::Optional<JSTextPosition> resolvedPosition = parseData.pausePositions.breakpointLocationForLineColumn((int)line, (int)column); > if (!resolvedPosition) > return; > >diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp >index a9f639c4f88af4c71ce1c93b6fab01809a1057bd..a048f888479a0f094e2cf33282948eaa155c4cb2 100644 >--- a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp >+++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp >@@ -293,7 +293,7 @@ TextPosition DebuggerCallFrame::currentPosition(VM& vm) > > if (isTailDeleted()) { > CodeBlock* codeBlock = m_shadowChickenFrame.codeBlock; >- if (std::optional<unsigned> bytecodeOffset = codeBlock->bytecodeOffsetFromCallSiteIndex(m_shadowChickenFrame.callSiteIndex)) { >+ if (WTF::Optional<unsigned> bytecodeOffset = codeBlock->bytecodeOffsetFromCallSiteIndex(m_shadowChickenFrame.callSiteIndex)) { > return TextPosition(OrdinalNumber::fromOneBasedInt(codeBlock->lineNumberForBytecodeOffset(*bytecodeOffset)), > OrdinalNumber::fromOneBasedInt(codeBlock->columnNumberForBytecodeOffset(*bytecodeOffset))); > } >diff --git a/Source/JavaScriptCore/debugger/DebuggerParseData.cpp b/Source/JavaScriptCore/debugger/DebuggerParseData.cpp >index 48f939f10fdaca1c77574b1bd8860b8e71f07a98..2abb5f0ab2d954c805f548cf60531bf51af27d05 100644 >--- a/Source/JavaScriptCore/debugger/DebuggerParseData.cpp >+++ b/Source/JavaScriptCore/debugger/DebuggerParseData.cpp >@@ -30,7 +30,7 @@ > > namespace JSC { > >-std::optional<JSTextPosition> DebuggerPausePositions::breakpointLocationForLineColumn(int line, int column) >+WTF::Optional<JSTextPosition> DebuggerPausePositions::breakpointLocationForLineColumn(int line, int column) > { > unsigned start = 0; > unsigned end = m_positions.size(); >@@ -54,7 +54,7 @@ std::optional<JSTextPosition> DebuggerPausePositions::breakpointLocationForLineC > // We are guarenteed to have a Leave for an Entry so we don't need to bounds check. > while (true) { > if (pausePosition.type != DebuggerPausePositionType::Enter) >- return std::optional<JSTextPosition>(pausePosition.position); >+ return WTF::Optional<JSTextPosition>(pausePosition.position); > pausePosition = m_positions[middle++]; > } > } >@@ -67,7 +67,7 @@ std::optional<JSTextPosition> DebuggerPausePositions::breakpointLocationForLineC > > // Past the end, no possible pause locations. > if (start >= m_positions.size()) >- return std::nullopt; >+ return WTF::nullopt; > > // If the next location is a function Entry we will need to decide if we should go into > // the function or go past the function. We decide to go into the function if the >@@ -87,7 +87,7 @@ std::optional<JSTextPosition> DebuggerPausePositions::breakpointLocationForLineC > // Valid pause location. Use it. > DebuggerPausePosition& firstSlidePosition = m_positions[start]; > if (firstSlidePosition.type != DebuggerPausePositionType::Enter) >- return std::optional<JSTextPosition>(firstSlidePosition.position); >+ return WTF::Optional<JSTextPosition>(firstSlidePosition.position); > > // Determine if we should enter this function or skip past it. > // If entryStackSize is > 0 we are skipping functions. >@@ -113,11 +113,11 @@ std::optional<JSTextPosition> DebuggerPausePositions::breakpointLocationForLineC > } > > // Found pause position. >- return std::optional<JSTextPosition>(slidePosition.position); >+ return WTF::Optional<JSTextPosition>(slidePosition.position); > } > > // No pause positions found. >- return std::nullopt; >+ return WTF::nullopt; > } > > void DebuggerPausePositions::sort() >diff --git a/Source/JavaScriptCore/debugger/DebuggerParseData.h b/Source/JavaScriptCore/debugger/DebuggerParseData.h >index ecc78d0d4bfdd23e614bb617e4f25e333e241193..1729c704300e3514fea2c16b2c66f9f6986921ff 100644 >--- a/Source/JavaScriptCore/debugger/DebuggerParseData.h >+++ b/Source/JavaScriptCore/debugger/DebuggerParseData.h >@@ -60,7 +60,7 @@ public: > m_positions.append({ DebuggerPausePositionType::Leave, position }); > } > >- std::optional<JSTextPosition> breakpointLocationForLineColumn(int line, int column); >+ WTF::Optional<JSTextPosition> breakpointLocationForLineColumn(int line, int column); > > void sort(); > >diff --git a/Source/JavaScriptCore/debugger/ScriptProfilingScope.h b/Source/JavaScriptCore/debugger/ScriptProfilingScope.h >index c4bee4d1620a86e070a88b28de01c426b4ac2edf..e7f94f8c95d25b8da58b2cfa42b4cbdfe3cf5fd7 100644 >--- a/Source/JavaScriptCore/debugger/ScriptProfilingScope.h >+++ b/Source/JavaScriptCore/debugger/ScriptProfilingScope.h >@@ -83,7 +83,7 @@ private: > } > > JSGlobalObject* m_globalObject { nullptr }; >- std::optional<Seconds> m_startTime; >+ WTF::Optional<Seconds> m_startTime; > ProfilingReason m_reason; > }; > >diff --git a/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h b/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h >index 5f5eccc330c22be8bd91e1b4cd7b759714a0dd67..b8b666710c77e2308b3f9335055198607ac34b35 100644 >--- a/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h >+++ b/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h >@@ -553,7 +553,7 @@ bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi > > case DoubleRep: { > JSValue child = forNode(node->child1()).value(); >- if (std::optional<double> number = child.toNumberFromPrimitive()) { >+ if (WTF::Optional<double> number = child.toNumberFromPrimitive()) { > setConstant(node, jsDoubleNumber(*number)); > break; > } >@@ -678,7 +678,7 @@ bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi > > case ArithClz32: { > JSValue operand = forNode(node->child1()).value(); >- if (std::optional<double> number = operand.toNumberFromPrimitive()) { >+ if (WTF::Optional<double> number = operand.toNumberFromPrimitive()) { > switch (node->child1().useKind()) { > case Int32Use: > case KnownInt32Use: >@@ -706,7 +706,7 @@ bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi > case MakeRope: { > unsigned numberOfChildren = 0; > unsigned numberOfRemovedChildren = 0; >- std::optional<unsigned> nonEmptyIndex; >+ WTF::Optional<unsigned> nonEmptyIndex; > for (unsigned i = 0; i < AdjacencyList::Size; ++i) { > Edge& edge = node->children.child(i); > if (!edge) >@@ -1054,7 +1054,7 @@ bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi > JSValue child = forNode(node->child1()).value(); > switch (node->child1().useKind()) { > case Int32Use: >- if (std::optional<double> number = child.toNumberFromPrimitive()) { >+ if (WTF::Optional<double> number = child.toNumberFromPrimitive()) { > JSValue result = jsNumber(fabs(*number)); > if (result.isInt32()) { > setConstant(node, result); >@@ -1064,7 +1064,7 @@ bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi > setNonCellTypeForNode(node, SpecInt32Only); > break; > case DoubleRepUse: >- if (std::optional<double> number = child.toNumberFromPrimitive()) { >+ if (WTF::Optional<double> number = child.toNumberFromPrimitive()) { > setConstant(node, jsDoubleNumber(fabs(*number))); > break; > } >@@ -1107,7 +1107,7 @@ bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi > case ArithCeil: > case ArithTrunc: { > JSValue operand = forNode(node->child1()).value(); >- if (std::optional<double> number = operand.toNumberFromPrimitive()) { >+ if (WTF::Optional<double> number = operand.toNumberFromPrimitive()) { > if (node->child1().useKind() != DoubleRepUse) > didFoldClobberWorld(); > >@@ -1187,7 +1187,7 @@ bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi > > case MapHash: { > if (JSValue key = forNode(node->child1()).value()) { >- if (std::optional<uint32_t> hash = concurrentJSMapHash(key)) { >+ if (WTF::Optional<uint32_t> hash = concurrentJSMapHash(key)) { > // Although C++ code uses uint32_t for the hash, the closest type in DFG IR is Int32 > // and that's what MapHash returns. So, we have to cast to int32_t to avoid large > // unsigned values becoming doubles. This casting between signed and unsigned >@@ -4114,7 +4114,7 @@ template<typename AbstractStateType> > void AbstractInterpreter<AbstractStateType>::executeDoubleUnaryOpEffects(Node* node, double(*equivalentFunction)(double)) > { > JSValue child = forNode(node->child1()).value(); >- if (std::optional<double> number = child.toNumberFromPrimitive()) { >+ if (WTF::Optional<double> number = child.toNumberFromPrimitive()) { > if (node->child1().useKind() != DoubleRepUse) > didFoldClobberWorld(); > setConstant(node, jsDoubleNumber(equivalentFunction(*number))); >diff --git a/Source/JavaScriptCore/dfg/DFGGraph.h b/Source/JavaScriptCore/dfg/DFGGraph.h >index e5b1e2ab62ef9ab5ea6a7b5dd4a81de76408d8df..18bb4501fc3e5c7a029e334a64352b84c254e5ec 100644 >--- a/Source/JavaScriptCore/dfg/DFGGraph.h >+++ b/Source/JavaScriptCore/dfg/DFGGraph.h >@@ -1096,7 +1096,7 @@ public: > bool m_hasDebuggerEnabled; > bool m_hasExceptionHandlers { false }; > bool m_isInSSAConversion { false }; >- std::optional<uint32_t> m_maxLocalsForCatchOSREntry; >+ WTF::Optional<uint32_t> m_maxLocalsForCatchOSREntry; > std::unique_ptr<FlowIndexing> m_indexingCache; > std::unique_ptr<FlowMap<AbstractValue>> m_abstractValuesCache; > Bag<EntrySwitchData> m_entrySwitchData; >diff --git a/Source/JavaScriptCore/dfg/DFGJITCode.cpp b/Source/JavaScriptCore/dfg/DFGJITCode.cpp >index 4798d8fb82a20bd4991ed7fc99541a7391ee3871..ea418899dd8aa8183990dc706bfbe814e65a4ff9 100644 >--- a/Source/JavaScriptCore/dfg/DFGJITCode.cpp >+++ b/Source/JavaScriptCore/dfg/DFGJITCode.cpp >@@ -225,16 +225,16 @@ void JITCode::validateReferences(const TrackedReferences& trackedReferences) > minifiedDFG.validateReferences(trackedReferences); > } > >-std::optional<CodeOrigin> JITCode::findPC(CodeBlock*, void* pc) >+WTF::Optional<CodeOrigin> JITCode::findPC(CodeBlock*, void* pc) > { > for (OSRExit& exit : osrExit) { > if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) { > if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr()) >- return std::optional<CodeOrigin>(exit.m_codeOriginForExitProfile); >+ return WTF::Optional<CodeOrigin>(exit.m_codeOriginForExitProfile); > } > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > void JITCode::finalizeOSREntrypoints() >diff --git a/Source/JavaScriptCore/dfg/DFGJITCode.h b/Source/JavaScriptCore/dfg/DFGJITCode.h >index 0e4a68d092a1c65e5de6f77dc7b95ebd3703f3ae..216257b9170027bdc1d68fc5add241d20cd09f0e 100644 >--- a/Source/JavaScriptCore/dfg/DFGJITCode.h >+++ b/Source/JavaScriptCore/dfg/DFGJITCode.h >@@ -126,7 +126,7 @@ public: > > static ptrdiff_t commonDataOffset() { return OBJECT_OFFSETOF(JITCode, common); } > >- std::optional<CodeOrigin> findPC(CodeBlock*, void* pc) override; >+ WTF::Optional<CodeOrigin> findPC(CodeBlock*, void* pc) override; > > private: > friend class JITCompiler; // Allow JITCompiler to call setCodeRef(). >diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp >index b75fcdfb975d91eca2e38fdfc6ed05db0c7cbc3b..1e66f1066b6735c61615437eb3baec85d4d0b9a8 100644 >--- a/Source/JavaScriptCore/dfg/DFGOperations.cpp >+++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp >@@ -142,7 +142,7 @@ ALWAYS_INLINE static void putByValInternal(ExecState* exec, VM& vm, EncodedJSVal > if (direct) { > RELEASE_ASSERT(baseValue.isObject()); > JSObject* baseObject = asObject(baseValue); >- if (std::optional<uint32_t> index = parseIndex(propertyName)) { >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) { > scope.release(); > baseObject->putDirectIndex(exec, index.value(), value, 0, strict ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); > return; >@@ -162,7 +162,7 @@ ALWAYS_INLINE static void putByValCellInternal(ExecState* exec, VM& vm, JSCell* > if (direct) { > RELEASE_ASSERT(base->isObject()); > JSObject* baseObject = asObject(base); >- if (std::optional<uint32_t> index = parseIndex(propertyName)) { >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) { > baseObject->putDirectIndex(exec, index.value(), value, 0, strict ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); > return; > } >@@ -1667,7 +1667,7 @@ char* JIT_OPERATION operationNewInt8ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSInt8Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSInt8Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewInt16ArrayWithSize( >@@ -1681,7 +1681,7 @@ char* JIT_OPERATION operationNewInt16ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSInt16Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSInt16Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewInt32ArrayWithSize( >@@ -1695,7 +1695,7 @@ char* JIT_OPERATION operationNewInt32ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSInt32Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSInt32Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewUint8ArrayWithSize( >@@ -1709,7 +1709,7 @@ char* JIT_OPERATION operationNewUint8ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint8Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint8Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewUint8ClampedArrayWithSize( >@@ -1723,7 +1723,7 @@ char* JIT_OPERATION operationNewUint8ClampedArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint8ClampedArray>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint8ClampedArray>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewUint16ArrayWithSize( >@@ -1737,7 +1737,7 @@ char* JIT_OPERATION operationNewUint16ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint16Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint16Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewUint32ArrayWithSize( >@@ -1751,7 +1751,7 @@ char* JIT_OPERATION operationNewUint32ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint32Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSUint32Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewFloat32ArrayWithSize( >@@ -1765,7 +1765,7 @@ char* JIT_OPERATION operationNewFloat32ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSFloat32Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSFloat32Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > char* JIT_OPERATION operationNewFloat64ArrayWithSize( >@@ -1779,7 +1779,7 @@ char* JIT_OPERATION operationNewFloat64ArrayWithOneArgument( > { > VM& vm = exec->vm(); > NativeCallFrameTracer tracer(&vm, exec); >- return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSFloat64Array>(exec, structure, encodedValue, 0, std::nullopt)); >+ return reinterpret_cast<char*>(constructGenericTypedArrayViewWithArguments<JSFloat64Array>(exec, structure, encodedValue, 0, WTF::nullopt)); > } > > JSCell* JIT_OPERATION operationCreateActivationDirect(ExecState* exec, Structure* structure, JSScope* scope, SymbolTable* table, EncodedJSValue initialValueEncoded) >diff --git a/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h b/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h >index 4ca87074c1f8280ffeac7769394a40f52eaa8f00..73ca84828976cc9b598669dcfaa81f1d60b1ad85 100644 >--- a/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h >+++ b/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h >@@ -51,7 +51,7 @@ public: > jit->m_outOfLineStreamIndex = m_streamIndex; > jit->m_origin = m_origin; > generateInternal(jit); >- jit->m_outOfLineStreamIndex = std::nullopt; >+ jit->m_outOfLineStreamIndex = WTF::nullopt; > if (!ASSERT_DISABLED) > jit->m_jit.abortWithReason(DFGSlowPathGeneratorFellThrough); > } >diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp >index fe3d6862e2f40ab7d74fbb6bb65baf8533459c47..d218f51b5e806665ffcad39040b7985dfc83bdb4 100644 >--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp >+++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp >@@ -405,7 +405,7 @@ void SpeculativeJIT::runSlowPathGenerators(PCToCodeOriginMapBuilder& pcToCodeOri > m_outOfLineStreamIndex = slowPathLambda.streamIndex; > pcToCodeOriginMapBuilder.appendItem(m_jit.labelIgnoringWatchpoints(), currentNode->origin.semantic); > slowPathLambda.generator(); >- m_outOfLineStreamIndex = std::nullopt; >+ m_outOfLineStreamIndex = WTF::nullopt; > } > } > >@@ -3561,8 +3561,8 @@ void SpeculativeJIT::emitUntypedBitOp(Node* node) > return; > } > >- std::optional<JSValueOperand> left; >- std::optional<JSValueOperand> right; >+ WTF::Optional<JSValueOperand> left; >+ WTF::Optional<JSValueOperand> right; > > JSValueRegs leftRegs; > JSValueRegs rightRegs; >@@ -3743,8 +3743,8 @@ void SpeculativeJIT::emitUntypedRightShiftBitOp(Node* node) > return; > } > >- std::optional<JSValueOperand> left; >- std::optional<JSValueOperand> right; >+ WTF::Optional<JSValueOperand> left; >+ WTF::Optional<JSValueOperand> right; > > JSValueRegs leftRegs; > JSValueRegs rightRegs; >@@ -3966,8 +3966,8 @@ void SpeculativeJIT::compileMathIC(Node* node, JITBinaryMathIC<Generator>* mathI > Edge& leftChild = node->child1(); > Edge& rightChild = node->child2(); > >- std::optional<JSValueOperand> left; >- std::optional<JSValueOperand> right; >+ WTF::Optional<JSValueOperand> left; >+ WTF::Optional<JSValueOperand> right; > > JSValueRegs leftRegs; > JSValueRegs rightRegs; >@@ -3980,14 +3980,14 @@ void SpeculativeJIT::compileMathIC(Node* node, JITBinaryMathIC<Generator>* mathI > GPRReg scratchGPR = InvalidGPRReg; > FPRReg scratchFPR = InvalidFPRReg; > >- std::optional<FPRTemporary> fprScratch; >+ WTF::Optional<FPRTemporary> fprScratch; > if (needsScratchFPRReg) { > fprScratch.emplace(this); > scratchFPR = fprScratch->fpr(); > } > > #if USE(JSVALUE64) >- std::optional<GPRTemporary> gprScratch; >+ WTF::Optional<GPRTemporary> gprScratch; > if (needsScratchGPRReg) { > gprScratch.emplace(this); > scratchGPR = gprScratch->gpr(); >@@ -4696,7 +4696,7 @@ template <typename Generator, typename RepatchingFunction, typename NonRepatchin > void SpeculativeJIT::compileMathIC(Node* node, JITUnaryMathIC<Generator>* mathIC, bool needsScratchGPRReg, RepatchingFunction repatchingFunction, NonRepatchingFunction nonRepatchingFunction) > { > GPRReg scratchGPR = InvalidGPRReg; >- std::optional<GPRTemporary> gprScratch; >+ WTF::Optional<GPRTemporary> gprScratch; > if (needsScratchGPRReg) { > gprScratch.emplace(this); > scratchGPR = gprScratch->gpr(); >@@ -5021,8 +5021,8 @@ void SpeculativeJIT::compileValueDiv(Node* node) > return; > } > >- std::optional<JSValueOperand> left; >- std::optional<JSValueOperand> right; >+ WTF::Optional<JSValueOperand> left; >+ WTF::Optional<JSValueOperand> right; > > JSValueRegs leftRegs; > JSValueRegs rightRegs; >@@ -9314,7 +9314,7 @@ void SpeculativeJIT::compileCallDOMGetter(Node* node) > SpeculateCellOperand base(this, baseEdge); > regs.append(SnippetParams::Value(base.gpr(), m_state.forNode(baseEdge).value())); > >- std::optional<SpeculateCellOperand> globalObject; >+ WTF::Optional<SpeculateCellOperand> globalObject; > if (snippet->requireGlobalObject) { > Edge& globalObjectEdge = node->child2(); > globalObject.emplace(this, globalObjectEdge); >diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h >index 438b114c9de65035f049e8f3e5bf555ca8396350..d5263794d66e9c54a0ff2bead3cd6e1cf0db66df 100644 >--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h >+++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h >@@ -1735,7 +1735,7 @@ public: > }; > Vector<SlowPathLambda> m_slowPathLambdas; > Vector<SilentRegisterSavePlan> m_plans; >- std::optional<unsigned> m_outOfLineStreamIndex; >+ WTF::Optional<unsigned> m_outOfLineStreamIndex; > }; > > >diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp >index 952f89158d4cc30bc768beef79c8db7b3dfdf659..7cd56c069b1cfe8b803467e8f5f6634b321fe6a6 100644 >--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp >+++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp >@@ -3827,8 +3827,8 @@ void SpeculativeJIT::compile(Node* node) > GPRTemporary structureID(this); > GPRTemporary result(this); > >- std::optional<SpeculateCellOperand> keyAsCell; >- std::optional<JSValueOperand> keyAsValue; >+ WTF::Optional<SpeculateCellOperand> keyAsCell; >+ WTF::Optional<JSValueOperand> keyAsValue; > JSValueRegs keyRegs; > if (node->child2().useKind() == UntypedUse) { > keyAsValue.emplace(this, node->child2()); >diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp >index 18ae7d81ba92ae1dbd4c852eb084f9778f66d0fb..662395b4b9629ba757de65d864c9bf1535a6d66d 100644 >--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp >+++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp >@@ -1702,7 +1702,7 @@ void SpeculativeJIT::compileLogicalNot(Node* node) > > bool shouldCheckMasqueradesAsUndefined = !masqueradesAsUndefinedWatchpointIsStillValid(); > JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic); >- std::optional<GPRTemporary> scratch; >+ WTF::Optional<GPRTemporary> scratch; > GPRReg scratchGPR = InvalidGPRReg; > if (shouldCheckMasqueradesAsUndefined) { > scratch.emplace(this); >@@ -1856,7 +1856,7 @@ void SpeculativeJIT::emitBranch(Node* node) > GPRTemporary result(this); > FPRTemporary fprValue(this); > FPRTemporary fprTemp(this); >- std::optional<GPRTemporary> scratch; >+ WTF::Optional<GPRTemporary> scratch; > > GPRReg scratchGPR = InvalidGPRReg; > bool shouldCheckMasqueradesAsUndefined = !masqueradesAsUndefinedWatchpointIsStillValid(); >@@ -2872,7 +2872,7 @@ void SpeculativeJIT::compile(Node* node) > // We are in generic mode! > JSValueOperand base(this, baseEdge); > JSValueOperand index(this, indexEdge); >- std::optional<JSValueOperand> args[2]; >+ WTF::Optional<JSValueOperand> args[2]; > baseGPR = base.gpr(); > indexGPR = index.gpr(); > for (unsigned i = numExtraArgs; i--;) { >@@ -3582,7 +3582,7 @@ void SpeculativeJIT::compile(Node* node) > GPRReg cellGPR = cell.gpr(); > > GPRReg tempGPR = InvalidGPRReg; >- std::optional<GPRTemporary> temp; >+ WTF::Optional<GPRTemporary> temp; > if (node->structureSet().size() > 1) { > temp.emplace(this); > tempGPR = temp->gpr(); >@@ -3955,7 +3955,7 @@ void SpeculativeJIT::compile(Node* node) > case StringUse: { > SpeculateCellOperand input(this, node->child1()); > GPRTemporary result(this); >- std::optional<GPRTemporary> temp; >+ WTF::Optional<GPRTemporary> temp; > > GPRReg tempGPR = InvalidGPRReg; > if (node->child1().useKind() == CellUse) { >@@ -4361,8 +4361,8 @@ void SpeculativeJIT::compile(Node* node) > GPRTemporary structureID(this); > GPRTemporary result(this); > >- std::optional<SpeculateCellOperand> keyAsCell; >- std::optional<JSValueOperand> keyAsValue; >+ WTF::Optional<SpeculateCellOperand> keyAsCell; >+ WTF::Optional<JSValueOperand> keyAsValue; > GPRReg keyGPR; > if (node->child2().useKind() == UntypedUse) { > keyAsValue.emplace(this, node->child2()); >@@ -4596,7 +4596,7 @@ void SpeculativeJIT::compile(Node* node) > GPRTemporary temp2(this); > GPRReg t2 = temp2.gpr(); > >- std::optional<SpeculateBooleanOperand> isLittleEndianOperand; >+ WTF::Optional<SpeculateBooleanOperand> isLittleEndianOperand; > if (node->child3()) > isLittleEndianOperand.emplace(this, node->child3()); > GPRReg isLittleEndianGPR = isLittleEndianOperand ? isLittleEndianOperand->gpr() : InvalidGPRReg; >@@ -4755,10 +4755,10 @@ void SpeculativeJIT::compile(Node* node) > SpeculateInt32Operand index(this, m_graph.varArgChild(node, 1)); > GPRReg indexGPR = index.gpr(); > >- std::optional<SpeculateStrictInt52Operand> int52Value; >- std::optional<SpeculateDoubleOperand> doubleValue; >- std::optional<SpeculateInt32Operand> int32Value; >- std::optional<FPRTemporary> fprTemporary; >+ WTF::Optional<SpeculateStrictInt52Operand> int52Value; >+ WTF::Optional<SpeculateDoubleOperand> doubleValue; >+ WTF::Optional<SpeculateInt32Operand> int32Value; >+ WTF::Optional<FPRTemporary> fprTemporary; > GPRReg valueGPR = InvalidGPRReg; > FPRReg valueFPR = InvalidFPRReg; > FPRReg tempFPR = InvalidFPRReg; >@@ -4794,7 +4794,7 @@ void SpeculativeJIT::compile(Node* node) > GPRTemporary temp3(this); > GPRReg t3 = temp3.gpr(); > >- std::optional<SpeculateBooleanOperand> isLittleEndianOperand; >+ WTF::Optional<SpeculateBooleanOperand> isLittleEndianOperand; > if (m_graph.varArgChild(node, 3)) > isLittleEndianOperand.emplace(this, m_graph.varArgChild(node, 3)); > GPRReg isLittleEndianGPR = isLittleEndianOperand ? isLittleEndianOperand->gpr() : InvalidGPRReg; >diff --git a/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp b/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp >index 90316057ecf789f8f4d2c180eee36a1fb960df27..1b373e3af6272710ce9a8a5fe20f4bb505529ee6 100644 >--- a/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp >+++ b/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp >@@ -204,7 +204,7 @@ private: > if (m_node->isBinaryUseKind(DoubleRepUse) > && m_node->child2()->isNumberConstant()) { > >- if (std::optional<double> reciprocal = safeReciprocalForDivByConst(m_node->child2()->asNumber())) { >+ if (WTF::Optional<double> reciprocal = safeReciprocalForDivByConst(m_node->child2()->asNumber())) { > Node* reciprocalNode = m_insertionSet.insertConstant(m_nodeIndex, m_node->origin, jsDoubleNumber(*reciprocal), DoubleConstant); > m_node->setOp(ArithMul); > m_node->child2() = Edge(reciprocalNode, DoubleRepUse); >diff --git a/Source/JavaScriptCore/ftl/FTLJITCode.cpp b/Source/JavaScriptCore/ftl/FTLJITCode.cpp >index a2278a8cf76e43cc77c533ea8c9b7bf4ff8a30fc..8345e1e8adf7fab7770d333e73fbaae69e23f93f 100644 >--- a/Source/JavaScriptCore/ftl/FTLJITCode.cpp >+++ b/Source/JavaScriptCore/ftl/FTLJITCode.cpp >@@ -151,23 +151,23 @@ RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBloc > return { }; > } > >-std::optional<CodeOrigin> JITCode::findPC(CodeBlock* codeBlock, void* pc) >+WTF::Optional<CodeOrigin> JITCode::findPC(CodeBlock* codeBlock, void* pc) > { > for (OSRExit& exit : osrExit) { > if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) { > if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr()) >- return std::optional<CodeOrigin>(exit.m_codeOriginForExitProfile); >+ return WTF::Optional<CodeOrigin>(exit.m_codeOriginForExitProfile); > } > } > > for (std::unique_ptr<LazySlowPath>& lazySlowPath : lazySlowPaths) { > if (ExecutableMemoryHandle* handle = lazySlowPath->stub().executableMemory()) { > if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr()) >- return std::optional<CodeOrigin>(codeBlock->codeOrigin(lazySlowPath->callSiteIndex())); >+ return WTF::Optional<CodeOrigin>(codeBlock->codeOrigin(lazySlowPath->callSiteIndex())); > } > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > } } // namespace JSC::FTL >diff --git a/Source/JavaScriptCore/ftl/FTLJITCode.h b/Source/JavaScriptCore/ftl/FTLJITCode.h >index 98280053830504c7fbca848eeca3faebc90626ce..14009610512e12128e7b33ecb2149dacea83f9af 100644 >--- a/Source/JavaScriptCore/ftl/FTLJITCode.h >+++ b/Source/JavaScriptCore/ftl/FTLJITCode.h >@@ -60,7 +60,7 @@ public: > > RegisterSet liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock*, CallSiteIndex) override; > >- std::optional<CodeOrigin> findPC(CodeBlock*, void* pc) override; >+ WTF::Optional<CodeOrigin> findPC(CodeBlock*, void* pc) override; > > CodeRef<JSEntryPtrTag> b3Code() const { return m_b3Code; } > >diff --git a/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp b/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp >index 185876b83716dbf352629eadfb6184658dd0f3e8..dc86b99eac4733126f3bee4e26a00b26f86e0dc0 100644 >--- a/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp >+++ b/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp >@@ -13404,8 +13404,8 @@ private: > > LBasicBlock lastNext = m_out.insertNewBlocksBefore(fastCase); > >- std::optional<unsigned> staticVectorLength; >- std::optional<unsigned> staticVectorLengthFromPublicLength; >+ WTF::Optional<unsigned> staticVectorLength; >+ WTF::Optional<unsigned> staticVectorLengthFromPublicLength; > if (structure->hasIntPtr()) { > if (publicLength->hasInt32()) { > unsigned publicLengthConst = static_cast<unsigned>(publicLength->asInt32()); >diff --git a/Source/JavaScriptCore/heap/GCRequest.h b/Source/JavaScriptCore/heap/GCRequest.h >index 2e81c02aaf504f5a2e87f7f19f7c5997e98a4c1b..98a700aaae8e70417b5b71d1a6563e3ebe3a702b 100644 >--- a/Source/JavaScriptCore/heap/GCRequest.h >+++ b/Source/JavaScriptCore/heap/GCRequest.h >@@ -41,7 +41,7 @@ struct GCRequest { > { > } > >- GCRequest(std::optional<CollectionScope> scope) >+ GCRequest(WTF::Optional<CollectionScope> scope) > : scope(scope) > { > } >@@ -50,7 +50,7 @@ struct GCRequest { > > void dump(PrintStream&) const; > >- std::optional<CollectionScope> scope; >+ WTF::Optional<CollectionScope> scope; > RefPtr<SharedTask<void()>> didFinishEndPhase; > }; > >diff --git a/Source/JavaScriptCore/heap/Heap.cpp b/Source/JavaScriptCore/heap/Heap.cpp >index 6b0f319388648cd295b6f11c573ab73844219787..4d1af555943ca280fc2763c8dd9a58e6239ac64a 100644 >--- a/Source/JavaScriptCore/heap/Heap.cpp >+++ b/Source/JavaScriptCore/heap/Heap.cpp >@@ -190,7 +190,7 @@ SimpleStats& timingStats(const char* name, CollectionScope scope) > > class TimingScope { > public: >- TimingScope(std::optional<CollectionScope> scope, const char* name) >+ TimingScope(WTF::Optional<CollectionScope> scope, const char* name) > : m_scope(scope) > , m_name(name) > { >@@ -203,7 +203,7 @@ public: > { > } > >- void setScope(std::optional<CollectionScope> scope) >+ void setScope(WTF::Optional<CollectionScope> scope) > { > m_scope = scope; > } >@@ -224,7 +224,7 @@ public: > } > } > private: >- std::optional<CollectionScope> m_scope; >+ WTF::Optional<CollectionScope> m_scope; > MonotonicTime m_before; > const char* m_name; > }; >@@ -2313,7 +2313,7 @@ void Heap::didFinishCollection() > > RELEASE_ASSERT(m_collectionScope); > m_lastCollectionScope = m_collectionScope; >- m_collectionScope = std::nullopt; >+ m_collectionScope = WTF::nullopt; > > for (auto* observer : m_observers) > observer->didGarbageCollect(scope); >@@ -2822,7 +2822,7 @@ void Heap::notifyIsSafeToCollect() > { > LockHolder locker(*m_threadLock); > if (m_requests.isEmpty()) { >- m_requests.append(std::nullopt); >+ m_requests.append(WTF::nullopt); > m_lastGrantedTicket++; > m_threadCondition->notifyOne(locker); > } >diff --git a/Source/JavaScriptCore/heap/Heap.h b/Source/JavaScriptCore/heap/Heap.h >index c8aed4a36a588201f1527e5eaafa1453295c0019..37ff269fbd4b0f4e368c2a509cb5cae1fff4a194 100644 >--- a/Source/JavaScriptCore/heap/Heap.h >+++ b/Source/JavaScriptCore/heap/Heap.h >@@ -153,7 +153,7 @@ public: > void removeObserver(HeapObserver* observer) { m_observers.removeFirst(observer); } > > MutatorState mutatorState() const { return m_mutatorState; } >- std::optional<CollectionScope> collectionScope() const { return m_collectionScope; } >+ WTF::Optional<CollectionScope> collectionScope() const { return m_collectionScope; } > bool hasHeapAccess() const; > bool worldIsStopped() const; > bool worldIsRunning() const { return !worldIsStopped(); } >@@ -177,8 +177,8 @@ public: > bool shouldCollectHeuristic(); > > // Queue up a collection. Returns immediately. This will not queue a collection if a collection >- // of equal or greater strength exists. Full collections are stronger than std::nullopt collections >- // and std::nullopt collections are stronger than Eden collections. std::nullopt means that the GC can >+ // of equal or greater strength exists. Full collections are stronger than WTF::nullopt collections >+ // and WTF::nullopt collections are stronger than Eden collections. WTF::nullopt means that the GC can > // choose Eden or Full. This implies that if you request a GC while that GC is ongoing, nothing > // will happen. > JS_EXPORT_PRIVATE void collectAsync(GCRequest = GCRequest()); >@@ -576,8 +576,8 @@ private: > size_t m_totalBytesVisitedThisCycle; > double m_incrementBalance { 0 }; > >- std::optional<CollectionScope> m_collectionScope; >- std::optional<CollectionScope> m_lastCollectionScope; >+ WTF::Optional<CollectionScope> m_collectionScope; >+ WTF::Optional<CollectionScope> m_lastCollectionScope; > MutatorState m_mutatorState { MutatorState::Running }; > StructureIDTable m_structureIDTable; > MarkedSpace m_objectSpace; >diff --git a/Source/JavaScriptCore/heap/HeapSnapshot.cpp b/Source/JavaScriptCore/heap/HeapSnapshot.cpp >index 34db12c3dbbc7270429351be0abdc93e6b628d1f..cd3af1d91f42b8350f28c2be22a4cf85238a584a 100644 >--- a/Source/JavaScriptCore/heap/HeapSnapshot.cpp >+++ b/Source/JavaScriptCore/heap/HeapSnapshot.cpp >@@ -130,7 +130,7 @@ void HeapSnapshot::finalize() > #endif > } > >-std::optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell) >+WTF::Optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell) > { > ASSERT(m_finalized); > >@@ -142,7 +142,7 @@ std::optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell) > unsigned middle = start + ((end - start) / 2); > HeapSnapshotNode& node = m_nodes[middle]; > if (cell == node.cell) >- return std::optional<HeapSnapshotNode>(node); >+ return WTF::Optional<HeapSnapshotNode>(node); > if (cell < node.cell) > end = middle; > else >@@ -153,32 +153,32 @@ std::optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell) > if (m_previous) > return m_previous->nodeForCell(cell); > >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<HeapSnapshotNode> HeapSnapshot::nodeForObjectIdentifier(unsigned objectIdentifier) >+WTF::Optional<HeapSnapshotNode> HeapSnapshot::nodeForObjectIdentifier(unsigned objectIdentifier) > { > if (isEmpty()) { > if (m_previous) > return m_previous->nodeForObjectIdentifier(objectIdentifier); >- return std::nullopt; >+ return WTF::nullopt; > } > > if (objectIdentifier > m_lastObjectIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > if (objectIdentifier < m_firstObjectIdentifier) { > if (m_previous) > return m_previous->nodeForObjectIdentifier(objectIdentifier); >- return std::nullopt; >+ return WTF::nullopt; > } > > for (auto& node : m_nodes) { > if (node.identifier == objectIdentifier) >- return std::optional<HeapSnapshotNode>(node); >+ return WTF::Optional<HeapSnapshotNode>(node); > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace JSC >diff --git a/Source/JavaScriptCore/heap/HeapSnapshot.h b/Source/JavaScriptCore/heap/HeapSnapshot.h >index fdd3de3b50f088b3540c141537d930f3b4934a05..efa2b5ed435c7009c9e459c98ed434391d2b46dd 100644 >--- a/Source/JavaScriptCore/heap/HeapSnapshot.h >+++ b/Source/JavaScriptCore/heap/HeapSnapshot.h >@@ -45,8 +45,8 @@ public: > void finalize(); > > bool isEmpty() const { return m_nodes.isEmpty(); } >- std::optional<HeapSnapshotNode> nodeForCell(JSCell*); >- std::optional<HeapSnapshotNode> nodeForObjectIdentifier(unsigned objectIdentifier); >+ WTF::Optional<HeapSnapshotNode> nodeForCell(JSCell*); >+ WTF::Optional<HeapSnapshotNode> nodeForObjectIdentifier(unsigned objectIdentifier); > > private: > friend class HeapSnapshotBuilder; >diff --git a/Source/JavaScriptCore/heap/MarkingConstraintSolver.cpp b/Source/JavaScriptCore/heap/MarkingConstraintSolver.cpp >index dca0a59262412c075a34be626a5f2ca2d35e295d..07c54a2edb4e9dd6b70ddf7e729a0e76a750e417 100644 >--- a/Source/JavaScriptCore/heap/MarkingConstraintSolver.cpp >+++ b/Source/JavaScriptCore/heap/MarkingConstraintSolver.cpp >@@ -54,7 +54,7 @@ bool MarkingConstraintSolver::didVisitSomething() const > return false; > } > >-void MarkingConstraintSolver::execute(SchedulerPreference preference, ScopedLambda<std::optional<unsigned>()> pickNext) >+void MarkingConstraintSolver::execute(SchedulerPreference preference, ScopedLambda<WTF::Optional<unsigned>()> pickNext) > { > m_pickNextIsStillActive = true; > RELEASE_ASSERT(!m_numThreadsThatMayProduceWork); >@@ -89,10 +89,10 @@ void MarkingConstraintSolver::drain(BitVector& unexecuted) > auto end = unexecuted.end(); > if (iter == end) > return; >- auto pickNext = scopedLambda<std::optional<unsigned>()>( >- [&] () -> std::optional<unsigned> { >+ auto pickNext = scopedLambda<WTF::Optional<unsigned>()>( >+ [&] () -> WTF::Optional<unsigned> { > if (iter == end) >- return std::nullopt; >+ return WTF::nullopt; > return *iter++; > }); > execute(NextConstraintFirst, pickNext); >@@ -126,13 +126,13 @@ void MarkingConstraintSolver::converge(const Vector<MarkingConstraint*>& order) > return; > } > >- auto pickNext = scopedLambda<std::optional<unsigned>()>( >- [&] () -> std::optional<unsigned> { >+ auto pickNext = scopedLambda<WTF::Optional<unsigned>()>( >+ [&] () -> WTF::Optional<unsigned> { > if (didVisitSomething()) >- return std::nullopt; >+ return WTF::nullopt; > > if (index >= order.size()) >- return std::nullopt; >+ return WTF::nullopt; > > MarkingConstraint& constraint = *order[index++]; > return constraint.index(); >@@ -157,7 +157,7 @@ void MarkingConstraintSolver::addParallelTask(RefPtr<SharedTask<void(SlotVisitor > m_toExecuteInParallel.append(TaskWithConstraint(WTFMove(task), &constraint)); > } > >-void MarkingConstraintSolver::runExecutionThread(SlotVisitor& visitor, SchedulerPreference preference, ScopedLambda<std::optional<unsigned>()> pickNext) >+void MarkingConstraintSolver::runExecutionThread(SlotVisitor& visitor, SchedulerPreference preference, ScopedLambda<WTF::Optional<unsigned>()> pickNext) > { > for (;;) { > bool doParallelWorkMode; >@@ -183,7 +183,7 @@ void MarkingConstraintSolver::runExecutionThread(SlotVisitor& visitor, Scheduler > return false; > > for (;;) { >- std::optional<unsigned> pickResult = pickNext(); >+ WTF::Optional<unsigned> pickResult = pickNext(); > if (!pickResult) { > m_pickNextIsStillActive = false; > return false; >diff --git a/Source/JavaScriptCore/heap/MarkingConstraintSolver.h b/Source/JavaScriptCore/heap/MarkingConstraintSolver.h >index 08b38dbbee7309a653eff47730ad0dac5f0ebc1c..ddc46186d7ed66d61c106837c36008b7bd76cf25 100644 >--- a/Source/JavaScriptCore/heap/MarkingConstraintSolver.h >+++ b/Source/JavaScriptCore/heap/MarkingConstraintSolver.h >@@ -56,7 +56,7 @@ public: > NextConstraintFirst > }; > >- void execute(SchedulerPreference, ScopedLambda<std::optional<unsigned>()> pickNext); >+ void execute(SchedulerPreference, ScopedLambda<WTF::Optional<unsigned>()> pickNext); > > void drain(BitVector& unexecuted); > >@@ -68,7 +68,7 @@ public: > void addParallelTask(RefPtr<SharedTask<void(SlotVisitor&)>>, MarkingConstraint&); > > private: >- void runExecutionThread(SlotVisitor&, SchedulerPreference, ScopedLambda<std::optional<unsigned>()> pickNext); >+ void runExecutionThread(SlotVisitor&, SchedulerPreference, ScopedLambda<WTF::Optional<unsigned>()> pickNext); > > struct TaskWithConstraint { > TaskWithConstraint() { } >diff --git a/Source/JavaScriptCore/inspector/InjectedScript.cpp b/Source/JavaScriptCore/inspector/InjectedScript.cpp >index c03ffeb2e4484f75d9b8fc4cc33a6a00865a2b0e..0fa1b2cf4db425f0a7df81e6ec739356924c7a46 100644 >--- a/Source/JavaScriptCore/inspector/InjectedScript.cpp >+++ b/Source/JavaScriptCore/inspector/InjectedScript.cpp >@@ -54,7 +54,7 @@ InjectedScript::~InjectedScript() > { > } > >-void InjectedScript::evaluate(ErrorString& errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) >+void InjectedScript::evaluate(ErrorString& errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex) > { > Deprecated::ScriptFunctionCall function(injectedScriptObject(), "evaluate"_s, inspectorEnvironment()->functionCallHandler()); > function.appendArgument(expression); >@@ -76,7 +76,7 @@ void InjectedScript::awaitPromise(const String& promiseObjectId, bool returnByVa > makeAsyncCall(function, WTFMove(callback)); > } > >-void InjectedScript::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown) >+void InjectedScript::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown) > { > Deprecated::ScriptFunctionCall function(injectedScriptObject(), "callFunctionOn"_s, inspectorEnvironment()->functionCallHandler()); > function.appendArgument(objectId); >@@ -85,12 +85,12 @@ void InjectedScript::callFunctionOn(ErrorString& errorString, const String& obje > function.appendArgument(returnByValue); > function.appendArgument(generatePreview); > >- std::optional<int> savedResultIndex; >+ WTF::Optional<int> savedResultIndex; > makeEvalCall(errorString, function, result, wasThrown, savedResultIndex); > ASSERT(!savedResultIndex); > } > >-void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) >+void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex) > { > Deprecated::ScriptFunctionCall function(injectedScriptObject(), "evaluateOnCallFrame"_s, inspectorEnvironment()->functionCallHandler()); > function.appendArgument(callFrames); >@@ -213,7 +213,7 @@ void InjectedScript::getCollectionEntries(ErrorString& errorString, const String > entries = BindingTraits<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>::runtimeCast(WTFMove(result)); > } > >-void InjectedScript::saveResult(ErrorString& errorString, const String& callArgumentJSON, std::optional<int>& savedResultIndex) >+void InjectedScript::saveResult(ErrorString& errorString, const String& callArgumentJSON, WTF::Optional<int>& savedResultIndex) > { > Deprecated::ScriptFunctionCall function(injectedScriptObject(), "saveResult"_s, inspectorEnvironment()->functionCallHandler()); > function.appendArgument(callArgumentJSON); >diff --git a/Source/JavaScriptCore/inspector/InjectedScript.h b/Source/JavaScriptCore/inspector/InjectedScript.h >index 4de9d745dce5b3dcf59bc1c53aeb6c3f8cc0a34f..d2b8021449ce4813db4500eb6d2ae1899f910ed3 100644 >--- a/Source/JavaScriptCore/inspector/InjectedScript.h >+++ b/Source/JavaScriptCore/inspector/InjectedScript.h >@@ -51,10 +51,10 @@ public: > InjectedScript(Deprecated::ScriptObject, InspectorEnvironment*); > virtual ~InjectedScript(); > >- void evaluate(ErrorString&, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex); >+ void evaluate(ErrorString&, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex); > void awaitPromise(const String& promiseObjectId, bool returnByValue, bool generatePreview, bool saveResult, AsyncCallCallback&&); >- void evaluateOnCallFrame(ErrorString&, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex); >- void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown); >+ void evaluateOnCallFrame(ErrorString&, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex); >+ void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown); > void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>& result); > void functionDetails(ErrorString&, JSC::JSValue, RefPtr<Protocol::Debugger::FunctionDetails>& result); > void getPreview(ErrorString&, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>& result); >@@ -62,7 +62,7 @@ public: > void getDisplayableProperties(ErrorString&, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result); > void getInternalProperties(ErrorString&, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& result); > void getCollectionEntries(ErrorString&, const String& objectId, const String& objectGroup, int startIndex, int numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries); >- void saveResult(ErrorString&, const String& callArgumentJSON, std::optional<int>& savedResultIndex); >+ void saveResult(ErrorString&, const String& callArgumentJSON, WTF::Optional<int>& savedResultIndex); > > Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> wrapCallFrames(JSC::JSValue) const; > RefPtr<Protocol::Runtime::RemoteObject> wrapObject(JSC::JSValue, const String& groupName, bool generatePreview = false) const; >diff --git a/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp >index 867e0b52d46becfeb6b6f63517bd27eb680db0ef..a63953a8dad4321fb5e1a7b1da3418877afe5832 100644 >--- a/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp >+++ b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp >@@ -96,7 +96,7 @@ Ref<JSON::Value> InjectedScriptBase::makeCall(Deprecated::ScriptFunctionCall& fu > return resultJSONValue.releaseNonNull(); > } > >-void InjectedScriptBase::makeEvalCall(ErrorString& errorString, Deprecated::ScriptFunctionCall& function, RefPtr<Protocol::Runtime::RemoteObject>& out_resultObject, std::optional<bool>& out_wasThrown, std::optional<int>& out_savedResultIndex) >+void InjectedScriptBase::makeEvalCall(ErrorString& errorString, Deprecated::ScriptFunctionCall& function, RefPtr<Protocol::Runtime::RemoteObject>& out_resultObject, WTF::Optional<bool>& out_wasThrown, WTF::Optional<int>& out_savedResultIndex) > { > checkCallResult(errorString, makeCall(function), out_resultObject, out_wasThrown, out_savedResultIndex); > } >@@ -141,7 +141,7 @@ void InjectedScriptBase::makeAsyncCall(Deprecated::ScriptFunctionCall& function, > } > } > >-void InjectedScriptBase::checkCallResult(ErrorString& errorString, RefPtr<JSON::Value> result, RefPtr<Protocol::Runtime::RemoteObject>& out_resultObject, std::optional<bool>& out_wasThrown, std::optional<int>& out_savedResultIndex) >+void InjectedScriptBase::checkCallResult(ErrorString& errorString, RefPtr<JSON::Value> result, RefPtr<Protocol::Runtime::RemoteObject>& out_resultObject, WTF::Optional<bool>& out_wasThrown, WTF::Optional<int>& out_savedResultIndex) > { > if (!result) { > errorString = "Internal error: result value is empty"_s; >@@ -186,8 +186,8 @@ void InjectedScriptBase::checkAsyncCallResult(RefPtr<JSON::Value> result, const > { > ErrorString errorString; > RefPtr<Protocol::Runtime::RemoteObject> resultObject; >- std::optional<bool> wasThrown; >- std::optional<int> savedResultIndex; >+ WTF::Optional<bool> wasThrown; >+ WTF::Optional<int> savedResultIndex; > > checkCallResult(errorString, result, resultObject, wasThrown, savedResultIndex); > >diff --git a/Source/JavaScriptCore/inspector/InjectedScriptBase.h b/Source/JavaScriptCore/inspector/InjectedScriptBase.h >index 447a4288f9977cf2cb20aefdefe2cb52b02c3a78..9cc69ea8a7b29ae562f8ebddc10af185ba555230 100644 >--- a/Source/JavaScriptCore/inspector/InjectedScriptBase.h >+++ b/Source/JavaScriptCore/inspector/InjectedScriptBase.h >@@ -45,7 +45,7 @@ class ScriptFunctionCall; > namespace Inspector { > > typedef String ErrorString; >-typedef WTF::Function<void(ErrorString&, RefPtr<Protocol::Runtime::RemoteObject>&&, std::optional<bool>&, std::optional<int>&)> AsyncCallCallback; >+typedef WTF::Function<void(ErrorString&, RefPtr<Protocol::Runtime::RemoteObject>&&, WTF::Optional<bool>&, WTF::Optional<int>&)> AsyncCallCallback; > > class JS_EXPORT_PRIVATE InjectedScriptBase { > public: >@@ -66,11 +66,11 @@ protected: > const Deprecated::ScriptObject& injectedScriptObject() const; > JSC::JSValue callFunctionWithEvalEnabled(Deprecated::ScriptFunctionCall&, bool& hadException) const; > Ref<JSON::Value> makeCall(Deprecated::ScriptFunctionCall&); >- void makeEvalCall(ErrorString&, Deprecated::ScriptFunctionCall&, RefPtr<Protocol::Runtime::RemoteObject>& resultObject, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex); >+ void makeEvalCall(ErrorString&, Deprecated::ScriptFunctionCall&, RefPtr<Protocol::Runtime::RemoteObject>& resultObject, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex); > void makeAsyncCall(Deprecated::ScriptFunctionCall&, AsyncCallCallback&&); > > private: >- void checkCallResult(ErrorString&, RefPtr<JSON::Value> result, RefPtr<Protocol::Runtime::RemoteObject>& resultObject, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex); >+ void checkCallResult(ErrorString&, RefPtr<JSON::Value> result, RefPtr<Protocol::Runtime::RemoteObject>& resultObject, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex); > void checkAsyncCallResult(RefPtr<JSON::Value> result, const AsyncCallCallback&); > > String m_name; >diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp >index 7dfb6ce70a57bcdedacecb6689b7b625fe741a53..1786d7d34e25025412a990c68d7c16bb8dc257a0 100644 >--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp >+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp >@@ -114,7 +114,7 @@ void BackendDispatcher::dispatch(const String& message) > { > // In case this is a re-entrant call from a nested run loop, we don't want to lose > // the outer request's id just because the inner request is bogus. >- SetForScope<std::optional<long>> scopedRequestId(m_currentRequestId, std::nullopt); >+ SetForScope<WTF::Optional<long>> scopedRequestId(m_currentRequestId, WTF::nullopt); > > RefPtr<JSON::Value> parsedMessage; > if (!JSON::Value::parseJSON(message, parsedMessage)) { >@@ -145,7 +145,7 @@ void BackendDispatcher::dispatch(const String& message) > > { > // We could be called re-entrantly from a nested run loop, so restore the previous id. >- SetForScope<std::optional<long>> scopedRequestId(m_currentRequestId, requestId); >+ SetForScope<WTF::Optional<long>> scopedRequestId(m_currentRequestId, requestId); > > RefPtr<JSON::Value> methodValue; > if (!messageObject->getValue("method"_s, methodValue)) { >@@ -251,7 +251,7 @@ void BackendDispatcher::sendPendingErrors() > m_frontendRouter->sendResponse(message->toJSONString()); > > m_protocolErrors.clear(); >- m_currentRequestId = std::nullopt; >+ m_currentRequestId = WTF::nullopt; > } > > void BackendDispatcher::reportProtocolError(CommonErrorCode errorCode, const String& errorMessage) >@@ -259,7 +259,7 @@ void BackendDispatcher::reportProtocolError(CommonErrorCode errorCode, const Str > reportProtocolError(m_currentRequestId, errorCode, errorMessage); > } > >-void BackendDispatcher::reportProtocolError(std::optional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage) >+void BackendDispatcher::reportProtocolError(WTF::Optional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage) > { > ASSERT_ARG(errorCode, errorCode >= 0); > >@@ -270,16 +270,6 @@ void BackendDispatcher::reportProtocolError(std::optional<long> relatedRequestId > m_protocolErrors.append(std::tuple<CommonErrorCode, String>(errorCode, errorMessage)); > } > >-#if PLATFORM(MAC) >-void BackendDispatcher::reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage) >-{ >- if (relatedRequestId) >- reportProtocolError(relatedRequestId.value(), errorCode, errorMessage); >- else >- reportProtocolError(std::nullopt, errorCode, errorMessage); >-} >-#endif >- > template<typename T> > T BackendDispatcher::getPropertyValue(JSON::Object* object, const String& name, bool* out_optionalValueFound, T defaultValue, std::function<bool(JSON::Value&, T&)> asMethod, const char* typeName) > { >diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h >index a34d1cef40bcf51d43be34e267eb6050a72b833f..42b309cdd214a901280953357c255aa1d3f073e2 100644 >--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h >+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h >@@ -29,7 +29,6 @@ > #include "InspectorFrontendRouter.h" > #include "InspectorProtocolTypes.h" > #include <functional> >-#include <wtf/DeprecatedOptional.h> > #include <wtf/Optional.h> > #include <wtf/RefCounted.h> > #include <wtf/text/WTFString.h> >@@ -93,7 +92,7 @@ public: > void sendPendingErrors(); > > void reportProtocolError(CommonErrorCode, const String& errorMessage); >- void reportProtocolError(std::optional<long> relatedRequestId, CommonErrorCode, const String& errorMessage); >+ void reportProtocolError(WTF::Optional<long> relatedRequestId, CommonErrorCode, const String& errorMessage); > > template<typename T> > WTF_INTERNAL >@@ -110,11 +109,6 @@ public: > private: > BackendDispatcher(Ref<FrontendRouter>&&); > >-#if PLATFORM(MAC) >- // This is necessary for some versions of Safari. Remove it when those versions of Safari are no longer supported. >- void reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode, const String& errorMessage); >-#endif >- > Ref<FrontendRouter> m_frontendRouter; > HashMap<String, SupplementalBackendDispatcher*> m_dispatchers; > >@@ -125,7 +119,7 @@ private: > > // For synchronously handled requests, avoid plumbing requestId through every > // call that could potentially fail with a protocol error. >- std::optional<long> m_currentRequestId { std::nullopt }; >+ WTF::Optional<long> m_currentRequestId { WTF::nullopt }; > }; > > } // namespace Inspector >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp >index f9910071742281e6b1dfe5df8a7b321996c4467b..21943672023cb5cc8065b30f0950b6cdd024d155 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp >@@ -309,7 +309,7 @@ void InspectorDebuggerAgent::didDispatchAsyncCall() > auto& asyncStackTrace = it->value; > asyncStackTrace->didDispatchAsyncCall(); > >- m_currentAsyncCallIdentifier = std::nullopt; >+ m_currentAsyncCallIdentifier = WTF::nullopt; > > if (!asyncStackTrace->isPending()) > m_pendingAsyncCalls.remove(identifier); >@@ -827,7 +827,7 @@ void InspectorDebuggerAgent::setPauseOnAssertions(ErrorString&, bool enabled) > m_pauseOnAssertionFailures = enabled; > } > >-void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) >+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex) > { > if (!m_currentCallStack) { > errorString = "Not paused"_s; >@@ -1155,7 +1155,7 @@ void InspectorDebuggerAgent::clearExceptionValue() > void InspectorDebuggerAgent::clearAsyncStackTraceData() > { > m_pendingAsyncCalls.clear(); >- m_currentAsyncCallIdentifier = std::nullopt; >+ m_currentAsyncCallIdentifier = WTF::nullopt; > > didClearAsyncStackTraceData(); > } >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h >index 2a58a8de4f436fa1d49b8992977dfd446a88825d..80161f588f4d7d35efcc927e6804ca62ed025e4a 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h >+++ b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h >@@ -79,7 +79,7 @@ public: > void stepOut(ErrorString&) final; > void setPauseOnExceptions(ErrorString&, const String& pauseState) final; > void setPauseOnAssertions(ErrorString&, bool enabled) final; >- void evaluateOnCallFrame(ErrorString&, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) final; >+ void evaluateOnCallFrame(ErrorString&, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex) final; > void setOverlayMessage(ErrorString&, const String*) override; > > bool isPaused() const; >@@ -192,7 +192,7 @@ private: > ShouldDispatchResumed m_conditionToDispatchResumed { ShouldDispatchResumed::No }; > bool m_enablePauseWhenIdle { false }; > HashMap<AsyncCallIdentifier, RefPtr<AsyncStackTrace>> m_pendingAsyncCalls; >- std::optional<AsyncCallIdentifier> m_currentAsyncCallIdentifier { std::nullopt }; >+ WTF::Optional<AsyncCallIdentifier> m_currentAsyncCallIdentifier { WTF::nullopt }; > bool m_enabled { false }; > bool m_javaScriptPauseScheduled { false }; > bool m_hasExceptionValue { false }; >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp >index dd23fa07779050c786d96203d01f97bb80e6f432..8987c507bd93eee7f7aba098b5b1fc5d7359d9c1 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp >@@ -143,30 +143,30 @@ void InspectorHeapAgent::stopTracking(ErrorString& errorString) > m_frontendDispatcher->trackingComplete(timestamp, snapshotData); > } > >-std::optional<HeapSnapshotNode> InspectorHeapAgent::nodeForHeapObjectIdentifier(ErrorString& errorString, unsigned heapObjectIdentifier) >+WTF::Optional<HeapSnapshotNode> InspectorHeapAgent::nodeForHeapObjectIdentifier(ErrorString& errorString, unsigned heapObjectIdentifier) > { > HeapProfiler* heapProfiler = m_environment.vm().heapProfiler(); > if (!heapProfiler) { > errorString = "No heap snapshot"_s; >- return std::nullopt; >+ return WTF::nullopt; > } > > HeapSnapshot* snapshot = heapProfiler->mostRecentSnapshot(); > if (!snapshot) { > errorString = "No heap snapshot"_s; >- return std::nullopt; >+ return WTF::nullopt; > } > >- const std::optional<HeapSnapshotNode> optionalNode = snapshot->nodeForObjectIdentifier(heapObjectIdentifier); >+ const WTF::Optional<HeapSnapshotNode> optionalNode = snapshot->nodeForObjectIdentifier(heapObjectIdentifier); > if (!optionalNode) { > errorString = "No object for identifier, it may have been collected"_s; >- return std::nullopt; >+ return WTF::nullopt; > } > > return optionalNode; > } > >-void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Protocol::Runtime::ObjectPreview>& objectPreview) >+void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, WTF::Optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Protocol::Runtime::ObjectPreview>& objectPreview) > { > // Prevent the cell from getting collected as we look it up. > VM& vm = m_environment.vm(); >@@ -174,7 +174,7 @@ void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, > DeferGC deferGC(vm.heap); > > unsigned heapObjectIdentifier = static_cast<unsigned>(heapObjectId); >- const std::optional<HeapSnapshotNode> optionalNode = nodeForHeapObjectIdentifier(errorString, heapObjectIdentifier); >+ const WTF::Optional<HeapSnapshotNode> optionalNode = nodeForHeapObjectIdentifier(errorString, heapObjectIdentifier); > if (!optionalNode) > return; > >@@ -223,7 +223,7 @@ void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjec > DeferGC deferGC(vm.heap); > > unsigned heapObjectIdentifier = static_cast<unsigned>(heapObjectId); >- const std::optional<HeapSnapshotNode> optionalNode = nodeForHeapObjectIdentifier(errorString, heapObjectIdentifier); >+ const WTF::Optional<HeapSnapshotNode> optionalNode = nodeForHeapObjectIdentifier(errorString, heapObjectIdentifier); > if (!optionalNode) > return; > >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h >index de6dda93d3038b3034a36d41760af033a0ea6e24..65fdfe75cfc61320bb0f0b47b7abf5ec13a9d8e5 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h >+++ b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h >@@ -59,7 +59,7 @@ public: > void snapshot(ErrorString&, double* timestamp, String* snapshotData) final; > void startTracking(ErrorString&) final; > void stopTracking(ErrorString&) final; >- void getPreview(ErrorString&, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>&, RefPtr<Protocol::Runtime::ObjectPreview>&) final; >+ void getPreview(ErrorString&, int heapObjectId, WTF::Optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>&, RefPtr<Protocol::Runtime::ObjectPreview>&) final; > void getRemoteObject(ErrorString&, int heapObjectId, const String* optionalObjectGroup, RefPtr<Protocol::Runtime::RemoteObject>& result) final; > > // HeapObserver >@@ -72,7 +72,7 @@ protected: > virtual void dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type, Seconds startTime, Seconds endTime); > > private: >- std::optional<JSC::HeapSnapshotNode> nodeForHeapObjectIdentifier(ErrorString&, unsigned heapObjectIdentifier); >+ WTF::Optional<JSC::HeapSnapshotNode> nodeForHeapObjectIdentifier(ErrorString&, unsigned heapObjectIdentifier); > > InjectedScriptManager& m_injectedScriptManager; > std::unique_ptr<HeapFrontendDispatcher> m_frontendDispatcher; >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp >index 627975b71339c559369205ceed8a903320bebe61..c0fffa10faec63dead7e380d96253dddcf85d783 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp >@@ -83,7 +83,7 @@ static Ref<Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLoc > .release(); > } > >-void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>& range) >+void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, WTF::Optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>& range) > { > JSLockHolder lock(m_vm); > >@@ -111,7 +111,7 @@ void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Protoc > } > } > >-void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) >+void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex) > { > InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId); > if (injectedScript.hasNoValue()) >@@ -139,7 +139,7 @@ void InspectorRuntimeAgent::awaitPromise(const String& promiseObjectId, const bo > return; > } > >- injectedScript.awaitPromise(promiseObjectId, asBool(returnByValue), asBool(generatePreview), asBool(saveResult), [callback = WTFMove(callback)] (ErrorString& errorString, RefPtr<Protocol::Runtime::RemoteObject>&& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) { >+ injectedScript.awaitPromise(promiseObjectId, asBool(returnByValue), asBool(generatePreview), asBool(saveResult), [callback = WTFMove(callback)] (ErrorString& errorString, RefPtr<Protocol::Runtime::RemoteObject>&& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex) { > if (!errorString.isEmpty()) > callback->sendFailure(errorString); > else >@@ -147,7 +147,7 @@ void InspectorRuntimeAgent::awaitPromise(const String& promiseObjectId, const bo > }); > } > >-void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown) >+void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown) > { > InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); > if (injectedScript.hasNoValue()) { >@@ -240,7 +240,7 @@ void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const > injectedScript.getCollectionEntries(errorString, objectId, objectGroup ? *objectGroup : String(), start, fetch, entries); > } > >-void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex) >+void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, WTF::Optional<int>& savedResultIndex) > { > InjectedScript injectedScript; > >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h >index ab6d7fc856bbf8f62250243cfd5c2e8231884b0c..2d81629ffcb5680ae1d53efcaba00a8cb05a94dd 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h >+++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h >@@ -57,16 +57,16 @@ public: > > void enable(ErrorString&) override { m_enabled = true; } > void disable(ErrorString&) override { m_enabled = false; } >- void parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>&) final; >- void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) final; >+ void parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, WTF::Optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>&) final; >+ void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown, WTF::Optional<int>& savedResultIndex) final; > void awaitPromise(const String& promiseObjectId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, Ref<AwaitPromiseCallback>&&) final; >- void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown) final; >+ void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, WTF::Optional<bool>& wasThrown) final; > void releaseObject(ErrorString&, const ErrorString& objectId) final; > void getPreview(ErrorString&, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>&) final; > void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final; > void getDisplayableProperties(ErrorString&, const String& objectId, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final; > void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries) final; >- void saveResult(ErrorString&, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex) final; >+ void saveResult(ErrorString&, const JSON::Object& callArgument, const int* executionContextId, WTF::Optional<int>& savedResultIndex) final; > void releaseObjectGroup(ErrorString&, const String& objectGroup) final; > void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>&) override; > void enableTypeProfiler(ErrorString&) override; >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h >index 854c9828ae3b890ec753ff3403fa08b4e684f3ab..f319c63c2ee8725489756762a4ca10769858582c 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h >+++ b/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h >@@ -65,7 +65,7 @@ public: > void close(); > void targetClosed(); > >- std::optional<unsigned> targetIdentifier() const; >+ WTF::Optional<unsigned> targetIdentifier() const; > #if PLATFORM(COCOA) > NSString *connectionIdentifier() const; > NSString *destination() const; >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp b/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp >index ce51b6eb0e637f5d554c510859bb376dcf582c01..3b10f29105ce426b7b6eca4388dfa7c662bf189d 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp >+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp >@@ -130,7 +130,7 @@ void RemoteInspector::updateClientCapabilities() > std::lock_guard<Lock> lock(m_mutex); > > if (!m_client) >- m_clientCapabilities = std::nullopt; >+ m_clientCapabilities = WTF::nullopt; > else { > RemoteInspector::Client::Capabilities updatedCapabilities = { > m_client->remoteAutomationAllowed(), >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspector.h b/Source/JavaScriptCore/inspector/remote/RemoteInspector.h >index 0eba5a68d8642624bf57fc4d8a16c02189c800e3..97b98441ee5535326578fb24e36fe2f792dc45f4 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteInspector.h >+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspector.h >@@ -79,8 +79,8 @@ public: > Vector<std::pair<String, String>> certificates; > #endif > #if PLATFORM(COCOA) >- std::optional<bool> allowInsecureMediaCapture; >- std::optional<bool> suppressICECandidateFiltering; >+ WTF::Optional<bool> allowInsecureMediaCapture; >+ WTF::Optional<bool> suppressICECandidateFiltering; > #endif > }; > >@@ -103,7 +103,7 @@ public: > RemoteInspector::Client* client() const { return m_client; } > void setClient(RemoteInspector::Client*); > void clientCapabilitiesDidChange(); >- std::optional<RemoteInspector::Client::Capabilities> clientCapabilities() const { return m_clientCapabilities; } >+ WTF::Optional<RemoteInspector::Client::Capabilities> clientCapabilities() const { return m_clientCapabilities; } > > void setupFailed(unsigned targetIdentifier); > void setupCompleted(unsigned targetIdentifier); >@@ -206,7 +206,7 @@ private: > #endif > > RemoteInspector::Client* m_client { nullptr }; >- std::optional<RemoteInspector::Client::Capabilities> m_clientCapabilities; >+ WTF::Optional<RemoteInspector::Client::Capabilities> m_clientCapabilities; > > #if PLATFORM(COCOA) > dispatch_queue_t m_xpcQueue; >diff --git a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >index 4a3426955ab0fad09437727fadf9f58fc682d15d..e61f395d03152a3f55257f1dd39ce9695a8c3e62 100644 >--- a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >@@ -120,9 +120,9 @@ RemoteConnectionToTarget::~RemoteConnectionToTarget() > teardownRunLoop(); > } > >-std::optional<unsigned> RemoteConnectionToTarget::targetIdentifier() const >+WTF::Optional<unsigned> RemoteConnectionToTarget::targetIdentifier() const > { >- return m_target ? std::optional<unsigned>(m_target->targetIdentifier()) : std::nullopt; >+ return m_target ? WTF::Optional<unsigned>(m_target->targetIdentifier()) : WTF::nullopt; > } > > NSString *RemoteConnectionToTarget::connectionIdentifier() const >diff --git a/Source/JavaScriptCore/inspector/remote/glib/RemoteConnectionToTargetGlib.cpp b/Source/JavaScriptCore/inspector/remote/glib/RemoteConnectionToTargetGlib.cpp >index 13e3930b3bfc201a896f81150d8cea10f060f709..bcaa9f706604a611388771032c5dc0531570df00 100644 >--- a/Source/JavaScriptCore/inspector/remote/glib/RemoteConnectionToTargetGlib.cpp >+++ b/Source/JavaScriptCore/inspector/remote/glib/RemoteConnectionToTargetGlib.cpp >@@ -106,9 +106,9 @@ void RemoteConnectionToTarget::targetClosed() > m_target = nullptr; > } > >-std::optional<unsigned> RemoteConnectionToTarget::targetIdentifier() const >+WTF::Optional<unsigned> RemoteConnectionToTarget::targetIdentifier() const > { >- return m_target ? std::optional<unsigned>(m_target->targetIdentifier()) : std::nullopt; >+ return m_target ? WTF::Optional<unsigned>(m_target->targetIdentifier()) : WTF::nullopt; > } > > void RemoteConnectionToTarget::sendMessageToFrontend(const String& message) >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py >index 4e9870514d5754a41b69dc15a86beb1a8c6e81ae..7a12e6fb0e88680aaa60421cd27b7ddd69e787db 100644 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py >@@ -211,7 +211,7 @@ class CppGenerator(Generator): > if isinstance(_type, PrimitiveType): > cpp_name = CppGenerator.cpp_name_for_primitive_type(_type) > if parameter.is_optional: >- return "std::optional<%s>&" % cpp_name >+ return "WTF::Optional<%s>&" % cpp_name > else: > return '%s*' % cpp_name > if isinstance(_type, EnumType): >@@ -237,7 +237,7 @@ class CppGenerator(Generator): > if isinstance(_type, PrimitiveType): > cpp_name = CppGenerator.cpp_name_for_primitive_type(_type) > if parameter.is_optional: >- return "std::optional<%s>&" % cpp_name >+ return "WTF::Optional<%s>&" % cpp_name > elif _type.qualified_name() in ['integer', 'number']: > return CppGenerator.cpp_name_for_primitive_type(_type) > elif _type.qualified_name() in ['string']: >@@ -269,7 +269,7 @@ class CppGenerator(Generator): > if _type.qualified_name() in ['any', 'object']: > return "RefPtr<%s>" % CppGenerator.cpp_name_for_primitive_type(_type) > elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer']: >- return "std::optional<%s>" % cpp_name >+ return "WTF::Optional<%s>" % cpp_name > else: > return cpp_name > >@@ -281,12 +281,12 @@ class CppGenerator(Generator): > if isinstance(_type, AliasedType): > builder_type = CppGenerator.cpp_protocol_type_for_type(_type) > if parameter.is_optional: >- return "std::optional<%s>" % builder_type >+ return "WTF::Optional<%s>" % builder_type > return '%s' % builder_type > if isinstance(_type, PrimitiveType): > cpp_name = CppGenerator.cpp_name_for_primitive_type(_type) > if parameter.is_optional: >- return "std::optional<%s>" % cpp_name >+ return "WTF::Optional<%s>" % cpp_name > else: > return cpp_name > if isinstance(_type, EnumType): >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py >index 844aa7d32cc411d600c12b35c04e0d23d043cb98..7ff9a5a411b48825b46d24dec3d1abce9d6d41e4 100755 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py >@@ -382,11 +382,11 @@ class CppProtocolTypesHeaderGenerator(CppGenerator): > 'namespace %s {' % self.helpers_namespace(), > '', > 'template<typename ProtocolEnumType>', >- 'std::optional<ProtocolEnumType> parseEnumValueFromString(const String&);', >+ 'WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&);', > ])) > > def return_type_with_export_macro(cpp_protocol_type): >- enum_return_type = 'std::optional<%s>' % cpp_protocol_type >+ enum_return_type = 'WTF::Optional<%s>' % cpp_protocol_type > result_terms = [enum_return_type] > export_macro = self.model().framework.setting('export_macro', None) > if export_macro is not None: >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py >index 0800d05c3bf65c88013112537078eaff83ee26c7..38b121f9a7ed117e6c491d465af226c8059757dc 100755 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py >@@ -111,7 +111,7 @@ class CppProtocolTypesImplementationGenerator(CppGenerator): > body_lines = [] > body_lines.extend([ > 'template<>', >- 'std::optional<%s> parseEnumValueFromString<%s>(const String& protocolString)' % (cpp_protocol_type, cpp_protocol_type), >+ 'WTF::Optional<%s> parseEnumValueFromString<%s>(const String& protocolString)' % (cpp_protocol_type, cpp_protocol_type), > '{', > ' static const size_t constantValues[] = {', > ]) >@@ -126,7 +126,7 @@ class CppProtocolTypesImplementationGenerator(CppGenerator): > ' if (protocolString == enum_constant_values[constantValues[i]])', > ' return (%s)constantValues[i];' % cpp_protocol_type, > '', >- ' return std::nullopt;', >+ ' return WTF::nullopt;', > '}', > '', > ]) >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py >index 76907bac6d97bf5ebb545416885e41e7ecea9658..006491df6d835ad6eca463f0035e5f7d4e00b261 100755 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py >@@ -176,7 +176,7 @@ class ObjCBackendDispatcherImplementationGenerator(ObjCGenerator): > objc_in_param_name = 'o_%s' % in_param_name > objc_type = self.objc_type_for_param(domain, command.command_name, parameter, False) > if isinstance(parameter.type, EnumType): >- objc_type = 'std::optional<%s>' % objc_type >+ objc_type = 'WTF::Optional<%s>' % objc_type > param_expression = in_param_expression(in_param_name, parameter) > import_expression = self.objc_protocol_import_expression_for_parameter(param_expression, domain, command.command_name, parameter) > if not parameter.is_optional: >@@ -206,7 +206,7 @@ class ObjCBackendDispatcherImplementationGenerator(ObjCGenerator): > objc_in_param_expression = 'o_%s' % in_param_name > if not parameter.is_optional: > # FIXME: we don't handle optional enum values in commands here because it isn't used anywhere yet. >- # We'd need to change the delegate's signature to take std::optional for optional enum values. >+ # We'd need to change the delegate's signature to take WTF::Optional for optional enum values. > if isinstance(parameter.type, EnumType): > objc_in_param_expression = '%s.value()' % objc_in_param_expression > >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py >index ce12a3a1ba1461ca2db5cb24243c799d81b48fd3..ee55b6dd513876ef2b25f78f433c82ae438608c3 100755 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py >@@ -161,11 +161,11 @@ class ObjCProtocolTypeConversionsHeaderGenerator(ObjCGenerator): > def _generate_enum_from_protocol_string(self, objc_enum_name, enum_values): > lines = [] > lines.append('template<>') >- lines.append('inline std::optional<%s> fromProtocolString(const String& value)' % objc_enum_name) >+ lines.append('inline WTF::Optional<%s> fromProtocolString(const String& value)' % objc_enum_name) > lines.append('{') > for enum_value in enum_values: > lines.append(' if (value == "%s")' % enum_value) > lines.append(' return %s%s;' % (objc_enum_name, Generator.stylized_name_for_enum_value(enum_value))) >- lines.append(' return std::nullopt;') >+ lines.append(' return WTF::nullopt;') > lines.append('}') > return '\n'.join(lines) >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py >index 3d84bf04bf23579e934288bbd7818c3c4572ff13..2cf669b098672b91248d4284621faf8a81c0db96 100644 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py >@@ -131,7 +131,7 @@ class ObjCProtocolTypeConversionsImplementationGenerator(ObjCGenerator): > lines.append('{') > if isinstance(resolved_type, EnumType): > lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]);') >- lines.append(' std::optional<%(type)s> result = Inspector::fromProtocolString<%(type)s>(payload);' % {'type': self.objc_name_for_type(resolved_type)}) >+ lines.append(' WTF::Optional<%(type)s> result = Inspector::fromProtocolString<%(type)s>(payload);' % {'type': self.objc_name_for_type(resolved_type)}) > lines.append(' THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"%s");' % declaration.type.raw_name()) > lines.append(' *outValue = @(result.value());') > elif isinstance(resolved_type, (ArrayType, PrimitiveType)): >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py >index 9cd98d7cda7f73d501a907a2b6f5382f84f9600e..98adcc980a7459469e5e028e5024b5951426ef08 100755 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py >@@ -143,7 +143,7 @@ class ObjCProtocolTypesImplementationGenerator(ObjCGenerator): > var_name = ObjCGenerator.identifier_to_objc_identifier(member_name) > conversion_expression = self.payload_to_objc_expression_for_member(declaration, member) > if isinstance(member.type, EnumType): >- lines.append(' std::optional<%s> %s = %s;' % (objc_type, var_name, conversion_expression)) >+ lines.append(' WTF::Optional<%s> %s = %s;' % (objc_type, var_name, conversion_expression)) > if not member.is_optional: > lines.append(' THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(%s, @"%s");' % (var_name, member_name)) > lines.append(' self.%s = %s.value();' % (var_name, var_name)) >diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py >index 6fc2b1d3633d1f1ddeca39415f8f51c09baf8910..60b2b4fe32a00df94302ca2db54298aaa84e8d2c 100755 >--- a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py >+++ b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py >@@ -55,7 +55,7 @@ namespace Inspector {""") > > TypeConversionsHeaderStandard = ( > """template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value);""") >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value);""") > > BackendDispatcherHeaderPrelude = ( > """${includes} >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result b/Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result >index 0eb7d2f5d7862cb48ab53d9d6c7f1eb09a52ec49..8b187555f95690fd6ec367b4ffc12ee1a044a038 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result >@@ -1006,7 +1006,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1023,7 +1023,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1033,7 +1033,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result >index 9a4d9771f878e6684228f678c7181a72706af3b7..2e38204622b6116aaa5d9cbda2cd85704ecc5f7b 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result >@@ -157,11 +157,11 @@ public: > Yellow = 5, > Black = 6, > }; // enum class PrintColor >- virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, std::optional<String>& opt_out_notes, std::optional<double>& opt_out_timestamp, std::optional<JSON::Object>& opt_out_values, std::optional<JSON::Value>& opt_out_payload, std::optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; >+ virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, WTF::Optional<String>& opt_out_notes, WTF::Optional<double>& opt_out_timestamp, WTF::Optional<JSON::Object>& opt_out_values, WTF::Optional<JSON::Value>& opt_out_payload, WTF::Optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; > class ExecuteSQLAsyncOptionalReturnValuesCallback : public BackendDispatcher::CallbackBase { > public: > ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&&, int id); >- void sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, std::optional<String>& notes, std::optional<double>& timestamp, std::optional<JSON::Object>& values, std::optional<JSON::Value>& payload, std::optional<int>& databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, std::optional<String>& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, std::optional<String>& printColor); >+ void sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, WTF::Optional<String>& notes, WTF::Optional<double>& timestamp, WTF::Optional<JSON::Object>& values, WTF::Optional<JSON::Value>& payload, WTF::Optional<int>& databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, WTF::Optional<String>& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, WTF::Optional<String>& printColor); > }; > virtual void executeSQLAsyncOptionalReturnValues(int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncOptionalReturnValuesCallback>&& callback) = 0; > virtual void executeSQLSync(ErrorString&, int in_databaseId, const String& in_query, RefPtr<JSON::ArrayOf<String>>& out_columnNames, String* out_notes, double* out_timestamp, JSON::Object* out_values, JSON::Value* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, RefPtr<Inspector::Protocol::Database::ColorList>& out_alternateColors, Inspector::Protocol::Database::PrimaryColors* out_screenColor, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0; >@@ -295,11 +295,11 @@ void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestI > ErrorString error; > Ref<JSON::Object> result = JSON::Object::create(); > RefPtr<JSON::ArrayOf<String>> out_columnNames; >- std::optional<String> out_notes; >- std::optional<double> out_timestamp; >- std::optional<JSON::Object> out_values; >- std::optional<JSON::Value> out_payload; >- std::optional<int> out_databaseId; >+ WTF::Optional<String> out_notes; >+ WTF::Optional<double> out_timestamp; >+ WTF::Optional<JSON::Object> out_values; >+ WTF::Optional<JSON::Value> out_payload; >+ WTF::Optional<int> out_databaseId; > RefPtr<Inspector::Protocol::Database::Error> out_sqlError; > Inspector::Protocol::Database::PrimaryColors out_screenColor; > RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors; >@@ -336,7 +336,7 @@ void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestI > > DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { } > >-void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, std::optional<String>& notes, std::optional<double>& timestamp, std::optional<JSON::Object>& values, std::optional<JSON::Value>& payload, std::optional<int>& databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, std::optional<String>& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, std::optional<String>& printColor) >+void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, WTF::Optional<String>& notes, WTF::Optional<double>& timestamp, WTF::Optional<JSON::Object>& values, WTF::Optional<JSON::Value>& payload, WTF::Optional<int>& databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, WTF::Optional<String>& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, WTF::Optional<String>& printColor) > { > Ref<JSON::Object> jsonMessage = JSON::Object::create(); > if (columnNames) >@@ -709,11 +709,11 @@ public: > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'Database' Domain > template<> >-std::optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&); >+WTF::Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&); > > } // namespace TestHelpers > >@@ -793,7 +793,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'Database' Domain > template<> >-std::optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Database::PrimaryColors::Red, >@@ -804,7 +804,7 @@ std::optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromSt > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Database::PrimaryColors)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1423,7 +1423,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1440,7 +1440,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1450,7 +1450,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1467,7 +1467,7 @@ inline String toProtocolString(TestProtocolDatabasePrimaryColors value) > } > > template<> >-inline std::optional<TestProtocolDatabasePrimaryColors> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabasePrimaryColors> fromProtocolString(const String& value) > { > if (value == "red") > return TestProtocolDatabasePrimaryColorsRed; >@@ -1475,7 +1475,7 @@ inline std::optional<TestProtocolDatabasePrimaryColors> fromProtocolString(const > return TestProtocolDatabasePrimaryColorsGreen; > if (value == "blue") > return TestProtocolDatabasePrimaryColorsBlue; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor value) >@@ -1493,7 +1493,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteSQLSyncOptionalReturnV > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan; >@@ -1503,7 +1503,7 @@ inline std::optional<TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrint > return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor value) >@@ -1521,7 +1521,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteSQLAsyncOptionalReturn > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan; >@@ -1531,7 +1531,7 @@ inline std::optional<TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrin > return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteSQLSyncPrintColor value) >@@ -1549,7 +1549,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteSQLSyncPrintColor valu > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteSQLSyncPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteSQLSyncPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteSQLSyncPrintColorCyan; >@@ -1559,7 +1559,7 @@ inline std::optional<TestProtocolDatabaseExecuteSQLSyncPrintColor> fromProtocolS > return TestProtocolDatabaseExecuteSQLSyncPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteSQLSyncPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteSQLAsyncPrintColor value) >@@ -1577,7 +1577,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteSQLAsyncPrintColor val > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteSQLAsyncPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteSQLAsyncPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteSQLAsyncPrintColorCyan; >@@ -1587,7 +1587,7 @@ inline std::optional<TestProtocolDatabaseExecuteSQLAsyncPrintColor> fromProtocol > return TestProtocolDatabaseExecuteSQLAsyncPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteSQLAsyncPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >@@ -1653,7 +1653,7 @@ using namespace Inspector; > + (void)_parsePrimaryColors:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolDatabasePrimaryColors> result = Inspector::fromProtocolString<TestProtocolDatabasePrimaryColors>(payload); >+ WTF::Optional<TestProtocolDatabasePrimaryColors> result = Inspector::fromProtocolString<TestProtocolDatabasePrimaryColors>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"PrimaryColors"); > *outValue = @(result.value()); > } >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result >index 3ebce2b82521df4cb480ce2ceab9906381eaac74..d6ce3e3de2ae6c5cf56e9745216437a611015ea4 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result >@@ -152,7 +152,7 @@ public: > Yellow = 5, > Black = 6, > }; // enum class PrintColor >- virtual void executeAllOptionalParameters(ErrorString&, const JSON::Array* opt_in_columnNames, const String* opt_in_notes, const double* opt_in_timestamp, const JSON::Object* opt_in_values, const JSON::Value* opt_in_payload, const int* opt_in_databaseId, const JSON::Object* opt_in_sqlError, const String* opt_in_screenColor, const JSON::Array* opt_in_alternateColors, const String* opt_in_printColor, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, std::optional<String>& opt_out_notes, std::optional<double>& opt_out_timestamp, std::optional<JSON::Object>& opt_out_values, std::optional<JSON::Value>& opt_out_payload, std::optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; >+ virtual void executeAllOptionalParameters(ErrorString&, const JSON::Array* opt_in_columnNames, const String* opt_in_notes, const double* opt_in_timestamp, const JSON::Object* opt_in_values, const JSON::Value* opt_in_payload, const int* opt_in_databaseId, const JSON::Object* opt_in_sqlError, const String* opt_in_screenColor, const JSON::Array* opt_in_alternateColors, const String* opt_in_printColor, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, WTF::Optional<String>& opt_out_notes, WTF::Optional<double>& opt_out_timestamp, WTF::Optional<JSON::Object>& opt_out_values, WTF::Optional<JSON::Value>& opt_out_payload, WTF::Optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; > virtual void executeNoOptionalParameters(ErrorString&, const JSON::Array& in_columnNames, const String& in_notes, double in_timestamp, const JSON::Object& in_values, JSON::Value in_payload, int in_databaseId, const JSON::Object& in_sqlError, const String& in_screenColor, const JSON::Array& in_alternateColors, const String& in_printColor, RefPtr<JSON::ArrayOf<String>>& out_columnNames, String* out_notes, double* out_timestamp, JSON::Object* out_values, JSON::Value* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, Inspector::Protocol::Database::PrimaryColors* out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0; > protected: > virtual ~DatabaseBackendDispatcherHandler(); >@@ -260,7 +260,7 @@ void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, Ref > bool opt_in_notes_valueFound = false; > String opt_in_notes = m_backendDispatcher->getString(parameters.get(), "notes"_s, &opt_in_notes_valueFound); > bool opt_in_timestamp_valueFound = false; >- std::optional<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), "timestamp"_s, &opt_in_timestamp_valueFound); >+ WTF::Optional<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), "timestamp"_s, &opt_in_timestamp_valueFound); > bool opt_in_values_valueFound = false; > RefPtr<JSON::Object> opt_in_values = m_backendDispatcher->getObject(parameters.get(), "values"_s, &opt_in_values_valueFound); > bool opt_in_payload_valueFound = false; >@@ -290,11 +290,11 @@ void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, Ref > ErrorString error; > Ref<JSON::Object> result = JSON::Object::create(); > RefPtr<JSON::ArrayOf<String>> out_columnNames; >- std::optional<String> out_notes; >- std::optional<double> out_timestamp; >- std::optional<JSON::Object> out_values; >- std::optional<JSON::Value> out_payload; >- std::optional<int> out_databaseId; >+ WTF::Optional<String> out_notes; >+ WTF::Optional<double> out_timestamp; >+ WTF::Optional<JSON::Object> out_values; >+ WTF::Optional<JSON::Value> out_payload; >+ WTF::Optional<int> out_databaseId; > RefPtr<Inspector::Protocol::Database::Error> out_sqlError; > Inspector::Protocol::Database::PrimaryColors out_screenColor; > RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors; >@@ -624,11 +624,11 @@ public: > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'Database' Domain > template<> >-std::optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&); >+WTF::Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&); > > } // namespace TestHelpers > >@@ -708,7 +708,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'Database' Domain > template<> >-std::optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Database::PrimaryColors::Red, >@@ -719,7 +719,7 @@ std::optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromSt > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Database::PrimaryColors)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -884,13 +884,13 @@ void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long r > TestProtocolDatabaseError *o_in_sqlError; > if (in_sqlError) > o_in_sqlError = [[[TestProtocolDatabaseError alloc] initWithJSONObject:in_sqlError] autorelease]; >- std::optional<TestProtocolDatabasePrimaryColors> o_in_screenColor; >+ WTF::Optional<TestProtocolDatabasePrimaryColors> o_in_screenColor; > if (in_screenColor) > o_in_screenColor = fromProtocolString<TestProtocolDatabasePrimaryColors>(*in_screenColor); > NSArray/*<NSString>*/ *o_in_alternateColors; > if (in_alternateColors) > o_in_alternateColors = toObjCStringArray(in_alternateColors); >- std::optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> o_in_printColor; >+ WTF::Optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> o_in_printColor; > if (in_printColor) > o_in_printColor = fromProtocolString<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor>(*in_printColor); > >@@ -932,13 +932,13 @@ void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long re > RWIProtocolJSONObject *o_in_payload = [[[RWIProtocolJSONObject alloc] initWithJSONObject:&in_payload] autorelease]; > int o_in_databaseId = in_databaseId; > TestProtocolDatabaseError *o_in_sqlError = [[[TestProtocolDatabaseError alloc] initWithJSONObject:&in_sqlError] autorelease]; >- std::optional<TestProtocolDatabasePrimaryColors> o_in_screenColor = fromProtocolString<TestProtocolDatabasePrimaryColors>(in_screenColor); >+ WTF::Optional<TestProtocolDatabasePrimaryColors> o_in_screenColor = fromProtocolString<TestProtocolDatabasePrimaryColors>(in_screenColor); > if (!o_in_screenColor) { > backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, "Parameter 'screenColor' of method 'Database.executeNoOptionalParameters' cannot be processed"_s); > return; > } > NSArray/*<NSString>*/ *o_in_alternateColors = toObjCStringArray(&in_alternateColors); >- std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> o_in_printColor = fromProtocolString<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor>(in_printColor); >+ WTF::Optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> o_in_printColor = fromProtocolString<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor>(in_printColor); > if (!o_in_printColor) { > backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, "Parameter 'printColor' of method 'Database.executeNoOptionalParameters' cannot be processed"_s); > return; >@@ -1300,7 +1300,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1317,7 +1317,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1327,7 +1327,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1344,7 +1344,7 @@ inline String toProtocolString(TestProtocolDatabasePrimaryColors value) > } > > template<> >-inline std::optional<TestProtocolDatabasePrimaryColors> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabasePrimaryColors> fromProtocolString(const String& value) > { > if (value == "red") > return TestProtocolDatabasePrimaryColorsRed; >@@ -1352,7 +1352,7 @@ inline std::optional<TestProtocolDatabasePrimaryColors> fromProtocolString(const > return TestProtocolDatabasePrimaryColorsGreen; > if (value == "blue") > return TestProtocolDatabasePrimaryColorsBlue; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteAllOptionalParametersPrintColor value) >@@ -1370,7 +1370,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteAllOptionalParametersP > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan; >@@ -1380,7 +1380,7 @@ inline std::optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> > return TestProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteAllOptionalParametersPrintColor value) >@@ -1398,7 +1398,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteAllOptionalParametersP > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan; >@@ -1408,7 +1408,7 @@ inline std::optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> > return TestProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteNoOptionalParametersPrintColor value) >@@ -1426,7 +1426,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteNoOptionalParametersPr > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan; >@@ -1436,7 +1436,7 @@ inline std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> > return TestProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseExecuteNoOptionalParametersPrintColor value) >@@ -1454,7 +1454,7 @@ inline String toProtocolString(TestProtocolDatabaseExecuteNoOptionalParametersPr > } > > template<> >-inline std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> fromProtocolString(const String& value) > { > if (value == "cyan") > return TestProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan; >@@ -1464,7 +1464,7 @@ inline std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> > return TestProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow; > if (value == "black") > return TestProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >@@ -1530,7 +1530,7 @@ using namespace Inspector; > + (void)_parsePrimaryColors:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolDatabasePrimaryColors> result = Inspector::fromProtocolString<TestProtocolDatabasePrimaryColors>(payload); >+ WTF::Optional<TestProtocolDatabasePrimaryColors> result = Inspector::fromProtocolString<TestProtocolDatabasePrimaryColors>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"PrimaryColors"); > *outValue = @(result.value()); > } >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result >index bc579b4a5d6bc8a91af8fc4db2ce406d2eaab9c1..4d8675a7672979712668f72a55b08806a22fc06b 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result >@@ -742,7 +742,7 @@ typedef NS_ENUM(NSInteger, TestProtocolPlatform) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -759,7 +759,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -769,7 +769,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result >index f1ab2ef42f3ac125be7475e81d3a9a6112a52863..d313cee8f1736aa6242d0300da2f14b3d4c2870f 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result >@@ -996,7 +996,7 @@ typedef NS_ENUM(NSInteger, TestProtocolPlatform) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1013,7 +1013,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1023,7 +1023,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result >index c663e65fc2bf3fcc99c2a7ce36c757037d572081..81a45c9effc22cb9113278342c5e64699e2c99e4 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result >@@ -1259,7 +1259,7 @@ typedef NS_ENUM(NSInteger, TestProtocolPlatform) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1276,7 +1276,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1286,7 +1286,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result >index a00de438d90c05b6ccf6dd4efa864dadc2ac6a12..e7929172d7e43368a3f519d034823454dbc72ef7 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result >@@ -472,11 +472,11 @@ enum class TypeDomainEnum { > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'TypeDomain' Domain > template<> >-std::optional<Inspector::Protocol::TypeDomain::TypeDomainEnum> parseEnumValueFromString<Inspector::Protocol::TypeDomain::TypeDomainEnum>(const String&); >+WTF::Optional<Inspector::Protocol::TypeDomain::TypeDomainEnum> parseEnumValueFromString<Inspector::Protocol::TypeDomain::TypeDomainEnum>(const String&); > > } // namespace TestHelpers > >@@ -558,7 +558,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'TypeDomain' Domain > template<> >-std::optional<Inspector::Protocol::TypeDomain::TypeDomainEnum> parseEnumValueFromString<Inspector::Protocol::TypeDomain::TypeDomainEnum>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::TypeDomain::TypeDomainEnum> parseEnumValueFromString<Inspector::Protocol::TypeDomain::TypeDomainEnum>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::TypeDomain::TypeDomainEnum::Shared, >@@ -570,7 +570,7 @@ std::optional<Inspector::Protocol::TypeDomain::TypeDomainEnum> parseEnumValueFro > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::TypeDomain::TypeDomainEnum)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1052,7 +1052,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1069,7 +1069,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1079,7 +1079,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1098,7 +1098,7 @@ inline String toProtocolString(TestProtocolTypeDomainEnum value) > } > > template<> >-inline std::optional<TestProtocolTypeDomainEnum> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolTypeDomainEnum> fromProtocolString(const String& value) > { > if (value == "shared") > return TestProtocolTypeDomainEnumShared; >@@ -1108,7 +1108,7 @@ inline std::optional<TestProtocolTypeDomainEnum> fromProtocolString(const String > return TestProtocolTypeDomainEnumGreen; > if (value == "blue") > return TestProtocolTypeDomainEnumBlue; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >@@ -1165,7 +1165,7 @@ using namespace Inspector; > + (void)_parseTypeDomainEnum:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolTypeDomainEnum> result = Inspector::fromProtocolString<TestProtocolTypeDomainEnum>(payload); >+ WTF::Optional<TestProtocolTypeDomainEnum> result = Inspector::fromProtocolString<TestProtocolTypeDomainEnum>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"TypeDomainEnum"); > *outValue = @(result.value()); > } >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result >index ebf6428104ca696925912b77cc89faf463c006c9..d847bc237e26a7a0a03c51137ae4624b7e4b6486 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result >@@ -992,7 +992,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1009,7 +1009,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1019,7 +1019,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result >index 050dbe240ce2d1962bfdad9f26ac9c4c158bdb1c..a3fd9a2313e563e355da286617062bdb5ea3aeb4 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result >@@ -1033,7 +1033,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1050,7 +1050,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1060,7 +1060,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result >index 5d4f91cbace25d5ba3bf9d7221ecf032168463b7..fbadcd59e914297bbd08ff2f1076a8165bbc41d8 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result >@@ -752,7 +752,7 @@ typedef NS_ENUM(NSInteger, TestProtocolPlatform) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -769,7 +769,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -779,7 +779,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result >index f52537bfb1ab95db317b1673c74c3a52331f7de4..96b530895997ffda9703f99eb3be51b88670cc57 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result >@@ -413,11 +413,11 @@ public: > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'Runtime' Domain > template<> >-std::optional<Inspector::Protocol::Runtime::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::KeyPath::Type>(const String&); >+WTF::Optional<Inspector::Protocol::Runtime::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::KeyPath::Type>(const String&); > > } // namespace TestHelpers > >@@ -481,7 +481,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'Runtime' Domain > template<> >-std::optional<Inspector::Protocol::Runtime::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::KeyPath::Type>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Runtime::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::KeyPath::Type>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Runtime::KeyPath::Type::Null, >@@ -492,7 +492,7 @@ std::optional<Inspector::Protocol::Runtime::KeyPath::Type> parseEnumValueFromStr > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Runtime::KeyPath::Type)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -889,7 +889,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -906,7 +906,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -916,7 +916,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -933,7 +933,7 @@ inline String toProtocolString(TestProtocolRuntimeKeyPathType value) > } > > template<> >-inline std::optional<TestProtocolRuntimeKeyPathType> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolRuntimeKeyPathType> fromProtocolString(const String& value) > { > if (value == "null") > return TestProtocolRuntimeKeyPathTypeNull; >@@ -941,7 +941,7 @@ inline std::optional<TestProtocolRuntimeKeyPathType> fromProtocolString(const St > return TestProtocolRuntimeKeyPathTypeString; > if (value == "array") > return TestProtocolRuntimeKeyPathTypeArray; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >@@ -1055,7 +1055,7 @@ using namespace Inspector; > return nil; > > THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@"type"], @"type"); >- std::optional<TestProtocolRuntimeKeyPathType> type = fromProtocolString<TestProtocolRuntimeKeyPathType>(payload[@"type"]); >+ WTF::Optional<TestProtocolRuntimeKeyPathType> type = fromProtocolString<TestProtocolRuntimeKeyPathType>(payload[@"type"]); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(type, @"type"); > self.type = type.value(); > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result >index 0ca420254899bb8a0e050e41f79170825f1afbdb..953911dcfa42d2532657da59af8a99f1f013b08b 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result >@@ -747,7 +747,7 @@ typedef NS_ENUM(NSInteger, TestProtocolPlatform) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -764,7 +764,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -774,7 +774,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result >index 87f9d4f17267a80002ee798d93666aeab69fbb19..7fe0f870004db79fe5e9d6e9c930b6c22b0f2ea2 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result >@@ -364,11 +364,11 @@ enum class Reason { > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'Debugger' Domain > template<> >-std::optional<Inspector::Protocol::Debugger::Reason> parseEnumValueFromString<Inspector::Protocol::Debugger::Reason>(const String&); >+WTF::Optional<Inspector::Protocol::Debugger::Reason> parseEnumValueFromString<Inspector::Protocol::Debugger::Reason>(const String&); > > } // namespace TestHelpers > >@@ -444,7 +444,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'Debugger' Domain > template<> >-std::optional<Inspector::Protocol::Debugger::Reason> parseEnumValueFromString<Inspector::Protocol::Debugger::Reason>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Debugger::Reason> parseEnumValueFromString<Inspector::Protocol::Debugger::Reason>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Debugger::Reason::Died, >@@ -455,7 +455,7 @@ std::optional<Inspector::Protocol::Debugger::Reason> parseEnumValueFromString<In > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Debugger::Reason)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -843,7 +843,7 @@ typedef NS_ENUM(NSInteger, TestProtocolDebuggerReason) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -860,7 +860,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -870,7 +870,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -887,7 +887,7 @@ inline String toProtocolString(TestProtocolDebuggerReason value) > } > > template<> >-inline std::optional<TestProtocolDebuggerReason> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDebuggerReason> fromProtocolString(const String& value) > { > if (value == "Died") > return TestProtocolDebuggerReasonDied; >@@ -895,7 +895,7 @@ inline std::optional<TestProtocolDebuggerReason> fromProtocolString(const String > return TestProtocolDebuggerReasonFainted; > if (value == "Hungry") > return TestProtocolDebuggerReasonHungry; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -971,7 +971,7 @@ using namespace Inspector; > + (void)_parseReason:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolDebuggerReason> result = Inspector::fromProtocolString<TestProtocolDebuggerReason>(payload); >+ WTF::Optional<TestProtocolDebuggerReason> result = Inspector::fromProtocolString<TestProtocolDebuggerReason>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"Reason"); > *outValue = @(result.value()); > } >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result >index f667dd24ebf08bc6c92eabf55e2a5e5e79bb76cc..d6e1fe0cd2ccb8022fa334437da59f14ba944b8a 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result >@@ -361,13 +361,13 @@ enum class TwoLeggedAnimals { > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'Runtime' Domain > template<> >-std::optional<Inspector::Protocol::Runtime::FarmAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::FarmAnimals>(const String&); >+WTF::Optional<Inspector::Protocol::Runtime::FarmAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::FarmAnimals>(const String&); > template<> >-std::optional<Inspector::Protocol::Runtime::TwoLeggedAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::TwoLeggedAnimals>(const String&); >+WTF::Optional<Inspector::Protocol::Runtime::TwoLeggedAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::TwoLeggedAnimals>(const String&); > > } // namespace TestHelpers > >@@ -451,7 +451,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'Runtime' Domain > template<> >-std::optional<Inspector::Protocol::Runtime::FarmAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::FarmAnimals>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Runtime::FarmAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::FarmAnimals>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Runtime::FarmAnimals::Pigs, >@@ -463,11 +463,11 @@ std::optional<Inspector::Protocol::Runtime::FarmAnimals> parseEnumValueFromStrin > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Runtime::FarmAnimals)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> >-std::optional<Inspector::Protocol::Runtime::TwoLeggedAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::TwoLeggedAnimals>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Runtime::TwoLeggedAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::TwoLeggedAnimals>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Runtime::TwoLeggedAnimals::Ducks, >@@ -479,7 +479,7 @@ std::optional<Inspector::Protocol::Runtime::TwoLeggedAnimals> parseEnumValueFrom > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Runtime::TwoLeggedAnimals)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -875,7 +875,7 @@ typedef NS_ENUM(NSInteger, TestProtocolRuntimeTwoLeggedAnimals) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -892,7 +892,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -902,7 +902,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -921,7 +921,7 @@ inline String toProtocolString(TestProtocolRuntimeFarmAnimals value) > } > > template<> >-inline std::optional<TestProtocolRuntimeFarmAnimals> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolRuntimeFarmAnimals> fromProtocolString(const String& value) > { > if (value == "Pigs") > return TestProtocolRuntimeFarmAnimalsPigs; >@@ -931,7 +931,7 @@ inline std::optional<TestProtocolRuntimeFarmAnimals> fromProtocolString(const St > return TestProtocolRuntimeFarmAnimalsCats; > if (value == "Hens") > return TestProtocolRuntimeFarmAnimalsHens; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolRuntimeTwoLeggedAnimals value) >@@ -949,7 +949,7 @@ inline String toProtocolString(TestProtocolRuntimeTwoLeggedAnimals value) > } > > template<> >-inline std::optional<TestProtocolRuntimeTwoLeggedAnimals> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolRuntimeTwoLeggedAnimals> fromProtocolString(const String& value) > { > if (value == "Ducks") > return TestProtocolRuntimeTwoLeggedAnimalsDucks; >@@ -959,7 +959,7 @@ inline std::optional<TestProtocolRuntimeTwoLeggedAnimals> fromProtocolString(con > return TestProtocolRuntimeTwoLeggedAnimalsCrows; > if (value == "Flamingos") > return TestProtocolRuntimeTwoLeggedAnimalsFlamingos; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >@@ -1017,7 +1017,7 @@ using namespace Inspector; > + (void)_parseFarmAnimals:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolRuntimeFarmAnimals> result = Inspector::fromProtocolString<TestProtocolRuntimeFarmAnimals>(payload); >+ WTF::Optional<TestProtocolRuntimeFarmAnimals> result = Inspector::fromProtocolString<TestProtocolRuntimeFarmAnimals>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"FarmAnimals"); > *outValue = @(result.value()); > } >@@ -1025,7 +1025,7 @@ using namespace Inspector; > + (void)_parseTwoLeggedAnimals:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolRuntimeTwoLeggedAnimals> result = Inspector::fromProtocolString<TestProtocolRuntimeTwoLeggedAnimals>(payload); >+ WTF::Optional<TestProtocolRuntimeTwoLeggedAnimals> result = Inspector::fromProtocolString<TestProtocolRuntimeTwoLeggedAnimals>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"TwoLeggedAnimals"); > *outValue = @(result.value()); > } >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result >index ac7adc71d792e118a3a8099270df5302a60e9b63..27dad8145cd8bb605ce20468c2d68dcc4320695d 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result >@@ -878,19 +878,19 @@ public: > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'Database' Domain > template<> >-std::optional<Inspector::Protocol::Database::MouseButton> parseEnumValueFromString<Inspector::Protocol::Database::MouseButton>(const String&); >+WTF::Optional<Inspector::Protocol::Database::MouseButton> parseEnumValueFromString<Inspector::Protocol::Database::MouseButton>(const String&); > template<> >-std::optional<Inspector::Protocol::Database::OptionalParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::OptionalParameterBundle::Directionality>(const String&); >+WTF::Optional<Inspector::Protocol::Database::OptionalParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::OptionalParameterBundle::Directionality>(const String&); > template<> >-std::optional<Inspector::Protocol::Database::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::ParameterBundle::Directionality>(const String&); >+WTF::Optional<Inspector::Protocol::Database::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::ParameterBundle::Directionality>(const String&); > > // Enums in the 'Test' Domain > template<> >-std::optional<Inspector::Protocol::Test::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Test::ParameterBundle::Directionality>(const String&); >+WTF::Optional<Inspector::Protocol::Test::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Test::ParameterBundle::Directionality>(const String&); > > } // namespace TestHelpers > >@@ -969,7 +969,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'Database' Domain > template<> >-std::optional<Inspector::Protocol::Database::MouseButton> parseEnumValueFromString<Inspector::Protocol::Database::MouseButton>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Database::MouseButton> parseEnumValueFromString<Inspector::Protocol::Database::MouseButton>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Database::MouseButton::None, >@@ -981,11 +981,11 @@ std::optional<Inspector::Protocol::Database::MouseButton> parseEnumValueFromStri > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Database::MouseButton)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> >-std::optional<Inspector::Protocol::Database::OptionalParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::OptionalParameterBundle::Directionality>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Database::OptionalParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::OptionalParameterBundle::Directionality>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Database::OptionalParameterBundle::Directionality::LTR, >@@ -995,11 +995,11 @@ std::optional<Inspector::Protocol::Database::OptionalParameterBundle::Directiona > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Database::OptionalParameterBundle::Directionality)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> >-std::optional<Inspector::Protocol::Database::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::ParameterBundle::Directionality>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Database::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Database::ParameterBundle::Directionality>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Database::ParameterBundle::Directionality::LTR, >@@ -1009,13 +1009,13 @@ std::optional<Inspector::Protocol::Database::ParameterBundle::Directionality> pa > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Database::ParameterBundle::Directionality)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > > // Enums in the 'Test' Domain > template<> >-std::optional<Inspector::Protocol::Test::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Test::ParameterBundle::Directionality>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Test::ParameterBundle::Directionality> parseEnumValueFromString<Inspector::Protocol::Test::ParameterBundle::Directionality>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Test::ParameterBundle::Directionality::LTR, >@@ -1025,7 +1025,7 @@ std::optional<Inspector::Protocol::Test::ParameterBundle::Directionality> parseE > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Test::ParameterBundle::Directionality)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1506,7 +1506,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1523,7 +1523,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1533,7 +1533,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1552,7 +1552,7 @@ inline String toProtocolString(TestProtocolDatabaseMouseButton value) > } > > template<> >-inline std::optional<TestProtocolDatabaseMouseButton> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseMouseButton> fromProtocolString(const String& value) > { > if (value == "None") > return TestProtocolDatabaseMouseButtonNone; >@@ -1562,7 +1562,7 @@ inline std::optional<TestProtocolDatabaseMouseButton> fromProtocolString(const S > return TestProtocolDatabaseMouseButtonMiddle; > if (value == "Right") > return TestProtocolDatabaseMouseButtonRight; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseOptionalParameterBundleDirectionality value) >@@ -1576,13 +1576,13 @@ inline String toProtocolString(TestProtocolDatabaseOptionalParameterBundleDirect > } > > template<> >-inline std::optional<TestProtocolDatabaseOptionalParameterBundleDirectionality> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseOptionalParameterBundleDirectionality> fromProtocolString(const String& value) > { > if (value == "LTR") > return TestProtocolDatabaseOptionalParameterBundleDirectionalityLTR; > if (value == "RTL") > return TestProtocolDatabaseOptionalParameterBundleDirectionalityRTL; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolDatabaseParameterBundleDirectionality value) >@@ -1596,13 +1596,13 @@ inline String toProtocolString(TestProtocolDatabaseParameterBundleDirectionality > } > > template<> >-inline std::optional<TestProtocolDatabaseParameterBundleDirectionality> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolDatabaseParameterBundleDirectionality> fromProtocolString(const String& value) > { > if (value == "LTR") > return TestProtocolDatabaseParameterBundleDirectionalityLTR; > if (value == "RTL") > return TestProtocolDatabaseParameterBundleDirectionalityRTL; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1617,13 +1617,13 @@ inline String toProtocolString(TestProtocolTestParameterBundleDirectionality val > } > > template<> >-inline std::optional<TestProtocolTestParameterBundleDirectionality> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolTestParameterBundleDirectionality> fromProtocolString(const String& value) > { > if (value == "LTR") > return TestProtocolTestParameterBundleDirectionalityLTR; > if (value == "RTL") > return TestProtocolTestParameterBundleDirectionalityRTL; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >@@ -1703,7 +1703,7 @@ using namespace Inspector; > + (void)_parseMouseButton:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolDatabaseMouseButton> result = Inspector::fromProtocolString<TestProtocolDatabaseMouseButton>(payload); >+ WTF::Optional<TestProtocolDatabaseMouseButton> result = Inspector::fromProtocolString<TestProtocolDatabaseMouseButton>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"MouseButton"); > *outValue = @(result.value()); > } >@@ -1856,7 +1856,7 @@ using namespace Inspector; > > self.buttons = payload[@"buttons"]; > >- std::optional<TestProtocolDatabaseOptionalParameterBundleDirectionality> directionality = fromProtocolString<TestProtocolDatabaseOptionalParameterBundleDirectionality>(payload[@"directionality"]); >+ WTF::Optional<TestProtocolDatabaseOptionalParameterBundleDirectionality> directionality = fromProtocolString<TestProtocolDatabaseOptionalParameterBundleDirectionality>(payload[@"directionality"]); > if (directionality) > self.directionality = directionality.value(); > >@@ -1998,7 +1998,7 @@ using namespace Inspector; > self.buttons = payload[@"buttons"]; > > THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@"directionality"], @"directionality"); >- std::optional<TestProtocolDatabaseParameterBundleDirectionality> directionality = fromProtocolString<TestProtocolDatabaseParameterBundleDirectionality>(payload[@"directionality"]); >+ WTF::Optional<TestProtocolDatabaseParameterBundleDirectionality> directionality = fromProtocolString<TestProtocolDatabaseParameterBundleDirectionality>(payload[@"directionality"]); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(directionality, @"directionality"); > self.directionality = directionality.value(); > >@@ -2291,7 +2291,7 @@ using namespace Inspector; > return nil; > > THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@"directionality"], @"directionality"); >- std::optional<TestProtocolTestParameterBundleDirectionality> directionality = fromProtocolString<TestProtocolTestParameterBundleDirectionality>(payload[@"directionality"]); >+ WTF::Optional<TestProtocolTestParameterBundleDirectionality> directionality = fromProtocolString<TestProtocolTestParameterBundleDirectionality>(payload[@"directionality"]); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(directionality, @"directionality"); > self.directionality = directionality.value(); > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result >index 76f8842dcf9a64b8f20909223e1271d063129dff..7878679b01016ac80d04329d81316ced13ea5655 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result >@@ -575,13 +575,13 @@ static void assertValueHasExpectedType(JSON::Value*); > namespace TestHelpers { > > template<typename ProtocolEnumType> >-std::optional<ProtocolEnumType> parseEnumValueFromString(const String&); >+WTF::Optional<ProtocolEnumType> parseEnumValueFromString(const String&); > > // Enums in the 'Test' Domain > template<> >-std::optional<Inspector::Protocol::Test::UncastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::UncastedAnimals>(const String&); >+WTF::Optional<Inspector::Protocol::Test::UncastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::UncastedAnimals>(const String&); > template<> >-std::optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::CastedAnimals>(const String&); >+WTF::Optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::CastedAnimals>(const String&); > > } // namespace TestHelpers > >@@ -665,7 +665,7 @@ String getEnumConstantValue(int code) { > > // Enums in the 'Test' Domain > template<> >-std::optional<Inspector::Protocol::Test::UncastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::UncastedAnimals>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Test::UncastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::UncastedAnimals>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Test::UncastedAnimals::Pigs, >@@ -677,11 +677,11 @@ std::optional<Inspector::Protocol::Test::UncastedAnimals> parseEnumValueFromStri > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Test::UncastedAnimals)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> >-std::optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::CastedAnimals>(const String& protocolString) >+WTF::Optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::CastedAnimals>(const String& protocolString) > { > static const size_t constantValues[] = { > (size_t)Inspector::Protocol::Test::CastedAnimals::Ducks, >@@ -693,7 +693,7 @@ std::optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString > if (protocolString == enum_constant_values[constantValues[i]]) > return (Inspector::Protocol::Test::CastedAnimals)constantValues[i]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1227,7 +1227,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1244,7 +1244,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1254,7 +1254,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -1273,7 +1273,7 @@ inline String toProtocolString(TestProtocolTestUncastedAnimals value) > } > > template<> >-inline std::optional<TestProtocolTestUncastedAnimals> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolTestUncastedAnimals> fromProtocolString(const String& value) > { > if (value == "Pigs") > return TestProtocolTestUncastedAnimalsPigs; >@@ -1283,7 +1283,7 @@ inline std::optional<TestProtocolTestUncastedAnimals> fromProtocolString(const S > return TestProtocolTestUncastedAnimalsCats; > if (value == "Hens") > return TestProtocolTestUncastedAnimalsHens; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline String toProtocolString(TestProtocolTestCastedAnimals value) >@@ -1301,7 +1301,7 @@ inline String toProtocolString(TestProtocolTestCastedAnimals value) > } > > template<> >-inline std::optional<TestProtocolTestCastedAnimals> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolTestCastedAnimals> fromProtocolString(const String& value) > { > if (value == "Ducks") > return TestProtocolTestCastedAnimalsDucks; >@@ -1311,7 +1311,7 @@ inline std::optional<TestProtocolTestCastedAnimals> fromProtocolString(const Str > return TestProtocolTestCastedAnimalsCrows; > if (value == "Flamingos") > return TestProtocolTestCastedAnimalsFlamingos; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >@@ -1392,7 +1392,7 @@ using namespace Inspector; > + (void)_parseUncastedAnimals:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolTestUncastedAnimals> result = Inspector::fromProtocolString<TestProtocolTestUncastedAnimals>(payload); >+ WTF::Optional<TestProtocolTestUncastedAnimals> result = Inspector::fromProtocolString<TestProtocolTestUncastedAnimals>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"UncastedAnimals"); > *outValue = @(result.value()); > } >@@ -1400,7 +1400,7 @@ using namespace Inspector; > + (void)_parseCastedAnimals:(NSNumber **)outValue fromPayload:(id)payload > { > THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); >- std::optional<TestProtocolTestCastedAnimals> result = Inspector::fromProtocolString<TestProtocolTestCastedAnimals>(payload); >+ WTF::Optional<TestProtocolTestCastedAnimals> result = Inspector::fromProtocolString<TestProtocolTestCastedAnimals>(payload); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"CastedAnimals"); > *outValue = @(result.value()); > } >@@ -1477,7 +1477,7 @@ using namespace Inspector; > self.number = [payload[@"number"] integerValue]; > > THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@"animals"], @"animals"); >- std::optional<TestProtocolTestCastedAnimals> animals = fromProtocolString<TestProtocolTestCastedAnimals>(payload[@"animals"]); >+ WTF::Optional<TestProtocolTestCastedAnimals> animals = fromProtocolString<TestProtocolTestCastedAnimals>(payload[@"animals"]); > THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(animals, @"animals"); > self.animals = animals.value(); > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result >index e5f5d1e49797abfe57899c287caeea2a08a40b09..d85af48daa468d2bc3e993700212fb9572de2d77 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result >@@ -900,7 +900,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -917,7 +917,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -927,7 +927,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result b/Source/JavaScriptCore/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result >index bc579b4a5d6bc8a91af8fc4db2ce406d2eaab9c1..4d8675a7672979712668f72a55b08806a22fc06b 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result >@@ -742,7 +742,7 @@ typedef NS_ENUM(NSInteger, TestProtocolPlatform) { > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -759,7 +759,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -769,7 +769,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace Inspector >diff --git a/Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result b/Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result >index 0eb7d2f5d7862cb48ab53d9d6c7f1eb09a52ec49..8b187555f95690fd6ec367b4ffc12ee1a044a038 100644 >--- a/Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result >+++ b/Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result >@@ -1006,7 +1006,7 @@ __attribute__((visibility ("default"))) > namespace Inspector { > > template<typename ObjCEnumType> >-std::optional<ObjCEnumType> fromProtocolString(const String& value); >+WTF::Optional<ObjCEnumType> fromProtocolString(const String& value); > > inline String toProtocolString(TestProtocolPlatform value) > { >@@ -1023,7 +1023,7 @@ inline String toProtocolString(TestProtocolPlatform value) > } > > template<> >-inline std::optional<TestProtocolPlatform> fromProtocolString(const String& value) >+inline WTF::Optional<TestProtocolPlatform> fromProtocolString(const String& value) > { > if (value == "all") > return TestProtocolPlatformAll; >@@ -1033,7 +1033,7 @@ inline std::optional<TestProtocolPlatform> fromProtocolString(const String& valu > return TestProtocolPlatformIOS; > if (value == "macos") > return TestProtocolPlatformMacOS; >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/JavaScriptCore/jit/JITCode.h b/Source/JavaScriptCore/jit/JITCode.h >index 66c5845d0df9d00074ffd9bf904be284cb76e72d..d89e311a0faaf091f973ecf8fd2922cfc429a963 100644 >--- a/Source/JavaScriptCore/jit/JITCode.h >+++ b/Source/JavaScriptCore/jit/JITCode.h >@@ -195,7 +195,7 @@ public: > > #if ENABLE(JIT) > virtual RegisterSet liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock*, CallSiteIndex); >- virtual std::optional<CodeOrigin> findPC(CodeBlock*, void* pc) { UNUSED_PARAM(pc); return std::nullopt; } >+ virtual WTF::Optional<CodeOrigin> findPC(CodeBlock*, void* pc) { UNUSED_PARAM(pc); return WTF::nullopt; } > #endif > > private: >diff --git a/Source/JavaScriptCore/jit/JITDivGenerator.cpp b/Source/JavaScriptCore/jit/JITDivGenerator.cpp >index a5db7e1b26e234bd1dd21813b5eee2928f9b4292..0b2d0a2e4c65d634abebb6606f80439da82a1b70 100644 >--- a/Source/JavaScriptCore/jit/JITDivGenerator.cpp >+++ b/Source/JavaScriptCore/jit/JITDivGenerator.cpp >@@ -82,7 +82,7 @@ void JITDivGenerator::generateFastPath(CCallHelpers& jit) > loadOperand(jit, m_leftOperand, m_left, m_leftFPR); > > #if USE(JSVALUE64) >- std::optional<double> safeReciprocal; >+ WTF::Optional<double> safeReciprocal; > if (m_rightOperand.isConst()) { > double constant = m_rightOperand.asConstNumber(); > safeReciprocal = safeReciprocalForDivByConst(constant); >diff --git a/Source/JavaScriptCore/jit/JITOperations.cpp b/Source/JavaScriptCore/jit/JITOperations.cpp >index 7b91d8fd33cb27594aa18f151a4ada34b473fe4a..f16810a7db97d8b6a616fc79acdbcb5e250f3216 100644 >--- a/Source/JavaScriptCore/jit/JITOperations.cpp >+++ b/Source/JavaScriptCore/jit/JITOperations.cpp >@@ -691,7 +691,7 @@ static void directPutByVal(CallFrame* callFrame, JSObject* baseObject, JSValue s > auto property = subscript.toPropertyKey(callFrame); > RETURN_IF_EXCEPTION(scope, void()); > >- if (std::optional<uint32_t> index = parseIndex(property)) { >+ if (WTF::Optional<uint32_t> index = parseIndex(property)) { > byValInfo->tookSlowPath = true; > scope.release(); > baseObject->putDirectIndex(callFrame, index.value(), value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); >diff --git a/Source/JavaScriptCore/jit/PCToCodeOriginMap.cpp b/Source/JavaScriptCore/jit/PCToCodeOriginMap.cpp >index 12a4d35dac194585d40832e338f0eb4bb2af8caf..0b24deb5a3b91abea9dc5144a38d61c14cf6b041 100644 >--- a/Source/JavaScriptCore/jit/PCToCodeOriginMap.cpp >+++ b/Source/JavaScriptCore/jit/PCToCodeOriginMap.cpp >@@ -246,11 +246,11 @@ double PCToCodeOriginMap::memorySize() > return size; > } > >-std::optional<CodeOrigin> PCToCodeOriginMap::findPC(void* pc) const >+WTF::Optional<CodeOrigin> PCToCodeOriginMap::findPC(void* pc) const > { > uintptr_t pcAsInt = bitwise_cast<uintptr_t>(pc); > if (!(m_pcRangeStart <= pcAsInt && pcAsInt <= m_pcRangeEnd)) >- return std::nullopt; >+ return WTF::nullopt; > > uintptr_t currentPC = 0; > CodeOrigin currentCodeOrigin(0, nullptr); >@@ -293,12 +293,12 @@ std::optional<CodeOrigin> PCToCodeOriginMap::findPC(void* pc) const > // We subtract 1 because we generate end points inclusively in this table, even though we are interested in ranges of the form: [previousPC, currentPC) > uintptr_t endOfRange = currentPC - 1; > if (startOfRange <= pcAsInt && pcAsInt <= endOfRange) >- return std::optional<CodeOrigin>(previousOrigin); // We return previousOrigin here because CodeOrigin's are mapped to the startValue of the range. >+ return WTF::Optional<CodeOrigin>(previousOrigin); // We return previousOrigin here because CodeOrigin's are mapped to the startValue of the range. > } > } > > RELEASE_ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace JSC >diff --git a/Source/JavaScriptCore/jit/PCToCodeOriginMap.h b/Source/JavaScriptCore/jit/PCToCodeOriginMap.h >index b3911b02b112e76b17e19f0e237ca2fbd46b03bc..8a1581163c0ff8d6d481352e7aa3200caf6e6e32 100644 >--- a/Source/JavaScriptCore/jit/PCToCodeOriginMap.h >+++ b/Source/JavaScriptCore/jit/PCToCodeOriginMap.h >@@ -81,7 +81,7 @@ public: > PCToCodeOriginMap(PCToCodeOriginMapBuilder&&, LinkBuffer&); > ~PCToCodeOriginMap(); > >- std::optional<CodeOrigin> findPC(void* pc) const; >+ WTF::Optional<CodeOrigin> findPC(void* pc) const; > > double memorySize(); > >diff --git a/Source/JavaScriptCore/jit/Repatch.cpp b/Source/JavaScriptCore/jit/Repatch.cpp >index 7311a6d5633895d126ca14463c713ddca704a2b1..9a6c7fc294e504040c56f719e0891632f6a26a0a 100644 >--- a/Source/JavaScriptCore/jit/Repatch.cpp >+++ b/Source/JavaScriptCore/jit/Repatch.cpp >@@ -332,7 +332,7 @@ static InlineCacheAction tryCacheGetByID(ExecState* exec, JSValue baseValue, con > if (slot.isCacheableGetter()) > getter = jsDynamicCast<JSFunction*>(vm, slot.getterSetter()->getter()); > >- std::optional<DOMAttributeAnnotation> domAttribute; >+ WTF::Optional<DOMAttributeAnnotation> domAttribute; > if (slot.isCacheableCustom() && slot.domAttribute()) > domAttribute = slot.domAttribute(); > >diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp >index 598f253db825792eaa2aa56aa5e3c6f977120650..d68445f22173b7c1eb544415ceb3a2c7d6cf9f0d 100644 >--- a/Source/JavaScriptCore/jsc.cpp >+++ b/Source/JavaScriptCore/jsc.cpp >@@ -709,11 +709,11 @@ ModuleName::ModuleName(const String& moduleName) > queries = moduleName.splitAllowingEmptyEntries('/'); > } > >-static std::optional<DirectoryName> extractDirectoryName(const String& absolutePathToFile) >+static WTF::Optional<DirectoryName> extractDirectoryName(const String& absolutePathToFile) > { > size_t firstSeparatorPosition = absolutePathToFile.find(pathSeparator()); > if (firstSeparatorPosition == notFound) >- return std::nullopt; >+ return WTF::nullopt; > DirectoryName directoryName; > directoryName.rootName = absolutePathToFile.substring(0, firstSeparatorPosition + 1); // Include the separator. > size_t lastSeparatorPosition = absolutePathToFile.reverseFind(pathSeparator()); >@@ -728,7 +728,7 @@ static std::optional<DirectoryName> extractDirectoryName(const String& absoluteP > return directoryName; > } > >-static std::optional<DirectoryName> currentWorkingDirectory() >+static WTF::Optional<DirectoryName> currentWorkingDirectory() > { > #if OS(WINDOWS) > // https://msdn.microsoft.com/en-us/library/windows/desktop/aa364934.aspx >@@ -742,7 +742,7 @@ static std::optional<DirectoryName> currentWorkingDirectory() > // In the path utility functions inside the JSC shell, we does not handle the UNC and UNCW including the network host name. > DWORD bufferLength = ::GetCurrentDirectoryW(0, nullptr); > if (!bufferLength) >- return std::nullopt; >+ return WTF::nullopt; > // In Windows, wchar_t is the UTF-16LE. > // https://msdn.microsoft.com/en-us/library/dd374081.aspx > // https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407.aspx >@@ -751,15 +751,15 @@ static std::optional<DirectoryName> currentWorkingDirectory() > String directoryString = wcharToString(buffer.data(), lengthNotIncludingNull); > // We don't support network path like \\host\share\<path name>. > if (directoryString.startsWith("\\\\")) >- return std::nullopt; >+ return WTF::nullopt; > #else > Vector<char> buffer(PATH_MAX); > if (!getcwd(buffer.data(), PATH_MAX)) >- return std::nullopt; >+ return WTF::nullopt; > String directoryString = String::fromUTF8(buffer.data()); > #endif > if (directoryString.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > if (directoryString[directoryString.length() - 1] == pathSeparator()) > return extractDirectoryName(directoryString); >@@ -2483,7 +2483,7 @@ static void runInteractive(GlobalObject* globalObject) > VM& vm = globalObject->vm(); > auto scope = DECLARE_CATCH_SCOPE(vm); > >- std::optional<DirectoryName> directoryName = currentWorkingDirectory(); >+ WTF::Optional<DirectoryName> directoryName = currentWorkingDirectory(); > if (!directoryName) > return; > SourceOrigin sourceOrigin(resolvePath(directoryName.value(), ModuleName("interpreter"))); >diff --git a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp >index 7edd1786397362c2b306e2fa4398a06eb50f9e9b..969e4e500cfce434f52319d8c7dd8ed649961424 100644 >--- a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp >+++ b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp >@@ -1064,7 +1064,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_val_direct) > if (UNLIKELY(throwScope.exception())) > LLINT_END(); > >- if (std::optional<uint32_t> index = parseIndex(property)) >+ if (WTF::Optional<uint32_t> index = parseIndex(property)) > baseObject->putDirectIndex(exec, index.value(), value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); > else { > PutPropertySlot slot(baseObject, isStrictMode); >diff --git a/Source/JavaScriptCore/parser/Lexer.cpp b/Source/JavaScriptCore/parser/Lexer.cpp >index dacd7f25086c16d0a4d43a64a73e6deb86ad51f0..08a20aea362cbd11ba38c64098a51875775727ed 100644 >--- a/Source/JavaScriptCore/parser/Lexer.cpp >+++ b/Source/JavaScriptCore/parser/Lexer.cpp >@@ -1539,7 +1539,7 @@ ALWAYS_INLINE auto Lexer<T>::parseHex() -> NumberParseResult > } > > template <typename T> >-ALWAYS_INLINE auto Lexer<T>::parseBinary() -> std::optional<NumberParseResult> >+ALWAYS_INLINE auto Lexer<T>::parseBinary() -> WTF::Optional<NumberParseResult> > { > // Optimization: most binary values fit into 4 bytes. > uint32_t binaryValue = 0; >@@ -1571,13 +1571,13 @@ ALWAYS_INLINE auto Lexer<T>::parseBinary() -> std::optional<NumberParseResult> > return Variant<double, const Identifier*> { makeIdentifier(m_buffer8.data(), m_buffer8.size()) }; > > if (isASCIIDigit(m_current)) >- return std::nullopt; >+ return WTF::nullopt; > > return Variant<double, const Identifier*> { parseIntOverflow(m_buffer8.data(), m_buffer8.size(), 2) }; > } > > template <typename T> >-ALWAYS_INLINE auto Lexer<T>::parseOctal() -> std::optional<NumberParseResult> >+ALWAYS_INLINE auto Lexer<T>::parseOctal() -> WTF::Optional<NumberParseResult> > { > // Optimization: most octal values fit into 4 bytes. > uint32_t octalValue = 0; >@@ -1610,13 +1610,13 @@ ALWAYS_INLINE auto Lexer<T>::parseOctal() -> std::optional<NumberParseResult> > return Variant<double, const Identifier*> { makeIdentifier(m_buffer8.data(), m_buffer8.size()) }; > > if (isASCIIDigit(m_current)) >- return std::nullopt; >+ return WTF::nullopt; > > return Variant<double, const Identifier*> { parseIntOverflow(m_buffer8.data(), m_buffer8.size(), 8) }; > } > > template <typename T> >-ALWAYS_INLINE auto Lexer<T>::parseDecimal() -> std::optional<NumberParseResult> >+ALWAYS_INLINE auto Lexer<T>::parseDecimal() -> WTF::Optional<NumberParseResult> > { > // Optimization: most decimal values fit into 4 bytes. > uint32_t decimalValue = 0; >@@ -1652,7 +1652,7 @@ ALWAYS_INLINE auto Lexer<T>::parseDecimal() -> std::optional<NumberParseResult> > if (UNLIKELY(Options::useBigInt() && m_current == 'n')) > return Variant<double, const Identifier*> { makeIdentifier(m_buffer8.data(), m_buffer8.size()) }; > >- return std::nullopt; >+ return WTF::nullopt; > } > > template <typename T> >diff --git a/Source/JavaScriptCore/parser/Lexer.h b/Source/JavaScriptCore/parser/Lexer.h >index 32f1b0b2acb5eeffdf5b29836f0a8a966c97ae25..f5c113cca4cda5593b0a3e0315b6e367639ab920 100644 >--- a/Source/JavaScriptCore/parser/Lexer.h >+++ b/Source/JavaScriptCore/parser/Lexer.h >@@ -179,9 +179,9 @@ private: > > using NumberParseResult = Variant<double, const Identifier*>; > ALWAYS_INLINE NumberParseResult parseHex(); >- ALWAYS_INLINE std::optional<NumberParseResult> parseBinary(); >- ALWAYS_INLINE std::optional<NumberParseResult> parseOctal(); >- ALWAYS_INLINE std::optional<NumberParseResult> parseDecimal(); >+ ALWAYS_INLINE WTF::Optional<NumberParseResult> parseBinary(); >+ ALWAYS_INLINE WTF::Optional<NumberParseResult> parseOctal(); >+ ALWAYS_INLINE WTF::Optional<NumberParseResult> parseDecimal(); > ALWAYS_INLINE void parseNumberAfterDecimalPoint(); > ALWAYS_INLINE bool parseNumberAfterExponentIndicator(); > ALWAYS_INLINE bool parseMultilineComment(); >diff --git a/Source/JavaScriptCore/parser/ModuleAnalyzer.cpp b/Source/JavaScriptCore/parser/ModuleAnalyzer.cpp >index 4522b0d68b0302b7d1c9ce93ab97aa2454386177..70d55858c1a794883ffce38757b80a941a262ea7 100644 >--- a/Source/JavaScriptCore/parser/ModuleAnalyzer.cpp >+++ b/Source/JavaScriptCore/parser/ModuleAnalyzer.cpp >@@ -82,7 +82,7 @@ void ModuleAnalyzer::exportVariable(ModuleProgramNode& moduleProgramNode, const > // Indirectly exported binding. > // import a from "mod" > // export { a } >- std::optional<JSModuleRecord::ImportEntry> optionalImportEntry = moduleRecord()->tryGetImportEntry(localName.get()); >+ WTF::Optional<JSModuleRecord::ImportEntry> optionalImportEntry = moduleRecord()->tryGetImportEntry(localName.get()); > ASSERT(optionalImportEntry); > const JSModuleRecord::ImportEntry& importEntry = *optionalImportEntry; > for (auto& exportName : moduleProgramNode.moduleScopeData().exportedBindings().get(localName.get())) >diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp >index 6832a58f42bf604052c11f9a24ffffa60fa7c2d4..212e622e57baaaef70200c61e547fdddfa02fedc 100644 >--- a/Source/JavaScriptCore/parser/Parser.cpp >+++ b/Source/JavaScriptCore/parser/Parser.cpp >@@ -194,7 +194,7 @@ Parser<LexerType>::~Parser() > } > > template <typename LexerType> >-String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMode parseMode, ParsingContext parsingContext, std::optional<int> functionConstructorParametersEndPosition) >+String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMode parseMode, ParsingContext parsingContext, WTF::Optional<int> functionConstructorParametersEndPosition) > { > String parseError = String(); > >@@ -614,7 +614,7 @@ template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseAsyncGen > } > > template <typename LexerType> >-template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseSingleFunction(TreeBuilder& context, std::optional<int> functionConstructorParametersEndPosition) >+template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseSingleFunction(TreeBuilder& context, WTF::Optional<int> functionConstructorParametersEndPosition) > { > TreeSourceElements sourceElements = context.createSourceElements(); > TreeStatement statement = 0; >@@ -2297,7 +2297,7 @@ template <class TreeBuilder> typename TreeBuilder::FormalParameterList Parser<Le > } > > template <typename LexerType> >-template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionNameRequirements requirements, SourceParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& functionInfo, FunctionDefinitionType functionDefinitionType, std::optional<int> functionConstructorParametersEndPosition) >+template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionNameRequirements requirements, SourceParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& functionInfo, FunctionDefinitionType functionDefinitionType, WTF::Optional<int> functionConstructorParametersEndPosition) > { > RELEASE_ASSERT(isFunctionParseMode(mode)); > >@@ -2631,7 +2631,7 @@ static NO_RETURN_DUE_TO_CRASH FunctionMetadataNode* getMetadata(ParserFunctionIn > static FunctionMetadataNode* getMetadata(ParserFunctionInfo<ASTBuilder>& info) { return info.body; } > > template <typename LexerType> >-template <class TreeBuilder> TreeStatement Parser<LexerType>::parseFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext, std::optional<int> functionConstructorParametersEndPosition) >+template <class TreeBuilder> TreeStatement Parser<LexerType>::parseFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext, WTF::Optional<int> functionConstructorParametersEndPosition) > { > ASSERT(match(FUNCTION)); > JSTokenLocation location(tokenLocation()); >@@ -2689,7 +2689,7 @@ template <class TreeBuilder> TreeStatement Parser<LexerType>::parseFunctionDecla > } > > template <typename LexerType> >-template <class TreeBuilder> TreeStatement Parser<LexerType>::parseAsyncFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext, std::optional<int> functionConstructorParametersEndPosition) >+template <class TreeBuilder> TreeStatement Parser<LexerType>::parseAsyncFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext, WTF::Optional<int> functionConstructorParametersEndPosition) > { > ASSERT(match(FUNCTION)); > JSTokenLocation location(tokenLocation()); >@@ -4659,7 +4659,7 @@ template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArgument(Tre > } > > template <typename TreeBuilder, typename ParserType, typename = typename std::enable_if<std::is_same<TreeBuilder, ASTBuilder>::value>::type> >-static inline void recordCallOrApplyDepth(ParserType* parser, VM& vm, std::optional<typename ParserType::CallOrApplyDepthScope>& callOrApplyDepthScope, ExpressionNode* expression) >+static inline void recordCallOrApplyDepth(ParserType* parser, VM& vm, WTF::Optional<typename ParserType::CallOrApplyDepthScope>& callOrApplyDepthScope, ExpressionNode* expression) > { > if (expression->isDotAccessorNode()) { > DotAccessorNode* dot = static_cast<DotAccessorNode*>(expression); >@@ -4670,7 +4670,7 @@ static inline void recordCallOrApplyDepth(ParserType* parser, VM& vm, std::optio > } > > template <typename TreeBuilder, typename ParserType, typename = typename std::enable_if<std::is_same<TreeBuilder, SyntaxChecker>::value>::type> >-static inline void recordCallOrApplyDepth(ParserType*, VM&, std::optional<typename ParserType::CallOrApplyDepthScope>&, SyntaxChecker::Expression) >+static inline void recordCallOrApplyDepth(ParserType*, VM&, WTF::Optional<typename ParserType::CallOrApplyDepthScope>&, SyntaxChecker::Expression) > { > } > >@@ -4800,7 +4800,7 @@ template <class TreeBuilder> TreeExpression Parser<LexerType>::parseMemberExpres > } else { > size_t usedVariablesSize = currentScope()->currentUsedVariablesSize(); > JSTextPosition expressionEnd = lastTokenEndPosition(); >- std::optional<CallOrApplyDepthScope> callOrApplyDepthScope; >+ WTF::Optional<CallOrApplyDepthScope> callOrApplyDepthScope; > recordCallOrApplyDepth<TreeBuilder>(this, *m_vm, callOrApplyDepthScope, base); > > TreeArguments arguments = parseArguments(context); >diff --git a/Source/JavaScriptCore/parser/Parser.h b/Source/JavaScriptCore/parser/Parser.h >index 6533ef9be86179eeb9a5c581adba7e06bf640892..7d882b92bab8aa586ac276395b4e392b7b20c79c 100644 >--- a/Source/JavaScriptCore/parser/Parser.h >+++ b/Source/JavaScriptCore/parser/Parser.h >@@ -872,7 +872,7 @@ public: > ~Parser(); > > template <class ParsedNode> >- std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, SourceParseMode, ParsingContext, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); >+ std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, SourceParseMode, ParsingContext, WTF::Optional<int> functionConstructorParametersEndPosition = WTF::nullopt); > > JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); } > JSTokenLocation locationBeforeLastToken() const { return m_lexer->lastTokenLocation(); } >@@ -1311,7 +1311,7 @@ private: > > Parser(); > >- String parseInner(const Identifier&, SourceParseMode, ParsingContext, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); >+ String parseInner(const Identifier&, SourceParseMode, ParsingContext, WTF::Optional<int> functionConstructorParametersEndPosition = WTF::nullopt); > > void didFinishParsing(SourceElements*, DeclarationStacks::FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, CodeFeatures, int); > >@@ -1523,14 +1523,14 @@ private: > template <class TreeBuilder> TreeSourceElements parseGeneratorFunctionSourceElements(TreeBuilder&, const Identifier& name, SourceElementsMode); > template <class TreeBuilder> TreeSourceElements parseAsyncFunctionSourceElements(TreeBuilder&, SourceParseMode, bool isArrowFunctionBodyExpression, SourceElementsMode); > template <class TreeBuilder> TreeSourceElements parseAsyncGeneratorFunctionSourceElements(TreeBuilder&, SourceParseMode, bool isArrowFunctionBodyExpression, SourceElementsMode); >- template <class TreeBuilder> TreeSourceElements parseSingleFunction(TreeBuilder&, std::optional<int> functionConstructorParametersEndPosition); >+ template <class TreeBuilder> TreeSourceElements parseSingleFunction(TreeBuilder&, WTF::Optional<int> functionConstructorParametersEndPosition); > template <class TreeBuilder> TreeStatement parseStatementListItem(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength); > template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength = 0); > enum class ExportType { Exported, NotExported }; > template <class TreeBuilder> TreeStatement parseClassDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard); >- template <class TreeBuilder> TreeStatement parseFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); >+ template <class TreeBuilder> TreeStatement parseFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard, WTF::Optional<int> functionConstructorParametersEndPosition = WTF::nullopt); > template <class TreeBuilder> TreeStatement parseFunctionDeclarationStatement(TreeBuilder&, bool isAsync, bool parentAllowsFunctionDeclarationAsStatement); >- template <class TreeBuilder> TreeStatement parseAsyncFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); >+ template <class TreeBuilder> TreeStatement parseAsyncFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard, WTF::Optional<int> functionConstructorParametersEndPosition = WTF::nullopt); > template <class TreeBuilder> NEVER_INLINE bool maybeParseAsyncFunctionDeclarationStatement(TreeBuilder& context, TreeStatement& result, bool parentAllowsFunctionDeclarationAsStatement); > template <class TreeBuilder> TreeStatement parseVariableDeclaration(TreeBuilder&, DeclarationType, ExportType = ExportType::NotExported); > template <class TreeBuilder> TreeStatement parseDoWhileStatement(TreeBuilder&); >@@ -1599,7 +1599,7 @@ private: > template <class TreeBuilder> ALWAYS_INLINE TreeExpression createResolveAndUseVariable(TreeBuilder&, const Identifier*, bool isEval, const JSTextPosition&, const JSTokenLocation&); > > enum class FunctionDefinitionType { Expression, Declaration, Method }; >- template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionNameRequirements, SourceParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionDefinitionType, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); >+ template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionNameRequirements, SourceParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionDefinitionType, WTF::Optional<int> functionConstructorParametersEndPosition = WTF::nullopt); > > ALWAYS_INLINE bool isArrowFunctionParameters(); > >@@ -1847,7 +1847,7 @@ private: > > template <typename LexerType> > template <class ParsedNode> >-std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, SourceParseMode parseMode, ParsingContext parsingContext, std::optional<int> functionConstructorParametersEndPosition) >+std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, SourceParseMode parseMode, ParsingContext parsingContext, WTF::Optional<int> functionConstructorParametersEndPosition) > { > int errLine; > String errMsg; >@@ -1986,7 +1986,7 @@ std::unique_ptr<ParsedNode> parse( > return result; > } > >-inline std::unique_ptr<ProgramNode> parseFunctionForFunctionConstructor(VM& vm, const SourceCode& source, ParserError& error, JSTextPosition* positionBeforeLastNewline, std::optional<int> functionConstructorParametersEndPosition) >+inline std::unique_ptr<ProgramNode> parseFunctionForFunctionConstructor(VM& vm, const SourceCode& source, ParserError& error, JSTextPosition* positionBeforeLastNewline, WTF::Optional<int> functionConstructorParametersEndPosition) > { > ASSERT(!source.provider()->source().isNull()); > >diff --git a/Source/JavaScriptCore/parser/SourceCodeKey.h b/Source/JavaScriptCore/parser/SourceCodeKey.h >index 655bc82a12646f4cb1835ddf64631a30e22fa1d0..17f423b9e56a86afd1af7225bc20e53db5a8e25b 100644 >--- a/Source/JavaScriptCore/parser/SourceCodeKey.h >+++ b/Source/JavaScriptCore/parser/SourceCodeKey.h >@@ -78,7 +78,7 @@ public: > SourceCodeKey( > const UnlinkedSourceCode& sourceCode, const String& name, SourceCodeType codeType, JSParserStrictMode strictMode, > JSParserScriptMode scriptMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext, >- DebuggerMode debuggerMode, TypeProfilerEnabled typeProfilerEnabled, ControlFlowProfilerEnabled controlFlowProfilerEnabled, std::optional<int> functionConstructorParametersEndPosition) >+ DebuggerMode debuggerMode, TypeProfilerEnabled typeProfilerEnabled, ControlFlowProfilerEnabled controlFlowProfilerEnabled, WTF::Optional<int> functionConstructorParametersEndPosition) > : m_sourceCode(sourceCode) > , m_name(name) > , m_flags(codeType, strictMode, scriptMode, derivedContextType, evalContextType, isArrowFunctionContext, debuggerMode, typeProfilerEnabled, controlFlowProfilerEnabled) >diff --git a/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp b/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp >index a4ad12ccf4ee35fc14826afcb06f898e5873bc25..25a99fdbf32e7f3d0ac8ed9106a70e161c66ff02 100644 >--- a/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp >+++ b/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp >@@ -98,20 +98,20 @@ void AbstractModuleRecord::addExportEntry(const ExportEntry& entry) > ASSERT_UNUSED(isNewEntry, isNewEntry); // This is guaranteed by the parser. > } > >-auto AbstractModuleRecord::tryGetImportEntry(UniquedStringImpl* localName) -> std::optional<ImportEntry> >+auto AbstractModuleRecord::tryGetImportEntry(UniquedStringImpl* localName) -> WTF::Optional<ImportEntry> > { > const auto iterator = m_importEntries.find(localName); > if (iterator == m_importEntries.end()) >- return std::nullopt; >- return std::optional<ImportEntry>(iterator->value); >+ return WTF::nullopt; >+ return WTF::Optional<ImportEntry>(iterator->value); > } > >-auto AbstractModuleRecord::tryGetExportEntry(UniquedStringImpl* exportName) -> std::optional<ExportEntry> >+auto AbstractModuleRecord::tryGetExportEntry(UniquedStringImpl* exportName) -> WTF::Optional<ExportEntry> > { > const auto iterator = m_exportEntries.find(exportName); > if (iterator == m_exportEntries.end()) >- return std::nullopt; >- return std::optional<ExportEntry>(iterator->value); >+ return WTF::nullopt; >+ return WTF::Optional<ExportEntry>(iterator->value); > } > > auto AbstractModuleRecord::ExportEntry::createLocal(const Identifier& exportName, const Identifier& localName) -> ExportEntry >@@ -154,7 +154,7 @@ auto AbstractModuleRecord::resolveImport(ExecState* exec, const Identifier& loca > VM& vm = exec->vm(); > auto scope = DECLARE_THROW_SCOPE(vm); > >- std::optional<ImportEntry> optionalImportEntry = tryGetImportEntry(localName.impl()); >+ WTF::Optional<ImportEntry> optionalImportEntry = tryGetImportEntry(localName.impl()); > if (!optionalImportEntry) > return Resolution::notFound(); > >@@ -233,12 +233,12 @@ inline bool AbstractModuleRecord::ResolveQuery::Hash::equal(const ResolveQuery& > return lhs.moduleRecord == rhs.moduleRecord && lhs.exportName == rhs.exportName; > } > >-auto AbstractModuleRecord::tryGetCachedResolution(UniquedStringImpl* exportName) -> std::optional<Resolution> >+auto AbstractModuleRecord::tryGetCachedResolution(UniquedStringImpl* exportName) -> WTF::Optional<Resolution> > { > const auto iterator = m_resolutionCache.find(exportName); > if (iterator == m_resolutionCache.end()) >- return std::nullopt; >- return std::optional<Resolution>(iterator->value); >+ return WTF::nullopt; >+ return WTF::Optional<Resolution>(iterator->value); > } > > void AbstractModuleRecord::cacheResolution(UniquedStringImpl* exportName, const Resolution& resolution) >@@ -595,14 +595,14 @@ auto AbstractModuleRecord::resolveExportImpl(ExecState* exec, const ResolveQuery > > // 4. Once we follow star links, we should not retrieve the result from the cache and should not cache the result. > if (!foundStarLinks) { >- if (std::optional<Resolution> cachedResolution = moduleRecord->tryGetCachedResolution(query.exportName.get())) { >+ if (WTF::Optional<Resolution> cachedResolution = moduleRecord->tryGetCachedResolution(query.exportName.get())) { > if (!mergeToCurrentTop(*cachedResolution)) > return Resolution::ambiguous(); > continue; > } > } > >- const std::optional<ExportEntry> optionalExportEntry = moduleRecord->tryGetExportEntry(query.exportName.get()); >+ const WTF::Optional<ExportEntry> optionalExportEntry = moduleRecord->tryGetExportEntry(query.exportName.get()); > if (!optionalExportEntry) { > // If there is no matched exported binding in the current module, > // we need to look into the stars. >@@ -690,7 +690,7 @@ auto AbstractModuleRecord::resolveExportImpl(ExecState* exec, const ResolveQuery > auto AbstractModuleRecord::resolveExport(ExecState* exec, const Identifier& exportName) -> Resolution > { > // Look up the cached resolution first before entering the resolving loop, since the loop setup takes some cost. >- if (std::optional<Resolution> cachedResolution = tryGetCachedResolution(exportName.impl())) >+ if (WTF::Optional<Resolution> cachedResolution = tryGetCachedResolution(exportName.impl())) > return *cachedResolution; > return resolveExportImpl(exec, ResolveQuery(this, exportName.impl())); > } >diff --git a/Source/JavaScriptCore/runtime/AbstractModuleRecord.h b/Source/JavaScriptCore/runtime/AbstractModuleRecord.h >index 5bb5b16fd3e19aec325465d8bd170c8efe974dc0..fe34db820ef100593071fc5873ad087b1d772213 100644 >--- a/Source/JavaScriptCore/runtime/AbstractModuleRecord.h >+++ b/Source/JavaScriptCore/runtime/AbstractModuleRecord.h >@@ -80,8 +80,8 @@ public: > void addImportEntry(const ImportEntry&); > void addExportEntry(const ExportEntry&); > >- std::optional<ImportEntry> tryGetImportEntry(UniquedStringImpl* localName); >- std::optional<ExportEntry> tryGetExportEntry(UniquedStringImpl* exportName); >+ WTF::Optional<ImportEntry> tryGetImportEntry(UniquedStringImpl* localName); >+ WTF::Optional<ExportEntry> tryGetExportEntry(UniquedStringImpl* exportName); > > const Identifier& moduleKey() const { return m_moduleKey; } > const OrderedIdentifierSet& requestedModules() const { return m_requestedModules; } >@@ -136,7 +136,7 @@ protected: > private: > struct ResolveQuery; > static Resolution resolveExportImpl(ExecState*, const ResolveQuery&); >- std::optional<Resolution> tryGetCachedResolution(UniquedStringImpl* exportName); >+ WTF::Optional<Resolution> tryGetCachedResolution(UniquedStringImpl* exportName); > void cacheResolution(UniquedStringImpl* exportName, const Resolution&); > > // The loader resolves the given module name to the module key. The module key is the unique value to represent this module. >diff --git a/Source/JavaScriptCore/runtime/CodeCache.cpp b/Source/JavaScriptCore/runtime/CodeCache.cpp >index faafb72b2a99b9cab8e795f01837bacefbc5fa5b..1943a1caf7291fbb0f8ff803d188a9e442303607 100644 >--- a/Source/JavaScriptCore/runtime/CodeCache.cpp >+++ b/Source/JavaScriptCore/runtime/CodeCache.cpp >@@ -58,7 +58,7 @@ UnlinkedCodeBlockType* CodeCache::getUnlinkedGlobalCodeBlock(VM& vm, ExecutableT > derivedContextType, evalContextType, isArrowFunctionContext, debuggerMode, > vm.typeProfiler() ? TypeProfilerEnabled::Yes : TypeProfilerEnabled::No, > vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No, >- std::nullopt); >+ WTF::nullopt); > SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key); > if (cache && Options::useCodeCache()) { > UnlinkedCodeBlockType* unlinkedCodeBlock = jsCast<UnlinkedCodeBlockType*>(cache->cell.get()); >@@ -96,7 +96,7 @@ UnlinkedModuleProgramCodeBlock* CodeCache::getUnlinkedModuleProgramCodeBlock(VM& > return getUnlinkedGlobalCodeBlock<UnlinkedModuleProgramCodeBlock>(vm, executable, source, JSParserStrictMode::Strict, JSParserScriptMode::Module, debuggerMode, error, EvalContextType::None); > } > >-UnlinkedFunctionExecutable* CodeCache::getUnlinkedGlobalFunctionExecutable(VM& vm, const Identifier& name, const SourceCode& source, DebuggerMode debuggerMode, std::optional<int> functionConstructorParametersEndPosition, ParserError& error) >+UnlinkedFunctionExecutable* CodeCache::getUnlinkedGlobalFunctionExecutable(VM& vm, const Identifier& name, const SourceCode& source, DebuggerMode debuggerMode, WTF::Optional<int> functionConstructorParametersEndPosition, ParserError& error) > { > bool isArrowFunctionContext = false; > SourceCodeKey key( >diff --git a/Source/JavaScriptCore/runtime/CodeCache.h b/Source/JavaScriptCore/runtime/CodeCache.h >index 53e3fda51e2e37d7e0dd092c0fda9579fbac73d4..53dc77919284ff9e41a10a0bf8cea5ba373889ed 100644 >--- a/Source/JavaScriptCore/runtime/CodeCache.h >+++ b/Source/JavaScriptCore/runtime/CodeCache.h >@@ -194,7 +194,7 @@ public: > UnlinkedProgramCodeBlock* getUnlinkedProgramCodeBlock(VM&, ProgramExecutable*, const SourceCode&, JSParserStrictMode, DebuggerMode, ParserError&); > UnlinkedEvalCodeBlock* getUnlinkedEvalCodeBlock(VM&, IndirectEvalExecutable*, const SourceCode&, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType); > UnlinkedModuleProgramCodeBlock* getUnlinkedModuleProgramCodeBlock(VM&, ModuleProgramExecutable*, const SourceCode&, DebuggerMode, ParserError&); >- UnlinkedFunctionExecutable* getUnlinkedGlobalFunctionExecutable(VM&, const Identifier&, const SourceCode&, DebuggerMode, std::optional<int> functionConstructorParametersEndPosition, ParserError&); >+ UnlinkedFunctionExecutable* getUnlinkedGlobalFunctionExecutable(VM&, const Identifier&, const SourceCode&, DebuggerMode, WTF::Optional<int> functionConstructorParametersEndPosition, ParserError&); > > void clear() { m_sourceCode.clear(); } > >diff --git a/Source/JavaScriptCore/runtime/ConcurrentJSLock.h b/Source/JavaScriptCore/runtime/ConcurrentJSLock.h >index cf59bc8dd20a3b1101e80924eba77ff5a5bfde6b..9f119a315fe432345baec5e1981e3e2bb55d9e2e 100644 >--- a/Source/JavaScriptCore/runtime/ConcurrentJSLock.h >+++ b/Source/JavaScriptCore/runtime/ConcurrentJSLock.h >@@ -120,7 +120,7 @@ public: > ConcurrentJSLocker(NoLockingNecessaryTag) > : ConcurrentJSLockerBase(NoLockingNecessary) > #if ENABLE(CONCURRENT_JS) && !defined(NDEBUG) >- , m_disallowGC(std::nullopt) >+ , m_disallowGC(WTF::nullopt) > #endif > { > } >@@ -129,7 +129,7 @@ public: > > #if ENABLE(CONCURRENT_JS) && !defined(NDEBUG) > private: >- std::optional<DisallowGC> m_disallowGC; >+ WTF::Optional<DisallowGC> m_disallowGC; > #endif > }; > >diff --git a/Source/JavaScriptCore/runtime/DefinePropertyAttributes.h b/Source/JavaScriptCore/runtime/DefinePropertyAttributes.h >index d7e3b9133335725a74a336404d662971100d4559..86bf1862055e0b96a590ed0646c28e7dddf95b55 100644 >--- a/Source/JavaScriptCore/runtime/DefinePropertyAttributes.h >+++ b/Source/JavaScriptCore/runtime/DefinePropertyAttributes.h >@@ -99,10 +99,10 @@ public: > return extractTriState(WritableShift) != MixedTriState; > } > >- std::optional<bool> writable() const >+ WTF::Optional<bool> writable() const > { > if (!hasWritable()) >- return std::nullopt; >+ return WTF::nullopt; > return extractTriState(WritableShift) == TrueTriState; > } > >@@ -111,10 +111,10 @@ public: > return extractTriState(ConfigurableShift) != MixedTriState; > } > >- std::optional<bool> configurable() const >+ WTF::Optional<bool> configurable() const > { > if (!hasConfigurable()) >- return std::nullopt; >+ return WTF::nullopt; > return extractTriState(ConfigurableShift) == TrueTriState; > } > >@@ -123,10 +123,10 @@ public: > return extractTriState(EnumerableShift) != MixedTriState; > } > >- std::optional<bool> enumerable() const >+ WTF::Optional<bool> enumerable() const > { > if (!hasEnumerable()) >- return std::nullopt; >+ return WTF::nullopt; > return extractTriState(EnumerableShift) == TrueTriState; > } > >diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.h b/Source/JavaScriptCore/runtime/ErrorConstructor.h >index 4eebf6849fab6f535f81bd0bd3a7735fce6a4320..a0e19e72fe0fbb1f81a9161aee9e7d4593869a4b 100644 >--- a/Source/JavaScriptCore/runtime/ErrorConstructor.h >+++ b/Source/JavaScriptCore/runtime/ErrorConstructor.h >@@ -51,7 +51,7 @@ public: > return Structure::create(vm, globalObject, prototype, TypeInfo(InternalFunctionType, StructureFlags), info()); > } > >- std::optional<unsigned> stackTraceLimit() const { return m_stackTraceLimit; } >+ WTF::Optional<unsigned> stackTraceLimit() const { return m_stackTraceLimit; } > > protected: > void finishCreation(VM&, ErrorPrototype*); >@@ -62,7 +62,7 @@ protected: > private: > ErrorConstructor(VM&, Structure*); > >- std::optional<unsigned> m_stackTraceLimit; >+ WTF::Optional<unsigned> m_stackTraceLimit; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp >index 7d3575fc37dbe6115641163cdee99a62d88efaba..1ea3aef72dd3d5452ba46c95186d69a56f46add8 100644 >--- a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp >+++ b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp >@@ -101,7 +101,7 @@ JSObject* constructFunctionSkippingEvalEnabledCheck( > // How we stringify functions is sometimes important for web compatibility. > // See https://bugs.webkit.org/show_bug.cgi?id=24350. > String program; >- std::optional<int> functionConstructorParametersEndPosition = std::nullopt; >+ WTF::Optional<int> functionConstructorParametersEndPosition = WTF::nullopt; > if (args.isEmpty()) > program = makeString(prefix, functionName.string(), "() {\n\n}"); > else if (args.size() == 1) { >diff --git a/Source/JavaScriptCore/runtime/FunctionExecutable.cpp b/Source/JavaScriptCore/runtime/FunctionExecutable.cpp >index eed3c216ca3bb7969fa6f88858dc695d66e5d114..c257104c699263a0f6ca6e3f783d53f677829abd 100644 >--- a/Source/JavaScriptCore/runtime/FunctionExecutable.cpp >+++ b/Source/JavaScriptCore/runtime/FunctionExecutable.cpp >@@ -94,7 +94,7 @@ void FunctionExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor) > > FunctionExecutable* FunctionExecutable::fromGlobalCode( > const Identifier& name, ExecState& exec, const SourceCode& source, >- JSObject*& exception, int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition) >+ JSObject*& exception, int overrideLineNumber, WTF::Optional<int> functionConstructorParametersEndPosition) > { > UnlinkedFunctionExecutable* unlinkedExecutable = > UnlinkedFunctionExecutable::fromGlobalCode( >diff --git a/Source/JavaScriptCore/runtime/FunctionExecutable.h b/Source/JavaScriptCore/runtime/FunctionExecutable.h >index 6ba85a152c774e31c71c712e2b26b5ead30bf95e..d22890ccbc8968cf3be6615d04079fdc585c6d45 100644 >--- a/Source/JavaScriptCore/runtime/FunctionExecutable.h >+++ b/Source/JavaScriptCore/runtime/FunctionExecutable.h >@@ -55,7 +55,7 @@ public: > } > static FunctionExecutable* fromGlobalCode( > const Identifier& name, ExecState&, const SourceCode&, >- JSObject*& exception, int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition); >+ JSObject*& exception, int overrideLineNumber, WTF::Optional<int> functionConstructorParametersEndPosition); > > static void destroy(JSCell*); > >diff --git a/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h b/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h >index 40dbc6094343d97310d9fdc97d8f6bbb8397404f..96faadfab823c61be1cb110c29792a44128f8a7e 100644 >--- a/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h >+++ b/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h >@@ -62,7 +62,7 @@ bool GenericArguments<Type>::getOwnPropertySlot(JSObject* object, ExecState* exe > } > } > >- if (std::optional<uint32_t> index = parseIndex(ident)) >+ if (WTF::Optional<uint32_t> index = parseIndex(ident)) > return GenericArguments<Type>::getOwnPropertySlotByIndex(thisObject, exec, *index, slot); > > return Base::getOwnPropertySlot(thisObject, exec, ident, slot); >@@ -132,7 +132,7 @@ bool GenericArguments<Type>::put(JSCell* cell, ExecState* exec, PropertyName ide > if (UNLIKELY(isThisValueAltered(slot, thisObject))) > return ordinarySetSlow(exec, thisObject, ident, value, slot.thisValue(), slot.isStrictMode()); > >- std::optional<uint32_t> index = parseIndex(ident); >+ WTF::Optional<uint32_t> index = parseIndex(ident); > if (index && thisObject->isMappedArgument(index.value())) { > thisObject->setIndexQuickly(vm, index.value(), value); > return true; >@@ -167,7 +167,7 @@ bool GenericArguments<Type>::deleteProperty(JSCell* cell, ExecState* exec, Prope > || ident == vm.propertyNames->iteratorSymbol)) > thisObject->overrideThings(vm); > >- if (std::optional<uint32_t> index = parseIndex(ident)) >+ if (WTF::Optional<uint32_t> index = parseIndex(ident)) > return GenericArguments<Type>::deletePropertyByIndex(thisObject, exec, *index); > > return Base::deleteProperty(thisObject, exec, ident); >@@ -208,7 +208,7 @@ bool GenericArguments<Type>::defineOwnProperty(JSObject* object, ExecState* exec > || ident == vm.propertyNames->iteratorSymbol) > thisObject->overrideThingsIfNecessary(vm); > else { >- std::optional<uint32_t> optionalIndex = parseIndex(ident); >+ WTF::Optional<uint32_t> optionalIndex = parseIndex(ident); > if (optionalIndex) { > uint32_t index = optionalIndex.value(); > if (!descriptor.isAccessorDescriptor() && thisObject->isMappedArgument(optionalIndex.value())) { >diff --git a/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h b/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h >index 0612eb73a374d9c0d42f1f616b9ba73e17567ca5..d3d4a1151adc11596f96e89dbb7058b964d39afe 100644 >--- a/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h >+++ b/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h >@@ -68,7 +68,7 @@ public: > return bitwise_cast<uint32_t>(structureID) + impl->hash(); > } > >- ALWAYS_INLINE std::optional<bool> get(Structure* structure, PropertyName propName) >+ ALWAYS_INLINE WTF::Optional<bool> get(Structure* structure, PropertyName propName) > { > UniquedStringImpl* impl = propName.uid(); > StructureID id = structure->id(); >@@ -76,7 +76,7 @@ public: > Entry& entry = bitwise_cast<Entry*>(this)[index]; > if (entry.structureID == id && entry.impl.get() == impl) > return entry.result; >- return std::nullopt; >+ return WTF::nullopt; > } > > ALWAYS_INLINE void tryAdd(VM& vm, PropertySlot& slot, JSObject* object, PropertyName propName, bool result) >diff --git a/Source/JavaScriptCore/runtime/HashMapImpl.h b/Source/JavaScriptCore/runtime/HashMapImpl.h >index 692a5f958e3311efd38dcd672d0b2bbe8111caa4..b206ce7e63361e7f27bdd2782d1695add745ab17 100644 >--- a/Source/JavaScriptCore/runtime/HashMapImpl.h >+++ b/Source/JavaScriptCore/runtime/HashMapImpl.h >@@ -284,16 +284,16 @@ ALWAYS_INLINE uint32_t jsMapHash(ExecState* exec, VM& vm, JSValue value) > return wangsInt64Hash(JSValue::encode(value)); > } > >-ALWAYS_INLINE std::optional<uint32_t> concurrentJSMapHash(JSValue key) >+ALWAYS_INLINE WTF::Optional<uint32_t> concurrentJSMapHash(JSValue key) > { > key = normalizeMapKey(key); > if (key.isString()) { > JSString* string = asString(key); > if (string->length() > 10 * 1024) >- return std::nullopt; >+ return WTF::nullopt; > const StringImpl* impl = string->tryGetValueImpl(); > if (!impl) >- return std::nullopt; >+ return WTF::nullopt; > return impl->concurrentHash(); > } > >diff --git a/Source/JavaScriptCore/runtime/Identifier.h b/Source/JavaScriptCore/runtime/Identifier.h >index 1a308ae4297c3c46a319fd687c41edb51ecb0dd5..38b3ac3d1284b44e2cf6c5ede33d0b1ca5ff3b52 100644 >--- a/Source/JavaScriptCore/runtime/Identifier.h >+++ b/Source/JavaScriptCore/runtime/Identifier.h >@@ -37,46 +37,46 @@ ALWAYS_INLINE bool isIndex(uint32_t index) > } > > template <typename CharType> >-ALWAYS_INLINE std::optional<uint32_t> parseIndex(const CharType* characters, unsigned length) >+ALWAYS_INLINE WTF::Optional<uint32_t> parseIndex(const CharType* characters, unsigned length) > { > // An empty string is not a number. > if (!length) >- return std::nullopt; >+ return WTF::nullopt; > > // Get the first character, turning it into a digit. > uint32_t value = characters[0] - '0'; > if (value > 9) >- return std::nullopt; >+ return WTF::nullopt; > > // Check for leading zeros. If the first characher is 0, then the > // length of the string must be one - e.g. "042" is not equal to "42". > if (!value && length > 1) >- return std::nullopt; >+ return WTF::nullopt; > > while (--length) { > // Multiply value by 10, checking for overflow out of 32 bits. > if (value > 0xFFFFFFFFU / 10) >- return std::nullopt; >+ return WTF::nullopt; > value *= 10; > > // Get the next character, turning it into a digit. > uint32_t newValue = *(++characters) - '0'; > if (newValue > 9) >- return std::nullopt; >+ return WTF::nullopt; > > // Add in the old value, checking for overflow out of 32 bits. > newValue += value; > if (newValue < value) >- return std::nullopt; >+ return WTF::nullopt; > value = newValue; > } > > if (!isIndex(value)) >- return std::nullopt; >+ return WTF::nullopt; > return value; > } > >-ALWAYS_INLINE std::optional<uint32_t> parseIndex(StringImpl& impl) >+ALWAYS_INLINE WTF::Optional<uint32_t> parseIndex(StringImpl& impl) > { > if (impl.is8Bit()) > return parseIndex(impl.characters8(), impl.length()); >@@ -272,13 +272,13 @@ inline bool Identifier::equal(const StringImpl* r, const UChar* s, unsigned leng > return WTF::equal(r, s, length); > } > >-ALWAYS_INLINE std::optional<uint32_t> parseIndex(const Identifier& identifier) >+ALWAYS_INLINE WTF::Optional<uint32_t> parseIndex(const Identifier& identifier) > { > auto uid = identifier.impl(); > if (!uid) >- return std::nullopt; >+ return WTF::nullopt; > if (uid->isSymbol()) >- return std::nullopt; >+ return WTF::nullopt; > return parseIndex(*uid); > } > >diff --git a/Source/JavaScriptCore/runtime/IntlPluralRules.h b/Source/JavaScriptCore/runtime/IntlPluralRules.h >index 2d17ef0bbf73f0c58fb1a9818f2794ea47e33a23..3294a42665ad64c8824bfcd3250d640634d48b58 100644 >--- a/Source/JavaScriptCore/runtime/IntlPluralRules.h >+++ b/Source/JavaScriptCore/runtime/IntlPluralRules.h >@@ -76,8 +76,8 @@ private: > unsigned m_minimumIntegerDigits { 1 }; > unsigned m_minimumFractionDigits { 0 }; > unsigned m_maximumFractionDigits { 3 }; >- std::optional<unsigned> m_minimumSignificantDigits; >- std::optional<unsigned> m_maximumSignificantDigits; >+ WTF::Optional<unsigned> m_minimumSignificantDigits; >+ WTF::Optional<unsigned> m_maximumSignificantDigits; > }; > > } // namespace JSC >diff --git a/Source/JavaScriptCore/runtime/JSArray.cpp b/Source/JavaScriptCore/runtime/JSArray.cpp >index f32af382e130134bfd0894d524d24a394d21663f..888ec7f6fd35fc15546cc4327f4a8a7209d77d0a 100644 >--- a/Source/JavaScriptCore/runtime/JSArray.cpp >+++ b/Source/JavaScriptCore/runtime/JSArray.cpp >@@ -241,7 +241,7 @@ bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName > > // 4. Else if P is an array index (15.4), then > // a. Let index be ToUint32(P). >- if (std::optional<uint32_t> optionalIndex = parseIndex(propertyName)) { >+ if (WTF::Optional<uint32_t> optionalIndex = parseIndex(propertyName)) { > // b. Reject if index >= oldLen and oldLenDesc.[[Writable]] is false. > uint32_t index = optionalIndex.value(); > // FIXME: Nothing prevents this from being called on a RuntimeArray, and the length function will always return 0 in that case. >diff --git a/Source/JavaScriptCore/runtime/JSBigInt.cpp b/Source/JavaScriptCore/runtime/JSBigInt.cpp >index afe3cfde0036c9e6b2551abdea0564228500df14..9efdc5d730c784037bf090512f9a84146744e68c 100644 >--- a/Source/JavaScriptCore/runtime/JSBigInt.cpp >+++ b/Source/JavaScriptCore/runtime/JSBigInt.cpp >@@ -188,7 +188,7 @@ JSValue JSBigInt::toPrimitive(ExecState*, PreferredPrimitiveType) const > return const_cast<JSBigInt*>(this); > } > >-std::optional<uint8_t> JSBigInt::singleDigitValueForString() >+WTF::Optional<uint8_t> JSBigInt::singleDigitValueForString() > { > if (isZero()) > return 0; >@@ -1961,16 +1961,16 @@ JSBigInt::ComparisonResult JSBigInt::compareToDouble(JSBigInt* x, double y) > return ComparisonResult::Equal; > } > >-std::optional<JSBigInt::Digit> JSBigInt::toShiftAmount(JSBigInt* x) >+WTF::Optional<JSBigInt::Digit> JSBigInt::toShiftAmount(JSBigInt* x) > { > if (x->length() > 1) >- return std::nullopt; >+ return WTF::nullopt; > > Digit value = x->digit(0); > static_assert(maxLengthBits < std::numeric_limits<Digit>::max(), "maxLengthBits needs to be less than digit"); > > if (value > maxLengthBits) >- return std::nullopt; >+ return WTF::nullopt; > > return value; > } >diff --git a/Source/JavaScriptCore/runtime/JSBigInt.h b/Source/JavaScriptCore/runtime/JSBigInt.h >index 8e14ca51230c554e2d4c1e829bd4d6c0a3a5365c..9225696cba112175cf0ca054fa957e2c92a05ca1 100644 >--- a/Source/JavaScriptCore/runtime/JSBigInt.h >+++ b/Source/JavaScriptCore/runtime/JSBigInt.h >@@ -85,7 +85,7 @@ public: > static JSBigInt* parseInt(ExecState*, StringView, ErrorParseMode = ErrorParseMode::ThrowExceptions); > static JSBigInt* stringToBigInt(ExecState*, StringView); > >- std::optional<uint8_t> singleDigitValueForString(); >+ WTF::Optional<uint8_t> singleDigitValueForString(); > String toString(ExecState*, unsigned radix); > > enum class ComparisonMode { >@@ -225,7 +225,7 @@ private: > > static JSBigInt* rightShiftByMaximum(VM&, bool sign); > >- static std::optional<Digit> toShiftAmount(JSBigInt* x); >+ static WTF::Optional<Digit> toShiftAmount(JSBigInt* x); > > static size_t allocationSize(unsigned length); > static size_t offsetOfData(); >diff --git a/Source/JavaScriptCore/runtime/JSCJSValue.cpp b/Source/JavaScriptCore/runtime/JSCJSValue.cpp >index 13615793cc371f520080b5fd4bbc8f1f443c7dbd..492d2b52da582beecf58d52d9dbec838ad74abd2 100644 >--- a/Source/JavaScriptCore/runtime/JSCJSValue.cpp >+++ b/Source/JavaScriptCore/runtime/JSCJSValue.cpp >@@ -76,10 +76,10 @@ double JSValue::toNumberSlowCase(ExecState* exec) const > return isUndefined() ? PNaN : 0; // null and false both convert to 0. > } > >-std::optional<double> JSValue::toNumberFromPrimitive() const >+WTF::Optional<double> JSValue::toNumberFromPrimitive() const > { > if (isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > if (isNumber()) > return asNumber(); > if (isBoolean()) >@@ -88,7 +88,7 @@ std::optional<double> JSValue::toNumberFromPrimitive() const > return PNaN; > if (isNull()) > return 0; >- return std::nullopt; >+ return WTF::nullopt; > } > > JSObject* JSValue::toObjectSlowCase(ExecState* exec, JSGlobalObject* globalObject) const >@@ -152,7 +152,7 @@ bool JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue > VM& vm = exec->vm(); > auto scope = DECLARE_THROW_SCOPE(vm); > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > RELEASE_AND_RETURN(scope, putToPrimitiveByIndex(exec, index.value(), value, slot.isStrictMode())); > > // Check if there are any setters or getters in the prototype chain >diff --git a/Source/JavaScriptCore/runtime/JSCJSValue.h b/Source/JavaScriptCore/runtime/JSCJSValue.h >index 90d8f9f9693031c73e3331f2f49f4c80fce20e35..963c8b21ad5967d3c83037c368505b2e494692ea 100644 >--- a/Source/JavaScriptCore/runtime/JSCJSValue.h >+++ b/Source/JavaScriptCore/runtime/JSCJSValue.h >@@ -262,7 +262,7 @@ public: > Variant<JSBigInt*, int32_t> toBigIntOrInt32(ExecState*) const; > > // toNumber conversion if it can be done without side effects. >- std::optional<double> toNumberFromPrimitive() const; >+ WTF::Optional<double> toNumberFromPrimitive() const; > > JSString* toString(ExecState*) const; // On exception, this returns the empty string. > JSString* toStringOrNull(ExecState*) const; // On exception, this returns null, to make exception checks faster. >diff --git a/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h b/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h >index 864203576737c41af040ea1eb0c852b106657415..fa0151d50f1f538937731ff0eba8797d79379465 100644 >--- a/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h >+++ b/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h >@@ -189,7 +189,7 @@ public: > > static ElementType toAdaptorNativeFromValue(ExecState* exec, JSValue jsValue) { return toNativeFromValue<Adaptor>(exec, jsValue); } > >- static std::optional<ElementType> toAdaptorNativeFromValueWithoutCoercion(JSValue jsValue) { return toNativeFromValueWithoutCoercion<Adaptor>(jsValue); } >+ static WTF::Optional<ElementType> toAdaptorNativeFromValueWithoutCoercion(JSValue jsValue) { return toNativeFromValueWithoutCoercion<Adaptor>(jsValue); } > > void sort() > { >diff --git a/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h b/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h >index 85a764affb1f0f493d9998f4cf9e67d4f8644abd..1210a4b3a53b5f4ab67620844acd56a10bebff8c 100644 >--- a/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h >+++ b/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h >@@ -114,7 +114,7 @@ inline JSObject* constructGenericTypedArrayViewFromIterator(ExecState* exec, Str > } > > template<typename ViewClass> >-inline JSObject* constructGenericTypedArrayViewWithArguments(ExecState* exec, Structure* structure, EncodedJSValue firstArgument, unsigned offset, std::optional<unsigned> lengthOpt) >+inline JSObject* constructGenericTypedArrayViewWithArguments(ExecState* exec, Structure* structure, EncodedJSValue firstArgument, unsigned offset, WTF::Optional<unsigned> lengthOpt) > { > VM& vm = exec->vm(); > auto scope = DECLARE_THROW_SCOPE(vm); >@@ -223,7 +223,7 @@ EncodedJSValue JSC_HOST_CALL constructGenericTypedArrayView(ExecState* exec) > > JSValue firstValue = exec->uncheckedArgument(0); > unsigned offset = 0; >- std::optional<unsigned> length = std::nullopt; >+ WTF::Optional<unsigned> length = WTF::nullopt; > if (jsDynamicCast<JSArrayBuffer*>(vm, firstValue) && argCount > 1) { > offset = exec->uncheckedArgument(1).toIndex(exec, "byteOffset"); > RETURN_IF_EXCEPTION(scope, encodedJSValue()); >diff --git a/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h b/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h >index 2e56ce165b5964ca4dd04f57e47986b474de5c6d..07f62178fe78de0bffef3737a324db6b5f1d3e21 100644 >--- a/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h >+++ b/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h >@@ -344,7 +344,7 @@ bool JSGenericTypedArrayView<Adaptor>::getOwnPropertySlot( > { > JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object); > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) { >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) { > if (thisObject->isNeutered()) { > slot.setCustom(thisObject, static_cast<unsigned>(PropertyAttribute::None), throwNeuteredTypedArrayTypeError); > return true; >@@ -372,7 +372,7 @@ bool JSGenericTypedArrayView<Adaptor>::put( > // https://tc39.github.io/ecma262/#sec-integer-indexed-exotic-objects-set-p-v-receiver > // Ignore the receiver even if the receiver is altered to non base value. > // 9.4.5.5-2-b-i Return ? IntegerIndexedElementSet(O, numericIndex, V). >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode()); > > return Base::put(thisObject, exec, propertyName, value, slot); >@@ -387,7 +387,7 @@ bool JSGenericTypedArrayView<Adaptor>::defineOwnProperty( > auto scope = DECLARE_THROW_SCOPE(vm); > JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object); > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) { >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) { > auto throwTypeErrorIfNeeded = [&] (const char* errorMessage) -> bool { > if (shouldThrow) > throwTypeError(exec, scope, makeString(errorMessage, String::number(*index))); >diff --git a/Source/JavaScriptCore/runtime/JSLock.h b/Source/JavaScriptCore/runtime/JSLock.h >index c0b82e6914d835423b925a94f0b1b82c3455064c..8ab0b6ae78f655d8efc21053ea5023b228ac57ff 100644 >--- a/Source/JavaScriptCore/runtime/JSLock.h >+++ b/Source/JavaScriptCore/runtime/JSLock.h >@@ -92,11 +92,11 @@ public: > > VM* vm() { return m_vm; } > >- std::optional<RefPtr<Thread>> ownerThread() const >+ WTF::Optional<RefPtr<Thread>> ownerThread() const > { > if (m_hasOwnerThread) > return m_ownerThread; >- return std::nullopt; >+ return WTF::nullopt; > } > bool currentThreadIsHoldingLock() { return m_hasOwnerThread && m_ownerThread.get() == &Thread::current(); } > >diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp >index 20fcd4032ce6b38317c76c53879bcfd3b6b1688f..356f6f924d2db9d8976655690b57512fb6464b60 100644 >--- a/Source/JavaScriptCore/runtime/JSObject.cpp >+++ b/Source/JavaScriptCore/runtime/JSObject.cpp >@@ -1854,7 +1854,7 @@ bool JSObject::putDirectAccessor(ExecState* exec, PropertyName propertyName, Get > { > ASSERT(attributes & PropertyAttribute::Accessor); > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return putDirectIndex(exec, index.value(), accessor, attributes, PutDirectIndexLikePutDirect); > > return putDirectNonIndexAccessor(exec->vm(), propertyName, accessor, attributes); >@@ -1926,7 +1926,7 @@ bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName proper > JSObject* thisObject = jsCast<JSObject*>(cell); > VM& vm = exec->vm(); > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return thisObject->methodTable(vm)->deletePropertyByIndex(thisObject, exec, index.value()); > > unsigned attributes; >@@ -2168,7 +2168,7 @@ bool JSObject::getOwnStaticPropertySlot(VM& vm, PropertyName propertyName, Prope > return false; > } > >-auto JSObject::findPropertyHashEntry(VM& vm, PropertyName propertyName) const -> std::optional<PropertyHashEntry> >+auto JSObject::findPropertyHashEntry(VM& vm, PropertyName propertyName) const -> WTF::Optional<PropertyHashEntry> > { > for (const ClassInfo* info = classInfo(vm); info; info = info->parentClass) { > if (const HashTable* propHashTable = info->staticPropHashTable) { >@@ -2176,7 +2176,7 @@ auto JSObject::findPropertyHashEntry(VM& vm, PropertyName propertyName) const -> > return PropertyHashEntry { propHashTable, entry }; > } > } >- return std::nullopt; >+ return WTF::nullopt; > } > > bool JSObject::hasInstance(ExecState* exec, JSValue value, JSValue hasInstanceValue) >@@ -3475,7 +3475,7 @@ static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName proper > > bool JSObject::putDirectMayBeIndex(ExecState* exec, PropertyName propertyName, JSValue value) > { >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return putDirectIndex(exec, index.value(), value); > return putDirect(exec->vm(), propertyName, value); > } >@@ -3641,7 +3641,7 @@ bool JSObject::defineOwnNonIndexProperty(ExecState* exec, PropertyName propertyN > bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool throwException) > { > // If it's an array index, then use the indexed property storage. >- if (std::optional<uint32_t> index = parseIndex(propertyName)) { >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) { > // c. Let succeeded be the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing P, Desc, and false as arguments. > // d. Reject if succeeded is false. > // e. If index >= oldLen >diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h >index a634ae1350525091f5960fa46db13d5f19cc95a9..f0bea56356d5a2e3bec22393ebc6376d357782df 100644 >--- a/Source/JavaScriptCore/runtime/JSObject.h >+++ b/Source/JavaScriptCore/runtime/JSObject.h >@@ -1046,7 +1046,7 @@ private: > const HashTable* table; > const HashTableValue* value; > }; >- std::optional<PropertyHashEntry> findPropertyHashEntry(VM&, PropertyName) const; >+ WTF::Optional<PropertyHashEntry> findPropertyHashEntry(VM&, PropertyName) const; > > bool putByIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); > bool putDirectIndexBeyondVectorLengthWithArrayStorage(ExecState*, unsigned propertyName, JSValue, unsigned attributes, PutDirectIndexMode, ArrayStorage*); >@@ -1399,7 +1399,7 @@ ALWAYS_INLINE bool JSObject::getOwnPropertySlot(JSObject* object, ExecState* exe > Structure* structure = object->structure(vm); > if (object->getOwnNonIndexPropertySlot(vm, structure, propertyName, slot)) > return true; >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return getOwnPropertySlotByIndex(object, exec, index.value(), slot); > return false; > } >@@ -1418,7 +1418,7 @@ ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, PropertyName prope > // getOwnNonIndexPropertySlot), so we cannot safely call the overridden getOwnPropertySlot > // (lest we return a property from a prototype that is shadowed). Check now for an index, > // if so we need to start afresh from this object. >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return getPropertySlot(exec, index.value(), slot); > // Safe to continue searching from current position; call getNonIndexPropertySlot to avoid > // parsing the int again. >@@ -1440,7 +1440,7 @@ ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, PropertyName prope > object = asObject(prototype); > } > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return getPropertySlot(exec, index.value(), slot); > return false; > } >@@ -1489,7 +1489,7 @@ inline bool JSObject::putOwnDataPropertyMayBeIndex(ExecState* exec, PropertyName > ASSERT(!structure(vm)->hasGetterSetterProperties()); > ASSERT(!structure(vm)->hasCustomGetterSetterProperties()); > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return putDirectIndex(exec, index.value(), value, 0, PutDirectIndexLikePutDirect); > > return putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot); >diff --git a/Source/JavaScriptCore/runtime/JSObjectInlines.h b/Source/JavaScriptCore/runtime/JSObjectInlines.h >index 722228380d45f2b646b03c08222c6be7b3e12a3d..a8f56da1a0c8f2c79df704d56811e07f8c0079ff 100644 >--- a/Source/JavaScriptCore/runtime/JSObjectInlines.h >+++ b/Source/JavaScriptCore/runtime/JSObjectInlines.h >@@ -232,7 +232,7 @@ ALWAYS_INLINE bool JSObject::putInlineForJSObject(JSCell* cell, ExecState* exec, > > // Try indexed put first. This is required for correctness, since loads on property names that appear like > // valid indices will never look in the named property storage. >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > RELEASE_AND_RETURN(scope, putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode())); > > if (thisObject->canPerformFastPutInline(vm, propertyName)) { >diff --git a/Source/JavaScriptCore/runtime/JSRunLoopTimer.cpp b/Source/JavaScriptCore/runtime/JSRunLoopTimer.cpp >index a56e462d4bbdee012224ec5976bfbd02a5cc5a11..c05fed73a62439c1d01663c600c7c77b47c8a162 100644 >--- a/Source/JavaScriptCore/runtime/JSRunLoopTimer.cpp >+++ b/Source/JavaScriptCore/runtime/JSRunLoopTimer.cpp >@@ -255,7 +255,7 @@ void JSRunLoopTimer::Manager::cancelTimer(JSRunLoopTimer& timer) > #endif > } > >-std::optional<Seconds> JSRunLoopTimer::Manager::timeUntilFire(JSRunLoopTimer& timer) >+WTF::Optional<Seconds> JSRunLoopTimer::Manager::timeUntilFire(JSRunLoopTimer& timer) > { > auto locker = holdLock(m_lock); > auto iter = m_mapping.find(timer.m_apiLock); >@@ -269,7 +269,7 @@ std::optional<Seconds> JSRunLoopTimer::Manager::timeUntilFire(JSRunLoopTimer& ti > } > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > #if USE(CF) >@@ -316,7 +316,7 @@ JSRunLoopTimer::~JSRunLoopTimer() > { > } > >-std::optional<Seconds> JSRunLoopTimer::timeUntilFire() >+WTF::Optional<Seconds> JSRunLoopTimer::timeUntilFire() > { > return Manager::shared().timeUntilFire(*this); > } >diff --git a/Source/JavaScriptCore/runtime/JSRunLoopTimer.h b/Source/JavaScriptCore/runtime/JSRunLoopTimer.h >index 6651672739eb9dca8f1ffcdbe735beda5af17240..2f00e806fa9e17309a3ec2356f5312c04f6df6df 100644 >--- a/Source/JavaScriptCore/runtime/JSRunLoopTimer.h >+++ b/Source/JavaScriptCore/runtime/JSRunLoopTimer.h >@@ -65,7 +65,7 @@ public: > void scheduleTimer(JSRunLoopTimer&, Seconds nextFireTime); > void cancelTimer(JSRunLoopTimer&); > >- std::optional<Seconds> timeUntilFire(JSRunLoopTimer&); >+ WTF::Optional<Seconds> timeUntilFire(JSRunLoopTimer&); > > #if USE(CF) > void didChangeRunLoop(VM&, CFRunLoopRef newRunLoop); >@@ -116,7 +116,7 @@ public: > JS_EXPORT_PRIVATE void addTimerSetNotification(TimerNotificationCallback); > JS_EXPORT_PRIVATE void removeTimerSetNotification(TimerNotificationCallback); > >- JS_EXPORT_PRIVATE std::optional<Seconds> timeUntilFire(); >+ JS_EXPORT_PRIVATE WTF::Optional<Seconds> timeUntilFire(); > > protected: > static const Seconds s_decade; >diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp >index 0303cbdfd790efdcde84adf877f100b6baa797d6..0d085863061db2c1e5c2f5103d2b05aa0e98f046 100644 >--- a/Source/JavaScriptCore/runtime/JSString.cpp >+++ b/Source/JavaScriptCore/runtime/JSString.cpp >@@ -444,7 +444,7 @@ bool JSString::getStringPropertyDescriptor(ExecState* exec, PropertyName propert > return true; > } > >- std::optional<uint32_t> index = parseIndex(propertyName); >+ WTF::Optional<uint32_t> index = parseIndex(propertyName); > if (index && index.value() < length()) { > descriptor.setDescriptor(getIndex(exec, index.value()), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); > return true; >diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h >index e0c04deb3821beae2431c6e1796534b3fd829f13..465336dacb5ac66b88479dc06658e68253c5033a 100644 >--- a/Source/JavaScriptCore/runtime/JSString.h >+++ b/Source/JavaScriptCore/runtime/JSString.h >@@ -694,7 +694,7 @@ ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName > return true; > } > >- std::optional<uint32_t> index = parseIndex(propertyName); >+ WTF::Optional<uint32_t> index = parseIndex(propertyName); > if (index && index.value() < length()) { > JSValue value = getIndex(exec, index.value()); > RETURN_IF_EXCEPTION(scope, false); >diff --git a/Source/JavaScriptCore/runtime/LiteralParser.cpp b/Source/JavaScriptCore/runtime/LiteralParser.cpp >index 20c8c9bb6aebc14d812558e565d4595e049452e9..8fb547fdb78e580f21e738e696b8e7daeac8194f 100644 >--- a/Source/JavaScriptCore/runtime/LiteralParser.cpp >+++ b/Source/JavaScriptCore/runtime/LiteralParser.cpp >@@ -935,7 +935,7 @@ JSValue LiteralParser<CharType>::parse(ParserState initialState) > PutPropertySlot slot(object, codeBlock ? codeBlock->isStrictMode() : false); > objectStack.last().put(m_exec, ident, lastValue, slot); > } else { >- if (std::optional<uint32_t> index = parseIndex(ident)) >+ if (WTF::Optional<uint32_t> index = parseIndex(ident)) > object->putDirectIndex(m_exec, index.value(), lastValue); > else > object->putDirect(vm, ident, lastValue); >diff --git a/Source/JavaScriptCore/runtime/MachineContext.h b/Source/JavaScriptCore/runtime/MachineContext.h >index 46f155451d0651b8b1fccbd25f62db91029fe994..ccde9ab612bb4c803587ed78749bc8801a32bdc4 100644 >--- a/Source/JavaScriptCore/runtime/MachineContext.h >+++ b/Source/JavaScriptCore/runtime/MachineContext.h >@@ -45,7 +45,7 @@ template<typename T = void*> T framePointer(const PlatformRegisters&); > template<typename T = void*> void setFramePointer(PlatformRegisters&, T); > inline MacroAssemblerCodePtr<PlatformRegistersLRPtrTag> linkRegister(const PlatformRegisters&); > inline void setLinkRegister(PlatformRegisters&, MacroAssemblerCodePtr<CFunctionPtrTag>); >-inline std::optional<MacroAssemblerCodePtr<PlatformRegistersPCPtrTag>> instructionPointer(const PlatformRegisters&); >+inline WTF::Optional<MacroAssemblerCodePtr<PlatformRegistersPCPtrTag>> instructionPointer(const PlatformRegisters&); > inline void setInstructionPointer(PlatformRegisters&, MacroAssemblerCodePtr<CFunctionPtrTag>); > > template<size_t N> void*& argumentPointer(PlatformRegisters&); >@@ -432,7 +432,7 @@ static inline void*& instructionPointerImpl(PlatformRegisters& regs) > } > #endif // !USE(PLATFORM_REGISTERS_WITH_PROFILE) > >-inline std::optional<MacroAssemblerCodePtr<PlatformRegistersPCPtrTag>> instructionPointer(const PlatformRegisters& regs) >+inline WTF::Optional<MacroAssemblerCodePtr<PlatformRegistersPCPtrTag>> instructionPointer(const PlatformRegisters& regs) > { > #if USE(PLATFORM_REGISTERS_WITH_PROFILE) > void* value = WTF_READ_PLATFORM_REGISTERS_PC_WITH_PROFILE(regs); >@@ -445,7 +445,7 @@ inline std::optional<MacroAssemblerCodePtr<PlatformRegistersPCPtrTag>> instructi > return MacroAssemblerCodePtr<PlatformRegistersPCPtrTag>(value); > if (isTaggedWith(value, PlatformRegistersPCPtrTag)) > return MacroAssemblerCodePtr<PlatformRegistersPCPtrTag>(value); >- return std::nullopt; >+ return WTF::nullopt; > } > > inline void setInstructionPointer(PlatformRegisters& regs, MacroAssemblerCodePtr<CFunctionPtrTag> value) >diff --git a/Source/JavaScriptCore/runtime/MathCommon.h b/Source/JavaScriptCore/runtime/MathCommon.h >index eda3fa59fb5a6dee614df62b6787f5b999d5847e..0f0a55def9d5cd610618605b08e5d16500963dcf 100644 >--- a/Source/JavaScriptCore/runtime/MathCommon.h >+++ b/Source/JavaScriptCore/runtime/MathCommon.h >@@ -156,15 +156,15 @@ inline uint32_t toUInt32(double number) > return toInt32(number); > } > >-inline std::optional<double> safeReciprocalForDivByConst(double constant) >+inline WTF::Optional<double> safeReciprocalForDivByConst(double constant) > { > // No "weird" numbers (NaN, Denormal, etc). > if (!constant || !std::isnormal(constant)) >- return std::nullopt; >+ return WTF::nullopt; > > int exponent; > if (std::frexp(constant, &exponent) != 0.5) >- return std::nullopt; >+ return WTF::nullopt; > > // Note that frexp() returns the value divided by two > // so we to offset this exponent by one. >@@ -173,7 +173,7 @@ inline std::optional<double> safeReciprocalForDivByConst(double constant) > // A double exponent is between -1022 and 1023. > // Nothing we can do to invert 1023. > if (exponent == 1023) >- return std::nullopt; >+ return WTF::nullopt; > > double reciprocal = std::ldexp(1, -exponent); > ASSERT(std::isnormal(reciprocal)); >diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp >index 275b56f7ccec7b4b1610d61da6233d0625f2d88e..1d53659b787c459984402855a04707e512d1966d 100644 >--- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp >+++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp >@@ -103,7 +103,7 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec) > > Structure* structure = thisObject->structure(vm); > HasOwnPropertyCache* hasOwnPropertyCache = vm.ensureHasOwnPropertyCache(); >- if (std::optional<bool> result = hasOwnPropertyCache->get(structure, propertyName)) { >+ if (WTF::Optional<bool> result = hasOwnPropertyCache->get(structure, propertyName)) { > ASSERT(*result == thisObject->hasOwnProperty(exec, propertyName)); > scope.assertNoException(); > return JSValue::encode(jsBoolean(*result)); >diff --git a/Source/JavaScriptCore/runtime/PropertyDescriptor.h b/Source/JavaScriptCore/runtime/PropertyDescriptor.h >index aeeae530427df423632c79ced0f6677c3c835982..6ab24f8c71998829d8d9bb856979b6aa8f4d727a 100644 >--- a/Source/JavaScriptCore/runtime/PropertyDescriptor.h >+++ b/Source/JavaScriptCore/runtime/PropertyDescriptor.h >@@ -98,16 +98,16 @@ inline PropertyDescriptor toPropertyDescriptor(JSValue value, JSValue getter, JS > // We assume that validation is already done. > PropertyDescriptor desc; > >- if (std::optional<bool> enumerable = attributes.enumerable()) >+ if (WTF::Optional<bool> enumerable = attributes.enumerable()) > desc.setEnumerable(enumerable.value()); > >- if (std::optional<bool> configurable = attributes.configurable()) >+ if (WTF::Optional<bool> configurable = attributes.configurable()) > desc.setConfigurable(configurable.value()); > > if (attributes.hasValue()) > desc.setValue(value); > >- if (std::optional<bool> writable = attributes.writable()) >+ if (WTF::Optional<bool> writable = attributes.writable()) > desc.setWritable(writable.value()); > > if (attributes.hasGet()) >diff --git a/Source/JavaScriptCore/runtime/PropertyName.h b/Source/JavaScriptCore/runtime/PropertyName.h >index a4740ced3d2470ff6598bcc21b4d7ea07ec3d0c4..bf0d00d9f582662c1193ee9dfee2e3a43624c87e 100644 >--- a/Source/JavaScriptCore/runtime/PropertyName.h >+++ b/Source/JavaScriptCore/runtime/PropertyName.h >@@ -120,13 +120,13 @@ inline bool operator!=(PropertyName a, PropertyName b) > return a.uid() != b.uid(); > } > >-ALWAYS_INLINE std::optional<uint32_t> parseIndex(PropertyName propertyName) >+ALWAYS_INLINE WTF::Optional<uint32_t> parseIndex(PropertyName propertyName) > { > auto uid = propertyName.uid(); > if (!uid) >- return std::nullopt; >+ return WTF::nullopt; > if (uid->isSymbol()) >- return std::nullopt; >+ return WTF::nullopt; > return parseIndex(*uid); > } > >diff --git a/Source/JavaScriptCore/runtime/PropertySlot.h b/Source/JavaScriptCore/runtime/PropertySlot.h >index e0e690480e8c4541183bb679f8c7d1349e082995..810eb72d87d7753af261a88ddbe40347e71bb303 100644 >--- a/Source/JavaScriptCore/runtime/PropertySlot.h >+++ b/Source/JavaScriptCore/runtime/PropertySlot.h >@@ -187,11 +187,11 @@ public: > return m_watchpointSet; > } > >- std::optional<DOMAttributeAnnotation> domAttribute() const >+ WTF::Optional<DOMAttributeAnnotation> domAttribute() const > { > if (m_additionalDataType == AdditionalDataType::DOMAttribute) > return m_additionalData.domAttribute; >- return std::nullopt; >+ return WTF::nullopt; > } > > struct ModuleNamespaceSlot { >@@ -199,11 +199,11 @@ public: > unsigned scopeOffset; > }; > >- std::optional<ModuleNamespaceSlot> moduleNamespaceSlot() const >+ WTF::Optional<ModuleNamespaceSlot> moduleNamespaceSlot() const > { > if (m_additionalDataType == AdditionalDataType::ModuleNamespace) > return m_additionalData.moduleNamespaceSlot; >- return std::nullopt; >+ return WTF::nullopt; > } > > void setValue(JSObject* slotBase, unsigned attributes, JSValue value) >diff --git a/Source/JavaScriptCore/runtime/SamplingProfiler.cpp b/Source/JavaScriptCore/runtime/SamplingProfiler.cpp >index 551fe34c4fdb354321eb179a004a9baffc386994..93cc3c3f89a28e52dffddc8e469f873033b80b1f 100644 >--- a/Source/JavaScriptCore/runtime/SamplingProfiler.cpp >+++ b/Source/JavaScriptCore/runtime/SamplingProfiler.cpp >@@ -605,7 +605,7 @@ void SamplingProfiler::processUnverifiedStackTraces() > } > } else { > #if ENABLE(JIT) >- if (std::optional<CodeOrigin> codeOrigin = topCodeBlock->findPC(unprocessedStackTrace.topPC)) { >+ if (WTF::Optional<CodeOrigin> codeOrigin = topCodeBlock->findPC(unprocessedStackTrace.topPC)) { > appendCodeOrigin(topCodeBlock, *codeOrigin); > storeCalleeIntoLastFrame(unprocessedStackTrace.frames[0].unverifiedCallee); > startIndex = 1; >@@ -1044,7 +1044,7 @@ void SamplingProfiler::reportTopBytecodes(PrintStream& out) > > StackFrame& frame = stackTrace.frames.first(); > String frameDescription = makeString(frame.displayName(m_vm), descriptionForLocation(frame.semanticLocation)); >- if (std::optional<std::pair<StackFrame::CodeLocation, CodeBlock*>> machineLocation = frame.machineLocation) { >+ if (WTF::Optional<std::pair<StackFrame::CodeLocation, CodeBlock*>> machineLocation = frame.machineLocation) { > frameDescription = makeString(frameDescription, " <-- ", > machineLocation->second->inferredName().data(), descriptionForLocation(machineLocation->first)); > } >diff --git a/Source/JavaScriptCore/runtime/SamplingProfiler.h b/Source/JavaScriptCore/runtime/SamplingProfiler.h >index 32a1b48a0b0be6591410d966c52c8a96821ea3f0..0c70a65c3beb405f74bd68ebfc1bfd92c0a2c7eb 100644 >--- a/Source/JavaScriptCore/runtime/SamplingProfiler.h >+++ b/Source/JavaScriptCore/runtime/SamplingProfiler.h >@@ -112,7 +112,7 @@ public: > }; > > CodeLocation semanticLocation; >- std::optional<std::pair<CodeLocation, CodeBlock*>> machineLocation; // This is non-null if we were inlined. It represents the machine frame we were inlined into. >+ WTF::Optional<std::pair<CodeLocation, CodeBlock*>> machineLocation; // This is non-null if we were inlined. It represents the machine frame we were inlined into. > > bool hasExpressionInfo() const { return semanticLocation.hasExpressionInfo(); } > unsigned lineNumber() const >diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp >index 234ef89f54f0c9173ae60e5e8f43f410cd8be675..9f9a877806f3dd54671f24582842c532fe102bc1 100644 >--- a/Source/JavaScriptCore/runtime/StringObject.cpp >+++ b/Source/JavaScriptCore/runtime/StringObject.cpp >@@ -72,7 +72,7 @@ bool StringObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, > > if (propertyName == vm.propertyNames->length) > return typeError(exec, scope, slot.isStrictMode(), ReadonlyPropertyWriteError); >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > RELEASE_AND_RETURN(scope, putByIndex(cell, exec, index.value(), value, slot.isStrictMode())); > RELEASE_AND_RETURN(scope, JSObject::put(cell, exec, propertyName, value, slot)); > } >@@ -93,7 +93,7 @@ static bool isStringOwnProperty(ExecState* exec, StringObject* object, PropertyN > VM& vm = exec->vm(); > if (propertyName == vm.propertyNames->length) > return true; >- if (std::optional<uint32_t> index = parseIndex(propertyName)) { >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) { > if (object->internalValue()->canGetIndex(index.value())) > return true; > } >@@ -130,7 +130,7 @@ bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName pr > StringObject* thisObject = jsCast<StringObject*>(cell); > if (propertyName == vm.propertyNames->length) > return false; >- std::optional<uint32_t> index = parseIndex(propertyName); >+ WTF::Optional<uint32_t> index = parseIndex(propertyName); > if (index && thisObject->internalValue()->canGetIndex(index.value())) > return false; > return JSObject::deleteProperty(thisObject, exec, propertyName); >diff --git a/Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h b/Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h >index bbe92ed9d1e164bb61ec5538874f873c487622c3..9c5253b41facbf458cbce584b47e6ce2899041cb 100644 >--- a/Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h >+++ b/Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h >@@ -37,7 +37,7 @@ class TemplateObjectDescriptorTable; > class TemplateObjectDescriptor : public RefCounted<TemplateObjectDescriptor> { > public: > typedef Vector<String, 4> StringVector; >- typedef Vector<std::optional<String>, 4> OptionalStringVector; >+ typedef Vector<WTF::Optional<String>, 4> OptionalStringVector; > > enum DeletedValueTag { DeletedValue }; > TemplateObjectDescriptor(DeletedValueTag); >diff --git a/Source/JavaScriptCore/runtime/ToNativeFromValue.h b/Source/JavaScriptCore/runtime/ToNativeFromValue.h >index fd618432777ceb995439f8f585a738da84c265e8..761565622433baa110fcb0427c55e207b27465dd 100644 >--- a/Source/JavaScriptCore/runtime/ToNativeFromValue.h >+++ b/Source/JavaScriptCore/runtime/ToNativeFromValue.h >@@ -48,10 +48,10 @@ typename Adaptor::Type toNativeFromValue(ExecState* exec, JSValue value) > } > > template<typename Adaptor> >-std::optional<typename Adaptor::Type> toNativeFromValueWithoutCoercion(JSValue value) >+WTF::Optional<typename Adaptor::Type> toNativeFromValueWithoutCoercion(JSValue value) > { > if (!value.isNumber()) >- return std::nullopt; >+ return WTF::nullopt; > if (value.isInt32()) > return Adaptor::toNativeFromInt32WithoutCoercion(value.asInt32()); > return Adaptor::toNativeFromDoubleWithoutCoercion(value.asDouble()); >diff --git a/Source/JavaScriptCore/runtime/TypedArrayAdaptors.h b/Source/JavaScriptCore/runtime/TypedArrayAdaptors.h >index 0af71f4c61fc242ca8a79107fcbb6fc56315abc3..6fca967c8914ada1a3aa67fe5b9c5646502881ba 100644 >--- a/Source/JavaScriptCore/runtime/TypedArrayAdaptors.h >+++ b/Source/JavaScriptCore/runtime/TypedArrayAdaptors.h >@@ -79,26 +79,26 @@ struct IntegralTypedArrayAdaptor { > return OtherAdaptor::toNativeFromInt32(value); > } > >- static std::optional<Type> toNativeFromInt32WithoutCoercion(int32_t value) >+ static WTF::Optional<Type> toNativeFromInt32WithoutCoercion(int32_t value) > { > if ((value >= 0 && static_cast<uint32_t>(value) > static_cast<uint32_t>(maxValue)) || value < static_cast<int32_t>(minValue)) >- return std::nullopt; >+ return WTF::nullopt; > return static_cast<Type>(value); > } > >- static std::optional<Type> toNativeFromUint32WithoutCoercion(uint32_t value) >+ static WTF::Optional<Type> toNativeFromUint32WithoutCoercion(uint32_t value) > { > if (value > static_cast<uint32_t>(maxValue)) >- return std::nullopt; >+ return WTF::nullopt; > > return static_cast<Type>(value); > } > >- static std::optional<Type> toNativeFromDoubleWithoutCoercion(double value) >+ static WTF::Optional<Type> toNativeFromDoubleWithoutCoercion(double value) > { > Type integer = static_cast<Type>(value); > if (static_cast<double>(integer) != value) >- return std::nullopt; >+ return WTF::nullopt; > > if (value < 0) > return toNativeFromInt32WithoutCoercion(static_cast<int32_t>(value)); >@@ -149,12 +149,12 @@ struct FloatTypedArrayAdaptor { > return OtherAdaptor::toNativeFromDouble(value); > } > >- static std::optional<Type> toNativeFromInt32WithoutCoercion(int32_t value) >+ static WTF::Optional<Type> toNativeFromInt32WithoutCoercion(int32_t value) > { > return static_cast<Type>(value); > } > >- static std::optional<Type> toNativeFromDoubleWithoutCoercion(double value) >+ static WTF::Optional<Type> toNativeFromDoubleWithoutCoercion(double value) > { > if (std::isnan(value) || std::isinf(value)) > return static_cast<Type>(value); >@@ -162,10 +162,10 @@ struct FloatTypedArrayAdaptor { > Type valueResult = static_cast<Type>(value); > > if (static_cast<double>(valueResult) != value) >- return std::nullopt; >+ return WTF::nullopt; > > if (value < minValue || value > maxValue) >- return std::nullopt; >+ return WTF::nullopt; > > return valueResult; > } >@@ -255,19 +255,19 @@ struct Uint8ClampedAdaptor { > return OtherAdaptor::toNativeFromInt32(value); > } > >- static std::optional<Type> toNativeFromInt32WithoutCoercion(int32_t value) >+ static WTF::Optional<Type> toNativeFromInt32WithoutCoercion(int32_t value) > { > if (value > maxValue || value < minValue) >- return std::nullopt; >+ return WTF::nullopt; > > return static_cast<Type>(value); > } > >- static std::optional<Type> toNativeFromDoubleWithoutCoercion(double value) >+ static WTF::Optional<Type> toNativeFromDoubleWithoutCoercion(double value) > { > uint8_t integer = static_cast<uint8_t>(value); > if (static_cast<double>(integer) != value) >- return std::nullopt; >+ return WTF::nullopt; > > return integer; > } >diff --git a/Source/JavaScriptCore/runtime/VM.h b/Source/JavaScriptCore/runtime/VM.h >index 8ae7d966fea3bd9d9c22034bbb3550eb15fd25c7..768a9d25c96e600a7741c8e83e099e9c00eed15b 100644 >--- a/Source/JavaScriptCore/runtime/VM.h >+++ b/Source/JavaScriptCore/runtime/VM.h >@@ -874,7 +874,7 @@ public: > template<typename Func> > void logEvent(CodeBlock*, const char* summary, const Func& func); > >- std::optional<RefPtr<Thread>> ownerThread() const { return m_apiLock->ownerThread(); } >+ WTF::Optional<RefPtr<Thread>> ownerThread() const { return m_apiLock->ownerThread(); } > > VMTraps& traps() { return m_traps; } > >diff --git a/Source/JavaScriptCore/runtime/VMTraps.cpp b/Source/JavaScriptCore/runtime/VMTraps.cpp >index 7ffc586091ccc1d538b986717079d1094e9d5d2c..7420750fc75a696eaa253525bd02813be79098da 100644 >--- a/Source/JavaScriptCore/runtime/VMTraps.cpp >+++ b/Source/JavaScriptCore/runtime/VMTraps.cpp >@@ -64,11 +64,11 @@ private: > { } > > public: >- static std::optional<SignalContext> tryCreate(PlatformRegisters& registers) >+ static WTF::Optional<SignalContext> tryCreate(PlatformRegisters& registers) > { > auto instructionPointer = MachineContext::instructionPointer(registers); > if (!instructionPointer) >- return std::nullopt; >+ return WTF::nullopt; > return SignalContext(registers, *instructionPointer); > } > >diff --git a/Source/JavaScriptCore/tools/JSDollarVM.cpp b/Source/JavaScriptCore/tools/JSDollarVM.cpp >index a6eb1c29846d96200eade0b2be0196388c554660..4304120a84e20ae478e847d6f5dbfac3098bd023 100644 >--- a/Source/JavaScriptCore/tools/JSDollarVM.cpp >+++ b/Source/JavaScriptCore/tools/JSDollarVM.cpp >@@ -445,7 +445,7 @@ public: > return true; > } > >- std::optional<uint32_t> index = parseIndex(propertyName); >+ WTF::Optional<uint32_t> index = parseIndex(propertyName); > if (index && index.value() < thisObject->getLength()) { > slot.setValue(thisObject, PropertyAttribute::DontDelete | PropertyAttribute::DontEnum, jsNumber(thisObject->m_vector[index.value()])); > return true; >diff --git a/Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp b/Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp >index 4165ea4afd913ce2df18030dbff8862042353ec0..3fcd072576611ea9b29b15ad1ee1913451faa7e3 100644 >--- a/Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp >+++ b/Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp >@@ -87,11 +87,11 @@ private: > { } > > public: >- static std::optional<SignalContext> tryCreate(PlatformRegisters& registers) >+ static WTF::Optional<SignalContext> tryCreate(PlatformRegisters& registers) > { > auto instructionPointer = MachineContext::instructionPointer(registers); > if (!instructionPointer) >- return std::nullopt; >+ return WTF::nullopt; > return SignalContext(registers, *instructionPointer); > } > >diff --git a/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp b/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp >index 86c3a8f8298d834d3311fc5de55d192b30d04c61..36ec61f39eba1314995d47c56912149390fd8d82 100644 >--- a/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp >+++ b/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp >@@ -227,7 +227,7 @@ public: > void dump(const Vector<ControlEntry>& controlStack, const ExpressionList* expressionStack); > void setParser(FunctionParser<B3IRGenerator>* parser) { m_parser = parser; }; > >- Value* constant(B3::Type, uint64_t bits, std::optional<Origin> = std::nullopt); >+ Value* constant(B3::Type, uint64_t bits, WTF::Optional<Origin> = WTF::nullopt); > void insertConstants(); > > private: >@@ -503,7 +503,7 @@ void B3IRGenerator::emitExceptionCheck(CCallHelpers& jit, ExceptionType type) > }); > } > >-Value* B3IRGenerator::constant(B3::Type type, uint64_t bits, std::optional<Origin> maybeOrigin) >+Value* B3IRGenerator::constant(B3::Type type, uint64_t bits, WTF::Optional<Origin> maybeOrigin) > { > auto result = m_constantPool.ensure(ValueKey(opcodeForConstant(type), type, static_cast<int64_t>(bits)), [&] { > Value* result = m_proc.addConstant(maybeOrigin ? *maybeOrigin : origin(), type, bits); >diff --git a/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp b/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp >index 22a65c3110cfc8cdb94cd105fb6d7c3e53e770a8..5e95739d78c455b741cc048b52ef307a392ae923 100644 >--- a/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp >+++ b/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp >@@ -239,7 +239,7 @@ void BBQPlan::compileFunctions(CompilationEffort effort) > if (!hasWork()) > return; > >- std::optional<TraceScope> traceScope; >+ WTF::Optional<TraceScope> traceScope; > if (Options::useTracePoints()) > traceScope.emplace(WebAssemblyCompileStart, WebAssemblyCompileEnd); > ThreadCountHolder holder(*this); >diff --git a/Source/JavaScriptCore/wasm/WasmFormat.h b/Source/JavaScriptCore/wasm/WasmFormat.h >index 4632394db2ce3c258fedd76ea013eba5d175b733..38814570b370753760ffe195e602266013b51393 100644 >--- a/Source/JavaScriptCore/wasm/WasmFormat.h >+++ b/Source/JavaScriptCore/wasm/WasmFormat.h >@@ -212,7 +212,7 @@ public: > ASSERT(!*this); > } > >- TableInformation(uint32_t initial, std::optional<uint32_t> maximum, bool isImport) >+ TableInformation(uint32_t initial, WTF::Optional<uint32_t> maximum, bool isImport) > : m_initial(initial) > , m_maximum(maximum) > , m_isImport(isImport) >@@ -224,11 +224,11 @@ public: > explicit operator bool() const { return m_isValid; } > bool isImport() const { return m_isImport; } > uint32_t initial() const { return m_initial; } >- std::optional<uint32_t> maximum() const { return m_maximum; } >+ WTF::Optional<uint32_t> maximum() const { return m_maximum; } > > private: > uint32_t m_initial; >- std::optional<uint32_t> m_maximum; >+ WTF::Optional<uint32_t> m_maximum; > bool m_isImport { false }; > bool m_isValid { false }; > }; >diff --git a/Source/JavaScriptCore/wasm/WasmModuleInformation.h b/Source/JavaScriptCore/wasm/WasmModuleInformation.h >index aa7bfc0c9476980300223e185c85cc95041f402c..11bb2daef82d6d92c07a25d0beb8d8a6ff9e3851 100644 >--- a/Source/JavaScriptCore/wasm/WasmModuleInformation.h >+++ b/Source/JavaScriptCore/wasm/WasmModuleInformation.h >@@ -76,7 +76,7 @@ struct ModuleInformation : public ThreadSafeRefCounted<ModuleInformation> { > Vector<FunctionData> functions; > > Vector<Export> exports; >- std::optional<uint32_t> startFunctionIndexSpace; >+ WTF::Optional<uint32_t> startFunctionIndexSpace; > Vector<Segment::Ptr> data; > Vector<Element> elements; > TableInformation tableInformation; >diff --git a/Source/JavaScriptCore/wasm/WasmNameSection.h b/Source/JavaScriptCore/wasm/WasmNameSection.h >index fe63cf5547366fc1740c1f0c70ba81be7536a88e..f976dcff261122b6a1033b28abe5824f163eadea 100644 >--- a/Source/JavaScriptCore/wasm/WasmNameSection.h >+++ b/Source/JavaScriptCore/wasm/WasmNameSection.h >@@ -39,7 +39,7 @@ struct NameSection : public ThreadSafeRefCounted<NameSection> { > public: > NameSection() > { >- setHash(std::nullopt); >+ setHash(WTF::nullopt); > } > > static Ref<NameSection> create() >@@ -47,7 +47,7 @@ public: > return adoptRef(*new NameSection); > } > >- void setHash(const std::optional<CString> &hash) >+ void setHash(const WTF::Optional<CString> &hash) > { > moduleHash = Name(hash ? hash->length() : 3); > if (hash) { >diff --git a/Source/JavaScriptCore/wasm/WasmSectionParser.cpp b/Source/JavaScriptCore/wasm/WasmSectionParser.cpp >index ae8725d079cc3c9c88200470dc0bff7be7644fcb..7b2241217f25d70d1a2d1c5c6a078b390bd9f7b7 100644 >--- a/Source/JavaScriptCore/wasm/WasmSectionParser.cpp >+++ b/Source/JavaScriptCore/wasm/WasmSectionParser.cpp >@@ -171,7 +171,7 @@ auto SectionParser::parseFunction() -> PartialResult > return { }; > } > >-auto SectionParser::parseResizableLimits(uint32_t& initial, std::optional<uint32_t>& maximum) -> PartialResult >+auto SectionParser::parseResizableLimits(uint32_t& initial, WTF::Optional<uint32_t>& maximum) -> PartialResult > { > ASSERT(!maximum); > >@@ -198,7 +198,7 @@ auto SectionParser::parseTableHelper(bool isImport) -> PartialResult > WASM_PARSER_FAIL_IF(type != Wasm::Anyfunc, "Table type should be anyfunc, got ", type); > > uint32_t initial; >- std::optional<uint32_t> maximum; >+ WTF::Optional<uint32_t> maximum; > PartialResult limits = parseResizableLimits(initial, maximum); > if (UNLIKELY(!limits)) > return makeUnexpected(WTFMove(limits.error())); >@@ -236,7 +236,7 @@ auto SectionParser::parseMemoryHelper(bool isImport) -> PartialResult > PageCount maximumPageCount; > { > uint32_t initial; >- std::optional<uint32_t> maximum; >+ WTF::Optional<uint32_t> maximum; > PartialResult limits = parseResizableLimits(initial, maximum); > if (UNLIKELY(!limits)) > return makeUnexpected(WTFMove(limits.error())); >diff --git a/Source/JavaScriptCore/wasm/WasmSectionParser.h b/Source/JavaScriptCore/wasm/WasmSectionParser.h >index 78d02836fc9f32bc2b78fbf90ad2c5da9f91283d..4c2666b041a030ce18baefe283e842f52f92a361 100644 >--- a/Source/JavaScriptCore/wasm/WasmSectionParser.h >+++ b/Source/JavaScriptCore/wasm/WasmSectionParser.h >@@ -62,7 +62,7 @@ private: > PartialResult WARN_UNUSED_RETURN parseGlobalType(Global&); > PartialResult WARN_UNUSED_RETURN parseMemoryHelper(bool isImport); > PartialResult WARN_UNUSED_RETURN parseTableHelper(bool isImport); >- PartialResult WARN_UNUSED_RETURN parseResizableLimits(uint32_t& initial, std::optional<uint32_t>& maximum); >+ PartialResult WARN_UNUSED_RETURN parseResizableLimits(uint32_t& initial, WTF::Optional<uint32_t>& maximum); > PartialResult WARN_UNUSED_RETURN parseInitExpr(uint8_t&, uint64_t&, Type& initExprType); > > size_t m_offsetInSource; >diff --git a/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp b/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp >index 9f372601d51332be25e07e0518235994eb4c0899..5e56eb714cfda402cc95d7547978833f3ea934c3 100644 >--- a/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp >+++ b/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp >@@ -47,14 +47,14 @@ static constexpr bool verbose = false; > } \ > } while (0) > >-ALWAYS_INLINE std::optional<uint8_t> parseUInt7(const uint8_t* data, size_t& offset, size_t size) >+ALWAYS_INLINE WTF::Optional<uint8_t> parseUInt7(const uint8_t* data, size_t& offset, size_t size) > { > if (offset >= size) > return false; > uint8_t result = data[offset++]; > if (result < 0x80) > return result; >- return std::nullopt; >+ return WTF::nullopt; > } > > template <typename ...Args> >@@ -173,7 +173,7 @@ auto StreamingParser::parseSectionPayload(Vector<uint8_t>&& data) -> State > return State::SectionID; > } > >-auto StreamingParser::consume(const uint8_t* bytes, size_t bytesSize, size_t& offsetInBytes, size_t requiredSize) -> std::optional<Vector<uint8_t>> >+auto StreamingParser::consume(const uint8_t* bytes, size_t bytesSize, size_t& offsetInBytes, size_t requiredSize) -> WTF::Optional<Vector<uint8_t>> > { > if (m_remaining.size() == requiredSize) { > Vector<uint8_t> result = WTFMove(m_remaining); >@@ -195,7 +195,7 @@ auto StreamingParser::consume(const uint8_t* bytes, size_t bytesSize, size_t& of > if (totalDataSize < requiredSize) { > m_remaining.append(bytes + offsetInBytes, bytesRemainingSize); > offsetInBytes = bytesSize; >- return std::nullopt; >+ return WTF::nullopt; > } > > size_t usedSize = requiredSize - m_remaining.size(); >diff --git a/Source/JavaScriptCore/wasm/WasmStreamingParser.h b/Source/JavaScriptCore/wasm/WasmStreamingParser.h >index 1fbb6b22b3559af038b804f125a7efa5a9a5d818..931a224fd535bceb5e6b59ff9d47be2ab3bf3996 100644 >--- a/Source/JavaScriptCore/wasm/WasmStreamingParser.h >+++ b/Source/JavaScriptCore/wasm/WasmStreamingParser.h >@@ -91,7 +91,7 @@ private: > State parseFunctionSize(uint32_t); > State parseFunctionPayload(Vector<uint8_t>&&); > >- std::optional<Vector<uint8_t>> consume(const uint8_t* bytes, size_t, size_t&, size_t); >+ WTF::Optional<Vector<uint8_t>> consume(const uint8_t* bytes, size_t, size_t&, size_t); > Expected<uint32_t, State> consumeVarUInt32(const uint8_t* bytes, size_t, size_t&, IsEndOfStream); > > template <typename ...Args> NEVER_INLINE State WARN_UNUSED_RETURN fail(Args...); >diff --git a/Source/JavaScriptCore/wasm/WasmTable.cpp b/Source/JavaScriptCore/wasm/WasmTable.cpp >index ebb632520faf3083df4c6f271001fd557145e8fd..e5a975490eb8bf7bc93c79618e7ade800214839b 100644 >--- a/Source/JavaScriptCore/wasm/WasmTable.cpp >+++ b/Source/JavaScriptCore/wasm/WasmTable.cpp >@@ -47,7 +47,7 @@ void Table::setLength(uint32_t length) > ASSERT(m_mask == WTF::maskForSize(allocatedLength(length))); > } > >-RefPtr<Table> Table::tryCreate(uint32_t initial, std::optional<uint32_t> maximum) >+RefPtr<Table> Table::tryCreate(uint32_t initial, WTF::Optional<uint32_t> maximum) > { > if (!isValidLength(initial)) > return nullptr; >@@ -58,7 +58,7 @@ Table::~Table() > { > } > >-Table::Table(uint32_t initial, std::optional<uint32_t> maximum) >+Table::Table(uint32_t initial, WTF::Optional<uint32_t> maximum) > { > setLength(initial); > m_maximum = maximum; >@@ -76,7 +76,7 @@ Table::Table(uint32_t initial, std::optional<uint32_t> maximum) > } > } > >-std::optional<uint32_t> Table::grow(uint32_t delta) >+WTF::Optional<uint32_t> Table::grow(uint32_t delta) > { > if (delta == 0) > return length(); >@@ -86,12 +86,12 @@ std::optional<uint32_t> Table::grow(uint32_t delta) > newLengthChecked += delta; > uint32_t newLength; > if (newLengthChecked.safeGet(newLength) == CheckedState::DidOverflow) >- return std::nullopt; >+ return WTF::nullopt; > > if (maximum() && newLength > *maximum()) >- return std::nullopt; >+ return WTF::nullopt; > if (!isValidLength(newLength)) >- return std::nullopt; >+ return WTF::nullopt; > > auto checkedGrow = [&] (auto& container) { > if (newLengthChecked.unsafeGet() > allocatedLength(m_length)) { >@@ -109,9 +109,9 @@ std::optional<uint32_t> Table::grow(uint32_t delta) > }; > > if (!checkedGrow(m_importableFunctions)) >- return std::nullopt; >+ return WTF::nullopt; > if (!checkedGrow(m_instances)) >- return std::nullopt; >+ return WTF::nullopt; > > setLength(newLength); > >diff --git a/Source/JavaScriptCore/wasm/WasmTable.h b/Source/JavaScriptCore/wasm/WasmTable.h >index 2f5483c618fa458bce0ed850da5594a91e62b9e0..aaf9e3e28376aa4c4f20eea7a3f5b8c772d10e86 100644 >--- a/Source/JavaScriptCore/wasm/WasmTable.h >+++ b/Source/JavaScriptCore/wasm/WasmTable.h >@@ -40,13 +40,13 @@ class Instance; > > class Table : public ThreadSafeRefCounted<Table> { > public: >- static RefPtr<Table> tryCreate(uint32_t initial, std::optional<uint32_t> maximum); >+ static RefPtr<Table> tryCreate(uint32_t initial, WTF::Optional<uint32_t> maximum); > > JS_EXPORT_PRIVATE ~Table(); > >- std::optional<uint32_t> maximum() const { return m_maximum; } >+ WTF::Optional<uint32_t> maximum() const { return m_maximum; } > uint32_t length() const { return m_length; } >- std::optional<uint32_t> grow(uint32_t delta) WARN_UNUSED_RETURN; >+ WTF::Optional<uint32_t> grow(uint32_t delta) WARN_UNUSED_RETURN; > void clearFunction(uint32_t); > void setFunction(uint32_t, WasmToWasmImportableFunction, Instance*); > >@@ -60,7 +60,7 @@ public: > static bool isValidLength(uint32_t length) { return length < maxTableEntries; } > > private: >- Table(uint32_t initial, std::optional<uint32_t> maximum); >+ Table(uint32_t initial, WTF::Optional<uint32_t> maximum); > > void setLength(uint32_t); > >@@ -69,7 +69,7 @@ private: > MallocPtr<Instance*> m_instances; > uint32_t m_length; > uint32_t m_mask; >- std::optional<uint32_t> m_maximum; >+ WTF::Optional<uint32_t> m_maximum; > }; > > } } // namespace JSC::Wasm >diff --git a/Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h b/Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h >index ad70a1fbb2bc5b7925af424bf5b905f9f999f42d..cfaca538d358f9761da59c0216a9375661ab4bb8 100644 >--- a/Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h >+++ b/Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h >@@ -49,7 +49,7 @@ public: > DECLARE_INFO; > > static bool isValidLength(uint32_t length) { return Wasm::Table::isValidLength(length); } >- std::optional<uint32_t> maximum() const { return m_table->maximum(); } >+ WTF::Optional<uint32_t> maximum() const { return m_table->maximum(); } > uint32_t length() const { return m_table->length(); } > uint32_t allocatedLength() const { return m_table->allocatedLength(length()); } > bool grow(uint32_t delta) WARN_UNUSED_RETURN; >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp b/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp >index 0f24369198e17256c2aaf0eb45954e924173961f..402bcad1b744f1b7f53b579f3b5d82cea7ee9ff2 100644 >--- a/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp >@@ -62,7 +62,7 @@ static EncodedJSValue JSC_HOST_CALL callWebAssemblyFunction(ExecState* exec) > // Make sure that the memory we think we are going to run with matches the one we expect. > ASSERT(wasmFunction->instance()->instance().codeBlock()->isSafeToRun(wasmFunction->instance()->memory()->memory().mode())); > >- std::optional<TraceScope> traceScope; >+ WTF::Optional<TraceScope> traceScope; > if (Options::useTracePoints()) > traceScope.emplace(WebAssemblyExecuteStart, WebAssemblyExecuteEnd); > >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp b/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp >index ec3c49702b2fc285c107aebcdb83f4187d2ee320..efb4fcf39c71a8ee4d82bb1d5e9bd5a02ce3ea5f 100644 >--- a/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp >@@ -269,8 +269,8 @@ void WebAssemblyModuleRecord::link(ExecState* exec, JSValue, JSObject* importObj > if (actualInitial < expectedInitial) > return exception(createJSWebAssemblyLinkError(exec, vm, importFailMessage(import, "Table import", "provided an 'initial' that is too small"))); > >- if (std::optional<uint32_t> expectedMaximum = moduleInformation.tableInformation.maximum()) { >- std::optional<uint32_t> actualMaximum = table->maximum(); >+ if (WTF::Optional<uint32_t> expectedMaximum = moduleInformation.tableInformation.maximum()) { >+ WTF::Optional<uint32_t> actualMaximum = table->maximum(); > if (!actualMaximum) > return exception(createJSWebAssemblyLinkError(exec, vm, importFailMessage(import, "Table import", "does not have a 'maximum' but the module requires that it does"))); > if (*actualMaximum > *expectedMaximum) >@@ -449,7 +449,7 @@ JSValue WebAssemblyModuleRecord::evaluate(ExecState* exec) > > const Vector<Wasm::Segment::Ptr>& data = moduleInformation.data; > >- std::optional<JSValue> exception; >+ WTF::Optional<JSValue> exception; > > auto forEachElement = [&] (auto fn) { > for (const Wasm::Element& element : moduleInformation.elements) { >diff --git a/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp b/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp >index 5a69520850de0191ae273b47fb99b337c17e86b1..1256544d5242c7b0853f52f1831d893c0a20cf43 100644 >--- a/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp >+++ b/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp >@@ -74,7 +74,7 @@ static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyTable(ExecState* exec) > uint32_t initial = toNonWrappingUint32(exec, initialSizeValue); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > >- std::optional<uint32_t> maximum; >+ WTF::Optional<uint32_t> maximum; > Identifier maximumIdent = Identifier::fromString(&vm, "maximum"); > bool hasProperty = memoryDescriptor->hasProperty(exec, maximumIdent); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >diff --git a/Source/JavaScriptCore/yarr/YarrJIT.cpp b/Source/JavaScriptCore/yarr/YarrJIT.cpp >index f4775879cd338b4e59d42f130c467265841efcb5..39a0b5f9f375f55103c6996769d1094a77c5f5db 100644 >--- a/Source/JavaScriptCore/yarr/YarrJIT.cpp >+++ b/Source/JavaScriptCore/yarr/YarrJIT.cpp >@@ -4140,7 +4140,7 @@ private: > > // Used to detect regular expression constructs that are not currently > // supported in the JIT; fall back to the interpreter when this is detected. >- std::optional<JITFailureReason> m_failureReason; >+ WTF::Optional<JITFailureReason> m_failureReason; > > bool m_decodeSurrogatePairs; > bool m_unicodeIgnoreCase; >diff --git a/Source/JavaScriptCore/yarr/YarrJIT.h b/Source/JavaScriptCore/yarr/YarrJIT.h >index e1f5ae0e820756ac82a62271e50a5da133c073e8..38caa5004c0262300a186b9e0ed762726ba17404 100644 >--- a/Source/JavaScriptCore/yarr/YarrJIT.h >+++ b/Source/JavaScriptCore/yarr/YarrJIT.h >@@ -83,7 +83,7 @@ public: > YarrCodeBlock() = default; > > void setFallBackWithFailureReason(JITFailureReason failureReason) { m_failureReason = failureReason; } >- std::optional<JITFailureReason> failureReason() { return m_failureReason; } >+ WTF::Optional<JITFailureReason> failureReason() { return m_failureReason; } > > bool has8BitCode() { return m_ref8.size(); } > bool has16BitCode() { return m_ref16.size(); } >@@ -193,7 +193,7 @@ public: > m_ref16 = MacroAssemblerCodeRef<Yarr16BitPtrTag>(); > m_matchOnly8 = MacroAssemblerCodeRef<YarrMatchOnly8BitPtrTag>(); > m_matchOnly16 = MacroAssemblerCodeRef<YarrMatchOnly16BitPtrTag>(); >- m_failureReason = std::nullopt; >+ m_failureReason = WTF::nullopt; > } > > private: >@@ -204,7 +204,7 @@ private: > #if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) > bool m_usesPatternContextBuffer; > #endif >- std::optional<JITFailureReason> m_failureReason; >+ WTF::Optional<JITFailureReason> m_failureReason; > }; > > enum YarrJITCompileMode { >diff --git a/Source/JavaScriptCore/yarr/YarrParser.h b/Source/JavaScriptCore/yarr/YarrParser.h >index 8e0fd8374eac448ff3fa05cced3f9ca0b1f7eb9f..4bd1b9b60ebec9b5dee3f6b6cd0359f0c96ecaa7 100644 >--- a/Source/JavaScriptCore/yarr/YarrParser.h >+++ b/Source/JavaScriptCore/yarr/YarrParser.h >@@ -1022,10 +1022,10 @@ private: > return n; > } > >- std::optional<String> tryConsumeGroupName() >+ WTF::Optional<String> tryConsumeGroupName() > { > if (atEndOfPattern()) >- return std::nullopt; >+ return WTF::nullopt; > > ParseState state = saveState(); > >@@ -1038,7 +1038,7 @@ private: > while (!atEndOfPattern()) { > ch = tryConsumeIdentifierCharacter(); > if (ch == '>') >- return std::optional<String>(identifierBuilder.toString()); >+ return WTF::Optional<String>(identifierBuilder.toString()); > > if (!isIdentifierPart(ch)) > break; >@@ -1049,14 +1049,14 @@ private: > > restoreState(state); > >- return std::nullopt; >+ return WTF::nullopt; > } > >- std::optional<BuiltInCharacterClassID> tryConsumeUnicodePropertyExpression() >+ WTF::Optional<BuiltInCharacterClassID> tryConsumeUnicodePropertyExpression() > { > if (atEndOfPattern() || !isUnicodePropertyValueExpressionChar(peek())) { > m_errorCode = ErrorCode::InvalidUnicodePropertyExpression; >- return std::nullopt; >+ return WTF::nullopt; > } > > StringBuilder expressionBuilder; >@@ -1072,7 +1072,7 @@ private: > consume(); > if (errors) { > m_errorCode = ErrorCode::InvalidUnicodePropertyExpression; >- return std::nullopt; >+ return WTF::nullopt; > } > > if (foundEquals) { >@@ -1103,7 +1103,7 @@ private: > } > > m_errorCode = ErrorCode::InvalidUnicodePropertyExpression; >- return std::nullopt; >+ return WTF::nullopt; > } > > Delegate& m_delegate; >@@ -1141,7 +1141,7 @@ private: > * void atomCharacterClassRange(UChar32 begin, UChar32 end) > * void atomCharacterClassBuiltIn(BuiltInCharacterClassID classID, bool invert) > * void atomCharacterClassEnd() >- * void atomParenthesesSubpatternBegin(bool capture = true, std::optional<String> groupName); >+ * void atomParenthesesSubpatternBegin(bool capture = true, WTF::Optional<String> groupName); > * void atomParentheticalAssertionBegin(bool invert = false); > * void atomParenthesesEnd(); > * void atomBackReference(unsigned subpatternId); >diff --git a/Source/JavaScriptCore/yarr/YarrPattern.cpp b/Source/JavaScriptCore/yarr/YarrPattern.cpp >index 482587c8810a9407b2d2e2502db9770d31122e18..47df79f9bd2b787442a74df1266bbcc8b9adeb10 100644 >--- a/Source/JavaScriptCore/yarr/YarrPattern.cpp >+++ b/Source/JavaScriptCore/yarr/YarrPattern.cpp >@@ -590,7 +590,7 @@ public: > m_pattern.m_userCharacterClasses.append(WTFMove(newCharacterClass)); > } > >- void atomParenthesesSubpatternBegin(bool capture = true, std::optional<String> optGroupName = std::nullopt) >+ void atomParenthesesSubpatternBegin(bool capture = true, WTF::Optional<String> optGroupName = WTF::nullopt) > { > unsigned subpatternId = m_pattern.m_numSubpatterns + 1; > if (capture) { >diff --git a/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp b/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp >index 358cc94d6b0d1cf3e555efc177621234cd3b0274..4e99e88202e8b418b89478f91225410c247417ab 100644 >--- a/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp >+++ b/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp >@@ -44,7 +44,7 @@ public: > void atomCharacterClassRange(UChar, UChar) {} > void atomCharacterClassBuiltIn(BuiltInCharacterClassID, bool) {} > void atomCharacterClassEnd() {} >- void atomParenthesesSubpatternBegin(bool = true, std::optional<String> = std::nullopt) {} >+ void atomParenthesesSubpatternBegin(bool = true, WTF::Optional<String> = WTF::nullopt) {} > void atomParentheticalAssertionBegin(bool = false) {} > void atomParenthesesEnd() {} > void atomBackReference(unsigned) {} >diff --git a/Source/JavaScriptCore/yarr/YarrUnicodeProperties.cpp b/Source/JavaScriptCore/yarr/YarrUnicodeProperties.cpp >index c0792fa7c9c759e48ed503fe55f6b5f5e7911575..027ed59a83450c96c297c136ffc37b25632c8cec 100644 >--- a/Source/JavaScriptCore/yarr/YarrUnicodeProperties.cpp >+++ b/Source/JavaScriptCore/yarr/YarrUnicodeProperties.cpp >@@ -72,7 +72,7 @@ struct HashTable { > > #include "UnicodePatternTables.h" > >-std::optional<BuiltInCharacterClassID> unicodeMatchPropertyValue(WTF::String unicodePropertyName, WTF::String unicodePropertyValue) >+WTF::Optional<BuiltInCharacterClassID> unicodeMatchPropertyValue(WTF::String unicodePropertyName, WTF::String unicodePropertyValue) > { > int propertyIndex = -1; > >@@ -84,12 +84,12 @@ std::optional<BuiltInCharacterClassID> unicodeMatchPropertyValue(WTF::String uni > propertyIndex = generalCategoryHashTable.entry(unicodePropertyValue); > > if (propertyIndex == -1) >- return std::nullopt; >+ return WTF::nullopt; > >- return std::optional<BuiltInCharacterClassID>(static_cast<BuiltInCharacterClassID>(static_cast<int>(BuiltInCharacterClassID::BaseUnicodePropertyID) + propertyIndex)); >+ return WTF::Optional<BuiltInCharacterClassID>(static_cast<BuiltInCharacterClassID>(static_cast<int>(BuiltInCharacterClassID::BaseUnicodePropertyID) + propertyIndex)); > } > >-std::optional<BuiltInCharacterClassID> unicodeMatchProperty(WTF::String unicodePropertyValue) >+WTF::Optional<BuiltInCharacterClassID> unicodeMatchProperty(WTF::String unicodePropertyValue) > { > int propertyIndex = -1; > >@@ -98,9 +98,9 @@ std::optional<BuiltInCharacterClassID> unicodeMatchProperty(WTF::String unicodeP > propertyIndex = generalCategoryHashTable.entry(unicodePropertyValue); > > if (propertyIndex == -1) >- return std::nullopt; >+ return WTF::nullopt; > >- return std::optional<BuiltInCharacterClassID>(static_cast<BuiltInCharacterClassID>(static_cast<int>(BuiltInCharacterClassID::BaseUnicodePropertyID) + propertyIndex)); >+ return WTF::Optional<BuiltInCharacterClassID>(static_cast<BuiltInCharacterClassID>(static_cast<int>(BuiltInCharacterClassID::BaseUnicodePropertyID) + propertyIndex)); > } > > std::unique_ptr<CharacterClass> createUnicodeCharacterClassFor(BuiltInCharacterClassID unicodeClassID) >diff --git a/Source/JavaScriptCore/yarr/YarrUnicodeProperties.h b/Source/JavaScriptCore/yarr/YarrUnicodeProperties.h >index 20f6739de3b7ddbdd0a5142cd1f65d630f29bc56..8b477eae8e182b5f5add67028bc31b6cc6d7f9c5 100644 >--- a/Source/JavaScriptCore/yarr/YarrUnicodeProperties.h >+++ b/Source/JavaScriptCore/yarr/YarrUnicodeProperties.h >@@ -33,8 +33,8 @@ namespace JSC { namespace Yarr { > > struct CharacterClass; > >-JS_EXPORT_PRIVATE std::optional<BuiltInCharacterClassID> unicodeMatchPropertyValue(WTF::String, WTF::String); >-JS_EXPORT_PRIVATE std::optional<BuiltInCharacterClassID> unicodeMatchProperty(WTF::String); >+JS_EXPORT_PRIVATE WTF::Optional<BuiltInCharacterClassID> unicodeMatchPropertyValue(WTF::String, WTF::String); >+JS_EXPORT_PRIVATE WTF::Optional<BuiltInCharacterClassID> unicodeMatchProperty(WTF::String); > > std::unique_ptr<CharacterClass> createUnicodeCharacterClassFor(BuiltInCharacterClassID); > >diff --git a/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/base_export.h b/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/base_export.h >index 1af54853368785cff11ccb87b283cbb4b06f1c84..426047a9927f02d3d62572b67e4b53d33464a8c0 100644 >--- a/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/base_export.h >+++ b/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/base_export.h >@@ -10,4 +10,4 @@ > > #define ANGLEBASE_EXPORT > >-#endif // ANGLEBASE_BASE_EXPORT_H_ >\ No newline at end of file >+#endif // ANGLEBASE_BASE_EXPORT_H_ >diff --git a/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/sys_byteorder.h b/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/sys_byteorder.h >index 43d1777f26fadbadcc701786bef6ab58f8cec259..70d9c275e6c5f76d354c32818bf311b04ed5b9a4 100644 >--- a/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/sys_byteorder.h >+++ b/Source/ThirdParty/ANGLE/src/common/third_party/base/anglebase/sys_byteorder.h >@@ -46,4 +46,4 @@ inline uint64_t ByteSwap(uint64_t x) > > } // namespace angle > >-#endif // ANGLEBASE_SYS_BYTEORDER_H_ >\ No newline at end of file >+#endif // ANGLEBASE_SYS_BYTEORDER_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp b/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp >index ce9828f1f91a8671658b420a10a5801447b3efae..d4d0623e1eb9633e63a1df045960791d83215321 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp >@@ -218,4 +218,4 @@ void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root, > } > } > >-} // namespace sh >\ No newline at end of file >+} // namespace sh >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h b/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h >index b4ab05fd0e77c375a1efaeb06f3c95ad3159409d..4b2aefe13d0ac7bb289f81b4ab3d88d79893ff87 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h >@@ -45,4 +45,4 @@ void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root, > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/FindMain.h b/Source/ThirdParty/ANGLE/src/compiler/translator/FindMain.h >index bf2c45d871e60c6d4e02f8f68c2b2252ff13a953..94401b79a27f4a566c5bdfcdebdc32a82d3f4e43 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/FindMain.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/FindMain.h >@@ -20,4 +20,4 @@ TIntermBlock *FindMainBody(TIntermBlock *root); > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_FINDMAIN_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_FINDMAIN_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/FindSymbolNode.h b/Source/ThirdParty/ANGLE/src/compiler/translator/FindSymbolNode.h >index 08dfb9a22240caa6705b5a972c5d263facd50242..9be690ac97881e05f970523e15b97e94c4743bd9 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/FindSymbolNode.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/FindSymbolNode.h >@@ -24,4 +24,4 @@ const TIntermSymbol *FindSymbolNode(TIntermNode *root, > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_FIND_SYMBOL_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_FIND_SYMBOL_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode_util.h b/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode_util.h >index 6f3b0674f03c03700ec5f168e49cce101e7190b8..734387e91ddb19f68a9f7a7ee991084ffcc56889 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode_util.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode_util.h >@@ -57,4 +57,4 @@ TIntermTyped *CreateBuiltInFunctionCallNode(const TString &name, > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_INTERMNODEUTIL_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_INTERMNODEUTIL_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp b/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp >index 7a2156611aadf2c0ba842e77d11e5dfc04bb9e04..259cdc55c32ff2e85e1c54e68b67147e7ec0aca1 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp >@@ -382,4 +382,4 @@ bool IsAssignment(TOperator op) > default: > return false; > } >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/OutputTree.h b/Source/ThirdParty/ANGLE/src/compiler/translator/OutputTree.h >index 9f11989cb1f21a1273ebeb587bce5f7d4b1af43f..cf915b32ba347467d2da99d6823975587b7c58db 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/OutputTree.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/OutputTree.h >@@ -19,4 +19,4 @@ void OutputTree(TIntermNode *root, TInfoSinkBase &out); > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_OUTPUTTREE_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_OUTPUTTREE_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveEmptySwitchStatements.h b/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveEmptySwitchStatements.h >index 1018a50d822ba166da8695d1e08f27c4ab93b554..88bc10062247033bd74227b6d2bf771c28f630e2 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveEmptySwitchStatements.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveEmptySwitchStatements.h >@@ -15,4 +15,4 @@ class TIntermBlock; > void RemoveEmptySwitchStatements(TIntermBlock *root); > } > >-#endif // COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.cpp b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.cpp >index b602e0c92302c4661ecc046597e9fa71f2ca136a..2c78f3bc4d27788dd7983a9b47df30ab7df918b4 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.cpp >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.cpp >@@ -151,4 +151,4 @@ void RewriteTexelFetchOffset(TIntermNode *root, const TSymbolTable &symbolTable, > Traverser::Apply(root, symbolTable, shaderVersion); > } > >-} // namespace sh >\ No newline at end of file >+} // namespace sh >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.h b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.h >index 694d709f8e67ba96dfe13920c089ea24529a57b7..a739297c3cf55908bdb8ddb9f47c65b77b880e03 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteTexelFetchOffset.h >@@ -25,4 +25,4 @@ void RewriteTexelFetchOffset(TIntermNode *root, const TSymbolTable &symbolTable, > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_REWRITE_TEXELFETCHOFFSET_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_REWRITE_TEXELFETCHOFFSET_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp >index fe2ef948b4521e70c18eb866278f419b53d7cc9d..47e96ed2182268f1326560a0f3d51ecd90aa08b3 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp >@@ -109,4 +109,4 @@ void RewriteUnaryMinusOperatorInt(TIntermNode *root) > Traverser::Apply(root); > } > >-} // namespace sh >\ No newline at end of file >+} // namespace sh >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.h b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.h >index 50f0c442a733b01e05df9ffafa5553cb67642f5e..802ed5748f12324637b702630ab6ed7a26fd0f13 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteUnaryMinusOperatorInt.h >@@ -17,4 +17,4 @@ void RewriteUnaryMinusOperatorInt(TIntermNode *root); > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORINT_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORINT_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/RunAtTheEndOfShader.h b/Source/ThirdParty/ANGLE/src/compiler/translator/RunAtTheEndOfShader.h >index ed94c28daecc573cbcefa89580b383e2df2b6142..caaf61c40992abd54e239b7975dcd4773fefe95e 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/RunAtTheEndOfShader.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/RunAtTheEndOfShader.h >@@ -20,4 +20,4 @@ void RunAtTheEndOfShader(TIntermBlock *root, TIntermNode *codeToRun, TSymbolTabl > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_RUNATTHEENDOFSHADER_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_RUNATTHEENDOFSHADER_H_ >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.cpp b/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.cpp >index 9c36fcea789473c3065d3dc7ec52b63a05035210..57cef6c5fcb6f5b0358ca6c4cd33036313ddec96 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.cpp >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.cpp >@@ -171,4 +171,4 @@ bool ValidateVaryingLocations(TIntermBlock *root, TDiagnostics *diagnostics, GLe > return (diagnostics->numErrors() == numErrorsBefore); > } > >-} // namespace sh >\ No newline at end of file >+} // namespace sh >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.h b/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.h >index 1e53977c68f4d0005fc08048876d2c7a1868712b..32120fd89443c309a6d542e454805810d9fe1a5d 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateVaryingLocations.h >@@ -22,4 +22,4 @@ bool ValidateVaryingLocations(TIntermBlock *root, TDiagnostics *diagnostics, GLe > > } // namespace sh > >-#endif >\ No newline at end of file >+#endif >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp b/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp >index 1e79a609915bb222bb7341c0fef250c855b9f59a..582b74744061bc3bb9a7d39fb77fc3cd01aec292 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp >@@ -281,4 +281,4 @@ void VectorizeVectorScalarArithmetic(TIntermBlock *root, TSymbolTable *symbolTab > } while (traverser.didReplaceScalarsWithVectors()); > } > >-} // namespace sh >\ No newline at end of file >+} // namespace sh >diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.h b/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.h >index 69f092e039d88cc02dcdcf7c6b742473c826e564..75c7e8a43ef27c3cacd7e23e61178f90f5282b1a 100644 >--- a/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.h >+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/VectorizeVectorScalarArithmetic.h >@@ -22,4 +22,4 @@ void VectorizeVectorScalarArithmetic(TIntermBlock *root, TSymbolTable *symbolTab > > } // namespace sh > >-#endif // COMPILER_TRANSLATOR_VECTORIZEVECTORSCALARARITHMETIC_H_ >\ No newline at end of file >+#endif // COMPILER_TRANSLATOR_VECTORIZEVECTORSCALARARITHMETIC_H_ >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.cpp b/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.cpp >index 2a97ce939f3e2536739eebd69bd4c0aa63dd8c9a..6b6d24fd2a977cea5f7d5aedf50e2ce7fe06d7cd 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.cpp >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.cpp >@@ -226,4 +226,4 @@ bool HandleRangeAllocator::isUsed(GLuint handle) const > return current->second >= handle; > } > >-} // namespace gl >\ No newline at end of file >+} // namespace gl >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.h b/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.h >index 4d4b6f4f69a80876c8cd23fc880e45e29eebf129..1ae532f0bf8973f2fe753ba527a09f854db1b4a8 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.h >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator.h >@@ -57,4 +57,4 @@ class HandleRangeAllocator final : angle::NonCopyable > > } // namespace gl > >-#endif // LIBANGLE_HANDLERANGEALLOCATOR_H_ >\ No newline at end of file >+#endif // LIBANGLE_HANDLERANGEALLOCATOR_H_ >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator_unittest.cpp b/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator_unittest.cpp >index 1d825f7106b38fc82ec407a9efa8a8b7c6c75da5..7110d6327e2b33aebadcbefd410b74d4a641295d 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator_unittest.cpp >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/HandleRangeAllocator_unittest.cpp >@@ -272,4 +272,4 @@ TEST_F(HandleRangeAllocatorTest, ZeroIdCases) > EXPECT_FALSE(allocator->isUsed(id1)); > } > >-} // namespace >\ No newline at end of file >+} // namespace >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/Path.h b/Source/ThirdParty/ANGLE/src/libANGLE/Path.h >index b103c8460705e0db05726b53cd17baeace3fdb05..85f49c15622f42047b2df7faf4fd0df68ddc6719 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/Path.h >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/Path.h >@@ -68,4 +68,4 @@ class Path final : angle::NonCopyable > > } // namespace gl > >-#endif // LIBANGLE_PATH_H_ >\ No newline at end of file >+#endif // LIBANGLE_PATH_H_ >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/PathImpl.h b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/PathImpl.h >index 3607f69a2b80bd4c7591e963812953a3c331ceab..cb03ed6a3ba9d3ed86a868a90be281c383e7ed36 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/PathImpl.h >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/PathImpl.h >@@ -33,4 +33,4 @@ class PathImpl : angle::NonCopyable > > } // namespace rx > >-#endif // LIBANGLE_RENDERER_PATHIMPL_H_ >\ No newline at end of file >+#endif // LIBANGLE_RENDERER_PATHIMPL_H_ >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/driver_utils.cpp b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/driver_utils.cpp >index d97b8e7c22abb1743b55cc22b692c23bda8b5de1..85e0f4e6d11a4c2efe0fea3290fbb2f7a0bd7052 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/driver_utils.cpp >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/driver_utils.cpp >@@ -117,4 +117,4 @@ bool IsKabylake(uint32_t DeviceId) > return std::find(std::begin(Kabylake), std::end(Kabylake), DeviceId) != std::end(Kabylake); > } > >-} // namespace rx >\ No newline at end of file >+} // namespace rx >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.cpp b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.cpp >index fb329781a589d858849aba2270f7151731dd32cf..835b62943e95450128c73a25efa09c7d5ba165e6 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.cpp >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.cpp >@@ -237,4 +237,4 @@ void ClearMultiviewGL::initializeResources() > ASSERT(mFramebuffer != 0u); > } > >-} // namespace rx >\ No newline at end of file >+} // namespace rx >diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.h b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.h >index cdbbfad1327dfd847c49bb19dce7130289048a43..ae08252f4279aeb3b4310fdbe2c5e44e2fd69376 100644 >--- a/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.h >+++ b/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ClearMultiviewGL.h >@@ -92,4 +92,4 @@ class ClearMultiviewGL : angle::NonCopyable > }; > } // namespace rx > >-#endif // LIBANGLE_RENDERER_GL_CLEARMULTIVIEWGL_H_ >\ No newline at end of file >+#endif // LIBANGLE_RENDERER_GL_CLEARMULTIVIEWGL_H_ >diff --git a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp >index 8adec774a1d6bd7fd4204a47b2a54cfa7e10a1c4..ce8062de9d9735b4733bf0cdea4c6b6f7b8bcc7d 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp >@@ -32,4 +32,4 @@ TEST_F(GLSLCompatibilityOutputTest, GLPositionWrittenTest) > "}"; > compile(shaderString); > EXPECT_TRUE(foundInCode("gl_Position")); >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GeometryShader_test.cpp b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GeometryShader_test.cpp >index ad8512cb1abccb07a18f6d29d53577a0d8fc0dfd..06bbdf9a0c1e6c57555c4d861c3a6bcc129edfcf 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GeometryShader_test.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/GeometryShader_test.cpp >@@ -1643,4 +1643,4 @@ TEST_F(GeometryShaderTest, MixedUseOESAndEXTExtension) > } > } > } >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/TypeTracking_test.cpp b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/TypeTracking_test.cpp >index b2913c6a5b317e82c5b93dd3eba5bfe7a8ff5fd0..284aac0852533df82b520340d9c038d056c8cfe7 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/TypeTracking_test.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/TypeTracking_test.cpp >@@ -642,4 +642,4 @@ TEST_F(TypeTrackingTest, BuiltInUsubBorrowPrecision) > compile(shaderString); > ASSERT_FALSE(foundErrorInIntermediateTree()); > ASSERT_TRUE(foundInIntermediateTree("usubBorrow (highp 2-component vector of uint)")); >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/WEBGL_multiview_test.cpp b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/WEBGL_multiview_test.cpp >index 0ec970ce2cdbf4b80a4f6140043c8aaa5159152e..f48d3538e1db21704fcff5c434e8a47702c8e0b4 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/compiler_tests/WEBGL_multiview_test.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/compiler_tests/WEBGL_multiview_test.cpp >@@ -760,4 +760,4 @@ TEST_F(WEBGLMultiviewVertexShaderOutputCodeTest, GlLayerIsSet) > EXPECT_LT(viewIDOVRAssignmentLoc, glLayerAssignmentLoc); > } > >-} // namespace >\ No newline at end of file >+} // namespace >diff --git a/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp b/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp >index 35401b70fb696b5c55831403c46a3666c35b1282..284ea48a9203fe1d20e40dba99921dd634d60a99 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp >@@ -379,4 +379,4 @@ TEST_P(EGLPresentPathD3D11, ClientBufferPresentPathCopy) > checkPixelsUsingD3D(false); > } > >-ANGLE_INSTANTIATE_TEST(EGLPresentPathD3D11, ES2_D3D11(), ES2_D3D11_FL9_3()); >\ No newline at end of file >+ANGLE_INSTANTIATE_TEST(EGLPresentPathD3D11, ES2_D3D11(), ES2_D3D11_FL9_3()); >diff --git a/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLSanityCheckTest.cpp b/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLSanityCheckTest.cpp >index 5c19eb8a5395fe0d59b1e7f5b851fbc51e5a8bcb..d631a20fcbc14ae419c169c7e7b56ddad8a40344 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLSanityCheckTest.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/egl_tests/EGLSanityCheckTest.cpp >@@ -34,4 +34,4 @@ TEST(EGLSanityCheckTest, GetProcAddressNegativeTest) > { > auto check = eglGetProcAddress("WigglyWombats"); > EXPECT_EQ(nullptr, check); >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/ANGLE/src/tests/gl_tests/FramebufferMultiviewTest.cpp b/Source/ThirdParty/ANGLE/src/tests/gl_tests/FramebufferMultiviewTest.cpp >index 182a5aed1411d23b3376093478d7c70cbf3e9ee7..6f53543f90523ecca1517e23411970142d51bbfd 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/gl_tests/FramebufferMultiviewTest.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/gl_tests/FramebufferMultiviewTest.cpp >@@ -1348,4 +1348,4 @@ TEST_P(FramebufferMultiviewLayeredClearTest, ColorBufferClearAllLayersAttached) > > ANGLE_INSTANTIATE_TEST(FramebufferMultiviewTest, ES3_OPENGL()); > ANGLE_INSTANTIATE_TEST(FramebufferMultiviewSideBySideClearTest, ES3_OPENGL(), ES3_D3D11()); >-ANGLE_INSTANTIATE_TEST(FramebufferMultiviewLayeredClearTest, ES3_OPENGL(), ES3_D3D11()); >\ No newline at end of file >+ANGLE_INSTANTIATE_TEST(FramebufferMultiviewLayeredClearTest, ES3_OPENGL(), ES3_D3D11()); >diff --git a/Source/ThirdParty/ANGLE/src/tests/gl_tests/ObjectAllocationTest.cpp b/Source/ThirdParty/ANGLE/src/tests/gl_tests/ObjectAllocationTest.cpp >index b0e59f7fcfcbca2a6b4a9f4b707b9754a23f671e..e2536db88be8b23f0179588f1dd24a87a5d0c2f2 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/gl_tests/ObjectAllocationTest.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/gl_tests/ObjectAllocationTest.cpp >@@ -51,4 +51,4 @@ TEST_P(ObjectAllocationTest, BindFramebufferAfterGen) > > } // anonymous namespace > >-ANGLE_INSTANTIATE_TEST(ObjectAllocationTest, ES3_OPENGL(), ES3_D3D11()); >\ No newline at end of file >+ANGLE_INSTANTIATE_TEST(ObjectAllocationTest, ES3_OPENGL(), ES3_D3D11()); >diff --git a/Source/ThirdParty/ANGLE/src/tests/gl_tests/PathRenderingTest.cpp b/Source/ThirdParty/ANGLE/src/tests/gl_tests/PathRenderingTest.cpp >index 62f38b396dd4e0c8bfc39fa82f3d94252d98aec1..b11a64095a947b3fffe474b4093131941e4b7d5e 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/gl_tests/PathRenderingTest.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/gl_tests/PathRenderingTest.cpp >@@ -1981,4 +1981,4 @@ ANGLE_INSTANTIATE_TEST(CHROMIUMPathRenderingWithTexturingTest, > ES2_OPENGL(), > ES2_OPENGLES(), > ES3_OPENGL(), >- ES3_OPENGLES()); >\ No newline at end of file >+ ES3_OPENGLES()); >diff --git a/Source/ThirdParty/ANGLE/src/tests/preprocessor_tests/PreprocessorTest.cpp b/Source/ThirdParty/ANGLE/src/tests/preprocessor_tests/PreprocessorTest.cpp >index ccb21a55e2237c527b2f33a4e88d62f1f0f681af..713d8eb5310f6178c13274b783fdefc27db4b94f 100644 >--- a/Source/ThirdParty/ANGLE/src/tests/preprocessor_tests/PreprocessorTest.cpp >+++ b/Source/ThirdParty/ANGLE/src/tests/preprocessor_tests/PreprocessorTest.cpp >@@ -64,4 +64,4 @@ void SimplePreprocessorTest::lexSingleToken(size_t count, > pp::Preprocessor preprocessor(&mDiagnostics, &mDirectiveHandler, pp::PreprocessorSettings()); > ASSERT_TRUE(preprocessor.init(count, input, nullptr)); > preprocessor.lex(token); >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTPixmap.cpp b/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTPixmap.cpp >index fdc853ae599406a8c11a158216a0939cc130d0f2..0c628dc753d305867d7f80860d4f9f5790fd168c 100644 >--- a/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTPixmap.cpp >+++ b/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTPixmap.cpp >@@ -14,4 +14,4 @@ OSPixmap *CreateOSPixmap() > { > UNIMPLEMENTED(); > return nullptr; >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTWindow.cpp b/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTWindow.cpp >index 33f76a29fba7e3a4f8ee0c63aa6bbdfdb6b08f31..e2e7d7d29e06e9c84c3b00e1d86efedcdd3aab6a 100644 >--- a/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTWindow.cpp >+++ b/Source/ThirdParty/ANGLE/util/windows/winrt/WinRTWindow.cpp >@@ -281,4 +281,4 @@ void WinRTWindow::signalTestEvent() > OSWindow *CreateOSWindow() > { > return new WinRTWindow(); >-} >\ No newline at end of file >+} >diff --git a/Source/ThirdParty/libwebrtc/Source/third_party/abseil-cpp/CMake/CMakeLists.txt.in b/Source/ThirdParty/libwebrtc/Source/third_party/abseil-cpp/CMake/CMakeLists.txt.in >index d60a33e9ac6a6ddfe0ebd181b33743f95e67b5a5..4c67ef5e5e1b55624cd5b26a61037e770a22ea26 100644 >--- a/Source/ThirdParty/libwebrtc/Source/third_party/abseil-cpp/CMake/CMakeLists.txt.in >+++ b/Source/ThirdParty/libwebrtc/Source/third_party/abseil-cpp/CMake/CMakeLists.txt.in >@@ -12,4 +12,4 @@ ExternalProject_Add(googletest > BUILD_COMMAND "" > INSTALL_COMMAND "" > TEST_COMMAND "" >-) >\ No newline at end of file >+) >diff --git a/Source/ThirdParty/libwebrtc/Source/third_party/gflags/src/test/config_for_unittests.h b/Source/ThirdParty/libwebrtc/Source/third_party/gflags/src/test/config_for_unittests.h >index 914571b36b99635acd8a2a2e0cec2b0aba549dab..056130942b53d12a77460d6fa0828accef8f171b 100644 >--- a/Source/ThirdParty/libwebrtc/Source/third_party/gflags/src/test/config_for_unittests.h >+++ b/Source/ThirdParty/libwebrtc/Source/third_party/gflags/src/test/config_for_unittests.h >@@ -76,4 +76,4 @@ > # define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport) > #else > # define GFLAGS_DLL_DECLARE_FLAG >-#endif >\ No newline at end of file >+#endif >diff --git a/Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/devtools/__init__.py b/Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/devtools/__init__.py >index c944e7cb0c08e3dd042c1e3ce04f820c01d366d5..15c796c7e5441414acd4f13341b6ce26cbd0a19c 100644 >--- a/Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/devtools/__init__.py >+++ b/Source/ThirdParty/libwebrtc/Source/third_party/jsoncpp/source/devtools/__init__.py >@@ -1 +1 @@ >-# module >\ No newline at end of file >+# module >diff --git a/Source/ThirdParty/libwebrtc/Source/third_party/libvpx/source/libvpx/third_party/libwebm/common/file_util.h b/Source/ThirdParty/libwebrtc/Source/third_party/libvpx/source/libvpx/third_party/libwebm/common/file_util.h >index 0e71eac11e465b650352a128b4d0576034f2b79c..ed89ef3f7c639041b096b6093d4276a32546b514 100644 >--- a/Source/ThirdParty/libwebrtc/Source/third_party/libvpx/source/libvpx/third_party/libwebm/common/file_util.h >+++ b/Source/ThirdParty/libwebrtc/Source/third_party/libvpx/source/libvpx/third_party/libwebm/common/file_util.h >@@ -38,4 +38,4 @@ class TempFileDeleter { > > } // namespace libwebm > >-#endif // LIBWEBM_COMMON_FILE_UTIL_H_ >\ No newline at end of file >+#endif // LIBWEBM_COMMON_FILE_UTIL_H_ >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index a2239490d112dca46a5aa4bcded35fdbcaaec9e9..d7465b7ac152d6503a82ac8b906387efee89bb8d 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -436,7 +436,6 @@ > A3E4DD921F3A803400DED0B4 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = "<group>"; }; > A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = "<group>"; }; > A5098B011C16A4F900087797 /* SecuritySPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecuritySPI.h; sourceTree = "<group>"; }; >- A561F30F1DF2642100FF675D /* DeprecatedOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedOptional.h; sourceTree = "<group>"; }; > A5BA15F2182433A900A82E69 /* StringCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringCocoa.mm; sourceTree = "<group>"; }; > A5BA15F41824348000A82E69 /* StringImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplCocoa.mm; sourceTree = "<group>"; }; > A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicStringImplCF.cpp; sourceTree = "<group>"; }; >@@ -876,7 +875,6 @@ > A8A4727B151A825A004123FF /* DecimalNumber.cpp */, > A8A4727C151A825A004123FF /* DecimalNumber.h */, > 0F2B66A417B6B4F700A7AE3F /* DeferrableRefCounted.h */, >- A561F30F1DF2642100FF675D /* DeprecatedOptional.h */, > A8A4727E151A825A004123FF /* Deque.h */, > A9A4727F151A825A004123FF /* DisallowCType.h */, > 0F4570421BE5B58F0062A629 /* Dominators.h */, >diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt >index cee1cce1e57184d13bd2cd519ef6a20dffb1a96a..ea7a2aa77eeba78f3715fdf6ec138e2b55ac430d 100644 >--- a/Source/WTF/wtf/CMakeLists.txt >+++ b/Source/WTF/wtf/CMakeLists.txt >@@ -47,7 +47,6 @@ set(WTF_PUBLIC_HEADERS > DebugUtilities.h > DecimalNumber.h > DeferrableRefCounted.h >- DeprecatedOptional.h > Deque.h > DisallowCType.h > Dominators.h >diff --git a/Source/WTF/wtf/CPUTime.h b/Source/WTF/wtf/CPUTime.h >index 6ac3fe7d5db1ea35d31a5d1f3eb8c4a495a850df..a5251831e7a4877eefcb0a4748adf3c4df7be31c 100644 >--- a/Source/WTF/wtf/CPUTime.h >+++ b/Source/WTF/wtf/CPUTime.h >@@ -38,7 +38,7 @@ struct CPUTime { > > WTF_EXPORT_PRIVATE double percentageCPUUsageSince(const CPUTime&) const; > >- WTF_EXPORT_PRIVATE static std::optional<CPUTime> get(); >+ WTF_EXPORT_PRIVATE static WTF::Optional<CPUTime> get(); > > // Returns the current CPU time of the current thread. > // Precision varies depending on platform but is usually as good or better >diff --git a/Source/WTF/wtf/CrossThreadCopier.h b/Source/WTF/wtf/CrossThreadCopier.h >index f4e4fd94fe2b4ab69fc3522382866aa99b9ff42e..40678dbebca6de5ece4d48816b531f632d171c96 100644 >--- a/Source/WTF/wtf/CrossThreadCopier.h >+++ b/Source/WTF/wtf/CrossThreadCopier.h >@@ -144,13 +144,13 @@ template<typename K, typename V> struct CrossThreadCopierBase<false, false, Hash > } > }; > >-// Default specialization for std::optional of CrossThreadCopyable class. >-template<typename T> struct CrossThreadCopierBase<false, false, std::optional<T>> { >- typedef std::optional<T> Type; >+// Default specialization for WTF::Optional of CrossThreadCopyable class. >+template<typename T> struct CrossThreadCopierBase<false, false, WTF::Optional<T>> { >+ typedef WTF::Optional<T> Type; > static Type copy(const Type& source) > { > if (!source) >- return std::nullopt; >+ return WTF::nullopt; > return CrossThreadCopier<T>::copy(*source); > } > }; >diff --git a/Source/WTF/wtf/CrossThreadQueue.h b/Source/WTF/wtf/CrossThreadQueue.h >index ade4d902f41cffa2f717fb7df7aacfd02ad44d30..8f3030cf79d8a5b8195f8c330dc8fc3c3f180c8c 100644 >--- a/Source/WTF/wtf/CrossThreadQueue.h >+++ b/Source/WTF/wtf/CrossThreadQueue.h >@@ -44,7 +44,7 @@ public: > void append(DataType&&); > > DataType waitForMessage(); >- std::optional<DataType> tryGetMessage(); >+ WTF::Optional<DataType> tryGetMessage(); > > void kill(); > bool isKilled() const; >@@ -84,7 +84,7 @@ DataType CrossThreadQueue<DataType>::waitForMessage() > } > > template<typename DataType> >-std::optional<DataType> CrossThreadQueue<DataType>::tryGetMessage() >+WTF::Optional<DataType> CrossThreadQueue<DataType>::tryGetMessage() > { > LockHolder lock(m_lock); > >diff --git a/Source/WTF/wtf/DateMath.cpp b/Source/WTF/wtf/DateMath.cpp >index 8b8eed257d3d7c6d97bbc67ca6fcfc2890761ea3..81e17c2e68305afaee8087677dd7e6793e93456d 100644 >--- a/Source/WTF/wtf/DateMath.cpp >+++ b/Source/WTF/wtf/DateMath.cpp >@@ -894,7 +894,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveT > if (day < 0) > return std::numeric_limits<double>::quiet_NaN(); > >- std::optional<int> year; >+ WTF::Optional<int> year; > if (day > 31) { > // ### where is the boundary and what happens below? > if (*dateString != '/') >@@ -977,7 +977,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveT > if (*newPosStr != ':') > return std::numeric_limits<double>::quiet_NaN(); > // There was no year; the number was the hour. >- year = std::nullopt; >+ year = WTF::nullopt; > } else { > // in the normal case (we parsed the year), advance to the next number > dateString = ++newPosStr; >diff --git a/Source/WTF/wtf/DeprecatedOptional.h b/Source/WTF/wtf/DeprecatedOptional.h >deleted file mode 100644 >index f5966e3d7931b4bdeec95e42ca4f47faccdfb479..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/DeprecatedOptional.h >+++ /dev/null >@@ -1,51 +0,0 @@ >-/* >- * Copyright (C) 2014, 2016 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-// This file contains a deprecated version of WTF::Optional which a released >-// version of Safari uses. Once Safari stops using this, we can remove this. >-// New code should use std::optional. >- >-#pragma once >- >-#include <type_traits> >- >-namespace WTF { >- >-template<typename T> >-class Optional { >-public: >- explicit operator bool() const { return m_isEngaged; } >- T& value() { return *asPtr(); } >- >-private: >- T* asPtr() { return reinterpret_cast<T*>(&m_value); } >- >- bool m_isEngaged; >- typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_value; >-}; >- >-template<typename T> using DeprecatedOptional = WTF::Optional<T>; >- >-} // namespace WTF >diff --git a/Source/WTF/wtf/HashTraits.h b/Source/WTF/wtf/HashTraits.h >index 3b7f30e1c588ed5300488c35bc7e8f65c4028085..57a73f2e2e215dbb1160c7166750ac1475c7adb5 100644 >--- a/Source/WTF/wtf/HashTraits.h >+++ b/Source/WTF/wtf/HashTraits.h >@@ -211,8 +211,8 @@ template<typename P> struct HashTraits<Ref<P>> : SimpleClassHashTraits<Ref<P>> { > static PeekType peek(const Ref<P>& value) { return const_cast<PeekType>(value.ptrAllowingHashTableEmptyValue()); } > static PeekType peek(P* value) { return value; } > >- typedef std::optional<Ref<P>> TakeType; >- static TakeType take(Ref<P>&& value) { return isEmptyValue(value) ? std::nullopt : std::optional<Ref<P>>(WTFMove(value)); } >+ typedef WTF::Optional<Ref<P>> TakeType; >+ static TakeType take(Ref<P>&& value) { return isEmptyValue(value) ? WTF::nullopt : WTF::Optional<Ref<P>>(WTFMove(value)); } > }; > > template<> struct HashTraits<String> : SimpleClassHashTraits<String> { >diff --git a/Source/WTF/wtf/Hasher.h b/Source/WTF/wtf/Hasher.h >index e3496e6d33bec652bfd0822247c0e3de9896c54e..b0f39b7de0444e7f88674029f79497e89f6cbad8 100644 >--- a/Source/WTF/wtf/Hasher.h >+++ b/Source/WTF/wtf/Hasher.h >@@ -140,7 +140,7 @@ template<typename T1, typename T2> void add(Hasher& hasher, const std::pair<T1, > add(hasher, pair.second); > } > >-template<typename T> void add(Hasher& hasher, const std::optional<T>& optional) >+template<typename T> void add(Hasher& hasher, const WTF::Optional<T>& optional) > { > add(hasher, optional.has_value()); > if (optional.has_value()) >diff --git a/Source/WTF/wtf/JSONValues.h b/Source/WTF/wtf/JSONValues.h >index 7f2c8e2ccd4fb85dea5348aab685cfd27319c915..2bc9c9a2ef9da1c8c373608442e495e2507fb9c2 100644 >--- a/Source/WTF/wtf/JSONValues.h >+++ b/Source/WTF/wtf/JSONValues.h >@@ -217,15 +217,15 @@ protected: > return value->asInteger(output); > } > >- template<class T> std::optional<T> getNumber(const String& name) const >+ template<class T> WTF::Optional<T> getNumber(const String& name) const > { > RefPtr<Value> value; > if (!getValue(name, value)) >- return std::nullopt; >+ return WTF::nullopt; > > T result; > if (!value->asDouble(result)) >- return std::nullopt; >+ return WTF::nullopt; > > return result; > } >diff --git a/Source/WTF/wtf/LoggerHelper.h b/Source/WTF/wtf/LoggerHelper.h >index 0aa8f4cbc221054dfa9e9716eb6605bda7082459..f04f26f456d4424e2a2175c8905123d33eaa466d 100644 >--- a/Source/WTF/wtf/LoggerHelper.h >+++ b/Source/WTF/wtf/LoggerHelper.h >@@ -52,7 +52,7 @@ public: > > #else > >-#define LOGIDENTIFIER (std::nullopt) >+#define LOGIDENTIFIER (WTF::nullopt) > > #define ALWAYS_LOG(...) ((void)0) > #define ERROR_LOG(...) ((void)0) >diff --git a/Source/WTF/wtf/MainThread.cpp b/Source/WTF/wtf/MainThread.cpp >index 7c22b727e9a2a336c58dac2768bbd34e1aa8dc59..a20f4ccffef4b78e4821304310591dd62e8669a8 100644 >--- a/Source/WTF/wtf/MainThread.cpp >+++ b/Source/WTF/wtf/MainThread.cpp >@@ -157,7 +157,7 @@ void setMainThreadCallbacksPaused(bool paused) > scheduleDispatchFunctionsOnMainThread(); > } > >-static ThreadSpecific<std::optional<GCThreadType>, CanBeGCThread::True>* isGCThread; >+static ThreadSpecific<WTF::Optional<GCThreadType>, CanBeGCThread::True>* isGCThread; > > void initializeGCThreads() > { >@@ -165,7 +165,7 @@ void initializeGCThreads() > std::call_once( > flag, > [] { >- isGCThread = new ThreadSpecific<std::optional<GCThreadType>, CanBeGCThread::True>(); >+ isGCThread = new ThreadSpecific<WTF::Optional<GCThreadType>, CanBeGCThread::True>(); > }); > } > >@@ -188,12 +188,12 @@ bool isMainThreadOrGCThread() > return isMainThread(); > } > >-std::optional<GCThreadType> mayBeGCThread() >+WTF::Optional<GCThreadType> mayBeGCThread() > { > if (!isGCThread) >- return std::nullopt; >+ return WTF::nullopt; > if (!isGCThread->isSet()) >- return std::nullopt; >+ return WTF::nullopt; > return **isGCThread; > } > >diff --git a/Source/WTF/wtf/MainThread.h b/Source/WTF/wtf/MainThread.h >index b0f1f02b7ea54931515a3a3ca43caa4eea69784d..72cda9e5835ac040af2c64922cb7e6949aceb5e0 100644 >--- a/Source/WTF/wtf/MainThread.h >+++ b/Source/WTF/wtf/MainThread.h >@@ -78,7 +78,7 @@ enum class GCThreadType { > void printInternal(PrintStream&, GCThreadType); > > WTF_EXPORT_PRIVATE void registerGCThread(GCThreadType); >-WTF_EXPORT_PRIVATE std::optional<GCThreadType> mayBeGCThread(); >+WTF_EXPORT_PRIVATE WTF::Optional<GCThreadType> mayBeGCThread(); > WTF_EXPORT_PRIVATE bool isMainThreadOrGCThread(); > > // NOTE: these functions are internal to the callOnMainThread implementation. >diff --git a/Source/WTF/wtf/Markable.h b/Source/WTF/wtf/Markable.h >index aa8ebe1109f55bb6dd65091b8ab8c1a51b00b412..0a435b4780ddaeaca80a0a449b1caa8a643b2f0e 100644 >--- a/Source/WTF/wtf/Markable.h >+++ b/Source/WTF/wtf/Markable.h >@@ -75,12 +75,12 @@ struct IntegralMarkableTraits { > } > }; > >-// The goal of Markable is offering std::optional without sacrificing storage efficiency. >+// The goal of Markable is offering WTF::Optional without sacrificing storage efficiency. > // Markable takes Traits, which should have isEmptyValue and emptyValue functions. By using >-// one value of T as an empty value, we can remove bool flag in std::optional. This strategy is >+// one value of T as an empty value, we can remove bool flag in WTF::Optional. This strategy is > // similar to WTF::HashTable, which uses two values of T as an empty value and a deleted value. > // This class is intended to be used as a member of a class to compact the size of the class. >-// Otherwise, you should use std::optional. >+// Otherwise, you should use WTF::Optional. > template<typename T, typename Traits> > class Markable { > public: >@@ -88,7 +88,7 @@ public: > : m_value(Traits::emptyValue()) > { } > >- constexpr Markable(std::nullopt_t) >+ constexpr Markable(WTF::nullopt_t) > : Markable() > { } > >@@ -105,11 +105,11 @@ public: > : m_value(std::forward<Args>(args)...) > { } > >- constexpr Markable(const std::optional<T>& value) >+ constexpr Markable(const WTF::Optional<T>& value) > : m_value(bool(value) ? *value : Traits::emptyValue()) > { } > >- constexpr Markable(std::optional<T>&& value) >+ constexpr Markable(WTF::Optional<T>&& value) > : m_value(bool(value) ? WTFMove(*value) : Traits::emptyValue()) > { } > >@@ -127,18 +127,18 @@ public: > constexpr const T& operator*() const& { return m_value; } > constexpr T& operator*() & { return m_value; } > >- operator std::optional<T>() && >+ operator WTF::Optional<T>() && > { > if (bool(*this)) > return WTFMove(m_value); >- return std::nullopt; >+ return WTF::nullopt; > } > >- operator std::optional<T>() const& >+ operator WTF::Optional<T>() const& > { > if (bool(*this)) > return m_value; >- return std::nullopt; >+ return WTF::nullopt; > } > > private: >diff --git a/Source/WTF/wtf/MemoryPressureHandler.h b/Source/WTF/wtf/MemoryPressureHandler.h >index 0f8b0f51ae4228cd759d52e0b4857661d59afeec..a0c5bb0e83e5c14675278b3b4adb3b6bfb43fb33 100644 >--- a/Source/WTF/wtf/MemoryPressureHandler.h >+++ b/Source/WTF/wtf/MemoryPressureHandler.h >@@ -135,11 +135,11 @@ public: > size_t resident { 0 }; > size_t physical { 0 }; > }; >- std::optional<MemoryUsage> platformMemoryUsage(); >+ WTF::Optional<MemoryUsage> platformMemoryUsage(); > void logMemoryUsageChange(); > > const char* m_logString; >- std::optional<MemoryUsage> m_initialMemory; >+ WTF::Optional<MemoryUsage> m_initialMemory; > > WTF_EXPORT_PRIVATE static bool s_loggingEnabled; > }; >diff --git a/Source/WTF/wtf/MonotonicTime.h b/Source/WTF/wtf/MonotonicTime.h >index 8fd0662de70cced4b93b7dfeea7fd67f09f90788..bf256465b3cd036596a8440cbcecd7522c55f5f1 100644 >--- a/Source/WTF/wtf/MonotonicTime.h >+++ b/Source/WTF/wtf/MonotonicTime.h >@@ -144,12 +144,12 @@ public: > } > > template<class Decoder> >- static std::optional<MonotonicTime> decode(Decoder& decoder) >+ static WTF::Optional<MonotonicTime> decode(Decoder& decoder) > { >- std::optional<double> time; >+ WTF::Optional<double> time; > decoder >> time; > if (!time) >- return std::nullopt; >+ return WTF::nullopt; > return MonotonicTime::fromRawSeconds(*time); > } > >diff --git a/Source/WTF/wtf/ObjectIdentifier.h b/Source/WTF/wtf/ObjectIdentifier.h >index 0a0687c244b185e5d87c85c00f0f674583a6d2ce..1c17bb72109e60d5e1dacc82c281f72cb480b15a 100644 >--- a/Source/WTF/wtf/ObjectIdentifier.h >+++ b/Source/WTF/wtf/ObjectIdentifier.h >@@ -45,12 +45,12 @@ public: > ASSERT(isValidIdentifier(m_identifier)); > encoder << m_identifier; > } >- template<typename Decoder> static std::optional<ObjectIdentifier> decode(Decoder& decoder) >+ template<typename Decoder> static WTF::Optional<ObjectIdentifier> decode(Decoder& decoder) > { >- std::optional<uint64_t> identifier; >+ WTF::Optional<uint64_t> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > ASSERT(isValidIdentifier(*identifier)); > return ObjectIdentifier { *identifier }; > } >diff --git a/Source/WTF/wtf/Optional.h b/Source/WTF/wtf/Optional.h >index 1cb3aa8e710021967aeb1cf4f68bc4fda547d832..4a7824b750326e5fdc4f0f00a1fa92d1bf835fbe 100644 >--- a/Source/WTF/wtf/Optional.h >+++ b/Source/WTF/wtf/Optional.h >@@ -130,7 +130,7 @@ > #define __NOEXCEPT_(...) > #endif > >-namespace std { >+namespace WTF { > namespace detail_ { > > // NOTE: All our target compilers support is_trivially_destructible. >@@ -206,11 +206,11 @@ struct is_nothrow_move_assignable > > } // namespace detail_ > >-// 20.5.4, optional for object types >-template <class T> class optional; >+// 20.5.4, Optional for object types >+template <class T> class Optional; > >-// 20.5.5, optional for lvalue reference types >-template <class T> class optional<T&>; >+// 20.5.5, Optional for lvalue reference types >+template <class T> class Optional<T&>; > > namespace detail_ { > >@@ -308,64 +308,64 @@ union constexpr_storage_t > > > template <class T> >-struct optional_base >+struct Optional_base > { > bool init_; > storage_t<T> storage_; > >- constexpr optional_base() __NOEXCEPT : init_(false), storage_(trivial_init) {}; >+ constexpr Optional_base() __NOEXCEPT : init_(false), storage_(trivial_init) {}; > >- explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {} >+ explicit constexpr Optional_base(const T& v) : init_(true), storage_(v) {} > >- explicit constexpr optional_base(T&& v) : init_(true), storage_(detail_::constexpr_move(v)) {} >+ explicit constexpr Optional_base(T&& v) : init_(true), storage_(detail_::constexpr_move(v)) {} > >- template <class... Args> explicit optional_base(in_place_t, Args&&... args) >+ template <class... Args> explicit Optional_base(std::in_place_t, Args&&... args) > : init_(true), storage_(detail_::constexpr_forward<Args>(args)...) {} > > template <class U, class... Args, TR2_OPTIONAL_REQUIRES(std::is_constructible<T, std::initializer_list<U>>)> >- explicit optional_base(in_place_t, std::initializer_list<U> il, Args&&... args) >+ explicit Optional_base(std::in_place_t, std::initializer_list<U> il, Args&&... args) > : init_(true), storage_(il, std::forward<Args>(args)...) {} > >- ~optional_base() { if (init_) storage_.value_.T::~T(); } >+ ~Optional_base() { if (init_) storage_.value_.T::~T(); } > }; > > > template <class T> >-struct constexpr_optional_base >+struct constexpr_Optional_base > { > bool init_; > constexpr_storage_t<T> storage_; > >- constexpr constexpr_optional_base() __NOEXCEPT : init_(false), storage_(trivial_init) {}; >+ constexpr constexpr_Optional_base() __NOEXCEPT : init_(false), storage_(trivial_init) {}; > >- explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_(v) {} >+ explicit constexpr constexpr_Optional_base(const T& v) : init_(true), storage_(v) {} > >- explicit constexpr constexpr_optional_base(T&& v) : init_(true), storage_(detail_::constexpr_move(v)) {} >+ explicit constexpr constexpr_Optional_base(T&& v) : init_(true), storage_(detail_::constexpr_move(v)) {} > >- template <class... Args> explicit constexpr constexpr_optional_base(in_place_t, Args&&... args) >+ template <class... Args> explicit constexpr constexpr_Optional_base(std::in_place_t, Args&&... args) > : init_(true), storage_(detail_::constexpr_forward<Args>(args)...) {} > > template <class U, class... Args, TR2_OPTIONAL_REQUIRES(std::is_constructible<T, std::initializer_list<U>>)> >- OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_optional_base(in_place_t, std::initializer_list<U> il, Args&&... args) >+ OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_Optional_base(std::in_place_t, std::initializer_list<U> il, Args&&... args) > : init_(true), storage_(il, std::forward<Args>(args)...) {} > >- ~constexpr_optional_base() = default; >+ ~constexpr_Optional_base() = default; > }; > > template <class T> > using OptionalBase = typename std::conditional< > std::is_trivially_destructible<T>::value, // if possible >- constexpr_optional_base<typename std::remove_const<T>::type>, // use base with trivial destructor >- optional_base<typename std::remove_const<T>::type> >+ constexpr_Optional_base<typename std::remove_const<T>::type>, // use base with trivial destructor >+ Optional_base<typename std::remove_const<T>::type> > >::type; > > > > template <class T> >-class optional : private OptionalBase<T> >+class Optional : private OptionalBase<T> > { > static_assert( !std::is_same<typename std::decay<T>::type, nullopt_t>::value, "bad T" ); >- static_assert( !std::is_same<typename std::decay<T>::type, in_place_t>::value, "bad T" ); >+ static_assert( !std::is_same<typename std::decay<T>::type, std::in_place_t>::value, "bad T" ); > > > constexpr bool initialized() const __NOEXCEPT { return OptionalBase<T>::init_; } >@@ -406,10 +406,10 @@ public: > typedef T value_type; > > // 20.5.5.1, constructors >- constexpr optional() __NOEXCEPT : OptionalBase<T>() {}; >- constexpr optional(nullopt_t) __NOEXCEPT : OptionalBase<T>() {}; >+ constexpr Optional() __NOEXCEPT : OptionalBase<T>() {}; >+ constexpr Optional(nullopt_t) __NOEXCEPT : OptionalBase<T>() {}; > >- optional(const optional& rhs) >+ Optional(const Optional& rhs) > : OptionalBase<T>() > { > if (rhs.initialized()) { >@@ -418,38 +418,39 @@ public: > } > } > >- optional(optional&& rhs) __NOEXCEPT_(detail_::is_nothrow_move_constructible<T>::value) >+ Optional(Optional&& rhs) __NOEXCEPT_(detail_::is_nothrow_move_constructible<T>::value) > : OptionalBase<T>() > { > if (rhs.initialized()) { > ::new (static_cast<void*>(dataptr())) T(std::move(*rhs)); > OptionalBase<T>::init_ = true; >+ rhs.clear(); > } > } > >- constexpr optional(const T& v) : OptionalBase<T>(v) {} >+ constexpr Optional(const T& v) : OptionalBase<T>(v) {} > >- constexpr optional(T&& v) : OptionalBase<T>(detail_::constexpr_move(v)) {} >+ constexpr Optional(T&& v) : OptionalBase<T>(detail_::constexpr_move(v)) {} > > template <class... Args> >- explicit constexpr optional(in_place_t, Args&&... args) >- : OptionalBase<T>(in_place_t{}, detail_::constexpr_forward<Args>(args)...) {} >+ explicit constexpr Optional(std::in_place_t, Args&&... args) >+ : OptionalBase<T>(std::in_place_t{}, detail_::constexpr_forward<Args>(args)...) {} > > template <class U, class... Args, TR2_OPTIONAL_REQUIRES(std::is_constructible<T, std::initializer_list<U>>)> >- OPTIONAL_CONSTEXPR_INIT_LIST explicit optional(in_place_t, std::initializer_list<U> il, Args&&... args) >- : OptionalBase<T>(in_place_t{}, il, detail_::constexpr_forward<Args>(args)...) {} >+ OPTIONAL_CONSTEXPR_INIT_LIST explicit Optional(std::in_place_t, std::initializer_list<U> il, Args&&... args) >+ : OptionalBase<T>(std::in_place_t{}, il, detail_::constexpr_forward<Args>(args)...) {} > > // 20.5.4.2, Destructor >- ~optional() = default; >+ ~Optional() = default; > > // 20.5.4.3, assignment >- optional& operator=(nullopt_t) __NOEXCEPT >+ Optional& operator=(nullopt_t) __NOEXCEPT > { > clear(); > return *this; > } > >- optional& operator=(const optional& rhs) >+ Optional& operator=(const Optional& rhs) > { > if (initialized() == true && rhs.initialized() == false) clear(); > else if (initialized() == false && rhs.initialized() == true) initialize(*rhs); >@@ -457,12 +458,12 @@ public: > return *this; > } > >- optional& operator=(optional&& rhs) >+ Optional& operator=(Optional&& rhs) > __NOEXCEPT_(detail_::is_nothrow_move_assignable<T>::value && detail_::is_nothrow_move_constructible<T>::value) > { > if (initialized() == true && rhs.initialized() == false) clear(); >- else if (initialized() == false && rhs.initialized() == true) initialize(std::move(*rhs)); >- else if (initialized() == true && rhs.initialized() == true) contained_val() = std::move(*rhs); >+ else if (initialized() == false && rhs.initialized() == true) { initialize(std::move(*rhs)); rhs.clear(); } >+ else if (initialized() == true && rhs.initialized() == true) { contained_val() = std::move(*rhs); rhs.clear(); } > return *this; > } > >@@ -471,7 +472,7 @@ public: > -> typename std::enable_if > < > std::is_same<typename std::decay<U>::type, T>::value, >- optional& >+ Optional& > >::type > { > if (initialized()) { contained_val() = std::forward<U>(v); } >@@ -495,7 +496,7 @@ public: > } > > // 20.5.4.4, Swap >- void swap(optional<T>& rhs) __NOEXCEPT_(detail_::is_nothrow_move_constructible<T>::value && __NOEXCEPT_(swap(std::declval<T&>(), std::declval<T&>()))) >+ void swap(Optional<T>& rhs) __NOEXCEPT_(detail_::is_nothrow_move_constructible<T>::value && __NOEXCEPT_(swap(std::declval<T&>(), std::declval<T&>()))) > { > if (initialized() == true && rhs.initialized() == false) { rhs.initialize(std::move(**this)); clear(); } > else if (initialized() == false && rhs.initialized() == true) { initialize(std::move(*rhs)); rhs.clear(); } >@@ -558,7 +559,7 @@ public: > template <class V> > OPTIONAL_MUTABLE_CONSTEXPR T value_or(V&& v) && > { >- return *this ? detail_::constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert<T>(detail_::constexpr_forward<V>(v)); >+ return *this ? detail_::constexpr_move(const_cast<Optional<T>&>(*this).contained_val()) : detail_::convert<T>(detail_::constexpr_forward<V>(v)); > } > > # else >@@ -577,43 +578,43 @@ public: > > > template <class T> >-class optional<T&> >+class Optional<T&> > { > static_assert( !std::is_same<T, nullopt_t>::value, "bad T" ); >- static_assert( !std::is_same<T, in_place_t>::value, "bad T" ); >+ static_assert( !std::is_same<T, std::in_place_t>::value, "bad T" ); > T* ref; > > public: > > // 20.5.5.1, construction/destruction >- constexpr optional() __NOEXCEPT : ref(nullptr) {} >+ constexpr Optional() __NOEXCEPT : ref(nullptr) {} > >- constexpr optional(nullopt_t) __NOEXCEPT : ref(nullptr) {} >+ constexpr Optional(nullopt_t) __NOEXCEPT : ref(nullptr) {} > >- constexpr optional(T& v) __NOEXCEPT : ref(detail_::static_addressof(v)) {} >+ constexpr Optional(T& v) __NOEXCEPT : ref(detail_::static_addressof(v)) {} > >- optional(T&&) = delete; >+ Optional(T&&) = delete; > >- constexpr optional(const optional& rhs) __NOEXCEPT : ref(rhs.ref) {} >+ constexpr Optional(const Optional& rhs) __NOEXCEPT : ref(rhs.ref) {} > >- explicit constexpr optional(in_place_t, T& v) __NOEXCEPT : ref(detail_::static_addressof(v)) {} >+ explicit constexpr Optional(std::in_place_t, T& v) __NOEXCEPT : ref(detail_::static_addressof(v)) {} > >- explicit optional(in_place_t, T&&) = delete; >+ explicit Optional(std::in_place_t, T&&) = delete; > >- ~optional() = default; >+ ~Optional() = default; > > // 20.5.5.2, mutation >- optional& operator=(nullopt_t) __NOEXCEPT { >+ Optional& operator=(nullopt_t) __NOEXCEPT { > ref = nullptr; > return *this; > } > >- // optional& operator=(const optional& rhs) __NOEXCEPT { >+ // Optional& operator=(const Optional& rhs) __NOEXCEPT { > // ref = rhs.ref; > // return *this; > // } > >- // optional& operator=(optional&& rhs) __NOEXCEPT { >+ // Optional& operator=(Optional&& rhs) __NOEXCEPT { > // ref = rhs.ref; > // return *this; > // } >@@ -622,8 +623,8 @@ public: > auto operator=(U&& rhs) __NOEXCEPT > -> typename std::enable_if > < >- std::is_same<typename std::decay<U>::type, optional<T&>>::value, >- optional& >+ std::is_same<typename std::decay<U>::type, Optional<T&>>::value, >+ Optional& > >::type > { > ref = rhs.ref; >@@ -634,8 +635,8 @@ public: > auto operator=(U&& rhs) __NOEXCEPT > -> typename std::enable_if > < >- !std::is_same<typename std::decay<U>::type, optional<T&>>::value, >- optional& >+ !std::is_same<typename std::decay<U>::type, Optional<T&>>::value, >+ Optional& > >::type > = delete; > >@@ -646,7 +647,7 @@ public: > void emplace(T&&) = delete; > > >- void swap(optional<T&>& rhs) __NOEXCEPT >+ void swap(Optional<T&>& rhs) __NOEXCEPT > { > std::swap(ref, rhs.ref); > } >@@ -687,101 +688,101 @@ public: > > > template <class T> >-class optional<T&&> >+class Optional<T&&> > { >- static_assert( sizeof(T) == 0, "optional rvalue references disallowed" ); >+ static_assert( sizeof(T) == 0, "Optional rvalue references disallowed" ); > }; > > > // 20.5.8, Relational operators >-template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y) >+template <class T> constexpr bool operator==(const Optional<T>& x, const Optional<T>& y) > { > return bool(x) != bool(y) ? false : bool(x) == false ? true : *x == *y; > } > >-template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y) >+template <class T> constexpr bool operator!=(const Optional<T>& x, const Optional<T>& y) > { > return !(x == y); > } > >-template <class T> constexpr bool operator<(const optional<T>& x, const optional<T>& y) >+template <class T> constexpr bool operator<(const Optional<T>& x, const Optional<T>& y) > { > return (!y) ? false : (!x) ? true : *x < *y; > } > >-template <class T> constexpr bool operator>(const optional<T>& x, const optional<T>& y) >+template <class T> constexpr bool operator>(const Optional<T>& x, const Optional<T>& y) > { > return (y < x); > } > >-template <class T> constexpr bool operator<=(const optional<T>& x, const optional<T>& y) >+template <class T> constexpr bool operator<=(const Optional<T>& x, const Optional<T>& y) > { > return !(y < x); > } > >-template <class T> constexpr bool operator>=(const optional<T>& x, const optional<T>& y) >+template <class T> constexpr bool operator>=(const Optional<T>& x, const Optional<T>& y) > { > return !(x < y); > } > > > // 20.5.9, Comparison with nullopt >-template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) __NOEXCEPT >+template <class T> constexpr bool operator==(const Optional<T>& x, nullopt_t) __NOEXCEPT > { > return (!x); > } > >-template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) __NOEXCEPT >+template <class T> constexpr bool operator==(nullopt_t, const Optional<T>& x) __NOEXCEPT > { > return (!x); > } > >-template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) __NOEXCEPT >+template <class T> constexpr bool operator!=(const Optional<T>& x, nullopt_t) __NOEXCEPT > { > return bool(x); > } > >-template <class T> constexpr bool operator!=(nullopt_t, const optional<T>& x) __NOEXCEPT >+template <class T> constexpr bool operator!=(nullopt_t, const Optional<T>& x) __NOEXCEPT > { > return bool(x); > } > >-template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) __NOEXCEPT >+template <class T> constexpr bool operator<(const Optional<T>&, nullopt_t) __NOEXCEPT > { > return false; > } > >-template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) __NOEXCEPT >+template <class T> constexpr bool operator<(nullopt_t, const Optional<T>& x) __NOEXCEPT > { > return bool(x); > } > >-template <class T> constexpr bool operator<=(const optional<T>& x, nullopt_t) __NOEXCEPT >+template <class T> constexpr bool operator<=(const Optional<T>& x, nullopt_t) __NOEXCEPT > { > return (!x); > } > >-template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) __NOEXCEPT >+template <class T> constexpr bool operator<=(nullopt_t, const Optional<T>&) __NOEXCEPT > { > return true; > } > >-template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) __NOEXCEPT >+template <class T> constexpr bool operator>(const Optional<T>& x, nullopt_t) __NOEXCEPT > { > return bool(x); > } > >-template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) __NOEXCEPT >+template <class T> constexpr bool operator>(nullopt_t, const Optional<T>&) __NOEXCEPT > { > return false; > } > >-template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) __NOEXCEPT >+template <class T> constexpr bool operator>=(const Optional<T>&, nullopt_t) __NOEXCEPT > { > return true; > } > >-template <class T> constexpr bool operator>=(nullopt_t, const optional<T>& x) __NOEXCEPT >+template <class T> constexpr bool operator>=(nullopt_t, const Optional<T>& x) __NOEXCEPT > { > return (!x); > } >@@ -789,185 +790,185 @@ template <class T> constexpr bool operator>=(nullopt_t, const optional<T>& x) __ > > > // 20.5.10, Comparison with T >-template <class T> constexpr bool operator==(const optional<T>& x, const T& v) >+template <class T> constexpr bool operator==(const Optional<T>& x, const T& v) > { > return bool(x) ? *x == v : false; > } > >-template <class T> constexpr bool operator==(const T& v, const optional<T>& x) >+template <class T> constexpr bool operator==(const T& v, const Optional<T>& x) > { > return bool(x) ? v == *x : false; > } > >-template <class T> constexpr bool operator!=(const optional<T>& x, const T& v) >+template <class T> constexpr bool operator!=(const Optional<T>& x, const T& v) > { > return bool(x) ? *x != v : true; > } > >-template <class T> constexpr bool operator!=(const T& v, const optional<T>& x) >+template <class T> constexpr bool operator!=(const T& v, const Optional<T>& x) > { > return bool(x) ? v != *x : true; > } > >-template <class T> constexpr bool operator<(const optional<T>& x, const T& v) >+template <class T> constexpr bool operator<(const Optional<T>& x, const T& v) > { > return bool(x) ? *x < v : true; > } > >-template <class T> constexpr bool operator>(const T& v, const optional<T>& x) >+template <class T> constexpr bool operator>(const T& v, const Optional<T>& x) > { > return bool(x) ? v > *x : true; > } > >-template <class T> constexpr bool operator>(const optional<T>& x, const T& v) >+template <class T> constexpr bool operator>(const Optional<T>& x, const T& v) > { > return bool(x) ? *x > v : false; > } > >-template <class T> constexpr bool operator<(const T& v, const optional<T>& x) >+template <class T> constexpr bool operator<(const T& v, const Optional<T>& x) > { > return bool(x) ? v < *x : false; > } > >-template <class T> constexpr bool operator>=(const optional<T>& x, const T& v) >+template <class T> constexpr bool operator>=(const Optional<T>& x, const T& v) > { > return bool(x) ? *x >= v : false; > } > >-template <class T> constexpr bool operator<=(const T& v, const optional<T>& x) >+template <class T> constexpr bool operator<=(const T& v, const Optional<T>& x) > { > return bool(x) ? v <= *x : false; > } > >-template <class T> constexpr bool operator<=(const optional<T>& x, const T& v) >+template <class T> constexpr bool operator<=(const Optional<T>& x, const T& v) > { > return bool(x) ? *x <= v : true; > } > >-template <class T> constexpr bool operator>=(const T& v, const optional<T>& x) >+template <class T> constexpr bool operator>=(const T& v, const Optional<T>& x) > { > return bool(x) ? v >= *x : true; > } > > >-// Comparison of optional<T&> with T >-template <class T> constexpr bool operator==(const optional<T&>& x, const T& v) >+// Comparison of Optional<T&> with T >+template <class T> constexpr bool operator==(const Optional<T&>& x, const T& v) > { > return bool(x) ? *x == v : false; > } > >-template <class T> constexpr bool operator==(const T& v, const optional<T&>& x) >+template <class T> constexpr bool operator==(const T& v, const Optional<T&>& x) > { > return bool(x) ? v == *x : false; > } > >-template <class T> constexpr bool operator!=(const optional<T&>& x, const T& v) >+template <class T> constexpr bool operator!=(const Optional<T&>& x, const T& v) > { > return bool(x) ? *x != v : true; > } > >-template <class T> constexpr bool operator!=(const T& v, const optional<T&>& x) >+template <class T> constexpr bool operator!=(const T& v, const Optional<T&>& x) > { > return bool(x) ? v != *x : true; > } > >-template <class T> constexpr bool operator<(const optional<T&>& x, const T& v) >+template <class T> constexpr bool operator<(const Optional<T&>& x, const T& v) > { > return bool(x) ? *x < v : true; > } > >-template <class T> constexpr bool operator>(const T& v, const optional<T&>& x) >+template <class T> constexpr bool operator>(const T& v, const Optional<T&>& x) > { > return bool(x) ? v > *x : true; > } > >-template <class T> constexpr bool operator>(const optional<T&>& x, const T& v) >+template <class T> constexpr bool operator>(const Optional<T&>& x, const T& v) > { > return bool(x) ? *x > v : false; > } > >-template <class T> constexpr bool operator<(const T& v, const optional<T&>& x) >+template <class T> constexpr bool operator<(const T& v, const Optional<T&>& x) > { > return bool(x) ? v < *x : false; > } > >-template <class T> constexpr bool operator>=(const optional<T&>& x, const T& v) >+template <class T> constexpr bool operator>=(const Optional<T&>& x, const T& v) > { > return bool(x) ? *x >= v : false; > } > >-template <class T> constexpr bool operator<=(const T& v, const optional<T&>& x) >+template <class T> constexpr bool operator<=(const T& v, const Optional<T&>& x) > { > return bool(x) ? v <= *x : false; > } > >-template <class T> constexpr bool operator<=(const optional<T&>& x, const T& v) >+template <class T> constexpr bool operator<=(const Optional<T&>& x, const T& v) > { > return bool(x) ? *x <= v : true; > } > >-template <class T> constexpr bool operator>=(const T& v, const optional<T&>& x) >+template <class T> constexpr bool operator>=(const T& v, const Optional<T&>& x) > { > return bool(x) ? v >= *x : true; > } > >-// Comparison of optional<T const&> with T >-template <class T> constexpr bool operator==(const optional<const T&>& x, const T& v) >+// Comparison of Optional<T const&> with T >+template <class T> constexpr bool operator==(const Optional<const T&>& x, const T& v) > { > return bool(x) ? *x == v : false; > } > >-template <class T> constexpr bool operator==(const T& v, const optional<const T&>& x) >+template <class T> constexpr bool operator==(const T& v, const Optional<const T&>& x) > { > return bool(x) ? v == *x : false; > } > >-template <class T> constexpr bool operator!=(const optional<const T&>& x, const T& v) >+template <class T> constexpr bool operator!=(const Optional<const T&>& x, const T& v) > { > return bool(x) ? *x != v : true; > } > >-template <class T> constexpr bool operator!=(const T& v, const optional<const T&>& x) >+template <class T> constexpr bool operator!=(const T& v, const Optional<const T&>& x) > { > return bool(x) ? v != *x : true; > } > >-template <class T> constexpr bool operator<(const optional<const T&>& x, const T& v) >+template <class T> constexpr bool operator<(const Optional<const T&>& x, const T& v) > { > return bool(x) ? *x < v : true; > } > >-template <class T> constexpr bool operator>(const T& v, const optional<const T&>& x) >+template <class T> constexpr bool operator>(const T& v, const Optional<const T&>& x) > { > return bool(x) ? v > *x : true; > } > >-template <class T> constexpr bool operator>(const optional<const T&>& x, const T& v) >+template <class T> constexpr bool operator>(const Optional<const T&>& x, const T& v) > { > return bool(x) ? *x > v : false; > } > >-template <class T> constexpr bool operator<(const T& v, const optional<const T&>& x) >+template <class T> constexpr bool operator<(const T& v, const Optional<const T&>& x) > { > return bool(x) ? v < *x : false; > } > >-template <class T> constexpr bool operator>=(const optional<const T&>& x, const T& v) >+template <class T> constexpr bool operator>=(const Optional<const T&>& x, const T& v) > { > return bool(x) ? *x >= v : false; > } > >-template <class T> constexpr bool operator<=(const T& v, const optional<const T&>& x) >+template <class T> constexpr bool operator<=(const T& v, const Optional<const T&>& x) > { > return bool(x) ? v <= *x : false; > } > >-template <class T> constexpr bool operator<=(const optional<const T&>& x, const T& v) >+template <class T> constexpr bool operator<=(const Optional<const T&>& x, const T& v) > { > return bool(x) ? *x <= v : true; > } > >-template <class T> constexpr bool operator>=(const T& v, const optional<const T&>& x) >+template <class T> constexpr bool operator>=(const T& v, const Optional<const T&>& x) > { > return bool(x) ? v >= *x : true; > } >@@ -975,33 +976,33 @@ template <class T> constexpr bool operator>=(const T& v, const optional<const T& > > // 20.5.12, Specialized algorithms > template <class T> >-void swap(optional<T>& x, optional<T>& y) __NOEXCEPT_(__NOEXCEPT_(x.swap(y))) >+void swap(Optional<T>& x, Optional<T>& y) __NOEXCEPT_(__NOEXCEPT_(x.swap(y))) > { > x.swap(y); > } > > > template <class T> >-constexpr optional<typename std::decay<T>::type> make_optional(T&& v) >+constexpr Optional<typename std::decay<T>::type> makeOptional(T&& v) > { >- return optional<typename std::decay<T>::type>(detail_::constexpr_forward<T>(v)); >+ return Optional<typename std::decay<T>::type>(detail_::constexpr_forward<T>(v)); > } > > template <class X> >-constexpr optional<X&> make_optional(std::reference_wrapper<X> v) >+constexpr Optional<X&> makeOptional(std::reference_wrapper<X> v) > { >- return optional<X&>(v.get()); >+ return Optional<X&>(v.get()); > } > >-} // namespace std >+} // namespace WTF > > namespace std > { > template <typename T> >- struct hash<std::optional<T>> >+ struct hash<WTF::Optional<T>> > { > typedef typename hash<T>::result_type result_type; >- typedef std::optional<T> argument_type; >+ typedef WTF::Optional<T> argument_type; > > constexpr result_type operator()(argument_type const& arg) const { > return arg ? std::hash<T>{}(*arg) : result_type{}; >@@ -1009,10 +1010,10 @@ namespace std > }; > > template <typename T> >- struct hash<std::optional<T&>> >+ struct hash<WTF::Optional<T&>> > { > typedef typename hash<T>::result_type result_type; >- typedef std::optional<T&> argument_type; >+ typedef WTF::Optional<T&> argument_type; > > constexpr result_type operator()(argument_type const& arg) const { > return arg ? std::hash<T>{}(*arg) : result_type{}; >@@ -1027,10 +1028,10 @@ namespace WTF { > // -- WebKit Additions -- > template <class OptionalType, class Callback> > ALWAYS_INLINE >-auto valueOrCompute(OptionalType optional, Callback callback) -> typename OptionalType::value_type >+auto valueOrCompute(OptionalType Optional, Callback callback) -> typename OptionalType::value_type > { >- if (optional) >- return *optional; >+ if (Optional) >+ return *Optional; > return callback(); > } > >diff --git a/Source/WTF/wtf/PrintStream.h b/Source/WTF/wtf/PrintStream.h >index 7a32efeaaf4cb27ade4ab6a4a3686d9c163f59b5..4adc26a7c9048b9097aed0880a0e19c24080c929 100644 >--- a/Source/WTF/wtf/PrintStream.h >+++ b/Source/WTF/wtf/PrintStream.h >@@ -326,7 +326,7 @@ FormatImpl<Types...> format(Types... values) > } > > template<typename T> >-void printInternal(PrintStream& out, const std::optional<T>& value) >+void printInternal(PrintStream& out, const WTF::Optional<T>& value) > { > if (value) > out.print(*value); >diff --git a/Source/WTF/wtf/Seconds.h b/Source/WTF/wtf/Seconds.h >index a98421687832928ca4e86d028db119ceebce761b..d033162ed7d95ab13d0f32ddd6e74a3439f523a3 100644 >--- a/Source/WTF/wtf/Seconds.h >+++ b/Source/WTF/wtf/Seconds.h >@@ -226,12 +226,12 @@ public: > } > > template<class Decoder> >- static std::optional<Seconds> decode(Decoder& decoder) >+ static WTF::Optional<Seconds> decode(Decoder& decoder) > { >- std::optional<double> seconds; >+ WTF::Optional<double> seconds; > decoder >> seconds; > if (!seconds) >- return std::nullopt; >+ return WTF::nullopt; > return Seconds(*seconds); > } > >diff --git a/Source/WTF/wtf/StackTrace.cpp b/Source/WTF/wtf/StackTrace.cpp >index c41dec00601dd0e34993d3f36cf738eb50bc8981..11d451795ecee991b113bc85c0134479708599f7 100644 >--- a/Source/WTF/wtf/StackTrace.cpp >+++ b/Source/WTF/wtf/StackTrace.cpp >@@ -86,7 +86,7 @@ std::unique_ptr<StackTrace> StackTrace::captureStackTrace(int maxFrames, int fra > return trace; > } > >-auto StackTrace::demangle(void* pc) -> std::optional<DemangleEntry> >+auto StackTrace::demangle(void* pc) -> WTF::Optional<DemangleEntry> > { > #if HAVE(DLADDR) > const char* mangledName = nullptr; >@@ -104,7 +104,7 @@ auto StackTrace::demangle(void* pc) -> std::optional<DemangleEntry> > #else > UNUSED_PARAM(pc); > #endif >- return std::nullopt; >+ return WTF::nullopt; > } > > void StackTrace::dump(PrintStream& out, const char* indentString) const >diff --git a/Source/WTF/wtf/StackTrace.h b/Source/WTF/wtf/StackTrace.h >index 432a7791b303c99b50f41beb8f1f769cfb1c0129..36e8ef36f25a353fa30e581775f88124410835b4 100644 >--- a/Source/WTF/wtf/StackTrace.h >+++ b/Source/WTF/wtf/StackTrace.h >@@ -69,7 +69,7 @@ public: > std::unique_ptr<const char[], SystemFree<const char[]>> m_demangledName; > }; > >- WTF_EXPORT_PRIVATE static std::optional<DemangleEntry> demangle(void*); >+ WTF_EXPORT_PRIVATE static WTF::Optional<DemangleEntry> demangle(void*); > > WTF_EXPORT_PRIVATE void dump(PrintStream&, const char* indentString = nullptr) const; > >diff --git a/Source/WTF/wtf/URL.cpp b/Source/WTF/wtf/URL.cpp >index 5ce17cd9de921d6c9a6216caf7e88d2b46c7f35b..57b5cceb20632359e9354731c442f373fadd2429 100644 >--- a/Source/WTF/wtf/URL.cpp >+++ b/Source/WTF/wtf/URL.cpp >@@ -136,10 +136,10 @@ StringView URL::host() const > return StringView(m_string).substring(start, m_hostEnd - start); > } > >-std::optional<uint16_t> URL::port() const >+WTF::Optional<uint16_t> URL::port() const > { > if (!m_portLength) >- return std::nullopt; >+ return WTF::nullopt; > > bool ok = false; > unsigned number; >@@ -148,7 +148,7 @@ std::optional<uint16_t> URL::port() const > else > number = charactersToUIntStrict(m_string.characters16() + m_hostEnd + 1, m_portLength - 1, &ok); > if (!ok || number > std::numeric_limits<uint16_t>::max()) >- return std::nullopt; >+ return WTF::nullopt; > return number; > } > >@@ -301,7 +301,7 @@ void clearDefaultPortForProtocolMapForTesting() > map->clear(); > } > >-std::optional<uint16_t> defaultPortForProtocol(StringView protocol) >+WTF::Optional<uint16_t> defaultPortForProtocol(StringView protocol) > { > if (auto* overrideMap = defaultPortForProtocolMapForTesting()) { > auto locker = holdLock(defaultPortForProtocolMapForTestingLock); >@@ -871,7 +871,7 @@ bool URL::protocolIsAbout() const > > bool portAllowed(const URL& url) > { >- std::optional<uint16_t> port = url.port(); >+ WTF::Optional<uint16_t> port = url.port(); > > // Since most URLs don't have a port, return early for the "no port" case. > if (!port) >diff --git a/Source/WTF/wtf/URL.h b/Source/WTF/wtf/URL.h >index 268867ec1728f536fba6ae1eebb5a4e927eccb3c..88dae756952869590c981e97535c0efa367f12b7 100644 >--- a/Source/WTF/wtf/URL.h >+++ b/Source/WTF/wtf/URL.h >@@ -96,7 +96,7 @@ public: > > StringView protocol() const; > StringView host() const; >- std::optional<uint16_t> port() const; >+ WTF::Optional<uint16_t> port() const; > String hostAndPort() const; > String protocolHostAndPort() const; > String user() const; >@@ -189,7 +189,7 @@ public: > > template <class Encoder> void encode(Encoder&) const; > template <class Decoder> static bool decode(Decoder&, URL&); >- template <class Decoder> static std::optional<URL> decode(Decoder&); >+ template <class Decoder> static WTF::Optional<URL> decode(Decoder&); > > private: > friend class URLParser; >@@ -242,11 +242,11 @@ bool URL::decode(Decoder& decoder, URL& url) > } > > template <class Decoder> >-std::optional<URL> URL::decode(Decoder& decoder) >+WTF::Optional<URL> URL::decode(Decoder& decoder) > { > String string; > if (!decoder.decode(string)) >- return std::nullopt; >+ return WTF::nullopt; > return URL(URL(), string); > } > >@@ -267,7 +267,7 @@ WTF_EXPORT_PRIVATE bool protocolIsJavaScript(const String& url); > WTF_EXPORT_PRIVATE bool protocolIsJavaScript(StringView url); > WTF_EXPORT_PRIVATE bool protocolIsInHTTPFamily(const String& url); > >-WTF_EXPORT_PRIVATE std::optional<uint16_t> defaultPortForProtocol(StringView protocol); >+WTF_EXPORT_PRIVATE WTF::Optional<uint16_t> defaultPortForProtocol(StringView protocol); > WTF_EXPORT_PRIVATE bool isDefaultPortForProtocol(uint16_t port, StringView protocol); > WTF_EXPORT_PRIVATE bool portAllowed(const URL&); // Blacklist ports that should never be used for Web resources. > >diff --git a/Source/WTF/wtf/URLParser.cpp b/Source/WTF/wtf/URLParser.cpp >index 509d4b81f98233ad4a99695b3e9da34cb1ce6c75..b76d075278a818942a35bbb9fb3542ad34c742db 100644 >--- a/Source/WTF/wtf/URLParser.cpp >+++ b/Source/WTF/wtf/URLParser.cpp >@@ -656,7 +656,7 @@ void URLParser::encodeNonUTF8Query(const Vector<UChar>& source, const URLTextEnc > } > } > >-std::optional<uint16_t> URLParser::defaultPortForProtocol(StringView scheme) >+WTF::Optional<uint16_t> URLParser::defaultPortForProtocol(StringView scheme) > { > static const uint16_t ftpPort = 21; > static const uint16_t gopherPort = 70; >@@ -667,19 +667,19 @@ std::optional<uint16_t> URLParser::defaultPortForProtocol(StringView scheme) > > auto length = scheme.length(); > if (!length) >- return std::nullopt; >+ return WTF::nullopt; > switch (scheme[0]) { > case 'w': > switch (length) { > case 2: > if (scheme[1] == 's') > return wsPort; >- return std::nullopt; >+ return WTF::nullopt; > case 3: > if (scheme[1] == 's' > && scheme[2] == 's') > return wssPort; >- return std::nullopt; >+ return WTF::nullopt; > default: > return false; > } >@@ -690,16 +690,16 @@ std::optional<uint16_t> URLParser::defaultPortForProtocol(StringView scheme) > && scheme[2] == 't' > && scheme[3] == 'p') > return httpPort; >- return std::nullopt; >+ return WTF::nullopt; > case 5: > if (scheme[1] == 't' > && scheme[2] == 't' > && scheme[3] == 'p' > && scheme[4] == 's') > return httpsPort; >- return std::nullopt; >+ return WTF::nullopt; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > case 'g': > if (length == 6 >@@ -709,15 +709,15 @@ std::optional<uint16_t> URLParser::defaultPortForProtocol(StringView scheme) > && scheme[4] == 'e' > && scheme[5] == 'r') > return gopherPort; >- return std::nullopt; >+ return WTF::nullopt; > case 'f': > if (length == 3 > && scheme[1] == 't' > && scheme[2] == 'p') > return ftpPort; >- return std::nullopt; >+ return WTF::nullopt; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -800,18 +800,18 @@ ALWAYS_INLINE static Scheme scheme(StringView scheme) > } > } > >-std::optional<String> URLParser::maybeCanonicalizeScheme(const String& scheme) >+WTF::Optional<String> URLParser::maybeCanonicalizeScheme(const String& scheme) > { > if (scheme.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > if (!isASCIIAlpha(scheme[0])) >- return std::nullopt; >+ return WTF::nullopt; > > for (size_t i = 1; i < scheme.length(); ++i) { > if (isASCIIAlphanumeric(scheme[i]) || scheme[i] == '+' || scheme[i] == '-' || scheme[i] == '.') > continue; >- return std::nullopt; >+ return WTF::nullopt; > } > > return scheme.convertToASCIILowercase(); >@@ -2130,9 +2130,9 @@ static size_t zeroSequenceLength(const std::array<uint16_t, 8>& address, size_t > return end - begin; > } > >-static std::optional<size_t> findLongestZeroSequence(const std::array<uint16_t, 8>& address) >+static WTF::Optional<size_t> findLongestZeroSequence(const std::array<uint16_t, 8>& address) > { >- std::optional<size_t> longest; >+ WTF::Optional<size_t> longest; > size_t longestLength = 0; > for (size_t i = 0; i < 8; i++) { > size_t length = zeroSequenceLength(address, i); >@@ -2342,27 +2342,27 @@ Expected<URLParser::IPv4Address, URLParser::IPv4ParsingError> URLParser::parseIP > } > > template<typename CharacterType> >-std::optional<uint32_t> URLParser::parseIPv4PieceInsideIPv6(CodePointIterator<CharacterType>& iterator) >+WTF::Optional<uint32_t> URLParser::parseIPv4PieceInsideIPv6(CodePointIterator<CharacterType>& iterator) > { > if (iterator.atEnd()) >- return std::nullopt; >+ return WTF::nullopt; > uint32_t piece = 0; > bool leadingZeros = false; > size_t digitCount = 0; > while (!iterator.atEnd()) { > if (!isASCIIDigit(*iterator)) >- return std::nullopt; >+ return WTF::nullopt; > ++digitCount; > if (!piece && *iterator == '0') { > if (leadingZeros) >- return std::nullopt; >+ return WTF::nullopt; > leadingZeros = true; > } > if (!piece && *iterator == '0') > leadingZeros = true; > piece = piece * 10 + *iterator - '0'; > if (piece > 255) >- return std::nullopt; >+ return WTF::nullopt; > advance<CharacterType, ReportSyntaxViolation::No>(iterator); > if (iterator.atEnd()) > break; >@@ -2370,51 +2370,51 @@ std::optional<uint32_t> URLParser::parseIPv4PieceInsideIPv6(CodePointIterator<Ch > break; > } > if (piece && leadingZeros) >- return std::nullopt; >+ return WTF::nullopt; > return piece; > } > > template<typename CharacterType> >-std::optional<URLParser::IPv4Address> URLParser::parseIPv4AddressInsideIPv6(CodePointIterator<CharacterType> iterator) >+WTF::Optional<URLParser::IPv4Address> URLParser::parseIPv4AddressInsideIPv6(CodePointIterator<CharacterType> iterator) > { > IPv4Address address = 0; > for (size_t i = 0; i < 4; ++i) { >- if (std::optional<uint32_t> piece = parseIPv4PieceInsideIPv6(iterator)) >+ if (WTF::Optional<uint32_t> piece = parseIPv4PieceInsideIPv6(iterator)) > address = (address << 8) + piece.value(); > else >- return std::nullopt; >+ return WTF::nullopt; > if (i < 3) { > if (iterator.atEnd()) >- return std::nullopt; >+ return WTF::nullopt; > if (*iterator != '.') >- return std::nullopt; >+ return WTF::nullopt; > advance<CharacterType, ReportSyntaxViolation::No>(iterator); > } else if (!iterator.atEnd()) >- return std::nullopt; >+ return WTF::nullopt; > } > ASSERT(iterator.atEnd()); > return address; > } > > template<typename CharacterType> >-std::optional<URLParser::IPv6Address> URLParser::parseIPv6Host(CodePointIterator<CharacterType> c) >+WTF::Optional<URLParser::IPv6Address> URLParser::parseIPv6Host(CodePointIterator<CharacterType> c) > { > ASSERT(*c == '['); > const auto hostBegin = c; > advance(c, hostBegin); > if (c.atEnd()) >- return std::nullopt; >+ return WTF::nullopt; > > IPv6Address address = {{0, 0, 0, 0, 0, 0, 0, 0}}; > size_t piecePointer = 0; >- std::optional<size_t> compressPointer; >+ WTF::Optional<size_t> compressPointer; > > if (*c == ':') { > advance(c, hostBegin); > if (c.atEnd()) >- return std::nullopt; >+ return WTF::nullopt; > if (*c != ':') >- return std::nullopt; >+ return WTF::nullopt; > advance(c, hostBegin); > ++piecePointer; > compressPointer = piecePointer; >@@ -2422,19 +2422,19 @@ std::optional<URLParser::IPv6Address> URLParser::parseIPv6Host(CodePointIterator > > while (!c.atEnd()) { > if (piecePointer == 8) >- return std::nullopt; >+ return WTF::nullopt; > if (*c == ':') { > if (compressPointer) >- return std::nullopt; >+ return WTF::nullopt; > advance(c, hostBegin); > ++piecePointer; > compressPointer = piecePointer; > continue; > } > if (piecePointer == 6 || (compressPointer && piecePointer < 6)) { >- if (std::optional<IPv4Address> ipv4Address = parseIPv4AddressInsideIPv6(c)) { >+ if (WTF::Optional<IPv4Address> ipv4Address = parseIPv4AddressInsideIPv6(c)) { > if (compressPointer && piecePointer == 5) >- return std::nullopt; >+ return WTF::nullopt; > syntaxViolation(hostBegin); > address[piecePointer++] = ipv4Address.value() >> 16; > address[piecePointer++] = ipv4Address.value() & 0xFFFF; >@@ -2465,12 +2465,12 @@ std::optional<URLParser::IPv6Address> URLParser::parseIPv6Host(CodePointIterator > if (c.atEnd()) > break; > if (piecePointer == 8 || *c != ':') >- return std::nullopt; >+ return WTF::nullopt; > advance(c, hostBegin); > } > > if (!c.atEnd()) >- return std::nullopt; >+ return WTF::nullopt; > > if (compressPointer) { > size_t swaps = piecePointer - compressPointer.value(); >@@ -2478,9 +2478,9 @@ std::optional<URLParser::IPv6Address> URLParser::parseIPv6Host(CodePointIterator > while (swaps) > std::swap(address[piecePointer--], address[compressPointer.value() + swaps-- - 1]); > } else if (piecePointer != 8) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<size_t> possibleCompressPointer = findLongestZeroSequence(address); >+ WTF::Optional<size_t> possibleCompressPointer = findLongestZeroSequence(address); > if (possibleCompressPointer) > possibleCompressPointer.value()++; > if (UNLIKELY(compressPointer != possibleCompressPointer)) >@@ -2533,7 +2533,7 @@ URLParser::LCharBuffer URLParser::percentDecode(const LChar* input, size_t lengt > return output; > } > >-template<typename CharacterType> std::optional<URLParser::LCharBuffer> URLParser::domainToASCII(StringImpl& domain, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition) >+template<typename CharacterType> WTF::Optional<URLParser::LCharBuffer> URLParser::domainToASCII(StringImpl& domain, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition) > { > LCharBuffer ascii; > if (domain.isAllASCII()) { >@@ -2575,7 +2575,7 @@ template<typename CharacterType> std::optional<URLParser::LCharBuffer> URLParser > syntaxViolation(iteratorForSyntaxViolationPosition); > return ascii; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > bool URLParser::hasForbiddenHostCodePoint(const URLParser::LCharBuffer& asciiDomain) >@@ -2784,11 +2784,11 @@ bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator) > return true; > } > >-std::optional<String> URLParser::formURLDecode(StringView input) >+WTF::Optional<String> URLParser::formURLDecode(StringView input) > { > auto utf8 = input.utf8(StrictConversion); > if (utf8.isNull()) >- return std::nullopt; >+ return WTF::nullopt; > auto percentDecoded = percentDecode(reinterpret_cast<const LChar*>(utf8.data()), utf8.length()); > return String::fromUTF8(percentDecoded.data(), percentDecoded.size()); > } >diff --git a/Source/WTF/wtf/URLParser.h b/Source/WTF/wtf/URLParser.h >index d05a61991d0ab451fecb2c7d539822dd623e494c..83d1fc68d2c79c4ec15ef882d0c7cac826a69850 100644 >--- a/Source/WTF/wtf/URLParser.h >+++ b/Source/WTF/wtf/URLParser.h >@@ -45,12 +45,12 @@ public: > WTF_EXPORT_PRIVATE static String serialize(const URLEncodedForm&); > > WTF_EXPORT_PRIVATE static bool isSpecialScheme(const String& scheme); >- WTF_EXPORT_PRIVATE static std::optional<String> maybeCanonicalizeScheme(const String& scheme); >+ WTF_EXPORT_PRIVATE static WTF::Optional<String> maybeCanonicalizeScheme(const String& scheme); > > static const UIDNA& internationalDomainNameTranscoder(); > static bool isInUserInfoEncodeSet(UChar); > >- static std::optional<uint16_t> defaultPortForProtocol(StringView); >+ static WTF::Optional<uint16_t> defaultPortForProtocol(StringView); > > private: > URLParser(const String&, const URL& = { }, const URLTextEncoding* = nullptr); >@@ -98,10 +98,10 @@ private: > template<typename UnsignedIntegerType> void appendNumberToASCIIBuffer(UnsignedIntegerType); > template<bool(*isInCodeSet)(UChar32), typename CharacterType> void utf8PercentEncode(const CodePointIterator<CharacterType>&); > template<typename CharacterType> void utf8QueryEncode(const CodePointIterator<CharacterType>&); >- template<typename CharacterType> std::optional<LCharBuffer> domainToASCII(StringImpl&, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition); >+ template<typename CharacterType> WTF::Optional<LCharBuffer> domainToASCII(StringImpl&, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition); > template<typename CharacterType> LCharBuffer percentDecode(const LChar*, size_t, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition); > static LCharBuffer percentDecode(const LChar*, size_t); >- static std::optional<String> formURLDecode(StringView input); >+ static WTF::Optional<String> formURLDecode(StringView input); > static bool hasForbiddenHostCodePoint(const LCharBuffer&); > void percentEncodeByte(uint8_t); > void appendToASCIIBuffer(UChar32); >@@ -120,9 +120,9 @@ private: > template<typename CharacterTypeForSyntaxViolation, typename CharacterType> Expected<IPv4Address, IPv4ParsingError> parseIPv4Host(const CodePointIterator<CharacterTypeForSyntaxViolation>&, CodePointIterator<CharacterType>); > template<typename CharacterType> Expected<uint32_t, URLParser::IPv4PieceParsingError> parseIPv4Piece(CodePointIterator<CharacterType>&, bool& syntaxViolation); > using IPv6Address = std::array<uint16_t, 8>; >- template<typename CharacterType> std::optional<IPv6Address> parseIPv6Host(CodePointIterator<CharacterType>); >- template<typename CharacterType> std::optional<uint32_t> parseIPv4PieceInsideIPv6(CodePointIterator<CharacterType>&); >- template<typename CharacterType> std::optional<IPv4Address> parseIPv4AddressInsideIPv6(CodePointIterator<CharacterType>); >+ template<typename CharacterType> WTF::Optional<IPv6Address> parseIPv6Host(CodePointIterator<CharacterType>); >+ template<typename CharacterType> WTF::Optional<uint32_t> parseIPv4PieceInsideIPv6(CodePointIterator<CharacterType>&); >+ template<typename CharacterType> WTF::Optional<IPv4Address> parseIPv4AddressInsideIPv6(CodePointIterator<CharacterType>); > void serializeIPv6Piece(uint16_t piece); > void serializeIPv6(IPv6Address); > >diff --git a/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp b/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp >index e42c7e11f6f5da25e23183a029378436f777b5f1..9738803aa6fa005381f837959f8b6eae71139889 100644 >--- a/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp >+++ b/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp >@@ -46,14 +46,14 @@ static int64_t timeValueToMicroseconds(const time_value_t& value) > return result; > } > >-std::optional<CPUTime> CPUTime::get() >+WTF::Optional<CPUTime> CPUTime::get() > { > // Account for current threads. > task_thread_times_info threadInfoData; > mach_msg_type_number_t threadInfoCount = TASK_THREAD_TIMES_INFO_COUNT; > kern_return_t result = task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, reinterpret_cast<task_info_t>(&threadInfoData), &threadInfoCount); > if (result != KERN_SUCCESS) >- return std::nullopt; >+ return WTF::nullopt; > > int64_t userTime = timeValueToMicroseconds(threadInfoData.user_time); > int64_t systemTime = timeValueToMicroseconds(threadInfoData.system_time); >@@ -63,7 +63,7 @@ std::optional<CPUTime> CPUTime::get() > mach_msg_type_number_t taskInfoCount = TASK_BASIC_INFO_COUNT; > result = task_info(mach_task_self(), TASK_BASIC_INFO, reinterpret_cast<task_info_t>(&taskInfoData), &taskInfoCount); > if (result != KERN_SUCCESS) >- return std::nullopt; >+ return WTF::nullopt; > > userTime += timeValueToMicroseconds(taskInfoData.user_time); > systemTime += timeValueToMicroseconds(taskInfoData.system_time); >diff --git a/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm b/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm >index 9faa36b360875f2ee33459c4e6fa5d676cfe06af..06311cdf116596107c82a5f6868d2bb3cadc9469 100644 >--- a/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm >+++ b/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm >@@ -197,13 +197,13 @@ void MemoryPressureHandler::respondToMemoryPressure(Critical critical, Synchrono > #endif > } > >-std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() >+WTF::Optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() > { > task_vm_info_data_t vmInfo; > mach_msg_type_number_t count = TASK_VM_INFO_COUNT; > kern_return_t err = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vmInfo, &count); > if (err != KERN_SUCCESS) >- return std::nullopt; >+ return WTF::nullopt; > > return MemoryUsage {static_cast<size_t>(vmInfo.internal), static_cast<size_t>(vmInfo.phys_footprint)}; > } >diff --git a/Source/WTF/wtf/cocoa/NSURLExtras.mm b/Source/WTF/wtf/cocoa/NSURLExtras.mm >index 135e42db5a0e3444b2857d3ef169807c2953ea33..3dd7970d68becb398367c3147de596856651607d 100644 >--- a/Source/WTF/wtf/cocoa/NSURLExtras.mm >+++ b/Source/WTF/wtf/cocoa/NSURLExtras.mm >@@ -94,7 +94,7 @@ template<typename CharacterType> inline bool isASCIIDigitOrValidHostCharacter(Ch > > > >-static BOOL isLookalikeCharacter(std::optional<UChar32> previousCodePoint, UChar32 charCode) >+static BOOL isLookalikeCharacter(WTF::Optional<UChar32> previousCodePoint, UChar32 charCode) > { > // This function treats the following as unsafe, lookalike characters: > // any non-printable character, any character considered as whitespace, >@@ -328,7 +328,7 @@ static BOOL allCharactersInIDNScriptWhiteList(const UChar *buffer, int32_t lengt > }); > > int32_t i = 0; >- std::optional<UChar32> previousCodePoint; >+ WTF::Optional<UChar32> previousCodePoint; > while (i < length) { > UChar32 c; > U16_NEXT(buffer, i, length, c) >@@ -1062,7 +1062,7 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string) > > Vector<UChar, URL_BYTES_BUFFER_LENGTH> outBuffer; > >- std::optional<UChar32> previousCodePoint; >+ WTF::Optional<UChar32> previousCodePoint; > CFIndex i = 0; > while (i < length) { > UChar32 c; >diff --git a/Source/WTF/wtf/fuchsia/CPUTimeFuchsia.cpp b/Source/WTF/wtf/fuchsia/CPUTimeFuchsia.cpp >index bff8d80e50660cff0f2ff67caf44426e19767575..ee744452081aafbd43ca4d4c5526113075a8b1e1 100644 >--- a/Source/WTF/wtf/fuchsia/CPUTimeFuchsia.cpp >+++ b/Source/WTF/wtf/fuchsia/CPUTimeFuchsia.cpp >@@ -35,7 +35,7 @@ static Seconds timeToSeconds(zx_time_t t) > return Seconds(t / static_cast<double>(ZX_SEC(1))); > } > >-std::optional<CPUTime> CPUTime::get() >+WTF::Optional<CPUTime> CPUTime::get() > { > // Fuchsia issue ZX-2318 tracks being able to get the monotonic and thread > // times atomically and being able to separate ZX_CLOCK_THREAD into user and >diff --git a/Source/WTF/wtf/generic/MemoryPressureHandlerGeneric.cpp b/Source/WTF/wtf/generic/MemoryPressureHandlerGeneric.cpp >index 4533873d9615a9ae4ca346256d70273dd3519126..d7a9ae056d0fedeb833350a5ce020f2b91382014 100644 >--- a/Source/WTF/wtf/generic/MemoryPressureHandlerGeneric.cpp >+++ b/Source/WTF/wtf/generic/MemoryPressureHandlerGeneric.cpp >@@ -48,9 +48,9 @@ void MemoryPressureHandler::respondToMemoryPressure(Critical, Synchronous) > { > } > >-std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() >+WTF::Optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() > { >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WTF >diff --git a/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp b/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp >index ae7823f4cdd5fd492364189b03c84543dcab2e08..bdd3bb240cf60c6e1da37fb314fe1fae65e5c108 100644 >--- a/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp >+++ b/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp >@@ -131,7 +131,7 @@ void MemoryPressureHandler::platformReleaseMemory(Critical) > #endif > } > >-std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() >+WTF::Optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() > { > return MemoryUsage {processMemoryUsage(), memoryFootprint()}; > } >diff --git a/Source/WTF/wtf/persistence/PersistentCoders.h b/Source/WTF/wtf/persistence/PersistentCoders.h >index 1bd4d6f7cd41ba4ed52f28c084dd81afc7184f70..d7db6d017f0118ebe3c10fc42a8246afe404871e 100644 >--- a/Source/WTF/wtf/persistence/PersistentCoders.h >+++ b/Source/WTF/wtf/persistence/PersistentCoders.h >@@ -61,8 +61,8 @@ template<typename T, typename U> struct Coder<std::pair<T, U>> { > } > }; > >-template<typename T> struct Coder<std::optional<T>> { >- static void encode(Encoder& encoder, const std::optional<T>& optional) >+template<typename T> struct Coder<WTF::Optional<T>> { >+ static void encode(Encoder& encoder, const WTF::Optional<T>& optional) > { > if (!optional) { > encoder << false; >@@ -73,14 +73,14 @@ template<typename T> struct Coder<std::optional<T>> { > encoder << optional.value(); > } > >- static bool decode(Decoder& decoder, std::optional<T>& optional) >+ static bool decode(Decoder& decoder, WTF::Optional<T>& optional) > { > bool isEngaged; > if (!decoder.decode(isEngaged)) > return false; > > if (!isEngaged) { >- optional = std::nullopt; >+ optional = WTF::nullopt; > return true; > } > >diff --git a/Source/WTF/wtf/text/NullTextBreakIterator.h b/Source/WTF/wtf/text/NullTextBreakIterator.h >index f8b1f3e54d313f8857fe69709e9d0af20013a740..78a84cf1a7681da732a0ad6cdee95496efc548e2 100644 >--- a/Source/WTF/wtf/text/NullTextBreakIterator.h >+++ b/Source/WTF/wtf/text/NullTextBreakIterator.h >@@ -30,13 +30,13 @@ public: > NullTextBreakIterator& operator=(const NullTextBreakIterator&) = delete; > NullTextBreakIterator& operator=(NullTextBreakIterator&&) = default; > >- std::optional<unsigned> preceding(unsigned) const >+ WTF::Optional<unsigned> preceding(unsigned) const > { > ASSERT_NOT_REACHED(); > return { }; > } > >- std::optional<unsigned> following(unsigned) const >+ WTF::Optional<unsigned> following(unsigned) const > { > ASSERT_NOT_REACHED(); > return { }; >diff --git a/Source/WTF/wtf/text/StringView.cpp b/Source/WTF/wtf/text/StringView.cpp >index 450b47a21619f3e9d47106d1a9cdb81971272696..76e63a152c705d2780d450b0931b90967466f8b8 100644 >--- a/Source/WTF/wtf/text/StringView.cpp >+++ b/Source/WTF/wtf/text/StringView.cpp >@@ -129,7 +129,7 @@ auto StringView::SplitResult::Iterator::operator++() -> Iterator& > > class StringView::GraphemeClusters::Iterator::Impl { > public: >- Impl(const StringView& stringView, std::optional<NonSharedCharacterBreakIterator>&& iterator, unsigned index) >+ Impl(const StringView& stringView, WTF::Optional<NonSharedCharacterBreakIterator>&& iterator, unsigned index) > : m_stringView(stringView) > , m_iterator(WTFMove(iterator)) > , m_index(index) >@@ -170,13 +170,13 @@ public: > > private: > const StringView& m_stringView; >- std::optional<NonSharedCharacterBreakIterator> m_iterator; >+ WTF::Optional<NonSharedCharacterBreakIterator> m_iterator; > unsigned m_index; > unsigned m_indexEnd; > }; > > StringView::GraphemeClusters::Iterator::Iterator(const StringView& stringView, unsigned index) >- : m_impl(std::make_unique<Impl>(stringView, stringView.isNull() ? std::nullopt : std::optional<NonSharedCharacterBreakIterator>(NonSharedCharacterBreakIterator(stringView)), index)) >+ : m_impl(std::make_unique<Impl>(stringView, stringView.isNull() ? WTF::nullopt : WTF::Optional<NonSharedCharacterBreakIterator>(NonSharedCharacterBreakIterator(stringView)), index)) > { > } > >diff --git a/Source/WTF/wtf/text/StringView.h b/Source/WTF/wtf/text/StringView.h >index 7314e56d94108fba95200a7830e76b7604f7ad22..acd45f07425979b6ffba0bbfea039becca2af167 100644 >--- a/Source/WTF/wtf/text/StringView.h >+++ b/Source/WTF/wtf/text/StringView.h >@@ -153,7 +153,7 @@ public: > int toInt() const; > int toInt(bool& isValid) const; > int toIntStrict(bool& isValid) const; >- std::optional<uint64_t> toUInt64Strict() const; >+ WTF::Optional<uint64_t> toUInt64Strict() const; > float toFloat(bool& isValid) const; > > static void invalidate(const StringImpl&); >@@ -529,11 +529,11 @@ inline int StringView::toIntStrict(bool& isValid) const > return charactersToIntStrict(characters16(), m_length, &isValid); > } > >-inline std::optional<uint64_t> StringView::toUInt64Strict() const >+inline WTF::Optional<uint64_t> StringView::toUInt64Strict() const > { > bool isValid; > uint64_t result = is8Bit() ? charactersToUInt64Strict(characters8(), m_length, &isValid) : charactersToUInt64Strict(characters16(), m_length, &isValid); >- return isValid ? std::make_optional(result) : std::nullopt; >+ return isValid ? WTF::makeOptional(result) : WTF::nullopt; > } > > inline String StringView::toStringWithoutCopying() const >@@ -743,7 +743,7 @@ public: > > private: > std::reference_wrapper<const StringView> m_stringView; >- std::optional<unsigned> m_nextCodePointOffset; >+ WTF::Optional<unsigned> m_nextCodePointOffset; > UChar32 m_codePoint; > }; > >@@ -808,7 +808,7 @@ inline auto StringView::CodePoints::Iterator::operator++() -> Iterator& > { > ASSERT(m_nextCodePointOffset); > if (m_nextCodePointOffset.value() == m_stringView.get().length()) { >- m_nextCodePointOffset = std::nullopt; >+ m_nextCodePointOffset = WTF::nullopt; > return *this; > } > if (m_stringView.get().is8Bit()) >diff --git a/Source/WTF/wtf/text/TextBreakIterator.h b/Source/WTF/wtf/text/TextBreakIterator.h >index e861057bde2e9866a349459137127cadaca3e641..3813e25f4a9cedaac77c4d43780a2ea3af909312 100644 >--- a/Source/WTF/wtf/text/TextBreakIterator.h >+++ b/Source/WTF/wtf/text/TextBreakIterator.h >@@ -56,14 +56,14 @@ public: > TextBreakIterator& operator=(const TextBreakIterator&) = delete; > TextBreakIterator& operator=(TextBreakIterator&&) = default; > >- std::optional<unsigned> preceding(unsigned location) const >+ WTF::Optional<unsigned> preceding(unsigned location) const > { > return switchOn(m_backing, [&](const auto& iterator) { > return iterator.preceding(location); > }); > } > >- std::optional<unsigned> following(unsigned location) const >+ WTF::Optional<unsigned> following(unsigned location) const > { > return switchOn(m_backing, [&](const auto& iterator) { > return iterator.following(location); >@@ -173,12 +173,12 @@ public: > CachedTextBreakIterator& operator=(const CachedTextBreakIterator&) = delete; > CachedTextBreakIterator& operator=(CachedTextBreakIterator&&) = default; > >- std::optional<unsigned> preceding(unsigned location) const >+ WTF::Optional<unsigned> preceding(unsigned location) const > { > return m_backing.preceding(location); > } > >- std::optional<unsigned> following(unsigned location) const >+ WTF::Optional<unsigned> following(unsigned location) const > { > return m_backing.following(location); > } >diff --git a/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h b/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h >index 27e50bce5075f9ddadc4fdb9b192f6e834065e66..2b156f21a62f6cf0ff21b5f476c63fa5af7267bd 100644 >--- a/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h >+++ b/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h >@@ -56,7 +56,7 @@ public: > m_string = string.createCFStringWithoutCopying(); > } > >- std::optional<unsigned> preceding(unsigned location) const >+ WTF::Optional<unsigned> preceding(unsigned location) const > { > if (!location) > return { }; >@@ -67,7 +67,7 @@ public: > return range.location; > } > >- std::optional<unsigned> following(unsigned location) const >+ WTF::Optional<unsigned> following(unsigned location) const > { > if (location >= static_cast<unsigned long>(CFStringGetLength(m_string.get()))) > return { }; >diff --git a/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h b/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h >index 5127388032a98ed59b53c7dafcf7b731c72058e3..28fd3ad962cf6dfed7588c5dc3ea816a301d0f03 100644 >--- a/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h >+++ b/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h >@@ -118,7 +118,7 @@ public: > ASSERT(U_SUCCESS(status)); > } > >- std::optional<unsigned> preceding(unsigned location) const >+ WTF::Optional<unsigned> preceding(unsigned location) const > { > auto result = ubrk_preceding(m_iterator, location); > if (result == UBRK_DONE) >@@ -126,7 +126,7 @@ public: > return result; > } > >- std::optional<unsigned> following(unsigned location) const >+ WTF::Optional<unsigned> following(unsigned location) const > { > auto result = ubrk_following(m_iterator, location); > if (result == UBRK_DONE) >diff --git a/Source/WTF/wtf/threads/Signals.h b/Source/WTF/wtf/threads/Signals.h >index d58fc68a84220ef11110c125672de4749a098520..077f80bde6a3bf7aac0b1a4e3602d32e718e06bf 100644 >--- a/Source/WTF/wtf/threads/Signals.h >+++ b/Source/WTF/wtf/threads/Signals.h >@@ -49,12 +49,12 @@ enum class Signal { > Unknown = NumberOfSignals > }; > >-inline std::tuple<int, std::optional<int>> toSystemSignal(Signal signal) >+inline std::tuple<int, WTF::Optional<int>> toSystemSignal(Signal signal) > { > switch (signal) { > case Signal::BadAccess: return std::make_tuple(SIGSEGV, SIGBUS); >- case Signal::Ill: return std::make_tuple(SIGILL, std::nullopt); >- case Signal::Usr: return std::make_tuple(SIGILL, std::nullopt); >+ case Signal::Ill: return std::make_tuple(SIGILL, WTF::nullopt); >+ case Signal::Usr: return std::make_tuple(SIGILL, WTF::nullopt); > default: break; > } > RELEASE_ASSERT_NOT_REACHED(); >diff --git a/Source/WTF/wtf/unix/CPUTimeUnix.cpp b/Source/WTF/wtf/unix/CPUTimeUnix.cpp >index beeb3e810e9c341c45c5f230d114d4e41b649779..db083892b80e9e989cec6dde7e4ccf193b0fc4b5 100644 >--- a/Source/WTF/wtf/unix/CPUTimeUnix.cpp >+++ b/Source/WTF/wtf/unix/CPUTimeUnix.cpp >@@ -37,7 +37,7 @@ static Seconds timevalToSeconds(const struct timeval& value) > return Seconds(value.tv_sec) + Seconds::fromMicroseconds(value.tv_usec); > } > >-std::optional<CPUTime> CPUTime::get() >+WTF::Optional<CPUTime> CPUTime::get() > { > struct rusage resource { }; > int ret = getrusage(RUSAGE_SELF, &resource); >diff --git a/Source/WTF/wtf/win/CPUTimeWin.cpp b/Source/WTF/wtf/win/CPUTimeWin.cpp >index 9c687b66cfd32377f95d111e464a7ccab4f1daf8..a7fd70fa3269d7a36e73407384352b4849f4f346 100644 >--- a/Source/WTF/wtf/win/CPUTimeWin.cpp >+++ b/Source/WTF/wtf/win/CPUTimeWin.cpp >@@ -47,7 +47,7 @@ static Seconds fileTimeToSeconds(const FILETIME& fileTime) > return Seconds { durationIn100NS.QuadPart / hundredsOfNanosecondsPerSecond }; > } > >-std::optional<CPUTime> CPUTime::get() >+WTF::Optional<CPUTime> CPUTime::get() > { > // https://msdn.microsoft.com/ja-jp/library/windows/desktop/ms683223(v=vs.85).aspx > FILETIME creationTime; >@@ -55,7 +55,7 @@ std::optional<CPUTime> CPUTime::get() > FILETIME kernelTime; > FILETIME userTime; > if (!::GetProcessTimes(::GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime)) >- return std::nullopt; >+ return WTF::nullopt; > > return CPUTime { MonotonicTime::now(), fileTimeToSeconds(userTime), fileTimeToSeconds(kernelTime) }; > } >diff --git a/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp b/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp >index e6bebdc1ca202619ea4fd76429c9ce3fe50ac8b0..755334b83ec145d823d02a6762edbe45cbbc285f 100644 >--- a/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp >+++ b/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp >@@ -96,9 +96,9 @@ void MemoryPressureHandler::respondToMemoryPressure(Critical critical, Synchrono > releaseMemory(critical, synchronous); > } > >-std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() >+WTF::Optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() > { >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WTF >diff --git a/Source/WebCore/Modules/applepay/ApplePayError.cpp b/Source/WebCore/Modules/applepay/ApplePayError.cpp >index 0b5bcf005a3655ebf249fc3812b19384314387cd..d122427c9959dfdd4c8ed9fed2be68c6dd8c2be6 100644 >--- a/Source/WebCore/Modules/applepay/ApplePayError.cpp >+++ b/Source/WebCore/Modules/applepay/ApplePayError.cpp >@@ -30,12 +30,12 @@ > > namespace WebCore { > >-Ref<ApplePayError> ApplePayError::create(Code code, std::optional<ContactField> contactField, const String& message) >+Ref<ApplePayError> ApplePayError::create(Code code, WTF::Optional<ContactField> contactField, const String& message) > { > return adoptRef(*new ApplePayError { code, contactField, message }); > } > >-ApplePayError::ApplePayError(Code code, std::optional<ContactField> contactField, const String& message) >+ApplePayError::ApplePayError(Code code, WTF::Optional<ContactField> contactField, const String& message) > : m_code { code } > , m_contactField { contactField } > , m_message { message } >diff --git a/Source/WebCore/Modules/applepay/ApplePayError.h b/Source/WebCore/Modules/applepay/ApplePayError.h >index e9defce3f3796f9610829ba97f156d5454764d68..aadfff07cc85df0b4d0aa9a18c009567c341c600 100644 >--- a/Source/WebCore/Modules/applepay/ApplePayError.h >+++ b/Source/WebCore/Modules/applepay/ApplePayError.h >@@ -38,23 +38,23 @@ public: > using Code = PaymentError::Code; > using ContactField = PaymentError::ContactField; > >- static Ref<ApplePayError> create(Code, std::optional<ContactField>, const String& message); >+ static Ref<ApplePayError> create(Code, WTF::Optional<ContactField>, const String& message); > virtual ~ApplePayError(); > > Code code() const { return m_code; } > void setCode(Code code) { m_code = code; } > >- std::optional<ContactField> contactField() const { return m_contactField; } >- void setContactField(std::optional<ContactField> contactField) { m_contactField = contactField; } >+ WTF::Optional<ContactField> contactField() const { return m_contactField; } >+ void setContactField(WTF::Optional<ContactField> contactField) { m_contactField = contactField; } > > String message() const { return m_message; } > void setMessage(String&& message) { m_message = WTFMove(message); } > > private: >- ApplePayError(Code, std::optional<ContactField>, const String& message); >+ ApplePayError(Code, WTF::Optional<ContactField>, const String& message); > > Code m_code; >- std::optional<ContactField> m_contactField; >+ WTF::Optional<ContactField> m_contactField; > String m_message; > }; > >diff --git a/Source/WebCore/Modules/applepay/ApplePayPayment.h b/Source/WebCore/Modules/applepay/ApplePayPayment.h >index 31f4cef82c9e418e888dae41191655c406110ceb..6321801ed11f967f3e13d93c37450858f1dc4b9f 100644 >--- a/Source/WebCore/Modules/applepay/ApplePayPayment.h >+++ b/Source/WebCore/Modules/applepay/ApplePayPayment.h >@@ -40,8 +40,8 @@ struct ApplePayPayment { > }; > > Token token; >- std::optional<ApplePayPaymentContact> billingContact; >- std::optional<ApplePayPaymentContact> shippingContact; >+ WTF::Optional<ApplePayPaymentContact> billingContact; >+ WTF::Optional<ApplePayPaymentContact> shippingContact; > }; > > } >diff --git a/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h b/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h >index dba99ff8e040349d942a43849285ce4c7e56735a..d004f80ff9a60d69b82aa7a38c62f58ea5f26048 100644 >--- a/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h >+++ b/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h >@@ -42,7 +42,7 @@ struct ApplePayPaymentContact { > String phoneticGivenName; > String phoneticFamilyName; > String localizedPhoneticName; >- std::optional<Vector<String>> addressLines; >+ WTF::Optional<Vector<String>> addressLines; > String subLocality; > String locality; > String postalCode; >diff --git a/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h b/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h >index 30958450f39e55b859cfaca2e70727a35616cabc..22b629cedef7eb8c84d0db8af07f6576c193337e 100644 >--- a/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h >+++ b/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h >@@ -39,8 +39,8 @@ struct ApplePayPaymentMethod { > > String displayName; > String network; >- std::optional<Type> type; >- std::optional<ApplePayPaymentPass> paymentPass; >+ WTF::Optional<Type> type; >+ WTF::Optional<ApplePayPaymentPass> paymentPass; > }; > > } >diff --git a/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h b/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h >index 4de95d70a5d9433309fdf83a867ff2b85d5a0c8b..dd8f8d27f8c6caab5a01d846f5ff9485ee9be106 100644 >--- a/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h >+++ b/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h >@@ -40,13 +40,13 @@ struct ApplePayPaymentRequest : ApplePayRequestBase { > > String currencyCode; > >- std::optional<Vector<ApplePayContactField>> requiredShippingContactFields; >+ WTF::Optional<Vector<ApplePayContactField>> requiredShippingContactFields; > > ShippingType shippingType { ShippingType::Shipping }; >- std::optional<Vector<ApplePayShippingMethod>> shippingMethods; >+ WTF::Optional<Vector<ApplePayShippingMethod>> shippingMethods; > > ApplePayLineItem total; >- std::optional<Vector<ApplePayLineItem>> lineItems; >+ WTF::Optional<Vector<ApplePayLineItem>> lineItems; > }; > > } >diff --git a/Source/WebCore/Modules/applepay/ApplePayRequestBase.h b/Source/WebCore/Modules/applepay/ApplePayRequestBase.h >index ea8dc7673c51d477b636214318954b61bc06dd18..586947120e31ad5d900f9fa52798c429452dd907 100644 >--- a/Source/WebCore/Modules/applepay/ApplePayRequestBase.h >+++ b/Source/WebCore/Modules/applepay/ApplePayRequestBase.h >@@ -40,10 +40,10 @@ struct ApplePayRequestBase { > Vector<String> supportedNetworks; > String countryCode; > >- std::optional<Vector<ApplePayContactField>> requiredBillingContactFields; >- std::optional<ApplePayPaymentContact> billingContact; >+ WTF::Optional<Vector<ApplePayContactField>> requiredBillingContactFields; >+ WTF::Optional<ApplePayPaymentContact> billingContact; > >- std::optional<ApplePayPaymentContact> shippingContact; >+ WTF::Optional<ApplePayPaymentContact> shippingContact; > > String applicationData; > Vector<String> supportedCountries; >diff --git a/Source/WebCore/Modules/applepay/ApplePaySession.cpp b/Source/WebCore/Modules/applepay/ApplePaySession.cpp >index e1a36e40edf1d247800920e67079e6ae5f8ac95c..f1a40e25eb6d7520b337b1c6b734f00b2cc75af1 100644 >--- a/Source/WebCore/Modules/applepay/ApplePaySession.cpp >+++ b/Source/WebCore/Modules/applepay/ApplePaySession.cpp >@@ -160,7 +160,7 @@ static ExceptionOr<ApplePaySessionPaymentRequest::LineItem> convertAndValidate(A > return WTFMove(result); > } > >-static ExceptionOr<Vector<ApplePaySessionPaymentRequest::LineItem>> convertAndValidate(std::optional<Vector<ApplePayLineItem>>&& lineItems) >+static ExceptionOr<Vector<ApplePaySessionPaymentRequest::LineItem>> convertAndValidate(WTF::Optional<Vector<ApplePayLineItem>>&& lineItems) > { > Vector<ApplePaySessionPaymentRequest::LineItem> result; > if (!lineItems) >@@ -284,7 +284,7 @@ static ExceptionOr<PaymentAuthorizationResult> convertAndValidate(ApplePayPaymen > > case ApplePaySession::STATUS_INVALID_BILLING_POSTAL_ADDRESS: > convertedResult.status = PaymentAuthorizationStatus::Failure; >- convertedResult.errors.append({ PaymentError::Code::BillingContactInvalid, { }, std::nullopt }); >+ convertedResult.errors.append({ PaymentError::Code::BillingContactInvalid, { }, WTF::nullopt }); > break; > > case ApplePaySession::STATUS_INVALID_SHIPPING_POSTAL_ADDRESS: >@@ -294,7 +294,7 @@ static ExceptionOr<PaymentAuthorizationResult> convertAndValidate(ApplePayPaymen > > case ApplePaySession::STATUS_INVALID_SHIPPING_CONTACT: > convertedResult.status = PaymentAuthorizationStatus::Failure; >- convertedResult.errors.append({ PaymentError::Code::ShippingContactInvalid, { }, std::nullopt }); >+ convertedResult.errors.append({ PaymentError::Code::ShippingContactInvalid, { }, WTF::nullopt }); > break; > > case ApplePaySession::STATUS_PIN_REQUIRED: >@@ -691,8 +691,8 @@ ExceptionOr<void> ApplePaySession::completeShippingContactSelection(unsigned sho > { > ApplePayShippingContactUpdate update; > >- std::optional<ApplePayError::Code> errorCode; >- std::optional<ApplePayError::ContactField> contactField; >+ WTF::Optional<ApplePayError::Code> errorCode; >+ WTF::Optional<ApplePayError::ContactField> contactField; > > switch (status) { > case ApplePaySession::STATUS_SUCCESS: >diff --git a/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp b/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp >index b7f7047881a838a182a1318f997b923cf7e43648..d577774d99aa69b598e9207dec7c06c64200e2f3 100644 >--- a/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp >+++ b/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.cpp >@@ -37,7 +37,7 @@ ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest() = default; > > ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest() = default; > >-bool isFinalStateResult(const std::optional<PaymentAuthorizationResult>& result) >+bool isFinalStateResult(const WTF::Optional<PaymentAuthorizationResult>& result) > { > if (!result) > return true; >diff --git a/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h b/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h >index d6ad7f59241bf62e8703744ee4ce9b73158c50e0..ece2a8fd1d6b36dbaedbd64d1c58cbd15b2e24d1 100644 >--- a/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h >+++ b/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h >@@ -190,7 +190,7 @@ struct PaymentError { > > Code code; > String message; >- std::optional<ContactField> contactField; >+ WTF::Optional<ContactField> contactField; > }; > > struct PaymentAuthorizationResult { >@@ -213,7 +213,7 @@ struct ShippingMethodUpdate { > ApplePaySessionPaymentRequest::TotalAndLineItems newTotalAndLineItems; > }; > >-WEBCORE_EXPORT bool isFinalStateResult(const std::optional<PaymentAuthorizationResult>&); >+WEBCORE_EXPORT bool isFinalStateResult(const WTF::Optional<PaymentAuthorizationResult>&); > > } > >diff --git a/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp b/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp >index e373357cc07fea59de97ec55d5c8893d063864d3..5929024e3989a6157cee551780dad2635d2cf454 100644 >--- a/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp >+++ b/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp >@@ -83,28 +83,28 @@ void PaymentCoordinator::completeMerchantValidation(const PaymentMerchantSession > m_client.completeMerchantValidation(paymentMerchantSession); > } > >-void PaymentCoordinator::completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&& update) >+void PaymentCoordinator::completeShippingMethodSelection(WTF::Optional<ShippingMethodUpdate>&& update) > { > ASSERT(m_activeSession); > > m_client.completeShippingMethodSelection(WTFMove(update)); > } > >-void PaymentCoordinator::completeShippingContactSelection(std::optional<ShippingContactUpdate>&& update) >+void PaymentCoordinator::completeShippingContactSelection(WTF::Optional<ShippingContactUpdate>&& update) > { > ASSERT(m_activeSession); > > m_client.completeShippingContactSelection(WTFMove(update)); > } > >-void PaymentCoordinator::completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&& update) >+void PaymentCoordinator::completePaymentMethodSelection(WTF::Optional<PaymentMethodUpdate>&& update) > { > ASSERT(m_activeSession); > > m_client.completePaymentMethodSelection(WTFMove(update)); > } > >-void PaymentCoordinator::completePaymentSession(std::optional<PaymentAuthorizationResult>&& result) >+void PaymentCoordinator::completePaymentSession(WTF::Optional<PaymentAuthorizationResult>&& result) > { > ASSERT(m_activeSession); > >@@ -194,13 +194,13 @@ void PaymentCoordinator::didCancelPaymentSession() > m_activeSession = nullptr; > } > >-std::optional<String> PaymentCoordinator::validatedPaymentNetwork(unsigned version, const String& paymentNetwork) const >+WTF::Optional<String> PaymentCoordinator::validatedPaymentNetwork(unsigned version, const String& paymentNetwork) const > { > if (version < 2 && equalIgnoringASCIICase(paymentNetwork, "jcb")) >- return std::nullopt; >+ return WTF::nullopt; > > if (version < 3 && equalIgnoringASCIICase(paymentNetwork, "carteBancaire")) >- return std::nullopt; >+ return WTF::nullopt; > > return m_client.validatedPaymentNetwork(paymentNetwork); > } >diff --git a/Source/WebCore/Modules/applepay/PaymentCoordinator.h b/Source/WebCore/Modules/applepay/PaymentCoordinator.h >index 5bf71daa26368fc834b154022c9cc1769a14bc3e..9c3465ba7418aeaf21f8184d794499cd53aff5f4 100644 >--- a/Source/WebCore/Modules/applepay/PaymentCoordinator.h >+++ b/Source/WebCore/Modules/applepay/PaymentCoordinator.h >@@ -60,10 +60,10 @@ public: > > bool beginPaymentSession(PaymentSession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&); > void completeMerchantValidation(const PaymentMerchantSession&); >- void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&); >- void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&); >- void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&); >- void completePaymentSession(std::optional<PaymentAuthorizationResult>&&); >+ void completeShippingMethodSelection(WTF::Optional<ShippingMethodUpdate>&&); >+ void completeShippingContactSelection(WTF::Optional<ShippingContactUpdate>&&); >+ void completePaymentMethodSelection(WTF::Optional<PaymentMethodUpdate>&&); >+ void completePaymentSession(WTF::Optional<PaymentAuthorizationResult>&&); > void abortPaymentSession(); > void cancelPaymentSession(); > >@@ -74,7 +74,7 @@ public: > WEBCORE_EXPORT void didSelectShippingContact(const PaymentContact&); > WEBCORE_EXPORT void didCancelPaymentSession(); > >- std::optional<String> validatedPaymentNetwork(unsigned version, const String&) const; >+ WTF::Optional<String> validatedPaymentNetwork(unsigned version, const String&) const; > > private: > PaymentCoordinatorClient& m_client; >diff --git a/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h b/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h >index 85e4e4b04468890f4ec3c804d5a24738e814446b..0187041b4fed711f8c64540e6722ad18b414a8c1 100644 >--- a/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h >+++ b/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h >@@ -46,17 +46,17 @@ struct ShippingMethodUpdate; > class PaymentCoordinatorClient { > public: > virtual bool supportsVersion(unsigned version) = 0; >- virtual std::optional<String> validatedPaymentNetwork(const String&) = 0; >+ virtual WTF::Optional<String> validatedPaymentNetwork(const String&) = 0; > virtual bool canMakePayments() = 0; > virtual void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) = 0; > virtual void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) = 0; > > virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&) = 0; > virtual void completeMerchantValidation(const PaymentMerchantSession&) = 0; >- virtual void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) = 0; >- virtual void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) = 0; >- virtual void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) = 0; >- virtual void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) = 0; >+ virtual void completeShippingMethodSelection(WTF::Optional<ShippingMethodUpdate>&&) = 0; >+ virtual void completeShippingContactSelection(WTF::Optional<ShippingContactUpdate>&&) = 0; >+ virtual void completePaymentMethodSelection(WTF::Optional<PaymentMethodUpdate>&&) = 0; >+ virtual void completePaymentSession(WTF::Optional<PaymentAuthorizationResult>&&) = 0; > virtual void abortPaymentSession() = 0; > virtual void cancelPaymentSession() = 0; > virtual void paymentCoordinatorDestroyed() = 0; >diff --git a/Source/WebCore/Modules/applepay/PaymentMerchantSession.h b/Source/WebCore/Modules/applepay/PaymentMerchantSession.h >index daa749549f53f5da3d366d5e60839a288063b3f5..2a4b5edb3d89fbaa20ce42567800d1efdaf9cf72 100644 >--- a/Source/WebCore/Modules/applepay/PaymentMerchantSession.h >+++ b/Source/WebCore/Modules/applepay/PaymentMerchantSession.h >@@ -47,7 +47,7 @@ public: > { > } > >- static std::optional<PaymentMerchantSession> fromJS(JSC::ExecState&, JSC::JSValue, String& errorMessage); >+ static WTF::Optional<PaymentMerchantSession> fromJS(JSC::ExecState&, JSC::JSValue, String& errorMessage); > > PKPaymentMerchantSession *pkPaymentMerchantSession() const { return m_pkPaymentMerchantSession.get(); } > >diff --git a/Source/WebCore/Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm b/Source/WebCore/Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm >index fc36c8953149f4330bd951a6aec22b8efb2e0dc4..a5869684ac21deee78a1f7661b755373bfa75eb4 100644 >--- a/Source/WebCore/Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm >+++ b/Source/WebCore/Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm >@@ -33,16 +33,16 @@ > > namespace WebCore { > >-std::optional<PaymentMerchantSession> PaymentMerchantSession::fromJS(JSC::ExecState& state, JSC::JSValue value, String&) >+WTF::Optional<PaymentMerchantSession> PaymentMerchantSession::fromJS(JSC::ExecState& state, JSC::JSValue value, String&) > { > // FIXME: Don't round-trip using NSString. > auto jsonString = JSONStringify(&state, value, 0); > if (!jsonString) >- return std::nullopt; >+ return WTF::nullopt; > > auto dictionary = dynamic_objc_cast<NSDictionary>([NSJSONSerialization JSONObjectWithData:[(NSString *)jsonString dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil]); > if (!dictionary || ![dictionary isKindOfClass:[NSDictionary class]]) >- return std::nullopt; >+ return WTF::nullopt; > > auto pkPaymentMerchantSession = adoptNS([PAL::allocPKPaymentMerchantSessionInstance() initWithDictionary:dictionary]); > >diff --git a/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm b/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm >index a5c599aff6cb9a90541647d5653b86053d2a481c..00edcb836ed2dd7f1658c0d88fd0ca04a9b51424 100644 >--- a/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm >+++ b/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm >@@ -50,10 +50,10 @@ static ApplePayPaymentPass::ActivationState convert(PKPaymentPassActivationState > } > } > >-static std::optional<ApplePayPaymentPass> convert(PKPaymentPass *paymentPass) >+static WTF::Optional<ApplePayPaymentPass> convert(PKPaymentPass *paymentPass) > { > if (!paymentPass) >- return std::nullopt; >+ return WTF::nullopt; > > ApplePayPaymentPass result; > >@@ -70,7 +70,7 @@ static std::optional<ApplePayPaymentPass> convert(PKPaymentPass *paymentPass) > return result; > } > >-static std::optional<ApplePayPaymentMethod::Type> convert(PKPaymentMethodType paymentMethodType) >+static WTF::Optional<ApplePayPaymentMethod::Type> convert(PKPaymentMethodType paymentMethodType) > { > switch (paymentMethodType) { > case PKPaymentMethodTypeDebit: >@@ -82,7 +82,7 @@ static std::optional<ApplePayPaymentMethod::Type> convert(PKPaymentMethodType pa > case PKPaymentMethodTypeStore: > return ApplePayPaymentMethod::Type::Store; > case PKPaymentMethodTypeUnknown: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp b/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp >index e75c215ea155af984753a1e283497e86b0c4a22f..a1c9d5cef6496bd476c3269c7b78b18301bde915 100644 >--- a/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp >+++ b/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp >@@ -316,7 +316,7 @@ ExceptionOr<ApplePaySessionPaymentRequest::TotalAndLineItems> ApplePayPaymentHan > return ApplePaySessionPaymentRequest::TotalAndLineItems { WTFMove(total), WTFMove(lineItems) }; > } > >-static inline void appendShippingContactInvalidError(String&& message, std::optional<PaymentError::ContactField> contactField, Vector<PaymentError>& errors) >+static inline void appendShippingContactInvalidError(String&& message, WTF::Optional<PaymentError::ContactField> contactField, Vector<PaymentError>& errors) > { > if (!message.isNull()) > errors.append({ PaymentError::Code::ShippingContactInvalid, WTFMove(message), WTFMove(contactField) }); >@@ -347,7 +347,7 @@ void ApplePayPaymentHandler::computeAddressErrors(String&& error, AddressErrors& > return; > > using ContactField = PaymentError::ContactField; >- appendShippingContactInvalidError(WTFMove(error), std::nullopt, errors); >+ appendShippingContactInvalidError(WTFMove(error), WTF::nullopt, errors); > appendShippingContactInvalidError(WTFMove(addressErrors.addressLine), ContactField::AddressLines, errors); > appendShippingContactInvalidError(WTFMove(addressErrors.city), ContactField::Locality, errors); > appendShippingContactInvalidError(WTFMove(addressErrors.country), ContactField::Country, errors); >@@ -485,11 +485,11 @@ ExceptionOr<void> ApplePayPaymentHandler::paymentMethodUpdated() > return { }; > } > >-void ApplePayPaymentHandler::complete(std::optional<PaymentComplete>&& result) >+void ApplePayPaymentHandler::complete(WTF::Optional<PaymentComplete>&& result) > { > if (!result) { >- ASSERT(isFinalStateResult(std::nullopt)); >- paymentCoordinator().completePaymentSession(std::nullopt); >+ ASSERT(isFinalStateResult(WTF::nullopt)); >+ paymentCoordinator().completePaymentSession(WTF::nullopt); > return; > } > >@@ -521,7 +521,7 @@ ExceptionOr<void> ApplePayPaymentHandler::retry(PaymentValidationErrors&& valida > > // Ensure there is always at least one error to avoid having a final result. > if (errors.isEmpty()) >- errors.append({ PaymentError::Code::Unknown, { }, std::nullopt }); >+ errors.append({ PaymentError::Code::Unknown, { }, WTF::nullopt }); > > PaymentAuthorizationResult authorizationResult { PaymentAuthorizationStatus::Failure, WTFMove(errors) }; > ASSERT(!isFinalStateResult(authorizationResult)); >diff --git a/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h b/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h >index 5f42ac6e0d71319d768ad0a9ada8efb22ec73b4d..3e9707a9cfc196434fb7073ee3fcd5afd3ec419b 100644 >--- a/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h >+++ b/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h >@@ -70,7 +70,7 @@ private: > void canMakePayment(WTF::Function<void(bool)>&& completionHandler) final; > ExceptionOr<void> detailsUpdated(PaymentRequest::UpdateReason, String&& error, AddressErrors&&, PayerErrorFields&&, JSC::JSObject* paymentMethodErrors) final; > ExceptionOr<void> merchantValidationCompleted(JSC::JSValue&&) final; >- void complete(std::optional<PaymentComplete>&&) final; >+ void complete(WTF::Optional<PaymentComplete>&&) final; > ExceptionOr<void> retry(PaymentValidationErrors&&) final; > > // PaymentSession >@@ -84,8 +84,8 @@ private: > > PaymentRequest::MethodIdentifier m_identifier; > Ref<PaymentRequest> m_paymentRequest; >- std::optional<ApplePayRequest> m_applePayRequest; >- std::optional<ApplePayPaymentMethodType> m_selectedPaymentMethodType; >+ WTF::Optional<ApplePayRequest> m_applePayRequest; >+ WTF::Optional<ApplePayPaymentMethodType> m_selectedPaymentMethodType; > bool m_isUpdating { false }; > }; > >diff --git a/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h b/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h >index b2f1b49f3eb3a3ee80a4fb329f69e8bf8e51a98a..735aafb811252ad99b7ec16752d0f46d4d1a24f0 100644 >--- a/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h >+++ b/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h >@@ -49,7 +49,7 @@ struct ApplicationManifest { > URL startURL; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ApplicationManifest> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ApplicationManifest> decode(Decoder&); > }; > > template<class Encoder> >@@ -59,22 +59,22 @@ void ApplicationManifest::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ApplicationManifest> ApplicationManifest::decode(Decoder& decoder) >+WTF::Optional<ApplicationManifest> ApplicationManifest::decode(Decoder& decoder) > { > ApplicationManifest result; > > if (!decoder.decode(result.name)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.shortName)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.description)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.scope)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decodeEnum(result.display)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.startURL)) >- return std::nullopt; >+ return WTF::nullopt; > > return result; > } >diff --git a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >index 48976d2a352e20de414a6bf98e566ee470475e06..daf3bf285eba124543a03e3d77f04b81ab4a94ee 100644 >--- a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >+++ b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >@@ -98,7 +98,7 @@ void NavigatorBeacon::logError(const ResourceError& error) > document->addConsoleMessage(MessageSource::Network, MessageLevel::Error, makeString("Beacon API cannot load "_s, error.failingURL().string(), messageMiddle, description)); > } > >-ExceptionOr<bool> NavigatorBeacon::sendBeacon(Document& document, const String& url, std::optional<FetchBody::Init>&& body) >+ExceptionOr<bool> NavigatorBeacon::sendBeacon(Document& document, const String& url, WTF::Optional<FetchBody::Init>&& body) > { > URL parsedUrl = document.completeURL(url); > >@@ -153,7 +153,7 @@ ExceptionOr<bool> NavigatorBeacon::sendBeacon(Document& document, const String& > return true; > } > >-ExceptionOr<bool> NavigatorBeacon::sendBeacon(Navigator& navigator, Document& document, const String& url, std::optional<FetchBody::Init>&& body) >+ExceptionOr<bool> NavigatorBeacon::sendBeacon(Navigator& navigator, Document& document, const String& url, WTF::Optional<FetchBody::Init>&& body) > { > return NavigatorBeacon::from(navigator)->sendBeacon(document, url, WTFMove(body)); > } >diff --git a/Source/WebCore/Modules/beacon/NavigatorBeacon.h b/Source/WebCore/Modules/beacon/NavigatorBeacon.h >index 349f643489811f6625c8f15646b6f1b833a3412f..f155d2238897168669ee524a6bc0f91bf413ff3e 100644 >--- a/Source/WebCore/Modules/beacon/NavigatorBeacon.h >+++ b/Source/WebCore/Modules/beacon/NavigatorBeacon.h >@@ -43,10 +43,10 @@ class NavigatorBeacon final : public Supplement<Navigator>, private CachedRawRes > public: > explicit NavigatorBeacon(Navigator&); > ~NavigatorBeacon(); >- static ExceptionOr<bool> sendBeacon(Navigator&, Document&, const String& url, std::optional<FetchBody::Init>&&); >+ static ExceptionOr<bool> sendBeacon(Navigator&, Document&, const String& url, WTF::Optional<FetchBody::Init>&&); > > private: >- ExceptionOr<bool> sendBeacon(Document&, const String& url, std::optional<FetchBody::Init>&&); >+ ExceptionOr<bool> sendBeacon(Document&, const String& url, WTF::Optional<FetchBody::Init>&&); > > static NavigatorBeacon* from(Navigator&); > static const char* supplementName(); >diff --git a/Source/WebCore/Modules/cache/DOMCache.cpp b/Source/WebCore/Modules/cache/DOMCache.cpp >index 87310a6b68677cd9667da991375c3f1ecf61b4d8..138c47bd4b0758b571538fd38989a9320d5c5586 100644 >--- a/Source/WebCore/Modules/cache/DOMCache.cpp >+++ b/Source/WebCore/Modules/cache/DOMCache.cpp >@@ -103,7 +103,7 @@ Vector<Ref<FetchResponse>> DOMCache::cloneResponses(const Vector<CacheStorageRec > }); > } > >-void DOMCache::matchAll(std::optional<RequestInfo>&& info, CacheQueryOptions&& options, MatchAllPromise&& promise) >+void DOMCache::matchAll(WTF::Optional<RequestInfo>&& info, CacheQueryOptions&& options, MatchAllPromise&& promise) > { > if (UNLIKELY(!scriptExecutionContext())) > return; >@@ -119,7 +119,7 @@ void DOMCache::matchAll(std::optional<RequestInfo>&& info, CacheQueryOptions&& o > } > > if (!request) { >- retrieveRecords(URL { }, [this, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable { >+ retrieveRecords(URL { }, [this, promise = WTFMove(promise)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > promise.reject(WTFMove(exception.value())); > return; >@@ -393,7 +393,7 @@ static inline Ref<FetchRequest> copyRequestRef(const CacheStorageRecord& record) > return record.request.copyRef(); > } > >-void DOMCache::keys(std::optional<RequestInfo>&& info, CacheQueryOptions&& options, KeysPromise&& promise) >+void DOMCache::keys(WTF::Optional<RequestInfo>&& info, CacheQueryOptions&& options, KeysPromise&& promise) > { > if (UNLIKELY(!scriptExecutionContext())) > return; >@@ -409,7 +409,7 @@ void DOMCache::keys(std::optional<RequestInfo>&& info, CacheQueryOptions&& optio > } > > if (!request) { >- retrieveRecords(URL { }, [this, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable { >+ retrieveRecords(URL { }, [this, promise = WTFMove(promise)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > promise.reject(WTFMove(exception.value())); > return; >@@ -429,7 +429,7 @@ void DOMCache::keys(std::optional<RequestInfo>&& info, CacheQueryOptions&& optio > }); > } > >-void DOMCache::retrieveRecords(const URL& url, WTF::Function<void(std::optional<Exception>&&)>&& callback) >+void DOMCache::retrieveRecords(const URL& url, WTF::Function<void(WTF::Optional<Exception>&&)>&& callback) > { > setPendingActivity(this); > >@@ -445,7 +445,7 @@ void DOMCache::retrieveRecords(const URL& url, WTF::Function<void(std::optional< > > if (result.has_value()) > updateRecords(WTFMove(result.value())); >- callback(std::nullopt); >+ callback(WTF::nullopt); > } > unsetPendingActivity(this); > }); >@@ -454,7 +454,7 @@ void DOMCache::retrieveRecords(const URL& url, WTF::Function<void(std::optional< > void DOMCache::queryCache(Ref<FetchRequest>&& request, CacheQueryOptions&& options, WTF::Function<void(ExceptionOr<Vector<CacheStorageRecord>>&&)>&& callback) > { > auto url = request->url(); >- retrieveRecords(url, [this, request = WTFMove(request), options = WTFMove(options), callback = WTFMove(callback)](std::optional<Exception>&& exception) mutable { >+ retrieveRecords(url, [this, request = WTFMove(request), options = WTFMove(options), callback = WTFMove(callback)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > callback(WTFMove(exception.value())); > return; >@@ -549,7 +549,7 @@ void DOMCache::updateRecords(Vector<Record>&& records) > if (index != notFound) { > auto& current = m_records[index]; > if (current.updateResponseCounter != record.updateResponseCounter) { >- auto response = FetchResponse::create(*scriptExecutionContext(), std::nullopt, record.responseHeadersGuard, WTFMove(record.response)); >+ auto response = FetchResponse::create(*scriptExecutionContext(), WTF::nullopt, record.responseHeadersGuard, WTFMove(record.response)); > response->setBodyData(WTFMove(record.responseBody), record.responseBodySize); > > current.response = WTFMove(response); >@@ -558,9 +558,9 @@ void DOMCache::updateRecords(Vector<Record>&& records) > newRecords.append(WTFMove(current)); > } else { > auto requestHeaders = FetchHeaders::create(record.requestHeadersGuard, HTTPHeaderMap { record.request.httpHeaderFields() }); >- auto request = FetchRequest::create(*scriptExecutionContext(), std::nullopt, WTFMove(requestHeaders), WTFMove(record.request), WTFMove(record.options), WTFMove(record.referrer)); >+ auto request = FetchRequest::create(*scriptExecutionContext(), WTF::nullopt, WTFMove(requestHeaders), WTFMove(record.request), WTFMove(record.options), WTFMove(record.referrer)); > >- auto response = FetchResponse::create(*scriptExecutionContext(), std::nullopt, record.responseHeadersGuard, WTFMove(record.response)); >+ auto response = FetchResponse::create(*scriptExecutionContext(), WTF::nullopt, record.responseHeadersGuard, WTFMove(record.response)); > response->setBodyData(WTFMove(record.responseBody), record.responseBodySize); > > newRecords.append(CacheStorageRecord { record.identifier, record.updateResponseCounter, WTFMove(request), WTFMove(response) }); >diff --git a/Source/WebCore/Modules/cache/DOMCache.h b/Source/WebCore/Modules/cache/DOMCache.h >index 4f5adf86895a07d4697502431198dd66f3a0c226..9051589850965613a7552dee5a5754e216def688 100644 >--- a/Source/WebCore/Modules/cache/DOMCache.h >+++ b/Source/WebCore/Modules/cache/DOMCache.h >@@ -45,13 +45,13 @@ public: > void match(RequestInfo&&, CacheQueryOptions&&, Ref<DeferredPromise>&&); > > using MatchAllPromise = DOMPromiseDeferred<IDLSequence<IDLInterface<FetchResponse>>>; >- void matchAll(std::optional<RequestInfo>&&, CacheQueryOptions&&, MatchAllPromise&&); >+ void matchAll(WTF::Optional<RequestInfo>&&, CacheQueryOptions&&, MatchAllPromise&&); > void add(RequestInfo&&, DOMPromiseDeferred<void>&&); > > void addAll(Vector<RequestInfo>&&, DOMPromiseDeferred<void>&&); > void put(RequestInfo&&, Ref<FetchResponse>&&, DOMPromiseDeferred<void>&&); > void remove(RequestInfo&&, CacheQueryOptions&&, DOMPromiseDeferred<IDLBoolean>&&); >- void keys(std::optional<RequestInfo>&&, CacheQueryOptions&&, KeysPromise&&); >+ void keys(WTF::Optional<RequestInfo>&&, CacheQueryOptions&&, KeysPromise&&); > > const String& name() const { return m_name; } > uint64_t identifier() const { return m_identifier; } >@@ -71,7 +71,7 @@ private: > > void putWithResponseData(DOMPromiseDeferred<void>&&, Ref<FetchRequest>&&, Ref<FetchResponse>&&, ExceptionOr<RefPtr<SharedBuffer>>&&); > >- void retrieveRecords(const URL&, WTF::Function<void(std::optional<Exception>&&)>&&); >+ void retrieveRecords(const URL&, WTF::Function<void(WTF::Optional<Exception>&&)>&&); > Vector<CacheStorageRecord> queryCacheWithTargetStorage(const FetchRequest&, const CacheQueryOptions&, const Vector<CacheStorageRecord>&); > void queryCache(Ref<FetchRequest>&&, CacheQueryOptions&&, WTF::Function<void(ExceptionOr<Vector<CacheStorageRecord>>&&)>&&); > void batchDeleteOperation(const FetchRequest&, CacheQueryOptions&&, WTF::Function<void(ExceptionOr<bool>&&)>&&); >diff --git a/Source/WebCore/Modules/cache/DOMCacheEngine.h b/Source/WebCore/Modules/cache/DOMCacheEngine.h >index ca5cd7c7ce55dac5a7f738862e9e658d19577c00..437a44f96843371d57ec0202f1bd114bdb90c77a 100644 >--- a/Source/WebCore/Modules/cache/DOMCacheEngine.h >+++ b/Source/WebCore/Modules/cache/DOMCacheEngine.h >@@ -82,7 +82,7 @@ struct CacheInfos { > CacheInfos isolatedCopy(); > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<CacheInfos> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<CacheInfos> decode(Decoder&); > > Vector<CacheInfo> infos; > uint64_t updateCounter; >@@ -90,7 +90,7 @@ struct CacheInfos { > > struct CacheIdentifierOperationResult { > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<CacheIdentifierOperationResult> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<CacheIdentifierOperationResult> decode(Decoder&); > > uint64_t identifier { 0 }; > // True in case storing cache list on the filesystem failed. >@@ -110,7 +110,7 @@ using CacheInfosCallback = WTF::Function<void(CacheInfosOrError&&)>; > using RecordsOrError = Expected<Vector<Record>, Error>; > using RecordsCallback = WTF::Function<void(RecordsOrError&&)>; > >-using CompletionCallback = WTF::Function<void(std::optional<Error>&&)>; >+using CompletionCallback = WTF::Function<void(WTF::Optional<Error>&&)>; > > template<class Encoder> inline void CacheInfos::encode(Encoder& encoder) const > { >@@ -118,17 +118,17 @@ template<class Encoder> inline void CacheInfos::encode(Encoder& encoder) const > encoder << updateCounter; > } > >-template<class Decoder> inline std::optional<CacheInfos> CacheInfos::decode(Decoder& decoder) >+template<class Decoder> inline WTF::Optional<CacheInfos> CacheInfos::decode(Decoder& decoder) > { >- std::optional<Vector<CacheInfo>> infos; >+ WTF::Optional<Vector<CacheInfo>> infos; > decoder >> infos; > if (!infos) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> updateCounter; >+ WTF::Optional<uint64_t> updateCounter; > decoder >> updateCounter; > if (!updateCounter) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*infos), WTFMove(*updateCounter) }}; > } >@@ -139,17 +139,17 @@ template<class Encoder> inline void CacheIdentifierOperationResult::encode(Encod > encoder << hadStorageError; > } > >-template<class Decoder> inline std::optional<CacheIdentifierOperationResult> CacheIdentifierOperationResult::decode(Decoder& decoder) >+template<class Decoder> inline WTF::Optional<CacheIdentifierOperationResult> CacheIdentifierOperationResult::decode(Decoder& decoder) > { >- std::optional<uint64_t> identifier; >+ WTF::Optional<uint64_t> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> hadStorageError; >+ WTF::Optional<bool> hadStorageError; > decoder >> hadStorageError; > if (!hadStorageError) >- return std::nullopt; >+ return WTF::nullopt; > return {{ WTFMove(*identifier), WTFMove(*hadStorageError) }}; > } > >diff --git a/Source/WebCore/Modules/cache/DOMCacheStorage.cpp b/Source/WebCore/Modules/cache/DOMCacheStorage.cpp >index 27e8f0293c083f748721f52e5cdb666ef91b78fe..06924ecc3944f795820b4f224dd4bf53b22d5aaa 100644 >--- a/Source/WebCore/Modules/cache/DOMCacheStorage.cpp >+++ b/Source/WebCore/Modules/cache/DOMCacheStorage.cpp >@@ -43,11 +43,11 @@ DOMCacheStorage::DOMCacheStorage(ScriptExecutionContext& context, Ref<CacheStora > suspendIfNeeded(); > } > >-std::optional<ClientOrigin> DOMCacheStorage::origin() const >+WTF::Optional<ClientOrigin> DOMCacheStorage::origin() const > { > auto* origin = scriptExecutionContext() ? scriptExecutionContext()->securityOrigin() : nullptr; > if (!origin) >- return std::nullopt; >+ return WTF::nullopt; > > return ClientOrigin { scriptExecutionContext()->topOrigin().data(), origin->data() }; > } >@@ -84,7 +84,7 @@ static inline Ref<DOMCache> copyCache(const Ref<DOMCache>& cache) > > void DOMCacheStorage::match(DOMCache::RequestInfo&& info, CacheQueryOptions&& options, Ref<DeferredPromise>&& promise) > { >- retrieveCaches([this, info = WTFMove(info), options = WTFMove(options), promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable { >+ retrieveCaches([this, info = WTFMove(info), options = WTFMove(options), promise = WTFMove(promise)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > promise->reject(WTFMove(exception.value())); > return; >@@ -119,7 +119,7 @@ void DOMCacheStorage::match(DOMCache::RequestInfo&& info, CacheQueryOptions&& op > > void DOMCacheStorage::has(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise) > { >- retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable { >+ retrieveCaches([this, name, promise = WTFMove(promise)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > promise.reject(WTFMove(exception.value())); > return; >@@ -136,7 +136,7 @@ Ref<DOMCache> DOMCacheStorage::findCacheOrCreate(CacheInfo&& info) > return DOMCache::create(*scriptExecutionContext(), WTFMove(info.name), info.identifier, m_connection.copyRef()); > } > >-void DOMCacheStorage::retrieveCaches(WTF::Function<void(std::optional<Exception>&&)>&& callback) >+void DOMCacheStorage::retrieveCaches(WTF::Function<void(WTF::Optional<Exception>&&)>&& callback) > { > auto origin = this->origin(); > if (!origin) >@@ -158,7 +158,7 @@ void DOMCacheStorage::retrieveCaches(WTF::Function<void(std::optional<Exception> > return findCacheOrCreate(WTFMove(info)); > }); > } >- callback(std::nullopt); >+ callback(WTF::nullopt); > } > }); > } >@@ -173,7 +173,7 @@ static void logConsolePersistencyError(ScriptExecutionContext* context, const St > > void DOMCacheStorage::open(const String& name, DOMPromiseDeferred<IDLInterface<DOMCache>>&& promise) > { >- retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable { >+ retrieveCaches([this, name, promise = WTFMove(promise)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > promise.reject(WTFMove(exception.value())); > return; >@@ -209,7 +209,7 @@ void DOMCacheStorage::doOpen(const String& name, DOMPromiseDeferred<IDLInterface > > void DOMCacheStorage::remove(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise) > { >- retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable { >+ retrieveCaches([this, name, promise = WTFMove(promise)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > promise.reject(WTFMove(exception.value())); > return; >@@ -241,7 +241,7 @@ void DOMCacheStorage::doRemove(const String& name, DOMPromiseDeferred<IDLBoolean > > void DOMCacheStorage::keys(KeysPromise&& promise) > { >- retrieveCaches([this, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable { >+ retrieveCaches([this, promise = WTFMove(promise)](WTF::Optional<Exception>&& exception) mutable { > if (exception) { > promise.reject(WTFMove(exception.value())); > return; >diff --git a/Source/WebCore/Modules/cache/DOMCacheStorage.h b/Source/WebCore/Modules/cache/DOMCacheStorage.h >index f30fd3d326cc6d9f295feb3862462e56161e40e4..16a96ea36f7cf08bcc111aa0abccfb7a06688adc 100644 >--- a/Source/WebCore/Modules/cache/DOMCacheStorage.h >+++ b/Source/WebCore/Modules/cache/DOMCacheStorage.h >@@ -54,9 +54,9 @@ private: > > void doOpen(const String& name, DOMPromiseDeferred<IDLInterface<DOMCache>>&&); > void doRemove(const String&, DOMPromiseDeferred<IDLBoolean>&&); >- void retrieveCaches(WTF::Function<void(std::optional<Exception>&&)>&&); >+ void retrieveCaches(WTF::Function<void(WTF::Optional<Exception>&&)>&&); > Ref<DOMCache> findCacheOrCreate(DOMCacheEngine::CacheInfo&&); >- std::optional<ClientOrigin> origin() const; >+ WTF::Optional<ClientOrigin> origin() const; > > Vector<Ref<DOMCache>> m_caches; > uint64_t m_updateCounter { 0 }; >diff --git a/Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h b/Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h >index a8653392bcd31d6eb5d525130156b063dfb0898e..85b0f683df7ea51c3c9252319dd9eb5626811773 100644 >--- a/Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h >+++ b/Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h >@@ -36,7 +36,7 @@ namespace WebCore { > > struct CredentialCreationOptions { > RefPtr<AbortSignal> signal; >- std::optional<PublicKeyCredentialCreationOptions> publicKey; >+ WTF::Optional<PublicKeyCredentialCreationOptions> publicKey; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h b/Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h >index 81c94eaafa759dd8d269553ae318b68f41fdd583..c45f65dc8cfcb9c90fed4a7dc1b6a7ee39841e0c 100644 >--- a/Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h >+++ b/Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h >@@ -40,7 +40,7 @@ struct CredentialRequestOptions { > > MediationRequirement mediation; > RefPtr<AbortSignal> signal; >- std::optional<PublicKeyCredentialRequestOptions> publicKey; >+ WTF::Optional<PublicKeyCredentialRequestOptions> publicKey; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/encryptedmedia/CDM.cpp b/Source/WebCore/Modules/encryptedmedia/CDM.cpp >index 34cf3d367818289853556a673caceca7a7af830f..57d7cb13e2ef3abc88d74fab1daee845a4bc669c 100644 >--- a/Source/WebCore/Modules/encryptedmedia/CDM.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/CDM.cpp >@@ -102,13 +102,13 @@ void CDM::doSupportedConfigurationStep(MediaKeySystemConfiguration&& candidateCo > // restrictions and origin. > auto optionalConfiguration = getSupportedConfiguration(candidateConfiguration, restrictions); > if (!optionalConfiguration) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > > auto consentCallback = [weakThis = makeWeakPtr(*this), callback = WTFMove(callback)] (ConsentStatus status, MediaKeySystemConfiguration&& configuration, MediaKeysRestrictions&& restrictions) mutable { > if (!weakThis) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > // 3.1.1.2 Get Supported Configuration and Consent, ctd. >@@ -162,14 +162,14 @@ bool CDM::isPersistentType(MediaKeySessionType sessionType) > return false; > } > >-std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const MediaKeySystemConfiguration& candidateConfiguration, MediaKeysRestrictions& restrictions) >+WTF::Optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const MediaKeySystemConfiguration& candidateConfiguration, MediaKeysRestrictions& restrictions) > { > // https://w3c.github.io/encrypted-media/#get-supported-configuration-and-consent > // W3C Editor's Draft 09 November 2016 > > ASSERT(m_private); > if (!m_private) >- return std::nullopt; >+ return WTF::nullopt; > > // 3.1.1.2 Get Supported Configuration and Consent > // Given a Key Systems implementation implementation, MediaKeySystemConfiguration candidate configuration, >@@ -201,7 +201,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > > // 3.3. If supported types is empty, return NotSupported. > if (supportedTypes.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > // 3.4. Set the initDataTypes member of accumulated configuration to supported types. > accumulatedConfiguration.initDataTypes = WTFMove(supportedTypes); >@@ -222,7 +222,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > // If the implementation does not support use of Distinctive Identifier(s) in combination > // with accumulated configuration and restrictions, return NotSupported. > if (m_private->distinctiveIdentifiersRequirement(accumulatedConfiguration, restrictions) == MediaKeysRequirement::NotAllowed) >- return std::nullopt; >+ return WTF::nullopt; > break; > > case MediaKeysRequirement::Optional: >@@ -235,7 +235,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > // If the implementation requires use Distinctive Identifier(s) or Distinctive Permanent Identifier(s) > // in combination with accumulated configuration and restrictions, return NotSupported. > if (m_private->distinctiveIdentifiersRequirement(accumulatedConfiguration, restrictions) == MediaKeysRequirement::Required) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > >@@ -257,7 +257,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > // If the implementation does not support persisting state in combination with accumulated configuration > // and restrictions, return NotSupported. > if (m_private->persistentStateRequirement(accumulatedConfiguration, restrictions) == MediaKeysRequirement::NotAllowed) >- return std::nullopt; >+ return WTF::nullopt; > break; > > case MediaKeysRequirement::Optional: >@@ -270,7 +270,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > // If the implementation requires persisting state in combination with accumulated configuration > // and restrictions, return NotSupported > if (m_private->persistentStateRequirement(accumulatedConfiguration, restrictions) == MediaKeysRequirement::Required) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > >@@ -296,12 +296,12 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > // 13.2. If accumulated configuration's persistentState value is "not-allowed" and the > // Is persistent session type? algorithm returns true for session type return NotSupported. > if (accumulatedConfiguration.persistentState == MediaKeysRequirement::NotAllowed && isPersistentType(sessionType)) >- return std::nullopt; >+ return WTF::nullopt; > > // 13.3. If the implementation does not support session type in combination with accumulated configuration > // and restrictions for other reasons, return NotSupported. > if (!m_private->supportsSessionTypeWithConfiguration(sessionType, accumulatedConfiguration)) >- return std::nullopt; >+ return WTF::nullopt; > > // 13.4 If accumulated configuration's persistentState value is "optional" and the result of running the Is > // persistent session type? algorithm on session type is true, change accumulated configuration's persistentState >@@ -315,7 +315,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > > // 15. If the videoCapabilities and audioCapabilities members in candidate configuration are both empty, return NotSupported. > if (candidateConfiguration.videoCapabilities.isEmpty() && candidateConfiguration.audioCapabilities.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > // 16. â³ If the videoCapabilities member in candidate configuration is non-empty: > if (!candidateConfiguration.videoCapabilities.isEmpty()) { >@@ -325,7 +325,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > > // 16.2. If video capabilities is null, return NotSupported. > if (!videoCapabilities) >- return std::nullopt; >+ return WTF::nullopt; > > // 16.3 Set the videoCapabilities member of accumulated configuration to video capabilities. > accumulatedConfiguration.videoCapabilities = WTFMove(videoCapabilities.value()); >@@ -343,7 +343,7 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > > // 17.2. If audio capabilities is null, return NotSupported. > if (!audioCapabilities) >- return std::nullopt; >+ return WTF::nullopt; > > // 17.3 Set the audioCapabilities member of accumulated configuration to audio capabilities. > accumulatedConfiguration.audioCapabilities = WTFMove(audioCapabilities.value()); >@@ -385,30 +385,30 @@ std::optional<MediaKeySystemConfiguration> CDM::getSupportedConfiguration(const > // 20. If implementation in the configuration specified by the combination of the values in accumulated configuration > // is not supported or not allowed in the origin, return NotSupported. > if (!m_private->supportsConfiguration(accumulatedConfiguration)) >- return std::nullopt; >+ return WTF::nullopt; > > Document* document = downcast<Document>(m_scriptExecutionContext); > if (!document) >- return std::nullopt; >+ return WTF::nullopt; > > SecurityOrigin& origin = document->securityOrigin(); > SecurityOrigin& topOrigin = document->topOrigin(); > > if ((accumulatedConfiguration.distinctiveIdentifier == MediaKeysRequirement::Required || accumulatedConfiguration.persistentState == MediaKeysRequirement::Required) && !origin.canAccessLocalStorage(&topOrigin)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(accumulatedConfiguration); > // NOTE: Continued in getConsentStatus(). > } > >-std::optional<Vector<MediaKeySystemMediaCapability>> CDM::getSupportedCapabilitiesForAudioVideoType(CDM::AudioVideoType type, const Vector<MediaKeySystemMediaCapability>& requestedCapabilities, const MediaKeySystemConfiguration& partialConfiguration, MediaKeysRestrictions& restrictions) >+WTF::Optional<Vector<MediaKeySystemMediaCapability>> CDM::getSupportedCapabilitiesForAudioVideoType(CDM::AudioVideoType type, const Vector<MediaKeySystemMediaCapability>& requestedCapabilities, const MediaKeySystemConfiguration& partialConfiguration, MediaKeysRestrictions& restrictions) > { > // https://w3c.github.io/encrypted-media/#get-supported-capabilities-for-audio-video-type > // W3C Editor's Draft 09 November 2016 > > ASSERT(m_private); > if (!m_private) >- return std::nullopt; >+ return WTF::nullopt; > > // 3.1.1.3 Get Supported Capabilities for Audio/Video Type > >@@ -430,7 +430,7 @@ std::optional<Vector<MediaKeySystemMediaCapability>> CDM::getSupportedCapabiliti > > // 3.3. If content type is the empty string, return null. > if (requestedCapability.contentType.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > // 3.4. If content type is an invalid or unrecognized MIME type, continue to the next iteration. > if (!isValidContentType(requestedCapability.contentType)) >@@ -493,7 +493,7 @@ std::optional<Vector<MediaKeySystemMediaCapability>> CDM::getSupportedCapabiliti > > // 4. If supported media capabilities is empty, return null. > if (supportedMediaCapabilities.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > // 5. Return supported media capabilities. > return supportedMediaCapabilities; >@@ -631,10 +631,10 @@ RefPtr<SharedBuffer> CDM::sanitizeResponse(const SharedBuffer& response) > return m_private->sanitizeResponse(response); > } > >-std::optional<String> CDM::sanitizeSessionId(const String& sessionId) >+WTF::Optional<String> CDM::sanitizeSessionId(const String& sessionId) > { > if (!m_private) >- return std::nullopt; >+ return WTF::nullopt; > return m_private->sanitizeSessionId(sessionId); > } > >diff --git a/Source/WebCore/Modules/encryptedmedia/CDM.h b/Source/WebCore/Modules/encryptedmedia/CDM.h >index e1558c5c2b04f3ebf9b56bcac9c07576897e407d..2c6a168ca92597163701bbe8e955985ebcdb0cdb 100644 >--- a/Source/WebCore/Modules/encryptedmedia/CDM.h >+++ b/Source/WebCore/Modules/encryptedmedia/CDM.h >@@ -57,7 +57,7 @@ public: > static Ref<CDM> create(Document&, const String& keySystem); > ~CDM(); > >- using SupportedConfigurationCallback = WTF::Function<void(std::optional<MediaKeySystemConfiguration>)>; >+ using SupportedConfigurationCallback = WTF::Function<void(WTF::Optional<MediaKeySystemConfiguration>)>; > void getSupportedConfiguration(MediaKeySystemConfiguration&& candidateConfiguration, SupportedConfigurationCallback&&); > > const String& keySystem() const { return m_keySystem; } >@@ -73,7 +73,7 @@ public: > > RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&); > >- std::optional<String> sanitizeSessionId(const String& sessionId); >+ WTF::Optional<String> sanitizeSessionId(const String& sessionId); > > String storageDirectory() const; > >@@ -98,8 +98,8 @@ private: > }; > > void doSupportedConfigurationStep(MediaKeySystemConfiguration&& candidateConfiguration, MediaKeysRestrictions&&, SupportedConfigurationCallback&&); >- std::optional<MediaKeySystemConfiguration> getSupportedConfiguration(const MediaKeySystemConfiguration& candidateConfiguration, MediaKeysRestrictions&); >- std::optional<Vector<MediaKeySystemMediaCapability>> getSupportedCapabilitiesForAudioVideoType(AudioVideoType, const Vector<MediaKeySystemMediaCapability>& requestedCapabilities, const MediaKeySystemConfiguration& partialConfiguration, MediaKeysRestrictions&); >+ WTF::Optional<MediaKeySystemConfiguration> getSupportedConfiguration(const MediaKeySystemConfiguration& candidateConfiguration, MediaKeysRestrictions&); >+ WTF::Optional<Vector<MediaKeySystemMediaCapability>> getSupportedCapabilitiesForAudioVideoType(AudioVideoType, const Vector<MediaKeySystemMediaCapability>& requestedCapabilities, const MediaKeySystemConfiguration& partialConfiguration, MediaKeysRestrictions&); > > using ConsentStatusCallback = WTF::Function<void(ConsentStatus, MediaKeySystemConfiguration&&, MediaKeysRestrictions&&)>; > void getConsentStatus(MediaKeySystemConfiguration&& accumulatedConfiguration, MediaKeysRestrictions&&, ConsentStatusCallback&&); >diff --git a/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp b/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp >index 01f883cec68bd9f3fb6efa686d7947e61daa6744..2e77068502ba5459cfc26c754db97b71cee24018 100644 >--- a/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp >@@ -49,25 +49,25 @@ namespace { > const uint32_t kKeyIdsMaxKeyIdSizeInBytes = 512; > } > >-static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsKeyids(const SharedBuffer& buffer) >+static WTF::Optional<Vector<Ref<SharedBuffer>>> extractKeyIDsKeyids(const SharedBuffer& buffer) > { > // 1. Format > // https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html#format > if (buffer.size() > std::numeric_limits<unsigned>::max()) >- return std::nullopt; >+ return WTF::nullopt; > String json { buffer.data(), static_cast<unsigned>(buffer.size()) }; > > RefPtr<JSON::Value> value; > if (!JSON::Value::parseJSON(json, value)) >- return std::nullopt; >+ return WTF::nullopt; > > RefPtr<JSON::Object> object; > if (!value->asObject(object)) >- return std::nullopt; >+ return WTF::nullopt; > > RefPtr<JSON::Array> kidsArray; > if (!object->getArray("kids", kidsArray)) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<Ref<SharedBuffer>> keyIDs; > for (auto& value : *kidsArray) { >@@ -80,7 +80,7 @@ static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsKeyids(const Shared > continue; > > if (keyIDData.size() < kKeyIdsMinKeyIdSizeInBytes || keyIDData.size() > kKeyIdsMaxKeyIdSizeInBytes) >- return std::nullopt; >+ return WTF::nullopt; > > Ref<SharedBuffer> keyIDBuffer = SharedBuffer::create(WTFMove(keyIDData)); > keyIDs.append(WTFMove(keyIDBuffer)); >@@ -107,12 +107,12 @@ static RefPtr<SharedBuffer> sanitizeKeyids(const SharedBuffer& buffer) > return SharedBuffer::create(jsonData.data(), jsonData.length()); > } > >-static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsCenc(const SharedBuffer& buffer) >+static WTF::Optional<Vector<Ref<SharedBuffer>>> extractKeyIDsCenc(const SharedBuffer& buffer) > { > // 4. Common SystemID and PSSH Box Format > // https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html#common-system > if (buffer.size() >= kCencMaxBoxSize) >- return std::nullopt; >+ return WTF::nullopt; > > unsigned offset = 0; > Vector<Ref<SharedBuffer>> keyIDs; >@@ -123,11 +123,11 @@ static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsCenc(const SharedBu > auto& boxSize = optionalBoxType.value().second; > > if (boxTypeName != ISOProtectionSystemSpecificHeaderBox::boxTypeName() || boxSize > buffer.size()) >- return std::nullopt; >+ return WTF::nullopt; > > ISOProtectionSystemSpecificHeaderBox psshBox; > if (!psshBox.read(view, offset)) >- return std::nullopt; >+ return WTF::nullopt; > > for (auto& value : psshBox.keyIDs()) > keyIDs.append(SharedBuffer::create(WTFMove(value))); >@@ -156,12 +156,12 @@ static RefPtr<SharedBuffer> sanitizeWebM(const SharedBuffer& buffer) > return buffer.copy(); > } > >-static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsWebM(const SharedBuffer& buffer) >+static WTF::Optional<Vector<Ref<SharedBuffer>>> extractKeyIDsWebM(const SharedBuffer& buffer) > { > Vector<Ref<SharedBuffer>> keyIDs; > RefPtr<SharedBuffer> sanitizedBuffer = sanitizeWebM(buffer); > if (!sanitizedBuffer) >- return std::nullopt; >+ return WTF::nullopt; > > // 1. Format > // https://w3c.github.io/encrypted-media/format-registry/initdata/webm.html#format >@@ -192,11 +192,11 @@ RefPtr<SharedBuffer> InitDataRegistry::sanitizeInitData(const AtomicString& init > return iter->value.sanitizeInitData(buffer); > } > >-std::optional<Vector<Ref<SharedBuffer>>> InitDataRegistry::extractKeyIDs(const AtomicString& initDataType, const SharedBuffer& buffer) >+WTF::Optional<Vector<Ref<SharedBuffer>>> InitDataRegistry::extractKeyIDs(const AtomicString& initDataType, const SharedBuffer& buffer) > { > auto iter = m_types.find(initDataType); > if (iter == m_types.end() || !iter->value.sanitizeInitData) >- return std::nullopt; >+ return WTF::nullopt; > return iter->value.extractKeyIDs(buffer); > } > >diff --git a/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.h b/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.h >index d1e3584dfe3509dfd2b4b9487068918d45b89223..dd35ccd615173a8c519528a7066ae064b7a6150a 100644 >--- a/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.h >+++ b/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.h >@@ -46,11 +46,11 @@ public: > friend class NeverDestroyed<InitDataRegistry>; > > RefPtr<SharedBuffer> sanitizeInitData(const AtomicString& initDataType, const SharedBuffer&); >- WEBCORE_EXPORT std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDs(const AtomicString& initDataType, const SharedBuffer&); >+ WEBCORE_EXPORT WTF::Optional<Vector<Ref<SharedBuffer>>> extractKeyIDs(const AtomicString& initDataType, const SharedBuffer&); > > struct InitDataTypeCallbacks { > using SanitizeInitDataCallback = Function<RefPtr<SharedBuffer>(const SharedBuffer&)>; >- using ExtractKeyIDsCallback = Function<std::optional<Vector<Ref<SharedBuffer>>>(const SharedBuffer&)>; >+ using ExtractKeyIDsCallback = Function<WTF::Optional<Vector<Ref<SharedBuffer>>>(const SharedBuffer&)>; > > SanitizeInitDataCallback sanitizeInitData; > ExtractKeyIDsCallback extractKeyIDs; >diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp >index d9e96cc6345b92f98c3f10cebc583cb6c5b820de..29180fe888cc4864ff6f3352b68a3fe1e7e4895b 100644 >--- a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp >@@ -275,7 +275,7 @@ void MediaKeySession::load(const String& sessionId, Ref<DeferredPromise>&& promi > m_taskQueue.enqueueTask([this, sessionId, promise = WTFMove(promise)] () mutable { > // 8.1. Let sanitized session ID be a validated and/or sanitized version of sessionId. > // 8.2. If the preceding step failed, or if sanitized session ID is empty, reject promise with a newly created TypeError. >- std::optional<String> sanitizedSessionId = m_implementation->sanitizeSessionId(sessionId); >+ WTF::Optional<String> sanitizedSessionId = m_implementation->sanitizeSessionId(sessionId); > if (!sanitizedSessionId || sanitizedSessionId->isEmpty()) { > promise->reject(TypeError); > return; >@@ -293,7 +293,7 @@ void MediaKeySession::load(const String& sessionId, Ref<DeferredPromise>&& promi > // 8.6. Let message type be null. > // 8.7. Let cdm be the CDM instance represented by this object's cdm instance value. > // 8.8. Use the cdm to execute the following steps: >- m_instanceSession->loadSession(m_sessionType, *sanitizedSessionId, origin, [this, weakThis = makeWeakPtr(*this), promise = WTFMove(promise), sanitizedSessionId = *sanitizedSessionId] (std::optional<CDMInstanceSession::KeyStatusVector>&& knownKeys, std::optional<double>&& expiration, std::optional<CDMInstanceSession::Message>&& message, CDMInstanceSession::SuccessValue succeeded, CDMInstanceSession::SessionLoadFailure failure) mutable { >+ m_instanceSession->loadSession(m_sessionType, *sanitizedSessionId, origin, [this, weakThis = makeWeakPtr(*this), promise = WTFMove(promise), sanitizedSessionId = *sanitizedSessionId] (WTF::Optional<CDMInstanceSession::KeyStatusVector>&& knownKeys, WTF::Optional<double>&& expiration, WTF::Optional<CDMInstanceSession::Message>&& message, CDMInstanceSession::SuccessValue succeeded, CDMInstanceSession::SessionLoadFailure failure) mutable { > // 8.8.1. If there is no data stored for the sanitized session ID in the origin, resolve promise with false and abort these steps. > // 8.8.2. If the stored session's session type is not the same as the current MediaKeySession session type, reject promise with a newly created TypeError. > // 8.8.3. Let session data be the data stored for the sanitized session ID in the origin. This must not include data from other origin(s) or that is not associated with an origin. >@@ -396,7 +396,7 @@ void MediaKeySession::update(const BufferSource& response, Ref<DeferredPromise>& > // 6.5. Let session closed be false. > // 6.6. Let cdm be the CDM instance represented by this object's cdm instance value. > // 6.7. Use the cdm to execute the following steps: >- m_instanceSession->updateLicense(m_sessionId, m_sessionType, *sanitizedResponse, [this, weakThis = makeWeakPtr(*this), promise = WTFMove(promise)] (bool sessionWasClosed, std::optional<CDMInstanceSession::KeyStatusVector>&& changedKeys, std::optional<double>&& changedExpiration, std::optional<CDMInstanceSession::Message>&& message, CDMInstanceSession::SuccessValue succeeded) mutable { >+ m_instanceSession->updateLicense(m_sessionId, m_sessionType, *sanitizedResponse, [this, weakThis = makeWeakPtr(*this), promise = WTFMove(promise)] (bool sessionWasClosed, WTF::Optional<CDMInstanceSession::KeyStatusVector>&& changedKeys, WTF::Optional<double>&& changedExpiration, WTF::Optional<CDMInstanceSession::Message>&& message, CDMInstanceSession::SuccessValue succeeded) mutable { > if (!weakThis) > return; > >@@ -553,7 +553,7 @@ void MediaKeySession::remove(Ref<DeferredPromise>&& promise) > // 4.3. Let message type be null. > > // 4.4. Use the cdm to execute the following steps: >- m_instanceSession->removeSessionData(m_sessionId, m_sessionType, [this, weakThis = makeWeakPtr(*this), promise = WTFMove(promise)] (CDMInstanceSession::KeyStatusVector&& keys, std::optional<Ref<SharedBuffer>>&& message, CDMInstanceSession::SuccessValue succeeded) mutable { >+ m_instanceSession->removeSessionData(m_sessionId, m_sessionType, [this, weakThis = makeWeakPtr(*this), promise = WTFMove(promise)] (CDMInstanceSession::KeyStatusVector&& keys, WTF::Optional<Ref<SharedBuffer>>&& message, CDMInstanceSession::SuccessValue succeeded) mutable { > if (!weakThis) > return; > >diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.cpp b/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.cpp >index fc0451eedc4f43458d7d83b3f09f88d58e36c82f..ec6ecd1e5f486a3df0e4d3342481407bf187bef6 100644 >--- a/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.cpp >@@ -93,14 +93,14 @@ MediaKeyStatusMap::Iterator::Iterator(MediaKeyStatusMap& map) > { > } > >-std::optional<WTF::KeyValuePair<BufferSource::VariantType, MediaKeyStatus>> MediaKeyStatusMap::Iterator::next() >+WTF::Optional<WTF::KeyValuePair<BufferSource::VariantType, MediaKeyStatus>> MediaKeyStatusMap::Iterator::next() > { > if (!m_map->m_session) >- return std::nullopt; >+ return WTF::nullopt; > > auto& statuses = m_map->m_session->statuses(); > if (m_index >= statuses.size()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& pair = statuses[m_index++]; > auto buffer = ArrayBuffer::create(pair.first->data(), pair.first->size()); >diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.h b/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.h >index 906af191dfb1068ca4d4f05f3b95d1e4ff7b85bf..6d93ebc1154cf6da79d22850a9ac124cad5a98ac 100644 >--- a/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.h >+++ b/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.h >@@ -62,7 +62,7 @@ public: > class Iterator { > public: > explicit Iterator(MediaKeyStatusMap&); >- std::optional<WTF::KeyValuePair<BufferSource::VariantType, MediaKeyStatus>> next(); >+ WTF::Optional<WTF::KeyValuePair<BufferSource::VariantType, MediaKeyStatus>> next(); > > private: > Ref<MediaKeyStatusMap> m_map; >diff --git a/Source/WebCore/Modules/encryptedmedia/NavigatorEME.cpp b/Source/WebCore/Modules/encryptedmedia/NavigatorEME.cpp >index af8ff5a0a80ce8baaad07a1d5bca6140cee030e1..06ba0812537793bbb759e4b5c43e6eeb213f26ea 100644 >--- a/Source/WebCore/Modules/encryptedmedia/NavigatorEME.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/NavigatorEME.cpp >@@ -83,7 +83,7 @@ static void tryNextSupportedConfiguration(RefPtr<CDM>&& implementation, Vector<M > MediaKeySystemConfiguration candidateConfiguration = WTFMove(supportedConfigurations.first()); > supportedConfigurations.remove(0); > >- CDM::SupportedConfigurationCallback callback = [implementation = implementation, supportedConfigurations = WTFMove(supportedConfigurations), promise] (std::optional<MediaKeySystemConfiguration> supportedConfiguration) mutable { >+ CDM::SupportedConfigurationCallback callback = [implementation = implementation, supportedConfigurations = WTFMove(supportedConfigurations), promise] (WTF::Optional<MediaKeySystemConfiguration> supportedConfiguration) mutable { > // 6.3.3. If supported configuration is not NotSupported, run the following steps: > if (supportedConfiguration) { > // 6.3.3.1. Let access be a new MediaKeySystemAccess object, and initialize it as follows: >diff --git a/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp b/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp >index 8faf04d03780b00ea256fc3053a3848e7ecc52b9..29d4fe4ce2b45d143e7d7a0edefeba16cb063ff2 100644 >--- a/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp >+++ b/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp >@@ -177,11 +177,11 @@ static ExceptionOr<String> validatePathIsExpectedType(const String& fullPath, St > return WTFMove(virtualPath); > } > >-static std::optional<FileMetadata::Type> fileType(const String& fullPath) >+static WTF::Optional<FileMetadata::Type> fileType(const String& fullPath) > { > auto metadata = FileSystem::fileMetadata(fullPath); > if (!metadata || metadata.value().isHidden) >- return std::nullopt; >+ return WTF::nullopt; > return metadata.value().type; > } > >diff --git a/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h b/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h >index 4fb6479654ee419be59b38ccf57debbe7b6db7b8..c930cdeae5e2d5d9c856131dea5ec7d2ee5fe182 100644 >--- a/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h >+++ b/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h >@@ -56,7 +56,7 @@ private: > bool canSuspendForDocumentSuspension() const final; > > Ref<FileSystemDirectoryEntry> m_directory; >- std::optional<Exception> m_error; >+ WTF::Optional<Exception> m_error; > bool m_isReading { false }; > bool m_isDone { false }; > }; >diff --git a/Source/WebCore/Modules/fetch/FetchBody.cpp b/Source/WebCore/Modules/fetch/FetchBody.cpp >index 07a4cddd1d4b3cf4339f2b0c987a3e1d271af2f0..4fe8e24b912be5194e733a6aa3ed9c1a3e50e196 100644 >--- a/Source/WebCore/Modules/fetch/FetchBody.cpp >+++ b/Source/WebCore/Modules/fetch/FetchBody.cpp >@@ -70,7 +70,7 @@ FetchBody FetchBody::extract(ScriptExecutionContext& context, Init&& value, Stri > }); > } > >-std::optional<FetchBody> FetchBody::fromFormData(FormData& formData) >+WTF::Optional<FetchBody> FetchBody::fromFormData(FormData& formData) > { > ASSERT(!formData.isEmpty()); > >@@ -88,7 +88,7 @@ std::optional<FetchBody> FetchBody::fromFormData(FormData& formData) > } > > // FIXME: Support form data bodies. >- return std::nullopt; >+ return WTF::nullopt; > } > > void FetchBody::arrayBuffer(FetchBodyOwner& owner, Ref<DeferredPromise>&& promise) >diff --git a/Source/WebCore/Modules/fetch/FetchBody.h b/Source/WebCore/Modules/fetch/FetchBody.h >index daad7c42c4779b1a40695d0f150d7f9f4b996c52..706181e62c311fe0fdf1cf38bb62e1895d902785 100644 >--- a/Source/WebCore/Modules/fetch/FetchBody.h >+++ b/Source/WebCore/Modules/fetch/FetchBody.h >@@ -58,7 +58,7 @@ public: > static FetchBody extract(ScriptExecutionContext&, Init&&, String&); > FetchBody() = default; > >- WEBCORE_EXPORT static std::optional<FetchBody> fromFormData(FormData&); >+ WEBCORE_EXPORT static WTF::Optional<FetchBody> fromFormData(FormData&); > > void loadingFailed(); > void loadingSucceeded(); >diff --git a/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp b/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp >index 03b94f112abeed45d2337e47d51343a67ce9c866..a741ae7d1a3d9df1995bd4c7ea8c18c45833fd36 100644 >--- a/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp >+++ b/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp >@@ -37,7 +37,7 @@ > > namespace WebCore { > >-FetchBodyOwner::FetchBodyOwner(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers) >+FetchBodyOwner::FetchBodyOwner(ScriptExecutionContext& context, WTF::Optional<FetchBody>&& body, Ref<FetchHeaders>&& headers) > : ActiveDOMObject(&context) > , m_body(WTFMove(body)) > , m_headers(WTFMove(headers)) >@@ -218,7 +218,7 @@ void FetchBodyOwner::loadBlob(const Blob& blob, FetchBodyConsumer* consumer) > m_blobLoader->loader->start(*scriptExecutionContext(), blob); > if (!m_blobLoader->loader->isStarted()) { > m_body->loadingFailed(); >- m_blobLoader = std::nullopt; >+ m_blobLoader = WTF::nullopt; > return; > } > setPendingActivity(this); >@@ -228,7 +228,7 @@ void FetchBodyOwner::finishBlobLoading() > { > ASSERT(m_blobLoader); > >- m_blobLoader = std::nullopt; >+ m_blobLoader = WTF::nullopt; > unsetPendingActivity(this); > } > >diff --git a/Source/WebCore/Modules/fetch/FetchBodyOwner.h b/Source/WebCore/Modules/fetch/FetchBodyOwner.h >index cc0ef2c963d550fdde95b4cc6cafd652de272cd9..8932ebc3ac82c466730fe1acc7ff99e816c13e30 100644 >--- a/Source/WebCore/Modules/fetch/FetchBodyOwner.h >+++ b/Source/WebCore/Modules/fetch/FetchBodyOwner.h >@@ -40,7 +40,7 @@ namespace WebCore { > > class FetchBodyOwner : public RefCounted<FetchBodyOwner>, public ActiveDOMObject { > public: >- FetchBodyOwner(ScriptExecutionContext&, std::optional<FetchBody>&&, Ref<FetchHeaders>&&); >+ FetchBodyOwner(ScriptExecutionContext&, WTF::Optional<FetchBody>&&, Ref<FetchHeaders>&&); > ~FetchBodyOwner(); > > bool bodyUsed() const { return isDisturbed(); } >@@ -109,17 +109,17 @@ private: > }; > > protected: >- std::optional<FetchBody> m_body; >+ WTF::Optional<FetchBody> m_body; > String m_contentType; > bool m_isDisturbed { false }; > #if ENABLE(STREAMS_API) > RefPtr<FetchBodySource> m_readableStreamSource; > #endif > Ref<FetchHeaders> m_headers; >- std::optional<ResourceError> m_loadingError; >+ WTF::Optional<ResourceError> m_loadingError; > > private: >- std::optional<BlobLoader> m_blobLoader; >+ WTF::Optional<BlobLoader> m_blobLoader; > bool m_isBodyOpaque { false }; > }; > >diff --git a/Source/WebCore/Modules/fetch/FetchHeaders.cpp b/Source/WebCore/Modules/fetch/FetchHeaders.cpp >index 1c87482add10bea448bc2ac6da6199d0e5ed31bc..58790e066010491c64835a449574711920fc20ae 100644 >--- a/Source/WebCore/Modules/fetch/FetchHeaders.cpp >+++ b/Source/WebCore/Modules/fetch/FetchHeaders.cpp >@@ -100,7 +100,7 @@ static ExceptionOr<void> fillHeaderMap(HTTPHeaderMap& headers, const FetchHeader > return { }; > } > >-ExceptionOr<Ref<FetchHeaders>> FetchHeaders::create(std::optional<Init>&& headersInit) >+ExceptionOr<Ref<FetchHeaders>> FetchHeaders::create(WTF::Optional<Init>&& headersInit) > { > HTTPHeaderMap headers; > >@@ -186,7 +186,7 @@ void FetchHeaders::filterAndFill(const HTTPHeaderMap& headers, Guard guard) > } > } > >-std::optional<WTF::KeyValuePair<String, String>> FetchHeaders::Iterator::next() >+WTF::Optional<WTF::KeyValuePair<String, String>> FetchHeaders::Iterator::next() > { > while (m_currentIndex < m_keys.size()) { > auto key = m_keys[m_currentIndex++]; >@@ -194,7 +194,7 @@ std::optional<WTF::KeyValuePair<String, String>> FetchHeaders::Iterator::next() > if (!value.isNull()) > return WTF::KeyValuePair<String, String> { WTFMove(key), WTFMove(value) }; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > FetchHeaders::Iterator::Iterator(FetchHeaders& headers) >diff --git a/Source/WebCore/Modules/fetch/FetchHeaders.h b/Source/WebCore/Modules/fetch/FetchHeaders.h >index 2e9c3bd48cbe45a33c5561b9e77878ab13f33789..7e170b2e4cf27f016f0a01eeb89c1d5360a585e0 100644 >--- a/Source/WebCore/Modules/fetch/FetchHeaders.h >+++ b/Source/WebCore/Modules/fetch/FetchHeaders.h >@@ -47,7 +47,7 @@ public: > }; > > using Init = Variant<Vector<Vector<String>>, Vector<WTF::KeyValuePair<String, String>>>; >- static ExceptionOr<Ref<FetchHeaders>> create(std::optional<Init>&&); >+ static ExceptionOr<Ref<FetchHeaders>> create(WTF::Optional<Init>&&); > > static Ref<FetchHeaders> create(Guard guard = Guard::None, HTTPHeaderMap&& headers = { }) { return adoptRef(*new FetchHeaders { guard, WTFMove(headers) }); } > static Ref<FetchHeaders> create(const FetchHeaders& headers) { return adoptRef(*new FetchHeaders { headers }); } >@@ -69,7 +69,7 @@ public: > class Iterator { > public: > explicit Iterator(FetchHeaders&); >- std::optional<WTF::KeyValuePair<String, String>> next(); >+ WTF::Optional<WTF::KeyValuePair<String, String>> next(); > > private: > Ref<FetchHeaders> m_headers; >diff --git a/Source/WebCore/Modules/fetch/FetchRequest.cpp b/Source/WebCore/Modules/fetch/FetchRequest.cpp >index e3ee5d959a08c9dd676b022c8761dbf57c5c17e8..04635c4c287d76cd4eeabbe920df43caa07306cf 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequest.cpp >+++ b/Source/WebCore/Modules/fetch/FetchRequest.cpp >@@ -35,14 +35,14 @@ > > namespace WebCore { > >-static std::optional<Exception> setMethod(ResourceRequest& request, const String& initMethod) >+static WTF::Optional<Exception> setMethod(ResourceRequest& request, const String& initMethod) > { > if (!isValidHTTPToken(initMethod)) > return Exception { TypeError, "Method is not a valid HTTP token."_s }; > if (isForbiddenMethod(initMethod)) > return Exception { TypeError, "Method is forbidden."_s }; > request.setHTTPMethod(normalizeHTTPMethod(initMethod)); >- return std::nullopt; >+ return WTF::nullopt; > } > > static ExceptionOr<String> computeReferrer(ScriptExecutionContext& context, const String& referrer) >@@ -64,7 +64,7 @@ static ExceptionOr<String> computeReferrer(ScriptExecutionContext& context, cons > return String { referrerURL.string() }; > } > >-static std::optional<Exception> buildOptions(FetchOptions& options, ResourceRequest& request, String& referrer, ScriptExecutionContext& context, const FetchRequest::Init& init) >+static WTF::Optional<Exception> buildOptions(FetchOptions& options, ResourceRequest& request, String& referrer, ScriptExecutionContext& context, const FetchRequest::Init& init) > { > if (!init.window.isUndefinedOrNull() && !init.window.isEmpty()) > return Exception { TypeError, "Window can only be null."_s }; >@@ -114,7 +114,7 @@ static std::optional<Exception> buildOptions(FetchOptions& options, ResourceRequ > return exception; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > static bool methodCanHaveBody(const ResourceRequest& request) >@@ -231,7 +231,7 @@ ExceptionOr<void> FetchRequest::setBody(FetchRequest& request) > if (!methodCanHaveBody(m_request)) > return Exception { TypeError, makeString("Request has method '", m_request.httpMethod(), "' and cannot have a body") }; > // FIXME: If body has a readable stream, we should pipe it to this new body stream. >- m_body = WTFMove(request.m_body); >+ m_body = WTFMove(*request.m_body); > request.setDisturbed(); > } > >@@ -242,7 +242,7 @@ ExceptionOr<void> FetchRequest::setBody(FetchRequest& request) > > ExceptionOr<Ref<FetchRequest>> FetchRequest::create(ScriptExecutionContext& context, Info&& input, Init&& init) > { >- auto request = adoptRef(*new FetchRequest(context, std::nullopt, FetchHeaders::create(FetchHeaders::Guard::Request), { }, { }, { })); >+ auto request = adoptRef(*new FetchRequest(context, WTF::nullopt, FetchHeaders::create(FetchHeaders::Guard::Request), { }, { }, { })); > > if (WTF::holds_alternative<String>(input)) { > auto result = request->initializeWith(WTF::get<String>(input), WTFMove(init)); >@@ -291,7 +291,7 @@ ExceptionOr<Ref<FetchRequest>> FetchRequest::clone(ScriptExecutionContext& conte > if (isDisturbedOrLocked()) > return Exception { TypeError, "Body is disturbed or locked"_s }; > >- auto clone = adoptRef(*new FetchRequest(context, std::nullopt, FetchHeaders::create(m_headers.get()), ResourceRequest { m_request }, FetchOptions { m_options}, String { m_referrer })); >+ auto clone = adoptRef(*new FetchRequest(context, WTF::nullopt, FetchHeaders::create(m_headers.get()), ResourceRequest { m_request }, FetchOptions { m_options}, String { m_referrer })); > clone->cloneBody(*this); > return WTFMove(clone); > } >diff --git a/Source/WebCore/Modules/fetch/FetchRequest.h b/Source/WebCore/Modules/fetch/FetchRequest.h >index 05685175d86bbd7f703a7fa56f521fb952a987f5..72561290f31f502b59b5da5a8cb60aa60d52ed50 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequest.h >+++ b/Source/WebCore/Modules/fetch/FetchRequest.h >@@ -53,7 +53,7 @@ public: > using Redirect = FetchOptions::Redirect; > > static ExceptionOr<Ref<FetchRequest>> create(ScriptExecutionContext&, Info&&, Init&&); >- static Ref<FetchRequest> create(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceRequest&& request, FetchOptions&& options, String&& referrer) { return adoptRef(*new FetchRequest(context, WTFMove(body), WTFMove(headers), WTFMove(request), WTFMove(options), WTFMove(referrer))); } >+ static Ref<FetchRequest> create(ScriptExecutionContext& context, WTF::Optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceRequest&& request, FetchOptions&& options, String&& referrer) { return adoptRef(*new FetchRequest(context, WTFMove(body), WTFMove(headers), WTFMove(request), WTFMove(options), WTFMove(referrer))); } > > const String& method() const { return m_request.httpMethod(); } > const String& urlString() const; >@@ -81,7 +81,7 @@ public: > ResourceRequest resourceRequest() const; > > private: >- FetchRequest(ScriptExecutionContext&, std::optional<FetchBody>&&, Ref<FetchHeaders>&&, ResourceRequest&&, FetchOptions&&, String&& referrer); >+ FetchRequest(ScriptExecutionContext&, WTF::Optional<FetchBody>&&, Ref<FetchHeaders>&&, ResourceRequest&&, FetchOptions&&, String&& referrer); > > ExceptionOr<void> initializeOptions(const Init&); > ExceptionOr<void> initializeWith(FetchRequest&, Init&&); >@@ -98,7 +98,7 @@ private: > mutable String m_requestURL; > }; > >-inline FetchRequest::FetchRequest(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceRequest&& request, FetchOptions&& options, String&& referrer) >+inline FetchRequest::FetchRequest(ScriptExecutionContext& context, WTF::Optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceRequest&& request, FetchOptions&& options, String&& referrer) > : FetchBodyOwner(context, WTFMove(body), WTFMove(headers)) > , m_request(WTFMove(request)) > , m_options(WTFMove(options)) >diff --git a/Source/WebCore/Modules/fetch/FetchRequestInit.h b/Source/WebCore/Modules/fetch/FetchRequestInit.h >index 97b001681e7f1ba4d30cfd84aed4ad9d7ea97b70..2a34a0dd83299805a40ec5ea661f5f19c052dbc3 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequestInit.h >+++ b/Source/WebCore/Modules/fetch/FetchRequestInit.h >@@ -36,16 +36,16 @@ namespace WebCore { > > struct FetchRequestInit { > String method; >- std::optional<FetchHeaders::Init> headers; >- std::optional<FetchBody::Init> body; >+ WTF::Optional<FetchHeaders::Init> headers; >+ WTF::Optional<FetchBody::Init> body; > String referrer; >- std::optional<ReferrerPolicy> referrerPolicy; >- std::optional<FetchOptions::Mode> mode; >- std::optional<FetchOptions::Credentials> credentials; >- std::optional<FetchOptions::Cache> cache; >- std::optional<FetchOptions::Redirect> redirect; >+ WTF::Optional<ReferrerPolicy> referrerPolicy; >+ WTF::Optional<FetchOptions::Mode> mode; >+ WTF::Optional<FetchOptions::Credentials> credentials; >+ WTF::Optional<FetchOptions::Cache> cache; >+ WTF::Optional<FetchOptions::Redirect> redirect; > String integrity; >- std::optional<bool> keepalive; >+ WTF::Optional<bool> keepalive; > JSC::JSValue window; > > bool hasMembers() const { return !method.isEmpty() || headers || body || !referrer.isEmpty() || referrerPolicy || mode || credentials || cache || redirect || !integrity.isEmpty() || keepalive || !window.isUndefined(); } >diff --git a/Source/WebCore/Modules/fetch/FetchResponse.cpp b/Source/WebCore/Modules/fetch/FetchResponse.cpp >index ff8c3a24a041f20055ab3de81936c8eed9230e41..47b580988ff1040530f5d219c086569ebe4a2f8b 100644 >--- a/Source/WebCore/Modules/fetch/FetchResponse.cpp >+++ b/Source/WebCore/Modules/fetch/FetchResponse.cpp >@@ -46,7 +46,7 @@ static inline bool isNullBodyStatus(int status) > return status == 101 || status == 204 || status == 205 || status == 304; > } > >-Ref<FetchResponse> FetchResponse::create(ScriptExecutionContext& context, std::optional<FetchBody>&& body, FetchHeaders::Guard guard, ResourceResponse&& response) >+Ref<FetchResponse> FetchResponse::create(ScriptExecutionContext& context, WTF::Optional<FetchBody>&& body, FetchHeaders::Guard guard, ResourceResponse&& response) > { > bool isSynthetic = response.type() == ResourceResponse::Type::Default || response.type() == ResourceResponse::Type::Error; > bool isOpaque = response.tainting() == ResourceResponse::Tainting::Opaque; >@@ -60,7 +60,7 @@ Ref<FetchResponse> FetchResponse::create(ScriptExecutionContext& context, std::o > return fetchResponse; > } > >-ExceptionOr<Ref<FetchResponse>> FetchResponse::create(ScriptExecutionContext& context, std::optional<FetchBody::Init>&& body, Init&& init) >+ExceptionOr<Ref<FetchResponse>> FetchResponse::create(ScriptExecutionContext& context, WTF::Optional<FetchBody::Init>&& body, Init&& init) > { > // 1. If initâs status member is not in the range 200 to 599, inclusive, then throw a RangeError. > if (init.status < 200 || init.status > 599) >@@ -89,7 +89,7 @@ ExceptionOr<Ref<FetchResponse>> FetchResponse::create(ScriptExecutionContext& co > return result.releaseException(); > } > >- std::optional<FetchBody> extractedBody; >+ WTF::Optional<FetchBody> extractedBody; > > // 8. If body is non-null, run these substeps: > if (body) { >@@ -157,7 +157,7 @@ ExceptionOr<Ref<FetchResponse>> FetchResponse::redirect(ScriptExecutionContext& > return WTFMove(redirectResponse); > } > >-FetchResponse::FetchResponse(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response) >+FetchResponse::FetchResponse(ScriptExecutionContext& context, WTF::Optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response) > : FetchBodyOwner(context, WTFMove(body), WTFMove(headers)) > , m_internalResponse(WTFMove(response)) > { >@@ -178,7 +178,7 @@ ExceptionOr<Ref<FetchResponse>> FetchResponse::clone(ScriptExecutionContext& con > if (m_internalResponse.type() == ResourceResponse::Type::Default) > m_internalResponse.setHTTPHeaderFields(HTTPHeaderMap { headers().internalHeaders() }); > >- auto clone = FetchResponse::create(context, std::nullopt, headers().guard(), ResourceResponse { m_internalResponse }); >+ auto clone = FetchResponse::create(context, WTF::nullopt, headers().guard(), ResourceResponse { m_internalResponse }); > clone->m_loadingError = m_loadingError; > clone->cloneBody(*this); > clone->m_opaqueLoadIdentifier = m_opaqueLoadIdentifier; >@@ -199,7 +199,7 @@ void FetchResponse::fetch(ScriptExecutionContext& context, FetchRequest& request > > response->m_bodyLoader.emplace(response.get(), WTFMove(responseCallback)); > if (!response->m_bodyLoader->start(context, request)) >- response->m_bodyLoader = std::nullopt; >+ response->m_bodyLoader = WTF::nullopt; > } > > const String& FetchResponse::url() const >@@ -237,7 +237,7 @@ void FetchResponse::BodyLoader::didSucceed() > > if (m_loader->isStarted()) { > Ref<FetchResponse> protector(m_response); >- m_response.m_bodyLoader = std::nullopt; >+ m_response.m_bodyLoader = WTF::nullopt; > } > } > >@@ -264,7 +264,7 @@ void FetchResponse::BodyLoader::didFail(const ResourceError& error) > // Check whether didFail is called as part of FetchLoader::start. > if (m_loader->isStarted()) { > Ref<FetchResponse> protector(m_response); >- m_response.m_bodyLoader = std::nullopt; >+ m_response.m_bodyLoader = WTF::nullopt; > } > } > >@@ -481,7 +481,7 @@ void FetchResponse::stop() > FetchBodyOwner::stop(); > if (m_bodyLoader) { > m_bodyLoader->stop(); >- m_bodyLoader = std::nullopt; >+ m_bodyLoader = WTF::nullopt; > } > } > >diff --git a/Source/WebCore/Modules/fetch/FetchResponse.h b/Source/WebCore/Modules/fetch/FetchResponse.h >index a8424ea8d19059a1973881087eadbd6be34ff1b9..ec6b5d82c8d7657c27fe15724327b11f642a4184 100644 >--- a/Source/WebCore/Modules/fetch/FetchResponse.h >+++ b/Source/WebCore/Modules/fetch/FetchResponse.h >@@ -52,12 +52,12 @@ public: > struct Init { > unsigned short status { 200 }; > String statusText { "OK"_s }; >- std::optional<FetchHeaders::Init> headers; >+ WTF::Optional<FetchHeaders::Init> headers; > }; > >- WEBCORE_EXPORT static Ref<FetchResponse> create(ScriptExecutionContext&, std::optional<FetchBody>&&, FetchHeaders::Guard, ResourceResponse&&); >+ WEBCORE_EXPORT static Ref<FetchResponse> create(ScriptExecutionContext&, WTF::Optional<FetchBody>&&, FetchHeaders::Guard, ResourceResponse&&); > >- static ExceptionOr<Ref<FetchResponse>> create(ScriptExecutionContext&, std::optional<FetchBody::Init>&&, Init&&); >+ static ExceptionOr<Ref<FetchResponse>> create(ScriptExecutionContext&, WTF::Optional<FetchBody::Init>&&, Init&&); > static Ref<FetchResponse> error(ScriptExecutionContext&); > static ExceptionOr<Ref<FetchResponse>> redirect(ScriptExecutionContext&, const String& url, int status); > >@@ -107,12 +107,12 @@ public: > > void initializeOpaqueLoadIdentifierForTesting() { m_opaqueLoadIdentifier = 1; } > >- const std::optional<ResourceError>& loadingError() const { return m_loadingError; } >+ const WTF::Optional<ResourceError>& loadingError() const { return m_loadingError; } > > const HTTPHeaderMap& internalResponseHeaders() const { return m_internalResponse.httpHeaderFields(); } > > private: >- FetchResponse(ScriptExecutionContext&, std::optional<FetchBody>&&, Ref<FetchHeaders>&&, ResourceResponse&&); >+ FetchResponse(ScriptExecutionContext&, WTF::Optional<FetchBody>&&, Ref<FetchHeaders>&&, ResourceResponse&&); > > void stop() final; > const char* activeDOMObjectName() const final; >@@ -151,9 +151,9 @@ private: > std::unique_ptr<FetchLoader> m_loader; > }; > >- mutable std::optional<ResourceResponse> m_filteredResponse; >+ mutable WTF::Optional<ResourceResponse> m_filteredResponse; > ResourceResponse m_internalResponse; >- std::optional<BodyLoader> m_bodyLoader; >+ WTF::Optional<BodyLoader> m_bodyLoader; > mutable String m_responseURL; > // Opaque responses will padd their body size when used with Cache API. > uint64_t m_bodySizeWithPadding { 0 }; >diff --git a/Source/WebCore/Modules/geolocation/Coordinates.h b/Source/WebCore/Modules/geolocation/Coordinates.h >index e1975bea062abb2e18ac3ba9ab15e89572fd74ce..43c33d8c315eaa527033f0e5c71b7c3a3ac3dba4 100644 >--- a/Source/WebCore/Modules/geolocation/Coordinates.h >+++ b/Source/WebCore/Modules/geolocation/Coordinates.h >@@ -46,12 +46,12 @@ public: > > double latitude() const { return m_position.latitude; } > double longitude() const { return m_position.longitude; } >- std::optional<double> altitude() const { return m_position.altitude; } >+ WTF::Optional<double> altitude() const { return m_position.altitude; } > double accuracy() const { return m_position.accuracy; } >- std::optional<double> altitudeAccuracy() const { return m_position.altitudeAccuracy; } >- std::optional<double> heading() const { return m_position.heading; } >- std::optional<double> speed() const { return m_position.speed; } >- std::optional<double> floorLevel() const { return m_position.floorLevel; } >+ WTF::Optional<double> altitudeAccuracy() const { return m_position.altitudeAccuracy; } >+ WTF::Optional<double> heading() const { return m_position.heading; } >+ WTF::Optional<double> speed() const { return m_position.speed; } >+ WTF::Optional<double> floorLevel() const { return m_position.floorLevel; } > > private: > explicit Coordinates(GeolocationPosition&&); >diff --git a/Source/WebCore/Modules/geolocation/Geolocation.cpp b/Source/WebCore/Modules/geolocation/Geolocation.cpp >index 9d250675fde7c2ec1fb631a91feea7cc438c5a9b..7de5d2ecc91671b7a47cde5bbc157ecd8879b01a 100644 >--- a/Source/WebCore/Modules/geolocation/Geolocation.cpp >+++ b/Source/WebCore/Modules/geolocation/Geolocation.cpp >@@ -52,7 +52,7 @@ static const ASCIILiteral failedToStartServiceErrorMessage { "Failed to start Ge > static const ASCIILiteral framelessDocumentErrorMessage { "Geolocation cannot be used in frameless documents"_s }; > static const ASCIILiteral originCannotRequestGeolocationErrorMessage { "Origin does not have permission to use Geolocation service"_s }; > >-static RefPtr<Geoposition> createGeoposition(std::optional<GeolocationPosition>&& position) >+static RefPtr<Geoposition> createGeoposition(WTF::Optional<GeolocationPosition>&& position) > { > if (!position) > return nullptr; >diff --git a/Source/WebCore/Modules/geolocation/GeolocationClient.h b/Source/WebCore/Modules/geolocation/GeolocationClient.h >index 25da5625633f37d797232a036ad3d2ec50844af0..8487d0821265865e308dbeb7b90fd7a965519418 100644 >--- a/Source/WebCore/Modules/geolocation/GeolocationClient.h >+++ b/Source/WebCore/Modules/geolocation/GeolocationClient.h >@@ -44,7 +44,7 @@ public: > // We should update WebKit to reflect this if and when the V2 specification > // is published. > virtual void setEnableHighAccuracy(bool) = 0; >- virtual std::optional<GeolocationPosition> lastPosition() = 0; >+ virtual WTF::Optional<GeolocationPosition> lastPosition() = 0; > > virtual void requestPermission(Geolocation&) = 0; > virtual void cancelPermissionRequest(Geolocation&) = 0; >diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.cpp b/Source/WebCore/Modules/geolocation/GeolocationController.cpp >index 08b34ed0a36663c78569847c73fae6a8126f0d98..e84d932c5597ea2fcae989760c1c134353fed7c0 100644 >--- a/Source/WebCore/Modules/geolocation/GeolocationController.cpp >+++ b/Source/WebCore/Modules/geolocation/GeolocationController.cpp >@@ -99,7 +99,7 @@ void GeolocationController::cancelPermissionRequest(Geolocation& geolocation) > m_client.cancelPermissionRequest(geolocation); > } > >-void GeolocationController::positionChanged(const std::optional<GeolocationPosition>& position) >+void GeolocationController::positionChanged(const WTF::Optional<GeolocationPosition>& position) > { > m_lastPosition = position; > Vector<Ref<Geolocation>> observersVector; >@@ -120,7 +120,7 @@ void GeolocationController::errorOccurred(GeolocationError& error) > observer->setError(error); > } > >-std::optional<GeolocationPosition> GeolocationController::lastPosition() >+WTF::Optional<GeolocationPosition> GeolocationController::lastPosition() > { > if (m_lastPosition) > return m_lastPosition.value(); >diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.h b/Source/WebCore/Modules/geolocation/GeolocationController.h >index c0596238175045771b50da4c7e91625899d3316c..d3262431c01957ecfaa45534e8bf8b5ef0868ecc 100644 >--- a/Source/WebCore/Modules/geolocation/GeolocationController.h >+++ b/Source/WebCore/Modules/geolocation/GeolocationController.h >@@ -53,10 +53,10 @@ public: > void requestPermission(Geolocation&); > void cancelPermissionRequest(Geolocation&); > >- WEBCORE_EXPORT void positionChanged(const std::optional<GeolocationPosition>&); >+ WEBCORE_EXPORT void positionChanged(const WTF::Optional<GeolocationPosition>&); > WEBCORE_EXPORT void errorOccurred(GeolocationError&); > >- std::optional<GeolocationPosition> lastPosition(); >+ WTF::Optional<GeolocationPosition> lastPosition(); > > GeolocationClient& client() { return m_client; } > >@@ -69,7 +69,7 @@ private: > > void activityStateDidChange(OptionSet<ActivityState::Flag> oldActivityState, OptionSet<ActivityState::Flag> newActivityState) override; > >- std::optional<GeolocationPosition> m_lastPosition; >+ WTF::Optional<GeolocationPosition> m_lastPosition; > > typedef HashSet<Ref<Geolocation>> ObserversSet; > // All observers; both those requesting high accuracy and those not. >diff --git a/Source/WebCore/Modules/geolocation/GeolocationPosition.h b/Source/WebCore/Modules/geolocation/GeolocationPosition.h >index 32e519152ac21895600ef34d21af60a6a7933326..ce847499fadf7b20d604bd8306ceea1cb0f5143b 100644 >--- a/Source/WebCore/Modules/geolocation/GeolocationPosition.h >+++ b/Source/WebCore/Modules/geolocation/GeolocationPosition.h >@@ -58,11 +58,11 @@ public: > double longitude { std::numeric_limits<double>::quiet_NaN() }; > double accuracy { std::numeric_limits<double>::quiet_NaN() }; > >- std::optional<double> altitude; >- std::optional<double> altitudeAccuracy; >- std::optional<double> heading; >- std::optional<double> speed; >- std::optional<double> floorLevel; >+ WTF::Optional<double> altitude; >+ WTF::Optional<double> altitudeAccuracy; >+ WTF::Optional<double> heading; >+ WTF::Optional<double> speed; >+ WTF::Optional<double> floorLevel; > > bool isValid() const; > >diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.h b/Source/WebCore/Modules/indexeddb/IDBDatabase.h >index 76a12859101046e652b8edab4f703e0d4ad1593e..d0cb8e33e38c0895370a76e5f3cacdce3172b8b0 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBDatabase.h >+++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.h >@@ -57,7 +57,7 @@ public: > RefPtr<DOMStringList> objectStoreNames() const; > > struct ObjectStoreParameters { >- std::optional<IDBKeyPath> keyPath; >+ WTF::Optional<IDBKeyPath> keyPath; > bool autoIncrement; > }; > >diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h >index 7de4cdad3e1dcdb01c3aaf44f025671762d25bb7..f0fbb7b842e6e0988ac9e8957d38c601e0a185f4 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h >+++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h >@@ -91,7 +91,7 @@ public: > static String databaseDirectoryRelativeToRoot(const SecurityOriginData& topLevelOrigin, const SecurityOriginData& openingOrigin, const String& rootDirectory); > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<IDBDatabaseIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<IDBDatabaseIdentifier> decode(Decoder&); > > #if !LOG_DISABLED > String debugString() const; >@@ -128,27 +128,27 @@ void IDBDatabaseIdentifier::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<IDBDatabaseIdentifier> IDBDatabaseIdentifier::decode(Decoder& decoder) >+WTF::Optional<IDBDatabaseIdentifier> IDBDatabaseIdentifier::decode(Decoder& decoder) > { >- std::optional<String> databaseName; >+ WTF::Optional<String> databaseName; > decoder >> databaseName; > if (!databaseName) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<PAL::SessionID> sessionID; >+ WTF::Optional<PAL::SessionID> sessionID; > decoder >> sessionID; > if (!sessionID) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<SecurityOriginData> openingOrigin; >+ WTF::Optional<SecurityOriginData> openingOrigin; > decoder >> openingOrigin; > if (!openingOrigin) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<SecurityOriginData> mainFrameOrigin; >+ WTF::Optional<SecurityOriginData> mainFrameOrigin; > decoder >> mainFrameOrigin; > if (!mainFrameOrigin) >- return std::nullopt; >+ return WTF::nullopt; > > IDBDatabaseIdentifier identifier; > identifier.m_databaseName = WTFMove(*databaseName); // FIXME: When decoding from IPC, databaseName can be null, and the non-empty constructor asserts that this is not the case. >diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp >index 4e11e7bce72073c784cabb87dd76d1019e41371d..ae0453b2308727ab8a50be4e9a1bf4f477da7a9e 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp >@@ -72,7 +72,7 @@ IDBFactory::IDBFactory(IDBClient::IDBConnectionProxy& connectionProxy) > > IDBFactory::~IDBFactory() = default; > >-ExceptionOr<Ref<IDBOpenDBRequest>> IDBFactory::open(ScriptExecutionContext& context, const String& name, std::optional<uint64_t> version) >+ExceptionOr<Ref<IDBOpenDBRequest>> IDBFactory::open(ScriptExecutionContext& context, const String& name, WTF::Optional<uint64_t> version) > { > LOG(IndexedDB, "IDBFactory::open"); > >diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.h b/Source/WebCore/Modules/indexeddb/IDBFactory.h >index 1f04d130cb1772c24132096ce90766409c7dc161..4654fcb55dc99611bd87eaca3c226e6108fa5747 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBFactory.h >+++ b/Source/WebCore/Modules/indexeddb/IDBFactory.h >@@ -53,7 +53,7 @@ public: > static Ref<IDBFactory> create(IDBClient::IDBConnectionProxy&); > ~IDBFactory(); > >- ExceptionOr<Ref<IDBOpenDBRequest>> open(ScriptExecutionContext&, const String& name, std::optional<uint64_t> version); >+ ExceptionOr<Ref<IDBOpenDBRequest>> open(ScriptExecutionContext&, const String& name, WTF::Optional<uint64_t> version); > ExceptionOr<Ref<IDBOpenDBRequest>> deleteDatabase(ScriptExecutionContext&, const String& name); > > ExceptionOr<short> cmp(JSC::ExecState&, JSC::JSValue first, JSC::JSValue second); >diff --git a/Source/WebCore/Modules/indexeddb/IDBGetAllResult.h b/Source/WebCore/Modules/indexeddb/IDBGetAllResult.h >index 27b759d50dfb4b49a0ff1b54ddf2f5efd8e20400..7d976cf90687ea3933ce187d5d240a6a533c6c33 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBGetAllResult.h >+++ b/Source/WebCore/Modules/indexeddb/IDBGetAllResult.h >@@ -115,7 +115,7 @@ bool IDBGetAllResult::decode(Decoder& decoder, IDBGetAllResult& result) > } > case 1: { > result.m_results = Vector<IDBValue>(); >- std::optional<Vector<IDBValue>> optional; >+ WTF::Optional<Vector<IDBValue>> optional; > decoder >> optional; > if (!optional) > return false; >diff --git a/Source/WebCore/Modules/indexeddb/IDBGetResult.h b/Source/WebCore/Modules/indexeddb/IDBGetResult.h >index 109e4893f7136fadf925618a141c8de43b001f0b..49a56dc77a53d7500ddb196b6c2a751ec59ddca4 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBGetResult.h >+++ b/Source/WebCore/Modules/indexeddb/IDBGetResult.h >@@ -131,13 +131,13 @@ void IDBGetResult::encode(Encoder& encoder) const > template<class Decoder> > bool IDBGetResult::decode(Decoder& decoder, IDBGetResult& result) > { >- std::optional<IDBKeyData> keyData; >+ WTF::Optional<IDBKeyData> keyData; > decoder >> keyData; > if (!keyData) > return false; > result.m_keyData = WTFMove(*keyData); > >- std::optional<IDBKeyData> primaryKeyData; >+ WTF::Optional<IDBKeyData> primaryKeyData; > decoder >> primaryKeyData; > if (!primaryKeyData) > return false; >@@ -149,7 +149,7 @@ bool IDBGetResult::decode(Decoder& decoder, IDBGetResult& result) > if (!decoder.decode(result.m_isDefined)) > return false; > >- std::optional<IDBValue> value; >+ WTF::Optional<IDBValue> value; > decoder >> value; > if (!value) > return false; >diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >index 9d1f83937737ae80110b020ea9983b68d803f67f..bcc7c2435c10d27c07840f9a209bd8c837980751 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >@@ -311,7 +311,7 @@ ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetKey(ExecState& execState, const IDBK > return transaction.requestGetKey(execState, *this, range); > } > >-ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, RefPtr<IDBKeyRange> range, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, RefPtr<IDBKeyRange> range, WTF::Optional<uint32_t> count) > { > LOG(IndexedDB, "IDBIndex::getAll"); > ASSERT(&m_objectStore.transaction().database().originThread() == &Thread::current()); >@@ -325,7 +325,7 @@ ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, RefPtr<IDBKe > return m_objectStore.transaction().requestGetAllIndexRecords(execState, *this, range.get(), IndexedDB::GetAllType::Values, count); > } > >-ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, JSValue key, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, JSValue key, WTF::Optional<uint32_t> count) > { > auto onlyResult = IDBKeyRange::only(execState, key); > if (onlyResult.hasException()) >@@ -334,7 +334,7 @@ ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, JSValue key, > return getAll(execState, onlyResult.releaseReturnValue(), count); > } > >-ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(ExecState& execState, RefPtr<IDBKeyRange> range, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(ExecState& execState, RefPtr<IDBKeyRange> range, WTF::Optional<uint32_t> count) > { > LOG(IndexedDB, "IDBIndex::getAllKeys"); > ASSERT(&m_objectStore.transaction().database().originThread() == &Thread::current()); >@@ -348,7 +348,7 @@ ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(ExecState& execState, RefPtr<I > return m_objectStore.transaction().requestGetAllIndexRecords(execState, *this, range.get(), IndexedDB::GetAllType::Keys, count); > } > >-ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(ExecState& execState, JSValue key, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(ExecState& execState, JSValue key, WTF::Optional<uint32_t> count) > { > auto onlyResult = IDBKeyRange::only(execState, key); > if (onlyResult.hasException()) >diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.h b/Source/WebCore/Modules/indexeddb/IDBIndex.h >index d6488d591cac3edf0d123dd8404090bf1507f325..b72e63306dd39c37b048b6b8abdf28728e978ad6 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBIndex.h >+++ b/Source/WebCore/Modules/indexeddb/IDBIndex.h >@@ -71,10 +71,10 @@ public: > ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, IDBKeyRange*); > ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, JSC::JSValue key); > >- ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, RefPtr<IDBKeyRange>, std::optional<uint32_t> count); >- ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, JSC::JSValue key, std::optional<uint32_t> count); >- ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, RefPtr<IDBKeyRange>, std::optional<uint32_t> count); >- ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, JSC::JSValue key, std::optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, RefPtr<IDBKeyRange>, WTF::Optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, JSC::JSValue key, WTF::Optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, RefPtr<IDBKeyRange>, WTF::Optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, JSC::JSValue key, WTF::Optional<uint32_t> count); > > const IDBIndexInfo& info() const { return m_info; } > >diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyData.h b/Source/WebCore/Modules/indexeddb/IDBKeyData.h >index 482780fd929e40f4e5744a1899d877b0babf0c79..5b181d076cf0518cb159ee0d291d0ae46140d51a 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKeyData.h >+++ b/Source/WebCore/Modules/indexeddb/IDBKeyData.h >@@ -86,7 +86,7 @@ public: > WEBCORE_EXPORT void setNumberValue(double); > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<IDBKeyData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<IDBKeyData> decode(Decoder&); > > #if !LOG_DISABLED > WEBCORE_EXPORT String loggingString() const; >@@ -259,17 +259,17 @@ void IDBKeyData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<IDBKeyData> IDBKeyData::decode(Decoder& decoder) >+WTF::Optional<IDBKeyData> IDBKeyData::decode(Decoder& decoder) > { > IDBKeyData keyData; > if (!decoder.decode(keyData.m_isNull)) >- return std::nullopt; >+ return WTF::nullopt; > > if (keyData.m_isNull) > return WTFMove(keyData); > > if (!decoder.decodeEnum(keyData.m_type)) >- return std::nullopt; >+ return WTF::nullopt; > > switch (keyData.m_type) { > case IndexedDB::KeyType::Invalid: >@@ -279,23 +279,23 @@ std::optional<IDBKeyData> IDBKeyData::decode(Decoder& decoder) > case IndexedDB::KeyType::Array: > keyData.m_value = Vector<IDBKeyData>(); > if (!decoder.decode(WTF::get<Vector<IDBKeyData>>(keyData.m_value))) >- return std::nullopt; >+ return WTF::nullopt; > break; > case IndexedDB::KeyType::Binary: > keyData.m_value = ThreadSafeDataBuffer(); > if (!decoder.decode(WTF::get<ThreadSafeDataBuffer>(keyData.m_value))) >- return std::nullopt; >+ return WTF::nullopt; > break; > case IndexedDB::KeyType::String: > keyData.m_value = String(); > if (!decoder.decode(WTF::get<String>(keyData.m_value))) >- return std::nullopt; >+ return WTF::nullopt; > break; > case IndexedDB::KeyType::Date: > case IndexedDB::KeyType::Number: > keyData.m_value = 0.0; > if (!decoder.decode(WTF::get<double>(keyData.m_value))) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > >diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyPath.h b/Source/WebCore/Modules/indexeddb/IDBKeyPath.h >index 0b72d1c97f4f5dfa3ab5fbeeda170df0c4ea31ee..5608b3f344c2c2c873cab97c907be28f64f72b93 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKeyPath.h >+++ b/Source/WebCore/Modules/indexeddb/IDBKeyPath.h >@@ -46,7 +46,7 @@ enum class IDBKeyPathParseError { > > void IDBParseKeyPath(const String&, Vector<String>&, IDBKeyPathParseError&); > IDBKeyPath isolatedCopy(const IDBKeyPath&); >-inline std::optional<IDBKeyPath> isolatedCopy(const std::optional<IDBKeyPath>& variant) >+inline WTF::Optional<IDBKeyPath> isolatedCopy(const WTF::Optional<IDBKeyPath>& variant) > { > if (!variant) > return { }; >diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h b/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h >index 6a62fa6300360ca959b12248cf40a1dd550441e8..e75b3d599c6ce89eedace20842cc5c1b5d91416d 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h >+++ b/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h >@@ -111,13 +111,13 @@ bool IDBKeyRangeData::decode(Decoder& decoder, IDBKeyRangeData& keyRange) > if (keyRange.isNull) > return true; > >- std::optional<IDBKeyData> upperKey; >+ WTF::Optional<IDBKeyData> upperKey; > decoder >> upperKey; > if (!upperKey) > return false; > keyRange.upperKey = WTFMove(*upperKey); > >- std::optional<IDBKeyData> lowerKey; >+ WTF::Optional<IDBKeyData> lowerKey; > decoder >> lowerKey; > if (!lowerKey) > return false; >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >index 7dc5e0f799c0a62862032efd1efcbaad8ad64e94..00b7a87539e32d540627e396b3772ac7991d47a1 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >@@ -116,7 +116,7 @@ ExceptionOr<void> IDBObjectStore::setName(const String& name) > return { }; > } > >-const std::optional<IDBKeyPath>& IDBObjectStore::keyPath() const >+const WTF::Optional<IDBKeyPath>& IDBObjectStore::keyPath() const > { > ASSERT(&m_transaction.database().originThread() == &Thread::current()); > return m_info.keyPath(); >@@ -570,7 +570,7 @@ ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doCount(ExecState& execState, const > return m_transaction.requestCount(execState, *this, range); > } > >-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(ExecState& execState, RefPtr<IDBKeyRange> range, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(ExecState& execState, RefPtr<IDBKeyRange> range, WTF::Optional<uint32_t> count) > { > LOG(IndexedDB, "IDBObjectStore::getAll"); > ASSERT(&m_transaction.database().originThread() == &Thread::current()); >@@ -584,7 +584,7 @@ ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(ExecState& execState, RefPtr > return m_transaction.requestGetAllObjectStoreRecords(execState, *this, range.get(), IndexedDB::GetAllType::Values, count); > } > >-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(ExecState& execState, JSValue key, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(ExecState& execState, JSValue key, WTF::Optional<uint32_t> count) > { > auto onlyResult = IDBKeyRange::only(execState, key); > if (onlyResult.hasException()) >@@ -593,7 +593,7 @@ ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAll(ExecState& execState, JSValu > return getAll(execState, onlyResult.releaseReturnValue(), count); > } > >-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(ExecState& execState, RefPtr<IDBKeyRange> range, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(ExecState& execState, RefPtr<IDBKeyRange> range, WTF::Optional<uint32_t> count) > { > LOG(IndexedDB, "IDBObjectStore::getAllKeys"); > ASSERT(&m_transaction.database().originThread() == &Thread::current()); >@@ -607,7 +607,7 @@ ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(ExecState& execState, Re > return m_transaction.requestGetAllObjectStoreRecords(execState, *this, range.get(), IndexedDB::GetAllType::Keys, count); > } > >-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(ExecState& execState, JSValue key, std::optional<uint32_t> count) >+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::getAllKeys(ExecState& execState, JSValue key, WTF::Optional<uint32_t> count) > { > auto onlyResult = IDBKeyRange::only(execState, key); > if (onlyResult.hasException()) >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >index ed60647e2077b39a97dbc4de807935ba39a1d79d..7e257a6cd0751af5ae7497d449dbf46d848c9821 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >@@ -63,7 +63,7 @@ public: > > const String& name() const; > ExceptionOr<void> setName(const String&); >- const std::optional<IDBKeyPath>& keyPath() const; >+ const WTF::Optional<IDBKeyPath>& keyPath() const; > RefPtr<DOMStringList> indexNames() const; > IDBTransaction& transaction(); > bool autoIncrement() const; >@@ -91,10 +91,10 @@ public: > ExceptionOr<void> deleteIndex(const String& name); > ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, IDBKeyRange*); > ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, JSC::JSValue key); >- ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, RefPtr<IDBKeyRange>, std::optional<uint32_t> count); >- ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, JSC::JSValue key, std::optional<uint32_t> count); >- ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, RefPtr<IDBKeyRange>, std::optional<uint32_t> count); >- ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, JSC::JSValue key, std::optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, RefPtr<IDBKeyRange>, WTF::Optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, JSC::JSValue key, WTF::Optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, RefPtr<IDBKeyRange>, WTF::Optional<uint32_t> count); >+ ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, JSC::JSValue key, WTF::Optional<uint32_t> count); > > ExceptionOr<Ref<IDBRequest>> putForCursorUpdate(JSC::ExecState&, JSC::JSValue, JSC::JSValue key); > >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >index 6f5ce0e972653f6573ad5db76a4fccd49f22da9b..1542a1a222e01270d41cb70ff5897077a2513ef3 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >@@ -153,12 +153,12 @@ IDBRequest::~IDBRequest() > } > } > >-ExceptionOr<std::optional<IDBRequest::Result>> IDBRequest::result() const >+ExceptionOr<WTF::Optional<IDBRequest::Result>> IDBRequest::result() const > { > if (!isDone()) > return Exception { InvalidStateError, "Failed to read the 'result' property from 'IDBRequest': The request has not finished."_s }; > >- return std::optional<IDBRequest::Result> { m_result }; >+ return WTF::Optional<IDBRequest::Result> { m_result }; > } > > ExceptionOr<DOMException*> IDBRequest::error() const >@@ -470,7 +470,7 @@ void IDBRequest::willIterateCursor(IDBCursor& cursor) > > m_pendingCursor = &cursor; > m_hasPendingActivity = true; >- m_result = std::nullopt; >+ m_result = WTF::nullopt; > m_readyState = ReadyState::Pending; > m_domError = nullptr; > m_idbError = IDBError { }; >@@ -481,7 +481,7 @@ void IDBRequest::didOpenOrIterateCursor(const IDBResultData& resultData) > ASSERT(&originThread() == &Thread::current()); > ASSERT(m_pendingCursor); > >- m_result = std::nullopt; >+ m_result = WTF::nullopt; > > if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) { > m_pendingCursor->setGetResult(*this, resultData.getResult()); >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h >index e625cd3c7fbdc8913d6d49aa340ed9bb7239b5e8..8d260fe30ded7db69df427ad0dcef1d8918624b8 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.h >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h >@@ -72,10 +72,10 @@ public: > // FIXME: The following use of JSC::Strong is incorrect and can lead to storage leaks > // due to reference cycles; we should use JSValueInWrappedObject instead. > using Result = Variant<RefPtr<IDBCursor>, RefPtr<IDBDatabase>, JSC::Strong<JSC::Unknown>>; >- ExceptionOr<std::optional<Result>> result() const; >+ ExceptionOr<WTF::Optional<Result>> result() const; > > using Source = Variant<RefPtr<IDBObjectStore>, RefPtr<IDBIndex>, RefPtr<IDBCursor>>; >- const std::optional<Source>& source() const { return m_source; } >+ const WTF::Optional<Source>& source() const { return m_source; } > > ExceptionOr<DOMException*> error() const; > >@@ -165,8 +165,8 @@ private: > IDBError m_idbError; > IDBResourceIdentifier m_resourceIdentifier; > >- std::optional<Result> m_result; >- std::optional<Source> m_source; >+ WTF::Optional<Result> m_result; >+ WTF::Optional<Source> m_source; > > bool m_hasPendingActivity { true }; > IndexedDB::ObjectStoreRecordType m_requestedObjectStoreRecordType { IndexedDB::ObjectStoreRecordType::ValueOnly }; >diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp >index ce728fce263885b207978b6c84f1bed478d7dc12..8334223b7c0adc8eb1905d0cb846685a7d684641 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp >@@ -878,7 +878,7 @@ void IDBTransaction::didIterateCursorOnServer(IDBRequest& request, const IDBResu > completeCursorRequest(request, resultData); > } > >-Ref<IDBRequest> IDBTransaction::requestGetAllObjectStoreRecords(JSC::ExecState& state, IDBObjectStore& objectStore, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, std::optional<uint32_t> count) >+Ref<IDBRequest> IDBTransaction::requestGetAllObjectStoreRecords(JSC::ExecState& state, IDBObjectStore& objectStore, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, WTF::Optional<uint32_t> count) > { > LOG(IndexedDB, "IDBTransaction::requestGetAllObjectStoreRecords"); > ASSERT(isActive()); >@@ -897,7 +897,7 @@ Ref<IDBRequest> IDBTransaction::requestGetAllObjectStoreRecords(JSC::ExecState& > return request; > } > >-Ref<IDBRequest> IDBTransaction::requestGetAllIndexRecords(JSC::ExecState& state, IDBIndex& index, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, std::optional<uint32_t> count) >+Ref<IDBRequest> IDBTransaction::requestGetAllIndexRecords(JSC::ExecState& state, IDBIndex& index, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, WTF::Optional<uint32_t> count) > { > LOG(IndexedDB, "IDBTransaction::requestGetAllIndexRecords"); > ASSERT(isActive()); >diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.h b/Source/WebCore/Modules/indexeddb/IDBTransaction.h >index ecac146e5d692efea999cef1106a76b131182723..d55b91b00b45f76cf13f4fef783480f48a3d762e 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBTransaction.h >+++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.h >@@ -115,8 +115,8 @@ public: > > Ref<IDBRequest> requestPutOrAdd(JSC::ExecState&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode); > Ref<IDBRequest> requestGetRecord(JSC::ExecState&, IDBObjectStore&, const IDBGetRecordData&); >- Ref<IDBRequest> requestGetAllObjectStoreRecords(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&, IndexedDB::GetAllType, std::optional<uint32_t> count); >- Ref<IDBRequest> requestGetAllIndexRecords(JSC::ExecState&, IDBIndex&, const IDBKeyRangeData&, IndexedDB::GetAllType, std::optional<uint32_t> count); >+ Ref<IDBRequest> requestGetAllObjectStoreRecords(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&, IndexedDB::GetAllType, WTF::Optional<uint32_t> count); >+ Ref<IDBRequest> requestGetAllIndexRecords(JSC::ExecState&, IDBIndex&, const IDBKeyRangeData&, IndexedDB::GetAllType, WTF::Optional<uint32_t> count); > Ref<IDBRequest> requestDeleteRecord(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&); > Ref<IDBRequest> requestClearObjectStore(JSC::ExecState&, IDBObjectStore&); > Ref<IDBRequest> requestCount(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&); >diff --git a/Source/WebCore/Modules/indexeddb/IDBValue.h b/Source/WebCore/Modules/indexeddb/IDBValue.h >index e6126995c60a89313e5ea96f274d5f5b5aa2ed07..b350b63cb37c53adba5d6af5d083043c2ca8d9aa 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBValue.h >+++ b/Source/WebCore/Modules/indexeddb/IDBValue.h >@@ -53,7 +53,7 @@ public: > const Vector<String>& blobFilePaths() const { return m_blobFilePaths; } > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<IDBValue> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<IDBValue> decode(Decoder&); > > private: > ThreadSafeDataBuffer m_data; >@@ -73,20 +73,20 @@ void IDBValue::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<IDBValue> IDBValue::decode(Decoder& decoder) >+WTF::Optional<IDBValue> IDBValue::decode(Decoder& decoder) > { > IDBValue result; > if (!decoder.decode(result.m_data)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.m_blobURLs)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.m_sessionID)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.m_blobFilePaths)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp b/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp >index c39bbcb153530c79421fd987d1c7cc3adc73beb8..b6c5a86300e7a077319df0f818bd78fa29d209fa 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp >@@ -38,7 +38,7 @@ IDBVersionChangeEvent::IDBVersionChangeEvent(const IDBResourceIdentifier& reques > if (newVersion) > m_newVersion = newVersion; > else >- m_newVersion = std::nullopt; >+ m_newVersion = WTF::nullopt; > } > > IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& name, const Init& init, IsTrusted isTrusted) >diff --git a/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h b/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h >index 0801720bc2b8bd7dbef9d565bdcb74b14edad588..fd6acd06683453d400810b50835f23bf4e8c82bd 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h >+++ b/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h >@@ -47,7 +47,7 @@ public: > > struct Init : EventInit { > uint64_t oldVersion { 0 }; >- std::optional<uint64_t> newVersion; >+ WTF::Optional<uint64_t> newVersion; > }; > > static Ref<IDBVersionChangeEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) >@@ -60,7 +60,7 @@ public: > bool isVersionChangeEvent() const final { return true; } > > uint64_t oldVersion() const { return m_oldVersion; } >- std::optional<uint64_t> newVersion() const { return m_newVersion; } >+ WTF::Optional<uint64_t> newVersion() const { return m_newVersion; } > > private: > IDBVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType); >@@ -70,7 +70,7 @@ private: > > IDBResourceIdentifier m_requestIdentifier; > uint64_t m_oldVersion; >- std::optional<uint64_t> m_newVersion; >+ WTF::Optional<uint64_t> m_newVersion; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp b/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp >index a5f02922519146976e4a1f9474ffca94c11e18b5..901938448d2706eb6dbb0efbf6315618569e5327 100644 >--- a/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp >@@ -40,7 +40,7 @@ namespace WebCore { > > enum class KeyPathType { Null, String, Array }; > >-RefPtr<SharedBuffer> serializeIDBKeyPath(const std::optional<IDBKeyPath>& keyPath) >+RefPtr<SharedBuffer> serializeIDBKeyPath(const WTF::Optional<IDBKeyPath>& keyPath) > { > auto encoder = KeyedEncoder::encoder(); > >@@ -61,7 +61,7 @@ RefPtr<SharedBuffer> serializeIDBKeyPath(const std::optional<IDBKeyPath>& keyPat > return encoder->finishEncoding(); > } > >-bool deserializeIDBKeyPath(const uint8_t* data, size_t size, std::optional<IDBKeyPath>& result) >+bool deserializeIDBKeyPath(const uint8_t* data, size_t size, WTF::Optional<IDBKeyPath>& result) > { > if (!data || !size) > return false; >diff --git a/Source/WebCore/Modules/indexeddb/server/IDBSerialization.h b/Source/WebCore/Modules/indexeddb/server/IDBSerialization.h >index 094fbc6ece5c023f4d8267ad304128fda5b83f69..36f447b66a4442644526e88331624081372543ac 100644 >--- a/Source/WebCore/Modules/indexeddb/server/IDBSerialization.h >+++ b/Source/WebCore/Modules/indexeddb/server/IDBSerialization.h >@@ -34,8 +34,8 @@ namespace WebCore { > > class IDBKeyData; > >-RefPtr<SharedBuffer> serializeIDBKeyPath(const std::optional<IDBKeyPath>&); >-bool deserializeIDBKeyPath(const uint8_t* buffer, size_t bufferSize, std::optional<IDBKeyPath>&); >+RefPtr<SharedBuffer> serializeIDBKeyPath(const WTF::Optional<IDBKeyPath>&); >+bool deserializeIDBKeyPath(const uint8_t* buffer, size_t bufferSize, WTF::Optional<IDBKeyPath>&); > > RefPtr<SharedBuffer> serializeIDBKeyData(const IDBKeyData&); > bool deserializeIDBKeyData(const uint8_t* buffer, size_t bufferSize, IDBKeyData&); >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp b/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp >index d082bc232db736b3300d3f2a0d93667f43deda36..f03e9ef1beba9fd5c507782dbb9e98bfda849ed5 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp >@@ -152,7 +152,7 @@ uint64_t MemoryIndex::countForKeyRange(const IDBKeyRangeData& inRange) > return count; > } > >-void MemoryIndex::getAllRecords(const IDBKeyRangeData& keyRangeData, std::optional<uint32_t> count, IndexedDB::GetAllType type, IDBGetAllResult& result) const >+void MemoryIndex::getAllRecords(const IDBKeyRangeData& keyRangeData, WTF::Optional<uint32_t> count, IndexedDB::GetAllType type, IDBGetAllResult& result) const > { > LOG(IndexedDB, "MemoryIndex::getAllRecords"); > >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h b/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h >index 5bf9cba893a47cb2f0c18adadb1336840e7da052..4987042f4ec408fdfd5562e7293e486a30177fe4 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h >@@ -68,7 +68,7 @@ public: > > IDBGetResult getResultForKeyRange(IndexedDB::IndexRecordType, const IDBKeyRangeData&) const; > uint64_t countForKeyRange(const IDBKeyRangeData&); >- void getAllRecords(const IDBKeyRangeData&, std::optional<uint32_t> count, IndexedDB::GetAllType, IDBGetAllResult&) const; >+ void getAllRecords(const IDBKeyRangeData&, WTF::Optional<uint32_t> count, IndexedDB::GetAllType, IDBGetAllResult&) const; > > IDBError putIndexKey(const IDBKeyData&, const IndexKey&); > >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp >index 5cded3e58815008c757a8f869172181640754352..66b9703b7dc434a8f61346262057e7b8c4f44954 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp >@@ -405,7 +405,7 @@ ThreadSafeDataBuffer MemoryObjectStore::valueForKeyRange(const IDBKeyRangeData& > return m_keyValueStore->get(key); > } > >-void MemoryObjectStore::getAllRecords(const IDBKeyRangeData& keyRangeData, std::optional<uint32_t> count, IndexedDB::GetAllType type, IDBGetAllResult& result) const >+void MemoryObjectStore::getAllRecords(const IDBKeyRangeData& keyRangeData, WTF::Optional<uint32_t> count, IndexedDB::GetAllType type, IDBGetAllResult& result) const > { > result = { type }; > >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h >index 5b3d833e556f6cc917c08802a35c078116d87318..35b32fc6804ef5ddfcda8dc197b54ee33e248a30 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h >@@ -88,7 +88,7 @@ public: > IDBGetResult indexValueForKeyRange(uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&) const; > uint64_t countForKeyRange(uint64_t indexIdentifier, const IDBKeyRangeData&) const; > >- void getAllRecords(const IDBKeyRangeData&, std::optional<uint32_t> count, IndexedDB::GetAllType, IDBGetAllResult&) const; >+ void getAllRecords(const IDBKeyRangeData&, WTF::Optional<uint32_t> count, IndexedDB::GetAllType, IDBGetAllResult&) const; > > const IDBObjectStoreInfo& info() const { return m_info; } > >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp >index 918c73d01ae6436b69885136b36bacb699ac7cc3..f8b23ea362ab2fd160dc2524e049f5fe1724a7fb 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp >@@ -51,7 +51,7 @@ MemoryObjectStoreCursor::MemoryObjectStoreCursor(MemoryObjectStore& objectStore, > > void MemoryObjectStoreCursor::objectStoreCleared() > { >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > } > > void MemoryObjectStoreCursor::keyDeleted(const IDBKeyData& key) >@@ -59,7 +59,7 @@ void MemoryObjectStoreCursor::keyDeleted(const IDBKeyData& key) > if (m_currentPositionKey != key) > return; > >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > } > > void MemoryObjectStoreCursor::keyAdded(IDBKeyDataSet::iterator iterator) >@@ -73,7 +73,7 @@ void MemoryObjectStoreCursor::keyAdded(IDBKeyDataSet::iterator iterator) > > void MemoryObjectStoreCursor::setFirstInRemainingRange(IDBKeyDataSet& set) > { >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > > if (m_info.isDirectionForward()) { > setForwardIteratorFromRemainingRange(set); >@@ -95,19 +95,19 @@ void MemoryObjectStoreCursor::setFirstInRemainingRange(IDBKeyDataSet& set) > void MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange(IDBKeyDataSet& set) > { > if (!set.size()) { >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > return; > } > > if (m_remainingRange.isExactlyOneKey()) { > m_iterator = set.find(m_remainingRange.lowerKey); > if (*m_iterator == set.end()) >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > > return; > } > >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > > auto lowest = set.lower_bound(m_remainingRange.lowerKey); > if (lowest == set.end()) >@@ -133,14 +133,14 @@ void MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange(IDBKeyDataSet > void MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange(IDBKeyDataSet& set) > { > if (!set.size()) { >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > return; > } > > if (m_remainingRange.isExactlyOneKey()) { > m_iterator = set.find(m_remainingRange.lowerKey); > if (*m_iterator == set.end()) >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > > return; > } >@@ -148,12 +148,12 @@ void MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange(IDBKeyDataSet > if (!m_remainingRange.upperKey.isValid()) { > m_iterator = --set.end(); > if (!m_remainingRange.containsKey(**m_iterator)) >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > > return; > } > >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > > // This is one record past the actual key we're looking for. > auto highest = set.upper_bound(m_remainingRange.upperKey); >@@ -248,7 +248,7 @@ void MemoryObjectStoreCursor::incrementForwardIterator(IDBKeyDataSet& set, const > ++*m_iterator; > > if (*m_iterator == set.end() || !m_info.range().containsKey(**m_iterator)) { >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > return; > } > } >@@ -300,7 +300,7 @@ void MemoryObjectStoreCursor::incrementReverseIterator(IDBKeyDataSet& set, const > > while (count) { > if (*m_iterator == set.begin()) { >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > return; > } > >@@ -308,7 +308,7 @@ void MemoryObjectStoreCursor::incrementReverseIterator(IDBKeyDataSet& set, const > --*m_iterator; > > if (!m_info.range().containsKey(**m_iterator)) { >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > return; > } > } >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.h b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.h >index 42d162f5af35c5313991bc0cb8b350d43a34a395..91123a40e3404026d0be1ce17460f6a06365a740 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.h >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.h >@@ -62,7 +62,7 @@ private: > > IDBKeyRangeData m_remainingRange; > >- std::optional<IDBKeyDataSet::iterator> m_iterator; >+ WTF::Optional<IDBKeyDataSet::iterator> m_iterator; > > IDBKeyData m_currentPositionKey; > }; >diff --git a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >index a2eeb524a9425ada1972b50a8c6a56b8ecb67f41..9ce28cb23d691fd0ae4647b88686c1e8366bb3d7 100644 >--- a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >@@ -674,7 +674,7 @@ std::unique_ptr<IDBDatabaseInfo> SQLiteIDBBackingStore::extractExistingDatabaseI > Vector<char> keyPathBuffer; > sql.getColumnBlobAsVector(2, keyPathBuffer); > >- std::optional<IDBKeyPath> objectStoreKeyPath; >+ WTF::Optional<IDBKeyPath> objectStoreKeyPath; > if (!deserializeIDBKeyPath(reinterpret_cast<const uint8_t*>(keyPathBuffer.data()), keyPathBuffer.size(), objectStoreKeyPath)) { > LOG_ERROR("Unable to extract key path from database"); > return nullptr; >@@ -707,7 +707,7 @@ std::unique_ptr<IDBDatabaseInfo> SQLiteIDBBackingStore::extractExistingDatabaseI > Vector<char> keyPathBuffer; > sql.getColumnBlobAsVector(3, keyPathBuffer); > >- std::optional<IDBKeyPath> indexKeyPath; >+ WTF::Optional<IDBKeyPath> indexKeyPath; > if (!deserializeIDBKeyPath(reinterpret_cast<const uint8_t*>(keyPathBuffer.data()), keyPathBuffer.size(), indexKeyPath)) { > LOG_ERROR("Unable to extract key path from database"); > return nullptr; >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp >index e5df15c44abbe2464f4feeefd98dab78d9b3af29..e54193c9e29e130505238d12148a38460c6c281c 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp >@@ -66,7 +66,7 @@ bool IDBDatabaseInfo::hasObjectStore(const String& name) const > return false; > } > >-IDBObjectStoreInfo IDBDatabaseInfo::createNewObjectStore(const String& name, std::optional<IDBKeyPath>&& keyPath, bool autoIncrement) >+IDBObjectStoreInfo IDBDatabaseInfo::createNewObjectStore(const String& name, WTF::Optional<IDBKeyPath>&& keyPath, bool autoIncrement) > { > IDBObjectStoreInfo info(++m_maxObjectStoreID, name, WTFMove(keyPath), autoIncrement); > m_objectStoreMap.set(info.identifier(), info); >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h >index db8ff2c7798b450ccbb66ac6b0fc38ee5c9a0e9b..d21037a703c9e1c4b630a638bb49e1f5e6782187 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h >@@ -47,7 +47,7 @@ public: > uint64_t version() const { return m_version; } > > bool hasObjectStore(const String& name) const; >- IDBObjectStoreInfo createNewObjectStore(const String& name, std::optional<IDBKeyPath>&&, bool autoIncrement); >+ IDBObjectStoreInfo createNewObjectStore(const String& name, WTF::Optional<IDBKeyPath>&&, bool autoIncrement); > void addExistingObjectStore(const IDBObjectStoreInfo&); > IDBObjectStoreInfo* infoForExistingObjectStore(uint64_t objectStoreIdentifier); > IDBObjectStoreInfo* infoForExistingObjectStore(const String& objectStoreName); >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp >index ae314b24ee72caa0969e6c3b9b6e76e9acac3398..d1226fb7a4160c7874423db4a5ec8f04439c2f0e 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp >@@ -32,7 +32,7 @@ > > namespace WebCore { > >-IDBError::IDBError(std::optional<ExceptionCode> code, const String& message) >+IDBError::IDBError(WTF::Optional<ExceptionCode> code, const String& message) > : m_code(code) > , m_message(message) > { >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBError.h b/Source/WebCore/Modules/indexeddb/shared/IDBError.h >index 0a28967b169565d04c639043969dd8e770dccb33..aa5e61920fc3b6cc80b79d8714f998adb5fafcd0 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBError.h >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBError.h >@@ -35,7 +35,7 @@ namespace WebCore { > > class IDBError { > public: >- WEBCORE_EXPORT explicit IDBError(std::optional<ExceptionCode> = std::nullopt, const String& message = { }); >+ WEBCORE_EXPORT explicit IDBError(WTF::Optional<ExceptionCode> = WTF::nullopt, const String& message = { }); > > static IDBError userDeleteError() > { >@@ -51,7 +51,7 @@ public: > > RefPtr<DOMException> toDOMException() const; > >- std::optional<ExceptionCode> code() const { return m_code; } >+ WTF::Optional<ExceptionCode> code() const { return m_code; } > String name() const; > String message() const; > >@@ -63,7 +63,7 @@ public: > template<class Decoder> static bool decode(Decoder&, IDBError&); > > private: >- std::optional<ExceptionCode> m_code; >+ WTF::Optional<ExceptionCode> m_code; > String m_message; > }; > >@@ -91,7 +91,7 @@ bool IDBError::decode(Decoder& decoder, IDBError& error) > return false; > error.m_code = ec; > } else >- error.m_code = std::nullopt; >+ error.m_code = WTF::nullopt; > > if (!decoder.decode(error.m_message)) > return false; >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h b/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h >index e9b459800daf821737d7f7a7941580ce45b7b37d..0fc9dd9a70583bfce67c3fd7d6cdca52649f05a2 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h >@@ -40,7 +40,7 @@ enum class GetAllType; > struct IDBGetAllRecordsData { > IDBKeyRangeData keyRangeData; > IndexedDB::GetAllType getAllType; >- std::optional<uint32_t> count; >+ WTF::Optional<uint32_t> count; > uint64_t objectStoreIdentifier; > uint64_t indexIdentifier; > >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.h b/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.h >index 1f3c7c5dca8e727403ded7a6cd4ccc465eab8d9a..130e6aa9af13ceff79bc63398b0407622014e22a 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.h >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.h >@@ -55,13 +55,13 @@ void IDBIterateCursorData::encode(Encoder& encoder) const > template<class Decoder> > bool IDBIterateCursorData::decode(Decoder& decoder, IDBIterateCursorData& iteratorCursorData) > { >- std::optional<IDBKeyData> keyData; >+ WTF::Optional<IDBKeyData> keyData; > decoder >> keyData; > if (!keyData) > return false; > iteratorCursorData.keyData = WTFMove(*keyData); > >- std::optional<IDBKeyData> primaryKeyData; >+ WTF::Optional<IDBKeyData> primaryKeyData; > decoder >> primaryKeyData; > if (!primaryKeyData) > return false; >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp >index ce663ce927c0e15dfbf810bf4f19b8ad0c6e66ba..b15142bd775a1702a1febfb8dce3dbd177e01dc7 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp >@@ -35,7 +35,7 @@ IDBObjectStoreInfo::IDBObjectStoreInfo() > { > } > >-IDBObjectStoreInfo::IDBObjectStoreInfo(uint64_t identifier, const String& name, std::optional<IDBKeyPath>&& keyPath, bool autoIncrement) >+IDBObjectStoreInfo::IDBObjectStoreInfo(uint64_t identifier, const String& name, WTF::Optional<IDBKeyPath>&& keyPath, bool autoIncrement) > : m_identifier(identifier) > , m_name(name) > , m_keyPath(WTFMove(keyPath)) >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h b/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h >index 0b8525909c59b3859cd6bd48a7a0eee7dd19bfb0..2221c7a5b422c97ae2d4f561112dbeaeed168b2c 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h >@@ -37,11 +37,11 @@ namespace WebCore { > class IDBObjectStoreInfo { > public: > WEBCORE_EXPORT IDBObjectStoreInfo(); >- IDBObjectStoreInfo(uint64_t identifier, const String& name, std::optional<IDBKeyPath>&&, bool autoIncrement); >+ IDBObjectStoreInfo(uint64_t identifier, const String& name, WTF::Optional<IDBKeyPath>&&, bool autoIncrement); > > uint64_t identifier() const { return m_identifier; } > const String& name() const { return m_name; } >- const std::optional<IDBKeyPath>& keyPath() const { return m_keyPath; } >+ const WTF::Optional<IDBKeyPath>& keyPath() const { return m_keyPath; } > bool autoIncrement() const { return m_autoIncrement; } > uint64_t maxIndexID() const { return m_maxIndexID; } > >@@ -73,7 +73,7 @@ public: > private: > uint64_t m_identifier { 0 }; > String m_name; >- std::optional<IDBKeyPath> m_keyPath; >+ WTF::Optional<IDBKeyPath> m_keyPath; > bool m_autoIncrement { false }; > uint64_t m_maxIndexID { 0 }; > >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h b/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h >index 9432511a3786e5501bbaa620cbc1b254178ca8b4..d1ca8af13e1a5fd072a287f3c5e67eb27730cbc1 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h >@@ -126,7 +126,7 @@ bool IDBRequestData::decode(Decoder& decoder, IDBRequestData& request) > if (!decoder.decode(request.m_indexIdentifier)) > return false; > >- std::optional<IDBDatabaseIdentifier> databaseIdentifier; >+ WTF::Optional<IDBDatabaseIdentifier> databaseIdentifier; > decoder >> databaseIdentifier; > if (!databaseIdentifier) > return false; >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h b/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h >index 56bdcbf307efeb22adc089bcf21911916c94362c..fac038362cdcdfaf5c4033b1a727e0dbad668fe7 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h >@@ -111,7 +111,7 @@ public: > > WEBCORE_EXPORT IDBResultData(); > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<IDBResultData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<IDBResultData> decode(Decoder&); > > private: > IDBResultData(const IDBResourceIdentifier&); >@@ -160,71 +160,71 @@ void IDBResultData::encode(Encoder& encoder) const > encoder << *m_getAllResult; > } > >-template<class Decoder> std::optional<IDBResultData> IDBResultData::decode(Decoder& decoder) >+template<class Decoder> WTF::Optional<IDBResultData> IDBResultData::decode(Decoder& decoder) > { > IDBResultData result; > if (!decoder.decode(result.m_requestIdentifier)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.m_error)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.m_databaseConnectionIdentifier)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.m_resultInteger)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(result.m_type)) >- return std::nullopt; >+ return WTF::nullopt; > > bool hasObject; > > if (!decoder.decode(hasObject)) >- return std::nullopt; >+ return WTF::nullopt; > if (hasObject) { > auto object = std::make_unique<IDBDatabaseInfo>(); > if (!decoder.decode(*object)) >- return std::nullopt; >+ return WTF::nullopt; > result.m_databaseInfo = WTFMove(object); > } > > if (!decoder.decode(hasObject)) >- return std::nullopt; >+ return WTF::nullopt; > if (hasObject) { > auto object = std::make_unique<IDBTransactionInfo>(); > if (!decoder.decode(*object)) >- return std::nullopt; >+ return WTF::nullopt; > result.m_transactionInfo = WTFMove(object); > } > > if (!decoder.decode(hasObject)) >- return std::nullopt; >+ return WTF::nullopt; > if (hasObject) { > auto object = std::make_unique<IDBKeyData>(); >- std::optional<IDBKeyData> optional; >+ WTF::Optional<IDBKeyData> optional; > decoder >> optional; > if (!optional) >- return std::nullopt; >+ return WTF::nullopt; > *object = WTFMove(*optional); > result.m_resultKey = WTFMove(object); > } > > if (!decoder.decode(hasObject)) >- return std::nullopt; >+ return WTF::nullopt; > if (hasObject) { > auto object = std::make_unique<IDBGetResult>(); > if (!decoder.decode(*object)) >- return std::nullopt; >+ return WTF::nullopt; > result.m_getResult = WTFMove(object); > } > > if (!decoder.decode(hasObject)) >- return std::nullopt; >+ return WTF::nullopt; > if (hasObject) { > auto object = std::make_unique<IDBGetAllResult>(); > if (!decoder.decode(*object)) >- return std::nullopt; >+ return WTF::nullopt; > result.m_getAllResult = WTFMove(object); > } > >diff --git a/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp b/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp >index f4cb2fb63d163507fd9a13d1d497cb3b0791e6aa..8839245671e4f5306edb1873b878ba1038fc92b0 100644 >--- a/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp >+++ b/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp >@@ -100,7 +100,7 @@ Vector<RefPtr<AudioTrack>> MediaControlsHost::sortedTrackListForMenu(AudioTrackL > return page->group().captionPreferences().sortedTrackListForMenu(&trackList); > } > >-String MediaControlsHost::displayNameForTrack(const std::optional<TextOrAudioTrack>& track) >+String MediaControlsHost::displayNameForTrack(const WTF::Optional<TextOrAudioTrack>& track) > { > if (!track) > return emptyString(); >diff --git a/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h b/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h >index a2793eecf8d2fefe3d968b56f733a5732a6c80ae..58b954e6422da94b13eb6cdbab22e84493a9c728 100644 >--- a/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h >+++ b/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h >@@ -56,7 +56,7 @@ public: > Vector<RefPtr<AudioTrack>> sortedTrackListForMenu(AudioTrackList&); > > using TextOrAudioTrack = WTF::Variant<RefPtr<TextTrack>, RefPtr<AudioTrack>>; >- String displayNameForTrack(const std::optional<TextOrAudioTrack>&); >+ String displayNameForTrack(const WTF::Optional<TextOrAudioTrack>&); > > TextTrack* captionMenuOffItem(); > TextTrack* captionMenuAutomaticItem(); >diff --git a/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp b/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp >index ee8741d64ccb458668793e61d8355fdd12a893eb..37f21f5efd7cf6fb44b75138b6afad412cb9918e 100644 >--- a/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp >+++ b/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp >@@ -104,7 +104,7 @@ bool MediaRecorder::canSuspendForDocumentSuspension() const > return false; // FIXME: We should do better here as this prevents entering PageCache. > } > >-ExceptionOr<void> MediaRecorder::startRecording(std::optional<int> timeslice) >+ExceptionOr<void> MediaRecorder::startRecording(WTF::Optional<int> timeslice) > { > UNUSED_PARAM(timeslice); > if (state() != RecordingState::Inactive) >diff --git a/Source/WebCore/Modules/mediarecorder/MediaRecorder.h b/Source/WebCore/Modules/mediarecorder/MediaRecorder.h >index e19953087095eb12a2506bf9017d73d8ec3df7e4..0b5f3e8645f59d4ffaa4b20ed3a1d927f8d5bb0d 100644 >--- a/Source/WebCore/Modules/mediarecorder/MediaRecorder.h >+++ b/Source/WebCore/Modules/mediarecorder/MediaRecorder.h >@@ -68,7 +68,7 @@ public: > using RefCounted::ref; > using RefCounted::deref; > >- ExceptionOr<void> startRecording(std::optional<int>); >+ ExceptionOr<void> startRecording(WTF::Optional<int>); > ExceptionOr<void> stopRecording(); > > private: >diff --git a/Source/WebCore/Modules/mediasession/MediaSession.cpp b/Source/WebCore/Modules/mediasession/MediaSession.cpp >index 31fb9874294ca48e274526cdbbbef2698429b967..8f905db114389b7e4ae18b9435d9a44a919defad 100644 >--- a/Source/WebCore/Modules/mediasession/MediaSession.cpp >+++ b/Source/WebCore/Modules/mediasession/MediaSession.cpp >@@ -114,7 +114,7 @@ bool MediaSession::hasActiveMediaElements() const > return !m_activeParticipatingElements.isEmpty(); > } > >-void MediaSession::setMetadata(const std::optional<Metadata>& optionalMetadata) >+void MediaSession::setMetadata(const WTF::Optional<Metadata>& optionalMetadata) > { > if (!optionalMetadata) > m_metadata = { }; >diff --git a/Source/WebCore/Modules/mediasession/MediaSession.h b/Source/WebCore/Modules/mediasession/MediaSession.h >index ef591b522d655dbd6c909fd500191288e0cb5f1f..9aab06035aa323bd0e343da129f059e1c55e0b2d 100644 >--- a/Source/WebCore/Modules/mediasession/MediaSession.h >+++ b/Source/WebCore/Modules/mediasession/MediaSession.h >@@ -62,7 +62,7 @@ public: > WEBCORE_EXPORT State currentState() const { return m_currentState; } > bool hasActiveMediaElements() const; > >- void setMetadata(const std::optional<Metadata>&); >+ void setMetadata(const WTF::Optional<Metadata>&); > > void deactivate(); > >diff --git a/Source/WebCore/Modules/mediasource/MediaSource.cpp b/Source/WebCore/Modules/mediasource/MediaSource.cpp >index e0ff27194d579f12a688ace195fae7745f3ce218..118023c2da8ca9d3ef158cd1ebfb4685376a6800 100644 >--- a/Source/WebCore/Modules/mediasource/MediaSource.cpp >+++ b/Source/WebCore/Modules/mediasource/MediaSource.cpp >@@ -548,7 +548,7 @@ void MediaSource::setReadyState(ReadyState state) > onReadyStateChange(oldState, state); > } > >-ExceptionOr<void> MediaSource::endOfStream(std::optional<EndOfStreamError> error) >+ExceptionOr<void> MediaSource::endOfStream(WTF::Optional<EndOfStreamError> error) > { > // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-endOfStream-void-EndOfStreamError-error > // 1. If the readyState attribute is not in the "open" state then throw an >@@ -567,7 +567,7 @@ ExceptionOr<void> MediaSource::endOfStream(std::optional<EndOfStreamError> error > return { }; > } > >-void MediaSource::streamEndedWithError(std::optional<EndOfStreamError> error) >+void MediaSource::streamEndedWithError(WTF::Optional<EndOfStreamError> error) > { > LOG(MediaSource, "MediaSource::streamEndedWithError(%p)", this); > if (isClosed()) >diff --git a/Source/WebCore/Modules/mediasource/MediaSource.h b/Source/WebCore/Modules/mediasource/MediaSource.h >index eca269ea9969b88f412af2471c31b6df770761d0..ec5851fb2d4c67a509e2635274da347c1839c408 100644 >--- a/Source/WebCore/Modules/mediasource/MediaSource.h >+++ b/Source/WebCore/Modules/mediasource/MediaSource.h >@@ -65,7 +65,7 @@ public: > void sourceBufferDidChangeActiveState(SourceBuffer&, bool); > > enum class EndOfStreamError { Network, Decode }; >- void streamEndedWithError(std::optional<EndOfStreamError>); >+ void streamEndedWithError(WTF::Optional<EndOfStreamError>); > > MediaTime duration() const final; > void durationChanged(const MediaTime&) final; >@@ -85,7 +85,7 @@ public: > > enum class ReadyState { Closed, Open, Ended }; > ReadyState readyState() const { return m_readyState; } >- ExceptionOr<void> endOfStream(std::optional<EndOfStreamError>); >+ ExceptionOr<void> endOfStream(WTF::Optional<EndOfStreamError>); > > HTMLMediaElement* mediaElement() const { return m_mediaElement; } > >diff --git a/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp b/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp >index 426c5d16cb014f78d8d88cf4291e1c1ecb49ab75..b4929db8c1ee2bb411efcd3a4e03ac2f15ed207d 100644 >--- a/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp >+++ b/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp >@@ -33,7 +33,7 @@ > > namespace WebCore { > >-Ref<CanvasCaptureMediaStreamTrack> CanvasCaptureMediaStreamTrack::create(ScriptExecutionContext& context, Ref<HTMLCanvasElement>&& canvas, std::optional<double>&& frameRequestRate) >+Ref<CanvasCaptureMediaStreamTrack> CanvasCaptureMediaStreamTrack::create(ScriptExecutionContext& context, Ref<HTMLCanvasElement>&& canvas, WTF::Optional<double>&& frameRequestRate) > { > auto source = CanvasCaptureMediaStreamTrack::Source::create(canvas.get(), WTFMove(frameRequestRate)); > return adoptRef(*new CanvasCaptureMediaStreamTrack(context, WTFMove(canvas), WTFMove(source))); >@@ -51,7 +51,7 @@ CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(ScriptExecutionCont > { > } > >-Ref<CanvasCaptureMediaStreamTrack::Source> CanvasCaptureMediaStreamTrack::Source::create(HTMLCanvasElement& canvas, std::optional<double>&& frameRequestRate) >+Ref<CanvasCaptureMediaStreamTrack::Source> CanvasCaptureMediaStreamTrack::Source::create(HTMLCanvasElement& canvas, WTF::Optional<double>&& frameRequestRate) > { > auto source = adoptRef(*new Source(canvas, WTFMove(frameRequestRate))); > source->start(); >@@ -65,7 +65,7 @@ Ref<CanvasCaptureMediaStreamTrack::Source> CanvasCaptureMediaStreamTrack::Source > } > > // FIXME: Give source id and name >-CanvasCaptureMediaStreamTrack::Source::Source(HTMLCanvasElement& canvas, std::optional<double>&& frameRequestRate) >+CanvasCaptureMediaStreamTrack::Source::Source(HTMLCanvasElement& canvas, WTF::Optional<double>&& frameRequestRate) > : RealtimeMediaSource(Type::Video, "CanvasCaptureMediaStreamTrack"_s) > , m_frameRequestRate(WTFMove(frameRequestRate)) > , m_requestFrameTimer(*this, &Source::requestFrameTimerFired) >@@ -130,7 +130,7 @@ const RealtimeMediaSourceSettings& CanvasCaptureMediaStreamTrack::Source::settin > void CanvasCaptureMediaStreamTrack::Source::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag> settings) > { > if (settings.containsAny({ RealtimeMediaSourceSettings::Flag::Width, RealtimeMediaSourceSettings::Flag::Height })) >- m_currentSettings = std::nullopt; >+ m_currentSettings = WTF::nullopt; > } > > void CanvasCaptureMediaStreamTrack::Source::canvasResized(CanvasBase& canvas) >diff --git a/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.h b/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.h >index 87d725b703dc8e883c79e9ea322d8f75aad2a37f..76f8f6466962674c2fac194882e76fb93e023232 100644 >--- a/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.h >+++ b/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.h >@@ -39,7 +39,7 @@ class ScriptExecutionContext; > > class CanvasCaptureMediaStreamTrack final : public MediaStreamTrack { > public: >- static Ref<CanvasCaptureMediaStreamTrack> create(ScriptExecutionContext&, Ref<HTMLCanvasElement>&&, std::optional<double>&& frameRequestRate); >+ static Ref<CanvasCaptureMediaStreamTrack> create(ScriptExecutionContext&, Ref<HTMLCanvasElement>&&, WTF::Optional<double>&& frameRequestRate); > > HTMLCanvasElement& canvas() { return m_canvas.get(); } > void requestFrame() { static_cast<Source&>(source()).requestFrame(); } >@@ -49,13 +49,13 @@ public: > private: > class Source final : public RealtimeMediaSource, private CanvasObserver { > public: >- static Ref<Source> create(HTMLCanvasElement&, std::optional<double>&& frameRequestRate); >+ static Ref<Source> create(HTMLCanvasElement&, WTF::Optional<double>&& frameRequestRate); > > void requestFrame() { m_shouldEmitFrame = true; } >- std::optional<double> frameRequestRate() const { return m_frameRequestRate; } >+ WTF::Optional<double> frameRequestRate() const { return m_frameRequestRate; } > > private: >- Source(HTMLCanvasElement&, std::optional<double>&&); >+ Source(HTMLCanvasElement&, WTF::Optional<double>&&); > > // CanvasObserver API > void canvasChanged(CanvasBase&, const FloatRect&) final; >@@ -73,10 +73,10 @@ private: > void requestFrameTimerFired(); > > bool m_shouldEmitFrame { true }; >- std::optional<double> m_frameRequestRate; >+ WTF::Optional<double> m_frameRequestRate; > Timer m_requestFrameTimer; > Timer m_canvasChangedTimer; >- std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > HTMLCanvasElement* m_canvas; > RefPtr<Image> m_currentImage; > }; >diff --git a/Source/WebCore/Modules/mediastream/DoubleRange.h b/Source/WebCore/Modules/mediastream/DoubleRange.h >index 84a46bd60c65c546c647599672e2e7db5308bb30..0ec2ea67f9ac50dc9036387da033d6e64f1e9a49 100644 >--- a/Source/WebCore/Modules/mediastream/DoubleRange.h >+++ b/Source/WebCore/Modules/mediastream/DoubleRange.h >@@ -31,8 +31,8 @@ > namespace WebCore { > > struct DoubleRange { >- std::optional<double> max; >- std::optional<double> min; >+ WTF::Optional<double> max; >+ WTF::Optional<double> min; > }; > > } >diff --git a/Source/WebCore/Modules/mediastream/LongRange.h b/Source/WebCore/Modules/mediastream/LongRange.h >index 160ef86b60827cf73fbbc6bdc47fc98b705450b8..66bc29ed430e84dcffc7ef0cf23f3c106216802c 100644 >--- a/Source/WebCore/Modules/mediastream/LongRange.h >+++ b/Source/WebCore/Modules/mediastream/LongRange.h >@@ -31,8 +31,8 @@ > namespace WebCore { > > struct LongRange { >- std::optional<int> max; >- std::optional<int> min; >+ WTF::Optional<int> max; >+ WTF::Optional<int> min; > }; > > } >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >index 70533ad51ed81a569c02e55daebbbb7e9d4c108a..97cc58390f8de0eb11e98a7ede1e8c677ffec715 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >@@ -316,7 +316,7 @@ MediaStreamTrack::TrackCapabilities MediaStreamTrack::getCapabilities() const > return result; > } > >-static MediaConstraints createMediaConstraints(const std::optional<MediaTrackConstraints>& constraints) >+static MediaConstraints createMediaConstraints(const WTF::Optional<MediaTrackConstraints>& constraints) > { > if (!constraints) { > MediaConstraints validConstraints; >@@ -326,7 +326,7 @@ static MediaConstraints createMediaConstraints(const std::optional<MediaTrackCon > return createMediaConstraints(constraints.value()); > } > >-void MediaStreamTrack::applyConstraints(const std::optional<MediaTrackConstraints>& constraints, DOMPromiseDeferred<void>&& promise) >+void MediaStreamTrack::applyConstraints(const WTF::Optional<MediaTrackConstraints>& constraints, DOMPromiseDeferred<void>&& promise) > { > m_promise = WTFMove(promise); > >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >index d82c3a9d8a36d75a898abd03e4ffa4a8578f3466..7d065217141d44462c6308ca4babca522483c289 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >@@ -91,16 +91,16 @@ public: > bool isCaptureTrack() const { return m_private->isCaptureTrack(); } > > struct TrackSettings { >- std::optional<int> width; >- std::optional<int> height; >- std::optional<double> aspectRatio; >- std::optional<double> frameRate; >+ WTF::Optional<int> width; >+ WTF::Optional<int> height; >+ WTF::Optional<double> aspectRatio; >+ WTF::Optional<double> frameRate; > String facingMode; >- std::optional<double> volume; >- std::optional<int> sampleRate; >- std::optional<int> sampleSize; >- std::optional<bool> echoCancellation; >- std::optional<bool> displaySurface; >+ WTF::Optional<double> volume; >+ WTF::Optional<int> sampleRate; >+ WTF::Optional<int> sampleSize; >+ WTF::Optional<bool> echoCancellation; >+ WTF::Optional<bool> displaySurface; > String logicalSurface; > String deviceId; > String groupId; >@@ -108,22 +108,22 @@ public: > TrackSettings getSettings() const; > > struct TrackCapabilities { >- std::optional<LongRange> width; >- std::optional<LongRange> height; >- std::optional<DoubleRange> aspectRatio; >- std::optional<DoubleRange> frameRate; >- std::optional<Vector<String>> facingMode; >- std::optional<DoubleRange> volume; >- std::optional<LongRange> sampleRate; >- std::optional<LongRange> sampleSize; >- std::optional<Vector<bool>> echoCancellation; >+ WTF::Optional<LongRange> width; >+ WTF::Optional<LongRange> height; >+ WTF::Optional<DoubleRange> aspectRatio; >+ WTF::Optional<DoubleRange> frameRate; >+ WTF::Optional<Vector<String>> facingMode; >+ WTF::Optional<DoubleRange> volume; >+ WTF::Optional<LongRange> sampleRate; >+ WTF::Optional<LongRange> sampleSize; >+ WTF::Optional<Vector<bool>> echoCancellation; > String deviceId; > String groupId; > }; > TrackCapabilities getCapabilities() const; > > const MediaTrackConstraints& getConstraints() const { return m_constraints; } >- void applyConstraints(const std::optional<MediaTrackConstraints>&, DOMPromiseDeferred<void>&&); >+ void applyConstraints(const WTF::Optional<MediaTrackConstraints>&, DOMPromiseDeferred<void>&&); > > RealtimeMediaSource& source() const { return m_private->source(); } > MediaStreamTrackPrivate& privateTrack() { return m_private.get(); } >@@ -180,7 +180,7 @@ private: > > > MediaTrackConstraints m_constraints; >- std::optional<DOMPromiseDeferred<void>> m_promise; >+ WTF::Optional<DOMPromiseDeferred<void>> m_promise; > GenericTaskQueue<ScriptExecutionContext> m_taskQueue; > > bool m_ended { false }; >diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp b/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp >index 9f10482196941b0f52468531c404f54f60a47c49..f5404277b09bc07ecf9b21eec5b3c023945faafb 100644 >--- a/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp >+++ b/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp >@@ -148,7 +148,7 @@ static void set(MediaTrackConstraintSetMap& map, ConstraintSetType setType, cons > map.set(type, WTFMove(constraint)); > } > >-template<typename T> static inline void set(MediaTrackConstraintSetMap& map, ConstraintSetType setType, const char* typeAsString, MediaConstraintType type, const std::optional<T>& value) >+template<typename T> static inline void set(MediaTrackConstraintSetMap& map, ConstraintSetType setType, const char* typeAsString, MediaConstraintType type, const WTF::Optional<T>& value) > { > if (!value) > return; >@@ -185,7 +185,7 @@ static Vector<MediaTrackConstraintSetMap> convertAdvancedToInternalForm(const Ve > return result; > } > >-static Vector<MediaTrackConstraintSetMap> convertAdvancedToInternalForm(const std::optional<Vector<MediaTrackConstraintSet>>& optionalVector) >+static Vector<MediaTrackConstraintSetMap> convertAdvancedToInternalForm(const WTF::Optional<Vector<MediaTrackConstraintSet>>& optionalVector) > { > if (!optionalVector) > return { }; >diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h b/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h >index 7314285ecf29d22a5df10040ccc7ca86362abd4d..2dd779a91412445ce20fecbf83c46889af3b3eab 100644 >--- a/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h >+++ b/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h >@@ -37,23 +37,23 @@ namespace WebCore { > struct MediaConstraints; > > struct ConstrainBooleanParameters { >- std::optional<bool> exact; >- std::optional<bool> ideal; >+ WTF::Optional<bool> exact; >+ WTF::Optional<bool> ideal; > }; > > struct ConstrainDOMStringParameters { >- std::optional<Variant<String, Vector<String>>> exact; >- std::optional<Variant<String, Vector<String>>> ideal; >+ WTF::Optional<Variant<String, Vector<String>>> exact; >+ WTF::Optional<Variant<String, Vector<String>>> ideal; > }; > > struct ConstrainDoubleRange : DoubleRange { >- std::optional<double> exact; >- std::optional<double> ideal; >+ WTF::Optional<double> exact; >+ WTF::Optional<double> ideal; > }; > > struct ConstrainLongRange : LongRange { >- std::optional<int> exact; >- std::optional<int> ideal; >+ WTF::Optional<int> exact; >+ WTF::Optional<int> ideal; > }; > > using ConstrainBoolean = Variant<bool, ConstrainBooleanParameters>; >@@ -62,23 +62,23 @@ using ConstrainDouble = Variant<double, ConstrainDoubleRange>; > using ConstrainLong = Variant<int, ConstrainLongRange>; > > struct MediaTrackConstraintSet { >- std::optional<ConstrainLong> width; >- std::optional<ConstrainLong> height; >- std::optional<ConstrainDouble> aspectRatio; >- std::optional<ConstrainDouble> frameRate; >- std::optional<ConstrainDOMString> facingMode; >- std::optional<ConstrainDouble> volume; >- std::optional<ConstrainLong> sampleRate; >- std::optional<ConstrainLong> sampleSize; >- std::optional<ConstrainBoolean> echoCancellation; >- std::optional<ConstrainDOMString> deviceId; >- std::optional<ConstrainDOMString> groupId; >- std::optional<ConstrainDOMString> displaySurface; >- std::optional<ConstrainBoolean> logicalSurface; >+ WTF::Optional<ConstrainLong> width; >+ WTF::Optional<ConstrainLong> height; >+ WTF::Optional<ConstrainDouble> aspectRatio; >+ WTF::Optional<ConstrainDouble> frameRate; >+ WTF::Optional<ConstrainDOMString> facingMode; >+ WTF::Optional<ConstrainDouble> volume; >+ WTF::Optional<ConstrainLong> sampleRate; >+ WTF::Optional<ConstrainLong> sampleSize; >+ WTF::Optional<ConstrainBoolean> echoCancellation; >+ WTF::Optional<ConstrainDOMString> deviceId; >+ WTF::Optional<ConstrainDOMString> groupId; >+ WTF::Optional<ConstrainDOMString> displaySurface; >+ WTF::Optional<ConstrainBoolean> logicalSurface; > }; > > struct MediaTrackConstraints : MediaTrackConstraintSet { >- std::optional<Vector<MediaTrackConstraintSet>> advanced; >+ WTF::Optional<Vector<MediaTrackConstraintSet>> advanced; > }; > > MediaConstraints createMediaConstraints(const MediaTrackConstraints&); >diff --git a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp >index d20dbca0c6cff6a4fe8039904f44968946c1173f..2b0acd391831310628b5ce2b57c8aaa7a09e7ded 100644 >--- a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp >+++ b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp >@@ -59,13 +59,13 @@ static std::unique_ptr<PeerConnectionBackend> createNoPeerConnectionBackend(RTCP > > CreatePeerConnectionBackend PeerConnectionBackend::create = createNoPeerConnectionBackend; > >-std::optional<RTCRtpCapabilities> PeerConnectionBackend::receiverCapabilities(ScriptExecutionContext&, const String&) >+WTF::Optional<RTCRtpCapabilities> PeerConnectionBackend::receiverCapabilities(ScriptExecutionContext&, const String&) > { > ASSERT_NOT_REACHED(); > return { }; > } > >-std::optional<RTCRtpCapabilities> PeerConnectionBackend::senderCapabilities(ScriptExecutionContext&, const String&) >+WTF::Optional<RTCRtpCapabilities> PeerConnectionBackend::senderCapabilities(ScriptExecutionContext&, const String&) > { > ASSERT_NOT_REACHED(); > return { }; >@@ -100,7 +100,7 @@ void PeerConnectionBackend::createOfferSucceeded(String&& sdp) > > ASSERT(m_offerAnswerPromise); > m_offerAnswerPromise->resolve(RTCSessionDescription::Init { RTCSdpType::Offer, filterSDP(WTFMove(sdp)) }); >- m_offerAnswerPromise = std::nullopt; >+ m_offerAnswerPromise = WTF::nullopt; > } > > void PeerConnectionBackend::createOfferFailed(Exception&& exception) >@@ -113,7 +113,7 @@ void PeerConnectionBackend::createOfferFailed(Exception&& exception) > > ASSERT(m_offerAnswerPromise); > m_offerAnswerPromise->reject(WTFMove(exception)); >- m_offerAnswerPromise = std::nullopt; >+ m_offerAnswerPromise = WTF::nullopt; > } > > void PeerConnectionBackend::createAnswer(RTCAnswerOptions&& options, PeerConnection::SessionDescriptionPromise&& promise) >@@ -135,7 +135,7 @@ void PeerConnectionBackend::createAnswerSucceeded(String&& sdp) > > ASSERT(m_offerAnswerPromise); > m_offerAnswerPromise->resolve(RTCSessionDescription::Init { RTCSdpType::Answer, WTFMove(sdp) }); >- m_offerAnswerPromise = std::nullopt; >+ m_offerAnswerPromise = WTF::nullopt; > } > > void PeerConnectionBackend::createAnswerFailed(Exception&& exception) >@@ -148,7 +148,7 @@ void PeerConnectionBackend::createAnswerFailed(Exception&& exception) > > ASSERT(m_offerAnswerPromise); > m_offerAnswerPromise->reject(WTFMove(exception)); >- m_offerAnswerPromise = std::nullopt; >+ m_offerAnswerPromise = WTF::nullopt; > } > > static inline bool isLocalDescriptionTypeValidForState(RTCSdpType type, RTCSignalingState state) >@@ -194,7 +194,7 @@ void PeerConnectionBackend::setLocalDescriptionSucceeded() > ASSERT(m_setDescriptionPromise); > > m_setDescriptionPromise->resolve(); >- m_setDescriptionPromise = std::nullopt; >+ m_setDescriptionPromise = WTF::nullopt; > } > > void PeerConnectionBackend::setLocalDescriptionFailed(Exception&& exception) >@@ -208,7 +208,7 @@ void PeerConnectionBackend::setLocalDescriptionFailed(Exception&& exception) > ASSERT(m_setDescriptionPromise); > > m_setDescriptionPromise->reject(WTFMove(exception)); >- m_setDescriptionPromise = std::nullopt; >+ m_setDescriptionPromise = WTF::nullopt; > } > > static inline bool isRemoteDescriptionTypeValidForState(RTCSdpType type, RTCSignalingState state) >@@ -254,7 +254,7 @@ void PeerConnectionBackend::setRemoteDescriptionSucceeded() > ASSERT(m_setDescriptionPromise); > > m_setDescriptionPromise->resolve(); >- m_setDescriptionPromise = std::nullopt; >+ m_setDescriptionPromise = WTF::nullopt; > } > > void PeerConnectionBackend::setRemoteDescriptionFailed(Exception&& exception) >@@ -268,7 +268,7 @@ void PeerConnectionBackend::setRemoteDescriptionFailed(Exception&& exception) > ASSERT(m_setDescriptionPromise); > > m_setDescriptionPromise->reject(WTFMove(exception)); >- m_setDescriptionPromise = std::nullopt; >+ m_setDescriptionPromise = WTF::nullopt; > } > > static String extractIPAddres(const String& sdp) >@@ -312,7 +312,7 @@ void PeerConnectionBackend::addIceCandidateSucceeded() > ASSERT(m_addIceCandidatePromise); > > m_addIceCandidatePromise->resolve(); >- m_addIceCandidatePromise = std::nullopt; >+ m_addIceCandidatePromise = WTF::nullopt; > > if (!m_waitingForMDNSResolution && m_finishedReceivingCandidates) > endOfIceCandidates(WTFMove(*m_endOfIceCandidatePromise)); >@@ -329,7 +329,7 @@ void PeerConnectionBackend::addIceCandidateFailed(Exception&& exception) > ASSERT(m_addIceCandidatePromise); > > m_addIceCandidatePromise->reject(WTFMove(exception)); >- m_addIceCandidatePromise = std::nullopt; >+ m_addIceCandidatePromise = WTF::nullopt; > > if (!m_waitingForMDNSResolution && m_finishedReceivingCandidates) > endOfIceCandidates(WTFMove(*m_endOfIceCandidatePromise)); >@@ -494,9 +494,9 @@ void PeerConnectionBackend::updateSignalingState(RTCSignalingState newSignalingS > > void PeerConnectionBackend::stop() > { >- m_offerAnswerPromise = std::nullopt; >- m_setDescriptionPromise = std::nullopt; >- m_addIceCandidatePromise = std::nullopt; >+ m_offerAnswerPromise = WTF::nullopt; >+ m_setDescriptionPromise = WTF::nullopt; >+ m_addIceCandidatePromise = WTF::nullopt; > > doStop(); > } >diff --git a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h >index a2c1bee9ea1794da4ab33e288adf58779985b5f1..e390d421c292a4d632e2fa661f9fae818b19e840 100644 >--- a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h >+++ b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h >@@ -79,8 +79,8 @@ class PeerConnectionBackend > public: > WEBCORE_EXPORT static CreatePeerConnectionBackend create; > >- static std::optional<RTCRtpCapabilities> receiverCapabilities(ScriptExecutionContext&, const String& kind); >- static std::optional<RTCRtpCapabilities> senderCapabilities(ScriptExecutionContext&, const String& kind); >+ static WTF::Optional<RTCRtpCapabilities> receiverCapabilities(ScriptExecutionContext&, const String& kind); >+ static WTF::Optional<RTCRtpCapabilities> senderCapabilities(ScriptExecutionContext&, const String& kind); > > explicit PeerConnectionBackend(RTCPeerConnection&); > virtual ~PeerConnectionBackend() = default; >@@ -161,9 +161,9 @@ public: > } > > Type type; >- std::optional<double> expires; >+ WTF::Optional<double> expires; > >- std::optional<RSA> rsaParameters; >+ WTF::Optional<RSA> rsaParameters; > }; > static void generateCertificate(Document&, const CertificateInformation&, DOMPromiseDeferred<IDLInterface<RTCCertificate>>&&); > >@@ -207,10 +207,10 @@ protected: > RTCPeerConnection& m_peerConnection; > > private: >- std::optional<PeerConnection::SessionDescriptionPromise> m_offerAnswerPromise; >- std::optional<DOMPromiseDeferred<void>> m_setDescriptionPromise; >- std::optional<DOMPromiseDeferred<void>> m_addIceCandidatePromise; >- std::optional<DOMPromiseDeferred<void>> m_endOfIceCandidatePromise; >+ WTF::Optional<PeerConnection::SessionDescriptionPromise> m_offerAnswerPromise; >+ WTF::Optional<DOMPromiseDeferred<void>> m_setDescriptionPromise; >+ WTF::Optional<DOMPromiseDeferred<void>> m_addIceCandidatePromise; >+ WTF::Optional<DOMPromiseDeferred<void>> m_endOfIceCandidatePromise; > > bool m_shouldFilterICECandidates { true }; > struct PendingICECandidate { >diff --git a/Source/WebCore/Modules/mediastream/RTCConfiguration.h b/Source/WebCore/Modules/mediastream/RTCConfiguration.h >index dd1e17c0d6303f5ab691e07e14ab71acc4e284fa..9e9357c651998294ec8cb146fc981d1764b985f4 100644 >--- a/Source/WebCore/Modules/mediastream/RTCConfiguration.h >+++ b/Source/WebCore/Modules/mediastream/RTCConfiguration.h >@@ -42,7 +42,7 @@ > namespace WebCore { > > struct RTCConfiguration { >- std::optional<Vector<RTCIceServer>> iceServers; >+ WTF::Optional<Vector<RTCIceServer>> iceServers; > RTCIceTransportPolicy iceTransportPolicy; > RTCBundlePolicy bundlePolicy; > RTCPMuxPolicy rtcpMuxPolicy; >diff --git a/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp b/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp >index 794ca8f4904dfb64dd867bcc6f6d13c70bcaf163..c5b348874e0c5e7bf9320ce56fa238ccc44165cd 100644 >--- a/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp >+++ b/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp >@@ -68,7 +68,7 @@ String RTCDTMFSender::toneBuffer() const > return { }; > } > >-ExceptionOr<void> RTCDTMFSender::insertDTMF(const String&, std::optional<int> duration, std::optional<int> interToneGap) >+ExceptionOr<void> RTCDTMFSender::insertDTMF(const String&, WTF::Optional<int> duration, WTF::Optional<int> interToneGap) > { > if (!canInsertDTMF()) > return Exception { NotSupportedError }; >diff --git a/Source/WebCore/Modules/mediastream/RTCDTMFSender.h b/Source/WebCore/Modules/mediastream/RTCDTMFSender.h >index 00fce07c95229ae88505b6116cb6681f03881f8d..d18a747d785923cb5bc24832515f98719ea30c16 100644 >--- a/Source/WebCore/Modules/mediastream/RTCDTMFSender.h >+++ b/Source/WebCore/Modules/mediastream/RTCDTMFSender.h >@@ -47,7 +47,7 @@ public: > int duration() const { return m_duration; } > int interToneGap() const { return m_interToneGap; } > >- ExceptionOr<void> insertDTMF(const String& tones, std::optional<int> duration, std::optional<int> interToneGap); >+ ExceptionOr<void> insertDTMF(const String& tones, WTF::Optional<int> duration, WTF::Optional<int> interToneGap); > > using RefCounted::ref; > using RefCounted::deref; >diff --git a/Source/WebCore/Modules/mediastream/RTCDataChannel.h b/Source/WebCore/Modules/mediastream/RTCDataChannel.h >index 620adb4348c6462bebd7b5efe5e643a0a36ae6db..8ef9c780c4aceb585b7e123a1ac4b538b1bc221d 100644 >--- a/Source/WebCore/Modules/mediastream/RTCDataChannel.h >+++ b/Source/WebCore/Modules/mediastream/RTCDataChannel.h >@@ -51,11 +51,11 @@ public: > static Ref<RTCDataChannel> create(ScriptExecutionContext&, std::unique_ptr<RTCDataChannelHandler>&&, String&&, RTCDataChannelInit&&); > > bool ordered() const { return *m_options.ordered; } >- std::optional<unsigned short> maxPacketLifeTime() const { return m_options.maxPacketLifeTime; } >- std::optional<unsigned short> maxRetransmits() const { return m_options.maxRetransmits; } >+ WTF::Optional<unsigned short> maxPacketLifeTime() const { return m_options.maxPacketLifeTime; } >+ WTF::Optional<unsigned short> maxRetransmits() const { return m_options.maxRetransmits; } > String protocol() const { return m_options.protocol; } > bool negotiated() const { return *m_options.negotiated; }; >- std::optional<unsigned short> id() const { return m_options.id; }; >+ WTF::Optional<unsigned short> id() const { return m_options.id; }; > > String label() const { return m_label; } > RTCDataChannelState readyState() const {return m_readyState; } >diff --git a/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp b/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp >index eaf7aff52f2fabe51252c37d4a4380a3f8eac7a0..27de165c6e95f0e9132f65b5841a333406db477f 100644 >--- a/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp >+++ b/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp >@@ -37,7 +37,7 @@ > > namespace WebCore { > >-inline RTCIceCandidate::RTCIceCandidate(const String& candidate, const String& sdpMid, std::optional<unsigned short> sdpMLineIndex) >+inline RTCIceCandidate::RTCIceCandidate(const String& candidate, const String& sdpMid, WTF::Optional<unsigned short> sdpMLineIndex) > : m_candidate(candidate) > , m_sdpMid(sdpMid) > , m_sdpMLineIndex(sdpMLineIndex) >@@ -52,7 +52,7 @@ ExceptionOr<Ref<RTCIceCandidate>> RTCIceCandidate::create(const Init& dictionary > return create(dictionary.candidate, dictionary.sdpMid, dictionary.sdpMLineIndex); > } > >-Ref<RTCIceCandidate> RTCIceCandidate::create(const String& candidate, const String& sdpMid, std::optional<unsigned short> sdpMLineIndex) >+Ref<RTCIceCandidate> RTCIceCandidate::create(const String& candidate, const String& sdpMid, WTF::Optional<unsigned short> sdpMLineIndex) > { > return adoptRef(*new RTCIceCandidate(candidate, sdpMid, sdpMLineIndex)); > } >diff --git a/Source/WebCore/Modules/mediastream/RTCIceCandidate.h b/Source/WebCore/Modules/mediastream/RTCIceCandidate.h >index b35c20db7f13b709ab51c95c8d11f44fa542976c..4152c3ca32c0bb8801e4a22afa1b73d14e2466e6 100644 >--- a/Source/WebCore/Modules/mediastream/RTCIceCandidate.h >+++ b/Source/WebCore/Modules/mediastream/RTCIceCandidate.h >@@ -42,24 +42,24 @@ public: > struct Init { > String candidate; > String sdpMid; >- std::optional<unsigned short> sdpMLineIndex; >+ WTF::Optional<unsigned short> sdpMLineIndex; > }; > > static ExceptionOr<Ref<RTCIceCandidate>> create(const Init&); >- static Ref<RTCIceCandidate> create(const String& candidate, const String& sdpMid, std::optional<unsigned short> sdpMLineIndex); >+ static Ref<RTCIceCandidate> create(const String& candidate, const String& sdpMid, WTF::Optional<unsigned short> sdpMLineIndex); > > const String& candidate() const { return m_candidate; } > const String& sdpMid() const { return m_sdpMid; } >- std::optional<unsigned short> sdpMLineIndex() const { return m_sdpMLineIndex; } >+ WTF::Optional<unsigned short> sdpMLineIndex() const { return m_sdpMLineIndex; } > > void setCandidate(String&& candidate) { m_candidate = WTFMove(candidate); } > > private: >- RTCIceCandidate(const String& candidate, const String& sdpMid, std::optional<unsigned short> sdpMLineIndex); >+ RTCIceCandidate(const String& candidate, const String& sdpMid, WTF::Optional<unsigned short> sdpMLineIndex); > > String m_candidate; > String m_sdpMid; >- std::optional<unsigned short> m_sdpMLineIndex; >+ WTF::Optional<unsigned short> m_sdpMLineIndex; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h >index 2e13663f84e42fcfa74076d6079f0280ef859400..f182277a19e3927a8f7fa5629dc8581499f3b029 100644 >--- a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h >+++ b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h >@@ -89,9 +89,9 @@ public: > String name; > String hash; > String namedCurve; >- std::optional<uint32_t> modulusLength; >+ WTF::Optional<uint32_t> modulusLength; > RefPtr<Uint8Array> publicExponent; >- std::optional<double> expires; >+ WTF::Optional<double> expires; > }; > > using AlgorithmIdentifier = Variant<JSC::Strong<JSC::JSObject>, String>; >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpContributingSource.h b/Source/WebCore/Modules/mediastream/RTCRtpContributingSource.h >index 8d89753b2995638ff3655f2546141149c8ede23e..c5d00e67fa422168e99c77a29d56acae22433eec 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpContributingSource.h >+++ b/Source/WebCore/Modules/mediastream/RTCRtpContributingSource.h >@@ -32,7 +32,7 @@ namespace WebCore { > struct RTCRtpContributingSource { > double timestamp; > unsigned long source; >- std::optional<double> audioLevel; >+ WTF::Optional<double> audioLevel; > }; > > >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.h b/Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.h >index 7a5c7dcd7e5da19d536caa5efdb0d33c8cda9f63..d95c0d457a5eb972aababd5fdc29c9328edb8fe2 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.h >+++ b/Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.h >@@ -39,7 +39,7 @@ struct RTCRtpEncodingParameters : RTCRtpCodingParameters { > unsigned long ssrc { 0 }; > RTCRtpRtxParameters rtx; > RTCRtpFecParameters fec; >- std::optional<RTCDtxStatus> dtx; >+ WTF::Optional<RTCDtxStatus> dtx; > bool active { false}; > RTCPriorityType priority { RTCPriorityType::Medium }; > unsigned long maxBitrate { 0 }; >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpReceiver.cpp b/Source/WebCore/Modules/mediastream/RTCRtpReceiver.cpp >index 7ffb5c8e2927826538aefb9ca05d25477b9b742a..e54c73839bafaab94603fb1a550ae9cede7ec8df 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpReceiver.cpp >+++ b/Source/WebCore/Modules/mediastream/RTCRtpReceiver.cpp >@@ -63,7 +63,7 @@ void RTCRtpReceiver::getStats(Ref<DeferredPromise>&& promise) > m_connection->getStats(*this, WTFMove(promise)); > } > >-std::optional<RTCRtpCapabilities> RTCRtpReceiver::getCapabilities(ScriptExecutionContext& context, const String& kind) >+WTF::Optional<RTCRtpCapabilities> RTCRtpReceiver::getCapabilities(ScriptExecutionContext& context, const String& kind) > { > return PeerConnectionBackend::receiverCapabilities(context, kind); > } >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpReceiver.h b/Source/WebCore/Modules/mediastream/RTCRtpReceiver.h >index 97feb815b4e0f31bb1b7fa894b9545d05212aca4..f58a607b45abc20adeb6c58131a1f2e0ebc46cf4 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpReceiver.h >+++ b/Source/WebCore/Modules/mediastream/RTCRtpReceiver.h >@@ -49,7 +49,7 @@ public: > return adoptRef(*new RTCRtpReceiver(connection, WTFMove(track), WTFMove(backend))); > } > >- static std::optional<RTCRtpCapabilities> getCapabilities(ScriptExecutionContext&, const String& kind); >+ static WTF::Optional<RTCRtpCapabilities> getCapabilities(ScriptExecutionContext&, const String& kind); > > void stop(); > >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp b/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp >index 2744d064bf86b84783feca3fa803e633b0f67929..28fcb9a3c0ffafaa91e6aa5c45d6c265fc6a1797 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp >+++ b/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp >@@ -127,7 +127,7 @@ bool RTCRtpSender::isCreatedBy(const PeerConnectionBackend& connection) const > return &connection == m_connection.get(); > } > >-std::optional<RTCRtpCapabilities> RTCRtpSender::getCapabilities(ScriptExecutionContext& context, const String& kind) >+WTF::Optional<RTCRtpCapabilities> RTCRtpSender::getCapabilities(ScriptExecutionContext& context, const String& kind) > { > return PeerConnectionBackend::senderCapabilities(context, kind); > } >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpSender.h b/Source/WebCore/Modules/mediastream/RTCRtpSender.h >index 3f4483f3074e371ee3a1cc6243d9e272e38dc6a3..77ffad62559453f4aa7371a99670dad38f44963f 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpSender.h >+++ b/Source/WebCore/Modules/mediastream/RTCRtpSender.h >@@ -47,7 +47,7 @@ public: > static Ref<RTCRtpSender> create(PeerConnectionBackend&, Ref<MediaStreamTrack>&&, Vector<String>&& mediaStreamIds, std::unique_ptr<RTCRtpSenderBackend>&&); > static Ref<RTCRtpSender> create(PeerConnectionBackend&, String&& trackKind, Vector<String>&& mediaStreamIds, std::unique_ptr<RTCRtpSenderBackend>&&); > >- static std::optional<RTCRtpCapabilities> getCapabilities(ScriptExecutionContext&, const String& kind); >+ static WTF::Optional<RTCRtpCapabilities> getCapabilities(ScriptExecutionContext&, const String& kind); > > MediaStreamTrack* track() { return m_track.get(); } > >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpSynchronizationSource.h b/Source/WebCore/Modules/mediastream/RTCRtpSynchronizationSource.h >index 7f33816a75fd1dc30c6f4877d956842eaf06ce33..e5348588a9f017e4f478c4a261c37bc4c9eed6d4 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpSynchronizationSource.h >+++ b/Source/WebCore/Modules/mediastream/RTCRtpSynchronizationSource.h >@@ -32,7 +32,7 @@ > namespace WebCore { > > struct RTCRtpSynchronizationSource : RTCRtpContributingSource { >- std::optional<bool> voiceActivityFlag; >+ WTF::Optional<bool> voiceActivityFlag; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.cpp b/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.cpp >index 84bcc1ea90a1091725f46c5cb832f20a028ad8d3..e390bcbe4a4d155d5320897ad7a0c26ca6a63295 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.cpp >+++ b/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.cpp >@@ -64,10 +64,10 @@ RTCRtpTransceiverDirection RTCRtpTransceiver::direction() const > return m_backend->direction(); > } > >-std::optional<RTCRtpTransceiverDirection> RTCRtpTransceiver::currentDirection() const >+WTF::Optional<RTCRtpTransceiverDirection> RTCRtpTransceiver::currentDirection() const > { > if (!m_backend) >- return std::nullopt; >+ return WTF::nullopt; > return m_backend->currentDirection(); > } > >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.h b/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.h >index 456749452026c953f5b3f386ac88a262727eed00..915ee28b454524ec26c4475014532fd00c874249 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.h >+++ b/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.h >@@ -55,7 +55,7 @@ public: > void disableSendingDirection(); > > RTCRtpTransceiverDirection direction() const; >- std::optional<RTCRtpTransceiverDirection> currentDirection() const; >+ WTF::Optional<RTCRtpTransceiverDirection> currentDirection() const; > void setDirection(RTCRtpTransceiverDirection); > String mid() const; > >diff --git a/Source/WebCore/Modules/mediastream/RTCRtpTransceiverBackend.h b/Source/WebCore/Modules/mediastream/RTCRtpTransceiverBackend.h >index 670b2d8d64488f8cade1dbdece68395414661825..600896c81ac3432277f89639cac3a9c445c726f2 100644 >--- a/Source/WebCore/Modules/mediastream/RTCRtpTransceiverBackend.h >+++ b/Source/WebCore/Modules/mediastream/RTCRtpTransceiverBackend.h >@@ -35,7 +35,7 @@ public: > virtual ~RTCRtpTransceiverBackend() = default; > > virtual RTCRtpTransceiverDirection direction() const = 0; >- virtual std::optional<RTCRtpTransceiverDirection> currentDirection() const = 0; >+ virtual WTF::Optional<RTCRtpTransceiverDirection> currentDirection() const = 0; > virtual void setDirection(RTCRtpTransceiverDirection) = 0; > > virtual String mid() = 0; >diff --git a/Source/WebCore/Modules/mediastream/RTCStatsReport.h b/Source/WebCore/Modules/mediastream/RTCStatsReport.h >index dc0dd5bef725198aa2b18b1a095c3fa6274ecccb..6347723e1d2f4b684c28200fc357fcdfaceb7fff 100644 >--- a/Source/WebCore/Modules/mediastream/RTCStatsReport.h >+++ b/Source/WebCore/Modules/mediastream/RTCStatsReport.h >@@ -59,7 +59,7 @@ public: > }; > > struct RTCRTPStreamStats : Stats { >- std::optional<uint32_t> ssrc; >+ WTF::Optional<uint32_t> ssrc; > String associateStatsId; > bool isRemote { false }; > String mediaType; >@@ -67,63 +67,63 @@ public: > String trackId; > String transportId; > String codecId; >- std::optional<uint32_t> firCount; >- std::optional<uint32_t> pliCount; >- std::optional<uint32_t> nackCount; >- std::optional<uint32_t> sliCount; >- std::optional<uint64_t> qpSum; >+ WTF::Optional<uint32_t> firCount; >+ WTF::Optional<uint32_t> pliCount; >+ WTF::Optional<uint32_t> nackCount; >+ WTF::Optional<uint32_t> sliCount; >+ WTF::Optional<uint64_t> qpSum; > }; > > struct InboundRTPStreamStats : RTCRTPStreamStats { > InboundRTPStreamStats() { type = RTCStatsReport::Type::InboundRtp; } > >- std::optional<uint32_t> packetsReceived; >- std::optional<uint64_t> bytesReceived; >- std::optional<uint32_t> packetsLost; >- std::optional<double> jitter; >- std::optional<double> fractionLost; >- std::optional<uint32_t> packetsDiscarded; >- std::optional<uint32_t> packetsRepaired; >- std::optional<uint32_t> burstPacketsLost; >- std::optional<uint32_t> burstPacketsDiscarded; >- std::optional<uint32_t> burstLossCount; >- std::optional<uint32_t> burstDiscardCount; >- std::optional<double> burstLossRate; >- std::optional<double> burstDiscardRate; >- std::optional<double> gapLossRate; >- std::optional<double> gapDiscardRate; >- std::optional<uint32_t> framesDecoded; >+ WTF::Optional<uint32_t> packetsReceived; >+ WTF::Optional<uint64_t> bytesReceived; >+ WTF::Optional<uint32_t> packetsLost; >+ WTF::Optional<double> jitter; >+ WTF::Optional<double> fractionLost; >+ WTF::Optional<uint32_t> packetsDiscarded; >+ WTF::Optional<uint32_t> packetsRepaired; >+ WTF::Optional<uint32_t> burstPacketsLost; >+ WTF::Optional<uint32_t> burstPacketsDiscarded; >+ WTF::Optional<uint32_t> burstLossCount; >+ WTF::Optional<uint32_t> burstDiscardCount; >+ WTF::Optional<double> burstLossRate; >+ WTF::Optional<double> burstDiscardRate; >+ WTF::Optional<double> gapLossRate; >+ WTF::Optional<double> gapDiscardRate; >+ WTF::Optional<uint32_t> framesDecoded; > }; > > struct OutboundRTPStreamStats : RTCRTPStreamStats { > OutboundRTPStreamStats() { type = RTCStatsReport::Type::OutboundRtp; } > >- std::optional<uint32_t> packetsSent; >- std::optional<uint64_t> bytesSent; >- std::optional<double> targetBitrate; >- std::optional<uint32_t> framesEncoded; >+ WTF::Optional<uint32_t> packetsSent; >+ WTF::Optional<uint64_t> bytesSent; >+ WTF::Optional<double> targetBitrate; >+ WTF::Optional<uint32_t> framesEncoded; > }; > > struct MediaStreamTrackStats : Stats { > MediaStreamTrackStats() { type = RTCStatsReport::Type::Track; } > > String trackIdentifier; >- std::optional<bool> remoteSource; >- std::optional<bool> ended; >- std::optional<bool> detached; >- std::optional<uint32_t> frameWidth; >- std::optional<uint32_t> frameHeight; >- std::optional<double> framesPerSecond; >- std::optional<uint32_t> framesSent; >- std::optional<uint32_t> framesReceived; >- std::optional<uint32_t> framesDecoded; >- std::optional<uint32_t> framesDropped; >- std::optional<uint32_t> framesCorrupted; >- std::optional<uint32_t> partialFramesLost; >- std::optional<uint32_t> fullFramesLost; >- std::optional<double> audioLevel; >- std::optional<double> echoReturnLoss; >- std::optional<double> echoReturnLossEnhancement; >+ WTF::Optional<bool> remoteSource; >+ WTF::Optional<bool> ended; >+ WTF::Optional<bool> detached; >+ WTF::Optional<uint32_t> frameWidth; >+ WTF::Optional<uint32_t> frameHeight; >+ WTF::Optional<double> framesPerSecond; >+ WTF::Optional<uint32_t> framesSent; >+ WTF::Optional<uint32_t> framesReceived; >+ WTF::Optional<uint32_t> framesDecoded; >+ WTF::Optional<uint32_t> framesDropped; >+ WTF::Optional<uint32_t> framesCorrupted; >+ WTF::Optional<uint32_t> partialFramesLost; >+ WTF::Optional<uint32_t> fullFramesLost; >+ WTF::Optional<double> audioLevel; >+ WTF::Optional<double> echoReturnLoss; >+ WTF::Optional<double> echoReturnLossEnhancement; > }; > > struct DataChannelStats : Stats { >@@ -131,12 +131,12 @@ public: > > String label; > String protocol; >- std::optional<int> datachannelid; >+ WTF::Optional<int> datachannelid; > String state; >- std::optional<uint32_t> messagesSent; >- std::optional<uint64_t> bytesSent; >- std::optional<uint32_t> messagesReceived; >- std::optional<uint64_t> bytesReceived; >+ WTF::Optional<uint32_t> messagesSent; >+ WTF::Optional<uint64_t> bytesSent; >+ WTF::Optional<uint32_t> messagesReceived; >+ WTF::Optional<uint64_t> bytesReceived; > }; > > enum class IceCandidatePairState { >@@ -155,26 +155,26 @@ public: > String localCandidateId; > String remoteCandidateId; > IceCandidatePairState state; >- std::optional<uint64_t> priority; >- std::optional<bool> nominated; >- std::optional<bool> writable; >- std::optional<bool> readable; >- std::optional<uint64_t> bytesSent; >- std::optional<uint64_t> bytesReceived; >- std::optional<double> totalRoundTripTime; >- std::optional<double> currentRoundTripTime; >- std::optional<double> availableOutgoingBitrate; >- std::optional<double> availableIncomingBitrate; >- std::optional<uint64_t> requestsReceived; >- std::optional<uint64_t> requestsSent; >- std::optional<uint64_t> responsesReceived; >- std::optional<uint64_t> responsesSent; >- std::optional<uint64_t> retransmissionsReceived; >- std::optional<uint64_t> retransmissionsSent; >- std::optional<uint64_t> consentRequestsReceived; >- std::optional<uint64_t> consentRequestsSent; >- std::optional<uint64_t> consentResponsesReceived; >- std::optional<uint64_t> consentResponsesSent; >+ WTF::Optional<uint64_t> priority; >+ WTF::Optional<bool> nominated; >+ WTF::Optional<bool> writable; >+ WTF::Optional<bool> readable; >+ WTF::Optional<uint64_t> bytesSent; >+ WTF::Optional<uint64_t> bytesReceived; >+ WTF::Optional<double> totalRoundTripTime; >+ WTF::Optional<double> currentRoundTripTime; >+ WTF::Optional<double> availableOutgoingBitrate; >+ WTF::Optional<double> availableIncomingBitrate; >+ WTF::Optional<uint64_t> requestsReceived; >+ WTF::Optional<uint64_t> requestsSent; >+ WTF::Optional<uint64_t> responsesReceived; >+ WTF::Optional<uint64_t> responsesSent; >+ WTF::Optional<uint64_t> retransmissionsReceived; >+ WTF::Optional<uint64_t> retransmissionsSent; >+ WTF::Optional<uint64_t> consentRequestsReceived; >+ WTF::Optional<uint64_t> consentRequestsSent; >+ WTF::Optional<uint64_t> consentResponsesReceived; >+ WTF::Optional<uint64_t> consentResponsesSent; > }; > > enum class IceCandidateType { Host, Srflx, Prflx, Relay }; >@@ -182,10 +182,10 @@ public: > struct IceCandidateStats : Stats { > String transportId; > String address; >- std::optional<int32_t> port; >+ WTF::Optional<int32_t> port; > String protocol; >- std::optional<IceCandidateType> candidateType; >- std::optional<int32_t> priority; >+ WTF::Optional<IceCandidateType> candidateType; >+ WTF::Optional<int32_t> priority; > String url; > bool deleted { false }; > }; >@@ -207,12 +207,12 @@ public: > struct CodecStats : Stats { > CodecStats() { type = RTCStatsReport::Type::Codec; } > >- std::optional<uint32_t> payloadType; >- std::optional<CodecType> codecType; >+ WTF::Optional<uint32_t> payloadType; >+ WTF::Optional<CodecType> codecType; > String transportId; > String mimeType; >- std::optional<uint32_t> clockRate; >- std::optional<uint32_t> channels; >+ WTF::Optional<uint32_t> clockRate; >+ WTF::Optional<uint32_t> channels; > String sdpFmtpLine; > String implementation; > }; >@@ -220,8 +220,8 @@ public: > struct TransportStats : Stats { > TransportStats() { type = RTCStatsReport::Type::Transport; } > >- std::optional<uint64_t> bytesSent; >- std::optional<uint64_t> bytesReceived; >+ WTF::Optional<uint64_t> bytesSent; >+ WTF::Optional<uint64_t> bytesReceived; > String rtcpTransportStatsId; > String selectedCandidatePairId; > String localCertificateId; >@@ -231,8 +231,8 @@ public: > struct PeerConnectionStats : Stats { > PeerConnectionStats() { type = RTCStatsReport::Type::PeerConnection; } > >- std::optional<uint32_t> dataChannelsOpened; >- std::optional<uint32_t> dataChannelsClosed; >+ WTF::Optional<uint32_t> dataChannelsOpened; >+ WTF::Optional<uint32_t> dataChannelsClosed; > }; > > private: >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp >index 8a088be3e3cce151ff1ec5454976fb17edad8474..ee5d5e2b96b08031fb3f29f880c5d6542f34f85e 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp >@@ -87,7 +87,7 @@ private: > } > > RefPtr<SecurityOrigin> m_origin; >- std::optional<DOMPromiseDeferred<IDLInterface<RTCCertificate>>> m_promise; >+ WTF::Optional<DOMPromiseDeferred<IDLInterface<RTCCertificate>>> m_promise; > }; > > static inline rtc::KeyParams keyParamsFromCertificateType(const PeerConnectionBackend::CertificateInformation& info) >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp >index 291ca8e93cbc41086c39a0a82de2fee4543d444d..336083a83ff4e63743ea7269e94f1c553ecda7f4 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp >@@ -534,17 +534,17 @@ void LibWebRTCMediaEndpoint::removeRemoteTrack(rtc::scoped_refptr<webrtc::RtpRec > } > > template<typename T> >-std::optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::createTransceiverBackends(T&& trackOrKind, const RTCRtpTransceiverInit& init, LibWebRTCRtpSenderBackend::Source&& source) >+WTF::Optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::createTransceiverBackends(T&& trackOrKind, const RTCRtpTransceiverInit& init, LibWebRTCRtpSenderBackend::Source&& source) > { > auto result = m_backend->AddTransceiver(WTFMove(trackOrKind), fromRtpTransceiverInit(init)); > if (!result.ok()) >- return std::nullopt; >+ return WTF::nullopt; > > auto transceiver = std::make_unique<LibWebRTCRtpTransceiverBackend>(result.MoveValue()); > return LibWebRTCMediaEndpoint::Backends { transceiver->createSenderBackend(m_peerConnectionBackend, WTFMove(source)), transceiver->createReceiverBackend(), WTFMove(transceiver) }; > } > >-std::optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(const String& trackKind, const RTCRtpTransceiverInit& init) >+WTF::Optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(const String& trackKind, const RTCRtpTransceiverInit& init) > { > auto type = trackKind == "audio" ? cricket::MediaType::MEDIA_TYPE_AUDIO : cricket::MediaType::MEDIA_TYPE_VIDEO; > return createTransceiverBackends(type, init, nullptr); >@@ -574,7 +574,7 @@ std::pair<LibWebRTCRtpSenderBackend::Source, rtc::scoped_refptr<webrtc::MediaStr > return std::make_pair(WTFMove(source), WTFMove(rtcTrack)); > } > >-std::optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(MediaStreamTrack& track, const RTCRtpTransceiverInit& init) >+WTF::Optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(MediaStreamTrack& track, const RTCRtpTransceiverInit& init) > { > auto sourceAndTrack = createSourceAndRTCTrack(track); > return createTransceiverBackends(WTFMove(sourceAndTrack.second), init, WTFMove(sourceAndTrack.first)); >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >index 41cd8847d36c0e78b48234d41b24519977b8a363..a5bb1d61333debd98e91808bc798d0c6e0491881 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >@@ -106,8 +106,8 @@ public: > std::unique_ptr<LibWebRTCRtpReceiverBackend> receiverBackend; > std::unique_ptr<LibWebRTCRtpTransceiverBackend> transceiverBackend; > }; >- std::optional<Backends> addTransceiver(const String& trackKind, const RTCRtpTransceiverInit&); >- std::optional<Backends> addTransceiver(MediaStreamTrack&, const RTCRtpTransceiverInit&); >+ WTF::Optional<Backends> addTransceiver(const String& trackKind, const RTCRtpTransceiverInit&); >+ WTF::Optional<Backends> addTransceiver(MediaStreamTrack&, const RTCRtpTransceiverInit&); > std::unique_ptr<LibWebRTCRtpTransceiverBackend> transceiverBackendFromSender(LibWebRTCRtpSenderBackend&); > > void setSenderSourceFromTrack(LibWebRTCRtpSenderBackend&, MediaStreamTrack&); >@@ -146,7 +146,7 @@ private: > void fireTrackEvent(Ref<RTCRtpReceiver>&&, Ref<MediaStreamTrack>&&, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>&, RefPtr<RTCRtpTransceiver>&&); > > template<typename T> >- std::optional<Backends> createTransceiverBackends(T&&, const RTCRtpTransceiverInit&, LibWebRTCRtpSenderBackend::Source&&); >+ WTF::Optional<Backends> createTransceiverBackends(T&&, const RTCRtpTransceiverInit&, LibWebRTCRtpSenderBackend::Source&&); > > void OnStatsDelivered(const rtc::scoped_refptr<const webrtc::RTCStatsReport>&) final; > void gatherStatsForLogging(); >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp >index a78557ad8d7235f8e221fb2168bb779adfa2f757..e81baaeadc786c17236334ce5de89f16bc14c65e 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp >@@ -66,7 +66,7 @@ static std::unique_ptr<PeerConnectionBackend> createLibWebRTCPeerConnectionBacke > > CreatePeerConnectionBackend PeerConnectionBackend::create = createLibWebRTCPeerConnectionBackend; > >-std::optional<RTCRtpCapabilities> PeerConnectionBackend::receiverCapabilities(ScriptExecutionContext& context, const String& kind) >+WTF::Optional<RTCRtpCapabilities> PeerConnectionBackend::receiverCapabilities(ScriptExecutionContext& context, const String& kind) > { > auto* page = downcast<Document>(context).page(); > if (!page) >@@ -74,7 +74,7 @@ std::optional<RTCRtpCapabilities> PeerConnectionBackend::receiverCapabilities(Sc > return page->libWebRTCProvider().receiverCapabilities(kind); > } > >-std::optional<RTCRtpCapabilities> PeerConnectionBackend::senderCapabilities(ScriptExecutionContext& context, const String& kind) >+WTF::Optional<RTCRtpCapabilities> PeerConnectionBackend::senderCapabilities(ScriptExecutionContext& context, const String& kind) > { > auto* page = downcast<Document>(context).page(); > if (!page) >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp >index 2c1c0158b88763deb28f32c2e8434417ee554e66..1752761fedc7b87da7e77483910aa0ebb4d4f602 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp >@@ -135,7 +135,7 @@ void LibWebRTCRtpSenderBackend::setParameters(const RTCRtpSendParameters& parame > > auto rtcParameters = WTFMove(*m_currentParameters); > updateRTCRtpSendParameters(parameters, rtcParameters); >- m_currentParameters = std::nullopt; >+ m_currentParameters = WTF::nullopt; > > auto error = m_rtcSender->SetParameters(rtcParameters); > if (!error.ok()) { >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h >index ee615a40c4fb398c6b04310d8c1ce61e6818a166..7fc82b350e6abad7eb30d15118cb475d5aa80987 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h >@@ -114,7 +114,7 @@ private: > WeakPtr<LibWebRTCPeerConnectionBackend> m_peerConnectionBackend; > rtc::scoped_refptr<webrtc::RtpSenderInterface> m_rtcSender; > Source m_source; >- mutable std::optional<webrtc::RtpParameters> m_currentParameters; >+ mutable WTF::Optional<webrtc::RtpParameters> m_currentParameters; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp >index a8983404c818b2407cb9dad34c1eaeb39a548768..a24c9004035c08e9a36dde5f17321d073818d3f0 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp >@@ -48,11 +48,11 @@ RTCRtpTransceiverDirection LibWebRTCRtpTransceiverBackend::direction() const > return toRTCRtpTransceiverDirection(m_rtcTransceiver->direction()); > } > >-std::optional<RTCRtpTransceiverDirection> LibWebRTCRtpTransceiverBackend::currentDirection() const >+WTF::Optional<RTCRtpTransceiverDirection> LibWebRTCRtpTransceiverBackend::currentDirection() const > { > auto value = m_rtcTransceiver->current_direction(); > if (!value) >- return std::nullopt; >+ return WTF::nullopt; > return toRTCRtpTransceiverDirection(*value); > } > >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h >index 3112d6bb44295c20473454a0336c4dcb4ff9223f..b992d109c078667b50dfb99d4192438f0cac0307 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h >@@ -55,7 +55,7 @@ public: > > private: > RTCRtpTransceiverDirection direction() const final; >- std::optional<RTCRtpTransceiverDirection> currentDirection() const final; >+ WTF::Optional<RTCRtpTransceiverDirection> currentDirection() const final; > void setDirection(RTCRtpTransceiverDirection) final; > String mid() final; > void stop() final; >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp >index 1ac8378eb95ad624a9e1f048607c01be000d9160..e054b54616821fb4fd3841393e33b52e9f516869 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp >@@ -278,7 +278,7 @@ static inline void fillRTCIceCandidatePairStats(RTCStatsReport::IceCandidatePair > stats.consentResponsesSent = *rtcStats.responses_sent; > } > >-static inline std::optional<RTCStatsReport::IceCandidateType> iceCandidateState(const std::string& state) >+static inline WTF::Optional<RTCStatsReport::IceCandidateType> iceCandidateState(const std::string& state) > { > if (state == "host") > return RTCStatsReport::IceCandidateType::Host; >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentDetailsModifier.h b/Source/WebCore/Modules/paymentrequest/PaymentDetailsModifier.h >index eed9ab4c1a5f9132741744d146289019ebe5cb27..040b9996b1e09e1a60e182879449913f737d7312 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentDetailsModifier.h >+++ b/Source/WebCore/Modules/paymentrequest/PaymentDetailsModifier.h >@@ -37,7 +37,7 @@ namespace WebCore { > > struct PaymentDetailsModifier { > String supportedMethods; >- std::optional<PaymentItem> total; >+ WTF::Optional<PaymentItem> total; > Vector<PaymentItem> additionalDisplayItems; > JSC::Strong<JSC::JSObject> data; > }; >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentHandler.h b/Source/WebCore/Modules/paymentrequest/PaymentHandler.h >index a6f50eac8dcce6bb48d8ff622786ce803f2c0681..2de69734499a3a64a0c827ff6a8ae42de9794b28 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentHandler.h >+++ b/Source/WebCore/Modules/paymentrequest/PaymentHandler.h >@@ -54,7 +54,7 @@ public: > virtual void canMakePayment(WTF::Function<void(bool)>&& completionHandler) = 0; > virtual ExceptionOr<void> detailsUpdated(PaymentRequest::UpdateReason, String&& error, AddressErrors&&, PayerErrorFields&&, JSC::JSObject* paymentMethodErrors) = 0; > virtual ExceptionOr<void> merchantValidationCompleted(JSC::JSValue&&) = 0; >- virtual void complete(std::optional<PaymentComplete>&&) = 0; >+ virtual void complete(WTF::Optional<PaymentComplete>&&) = 0; > virtual ExceptionOr<void> retry(PaymentValidationErrors&&) = 0; > }; > >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp b/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp >index 970906804d827391b3797a7728d42beb35379d4e..96c575c1b23554d31f59c75ba1c0ed371771742c 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp >+++ b/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp >@@ -225,19 +225,19 @@ static bool isValidURLBasedPaymentMethodIdentifier(const URL& url) > > // Implements "validate a payment method identifier" > // https://www.w3.org/TR/payment-method-id/#validity >-std::optional<PaymentRequest::MethodIdentifier> convertAndValidatePaymentMethodIdentifier(const String& identifier) >+WTF::Optional<PaymentRequest::MethodIdentifier> convertAndValidatePaymentMethodIdentifier(const String& identifier) > { > URL url { URL(), identifier }; > if (!url.isValid()) { > if (isValidStandardizedPaymentMethodIdentifier(identifier)) > return { identifier }; >- return std::nullopt; >+ return WTF::nullopt; > } > > if (isValidURLBasedPaymentMethodIdentifier(url)) > return { WTFMove(url) }; > >- return std::nullopt; >+ return WTF::nullopt; > } > > enum class ShouldValidatePaymentMethodIdentifier { >@@ -457,13 +457,13 @@ void PaymentRequest::abortWithException(Exception&& exception) > > void PaymentRequest::settleShowPromise(ExceptionOr<PaymentResponse&>&& result) > { >- if (auto showPromise = std::exchange(m_showPromise, std::nullopt)) >+ if (auto showPromise = std::exchange(m_showPromise, WTF::nullopt)) > showPromise->settle(WTFMove(result)); > } > > void PaymentRequest::closeActivePaymentHandler() > { >- if (auto activePaymentHandler = std::exchange(m_activePaymentHandler, std::nullopt)) >+ if (auto activePaymentHandler = std::exchange(m_activePaymentHandler, WTF::nullopt)) > activePaymentHandler->paymentHandler->hide(); > > m_isUpdating = false; >@@ -520,11 +520,11 @@ const String& PaymentRequest::id() const > return m_details.id; > } > >-std::optional<PaymentShippingType> PaymentRequest::shippingType() const >+WTF::Optional<PaymentShippingType> PaymentRequest::shippingType() const > { > if (m_options.requestShipping) > return m_options.shippingType; >- return std::nullopt; >+ return WTF::nullopt; > } > > bool PaymentRequest::canSuspendForDocumentSuspension() const >@@ -711,14 +711,14 @@ void PaymentRequest::accept(const String& methodName, PaymentResponse::DetailsFu > m_state = State::Closed; > } > >-ExceptionOr<void> PaymentRequest::complete(std::optional<PaymentComplete>&& result) >+ExceptionOr<void> PaymentRequest::complete(WTF::Optional<PaymentComplete>&& result) > { > ASSERT(m_state == State::Closed); > if (!m_activePaymentHandler) > return Exception { AbortError }; > > activePaymentHandler()->complete(WTFMove(result)); >- m_activePaymentHandler = std::nullopt; >+ m_activePaymentHandler = WTF::nullopt; > return { }; > } > >@@ -734,7 +734,7 @@ ExceptionOr<void> PaymentRequest::retry(PaymentValidationErrors&& errors) > > void PaymentRequest::cancel() > { >- m_activePaymentHandler = std::nullopt; >+ m_activePaymentHandler = WTF::nullopt; > > if (m_isUpdating) { > m_isCancelPending = true; >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentRequest.h b/Source/WebCore/Modules/paymentrequest/PaymentRequest.h >index 7eae137ad245828b7dd98804652a5d0915bc4668..906d16ba631768413d54d9c9e9189d840d97a80a 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentRequest.h >+++ b/Source/WebCore/Modules/paymentrequest/PaymentRequest.h >@@ -66,7 +66,7 @@ public: > const String& id() const; > PaymentAddress* shippingAddress() const { return m_shippingAddress.get(); } > const String& shippingOption() const { return m_shippingOption; } >- std::optional<PaymentShippingType> shippingType() const; >+ WTF::Optional<PaymentShippingType> shippingType() const; > > enum class State { > Created, >@@ -93,7 +93,7 @@ public: > ExceptionOr<void> updateWith(UpdateReason, Ref<DOMPromise>&&); > ExceptionOr<void> completeMerchantValidation(Event&, Ref<DOMPromise>&&); > void accept(const String& methodName, PaymentResponse::DetailsFunction&&, Ref<PaymentAddress>&& shippingAddress, const String& payerName, const String& payerEmail, const String& payerPhone); >- ExceptionOr<void> complete(std::optional<PaymentComplete>&&); >+ ExceptionOr<void> complete(WTF::Optional<PaymentComplete>&&); > ExceptionOr<void> retry(PaymentValidationErrors&&); > void cancel(); > >@@ -140,8 +140,8 @@ private: > String m_shippingOption; > RefPtr<PaymentAddress> m_shippingAddress; > State m_state { State::Created }; >- std::optional<ShowPromise> m_showPromise; >- std::optional<PaymentHandlerWithPendingActivity> m_activePaymentHandler; >+ WTF::Optional<ShowPromise> m_showPromise; >+ WTF::Optional<PaymentHandlerWithPendingActivity> m_activePaymentHandler; > RefPtr<DOMPromise> m_detailsPromise; > RefPtr<DOMPromise> m_merchantSessionPromise; > RefPtr<PaymentResponse> m_response; >@@ -149,7 +149,7 @@ private: > bool m_isCancelPending { false }; > }; > >-std::optional<PaymentRequest::MethodIdentifier> convertAndValidatePaymentMethodIdentifier(const String& identifier); >+WTF::Optional<PaymentRequest::MethodIdentifier> convertAndValidatePaymentMethodIdentifier(const String& identifier); > > } // namespace WebCore > >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp b/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp >index dde78efdc6aea29da3ef66fc45b2a101d08d64d4..d0498379f7b03e68f46095c63fe69e78c5fd1916 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp >+++ b/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp >@@ -59,7 +59,7 @@ void PaymentResponse::setDetailsFunction(DetailsFunction&& detailsFunction) > m_cachedDetails = { }; > } > >-void PaymentResponse::complete(std::optional<PaymentComplete>&& result, DOMPromiseDeferred<void>&& promise) >+void PaymentResponse::complete(WTF::Optional<PaymentComplete>&& result, DOMPromiseDeferred<void>&& promise) > { > if (m_state == State::Stopped || !m_request) { > promise.reject(Exception { AbortError }); >@@ -117,7 +117,7 @@ void PaymentResponse::settleRetryPromise(ExceptionOr<void>&& result) > > ASSERT(hasPendingActivity()); > ASSERT(m_state == State::Created); >- std::exchange(m_retryPromise, std::nullopt)->settle(WTFMove(result)); >+ std::exchange(m_retryPromise, WTF::nullopt)->settle(WTFMove(result)); > } > > bool PaymentResponse::canSuspendForDocumentSuspension() const >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentResponse.h b/Source/WebCore/Modules/paymentrequest/PaymentResponse.h >index 97eac7fc40a1986265da14b61d23595c66076081..548fa4ac6826b6757cfdbd2959577f78d070351a 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentResponse.h >+++ b/Source/WebCore/Modules/paymentrequest/PaymentResponse.h >@@ -81,7 +81,7 @@ public: > const String& payerPhone() const { return m_payerPhone; } > void setPayerPhone(const String& payerPhone) { m_payerPhone = payerPhone; } > >- void complete(std::optional<PaymentComplete>&&, DOMPromiseDeferred<void>&&); >+ void complete(WTF::Optional<PaymentComplete>&&, DOMPromiseDeferred<void>&&); > void retry(PaymentValidationErrors&&, DOMPromiseDeferred<void>&&); > void abortWithException(Exception&&); > bool hasRetryPromise() const { return !!m_retryPromise; } >@@ -122,7 +122,7 @@ private: > String m_payerEmail; > String m_payerPhone; > State m_state { State::Created }; >- std::optional<DOMPromiseDeferred<void>> m_retryPromise; >+ WTF::Optional<DOMPromiseDeferred<void>> m_retryPromise; > RefPtr<PendingActivity<PaymentResponse>> m_pendingActivity; > }; > >diff --git a/Source/WebCore/Modules/streams/ReadableStreamSource.h b/Source/WebCore/Modules/streams/ReadableStreamSource.h >index 3d039113cb93c84c2d6b96bef632876e02b6f60c..82e304c20a0f80e51bbaae628a255147e91e3d56 100644 >--- a/Source/WebCore/Modules/streams/ReadableStreamSource.h >+++ b/Source/WebCore/Modules/streams/ReadableStreamSource.h >@@ -63,8 +63,8 @@ protected: > virtual void doCancel() = 0; > > private: >- std::optional<DOMPromiseDeferred<void>> m_promise; >- std::optional<ReadableStreamDefaultController> m_controller; >+ WTF::Optional<DOMPromiseDeferred<void>> m_promise; >+ WTF::Optional<ReadableStreamDefaultController> m_controller; > }; > > inline void ReadableStreamSource::start(ReadableStreamDefaultController&& controller, DOMPromiseDeferred<void>&& promise) >@@ -91,14 +91,14 @@ inline void ReadableStreamSource::pull(DOMPromiseDeferred<void>&& promise) > inline void ReadableStreamSource::startFinished() > { > ASSERT(m_promise); >- std::exchange(m_promise, std::nullopt).value().resolve(); >+ std::exchange(m_promise, WTF::nullopt).value().resolve(); > setInactive(); > } > > inline void ReadableStreamSource::pullFinished() > { > ASSERT(m_promise); >- std::exchange(m_promise, std::nullopt).value().resolve(); >+ std::exchange(m_promise, WTF::nullopt).value().resolve(); > setInactive(); > } > >@@ -111,7 +111,7 @@ inline void ReadableStreamSource::cancel(JSC::JSValue) > inline void ReadableStreamSource::clean() > { > if (m_promise) { >- m_promise = std::nullopt; >+ m_promise = WTF::nullopt; > setInactive(); > } > } >diff --git a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp >index b02515c24faf919985fa79c124e5ce695904e9a6..fc52eb40d7a225c3bd1b3a08c7bc9ce004fb6370 100644 >--- a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp >@@ -437,7 +437,7 @@ unsigned AudioBufferSourceNode::numberOfChannels() > return output(0)->numberOfChannels(); > } > >-ExceptionOr<void> AudioBufferSourceNode::start(double when, double grainOffset, std::optional<double> optionalGrainDuration) >+ExceptionOr<void> AudioBufferSourceNode::start(double when, double grainOffset, WTF::Optional<double> optionalGrainDuration) > { > double grainDuration = 0; > if (optionalGrainDuration) >diff --git a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h >index 30b79b79333731821fa257a08d13580fa2590dc7..18a517b62fe6abd01b04203df27cb3c74792b00e 100644 >--- a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h >+++ b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h >@@ -56,7 +56,7 @@ public: > unsigned numberOfChannels(); > > // Play-state >- ExceptionOr<void> start(double when, double grainOffset, std::optional<double> grainDuration); >+ ExceptionOr<void> start(double when, double grainOffset, WTF::Optional<double> grainDuration); > > // Note: the attribute was originally exposed as .looping, but to be more consistent in naming with <audio> > // and with how it's described in the specification, the proper attribute name is .loop >diff --git a/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h b/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h >index ba68df92b182c7a9b13a366fa9116082eb465dbe..be04c0a2b779fc749ba0a933ebcade3716ceeb7e 100644 >--- a/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h >+++ b/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h >@@ -62,16 +62,16 @@ struct PublicKeyCredentialCreationOptions { > int64_t alg; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<Parameters> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<Parameters> decode(Decoder&); > }; > > struct AuthenticatorSelectionCriteria { >- std::optional<AuthenticatorAttachment> authenticatorAttachment; >+ WTF::Optional<AuthenticatorAttachment> authenticatorAttachment; > bool requireResidentKey { false }; > UserVerificationRequirement userVerification { UserVerificationRequirement::Preferred }; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<AuthenticatorSelectionCriteria> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<AuthenticatorSelectionCriteria> decode(Decoder&); > }; > > RpEntity rp; >@@ -80,12 +80,12 @@ struct PublicKeyCredentialCreationOptions { > BufferSource challenge; > Vector<Parameters> pubKeyCredParams; > >- std::optional<unsigned> timeout; >+ WTF::Optional<unsigned> timeout; > Vector<PublicKeyCredentialDescriptor> excludeCredentials; >- std::optional<AuthenticatorSelectionCriteria> authenticatorSelection; >+ WTF::Optional<AuthenticatorSelectionCriteria> authenticatorSelection; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<PublicKeyCredentialCreationOptions> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<PublicKeyCredentialCreationOptions> decode(Decoder&); > }; > > template<class Encoder> >@@ -95,13 +95,13 @@ void PublicKeyCredentialCreationOptions::Parameters::encode(Encoder& encoder) co > } > > template<class Decoder> >-std::optional<PublicKeyCredentialCreationOptions::Parameters> PublicKeyCredentialCreationOptions::Parameters::decode(Decoder& decoder) >+WTF::Optional<PublicKeyCredentialCreationOptions::Parameters> PublicKeyCredentialCreationOptions::Parameters::decode(Decoder& decoder) > { > PublicKeyCredentialCreationOptions::Parameters result; > if (!decoder.decodeEnum(result.type)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.alg)) >- return std::nullopt; >+ return WTF::nullopt; > return result; > } > >@@ -112,24 +112,24 @@ void PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::encode( > } > > template<class Decoder> >-std::optional<PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria> PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::decode(Decoder& decoder) >+WTF::Optional<PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria> PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::decode(Decoder& decoder) > { > PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria result; > >- std::optional<std::optional<AuthenticatorAttachment>> authenticatorAttachment; >+ WTF::Optional<WTF::Optional<AuthenticatorAttachment>> authenticatorAttachment; > decoder >> authenticatorAttachment; > if (!authenticatorAttachment) >- return std::nullopt; >+ return WTF::nullopt; > result.authenticatorAttachment = WTFMove(*authenticatorAttachment); > >- std::optional<bool> requireResidentKey; >+ WTF::Optional<bool> requireResidentKey; > decoder >> requireResidentKey; > if (!requireResidentKey) >- return std::nullopt; >+ return WTF::nullopt; > result.requireResidentKey = *requireResidentKey; > > if (!decoder.decodeEnum(result.userVerification)) >- return std::nullopt; >+ return WTF::nullopt; > return result; > } > >@@ -144,39 +144,39 @@ void PublicKeyCredentialCreationOptions::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<PublicKeyCredentialCreationOptions> PublicKeyCredentialCreationOptions::decode(Decoder& decoder) >+WTF::Optional<PublicKeyCredentialCreationOptions> PublicKeyCredentialCreationOptions::decode(Decoder& decoder) > { > PublicKeyCredentialCreationOptions result; > if (!decoder.decode(result.rp.id)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.rp.name)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.rp.icon)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.user.idVector)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.user.displayName)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.user.name)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.user.icon)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.pubKeyCredParams)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<unsigned>> timeout; >+ WTF::Optional<WTF::Optional<unsigned>> timeout; > decoder >> timeout; > if (!timeout) >- return std::nullopt; >+ return WTF::nullopt; > result.timeout = WTFMove(*timeout); > > if (!decoder.decode(result.excludeCredentials)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<AuthenticatorSelectionCriteria>> authenticatorSelection; >+ WTF::Optional<WTF::Optional<AuthenticatorSelectionCriteria>> authenticatorSelection; > decoder >> authenticatorSelection; > if (!authenticatorSelection) >- return std::nullopt; >+ return WTF::nullopt; > result.authenticatorSelection = WTFMove(*authenticatorSelection); > > return result; >diff --git a/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h b/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h >index 9bbef17b001c4463c25ef2e994e434fefbbd730c..fe33cf8f37f73f0475ee95207f32a05486c0d49a 100644 >--- a/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h >+++ b/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h >@@ -50,7 +50,7 @@ struct PublicKeyCredentialData { > mutable RefPtr<ArrayBuffer> userHandle; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<PublicKeyCredentialData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<PublicKeyCredentialData> decode(Decoder&); > }; > > // Noted: clientDataJSON is never encoded or decoded as it is never sent across different processes. >@@ -91,78 +91,78 @@ void PublicKeyCredentialData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<PublicKeyCredentialData> PublicKeyCredentialData::decode(Decoder& decoder) >+WTF::Optional<PublicKeyCredentialData> PublicKeyCredentialData::decode(Decoder& decoder) > { > PublicKeyCredentialData result; > >- std::optional<bool> isEmpty; >+ WTF::Optional<bool> isEmpty; > decoder >> isEmpty; > if (!isEmpty) >- return std::nullopt; >+ return WTF::nullopt; > if (isEmpty.value()) > return result; > >- std::optional<uint64_t> rawIdLength; >+ WTF::Optional<uint64_t> rawIdLength; > decoder >> rawIdLength; > if (!rawIdLength) >- return std::nullopt; >+ return WTF::nullopt; > > result.rawId = ArrayBuffer::create(rawIdLength.value(), sizeof(uint8_t)); > if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(result.rawId->data()), rawIdLength.value(), 1)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> isAuthenticatorAttestationResponse; >+ WTF::Optional<bool> isAuthenticatorAttestationResponse; > decoder >> isAuthenticatorAttestationResponse; > if (!isAuthenticatorAttestationResponse) >- return std::nullopt; >+ return WTF::nullopt; > result.isAuthenticatorAttestationResponse = isAuthenticatorAttestationResponse.value(); > > if (result.isAuthenticatorAttestationResponse) { >- std::optional<uint64_t> attestationObjectLength; >+ WTF::Optional<uint64_t> attestationObjectLength; > decoder >> attestationObjectLength; > if (!attestationObjectLength) >- return std::nullopt; >+ return WTF::nullopt; > > result.attestationObject = ArrayBuffer::create(attestationObjectLength.value(), sizeof(uint8_t)); > if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(result.attestationObject->data()), attestationObjectLength.value(), 1)) >- return std::nullopt; >+ return WTF::nullopt; > > return result; > } > >- std::optional<uint64_t> authenticatorDataLength; >+ WTF::Optional<uint64_t> authenticatorDataLength; > decoder >> authenticatorDataLength; > if (!authenticatorDataLength) >- return std::nullopt; >+ return WTF::nullopt; > > result.authenticatorData = ArrayBuffer::create(authenticatorDataLength.value(), sizeof(uint8_t)); > if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(result.authenticatorData->data()), authenticatorDataLength.value(), 1)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> signatureLength; >+ WTF::Optional<uint64_t> signatureLength; > decoder >> signatureLength; > if (!signatureLength) >- return std::nullopt; >+ return WTF::nullopt; > > result.signature = ArrayBuffer::create(signatureLength.value(), sizeof(uint8_t)); > if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(result.signature->data()), signatureLength.value(), 1)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> hasUserHandle; >+ WTF::Optional<bool> hasUserHandle; > decoder >> hasUserHandle; > if (!hasUserHandle) >- return std::nullopt; >+ return WTF::nullopt; > if (!*hasUserHandle) > return result; > >- std::optional<uint64_t> userHandleLength; >+ WTF::Optional<uint64_t> userHandleLength; > decoder >> userHandleLength; > if (!userHandleLength) >- return std::nullopt; >+ return WTF::nullopt; > > result.userHandle = ArrayBuffer::create(userHandleLength.value(), sizeof(uint8_t)); > if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(result.userHandle->data()), userHandleLength.value(), 1)) >- return std::nullopt; >+ return WTF::nullopt; > > return result; > } >diff --git a/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.h b/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.h >index 3f7b6b519175086fba226e80cfb55c1ae379e958..61d8c5fe02330004bf370946574bd52755f57a5e 100644 >--- a/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.h >+++ b/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.h >@@ -40,7 +40,7 @@ struct PublicKeyCredentialDescriptor { > Vector<AuthenticatorTransport> transports; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<PublicKeyCredentialDescriptor> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<PublicKeyCredentialDescriptor> decode(Decoder&); > }; > > template<class Encoder> >@@ -53,15 +53,15 @@ void PublicKeyCredentialDescriptor::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<PublicKeyCredentialDescriptor> PublicKeyCredentialDescriptor::decode(Decoder& decoder) >+WTF::Optional<PublicKeyCredentialDescriptor> PublicKeyCredentialDescriptor::decode(Decoder& decoder) > { > PublicKeyCredentialDescriptor result; > if (!decoder.decodeEnum(result.type)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.idVector)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.transports)) >- return std::nullopt; >+ return WTF::nullopt; > return result; > } > >diff --git a/Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.h b/Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.h >index e2b0e336d5213f99825de6ba009a40f1b35f0a31..e806c53fd762be91f02825c69d1299f21acefb15 100644 >--- a/Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.h >+++ b/Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.h >@@ -36,13 +36,13 @@ namespace WebCore { > > struct PublicKeyCredentialRequestOptions { > BufferSource challenge; >- std::optional<unsigned> timeout; >+ WTF::Optional<unsigned> timeout; > mutable String rpId; > Vector<PublicKeyCredentialDescriptor> allowCredentials; > UserVerificationRequirement userVerification { UserVerificationRequirement::Preferred }; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<PublicKeyCredentialRequestOptions> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<PublicKeyCredentialRequestOptions> decode(Decoder&); > }; > > // Not every member is encoded. >@@ -53,25 +53,25 @@ void PublicKeyCredentialRequestOptions::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<PublicKeyCredentialRequestOptions> PublicKeyCredentialRequestOptions::decode(Decoder& decoder) >+WTF::Optional<PublicKeyCredentialRequestOptions> PublicKeyCredentialRequestOptions::decode(Decoder& decoder) > { > PublicKeyCredentialRequestOptions result; > >- std::optional<std::optional<unsigned>> timeout; >+ WTF::Optional<WTF::Optional<unsigned>> timeout; > decoder >> timeout; > if (!timeout) >- return std::nullopt; >+ return WTF::nullopt; > result.timeout = WTFMove(*timeout); > > if (!decoder.decode(result.rpId)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.allowCredentials)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<UserVerificationRequirement> userVerification; >+ WTF::Optional<UserVerificationRequirement> userVerification; > decoder >> userVerification; > if (!userVerification) >- return std::nullopt; >+ return WTF::nullopt; > result.userVerification = WTFMove(*userVerification); > > return result; >diff --git a/Source/WebCore/Modules/webauthn/cbor/CBORReader.cpp b/Source/WebCore/Modules/webauthn/cbor/CBORReader.cpp >index e9d926a336c34b8ac9d688f3f82b8f18df0282dc..093d68f4e3c3fd6148f9c264cdedc515c1a62390 100644 >--- a/Source/WebCore/Modules/webauthn/cbor/CBORReader.cpp >+++ b/Source/WebCore/Modules/webauthn/cbor/CBORReader.cpp >@@ -80,10 +80,10 @@ CBORReader::~CBORReader() > } > > // static >-std::optional<CBORValue> CBORReader::read(const Bytes& data, DecoderError* errorCodeOut, int maxNestingLevel) >+WTF::Optional<CBORValue> CBORReader::read(const Bytes& data, DecoderError* errorCodeOut, int maxNestingLevel) > { > CBORReader reader(data.begin(), data.end()); >- std::optional<CBORValue> decodedCbor = reader.decodeCBOR(maxNestingLevel); >+ WTF::Optional<CBORValue> decodedCbor = reader.decodeCBOR(maxNestingLevel); > > if (decodedCbor) > reader.checkExtraneousData(); >@@ -91,20 +91,20 @@ std::optional<CBORValue> CBORReader::read(const Bytes& data, DecoderError* error > *errorCodeOut = reader.getErrorCode(); > > if (reader.getErrorCode() != DecoderError::CBORNoError) >- return std::nullopt; >+ return WTF::nullopt; > return decodedCbor; > } > >-std::optional<CBORValue> CBORReader::decodeCBOR(int maxNestingLevel) >+WTF::Optional<CBORValue> CBORReader::decodeCBOR(int maxNestingLevel) > { > if (maxNestingLevel < 0 || maxNestingLevel > kCBORMaxDepth) { > m_errorCode = DecoderError::TooMuchNesting; >- return std::nullopt; >+ return WTF::nullopt; > } > > if (!canConsume(1)) { > m_errorCode = DecoderError::IncompleteCBORData; >- return std::nullopt; >+ return WTF::nullopt; > } > > const uint8_t initialByte = *m_it++; >@@ -113,7 +113,7 @@ std::optional<CBORValue> CBORReader::decodeCBOR(int maxNestingLevel) > > uint64_t value; > if (!readVariadicLengthInteger(additionalInfo, &value)) >- return std::nullopt; >+ return WTF::nullopt; > > switch (major_type) { > case CBORValue::Type::Unsigned: >@@ -135,7 +135,7 @@ std::optional<CBORValue> CBORReader::decodeCBOR(int maxNestingLevel) > } > > m_errorCode = DecoderError::UnsupportedMajorType; >- return std::nullopt; >+ return WTF::nullopt; > } > > bool CBORReader::readVariadicLengthInteger(uint8_t additionalInfo, uint64_t* value) >@@ -174,30 +174,30 @@ bool CBORReader::readVariadicLengthInteger(uint8_t additionalInfo, uint64_t* val > return checkMinimalEncoding(additionalBytes, intData); > } > >-std::optional<CBORValue> CBORReader::decodeValueToNegative(uint64_t value) >+WTF::Optional<CBORValue> CBORReader::decodeValueToNegative(uint64_t value) > { > if (value > static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) { > m_errorCode = DecoderError::OutOfRangeIntegerValue; >- return std::nullopt; >+ return WTF::nullopt; > } > return CBORValue(-static_cast<int64_t>(value) - 1); > } > >-std::optional<CBORValue> CBORReader::decodeValueToUnsigned(uint64_t value) >+WTF::Optional<CBORValue> CBORReader::decodeValueToUnsigned(uint64_t value) > { > if (value > static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) { > m_errorCode = DecoderError::OutOfRangeIntegerValue; >- return std::nullopt; >+ return WTF::nullopt; > } > return CBORValue(static_cast<int64_t>(value)); > } > >-std::optional<CBORValue> CBORReader::readSimpleValue(uint8_t additionalInfo, uint64_t value) >+WTF::Optional<CBORValue> CBORReader::readSimpleValue(uint8_t additionalInfo, uint64_t value) > { > // Floating point numbers are not supported. > if (additionalInfo > 24 && additionalInfo < 28) { > m_errorCode = DecoderError::UnsupportedFloatingPointValue; >- return std::nullopt; >+ return WTF::nullopt; > } > > ASSERT(value <= 255u); >@@ -211,14 +211,14 @@ std::optional<CBORValue> CBORReader::readSimpleValue(uint8_t additionalInfo, uin > } > > m_errorCode = DecoderError::UnsupportedSimpleValue; >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<CBORValue> CBORReader::readString(uint64_t numBytes) >+WTF::Optional<CBORValue> CBORReader::readString(uint64_t numBytes) > { > if (!canConsume(numBytes)) { > m_errorCode = DecoderError::IncompleteCBORData; >- return std::nullopt; >+ return WTF::nullopt; > } > > ASSERT(numBytes <= std::numeric_limits<size_t>::max()); >@@ -229,14 +229,14 @@ std::optional<CBORValue> CBORReader::readString(uint64_t numBytes) > // Not to confuse it with an actual empty WTFString. > if (!numBytes || hasValidUTF8Format(cborString)) > return CBORValue(WTFMove(cborString)); >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<CBORValue> CBORReader::readBytes(uint64_t numBytes) >+WTF::Optional<CBORValue> CBORReader::readBytes(uint64_t numBytes) > { > if (!canConsume(numBytes)) { > m_errorCode = DecoderError::IncompleteCBORData; >- return std::nullopt; >+ return WTF::nullopt; > } > > Bytes cborByteString; >@@ -247,34 +247,34 @@ std::optional<CBORValue> CBORReader::readBytes(uint64_t numBytes) > return CBORValue(WTFMove(cborByteString)); > } > >-std::optional<CBORValue> CBORReader::readCBORArray(uint64_t length, int maxNestingLevel) >+WTF::Optional<CBORValue> CBORReader::readCBORArray(uint64_t length, int maxNestingLevel) > { > CBORValue::ArrayValue cborArray; > while (length-- > 0) { >- std::optional<CBORValue> cborElement = decodeCBOR(maxNestingLevel - 1); >+ WTF::Optional<CBORValue> cborElement = decodeCBOR(maxNestingLevel - 1); > if (!cborElement) >- return std::nullopt; >+ return WTF::nullopt; > cborArray.append(WTFMove(cborElement.value())); > } > return CBORValue(WTFMove(cborArray)); > } > >-std::optional<CBORValue> CBORReader::readCBORMap(uint64_t length, int maxNestingLevel) >+WTF::Optional<CBORValue> CBORReader::readCBORMap(uint64_t length, int maxNestingLevel) > { > CBORValue::MapValue cborMap; > while (length-- > 0) { >- std::optional<CBORValue> key = decodeCBOR(maxNestingLevel - 1); >- std::optional<CBORValue> value = decodeCBOR(maxNestingLevel - 1); >+ WTF::Optional<CBORValue> key = decodeCBOR(maxNestingLevel - 1); >+ WTF::Optional<CBORValue> value = decodeCBOR(maxNestingLevel - 1); > if (!key || !value) >- return std::nullopt; >+ return WTF::nullopt; > > // Only CBOR maps with integer or string type keys are allowed. > if (key.value().type() != CBORValue::Type::String && key.value().type() != CBORValue::Type::Unsigned) { > m_errorCode = DecoderError::IncorrectMapKeyType; >- return std::nullopt; >+ return WTF::nullopt; > } > if (!checkDuplicateKey(key.value(), cborMap) || !checkOutOfOrderKey(key.value(), cborMap)) >- return std::nullopt; >+ return WTF::nullopt; > > cborMap.emplace(std::make_pair(WTFMove(key.value()), WTFMove(value.value()))); > } >diff --git a/Source/WebCore/Modules/webauthn/cbor/CBORReader.h b/Source/WebCore/Modules/webauthn/cbor/CBORReader.h >index 16164ded4e45e7bc4b808fdf68ebe8bfcf4775e8..f87fa2c5e690a5217bee0d331f8afa5a4f90bb17 100644 >--- a/Source/WebCore/Modules/webauthn/cbor/CBORReader.h >+++ b/Source/WebCore/Modules/webauthn/cbor/CBORReader.h >@@ -101,22 +101,22 @@ public: > // CBOR data- then an empty optional is returned. Optional |errorCodeOut| > // can be provided by the caller to obtain additional information about > // decoding failures. >- WEBCORE_EXPORT static std::optional<CBORValue> read(const Bytes&, DecoderError* errorCodeOut = nullptr, int maxNestingLevel = kCBORMaxDepth); >+ WEBCORE_EXPORT static WTF::Optional<CBORValue> read(const Bytes&, DecoderError* errorCodeOut = nullptr, int maxNestingLevel = kCBORMaxDepth); > > // Translates errors to human-readable error messages. > static const char* errorCodeToString(DecoderError errorCode); > > private: > CBORReader(Bytes::const_iterator, const Bytes::const_iterator); >- std::optional<CBORValue> decodeCBOR(int maxNestingLevel); >- std::optional<CBORValue> decodeValueToNegative(uint64_t value); >- std::optional<CBORValue> decodeValueToUnsigned(uint64_t value); >- std::optional<CBORValue> readSimpleValue(uint8_t additionalInfo, uint64_t value); >+ WTF::Optional<CBORValue> decodeCBOR(int maxNestingLevel); >+ WTF::Optional<CBORValue> decodeValueToNegative(uint64_t value); >+ WTF::Optional<CBORValue> decodeValueToUnsigned(uint64_t value); >+ WTF::Optional<CBORValue> readSimpleValue(uint8_t additionalInfo, uint64_t value); > bool readVariadicLengthInteger(uint8_t additionalInfo, uint64_t* value); >- std::optional<CBORValue> readBytes(uint64_t numBytes); >- std::optional<CBORValue> readString(uint64_t numBytes); >- std::optional<CBORValue> readCBORArray(uint64_t length, int maxNestingLevel); >- std::optional<CBORValue> readCBORMap(uint64_t length, int maxNestingLevel); >+ WTF::Optional<CBORValue> readBytes(uint64_t numBytes); >+ WTF::Optional<CBORValue> readString(uint64_t numBytes); >+ WTF::Optional<CBORValue> readCBORArray(uint64_t length, int maxNestingLevel); >+ WTF::Optional<CBORValue> readCBORMap(uint64_t length, int maxNestingLevel); > bool canConsume(uint64_t bytes); > void checkExtraneousData(); > bool checkDuplicateKey(const CBORValue& newKey, const CBORValue::MapValue&); >diff --git a/Source/WebCore/Modules/webauthn/cbor/CBORWriter.cpp b/Source/WebCore/Modules/webauthn/cbor/CBORWriter.cpp >index 71f58c026abbdd721a5fa8c624933e9871d89047..042ba8f7471d94e79553ced46d44570361b87f95 100644 >--- a/Source/WebCore/Modules/webauthn/cbor/CBORWriter.cpp >+++ b/Source/WebCore/Modules/webauthn/cbor/CBORWriter.cpp >@@ -41,13 +41,13 @@ CBORWriter::~CBORWriter() > } > > // static >-std::optional<Vector<uint8_t>> CBORWriter::write(const CBORValue& node, size_t maxNestingLevel) >+WTF::Optional<Vector<uint8_t>> CBORWriter::write(const CBORValue& node, size_t maxNestingLevel) > { > Vector<uint8_t> cbor; > CBORWriter writer(&cbor); > if (writer.encodeCBOR(node, static_cast<int>(maxNestingLevel))) > return cbor; >- return std::nullopt; >+ return WTF::nullopt; > } > > CBORWriter::CBORWriter(Vector<uint8_t>* cbor) >diff --git a/Source/WebCore/Modules/webauthn/cbor/CBORWriter.h b/Source/WebCore/Modules/webauthn/cbor/CBORWriter.h >index 5f946c10055fc55603829e6934c9ba806cc9ee86..6f169e4fbb76596edf7a9fb7c2e069a82de56eee 100644 >--- a/Source/WebCore/Modules/webauthn/cbor/CBORWriter.h >+++ b/Source/WebCore/Modules/webauthn/cbor/CBORWriter.h >@@ -87,7 +87,7 @@ public: > // arrays/maps that has to be traversed to reach the most nested CBORValue > // contained in |node|. Primitive values and empty containers have nesting > // depths of 0. >- WEBCORE_EXPORT static std::optional<Vector<uint8_t>> write(const CBORValue&, size_t maxNestingLevel = kDefaultMaxNestingDepth); >+ WEBCORE_EXPORT static WTF::Optional<Vector<uint8_t>> write(const CBORValue&, size_t maxNestingLevel = kDefaultMaxNestingDepth); > > private: > explicit CBORWriter(Vector<uint8_t>*); >diff --git a/Source/WebCore/Modules/webauthn/fido/AuthenticatorGetInfoResponse.h b/Source/WebCore/Modules/webauthn/fido/AuthenticatorGetInfoResponse.h >index c063c4f5c935f973dc11540203597c5856c34afe..a5ad5ad3e20fe2487e976560a70976f60dcd3c5b 100644 >--- a/Source/WebCore/Modules/webauthn/fido/AuthenticatorGetInfoResponse.h >+++ b/Source/WebCore/Modules/webauthn/fido/AuthenticatorGetInfoResponse.h >@@ -55,17 +55,17 @@ public: > > const StdSet<ProtocolVersion>& versions() const { return m_versions; } > const Vector<uint8_t>& aaguid() const { return m_aaguid; } >- const std::optional<uint32_t>& maxMsgSize() const { return m_maxMsgSize; } >- const std::optional<Vector<uint8_t>>& pinProtocol() const { return m_pinProtocols; } >- const std::optional<Vector<String>>& extensions() const { return m_extensions; } >+ const WTF::Optional<uint32_t>& maxMsgSize() const { return m_maxMsgSize; } >+ const WTF::Optional<Vector<uint8_t>>& pinProtocol() const { return m_pinProtocols; } >+ const WTF::Optional<Vector<String>>& extensions() const { return m_extensions; } > const AuthenticatorSupportedOptions& options() const { return m_options; } > > private: > StdSet<ProtocolVersion> m_versions; > Vector<uint8_t> m_aaguid; >- std::optional<uint32_t> m_maxMsgSize; >- std::optional<Vector<uint8_t>> m_pinProtocols; >- std::optional<Vector<String>> m_extensions; >+ WTF::Optional<uint32_t> m_maxMsgSize; >+ WTF::Optional<Vector<uint8_t>> m_pinProtocols; >+ WTF::Optional<Vector<String>> m_extensions; > AuthenticatorSupportedOptions m_options; > }; > >diff --git a/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp b/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp >index 80cf6de712c20abed8542fab15c6f631ae9a7d6f..7a5076e2b3a141bb3b35c74b8e4588410fe44aca 100644 >--- a/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp >+++ b/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp >@@ -83,35 +83,35 @@ static Vector<uint8_t> getCredentialId(const Vector<uint8_t>& authenticatorData) > > // Decodes byte array response from authenticator to CBOR value object and > // checks for correct encoding format. >-std::optional<PublicKeyCredentialData> readCTAPMakeCredentialResponse(const Vector<uint8_t>& inBuffer) >+WTF::Optional<PublicKeyCredentialData> readCTAPMakeCredentialResponse(const Vector<uint8_t>& inBuffer) > { > if (inBuffer.size() <= kResponseCodeLength) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<uint8_t> buffer; > buffer.append(inBuffer.data() + 1, inBuffer.size() - 1); >- std::optional<CBOR> decodedResponse = cbor::CBORReader::read(buffer); >+ WTF::Optional<CBOR> decodedResponse = cbor::CBORReader::read(buffer); > if (!decodedResponse || !decodedResponse->isMap()) >- return std::nullopt; >+ return WTF::nullopt; > const auto& decodedMap = decodedResponse->getMap(); > > auto it = decodedMap.find(CBOR(1)); > if (it == decodedMap.end() || !it->second.isString()) >- return std::nullopt; >+ return WTF::nullopt; > auto format = it->second.clone(); > > it = decodedMap.find(CBOR(2)); > if (it == decodedMap.end() || !it->second.isByteString()) >- return std::nullopt; >+ return WTF::nullopt; > auto authenticatorData = it->second.clone(); > > auto credentialId = getCredentialId(authenticatorData.getByteString()); > if (credentialId.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > it = decodedMap.find(CBOR(3)); > if (it == decodedMap.end() || !it->second.isMap()) >- return std::nullopt; >+ return WTF::nullopt; > auto attStmt = it->second.clone(); > > CBOR::MapValue attestationObjectMap; >@@ -123,17 +123,17 @@ std::optional<PublicKeyCredentialData> readCTAPMakeCredentialResponse(const Vect > return PublicKeyCredentialData { ArrayBuffer::create(credentialId.data(), credentialId.size()), true, nullptr, ArrayBuffer::create(attestationObject.value().data(), attestationObject.value().size()), nullptr, nullptr, nullptr }; > } > >-std::optional<PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector<uint8_t>& inBuffer) >+WTF::Optional<PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector<uint8_t>& inBuffer) > { > if (inBuffer.size() <= kResponseCodeLength) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<uint8_t> buffer; > buffer.append(inBuffer.data() + 1, inBuffer.size() - 1); >- std::optional<CBOR> decodedResponse = cbor::CBORReader::read(buffer); >+ WTF::Optional<CBOR> decodedResponse = cbor::CBORReader::read(buffer); > > if (!decodedResponse || !decodedResponse->isMap()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& responseMap = decodedResponse->getMap(); > >@@ -143,19 +143,19 @@ std::optional<PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector > auto& credential = it->second.getMap(); > auto itr = credential.find(CBOR(kCredentialIdKey)); > if (itr == credential.end() || !itr->second.isByteString()) >- return std::nullopt; >+ return WTF::nullopt; > auto& id = itr->second.getByteString(); > credentialId = ArrayBuffer::create(id.data(), id.size()); > } > > it = responseMap.find(CBOR(2)); > if (it == responseMap.end() || !it->second.isByteString()) >- return std::nullopt; >+ return WTF::nullopt; > auto& authData = it->second.getByteString(); > > it = responseMap.find(CBOR(3)); > if (it == responseMap.end() || !it->second.isByteString()) >- return std::nullopt; >+ return WTF::nullopt; > auto& signature = it->second.getByteString(); > > RefPtr<ArrayBuffer> userHandle; >@@ -164,7 +164,7 @@ std::optional<PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector > auto& user = it->second.getMap(); > auto itr = user.find(CBOR(kEntityIdMapKey)); > if (itr == user.end() || !itr->second.isByteString()) >- return std::nullopt; >+ return WTF::nullopt; > auto& id = itr->second.getByteString(); > userHandle = ArrayBuffer::create(id.data(), id.size()); > } >@@ -172,25 +172,25 @@ std::optional<PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector > return PublicKeyCredentialData { WTFMove(credentialId), false, nullptr, nullptr, ArrayBuffer::create(authData.data(), authData.size()), ArrayBuffer::create(signature.data(), signature.size()), WTFMove(userHandle) }; > } > >-std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector<uint8_t>& inBuffer) >+WTF::Optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector<uint8_t>& inBuffer) > { > if (inBuffer.size() <= kResponseCodeLength || getResponseCode(inBuffer) != CtapDeviceResponseCode::kSuccess) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<uint8_t> buffer; > buffer.append(inBuffer.data() + 1, inBuffer.size() - 1); >- std::optional<CBOR> decodedResponse = cbor::CBORReader::read(buffer); >+ WTF::Optional<CBOR> decodedResponse = cbor::CBORReader::read(buffer); > if (!decodedResponse || !decodedResponse->isMap()) >- return std::nullopt; >+ return WTF::nullopt; > const auto& responseMap = decodedResponse->getMap(); > > auto it = responseMap.find(CBOR(1)); > if (it == responseMap.end() || !it->second.isArray() || it->second.getArray().size() > 2) >- return std::nullopt; >+ return WTF::nullopt; > StdSet<ProtocolVersion> protocolVersions; > for (const auto& version : it->second.getArray()) { > if (!version.isString()) >- return std::nullopt; >+ return WTF::nullopt; > > auto protocol = convertStringToProtocolVersion(version.getString()); > if (protocol == ProtocolVersion::kUnknown) { >@@ -199,26 +199,26 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > } > > if (!protocolVersions.insert(protocol).second) >- return std::nullopt; >+ return WTF::nullopt; > } > if (protocolVersions.empty()) >- return std::nullopt; >+ return WTF::nullopt; > > it = responseMap.find(CBOR(3)); > if (it == responseMap.end() || !it->second.isByteString() || it->second.getByteString().size() != kAaguidLength) >- return std::nullopt; >+ return WTF::nullopt; > > AuthenticatorGetInfoResponse response(WTFMove(protocolVersions), Vector<uint8_t>(it->second.getByteString())); > > it = responseMap.find(CBOR(2)); > if (it != responseMap.end()) { > if (!it->second.isArray()) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<String> extensions; > for (const auto& extension : it->second.getArray()) { > if (!extension.isString()) >- return std::nullopt; >+ return WTF::nullopt; > > extensions.append(extension.getString()); > } >@@ -229,12 +229,12 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > it = responseMap.find(CBOR(4)); > if (it != responseMap.end()) { > if (!it->second.isMap()) >- return std::nullopt; >+ return WTF::nullopt; > const auto& optionMap = it->second.getMap(); > auto optionMapIt = optionMap.find(CBOR(kPlatformDeviceMapKey)); > if (optionMapIt != optionMap.end()) { > if (!optionMapIt->second.isBool()) >- return std::nullopt; >+ return WTF::nullopt; > > options.setIsPlatformDevice(optionMapIt->second.getBool()); > } >@@ -242,7 +242,7 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > optionMapIt = optionMap.find(CBOR(kResidentKeyMapKey)); > if (optionMapIt != optionMap.end()) { > if (!optionMapIt->second.isBool()) >- return std::nullopt; >+ return WTF::nullopt; > > options.setSupportsResidentKey(optionMapIt->second.getBool()); > } >@@ -250,7 +250,7 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > optionMapIt = optionMap.find(CBOR(kUserPresenceMapKey)); > if (optionMapIt != optionMap.end()) { > if (!optionMapIt->second.isBool()) >- return std::nullopt; >+ return WTF::nullopt; > > options.setUserPresenceRequired(optionMapIt->second.getBool()); > } >@@ -258,7 +258,7 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > optionMapIt = optionMap.find(CBOR(kUserVerificationMapKey)); > if (optionMapIt != optionMap.end()) { > if (!optionMapIt->second.isBool()) >- return std::nullopt; >+ return WTF::nullopt; > > if (optionMapIt->second.getBool()) > options.setUserVerificationAvailability(AuthenticatorSupportedOptions::UserVerificationAvailability::kSupportedAndConfigured); >@@ -269,7 +269,7 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > optionMapIt = optionMap.find(CBOR(kClientPinMapKey)); > if (optionMapIt != optionMap.end()) { > if (!optionMapIt->second.isBool()) >- return std::nullopt; >+ return WTF::nullopt; > > if (optionMapIt->second.getBool()) > options.setClientPinAvailability(AuthenticatorSupportedOptions::ClientPinAvailability::kSupportedAndPinSet); >@@ -282,7 +282,7 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > it = responseMap.find(CBOR(5)); > if (it != responseMap.end()) { > if (!it->second.isUnsigned()) >- return std::nullopt; >+ return WTF::nullopt; > > response.setMaxMsgSize(it->second.getUnsigned()); > } >@@ -290,12 +290,12 @@ std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector > it = responseMap.find(CBOR(6)); > if (it != responseMap.end()) { > if (!it->second.isArray()) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<uint8_t> supportedPinProtocols; > for (const auto& protocol : it->second.getArray()) { > if (!protocol.isUnsigned()) >- return std::nullopt; >+ return WTF::nullopt; > > supportedPinProtocols.append(protocol.getUnsigned()); > } >diff --git a/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.h b/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.h >index 819633545cde25c0dbdc4c63da5f1b166e237493..0db5362549754983d44aee65e74d32827e8cb771 100644 >--- a/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.h >+++ b/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.h >@@ -48,18 +48,18 @@ WEBCORE_EXPORT CtapDeviceResponseCode getResponseCode(const Vector<uint8_t>&); > // and converts response to AuthenticatorMakeCredentialResponse object with > // CBOR map keys that conform to format of attestation object defined by the > // WebAuthN spec : https://w3c.github.io/webauthn/#fig-attStructs >-WEBCORE_EXPORT std::optional<WebCore::PublicKeyCredentialData> readCTAPMakeCredentialResponse(const Vector<uint8_t>&); >+WEBCORE_EXPORT WTF::Optional<WebCore::PublicKeyCredentialData> readCTAPMakeCredentialResponse(const Vector<uint8_t>&); > > // De-serializes CBOR encoded response to AuthenticatorGetAssertion / > // AuthenticatorGetNextAssertion request to AuthenticatorGetAssertionResponse > // object. > // FIXME(190783): Probably need to remake AuthenticatorResponse to include more fields like numberOfCredentials, > // and use it here instead of PublicKeyCredentialData. >-WEBCORE_EXPORT std::optional<WebCore::PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector<uint8_t>&); >+WEBCORE_EXPORT WTF::Optional<WebCore::PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector<uint8_t>&); > > // De-serializes CBOR encoded response to AuthenticatorGetInfo request to > // AuthenticatorGetInfoResponse object. >-WEBCORE_EXPORT std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector<uint8_t>&); >+WEBCORE_EXPORT WTF::Optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector<uint8_t>&); > > } // namespace fido > >diff --git a/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.cpp b/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.cpp >index 395e5eced8849f2b6c3a3829a260a97a0c6e01ec..062eba298caa51889e13dff943a29def5eea9f64 100644 >--- a/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.cpp >+++ b/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.cpp >@@ -37,10 +37,10 @@ > namespace fido { > > // static >-std::optional<FidoHidMessage> FidoHidMessage::create(uint32_t channelId, FidoHidDeviceCommand type, const Vector<uint8_t>& data) >+WTF::Optional<FidoHidMessage> FidoHidMessage::create(uint32_t channelId, FidoHidDeviceCommand type, const Vector<uint8_t>& data) > { > if (data.size() > kHidMaxMessageSize) >- return std::nullopt; >+ return WTF::nullopt; > > switch (type) { > case FidoHidDeviceCommand::kPing: >@@ -48,46 +48,46 @@ std::optional<FidoHidMessage> FidoHidMessage::create(uint32_t channelId, FidoHid > case FidoHidDeviceCommand::kMsg: > case FidoHidDeviceCommand::kCbor: { > if (data.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > > case FidoHidDeviceCommand::kCancel: > case FidoHidDeviceCommand::kWink: { > if (!data.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > case FidoHidDeviceCommand::kLock: { > if (data.size() != 1 || data[0] > kHidMaxLockSeconds) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > case FidoHidDeviceCommand::kInit: { > if (data.size() != 8) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > case FidoHidDeviceCommand::kKeepAlive: > case FidoHidDeviceCommand::kError: > if (data.size() != 1) >- return std::nullopt; >+ return WTF::nullopt; > } > > return FidoHidMessage(channelId, type, data); > } > > // static >-std::optional<FidoHidMessage> FidoHidMessage::createFromSerializedData(const Vector<uint8_t>& serializedData) >+WTF::Optional<FidoHidMessage> FidoHidMessage::createFromSerializedData(const Vector<uint8_t>& serializedData) > { > size_t remainingSize = 0; > if (serializedData.size() > kHidPacketSize || serializedData.size() < kHidInitPacketHeaderSize) >- return std::nullopt; >+ return WTF::nullopt; > > auto initPacket = FidoHidInitPacket::createFromSerializedData(serializedData, &remainingSize); > > if (!initPacket) >- return std::nullopt; >+ return WTF::nullopt; > > return FidoHidMessage(WTFMove(initPacket), remainingSize); > } >diff --git a/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.h b/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.h >index 0d9d3fc93ba8d0b67a783d7e912e9de29bbee8c3..483d4146fcaa37cd8f2691d1ad773cb015d2a48d 100644 >--- a/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.h >+++ b/Source/WebCore/Modules/webauthn/fido/FidoHidMessage.h >@@ -45,10 +45,10 @@ class WEBCORE_EXPORT FidoHidMessage { > WTF_MAKE_NONCOPYABLE(FidoHidMessage); > public: > // Static functions to create CTAP/U2F HID commands. >- static std::optional<FidoHidMessage> create(uint32_t channelId, FidoHidDeviceCommand, const Vector<uint8_t>& data); >+ static WTF::Optional<FidoHidMessage> create(uint32_t channelId, FidoHidDeviceCommand, const Vector<uint8_t>& data); > > // Reconstruct a message from serialized message data. >- static std::optional<FidoHidMessage> createFromSerializedData(const Vector<uint8_t>&); >+ static WTF::Optional<FidoHidMessage> createFromSerializedData(const Vector<uint8_t>&); > > FidoHidMessage(FidoHidMessage&& that) = default; > FidoHidMessage& operator=(FidoHidMessage&& other) = default; >diff --git a/Source/WebCore/Modules/webdatabase/Database.cpp b/Source/WebCore/Modules/webdatabase/Database.cpp >index 873143c7c4396bce678497b7d19fbd5f9bf9a5ac..7a53fec4998046ae16fb88886bd50ef205c84e6a 100644 >--- a/Source/WebCore/Modules/webdatabase/Database.cpp >+++ b/Source/WebCore/Modules/webdatabase/Database.cpp >@@ -638,7 +638,7 @@ String Database::fileName() const > DatabaseDetails Database::details() const > { > // This code path is only used for database quota delegate calls, so file dates are irrelevant and left uninitialized. >- return DatabaseDetails(stringIdentifier(), displayName(), estimatedSize(), 0, std::nullopt, std::nullopt); >+ return DatabaseDetails(stringIdentifier(), displayName(), estimatedSize(), 0, WTF::nullopt, WTF::nullopt); > } > > void Database::disableAuthorizer() >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseDetails.h b/Source/WebCore/Modules/webdatabase/DatabaseDetails.h >index 670210240b2a868c627eb510defc72a8804d9527..8f9dbf201c697ba970d206b1c65a1ab47de0e96d 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseDetails.h >+++ b/Source/WebCore/Modules/webdatabase/DatabaseDetails.h >@@ -66,7 +66,7 @@ public: > return *this; > } > >- DatabaseDetails(const String& databaseName, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage, std::optional<WallTime> creationTime, std::optional<WallTime> modificationTime) >+ DatabaseDetails(const String& databaseName, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage, WTF::Optional<WallTime> creationTime, WTF::Optional<WallTime> modificationTime) > : m_name(databaseName) > , m_displayName(displayName) > , m_expectedUsage(expectedUsage) >@@ -80,8 +80,8 @@ public: > const String& displayName() const { return m_displayName; } > uint64_t expectedUsage() const { return m_expectedUsage; } > uint64_t currentUsage() const { return m_currentUsage; } >- std::optional<WallTime> creationTime() const { return m_creationTime; } >- std::optional<WallTime> modificationTime() const { return m_modificationTime; } >+ WTF::Optional<WallTime> creationTime() const { return m_creationTime; } >+ WTF::Optional<WallTime> modificationTime() const { return m_modificationTime; } > #ifndef NDEBUG > Thread& thread() const { return m_thread.get(); } > #endif >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp b/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp >index 23c3c3034fd6ac81b51a427869db3fdd7682afe5..356f07fefd4b956a229b789b36c96504f60b1e99 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp >+++ b/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp >@@ -59,7 +59,7 @@ private: > DatabaseManager::ProposedDatabase::ProposedDatabase(DatabaseManager& manager, SecurityOrigin& origin, const String& name, const String& displayName, unsigned long estimatedSize) > : m_manager(manager) > , m_origin(origin.isolatedCopy()) >- , m_details(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0, std::nullopt, std::nullopt) >+ , m_details(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0, WTF::nullopt, WTF::nullopt) > { > m_manager.addProposedDatabase(*this); > } >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >index 9f5b5ae18c73947da97e3b2d6ad401d96e0d54ab..d96541ed49f693824ed1dfc525088dac32bc59c5 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >+++ b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >@@ -472,7 +472,7 @@ DatabaseDetails DatabaseTracker::detailsForNameAndOrigin(const String& name, con > > String path = fullPathForDatabase(origin, name, false); > if (path.isEmpty()) >- return DatabaseDetails(name, displayName, expectedUsage, 0, std::nullopt, std::nullopt); >+ return DatabaseDetails(name, displayName, expectedUsage, 0, WTF::nullopt, WTF::nullopt); > return DatabaseDetails(name, displayName, expectedUsage, SQLiteFileSystem::getDatabaseFileSize(path), SQLiteFileSystem::databaseCreationTime(path), SQLiteFileSystem::databaseModificationTime(path)); > } > >diff --git a/Source/WebCore/Modules/webdatabase/SQLResultSet.h b/Source/WebCore/Modules/webdatabase/SQLResultSet.h >index e2283999fa89a3c6ff716c14c5894f538fd84547..788ef3936b6f3dae584364b5c083e456cc578970 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLResultSet.h >+++ b/Source/WebCore/Modules/webdatabase/SQLResultSet.h >@@ -50,7 +50,7 @@ private: > SQLResultSet(); > > Ref<SQLResultSetRowList> m_rows; >- std::optional<int64_t> m_insertId; >+ WTF::Optional<int64_t> m_insertId; > int m_rowsAffected { 0 }; > }; > >diff --git a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp b/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp >index b5ddd563aac77193c61178ecec0f24bfe4edd87b..a90420a252e475af06428b749b270850b2216670 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp >+++ b/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp >@@ -70,7 +70,7 @@ SQLTransaction::SQLTransaction(Ref<Database>&& database, RefPtr<SQLTransactionCa > > SQLTransaction::~SQLTransaction() = default; > >-ExceptionOr<void> SQLTransaction::executeSql(const String& sqlStatement, std::optional<Vector<SQLValue>>&& arguments, RefPtr<SQLStatementCallback>&& callback, RefPtr<SQLStatementErrorCallback>&& callbackError) >+ExceptionOr<void> SQLTransaction::executeSql(const String& sqlStatement, WTF::Optional<Vector<SQLValue>>&& arguments, RefPtr<SQLStatementCallback>&& callback, RefPtr<SQLStatementErrorCallback>&& callbackError) > { > if (!m_executeSqlAllowed || !m_database->opened()) > return Exception { InvalidStateError }; >diff --git a/Source/WebCore/Modules/webdatabase/SQLTransaction.h b/Source/WebCore/Modules/webdatabase/SQLTransaction.h >index fd23d8732b538a54d6b8ebe98ee52101a6468711..5a36cf5ff7ee3b36899f5cf410493ae232e18930 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLTransaction.h >+++ b/Source/WebCore/Modules/webdatabase/SQLTransaction.h >@@ -62,7 +62,7 @@ public: > static Ref<SQLTransaction> create(Ref<Database>&&, RefPtr<SQLTransactionCallback>&&, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly); > ~SQLTransaction(); > >- ExceptionOr<void> executeSql(const String& sqlStatement, std::optional<Vector<SQLValue>>&& arguments, RefPtr<SQLStatementCallback>&&, RefPtr<SQLStatementErrorCallback>&&); >+ ExceptionOr<void> executeSql(const String& sqlStatement, WTF::Optional<Vector<SQLValue>>&& arguments, RefPtr<SQLStatementCallback>&&, RefPtr<SQLStatementErrorCallback>&&); > > void lockAcquired(); > void performNextStep(); >diff --git a/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp b/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >index 77ba4cbc08f96b1e322c69d487f705941286c438..7309f88463d31868c5bc0f96d865aa84e7c27a48 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >+++ b/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >@@ -71,10 +71,10 @@ RefPtr<WebGPUShaderModule> WebGPUDevice::createShaderModule(WebGPUShaderModuleDe > return module ? WebGPUShaderModule::create(module.releaseNonNull()) : nullptr; > } > >-static std::optional<GPUPipelineStageDescriptor> validateAndConvertPipelineStage(const WebGPUPipelineStageDescriptor& descriptor) >+static WTF::Optional<GPUPipelineStageDescriptor> validateAndConvertPipelineStage(const WebGPUPipelineStageDescriptor& descriptor) > { > if (!descriptor.module || !descriptor.module->module() || descriptor.entryPoint.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > return GPUPipelineStageDescriptor { descriptor.module->module(), descriptor.entryPoint }; > } >diff --git a/Source/WebCore/Modules/websockets/WebSocket.cpp b/Source/WebCore/Modules/websockets/WebSocket.cpp >index 58536213b5c7ab639d55e6c70f71d16996a0cdd7..0081c19660fa91cfa390e4567367512bc150f31c 100644 >--- a/Source/WebCore/Modules/websockets/WebSocket.cpp >+++ b/Source/WebCore/Modules/websockets/WebSocket.cpp >@@ -389,7 +389,7 @@ ExceptionOr<void> WebSocket::send(Blob& binaryData) > return { }; > } > >-ExceptionOr<void> WebSocket::close(std::optional<unsigned short> optionalCode, const String& reason) >+ExceptionOr<void> WebSocket::close(WTF::Optional<unsigned short> optionalCode, const String& reason) > { > int code = optionalCode ? optionalCode.value() : static_cast<int>(WebSocketChannel::CloseEventCodeNotSpecified); > if (code == WebSocketChannel::CloseEventCodeNotSpecified) >diff --git a/Source/WebCore/Modules/websockets/WebSocket.h b/Source/WebCore/Modules/websockets/WebSocket.h >index 5043c494235d07085506aabdce3bc4d0b84bbc1b..c769015c2464544642886cefdba654949087e662 100644 >--- a/Source/WebCore/Modules/websockets/WebSocket.h >+++ b/Source/WebCore/Modules/websockets/WebSocket.h >@@ -78,7 +78,7 @@ public: > ExceptionOr<void> send(JSC::ArrayBufferView&); > ExceptionOr<void> send(Blob&); > >- ExceptionOr<void> close(std::optional<unsigned short> code, const String& reason); >+ ExceptionOr<void> close(WTF::Optional<unsigned short> code, const String& reason); > > RefPtr<ThreadableWebSocketChannel> channel() const; > >diff --git a/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp b/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp >index 1b19edab4c9a6f3812f7130b76a6b9537c5c75e6..10642c3f8b4ac8f0d7a38151dcfc833ab841932e 100644 >--- a/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp >+++ b/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp >@@ -264,10 +264,10 @@ ResourceRequest WebSocketHandshake::clientHandshakeRequest() const > return request; > } > >-std::optional<CookieRequestHeaderFieldProxy> WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy() const >+WTF::Optional<CookieRequestHeaderFieldProxy> WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy() const > { > if (!m_document || !m_allowCookies) >- return std::nullopt; >+ return WTF::nullopt; > return cookieRequestHeaderFieldProxy(*m_document, httpURLForAuthenticationAndCookies()); > } > >diff --git a/Source/WebCore/Modules/websockets/WebSocketHandshake.h b/Source/WebCore/Modules/websockets/WebSocketHandshake.h >index e96f8602a87a935269696765c80e7302cf737eb0..5a652bafce1800666016f27869f5b76ad159ba40 100644 >--- a/Source/WebCore/Modules/websockets/WebSocketHandshake.h >+++ b/Source/WebCore/Modules/websockets/WebSocketHandshake.h >@@ -66,7 +66,7 @@ public: > > CString clientHandshakeMessage() const; > ResourceRequest clientHandshakeRequest() const; >- std::optional<CookieRequestHeaderFieldProxy> clientHandshakeCookieRequestHeaderFieldProxy() const; >+ WTF::Optional<CookieRequestHeaderFieldProxy> clientHandshakeCookieRequestHeaderFieldProxy() const; > > void reset(); > void clearDocument(); >diff --git a/Source/WebCore/Modules/webvr/NavigatorWebVR.cpp b/Source/WebCore/Modules/webvr/NavigatorWebVR.cpp >index a611f4320374fd9a0709d4425b44b204982858b3..03e478934898aeb8ca5cb76ad35c84bcf9db31c2 100644 >--- a/Source/WebCore/Modules/webvr/NavigatorWebVR.cpp >+++ b/Source/WebCore/Modules/webvr/NavigatorWebVR.cpp >@@ -48,7 +48,7 @@ void NavigatorWebVR::getVRDisplays(Navigator& navigator, Document& document, Get > void NavigatorWebVR::getVRDisplays(Document& document, GetVRDisplaysPromise&& promise) > { > document.postTask([this, promise = WTFMove(promise)] (ScriptExecutionContext& context) mutable { >- std::optional<VRManager::VRDisplaysVector> platformDisplays = VRManager::singleton().getVRDisplays(); >+ WTF::Optional<VRManager::VRDisplaysVector> platformDisplays = VRManager::singleton().getVRDisplays(); > if (!platformDisplays) { > promise.reject(); > m_displays.clear(); >diff --git a/Source/WebCore/Modules/webvr/VRDisplay.cpp b/Source/WebCore/Modules/webvr/VRDisplay.cpp >index a933d980fcf5a99174ab0e0c40020916cbf1b366..4af23b512b17bb8a85b953f1f03b64dbd1c299f4 100644 >--- a/Source/WebCore/Modules/webvr/VRDisplay.cpp >+++ b/Source/WebCore/Modules/webvr/VRDisplay.cpp >@@ -180,7 +180,7 @@ void VRDisplay::requestPresent(const Vector<VRLayerInit>& layers, Ref<DeferredPr > > void VRDisplay::stopPresenting() > { >- m_presentingLayer = std::nullopt; >+ m_presentingLayer = WTF::nullopt; > } > > void VRDisplay::exitPresent(Ref<DeferredPromise>&& promise) >@@ -207,12 +207,12 @@ void VRDisplay::submitFrame() > > void VRDisplay::platformDisplayConnected() > { >- document()->domWindow()->dispatchEvent(VRDisplayEvent::create(eventNames().vrdisplayconnectEvent, makeRefPtr(this), std::nullopt)); >+ document()->domWindow()->dispatchEvent(VRDisplayEvent::create(eventNames().vrdisplayconnectEvent, makeRefPtr(this), WTF::nullopt)); > } > > void VRDisplay::platformDisplayDisconnected() > { >- document()->domWindow()->dispatchEvent(VRDisplayEvent::create(eventNames().vrdisplaydisconnectEvent, makeRefPtr(this), std::nullopt)); >+ document()->domWindow()->dispatchEvent(VRDisplayEvent::create(eventNames().vrdisplaydisconnectEvent, makeRefPtr(this), WTF::nullopt)); > } > > void VRDisplay::platformDisplayMounted() >diff --git a/Source/WebCore/Modules/webvr/VRDisplay.h b/Source/WebCore/Modules/webvr/VRDisplay.h >index 2f8ea8c267a06e7ee9c99db7e4eccc6d5ea62c6c..3577a5852ae16bdc99d1b30d840fcd4fbfe5b790 100644 >--- a/Source/WebCore/Modules/webvr/VRDisplay.h >+++ b/Source/WebCore/Modules/webvr/VRDisplay.h >@@ -127,7 +127,7 @@ private: > > RefPtr<ScriptedAnimationController> m_scriptedAnimationController; > >- std::optional<VRLayerInit> m_presentingLayer; >+ WTF::Optional<VRLayerInit> m_presentingLayer; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp b/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp >index 0aa8ea1173a7a3de5f7f6ce85c88cffe61453e63..8a1cc745605948dfcc749ca4f4aa674081b09514 100644 >--- a/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp >+++ b/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp >@@ -36,7 +36,7 @@ VRDisplayEvent::VRDisplayEvent(const AtomicString& type, const Init& initializer > { > } > >-VRDisplayEvent::VRDisplayEvent(const AtomicString& name, const RefPtr<VRDisplay>& display, std::optional<VRDisplayEventReason>&& reason) >+VRDisplayEvent::VRDisplayEvent(const AtomicString& name, const RefPtr<VRDisplay>& display, WTF::Optional<VRDisplayEventReason>&& reason) > : Event(name, CanBubble::No, IsCancelable::No) > , m_display(display) > , m_reason(WTFMove(reason)) >diff --git a/Source/WebCore/Modules/webvr/VRDisplayEvent.h b/Source/WebCore/Modules/webvr/VRDisplayEvent.h >index dae7a6d1d25d51282ddebb62b26e5a6040ecce3a..d15a837d2b0d7ca9eeec3018419bb5e190ab651d 100644 >--- a/Source/WebCore/Modules/webvr/VRDisplayEvent.h >+++ b/Source/WebCore/Modules/webvr/VRDisplayEvent.h >@@ -32,14 +32,14 @@ namespace WebCore { > > class VRDisplayEvent final : public Event { > public: >- static Ref<VRDisplayEvent> create(const AtomicString& type, const RefPtr<VRDisplay>& display, std::optional<VRDisplayEventReason>&& reason) >+ static Ref<VRDisplayEvent> create(const AtomicString& type, const RefPtr<VRDisplay>& display, WTF::Optional<VRDisplayEventReason>&& reason) > { > return adoptRef(*new VRDisplayEvent(type, display, WTFMove(reason))); > } > > struct Init : EventInit { > RefPtr<VRDisplay> display; >- std::optional<VRDisplayEventReason> reason; >+ WTF::Optional<VRDisplayEventReason> reason; > }; > > static Ref<VRDisplayEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) >@@ -50,17 +50,17 @@ public: > virtual ~VRDisplayEvent(); > > RefPtr<VRDisplay> display() const { return m_display; } >- const std::optional<VRDisplayEventReason>& reason() const { return m_reason; } >+ const WTF::Optional<VRDisplayEventReason>& reason() const { return m_reason; } > > private: > VRDisplayEvent(const AtomicString&, const Init&, IsTrusted); >- VRDisplayEvent(const AtomicString&, const RefPtr<VRDisplay>&, std::optional<VRDisplayEventReason>&&); >+ VRDisplayEvent(const AtomicString&, const RefPtr<VRDisplay>&, WTF::Optional<VRDisplayEventReason>&&); > > // Event > EventInterface eventInterface() const override; > > RefPtr<VRDisplay> m_display; >- std::optional<VRDisplayEventReason> m_reason; >+ WTF::Optional<VRDisplayEventReason> m_reason; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/webvr/VRPose.cpp b/Source/WebCore/Modules/webvr/VRPose.cpp >index 1686b9a5ab7df7c37ae3ce223570d049b50e9792..64ce57d5a1ed2364e31548de10e2b92b0d5d70ea 100644 >--- a/Source/WebCore/Modules/webvr/VRPose.cpp >+++ b/Source/WebCore/Modules/webvr/VRPose.cpp >@@ -27,7 +27,7 @@ > > namespace WebCore { > >-static RefPtr<Float32Array> optionalFloat3ToJSCArray(const std::optional<VRPlatformTrackingInfo::Float3>& data) >+static RefPtr<Float32Array> optionalFloat3ToJSCArray(const WTF::Optional<VRPlatformTrackingInfo::Float3>& data) > { > if (!data) > return nullptr; >diff --git a/Source/WebCore/Modules/webvr/VRStageParameters.h b/Source/WebCore/Modules/webvr/VRStageParameters.h >index bffcc12a9c68c5ba137074a136e90c1a1edf3176..25aa25b6af85686c1d1c256264328306854c442a 100644 >--- a/Source/WebCore/Modules/webvr/VRStageParameters.h >+++ b/Source/WebCore/Modules/webvr/VRStageParameters.h >@@ -33,7 +33,7 @@ namespace WebCore { > > class VRStageParameters : public RefCounted<VRStageParameters> { > public: >- static RefPtr<VRStageParameters> create(const std::optional<TransformationMatrix>& sittingToStandingTransform, const std::optional<FloatSize>& playAreaBounds) >+ static RefPtr<VRStageParameters> create(const WTF::Optional<TransformationMatrix>& sittingToStandingTransform, const WTF::Optional<FloatSize>& playAreaBounds) > { > if (!sittingToStandingTransform || !playAreaBounds) > return nullptr; >diff --git a/Source/WebCore/PAL/pal/SessionID.h b/Source/WebCore/PAL/pal/SessionID.h >index d7268305db4afa470d6546a617fb6a809bb67368..4d4878c9af3fc105c3211279ecdefc00f80c7a25 100644 >--- a/Source/WebCore/PAL/pal/SessionID.h >+++ b/Source/WebCore/PAL/pal/SessionID.h >@@ -64,7 +64,7 @@ public: > > template<class Encoder> void encode(Encoder&) const; > template<class Decoder> static bool decode(Decoder&, SessionID&); >- template<class Decoder> static std::optional<SessionID> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<SessionID> decode(Decoder&); > > SessionID isolatedCopy() const; > >@@ -87,7 +87,7 @@ void SessionID::encode(Encoder& encoder) const > template<class Decoder> > bool SessionID::decode(Decoder& decoder, SessionID& sessionID) > { >- std::optional<SessionID> decodedSessionID; >+ WTF::Optional<SessionID> decodedSessionID; > decoder >> decodedSessionID; > if (!decodedSessionID) > return false; >@@ -97,12 +97,12 @@ bool SessionID::decode(Decoder& decoder, SessionID& sessionID) > } > > template<class Decoder> >-std::optional<SessionID> SessionID::decode(Decoder& decoder) >+WTF::Optional<SessionID> SessionID::decode(Decoder& decoder) > { >- std::optional<uint64_t> sessionID; >+ WTF::Optional<uint64_t> sessionID; > decoder >> sessionID; > if (!sessionID) >- return std::nullopt; >+ return WTF::nullopt; > > // FIXME: Eliminate places that encode invalid SessionIDs, then fail to decode an invalid sessionID. > return SessionID { *sessionID }; >diff --git a/Source/WebCore/PAL/pal/crypto/gcrypt/Utilities.h b/Source/WebCore/PAL/pal/crypto/gcrypt/Utilities.h >index 6292a0f80bb0f5826532fe41b3baa091bde2c616..661b4b1dff5e14c8c0da8acc89eeffa2c9672c38 100644 >--- a/Source/WebCore/PAL/pal/crypto/gcrypt/Utilities.h >+++ b/Source/WebCore/PAL/pal/crypto/gcrypt/Utilities.h >@@ -53,7 +53,7 @@ static inline void logError(gcry_error_t error) > #endif > } > >-static inline std::optional<int> aesAlgorithmForKeySize(size_t keySize) >+static inline WTF::Optional<int> aesAlgorithmForKeySize(size_t keySize) > { > switch (keySize) { > case 128: >@@ -63,7 +63,7 @@ static inline std::optional<int> aesAlgorithmForKeySize(size_t keySize) > case 256: > return GCRY_CIPHER_AES256; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.cpp b/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.cpp >index ac8ad8bef5fac1e7be39e2ec5bc3adda768ef787..535a7a50ce813a6bc35cca73611d59082c60707d 100644 >--- a/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.cpp >+++ b/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.cpp >@@ -118,39 +118,39 @@ bool decodeStructure(asn1_node* root, const char* elementName, const Vector<uint > return ret == ASN1_SUCCESS; > } > >-std::optional<Vector<uint8_t>> elementData(asn1_node root, const char* elementName) >+WTF::Optional<Vector<uint8_t>> elementData(asn1_node root, const char* elementName) > { > int length = 0; > unsigned type = 0; > int ret = asn1_read_value_type(root, elementName, nullptr, &length, &type); > if (ret != ASN1_MEM_ERROR) >- return std::nullopt; >+ return WTF::nullopt; > > if (type == ASN1_ETYPE_BIT_STRING) { > if (length % 8) >- return std::nullopt; >+ return WTF::nullopt; > length /= 8; > } > > Vector<uint8_t> data(length); > ret = asn1_read_value(root, elementName, data.data(), &length); > if (ret != ASN1_SUCCESS) >- return std::nullopt; >+ return WTF::nullopt; > > return data; > } > >-std::optional<Vector<uint8_t>> encodedData(asn1_node root, const char* elementName) >+WTF::Optional<Vector<uint8_t>> encodedData(asn1_node root, const char* elementName) > { > int length = 0; > int ret = asn1_der_coding(root, elementName, nullptr, &length, nullptr); > if (ret != ASN1_MEM_ERROR) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<uint8_t> data(length); > ret = asn1_der_coding(root, elementName, data.data(), &length, nullptr); > if (ret != ASN1_SUCCESS) >- return std::nullopt; >+ return WTF::nullopt; > > return data; > } >diff --git a/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.h b/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.h >index 65aaf6ce39553ad48348effba9bad3af4feb3bc2..b3ee0413e8260e22d69d0204d2b4d355541737cf 100644 >--- a/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.h >+++ b/Source/WebCore/PAL/pal/crypto/tasn1/Utilities.h >@@ -57,8 +57,8 @@ private: > > bool createStructure(const char* elementName, asn1_node* root); > bool decodeStructure(asn1_node* root, const char* elementName, const Vector<uint8_t>& data); >-std::optional<Vector<uint8_t>> elementData(asn1_node root, const char* elementName); >-std::optional<Vector<uint8_t>> encodedData(asn1_node root, const char* elementName); >+WTF::Optional<Vector<uint8_t>> elementData(asn1_node root, const char* elementName); >+WTF::Optional<Vector<uint8_t>> encodedData(asn1_node root, const char* elementName); > bool writeElement(asn1_node root, const char* elementName, const void* data, size_t dataSize); > > } // namespace TASN1 >diff --git a/Source/WebCore/accessibility/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp >index f114ba949b0b32d0f6e689212dfd51f3e12315b2..991085ee5ba43b61591d2ba32da4552b994cce21 100644 >--- a/Source/WebCore/accessibility/AXObjectCache.cpp >+++ b/Source/WebCore/accessibility/AXObjectCache.cpp >@@ -2188,19 +2188,19 @@ AccessibilityObject* AXObjectCache::accessibilityObjectForTextMarkerData(TextMar > return this->getOrCreate(domNode); > } > >-std::optional<TextMarkerData> AXObjectCache::textMarkerDataForVisiblePosition(const VisiblePosition& visiblePos) >+WTF::Optional<TextMarkerData> AXObjectCache::textMarkerDataForVisiblePosition(const VisiblePosition& visiblePos) > { > if (visiblePos.isNull()) >- return std::nullopt; >+ return WTF::nullopt; > > Position deepPos = visiblePos.deepEquivalent(); > Node* domNode = deepPos.deprecatedNode(); > ASSERT(domNode); > if (!domNode) >- return std::nullopt; >+ return WTF::nullopt; > > if (is<HTMLInputElement>(*domNode) && downcast<HTMLInputElement>(*domNode).isPasswordField()) >- return std::nullopt; >+ return WTF::nullopt; > > // If the visible position has an anchor type referring to a node other than the anchored node, we should > // set the text marker data with CharacterOffset so that the offset will correspond to the node. >@@ -2214,7 +2214,7 @@ std::optional<TextMarkerData> AXObjectCache::textMarkerDataForVisiblePosition(co > // find or create an accessibility object for this node > AXObjectCache* cache = domNode->document().axObjectCache(); > if (!cache) >- return std::nullopt; >+ return WTF::nullopt; > RefPtr<AccessibilityObject> obj = cache->getOrCreate(domNode); > > // This memory must be zero'd so instances of TextMarkerData can be tested for byte-equivalence. >@@ -2236,18 +2236,18 @@ std::optional<TextMarkerData> AXObjectCache::textMarkerDataForVisiblePosition(co > } > > // This function exits as a performance optimization to avoid a synchronous layout. >-std::optional<TextMarkerData> AXObjectCache::textMarkerDataForFirstPositionInTextControl(HTMLTextFormControlElement& textControl) >+WTF::Optional<TextMarkerData> AXObjectCache::textMarkerDataForFirstPositionInTextControl(HTMLTextFormControlElement& textControl) > { > if (is<HTMLInputElement>(textControl) && downcast<HTMLInputElement>(textControl).isPasswordField()) >- return std::nullopt; >+ return WTF::nullopt; > > AXObjectCache* cache = textControl.document().axObjectCache(); > if (!cache) >- return std::nullopt; >+ return WTF::nullopt; > > RefPtr<AccessibilityObject> obj = cache->getOrCreate(&textControl); > if (!obj) >- return std::nullopt; >+ return WTF::nullopt; > > // This memory must be zero'd so instances of TextMarkerData can be tested for byte-equivalence. > // Warning: This is risky and bad because TextMarkerData is a nontrivial type. >diff --git a/Source/WebCore/accessibility/AXObjectCache.h b/Source/WebCore/accessibility/AXObjectCache.h >index 3e4c6146d9ba38c8642805b3243b0812faf6b700..6a3202c472e8ce0781b296d8e9a9c8049f7fc561 100644 >--- a/Source/WebCore/accessibility/AXObjectCache.h >+++ b/Source/WebCore/accessibility/AXObjectCache.h >@@ -204,8 +204,8 @@ public: > AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id); } > > // Text marker utilities. >- std::optional<TextMarkerData> textMarkerDataForVisiblePosition(const VisiblePosition&); >- std::optional<TextMarkerData> textMarkerDataForFirstPositionInTextControl(HTMLTextFormControlElement&); >+ WTF::Optional<TextMarkerData> textMarkerDataForVisiblePosition(const VisiblePosition&); >+ WTF::Optional<TextMarkerData> textMarkerDataForFirstPositionInTextControl(HTMLTextFormControlElement&); > void textMarkerDataForCharacterOffset(TextMarkerData&, const CharacterOffset&); > void textMarkerDataForNextCharacterOffset(TextMarkerData&, const CharacterOffset&); > void textMarkerDataForPreviousCharacterOffset(TextMarkerData&, const CharacterOffset&); >diff --git a/Source/WebCore/animation/AnimationEffect.cpp b/Source/WebCore/animation/AnimationEffect.cpp >index 2b8c538313f1ec16ab6f4bc7df91a95aee783dd2..6ee6d22dc85ac4d6910e5817b5182b8187b79f8f 100644 >--- a/Source/WebCore/animation/AnimationEffect.cpp >+++ b/Source/WebCore/animation/AnimationEffect.cpp >@@ -41,11 +41,11 @@ AnimationEffect::~AnimationEffect() > { > } > >-std::optional<Seconds> AnimationEffect::localTime() const >+WTF::Optional<Seconds> AnimationEffect::localTime() const > { > if (m_animation) > return m_animation->currentTime(); >- return std::nullopt; >+ return WTF::nullopt; > } > > auto AnimationEffect::phase() const -> Phase >@@ -86,7 +86,7 @@ auto AnimationEffect::phase() const -> Phase > return Phase::Active; > } > >-std::optional<Seconds> AnimationEffect::activeTime() const >+WTF::Optional<Seconds> AnimationEffect::activeTime() const > { > // 3.8.3.1. Calculating the active time > // https://drafts.csswg.org/web-animations-1/#calculating-the-active-time >@@ -105,7 +105,7 @@ std::optional<Seconds> AnimationEffect::activeTime() const > if (m_fill == FillMode::Backwards || m_fill == FillMode::Both) > return std::max(localTime().value() - m_delay, 0_s); > // Otherwise, return an unresolved time value. >- return std::nullopt; >+ return WTF::nullopt; > } > > // If the animation effect is in the active phase, return the result of evaluating local time - start delay. >@@ -120,14 +120,14 @@ std::optional<Seconds> AnimationEffect::activeTime() const > if (m_fill == FillMode::Forwards || m_fill == FillMode::Both) > return std::max(std::min(localTime().value() - m_delay, activeDuration()), 0_s); > // Otherwise, return an unresolved time value. >- return std::nullopt; >+ return WTF::nullopt; > } > > // Otherwise (the local time is unresolved), return an unresolved time value. >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<double> AnimationEffect::overallProgress() const >+WTF::Optional<double> AnimationEffect::overallProgress() const > { > // 3.8.3.2. Calculating the overall progress > // https://drafts.csswg.org/web-animations-1/#calculating-the-overall-progress >@@ -137,7 +137,7 @@ std::optional<double> AnimationEffect::overallProgress() const > // 1. If the active time is unresolved, return unresolved. > auto effectActiveTime = activeTime(); > if (!effectActiveTime) >- return std::nullopt; >+ return WTF::nullopt; > > // 2. Calculate an initial value for overall progress based on the first matching condition from below, > double overallProgress; >@@ -156,7 +156,7 @@ std::optional<double> AnimationEffect::overallProgress() const > return std::abs(overallProgress); > } > >-std::optional<double> AnimationEffect::simpleIterationProgress() const >+WTF::Optional<double> AnimationEffect::simpleIterationProgress() const > { > // 3.8.3.3. Calculating the simple iteration progress > // https://drafts.csswg.org/web-animations-1/#calculating-the-simple-iteration-progress >@@ -168,7 +168,7 @@ std::optional<double> AnimationEffect::simpleIterationProgress() const > // 1. If the overall progress is unresolved, return unresolved. > auto effectOverallProgress = overallProgress(); > if (!effectOverallProgress) >- return std::nullopt; >+ return WTF::nullopt; > > // 2. If overall progress is infinity, let the simple iteration progress be iteration start % 1.0, > // otherwise, let the simple iteration progress be overall progress % 1.0. >@@ -189,7 +189,7 @@ std::optional<double> AnimationEffect::simpleIterationProgress() const > return simpleIterationProgress; > } > >-std::optional<double> AnimationEffect::currentIteration() const >+WTF::Optional<double> AnimationEffect::currentIteration() const > { > // 3.8.4. Calculating the current iteration > // https://drafts.csswg.org/web-animations-1/#calculating-the-current-iteration >@@ -198,7 +198,7 @@ std::optional<double> AnimationEffect::currentIteration() const > > // 1. If the active time is unresolved, return unresolved. > if (!activeTime()) >- return std::nullopt; >+ return WTF::nullopt; > > // 2. If the animation effect is in the after phase and the iteration count is infinity, return infinity. > if (phase() == Phase::After && std::isinf(m_iterations)) >@@ -237,7 +237,7 @@ AnimationEffect::ComputedDirection AnimationEffect::currentDirection() const > return AnimationEffect::ComputedDirection::Reverse; > } > >-std::optional<double> AnimationEffect::directedProgress() const >+WTF::Optional<double> AnimationEffect::directedProgress() const > { > // 3.9.1. Calculating the directed progress > // https://drafts.csswg.org/web-animations-1/#calculating-the-directed-progress >@@ -247,7 +247,7 @@ std::optional<double> AnimationEffect::directedProgress() const > // 1. If the simple iteration progress is unresolved, return unresolved. > auto effectSimpleIterationProgress = simpleIterationProgress(); > if (!effectSimpleIterationProgress) >- return std::nullopt; >+ return WTF::nullopt; > > // 2. Calculate the current direction (we implement this as a separate method). > >@@ -259,7 +259,7 @@ std::optional<double> AnimationEffect::directedProgress() const > return 1 - effectSimpleIterationProgress.value(); > } > >-std::optional<double> AnimationEffect::transformedProgress() const >+WTF::Optional<double> AnimationEffect::transformedProgress() const > { > // 3.10.1. Calculating the transformed progress > // https://drafts.csswg.org/web-animations-1/#calculating-the-transformed-progress >@@ -269,7 +269,7 @@ std::optional<double> AnimationEffect::transformedProgress() const > // 1. If the directed progress is unresolved, return unresolved. > auto effectDirectedProgress = directedProgress(); > if (!effectDirectedProgress) >- return std::nullopt; >+ return WTF::nullopt; > > auto effectDirectedProgressValue = effectDirectedProgress.value(); > >@@ -294,7 +294,7 @@ std::optional<double> AnimationEffect::transformedProgress() const > return effectDirectedProgressValue; > } > >-std::optional<double> AnimationEffect::iterationProgress() const >+WTF::Optional<double> AnimationEffect::iterationProgress() const > { > return transformedProgress(); > } >@@ -336,7 +336,7 @@ ComputedEffectTiming AnimationEffect::getComputedTiming() > return computedTiming; > } > >-ExceptionOr<void> AnimationEffect::updateTiming(std::optional<OptionalEffectTiming> timing) >+ExceptionOr<void> AnimationEffect::updateTiming(WTF::Optional<OptionalEffectTiming> timing) > { > // 6.5.4. Updating the timing of an AnimationEffect > // https://drafts.csswg.org/web-animations/#updating-animationeffect-timing >diff --git a/Source/WebCore/animation/AnimationEffect.h b/Source/WebCore/animation/AnimationEffect.h >index 8584db2b9d78d987c878f8ac47d2b46d42314bf6..1eef9fe4c64afa4f2f8caf9c64c780b53cb3d749 100644 >--- a/Source/WebCore/animation/AnimationEffect.h >+++ b/Source/WebCore/animation/AnimationEffect.h >@@ -53,7 +53,7 @@ public: > > EffectTiming getTiming(); > ComputedEffectTiming getComputedTiming(); >- ExceptionOr<void> updateTiming(std::optional<OptionalEffectTiming>); >+ ExceptionOr<void> updateTiming(WTF::Optional<OptionalEffectTiming>); > > virtual void apply(RenderStyle&) = 0; > virtual void invalidate() = 0; >@@ -87,12 +87,12 @@ public: > TimingFunction* timingFunction() const { return m_timingFunction.get(); } > void setTimingFunction(const RefPtr<TimingFunction>&); > >- std::optional<Seconds> localTime() const; >- std::optional<Seconds> activeTime() const; >+ WTF::Optional<Seconds> localTime() const; >+ WTF::Optional<Seconds> activeTime() const; > Seconds endTime() const; >- std::optional<double> simpleIterationProgress() const; >- std::optional<double> iterationProgress() const; >- std::optional<double> currentIteration() const; >+ WTF::Optional<double> simpleIterationProgress() const; >+ WTF::Optional<double> iterationProgress() const; >+ WTF::Optional<double> currentIteration() const; > Seconds activeDuration() const; > > enum class Phase { Before, Active, After, Idle }; >@@ -104,10 +104,10 @@ protected: > private: > enum class ComputedDirection { Forwards, Reverse }; > >- std::optional<double> overallProgress() const; >+ WTF::Optional<double> overallProgress() const; > AnimationEffect::ComputedDirection currentDirection() const; >- std::optional<double> directedProgress() const; >- std::optional<double> transformedProgress() const; >+ WTF::Optional<double> directedProgress() const; >+ WTF::Optional<double> transformedProgress() const; > > Seconds m_delay { 0_s }; > Seconds m_endDelay { 0_s }; >diff --git a/Source/WebCore/animation/AnimationPlaybackEvent.cpp b/Source/WebCore/animation/AnimationPlaybackEvent.cpp >index 96c09248b4487e49f76c489ee56676b09723b072..333aaf7a3cf900c61b1c666d77a5a70f827dc39e 100644 >--- a/Source/WebCore/animation/AnimationPlaybackEvent.cpp >+++ b/Source/WebCore/animation/AnimationPlaybackEvent.cpp >@@ -33,18 +33,18 @@ namespace WebCore { > AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, const AnimationPlaybackEventInit& initializer, IsTrusted isTrusted) > : Event(type, initializer, isTrusted) > { >- if (initializer.currentTime == std::nullopt) >- m_currentTime = std::nullopt; >+ if (initializer.currentTime == WTF::nullopt) >+ m_currentTime = WTF::nullopt; > else > m_currentTime = Seconds::fromMilliseconds(initializer.currentTime.value()); > >- if (initializer.timelineTime == std::nullopt) >- m_timelineTime = std::nullopt; >+ if (initializer.timelineTime == WTF::nullopt) >+ m_timelineTime = WTF::nullopt; > else > m_timelineTime = Seconds::fromMilliseconds(initializer.timelineTime.value()); > } > >-AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, std::optional<Seconds> currentTime, std::optional<Seconds> timelineTime) >+AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, WTF::Optional<Seconds> currentTime, WTF::Optional<Seconds> timelineTime) > : Event(type, CanBubble::Yes, IsCancelable::No) > , m_currentTime(currentTime) > , m_timelineTime(timelineTime) >@@ -53,17 +53,17 @@ AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, std::op > > AnimationPlaybackEvent::~AnimationPlaybackEvent() = default; > >-std::optional<double> AnimationPlaybackEvent::bindingsCurrentTime() const >+WTF::Optional<double> AnimationPlaybackEvent::bindingsCurrentTime() const > { > if (!m_currentTime) >- return std::nullopt; >+ return WTF::nullopt; > return secondsToWebAnimationsAPITime(m_currentTime.value()); > } > >-std::optional<double> AnimationPlaybackEvent::bindingsTimelineTime() const >+WTF::Optional<double> AnimationPlaybackEvent::bindingsTimelineTime() const > { > if (!m_timelineTime) >- return std::nullopt; >+ return WTF::nullopt; > return secondsToWebAnimationsAPITime(m_timelineTime.value()); > } > >diff --git a/Source/WebCore/animation/AnimationPlaybackEvent.h b/Source/WebCore/animation/AnimationPlaybackEvent.h >index 384ce3eb35d2b256bbf18ba0093627670c641d17..64de00090414688f1ad9c36cd8bc37dc2826f455 100644 >--- a/Source/WebCore/animation/AnimationPlaybackEvent.h >+++ b/Source/WebCore/animation/AnimationPlaybackEvent.h >@@ -32,7 +32,7 @@ namespace WebCore { > > class AnimationPlaybackEvent final : public Event { > public: >- static Ref<AnimationPlaybackEvent> create(const AtomicString& type, std::optional<Seconds> currentTime, std::optional<Seconds> timelineTime) >+ static Ref<AnimationPlaybackEvent> create(const AtomicString& type, WTF::Optional<Seconds> currentTime, WTF::Optional<Seconds> timelineTime) > { > return adoptRef(*new AnimationPlaybackEvent(type, currentTime, timelineTime)); > } >@@ -44,19 +44,19 @@ public: > > virtual ~AnimationPlaybackEvent(); > >- std::optional<double> bindingsCurrentTime() const; >- std::optional<Seconds> currentTime() const { return m_currentTime; } >- std::optional<double> bindingsTimelineTime() const; >- std::optional<Seconds> timelineTime() const { return m_timelineTime; } >+ WTF::Optional<double> bindingsCurrentTime() const; >+ WTF::Optional<Seconds> currentTime() const { return m_currentTime; } >+ WTF::Optional<double> bindingsTimelineTime() const; >+ WTF::Optional<Seconds> timelineTime() const { return m_timelineTime; } > > EventInterface eventInterface() const override { return AnimationPlaybackEventInterfaceType; } > > private: >- AnimationPlaybackEvent(const AtomicString&, std::optional<Seconds>, std::optional<Seconds>); >+ AnimationPlaybackEvent(const AtomicString&, WTF::Optional<Seconds>, WTF::Optional<Seconds>); > AnimationPlaybackEvent(const AtomicString&, const AnimationPlaybackEventInit&, IsTrusted); > >- std::optional<Seconds> m_currentTime; >- std::optional<Seconds> m_timelineTime; >+ WTF::Optional<Seconds> m_currentTime; >+ WTF::Optional<Seconds> m_timelineTime; > }; > > } >diff --git a/Source/WebCore/animation/AnimationPlaybackEventInit.h b/Source/WebCore/animation/AnimationPlaybackEventInit.h >index 3e2ed7393eaae59427b939d314b796024c96dd87..fcb362455b9eca60d7e1c3d8b9b6f4175e28db1a 100644 >--- a/Source/WebCore/animation/AnimationPlaybackEventInit.h >+++ b/Source/WebCore/animation/AnimationPlaybackEventInit.h >@@ -31,8 +31,8 @@ > namespace WebCore { > > struct AnimationPlaybackEventInit : EventInit { >- std::optional<double> currentTime; >- std::optional<double> timelineTime; >+ WTF::Optional<double> currentTime; >+ WTF::Optional<double> timelineTime; > }; > > } >diff --git a/Source/WebCore/animation/AnimationTimeline.cpp b/Source/WebCore/animation/AnimationTimeline.cpp >index 67a6f3f85b0d7a5107b39a9a8e27a7a498941a76..c560a4c268ea03881f15b289ce1f5665ed99aa71 100644 >--- a/Source/WebCore/animation/AnimationTimeline.cpp >+++ b/Source/WebCore/animation/AnimationTimeline.cpp >@@ -80,11 +80,11 @@ void AnimationTimeline::removeAnimation(WebAnimation& animation) > } > } > >-std::optional<double> AnimationTimeline::bindingsCurrentTime() >+WTF::Optional<double> AnimationTimeline::bindingsCurrentTime() > { > auto time = currentTime(); > if (!time) >- return std::nullopt; >+ return WTF::nullopt; > return secondsToWebAnimationsAPITime(*time); > } > >@@ -365,7 +365,7 @@ void AnimationTimeline::updateCSSTransitionsForElement(Element& element, const R > > auto numberOfProperties = CSSPropertyAnimation::getNumProperties(); > for (int propertyIndex = 0; propertyIndex < numberOfProperties; ++propertyIndex) { >- std::optional<bool> isShorthand; >+ WTF::Optional<bool> isShorthand; > auto property = CSSPropertyAnimation::getPropertyAtIndex(propertyIndex, isShorthand); > if (isShorthand && *isShorthand) > continue; >diff --git a/Source/WebCore/animation/AnimationTimeline.h b/Source/WebCore/animation/AnimationTimeline.h >index 896eb553dc62e30c430a772f59b35641b8948271..75b86eaa25ef5b9edc17bee9791e1b0ba7d3d180 100644 >--- a/Source/WebCore/animation/AnimationTimeline.h >+++ b/Source/WebCore/animation/AnimationTimeline.h >@@ -52,8 +52,8 @@ public: > virtual void animationTimingDidChange(WebAnimation&); > virtual void removeAnimation(WebAnimation&); > >- std::optional<double> bindingsCurrentTime(); >- virtual std::optional<Seconds> currentTime() { return m_currentTime; } >+ WTF::Optional<double> bindingsCurrentTime(); >+ virtual WTF::Optional<Seconds> currentTime() { return m_currentTime; } > > enum class Ordering { Sorted, Unsorted }; > Vector<RefPtr<WebAnimation>> animationsForElement(Element&, Ordering ordering = Ordering::Unsorted) const; >@@ -91,7 +91,7 @@ private: > void cancelDeclarativeAnimation(DeclarativeAnimation&); > > ClassType m_classType; >- std::optional<Seconds> m_currentTime; >+ WTF::Optional<Seconds> m_currentTime; > ElementToAnimationsMap m_elementToAnimationsMap; > ElementToAnimationsMap m_elementToCSSAnimationsMap; > ElementToAnimationsMap m_elementToCSSTransitionsMap; >diff --git a/Source/WebCore/animation/ComputedEffectTiming.h b/Source/WebCore/animation/ComputedEffectTiming.h >index eb9fe9384963b5cd4620100471ebc2e7185a4f58..dd47ae1e4523cb52a1a27f15b734eba1c86cfe88 100644 >--- a/Source/WebCore/animation/ComputedEffectTiming.h >+++ b/Source/WebCore/animation/ComputedEffectTiming.h >@@ -33,9 +33,9 @@ namespace WebCore { > struct ComputedEffectTiming : EffectTiming { > double endTime; > double activeDuration; >- std::optional<double> localTime; >- std::optional<double> progress; >- std::optional<double> currentIteration; >+ WTF::Optional<double> localTime; >+ WTF::Optional<double> progress; >+ WTF::Optional<double> currentIteration; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/animation/DeclarativeAnimation.cpp b/Source/WebCore/animation/DeclarativeAnimation.cpp >index 87a75235c00b397f907a3b7b40051762d35db570..9150e02902c769a6f16f408a06e8dbbb4c95ebae 100644 >--- a/Source/WebCore/animation/DeclarativeAnimation.cpp >+++ b/Source/WebCore/animation/DeclarativeAnimation.cpp >@@ -117,25 +117,25 @@ void DeclarativeAnimation::syncPropertiesWithBackingAnimation() > { > } > >-std::optional<double> DeclarativeAnimation::startTime() const >+WTF::Optional<double> DeclarativeAnimation::startTime() const > { > flushPendingStyleChanges(); > return WebAnimation::startTime(); > } > >-void DeclarativeAnimation::setStartTime(std::optional<double> startTime) >+void DeclarativeAnimation::setStartTime(WTF::Optional<double> startTime) > { > flushPendingStyleChanges(); > return WebAnimation::setStartTime(startTime); > } > >-std::optional<double> DeclarativeAnimation::bindingsCurrentTime() const >+WTF::Optional<double> DeclarativeAnimation::bindingsCurrentTime() const > { > flushPendingStyleChanges(); > return WebAnimation::bindingsCurrentTime(); > } > >-ExceptionOr<void> DeclarativeAnimation::setBindingsCurrentTime(std::optional<double> currentTime) >+ExceptionOr<void> DeclarativeAnimation::setBindingsCurrentTime(WTF::Optional<double> currentTime) > { > flushPendingStyleChanges(); > return WebAnimation::setBindingsCurrentTime(currentTime); >diff --git a/Source/WebCore/animation/DeclarativeAnimation.h b/Source/WebCore/animation/DeclarativeAnimation.h >index b27a5462c825e8549bef431c05dc22ad6a3423b8..85d52d499c15bda8b393105190649a714b5f24d4 100644 >--- a/Source/WebCore/animation/DeclarativeAnimation.h >+++ b/Source/WebCore/animation/DeclarativeAnimation.h >@@ -47,10 +47,10 @@ public: > void setBackingAnimation(const Animation&); > void cancelFromStyle(); > >- std::optional<double> startTime() const final; >- void setStartTime(std::optional<double>) final; >- std::optional<double> bindingsCurrentTime() const final; >- ExceptionOr<void> setBindingsCurrentTime(std::optional<double>) final; >+ WTF::Optional<double> startTime() const final; >+ void setStartTime(WTF::Optional<double>) final; >+ WTF::Optional<double> bindingsCurrentTime() const final; >+ ExceptionOr<void> setBindingsCurrentTime(WTF::Optional<double>) final; > WebAnimation::PlayState bindingsPlayState() const final; > bool bindingsPending() const final; > WebAnimation::ReadyPromise& bindingsReady() final; >diff --git a/Source/WebCore/animation/DocumentTimeline.cpp b/Source/WebCore/animation/DocumentTimeline.cpp >index 5381424ba55829353f25d6efb8700617b7c87c18..8d36a60924ec3a37448e6c3c6811581aa7254236 100644 >--- a/Source/WebCore/animation/DocumentTimeline.cpp >+++ b/Source/WebCore/animation/DocumentTimeline.cpp >@@ -227,7 +227,7 @@ void DocumentTimeline::resumeAnimations() > if (!animationsAreSuspended()) > return; > >- m_cachedCurrentTime = std::nullopt; >+ m_cachedCurrentTime = WTF::nullopt; > > m_isSuspended = false; > >@@ -261,7 +261,7 @@ Seconds DocumentTimeline::liveCurrentTime() const > #endif > } > >-std::optional<Seconds> DocumentTimeline::currentTime() >+WTF::Optional<Seconds> DocumentTimeline::currentTime() > { > if (!m_document || !m_document->domWindow()) > return AnimationTimeline::currentTime(); >@@ -270,7 +270,7 @@ std::optional<Seconds> DocumentTimeline::currentTime() > if (mainDocumentTimeline != this) { > if (auto mainDocumentTimelineCurrentTime = mainDocumentTimeline->currentTime()) > return mainDocumentTimelineCurrentTime.value() - m_originTime; >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -323,7 +323,7 @@ void DocumentTimeline::maybeClearCachedCurrentTime() > // we're guaranteed to have a consistent current time reported for all work happening in a given > // JS frame or throughout updating animations in WebCore. > if (!m_isSuspended && !m_waitingOnVMIdle && !m_currentTimeClearingTaskQueue.hasPendingTasks()) >- m_cachedCurrentTime = std::nullopt; >+ m_cachedCurrentTime = WTF::nullopt; > } > > void DocumentTimeline::scheduleAnimationResolutionIfNeeded() >diff --git a/Source/WebCore/animation/DocumentTimeline.h b/Source/WebCore/animation/DocumentTimeline.h >index fa05217323834c5e09c0786f265365741db17c70..7d26142b94bc14bf6cb1065a650dbb3909d6e40b 100644 >--- a/Source/WebCore/animation/DocumentTimeline.h >+++ b/Source/WebCore/animation/DocumentTimeline.h >@@ -47,7 +47,7 @@ public: > > Document* document() const { return m_document.get(); } > >- std::optional<Seconds> currentTime() override; >+ WTF::Optional<Seconds> currentTime() override; > > void animationTimingDidChange(WebAnimation&) override; > void removeAnimation(WebAnimation&) override; >@@ -105,7 +105,7 @@ private: > bool m_isSuspended { false }; > bool m_waitingOnVMIdle { false }; > bool m_isUpdatingAnimations { false }; >- std::optional<Seconds> m_cachedCurrentTime; >+ WTF::Optional<Seconds> m_cachedCurrentTime; > GenericTaskQueue<Timer> m_currentTimeClearingTaskQueue; > HashSet<RefPtr<WebAnimation>> m_acceleratedAnimationsPendingRunningStateChange; > Vector<Ref<AnimationPlaybackEvent>> m_pendingAnimationEvents; >diff --git a/Source/WebCore/animation/KeyframeEffect.cpp b/Source/WebCore/animation/KeyframeEffect.cpp >index ce1bb329a2e30402b5c4a1c27eef8ec9e2a4228b..570225c35a5e728b357ff87c9cf035b585d001b4 100644 >--- a/Source/WebCore/animation/KeyframeEffect.cpp >+++ b/Source/WebCore/animation/KeyframeEffect.cpp >@@ -112,7 +112,7 @@ static inline void computeMissingKeyframeOffsets(Vector<KeyframeEffect::ParsedKe > return; > > // 1. For each keyframe, in keyframes, let the computed keyframe offset of the keyframe be equal to its keyframe offset value. >- // In our implementation, we only set non-null values to avoid making computedOffset std::optional<double>. Instead, we'll know >+ // In our implementation, we only set non-null values to avoid making computedOffset WTF::Optional<double>. Instead, we'll know > // that a keyframe hasn't had a computed offset by checking if it has a null offset and a 0 computedOffset, since the first > // keyframe will already have a 0 computedOffset. > for (auto& keyframe : keyframes) >@@ -390,13 +390,13 @@ static inline ExceptionOr<void> processPropertyIndexedKeyframes(ExecState& state > // 5. Let offsets be a sequence of nullable double values assigned based on the type of the âoffsetâ member of the property-indexed keyframe as follows: > // - sequence<double?>, the value of âoffsetâ as-is. > // - double?, a sequence of length one with the value of âoffsetâ as its single item, i.e. « offset », >- Vector<std::optional<double>> offsets; >- if (WTF::holds_alternative<Vector<std::optional<double>>>(propertyIndexedKeyframe.baseProperties.offset)) >- offsets = WTF::get<Vector<std::optional<double>>>(propertyIndexedKeyframe.baseProperties.offset); >+ Vector<WTF::Optional<double>> offsets; >+ if (WTF::holds_alternative<Vector<WTF::Optional<double>>>(propertyIndexedKeyframe.baseProperties.offset)) >+ offsets = WTF::get<Vector<WTF::Optional<double>>>(propertyIndexedKeyframe.baseProperties.offset); > else if (WTF::holds_alternative<double>(propertyIndexedKeyframe.baseProperties.offset)) > offsets.append(WTF::get<double>(propertyIndexedKeyframe.baseProperties.offset)); > else if (WTF::holds_alternative<std::nullptr_t>(propertyIndexedKeyframe.baseProperties.offset)) >- offsets.append(std::nullopt); >+ offsets.append(WTF::nullopt); > > // 6. Assign each value in offsets to the keyframe offset of the keyframe with corresponding position in property keyframes until the end of either sequence is reached. > for (size_t i = 0; i < offsets.size() && i < parsedKeyframes.size(); ++i) >@@ -459,7 +459,7 @@ static inline ExceptionOr<void> processPropertyIndexedKeyframes(ExecState& state > return { }; > } > >-ExceptionOr<Ref<KeyframeEffect>> KeyframeEffect::create(ExecState& state, Element* target, Strong<JSObject>&& keyframes, std::optional<Variant<double, KeyframeEffectOptions>>&& options) >+ExceptionOr<Ref<KeyframeEffect>> KeyframeEffect::create(ExecState& state, Element* target, Strong<JSObject>&& keyframes, WTF::Optional<Variant<double, KeyframeEffectOptions>>&& options) > { > auto keyframeEffect = adoptRef(*new KeyframeEffect(target)); > >@@ -1077,7 +1077,7 @@ void KeyframeEffect::setAnimatedPropertiesInStyle(RenderStyle& targetStyle, doub > // 6. Remove any keyframes from property-specific keyframes that do not have a property value for target property. > unsigned numberOfKeyframesWithZeroOffset = 0; > unsigned numberOfKeyframesWithOneOffset = 0; >- Vector<std::optional<size_t>> propertySpecificKeyframes; >+ Vector<WTF::Optional<size_t>> propertySpecificKeyframes; > for (size_t i = 0; i < m_blendingKeyframes.size(); ++i) { > auto& keyframe = m_blendingKeyframes[i]; > auto offset = keyframe.key(); >@@ -1102,7 +1102,7 @@ void KeyframeEffect::setAnimatedPropertiesInStyle(RenderStyle& targetStyle, doub > // offset of 0, a property value set to the neutral value for composition, and a composite operation of add, and prepend it to the beginning of > // property-specific keyframes. > if (!numberOfKeyframesWithZeroOffset) { >- propertySpecificKeyframes.insert(0, std::nullopt); >+ propertySpecificKeyframes.insert(0, WTF::nullopt); > numberOfKeyframesWithZeroOffset = 1; > } > >@@ -1110,12 +1110,12 @@ void KeyframeEffect::setAnimatedPropertiesInStyle(RenderStyle& targetStyle, doub > // keyframe offset of 1, a property value set to the neutral value for composition, and a composite operation of add, and append it to the end of > // property-specific keyframes. > if (!numberOfKeyframesWithOneOffset) { >- propertySpecificKeyframes.append(std::nullopt); >+ propertySpecificKeyframes.append(WTF::nullopt); > numberOfKeyframesWithOneOffset = 1; > } > > // 10. Let interval endpoints be an empty sequence of keyframes. >- Vector<std::optional<size_t>> intervalEndpoints; >+ Vector<WTF::Optional<size_t>> intervalEndpoints; > > // 11. Populate interval endpoints by following the steps from the first matching condition from below: > if (iterationProgress < 0 && numberOfKeyframesWithZeroOffset > 1) { >diff --git a/Source/WebCore/animation/KeyframeEffect.h b/Source/WebCore/animation/KeyframeEffect.h >index e973e6f5c36e4fdb5a3f4f7446e2655c24c452e8..b610437bb2dc6e004d75462cc8075561339d62c5 100644 >--- a/Source/WebCore/animation/KeyframeEffect.h >+++ b/Source/WebCore/animation/KeyframeEffect.h >@@ -46,7 +46,7 @@ class FilterOperations; > class KeyframeEffect : public AnimationEffect > , public CSSPropertyBlendingClient { > public: >- static ExceptionOr<Ref<KeyframeEffect>> create(JSC::ExecState&, Element*, JSC::Strong<JSC::JSObject>&&, std::optional<Variant<double, KeyframeEffectOptions>>&&); >+ static ExceptionOr<Ref<KeyframeEffect>> create(JSC::ExecState&, Element*, JSC::Strong<JSC::JSObject>&&, WTF::Optional<Variant<double, KeyframeEffectOptions>>&&); > static ExceptionOr<Ref<KeyframeEffect>> create(JSC::ExecState&, Ref<KeyframeEffect>&&); > static Ref<KeyframeEffect> create(const Element&); > ~KeyframeEffect() { } >@@ -54,13 +54,13 @@ public: > bool isKeyframeEffect() const final { return true; } > > struct BasePropertyIndexedKeyframe { >- Variant<std::nullptr_t, Vector<std::optional<double>>, double> offset = Vector<std::optional<double>>(); >+ Variant<std::nullptr_t, Vector<WTF::Optional<double>>, double> offset = Vector<WTF::Optional<double>>(); > Variant<Vector<String>, String> easing = Vector<String>(); > Variant<Vector<CompositeOperationOrAuto>, CompositeOperationOrAuto> composite = Vector<CompositeOperationOrAuto>(); > }; > > struct BaseKeyframe { >- std::optional<double> offset; >+ WTF::Optional<double> offset; > String easing { "linear" }; > CompositeOperationOrAuto composite { CompositeOperationOrAuto::Auto }; > }; >@@ -76,7 +76,7 @@ public: > }; > > struct ParsedKeyframe { >- std::optional<double> offset; >+ WTF::Optional<double> offset; > double computedOffset; > CompositeOperationOrAuto composite { CompositeOperationOrAuto::Auto }; > String easing; >@@ -91,7 +91,7 @@ public: > }; > > struct BaseComputedKeyframe { >- std::optional<double> offset; >+ WTF::Optional<double> offset; > double computedOffset; > String easing { "linear" }; > CompositeOperationOrAuto composite { CompositeOperationOrAuto::Auto }; >diff --git a/Source/WebCore/animation/OptionalEffectTiming.h b/Source/WebCore/animation/OptionalEffectTiming.h >index 23af2ad87551f3b098d31b670f92c5a26c491221..ef735a6ab1b53aae6d3ec9e2be7a7235c0dab535 100644 >--- a/Source/WebCore/animation/OptionalEffectTiming.h >+++ b/Source/WebCore/animation/OptionalEffectTiming.h >@@ -33,13 +33,13 @@ > namespace WebCore { > > struct OptionalEffectTiming { >- std::optional<double> delay; >- std::optional<double> endDelay; >- std::optional<FillMode> fill; >- std::optional<double> iterationStart; >- std::optional<double> iterations; >- std::optional<Variant<double, String>> duration; >- std::optional<PlaybackDirection> direction; >+ WTF::Optional<double> delay; >+ WTF::Optional<double> endDelay; >+ WTF::Optional<FillMode> fill; >+ WTF::Optional<double> iterationStart; >+ WTF::Optional<double> iterations; >+ WTF::Optional<Variant<double, String>> duration; >+ WTF::Optional<PlaybackDirection> direction; > String easing; > }; > >diff --git a/Source/WebCore/animation/WebAnimation.cpp b/Source/WebCore/animation/WebAnimation.cpp >index 850d8387e3518aa5b68ae5d6f5c9136f736cdcb6..607c992c4a35730102963940b92bb1a8609688f4 100644 >--- a/Source/WebCore/animation/WebAnimation.cpp >+++ b/Source/WebCore/animation/WebAnimation.cpp >@@ -180,7 +180,7 @@ void WebAnimation::setTimeline(RefPtr<AnimationTimeline>&& timeline) > > // 4. If the animation start time of animation is resolved, make animation's hold time unresolved. > if (m_startTime) >- m_holdTime = std::nullopt; >+ m_holdTime = WTF::nullopt; > > if (is<KeyframeEffect>(m_effect)) { > auto* keyframeEffect = downcast<KeyframeEffect>(m_effect.get()); >@@ -232,32 +232,32 @@ void WebAnimation::effectTargetDidChange(Element* previousTarget, Element* newTa > m_timeline->animationWasAddedToElement(*this, *newTarget); > } > >-std::optional<double> WebAnimation::startTime() const >+WTF::Optional<double> WebAnimation::startTime() const > { > if (!m_startTime) >- return std::nullopt; >+ return WTF::nullopt; > return secondsToWebAnimationsAPITime(m_startTime.value()); > } > >-void WebAnimation::setStartTime(std::optional<double> startTime) >+void WebAnimation::setStartTime(WTF::Optional<double> startTime) > { > // 3.4.6 The procedure to set the start time of animation, animation, to new start time, is as follows: > // https://drafts.csswg.org/web-animations/#setting-the-start-time-of-an-animation > >- std::optional<Seconds> newStartTime; >+ WTF::Optional<Seconds> newStartTime; > if (!startTime) >- newStartTime = std::nullopt; >+ newStartTime = WTF::nullopt; > else > newStartTime = Seconds::fromMilliseconds(startTime.value()); > > // 1. Let timeline time be the current time value of the timeline that animation is associated with. If > // there is no timeline associated with animation or the associated timeline is inactive, let the timeline > // time be unresolved. >- auto timelineTime = m_timeline ? m_timeline->currentTime() : std::nullopt; >+ auto timelineTime = m_timeline ? m_timeline->currentTime() : WTF::nullopt; > > // 2. If timeline time is unresolved and new start time is resolved, make animation's hold time unresolved. > if (!timelineTime && newStartTime) >- m_holdTime = std::nullopt; >+ m_holdTime = WTF::nullopt; > > // 3. Let previous current time be animation's current time. > auto previousCurrentTime = currentTime(); >@@ -273,7 +273,7 @@ void WebAnimation::setStartTime(std::optional<double> startTime) > // If new start time is resolved, > // If animation's playback rate is not zero, make animation's hold time unresolved. > if (m_playbackRate) >- m_holdTime = std::nullopt; >+ m_holdTime = WTF::nullopt; > } else { > // Otherwise (new start time is unresolved), > // Set animation's hold time to previous current time even if previous current time is unresolved. >@@ -293,27 +293,27 @@ void WebAnimation::setStartTime(std::optional<double> startTime) > invalidateEffect(); > } > >-std::optional<double> WebAnimation::bindingsCurrentTime() const >+WTF::Optional<double> WebAnimation::bindingsCurrentTime() const > { > auto time = currentTime(); > if (!time) >- return std::nullopt; >+ return WTF::nullopt; > return secondsToWebAnimationsAPITime(time.value()); > } > >-ExceptionOr<void> WebAnimation::setBindingsCurrentTime(std::optional<double> currentTime) >+ExceptionOr<void> WebAnimation::setBindingsCurrentTime(WTF::Optional<double> currentTime) > { > if (!currentTime) >- return setCurrentTime(std::nullopt); >+ return setCurrentTime(WTF::nullopt); > return setCurrentTime(Seconds::fromMilliseconds(currentTime.value())); > } > >-std::optional<Seconds> WebAnimation::currentTime() const >+WTF::Optional<Seconds> WebAnimation::currentTime() const > { > return currentTime(RespectHoldTime::Yes); > } > >-std::optional<Seconds> WebAnimation::currentTime(RespectHoldTime respectHoldTime) const >+WTF::Optional<Seconds> WebAnimation::currentTime(RespectHoldTime respectHoldTime) const > { > // 3.4.4. The current time of an animation > // https://drafts.csswg.org/web-animations-1/#the-current-time-of-an-animation >@@ -330,13 +330,13 @@ std::optional<Seconds> WebAnimation::currentTime(RespectHoldTime respectHoldTime > // 3. the animation's start time is unresolved. > // The current time is an unresolved time value. > if (!m_timeline || !m_timeline->currentTime() || !m_startTime) >- return std::nullopt; >+ return WTF::nullopt; > > // Otherwise, current time = (timeline time - start time) * playback rate > return (m_timeline->currentTime().value() - m_startTime.value()) * m_playbackRate; > } > >-ExceptionOr<void> WebAnimation::silentlySetCurrentTime(std::optional<Seconds> seekTime) >+ExceptionOr<void> WebAnimation::silentlySetCurrentTime(WTF::Optional<Seconds> seekTime) > { > // 3.4.5. Setting the current time of an animation > // https://drafts.csswg.org/web-animations-1/#setting-the-current-time-of-an-animation >@@ -366,15 +366,15 @@ ExceptionOr<void> WebAnimation::silentlySetCurrentTime(std::optional<Seconds> se > > // 3. If animation has no associated timeline or the associated timeline is inactive, make animation's start time unresolved. > if (!m_timeline || !m_timeline->currentTime()) >- m_startTime = std::nullopt; >+ m_startTime = WTF::nullopt; > > // 4. Make animation's previous current time unresolved. >- m_previousCurrentTime = std::nullopt; >+ m_previousCurrentTime = WTF::nullopt; > > return { }; > } > >-ExceptionOr<void> WebAnimation::setCurrentTime(std::optional<Seconds> seekTime) >+ExceptionOr<void> WebAnimation::setCurrentTime(WTF::Optional<Seconds> seekTime) > { > // 3.4.5. Setting the current time of an animation > // https://drafts.csswg.org/web-animations-1/#setting-the-current-time-of-an-animation >@@ -391,7 +391,7 @@ ExceptionOr<void> WebAnimation::setCurrentTime(std::optional<Seconds> seekTime) > // 2. Apply any pending playback rate to animation. > applyPendingPlaybackRate(); > // 3. Make animation's start time unresolved. >- m_startTime = std::nullopt; >+ m_startTime = WTF::nullopt; > // 4. Cancel the pending pause task. > m_timeToRunPendingPauseTask = TimeToRunPendingTask::NotScheduled; > // 5. Resolve animation's current ready promise with animation. >@@ -422,7 +422,7 @@ void WebAnimation::setPlaybackRate(double newPlaybackRate) > // https://drafts.csswg.org/web-animations-1/#updating-the-playback-rate-of-an-animation > > // 1. Clear any pending playback rate on animation. >- m_pendingPlaybackRate = std::nullopt; >+ m_pendingPlaybackRate = WTF::nullopt; > > // 2. Let previous time be the value of the current time of animation before changing the playback rate. > auto previousTime = currentTime(); >@@ -499,7 +499,7 @@ void WebAnimation::applyPendingPlaybackRate() > m_playbackRate = m_pendingPlaybackRate.value(); > > // 3. Clear animation's pending playback rate. >- m_pendingPlaybackRate = std::nullopt; >+ m_pendingPlaybackRate = WTF::nullopt; > } > > auto WebAnimation::playState() const -> PlayState >@@ -580,21 +580,21 @@ void WebAnimation::cancel(Silently silently) > // scheduled event time is an unresolved time value. > // Otherwise, queue a task to dispatch cancelEvent at animation. The task source for this task is the DOM manipulation task source. > if (silently == Silently::No) >- enqueueAnimationPlaybackEvent(eventNames().cancelEvent, std::nullopt, m_timeline ? m_timeline->currentTime() : std::nullopt); >+ enqueueAnimationPlaybackEvent(eventNames().cancelEvent, WTF::nullopt, m_timeline ? m_timeline->currentTime() : WTF::nullopt); > } > > // 2. Make animation's hold time unresolved. >- m_holdTime = std::nullopt; >+ m_holdTime = WTF::nullopt; > > // 3. Make animation's start time unresolved. >- m_startTime = std::nullopt; >+ m_startTime = WTF::nullopt; > > timingDidChange(DidSeek::No, SynchronouslyNotify::No); > > invalidateEffect(); > } > >-void WebAnimation::enqueueAnimationPlaybackEvent(const AtomicString& type, std::optional<Seconds> currentTime, std::optional<Seconds> timelineTime) >+void WebAnimation::enqueueAnimationPlaybackEvent(const AtomicString& type, WTF::Optional<Seconds> currentTime, WTF::Optional<Seconds> timelineTime) > { > auto event = AnimationPlaybackEvent::create(type, currentTime, timelineTime); > event->setTarget(this); >@@ -673,7 +673,7 @@ ExceptionOr<void> WebAnimation::finish() > // 6. If there is a pending pause task and start time is resolved, > if (hasPendingPauseTask() && m_startTime) { > // 1. Let the hold time be unresolved. >- m_holdTime = std::nullopt; >+ m_holdTime = WTF::nullopt; > // 2. Cancel the pending pause task. > m_timeToRunPendingPauseTask = TimeToRunPendingTask::NotScheduled; > // 3. Resolve the current ready promise of animation with animation. >@@ -751,7 +751,7 @@ void WebAnimation::updateFinishedState(DidSeek didSeek, SynchronouslyNotify sync > if (didSeek == DidSeek::Yes && m_holdTime) > m_startTime = m_timeline->currentTime().value() - (m_holdTime.value() / m_playbackRate); > // 2. Let the hold time be unresolved. >- m_holdTime = std::nullopt; >+ m_holdTime = WTF::nullopt; > } > } > >@@ -827,7 +827,7 @@ void WebAnimation::finishNotificationSteps() > // queue along with its target, animation. For the scheduled event time, use the result of converting animation's target > // effect end to an origin-relative time. > // Otherwise, queue a task to dispatch finishEvent at animation. The task source for this task is the DOM manipulation task source. >- enqueueAnimationPlaybackEvent(eventNames().finishEvent, currentTime(), m_timeline ? m_timeline->currentTime() : std::nullopt); >+ enqueueAnimationPlaybackEvent(eventNames().finishEvent, currentTime(), m_timeline ? m_timeline->currentTime() : WTF::nullopt); > } > > ExceptionOr<void> WebAnimation::play() >@@ -891,7 +891,7 @@ ExceptionOr<void> WebAnimation::play(AutoRewind autoRewind) > > // 6. If animation's hold time is resolved, let its start time be unresolved. > if (m_holdTime) >- m_startTime = std::nullopt; >+ m_startTime = WTF::nullopt; > > // 7. If has pending ready promise is false, let animation's current ready promise be a new (pending) Promise object. > if (!hasPendingReadyPromise) >@@ -930,7 +930,7 @@ void WebAnimation::runPendingPlayTask() > // If the animation playback rate is zero, let new start time be simply ready time. > // FIXME: Implementation cannot guarantee an active timeline at the point of this async dispatch. > // Subsequently, the resulting readyTime value can be null. Unify behavior between C++17 and >- // C++14 builds (the latter using WTF's std::optional) and avoid null std::optional dereferencing >+ // C++14 builds (the latter using WTF's WTF::Optional) and avoid null WTF::Optional dereferencing > // by defaulting to a Seconds(0) value. See https://bugs.webkit.org/show_bug.cgi?id=186189. > auto newStartTime = readyTime.value_or(0_s); > if (m_playbackRate) >@@ -939,7 +939,7 @@ void WebAnimation::runPendingPlayTask() > m_startTime = newStartTime; > // 4. If animation's playback rate is not 0, make animation's hold time unresolved. > if (m_playbackRate) >- m_holdTime = std::nullopt; >+ m_holdTime = WTF::nullopt; > } else if (m_startTime && m_pendingPlaybackRate) { > // If animation's start time is resolved and animation has a pending playback rate, > // 1. Let current time to match be the result of evaluating (ready time - start time) à playback rate for animation. >@@ -1072,7 +1072,7 @@ void WebAnimation::runPendingPauseTask() > if (animationStartTime && !m_holdTime) { > // FIXME: Implementation cannot guarantee an active timeline at the point of this async dispatch. > // Subsequently, the resulting readyTime value can be null. Unify behavior between C++17 and >- // C++14 builds (the latter using WTF's std::optional) and avoid null std::optional dereferencing >+ // C++14 builds (the latter using WTF's WTF::Optional) and avoid null WTF::Optional dereferencing > // by defaulting to a Seconds(0) value. See https://bugs.webkit.org/show_bug.cgi?id=186189. > m_holdTime = (readyTime.value_or(0_s) - animationStartTime.value()) * m_playbackRate; > } >@@ -1081,7 +1081,7 @@ void WebAnimation::runPendingPauseTask() > applyPendingPlaybackRate(); > > // 4. Make animation's start time unresolved. >- m_startTime = std::nullopt; >+ m_startTime = WTF::nullopt; > > // 5. Resolve animation's current ready promise with animation. > if (!m_readyPromise->isFulfilled()) >diff --git a/Source/WebCore/animation/WebAnimation.h b/Source/WebCore/animation/WebAnimation.h >index c99dafa1ba652d1899af0ba3660a338937830ac0..8729ac462003af2a755780dbe853d18270e28476 100644 >--- a/Source/WebCore/animation/WebAnimation.h >+++ b/Source/WebCore/animation/WebAnimation.h >@@ -65,8 +65,8 @@ public: > AnimationTimeline* timeline() const { return m_timeline.get(); } > virtual void setTimeline(RefPtr<AnimationTimeline>&&); > >- std::optional<Seconds> currentTime() const; >- ExceptionOr<void> setCurrentTime(std::optional<Seconds>); >+ WTF::Optional<Seconds> currentTime() const; >+ ExceptionOr<void> setCurrentTime(WTF::Optional<Seconds>); > > enum class Silently { Yes, No }; > double playbackRate() const { return m_playbackRate + 0; } >@@ -91,10 +91,10 @@ public: > ExceptionOr<void> pause(); > ExceptionOr<void> reverse(); > >- virtual std::optional<double> startTime() const; >- virtual void setStartTime(std::optional<double>); >- virtual std::optional<double> bindingsCurrentTime() const; >- virtual ExceptionOr<void> setBindingsCurrentTime(std::optional<double>); >+ virtual WTF::Optional<double> startTime() const; >+ virtual void setStartTime(WTF::Optional<double>); >+ virtual WTF::Optional<double> bindingsCurrentTime() const; >+ virtual ExceptionOr<void> setBindingsCurrentTime(WTF::Optional<double>); > virtual PlayState bindingsPlayState() const { return playState(); } > virtual bool bindingsPending() const { return pending(); } > virtual ReadyPromise& bindingsReady() { return ready(); } >@@ -136,12 +136,12 @@ private: > > void timingDidChange(DidSeek, SynchronouslyNotify); > void updateFinishedState(DidSeek, SynchronouslyNotify); >- void enqueueAnimationPlaybackEvent(const AtomicString&, std::optional<Seconds>, std::optional<Seconds>); >+ void enqueueAnimationPlaybackEvent(const AtomicString&, WTF::Optional<Seconds>, WTF::Optional<Seconds>); > Seconds effectEndTime() const; > WebAnimation& readyPromiseResolve(); > WebAnimation& finishedPromiseResolve(); >- std::optional<Seconds> currentTime(RespectHoldTime) const; >- ExceptionOr<void> silentlySetCurrentTime(std::optional<Seconds>); >+ WTF::Optional<Seconds> currentTime(RespectHoldTime) const; >+ ExceptionOr<void> silentlySetCurrentTime(WTF::Optional<Seconds>); > void finishNotificationSteps(); > void scheduleMicrotaskIfNeeded(); > void performMicrotask(); >@@ -163,12 +163,12 @@ private: > String m_id; > RefPtr<AnimationEffect> m_effect; > RefPtr<AnimationTimeline> m_timeline; >- std::optional<Seconds> m_previousCurrentTime; >- std::optional<Seconds> m_startTime; >- std::optional<Seconds> m_holdTime; >+ WTF::Optional<Seconds> m_previousCurrentTime; >+ WTF::Optional<Seconds> m_startTime; >+ WTF::Optional<Seconds> m_holdTime; > int m_suspendCount { 0 }; > double m_playbackRate { 1 }; >- std::optional<double> m_pendingPlaybackRate; >+ WTF::Optional<double> m_pendingPlaybackRate; > bool m_isStopped { false }; > bool m_isSuspended { false }; > bool m_finishNotificationStepsMicrotaskPending; >diff --git a/Source/WebCore/bindings/IDLTypes.h b/Source/WebCore/bindings/IDLTypes.h >index 8057dfa115888d3db4a0f0be26b4c662b69c787c..2cecf927041bc40306bf75fd1c2305e13e31f593 100644 >--- a/Source/WebCore/bindings/IDLTypes.h >+++ b/Source/WebCore/bindings/IDLTypes.h >@@ -65,13 +65,13 @@ struct IDLType { > using StorageType = T; > > using ParameterType = T; >- using NullableParameterType = std::optional<ImplementationType>; >+ using NullableParameterType = WTF::Optional<ImplementationType>; > > using InnerParameterType = T; >- using NullableInnerParameterType = std::optional<ImplementationType>; >+ using NullableInnerParameterType = WTF::Optional<ImplementationType>; > >- using NullableType = std::optional<ImplementationType>; >- static NullableType nullValue() { return std::nullopt; } >+ using NullableType = WTF::Optional<ImplementationType>; >+ static NullableType nullValue() { return WTF::nullopt; } > static bool isNullValue(const NullableType& value) { return !value; } > static ImplementationType extractValueFromNullable(const NullableType& value) { return value.value(); } > }; >@@ -204,14 +204,14 @@ template<typename T> struct IDLSequence : IDLType<Vector<typename T::Implementat > using InnerType = T; > > using ParameterType = const Vector<typename T::InnerParameterType>&; >- using NullableParameterType = const std::optional<Vector<typename T::InnerParameterType>>&; >+ using NullableParameterType = const WTF::Optional<Vector<typename T::InnerParameterType>>&; > }; > > template<typename T> struct IDLFrozenArray : IDLType<Vector<typename T::ImplementationType>> { > using InnerType = T; > > using ParameterType = const Vector<typename T::ImplementationType>&; >- using NullableParameterType = const std::optional<Vector<typename T::ImplementationType>>&; >+ using NullableParameterType = const WTF::Optional<Vector<typename T::ImplementationType>>&; > }; > > template<typename K, typename V> struct IDLRecord : IDLType<Vector<WTF::KeyValuePair<typename K::ImplementationType, typename V::ImplementationType>>> { >@@ -219,7 +219,7 @@ template<typename K, typename V> struct IDLRecord : IDLType<Vector<WTF::KeyValue > using ValueType = V; > > using ParameterType = const Vector<WTF::KeyValuePair<typename K::ImplementationType, typename V::ImplementationType>>&; >- using NullableParameterType = const std::optional<Vector<WTF::KeyValuePair<typename K::ImplementationType, typename V::ImplementationType>>>&; >+ using NullableParameterType = const WTF::Optional<Vector<WTF::KeyValuePair<typename K::ImplementationType, typename V::ImplementationType>>>&; > }; > > template<typename T> struct IDLPromise : IDLWrapper<DOMPromise> { >@@ -234,7 +234,7 @@ struct IDLUnion : IDLType<Variant<typename Ts::ImplementationType...>> { > using TypeList = brigand::list<Ts...>; > > using ParameterType = const Variant<typename Ts::ImplementationType...>&; >- using NullableParameterType = const std::optional<Variant<typename Ts::ImplementationType...>>&; >+ using NullableParameterType = const WTF::Optional<Variant<typename Ts::ImplementationType...>>&; > }; > > template<typename T> struct IDLBufferSource : IDLWrapper<T> { }; >diff --git a/Source/WebCore/bindings/js/DOMPromiseProxy.h b/Source/WebCore/bindings/js/DOMPromiseProxy.h >index 8b26e3a2830f183a41b7f55acf9f8af490eba33f..c53339678f213b25db7f5deb354a3de45b9537b4 100644 >--- a/Source/WebCore/bindings/js/DOMPromiseProxy.h >+++ b/Source/WebCore/bindings/js/DOMPromiseProxy.h >@@ -53,7 +53,7 @@ public: > void reject(Exception); > > private: >- std::optional<ExceptionOr<Value>> m_valueOrException; >+ WTF::Optional<ExceptionOr<Value>> m_valueOrException; > Vector<Ref<DeferredPromise>, 1> m_deferredPromises; > }; > >@@ -73,7 +73,7 @@ public: > void reject(Exception); > > private: >- std::optional<ExceptionOr<void>> m_valueOrException; >+ WTF::Optional<ExceptionOr<void>> m_valueOrException; > Vector<Ref<DeferredPromise>, 1> m_deferredPromises; > }; > >@@ -103,7 +103,7 @@ public: > > private: > ResolveCallback m_resolveCallback; >- std::optional<ExceptionOr<void>> m_valueOrException; >+ WTF::Optional<ExceptionOr<void>> m_valueOrException; > Vector<Ref<DeferredPromise>, 1> m_deferredPromises; > }; > >@@ -138,7 +138,7 @@ inline JSC::JSValue DOMPromiseProxy<IDLType>::promise(JSC::ExecState& state, JSD > template<typename IDLType> > inline void DOMPromiseProxy<IDLType>::clear() > { >- m_valueOrException = std::nullopt; >+ m_valueOrException = WTF::nullopt; > m_deferredPromises.clear(); > } > >@@ -207,7 +207,7 @@ inline JSC::JSValue DOMPromiseProxy<IDLVoid>::promise(JSC::ExecState& state, JSD > > inline void DOMPromiseProxy<IDLVoid>::clear() > { >- m_valueOrException = std::nullopt; >+ m_valueOrException = WTF::nullopt; > m_deferredPromises.clear(); > } > >@@ -275,7 +275,7 @@ inline JSC::JSValue DOMPromiseProxyWithResolveCallback<IDLType>::promise(JSC::Ex > template<typename IDLType> > inline void DOMPromiseProxyWithResolveCallback<IDLType>::clear() > { >- m_valueOrException = std::nullopt; >+ m_valueOrException = WTF::nullopt; > m_deferredPromises.clear(); > } > >diff --git a/Source/WebCore/bindings/js/JSDOMAbstractOperations.h b/Source/WebCore/bindings/js/JSDOMAbstractOperations.h >index 179abf4b175bdc554f0581639764403d6d216a5d..9ce6e7a80b2316f3607c5860f5f5638d03c9e7f6 100644 >--- a/Source/WebCore/bindings/js/JSDOMAbstractOperations.h >+++ b/Source/WebCore/bindings/js/JSDOMAbstractOperations.h >@@ -91,17 +91,17 @@ static auto accessVisibleNamedProperty(JSC::ExecState& state, JSClass& thisObjec > // NOTE: While it is not specified, a Symbol can never be a 'supported property > // name' so we check that first. > if (propertyName.isSymbol()) >- return std::nullopt; >+ return WTF::nullopt; > > // 1. If P is not a supported property name of O, then return false. > auto result = itemAccessor(thisObject, propertyName); > if (!result) >- return std::nullopt; >+ return WTF::nullopt; > > // 2. If O has an own property named P, then return false. > JSC::PropertySlot slot { &thisObject, JSC::PropertySlot::InternalMethodType::VMInquiry }; > if (JSC::JSObject::getOwnPropertySlot(&thisObject, &state, propertyName, slot)) >- return std::nullopt; >+ return WTF::nullopt; > > // 3. If O implements an interface that has the [OverrideBuiltins] extended attribute, then return true. > if (overrideBuiltins == OverrideBuiltins::Yes && !worldForDOMObject(thisObject).shouldDisableOverrideBuiltinsBehavior()) >@@ -114,7 +114,7 @@ static auto accessVisibleNamedProperty(JSC::ExecState& state, JSClass& thisObjec > // 2. Set prototype to be the value of the internal [[Prototype]] property of prototype. > auto prototype = thisObject.getPrototypeDirect(state.vm()); > if (prototype.isObject() && JSC::asObject(prototype)->getPropertySlot(&state, propertyName, slot)) >- return std::nullopt; >+ return WTF::nullopt; > > // 6. Return true. > return result; >diff --git a/Source/WebCore/bindings/js/JSDOMConvertAny.h b/Source/WebCore/bindings/js/JSDOMConvertAny.h >index 3734a8b732b86d9f333c3d31e1a0b86bdc6001de..afea6d0af5d6d342179a5ea78ab28275569e51f3 100644 >--- a/Source/WebCore/bindings/js/JSDOMConvertAny.h >+++ b/Source/WebCore/bindings/js/JSDOMConvertAny.h >@@ -64,13 +64,13 @@ template<> struct JSConverter<IDLAny> { > template<> struct VariadicConverter<IDLAny> { > using Item = typename IDLAny::ImplementationType; > >- static std::optional<Item> convert(JSC::ExecState& state, JSC::JSValue value) >+ static WTF::Optional<Item> convert(JSC::ExecState& state, JSC::JSValue value) > { > auto& vm = state.vm(); > auto scope = DECLARE_THROW_SCOPE(vm); > > auto result = Converter<IDLAny>::convert(state, value); >- RETURN_IF_EXCEPTION(scope, std::nullopt); >+ RETURN_IF_EXCEPTION(scope, WTF::nullopt); > > return Item { vm, result }; > } >diff --git a/Source/WebCore/bindings/js/JSDOMConvertEnumeration.h b/Source/WebCore/bindings/js/JSDOMConvertEnumeration.h >index 4316aa0110d004cd000eb0c4459998a419880cd5..86c3e84f55602c09c7158352881211c8690b6d30 100644 >--- a/Source/WebCore/bindings/js/JSDOMConvertEnumeration.h >+++ b/Source/WebCore/bindings/js/JSDOMConvertEnumeration.h >@@ -31,7 +31,7 @@ > namespace WebCore { > > // Specialized by generated code for IDL enumeration conversion. >-template<typename T> std::optional<T> parseEnumeration(JSC::ExecState&, JSC::JSValue); >+template<typename T> WTF::Optional<T> parseEnumeration(JSC::ExecState&, JSC::JSValue); > template<typename T> const char* expectedEnumerationValues(); > > // Specialized by generated code for IDL enumeration conversion. >diff --git a/Source/WebCore/bindings/js/JSDOMConvertInterface.h b/Source/WebCore/bindings/js/JSDOMConvertInterface.h >index f239110d3f8e32e45fafdf7ed71445933e2f9eb1..daa3ff48156857387b84b99f006af313057dd40d 100644 >--- a/Source/WebCore/bindings/js/JSDOMConvertInterface.h >+++ b/Source/WebCore/bindings/js/JSDOMConvertInterface.h >@@ -91,12 +91,12 @@ template<typename T> struct JSConverter<IDLInterface<T>> { > template<typename T> struct VariadicConverter<IDLInterface<T>> { > using Item = std::reference_wrapper<T>; > >- static std::optional<Item> convert(JSC::ExecState& state, JSC::JSValue value) >+ static WTF::Optional<Item> convert(JSC::ExecState& state, JSC::JSValue value) > { > auto* result = Converter<IDLInterface<T>>::convert(state, value); > if (!result) >- return std::nullopt; >- return std::optional<Item> { *result }; >+ return WTF::nullopt; >+ return WTF::Optional<Item> { *result }; > } > }; > >diff --git a/Source/WebCore/bindings/js/JSDOMConvertUnion.h b/Source/WebCore/bindings/js/JSDOMConvertUnion.h >index 7ba91351adb580588eef8c0896e5d5b9d244c311..93454f7d5dbf9701f19cf1ebc56294e80d4cfc9c 100644 >--- a/Source/WebCore/bindings/js/JSDOMConvertUnion.h >+++ b/Source/WebCore/bindings/js/JSDOMConvertUnion.h >@@ -42,7 +42,7 @@ struct ConditionalReturner; > template<typename ReturnType> > struct ConditionalReturner<ReturnType, true> { > template<typename T> >- static std::optional<ReturnType> get(T&& value) >+ static WTF::Optional<ReturnType> get(T&& value) > { > return ReturnType(std::forward<T>(value)); > } >@@ -51,9 +51,9 @@ struct ConditionalReturner<ReturnType, true> { > template<typename ReturnType> > struct ConditionalReturner<ReturnType, false> { > template<typename T> >- static std::optional<ReturnType> get(T&&) >+ static WTF::Optional<ReturnType> get(T&&) > { >- return std::nullopt; >+ return WTF::nullopt; > } > }; > >@@ -62,7 +62,7 @@ struct ConditionalConverter; > > template<typename ReturnType, typename T> > struct ConditionalConverter<ReturnType, T, true> { >- static std::optional<ReturnType> convert(JSC::ExecState& state, JSC::JSValue value) >+ static WTF::Optional<ReturnType> convert(JSC::ExecState& state, JSC::JSValue value) > { > return ReturnType(Converter<T>::convert(state, value)); > } >@@ -70,9 +70,9 @@ struct ConditionalConverter<ReturnType, T, true> { > > template<typename ReturnType, typename T> > struct ConditionalConverter<ReturnType, T, false> { >- static std::optional<ReturnType> convert(JSC::ExecState&, JSC::JSValue) >+ static WTF::Optional<ReturnType> convert(JSC::ExecState&, JSC::JSValue) > { >- return std::nullopt; >+ return WTF::nullopt; > } > }; > >@@ -81,7 +81,7 @@ struct ConditionalSequenceConverter; > > template<typename ReturnType, typename T> > struct ConditionalSequenceConverter<ReturnType, T, true> { >- static std::optional<ReturnType> convert(JSC::ExecState& state, JSC::JSObject* object, JSC::JSValue method) >+ static WTF::Optional<ReturnType> convert(JSC::ExecState& state, JSC::JSObject* object, JSC::JSValue method) > { > return ReturnType(Converter<T>::convert(state, object, method)); > } >@@ -89,9 +89,9 @@ struct ConditionalSequenceConverter<ReturnType, T, true> { > > template<typename ReturnType, typename T> > struct ConditionalSequenceConverter<ReturnType, T, false> { >- static std::optional<ReturnType> convert(JSC::ExecState&, JSC::JSObject*, JSC::JSValue) >+ static WTF::Optional<ReturnType> convert(JSC::ExecState&, JSC::JSObject*, JSC::JSValue) > { >- return std::nullopt; >+ return WTF::nullopt; > } > }; > >@@ -191,7 +191,7 @@ template<typename... T> struct Converter<IDLUnion<T...>> : DefaultConverter<IDLU > // 2. If types includes object, then return the IDL value that is a reference to the object V. > // (FIXME: Add support for object and step 4.2) > if (brigand::any<TypeList, IsIDLInterface<brigand::_1>>::value) { >- std::optional<ReturnType> returnValue; >+ WTF::Optional<ReturnType> returnValue; > brigand::for_each<InterfaceTypeList>([&](auto&& type) { > if (returnValue) > return; >@@ -264,7 +264,7 @@ template<typename... T> struct Converter<IDLUnion<T...>> : DefaultConverter<IDLU > // (FIXME: Add support for object and step 9.2) > constexpr bool hasTypedArrayType = brigand::any<TypeList, IsIDLTypedArray<brigand::_1>>::value; > if (hasTypedArrayType) { >- std::optional<ReturnType> returnValue; >+ WTF::Optional<ReturnType> returnValue; > brigand::for_each<TypedArrayTypeList>([&](auto&& type) { > if (returnValue) > return; >@@ -391,7 +391,7 @@ template<typename... T> struct JSConverter<IDLUnion<T...>> { > { > auto index = variant.index(); > >- std::optional<JSC::JSValue> returnValue; >+ WTF::Optional<JSC::JSValue> returnValue; > brigand::for_each<Sequence>([&](auto&& type) { > using I = typename WTF::RemoveCVAndReference<decltype(type)>::type::type; > if (I::value == index) { >diff --git a/Source/WebCore/bindings/js/JSDOMConvertVariadic.h b/Source/WebCore/bindings/js/JSDOMConvertVariadic.h >index 18bd11f68e52f6ef5fb54943a33b10c9a65498ed..c4f6ba88addc3bf6c37cf550be5ff66568f91f5f 100644 >--- a/Source/WebCore/bindings/js/JSDOMConvertVariadic.h >+++ b/Source/WebCore/bindings/js/JSDOMConvertVariadic.h >@@ -34,13 +34,13 @@ template<typename IDLType> > struct VariadicConverter { > using Item = typename IDLType::ImplementationType; > >- static std::optional<Item> convert(JSC::ExecState& state, JSC::JSValue value) >+ static WTF::Optional<Item> convert(JSC::ExecState& state, JSC::JSValue value) > { > auto& vm = state.vm(); > auto scope = DECLARE_THROW_SCOPE(vm); > > auto result = Converter<IDLType>::convert(state, value); >- RETURN_IF_EXCEPTION(scope, std::nullopt); >+ RETURN_IF_EXCEPTION(scope, WTF::nullopt); > > return WTFMove(result); > } >diff --git a/Source/WebCore/bindings/js/JSDOMIterator.h b/Source/WebCore/bindings/js/JSDOMIterator.h >index 32c4005a147cb7d717f80ef5880b9e2433ffbe3e..ca9e5440bcb8419ba872e40ad2ad80ca76ff9269 100644 >--- a/Source/WebCore/bindings/js/JSDOMIterator.h >+++ b/Source/WebCore/bindings/js/JSDOMIterator.h >@@ -118,7 +118,7 @@ private: > > static void destroy(JSC::JSCell*); > >- std::optional<typename DOMWrapped::Iterator> m_iterator; >+ WTF::Optional<typename DOMWrapped::Iterator> m_iterator; > IterationKind m_kind; > }; > >@@ -240,7 +240,7 @@ JSC::JSValue JSDOMIterator<JSWrapper, IteratorTraits>::next(JSC::ExecState& stat > auto iteratorValue = m_iterator->next(); > if (iteratorValue) > return createIteratorResultObject(&state, asJS(state, iteratorValue), false); >- m_iterator = std::nullopt; >+ m_iterator = WTF::nullopt; > } > return createIteratorResultObject(&state, JSC::jsUndefined(), true); > } >diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp >index dea0de27399e91e586bd00f9d7d14d416ad7c328..dff846ca92af8ac63b15d6f28d39ba6a7d4ac4d3 100644 >--- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp >+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp >@@ -345,12 +345,12 @@ JSC::JSObject* JSDOMWindowBase::moduleLoaderCreateImportMetaProperties(JSC::JSGl > } > > #if ENABLE(WEBASSEMBLY) >-static std::optional<Vector<uint8_t>> tryAllocate(JSC::ExecState* exec, JSC::JSPromiseDeferred* promise, const char* data, size_t byteSize) >+static WTF::Optional<Vector<uint8_t>> tryAllocate(JSC::ExecState* exec, JSC::JSPromiseDeferred* promise, const char* data, size_t byteSize) > { > Vector<uint8_t> arrayBuffer; > if (!arrayBuffer.tryReserveCapacity(byteSize)) { > promise->reject(exec, createOutOfMemoryError(exec)); >- return std::nullopt; >+ return WTF::nullopt; > } > > arrayBuffer.grow(byteSize); >diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp >index 33b88ca9eaa54df71a2c2fb8f358a997caa0797d..d0b1232899961d7354b0ece77df4f4af7f590f24 100644 >--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp >+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp >@@ -182,7 +182,7 @@ bool JSDOMWindow::getOwnPropertySlot(JSObject* object, ExecState* state, Propert > { > // (1) First, indexed properties. > // Hand off all indexed access to getOwnPropertySlotByIndex, which supports the indexed getter. >- if (std::optional<unsigned> index = parseIndex(propertyName)) >+ if (WTF::Optional<unsigned> index = parseIndex(propertyName)) > return getOwnPropertySlotByIndex(object, state, index.value(), slot); > > auto* thisObject = jsCast<JSDOMWindow*>(object); >@@ -235,7 +235,7 @@ bool JSDOMWindow::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, > slot.disableCaching(); > > String errorMessage; >- std::optional<bool> cachedIsCrossOriginAccess; >+ WTF::Optional<bool> cachedIsCrossOriginAccess; > auto isCrossOriginAccess = [&] { > if (!cachedIsCrossOriginAccess) > cachedIsCrossOriginAccess = !BindingSecurity::shouldAllowAccessToDOMWindow(*state, window, errorMessage); >diff --git a/Source/WebCore/bindings/js/JSRemoteDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSRemoteDOMWindowCustom.cpp >index a7a50812c3c4715ac8c614dbbef4474e072f62b9..7ca2af3e3d5ddbc19784e6906c9f1ef48f4e0a0c 100644 >--- a/Source/WebCore/bindings/js/JSRemoteDOMWindowCustom.cpp >+++ b/Source/WebCore/bindings/js/JSRemoteDOMWindowCustom.cpp >@@ -34,7 +34,7 @@ using namespace JSC; > > bool JSRemoteDOMWindow::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot) > { >- if (std::optional<unsigned> index = parseIndex(propertyName)) >+ if (WTF::Optional<unsigned> index = parseIndex(propertyName)) > return getOwnPropertySlotByIndex(object, state, index.value(), slot); > > auto* thisObject = jsCast<JSRemoteDOMWindow*>(object); >diff --git a/Source/WebCore/bindings/js/ScriptController.cpp b/Source/WebCore/bindings/js/ScriptController.cpp >index 21d1d347ca1d07e17a62ba76b5af79b121e23524..23aff007cf93f5bf122946d8a681b250f22eaaa4 100644 >--- a/Source/WebCore/bindings/js/ScriptController.cpp >+++ b/Source/WebCore/bindings/js/ScriptController.cpp >@@ -295,7 +295,7 @@ void ScriptController::setupModuleScriptHandlers(LoadableModuleScript& moduleScr > case ModuleFetchFailureKind::WasErrored: > moduleScript->notifyLoadFailed(LoadableScript::Error { > LoadableScript::ErrorType::CachedScript, >- std::nullopt >+ WTF::nullopt > }); > break; > case ModuleFetchFailureKind::WasCanceled: >@@ -542,7 +542,7 @@ void ScriptController::clearScriptObjects() > > JSValue ScriptController::executeScriptInWorld(DOMWrapperWorld& world, const String& script, bool forceUserGesture, ExceptionDetails* exceptionDetails) > { >- UserGestureIndicator gestureIndicator(forceUserGesture ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt); >+ UserGestureIndicator gestureIndicator(forceUserGesture ? WTF::Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); > ScriptSourceCode sourceCode(script, m_frame.document()->url(), TextPosition(), JSC::SourceProviderSourceType::Program, CachedScriptFetcher::create(m_frame.document()->charset())); > > if (!canExecuteScripts(AboutToExecuteScript) || isPaused()) >@@ -571,7 +571,7 @@ bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso > > JSValue ScriptController::executeScript(const String& script, bool forceUserGesture, ExceptionDetails* exceptionDetails) > { >- UserGestureIndicator gestureIndicator(forceUserGesture ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt); >+ UserGestureIndicator gestureIndicator(forceUserGesture ? WTF::Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); > return executeScript(ScriptSourceCode(script, m_frame.document()->url(), TextPosition(), JSC::SourceProviderSourceType::Program, CachedScriptFetcher::create(m_frame.document()->charset())), exceptionDetails); > } > >diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >index 2b8d9c0528ba8ceb9873cb6f133593635bc3faa5..a3eff08188679d3490b704b9de3806c734682e97 100644 >--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp >+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >@@ -2066,7 +2066,7 @@ private: > CachedStringRef name; > if (!readStringData(name)) > return false; >- std::optional<int64_t> optionalLastModified; >+ WTF::Optional<int64_t> optionalLastModified; > if (m_version > 6) { > double lastModified; > if (!read(lastModified)) >@@ -2629,17 +2629,17 @@ private: > return toJSNewlyCreated(m_exec, jsCast<JSDOMGlobalObject*>(m_globalObject), T::create(x, y, width, height)); > } > >- std::optional<DOMPointInit> readDOMPointInit() >+ WTF::Optional<DOMPointInit> readDOMPointInit() > { > DOMPointInit point; > if (!read(point.x)) >- return std::nullopt; >+ return WTF::nullopt; > if (!read(point.y)) >- return std::nullopt; >+ return WTF::nullopt; > if (!read(point.z)) >- return std::nullopt; >+ return WTF::nullopt; > if (!read(point.w)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(point); > } >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index a93453aaff446b2a270fd85a980512fee29f7736..dc9953beec7857ad3dd12de0e7adfa9cb17ca2c7 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -591,15 +591,15 @@ sub GenerateNamedGetterLambda > # dependant on the IDL type). This is based on the assumption that no named getter will > # ever actually want to return null as an actual return value, which seems like an ok > # assumption to make (should it turn out this doesn't hold in the future, we have lots >- # of options; do two lookups, add an extra layer of std::optional, etc.). >+ # of options; do two lookups, add an extra layer of WTF::Optional, etc.). > > my $resultType = "typename ${IDLType}::ImplementationType"; > $resultType = "ExceptionOr<" . $resultType . ">" if $namedGetterOperation->extendedAttributes->{MayThrowException}; >- my $returnType = "std::optional<" . $resultType . ">"; >+ my $returnType = "WTF::Optional<" . $resultType . ">"; > > push(@$outputArray, " auto getterFunctor = [] (auto& thisObject, auto propertyName) -> ${returnType} {\n"); > >- my @arguments = GenerateCallWithUsingReferences($namedGetterOperation->extendedAttributes->{CallWith}, $outputArray, "std::nullopt", "thisObject", " "); >+ my @arguments = GenerateCallWithUsingReferences($namedGetterOperation->extendedAttributes->{CallWith}, $outputArray, "WTF::nullopt", "thisObject", " "); > push(@arguments, "propertyNameToAtomicString(propertyName)"); > > push(@$outputArray, " auto result = thisObject.wrapped().${namedGetterFunctionName}(" . join(", ", @arguments) . ");\n"); >@@ -609,11 +609,11 @@ sub GenerateNamedGetterLambda > push(@$outputArray, " return ${resultType} { result.releaseException() };\n"); > push(@$outputArray, " if (!${IDLType}::isNullValue(result.returnValue()))\n"); > push(@$outputArray, " return ${resultType} { ${IDLType}::extractValueFromNullable(result.releaseReturnValue()) };\n"); >- push(@$outputArray, " return std::nullopt;\n"); >+ push(@$outputArray, " return WTF::nullopt;\n"); > } else { > push(@$outputArray, " if (!${IDLType}::isNullValue(result))\n"); > push(@$outputArray, " return ${resultType} { ${IDLType}::extractValueFromNullable(result) };\n"); >- push(@$outputArray, " return std::nullopt;\n"); >+ push(@$outputArray, " return WTF::nullopt;\n"); > } > push(@$outputArray, " };\n"); > } >@@ -2090,7 +2090,7 @@ sub GenerateEnumerationImplementationContent > # FIXME: Change to take VM& instead of ExecState&. > # FIXME: Consider using toStringOrNull to make exception checking faster. > # FIXME: Consider finding a more efficient way to match against all the strings quickly. >- $result .= "template<> std::optional<$className> parseEnumeration<$className>(ExecState& state, JSValue value)\n"; >+ $result .= "template<> WTF::Optional<$className> parseEnumeration<$className>(ExecState& state, JSValue value)\n"; > $result .= "{\n"; > $result .= " auto stringValue = value.toWTFString(&state);\n"; > foreach my $value (@{$enumeration->values}) { >@@ -2102,7 +2102,7 @@ sub GenerateEnumerationImplementationContent > } > $result .= " return ${className}::${enumerationValueName};\n"; > } >- $result .= " return std::nullopt;\n"; >+ $result .= " return WTF::nullopt;\n"; > $result .= "}\n\n"; > > $result .= "template<> const char* expectedEnumerationValues<$className>()\n"; >@@ -2143,7 +2143,7 @@ sub GenerateEnumerationHeaderContent > > $result .= "${exportMacro}String convertEnumerationToString($className);\n"; > $result .= "template<> ${exportMacro}JSC::JSString* convertEnumerationToJS(JSC::ExecState&, $className);\n\n"; >- $result .= "template<> ${exportMacro}std::optional<$className> parseEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n"; >+ $result .= "template<> ${exportMacro}WTF::Optional<$className> parseEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n"; > $result .= "template<> ${exportMacro}const char* expectedEnumerationValues<$className>();\n\n"; > $result .= "#endif\n\n" if $conditionalString; > >@@ -2202,7 +2202,7 @@ sub GenerateDefaultValue > # FIXME: Would be nice to report an error if the value is not one of the enumeration values. > if ($defaultValue eq "null") { > die if !$type->isNullable; >- return "std::nullopt"; >+ return "WTF::nullopt"; > } > my $className = GetEnumerationClassName($type, $typeScope); > my $enumerationValueName = GetEnumerationValueName(substr($defaultValue, 1, -1)); >@@ -2210,7 +2210,7 @@ sub GenerateDefaultValue > } > if ($defaultValue eq "null") { > if ($type->isUnion) { >- return "std::nullopt" if $type->isNullable; >+ return "WTF::nullopt" if $type->isNullable; > > my $IDLType = GetIDLType($typeScope, $type); > return "convert<${IDLType}>(state, jsNull());"; >@@ -2219,7 +2219,7 @@ sub GenerateDefaultValue > return "jsNull()" if $type->name eq "any"; > return "nullptr" if $codeGenerator->IsWrapperType($type) || $codeGenerator->IsBufferSourceType($type); > return "String()" if $codeGenerator->IsStringType($type); >- return "std::nullopt"; >+ return "WTF::nullopt"; > } > > if ($defaultValue eq "[]") { >@@ -5740,8 +5740,8 @@ sub GenerateParametersCheck > if ($codeGenerator->IsPromiseType($argument->type)) { > $defaultValue = "nullptr"; > } else { >- $defaultValue = "std::optional<Converter<$argumentIDLType>::ReturnType>()"; >- $nativeValueCastFunction = "std::optional<Converter<$argumentIDLType>::ReturnType>"; >+ $defaultValue = "WTF::Optional<Converter<$argumentIDLType>::ReturnType>()"; >+ $nativeValueCastFunction = "WTF::Optional<Converter<$argumentIDLType>::ReturnType>"; > } > > $optionalCheck = "state->argument($argumentIndex).isUndefined() ? $defaultValue : "; >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCallTracer.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestCallTracer.cpp >index dbd71818c290d03dabf3c1557092d8abd67b6843..6aef2208b9d1bd97f58bd0679cabdec047b452e0 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestCallTracer.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCallTracer.cpp >@@ -485,7 +485,7 @@ static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperation > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto variantOptionalArg = state->argument(0).isUndefined() ? std::optional<Converter<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>::ReturnType>() : std::optional<Converter<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>::ReturnType>(convert<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>(*state, state->uncheckedArgument(0))); >+ auto variantOptionalArg = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>::ReturnType>() : WTF::Optional<Converter<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>::ReturnType>(convert<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > if (UNLIKELY(impl.callTracingActive())) { > Vector<TestCallTracerInterfaceVariant> callTracerParameters; >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp >index 2fc738220b8d75c2a7083534ab312b52f559d649..dbe255d468be4ac4d9564b844075ed5d044dad8b 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp >@@ -64,14 +64,14 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestCallbackInterf > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestCallbackInterface::Enum> parseEnumeration<TestCallbackInterface::Enum>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestCallbackInterface::Enum> parseEnumeration<TestCallbackInterface::Enum>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "value1") > return TestCallbackInterface::Enum::Value1; > if (stringValue == "value2") > return TestCallbackInterface::Enum::Value2; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestCallbackInterface::Enum>() >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h >index 8f21fd2c55ad804ffe678b6f46c409505eb4bea6..ff23cd503214a2629157d37c3760ff7df7e11747 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h >@@ -69,7 +69,7 @@ inline JSC::JSValue toJS(TestCallbackInterface* impl) { return impl ? toJS(*impl > String convertEnumerationToString(TestCallbackInterface::Enum); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestCallbackInterface::Enum); > >-template<> std::optional<TestCallbackInterface::Enum> parseEnumeration<TestCallbackInterface::Enum>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestCallbackInterface::Enum> parseEnumeration<TestCallbackInterface::Enum>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestCallbackInterface::Enum>(); > > template<> TestCallbackInterface::Dictionary convertDictionary<TestCallbackInterface::Dictionary>(JSC::ExecState&, JSC::JSValue); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp >index 54b9205782f965d3b7569e9c31d3e5a6bff51a8a..4e3b2812fdff71c27de5a4006bc9f84ab3a3c8ac 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp >@@ -151,11 +151,11 @@ bool JSTestEventTarget::getOwnPropertySlot(JSObject* object, ExecState* state, P > return JSObject::getOwnPropertySlot(object, state, propertyName, slot); > } > using GetterIDLType = IDLInterface<Node>; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLInterface<Node>>(*state, *thisObject->globalObject(), WTFMove(namedProperty.value())); >@@ -179,11 +179,11 @@ bool JSTestEventTarget::getOwnPropertySlotByIndex(JSObject* object, ExecState* s > } > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLInterface<Node>; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLInterface<Node>>(*state, *thisObject->globalObject(), WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp >index 9c2a2dd91ccf9eed1dbc6d9dd115cf9c17cee38e..e0602c92d17a0dc901c5284891b0e10532d8a101 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp >@@ -150,11 +150,11 @@ bool JSTestNamedAndIndexedSetterNoIdentifier::getOwnPropertySlot(JSObject* objec > return JSObject::getOwnPropertySlot(object, state, propertyName, slot); > } > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -178,11 +178,11 @@ bool JSTestNamedAndIndexedSetterNoIdentifier::getOwnPropertySlotByIndex(JSObject > } > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp >index e72a66a5ce05d0c565000e956b4d42fbf99531f4..4af93dbf2c4eba1bab8ae93795f6cccdb86b544d 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp >@@ -150,11 +150,11 @@ bool JSTestNamedAndIndexedSetterThrowingException::getOwnPropertySlot(JSObject* > return JSObject::getOwnPropertySlot(object, state, propertyName, slot); > } > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -178,11 +178,11 @@ bool JSTestNamedAndIndexedSetterThrowingException::getOwnPropertySlotByIndex(JSO > } > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp >index 67af9e19e5979ea8ec23969979a7efe8590ad10e..3357afac416d65775dced341575bd740822a1fd6 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp >@@ -159,11 +159,11 @@ bool JSTestNamedAndIndexedSetterWithIdentifier::getOwnPropertySlot(JSObject* obj > return JSObject::getOwnPropertySlot(object, state, propertyName, slot); > } > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -187,11 +187,11 @@ bool JSTestNamedAndIndexedSetterWithIdentifier::getOwnPropertySlotByIndex(JSObje > } > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp >index c0787f754647eb91a3374add599259602cf12e0d..fbc425f60f0ff17366545dc4b3db4f1793d2732d 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp >@@ -141,11 +141,11 @@ bool JSTestNamedDeleterNoIdentifier::getOwnPropertySlot(JSObject* object, ExecSt > auto* thisObject = jsCast<JSTestNamedDeleterNoIdentifier*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -161,11 +161,11 @@ bool JSTestNamedDeleterNoIdentifier::getOwnPropertySlotByIndex(JSObject* object, > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp >index 25bf0b2cc499da3d3d6a31d0f70feaace6bdab75..96d502ba26a3b12187030be51231c7f43a359d75 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp >@@ -141,11 +141,11 @@ bool JSTestNamedDeleterThrowingException::getOwnPropertySlot(JSObject* object, E > auto* thisObject = jsCast<JSTestNamedDeleterThrowingException*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -161,11 +161,11 @@ bool JSTestNamedDeleterThrowingException::getOwnPropertySlotByIndex(JSObject* ob > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp >index 0eb3a6ea6502c719b25468c2e45ce4803c209444..8eb61f5031664c9f2675de2b7c5bcf2d05ae44f5 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp >@@ -147,11 +147,11 @@ bool JSTestNamedDeleterWithIdentifier::getOwnPropertySlot(JSObject* object, Exec > auto* thisObject = jsCast<JSTestNamedDeleterWithIdentifier*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -167,11 +167,11 @@ bool JSTestNamedDeleterWithIdentifier::getOwnPropertySlotByIndex(JSObject* objec > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp >index d2604b17cd8b336998ab739aacde7e31b119eed9..572c4809ab6621b251e2802264f7cbb9ee851079 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp >@@ -150,11 +150,11 @@ bool JSTestNamedDeleterWithIndexedGetter::getOwnPropertySlot(JSObject* object, E > return JSObject::getOwnPropertySlot(object, state, propertyName, slot); > } > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -178,11 +178,11 @@ bool JSTestNamedDeleterWithIndexedGetter::getOwnPropertySlotByIndex(JSObject* ob > } > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp >index 471d14f105ae88107ce224877bff21a34773de47..d8556051dd183786dc64b5a6be8d043f1d16eb55 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp >@@ -141,11 +141,11 @@ bool JSTestNamedGetterCallWith::getOwnPropertySlot(JSObject* object, ExecState* > auto* thisObject = jsCast<JSTestNamedGetterCallWith*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(worldForDOMObject(thisObject), propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -161,11 +161,11 @@ bool JSTestNamedGetterCallWith::getOwnPropertySlotByIndex(JSObject* object, Exec > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(worldForDOMObject(thisObject), propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp >index 8e5bc2009f93cb37951b25012644985f8a67bf60..86862376ec5da7e990c9f8b3818d59b8f2e15beb 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp >@@ -141,11 +141,11 @@ bool JSTestNamedGetterNoIdentifier::getOwnPropertySlot(JSObject* object, ExecSta > auto* thisObject = jsCast<JSTestNamedGetterNoIdentifier*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -161,11 +161,11 @@ bool JSTestNamedGetterNoIdentifier::getOwnPropertySlotByIndex(JSObject* object, > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp >index 4847061cc7d0c58d32b8b43908088c7d8b771441..6f63952ba70eb992d4c639899d91e1bae19be103 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp >@@ -147,11 +147,11 @@ bool JSTestNamedGetterWithIdentifier::getOwnPropertySlot(JSObject* object, ExecS > auto* thisObject = jsCast<JSTestNamedGetterWithIdentifier*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().getterName(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -167,11 +167,11 @@ bool JSTestNamedGetterWithIdentifier::getOwnPropertySlotByIndex(JSObject* object > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().getterName(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp >index 5057577c4308a6528c0a177f2ad493780c18e08b..8856e10a9c2790118f771295e314071db1a7ae97 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp >@@ -141,11 +141,11 @@ bool JSTestNamedSetterNoIdentifier::getOwnPropertySlot(JSObject* object, ExecSta > auto* thisObject = jsCast<JSTestNamedSetterNoIdentifier*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -161,11 +161,11 @@ bool JSTestNamedSetterNoIdentifier::getOwnPropertySlotByIndex(JSObject* object, > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp >index 668773981e4449c17fb8da1bce0b260c9204cbef..3b0d4d63e8d6b87d8f444b60bbadfa8d5f5ba9f6 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp >@@ -141,11 +141,11 @@ bool JSTestNamedSetterThrowingException::getOwnPropertySlot(JSObject* object, Ex > auto* thisObject = jsCast<JSTestNamedSetterThrowingException*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -161,11 +161,11 @@ bool JSTestNamedSetterThrowingException::getOwnPropertySlotByIndex(JSObject* obj > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp >index 0db74292a9144239a20569393138cfe566245f18..fdee714cc01db0bfd931fcf896b1f3c740a6ae0d 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp >@@ -147,11 +147,11 @@ bool JSTestNamedSetterWithIdentifier::getOwnPropertySlot(JSObject* object, ExecS > auto* thisObject = jsCast<JSTestNamedSetterWithIdentifier*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -167,11 +167,11 @@ bool JSTestNamedSetterWithIdentifier::getOwnPropertySlotByIndex(JSObject* object > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp >index aa40bd1f0a9bc0a6fdb30f84a270ef9709c2dc92..0abe5fe600c8ac0f7adb51e1f8d80edb8e3ee2af 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp >@@ -159,11 +159,11 @@ bool JSTestNamedSetterWithIndexedGetter::getOwnPropertySlot(JSObject* object, Ex > return JSObject::getOwnPropertySlot(object, state, propertyName, slot); > } > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -187,11 +187,11 @@ bool JSTestNamedSetterWithIndexedGetter::getOwnPropertySlotByIndex(JSObject* obj > } > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp >index bed173a1d4a8781145495b542f733955579fe0ae..2218b25e8f336ac80607c900029bfdb1313b94be 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp >@@ -159,11 +159,11 @@ bool JSTestNamedSetterWithIndexedGetterAndSetter::getOwnPropertySlot(JSObject* o > return JSObject::getOwnPropertySlot(object, state, propertyName, slot); > } > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -187,11 +187,11 @@ bool JSTestNamedSetterWithIndexedGetterAndSetter::getOwnPropertySlotByIndex(JSOb > } > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp >index 50bfcb1bc148327eab0e98c8b3ba8d233116b7bc..deb4f3d437f1503d5d1b3b1be4c89916d52c9487 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp >@@ -141,11 +141,11 @@ bool JSTestNamedSetterWithOverrideBuiltins::getOwnPropertySlot(JSObject* object, > auto* thisObject = jsCast<JSTestNamedSetterWithOverrideBuiltins*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -161,11 +161,11 @@ bool JSTestNamedSetterWithOverrideBuiltins::getOwnPropertySlotByIndex(JSObject* > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp >index fed2dc1bc06cc376cf361e8bfc3301bfc8870320..3d3e6119d2623e8ecb43f95f64e0adc2980f8c44 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp >@@ -165,11 +165,11 @@ bool JSTestNamedSetterWithUnforgableProperties::getOwnPropertySlot(JSObject* obj > auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -185,11 +185,11 @@ bool JSTestNamedSetterWithUnforgableProperties::getOwnPropertySlotByIndex(JSObje > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp >index 727f3781170e2955dd659f88d5b303998f084b9f..b77be742199e7214b661ad32b1098a9bad61d06f 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp >@@ -165,11 +165,11 @@ bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::getOwnPropert > auto* thisObject = jsCast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >@@ -185,11 +185,11 @@ bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::getOwnPropert > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLDOMString; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >index a95931f9d9eb5570dc36818715dd45c709762b90..c65f3af405e2c417df2e36adcbefa97aafa87cf0 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >@@ -135,7 +135,7 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::EnumType > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::EnumType> parseEnumeration<TestObj::EnumType>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::EnumType> parseEnumeration<TestObj::EnumType>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue.isEmpty()) >@@ -146,7 +146,7 @@ template<> std::optional<TestObj::EnumType> parseEnumeration<TestObj::EnumType>( > return TestObj::EnumType::EnumValue2; > if (stringValue == "EnumValue3") > return TestObj::EnumType::EnumValue3; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::EnumType>() >@@ -175,7 +175,7 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::Optional > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::Optional> parseEnumeration<TestObj::Optional>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::Optional> parseEnumeration<TestObj::Optional>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue.isEmpty()) >@@ -186,7 +186,7 @@ template<> std::optional<TestObj::Optional> parseEnumeration<TestObj::Optional>( > return TestObj::Optional::OptionalValue2; > if (stringValue == "OptionalValue3") > return TestObj::Optional::OptionalValue3; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::Optional>() >@@ -211,14 +211,14 @@ template<> JSString* convertEnumerationToJS(ExecState& state, AlternateEnumName > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<AlternateEnumName> parseEnumeration<AlternateEnumName>(ExecState& state, JSValue value) >+template<> WTF::Optional<AlternateEnumName> parseEnumeration<AlternateEnumName>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "enumValue1") > return AlternateEnumName::EnumValue1; > if (stringValue == "EnumValue2") > return AlternateEnumName::EnumValue2; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<AlternateEnumName>() >@@ -243,12 +243,12 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::EnumA enu > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::EnumA> parseEnumeration<TestObj::EnumA>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::EnumA> parseEnumeration<TestObj::EnumA>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "A") > return TestObj::EnumA::A; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::EnumA>() >@@ -275,12 +275,12 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::EnumB enu > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::EnumB> parseEnumeration<TestObj::EnumB>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::EnumB> parseEnumeration<TestObj::EnumB>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "B") > return TestObj::EnumB::B; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::EnumB>() >@@ -307,12 +307,12 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::EnumC enu > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::EnumC> parseEnumeration<TestObj::EnumC>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::EnumC> parseEnumeration<TestObj::EnumC>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "C") > return TestObj::EnumC::C; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::EnumC>() >@@ -339,14 +339,14 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::Kind enum > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::Kind> parseEnumeration<TestObj::Kind>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::Kind> parseEnumeration<TestObj::Kind>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "quick") > return TestObj::Kind::Quick; > if (stringValue == "dead") > return TestObj::Kind::Dead; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::Kind>() >@@ -371,14 +371,14 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::Size enum > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::Size> parseEnumeration<TestObj::Size>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::Size> parseEnumeration<TestObj::Size>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "small") > return TestObj::Size::Small; > if (stringValue == "much-much-larger") > return TestObj::Size::MuchMuchLarger; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::Size>() >@@ -403,14 +403,14 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestObj::Confidenc > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestObj::Confidence> parseEnumeration<TestObj::Confidence>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestObj::Confidence> parseEnumeration<TestObj::Confidence>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "high") > return TestObj::Confidence::High; > if (stringValue == "kinda-low") > return TestObj::Confidence::KindaLow; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestObj::Confidence>() >@@ -648,7 +648,7 @@ template<> TestObj::Dictionary convertDictionary<TestObj::Dictionary>(ExecState& > result.nullableEnum = convert<IDLNullable<IDLEnumeration<TestObj::EnumType>>>(state, nullableEnumValue); > RETURN_IF_EXCEPTION(throwScope, { }); > } else >- result.nullableEnum = std::nullopt; >+ result.nullableEnum = WTF::nullopt; > JSValue nullableIntegerWithDefaultValue; > if (isNullOrUndefined) > nullableIntegerWithDefaultValue = jsUndefined(); >@@ -660,7 +660,7 @@ template<> TestObj::Dictionary convertDictionary<TestObj::Dictionary>(ExecState& > result.nullableIntegerWithDefault = convert<IDLNullable<IDLLong>>(state, nullableIntegerWithDefaultValue); > RETURN_IF_EXCEPTION(throwScope, { }); > } else >- result.nullableIntegerWithDefault = std::nullopt; >+ result.nullableIntegerWithDefault = WTF::nullopt; > JSValue nullableNodeValue; > if (isNullOrUndefined) > nullableNodeValue = jsUndefined(); >@@ -696,7 +696,7 @@ template<> TestObj::Dictionary convertDictionary<TestObj::Dictionary>(ExecState& > result.nullableUnionMember = convert<IDLNullable<IDLUnion<IDLLong, IDLInterface<Node>>>>(state, nullableUnionMemberValue); > RETURN_IF_EXCEPTION(throwScope, { }); > } else >- result.nullableUnionMember = std::nullopt; >+ result.nullableUnionMember = WTF::nullopt; > JSValue requiredBufferSourceValueValue; > if (isNullOrUndefined) > requiredBufferSourceValueValue = jsUndefined(); >@@ -5752,7 +5752,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalEn > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto enumArg = state->argument(0).isUndefined() ? std::optional<Converter<IDLEnumeration<TestObj::EnumType>>::ReturnType>() : std::optional<Converter<IDLEnumeration<TestObj::EnumType>>::ReturnType>(convert<IDLEnumeration<TestObj::EnumType>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 0, "enumArg", "TestObject", "methodWithOptionalEnumArg", expectedEnumerationValues<TestObj::EnumType>()); })); >+ auto enumArg = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLEnumeration<TestObj::EnumType>>::ReturnType>() : WTF::Optional<Converter<IDLEnumeration<TestObj::EnumType>>::ReturnType>(convert<IDLEnumeration<TestObj::EnumType>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 0, "enumArg", "TestObject", "methodWithOptionalEnumArg", expectedEnumerationValues<TestObj::EnumType>()); })); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithOptionalEnumArg(WTFMove(enumArg)); > return JSValue::encode(jsUndefined()); >@@ -6259,7 +6259,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalAr > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto opt = state->argument(0).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0))); >+ auto opt = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithOptionalArg(WTFMove(opt)); > return JSValue::encode(jsUndefined()); >@@ -6295,7 +6295,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithNonOptiona > return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); > auto nonOpt = convert<IDLLong>(*state, state->uncheckedArgument(0)); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >- auto opt = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); >+ auto opt = state->argument(1).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithNonOptionalArgAndOptionalArg(WTFMove(nonOpt), WTFMove(opt)); > return JSValue::encode(jsUndefined()); >@@ -6315,9 +6315,9 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithNonOptiona > return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); > auto nonOpt = convert<IDLLong>(*state, state->uncheckedArgument(0)); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >- auto opt1 = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); >+ auto opt1 = state->argument(1).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >- auto opt2 = state->argument(2).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(2))); >+ auto opt2 = state->argument(2).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(2))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithNonOptionalArgAndTwoOptionalArgs(WTFMove(nonOpt), WTFMove(opt1), WTFMove(opt2)); > return JSValue::encode(jsUndefined()); >@@ -6541,7 +6541,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalLo > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto number = state->argument(0).isUndefined() ? std::optional<Converter<IDLLongLong>::ReturnType>() : std::optional<Converter<IDLLongLong>::ReturnType>(convert<IDLLongLong>(*state, state->uncheckedArgument(0))); >+ auto number = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLLongLong>::ReturnType>() : WTF::Optional<Converter<IDLLongLong>::ReturnType>(convert<IDLLongLong>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithOptionalLongLong(WTFMove(number)); > return JSValue::encode(jsUndefined()); >@@ -6573,7 +6573,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalUn > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto number = state->argument(0).isUndefined() ? std::optional<Converter<IDLUnsignedLongLong>::ReturnType>() : std::optional<Converter<IDLUnsignedLongLong>::ReturnType>(convert<IDLUnsignedLongLong>(*state, state->uncheckedArgument(0))); >+ auto number = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLUnsignedLongLong>::ReturnType>() : WTF::Optional<Converter<IDLUnsignedLongLong>::ReturnType>(convert<IDLUnsignedLongLong>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithOptionalUnsignedLongLong(WTFMove(number)); > return JSValue::encode(jsUndefined()); >@@ -6637,7 +6637,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalBo > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto b = state->argument(0).isUndefined() ? std::optional<Converter<IDLBoolean>::ReturnType>() : std::optional<Converter<IDLBoolean>::ReturnType>(convert<IDLBoolean>(*state, state->uncheckedArgument(0))); >+ auto b = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLBoolean>::ReturnType>() : WTF::Optional<Converter<IDLBoolean>::ReturnType>(convert<IDLBoolean>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithOptionalBoolean(WTFMove(b)); > return JSValue::encode(jsUndefined()); >@@ -6685,7 +6685,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalOb > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto a = state->argument(0).isUndefined() ? std::optional<Converter<IDLObject>::ReturnType>() : std::optional<Converter<IDLObject>::ReturnType>(convert<IDLObject>(*state, state->uncheckedArgument(0))); >+ auto a = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLObject>::ReturnType>() : WTF::Optional<Converter<IDLObject>::ReturnType>(convert<IDLObject>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithOptionalObject(WTFMove(a)); > return JSValue::encode(jsUndefined()); >@@ -6749,7 +6749,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalRe > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto record = state->argument(0).isUndefined() ? std::nullopt : convert<IDLNullable<IDLRecord<IDLDOMString, IDLLong>>>(*state, state->uncheckedArgument(0)); >+ auto record = state->argument(0).isUndefined() ? WTF::nullopt : convert<IDLNullable<IDLRecord<IDLDOMString, IDLLong>>>(*state, state->uncheckedArgument(0)); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.methodWithOptionalRecord(WTFMove(record)); > return JSValue::encode(jsUndefined()); >@@ -6986,7 +6986,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod2Bod > auto& impl = castedThis->wrapped(); > auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); }); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >- auto longArg = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); >+ auto longArg = state->argument(1).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.overloadedMethod(WTFMove(objArg), WTFMove(longArg)); > return JSValue::encode(jsUndefined()); >@@ -7185,7 +7185,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith > auto& impl = castedThis->wrapped(); > auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj"); }); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >- auto longArg = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); >+ auto longArg = state->argument(1).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.overloadedMethodWithOptionalParameter(WTFMove(objArg), WTFMove(longArg)); > return JSValue::encode(jsUndefined()); >@@ -7531,7 +7531,7 @@ static inline JSC::EncodedJSValue jsTestObjConstructorFunctionClassMethodWithOpt > { > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); >- auto arg = state->argument(0).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0))); >+ auto arg = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > return JSValue::encode(toJS<IDLLong>(TestObj::classMethodWithOptional(WTFMove(arg)))); > } >@@ -7737,7 +7737,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOperationWithOptiona > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto optionalUnion = state->argument(0).isUndefined() ? std::optional<Converter<IDLUnion<IDLDOMString, IDLSequence<IDLUnrestrictedDouble>>>::ReturnType>() : std::optional<Converter<IDLUnion<IDLDOMString, IDLSequence<IDLUnrestrictedDouble>>>::ReturnType>(convert<IDLUnion<IDLDOMString, IDLSequence<IDLUnrestrictedDouble>>>(*state, state->uncheckedArgument(0))); >+ auto optionalUnion = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLUnion<IDLDOMString, IDLSequence<IDLUnrestrictedDouble>>>::ReturnType>() : WTF::Optional<Converter<IDLUnion<IDLDOMString, IDLSequence<IDLUnrestrictedDouble>>>::ReturnType>(convert<IDLUnion<IDLDOMString, IDLSequence<IDLUnrestrictedDouble>>>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.operationWithOptionalUnionParameter(WTFMove(optionalUnion)); > return JSValue::encode(jsUndefined()); >@@ -8048,7 +8048,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionW > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto a = state->argument(0).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0))); >+ auto a = state->argument(0).isUndefined() ? WTF::Optional<Converter<IDLLong>::ReturnType>() : WTF::Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.testPromiseFunctionWithOptionalIntArgument(WTFMove(a), WTFMove(promise)); > return JSValue::encode(jsUndefined()); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h >index d55404eefcd5c198eff17398ce11e0c72e462119..55dbb75720f42898b442bff25110c4125b33d4a4 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h >@@ -112,19 +112,19 @@ template<> struct JSDOMWrapperConverterTraits<TestObj> { > String convertEnumerationToString(TestObj::EnumType); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::EnumType); > >-template<> std::optional<TestObj::EnumType> parseEnumeration<TestObj::EnumType>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::EnumType> parseEnumeration<TestObj::EnumType>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::EnumType>(); > > String convertEnumerationToString(TestObj::Optional); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::Optional); > >-template<> std::optional<TestObj::Optional> parseEnumeration<TestObj::Optional>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::Optional> parseEnumeration<TestObj::Optional>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::Optional>(); > > String convertEnumerationToString(AlternateEnumName); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, AlternateEnumName); > >-template<> std::optional<AlternateEnumName> parseEnumeration<AlternateEnumName>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<AlternateEnumName> parseEnumeration<AlternateEnumName>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<AlternateEnumName>(); > > #if ENABLE(Condition1) >@@ -132,7 +132,7 @@ template<> const char* expectedEnumerationValues<AlternateEnumName>(); > String convertEnumerationToString(TestObj::EnumA); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::EnumA); > >-template<> std::optional<TestObj::EnumA> parseEnumeration<TestObj::EnumA>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::EnumA> parseEnumeration<TestObj::EnumA>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::EnumA>(); > > #endif >@@ -142,7 +142,7 @@ template<> const char* expectedEnumerationValues<TestObj::EnumA>(); > String convertEnumerationToString(TestObj::EnumB); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::EnumB); > >-template<> std::optional<TestObj::EnumB> parseEnumeration<TestObj::EnumB>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::EnumB> parseEnumeration<TestObj::EnumB>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::EnumB>(); > > #endif >@@ -152,7 +152,7 @@ template<> const char* expectedEnumerationValues<TestObj::EnumB>(); > String convertEnumerationToString(TestObj::EnumC); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::EnumC); > >-template<> std::optional<TestObj::EnumC> parseEnumeration<TestObj::EnumC>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::EnumC> parseEnumeration<TestObj::EnumC>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::EnumC>(); > > #endif >@@ -160,19 +160,19 @@ template<> const char* expectedEnumerationValues<TestObj::EnumC>(); > String convertEnumerationToString(TestObj::Kind); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::Kind); > >-template<> std::optional<TestObj::Kind> parseEnumeration<TestObj::Kind>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::Kind> parseEnumeration<TestObj::Kind>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::Kind>(); > > String convertEnumerationToString(TestObj::Size); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::Size); > >-template<> std::optional<TestObj::Size> parseEnumeration<TestObj::Size>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::Size> parseEnumeration<TestObj::Size>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::Size>(); > > String convertEnumerationToString(TestObj::Confidence); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestObj::Confidence); > >-template<> std::optional<TestObj::Confidence> parseEnumeration<TestObj::Confidence>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestObj::Confidence> parseEnumeration<TestObj::Confidence>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestObj::Confidence>(); > > template<> TestObj::Dictionary convertDictionary<TestObj::Dictionary>(JSC::ExecState&, JSC::JSValue); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp >index f21b343157e2e500145ea9f6cd8a18563af88b59..2d46e7f160b78cff7923f186c9acbe05a891d022 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp >@@ -150,11 +150,11 @@ bool JSTestOverrideBuiltins::getOwnPropertySlot(JSObject* object, ExecState* sta > auto* thisObject = jsCast<JSTestOverrideBuiltins*>(object); > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > using GetterIDLType = IDLInterface<Node>; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLInterface<Node>>(*state, *thisObject->globalObject(), WTFMove(namedProperty.value())); >@@ -170,11 +170,11 @@ bool JSTestOverrideBuiltins::getOwnPropertySlotByIndex(JSObject* object, ExecSta > ASSERT_GC_OBJECT_INHERITS(thisObject, info()); > auto propertyName = Identifier::from(state, index); > using GetterIDLType = IDLInterface<Node>; >- auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> { >+ auto getterFunctor = [] (auto& thisObject, auto propertyName) -> WTF::Optional<typename GetterIDLType::ImplementationType> { > auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName)); > if (!GetterIDLType::isNullValue(result)) > return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) }; >- return std::nullopt; >+ return WTF::nullopt; > }; > if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::Yes>(*state, *thisObject, propertyName, getterFunctor)) { > auto value = toJS<IDLInterface<Node>>(*state, *thisObject->globalObject(), WTFMove(namedProperty.value())); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp >index e3f459649851da2d7539cba641282023b63214ee..6e13038448e199309634f063f81100da0037fde1 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp >@@ -102,14 +102,14 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestStandaloneDict > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestStandaloneDictionary::EnumInStandaloneDictionaryFile> parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestStandaloneDictionary::EnumInStandaloneDictionaryFile> parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "enumValue1") > return TestStandaloneDictionary::EnumInStandaloneDictionaryFile::EnumValue1; > if (stringValue == "enumValue2") > return TestStandaloneDictionary::EnumInStandaloneDictionaryFile::EnumValue2; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>() >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.h b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.h >index ddbfbfd04b5fb85d63656c771663757a26e05b43..a0db37bf6879fc611b73df605b6013e35590a25b 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.h >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.h >@@ -33,7 +33,7 @@ template<> WEBCORE_EXPORT DictionaryImplName convertDictionary<DictionaryImplNam > String convertEnumerationToString(TestStandaloneDictionary::EnumInStandaloneDictionaryFile); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestStandaloneDictionary::EnumInStandaloneDictionaryFile); > >-template<> std::optional<TestStandaloneDictionary::EnumInStandaloneDictionaryFile> parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestStandaloneDictionary::EnumInStandaloneDictionaryFile> parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>(); > > } // namespace WebCore >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp >index 6e0bd8ee7ee85b447ce2798fcb7663cafc101d61..e81de209a25b573fc9c791c2b80f93d898033808 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp >@@ -49,14 +49,14 @@ template<> JSString* convertEnumerationToJS(ExecState& state, TestStandaloneEnum > return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); > } > >-template<> std::optional<TestStandaloneEnumeration> parseEnumeration<TestStandaloneEnumeration>(ExecState& state, JSValue value) >+template<> WTF::Optional<TestStandaloneEnumeration> parseEnumeration<TestStandaloneEnumeration>(ExecState& state, JSValue value) > { > auto stringValue = value.toWTFString(&state); > if (stringValue == "enumValue1") > return TestStandaloneEnumeration::EnumValue1; > if (stringValue == "enumValue2") > return TestStandaloneEnumeration::EnumValue2; >- return std::nullopt; >+ return WTF::nullopt; > } > > template<> const char* expectedEnumerationValues<TestStandaloneEnumeration>() >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.h b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.h >index a0e7bd9c504158d37bb5a57e36c6f0a9f6e8b43a..95e2260501387a05f8c3639876c728a12eadd0a6 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.h >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.h >@@ -30,7 +30,7 @@ namespace WebCore { > String convertEnumerationToString(TestStandaloneEnumeration); > template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestStandaloneEnumeration); > >-template<> std::optional<TestStandaloneEnumeration> parseEnumeration<TestStandaloneEnumeration>(JSC::ExecState&, JSC::JSValue); >+template<> WTF::Optional<TestStandaloneEnumeration> parseEnumeration<TestStandaloneEnumeration>(JSC::ExecState&, JSC::JSValue); > template<> const char* expectedEnumerationValues<TestStandaloneEnumeration>(); > > } // namespace WebCore >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp >index 6b678bcf5eefd6b8b9df71a79d000a7d3ba3a1d3..e2d2a1ec19af0b036843acae5b441eaa3e8bc5a0 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp >@@ -510,7 +510,7 @@ static inline JSC::EncodedJSValue jsTestTypedefsPrototypeFunctionSetShadowBody(J > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > auto color = state->argument(3).isUndefined() ? String() : convert<IDLDOMString>(*state, state->uncheckedArgument(3)); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >- auto alpha = state->argument(4).isUndefined() ? std::optional<Converter<IDLUnrestrictedFloat>::ReturnType>() : std::optional<Converter<IDLUnrestrictedFloat>::ReturnType>(convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(4))); >+ auto alpha = state->argument(4).isUndefined() ? WTF::Optional<Converter<IDLUnrestrictedFloat>::ReturnType>() : WTF::Optional<Converter<IDLUnrestrictedFloat>::ReturnType>(convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(4))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.setShadow(WTFMove(width), WTFMove(height), WTFMove(blur), WTFMove(color), WTFMove(alpha)); > return JSValue::encode(jsUndefined()); >@@ -637,7 +637,7 @@ static inline JSC::EncodedJSValue jsTestTypedefsPrototypeFunctionFuncWithClampBo > return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); > auto arg1 = convert<IDLClampAdaptor<IDLUnsignedLongLong>>(*state, state->uncheckedArgument(0)); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >- auto arg2 = state->argument(1).isUndefined() ? std::optional<Converter<IDLClampAdaptor<IDLUnsignedLongLong>>::ReturnType>() : std::optional<Converter<IDLClampAdaptor<IDLUnsignedLongLong>>::ReturnType>(convert<IDLClampAdaptor<IDLUnsignedLongLong>>(*state, state->uncheckedArgument(1))); >+ auto arg2 = state->argument(1).isUndefined() ? WTF::Optional<Converter<IDLClampAdaptor<IDLUnsignedLongLong>>::ReturnType>() : WTF::Optional<Converter<IDLClampAdaptor<IDLUnsignedLongLong>>::ReturnType>(convert<IDLClampAdaptor<IDLUnsignedLongLong>>(*state, state->uncheckedArgument(1))); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.funcWithClamp(WTFMove(arg1), WTFMove(arg2)); > return JSValue::encode(jsUndefined()); >diff --git a/Source/WebCore/bridge/runtime_array.cpp b/Source/WebCore/bridge/runtime_array.cpp >index 59b362aded7454b1e70388505f6b4971bb40dc40..294bef7e3ad35154c00d6222c27093f94153eacc 100644 >--- a/Source/WebCore/bridge/runtime_array.cpp >+++ b/Source/WebCore/bridge/runtime_array.cpp >@@ -94,7 +94,7 @@ bool RuntimeArray::getOwnPropertySlot(JSObject* object, ExecState* exec, Propert > return true; > } > >- std::optional<uint32_t> index = parseIndex(propertyName); >+ WTF::Optional<uint32_t> index = parseIndex(propertyName); > if (index && index.value() < thisObject->getLength()) { > slot.setValue(thisObject, PropertyAttribute::DontDelete | PropertyAttribute::DontEnum, > thisObject->getConcreteArray()->valueAt(exec, index.value())); >@@ -127,7 +127,7 @@ bool RuntimeArray::put(JSCell* cell, ExecState* exec, PropertyName propertyName, > return false; > } > >- if (std::optional<uint32_t> index = parseIndex(propertyName)) >+ if (WTF::Optional<uint32_t> index = parseIndex(propertyName)) > return thisObject->getConcreteArray()->setValueAt(exec, index.value(), value); > > RELEASE_AND_RETURN(scope, JSObject::put(thisObject, exec, propertyName, value, slot)); >diff --git a/Source/WebCore/contentextensions/ContentExtensionParser.cpp b/Source/WebCore/contentextensions/ContentExtensionParser.cpp >index 928c37e7d3c82646b8318a4060b58798507ef701..376b6f3629da5e11935dfd65a6b16d0be8de9451 100644 >--- a/Source/WebCore/contentextensions/ContentExtensionParser.cpp >+++ b/Source/WebCore/contentextensions/ContentExtensionParser.cpp >@@ -240,7 +240,7 @@ bool isValidCSSSelector(const String& selector) > return selectorList.isValid(); > } > >-static Expected<std::optional<Action>, std::error_code> loadAction(ExecState& exec, const JSObject& ruleObject) >+static Expected<WTF::Optional<Action>, std::error_code> loadAction(ExecState& exec, const JSObject& ruleObject) > { > VM& vm = exec.vm(); > auto scope = DECLARE_THROW_SCOPE(vm); >@@ -269,7 +269,7 @@ static Expected<std::optional<Action>, std::error_code> loadAction(ExecState& ex > String selectorString = asString(selector)->value(&exec); > if (!isValidCSSSelector(selectorString)) { > // Skip rules with invalid selectors to be backwards-compatible. >- return { std::nullopt }; >+ return { WTF::nullopt }; > } > return { Action(ActionType::CSSDisplayNoneSelector, selectorString) }; > } >@@ -284,7 +284,7 @@ static Expected<std::optional<Action>, std::error_code> loadAction(ExecState& ex > return makeUnexpected(ContentExtensionError::JSONInvalidActionType); > } > >-static Expected<std::optional<ContentExtensionRule>, std::error_code> loadRule(ExecState& exec, const JSObject& ruleObject) >+static Expected<WTF::Optional<ContentExtensionRule>, std::error_code> loadRule(ExecState& exec, const JSObject& ruleObject) > { > auto trigger = loadTrigger(exec, ruleObject); > if (!trigger.has_value()) >@@ -297,7 +297,7 @@ static Expected<std::optional<ContentExtensionRule>, std::error_code> loadRule(E > if (action.value()) > return {{{ WTFMove(trigger.value()), WTFMove(action.value().value()) }}}; > >- return { std::nullopt }; >+ return { WTF::nullopt }; > } > > static Expected<Vector<ContentExtensionRule>, std::error_code> loadEncodedRules(ExecState& exec, const String& ruleJSON) >diff --git a/Source/WebCore/contentextensions/URLFilterParser.cpp b/Source/WebCore/contentextensions/URLFilterParser.cpp >index c50128e9658904db75e8b9aace50f0207be3c0cc..02e847294602aca5c264ae3cdca4af6307bdc204 100644 >--- a/Source/WebCore/contentextensions/URLFilterParser.cpp >+++ b/Source/WebCore/contentextensions/URLFilterParser.cpp >@@ -218,7 +218,7 @@ public: > fail(URLFilterParser::AtomCharacter); > } > >- void atomParenthesesSubpatternBegin(bool = true, std::optional<String> = std::nullopt) >+ void atomParenthesesSubpatternBegin(bool = true, WTF::Optional<String> = WTF::nullopt) > { > if (hasError()) > return; >diff --git a/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp b/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp >index b160a54b127a4b9eae7c12c1ce0ff84e37d84bf6..28b41d6567545d7d7b88add48b2bc0fcfc6b9f5f 100644 >--- a/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp >+++ b/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp >@@ -47,17 +47,17 @@ CryptoAlgorithmRegistry::CryptoAlgorithmRegistry() > platformRegisterAlgorithms(); > } > >-std::optional<CryptoAlgorithmIdentifier> CryptoAlgorithmRegistry::identifier(const String& name) >+WTF::Optional<CryptoAlgorithmIdentifier> CryptoAlgorithmRegistry::identifier(const String& name) > { > if (name.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > std::lock_guard<Lock> lock(registryMutex); > > // FIXME: How is it helpful to call isolatedCopy on the argument to find? > auto identifier = m_identifiers.find(name.isolatedCopy()); > if (identifier == m_identifiers.end()) >- return std::nullopt; >+ return WTF::nullopt; > > return identifier->value; > } >diff --git a/Source/WebCore/crypto/CryptoAlgorithmRegistry.h b/Source/WebCore/crypto/CryptoAlgorithmRegistry.h >index fa7a84c2bcb78fd8d6ccc1920faf13132bfdfa3e..236da1d49294f2a5885b1695744777ed828d8e40 100644 >--- a/Source/WebCore/crypto/CryptoAlgorithmRegistry.h >+++ b/Source/WebCore/crypto/CryptoAlgorithmRegistry.h >@@ -44,7 +44,7 @@ class CryptoAlgorithmRegistry { > public: > static CryptoAlgorithmRegistry& singleton(); > >- std::optional<CryptoAlgorithmIdentifier> identifier(const String&); >+ WTF::Optional<CryptoAlgorithmIdentifier> identifier(const String&); > String name(CryptoAlgorithmIdentifier); > > RefPtr<CryptoAlgorithm> create(CryptoAlgorithmIdentifier); >diff --git a/Source/WebCore/crypto/JsonWebKey.h b/Source/WebCore/crypto/JsonWebKey.h >index eec00d747e6b07216d09b38d0713946b69717dc7..e2bbe3fe9e4c6b6e0a2fd2bc55bce6063327a0c2 100644 >--- a/Source/WebCore/crypto/JsonWebKey.h >+++ b/Source/WebCore/crypto/JsonWebKey.h >@@ -37,11 +37,11 @@ struct JsonWebKey { > String kty; > String use; > // FIXME: Consider merging key_ops and usages. >- std::optional<Vector<CryptoKeyUsage>> key_ops; >+ WTF::Optional<Vector<CryptoKeyUsage>> key_ops; > CryptoKeyUsageBitmap usages; > String alg; > >- std::optional<bool> ext; >+ WTF::Optional<bool> ext; > > String crv; > String x; >@@ -54,7 +54,7 @@ struct JsonWebKey { > String dp; > String dq; > String qi; >- std::optional<Vector<RsaOtherPrimesInfo>> oth; >+ WTF::Optional<Vector<RsaOtherPrimesInfo>> oth; > String k; > }; > >diff --git a/Source/WebCore/crypto/SubtleCrypto.cpp b/Source/WebCore/crypto/SubtleCrypto.cpp >index a9446da5a6c689fd006de74c3454ed7c45230a90..27479a03165d0e33f65a622565e4faacb3d1aa6c 100644 >--- a/Source/WebCore/crypto/SubtleCrypto.cpp >+++ b/Source/WebCore/crypto/SubtleCrypto.cpp >@@ -442,22 +442,22 @@ static void normalizeJsonWebKey(JsonWebKey& webKey) > webKey.usages = webKey.key_ops ? toCryptoKeyUsageBitmap(webKey.key_ops.value()) : 0; > } > >-// FIXME: This returns an std::optional<KeyData> and takes a promise, rather than returning an >+// FIXME: This returns an WTF::Optional<KeyData> and takes a promise, rather than returning an > // ExceptionOr<KeyData> and letting the caller handle the promise, to work around an issue where > // Variant types (which KeyData is) in ExceptionOr<> cause compile issues on some platforms. This > // should be resolved by adopting a standards compliant std::variant (see https://webkit.org/b/175583) >-static std::optional<KeyData> toKeyData(SubtleCrypto::KeyFormat format, SubtleCrypto::KeyDataVariant&& keyDataVariant, Ref<DeferredPromise>& promise) >+static WTF::Optional<KeyData> toKeyData(SubtleCrypto::KeyFormat format, SubtleCrypto::KeyDataVariant&& keyDataVariant, Ref<DeferredPromise>& promise) > { > switch (format) { > case SubtleCrypto::KeyFormat::Spki: > case SubtleCrypto::KeyFormat::Pkcs8: > case SubtleCrypto::KeyFormat::Raw: > return WTF::switchOn(keyDataVariant, >- [&promise] (JsonWebKey&) -> std::optional<KeyData> { >+ [&promise] (JsonWebKey&) -> WTF::Optional<KeyData> { > promise->reject(Exception { TypeError }); >- return std::nullopt; >+ return WTF::nullopt; > }, >- [] (auto& bufferSource) -> std::optional<KeyData> { >+ [] (auto& bufferSource) -> WTF::Optional<KeyData> { > Vector<uint8_t> result; > result.append(static_cast<const uint8_t*>(bufferSource->data()), bufferSource->byteLength()); > return KeyData { result }; >@@ -465,13 +465,13 @@ static std::optional<KeyData> toKeyData(SubtleCrypto::KeyFormat format, SubtleCr > ); > case SubtleCrypto::KeyFormat::Jwk: > return WTF::switchOn(keyDataVariant, >- [] (JsonWebKey& webKey) -> std::optional<KeyData> { >+ [] (JsonWebKey& webKey) -> WTF::Optional<KeyData> { > normalizeJsonWebKey(webKey); > return KeyData { webKey }; > }, >- [&promise] (auto&) -> std::optional<KeyData> { >+ [&promise] (auto&) -> WTF::Optional<KeyData> { > promise->reject(Exception { TypeError }); >- return std::nullopt; >+ return WTF::nullopt; > } > ); > } >diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp b/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp >index dd2d90eec80baf42ea2cadff34b22502a44a1e5d..378d698779bb049765490619d16db64a1798599f 100644 >--- a/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp >+++ b/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp >@@ -96,7 +96,7 @@ void CryptoAlgorithmECDH::deriveBits(const CryptoAlgorithmParameters& parameters > return; > } > >- auto unifiedCallback = [callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](std::optional<Vector<uint8_t>>&& derivedKey, size_t length) mutable { >+ auto unifiedCallback = [callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](WTF::Optional<Vector<uint8_t>>&& derivedKey, size_t length) mutable { > if (!derivedKey) { > exceptionCallback(OperationError); > return; >diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h b/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h >index 3f5891b1120af6c6de8a7c4cf764ba4608e415b6..f5f4040f4174c8b3077535e3a1fcb2d61581d009 100644 >--- a/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h >+++ b/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h >@@ -48,7 +48,7 @@ private: > void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final; > void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final; > >- static std::optional<Vector<uint8_t>> platformDeriveBits(const CryptoKeyEC&, const CryptoKeyEC&); >+ static WTF::Optional<Vector<uint8_t>> platformDeriveBits(const CryptoKeyEC&, const CryptoKeyEC&); > }; > > } // namespace WebCore >diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp >index 78b277efdafc970bebe2c408ab8eb8d1e57f8c42..f22cc515f4f787885fdccfc7b8e424c7faa70827 100644 >--- a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp >+++ b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp >@@ -112,7 +112,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData& > exceptionCallback(DataError); > return; > } >- result = CryptoKeyRSA::importJwk(parameters.identifier, std::nullopt, WTFMove(key), extractable, usages); >+ result = CryptoKeyRSA::importJwk(parameters.identifier, WTF::nullopt, WTFMove(key), extractable, usages); > break; > } > case CryptoKeyFormat::Spki: { >@@ -120,7 +120,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData& > exceptionCallback(SyntaxError); > return; > } >- result = CryptoKeyRSA::importSpki(parameters.identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages); >+ result = CryptoKeyRSA::importSpki(parameters.identifier, WTF::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages); > break; > } > case CryptoKeyFormat::Pkcs8: { >@@ -128,7 +128,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData& > exceptionCallback(SyntaxError); > return; > } >- result = CryptoKeyRSA::importPkcs8(parameters.identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages); >+ result = CryptoKeyRSA::importPkcs8(parameters.identifier, WTF::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages); > break; > } > default: >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp >index ebe2b384c3691b71a19e6a96d8b270e584d62ebc..58c2106c73eda6ed7f602464ad3847843de8a69b 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp >@@ -36,33 +36,33 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, Vector<uint8_t>&& plainText) >+static WTF::Optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, Vector<uint8_t>&& plainText) > { > // Determine the AES algorithm for the given key size. > auto algorithm = PAL::GCrypt::aesAlgorithmForKeySize(key.size() * 8); > if (!algorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Create a new GCrypt cipher object for the AES algorithm and the CBC cipher mode. > PAL::GCrypt::Handle<gcry_cipher_hd_t> handle; > gcry_error_t error = gcry_cipher_open(&handle, *algorithm, GCRY_CIPHER_MODE_CBC, 0); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given key for this cipher object. > error = gcry_cipher_setkey(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given IV for this cipher object. > error = gcry_cipher_setiv(handle, iv.data(), iv.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the PKCS#7 padding. >@@ -74,7 +74,7 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > // Padded size should be bigger than size, but bail if the value doesn't fit into a byte. > ASSERT(paddedSize > size); > if (paddedSize - size > 255) >- return std::nullopt; >+ return WTF::nullopt; > uint8_t paddingValue = paddedSize - size; > > plainText.grow(paddedSize); >@@ -85,7 +85,7 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > error = gcry_cipher_final(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Perform the encryption and retrieve the encrypted output. >@@ -93,46 +93,46 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > error = gcry_cipher_encrypt(handle, output.data(), output.size(), plainText.data(), plainText.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return output; > } > >-static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, const Vector<uint8_t>& cipherText) >+static WTF::Optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, const Vector<uint8_t>& cipherText) > { > // Determine the AES algorithm for the given key size. > auto algorithm = PAL::GCrypt::aesAlgorithmForKeySize(key.size() * 8); > if (!algorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Create a new GCrypt cipher object for the AES algorithm and the CBC cipher mode. > PAL::GCrypt::Handle<gcry_cipher_hd_t> handle; > gcry_error_t error = gcry_cipher_open(&handle, *algorithm, GCRY_CIPHER_MODE_CBC, 0); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given key for this cipher object. > error = gcry_cipher_setkey(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given IV for this cipher object. > error = gcry_cipher_setiv(handle, iv.data(), iv.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Finalize the cipher object before performing the decryption. > error = gcry_cipher_final(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Perform the decryption and retrieve the decrypted output. >@@ -140,7 +140,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, > error = gcry_cipher_decrypt(handle, output.data(), output.size(), cipherText.data(), cipherText.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Remove the PKCS#7 padding from the decrypted output. >@@ -148,16 +148,16 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, > // The padding value can be retrieved from the last byte. > uint8_t paddingValue = output.last(); > if (paddingValue > gcry_cipher_get_algo_blklen(*algorithm)) >- return std::nullopt; >+ return WTF::nullopt; > > // Padding value mustn't be greater than the size of the padded output. > size_t size = output.size(); > if (paddingValue > size) >- return std::nullopt; >+ return WTF::nullopt; > > // Bail if the last `paddingValue` bytes don't have the value of `paddingValue`. > if (std::count(output.end() - paddingValue, output.end(), paddingValue) != paddingValue) >- return std::nullopt; >+ return WTF::nullopt; > > // Shrink the output Vector object to drop the PKCS#7 padding. > output.shrink(size - paddingValue); >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp >index 22c129965aadcd02c67b8c8cea1a082bc4a8a070..a4c984ea23d53d7aff376af1d908be0841406e5d 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp >@@ -39,42 +39,42 @@ namespace WebCore { > > // This is a helper function that resets the cipher object, sets the provided counter data, > // and executes the encrypt or decrypt operation, retrieving and returning the output data. >-static std::optional<Vector<uint8_t>> callOperation(PAL::GCrypt::CipherOperation operation, gcry_cipher_hd_t handle, const Vector<uint8_t>& counter, const uint8_t* data, const size_t size) >+static WTF::Optional<Vector<uint8_t>> callOperation(PAL::GCrypt::CipherOperation operation, gcry_cipher_hd_t handle, const Vector<uint8_t>& counter, const uint8_t* data, const size_t size) > { > gcry_error_t error = gcry_cipher_reset(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > error = gcry_cipher_setctr(handle, counter.data(), counter.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > error = gcry_cipher_final(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > Vector<uint8_t> output(size); > error = operation(handle, output.data(), output.size(), data, size); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return output; > } > >-static std::optional<Vector<uint8_t>> gcryptAES_CTR(PAL::GCrypt::CipherOperation operation, const Vector<uint8_t>& key, const Vector<uint8_t>& counter, size_t counterLength, const Vector<uint8_t>& inputText) >+static WTF::Optional<Vector<uint8_t>> gcryptAES_CTR(PAL::GCrypt::CipherOperation operation, const Vector<uint8_t>& key, const Vector<uint8_t>& counter, size_t counterLength, const Vector<uint8_t>& inputText) > { > constexpr size_t blockSize = 16; > auto algorithm = PAL::GCrypt::aesAlgorithmForKeySize(key.size() * 8); > if (!algorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Construct the libgcrypt cipher object and attach the key to it. Key information on this > // cipher object will live through any gcry_cipher_reset() calls. >@@ -82,13 +82,13 @@ static std::optional<Vector<uint8_t>> gcryptAES_CTR(PAL::GCrypt::CipherOperation > gcry_error_t error = gcry_cipher_open(&handle, *algorithm, GCRY_CIPHER_MODE_CTR, 0); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > error = gcry_cipher_setkey(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Calculate the block count: ((inputText.size() + blockSize - 1) / blockSize), remainder discarded. >@@ -111,7 +111,7 @@ static std::optional<Vector<uint8_t>> gcryptAES_CTR(PAL::GCrypt::CipherOperation > // the number of unique counter values we could produce for the specified counter > // length) is lower than the deduced block count, we bail. > if (gcry_mpi_cmp(counterLimitMPI, blockCountMPI) < 0) >- return std::nullopt; >+ return WTF::nullopt; > > // If the counter length, in bits, matches the size of the counter data, we don't have to > // use any part of the counter Vector<> as nonce. This allows us to directly encrypt or >@@ -125,7 +125,7 @@ static std::optional<Vector<uint8_t>> gcryptAES_CTR(PAL::GCrypt::CipherOperation > error = gcry_mpi_scan(&counterDataMPI, GCRYMPI_FMT_USG, counter.data(), counter.size(), nullptr); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Extract the counter MPI from the counterDataMPI: (counterDataMPI % counterLimitMPI). >@@ -175,14 +175,14 @@ static std::optional<Vector<uint8_t>> gcryptAES_CTR(PAL::GCrypt::CipherOperation > error = gcry_mpi_print(GCRYMPI_FMT_USG, blockCounterData.data(), blockCounterData.size(), nullptr, blockCounterMPI); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Encrypt/decrypt this single block with the block-specific counter. Output for this > // single block is appended to the general output vector. > auto blockOutput = callOperation(operation, handle, blockCounterData, inputText.data() + i, blockInputSize); > if (!blockOutput) >- return std::nullopt; >+ return WTF::nullopt; > > output.appendVector(*blockOutput); > >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp >index 7dd00508cbb083cfe01372f0eb1c3c8b2bc5a70c..286d531565020364826dc6ef535c43730464d4c4 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp >@@ -39,33 +39,33 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, const Vector<uint8_t>& plainText, const Vector<uint8_t>& additionalData, uint8_t tagLength) >+static WTF::Optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, const Vector<uint8_t>& plainText, const Vector<uint8_t>& additionalData, uint8_t tagLength) > { > // Determine the AES algorithm for the given key size. > auto algorithm = PAL::GCrypt::aesAlgorithmForKeySize(key.size() * 8); > if (!algorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Create a new GCrypt cipher object for the AES algorithm and the GCM cipher mode. > PAL::GCrypt::Handle<gcry_cipher_hd_t> handle; > gcry_error_t error = gcry_cipher_open(&handle, *algorithm, GCRY_CIPHER_MODE_GCM, GCRY_CIPHER_SECURE); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given key for this cipher object. > error = gcry_cipher_setkey(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given IV for this cipher object. > error = gcry_cipher_setiv(handle, iv.data(), iv.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given additonal data, if any, as the authentication data for this cipher object. >@@ -73,7 +73,7 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > error = gcry_cipher_authenticate(handle, additionalData.data(), additionalData.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -81,7 +81,7 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > error = gcry_cipher_final(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Perform the encryption and retrieve the encrypted output. >@@ -89,7 +89,7 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > error = gcry_cipher_encrypt(handle, output.data(), output.size(), plainText.data(), plainText.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // If tag length was specified, retrieve the tag data and append it to the output vector. >@@ -98,7 +98,7 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > error = gcry_cipher_gettag(handle, tag.data(), tag.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > output.appendVector(tag); >@@ -107,33 +107,33 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(const Vector<uint8_t>& key, > return output; > } > >-static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, const Vector<uint8_t>& cipherText, const Vector<uint8_t>& additionalData, uint8_t tagLength) >+static WTF::Optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, const Vector<uint8_t>& iv, const Vector<uint8_t>& cipherText, const Vector<uint8_t>& additionalData, uint8_t tagLength) > { > // Determine the AES algorithm for the given key size. > auto algorithm = PAL::GCrypt::aesAlgorithmForKeySize(key.size() * 8); > if (!algorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Create a new GCrypt cipher object for the AES algorithm and the GCM cipher mode. > PAL::GCrypt::Handle<gcry_cipher_hd_t> handle; > gcry_error_t error = gcry_cipher_open(&handle, *algorithm, GCRY_CIPHER_MODE_GCM, 0); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given key for this cipher object. > error = gcry_cipher_setkey(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given IV for this cipher object. > error = gcry_cipher_setiv(handle, iv.data(), iv.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given additonal data, if any, as the authentication data for this cipher object. >@@ -141,7 +141,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, > error = gcry_cipher_authenticate(handle, additionalData.data(), additionalData.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -149,7 +149,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, > error = gcry_cipher_final(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Account for the specified tag length when performing the decryption and retrieving the decrypted output. >@@ -158,7 +158,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, > error = gcry_cipher_decrypt(handle, output.data(), output.size(), cipherText.data(), cipherLength); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // If tag length was indeed specified, retrieve the tag data and compare it securely to the tag data that >@@ -169,11 +169,11 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key, > error = gcry_cipher_gettag(handle, tag.data(), tagLength); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > if (constantTimeMemcmp(tag.data(), cipherText.data() + cipherLength, tagLength)) >- return std::nullopt; >+ return WTF::nullopt; > } > > return output; >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp >index 6af2f71c06e69553e4ab69651fea4ad352b1eb4a..9201aa9f7a4b98ed67ed28e62c6ecfbad58d1112 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp >@@ -35,33 +35,33 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptWrapKey(const Vector<uint8_t>& key, const Vector<uint8_t>& data) >+static WTF::Optional<Vector<uint8_t>> gcryptWrapKey(const Vector<uint8_t>& key, const Vector<uint8_t>& data) > { > // Determine the AES algorithm for the given key size. > auto algorithm = PAL::GCrypt::aesAlgorithmForKeySize(key.size() * 8); > if (!algorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Create a new GCrypt cipher object for the AES algorithm and the AES-Wrap cipher mode. > PAL::GCrypt::Handle<gcry_cipher_hd_t> handle; > gcry_error_t error = gcry_cipher_open(&handle, *algorithm, GCRY_CIPHER_MODE_AESWRAP, 0); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given key for this cipher object. > error = gcry_cipher_setkey(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Finalize the cipher object before performing the encryption. > error = gcry_cipher_final(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Perform the encryption. The provided output buffer must be 64 bits larger than the input buffer. >@@ -69,39 +69,39 @@ static std::optional<Vector<uint8_t>> gcryptWrapKey(const Vector<uint8_t>& key, > error = gcry_cipher_encrypt(handle, output.data(), output.size(), data.data(), data.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return output; > } > >-static std::optional<Vector<uint8_t>> gcryptUnwrapKey(const Vector<uint8_t>& key, const Vector<uint8_t>& data) >+static WTF::Optional<Vector<uint8_t>> gcryptUnwrapKey(const Vector<uint8_t>& key, const Vector<uint8_t>& data) > { > // Determine the AES algorithm for the given key size. > auto algorithm = PAL::GCrypt::aesAlgorithmForKeySize(key.size() * 8); > if (!algorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Create a new GCrypt cipher object for the AES algorithm and the AES-Wrap cipher mode. > PAL::GCrypt::Handle<gcry_cipher_hd_t> handle; > gcry_error_t error = gcry_cipher_open(&handle, *algorithm, GCRY_CIPHER_MODE_AESWRAP, 0); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Use the given key for this cipher object. > error = gcry_cipher_setkey(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Finalize the cipher object before performing the encryption. > error = gcry_cipher_final(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Perform the decryption. The output buffer may be specified 64 bits shorter than the input buffer. >@@ -109,7 +109,7 @@ static std::optional<Vector<uint8_t>> gcryptUnwrapKey(const Vector<uint8_t>& key > error = gcry_cipher_decrypt(handle, output.data(), output.size(), data.data(), data.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return output; >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp >index 498e6216833b54e2dfef0a963354eb3ee7c10e17..01296937bef3bd3021091eb281d2ce9ff1bc226a 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp >@@ -37,7 +37,7 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptDerive(gcry_sexp_t baseKeySexp, gcry_sexp_t publicKeySexp, size_t keySizeInBytes) >+static WTF::Optional<Vector<uint8_t>> gcryptDerive(gcry_sexp_t baseKeySexp, gcry_sexp_t publicKeySexp, size_t keySizeInBytes) > { > // First, retrieve private key data, which is roughly of the following form: > // (private-key >@@ -48,15 +48,15 @@ static std::optional<Vector<uint8_t>> gcryptDerive(gcry_sexp_t baseKeySexp, gcry > { > PAL::GCrypt::Handle<gcry_sexp_t> dSexp(gcry_sexp_find_token(baseKeySexp, "d", 0)); > if (!dSexp) >- return std::nullopt; >+ return WTF::nullopt; > > auto data = mpiData(dSexp); > if (!data) >- return std::nullopt; >+ return WTF::nullopt; > > gcry_sexp_build(&dataSexp, nullptr, "(data(flags raw)(value %b))", data->size(), data->data()); > if (!dataSexp) >- return std::nullopt; >+ return WTF::nullopt; > } > > // Encrypt the data s-expression with the public key. >@@ -64,7 +64,7 @@ static std::optional<Vector<uint8_t>> gcryptDerive(gcry_sexp_t baseKeySexp, gcry > gcry_error_t error = gcry_pk_encrypt(&cipherSexp, dataSexp, publicKeySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Retrieve the shared point value from the generated s-expression, which is of the following form: >@@ -74,24 +74,24 @@ static std::optional<Vector<uint8_t>> gcryptDerive(gcry_sexp_t baseKeySexp, gcry > // (e ...))) > PAL::GCrypt::Handle<gcry_mpi_t> xMPI(gcry_mpi_new(0)); > if (!xMPI) >- return std::nullopt; >+ return WTF::nullopt; > > { > PAL::GCrypt::Handle<gcry_sexp_t> sSexp(gcry_sexp_find_token(cipherSexp, "s", 0)); > if (!sSexp) >- return std::nullopt; >+ return WTF::nullopt; > > PAL::GCrypt::Handle<gcry_mpi_t> sMPI(gcry_sexp_nth_mpi(sSexp, 1, GCRYMPI_FMT_USG)); > if (!sMPI) >- return std::nullopt; >+ return WTF::nullopt; > > PAL::GCrypt::Handle<gcry_mpi_point_t> point(gcry_mpi_point_new(0)); > if (!point) >- return std::nullopt; >+ return WTF::nullopt; > > error = gcry_mpi_ec_decode_point(point, sMPI, nullptr); > if (error != GPG_ERR_NO_ERROR) >- return std::nullopt; >+ return WTF::nullopt; > > // We're only interested in the x-coordinate. > gcry_mpi_point_snatch_get(xMPI, nullptr, nullptr, point.release()); >@@ -100,7 +100,7 @@ static std::optional<Vector<uint8_t>> gcryptDerive(gcry_sexp_t baseKeySexp, gcry > return mpiZeroPrefixedData(xMPI, keySizeInBytes); > } > >-std::optional<Vector<uint8_t>> CryptoAlgorithmECDH::platformDeriveBits(const CryptoKeyEC& baseKey, const CryptoKeyEC& publicKey) >+WTF::Optional<Vector<uint8_t>> CryptoAlgorithmECDH::platformDeriveBits(const CryptoKeyEC& baseKey, const CryptoKeyEC& publicKey) > { > return gcryptDerive(baseKey.platformKey(), publicKey.platformKey(), (baseKey.keySizeInBits() + 7) / 8); > } >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp >index 8f589fc6c35bfaf160be0ba1073b0b1e76be9084..fd3dc433baaee14058b5751f890775544dda5e68 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp >@@ -62,18 +62,18 @@ static bool extractECDSASignatureInteger(Vector<uint8_t>& signature, gcry_sexp_t > return true; > } > >-static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t keySizeInBytes) >+static WTF::Optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t keySizeInBytes) > { > // Perform digest operation with the specified algorithm on the given data. > Vector<uint8_t> dataHash; > { > auto digestAlgorithm = hashCryptoDigestAlgorithm(hashAlgorithmIdentifier); > if (!digestAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > auto digest = PAL::CryptoDigest::create(*digestAlgorithm); > if (!digest) >- return std::nullopt; >+ return WTF::nullopt; > > digest->addBytes(data.data(), data.size()); > dataHash = digest->computeHash(); >@@ -84,13 +84,13 @@ static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vect > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > gcry_error_t error = gcry_sexp_build(&dataSexp, nullptr, "(data(flags raw)(hash %s %b))", > *shaAlgorithm, dataHash.size(), dataHash.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -103,7 +103,7 @@ static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vect > gcry_error_t error = gcry_pk_sign(&signatureSexp, dataSexp, keySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Retrieve MPI data of the resulting r and s integers. They are concatenated into >@@ -113,12 +113,12 @@ static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vect > > if (!extractECDSASignatureInteger(signature, signatureSexp, "r", keySizeInBytes) > || !extractECDSASignatureInteger(signature, signatureSexp, "s", keySizeInBytes)) >- return std::nullopt; >+ return WTF::nullopt; > > return signature; > } > >-static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_t>& signature, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t keySizeInBytes) >+static WTF::Optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_t>& signature, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t keySizeInBytes) > { > // Bail if the signature size isn't double the key size (i.e. concatenated r and s components). > if (signature.size() != keySizeInBytes * 2) >@@ -129,11 +129,11 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_ > { > auto digestAlgorithm = hashCryptoDigestAlgorithm(hashAlgorithmIdentifier); > if (!digestAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > auto digest = PAL::CryptoDigest::create(*digestAlgorithm); > if (!digest) >- return std::nullopt; >+ return WTF::nullopt; > > digest->addBytes(data.data(), data.size()); > dataHash = digest->computeHash(); >@@ -145,7 +145,7 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_ > keySizeInBytes, signature.data(), keySizeInBytes, signature.data() + keySizeInBytes); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Construct the data s-expression that contains raw hashed data. >@@ -153,13 +153,13 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_ > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > error = gcry_sexp_build(&dataSexp, nullptr, "(data(flags raw)(hash %s %b))", > *shaAlgorithm, dataHash.size(), dataHash.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp >index f2e61710a20f9333c39e684bec91052f9506ca42..bb5cd7e8c9637425f6e33570a77e12ad8af2ef14 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp >@@ -40,7 +40,7 @@ namespace WebCore { > // We should switch to the libgcrypt-provided implementation once it's available. > // https://bugs.webkit.org/show_bug.cgi?id=171536 > >-static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& key, const Vector<uint8_t>& salt, const Vector<uint8_t>& info, size_t lengthInBytes, CryptoAlgorithmIdentifier identifier) >+static WTF::Optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& key, const Vector<uint8_t>& salt, const Vector<uint8_t>& info, size_t lengthInBytes, CryptoAlgorithmIdentifier identifier) > { > // libgcrypt doesn't provide HKDF support, so we have to implement > // the functionality ourselves as specified in RFC5869. >@@ -48,18 +48,18 @@ static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& ke > > auto macAlgorithm = hmacAlgorithm(identifier); > if (!macAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // We can immediately discard invalid output lengths, otherwise needed for the expand step. > size_t macLength = gcry_mac_get_algo_maclen(*macAlgorithm); > if (lengthInBytes > macLength * 255) >- return std::nullopt; >+ return WTF::nullopt; > > PAL::GCrypt::Handle<gcry_mac_hd_t> handle; > gcry_error_t error = gcry_mac_open(&handle, *macAlgorithm, 0, nullptr); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Step 1 -- Extract. A pseudo-random key is generated with the specified algorithm >@@ -74,25 +74,25 @@ static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& ke > error = gcry_mac_setkey(handle, salt.data(), salt.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > error = gcry_mac_write(handle, key.data(), key.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > size_t pseudoRandomKeySize = pseudoRandomKey.size(); > error = gcry_mac_read(handle, pseudoRandomKey.data(), &pseudoRandomKeySize); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Something went wrong if libgcrypt didn't write out the proper amount of data. > if (pseudoRandomKeySize != macLength) >- return std::nullopt; >+ return WTF::nullopt; > } > > // Step #2 -- Expand. >@@ -108,13 +108,13 @@ static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& ke > error = gcry_mac_reset(handle); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > error = gcry_mac_setkey(handle, pseudoRandomKey.data(), pseudoRandomKey.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // T(0) = empty string (zero length) -- i.e. empty lastBlock >@@ -128,19 +128,19 @@ static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& ke > error = gcry_mac_write(handle, blockData.data(), blockData.size()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > size_t blockSize = lastBlock.size(); > error = gcry_mac_read(handle, lastBlock.data(), &blockSize); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Something went wrong if libgcrypt didn't write out the proper amount of data. > if (blockSize != lastBlock.size()) >- return std::nullopt; >+ return WTF::nullopt; > > // Append the current block data to the output vector. > output.appendVector(lastBlock); >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp >index 4b52095298dd8234afbc63a9692aa69ab67a8758..5341f7049637625c226d35ffeb4dd73824bae0ca 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp >@@ -55,28 +55,28 @@ static int getGCryptDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction) > } > } > >-static std::optional<Vector<uint8_t>> calculateSignature(int algorithm, const Vector<uint8_t>& key, const uint8_t* data, size_t dataLength) >+static WTF::Optional<Vector<uint8_t>> calculateSignature(int algorithm, const Vector<uint8_t>& key, const uint8_t* data, size_t dataLength) > { > const void* keyData = key.data() ? key.data() : reinterpret_cast<const uint8_t*>(""); > > PAL::GCrypt::Handle<gcry_mac_hd_t> hd; > gcry_error_t err = gcry_mac_open(&hd, algorithm, 0, nullptr); > if (err) >- return std::nullopt; >+ return WTF::nullopt; > > err = gcry_mac_setkey(hd, keyData, key.size()); > if (err) >- return std::nullopt; >+ return WTF::nullopt; > > err = gcry_mac_write(hd, data, dataLength); > if (err) >- return std::nullopt; >+ return WTF::nullopt; > > size_t digestLength = gcry_mac_get_algo_maclen(algorithm); > Vector<uint8_t> signature(digestLength); > err = gcry_mac_read(hd, signature.data(), &digestLength); > if (err) >- return std::nullopt; >+ return WTF::nullopt; > > signature.resize(digestLength); > return WTFMove(signature); >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp >index 66edfbd81998f17e0c28578b1d4eeb35bf71c900..76184922d0f4434f935846148659dc97806ea4d2 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp >@@ -36,12 +36,12 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& keyData, const Vector<uint8_t>& saltData, CryptoAlgorithmIdentifier hashIdentifier, size_t iterations, size_t length) >+static WTF::Optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& keyData, const Vector<uint8_t>& saltData, CryptoAlgorithmIdentifier hashIdentifier, size_t iterations, size_t length) > { > // Determine the hash algorithm that will be used for derivation. > auto hashAlgorithm = digestAlgorithm(hashIdentifier); > if (!hashAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > // Length, in bits, is a multiple of 8, as guaranteed by CryptoAlgorithmPBKDF2::deriveBits(). > ASSERT(!(length % 8)); >@@ -51,7 +51,7 @@ static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& ke > gcry_error_t error = gcry_kdf_derive(keyData.data(), keyData.size(), GCRY_KDF_PBKDF2, *hashAlgorithm, saltData.data(), saltData.size(), iterations, result.size(), result.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return result; >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp >index 0e4e2de719f2759d55f5c95f358845e62893a82f..ecd263bbc4368522d0ec6b46fba92e99d96aeec2 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp >@@ -33,7 +33,7 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptEncrypt(gcry_sexp_t keySexp, const Vector<uint8_t>& plainText, size_t keySizeInBytes) >+static WTF::Optional<Vector<uint8_t>> gcryptEncrypt(gcry_sexp_t keySexp, const Vector<uint8_t>& plainText, size_t keySizeInBytes) > { > // Embed the plain-text data in a `data` s-expression using PKCS#1 padding. > PAL::GCrypt::Handle<gcry_sexp_t> dataSexp; >@@ -41,7 +41,7 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(gcry_sexp_t keySexp, const V > plainText.size(), plainText.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Encrypt data with the provided key. The returned s-expression is of this form: >@@ -52,18 +52,18 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(gcry_sexp_t keySexp, const V > error = gcry_pk_encrypt(&cipherSexp, dataSexp, keySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Return MPI data of the embedded `a` integer. > PAL::GCrypt::Handle<gcry_sexp_t> aSexp(gcry_sexp_find_token(cipherSexp, "a", 0)); > if (!aSexp) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiZeroPrefixedData(aSexp, keySizeInBytes); > } > >-static std::optional<Vector<uint8_t>> gcryptDecrypt(gcry_sexp_t keySexp, const Vector<uint8_t>& cipherText) >+static WTF::Optional<Vector<uint8_t>> gcryptDecrypt(gcry_sexp_t keySexp, const Vector<uint8_t>& cipherText) > { > // Embed the cipher-text data in an `enc-val` s-expression using PKCS#1 padding. > PAL::GCrypt::Handle<gcry_sexp_t> encValSexp; >@@ -71,7 +71,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(gcry_sexp_t keySexp, const V > cipherText.size(), cipherText.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Decrypt data with the provided key. The returned s-expression is of this form: >@@ -82,13 +82,13 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(gcry_sexp_t keySexp, const V > error = gcry_pk_decrypt(&plainSexp, encValSexp, keySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Return MPI data of the embedded `value` integer. > PAL::GCrypt::Handle<gcry_sexp_t> valueSexp(gcry_sexp_find_token(plainSexp, "value", 0)); > if (!valueSexp) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiData(valueSexp); > } >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp >index be6aa86f80793594f81196b4448a6e10a124dca2..9ba7c2352bb0e849c92014b3d59b71a91ec4eafe 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp >@@ -35,18 +35,18 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t keySizeInBytes) >+static WTF::Optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t keySizeInBytes) > { > // Perform digest operation with the specified algorithm on the given data. > Vector<uint8_t> dataHash; > { > auto digestAlgorithm = hashCryptoDigestAlgorithm(hashAlgorithmIdentifier); > if (!digestAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > auto digest = PAL::CryptoDigest::create(*digestAlgorithm); > if (!digest) >- return std::nullopt; >+ return WTF::nullopt; > > digest->addBytes(data.data(), data.size()); > dataHash = digest->computeHash(); >@@ -57,13 +57,13 @@ static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vect > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > gcry_error_t error = gcry_sexp_build(&dataSexp, nullptr, "(data(flags pkcs1)(hash %s %b))", > *shaAlgorithm, dataHash.size(), dataHash.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -75,29 +75,29 @@ static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vect > gcry_error_t error = gcry_pk_sign(&signatureSexp, dataSexp, keySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Return MPI data of the embedded s integer. > PAL::GCrypt::Handle<gcry_sexp_t> sSexp(gcry_sexp_find_token(signatureSexp, "s", 0)); > if (!sSexp) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiZeroPrefixedData(sSexp, keySizeInBytes); > } > >-static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_t>& signature, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier) >+static WTF::Optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_t>& signature, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier) > { > // Perform digest operation with the specified algorithm on the given data. > Vector<uint8_t> dataHash; > { > auto digestAlgorithm = hashCryptoDigestAlgorithm(hashAlgorithmIdentifier); > if (!digestAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > auto digest = PAL::CryptoDigest::create(*digestAlgorithm); > if (!digest) >- return std::nullopt; >+ return WTF::nullopt; > > digest->addBytes(data.data(), data.size()); > dataHash = digest->computeHash(); >@@ -109,7 +109,7 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_ > signature.size(), signature.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Construct the data s-expression that contains PKCS#1-padded hashed data. >@@ -117,13 +117,13 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_ > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > error = gcry_sexp_build(&dataSexp, nullptr, "(data(flags pkcs1)(hash %s %b))", > *shaAlgorithm, dataHash.size(), dataHash.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp >index 87c56c0673156903fa4507429be0604fd618e5b7..2b4be6180de6745a34bb2fcc1b478e12be0a19fd 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp >@@ -35,7 +35,7 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptEncrypt(CryptoAlgorithmIdentifier hashAlgorithmIdentifier, gcry_sexp_t keySexp, const Vector<uint8_t>& labelVector, const Vector<uint8_t>& plainText, size_t keySizeInBytes) >+static WTF::Optional<Vector<uint8_t>> gcryptEncrypt(CryptoAlgorithmIdentifier hashAlgorithmIdentifier, gcry_sexp_t keySexp, const Vector<uint8_t>& labelVector, const Vector<uint8_t>& plainText, size_t keySizeInBytes) > { > // Embed the plain-text data in a data s-expression using OAEP padding. > // Empty label data is properly handled by gcry_sexp_build(). >@@ -43,13 +43,13 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(CryptoAlgorithmIdentifier ha > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > gcry_error_t error = gcry_sexp_build(&dataSexp, nullptr, "(data(flags oaep)(hash-algo %s)(label %b)(value %b))", > *shaAlgorithm, labelVector.size(), labelVector.data(), plainText.size(), plainText.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -62,18 +62,18 @@ static std::optional<Vector<uint8_t>> gcryptEncrypt(CryptoAlgorithmIdentifier ha > gcry_error_t error = gcry_pk_encrypt(&cipherSexp, dataSexp, keySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Return MPI data of the embedded a integer. > PAL::GCrypt::Handle<gcry_sexp_t> aSexp(gcry_sexp_find_token(cipherSexp, "a", 0)); > if (!aSexp) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiZeroPrefixedData(aSexp, keySizeInBytes); > } > >-static std::optional<Vector<uint8_t>> gcryptDecrypt(CryptoAlgorithmIdentifier hashAlgorithmIdentifier, gcry_sexp_t keySexp, const Vector<uint8_t>& labelVector, const Vector<uint8_t>& cipherText) >+static WTF::Optional<Vector<uint8_t>> gcryptDecrypt(CryptoAlgorithmIdentifier hashAlgorithmIdentifier, gcry_sexp_t keySexp, const Vector<uint8_t>& labelVector, const Vector<uint8_t>& cipherText) > { > // Embed the cipher-text data in an enc-val s-expression using OAEP padding. > // Empty label data is properly handled by gcry_sexp_build(). >@@ -81,13 +81,13 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(CryptoAlgorithmIdentifier ha > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > gcry_error_t error = gcry_sexp_build(&encValSexp, nullptr, "(enc-val(flags oaep)(hash-algo %s)(label %b)(rsa(a %b)))", > *shaAlgorithm, labelVector.size(), labelVector.data(), cipherText.size(), cipherText.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -99,13 +99,13 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(CryptoAlgorithmIdentifier ha > gcry_error_t error = gcry_pk_decrypt(&plainSexp, encValSexp, keySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Return MPI data of the embedded value integer. > PAL::GCrypt::Handle<gcry_sexp_t> valueSexp(gcry_sexp_find_token(plainSexp, "value", 0)); > if (!valueSexp) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiData(valueSexp); > } >diff --git a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp >index fe1618a745743bb50e988b89f732e978fe7e4c14..58c1d296a46411eb3231cbd410defff1d0ad4278 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp >@@ -36,18 +36,18 @@ > > namespace WebCore { > >-static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t saltLength, size_t keySizeInBytes) >+static WTF::Optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t saltLength, size_t keySizeInBytes) > { > // Perform digest operation with the specified algorithm on the given data. > Vector<uint8_t> dataHash; > { > auto digestAlgorithm = hashCryptoDigestAlgorithm(hashAlgorithmIdentifier); > if (!digestAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > auto digest = PAL::CryptoDigest::create(*digestAlgorithm); > if (!digest) >- return std::nullopt; >+ return WTF::nullopt; > > digest->addBytes(data.data(), data.size()); > dataHash = digest->computeHash(); >@@ -58,13 +58,13 @@ static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vect > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > gcry_error_t error = gcry_sexp_build(&dataSexp, nullptr, "(data(flags pss)(salt-length %u)(hash %s %b))", > saltLength, *shaAlgorithm, dataHash.size(), dataHash.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -76,29 +76,29 @@ static std::optional<Vector<uint8_t>> gcryptSign(gcry_sexp_t keySexp, const Vect > gcry_error_t error = gcry_pk_sign(&signatureSexp, dataSexp, keySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Retrieve MPI data of the embedded `s` integer. > PAL::GCrypt::Handle<gcry_sexp_t> sSexp(gcry_sexp_find_token(signatureSexp, "s", 0)); > if (!sSexp) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiZeroPrefixedData(sSexp, keySizeInBytes); > } > >-static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_t>& signature, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t saltLength) >+static WTF::Optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_t>& signature, const Vector<uint8_t>& data, CryptoAlgorithmIdentifier hashAlgorithmIdentifier, size_t saltLength) > { > // Perform digest operation with the specified algorithm on the given data. > Vector<uint8_t> dataHash; > { > auto digestAlgorithm = hashCryptoDigestAlgorithm(hashAlgorithmIdentifier); > if (!digestAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > auto digest = PAL::CryptoDigest::create(*digestAlgorithm); > if (!digest) >- return std::nullopt; >+ return WTF::nullopt; > > digest->addBytes(data.data(), data.size()); > dataHash = digest->computeHash(); >@@ -110,7 +110,7 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_ > signature.size(), signature.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > // Construct the `data` s-expression that contains PSS-padded hashed data. >@@ -118,13 +118,13 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_ > { > auto shaAlgorithm = hashAlgorithmName(hashAlgorithmIdentifier); > if (!shaAlgorithm) >- return std::nullopt; >+ return WTF::nullopt; > > error = gcry_sexp_build(&dataSexp, nullptr, "(data(flags pss)(salt-length %u)(hash %s %b))", > saltLength, *shaAlgorithm, dataHash.size(), dataHash.data()); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp >index 798eacea326613f00649331d78617006f113e096..48c6dc62e1c0e0466ebefcedae71709e6f8b77b9 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp >@@ -121,26 +121,26 @@ bool CryptoKeyEC::platformSupportedCurve(NamedCurve curve) > return curve == NamedCurve::P256 || curve == NamedCurve::P384 || curve == NamedCurve::P521; > } > >-std::optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier identifier, NamedCurve curve, bool extractable, CryptoKeyUsageBitmap usages) >+WTF::Optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier identifier, NamedCurve curve, bool extractable, CryptoKeyUsageBitmap usages) > { > PAL::GCrypt::Handle<gcry_sexp_t> genkeySexp; > gcry_error_t error = gcry_sexp_build(&genkeySexp, nullptr, "(genkey(ecc(curve %s)))", curveName(curve)); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > PAL::GCrypt::Handle<gcry_sexp_t> keyPairSexp; > error = gcry_pk_genkey(&keyPairSexp, genkeySexp); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > PAL::GCrypt::Handle<gcry_sexp_t> publicKeySexp(gcry_sexp_find_token(keyPairSexp, "public-key", 0)); > PAL::GCrypt::Handle<gcry_sexp_t> privateKeySexp(gcry_sexp_find_token(keyPairSexp, "private-key", 0)); > if (!publicKeySexp || !privateKeySexp) >- return std::nullopt; >+ return WTF::nullopt; > > auto publicKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Public, publicKeySexp.release(), true, usages); > auto privateKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Private, privateKeySexp.release(), extractable, usages); >@@ -237,7 +237,7 @@ static bool supportedAlgorithmIdentifier(CryptoAlgorithmIdentifier keyIdentifier > return false; > } > >-static std::optional<CryptoKeyEC::NamedCurve> curveForIdentifier(const Vector<uint8_t>& identifier) >+static WTF::Optional<CryptoKeyEC::NamedCurve> curveForIdentifier(const Vector<uint8_t>& identifier) > { > auto* data = identifier.data(); > auto size = identifier.size(); >@@ -249,7 +249,7 @@ static std::optional<CryptoKeyEC::NamedCurve> curveForIdentifier(const Vector<ui > if (CryptoConstants::matches(data, size, CryptoConstants::s_secp521r1Identifier)) > return CryptoKeyEC::NamedCurve::P521; > >- return std::nullopt; >+ return WTF::nullopt; > } > > RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportSpki(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) >diff --git a/Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp b/Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp >index 3e109ff5e076d6d6b6e75733929810d01f17c3d2..c4cfd0bb6f79913c0aba99204296c454afd559de 100644 >--- a/Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp >+++ b/Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp >@@ -177,11 +177,11 @@ size_t CryptoKeyRSA::keySizeInBits() const > } > > // Convert the exponent vector to a 32-bit value, if possible. >-static std::optional<uint32_t> exponentVectorToUInt32(const Vector<uint8_t>& exponent) >+static WTF::Optional<uint32_t> exponentVectorToUInt32(const Vector<uint8_t>& exponent) > { > if (exponent.size() > 4) { > if (std::any_of(exponent.begin(), exponent.end() - 4, [](uint8_t element) { return !!element; })) >- return std::nullopt; >+ return WTF::nullopt; > } > > uint32_t result = 0; >@@ -269,7 +269,7 @@ static bool supportedAlgorithmIdentifier(const uint8_t* data, size_t size) > return false; > } > >-RefPtr<CryptoKeyRSA> CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) >+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifier, WTF::Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) > { > // Decode the `SubjectPublicKeyInfo` structure using the provided key data. > PAL::TASN1::Structure spki; >@@ -316,7 +316,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifi > return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Public, platformKey.release(), extractable, usages)); > } > >-RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) >+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identifier, WTF::Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) > { > // Decode the `PrivateKeyInfo` structure using the provided key data. > PAL::TASN1::Structure pkcs8; >diff --git a/Source/WebCore/crypto/gcrypt/GCryptUtilities.cpp b/Source/WebCore/crypto/gcrypt/GCryptUtilities.cpp >index 092eef7da467ebc4f30ebcc5026d49900104e9a3..f1c94903bc5495dc4d01d6993aba3c7200317e72 100644 >--- a/Source/WebCore/crypto/gcrypt/GCryptUtilities.cpp >+++ b/Source/WebCore/crypto/gcrypt/GCryptUtilities.cpp >@@ -30,7 +30,7 @@ > > namespace WebCore { > >-std::optional<const char*> hashAlgorithmName(CryptoAlgorithmIdentifier identifier) >+WTF::Optional<const char*> hashAlgorithmName(CryptoAlgorithmIdentifier identifier) > { > switch (identifier) { > case CryptoAlgorithmIdentifier::SHA_1: >@@ -44,11 +44,11 @@ std::optional<const char*> hashAlgorithmName(CryptoAlgorithmIdentifier identifie > case CryptoAlgorithmIdentifier::SHA_512: > return "sha512"; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-std::optional<int> hmacAlgorithm(CryptoAlgorithmIdentifier identifier) >+WTF::Optional<int> hmacAlgorithm(CryptoAlgorithmIdentifier identifier) > { > switch (identifier) { > case CryptoAlgorithmIdentifier::SHA_1: >@@ -62,11 +62,11 @@ std::optional<int> hmacAlgorithm(CryptoAlgorithmIdentifier identifier) > case CryptoAlgorithmIdentifier::SHA_512: > return GCRY_MAC_HMAC_SHA512; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-std::optional<int> digestAlgorithm(CryptoAlgorithmIdentifier identifier) >+WTF::Optional<int> digestAlgorithm(CryptoAlgorithmIdentifier identifier) > { > switch (identifier) { > case CryptoAlgorithmIdentifier::SHA_1: >@@ -80,11 +80,11 @@ std::optional<int> digestAlgorithm(CryptoAlgorithmIdentifier identifier) > case CryptoAlgorithmIdentifier::SHA_512: > return GCRY_MD_SHA512; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-std::optional<PAL::CryptoDigest::Algorithm> hashCryptoDigestAlgorithm(CryptoAlgorithmIdentifier identifier) >+WTF::Optional<PAL::CryptoDigest::Algorithm> hashCryptoDigestAlgorithm(CryptoAlgorithmIdentifier identifier) > { > switch (identifier) { > case CryptoAlgorithmIdentifier::SHA_1: >@@ -98,57 +98,57 @@ std::optional<PAL::CryptoDigest::Algorithm> hashCryptoDigestAlgorithm(CryptoAlgo > case CryptoAlgorithmIdentifier::SHA_512: > return PAL::CryptoDigest::Algorithm::SHA_512; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-std::optional<size_t> mpiLength(gcry_mpi_t paramMPI) >+WTF::Optional<size_t> mpiLength(gcry_mpi_t paramMPI) > { > // Retrieve the MPI length for the unsigned format. > size_t dataLength = 0; > gcry_error_t error = gcry_mpi_print(GCRYMPI_FMT_USG, nullptr, 0, &dataLength, paramMPI); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return dataLength; > } > >-std::optional<size_t> mpiLength(gcry_sexp_t paramSexp) >+WTF::Optional<size_t> mpiLength(gcry_sexp_t paramSexp) > { > // Retrieve the MPI value stored in the s-expression: (name mpi-data) > PAL::GCrypt::Handle<gcry_mpi_t> paramMPI(gcry_sexp_nth_mpi(paramSexp, 1, GCRYMPI_FMT_USG)); > if (!paramMPI) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiLength(paramMPI); > } > >-std::optional<Vector<uint8_t>> mpiData(gcry_mpi_t paramMPI) >+WTF::Optional<Vector<uint8_t>> mpiData(gcry_mpi_t paramMPI) > { > // Retrieve the MPI length. > auto length = mpiLength(paramMPI); > if (!length) >- return std::nullopt; >+ return WTF::nullopt; > > // Copy the MPI data into a properly-sized buffer. > Vector<uint8_t> output(*length); > gcry_error_t error = gcry_mpi_print(GCRYMPI_FMT_USG, output.data(), output.size(), nullptr, paramMPI); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return output; > } > >-std::optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_mpi_t paramMPI, size_t targetLength) >+WTF::Optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_mpi_t paramMPI, size_t targetLength) > { > // Retrieve the MPI length. Bail if the retrieved length is longer than target length. > auto length = mpiLength(paramMPI); > if (!length || *length > targetLength) >- return std::nullopt; >+ return WTF::nullopt; > > // Fill out the output buffer with zeros. Properly determine the zero prefix length, > // and copy the MPI data into memory area following the prefix (if any). >@@ -157,37 +157,37 @@ std::optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_mpi_t paramMPI, size_t t > gcry_error_t error = gcry_mpi_print(GCRYMPI_FMT_USG, output.data() + prefixLength, targetLength, nullptr, paramMPI); > if (error != GPG_ERR_NO_ERROR) { > PAL::GCrypt::logError(error); >- return std::nullopt; >+ return WTF::nullopt; > } > > return output; > } > >-std::optional<Vector<uint8_t>> mpiData(gcry_sexp_t paramSexp) >+WTF::Optional<Vector<uint8_t>> mpiData(gcry_sexp_t paramSexp) > { > // Retrieve the MPI value stored in the s-expression: (name mpi-data) > PAL::GCrypt::Handle<gcry_mpi_t> paramMPI(gcry_sexp_nth_mpi(paramSexp, 1, GCRYMPI_FMT_USG)); > if (!paramMPI) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiData(paramMPI); > } > >-std::optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_sexp_t paramSexp, size_t targetLength) >+WTF::Optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_sexp_t paramSexp, size_t targetLength) > { > // Retrieve the MPI value stored in the s-expression: (name mpi-data) > PAL::GCrypt::Handle<gcry_mpi_t> paramMPI(gcry_sexp_nth_mpi(paramSexp, 1, GCRYMPI_FMT_USG)); > if (!paramMPI) >- return std::nullopt; >+ return WTF::nullopt; > > return mpiZeroPrefixedData(paramMPI, targetLength); > } > >-std::optional<Vector<uint8_t>> mpiSignedData(gcry_mpi_t mpi) >+WTF::Optional<Vector<uint8_t>> mpiSignedData(gcry_mpi_t mpi) > { > auto data = mpiData(mpi); > if (!data) >- return std::nullopt; >+ return WTF::nullopt; > > if (data->at(0) & 0x80) > data->insert(0, 0x00); >@@ -195,11 +195,11 @@ std::optional<Vector<uint8_t>> mpiSignedData(gcry_mpi_t mpi) > return data; > } > >-std::optional<Vector<uint8_t>> mpiSignedData(gcry_sexp_t paramSexp) >+WTF::Optional<Vector<uint8_t>> mpiSignedData(gcry_sexp_t paramSexp) > { > auto data = mpiData(paramSexp); > if (!data) >- return std::nullopt; >+ return WTF::nullopt; > > if (data->at(0) & 0x80) > data->insert(0, 0x00); >diff --git a/Source/WebCore/crypto/gcrypt/GCryptUtilities.h b/Source/WebCore/crypto/gcrypt/GCryptUtilities.h >index 36f48d04d782d52399dd77c4bc3d7828d795a9f1..f3d5626fcba67aadcba006248ba6d53e6395064b 100644 >--- a/Source/WebCore/crypto/gcrypt/GCryptUtilities.h >+++ b/Source/WebCore/crypto/gcrypt/GCryptUtilities.h >@@ -68,19 +68,19 @@ static inline bool matches(const void* lhs, size_t size, const std::array<uint8_ > > } // namespace CryptoConstants > >-std::optional<const char*> hashAlgorithmName(CryptoAlgorithmIdentifier); >- >-std::optional<int> hmacAlgorithm(CryptoAlgorithmIdentifier); >-std::optional<int> digestAlgorithm(CryptoAlgorithmIdentifier); >-std::optional<PAL::CryptoDigest::Algorithm> hashCryptoDigestAlgorithm(CryptoAlgorithmIdentifier); >- >-std::optional<size_t> mpiLength(gcry_mpi_t); >-std::optional<size_t> mpiLength(gcry_sexp_t); >-std::optional<Vector<uint8_t>> mpiData(gcry_mpi_t); >-std::optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_mpi_t, size_t targetLength); >-std::optional<Vector<uint8_t>> mpiData(gcry_sexp_t); >-std::optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_sexp_t, size_t targetLength); >-std::optional<Vector<uint8_t>> mpiSignedData(gcry_mpi_t); >-std::optional<Vector<uint8_t>> mpiSignedData(gcry_sexp_t); >+WTF::Optional<const char*> hashAlgorithmName(CryptoAlgorithmIdentifier); >+ >+WTF::Optional<int> hmacAlgorithm(CryptoAlgorithmIdentifier); >+WTF::Optional<int> digestAlgorithm(CryptoAlgorithmIdentifier); >+WTF::Optional<PAL::CryptoDigest::Algorithm> hashCryptoDigestAlgorithm(CryptoAlgorithmIdentifier); >+ >+WTF::Optional<size_t> mpiLength(gcry_mpi_t); >+WTF::Optional<size_t> mpiLength(gcry_sexp_t); >+WTF::Optional<Vector<uint8_t>> mpiData(gcry_mpi_t); >+WTF::Optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_mpi_t, size_t targetLength); >+WTF::Optional<Vector<uint8_t>> mpiData(gcry_sexp_t); >+WTF::Optional<Vector<uint8_t>> mpiZeroPrefixedData(gcry_sexp_t, size_t targetLength); >+WTF::Optional<Vector<uint8_t>> mpiSignedData(gcry_mpi_t); >+WTF::Optional<Vector<uint8_t>> mpiSignedData(gcry_sexp_t); > > } // namespace WebCore >diff --git a/Source/WebCore/crypto/keys/CryptoKeyEC.cpp b/Source/WebCore/crypto/keys/CryptoKeyEC.cpp >index 6784fa8c320ae4b2a859fe6c23f4345889836af0..fd758c5e420ac8674614a6b0ab4c84a533dc7397 100644 >--- a/Source/WebCore/crypto/keys/CryptoKeyEC.cpp >+++ b/Source/WebCore/crypto/keys/CryptoKeyEC.cpp >@@ -38,7 +38,7 @@ static const ASCIILiteral P256 { "P-256"_s }; > static const ASCIILiteral P384 { "P-384"_s }; > static const ASCIILiteral P521 { "P-521"_s }; > >-static std::optional<CryptoKeyEC::NamedCurve> toNamedCurve(const String& curve) >+static WTF::Optional<CryptoKeyEC::NamedCurve> toNamedCurve(const String& curve) > { > if (curve == P256) > return CryptoKeyEC::NamedCurve::P256; >@@ -47,7 +47,7 @@ static std::optional<CryptoKeyEC::NamedCurve> toNamedCurve(const String& curve) > if (curve == P521) > return CryptoKeyEC::NamedCurve::P521; > >- return std::nullopt; >+ return WTF::nullopt; > } > > CryptoKeyEC::CryptoKeyEC(CryptoAlgorithmIdentifier identifier, NamedCurve curve, CryptoKeyType type, PlatformECKey platformKey, bool extractable, CryptoKeyUsageBitmap usages) >diff --git a/Source/WebCore/crypto/keys/CryptoKeyEC.h b/Source/WebCore/crypto/keys/CryptoKeyEC.h >index 2e9c2e3d2fb2cd6cffe92dcdc3597b67929564e2..6a5b0b40a3885ed5cc62ff7bc50ac53a0bd5d9c2 100644 >--- a/Source/WebCore/crypto/keys/CryptoKeyEC.h >+++ b/Source/WebCore/crypto/keys/CryptoKeyEC.h >@@ -86,7 +86,7 @@ private: > KeyAlgorithm algorithm() const final; > > static bool platformSupportedCurve(NamedCurve); >- static std::optional<CryptoKeyPair> platformGeneratePair(CryptoAlgorithmIdentifier, NamedCurve, bool extractable, CryptoKeyUsageBitmap); >+ static WTF::Optional<CryptoKeyPair> platformGeneratePair(CryptoAlgorithmIdentifier, NamedCurve, bool extractable, CryptoKeyUsageBitmap); > static RefPtr<CryptoKeyEC> platformImportRaw(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap); > static RefPtr<CryptoKeyEC> platformImportJWKPublic(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, bool extractable, CryptoKeyUsageBitmap); > static RefPtr<CryptoKeyEC> platformImportJWKPrivate(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, Vector<uint8_t>&& d, bool extractable, CryptoKeyUsageBitmap); >diff --git a/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp b/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp >index 302cf419533c43745c1cd45942f73e814a9fca72..7e922e6664743f97cd57ee3ab13967a84b2e3846 100644 >--- a/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp >+++ b/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp >@@ -34,7 +34,7 @@ > > namespace WebCore { > >-RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm, std::optional<CryptoAlgorithmIdentifier> hash, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages) >+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm, WTF::Optional<CryptoAlgorithmIdentifier> hash, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages) > { > if (keyData.kty != "RSA") > return nullptr; >@@ -57,7 +57,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm > if (keyData.d.isNull()) { > // import public key > auto publicKeyComponents = CryptoKeyRSAComponents::createPublic(WTFMove(modulus), WTFMove(exponent)); >- // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. >+ // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is WTF::nullopt. > return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *publicKeyComponents, extractable, usages); > } > >@@ -67,7 +67,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm > return nullptr; > if (keyData.p.isNull() && keyData.q.isNull() && keyData.dp.isNull() && keyData.dp.isNull() && keyData.qi.isNull()) { > auto privateKeyComponents = CryptoKeyRSAComponents::createPrivate(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent)); >- // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. >+ // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is WTF::nullopt. > return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages); > } > >@@ -87,7 +87,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm > return nullptr; > if (!keyData.oth) { > auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), { }); >- // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. >+ // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is WTF::nullopt. > return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages); > } > >@@ -104,7 +104,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm > } > > auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), WTFMove(otherPrimeInfos)); >- // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. >+ // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is WTF::nullopt. > return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages); > } > >diff --git a/Source/WebCore/crypto/keys/CryptoKeyRSA.h b/Source/WebCore/crypto/keys/CryptoKeyRSA.h >index a0119d13a29f95604a3ea1330e469aedc74a2290..b0ce9933759762f806103eb25a6d3ff1dbd3223a 100644 >--- a/Source/WebCore/crypto/keys/CryptoKeyRSA.h >+++ b/Source/WebCore/crypto/keys/CryptoKeyRSA.h >@@ -67,9 +67,9 @@ public: > using KeyPairCallback = WTF::Function<void(CryptoKeyPair&&)>; > using VoidCallback = WTF::Function<void()>; > static void generatePair(CryptoAlgorithmIdentifier, CryptoAlgorithmIdentifier hash, bool hasHash, unsigned modulusLength, const Vector<uint8_t>& publicExponent, bool extractable, CryptoKeyUsageBitmap, KeyPairCallback&&, VoidCallback&& failureCallback, ScriptExecutionContext*); >- static RefPtr<CryptoKeyRSA> importJwk(CryptoAlgorithmIdentifier, std::optional<CryptoAlgorithmIdentifier> hash, JsonWebKey&&, bool extractable, CryptoKeyUsageBitmap); >- static RefPtr<CryptoKeyRSA> importSpki(CryptoAlgorithmIdentifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap); >- static RefPtr<CryptoKeyRSA> importPkcs8(CryptoAlgorithmIdentifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap); >+ static RefPtr<CryptoKeyRSA> importJwk(CryptoAlgorithmIdentifier, WTF::Optional<CryptoAlgorithmIdentifier> hash, JsonWebKey&&, bool extractable, CryptoKeyUsageBitmap); >+ static RefPtr<CryptoKeyRSA> importSpki(CryptoAlgorithmIdentifier, WTF::Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap); >+ static RefPtr<CryptoKeyRSA> importPkcs8(CryptoAlgorithmIdentifier, WTF::Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap); > > PlatformRSAKey platformKey() const { return m_platformKey; } > JsonWebKey exportJwk() const; >diff --git a/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp b/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp >index a72060e3fcee8ee9510fe2ad46d17f9de1e18f5c..b870d1440716f3059351594b83f854dbf0443e75 100644 >--- a/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp >+++ b/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp >@@ -33,9 +33,9 @@ > > namespace WebCore { > >-std::optional<Vector<uint8_t>> CryptoAlgorithmECDH::platformDeriveBits(const CryptoKeyEC& baseKey, const CryptoKeyEC& publicKey) >+WTF::Optional<Vector<uint8_t>> CryptoAlgorithmECDH::platformDeriveBits(const CryptoKeyEC& baseKey, const CryptoKeyEC& publicKey) > { >- std::optional<Vector<uint8_t>> result = std::nullopt; >+ WTF::Optional<Vector<uint8_t>> result = WTF::nullopt; > Vector<uint8_t> derivedKey(baseKey.keySizeInBits() / 8); // Per https://tools.ietf.org/html/rfc6090#section-4. > size_t size = derivedKey.size(); > if (!CCECCryptorComputeSharedSecret(baseKey.platformKey(), publicKey.platformKey(), derivedKey.data(), &size)) >diff --git a/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp b/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp >index a09772aa71a5632ac1f6dc2a7344dd9efe004b50..77807b2d913cecd90cdeb35755c1cb66d16d506f 100644 >--- a/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp >+++ b/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp >@@ -34,7 +34,7 @@ > > namespace WebCore { > >-static std::optional<CCHmacAlgorithm> commonCryptoHMACAlgorithm(CryptoAlgorithmIdentifier hashFunction) >+static WTF::Optional<CCHmacAlgorithm> commonCryptoHMACAlgorithm(CryptoAlgorithmIdentifier hashFunction) > { > switch (hashFunction) { > case CryptoAlgorithmIdentifier::SHA_1: >@@ -48,7 +48,7 @@ static std::optional<CCHmacAlgorithm> commonCryptoHMACAlgorithm(CryptoAlgorithmI > case CryptoAlgorithmIdentifier::SHA_512: > return kCCHmacAlgSHA512; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h b/Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h >index 848d89416a0361c1add165b9270256c5ee6e75fe..30f248a1645c9427e426f55d50a327f13ae3a8d8 100644 >--- a/Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h >+++ b/Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h >@@ -33,7 +33,7 @@ > > namespace WebCore { > >-static std::optional<PAL::CryptoDigest::Algorithm> cryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction) >+static WTF::Optional<PAL::CryptoDigest::Algorithm> cryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction) > { > switch (hashFunction) { > case CryptoAlgorithmIdentifier::SHA_1: >@@ -47,7 +47,7 @@ static std::optional<PAL::CryptoDigest::Algorithm> cryptoDigestAlgorithm(CryptoA > case CryptoAlgorithmIdentifier::SHA_512: > return PAL::CryptoDigest::Algorithm::SHA_512; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/crypto/mac/CryptoKeyECMac.cpp b/Source/WebCore/crypto/mac/CryptoKeyECMac.cpp >index 2f3b8532012ab5bc5d4c0443836c18735da3f3af..0fef716aeb1c605f682aa2b0e7b2a6bc37366aef 100644 >--- a/Source/WebCore/crypto/mac/CryptoKeyECMac.cpp >+++ b/Source/WebCore/crypto/mac/CryptoKeyECMac.cpp >@@ -111,13 +111,13 @@ bool CryptoKeyEC::platformSupportedCurve(NamedCurve curve) > return curve == NamedCurve::P256 || curve == NamedCurve::P384; > } > >-std::optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier identifier, NamedCurve curve, bool extractable, CryptoKeyUsageBitmap usages) >+WTF::Optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier identifier, NamedCurve curve, bool extractable, CryptoKeyUsageBitmap usages) > { > size_t size = getKeySizeFromNamedCurve(curve); > CCECCryptorRef ccPublicKey; > CCECCryptorRef ccPrivateKey; > if (CCECCryptorGeneratePair(size, &ccPublicKey, &ccPrivateKey)) >- return std::nullopt; >+ return WTF::nullopt; > > auto publicKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Public, ccPublicKey, true, usages); > auto privateKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Private, ccPrivateKey, extractable, usages); >diff --git a/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp b/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp >index e36fa76d2e83d2faf9595dffb7dd6a44b1b89544..9ed3fbde5f2966b16f00cac8c915ac58905b8384 100644 >--- a/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp >+++ b/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp >@@ -342,7 +342,7 @@ void CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier algorithm, CryptoAlgor > }); > } > >-RefPtr<CryptoKeyRSA> CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) >+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifier, WTF::Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) > { > // The current SecLibrary cannot import a SPKI format binary. Hence, we need to strip out the SPKI header. > // This hack can be removed when <rdar://problem/29523286> is resolved. >@@ -362,7 +362,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifi > if (CCRSACryptorImport(keyData.data() + headerSize, keyData.size() - headerSize, &ccPublicKey)) > return nullptr; > >- // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. >+ // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is WTF::nullopt. > return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Public, ccPublicKey, extractable, usages)); > } > >@@ -398,7 +398,7 @@ ExceptionOr<Vector<uint8_t>> CryptoKeyRSA::exportSpki() const > return WTFMove(result); > } > >-RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) >+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identifier, WTF::Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) > { > // The current SecLibrary cannot import a PKCS8 format binary. Hence, we need to strip out the PKCS8 header. > // This hack can be removed when <rdar://problem/29523286> is resolved. >@@ -419,7 +419,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identif > if (CCRSACryptorImport(keyData.data() + headerSize, keyData.size() - headerSize, &ccPrivateKey)) > return nullptr; > >- // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. >+ // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is WTF::nullopt. > return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Private, ccPrivateKey, extractable, usages)); > } > >diff --git a/Source/WebCore/crypto/parameters/CryptoAlgorithmAesGcmParams.h b/Source/WebCore/crypto/parameters/CryptoAlgorithmAesGcmParams.h >index 67af03987fec69542f8d7c92cafb0a069a7c4116..8afb544e8e6ad5c08a7c439afdda58bf37e2c0a2 100644 >--- a/Source/WebCore/crypto/parameters/CryptoAlgorithmAesGcmParams.h >+++ b/Source/WebCore/crypto/parameters/CryptoAlgorithmAesGcmParams.h >@@ -37,8 +37,8 @@ class CryptoAlgorithmAesGcmParams final : public CryptoAlgorithmParameters { > public: > BufferSource iv; > // Use additionalDataVector() instead of additionalData. The label will be gone once additionalDataVector() is called. >- mutable std::optional<BufferSource::VariantType> additionalData; >- mutable std::optional<uint8_t> tagLength; >+ mutable WTF::Optional<BufferSource::VariantType> additionalData; >+ mutable WTF::Optional<uint8_t> tagLength; > > Class parametersClass() const final { return Class::AesGcmParams; } > >@@ -57,7 +57,7 @@ public: > return m_additionalDataVector; > > BufferSource additionalDataBuffer = WTFMove(*additionalData); >- additionalData = std::nullopt; >+ additionalData = WTF::nullopt; > if (!additionalDataBuffer.length()) > return m_additionalDataVector; > >diff --git a/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h b/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h >index 9d109c0f84b6cc8cdefcb36a05af3e672a78e1ad..22e15dc7af4c01e8fd7674315073475fbf438ea7 100644 >--- a/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h >+++ b/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h >@@ -39,7 +39,7 @@ public: > // FIXME: Consider merging hash and hashIdentifier. > Variant<JSC::Strong<JSC::JSObject>, String> hash; > CryptoAlgorithmIdentifier hashIdentifier; >- std::optional<size_t> length; >+ WTF::Optional<size_t> length; > > Class parametersClass() const final { return Class::HmacKeyParams; } > >diff --git a/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h b/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h >index 769f3d9cb3aaa799672fc7554729583e63b4015f..c9e82c9a29e0f0d03092d6e5f4b1e8a13ffdb7a1 100644 >--- a/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h >+++ b/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h >@@ -36,7 +36,7 @@ namespace WebCore { > class CryptoAlgorithmRsaOaepParams final : public CryptoAlgorithmParameters { > public: > // Use labelVector() instead of label. The label will be gone once labelVector() is called. >- mutable std::optional<BufferSource::VariantType> label; >+ mutable WTF::Optional<BufferSource::VariantType> label; > > Class parametersClass() const final { return Class::RsaOaepParams; } > >@@ -46,7 +46,7 @@ public: > return m_labelVector; > > BufferSource labelBuffer = WTFMove(*label); >- label = std::nullopt; >+ label = WTF::nullopt; > if (!labelBuffer.length()) > return m_labelVector; > >diff --git a/Source/WebCore/css/CSSCalculationValue.cpp b/Source/WebCore/css/CSSCalculationValue.cpp >index 05872e2b22438be203a536f90bcbffeb304bc009..55f42edd76f7ff54946a43a64553013807115f12 100644 >--- a/Source/WebCore/css/CSSCalculationValue.cpp >+++ b/Source/WebCore/css/CSSCalculationValue.cpp >@@ -418,7 +418,7 @@ public: > { > ASSERT(op == CalcOperator::Min || op == CalcOperator::Max); > >- std::optional<CalculationCategory> category = std::nullopt; >+ WTF::Optional<CalculationCategory> category = WTF::nullopt; > for (auto& value : values) { > auto valueCategory = resolvedTypeForMinOrMax(value->category(), destinationCategory); > >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index 36f0394ba7a96b5f7eac88c672c7c8931d14a35b..d89452f05add7a43b5323ebd192ac52d79b183a2 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -2040,7 +2040,7 @@ Ref<CSSFontStyleValue> ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue > return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG)); > } > >-Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(std::optional<FontSelectionValue> italic, FontStyleAxis fontStyleAxis) >+Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(WTF::Optional<FontSelectionValue> italic, FontStyleAxis fontStyleAxis) > { > if (auto keyword = fontStyleKeyword(italic, fontStyleAxis)) > return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(keyword.value())); >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.h b/Source/WebCore/css/CSSComputedStyleDeclaration.h >index bdf343272a6aa41b76e31d2a19ff711772367f73..8b56d44b9aa40be0077fc02e9b6e26deed185741 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.h >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.h >@@ -73,7 +73,7 @@ public: > static Ref<CSSPrimitiveValue> fontNonKeywordStretchFromStyleValue(FontSelectionValue); > static Ref<CSSPrimitiveValue> fontStretchFromStyleValue(FontSelectionValue); > static Ref<CSSFontStyleValue> fontNonKeywordStyleFromStyleValue(FontSelectionValue); >- static Ref<CSSFontStyleValue> fontStyleFromStyleValue(std::optional<FontSelectionValue>, FontStyleAxis); >+ static Ref<CSSFontStyleValue> fontStyleFromStyleValue(WTF::Optional<FontSelectionValue>, FontStyleAxis); > > private: > // The styled element is either the element passed into >diff --git a/Source/WebCore/css/CSSFontFaceSet.h b/Source/WebCore/css/CSSFontFaceSet.h >index 337feab4b158f36585dacfd9987ace3556f37b27..2e9706f01aa9c09067220a7e933b038a157bac59 100644 >--- a/Source/WebCore/css/CSSFontFaceSet.h >+++ b/Source/WebCore/css/CSSFontFaceSet.h >@@ -97,7 +97,7 @@ private: > > static String familyNameFromPrimitive(const CSSPrimitiveValue&); > >- using FontSelectionKey = std::optional<FontSelectionRequest>; >+ using FontSelectionKey = WTF::Optional<FontSelectionRequest>; > struct FontSelectionKeyHash { > static unsigned hash(const FontSelectionKey& key) { return computeHash(key); } > static bool equal(const FontSelectionKey& a, const FontSelectionKey& b) { return a == b; } >@@ -106,7 +106,7 @@ private: > struct FontSelectionKeyHashTraits : SimpleClassHashTraits<FontSelectionKey> { > static const bool emptyValueIsZero = false; > static FontSelectionKey emptyValue() { return FontSelectionRequest { }; } >- static void constructDeletedValue(FontSelectionKey& slot) { slot = std::nullopt; } >+ static void constructDeletedValue(FontSelectionKey& slot) { slot = WTF::nullopt; } > static bool isDeletedValue(const FontSelectionKey& value) { return !value; } > }; > using FontSelectionHashMap = HashMap<FontSelectionKey, RefPtr<CSSSegmentedFontFace>, FontSelectionKeyHash, FontSelectionKeyHashTraits>; >diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp >index 636d601924b9c7b7545970f1dd55cdc2cd7c8dc4..4f3da0a38bf9431387d117144205fc41731ffce4 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.cpp >+++ b/Source/WebCore/css/CSSPrimitiveValue.cpp >@@ -822,10 +822,10 @@ CSSPrimitiveValue::UnitType CSSPrimitiveValue::canonicalUnitTypeForCategory(Unit > } > } > >-std::optional<double> CSSPrimitiveValue::doubleValueInternal(UnitType requestedUnitType) const >+WTF::Optional<double> CSSPrimitiveValue::doubleValueInternal(UnitType requestedUnitType) const > { > if (!isValidCSSUnitTypeForDoubleConversion(static_cast<UnitType>(m_primitiveUnitType)) || !isValidCSSUnitTypeForDoubleConversion(requestedUnitType)) >- return std::nullopt; >+ return WTF::nullopt; > > UnitType sourceUnitType = static_cast<UnitType>(primitiveType()); > if (requestedUnitType == sourceUnitType || requestedUnitType == CSS_DIMENSION) >@@ -840,20 +840,20 @@ std::optional<double> CSSPrimitiveValue::doubleValueInternal(UnitType requestedU > > // Cannot convert between unrelated unit categories if one of them is not UNumber. > if (sourceCategory != targetCategory && sourceCategory != UNumber && targetCategory != UNumber) >- return std::nullopt; >+ return WTF::nullopt; > > if (targetCategory == UNumber) { > // We interpret conversion to CSS_NUMBER as conversion to a canonical unit in this value's category. > targetUnitType = canonicalUnitTypeForCategory(sourceCategory); > if (targetUnitType == CSS_UNKNOWN) >- return std::nullopt; >+ return WTF::nullopt; > } > > if (sourceUnitType == CSS_NUMBER) { > // We interpret conversion from CSS_NUMBER in the same way as CSSParser::validUnit() while using non-strict mode. > sourceUnitType = canonicalUnitTypeForCategory(targetCategory); > if (sourceUnitType == CSS_UNKNOWN) >- return std::nullopt; >+ return WTF::nullopt; > } > > double convertedValue = doubleValue(); >diff --git a/Source/WebCore/css/CSSPrimitiveValue.h b/Source/WebCore/css/CSSPrimitiveValue.h >index 53088cca7f2a86084e15da5a0bc8f373a815d6af..848f1218bceaf8b86bdc16c273d1a4fef40f0efd 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.h >+++ b/Source/WebCore/css/CSSPrimitiveValue.h >@@ -325,7 +325,7 @@ private: > void init(RefPtr<DashboardRegion>&&); // FIXME: Dashboard region should not be a primitive value. > #endif > >- std::optional<double> doubleValueInternal(UnitType targetUnitType) const; >+ WTF::Optional<double> doubleValueInternal(UnitType targetUnitType) const; > > double computeLengthDouble(const CSSToLengthConversionData&) const; > >diff --git a/Source/WebCore/css/CSSSegmentedFontFace.cpp b/Source/WebCore/css/CSSSegmentedFontFace.cpp >index dda20fd413d308cf3b06f957e0b691bad0175d7a..bcc3a8d1d09999d691b179bc8471e306076046b7 100644 >--- a/Source/WebCore/css/CSSSegmentedFontFace.cpp >+++ b/Source/WebCore/css/CSSSegmentedFontFace.cpp >@@ -88,7 +88,7 @@ private: > return m_result && m_result.value() && m_result.value()->isInterstitial(); > } > >- mutable std::optional<RefPtr<Font>> m_result; // Caches nullptr too >+ mutable WTF::Optional<RefPtr<Font>> m_result; // Caches nullptr too > mutable Ref<CSSFontFace> m_fontFace; > FontDescription m_fontDescription; > bool m_syntheticBold; >diff --git a/Source/WebCore/css/CSSStyleDeclaration.cpp b/Source/WebCore/css/CSSStyleDeclaration.cpp >index a42659c037094f8ca5248cc7d68784853b4e9059..7e1d2d9d4fb6c81396cffc834b5a9ecc2e1b278e 100644 >--- a/Source/WebCore/css/CSSStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSStyleDeclaration.cpp >@@ -255,11 +255,11 @@ CSSPropertyID CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName(co > return parseJavaScriptCSSPropertyName(propertyName).propertyID; > } > >-std::optional<Variant<String, double>> CSSStyleDeclaration::namedItem(const AtomicString& propertyName) >+WTF::Optional<Variant<String, double>> CSSStyleDeclaration::namedItem(const AtomicString& propertyName) > { > auto propertyInfo = parseJavaScriptCSSPropertyName(propertyName); > if (!propertyInfo.propertyID) >- return std::nullopt; >+ return WTF::nullopt; > > auto value = getPropertyCSSValueInternal(propertyInfo.propertyID); > if (!value) { >diff --git a/Source/WebCore/css/CSSStyleDeclaration.h b/Source/WebCore/css/CSSStyleDeclaration.h >index b18c9ce327499acd052ae28f08357cdf74029f98..63199a7ae27354ea6eef5582f4b075b1453beb3a 100644 >--- a/Source/WebCore/css/CSSStyleDeclaration.h >+++ b/Source/WebCore/css/CSSStyleDeclaration.h >@@ -75,7 +75,7 @@ public: > virtual CSSStyleSheet* parentStyleSheet() const { return nullptr; } > > // Bindings support. >- std::optional<Variant<String, double>> namedItem(const AtomicString&); >+ WTF::Optional<Variant<String, double>> namedItem(const AtomicString&); > ExceptionOr<void> setNamedItem(const AtomicString& name, String value, bool& propertySupported); > Vector<AtomicString> supportedPropertyNames() const; > >diff --git a/Source/WebCore/css/CSSStyleSheet.cpp b/Source/WebCore/css/CSSStyleSheet.cpp >index 1ecc5ba3708792fa637f16b12cd73e11efb04a62..311500d48032c2ecb03eb48fb93a32605f6acfe7 100644 >--- a/Source/WebCore/css/CSSStyleSheet.cpp >+++ b/Source/WebCore/css/CSSStyleSheet.cpp >@@ -74,7 +74,7 @@ Ref<CSSStyleSheet> CSSStyleSheet::create(Ref<StyleSheetContents>&& sheet, CSSImp > return adoptRef(*new CSSStyleSheet(WTFMove(sheet), ownerRule)); > } > >-Ref<CSSStyleSheet> CSSStyleSheet::create(Ref<StyleSheetContents>&& sheet, Node& ownerNode, const std::optional<bool>& isCleanOrigin) >+Ref<CSSStyleSheet> CSSStyleSheet::create(Ref<StyleSheetContents>&& sheet, Node& ownerNode, const WTF::Optional<bool>& isCleanOrigin) > { > return adoptRef(*new CSSStyleSheet(WTFMove(sheet), ownerNode, TextPosition(), false, isCleanOrigin)); > } >@@ -96,7 +96,7 @@ CSSStyleSheet::CSSStyleSheet(Ref<StyleSheetContents>&& contents, CSSImportRule* > m_contents->registerClient(this); > } > >-CSSStyleSheet::CSSStyleSheet(Ref<StyleSheetContents>&& contents, Node& ownerNode, const TextPosition& startPosition, bool isInlineStylesheet, const std::optional<bool>& isOriginClean) >+CSSStyleSheet::CSSStyleSheet(Ref<StyleSheetContents>&& contents, Node& ownerNode, const TextPosition& startPosition, bool isInlineStylesheet, const WTF::Optional<bool>& isOriginClean) > : m_contents(WTFMove(contents)) > , m_isInlineStylesheet(isInlineStylesheet) > , m_isDisabled(false) >@@ -307,7 +307,7 @@ ExceptionOr<void> CSSStyleSheet::deleteRule(unsigned index) > return { }; > } > >-ExceptionOr<int> CSSStyleSheet::addRule(const String& selector, const String& style, std::optional<unsigned> index) >+ExceptionOr<int> CSSStyleSheet::addRule(const String& selector, const String& style, WTF::Optional<unsigned> index) > { > StringBuilder text; > text.append(selector); >diff --git a/Source/WebCore/css/CSSStyleSheet.h b/Source/WebCore/css/CSSStyleSheet.h >index 5d37fa8d2e85488b38a51b7cd4758ec56a8c273c..6024ec36eb227dc2741e2493733be42ec8ec485a 100644 >--- a/Source/WebCore/css/CSSStyleSheet.h >+++ b/Source/WebCore/css/CSSStyleSheet.h >@@ -49,7 +49,7 @@ class Scope; > class CSSStyleSheet final : public StyleSheet { > public: > static Ref<CSSStyleSheet> create(Ref<StyleSheetContents>&&, CSSImportRule* ownerRule = 0); >- static Ref<CSSStyleSheet> create(Ref<StyleSheetContents>&&, Node& ownerNode, const std::optional<bool>& isOriginClean = std::nullopt); >+ static Ref<CSSStyleSheet> create(Ref<StyleSheetContents>&&, Node& ownerNode, const WTF::Optional<bool>& isOriginClean = WTF::nullopt); > static Ref<CSSStyleSheet> createInline(Ref<StyleSheetContents>&&, Element& owner, const TextPosition& startPosition); > > virtual ~CSSStyleSheet(); >@@ -67,7 +67,7 @@ public: > WEBCORE_EXPORT ExceptionOr<void> deleteRule(unsigned index); > > WEBCORE_EXPORT RefPtr<CSSRuleList> rules(); >- WEBCORE_EXPORT ExceptionOr<int> addRule(const String& selector, const String& style, std::optional<unsigned> index); >+ WEBCORE_EXPORT ExceptionOr<int> addRule(const String& selector, const String& style, WTF::Optional<unsigned> index); > ExceptionOr<void> removeRule(unsigned index) { return deleteRule(index); } > > // For CSSRuleList. >@@ -130,7 +130,7 @@ public: > private: > CSSStyleSheet(Ref<StyleSheetContents>&&, CSSImportRule* ownerRule); > CSSStyleSheet(Ref<StyleSheetContents>&&, Node* ownerNode, const TextPosition& startPosition, bool isInlineStylesheet); >- CSSStyleSheet(Ref<StyleSheetContents>&&, Node& ownerNode, const TextPosition& startPosition, bool isInlineStylesheet, const std::optional<bool>&); >+ CSSStyleSheet(Ref<StyleSheetContents>&&, Node& ownerNode, const TextPosition& startPosition, bool isInlineStylesheet, const WTF::Optional<bool>&); > > bool isCSSStyleSheet() const final { return true; } > String type() const final { return "text/css"_s; } >@@ -139,7 +139,7 @@ private: > bool m_isInlineStylesheet; > bool m_isDisabled; > bool m_mutatedRules; >- std::optional<bool> m_isOriginClean; >+ WTF::Optional<bool> m_isOriginClean; > String m_title; > RefPtr<MediaQuerySet> m_mediaQueries; > >diff --git a/Source/WebCore/css/DOMMatrix.cpp b/Source/WebCore/css/DOMMatrix.cpp >index 756647523fbd696b228024ed3e4af22609dcd9d0..f234097d2bdcf626cd6c5943964f086986c2582b 100644 >--- a/Source/WebCore/css/DOMMatrix.cpp >+++ b/Source/WebCore/css/DOMMatrix.cpp >@@ -33,7 +33,7 @@ > namespace WebCore { > > // https://drafts.fxtf.org/geometry/#dom-dommatrixreadonly-dommatrixreadonly >-ExceptionOr<Ref<DOMMatrix>> DOMMatrix::create(ScriptExecutionContext& scriptExecutionContext, std::optional<Variant<String, Vector<double>>>&& init) >+ExceptionOr<Ref<DOMMatrix>> DOMMatrix::create(ScriptExecutionContext& scriptExecutionContext, WTF::Optional<Variant<String, Vector<double>>>&& init) > { > if (!init) > return adoptRef(*new DOMMatrix); >@@ -154,7 +154,7 @@ Ref<DOMMatrix> DOMMatrix::translateSelf(double tx, double ty, double tz) > } > > // https://drafts.fxtf.org/geometry/#dom-dommatrix-scaleself >-Ref<DOMMatrix> DOMMatrix::scaleSelf(double scaleX, std::optional<double> scaleY, double scaleZ, double originX, double originY, double originZ) >+Ref<DOMMatrix> DOMMatrix::scaleSelf(double scaleX, WTF::Optional<double> scaleY, double scaleZ, double originX, double originY, double originZ) > { > if (!scaleY) > scaleY = scaleX; >@@ -182,7 +182,7 @@ Ref<DOMMatrix> DOMMatrix::scale3dSelf(double scale, double originX, double origi > } > > // https://drafts.fxtf.org/geometry/#dom-dommatrix-rotateself >-Ref<DOMMatrix> DOMMatrix::rotateSelf(double rotX, std::optional<double> rotY, std::optional<double> rotZ) >+Ref<DOMMatrix> DOMMatrix::rotateSelf(double rotX, WTF::Optional<double> rotY, WTF::Optional<double> rotZ) > { > if (!rotY && !rotZ) { > rotZ = rotX; >diff --git a/Source/WebCore/css/DOMMatrix.h b/Source/WebCore/css/DOMMatrix.h >index ed2e11f408fc6bebeb3e21778e403934ca6f6cc5..9faeecba1a3c4da44bb1c1ddbf2242541dee17fd 100644 >--- a/Source/WebCore/css/DOMMatrix.h >+++ b/Source/WebCore/css/DOMMatrix.h >@@ -33,7 +33,7 @@ class ScriptExecutionContext; > > class DOMMatrix : public DOMMatrixReadOnly { > public: >- static ExceptionOr<Ref<DOMMatrix>> create(ScriptExecutionContext&, std::optional<Variant<String, Vector<double>>>&&); >+ static ExceptionOr<Ref<DOMMatrix>> create(ScriptExecutionContext&, WTF::Optional<Variant<String, Vector<double>>>&&); > > static Ref<DOMMatrix> create(const TransformationMatrix& matrix, Is2D is2D) > { >@@ -53,9 +53,9 @@ public: > ExceptionOr<Ref<DOMMatrix>> multiplySelf(DOMMatrixInit&& other); > ExceptionOr<Ref<DOMMatrix>> preMultiplySelf(DOMMatrixInit&& other); > Ref<DOMMatrix> translateSelf(double tx = 0, double ty = 0, double tz = 0); >- Ref<DOMMatrix> scaleSelf(double scaleX = 1, std::optional<double> scaleY = std::nullopt, double scaleZ = 1, double originX = 0, double originY = 0, double originZ = 0); >+ Ref<DOMMatrix> scaleSelf(double scaleX = 1, WTF::Optional<double> scaleY = WTF::nullopt, double scaleZ = 1, double originX = 0, double originY = 0, double originZ = 0); > Ref<DOMMatrix> scale3dSelf(double scale = 1, double originX = 0, double originY = 0, double originZ = 0); >- Ref<DOMMatrix> rotateSelf(double rotX = 0, std::optional<double> rotY = std::nullopt, std::optional<double> rotZ = std::nullopt); // Angles are in degrees. >+ Ref<DOMMatrix> rotateSelf(double rotX = 0, WTF::Optional<double> rotY = WTF::nullopt, WTF::Optional<double> rotZ = WTF::nullopt); // Angles are in degrees. > Ref<DOMMatrix> rotateFromVectorSelf(double x = 0, double y = 0); > Ref<DOMMatrix> rotateAxisAngleSelf(double x = 0, double y = 0, double z = 0, double angle = 0); // Angle is in degrees. > Ref<DOMMatrix> skewXSelf(double sx = 0); // Angle is in degrees. >diff --git a/Source/WebCore/css/DOMMatrix2DInit.h b/Source/WebCore/css/DOMMatrix2DInit.h >index f39d2795851dbe617956d8f4eb529826a9f1e451..a514df12ba4c425cf008e8946d292a0841ac7895 100644 >--- a/Source/WebCore/css/DOMMatrix2DInit.h >+++ b/Source/WebCore/css/DOMMatrix2DInit.h >@@ -30,18 +30,18 @@ > namespace WebCore { > > struct DOMMatrix2DInit { >- std::optional<double> a; >- std::optional<double> b; >- std::optional<double> c; >- std::optional<double> d; >- std::optional<double> e; >- std::optional<double> f; >- std::optional<double> m11; >- std::optional<double> m12; >- std::optional<double> m21; >- std::optional<double> m22; >- std::optional<double> m41; >- std::optional<double> m42; >+ WTF::Optional<double> a; >+ WTF::Optional<double> b; >+ WTF::Optional<double> c; >+ WTF::Optional<double> d; >+ WTF::Optional<double> e; >+ WTF::Optional<double> f; >+ WTF::Optional<double> m11; >+ WTF::Optional<double> m12; >+ WTF::Optional<double> m21; >+ WTF::Optional<double> m22; >+ WTF::Optional<double> m41; >+ WTF::Optional<double> m42; > }; > > } >diff --git a/Source/WebCore/css/DOMMatrixInit.h b/Source/WebCore/css/DOMMatrixInit.h >index 168db3d3bb73a1857343797e7610e5c69e9577bd..8edf3d34e7b07213295b98d799465cfdb8c41fcb 100644 >--- a/Source/WebCore/css/DOMMatrixInit.h >+++ b/Source/WebCore/css/DOMMatrixInit.h >@@ -40,7 +40,7 @@ struct DOMMatrixInit : DOMMatrix2DInit { > double m34 { 0 }; > double m43 { 0 }; > double m44 { 1 }; >- std::optional<bool> is2D; >+ WTF::Optional<bool> is2D; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/css/DOMMatrixReadOnly.cpp b/Source/WebCore/css/DOMMatrixReadOnly.cpp >index 731754e466f3736e9cc47d730475257f7ea5bfe5..ffb2921908f850c8f84fdc50faed57bccab961f5 100644 >--- a/Source/WebCore/css/DOMMatrixReadOnly.cpp >+++ b/Source/WebCore/css/DOMMatrixReadOnly.cpp >@@ -41,7 +41,7 @@ > namespace WebCore { > > // https://drafts.fxtf.org/geometry/#dom-dommatrixreadonly-dommatrixreadonly >-ExceptionOr<Ref<DOMMatrixReadOnly>> DOMMatrixReadOnly::create(ScriptExecutionContext& scriptExecutionContext, std::optional<Variant<String, Vector<double>>>&& init) >+ExceptionOr<Ref<DOMMatrixReadOnly>> DOMMatrixReadOnly::create(ScriptExecutionContext& scriptExecutionContext, WTF::Optional<Variant<String, Vector<double>>>&& init) > { > if (!init) > return adoptRef(*new DOMMatrixReadOnly); >@@ -288,7 +288,7 @@ ExceptionOr<Ref<DOMMatrix>> DOMMatrixReadOnly::multiply(DOMMatrixInit&& other) c > return matrix->multiplySelf(WTFMove(other)); > } > >-Ref<DOMMatrix> DOMMatrixReadOnly::scale(double scaleX, std::optional<double> scaleY, double scaleZ, double originX, double originY, double originZ) >+Ref<DOMMatrix> DOMMatrixReadOnly::scale(double scaleX, WTF::Optional<double> scaleY, double scaleZ, double originX, double originY, double originZ) > { > auto matrix = cloneAsDOMMatrix(); > return matrix->scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ); >@@ -300,7 +300,7 @@ Ref<DOMMatrix> DOMMatrixReadOnly::scale3d(double scale, double originX, double o > return matrix->scale3dSelf(scale, originX, originY, originZ); > } > >-Ref<DOMMatrix> DOMMatrixReadOnly::rotate(double rotX, std::optional<double> rotY, std::optional<double> rotZ) >+Ref<DOMMatrix> DOMMatrixReadOnly::rotate(double rotX, WTF::Optional<double> rotY, WTF::Optional<double> rotZ) > { > auto matrix = cloneAsDOMMatrix(); > return matrix->rotateSelf(rotX, rotY, rotZ); >diff --git a/Source/WebCore/css/DOMMatrixReadOnly.h b/Source/WebCore/css/DOMMatrixReadOnly.h >index 2e93eac4138b8c9edf51f56140b1323f2aec4c12..c54bdd4ef9839112a648b94b4793b32fcb140463 100644 >--- a/Source/WebCore/css/DOMMatrixReadOnly.h >+++ b/Source/WebCore/css/DOMMatrixReadOnly.h >@@ -46,7 +46,7 @@ struct DOMPointInit; > class DOMMatrixReadOnly : public ScriptWrappable, public RefCounted<DOMMatrixReadOnly> { > WTF_MAKE_FAST_ALLOCATED; > public: >- static ExceptionOr<Ref<DOMMatrixReadOnly>> create(ScriptExecutionContext&, std::optional<Variant<String, Vector<double>>>&&); >+ static ExceptionOr<Ref<DOMMatrixReadOnly>> create(ScriptExecutionContext&, WTF::Optional<Variant<String, Vector<double>>>&&); > > enum class Is2D { No, Yes }; > static Ref<DOMMatrixReadOnly> create(const TransformationMatrix& matrix, Is2D is2D) >@@ -101,9 +101,9 @@ public: > ExceptionOr<Ref<DOMMatrix>> multiply(DOMMatrixInit&& other) const; > Ref<DOMMatrix> flipX(); > Ref<DOMMatrix> flipY(); >- Ref<DOMMatrix> scale(double scaleX = 1, std::optional<double> scaleY = std::nullopt, double scaleZ = 1, double originX = 0, double originY = 0, double originZ = 0); >+ Ref<DOMMatrix> scale(double scaleX = 1, WTF::Optional<double> scaleY = WTF::nullopt, double scaleZ = 1, double originX = 0, double originY = 0, double originZ = 0); > Ref<DOMMatrix> scale3d(double scale = 1, double originX = 0, double originY = 0, double originZ = 0); >- Ref<DOMMatrix> rotate(double rotX = 0, std::optional<double> rotY = std::nullopt, std::optional<double> rotZ = std::nullopt); // Angles are in degrees. >+ Ref<DOMMatrix> rotate(double rotX = 0, WTF::Optional<double> rotY = WTF::nullopt, WTF::Optional<double> rotZ = WTF::nullopt); // Angles are in degrees. > Ref<DOMMatrix> rotateFromVector(double x = 0, double y = 0); > Ref<DOMMatrix> rotateAxisAngle(double x = 0, double y = 0, double z = 0, double angle = 0); // Angle is in degrees. > Ref<DOMMatrix> skewX(double sx = 0); // Angle is in degrees. >diff --git a/Source/WebCore/css/DocumentRuleSets.cpp b/Source/WebCore/css/DocumentRuleSets.cpp >index fbd8aad9ef05e730549c4cac19b598976df790f1..a2ef908386be703a6fafe926c30a77f14bafd945 100644 >--- a/Source/WebCore/css/DocumentRuleSets.cpp >+++ b/Source/WebCore/css/DocumentRuleSets.cpp >@@ -169,7 +169,7 @@ void DocumentRuleSets::collectFeatures() const > > m_classInvalidationRuleSets.clear(); > m_attributeInvalidationRuleSets.clear(); >- m_cachedHasComplexSelectorsForStyleAttribute = std::nullopt; >+ m_cachedHasComplexSelectorsForStyleAttribute = WTF::nullopt; > > m_features.shrinkToFit(); > } >diff --git a/Source/WebCore/css/DocumentRuleSets.h b/Source/WebCore/css/DocumentRuleSets.h >index 9414b8cbd48090a37fc903917eb544f9679c3e28..fd3afbb500321af8b01b6b114e9a2b316a9ef140 100644 >--- a/Source/WebCore/css/DocumentRuleSets.h >+++ b/Source/WebCore/css/DocumentRuleSets.h >@@ -92,7 +92,7 @@ private: > mutable HashMap<AtomicString, std::unique_ptr<Vector<InvalidationRuleSet>>> m_classInvalidationRuleSets; > mutable HashMap<AtomicString, std::unique_ptr<Vector<InvalidationRuleSet>>> m_attributeInvalidationRuleSets; > >- mutable std::optional<bool> m_cachedHasComplexSelectorsForStyleAttribute; >+ mutable WTF::Optional<bool> m_cachedHasComplexSelectorsForStyleAttribute; > > mutable unsigned m_defaultStyleVersionOnFeatureCollection { 0 }; > mutable unsigned m_userAgentMediaQueryRuleCountOnUpdate { 0 }; >diff --git a/Source/WebCore/css/FontSelectionValueInlines.h b/Source/WebCore/css/FontSelectionValueInlines.h >index fd87c900b3655fafe719efd0cadc403c4d725c84..c6b3d68cbe250a6c851e877d12651ddd6eb2f3f4 100644 >--- a/Source/WebCore/css/FontSelectionValueInlines.h >+++ b/Source/WebCore/css/FontSelectionValueInlines.h >@@ -48,16 +48,16 @@ inline bool isCSS21Weight(int weight) > return !((weight % 100) || weight < 100 || weight > 900); > } > >-inline std::optional<CSSValueID> fontWeightKeyword(FontSelectionValue weight) >+inline WTF::Optional<CSSValueID> fontWeightKeyword(FontSelectionValue weight) > { > if (weight == normalWeightValue()) > return CSSValueNormal; > if (weight == boldWeightValue()) > return CSSValueBold; >- return std::nullopt; >+ return WTF::nullopt; > } > >-inline std::optional<FontSelectionValue> fontWeightValue(CSSValueID value) >+inline WTF::Optional<FontSelectionValue> fontWeightValue(CSSValueID value) > { > switch (value) { > case CSSValueNormal: >@@ -68,11 +68,11 @@ inline std::optional<FontSelectionValue> fontWeightValue(CSSValueID value) > case CSSValueLighter: > return lightWeightValue(); > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-inline std::optional<CSSValueID> fontStretchKeyword(FontSelectionValue stretch) >+inline WTF::Optional<CSSValueID> fontStretchKeyword(FontSelectionValue stretch) > { > if (stretch == ultraCondensedStretchValue()) > return CSSValueUltraCondensed; >@@ -92,10 +92,10 @@ inline std::optional<CSSValueID> fontStretchKeyword(FontSelectionValue stretch) > return CSSValueExtraExpanded; > if (stretch == ultraExpandedStretchValue()) > return CSSValueUltraExpanded; >- return std::nullopt; >+ return WTF::nullopt; > } > >-inline std::optional<FontSelectionValue> fontStretchValue(CSSValueID value) >+inline WTF::Optional<FontSelectionValue> fontStretchValue(CSSValueID value) > { > switch (value) { > case CSSValueUltraCondensed: >@@ -117,17 +117,17 @@ inline std::optional<FontSelectionValue> fontStretchValue(CSSValueID value) > case CSSValueUltraExpanded: > return ultraExpandedStretchValue(); > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-inline std::optional<CSSValueID> fontStyleKeyword(std::optional<FontSelectionValue> style, FontStyleAxis axis) >+inline WTF::Optional<CSSValueID> fontStyleKeyword(WTF::Optional<FontSelectionValue> style, FontStyleAxis axis) > { > if (!style || style.value() == normalItalicValue()) > return CSSValueNormal; > if (style.value() == italicValue()) > return axis == FontStyleAxis::ital ? CSSValueItalic : CSSValueOblique; >- return std::nullopt; >+ return WTF::nullopt; > } > > } >diff --git a/Source/WebCore/css/MediaQueryEvaluator.cpp b/Source/WebCore/css/MediaQueryEvaluator.cpp >index e959ae60cfa6744a78ab80a3c3b636b00e9f8884..3c8e569094dc508257cbd9b4dcd07f63b2a8d69e 100644 >--- a/Source/WebCore/css/MediaQueryEvaluator.cpp >+++ b/Source/WebCore/css/MediaQueryEvaluator.cpp >@@ -255,10 +255,10 @@ static bool compareAspectRatioValue(CSSValue* value, int width, int height, Medi > return compareValue(width * aspectRatio.denominatorValue(), height * aspectRatio.numeratorValue(), op); > } > >-static std::optional<double> doubleValue(CSSValue* value) >+static WTF::Optional<double> doubleValue(CSSValue* value) > { > if (!is<CSSPrimitiveValue>(value) || !downcast<CSSPrimitiveValue>(*value).isNumber()) >- return std::nullopt; >+ return WTF::nullopt; > return downcast<CSSPrimitiveValue>(*value).doubleValue(CSSPrimitiveValue::CSS_NUMBER); > } > >@@ -798,7 +798,7 @@ static bool displayModeEvaluate(CSSValue* value, const CSSToLengthConversionData > > auto keyword = downcast<CSSPrimitiveValue>(*value).valueID(); > >- auto manifest = frame.page() ? frame.page()->applicationManifest() : std::nullopt; >+ auto manifest = frame.page() ? frame.page()->applicationManifest() : WTF::nullopt; > if (!manifest) > return keyword == CSSValueBrowser; > >diff --git a/Source/WebCore/css/RuleFeature.h b/Source/WebCore/css/RuleFeature.h >index b77a7d930209ae2de165ec32f450c663ea3368a6..2098d5f75db8feb9c19c643e5beadb27e1e8a5b1 100644 >--- a/Source/WebCore/css/RuleFeature.h >+++ b/Source/WebCore/css/RuleFeature.h >@@ -37,7 +37,7 @@ enum class MatchElement { Subject, Parent, Ancestor, DirectSibling, IndirectSibl > constexpr unsigned matchElementCount = static_cast<unsigned>(MatchElement::Host) + 1; > > struct RuleFeature { >- RuleFeature(StyleRule* rule, unsigned selectorIndex, unsigned selectorListIndex, std::optional<MatchElement> matchElement = std::nullopt, const CSSSelector* invalidationSelector = nullptr) >+ RuleFeature(StyleRule* rule, unsigned selectorIndex, unsigned selectorListIndex, WTF::Optional<MatchElement> matchElement = WTF::nullopt, const CSSSelector* invalidationSelector = nullptr) > : rule(rule) > , selectorIndex(selectorIndex) > , selectorListIndex(selectorListIndex) >@@ -48,7 +48,7 @@ struct RuleFeature { > StyleRule* rule; > unsigned selectorIndex; > unsigned selectorListIndex; >- std::optional<MatchElement> matchElement; >+ WTF::Optional<MatchElement> matchElement; > const CSSSelector* invalidationSelector; > }; > >diff --git a/Source/WebCore/css/StyleBuilderConverter.h b/Source/WebCore/css/StyleBuilderConverter.h >index e61d1f5472d49950e5ee353fa601594af46cf0d0..6b3785d644776026f4ad060b732031dfa6313976 100644 >--- a/Source/WebCore/css/StyleBuilderConverter.h >+++ b/Source/WebCore/css/StyleBuilderConverter.h >@@ -105,12 +105,12 @@ public: > #endif > static GridTrackSize convertGridTrackSize(StyleResolver&, const CSSValue&); > static Vector<GridTrackSize> convertGridTrackSizeList(StyleResolver&, const CSSValue&); >- static std::optional<GridPosition> convertGridPosition(StyleResolver&, const CSSValue&); >+ static WTF::Optional<GridPosition> convertGridPosition(StyleResolver&, const CSSValue&); > static GridAutoFlow convertGridAutoFlow(StyleResolver&, const CSSValue&); >- static std::optional<Length> convertWordSpacing(StyleResolver&, const CSSValue&); >- static std::optional<float> convertPerspective(StyleResolver&, const CSSValue&); >- static std::optional<Length> convertMarqueeIncrement(StyleResolver&, const CSSValue&); >- static std::optional<FilterOperations> convertFilterOperations(StyleResolver&, const CSSValue&); >+ static WTF::Optional<Length> convertWordSpacing(StyleResolver&, const CSSValue&); >+ static WTF::Optional<float> convertPerspective(StyleResolver&, const CSSValue&); >+ static WTF::Optional<Length> convertMarqueeIncrement(StyleResolver&, const CSSValue&); >+ static WTF::Optional<FilterOperations> convertFilterOperations(StyleResolver&, const CSSValue&); > #if PLATFORM(IOS_FAMILY) > static bool convertTouchCallout(StyleResolver&, const CSSValue&); > #endif >@@ -123,7 +123,7 @@ public: > static FontFeatureSettings convertFontFeatureSettings(StyleResolver&, const CSSValue&); > static FontSelectionValue convertFontWeightFromValue(const CSSValue&); > static FontSelectionValue convertFontStretchFromValue(const CSSValue&); >- static std::optional<FontSelectionValue> convertFontStyleFromValue(const CSSValue&); >+ static WTF::Optional<FontSelectionValue> convertFontStyleFromValue(const CSSValue&); > static FontSelectionValue convertFontWeight(StyleResolver&, const CSSValue&); > static FontSelectionValue convertFontStretch(StyleResolver&, const CSSValue&); > static FontSelectionValue convertFontStyle(StyleResolver&, const CSSValue&); >@@ -141,7 +141,7 @@ public: > static StyleContentAlignmentData convertContentAlignmentData(StyleResolver&, const CSSValue&); > static GlyphOrientation convertGlyphOrientation(StyleResolver&, const CSSValue&); > static GlyphOrientation convertGlyphOrientationOrAuto(StyleResolver&, const CSSValue&); >- static std::optional<Length> convertLineHeight(StyleResolver&, const CSSValue&, float multiplier = 1.f); >+ static WTF::Optional<Length> convertLineHeight(StyleResolver&, const CSSValue&, float multiplier = 1.f); > static FontSynthesis convertFontSynthesis(StyleResolver&, const CSSValue&); > > static BreakBetween convertPageBreakBetween(StyleResolver&, const CSSValue&); >@@ -1105,12 +1105,12 @@ inline GridTrackSize StyleBuilderConverter::convertGridTrackSize(StyleResolver& > return createGridTrackSize(value, styleResolver); > } > >-inline std::optional<GridPosition> StyleBuilderConverter::convertGridPosition(StyleResolver&, const CSSValue& value) >+inline WTF::Optional<GridPosition> StyleBuilderConverter::convertGridPosition(StyleResolver&, const CSSValue& value) > { > GridPosition gridPosition; > if (createGridPosition(value, gridPosition)) > return gridPosition; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolver&, const CSSValue& value) >@@ -1160,9 +1160,9 @@ inline CSSToLengthConversionData StyleBuilderConverter::csstoLengthConversionDat > return styleResolver.state().cssToLengthConversionData(); > } > >-inline std::optional<Length> StyleBuilderConverter::convertWordSpacing(StyleResolver& styleResolver, const CSSValue& value) >+inline WTF::Optional<Length> StyleBuilderConverter::convertWordSpacing(StyleResolver& styleResolver, const CSSValue& value) > { >- std::optional<Length> wordSpacing; >+ WTF::Optional<Length> wordSpacing; > auto& primitiveValue = downcast<CSSPrimitiveValue>(value); > if (primitiveValue.valueID() == CSSValueNormal) > wordSpacing = RenderStyle::initialWordSpacing(); >@@ -1176,7 +1176,7 @@ inline std::optional<Length> StyleBuilderConverter::convertWordSpacing(StyleReso > return wordSpacing; > } > >-inline std::optional<float> StyleBuilderConverter::convertPerspective(StyleResolver& styleResolver, const CSSValue& value) >+inline WTF::Optional<float> StyleBuilderConverter::convertPerspective(StyleResolver& styleResolver, const CSSValue& value) > { > auto& primitiveValue = downcast<CSSPrimitiveValue>(value); > if (primitiveValue.valueID() == CSSValueNone) >@@ -1190,12 +1190,12 @@ inline std::optional<float> StyleBuilderConverter::convertPerspective(StyleResol > else > ASSERT_NOT_REACHED(); > >- return perspective < 0 ? std::optional<float>(std::nullopt) : std::optional<float>(perspective); >+ return perspective < 0 ? WTF::Optional<float>(WTF::nullopt) : WTF::Optional<float>(perspective); > } > >-inline std::optional<Length> StyleBuilderConverter::convertMarqueeIncrement(StyleResolver& styleResolver, const CSSValue& value) >+inline WTF::Optional<Length> StyleBuilderConverter::convertMarqueeIncrement(StyleResolver& styleResolver, const CSSValue& value) > { >- std::optional<Length> marqueeLength; >+ WTF::Optional<Length> marqueeLength; > auto& primitiveValue = downcast<CSSPrimitiveValue>(value); > switch (primitiveValue.valueID()) { > case CSSValueSmall: >@@ -1219,12 +1219,12 @@ inline std::optional<Length> StyleBuilderConverter::convertMarqueeIncrement(Styl > return marqueeLength; > } > >-inline std::optional<FilterOperations> StyleBuilderConverter::convertFilterOperations(StyleResolver& styleResolver, const CSSValue& value) >+inline WTF::Optional<FilterOperations> StyleBuilderConverter::convertFilterOperations(StyleResolver& styleResolver, const CSSValue& value) > { > FilterOperations operations; > if (styleResolver.createFilterOperations(value, operations)) > return operations; >- return std::nullopt; >+ return WTF::nullopt; > } > > inline FontFeatureSettings StyleBuilderConverter::convertFontFeatureSettings(StyleResolver&, const CSSValue& value) >@@ -1280,15 +1280,15 @@ inline FontSelectionValue StyleBuilderConverter::convertFontStretchFromValue(con > return normalStretchValue(); > } > >-// The input value needs to parsed and valid, this function returns std::nullopt if the input was "normal". >-inline std::optional<FontSelectionValue> StyleBuilderConverter::convertFontStyleFromValue(const CSSValue& value) >+// The input value needs to parsed and valid, this function returns WTF::nullopt if the input was "normal". >+inline WTF::Optional<FontSelectionValue> StyleBuilderConverter::convertFontStyleFromValue(const CSSValue& value) > { > ASSERT(is<CSSFontStyleValue>(value)); > const auto& fontStyleValue = downcast<CSSFontStyleValue>(value); > > auto valueID = fontStyleValue.fontStyleValue->valueID(); > if (valueID == CSSValueNormal) >- return std::nullopt; >+ return WTF::nullopt; > if (valueID == CSSValueItalic) > return italicValue(); > ASSERT(valueID == CSSValueOblique); >@@ -1481,7 +1481,7 @@ inline GlyphOrientation StyleBuilderConverter::convertGlyphOrientationOrAuto(Sty > return convertGlyphOrientation(styleResolver, value); > } > >-inline std::optional<Length> StyleBuilderConverter::convertLineHeight(StyleResolver& styleResolver, const CSSValue& value, float multiplier) >+inline WTF::Optional<Length> StyleBuilderConverter::convertLineHeight(StyleResolver& styleResolver, const CSSValue& value, float multiplier) > { > auto& primitiveValue = downcast<CSSPrimitiveValue>(value); > if (primitiveValue.valueID() == CSSValueNormal) >@@ -1509,7 +1509,7 @@ inline std::optional<Length> StyleBuilderConverter::convertLineHeight(StyleResol > > // FIXME: The parser should only emit the above types, so this should never be reached. We should change the > // type of this function to return just a Length (and not an Optional). >- return std::nullopt; >+ return WTF::nullopt; > } > > inline FontSynthesis StyleBuilderConverter::convertFontSynthesis(StyleResolver&, const CSSValue& value) >diff --git a/Source/WebCore/css/StyleBuilderCustom.h b/Source/WebCore/css/StyleBuilderCustom.h >index 4370218f955e047f37465840809d81ff259b2ce0..519a4cd3bb26498ddda3ccb3aa2fd316959fe17e 100644 >--- a/Source/WebCore/css/StyleBuilderCustom.h >+++ b/Source/WebCore/css/StyleBuilderCustom.h >@@ -708,7 +708,7 @@ static inline float computeLineHeightMultiplierDueToFontSize(const Document& doc > > inline void StyleBuilderCustom::applyValueLineHeight(StyleResolver& styleResolver, CSSValue& value) > { >- std::optional<Length> lineHeight = StyleBuilderConverter::convertLineHeight(styleResolver, value, 1); >+ WTF::Optional<Length> lineHeight = StyleBuilderConverter::convertLineHeight(styleResolver, value, 1); > if (!lineHeight) > return; > >@@ -1177,9 +1177,9 @@ inline void StyleBuilderCustom::applyValueCounter(StyleResolver& styleResolver, > CounterDirectiveMap& map = styleResolver.style()->accessCounterDirectives(); > for (auto& keyValue : map) { > if (counterBehavior == Reset) >- keyValue.value.resetValue = std::nullopt; >+ keyValue.value.resetValue = WTF::nullopt; > else >- keyValue.value.incrementValue = std::nullopt; >+ keyValue.value.incrementValue = WTF::nullopt; > } > > if (setCounterIncrementToNone) >diff --git a/Source/WebCore/css/StyleProperties.cpp b/Source/WebCore/css/StyleProperties.cpp >index 5acb48f911a37178fae8a80e1783e69b7588cb58..4d45266a22a061b2d9f8fac05a8f5f37fbc66324 100644 >--- a/Source/WebCore/css/StyleProperties.cpp >+++ b/Source/WebCore/css/StyleProperties.cpp >@@ -248,11 +248,11 @@ String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const > } > } > >-std::optional<Color> StyleProperties::propertyAsColor(CSSPropertyID property) const >+WTF::Optional<Color> StyleProperties::propertyAsColor(CSSPropertyID property) const > { > auto colorValue = getPropertyCSSValue(property); > if (!is<CSSPrimitiveValue>(colorValue)) >- return std::nullopt; >+ return WTF::nullopt; > > auto& primitiveColor = downcast<CSSPrimitiveValue>(*colorValue); > return primitiveColor.isRGBColor() ? primitiveColor.color() : CSSParser::parseColor(colorValue->cssText()); >diff --git a/Source/WebCore/css/StyleProperties.h b/Source/WebCore/css/StyleProperties.h >index 50f72e9bac64a68186ff53fbf61f3bb9b331c238..2cf6e97ae9af65ac787b23a68cfbeaec2dd9b44c 100644 >--- a/Source/WebCore/css/StyleProperties.h >+++ b/Source/WebCore/css/StyleProperties.h >@@ -113,7 +113,7 @@ public: > WEBCORE_EXPORT RefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const; > WEBCORE_EXPORT String getPropertyValue(CSSPropertyID) const; > >- WEBCORE_EXPORT std::optional<Color> propertyAsColor(CSSPropertyID) const; >+ WEBCORE_EXPORT WTF::Optional<Color> propertyAsColor(CSSPropertyID) const; > WEBCORE_EXPORT CSSValueID propertyAsValueID(CSSPropertyID) const; > > bool propertyIsImportant(CSSPropertyID) const; >diff --git a/Source/WebCore/css/StyleRuleImport.cpp b/Source/WebCore/css/StyleRuleImport.cpp >index 20354cc1785659718e57a4975f7efa6d45949780..3f312a41779dfaa3774ec1671397b74d34033204 100644 >--- a/Source/WebCore/css/StyleRuleImport.cpp >+++ b/Source/WebCore/css/StyleRuleImport.cpp >@@ -118,7 +118,7 @@ void StyleRuleImport::requestStyleSheet() > > // FIXME: Skip Content Security Policy check when stylesheet is in a user agent shadow tree. > // See <https://bugs.webkit.org/show_bug.cgi?id=146663>. >- CachedResourceRequest request(absURL, CachedResourceLoader::defaultCachedResourceOptions(), std::nullopt, String(m_parentStyleSheet->charset())); >+ CachedResourceRequest request(absURL, CachedResourceLoader::defaultCachedResourceOptions(), WTF::nullopt, String(m_parentStyleSheet->charset())); > request.setInitiator(cachedResourceRequestInitiators().css); > if (m_cachedSheet) > m_cachedSheet->removeClient(m_styleSheetClient); >diff --git a/Source/WebCore/css/parser/MediaQueryParser.cpp b/Source/WebCore/css/parser/MediaQueryParser.cpp >index a71de6d3a19bec1c58b0057113397f9c9a99d2b3..8c3562ecf57f59b08f263af9894edaa896e3ee82 100644 >--- a/Source/WebCore/css/parser/MediaQueryParser.cpp >+++ b/Source/WebCore/css/parser/MediaQueryParser.cpp >@@ -285,7 +285,7 @@ MediaQueryParser::MediaQueryData::MediaQueryData(MediaQueryParserContext context > void MediaQueryParser::MediaQueryData::clear() > { > m_restrictor = MediaQuery::None; >- m_mediaType = std::nullopt; >+ m_mediaType = WTF::nullopt; > m_mediaFeature = String(); > m_expressions.clear(); > } >diff --git a/Source/WebCore/css/parser/MediaQueryParser.h b/Source/WebCore/css/parser/MediaQueryParser.h >index 90f0439b72f641415aff8e00f3586ca1e9182c88..a4ecb494e51e7c78085c098e0d016ff2b405ed86 100644 >--- a/Source/WebCore/css/parser/MediaQueryParser.h >+++ b/Source/WebCore/css/parser/MediaQueryParser.h >@@ -95,7 +95,7 @@ private: > > MediaQuery::Restrictor restrictor() const { return m_restrictor; } > Vector<MediaQueryExpression>& expressions() { return m_expressions; } >- const std::optional<String>& mediaType() const { return m_mediaType; } >+ const WTF::Optional<String>& mediaType() const { return m_mediaType; } > > bool currentMediaQueryChanged() const > { >@@ -111,7 +111,7 @@ private: > > private: > MediaQuery::Restrictor m_restrictor { MediaQuery::None }; >- std::optional<String> m_mediaType; >+ WTF::Optional<String> m_mediaType; > Vector<MediaQueryExpression> m_expressions; > String m_mediaFeature; > MediaQueryParserContext m_context; >diff --git a/Source/WebCore/cssjit/SelectorCompiler.cpp b/Source/WebCore/cssjit/SelectorCompiler.cpp >index efbcc0dcd45db55994c80441c12aab7f9658a3a6..e01c5b17b8a8dbd9c46deeb268e7b5dc11e0bf52 100644 >--- a/Source/WebCore/cssjit/SelectorCompiler.cpp >+++ b/Source/WebCore/cssjit/SelectorCompiler.cpp >@@ -329,8 +329,8 @@ private: > void generateElementHasFocusWithin(Assembler::JumpList& failureCases); > > // Helpers. >- void generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, Style::Relation::Type, std::optional<Assembler::RegisterID> value = { }); >- void generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, Style::Relation::Type, std::optional<Assembler::RegisterID> value = { }); >+ void generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, Style::Relation::Type, WTF::Optional<Assembler::RegisterID> value = { }); >+ void generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, Style::Relation::Type, WTF::Optional<Assembler::RegisterID> value = { }); > Assembler::Jump branchOnResolvingModeWithCheckingContext(Assembler::RelationalCondition, SelectorChecker::Mode, Assembler::RegisterID checkingContext); > Assembler::Jump branchOnResolvingMode(Assembler::RelationalCondition, SelectorChecker::Mode, Assembler::RegisterID checkingContext); > void generateElementIsFirstLink(Assembler::JumpList& failureCases, Assembler::RegisterID element); >@@ -2205,7 +2205,7 @@ void SelectorCodeGenerator::generateIndirectAdjacentTreeWalker(Assembler::JumpLi > localFailureCases.linkTo(loopStart, &m_assembler); > } > >-void SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, Style::Relation::Type relationType, std::optional<Assembler::RegisterID> value) >+void SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, Style::Relation::Type relationType, WTF::Optional<Assembler::RegisterID> value) > { > if (m_selectorContext == SelectorContext::QuerySelector) > return; >@@ -2223,7 +2223,7 @@ static void addStyleRelationFunction(SelectorChecker::CheckingContext* checkingC > checkingContext->styleRelations.append({ *element, Style::Relation::AffectedByActive, 1 }); > } > >-void SelectorCodeGenerator::generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, Style::Relation::Type relationType, std::optional<Assembler::RegisterID> value) >+void SelectorCodeGenerator::generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, Style::Relation::Type relationType, WTF::Optional<Assembler::RegisterID> value) > { > ASSERT(m_selectorContext != SelectorContext::QuerySelector); > >diff --git a/Source/WebCore/dom/ConstantPropertyMap.h b/Source/WebCore/dom/ConstantPropertyMap.h >index 9a9cd229b23107bb0575c3b3c81e88bdd79661ea..6aaeea70cf2474682f8edbb51d5dd5a0d9d1bd61 100644 >--- a/Source/WebCore/dom/ConstantPropertyMap.h >+++ b/Source/WebCore/dom/ConstantPropertyMap.h >@@ -70,7 +70,7 @@ private: > void updateConstantsForSafeAreaInsets(); > void updateConstantsForFullscreen(); > >- std::optional<Values> m_values; >+ WTF::Optional<Values> m_values; > > Document& m_document; > }; >diff --git a/Source/WebCore/dom/CustomElementReactionQueue.cpp b/Source/WebCore/dom/CustomElementReactionQueue.cpp >index e0d13d82c9b88a55ff36c40f0c7d315de6182cc3..771d95308d612fbdc72234183139a915a4abb7f1 100644 >--- a/Source/WebCore/dom/CustomElementReactionQueue.cpp >+++ b/Source/WebCore/dom/CustomElementReactionQueue.cpp >@@ -98,7 +98,7 @@ private: > Type m_type; > RefPtr<Document> m_oldDocument; > RefPtr<Document> m_newDocument; >- std::optional<QualifiedName> m_attributeName; >+ WTF::Optional<QualifiedName> m_attributeName; > AtomicString m_oldValue; > AtomicString m_newValue; > }; >diff --git a/Source/WebCore/dom/DataTransferItemList.h b/Source/WebCore/dom/DataTransferItemList.h >index d25359abac9b536607dd133440fe93fdd116c8a3..29d8f152a4d26b1813b36ba077d1fee38d2b41f6 100644 >--- a/Source/WebCore/dom/DataTransferItemList.h >+++ b/Source/WebCore/dom/DataTransferItemList.h >@@ -76,7 +76,7 @@ private: > Vector<Ref<DataTransferItem>>& ensureItems() const; > > DataTransfer& m_dataTransfer; >- mutable std::optional<Vector<Ref<DataTransferItem>>> m_items; >+ mutable WTF::Optional<Vector<Ref<DataTransferItem>>> m_items; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/dom/DeviceMotionData.cpp b/Source/WebCore/dom/DeviceMotionData.cpp >index 06816a6c89141232f265fef0aa3d04977603ab32..4f079eea22fe3130e5ba72a231537ced27a03e3b 100644 >--- a/Source/WebCore/dom/DeviceMotionData.cpp >+++ b/Source/WebCore/dom/DeviceMotionData.cpp >@@ -33,12 +33,12 @@ Ref<DeviceMotionData> DeviceMotionData::create() > return adoptRef(*new DeviceMotionData); > } > >-Ref<DeviceMotionData> DeviceMotionData::create(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, std::optional<double> interval) >+Ref<DeviceMotionData> DeviceMotionData::create(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, WTF::Optional<double> interval) > { > return adoptRef(*new DeviceMotionData(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), interval)); > } > >-DeviceMotionData::DeviceMotionData(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, std::optional<double> interval) >+DeviceMotionData::DeviceMotionData(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, WTF::Optional<double> interval) > : m_acceleration(WTFMove(acceleration)) > , m_accelerationIncludingGravity(WTFMove(accelerationIncludingGravity)) > , m_rotationRate(WTFMove(rotationRate)) >diff --git a/Source/WebCore/dom/DeviceMotionData.h b/Source/WebCore/dom/DeviceMotionData.h >index ccdb87a08f54540af2b11b25e2ee04160874f267..3d2c5534e7fc1894a9c5f4607c761b39f6ce6aed 100644 >--- a/Source/WebCore/dom/DeviceMotionData.h >+++ b/Source/WebCore/dom/DeviceMotionData.h >@@ -39,27 +39,27 @@ public: > { > return adoptRef(*new Acceleration); > } >- static Ref<Acceleration> create(std::optional<double> x, std::optional<double> y, std::optional<double> z) >+ static Ref<Acceleration> create(WTF::Optional<double> x, WTF::Optional<double> y, WTF::Optional<double> z) > { > return adoptRef(*new Acceleration(x, y, z)); > } > >- std::optional<double> x() const { return m_x; } >- std::optional<double> y() const { return m_y; } >- std::optional<double> z() const { return m_z; } >+ WTF::Optional<double> x() const { return m_x; } >+ WTF::Optional<double> y() const { return m_y; } >+ WTF::Optional<double> z() const { return m_z; } > > private: > Acceleration() = default; >- Acceleration(std::optional<double> x, std::optional<double> y, std::optional<double> z) >+ Acceleration(WTF::Optional<double> x, WTF::Optional<double> y, WTF::Optional<double> z) > : m_x(x) > , m_y(y) > , m_z(z) > { > } > >- std::optional<double> m_x; >- std::optional<double> m_y; >- std::optional<double> m_z; >+ WTF::Optional<double> m_x; >+ WTF::Optional<double> m_y; >+ WTF::Optional<double> m_z; > }; > > class RotationRate : public RefCounted<DeviceMotionData::RotationRate> { >@@ -68,46 +68,46 @@ public: > { > return adoptRef(*new RotationRate); > } >- static Ref<RotationRate> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma) >+ static Ref<RotationRate> create(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma) > { > return adoptRef(*new RotationRate(alpha, beta, gamma)); > } > >- std::optional<double> alpha() const { return m_alpha; } >- std::optional<double> beta() const { return m_beta; } >- std::optional<double> gamma() const { return m_gamma; } >+ WTF::Optional<double> alpha() const { return m_alpha; } >+ WTF::Optional<double> beta() const { return m_beta; } >+ WTF::Optional<double> gamma() const { return m_gamma; } > > private: > RotationRate() = default; >- RotationRate(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma) >+ RotationRate(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma) > : m_alpha(alpha) > , m_beta(beta) > , m_gamma(gamma) > { > } > >- std::optional<double> m_alpha; >- std::optional<double> m_beta; >- std::optional<double> m_gamma; >+ WTF::Optional<double> m_alpha; >+ WTF::Optional<double> m_beta; >+ WTF::Optional<double> m_gamma; > }; > > WEBCORE_EXPORT static Ref<DeviceMotionData> create(); >- WEBCORE_EXPORT static Ref<DeviceMotionData> create(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, std::optional<double> interval); >+ WEBCORE_EXPORT static Ref<DeviceMotionData> create(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, WTF::Optional<double> interval); > > const Acceleration* acceleration() const { return m_acceleration.get(); } > const Acceleration* accelerationIncludingGravity() const { return m_accelerationIncludingGravity.get(); } > const RotationRate* rotationRate() const { return m_rotationRate.get(); } > >- std::optional<double> interval() const { return m_interval; } >+ WTF::Optional<double> interval() const { return m_interval; } > > private: > DeviceMotionData() = default; >- DeviceMotionData(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, std::optional<double> interval); >+ DeviceMotionData(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, WTF::Optional<double> interval); > > RefPtr<Acceleration> m_acceleration; > RefPtr<Acceleration> m_accelerationIncludingGravity; > RefPtr<RotationRate> m_rotationRate; >- std::optional<double> m_interval; >+ WTF::Optional<double> m_interval; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/dom/DeviceMotionEvent.cpp b/Source/WebCore/dom/DeviceMotionEvent.cpp >index 904ef3af1b707deee95cf4f1f16e731fbe69078c..badb7373be9326e53ada0c6534c9b4dd7a93e7df 100644 >--- a/Source/WebCore/dom/DeviceMotionEvent.cpp >+++ b/Source/WebCore/dom/DeviceMotionEvent.cpp >@@ -43,23 +43,23 @@ DeviceMotionEvent::DeviceMotionEvent(const AtomicString& eventType, DeviceMotion > { > } > >-static std::optional<DeviceMotionEvent::Acceleration> convert(const DeviceMotionData::Acceleration* acceleration) >+static WTF::Optional<DeviceMotionEvent::Acceleration> convert(const DeviceMotionData::Acceleration* acceleration) > { > if (!acceleration) >- return std::nullopt; >+ return WTF::nullopt; > > return DeviceMotionEvent::Acceleration { acceleration->x(), acceleration->y(), acceleration->z() }; > } > >-static std::optional<DeviceMotionEvent::RotationRate> convert(const DeviceMotionData::RotationRate* rotationRate) >+static WTF::Optional<DeviceMotionEvent::RotationRate> convert(const DeviceMotionData::RotationRate* rotationRate) > { > if (!rotationRate) >- return std::nullopt; >+ return WTF::nullopt; > > return DeviceMotionEvent::RotationRate { rotationRate->alpha(), rotationRate->beta(), rotationRate->gamma() }; > } > >-static RefPtr<DeviceMotionData::Acceleration> convert(std::optional<DeviceMotionEvent::Acceleration>&& acceleration) >+static RefPtr<DeviceMotionData::Acceleration> convert(WTF::Optional<DeviceMotionEvent::Acceleration>&& acceleration) > { > if (!acceleration) > return nullptr; >@@ -70,7 +70,7 @@ static RefPtr<DeviceMotionData::Acceleration> convert(std::optional<DeviceMotion > return DeviceMotionData::Acceleration::create(acceleration->x, acceleration->y, acceleration->z); > } > >-static RefPtr<DeviceMotionData::RotationRate> convert(std::optional<DeviceMotionEvent::RotationRate>&& rotationRate) >+static RefPtr<DeviceMotionData::RotationRate> convert(WTF::Optional<DeviceMotionEvent::RotationRate>&& rotationRate) > { > if (!rotationRate) > return nullptr; >@@ -81,27 +81,27 @@ static RefPtr<DeviceMotionData::RotationRate> convert(std::optional<DeviceMotion > return DeviceMotionData::RotationRate::create(rotationRate->alpha, rotationRate->beta, rotationRate->gamma); > } > >-std::optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::acceleration() const >+WTF::Optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::acceleration() const > { > return convert(m_deviceMotionData->acceleration()); > } > >-std::optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::accelerationIncludingGravity() const >+WTF::Optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::accelerationIncludingGravity() const > { > return convert(m_deviceMotionData->accelerationIncludingGravity()); > } > >-std::optional<DeviceMotionEvent::RotationRate> DeviceMotionEvent::rotationRate() const >+WTF::Optional<DeviceMotionEvent::RotationRate> DeviceMotionEvent::rotationRate() const > { > return convert(m_deviceMotionData->rotationRate()); > } > >-std::optional<double> DeviceMotionEvent::interval() const >+WTF::Optional<double> DeviceMotionEvent::interval() const > { > return m_deviceMotionData->interval(); > } > >-void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<DeviceMotionEvent::Acceleration>&& acceleration, std::optional<DeviceMotionEvent::Acceleration>&& accelerationIncludingGravity, std::optional<DeviceMotionEvent::RotationRate>&& rotationRate, std::optional<double> interval) >+void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, WTF::Optional<DeviceMotionEvent::Acceleration>&& acceleration, WTF::Optional<DeviceMotionEvent::Acceleration>&& accelerationIncludingGravity, WTF::Optional<DeviceMotionEvent::RotationRate>&& rotationRate, WTF::Optional<double> interval) > { > if (isBeingDispatched()) > return; >diff --git a/Source/WebCore/dom/DeviceMotionEvent.h b/Source/WebCore/dom/DeviceMotionEvent.h >index 7a8e9a5a1689f39deb00655f83864c796ddac13a..7d350dd6a1d53ddeea44dce6f4a63c34364e82a6 100644 >--- a/Source/WebCore/dom/DeviceMotionEvent.h >+++ b/Source/WebCore/dom/DeviceMotionEvent.h >@@ -37,16 +37,16 @@ public: > > // FIXME: Merge this with DeviceMotionData::Acceleration > struct Acceleration { >- std::optional<double> x; >- std::optional<double> y; >- std::optional<double> z; >+ WTF::Optional<double> x; >+ WTF::Optional<double> y; >+ WTF::Optional<double> z; > }; > > // FIXME: Merge this with DeviceMotionData::RotationRate > struct RotationRate { >- std::optional<double> alpha; >- std::optional<double> beta; >- std::optional<double> gamma; >+ WTF::Optional<double> alpha; >+ WTF::Optional<double> beta; >+ WTF::Optional<double> gamma; > }; > > static Ref<DeviceMotionEvent> create(const AtomicString& eventType, DeviceMotionData* deviceMotionData) >@@ -59,12 +59,12 @@ public: > return adoptRef(*new DeviceMotionEvent); > } > >- std::optional<Acceleration> acceleration() const; >- std::optional<Acceleration> accelerationIncludingGravity() const; >- std::optional<RotationRate> rotationRate() const; >- std::optional<double> interval() const; >+ WTF::Optional<Acceleration> acceleration() const; >+ WTF::Optional<Acceleration> accelerationIncludingGravity() const; >+ WTF::Optional<RotationRate> rotationRate() const; >+ WTF::Optional<double> interval() const; > >- void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<Acceleration>&&, std::optional<Acceleration>&&, std::optional<RotationRate>&&, std::optional<double>); >+ void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, WTF::Optional<Acceleration>&&, WTF::Optional<Acceleration>&&, WTF::Optional<RotationRate>&&, WTF::Optional<double>); > > private: > DeviceMotionEvent(); >diff --git a/Source/WebCore/dom/DeviceOrientationData.cpp b/Source/WebCore/dom/DeviceOrientationData.cpp >index 668a41f5480f174ef50d962c0eb6900cb7f681e2..8cb456448a7b6530868603309f5506f795437ea1 100644 >--- a/Source/WebCore/dom/DeviceOrientationData.cpp >+++ b/Source/WebCore/dom/DeviceOrientationData.cpp >@@ -31,12 +31,12 @@ namespace WebCore { > #if PLATFORM(IOS_FAMILY) > > // FIXME: We should reconcile the iOS and OpenSource differences. >-Ref<DeviceOrientationData> DeviceOrientationData::create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy) >+Ref<DeviceOrientationData> DeviceOrientationData::create(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<double> compassHeading, WTF::Optional<double> compassAccuracy) > { > return adoptRef(*new DeviceOrientationData(alpha, beta, gamma, compassHeading, compassAccuracy)); > } > >-DeviceOrientationData::DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy) >+DeviceOrientationData::DeviceOrientationData(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<double> compassHeading, WTF::Optional<double> compassAccuracy) > : m_alpha(alpha) > , m_beta(beta) > , m_gamma(gamma) >@@ -47,12 +47,12 @@ DeviceOrientationData::DeviceOrientationData(std::optional<double> alpha, std::o > > #else > >-Ref<DeviceOrientationData> DeviceOrientationData::create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute) >+Ref<DeviceOrientationData> DeviceOrientationData::create(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<bool> absolute) > { > return adoptRef(*new DeviceOrientationData(alpha, beta, gamma, absolute)); > } > >-DeviceOrientationData::DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute) >+DeviceOrientationData::DeviceOrientationData(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<bool> absolute) > : m_alpha(alpha) > , m_beta(beta) > , m_gamma(gamma) >diff --git a/Source/WebCore/dom/DeviceOrientationData.h b/Source/WebCore/dom/DeviceOrientationData.h >index c8051ddf476834b90b0ae71db8ca53fb1c08f465..9b3588362b251cfbd6e3c52fbde54bb81873c012 100644 >--- a/Source/WebCore/dom/DeviceOrientationData.h >+++ b/Source/WebCore/dom/DeviceOrientationData.h >@@ -39,37 +39,37 @@ public: > } > > #if PLATFORM(IOS_FAMILY) >- WEBCORE_EXPORT static Ref<DeviceOrientationData> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy); >+ WEBCORE_EXPORT static Ref<DeviceOrientationData> create(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<double> compassHeading, WTF::Optional<double> compassAccuracy); > #else >- WEBCORE_EXPORT static Ref<DeviceOrientationData> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute); >+ WEBCORE_EXPORT static Ref<DeviceOrientationData> create(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<bool> absolute); > #endif > >- std::optional<double> alpha() const { return m_alpha; } >- std::optional<double> beta() const { return m_beta; } >- std::optional<double> gamma() const { return m_gamma; } >+ WTF::Optional<double> alpha() const { return m_alpha; } >+ WTF::Optional<double> beta() const { return m_beta; } >+ WTF::Optional<double> gamma() const { return m_gamma; } > #if PLATFORM(IOS_FAMILY) >- std::optional<double> compassHeading() const { return m_compassHeading; } >- std::optional<double> compassAccuracy() const { return m_compassAccuracy; } >+ WTF::Optional<double> compassHeading() const { return m_compassHeading; } >+ WTF::Optional<double> compassAccuracy() const { return m_compassAccuracy; } > #else >- std::optional<bool> absolute() const { return m_absolute; } >+ WTF::Optional<bool> absolute() const { return m_absolute; } > #endif > > private: > DeviceOrientationData() = default; > #if PLATFORM(IOS_FAMILY) >- DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy); >+ DeviceOrientationData(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<double> compassHeading, WTF::Optional<double> compassAccuracy); > #else >- DeviceOrientationData(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute); >+ DeviceOrientationData(WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<bool> absolute); > #endif > >- std::optional<double> m_alpha; >- std::optional<double> m_beta; >- std::optional<double> m_gamma; >+ WTF::Optional<double> m_alpha; >+ WTF::Optional<double> m_beta; >+ WTF::Optional<double> m_gamma; > #if PLATFORM(IOS_FAMILY) >- std::optional<double> m_compassHeading; >- std::optional<double> m_compassAccuracy; >+ WTF::Optional<double> m_compassHeading; >+ WTF::Optional<double> m_compassAccuracy; > #else >- std::optional<bool> m_absolute; >+ WTF::Optional<bool> m_absolute; > #endif > }; > >diff --git a/Source/WebCore/dom/DeviceOrientationEvent.cpp b/Source/WebCore/dom/DeviceOrientationEvent.cpp >index c47ad46714bf722bb96faefcebe2b6a24761dc1b..7b23e7283010b9aba8e70f6c91ade4fdc71e2e01 100644 >--- a/Source/WebCore/dom/DeviceOrientationEvent.cpp >+++ b/Source/WebCore/dom/DeviceOrientationEvent.cpp >@@ -43,34 +43,34 @@ DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, De > { > } > >-std::optional<double> DeviceOrientationEvent::alpha() const >+WTF::Optional<double> DeviceOrientationEvent::alpha() const > { > return m_orientation->alpha(); > } > >-std::optional<double> DeviceOrientationEvent::beta() const >+WTF::Optional<double> DeviceOrientationEvent::beta() const > { > return m_orientation->beta(); > } > >-std::optional<double> DeviceOrientationEvent::gamma() const >+WTF::Optional<double> DeviceOrientationEvent::gamma() const > { > return m_orientation->gamma(); > } > > #if PLATFORM(IOS_FAMILY) > >-std::optional<double> DeviceOrientationEvent::compassHeading() const >+WTF::Optional<double> DeviceOrientationEvent::compassHeading() const > { > return m_orientation->compassHeading(); > } > >-std::optional<double> DeviceOrientationEvent::compassAccuracy() const >+WTF::Optional<double> DeviceOrientationEvent::compassAccuracy() const > { > return m_orientation->compassAccuracy(); > } > >-void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy) >+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<double> compassHeading, WTF::Optional<double> compassAccuracy) > { > if (isBeingDispatched()) > return; >@@ -81,12 +81,12 @@ void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type > > #else > >-std::optional<bool> DeviceOrientationEvent::absolute() const >+WTF::Optional<bool> DeviceOrientationEvent::absolute() const > { > return m_orientation->absolute(); > } > >-void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute) >+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<bool> absolute) > { > if (isBeingDispatched()) > return; >diff --git a/Source/WebCore/dom/DeviceOrientationEvent.h b/Source/WebCore/dom/DeviceOrientationEvent.h >index c288492c8c577a19a676c7524ebdcbef516f9d7a..4db260b35cb11d828dfaf61ea6d014775eb47ed4 100644 >--- a/Source/WebCore/dom/DeviceOrientationEvent.h >+++ b/Source/WebCore/dom/DeviceOrientationEvent.h >@@ -45,19 +45,19 @@ public: > > virtual ~DeviceOrientationEvent(); > >- std::optional<double> alpha() const; >- std::optional<double> beta() const; >- std::optional<double> gamma() const; >+ WTF::Optional<double> alpha() const; >+ WTF::Optional<double> beta() const; >+ WTF::Optional<double> gamma() const; > > #if PLATFORM(IOS_FAMILY) >- std::optional<double> compassHeading() const; >- std::optional<double> compassAccuracy() const; >+ WTF::Optional<double> compassHeading() const; >+ WTF::Optional<double> compassAccuracy() const; > >- void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy); >+ void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<double> compassHeading, WTF::Optional<double> compassAccuracy); > #else >- std::optional<bool> absolute() const; >+ WTF::Optional<bool> absolute() const; > >- void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute); >+ void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, WTF::Optional<double> alpha, WTF::Optional<double> beta, WTF::Optional<double> gamma, WTF::Optional<bool> absolute); > #endif > > private: >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index d6be912b123ab17970e88b482146091383aabdda..9cd9b787fe69bd9ed0dc3382933685440d31f08b 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -1981,7 +1981,7 @@ void Document::updateTextRenderer(Text& text, unsigned offsetOfReplacedText, uns > SetForScope<bool> inRenderTreeUpdate(m_inRenderTreeUpdate, true); > > auto textUpdate = std::make_unique<Style::Update>(*this); >- textUpdate->addText(text, { offsetOfReplacedText, lengthOfReplacedText, std::nullopt }); >+ textUpdate->addText(text, { offsetOfReplacedText, lengthOfReplacedText, WTF::nullopt }); > > RenderTreeUpdater renderTreeUpdater(*this); > renderTreeUpdater.commit(WTFMove(textUpdate)); >@@ -3562,7 +3562,7 @@ void Document::dispatchDisabledAdaptationsDidChangeForMainFrame() > page()->chrome().dispatchDisabledAdaptationsDidChange(m_disabledAdaptations); > } > >-void Document::setOverrideViewportArguments(const std::optional<ViewportArguments>& viewportArguments) >+void Document::setOverrideViewportArguments(const WTF::Optional<ViewportArguments>& viewportArguments) > { > if (viewportArguments == m_overrideViewportArguments) > return; >@@ -4873,7 +4873,7 @@ ExceptionOr<void> Document::setDomain(const String& newDomain) > return { }; > } > >-void Document::overrideLastModified(const std::optional<WallTime>& lastModified) >+void Document::overrideLastModified(const WTF::Optional<WallTime>& lastModified) > { > m_overrideLastModified = lastModified; > } >@@ -4881,7 +4881,7 @@ void Document::overrideLastModified(const std::optional<WallTime>& lastModified) > // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified > String Document::lastModified() const > { >- std::optional<WallTime> dateTime; >+ WTF::Optional<WallTime> dateTime; > if (m_overrideLastModified) > dateTime = m_overrideLastModified; > else if (loader()) >@@ -5956,15 +5956,15 @@ void Document::detachRange(Range* range) > m_ranges.remove(range); > } > >-std::optional<RenderingContext> Document::getCSSCanvasContext(const String& type, const String& name, int width, int height) >+WTF::Optional<RenderingContext> Document::getCSSCanvasContext(const String& type, const String& name, int width, int height) > { > HTMLCanvasElement* element = getCSSCanvasElement(name); > if (!element) >- return std::nullopt; >+ return WTF::nullopt; > element->setSize({ width, height }); > auto context = element->getContext(type); > if (!context) >- return std::nullopt; >+ return WTF::nullopt; > > #if ENABLE(WEBGL) > if (is<WebGLRenderingContext>(*context)) >@@ -7706,21 +7706,21 @@ static void expandRootBoundsWithRootMargin(FloatRect& localRootBounds, const Len > localRootBounds.expand(rootMarginFloatBox); > } > >-static std::optional<LayoutRect> computeClippedRectInRootContentsSpace(const LayoutRect& rect, const RenderElement* renderer) >+static WTF::Optional<LayoutRect> computeClippedRectInRootContentsSpace(const LayoutRect& rect, const RenderElement* renderer) > { > OptionSet<RenderObject::VisibleRectContextOption> visibleRectOptions = { RenderObject::VisibleRectContextOption::UseEdgeInclusiveIntersection, RenderObject::VisibleRectContextOption::ApplyCompositedClips, RenderObject::VisibleRectContextOption::ApplyCompositedContainerScrolls }; >- std::optional<LayoutRect> rectInFrameAbsoluteSpace = renderer->computeVisibleRectInContainer(rect, &renderer->view(), {false /* hasPositionFixedDescendant */, false /* dirtyRectIsFlipped */, visibleRectOptions }); >+ WTF::Optional<LayoutRect> rectInFrameAbsoluteSpace = renderer->computeVisibleRectInContainer(rect, &renderer->view(), {false /* hasPositionFixedDescendant */, false /* dirtyRectIsFlipped */, visibleRectOptions }); > if (!rectInFrameAbsoluteSpace || renderer->frame().isMainFrame()) > return rectInFrameAbsoluteSpace; > > bool intersects = rectInFrameAbsoluteSpace->edgeInclusiveIntersect(renderer->view().frameView().layoutViewportRect()); > if (!intersects) >- return std::nullopt; >+ return WTF::nullopt; > > LayoutRect rectInFrameViewSpace(renderer->view().frameView().contentsToView(snappedIntRect(*rectInFrameAbsoluteSpace))); > auto* ownerRenderer = renderer->frame().ownerRenderer(); > if (!ownerRenderer) >- return std::nullopt; >+ return WTF::nullopt; > > rectInFrameViewSpace.moveBy(ownerRenderer->contentBoxLocation()); > return computeClippedRectInRootContentsSpace(rectInFrameViewSpace, ownerRenderer); >@@ -7733,24 +7733,24 @@ struct IntersectionObservationState { > bool isIntersecting { false }; > }; > >-static std::optional<IntersectionObservationState> computeIntersectionState(FrameView& frameView, const IntersectionObserver& observer, Element& target, bool applyRootMargin) >+static WTF::Optional<IntersectionObservationState> computeIntersectionState(FrameView& frameView, const IntersectionObserver& observer, Element& target, bool applyRootMargin) > { > auto* targetRenderer = target.renderer(); > if (!targetRenderer) >- return std::nullopt; >+ return WTF::nullopt; > > FloatRect localRootBounds; > RenderBlock* rootRenderer; > if (observer.root()) { > if (observer.trackingDocument() != &target.document()) >- return std::nullopt; >+ return WTF::nullopt; > > if (!observer.root()->renderer() || !is<RenderBlock>(observer.root()->renderer())) >- return std::nullopt; >+ return WTF::nullopt; > > rootRenderer = downcast<RenderBlock>(observer.root()->renderer()); > if (!rootRenderer->isContainingBlockAncestorFor(*targetRenderer)) >- return std::nullopt; >+ return WTF::nullopt; > > if (rootRenderer->hasOverflowClip()) > localRootBounds = rootRenderer->contentBoxRect(); >@@ -7760,7 +7760,7 @@ static std::optional<IntersectionObservationState> computeIntersectionState(Fram > ASSERT(frameView.frame().isMainFrame()); > // FIXME: Handle the case of an implicit-root observer that has a target in a different frame tree. > if (&targetRenderer->frame().mainFrame() != &frameView.frame()) >- return std::nullopt; >+ return WTF::nullopt; > rootRenderer = frameView.renderView(); > localRootBounds = frameView.layoutViewportRect(); > } >@@ -7776,7 +7776,7 @@ static std::optional<IntersectionObservationState> computeIntersectionState(Fram > else if (is<RenderLineBreak>(targetRenderer)) > localTargetBounds = downcast<RenderLineBreak>(targetRenderer)->linesBoundingBox(); > >- std::optional<LayoutRect> rootLocalTargetRect; >+ WTF::Optional<LayoutRect> rootLocalTargetRect; > if (observer.root()) { > OptionSet<RenderObject::VisibleRectContextOption> visibleRectOptions = { RenderObject::VisibleRectContextOption::UseEdgeInclusiveIntersection, RenderObject::VisibleRectContextOption::ApplyCompositedClips, RenderObject::VisibleRectContextOption::ApplyCompositedContainerScrolls }; > rootLocalTargetRect = targetRenderer->computeVisibleRectInContainer(localTargetBounds, rootRenderer, { false /* hasPositionFixedDescendant */, false /* dirtyRectIsFlipped */, visibleRectOptions }); >@@ -7860,7 +7860,7 @@ void Document::updateIntersectionObservations() > clientIntersectionRect = targetFrameView->absoluteToClientRect(intersectionState->absoluteIntersectionRect, target->renderer()->style().effectiveZoom()); > } > >- std::optional<DOMRectInit> reportedRootBounds; >+ WTF::Optional<DOMRectInit> reportedRootBounds; > if (isSameOriginObservation) { > reportedRootBounds = DOMRectInit({ > clientRootBounds.x(), >@@ -8474,7 +8474,7 @@ void Document::setServiceWorkerConnection(SWClientConnection* serviceWorkerConne > if (!m_serviceWorkerConnection) > return; > >- auto controllingServiceWorkerRegistrationIdentifier = activeServiceWorker() ? std::make_optional<ServiceWorkerRegistrationIdentifier>(activeServiceWorker()->registrationIdentifier()) : std::nullopt; >+ auto controllingServiceWorkerRegistrationIdentifier = activeServiceWorker() ? WTF::makeOptional<ServiceWorkerRegistrationIdentifier>(activeServiceWorker()->registrationIdentifier()) : WTF::nullopt; > m_serviceWorkerConnection->registerServiceWorkerClient(topOrigin(), ServiceWorkerClientData::from(*this, *serviceWorkerConnection), controllingServiceWorkerRegistrationIdentifier); > } > #endif >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index 4cca3a1d1204582882ad87238187bc24d8e9b952..d7857571a48533a42771363ccf6c85a5152ba399 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -415,7 +415,7 @@ public: > void setViewportArguments(const ViewportArguments& viewportArguments) { m_viewportArguments = viewportArguments; } > ViewportArguments viewportArguments() const { return m_viewportArguments; } > >- WEBCORE_EXPORT void setOverrideViewportArguments(const std::optional<ViewportArguments>&); >+ WEBCORE_EXPORT void setOverrideViewportArguments(const WTF::Optional<ViewportArguments>&); > > OptionSet<DisabledAdaptations> disabledAdaptations() const { return m_disabledAdaptations; } > #ifndef NDEBUG >@@ -929,7 +929,7 @@ public: > WEBCORE_EXPORT String domain() const; > ExceptionOr<void> setDomain(const String& newDomain); > >- void overrideLastModified(const std::optional<WallTime>&); >+ void overrideLastModified(const WTF::Optional<WallTime>&); > WEBCORE_EXPORT String lastModified() const; > > // The cookieURL is used to query the cookie database for this document's >@@ -1050,7 +1050,7 @@ public: > void setHasNodesWithMissingStyle() { m_hasNodesWithMissingStyle = true; } > > // Extension for manipulating canvas drawing contexts for use in CSS >- std::optional<RenderingContext> getCSSCanvasContext(const String& type, const String& name, int width, int height); >+ WTF::Optional<RenderingContext> getCSSCanvasContext(const String& type, const String& name, int width, int height); > HTMLCanvasElement* getCSSCanvasElement(const String& name); > String nameForCSSCanvasElement(const HTMLCanvasElement&) const; > >@@ -1844,7 +1844,7 @@ private: > Timer m_loadEventDelayTimer; > > ViewportArguments m_viewportArguments; >- std::optional<ViewportArguments> m_overrideViewportArguments; >+ WTF::Optional<ViewportArguments> m_overrideViewportArguments; > OptionSet<DisabledAdaptations> m_disabledAdaptations; > > DocumentTiming m_documentTiming; >@@ -1931,7 +1931,7 @@ private: > > String m_cachedDOMCookies; > >- std::optional<WallTime> m_overrideLastModified; >+ WTF::Optional<WallTime> m_overrideLastModified; > > HashSet<RefPtr<Element>> m_associatedFormControls; > unsigned m_disabledFieldsetElementsCount { 0 }; >@@ -1959,7 +1959,7 @@ private: > MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying }; > bool m_userHasInteractedWithMediaElement { false }; > PageCacheState m_pageCacheState { NotInPageCache }; >- std::optional<ReferrerPolicy> m_referrerPolicy; >+ WTF::Optional<ReferrerPolicy> m_referrerPolicy; > ReadyState m_readyState { Complete }; > > MutationObserverOptions m_mutationObserverTypes { 0 }; >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index 6468eabf340002285c4c542984ef77d9cda55894..8c55bb8c429037d921f70c6332d8a7048795767c 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -655,7 +655,7 @@ void Element::setHovered(bool flag) > } > > // FIXME(webkit.org/b/161611): Take into account orientation/direction. >-inline ScrollAlignment toScrollAlignment(std::optional<ScrollLogicalPosition> position, bool isVertical) >+inline ScrollAlignment toScrollAlignment(WTF::Optional<ScrollLogicalPosition> position, bool isVertical) > { > switch (position.value_or(isVertical ? ScrollLogicalPosition::Start : ScrollLogicalPosition::Nearest)) { > case ScrollLogicalPosition::Start: >@@ -672,7 +672,7 @@ inline ScrollAlignment toScrollAlignment(std::optional<ScrollLogicalPosition> po > } > } > >-void Element::scrollIntoView(std::optional<Variant<bool, ScrollIntoViewOptions>>&& arg) >+void Element::scrollIntoView(WTF::Optional<Variant<bool, ScrollIntoViewOptions>>&& arg) > { > document().updateLayoutIgnorePendingStylesheets(); > >@@ -1270,7 +1270,7 @@ LayoutRect Element::absoluteEventHandlerBounds(bool& includesFixedPositionElemen > return absoluteEventBoundsOfElementAndDescendants(includesFixedPositionElements); > } > >-static std::optional<std::pair<RenderObject*, LayoutRect>> listBoxElementBoundingBox(Element& element) >+static WTF::Optional<std::pair<RenderObject*, LayoutRect>> listBoxElementBoundingBox(Element& element) > { > HTMLSelectElement* selectElement; > bool isGroup; >@@ -1281,13 +1281,13 @@ static std::optional<std::pair<RenderObject*, LayoutRect>> listBoxElementBoundin > selectElement = downcast<HTMLOptGroupElement>(element).ownerSelectElement(); > isGroup = true; > } else >- return std::nullopt; >+ return WTF::nullopt; > > if (!selectElement || !selectElement->renderer() || !is<RenderListBox>(selectElement->renderer())) >- return std::nullopt; >+ return WTF::nullopt; > > auto& renderer = downcast<RenderListBox>(*selectElement->renderer()); >- std::optional<LayoutRect> boundingBox; >+ WTF::Optional<LayoutRect> boundingBox; > int optionIndex = 0; > for (auto* item : selectElement->listItems()) { > if (item == &element) { >@@ -1305,7 +1305,7 @@ static std::optional<std::pair<RenderObject*, LayoutRect>> listBoxElementBoundin > } > > if (!boundingBox) >- return std::nullopt; >+ return WTF::nullopt; > > return std::pair<RenderObject*, LayoutRect> { &renderer, boundingBox.value() }; > } >@@ -1398,7 +1398,7 @@ const AtomicString& Element::getAttributeNS(const AtomicString& namespaceURI, co > } > > // https://dom.spec.whatwg.org/#dom-element-toggleattribute >-ExceptionOr<bool> Element::toggleAttribute(const AtomicString& qualifiedName, std::optional<bool> force) >+ExceptionOr<bool> Element::toggleAttribute(const AtomicString& qualifiedName, WTF::Optional<bool> force) > { > if (!Document::isValidName(qualifiedName)) > return Exception { InvalidCharacterError }; >@@ -3756,10 +3756,10 @@ void Element::didDetachRenderers() > ASSERT(hasCustomStyleResolveCallbacks()); > } > >-std::optional<ElementStyle> Element::resolveCustomStyle(const RenderStyle&, const RenderStyle*) >+WTF::Optional<ElementStyle> Element::resolveCustomStyle(const RenderStyle&, const RenderStyle*) > { > ASSERT(hasCustomStyleResolveCallbacks()); >- return std::nullopt; >+ return WTF::nullopt; > } > > void Element::cloneAttributesFromElement(const Element& other) >@@ -4003,10 +4003,10 @@ Element* Element::findAnchorElementForLink(String& outAnchorName) > return nullptr; > } > >-ExceptionOr<Ref<WebAnimation>> Element::animate(JSC::ExecState& state, JSC::Strong<JSC::JSObject>&& keyframes, std::optional<Variant<double, KeyframeAnimationOptions>>&& options) >+ExceptionOr<Ref<WebAnimation>> Element::animate(JSC::ExecState& state, JSC::Strong<JSC::JSObject>&& keyframes, WTF::Optional<Variant<double, KeyframeAnimationOptions>>&& options) > { > String id = ""; >- std::optional<Variant<double, KeyframeEffectOptions>> keyframeEffectOptions; >+ WTF::Optional<Variant<double, KeyframeEffectOptions>> keyframeEffectOptions; > if (options) { > auto optionsValue = options.value(); > Variant<double, KeyframeEffectOptions> keyframeEffectOptionsVariant; >diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h >index bc6eba852548670077f3888bb20bcc0ac9f6f5a0..a5e2689bcc857372082aae4903ec08448e365787 100644 >--- a/Source/WebCore/dom/Element.h >+++ b/Source/WebCore/dom/Element.h >@@ -122,7 +122,7 @@ public: > static ExceptionOr<QualifiedName> parseAttributeName(const AtomicString& namespaceURI, const AtomicString& qualifiedName); > WEBCORE_EXPORT ExceptionOr<void> setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value); > >- ExceptionOr<bool> toggleAttribute(const AtomicString& qualifiedName, std::optional<bool> force); >+ ExceptionOr<bool> toggleAttribute(const AtomicString& qualifiedName, WTF::Optional<bool> force); > > const AtomicString& getIdAttribute() const; > void setIdAttribute(const AtomicString&); >@@ -143,7 +143,7 @@ public: > unsigned findAttributeIndexByName(const QualifiedName& name) const { return elementData()->findAttributeIndexByName(name); } > unsigned findAttributeIndexByName(const AtomicString& name, bool shouldIgnoreAttributeCase) const { return elementData()->findAttributeIndexByName(name, shouldIgnoreAttributeCase); } > >- WEBCORE_EXPORT void scrollIntoView(std::optional<Variant<bool, ScrollIntoViewOptions>>&& arg); >+ WEBCORE_EXPORT void scrollIntoView(WTF::Optional<Variant<bool, ScrollIntoViewOptions>>&& arg); > WEBCORE_EXPORT void scrollIntoView(bool alignToTop = true); > WEBCORE_EXPORT void scrollIntoViewIfNeeded(bool centerIfNeeded = true); > WEBCORE_EXPORT void scrollIntoViewIfNotVisible(bool centerIfNotVisible = true); >@@ -522,7 +522,7 @@ public: > virtual void didAttachRenderers(); > virtual void willDetachRenderers(); > virtual void didDetachRenderers(); >- virtual std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle); >+ virtual WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle); > > LayoutRect absoluteEventHandlerBounds(bool& includesFixedPositionElements) override; > >@@ -582,7 +582,7 @@ public: > > Element* findAnchorElementForLink(String& outAnchorName); > >- ExceptionOr<Ref<WebAnimation>> animate(JSC::ExecState&, JSC::Strong<JSC::JSObject>&&, std::optional<Variant<double, KeyframeAnimationOptions>>&&); >+ ExceptionOr<Ref<WebAnimation>> animate(JSC::ExecState&, JSC::Strong<JSC::JSObject>&&, WTF::Optional<Variant<double, KeyframeAnimationOptions>>&&); > Vector<RefPtr<WebAnimation>> getAnimations(); > > protected: >diff --git a/Source/WebCore/dom/ElementIteratorAssertions.h b/Source/WebCore/dom/ElementIteratorAssertions.h >index 393b351c74760806b0c8aaf343f2a54d7bd28525..a941775b143200ed5dc70a297f56298411fa02ca 100644 >--- a/Source/WebCore/dom/ElementIteratorAssertions.h >+++ b/Source/WebCore/dom/ElementIteratorAssertions.h >@@ -39,7 +39,7 @@ public: > private: > const Document* m_document; > uint64_t m_initialDOMTreeVersion; >- std::optional<ScriptDisallowedScope> m_eventDispatchAssertion; >+ WTF::Optional<ScriptDisallowedScope> m_eventDispatchAssertion; > }; > > // FIXME: No real point in doing these as inlines; they are for debugging and we usually turn off inlining in debug builds. >@@ -59,14 +59,14 @@ inline bool ElementIteratorAssertions::domTreeHasMutated() const > > inline void ElementIteratorAssertions::dropEventDispatchAssertion() > { >- m_eventDispatchAssertion = std::nullopt; >+ m_eventDispatchAssertion = WTF::nullopt; > } > > inline void ElementIteratorAssertions::clear() > { > m_document = nullptr; > m_initialDOMTreeVersion = 0; >- m_eventDispatchAssertion = std::nullopt; >+ m_eventDispatchAssertion = WTF::nullopt; > } > > } // namespace WebCore >diff --git a/Source/WebCore/dom/EventTarget.h b/Source/WebCore/dom/EventTarget.h >index 7c7e110b4d0011470892a0aa04699f8719328552..130fe5f22a76038c6c977a71e94cd5593bb8e7d6 100644 >--- a/Source/WebCore/dom/EventTarget.h >+++ b/Source/WebCore/dom/EventTarget.h >@@ -70,13 +70,13 @@ public: > }; > > struct AddEventListenerOptions : ListenerOptions { >- AddEventListenerOptions(bool capture = false, std::optional<bool> passive = std::nullopt, bool once = false) >+ AddEventListenerOptions(bool capture = false, WTF::Optional<bool> passive = WTF::nullopt, bool once = false) > : ListenerOptions(capture) > , passive(passive) > , once(once) > { } > >- std::optional<bool> passive; >+ WTF::Optional<bool> passive; > bool once { false }; > }; > >diff --git a/Source/WebCore/dom/GCReachableRef.h b/Source/WebCore/dom/GCReachableRef.h >index e66c975460a86ac240d51cc60e8b60640f8a8a12..7e9c15bccf3e1acafe0e6cfd1be8f1fe3e02e9e5 100644 >--- a/Source/WebCore/dom/GCReachableRef.h >+++ b/Source/WebCore/dom/GCReachableRef.h >@@ -124,8 +124,8 @@ template<typename P> struct HashTraits<WebCore::GCReachableRef<P>> : SimpleClass > static PeekType peek(const Ref<P>& value) { return const_cast<PeekType>(value.ptrAllowingHashTableEmptyValue()); } > static PeekType peek(P* value) { return value; } > >- typedef std::optional<Ref<P>> TakeType; >- static TakeType take(Ref<P>&& value) { return isEmptyValue(value) ? std::nullopt : std::optional<Ref<P>>(WTFMove(value)); } >+ typedef WTF::Optional<Ref<P>> TakeType; >+ static TakeType take(Ref<P>&& value) { return isEmptyValue(value) ? WTF::nullopt : WTF::Optional<Ref<P>>(WTFMove(value)); } > }; > > template <typename T, typename U> >diff --git a/Source/WebCore/dom/InlineStyleSheetOwner.cpp b/Source/WebCore/dom/InlineStyleSheetOwner.cpp >index 109f724c583160a718cb5874d0eff84eaa4fffbd..7fd78dd26858ed099ed5399578cc268bf1f831d8 100644 >--- a/Source/WebCore/dom/InlineStyleSheetOwner.cpp >+++ b/Source/WebCore/dom/InlineStyleSheetOwner.cpp >@@ -58,7 +58,7 @@ static CSSParserContext parserContextForElement(const Element& element) > return result; > } > >-static std::optional<InlineStyleSheetCacheKey> makeInlineStyleSheetCacheKey(const String& text, const Element& element) >+static WTF::Optional<InlineStyleSheetCacheKey> makeInlineStyleSheetCacheKey(const String& text, const Element& element) > { > // Only cache for shadow trees. Main document inline stylesheets are generally unique and can't be shared between documents. > // FIXME: This could be relaxed when a stylesheet does not contain document-relative URLs (or #urls). >diff --git a/Source/WebCore/dom/KeyboardEvent.cpp b/Source/WebCore/dom/KeyboardEvent.cpp >index eed5bd92aaf274872d5e477635313af5f9308821..23de812c55d0d3fbb19b0567f28f6c7c0b3fefc3 100644 >--- a/Source/WebCore/dom/KeyboardEvent.cpp >+++ b/Source/WebCore/dom/KeyboardEvent.cpp >@@ -162,12 +162,12 @@ void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, > > setModifierKeys(ctrlKey, altKey, shiftKey, metaKey, altGraphKey); > >- m_charCode = std::nullopt; >+ m_charCode = WTF::nullopt; > m_isComposing = false; >- m_keyCode = std::nullopt; >+ m_keyCode = WTF::nullopt; > m_repeat = false; > m_underlyingPlatformEvent = nullptr; >- m_which = std::nullopt; >+ m_which = WTF::nullopt; > > #if ENABLE(KEYBOARD_CODE_ATTRIBUTE) > m_code = { }; >diff --git a/Source/WebCore/dom/KeyboardEvent.h b/Source/WebCore/dom/KeyboardEvent.h >index 07a32da0c80dbf83e711e7db857fdd4426a7b45d..7500290a9c4875dc01986c44f30e83055bec236d 100644 >--- a/Source/WebCore/dom/KeyboardEvent.h >+++ b/Source/WebCore/dom/KeyboardEvent.h >@@ -55,7 +55,7 @@ public: > > // Legacy. > String keyIdentifier; >- std::optional<unsigned> keyLocation; >+ WTF::Optional<unsigned> keyLocation; > unsigned charCode; > unsigned keyCode; > unsigned which; >@@ -114,9 +114,9 @@ private: > unsigned m_location { DOM_KEY_LOCATION_STANDARD }; > bool m_repeat { false }; > bool m_isComposing { false }; >- std::optional<unsigned> m_charCode; >- std::optional<unsigned> m_keyCode; >- std::optional<unsigned> m_which; >+ WTF::Optional<unsigned> m_charCode; >+ WTF::Optional<unsigned> m_keyCode; >+ WTF::Optional<unsigned> m_which; > > #if PLATFORM(COCOA) > // Commands that were sent by AppKit when interpreting the event. Doesn't include input method commands. >diff --git a/Source/WebCore/dom/LoadableClassicScript.cpp b/Source/WebCore/dom/LoadableClassicScript.cpp >index b3d12702539150a46986d39850795f3622971dc6..542e7fd11f649a832daf78f9b3ce896d99d780b7 100644 >--- a/Source/WebCore/dom/LoadableClassicScript.cpp >+++ b/Source/WebCore/dom/LoadableClassicScript.cpp >@@ -52,16 +52,16 @@ bool LoadableClassicScript::isLoaded() const > return m_cachedScript->isLoaded(); > } > >-std::optional<LoadableScript::Error> LoadableClassicScript::error() const >+WTF::Optional<LoadableScript::Error> LoadableClassicScript::error() const > { > ASSERT(m_cachedScript); > if (m_error) > return m_error; > > if (m_cachedScript->errorOccurred()) >- return Error { ErrorType::CachedScript, std::nullopt }; >+ return Error { ErrorType::CachedScript, WTF::nullopt }; > >- return std::nullopt; >+ return WTF::nullopt; > } > > bool LoadableClassicScript::wasCanceled() const >diff --git a/Source/WebCore/dom/LoadableClassicScript.h b/Source/WebCore/dom/LoadableClassicScript.h >index 73a28b7ec78dc3b933177e5bc757ad42a4512abd..7609fbcd107c0dfd141e851d3af4193057656922 100644 >--- a/Source/WebCore/dom/LoadableClassicScript.h >+++ b/Source/WebCore/dom/LoadableClassicScript.h >@@ -42,7 +42,7 @@ public: > > static Ref<LoadableClassicScript> create(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree); > bool isLoaded() const final; >- std::optional<Error> error() const final; >+ WTF::Optional<Error> error() const final; > bool wasCanceled() const final; > > CachedScript& cachedScript() { return *m_cachedScript; } >@@ -64,7 +64,7 @@ private: > void notifyFinished(CachedResource&) final; > > CachedResourceHandle<CachedScript> m_cachedScript { }; >- std::optional<Error> m_error { std::nullopt }; >+ WTF::Optional<Error> m_error { WTF::nullopt }; > String m_integrity; > }; > >diff --git a/Source/WebCore/dom/LoadableModuleScript.cpp b/Source/WebCore/dom/LoadableModuleScript.cpp >index 267ff01beb657cb1c383db6ee085590cae6449c4..4709d5a4e67c575b077e73a7323adaec41c7a1de 100644 >--- a/Source/WebCore/dom/LoadableModuleScript.cpp >+++ b/Source/WebCore/dom/LoadableModuleScript.cpp >@@ -52,7 +52,7 @@ bool LoadableModuleScript::isLoaded() const > return m_isLoaded; > } > >-std::optional<LoadableScript::Error> LoadableModuleScript::error() const >+WTF::Optional<LoadableScript::Error> LoadableModuleScript::error() const > { > return m_error; > } >diff --git a/Source/WebCore/dom/LoadableModuleScript.h b/Source/WebCore/dom/LoadableModuleScript.h >index ba1fe1da1f9049a4fb7cd2e4f9d9b12635e06a10..45864af8a02022586ec8dfa299f30bc48b38b2ba 100644 >--- a/Source/WebCore/dom/LoadableModuleScript.h >+++ b/Source/WebCore/dom/LoadableModuleScript.h >@@ -40,7 +40,7 @@ public: > static Ref<LoadableModuleScript> create(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree); > > bool isLoaded() const final; >- std::optional<Error> error() const final; >+ WTF::Optional<Error> error() const final; > bool wasCanceled() const final; > > bool isClassicScript() const final { return false; } >@@ -64,7 +64,7 @@ private: > > Ref<ModuleFetchParameters> m_parameters; > RefPtr<UniquedStringImpl> m_moduleKey; >- std::optional<LoadableScript::Error> m_error; >+ WTF::Optional<LoadableScript::Error> m_error; > bool m_wasCanceled { false }; > bool m_isLoaded { false }; > }; >diff --git a/Source/WebCore/dom/LoadableScript.h b/Source/WebCore/dom/LoadableScript.h >index a320a368b524eb34fc908f5da19653e49f1a3b96..52e98f643cc3fed11910e677448f4712d18674b5 100644 >--- a/Source/WebCore/dom/LoadableScript.h >+++ b/Source/WebCore/dom/LoadableScript.h >@@ -53,13 +53,13 @@ public: > > struct Error { > ErrorType type; >- std::optional<ConsoleMessage> consoleMessage; >+ WTF::Optional<ConsoleMessage> consoleMessage; > }; > > virtual ~LoadableScript() = default; > > virtual bool isLoaded() const = 0; >- virtual std::optional<Error> error() const = 0; >+ virtual WTF::Optional<Error> error() const = 0; > virtual bool wasCanceled() const = 0; > > virtual void execute(ScriptElement&) = 0; >diff --git a/Source/WebCore/dom/MessageEvent.cpp b/Source/WebCore/dom/MessageEvent.cpp >index a9ae6e931957ebed7221ecd1fd479b93e1d54c54..cbed2b451f8874f718a7ed5ae9ececaa8bb0a0a5 100644 >--- a/Source/WebCore/dom/MessageEvent.cpp >+++ b/Source/WebCore/dom/MessageEvent.cpp >@@ -48,7 +48,7 @@ inline MessageEvent::MessageEvent(const AtomicString& type, Init&& initializer, > { > } > >-inline MessageEvent::MessageEvent(DataType&& data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports) >+inline MessageEvent::MessageEvent(DataType&& data, const String& origin, const String& lastEventId, WTF::Optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports) > : Event(eventNames().messageEvent, CanBubble::No, IsCancelable::No) > , m_data(WTFMove(data)) > , m_origin(origin) >@@ -66,7 +66,7 @@ inline MessageEvent::MessageEvent(const AtomicString& type, Ref<SerializedScript > { > } > >-Ref<MessageEvent> MessageEvent::create(Vector<RefPtr<MessagePort>>&& ports, Ref<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source) >+Ref<MessageEvent> MessageEvent::create(Vector<RefPtr<MessagePort>>&& ports, Ref<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, WTF::Optional<MessageEventSource>&& source) > { > return adoptRef(*new MessageEvent(WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports))); > } >@@ -103,7 +103,7 @@ Ref<MessageEvent> MessageEvent::create(const AtomicString& type, Init&& initiali > > MessageEvent::~MessageEvent() = default; > >-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, JSValue data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports) >+void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, JSValue data, const String& origin, const String& lastEventId, WTF::Optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports) > { > if (isBeingDispatched()) > return; >diff --git a/Source/WebCore/dom/MessageEvent.h b/Source/WebCore/dom/MessageEvent.h >index e15dcc24bf4a83d3b55ba7c1404b9b311858feee..76d960f263a840e038405119e2bb87cd04d10541 100644 >--- a/Source/WebCore/dom/MessageEvent.h >+++ b/Source/WebCore/dom/MessageEvent.h >@@ -47,7 +47,7 @@ using MessageEventSource = Variant<RefPtr<WindowProxy>, RefPtr<MessagePort>>; > > class MessageEvent final : public Event { > public: >- static Ref<MessageEvent> create(Vector<RefPtr<MessagePort>>&&, Ref<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, std::optional<MessageEventSource>&& source = std::nullopt); >+ static Ref<MessageEvent> create(Vector<RefPtr<MessagePort>>&&, Ref<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, WTF::Optional<MessageEventSource>&& source = WTF::nullopt); > static Ref<MessageEvent> create(const AtomicString& type, Ref<SerializedScriptValue>&&, const String& origin, const String& lastEventId); > static Ref<MessageEvent> create(const String& data, const String& origin = { }); > static Ref<MessageEvent> create(Ref<Blob>&& data, const String& origin); >@@ -58,18 +58,18 @@ public: > JSC::JSValue data; > String origin; > String lastEventId; >- std::optional<MessageEventSource> source; >+ WTF::Optional<MessageEventSource> source; > Vector<RefPtr<MessagePort>> ports; > }; > static Ref<MessageEvent> create(const AtomicString& type, Init&&, IsTrusted = IsTrusted::No); > > virtual ~MessageEvent(); > >- void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&&, Vector<RefPtr<MessagePort>>&&); >+ void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue data, const String& origin, const String& lastEventId, WTF::Optional<MessageEventSource>&&, Vector<RefPtr<MessagePort>>&&); > > const String& origin() const { return m_origin; } > const String& lastEventId() const { return m_lastEventId; } >- const std::optional<MessageEventSource>& source() const { return m_source; } >+ const WTF::Optional<MessageEventSource>& source() const { return m_source; } > const Vector<RefPtr<MessagePort>>& ports() const { return m_ports; } > > using DataType = Variant<JSValueInWrappedObject, Ref<SerializedScriptValue>, String, Ref<Blob>, Ref<ArrayBuffer>>; >@@ -82,14 +82,14 @@ private: > MessageEvent(); > MessageEvent(const AtomicString& type, Init&&, IsTrusted); > MessageEvent(const AtomicString& type, Ref<SerializedScriptValue>&& data, const String& origin, const String& lastEventId); >- MessageEvent(DataType&&, const String& origin, const String& lastEventId = { }, std::optional<MessageEventSource>&& = std::nullopt, Vector<RefPtr<MessagePort>>&& = { }); >+ MessageEvent(DataType&&, const String& origin, const String& lastEventId = { }, WTF::Optional<MessageEventSource>&& = WTF::nullopt, Vector<RefPtr<MessagePort>>&& = { }); > > EventInterface eventInterface() const final; > > DataType m_data; > String m_origin; > String m_lastEventId; >- std::optional<MessageEventSource> m_source; >+ WTF::Optional<MessageEventSource> m_source; > Vector<RefPtr<MessagePort>> m_ports; > > JSValueInWrappedObject m_cachedData; >diff --git a/Source/WebCore/dom/MessagePortIdentifier.h b/Source/WebCore/dom/MessagePortIdentifier.h >index f88a0494c0080aad90496bfe62e056cd4e74e24c..5087a4899eb5403e0505e9defb9293ae2df1b6ce 100644 >--- a/Source/WebCore/dom/MessagePortIdentifier.h >+++ b/Source/WebCore/dom/MessagePortIdentifier.h >@@ -39,7 +39,7 @@ struct MessagePortIdentifier { > unsigned hash() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<MessagePortIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<MessagePortIdentifier> decode(Decoder&); > > #if !LOG_DISABLED > String logString() const; >@@ -58,17 +58,17 @@ void MessagePortIdentifier::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<MessagePortIdentifier> MessagePortIdentifier::decode(Decoder& decoder) >+WTF::Optional<MessagePortIdentifier> MessagePortIdentifier::decode(Decoder& decoder) > { >- std::optional<ProcessIdentifier> processIdentifier; >+ WTF::Optional<ProcessIdentifier> processIdentifier; > decoder >> processIdentifier; > if (!processIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ObjectIdentifier<PortIdentifierType>> portIdentifier; >+ WTF::Optional<ObjectIdentifier<PortIdentifierType>> portIdentifier; > decoder >> portIdentifier; > if (!portIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*processIdentifier), WTFMove(*portIdentifier) } }; > } >diff --git a/Source/WebCore/dom/MutationObserver.h b/Source/WebCore/dom/MutationObserver.h >index b0817f01fb52135019c8b0d804a92c5bbb66539d..5b09e031e7fdbb7da6ed9585f389a9191c160182 100644 >--- a/Source/WebCore/dom/MutationObserver.h >+++ b/Source/WebCore/dom/MutationObserver.h >@@ -77,12 +77,12 @@ public: > > struct Init { > bool childList; >- std::optional<bool> attributes; >- std::optional<bool> characterData; >+ WTF::Optional<bool> attributes; >+ WTF::Optional<bool> characterData; > bool subtree; >- std::optional<bool> attributeOldValue; >- std::optional<bool> characterDataOldValue; >- std::optional<Vector<String>> attributeFilter; >+ WTF::Optional<bool> attributeOldValue; >+ WTF::Optional<bool> characterDataOldValue; >+ WTF::Optional<Vector<String>> attributeFilter; > }; > > ExceptionOr<void> observe(Node&, const Init&); >diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp >index bb099bf20ec8b73218f50218fd1f9100431e3e8c..ace4acdafb67233d174897c783dd916102fbb597 100644 >--- a/Source/WebCore/dom/ProcessingInstruction.cpp >+++ b/Source/WebCore/dom/ProcessingInstruction.cpp >@@ -167,7 +167,7 @@ void ProcessingInstruction::checkStyleSheet() > #endif > { > String charset = attributes->get("charset"); >- CachedResourceRequest request(document().completeURL(href), CachedResourceLoader::defaultCachedResourceOptions(), std::nullopt, charset.isEmpty() ? document().charset() : WTFMove(charset)); >+ CachedResourceRequest request(document().completeURL(href), CachedResourceLoader::defaultCachedResourceOptions(), WTF::nullopt, charset.isEmpty() ? document().charset() : WTFMove(charset)); > > m_cachedSheet = document().cachedResourceLoader().requestCSSStyleSheet(WTFMove(request)).value_or(nullptr); > } >diff --git a/Source/WebCore/dom/RangeBoundaryPoint.h b/Source/WebCore/dom/RangeBoundaryPoint.h >index d85fa32dd434afef83498d3d70f3dc711d2c41c7..7fc7c2f8c37e577bc09adebbd703a47031c4f2da 100644 >--- a/Source/WebCore/dom/RangeBoundaryPoint.h >+++ b/Source/WebCore/dom/RangeBoundaryPoint.h >@@ -58,7 +58,7 @@ public: > > private: > RefPtr<Node> m_containerNode; >- mutable std::optional<unsigned> m_offsetInContainer { 0 }; >+ mutable WTF::Optional<unsigned> m_offsetInContainer { 0 }; > RefPtr<Node> m_childBeforeBoundary; > }; > >@@ -135,7 +135,7 @@ inline void RangeBoundaryPoint::setToBeforeChild(Node& child) > ASSERT(child.parentNode()); > m_childBeforeBoundary = child.previousSibling(); > m_containerNode = child.parentNode(); >- m_offsetInContainer = m_childBeforeBoundary ? std::nullopt : std::optional<unsigned>(0); >+ m_offsetInContainer = m_childBeforeBoundary ? WTF::nullopt : WTF::Optional<unsigned>(0); > } > > inline void RangeBoundaryPoint::setToAfterChild(Node& child) >@@ -143,7 +143,7 @@ inline void RangeBoundaryPoint::setToAfterChild(Node& child) > ASSERT(child.parentNode()); > m_childBeforeBoundary = &child; > m_containerNode = child.parentNode(); >- m_offsetInContainer = m_childBeforeBoundary ? std::nullopt : std::optional<unsigned>(0); >+ m_offsetInContainer = m_childBeforeBoundary ? WTF::nullopt : WTF::Optional<unsigned>(0); > } > > inline void RangeBoundaryPoint::setToStartOfNode(Ref<Node>&& container) >@@ -161,7 +161,7 @@ inline void RangeBoundaryPoint::setToEndOfNode(Ref<Node>&& container) > m_childBeforeBoundary = nullptr; > } else { > m_childBeforeBoundary = m_containerNode->lastChild(); >- m_offsetInContainer = m_childBeforeBoundary ? std::nullopt : std::optional<unsigned>(0); >+ m_offsetInContainer = m_childBeforeBoundary ? WTF::nullopt : WTF::Optional<unsigned>(0); > } > } > >@@ -177,7 +177,7 @@ inline void RangeBoundaryPoint::childBeforeWillBeRemoved() > > inline void RangeBoundaryPoint::invalidateOffset() const > { >- m_offsetInContainer = std::nullopt; >+ m_offsetInContainer = WTF::nullopt; > } > > inline bool operator==(const RangeBoundaryPoint& a, const RangeBoundaryPoint& b) >diff --git a/Source/WebCore/dom/ScriptElement.cpp b/Source/WebCore/dom/ScriptElement.cpp >index 488ab8e1ddba6c7dd1dbad2c98c0cdc790d287e0..aa14db2ab44fc83a703ad3a23bc58c561d4e54d3 100644 >--- a/Source/WebCore/dom/ScriptElement.cpp >+++ b/Source/WebCore/dom/ScriptElement.cpp >@@ -128,7 +128,7 @@ void ScriptElement::dispatchErrorEvent() > m_element.dispatchEvent(Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::No)); > } > >-std::optional<ScriptElement::ScriptType> ScriptElement::determineScriptType(LegacyTypeSupport supportLegacyTypes) const >+WTF::Optional<ScriptElement::ScriptType> ScriptElement::determineScriptType(LegacyTypeSupport supportLegacyTypes) const > { > // FIXME: isLegacySupportedJavaScriptLanguage() is not valid HTML5. It is used here to maintain backwards compatibility with existing layout tests. The specific violations are: > // - Allowing type=javascript. type= should only support MIME types, such as text/javascript. >@@ -142,7 +142,7 @@ std::optional<ScriptElement::ScriptType> ScriptElement::determineScriptType(Lega > return ScriptType::Classic; > if (isLegacySupportedJavaScriptLanguage(language)) > return ScriptType::Classic; >- return std::nullopt; >+ return WTF::nullopt; > } > if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace())) > return ScriptType::Classic; >@@ -154,13 +154,13 @@ std::optional<ScriptElement::ScriptType> ScriptElement::determineScriptType(Lega > // Once "defer" is implemented, we can reconsider enabling modules in XHTML. > // https://bugs.webkit.org/show_bug.cgi?id=123387 > if (!m_element.document().isHTMLDocument()) >- return std::nullopt; >+ return WTF::nullopt; > > // https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type > // Setting the attribute to an ASCII case-insensitive match for the string "module" means that the script is a module script. > if (equalLettersIgnoringASCIICase(type, "module")) > return ScriptType::Module; >- return std::nullopt; >+ return WTF::nullopt; > } > > // http://dev.w3.org/html5/spec/Overview.html#prepare-a-script >@@ -187,7 +187,7 @@ bool ScriptElement::prepareScript(const TextPosition& scriptStartPosition, Legac > return false; > > ScriptType scriptType = ScriptType::Classic; >- if (std::optional<ScriptType> result = determineScriptType(supportLegacyTypes)) >+ if (WTF::Optional<ScriptType> result = determineScriptType(supportLegacyTypes)) > scriptType = result.value(); > else > return false; >@@ -417,8 +417,8 @@ void ScriptElement::dispatchLoadEventRespectingUserGestureIndicator() > > void ScriptElement::executeScriptAndDispatchEvent(LoadableScript& loadableScript) > { >- if (std::optional<LoadableScript::Error> error = loadableScript.error()) { >- if (std::optional<LoadableScript::ConsoleMessage> message = error->consoleMessage) >+ if (WTF::Optional<LoadableScript::Error> error = loadableScript.error()) { >+ if (WTF::Optional<LoadableScript::ConsoleMessage> message = error->consoleMessage) > m_element.document().addConsoleMessage(message->source, message->level, message->message); > dispatchErrorEvent(); > } else if (!loadableScript.wasCanceled()) { >diff --git a/Source/WebCore/dom/ScriptElement.h b/Source/WebCore/dom/ScriptElement.h >index 62454e793cb1334f64ccf3be2095d33ca9a72c8a..13f2c07f851f81c35e33922ec9cc43fa3d05b784 100644 >--- a/Source/WebCore/dom/ScriptElement.h >+++ b/Source/WebCore/dom/ScriptElement.h >@@ -95,7 +95,7 @@ protected: > private: > void executeScriptAndDispatchEvent(LoadableScript&); > >- std::optional<ScriptType> determineScriptType(LegacyTypeSupport) const; >+ WTF::Optional<ScriptType> determineScriptType(LegacyTypeSupport) const; > bool ignoresLoadRequest() const; > bool isScriptForEventSupported() const; > void dispatchLoadEventRespectingUserGestureIndicator(); >diff --git a/Source/WebCore/dom/SuccessOr.h b/Source/WebCore/dom/SuccessOr.h >index 65a30591bf9a0114788a564303a87fe796b056e4..cf1fb3e11f33311af753d81098ef10ba01be923b 100644 >--- a/Source/WebCore/dom/SuccessOr.h >+++ b/Source/WebCore/dom/SuccessOr.h >@@ -30,12 +30,12 @@ > namespace WebCore { > > template <typename T> >-class SuccessOr : public std::optional<T> { >+class SuccessOr : public WTF::Optional<T> { > public: >- SuccessOr() : std::optional<T>() { } >- SuccessOr(T&& error) : std::optional<T>(error) { } >+ SuccessOr() : WTF::Optional<T>() { } >+ SuccessOr(T&& error) : WTF::Optional<T>(error) { } > >- explicit constexpr operator bool() const { return !std::optional<T>::operator bool(); } >+ explicit constexpr operator bool() const { return !WTF::Optional<T>::operator bool(); } > }; > > } // namespace WebCore >diff --git a/Source/WebCore/dom/TextDecoder.cpp b/Source/WebCore/dom/TextDecoder.cpp >index 159a285a3b4dadf3dc034bb232037d6e72054aa6..91d5b8099b89a7d11a2fdcd3f0097653422daf38 100644 >--- a/Source/WebCore/dom/TextDecoder.cpp >+++ b/Source/WebCore/dom/TextDecoder.cpp >@@ -90,9 +90,9 @@ static size_t codeUnitByteSize(const TextEncoding& encoding) > return encoding.isByteBasedEncoding() ? 1 : 2; > } > >-ExceptionOr<String> TextDecoder::decode(std::optional<BufferSource::VariantType> input, DecodeOptions options) >+ExceptionOr<String> TextDecoder::decode(WTF::Optional<BufferSource::VariantType> input, DecodeOptions options) > { >- std::optional<BufferSource> inputBuffer; >+ WTF::Optional<BufferSource> inputBuffer; > const uint8_t* data = nullptr; > size_t length = 0; > if (input) { >diff --git a/Source/WebCore/dom/TextDecoder.h b/Source/WebCore/dom/TextDecoder.h >index e4201243a554cdab80137437f380c9fe405dd44b..a64ac726c5b56b59b2e75c69638e84d08d2a2b48 100644 >--- a/Source/WebCore/dom/TextDecoder.h >+++ b/Source/WebCore/dom/TextDecoder.h >@@ -49,7 +49,7 @@ public: > String encoding() const; > bool fatal() const { return m_options.fatal; } > bool ignoreBOM() const { return m_options.ignoreBOM; } >- ExceptionOr<String> decode(std::optional<BufferSource::VariantType>, DecodeOptions); >+ ExceptionOr<String> decode(WTF::Optional<BufferSource::VariantType>, DecodeOptions); > > private: > String prependBOMIfNecessary(const String&); >diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp >index b9e9271292a7b2398278ba10bd0485ff773e7df6..15c1077e528abb78d1f9c996f9f3d2bc0283b0d2 100644 >--- a/Source/WebCore/dom/TreeScope.cpp >+++ b/Source/WebCore/dom/TreeScope.cpp >@@ -312,21 +312,21 @@ HTMLLabelElement* TreeScope::labelElementForId(const AtomicString& forAttributeV > return m_labelsByForAttribute->getElementByLabelForAttribute(*forAttributeValue.impl(), *this); > } > >-static std::optional<LayoutPoint> absolutePointIfNotClipped(Document& document, const LayoutPoint& clientPoint) >+static WTF::Optional<LayoutPoint> absolutePointIfNotClipped(Document& document, const LayoutPoint& clientPoint) > { > if (!document.frame() || !document.view()) >- return std::nullopt; >+ return WTF::nullopt; > > const auto& settings = document.frame()->settings(); > if (settings.visualViewportEnabled() && settings.clientCoordinatesRelativeToLayoutViewport()) { > document.updateLayout(); > if (!document.view() || !document.hasLivingRenderTree()) >- return std::nullopt; >+ return WTF::nullopt; > auto* view = document.view(); > FloatPoint layoutViewportPoint = view->clientToLayoutViewportPoint(clientPoint); > FloatRect layoutViewportBounds({ }, view->layoutViewportRect().size()); > if (!layoutViewportBounds.contains(layoutViewportPoint)) >- return std::nullopt; >+ return WTF::nullopt; > return LayoutPoint(view->layoutViewportToAbsolutePoint(layoutViewportPoint)); > } > >@@ -346,7 +346,7 @@ static std::optional<LayoutPoint> absolutePointIfNotClipped(Document& document, > #endif > if (visibleRect.contains(absolutePoint)) > return absolutePoint; >- return std::nullopt; >+ return WTF::nullopt; > } > > Node* TreeScope::nodeFromPoint(const LayoutPoint& clientPoint, LayoutPoint* localPoint) >diff --git a/Source/WebCore/dom/UserGestureIndicator.cpp b/Source/WebCore/dom/UserGestureIndicator.cpp >index 23c936f91b139a4e17ccd22b5cdf7d97815c9217..9a2e2a8e715ac91db52c2cc42269cea9d4554d27 100644 >--- a/Source/WebCore/dom/UserGestureIndicator.cpp >+++ b/Source/WebCore/dom/UserGestureIndicator.cpp >@@ -46,7 +46,7 @@ UserGestureToken::~UserGestureToken() > observer(*this); > } > >-UserGestureIndicator::UserGestureIndicator(std::optional<ProcessingUserGestureState> state, Document* document, UserGestureType gestureType, ProcessInteractionStyle processInteractionStyle) >+UserGestureIndicator::UserGestureIndicator(WTF::Optional<ProcessingUserGestureState> state, Document* document, UserGestureType gestureType, ProcessInteractionStyle processInteractionStyle) > : m_previousToken { currentToken() } > { > ASSERT(isMainThread()); >diff --git a/Source/WebCore/dom/UserGestureIndicator.h b/Source/WebCore/dom/UserGestureIndicator.h >index cf8e393b863f7e4993cd20a23f9ae8552539e7ca..d7f629fa10978384c830ac408bdc426d018a06ba 100644 >--- a/Source/WebCore/dom/UserGestureIndicator.h >+++ b/Source/WebCore/dom/UserGestureIndicator.h >@@ -85,7 +85,7 @@ public: > > // If a document is provided, its last known user gesture timestamp is updated. > enum class ProcessInteractionStyle { Immediate, Delayed }; >- WEBCORE_EXPORT explicit UserGestureIndicator(std::optional<ProcessingUserGestureState>, Document* = nullptr, UserGestureType = UserGestureType::Other, ProcessInteractionStyle = ProcessInteractionStyle::Immediate); >+ WEBCORE_EXPORT explicit UserGestureIndicator(WTF::Optional<ProcessingUserGestureState>, Document* = nullptr, UserGestureType = UserGestureType::Other, ProcessInteractionStyle = ProcessInteractionStyle::Immediate); > WEBCORE_EXPORT explicit UserGestureIndicator(RefPtr<UserGestureToken>); > WEBCORE_EXPORT ~UserGestureIndicator(); > >diff --git a/Source/WebCore/dom/WheelEvent.cpp b/Source/WebCore/dom/WheelEvent.cpp >index f5b1251810a72ff55fd554ef8bf0715f18a2c761..37e07104463a4d3766c34980c79a3da922db7c1f 100644 >--- a/Source/WebCore/dom/WheelEvent.cpp >+++ b/Source/WebCore/dom/WheelEvent.cpp >@@ -87,7 +87,7 @@ void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, RefPtr<Windo > > m_deltaMode = DOM_DELTA_PIXEL; > >- m_underlyingPlatformEvent = std::nullopt; >+ m_underlyingPlatformEvent = WTF::nullopt; > } > > EventInterface WheelEvent::eventInterface() const >diff --git a/Source/WebCore/dom/WheelEvent.h b/Source/WebCore/dom/WheelEvent.h >index 66997dff3be12338a69a301fa8c5c50c378433a1..ad59ee2de42f33e9ebbe11f4f897d044c537f278 100644 >--- a/Source/WebCore/dom/WheelEvent.h >+++ b/Source/WebCore/dom/WheelEvent.h >@@ -55,7 +55,7 @@ public: > > WEBCORE_EXPORT void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, RefPtr<WindowProxy>&&, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); > >- const std::optional<PlatformWheelEvent>& underlyingPlatformEvent() const { return m_underlyingPlatformEvent; } >+ const WTF::Optional<PlatformWheelEvent>& underlyingPlatformEvent() const { return m_underlyingPlatformEvent; } > > double deltaX() const { return m_deltaX; } // Positive when scrolling right. > double deltaY() const { return m_deltaY; } // Positive when scrolling down. >@@ -86,7 +86,7 @@ private: > double m_deltaY { 0 }; > double m_deltaZ { 0 }; > unsigned m_deltaMode { DOM_DELTA_PIXEL }; >- std::optional<PlatformWheelEvent> m_underlyingPlatformEvent; >+ WTF::Optional<PlatformWheelEvent> m_underlyingPlatformEvent; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/dom/messageports/MessagePortChannel.cpp b/Source/WebCore/dom/messageports/MessagePortChannel.cpp >index bb4b08d6ad87a24eff89f11fdeeaff58dbeeec08..f002ffd35d8d6a99b0e315df743e0e29d51a4432 100644 >--- a/Source/WebCore/dom/messageports/MessagePortChannel.cpp >+++ b/Source/WebCore/dom/messageports/MessagePortChannel.cpp >@@ -60,7 +60,7 @@ MessagePortChannel::~MessagePortChannel() > m_registry.messagePortChannelDestroyed(*this); > } > >-std::optional<ProcessIdentifier> MessagePortChannel::processForPort(const MessagePortIdentifier& port) >+WTF::Optional<ProcessIdentifier> MessagePortChannel::processForPort(const MessagePortIdentifier& port) > { > ASSERT(isMainThread()); > ASSERT(port == m_ports[0] || port == m_ports[1]); >@@ -100,7 +100,7 @@ void MessagePortChannel::disentanglePort(const MessagePortIdentifier& port) > size_t i = port == m_ports[0] ? 0 : 1; > > ASSERT(m_processes[i] || m_isClosed[i]); >- m_processes[i] = std::nullopt; >+ m_processes[i] = WTF::nullopt; > m_pendingMessagePortTransfers[i].add(this); > > // This set of steps is to guarantee that the lock is unlocked before the >@@ -115,7 +115,7 @@ void MessagePortChannel::closePort(const MessagePortIdentifier& port) > ASSERT(port == m_ports[0] || port == m_ports[1]); > size_t i = port == m_ports[0] ? 0 : 1; > >- m_processes[i] = std::nullopt; >+ m_processes[i] = WTF::nullopt; > m_isClosed[i] = true; > > // This set of steps is to guarantee that the lock is unlocked before the >diff --git a/Source/WebCore/dom/messageports/MessagePortChannel.h b/Source/WebCore/dom/messageports/MessagePortChannel.h >index 88224340417755abebbded57d014050dbc5053f5..d22468b389e869802070dd5f6d18970bee81b0d5 100644 >--- a/Source/WebCore/dom/messageports/MessagePortChannel.h >+++ b/Source/WebCore/dom/messageports/MessagePortChannel.h >@@ -46,7 +46,7 @@ public: > const MessagePortIdentifier& port1() const { return m_ports[0]; } > const MessagePortIdentifier& port2() const { return m_ports[1]; } > >- WEBCORE_EXPORT std::optional<ProcessIdentifier> processForPort(const MessagePortIdentifier&); >+ WEBCORE_EXPORT WTF::Optional<ProcessIdentifier> processForPort(const MessagePortIdentifier&); > bool includesPort(const MessagePortIdentifier&); > void entanglePortWithProcess(const MessagePortIdentifier&, ProcessIdentifier); > void disentanglePort(const MessagePortIdentifier&); >@@ -69,7 +69,7 @@ private: > > MessagePortIdentifier m_ports[2]; > bool m_isClosed[2] { false, false }; >- std::optional<ProcessIdentifier> m_processes[2]; >+ WTF::Optional<ProcessIdentifier> m_processes[2]; > RefPtr<MessagePortChannel> m_entangledToProcessProtectors[2]; > Vector<MessageWithMessagePorts> m_pendingMessages[2]; > HashSet<RefPtr<MessagePortChannel>> m_pendingMessagePortTransfers[2]; >diff --git a/Source/WebCore/dom/messageports/MessageWithMessagePorts.h b/Source/WebCore/dom/messageports/MessageWithMessagePorts.h >index 8dedf4ed88f0e9d415ca476f06d4c6f1c5b0d85a..dd63739ae33ebd08c28d7b594a320bb6d85e67d9 100644 >--- a/Source/WebCore/dom/messageports/MessageWithMessagePorts.h >+++ b/Source/WebCore/dom/messageports/MessageWithMessagePorts.h >@@ -40,7 +40,7 @@ struct MessageWithMessagePorts { > TransferredMessagePortArray transferredPorts; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<MessageWithMessagePorts> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<MessageWithMessagePorts> decode(Decoder&); > }; > > >@@ -52,16 +52,16 @@ void MessageWithMessagePorts::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<MessageWithMessagePorts> MessageWithMessagePorts::decode(Decoder& decoder) >+WTF::Optional<MessageWithMessagePorts> MessageWithMessagePorts::decode(Decoder& decoder) > { > MessageWithMessagePorts result; > > result.message = SerializedScriptValue::decode(decoder); > if (!result.message) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.transferredPorts)) >- return std::nullopt; >+ return WTF::nullopt; > > return result; > } >diff --git a/Source/WebCore/editing/ChangeListTypeCommand.cpp b/Source/WebCore/editing/ChangeListTypeCommand.cpp >index 297f218c47274b89fb53dc18689e5443390a7178..1d74b77f5dd8ff36532aefd98e79b3de5a4ea39c 100644 >--- a/Source/WebCore/editing/ChangeListTypeCommand.cpp >+++ b/Source/WebCore/editing/ChangeListTypeCommand.cpp >@@ -35,7 +35,7 @@ > > namespace WebCore { > >-static std::optional<std::pair<ChangeListTypeCommand::Type, Ref<HTMLElement>>> listConversionTypeForSelection(const VisibleSelection& selection) >+static WTF::Optional<std::pair<ChangeListTypeCommand::Type, Ref<HTMLElement>>> listConversionTypeForSelection(const VisibleSelection& selection) > { > RefPtr<HTMLElement> listToReplace; > auto commonAncestor = makeRefPtr(Range::commonAncestorContainer(selection.start().containerNode(), selection.end().containerNode())); >@@ -50,16 +50,16 @@ static std::optional<std::pair<ChangeListTypeCommand::Type, Ref<HTMLElement>>> l > if (is<HTMLOListElement>(listToReplace)) > return {{ ChangeListTypeCommand::Type::ConvertToUnorderedList, listToReplace.releaseNonNull() }}; > >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<ChangeListTypeCommand::Type> ChangeListTypeCommand::listConversionType(Document& document) >+WTF::Optional<ChangeListTypeCommand::Type> ChangeListTypeCommand::listConversionType(Document& document) > { > if (auto frame = makeRefPtr(document.frame())) { > if (auto typeAndElement = listConversionTypeForSelection(frame->selection().selection())) > return typeAndElement->first; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > Ref<HTMLElement> ChangeListTypeCommand::createNewList(const HTMLElement& listToReplace) >diff --git a/Source/WebCore/editing/ChangeListTypeCommand.h b/Source/WebCore/editing/ChangeListTypeCommand.h >index eae3c55995466e553651a8cbd635361f7c91fc62..645b7a21e22f9911d0d39c4f735d494fed38218d 100644 >--- a/Source/WebCore/editing/ChangeListTypeCommand.h >+++ b/Source/WebCore/editing/ChangeListTypeCommand.h >@@ -39,7 +39,7 @@ class HTMLElement; > class ChangeListTypeCommand final : public CompositeEditCommand { > public: > enum class Type : uint8_t { ConvertToOrderedList, ConvertToUnorderedList }; >- static std::optional<Type> listConversionType(Document&); >+ static WTF::Optional<Type> listConversionType(Document&); > static Ref<ChangeListTypeCommand> create(Document& document, Type type) > { > return adoptRef(*new ChangeListTypeCommand(document, type)); >diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp >index ac1f2710dc711844b1b3137a934264cb5c1db083..16c7b449c06917e9f658663d461af6ff1ba7f25a 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.cpp >+++ b/Source/WebCore/editing/CompositeEditCommand.cpp >@@ -1518,11 +1518,11 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap > } > } > >-std::optional<VisibleSelection> CompositeEditCommand::shouldBreakOutOfEmptyListItem() const >+WTF::Optional<VisibleSelection> CompositeEditCommand::shouldBreakOutOfEmptyListItem() const > { > auto emptyListItem = enclosingEmptyListItem(endingSelection().visibleStart()); > if (!emptyListItem) >- return std::nullopt; >+ return WTF::nullopt; > > auto listNode = emptyListItem->parentNode(); > // FIXME: Can't we do something better when the immediate parent wasn't a list node? >@@ -1530,7 +1530,7 @@ std::optional<VisibleSelection> CompositeEditCommand::shouldBreakOutOfEmptyListI > || (!listNode->hasTagName(ulTag) && !listNode->hasTagName(olTag)) > || !listNode->hasEditableStyle() > || listNode == emptyListItem->rootEditableElement()) >- return std::nullopt; >+ return WTF::nullopt; > > return VisibleSelection(endingSelection().start().previous(BackwardDeletion), endingSelection().end()); > } >diff --git a/Source/WebCore/editing/CompositeEditCommand.h b/Source/WebCore/editing/CompositeEditCommand.h >index 4a424a1924fcaa9c664c8c75e5b79feac1f64d0a..e59c1e911bcc092c5864e8f120254f350870c966 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.h >+++ b/Source/WebCore/editing/CompositeEditCommand.h >@@ -199,7 +199,7 @@ protected: > void cloneParagraphUnderNewElement(const Position& start, const Position& end, Node* outerNode, Element* blockElement); > void cleanupAfterDeletion(VisiblePosition destination = VisiblePosition()); > >- std::optional<VisibleSelection> shouldBreakOutOfEmptyListItem() const; >+ WTF::Optional<VisibleSelection> shouldBreakOutOfEmptyListItem() const; > bool breakOutOfEmptyListItem(); > bool breakOutOfEmptyMailBlockquotedParagraph(); > >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index 69c16a94dd9dbd83a09d0e6df33ca83d8b32f954..cca458947cd119ba885f973fc4f847faa85aaf85 100644 >--- a/Source/WebCore/editing/Editor.cpp >+++ b/Source/WebCore/editing/Editor.cpp >@@ -198,7 +198,7 @@ using namespace HTMLNames; > using namespace WTF; > using namespace Unicode; > >-TemporarySelectionChange::TemporarySelectionChange(Frame& frame, std::optional<VisibleSelection> temporarySelection, OptionSet<TemporarySelectionOption> options) >+TemporarySelectionChange::TemporarySelectionChange(Frame& frame, WTF::Optional<VisibleSelection> temporarySelection, OptionSet<TemporarySelectionOption> options) > : m_frame(frame) > , m_options(options) > , m_wasIgnoringSelectionChanges(frame.editor().ignoreSelectionChanges()) >@@ -4090,7 +4090,7 @@ void Editor::notifyClientOfAttachmentUpdates() > } > } > >-void Editor::insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType) >+void Editor::insertAttachment(const String& identifier, WTF::Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType) > { > auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document()); > attachment->setUniqueIdentifier(identifier); >diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h >index 87b684f903a33fddb66304cf13486f9c84045bd4..dc4beff0be538ffc06f9fd75cacfce3848a878b0 100644 >--- a/Source/WebCore/editing/Editor.h >+++ b/Source/WebCore/editing/Editor.h >@@ -115,7 +115,7 @@ enum class TemporarySelectionOption : uint8_t { > > class TemporarySelectionChange { > public: >- TemporarySelectionChange(Frame&, std::optional<VisibleSelection> = std::nullopt, OptionSet<TemporarySelectionOption> = { }); >+ TemporarySelectionChange(Frame&, WTF::Optional<VisibleSelection> = WTF::nullopt, OptionSet<TemporarySelectionOption> = { }); > ~TemporarySelectionChange(); > > private: >@@ -127,7 +127,7 @@ private: > #if PLATFORM(IOS_FAMILY) > bool m_appearanceUpdatesWereEnabled; > #endif >- std::optional<VisibleSelection> m_selectionToRestore; >+ WTF::Optional<VisibleSelection> m_selectionToRestore; > }; > > class Editor { >@@ -518,7 +518,7 @@ public: > bool isGettingDictionaryPopupInfo() const { return m_isGettingDictionaryPopupInfo; } > > #if ENABLE(ATTACHMENT_ELEMENT) >- WEBCORE_EXPORT void insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType); >+ WEBCORE_EXPORT void insertAttachment(const String& identifier, WTF::Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType); > void registerAttachmentIdentifier(const String&, const String& contentType, const String& preferredFileName, Ref<SharedBuffer>&& fileData); > void registerAttachments(Vector<SerializedAttachmentData>&&); > void registerAttachmentIdentifier(const String&, const String& contentType, const String& filePath); >diff --git a/Source/WebCore/editing/FontAttributeChanges.h b/Source/WebCore/editing/FontAttributeChanges.h >index 45d768c332120c895d895dbd8f2dc5d37fb62148..c358cf27e3584f27d8aa41d1f3086114079f2473 100644 >--- a/Source/WebCore/editing/FontAttributeChanges.h >+++ b/Source/WebCore/editing/FontAttributeChanges.h >@@ -63,10 +63,10 @@ private: > > String m_fontName; > String m_fontFamily; >- std::optional<double> m_fontSize; >- std::optional<double> m_fontSizeDelta; >- std::optional<bool> m_bold; >- std::optional<bool> m_italic; >+ WTF::Optional<double> m_fontSize; >+ WTF::Optional<double> m_fontSizeDelta; >+ WTF::Optional<bool> m_bold; >+ WTF::Optional<bool> m_italic; > }; > > class FontAttributeChanges { >@@ -86,12 +86,12 @@ public: > WEBCORE_EXPORT EditAction editAction() const; > > private: >- std::optional<VerticalAlignChange> m_verticalAlign; >- std::optional<Color> m_backgroundColor; >- std::optional<Color> m_foregroundColor; >- std::optional<FontShadow> m_shadow; >- std::optional<bool> m_strikeThrough; >- std::optional<bool> m_underline; >+ WTF::Optional<VerticalAlignChange> m_verticalAlign; >+ WTF::Optional<Color> m_backgroundColor; >+ WTF::Optional<Color> m_foregroundColor; >+ WTF::Optional<FontShadow> m_shadow; >+ WTF::Optional<bool> m_strikeThrough; >+ WTF::Optional<bool> m_underline; > FontChanges m_fontChanges; > }; > >diff --git a/Source/WebCore/editing/FontAttributes.h b/Source/WebCore/editing/FontAttributes.h >index 728b219242ed26933e1121bcaa552035e3a132c8..739719a7a2b41db8913741251743f251cc45fa2d 100644 >--- a/Source/WebCore/editing/FontAttributes.h >+++ b/Source/WebCore/editing/FontAttributes.h >@@ -42,7 +42,7 @@ struct TextList { > bool ordered { false }; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<TextList> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<TextList> decode(Decoder&); > > #if PLATFORM(COCOA) > RetainPtr<NSTextList> createTextList() const; >@@ -54,22 +54,22 @@ template<class Encoder> inline void TextList::encode(Encoder& encoder) const > encoder << static_cast<uint8_t>(style) << startingItemNumber << ordered; > } > >-template<class Decoder> inline std::optional<TextList> TextList::decode(Decoder& decoder) >+template<class Decoder> inline WTF::Optional<TextList> TextList::decode(Decoder& decoder) > { >- std::optional<uint8_t> style; >+ WTF::Optional<uint8_t> style; > decoder >> style; > if (!style) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> startingItemNumber; >+ WTF::Optional<int> startingItemNumber; > decoder >> startingItemNumber; > if (!startingItemNumber) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> ordered; >+ WTF::Optional<bool> ordered; > decoder >> ordered; > if (!ordered) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ static_cast<ListStyleType>(WTFMove(*style)), WTFMove(*startingItemNumber), WTFMove(*ordered) }}; > } >diff --git a/Source/WebCore/editing/TextCheckingHelper.h b/Source/WebCore/editing/TextCheckingHelper.h >index 1e8c9faa35405f03348ea6ca014bf7795a992fba..20b0d70f2118d7df0caaea4257ec21eb51a3f730 100644 >--- a/Source/WebCore/editing/TextCheckingHelper.h >+++ b/Source/WebCore/editing/TextCheckingHelper.h >@@ -75,11 +75,11 @@ private: > mutable RefPtr<Range> m_paragraphRange; > mutable RefPtr<Range> m_offsetAsRange; > mutable String m_text; >- mutable std::optional<int> m_checkingStart; >- mutable std::optional<int> m_checkingEnd; >- mutable std::optional<int> m_checkingLength; >- mutable std::optional<int> m_automaticReplacementStart; >- mutable std::optional<int> m_automaticReplacementLength; >+ mutable WTF::Optional<int> m_checkingStart; >+ mutable WTF::Optional<int> m_checkingEnd; >+ mutable WTF::Optional<int> m_checkingLength; >+ mutable WTF::Optional<int> m_automaticReplacementStart; >+ mutable WTF::Optional<int> m_automaticReplacementLength; > }; > > class TextCheckingHelper { >diff --git a/Source/WebCore/editing/VisibleUnits.cpp b/Source/WebCore/editing/VisibleUnits.cpp >index 3950361bbad5914dddd32343ba788b3017479c41..e0717b982efeeb6447f6ceb8f45b0f3b0d4ab17e 100644 >--- a/Source/WebCore/editing/VisibleUnits.cpp >+++ b/Source/WebCore/editing/VisibleUnits.cpp >@@ -360,7 +360,7 @@ static VisiblePosition visualWordPosition(const VisiblePosition& visiblePosition > TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent()); > InlineBox* previouslyVisitedBox = nullptr; > VisiblePosition current = visiblePosition; >- std::optional<VisiblePosition> previousPosition; >+ WTF::Optional<VisiblePosition> previousPosition; > UBreakIterator* iter = nullptr; > > CachedLogicallyOrderedLeafBoxes leafBoxes; >diff --git a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >index e7c781e626396713e2bdbffe64b338834718bdad..1cf9a4f1622e4e969c31794f244ce9365ad758c5 100644 >--- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >+++ b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >@@ -442,19 +442,19 @@ struct MarkupAndArchive { > Ref<Archive> archive; > }; > >-static std::optional<MarkupAndArchive> extractMarkupAndArchive(SharedBuffer& buffer, const std::function<bool(const String)>& canShowMIMETypeAsHTML) >+static WTF::Optional<MarkupAndArchive> extractMarkupAndArchive(SharedBuffer& buffer, const std::function<bool(const String)>& canShowMIMETypeAsHTML) > { > auto archive = LegacyWebArchive::create(URL(), buffer); > if (!archive) >- return std::nullopt; >+ return WTF::nullopt; > > RefPtr<ArchiveResource> mainResource = archive->mainResource(); > if (!mainResource) >- return std::nullopt; >+ return WTF::nullopt; > > auto type = mainResource->mimeType(); > if (!canShowMIMETypeAsHTML(type)) >- return std::nullopt; >+ return WTF::nullopt; > > return MarkupAndArchive { String::fromUTF8(mainResource->data().data(), mainResource->data().size()), mainResource.releaseNonNull(), archive.releaseNonNull() }; > } >@@ -727,7 +727,7 @@ static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path) > } > > String contentType; >- std::optional<uint64_t> fileSizeForDisplay; >+ WTF::Optional<uint64_t> fileSizeForDisplay; > if (FileSystem::fileIsDirectory(path, FileSystem::ShouldFollowSymbolicLinks::Yes)) > contentType = kUTTypeDirectory; > else { >diff --git a/Source/WebCore/editing/ios/AutofillElements.cpp b/Source/WebCore/editing/ios/AutofillElements.cpp >index 75b1a04d47211c5ba229b2923ca5c85cb2cbbd1f..75e0d21e6b1cd57c935ad01224b64c7f5e034657 100644 >--- a/Source/WebCore/editing/ios/AutofillElements.cpp >+++ b/Source/WebCore/editing/ios/AutofillElements.cpp >@@ -78,17 +78,17 @@ AutofillElements::AutofillElements(RefPtr<HTMLInputElement>&& username, RefPtr<H > { > } > >-std::optional<AutofillElements> AutofillElements::computeAutofillElements(Ref<HTMLInputElement> start) >+WTF::Optional<AutofillElements> AutofillElements::computeAutofillElements(Ref<HTMLInputElement> start) > { > if (!start->document().page()) >- return std::nullopt; >+ return WTF::nullopt; > FocusController& focusController = start->document().page()->focusController(); > if (start->isPasswordField()) { > RefPtr<HTMLInputElement> previousElement = previousAutofillableElement(start.ptr(), focusController); > RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController); > bool hasDuplicatePasswordElements = (nextElement && nextElement->isPasswordField()) || (previousElement && previousElement->isPasswordField()); > if (hasDuplicatePasswordElements) >- return std::nullopt; >+ return WTF::nullopt; > > if (previousElement && is<HTMLInputElement>(*previousElement)) { > if (previousElement->isTextField()) >@@ -101,7 +101,7 @@ std::optional<AutofillElements> AutofillElements::computeAutofillElements(Ref<HT > RefPtr<HTMLInputElement> elementAfternextElement = nextAutofillableElement(nextElement.get(), focusController); > bool hasDuplicatePasswordElements = elementAfternextElement && elementAfternextElement->isPasswordField(); > if (hasDuplicatePasswordElements) >- return std::nullopt; >+ return WTF::nullopt; > > return AutofillElements(WTFMove(start), WTFMove(nextElement)); > } >@@ -114,7 +114,7 @@ std::optional<AutofillElements> AutofillElements::computeAutofillElements(Ref<HT > if (!previousElement && !nextElement) > return AutofillElements(nullptr, start.ptr()); > } >- return std::nullopt; >+ return WTF::nullopt; > } > > void AutofillElements::autofill(String username, String password) >diff --git a/Source/WebCore/editing/ios/AutofillElements.h b/Source/WebCore/editing/ios/AutofillElements.h >index bce5e08274b154816069a231333f7ff2bb5b038b..cf95761f05dda796fd4dc645dbbf4cde7abe5122 100644 >--- a/Source/WebCore/editing/ios/AutofillElements.h >+++ b/Source/WebCore/editing/ios/AutofillElements.h >@@ -30,7 +30,7 @@ namespace WebCore { > class AutofillElements { > WTF_MAKE_FAST_ALLOCATED; > public: >- WEBCORE_EXPORT static std::optional<AutofillElements> computeAutofillElements(Ref<HTMLInputElement>); >+ WEBCORE_EXPORT static WTF::Optional<AutofillElements> computeAutofillElements(Ref<HTMLInputElement>); > WEBCORE_EXPORT void autofill(String, String); > > const HTMLInputElement* username() const { return m_username.get(); } >diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp >index 795b12d0e63b015a9f559ac72f8b61aabda19834..aa21fc132dcc206367f337c8ef73b9ad50b4c4d4 100644 >--- a/Source/WebCore/editing/markup.cpp >+++ b/Source/WebCore/editing/markup.cpp >@@ -199,7 +199,7 @@ std::unique_ptr<Page> createPageForSanitizingWebContent() > return page; > } > >-String sanitizeMarkup(const String& rawHTML, MSOListQuirks msoListQuirks, std::optional<WTF::Function<void(DocumentFragment&)>> fragmentSanitizer) >+String sanitizeMarkup(const String& rawHTML, MSOListQuirks msoListQuirks, WTF::Optional<WTF::Function<void(DocumentFragment&)>> fragmentSanitizer) > { > auto page = createPageForSanitizingWebContent(); > Document* stagingDocument = page->mainFrame().document(); >diff --git a/Source/WebCore/editing/markup.h b/Source/WebCore/editing/markup.h >index 22486ce2c8ad5ecd574b2814d0fbccfd24278781..53462e30d18c0eedadeecd9024bd2423bc19ccbf 100644 >--- a/Source/WebCore/editing/markup.h >+++ b/Source/WebCore/editing/markup.h >@@ -52,7 +52,7 @@ void removeSubresourceURLAttributes(Ref<DocumentFragment>&&, WTF::Function<bool( > > enum class MSOListQuirks { CheckIfNeeded, Disabled }; > std::unique_ptr<Page> createPageForSanitizingWebContent(); >-String sanitizeMarkup(const String&, MSOListQuirks = MSOListQuirks::Disabled, std::optional<WTF::Function<void(DocumentFragment&)>> fragmentSanitizer = std::nullopt); >+String sanitizeMarkup(const String&, MSOListQuirks = MSOListQuirks::Disabled, WTF::Optional<WTF::Function<void(DocumentFragment&)>> fragmentSanitizer = WTF::nullopt); > String sanitizedMarkupForFragmentInDocument(Ref<DocumentFragment>&&, Document&, MSOListQuirks, const String& originalMarkup); > > WEBCORE_EXPORT Ref<DocumentFragment> createFragmentFromText(Range& context, const String& text); >diff --git a/Source/WebCore/fileapi/AsyncFileStream.cpp b/Source/WebCore/fileapi/AsyncFileStream.cpp >index 325e34d0c6b8e7cc93afdb6445f548f5fcebee3e..63acbb7db9c2e981a49603295de537947c94d84b 100644 >--- a/Source/WebCore/fileapi/AsyncFileStream.cpp >+++ b/Source/WebCore/fileapi/AsyncFileStream.cpp >@@ -134,7 +134,7 @@ void AsyncFileStream::perform(WTF::Function<WTF::Function<void(FileStreamClient& > }); > } > >-void AsyncFileStream::getSize(const String& path, std::optional<WallTime> expectedModificationTime) >+void AsyncFileStream::getSize(const String& path, WTF::Optional<WallTime> expectedModificationTime) > { > // FIXME: Explicit return type here and in all the other cases like this below is a workaround for a deficiency > // in the Windows compiler at the time of this writing. Could remove it if that is resolved. >diff --git a/Source/WebCore/fileapi/AsyncFileStream.h b/Source/WebCore/fileapi/AsyncFileStream.h >index 7a9337e33be2c93e793266e611b13bc4ce36e438..5023d9d15b51a2e793a81fbef4413803287e43be 100644 >--- a/Source/WebCore/fileapi/AsyncFileStream.h >+++ b/Source/WebCore/fileapi/AsyncFileStream.h >@@ -45,7 +45,7 @@ public: > explicit AsyncFileStream(FileStreamClient&); > ~AsyncFileStream(); > >- void getSize(const String& path, std::optional<WallTime> expectedModificationTime); >+ void getSize(const String& path, WTF::Optional<WallTime> expectedModificationTime); > void openForRead(const String& path, long long offset, long long length); > void close(); > void read(char* buffer, int length); >diff --git a/Source/WebCore/fileapi/File.cpp b/Source/WebCore/fileapi/File.cpp >index 8b1f724673874675839037f9c9eefbe3bc89e0a5..6b3fa923be1efcf9a108a35d731057d854798497 100644 >--- a/Source/WebCore/fileapi/File.cpp >+++ b/Source/WebCore/fileapi/File.cpp >@@ -63,7 +63,7 @@ File::File(const String& path, const String& nameOverride) > ThreadableBlobRegistry::registerFileBlobURL(m_internalURL, path, m_type); > } > >-File::File(DeserializationContructor, const String& path, const URL& url, const String& type, const String& name, const std::optional<int64_t>& lastModified) >+File::File(DeserializationContructor, const String& path, const URL& url, const String& type, const String& name, const WTF::Optional<int64_t>& lastModified) > : Blob(deserializationContructor, url, type, -1, path) > , m_path(path) > , m_name(name) >diff --git a/Source/WebCore/fileapi/File.h b/Source/WebCore/fileapi/File.h >index da2e8bca352ca3fc7ec7cb4562d79bbb728bf05f..3cfed501859e22b71b85a41f8db36386077d016f 100644 >--- a/Source/WebCore/fileapi/File.h >+++ b/Source/WebCore/fileapi/File.h >@@ -36,7 +36,7 @@ namespace WebCore { > class File final : public Blob { > public: > struct PropertyBag : BlobPropertyBag { >- std::optional<int64_t> lastModified; >+ WTF::Optional<int64_t> lastModified; > }; > > static Ref<File> create(const String& path) >@@ -50,7 +50,7 @@ public: > return adoptRef(*new File(WTFMove(blobPartVariants), filename, propertyBag)); > } > >- static Ref<File> deserialize(const String& path, const URL& srcURL, const String& type, const String& name, const std::optional<int64_t>& lastModified = std::nullopt) >+ static Ref<File> deserialize(const String& path, const URL& srcURL, const String& type, const String& name, const WTF::Optional<int64_t>& lastModified = WTF::nullopt) > { > return adoptRef(*new File(deserializationContructor, path, srcURL, type, name, lastModified)); > } >@@ -82,7 +82,7 @@ public: > void setRelativePath(const String& relativePath) { m_relativePath = relativePath; } > const String& name() const { return m_name; } > WEBCORE_EXPORT int64_t lastModified() const; // Number of milliseconds since Epoch. >- const std::optional<int64_t>& lastModifiedOverride() const { return m_lastModifiedDateOverride; } // Number of milliseconds since Epoch. >+ const WTF::Optional<int64_t>& lastModifiedOverride() const { return m_lastModifiedDateOverride; } // Number of milliseconds since Epoch. > > static String contentTypeForFile(const String& path); > >@@ -99,7 +99,7 @@ private: > File(const Blob&, const String& name); > File(const File&, const String& name); > >- File(DeserializationContructor, const String& path, const URL& srcURL, const String& type, const String& name, const std::optional<int64_t>& lastModified); >+ File(DeserializationContructor, const String& path, const URL& srcURL, const String& type, const String& name, const WTF::Optional<int64_t>& lastModified); > > static void computeNameAndContentType(const String& path, const String& nameOverride, String& effectiveName, String& effectiveContentType); > #if ENABLE(FILE_REPLACEMENT) >@@ -110,8 +110,8 @@ private: > String m_relativePath; > String m_name; > >- std::optional<int64_t> m_lastModifiedDateOverride; >- mutable std::optional<bool> m_isDirectory; >+ WTF::Optional<int64_t> m_lastModifiedDateOverride; >+ mutable WTF::Optional<bool> m_isDirectory; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/fileapi/FileReader.cpp b/Source/WebCore/fileapi/FileReader.cpp >index b5fcf626ca1ff1fdb4035b10f1dbf2fa3deae3e0..8b32fb8c90114fccbf8c965784892cca9c2f7004 100644 >--- a/Source/WebCore/fileapi/FileReader.cpp >+++ b/Source/WebCore/fileapi/FileReader.cpp >@@ -226,19 +226,19 @@ void FileReader::fireEvent(const AtomicString& type) > dispatchEvent(ProgressEvent::create(type, true, m_loader ? m_loader->bytesLoaded() : 0, m_loader ? m_loader->totalBytes() : 0)); > } > >-std::optional<Variant<String, RefPtr<JSC::ArrayBuffer>>> FileReader::result() const >+WTF::Optional<Variant<String, RefPtr<JSC::ArrayBuffer>>> FileReader::result() const > { > if (!m_loader || m_error) >- return std::nullopt; >+ return WTF::nullopt; > if (m_readType == FileReaderLoader::ReadAsArrayBuffer) { > auto result = m_loader->arrayBufferResult(); > if (!result) >- return std::nullopt; >+ return WTF::nullopt; > return { result }; > } > String result = m_loader->stringResult(); > if (result.isNull()) >- return std::nullopt; >+ return WTF::nullopt; > return { WTFMove(result) }; > } > >diff --git a/Source/WebCore/fileapi/FileReader.h b/Source/WebCore/fileapi/FileReader.h >index ef89f5bd6e012e5e4d058c30104439a72ef0ea6c..c35a015f2137f3f028fdb857a649cf6d1fb64296 100644 >--- a/Source/WebCore/fileapi/FileReader.h >+++ b/Source/WebCore/fileapi/FileReader.h >@@ -68,7 +68,7 @@ public: > ReadyState readyState() const { return m_state; } > RefPtr<FileError> error() { return m_error; } > FileReaderLoader::ReadType readType() const { return m_readType; } >- std::optional<Variant<String, RefPtr<JSC::ArrayBuffer>>> result() const; >+ WTF::Optional<Variant<String, RefPtr<JSC::ArrayBuffer>>> result() const; > > using RefCounted::ref; > using RefCounted::deref; >diff --git a/Source/WebCore/history/BackForwardItemIdentifier.h b/Source/WebCore/history/BackForwardItemIdentifier.h >index 6ded64ad4f3ca1f22cd2cf4f6079ce2cc115cd3c..b357a4cf7454cf90e2ed373a69d2160f2e7e51b4 100644 >--- a/Source/WebCore/history/BackForwardItemIdentifier.h >+++ b/Source/WebCore/history/BackForwardItemIdentifier.h >@@ -40,7 +40,7 @@ struct BackForwardItemIdentifier { > unsigned hash() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<BackForwardItemIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<BackForwardItemIdentifier> decode(Decoder&); > > #if !LOG_DISABLED > const char* logString() const; >@@ -66,17 +66,17 @@ void BackForwardItemIdentifier::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<BackForwardItemIdentifier> BackForwardItemIdentifier::decode(Decoder& decoder) >+WTF::Optional<BackForwardItemIdentifier> BackForwardItemIdentifier::decode(Decoder& decoder) > { >- std::optional<ProcessIdentifier> processIdentifier; >+ WTF::Optional<ProcessIdentifier> processIdentifier; > decoder >> processIdentifier; > if (!processIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ObjectIdentifier<ItemIdentifierType>> itemIdentifier; >+ WTF::Optional<ObjectIdentifier<ItemIdentifierType>> itemIdentifier; > decoder >> itemIdentifier; > if (!itemIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*processIdentifier), WTFMove(*itemIdentifier) } }; > } >diff --git a/Source/WebCore/history/CachedFrame.h b/Source/WebCore/history/CachedFrame.h >index dbdbaf31f75570593d723ec8b2bfb19e6c8a2156..18d9b409c8fb73d7baf26e6056a4c06590ac1ef4 100644 >--- a/Source/WebCore/history/CachedFrame.h >+++ b/Source/WebCore/history/CachedFrame.h >@@ -62,7 +62,7 @@ protected: > std::unique_ptr<ScriptCachedFrameData> m_cachedFrameScriptData; > std::unique_ptr<CachedFramePlatformData> m_cachedFramePlatformData; > bool m_isMainFrame; >- std::optional<HasInsecureContent> m_hasInsecureContent; >+ WTF::Optional<HasInsecureContent> m_hasInsecureContent; > > Vector<std::unique_ptr<CachedFrame>> m_childFrames; > }; >@@ -80,7 +80,7 @@ public: > WEBCORE_EXPORT CachedFramePlatformData* cachedFramePlatformData(); > > WEBCORE_EXPORT void setHasInsecureContent(HasInsecureContent); >- std::optional<HasInsecureContent> hasInsecureContent() const { return m_hasInsecureContent; } >+ WTF::Optional<HasInsecureContent> hasInsecureContent() const { return m_hasInsecureContent; } > > using CachedFrameBase::document; > using CachedFrameBase::view; >diff --git a/Source/WebCore/html/ColorInputType.cpp b/Source/WebCore/html/ColorInputType.cpp >index 075290a25f7c8baaf913dbc58ca95ad7ef6daa41..908049562b933987d247a3d4bc2d4399c2969e88 100644 >--- a/Source/WebCore/html/ColorInputType.cpp >+++ b/Source/WebCore/html/ColorInputType.cpp >@@ -69,10 +69,10 @@ static bool isValidSimpleColor(StringView string) > } > > // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-simple-colour-values >-static std::optional<RGBA32> parseSimpleColorValue(StringView string) >+static WTF::Optional<RGBA32> parseSimpleColorValue(StringView string) > { > if (!isValidSimpleColor(string)) >- return std::nullopt; >+ return WTF::nullopt; > return makeRGB(toASCIIHexValue(string[1], string[2]), toASCIIHexValue(string[3], string[4]), toASCIIHexValue(string[5], string[6])); > } > >diff --git a/Source/WebCore/html/DOMFormData.cpp b/Source/WebCore/html/DOMFormData.cpp >index d2eb67d670237b671cc13ccb319305b372ff23f2..fc163b52ccc6866851929d331ab6c6d011aa6285 100644 >--- a/Source/WebCore/html/DOMFormData.cpp >+++ b/Source/WebCore/html/DOMFormData.cpp >@@ -82,14 +82,14 @@ void DOMFormData::remove(const String& name) > }); > } > >-auto DOMFormData::get(const String& name) -> std::optional<FormDataEntryValue> >+auto DOMFormData::get(const String& name) -> WTF::Optional<FormDataEntryValue> > { > for (auto& item : m_items) { > if (item.name == name) > return item.data; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > auto DOMFormData::getAll(const String& name) -> Vector<FormDataEntryValue> >@@ -126,7 +126,7 @@ void DOMFormData::set(const String& name, Blob& blob, const String& filename) > > void DOMFormData::set(const String& name, Item&& item) > { >- std::optional<size_t> initialMatchLocation; >+ WTF::Optional<size_t> initialMatchLocation; > > // Find location of the first item with a matching name. > for (size_t i = 0; i < m_items.size(); ++i) { >@@ -153,11 +153,11 @@ DOMFormData::Iterator::Iterator(DOMFormData& target) > { > } > >-std::optional<KeyValuePair<String, DOMFormData::FormDataEntryValue>> DOMFormData::Iterator::next() >+WTF::Optional<KeyValuePair<String, DOMFormData::FormDataEntryValue>> DOMFormData::Iterator::next() > { > auto& items = m_target->items(); > if (m_index >= items.size()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& item = items[m_index++]; > return makeKeyValuePair(item.name, item.data); >diff --git a/Source/WebCore/html/DOMFormData.h b/Source/WebCore/html/DOMFormData.h >index 80e49fc774442f702727f1e7b53af3d75f9e948f..38f74d07a32c7ee9b76a18e0909671637ef6095f 100644 >--- a/Source/WebCore/html/DOMFormData.h >+++ b/Source/WebCore/html/DOMFormData.h >@@ -60,7 +60,7 @@ public: > void append(const String& name, const String& value); > void append(const String& name, Blob&, const String& filename = { }); > void remove(const String& name); >- std::optional<FormDataEntryValue> get(const String& name); >+ WTF::Optional<FormDataEntryValue> get(const String& name); > Vector<FormDataEntryValue> getAll(const String& name); > bool has(const String& name); > void set(const String& name, const String& value); >@@ -69,7 +69,7 @@ public: > class Iterator { > public: > explicit Iterator(DOMFormData&); >- std::optional<KeyValuePair<String, FormDataEntryValue>> next(); >+ WTF::Optional<KeyValuePair<String, FormDataEntryValue>> next(); > > private: > Ref<DOMFormData> m_target; >diff --git a/Source/WebCore/html/DOMTokenList.cpp b/Source/WebCore/html/DOMTokenList.cpp >index c95f969a699b1753d18ad832e5c95aca1b262ab3..70d6bca11c23081e58dffa999966bd11f0d3b089 100644 >--- a/Source/WebCore/html/DOMTokenList.cpp >+++ b/Source/WebCore/html/DOMTokenList.cpp >@@ -132,7 +132,7 @@ ExceptionOr<void> DOMTokenList::remove(const AtomicString& token) > return removeInternal(&token.string(), 1); > } > >-ExceptionOr<bool> DOMTokenList::toggle(const AtomicString& token, std::optional<bool> force) >+ExceptionOr<bool> DOMTokenList::toggle(const AtomicString& token, WTF::Optional<bool> force) > { > auto result = validateToken(token); > if (result.hasException()) >diff --git a/Source/WebCore/html/DOMTokenList.h b/Source/WebCore/html/DOMTokenList.h >index 3940f035eaeba02394e5a912b90c833baf4a9afb..c45531f5f11d036f1b2e42ee267d62ea123378f1 100644 >--- a/Source/WebCore/html/DOMTokenList.h >+++ b/Source/WebCore/html/DOMTokenList.h >@@ -48,7 +48,7 @@ public: > ExceptionOr<void> add(const AtomicString&); > ExceptionOr<void> remove(const Vector<String>&); > ExceptionOr<void> remove(const AtomicString&); >- WEBCORE_EXPORT ExceptionOr<bool> toggle(const AtomicString&, std::optional<bool> force); >+ WEBCORE_EXPORT ExceptionOr<bool> toggle(const AtomicString&, WTF::Optional<bool> force); > ExceptionOr<bool> replace(const AtomicString& token, const AtomicString& newToken); > ExceptionOr<bool> supports(StringView token); > >diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp >index 8a80698f26cec343cbe54cf7f4200b6710ddb0ad..d585197c2a854488b77c9c062be105abaf5e3feb 100644 >--- a/Source/WebCore/html/FormController.cpp >+++ b/Source/WebCore/html/FormController.cpp >@@ -61,13 +61,13 @@ static inline void serializeFormControlStateTo(const FormControlState& formContr > stateVector.append(value.isNull() ? emptyString() : value); > } > >-static inline std::optional<FormControlState> deserializeFormControlState(const Vector<String>& stateVector, size_t& index) >+static inline WTF::Optional<FormControlState> deserializeFormControlState(const Vector<String>& stateVector, size_t& index) > { > if (index >= stateVector.size()) >- return std::nullopt; >+ return WTF::nullopt; > size_t size = stateVector[index++].toUInt(); > if (index + size > stateVector.size()) >- return std::nullopt; >+ return WTF::nullopt; > Vector<String> subvector; > subvector.reserveInitialCapacity(size); > for (size_t i = 0; i < size; ++i) >diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp >index 1238cb195416899f19bf3e4dbde7530f260d3ba9..a04567b303068fe46cf25a4c158fe848d542926f 100644 >--- a/Source/WebCore/html/HTMLAllCollection.cpp >+++ b/Source/WebCore/html/HTMLAllCollection.cpp >@@ -43,10 +43,10 @@ inline HTMLAllCollection::HTMLAllCollection(Document& document, CollectionType t > } > > // https://html.spec.whatwg.org/multipage/infrastructure.html#dom-htmlallcollection-item >-std::optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> HTMLAllCollection::namedOrIndexedItemOrItems(const AtomicString& nameOrIndex) const >+WTF::Optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> HTMLAllCollection::namedOrIndexedItemOrItems(const AtomicString& nameOrIndex) const > { > if (nameOrIndex.isNull()) >- return std::nullopt; >+ return WTF::nullopt; > > if (auto index = JSC::parseIndex(*nameOrIndex.impl())) > return Variant<RefPtr<HTMLCollection>, RefPtr<Element>> { RefPtr<Element> { item(index.value()) } }; >@@ -55,12 +55,12 @@ std::optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> HTMLAllCollectio > } > > // https://html.spec.whatwg.org/multipage/infrastructure.html#concept-get-all-named >-std::optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> HTMLAllCollection::namedItemOrItems(const AtomicString& name) const >+WTF::Optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> HTMLAllCollection::namedItemOrItems(const AtomicString& name) const > { > auto namedItems = this->namedItems(name); > > if (namedItems.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > if (namedItems.size() == 1) > return Variant<RefPtr<HTMLCollection>, RefPtr<Element>> { RefPtr<Element> { WTFMove(namedItems[0]) } }; > >diff --git a/Source/WebCore/html/HTMLAllCollection.h b/Source/WebCore/html/HTMLAllCollection.h >index 98a6f8f3b822953bd84756e3f984c2f041338cfb..78cc7fe0e3ba54eefe2067dd589890bb7cfebb8e 100644 >--- a/Source/WebCore/html/HTMLAllCollection.h >+++ b/Source/WebCore/html/HTMLAllCollection.h >@@ -35,8 +35,8 @@ class HTMLAllCollection final : public AllDescendantsCollection { > public: > static Ref<HTMLAllCollection> create(Document&, CollectionType); > >- std::optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> namedOrIndexedItemOrItems(const AtomicString& nameOrIndex) const; >- std::optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> namedItemOrItems(const AtomicString&) const; >+ WTF::Optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> namedOrIndexedItemOrItems(const AtomicString& nameOrIndex) const; >+ WTF::Optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> namedItemOrItems(const AtomicString&) const; > > private: > HTMLAllCollection(Document&, CollectionType); >diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp >index a1aeb527b64c891d1878b160edfa8cc7aae18dfd..a5eebaf8e9974ec1d1a33656948fbb3a19660379 100644 >--- a/Source/WebCore/html/HTMLAnchorElement.cpp >+++ b/Source/WebCore/html/HTMLAnchorElement.cpp >@@ -432,7 +432,7 @@ void HTMLAnchorElement::handleClick(Event& event) > ShouldSendReferrer shouldSendReferrer = hasRel(Relation::NoReferrer) ? NeverSendReferrer : MaybeSendReferrer; > > auto effectiveTarget = this->effectiveTarget(); >- std::optional<NewFrameOpenerPolicy> newFrameOpenerPolicy; >+ WTF::Optional<NewFrameOpenerPolicy> newFrameOpenerPolicy; > if (hasRel(Relation::Opener)) > newFrameOpenerPolicy = NewFrameOpenerPolicy::Allow; > else if (hasRel(Relation::NoOpener) || (RuntimeEnabledFeatures::sharedFeatures().blankAnchorTargetImpliesNoOpenerEnabled() && equalIgnoringASCIICase(effectiveTarget, "_blank"))) >diff --git a/Source/WebCore/html/HTMLAttachmentElement.cpp b/Source/WebCore/html/HTMLAttachmentElement.cpp >index cb6acb718b3864813054e8694615deb9fd18bac1..8be1cfebda01e41667cef93d05256b1cb3aabd4a 100644 >--- a/Source/WebCore/html/HTMLAttachmentElement.cpp >+++ b/Source/WebCore/html/HTMLAttachmentElement.cpp >@@ -205,7 +205,7 @@ String HTMLAttachmentElement::attachmentPath() const > return attributeWithoutSynchronization(webkitattachmentpathAttr); > } > >-void HTMLAttachmentElement::updateAttributes(std::optional<uint64_t>&& newFileSize, const String& newContentType, const String& newFilename) >+void HTMLAttachmentElement::updateAttributes(WTF::Optional<uint64_t>&& newFileSize, const String& newContentType, const String& newFilename) > { > if (!newFilename.isNull()) > setAttributeWithoutSynchronization(HTMLNames::titleAttr, newFilename); >diff --git a/Source/WebCore/html/HTMLAttachmentElement.h b/Source/WebCore/html/HTMLAttachmentElement.h >index 12e20a350691c6eca1268bbbd9081fb5bb06a510..2770da5d9b91635b01b2567a2600467f2ef7e921 100644 >--- a/Source/WebCore/html/HTMLAttachmentElement.h >+++ b/Source/WebCore/html/HTMLAttachmentElement.h >@@ -54,7 +54,7 @@ public: > > void copyNonAttributePropertiesFromElement(const Element&) final; > >- WEBCORE_EXPORT void updateAttributes(std::optional<uint64_t>&& newFileSize, const String& newContentType, const String& newFilename); >+ WEBCORE_EXPORT void updateAttributes(WTF::Optional<uint64_t>&& newFileSize, const String& newContentType, const String& newFilename); > WEBCORE_EXPORT void updateEnclosingImageWithData(const String& contentType, Ref<SharedBuffer>&& data); > > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; >diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp >index 7485640a31ed1772330156b724a4a424466eab3e..24f0ed9a308b7dc7c19d240402d0137d5aee86a7 100644 >--- a/Source/WebCore/html/HTMLCanvasElement.cpp >+++ b/Source/WebCore/html/HTMLCanvasElement.cpp >@@ -211,7 +211,7 @@ static inline size_t maxActivePixelMemory() > return maxPixelMemory; > } > >-ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC::ExecState& state, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments) >+ExceptionOr<WTF::Optional<RenderingContext>> HTMLCanvasElement::getContext(JSC::ExecState& state, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments) > { > if (m_context) { > if (m_context->isPlaceholder()) >@@ -219,25 +219,25 @@ ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC:: > > if (m_context->is2d()) { > if (!is2dType(contextId)) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { &downcast<CanvasRenderingContext2D>(*m_context) } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { &downcast<CanvasRenderingContext2D>(*m_context) } }; > } > > if (m_context->isBitmapRenderer()) { > if (!isBitmapRendererType(contextId)) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<ImageBitmapRenderingContext> { &downcast<ImageBitmapRenderingContext>(*m_context) } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<ImageBitmapRenderingContext> { &downcast<ImageBitmapRenderingContext>(*m_context) } }; > } > > #if ENABLE(WEBGL) > if (m_context->isWebGL()) { > if (!isWebGLType(contextId)) >- return std::optional<RenderingContext> { std::nullopt }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; > if (is<WebGLRenderingContext>(*m_context)) >- return std::optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*m_context) } }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*m_context) } }; > #if ENABLE(WEBGL2) > ASSERT(is<WebGL2RenderingContext>(*m_context)); >- return std::optional<RenderingContext> { RefPtr<WebGL2RenderingContext> { &downcast<WebGL2RenderingContext>(*m_context) } }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebGL2RenderingContext> { &downcast<WebGL2RenderingContext>(*m_context) } }; > #endif > } > #endif >@@ -245,28 +245,28 @@ ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC:: > #if ENABLE(WEBGPU) > if (m_context->isWebGPU()) { > if (!isWebGPUType(contextId)) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<WebGPURenderingContext> { &downcast<WebGPURenderingContext>(*m_context) } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebGPURenderingContext> { &downcast<WebGPURenderingContext>(*m_context) } }; > } > #endif > > #if ENABLE(WEBMETAL) > if (m_context->isWebMetal()) { > if (!isWebMetalType(contextId)) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<WebMetalRenderingContext> { &downcast<WebMetalRenderingContext>(*m_context) } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebMetalRenderingContext> { &downcast<WebMetalRenderingContext>(*m_context) } }; > } > #endif > > ASSERT_NOT_REACHED(); >- return std::optional<RenderingContext> { std::nullopt }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; > } > > if (is2dType(contextId)) { > auto context = createContext2d(contextId); > if (!context) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { context } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { context } }; > } > > if (isBitmapRendererType(contextId)) { >@@ -276,8 +276,8 @@ ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC:: > > auto context = createContextBitmapRenderer(contextId, WTFMove(attributes)); > if (!context) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<ImageBitmapRenderingContext> { context } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<ImageBitmapRenderingContext> { context } }; > } > > #if ENABLE(WEBGL) >@@ -288,13 +288,13 @@ ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC:: > > auto context = createContextWebGL(contextId, WTFMove(attributes)); > if (!context) >- return std::optional<RenderingContext> { std::nullopt }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; > > if (is<WebGLRenderingContext>(*context)) >- return std::optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*context) } }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*context) } }; > #if ENABLE(WEBGL2) > ASSERT(is<WebGL2RenderingContext>(*context)); >- return std::optional<RenderingContext> { RefPtr<WebGL2RenderingContext> { &downcast<WebGL2RenderingContext>(*context) } }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebGL2RenderingContext> { &downcast<WebGL2RenderingContext>(*context) } }; > #endif > } > #endif >@@ -303,8 +303,8 @@ ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC:: > if (isWebGPUType(contextId)) { > auto context = createContextWebGPU(contextId); > if (!context) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<WebGPURenderingContext> { context } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebGPURenderingContext> { context } }; > } > #endif > >@@ -312,12 +312,12 @@ ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC:: > if (isWebMetalType(contextId)) { > auto context = createContextWebMetal(contextId); > if (!context) >- return std::optional<RenderingContext> { std::nullopt }; >- return std::optional<RenderingContext> { RefPtr<WebMetalRenderingContext> { context } }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; >+ return WTF::Optional<RenderingContext> { RefPtr<WebMetalRenderingContext> { context } }; > } > #endif > >- return std::optional<RenderingContext> { std::nullopt }; >+ return WTF::Optional<RenderingContext> { WTF::nullopt }; > } > > CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type) >@@ -748,14 +748,14 @@ static String toEncodingMimeType(const String& mimeType) > } > > // https://html.spec.whatwg.org/multipage/canvas.html#a-serialisation-of-the-bitmap-as-a-file >-static std::optional<double> qualityFromJSValue(JSC::JSValue qualityValue) >+static WTF::Optional<double> qualityFromJSValue(JSC::JSValue qualityValue) > { > if (!qualityValue.isNumber()) >- return std::nullopt; >+ return WTF::nullopt; > > double qualityNumber = qualityValue.asNumber(); > if (qualityNumber < 0 || qualityNumber > 1) >- return std::nullopt; >+ return WTF::nullopt; > > return qualityNumber; > } >@@ -855,7 +855,7 @@ RefPtr<MediaSample> HTMLCanvasElement::toMediaSample() > #endif > } > >-ExceptionOr<Ref<MediaStream>> HTMLCanvasElement::captureStream(ScriptExecutionContext& context, std::optional<double>&& frameRequestRate) >+ExceptionOr<Ref<MediaStream>> HTMLCanvasElement::captureStream(ScriptExecutionContext& context, WTF::Optional<double>&& frameRequestRate) > { > if (!originClean()) > return Exception(SecurityError, "Canvas is tainted"_s); >diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h >index a6ca3a290c3e41d56f6930f7a3367bcf890b319c..4476099472d331c24ae376dcf7b7d18883c9b883 100644 >--- a/Source/WebCore/html/HTMLCanvasElement.h >+++ b/Source/WebCore/html/HTMLCanvasElement.h >@@ -85,7 +85,7 @@ public: > reset(); > } > >- ExceptionOr<std::optional<RenderingContext>> getContext(JSC::ExecState&, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments); >+ ExceptionOr<WTF::Optional<RenderingContext>> getContext(JSC::ExecState&, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments); > > CanvasRenderingContext* getContext(const String&); > >@@ -127,7 +127,7 @@ public: > > #if ENABLE(MEDIA_STREAM) > RefPtr<MediaSample> toMediaSample(); >- ExceptionOr<Ref<MediaStream>> captureStream(ScriptExecutionContext&, std::optional<double>&& frameRequestRate); >+ ExceptionOr<Ref<MediaStream>> captureStream(ScriptExecutionContext&, WTF::Optional<double>&& frameRequestRate); > #endif > > ImageBuffer* buffer() const; >diff --git a/Source/WebCore/html/HTMLDocument.cpp b/Source/WebCore/html/HTMLDocument.cpp >index 9d581cedfa841e0adf1aac432591c8b6f2f76518..6063df3b79a284048c7e6bba5085fc77be1ff9d7 100644 >--- a/Source/WebCore/html/HTMLDocument.cpp >+++ b/Source/WebCore/html/HTMLDocument.cpp >@@ -114,10 +114,10 @@ Ref<DocumentParser> HTMLDocument::createParser() > } > > // https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem >-std::optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> HTMLDocument::namedItem(const AtomicString& name) >+WTF::Optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> HTMLDocument::namedItem(const AtomicString& name) > { > if (name.isNull() || !hasDocumentNamedItem(*name.impl())) >- return std::nullopt; >+ return WTF::nullopt; > > if (UNLIKELY(documentNamedItemContainsMultipleElements(*name.impl()))) { > auto collection = documentNamedItems(name); >diff --git a/Source/WebCore/html/HTMLDocument.h b/Source/WebCore/html/HTMLDocument.h >index 5e57204880aa28174a296c001e2ee4c17c643ba2..1636815894dd2c3985b49b4cdce165d35d8da141 100644 >--- a/Source/WebCore/html/HTMLDocument.h >+++ b/Source/WebCore/html/HTMLDocument.h >@@ -44,7 +44,7 @@ public: > WEBCORE_EXPORT int width(); > WEBCORE_EXPORT int height(); > >- std::optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> namedItem(const AtomicString&); >+ WTF::Optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> namedItem(const AtomicString&); > Vector<AtomicString> supportedPropertyNames() const; > > Element* documentNamedItem(const AtomicStringImpl& name) const { return m_documentNamedItem.getElementByDocumentNamedItem(name, *this); } >diff --git a/Source/WebCore/html/HTMLFormControlsCollection.cpp b/Source/WebCore/html/HTMLFormControlsCollection.cpp >index d921e31e9f12eafe7d8f53bc12fc5dbcbd961c9c..97b8714eb5459ce13e4e1a61f0d12140f514cc6c 100644 >--- a/Source/WebCore/html/HTMLFormControlsCollection.cpp >+++ b/Source/WebCore/html/HTMLFormControlsCollection.cpp >@@ -50,12 +50,12 @@ Ref<HTMLFormControlsCollection> HTMLFormControlsCollection::create(ContainerNode > > HTMLFormControlsCollection::~HTMLFormControlsCollection() = default; > >-std::optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> HTMLFormControlsCollection::namedItemOrItems(const String& name) const >+WTF::Optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> HTMLFormControlsCollection::namedItemOrItems(const String& name) const > { > auto namedItems = this->namedItems(name); > > if (namedItems.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > if (namedItems.size() == 1) > return Variant<RefPtr<RadioNodeList>, RefPtr<Element>> { RefPtr<Element> { WTFMove(namedItems[0]) } }; > >diff --git a/Source/WebCore/html/HTMLFormControlsCollection.h b/Source/WebCore/html/HTMLFormControlsCollection.h >index 540756794d92157618c915c71e855dee6776ab88..bb3f8e145a83a14f5f17f57e30f49639a0547dda 100644 >--- a/Source/WebCore/html/HTMLFormControlsCollection.h >+++ b/Source/WebCore/html/HTMLFormControlsCollection.h >@@ -40,7 +40,7 @@ public: > virtual ~HTMLFormControlsCollection(); > > HTMLElement* item(unsigned offset) const override; >- std::optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> namedItemOrItems(const String&) const; >+ WTF::Optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> namedItemOrItems(const String&) const; > > HTMLFormElement& ownerNode() const; > >diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp >index ed92ac8fe7b046fca81e2a894ed387b376447993..896de00ae1966a4659439a9abdd9aabef64170fa 100644 >--- a/Source/WebCore/html/HTMLFormElement.cpp >+++ b/Source/WebCore/html/HTMLFormElement.cpp >@@ -166,12 +166,12 @@ HTMLElement* HTMLFormElement::item(unsigned index) > return elements()->item(index); > } > >-std::optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> HTMLFormElement::namedItem(const AtomicString& name) >+WTF::Optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> HTMLFormElement::namedItem(const AtomicString& name) > { > auto namedItems = namedElements(name); > > if (namedItems.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > if (namedItems.size() == 1) > return Variant<RefPtr<RadioNodeList>, RefPtr<Element>> { RefPtr<Element> { WTFMove(namedItems[0]) } }; > >diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h >index 7fe0426066e036fa585de9e95a5c656669da87eb..d906d7cb240545a64c32ee2e7041e4e77a7da84d 100644 >--- a/Source/WebCore/html/HTMLFormElement.h >+++ b/Source/WebCore/html/HTMLFormElement.h >@@ -54,7 +54,7 @@ public: > > WEBCORE_EXPORT unsigned length() const; > HTMLElement* item(unsigned index); >- std::optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> namedItem(const AtomicString&); >+ WTF::Optional<Variant<RefPtr<RadioNodeList>, RefPtr<Element>>> namedItem(const AtomicString&); > Vector<AtomicString> supportedPropertyNames() const; > > String enctype() const { return m_attributes.encodingType(); } >diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp >index dd780f7b3045fa21992f647e3dff4ab564e604bb..77306f9a9d6d96b3330c7fea176a980dc18851c5 100644 >--- a/Source/WebCore/html/HTMLImageElement.cpp >+++ b/Source/WebCore/html/HTMLImageElement.cpp >@@ -100,7 +100,7 @@ HTMLImageElement::~HTMLImageElement() > setPictureElement(nullptr); > } > >-Ref<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document& document, std::optional<unsigned> width, std::optional<unsigned> height) >+Ref<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document& document, WTF::Optional<unsigned> width, WTF::Optional<unsigned> height) > { > auto image = adoptRef(*new HTMLImageElement(imgTag, document)); > if (width) >diff --git a/Source/WebCore/html/HTMLImageElement.h b/Source/WebCore/html/HTMLImageElement.h >index 4f709dd88d03941a2f3fb32b324843a9e8be2d42..02540a17c5df4860a07eaccb8acfb9c4b448b89b 100644 >--- a/Source/WebCore/html/HTMLImageElement.h >+++ b/Source/WebCore/html/HTMLImageElement.h >@@ -45,7 +45,7 @@ class HTMLImageElement : public HTMLElement, public FormNamedItem { > public: > static Ref<HTMLImageElement> create(Document&); > static Ref<HTMLImageElement> create(const QualifiedName&, Document&, HTMLFormElement*); >- static Ref<HTMLImageElement> createForJSConstructor(Document&, std::optional<unsigned> width, std::optional<unsigned> height); >+ static Ref<HTMLImageElement> createForJSConstructor(Document&, WTF::Optional<unsigned> width, WTF::Optional<unsigned> height); > > virtual ~HTMLImageElement(); > >diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp >index 400c8e32402978cecf3e4637a2713a8d2e6eba98..e70aece5de5a004efdc2282c6bbf81128aaab141 100644 >--- a/Source/WebCore/html/HTMLInputElement.cpp >+++ b/Source/WebCore/html/HTMLInputElement.cpp >@@ -399,7 +399,7 @@ StepRange HTMLInputElement::createStepRange(AnyStepHandling anyStepHandling) con > } > > #if ENABLE(DATALIST_ELEMENT) >-std::optional<Decimal> HTMLInputElement::findClosestTickMarkValue(const Decimal& value) >+WTF::Optional<Decimal> HTMLInputElement::findClosestTickMarkValue(const Decimal& value) > { > return m_inputType->findClosestTickMarkValue(value); > } >diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h >index ac50d36e2226b412caf584ba1050d9a99b07c7e6..4c5aaee6abaadc8affc8b4123d53e152292debbb 100644 >--- a/Source/WebCore/html/HTMLInputElement.h >+++ b/Source/WebCore/html/HTMLInputElement.h >@@ -86,7 +86,7 @@ public: > StepRange createStepRange(AnyStepHandling) const; > > #if ENABLE(DATALIST_ELEMENT) >- std::optional<Decimal> findClosestTickMarkValue(const Decimal&); >+ WTF::Optional<Decimal> findClosestTickMarkValue(const Decimal&); > #endif > > WEBCORE_EXPORT ExceptionOr<void> stepUp(int = 1); >diff --git a/Source/WebCore/html/HTMLLIElement.cpp b/Source/WebCore/html/HTMLLIElement.cpp >index f980f4cd4e934ce77147c28d09b7127275857255..e92815b8f92043e5b78d4cd3300eaa2ddb763fdb 100644 >--- a/Source/WebCore/html/HTMLLIElement.cpp >+++ b/Source/WebCore/html/HTMLLIElement.cpp >@@ -123,7 +123,7 @@ inline void HTMLLIElement::parseValue(const AtomicString& value) > if (valueOK) > downcast<RenderListItem>(*renderer()).setExplicitValue(requestedValue); > else >- downcast<RenderListItem>(*renderer()).setExplicitValue(std::nullopt); >+ downcast<RenderListItem>(*renderer()).setExplicitValue(WTF::nullopt); > } > > } >diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp >index 02ca3c52bf43a60e55a0517cbcc85b3dc70fd2af..282fefcbaf4607e94145a981542ade0a46cbb310 100644 >--- a/Source/WebCore/html/HTMLLinkElement.cpp >+++ b/Source/WebCore/html/HTMLLinkElement.cpp >@@ -289,7 +289,7 @@ void HTMLLinkElement::process() > > bool mediaQueryMatches = true; > if (!m_media.isEmpty()) { >- std::optional<RenderStyle> documentStyle; >+ WTF::Optional<RenderStyle> documentStyle; > if (document().hasLivingRenderTree()) > documentStyle = Style::resolveForDocument(document()); > auto media = MediaQuerySet::create(m_media, MediaQueryParserContext(document())); >@@ -303,7 +303,7 @@ void HTMLLinkElement::process() > addPendingSheet(isActive ? ActiveSheet : InactiveSheet); > > // Load stylesheets that are not needed for the rendering immediately with low priority. >- std::optional<ResourceLoadPriority> priority; >+ WTF::Optional<ResourceLoadPriority> priority; > if (!isActive) > priority = ResourceLoadPriority::VeryLow; > >@@ -395,7 +395,7 @@ void HTMLLinkElement::finishParsingChildren() > void HTMLLinkElement::initializeStyleSheet(Ref<StyleSheetContents>&& styleSheet, const CachedCSSStyleSheet& cachedStyleSheet, MediaQueryParserContext context) > { > // FIXME: originClean should be turned to false except if fetch mode is CORS. >- std::optional<bool> originClean; >+ WTF::Optional<bool> originClean; > if (cachedStyleSheet.options().mode == FetchOptions::Mode::Cors) > originClean = cachedStyleSheet.isCORSSameOrigin(); > >@@ -580,7 +580,7 @@ const AtomicString& HTMLLinkElement::type() const > return attributeWithoutSynchronization(typeAttr); > } > >-std::optional<LinkIconType> HTMLLinkElement::iconType() const >+WTF::Optional<LinkIconType> HTMLLinkElement::iconType() const > { > return m_relAttribute.iconType; > } >diff --git a/Source/WebCore/html/HTMLLinkElement.h b/Source/WebCore/html/HTMLLinkElement.h >index 6828f9343b5724095db6021742687654070cdf89..c5f46d5be0db32eab7709cae154806b81b890709 100644 >--- a/Source/WebCore/html/HTMLLinkElement.h >+++ b/Source/WebCore/html/HTMLLinkElement.h >@@ -54,7 +54,7 @@ public: > > const AtomicString& type() const; > >- std::optional<LinkIconType> iconType() const; >+ WTF::Optional<LinkIconType> iconType() const; > > CSSStyleSheet* sheet() const { return m_sheet.get(); } > >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index 0dcc88905063d2eb2709e62e34e95ea073b288a4..29f07a959ba4d8750b2936cb5e7da95d522eb475 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -1758,7 +1758,7 @@ void HTMLMediaElement::updateActiveTextTrackCues(const MediaTime& movieTime) > if (auto nearestEndingCue = std::min_element(currentCues.begin(), currentCues.end(), compareCueIntervalEndTime)) > nextInterestingTime = nearestEndingCue->data()->endMediaTime(); > >- std::optional<CueInterval> nextCue = m_cueTree.nextIntervalAfter(movieTimeInterval); >+ WTF::Optional<CueInterval> nextCue = m_cueTree.nextIntervalAfter(movieTimeInterval); > if (nextCue) > nextInterestingTime = std::min(nextInterestingTime, nextCue->low()); > >@@ -7185,7 +7185,7 @@ RefPtr<VideoPlaybackQuality> HTMLMediaElement::getVideoPlaybackQuality() > RefPtr<DOMWindow> domWindow = document().domWindow(); > double timestamp = domWindow ? 1000 * domWindow->nowTimestamp() : 0; > >- auto metrics = m_player ? m_player->videoPlaybackQualityMetrics() : std::nullopt; >+ auto metrics = m_player ? m_player->videoPlaybackQualityMetrics() : WTF::nullopt; > if (!metrics) > return VideoPlaybackQuality::create(timestamp, { }); > >@@ -7783,10 +7783,10 @@ void HTMLMediaElement::setPlaybackWithoutUserGesture(PlaybackWithoutUserGesture > m_playbackWithoutUserGestureStartedTime = currentMediaTime(); > break; > case PlaybackWithoutUserGesture::None: >- m_playbackWithoutUserGestureStartedTime = std::nullopt; >+ m_playbackWithoutUserGestureStartedTime = WTF::nullopt; > break; > case PlaybackWithoutUserGesture::Prevented: >- m_playbackWithoutUserGestureStartedTime = std::nullopt; >+ m_playbackWithoutUserGestureStartedTime = WTF::nullopt; > > dispatchPlayPauseEventsIfNeedsQuirks(); > handleAutoplayEvent(AutoplayEvent::DidPreventMediaFromPlaying); >diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h >index 0c871593e285867c3bd82aa86107fbbf643af6da..55be1ea5a22257ae0593eee94f9408b3fc8ac1c0 100644 >--- a/Source/WebCore/html/HTMLMediaElement.h >+++ b/Source/WebCore/html/HTMLMediaElement.h >@@ -113,7 +113,7 @@ using CueInterval = CueIntervalTree::IntervalType; > using CueList = Vector<CueInterval>; > #endif > >-using MediaProvider = std::optional<Variant< >+using MediaProvider = WTF::Optional<Variant< > #if ENABLE(MEDIA_STREAM) > RefPtr<MediaStream>, > #endif >@@ -1118,12 +1118,12 @@ private: > bool m_processingPreferenceChange : 1; > > PlaybackWithoutUserGesture m_playbackWithoutUserGesture { PlaybackWithoutUserGesture::None }; >- std::optional<MediaTime> m_playbackWithoutUserGestureStartedTime; >+ WTF::Optional<MediaTime> m_playbackWithoutUserGestureStartedTime; > > String m_subtitleTrackLanguage; > MediaTime m_lastTextTrackUpdateTime { -1, 1 }; > >- std::optional<CaptionUserPreferences::CaptionDisplayMode> m_captionDisplayMode; >+ WTF::Optional<CaptionUserPreferences::CaptionDisplayMode> m_captionDisplayMode; > > RefPtr<AudioTrackList> m_audioTracks; > RefPtr<TextTrackList> m_textTracks; >diff --git a/Source/WebCore/html/HTMLOListElement.cpp b/Source/WebCore/html/HTMLOListElement.cpp >index eff762905edbb6c85d578ba3c4aaee047f7e797d..d8263dbd6a3f04320f1d79c36876624d464013f9 100644 >--- a/Source/WebCore/html/HTMLOListElement.cpp >+++ b/Source/WebCore/html/HTMLOListElement.cpp >@@ -30,11 +30,11 @@ > #include "RenderListItem.h" > #include <wtf/IsoMallocInlines.h> > >-// FIXME: There should be a standard way to turn a std::expected into a std::optional. >+// FIXME: There should be a standard way to turn a std::expected into a WTF::Optional. > // Maybe we should put this into the header file for Expected and give it a better name. >-template<typename T, typename E> inline std::optional<T> optionalValue(Expected<T, E>&& expected) >+template<typename T, typename E> inline WTF::Optional<T> optionalValue(Expected<T, E>&& expected) > { >- return expected ? std::optional<T>(WTFMove(expected.value())) : std::nullopt; >+ return expected ? WTF::Optional<T>(WTFMove(expected.value())) : WTF::nullopt; > } > > namespace WebCore { >diff --git a/Source/WebCore/html/HTMLOListElement.h b/Source/WebCore/html/HTMLOListElement.h >index c2bed0be233f782c167c70e9865bb764843a9c7c..92133129b90028fa6fbff53cc4f8d1b0c4d3b147 100644 >--- a/Source/WebCore/html/HTMLOListElement.h >+++ b/Source/WebCore/html/HTMLOListElement.h >@@ -41,7 +41,7 @@ public: > > int start() const { return m_start ? m_start.value() : (m_isReversed ? itemCount() : 1); } > bool isReversed() const { return m_isReversed; } >- void itemCountChanged() { m_itemCount = std::nullopt; } >+ void itemCountChanged() { m_itemCount = WTF::nullopt; } > > private: > HTMLOListElement(const QualifiedName&, Document&); >@@ -52,8 +52,8 @@ private: > bool isPresentationAttribute(const QualifiedName&) const final; > void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final; > >- std::optional<int> m_start; >- mutable std::optional<unsigned> m_itemCount; >+ WTF::Optional<int> m_start; >+ mutable WTF::Optional<unsigned> m_itemCount; > bool m_isReversed { false }; > }; > >diff --git a/Source/WebCore/html/HTMLOptionsCollection.cpp b/Source/WebCore/html/HTMLOptionsCollection.cpp >index 1c4b3d119e40ff6534573e0db0a0ff5c2eb3caaa..9f446d1f0edd0f99e0089531105dfad1e75e6501 100644 >--- a/Source/WebCore/html/HTMLOptionsCollection.cpp >+++ b/Source/WebCore/html/HTMLOptionsCollection.cpp >@@ -33,7 +33,7 @@ Ref<HTMLOptionsCollection> HTMLOptionsCollection::create(HTMLSelectElement& sele > return adoptRef(*new HTMLOptionsCollection(select)); > } > >-ExceptionOr<void> HTMLOptionsCollection::add(const OptionOrOptGroupElement& element, const std::optional<HTMLElementOrInt>& before) >+ExceptionOr<void> HTMLOptionsCollection::add(const OptionOrOptGroupElement& element, const WTF::Optional<HTMLElementOrInt>& before) > { > return selectElement().add(element, before); > } >diff --git a/Source/WebCore/html/HTMLOptionsCollection.h b/Source/WebCore/html/HTMLOptionsCollection.h >index 983a38feb49238942dfb16f6e5bf1b8d6d26652a..a03d247d8f0881eb9a9fb911e4a8eef9727ba03f 100644 >--- a/Source/WebCore/html/HTMLOptionsCollection.h >+++ b/Source/WebCore/html/HTMLOptionsCollection.h >@@ -45,7 +45,7 @@ public: > > using OptionOrOptGroupElement = Variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>; > using HTMLElementOrInt = Variant<RefPtr<HTMLElement>, int>; >- WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, const std::optional<HTMLElementOrInt>& before); >+ WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, const WTF::Optional<HTMLElementOrInt>& before); > WEBCORE_EXPORT void remove(int index); > > WEBCORE_EXPORT int selectedIndex() const; >diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp >index c1740b77477cf23cb86406bd4d654264e91a1c3f..8e32e6808050dcdedd1a5ef03f890fc0c092eac9 100644 >--- a/Source/WebCore/html/HTMLSelectElement.cpp >+++ b/Source/WebCore/html/HTMLSelectElement.cpp >@@ -222,7 +222,7 @@ int HTMLSelectElement::activeSelectionEndListIndex() const > return lastSelectedListIndex(); > } > >-ExceptionOr<void> HTMLSelectElement::add(const OptionOrOptGroupElement& element, const std::optional<HTMLElementOrInt>& before) >+ExceptionOr<void> HTMLSelectElement::add(const OptionOrOptGroupElement& element, const WTF::Optional<HTMLElementOrInt>& before) > { > RefPtr<HTMLElement> beforeElement; > if (before) { >@@ -467,7 +467,7 @@ ExceptionOr<void> HTMLSelectElement::setLength(unsigned newLength) > > if (diff < 0) { // Add dummy elements. > do { >- auto result = add(HTMLOptionElement::create(document()).ptr(), std::nullopt); >+ auto result = add(HTMLOptionElement::create(document()).ptr(), WTF::nullopt); > if (result.hasException()) > return result; > } while (++diff); >diff --git a/Source/WebCore/html/HTMLSelectElement.h b/Source/WebCore/html/HTMLSelectElement.h >index 26ebda8f225e7f870df57c799409462271f91d16..1c38357a9b8d5a38bb5de10051ee1643e24dfeeb 100644 >--- a/Source/WebCore/html/HTMLSelectElement.h >+++ b/Source/WebCore/html/HTMLSelectElement.h >@@ -54,7 +54,7 @@ public: > > using OptionOrOptGroupElement = Variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>; > using HTMLElementOrInt = Variant<RefPtr<HTMLElement>, int>; >- WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, const std::optional<HTMLElementOrInt>& before); >+ WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, const WTF::Optional<HTMLElementOrInt>& before); > > using Node::remove; > WEBCORE_EXPORT void remove(int); >diff --git a/Source/WebCore/html/HTMLSourceElement.cpp b/Source/WebCore/html/HTMLSourceElement.cpp >index d3e88d35d9873fa928a33dcb4e65d78ffa249d07..cfdeb535229e94dcfe3aeb8cd4bc96b2885c959a 100644 >--- a/Source/WebCore/html/HTMLSourceElement.cpp >+++ b/Source/WebCore/html/HTMLSourceElement.cpp >@@ -160,7 +160,7 @@ void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicSt > HTMLElement::parseAttribute(name, value); > if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) { > if (name == mediaAttr) >- m_cachedParsedMediaAttribute = std::nullopt; >+ m_cachedParsedMediaAttribute = WTF::nullopt; > auto parent = makeRefPtr(parentNode()); > if (is<HTMLPictureElement>(parent)) > downcast<HTMLPictureElement>(*parent).sourcesChanged(); >diff --git a/Source/WebCore/html/HTMLSourceElement.h b/Source/WebCore/html/HTMLSourceElement.h >index 3204f54a1029f24a33f93a60e6d6c334b3bff578..e91d4582eeada09c594c0aa366568249874f4013 100644 >--- a/Source/WebCore/html/HTMLSourceElement.h >+++ b/Source/WebCore/html/HTMLSourceElement.h >@@ -63,7 +63,7 @@ private: > > Timer m_errorEventTimer; > bool m_shouldRescheduleErrorEventOnResume { false }; >- mutable std::optional<RefPtr<const MediaQuerySet>> m_cachedParsedMediaAttribute; >+ mutable WTF::Optional<RefPtr<const MediaQuerySet>> m_cachedParsedMediaAttribute; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/html/ImageBitmap.cpp b/Source/WebCore/html/ImageBitmap.cpp >index d1a4814c2404ca072bbb3946dca5857ef3f62d31..aa9970ac909ea5a3262f54de19df785ef9466f46 100644 >--- a/Source/WebCore/html/ImageBitmap.cpp >+++ b/Source/WebCore/html/ImageBitmap.cpp >@@ -76,7 +76,7 @@ void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext, > { > WTF::switchOn(source, > [&] (auto& specificSource) { >- createPromise(scriptExecutionContext, specificSource, WTFMove(options), std::nullopt, WTFMove(promise)); >+ createPromise(scriptExecutionContext, specificSource, WTFMove(options), WTF::nullopt, WTFMove(promise)); > } > ); > } >@@ -147,7 +147,7 @@ static bool taintsOrigin(SecurityOrigin* origin, HTMLVideoElement& video) > #endif > > // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#cropped-to-the-source-rectangle-with-formatting >-static ExceptionOr<IntRect> croppedSourceRectangleWithFormatting(IntSize inputSize, ImageBitmapOptions& options, std::optional<IntRect> rect) >+static ExceptionOr<IntRect> croppedSourceRectangleWithFormatting(IntSize inputSize, ImageBitmapOptions& options, WTF::Optional<IntRect> rect) > { > // 2. If either or both of resizeWidth and resizeHeight members of options are less > // than or equal to 0, then return a promise rejected with "InvalidStateError" >@@ -250,7 +250,7 @@ static InterpolationQuality interpolationQualityForResizeQuality(ImageBitmapOpti > > // 13. Return output. > >-void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<HTMLImageElement>& imageElement, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<HTMLImageElement>& imageElement, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > { > // 2. If image is not completely available, then return a promise rejected with > // an "InvalidStateError" DOMException and abort these steps. >@@ -338,7 +338,7 @@ void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<HTMLImageElement > promise.resolve(WTFMove(imageBitmap)); > } > >-void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<HTMLCanvasElement>& canvasElement, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<HTMLCanvasElement>& canvasElement, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > { > // 2. If the canvas element's bitmap has either a horizontal dimension or a vertical > // dimension equal to zero, then return a promise rejected with an "InvalidStateError" >@@ -388,7 +388,7 @@ void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<HTMLCanvasElemen > } > > #if ENABLE(VIDEO) >-void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext, RefPtr<HTMLVideoElement>& video, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext, RefPtr<HTMLVideoElement>& video, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > { > // https://html.spec.whatwg.org/multipage/#dom-createimagebitmap > // WHATWG HTML 2102913b313078cd8eeac7e81e6a8756cbd3e773 >@@ -450,13 +450,13 @@ void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext, > #endif > > #if ENABLE(CSS_TYPED_OM) >-void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<TypedOMCSSImageValue>&, ImageBitmapOptions&&, std::optional<IntRect>, ImageBitmap::Promise&& promise) >+void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<TypedOMCSSImageValue>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, ImageBitmap::Promise&& promise) > { > promise.reject(InvalidStateError, "Not implemented"); > } > #endif > >-void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<ImageBitmap>& existingImageBitmap, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<ImageBitmap>& existingImageBitmap, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > { > // 2. If image's [[Detached]] internal slot value is true, return a promise > // rejected with an "InvalidStateError" DOMException and abort these steps. >@@ -529,14 +529,14 @@ private: > > class PendingImageBitmap final : public ActiveDOMObject, public FileReaderLoaderClient { > public: >- static void fetch(ScriptExecutionContext& scriptExecutionContext, RefPtr<Blob>&& blob, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+ static void fetch(ScriptExecutionContext& scriptExecutionContext, RefPtr<Blob>&& blob, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > { > auto pendingImageBitmap = new PendingImageBitmap(scriptExecutionContext, WTFMove(blob), WTFMove(options), WTFMove(rect), WTFMove(promise)); > pendingImageBitmap->start(scriptExecutionContext); > } > > private: >- PendingImageBitmap(ScriptExecutionContext& scriptExecutionContext, RefPtr<Blob>&& blob, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+ PendingImageBitmap(ScriptExecutionContext& scriptExecutionContext, RefPtr<Blob>&& blob, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > : ActiveDOMObject(&scriptExecutionContext) > , m_blobLoader(FileReaderLoader::ReadAsArrayBuffer, this) > , m_blob(WTFMove(blob)) >@@ -600,7 +600,7 @@ private: > FileReaderLoader m_blobLoader; > RefPtr<Blob> m_blob; > ImageBitmapOptions m_options; >- std::optional<IntRect> m_rect; >+ WTF::Optional<IntRect> m_rect; > ImageBitmap::Promise m_promise; > }; > >@@ -610,7 +610,7 @@ void ImageBitmap::createFromBuffer( > long long expectedContentLength, > const URL& sourceUrl, > ImageBitmapOptions&& options, >- std::optional<IntRect> rect, >+ WTF::Optional<IntRect> rect, > ImageBitmap::Promise&& promise) > { > if (!arrayBuffer->byteLength()) { >@@ -656,13 +656,13 @@ void ImageBitmap::createFromBuffer( > promise.resolve(WTFMove(imageBitmap)); > } > >-void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext, RefPtr<Blob>& blob, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext, RefPtr<Blob>& blob, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > { > // 2. Return a new promise, but continue running these steps in parallel. > PendingImageBitmap::fetch(scriptExecutionContext, WTFMove(blob), WTFMove(options), WTFMove(rect), WTFMove(promise)); > } > >-void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<ImageData>& imageData, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise) >+void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<ImageData>& imageData, ImageBitmapOptions&& options, WTF::Optional<IntRect> rect, ImageBitmap::Promise&& promise) > { > UNUSED_PARAM(imageData); > UNUSED_PARAM(options); >diff --git a/Source/WebCore/html/ImageBitmap.h b/Source/WebCore/html/ImageBitmap.h >index cbd1f7dd958c9fd9be41f374a4ccef5324d9893d..18afb2274bf6c571bfcabe23be554efd32e2b0c7 100644 >--- a/Source/WebCore/html/ImageBitmap.h >+++ b/Source/WebCore/html/ImageBitmap.h >@@ -94,16 +94,16 @@ private: > static Ref<ImageBitmap> create(std::unique_ptr<ImageBuffer>&&); > ImageBitmap(std::unique_ptr<ImageBuffer>&&); > >- static void createPromise(ScriptExecutionContext&, RefPtr<HTMLImageElement>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >+ static void createPromise(ScriptExecutionContext&, RefPtr<HTMLImageElement>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); > #if ENABLE(VIDEO) >- static void createPromise(ScriptExecutionContext&, RefPtr<HTMLVideoElement>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >+ static void createPromise(ScriptExecutionContext&, RefPtr<HTMLVideoElement>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); > #endif >- static void createPromise(ScriptExecutionContext&, RefPtr<HTMLCanvasElement>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >- static void createPromise(ScriptExecutionContext&, RefPtr<ImageBitmap>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >- static void createPromise(ScriptExecutionContext&, RefPtr<Blob>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >- static void createPromise(ScriptExecutionContext&, RefPtr<ImageData>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >- static void createPromise(ScriptExecutionContext&, RefPtr<TypedOMCSSImageValue>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >- static void createFromBuffer(Ref<ArrayBuffer>&&, String mimeType, long long expectedContentLength, const URL&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&); >+ static void createPromise(ScriptExecutionContext&, RefPtr<HTMLCanvasElement>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); >+ static void createPromise(ScriptExecutionContext&, RefPtr<ImageBitmap>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); >+ static void createPromise(ScriptExecutionContext&, RefPtr<Blob>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); >+ static void createPromise(ScriptExecutionContext&, RefPtr<ImageData>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); >+ static void createPromise(ScriptExecutionContext&, RefPtr<TypedOMCSSImageValue>&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); >+ static void createFromBuffer(Ref<ArrayBuffer>&&, String mimeType, long long expectedContentLength, const URL&, ImageBitmapOptions&&, WTF::Optional<IntRect>, Promise&&); > > std::unique_ptr<ImageBuffer> m_bitmapData; > bool m_detached { false }; >diff --git a/Source/WebCore/html/ImageBitmapOptions.h b/Source/WebCore/html/ImageBitmapOptions.h >index d5f09b7d1f9ee7b38a79fbc839d89d49fed1c60e..82725d18e43fc2977b1568b435033383fd3a364c 100644 >--- a/Source/WebCore/html/ImageBitmapOptions.h >+++ b/Source/WebCore/html/ImageBitmapOptions.h >@@ -38,8 +38,8 @@ struct ImageBitmapOptions { > Orientation imageOrientation { Orientation::None }; > PremultiplyAlpha premultiplyAlpha { PremultiplyAlpha::Default }; > ColorSpaceConversion colorSpaceConversion { ColorSpaceConversion::Default }; >- std::optional<unsigned> resizeWidth; >- std::optional<unsigned> resizeHeight; >+ WTF::Optional<unsigned> resizeWidth; >+ WTF::Optional<unsigned> resizeHeight; > ResizeQuality resizeQuality { ResizeQuality::Low }; > }; > >diff --git a/Source/WebCore/html/ImageData.cpp b/Source/WebCore/html/ImageData.cpp >index 3b2a23663d107731d3271b643813451a1318756d..89279aa65f0aba1350586d7efa635e7e492d1ac6 100644 >--- a/Source/WebCore/html/ImageData.cpp >+++ b/Source/WebCore/html/ImageData.cpp >@@ -77,7 +77,7 @@ RefPtr<ImageData> ImageData::create(const IntSize& size, Ref<Uint8ClampedArray>& > return adoptRef(*new ImageData(size, WTFMove(byteArray))); > } > >-ExceptionOr<RefPtr<ImageData>> ImageData::create(Ref<Uint8ClampedArray>&& byteArray, unsigned sw, std::optional<unsigned> sh) >+ExceptionOr<RefPtr<ImageData>> ImageData::create(Ref<Uint8ClampedArray>&& byteArray, unsigned sw, WTF::Optional<unsigned> sh) > { > unsigned length = byteArray->length(); > if (!length || length % 4) >diff --git a/Source/WebCore/html/ImageData.h b/Source/WebCore/html/ImageData.h >index a0ffa298718bf277e8a16b613e5758a7872c22f3..5f6dddacd85ba3e7de9f4a2ab0dd283ce3e2c126 100644 >--- a/Source/WebCore/html/ImageData.h >+++ b/Source/WebCore/html/ImageData.h >@@ -39,7 +39,7 @@ public: > WEBCORE_EXPORT static ExceptionOr<Ref<ImageData>> create(unsigned sw, unsigned sh); > WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&); > WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&, Ref<Uint8ClampedArray>&&); >- WEBCORE_EXPORT static ExceptionOr<RefPtr<ImageData>> create(Ref<Uint8ClampedArray>&&, unsigned sw, std::optional<unsigned> sh); >+ WEBCORE_EXPORT static ExceptionOr<RefPtr<ImageData>> create(Ref<Uint8ClampedArray>&&, unsigned sw, WTF::Optional<unsigned> sh); > > IntSize size() const { return m_size; } > int width() const { return m_size.width(); } >diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp >index 15aa139240af9e5152a1378e6538ceb4058da5ec..03c7018c6edf2b94dc532e07842a1675b5110e28 100644 >--- a/Source/WebCore/html/InputType.cpp >+++ b/Source/WebCore/html/InputType.cpp >@@ -924,10 +924,10 @@ void InputType::listAttributeTargetChanged() > { > } > >-std::optional<Decimal> InputType::findClosestTickMarkValue(const Decimal&) >+WTF::Optional<Decimal> InputType::findClosestTickMarkValue(const Decimal&) > { > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > #endif > >diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h >index 7a01d20b2b989195a3ed94c6de61d2109488fc26..058988079cc922cc0570c056f25ecfc72115b4c7 100644 >--- a/Source/WebCore/html/InputType.h >+++ b/Source/WebCore/html/InputType.h >@@ -298,7 +298,7 @@ public: > > #if ENABLE(DATALIST_ELEMENT) > virtual void listAttributeTargetChanged(); >- virtual std::optional<Decimal> findClosestTickMarkValue(const Decimal&); >+ virtual WTF::Optional<Decimal> findClosestTickMarkValue(const Decimal&); > #endif > > #if ENABLE(DRAG_SUPPORT) >diff --git a/Source/WebCore/html/LinkIconCollector.cpp b/Source/WebCore/html/LinkIconCollector.cpp >index 6a749d9a9b00de7d30e21e1027aec15a4f378951..24486cd84fd4e30bc03b001da81360f59430813a 100644 >--- a/Source/WebCore/html/LinkIconCollector.cpp >+++ b/Source/WebCore/html/LinkIconCollector.cpp >@@ -95,7 +95,7 @@ auto LinkIconCollector::iconsOfTypes(OptionSet<LinkIconType> iconTypes) -> Vecto > // This icon size parsing is a little wonky - it only parses the first > // part of the size, "60x70" becomes "60". This is for compatibility reasons > // and is probably good enough for now. >- std::optional<unsigned> iconSize; >+ WTF::Optional<unsigned> iconSize; > > if (linkElement.sizes().length()) { > bool ok; >diff --git a/Source/WebCore/html/LinkRelAttribute.h b/Source/WebCore/html/LinkRelAttribute.h >index 3ab094d4b7442a5fbffd7eef2b94d162f2c091f3..fdd299146ed1f0c1f0a46fdd604ef4022ed69785 100644 >--- a/Source/WebCore/html/LinkRelAttribute.h >+++ b/Source/WebCore/html/LinkRelAttribute.h >@@ -42,7 +42,7 @@ enum class LinkIconType; > > struct LinkRelAttribute { > bool isStyleSheet { false }; >- std::optional<LinkIconType> iconType; >+ WTF::Optional<LinkIconType> iconType; > bool isAlternate { false }; > bool isDNSPrefetch { false }; > bool isLinkPreload { false }; >diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp >index 4bf8898b40364427d29085d717556b3bf02d5f6d..fb6d8f75bc17e20feae3d6477b884e058eb22cc2 100644 >--- a/Source/WebCore/html/RangeInputType.cpp >+++ b/Source/WebCore/html/RangeInputType.cpp >@@ -409,11 +409,11 @@ void RangeInputType::updateTickMarkValues() > std::sort(m_tickMarkValues.begin(), m_tickMarkValues.end()); > } > >-std::optional<Decimal> RangeInputType::findClosestTickMarkValue(const Decimal& value) >+WTF::Optional<Decimal> RangeInputType::findClosestTickMarkValue(const Decimal& value) > { > updateTickMarkValues(); > if (!m_tickMarkValues.size()) >- return std::nullopt; >+ return WTF::nullopt; > > size_t left = 0; > size_t right = m_tickMarkValues.size(); >@@ -436,8 +436,8 @@ std::optional<Decimal> RangeInputType::findClosestTickMarkValue(const Decimal& v > right = middle; > } > >- std::optional<Decimal> closestLeft = middle ? std::make_optional(m_tickMarkValues[middle - 1]) : std::nullopt; >- std::optional<Decimal> closestRight = middle != m_tickMarkValues.size() ? std::make_optional(m_tickMarkValues[middle]) : std::nullopt; >+ WTF::Optional<Decimal> closestLeft = middle ? WTF::makeOptional(m_tickMarkValues[middle - 1]) : WTF::nullopt; >+ WTF::Optional<Decimal> closestRight = middle != m_tickMarkValues.size() ? WTF::makeOptional(m_tickMarkValues[middle]) : WTF::nullopt; > > if (!closestLeft) > return closestRight; >diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h >index 1fc35bd410feab69e5b9ee3c5f705b83da9f1819..36713669892fe7122fe91eb26ebf25bc678afbcc 100644 >--- a/Source/WebCore/html/RangeInputType.h >+++ b/Source/WebCore/html/RangeInputType.h >@@ -72,7 +72,7 @@ private: > #if ENABLE(DATALIST_ELEMENT) > void listAttributeTargetChanged() final; > void updateTickMarkValues(); >- std::optional<Decimal> findClosestTickMarkValue(const Decimal&) final; >+ WTF::Optional<Decimal> findClosestTickMarkValue(const Decimal&) final; > > bool m_tickMarkValuesDirty { true }; > Vector<Decimal> m_tickMarkValues; >diff --git a/Source/WebCore/html/URLSearchParams.cpp b/Source/WebCore/html/URLSearchParams.cpp >index 4e7fbaefdf0a416cc654aa73d59b7be80b41d0f8..b96cc4f8d052e590f21b2712586637587f8fe27f 100644 >--- a/Source/WebCore/html/URLSearchParams.cpp >+++ b/Source/WebCore/html/URLSearchParams.cpp >@@ -149,11 +149,11 @@ void URLSearchParams::updateFromAssociatedURL() > m_pairs = search.startsWith('?') ? WTF::URLParser::parseURLEncodedForm(StringView(search).substring(1)) : WTF::URLParser::parseURLEncodedForm(search); > } > >-std::optional<WTF::KeyValuePair<String, String>> URLSearchParams::Iterator::next() >+WTF::Optional<WTF::KeyValuePair<String, String>> URLSearchParams::Iterator::next() > { > auto& pairs = m_target->pairs(); > if (m_index >= pairs.size()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& pair = pairs[m_index++]; > return WTF::KeyValuePair<String, String> { pair.key, pair.value }; >diff --git a/Source/WebCore/html/URLSearchParams.h b/Source/WebCore/html/URLSearchParams.h >index 3e4bfa614851e33a9fa3a34df25669aafc34fb61..9e93122ac32fa873db4d941d1036ab9bb7a6f852 100644 >--- a/Source/WebCore/html/URLSearchParams.h >+++ b/Source/WebCore/html/URLSearchParams.h >@@ -53,7 +53,7 @@ public: > class Iterator { > public: > explicit Iterator(URLSearchParams&); >- std::optional<WTF::KeyValuePair<String, String>> next(); >+ WTF::Optional<WTF::KeyValuePair<String, String>> next(); > > private: > Ref<URLSearchParams> m_target; >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >index 28638c6c83a5ddca1c3afd0bfc606d14ba018853..aad420e347ebac34bf83fd48c6108eb117884f4b 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >@@ -323,12 +323,12 @@ void CanvasRenderingContext2D::setDirection(CanvasDirection direction) > modifiableState().direction = direction; > } > >-void CanvasRenderingContext2D::fillText(const String& text, float x, float y, std::optional<float> maxWidth) >+void CanvasRenderingContext2D::fillText(const String& text, float x, float y, WTF::Optional<float> maxWidth) > { > drawTextInternal(text, x, y, true, maxWidth); > } > >-void CanvasRenderingContext2D::strokeText(const String& text, float x, float y, std::optional<float> maxWidth) >+void CanvasRenderingContext2D::strokeText(const String& text, float x, float y, WTF::Optional<float> maxWidth) > { > drawTextInternal(text, x, y, false, maxWidth); > } >@@ -457,7 +457,7 @@ FloatPoint CanvasRenderingContext2D::textOffset(float width, TextDirection direc > return offset; > } > >-void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, std::optional<float> maxWidth) >+void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, WTF::Optional<float> maxWidth) > { > if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled()) > ResourceLoadObserver::shared().logCanvasWriteOrMeasure(this->canvas().document(), text); >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h >index e67160ae8aa56b30c0267573253ebb35afa50d89..e69742f342567984b7b8a7cb57a55ded227a87f9 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h >@@ -62,8 +62,8 @@ public: > CanvasDirection direction() const; > void setDirection(CanvasDirection); > >- void fillText(const String& text, float x, float y, std::optional<float> maxWidth = std::nullopt); >- void strokeText(const String& text, float x, float y, std::optional<float> maxWidth = std::nullopt); >+ void fillText(const String& text, float x, float y, WTF::Optional<float> maxWidth = WTF::nullopt); >+ void strokeText(const String& text, float x, float y, WTF::Optional<float> maxWidth = WTF::nullopt); > Ref<TextMetrics> measureText(const String& text); > > bool is2d() const override { return true; } >@@ -75,7 +75,7 @@ private: > // Therefore, all font operations must pass through the State. > const FontProxy& fontProxy(); > >- void drawTextInternal(const String& text, float x, float y, bool fill, std::optional<float> maxWidth = std::nullopt); >+ void drawTextInternal(const String& text, float x, float y, bool fill, WTF::Optional<float> maxWidth = WTF::nullopt); > > void drawFocusIfNeededInternal(const Path&, Element&); > >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp >index c139a026914d995de2a126f91167476806bdf6c2..c978cefe11a26c604fa7691fcb51324839b61fe2 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp >@@ -387,7 +387,7 @@ void CanvasRenderingContext2DBase::restore() > return; > m_path.transform(state().transform); > m_stateStack.removeLast(); >- if (std::optional<AffineTransform> inverse = state().transform.inverse()) >+ if (WTF::Optional<AffineTransform> inverse = state().transform.inverse()) > m_path.transform(inverse.value()); > GraphicsContext* c = drawingContext(); > if (!c) >@@ -939,7 +939,7 @@ void CanvasRenderingContext2DBase::resetTransform() > modifiableState().hasInvertibleTransform = true; > } > >-void CanvasRenderingContext2DBase::setStrokeColor(const String& color, std::optional<float> alpha) >+void CanvasRenderingContext2DBase::setStrokeColor(const String& color, WTF::Optional<float> alpha) > { > if (alpha) { > setStrokeStyle(CanvasStyle::createFromStringWithOverrideAlpha(color, alpha.value())); >@@ -975,7 +975,7 @@ void CanvasRenderingContext2DBase::setStrokeColor(float c, float m, float y, flo > setStrokeStyle(CanvasStyle(c, m, y, k, a)); > } > >-void CanvasRenderingContext2DBase::setFillColor(const String& color, std::optional<float> alpha) >+void CanvasRenderingContext2DBase::setFillColor(const String& color, WTF::Optional<float> alpha) > { > if (alpha) { > setFillStyle(CanvasStyle::createFromStringWithOverrideAlpha(color, alpha.value())); >@@ -1339,7 +1339,7 @@ void CanvasRenderingContext2DBase::strokeRect(float x, float y, float width, flo > } > } > >-void CanvasRenderingContext2DBase::setShadow(float width, float height, float blur, const String& colorString, std::optional<float> alpha) >+void CanvasRenderingContext2DBase::setShadow(float width, float height, float blur, const String& colorString, WTF::Optional<float> alpha) > { > Color color = Color::transparent; > if (!colorString.isNull()) { >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h b/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h >index a14b605aa892ff43ebc418848a82fc35a8ec376c..82b89354970090d7a98052998cdeb7aa8465d07b 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h >@@ -135,12 +135,12 @@ public: > ExceptionOr<void> setTransform(DOMMatrix2DInit&&); > void resetTransform(); > >- void setStrokeColor(const String& color, std::optional<float> alpha = std::nullopt); >+ void setStrokeColor(const String& color, WTF::Optional<float> alpha = WTF::nullopt); > void setStrokeColor(float grayLevel, float alpha = 1.0); > void setStrokeColor(float r, float g, float b, float a); > void setStrokeColor(float c, float m, float y, float k, float a); > >- void setFillColor(const String& color, std::optional<float> alpha = std::nullopt); >+ void setFillColor(const String& color, WTF::Optional<float> alpha = WTF::nullopt); > void setFillColor(float grayLevel, float alpha = 1.0f); > void setFillColor(float r, float g, float b, float a); > void setFillColor(float c, float m, float y, float k, float a); >@@ -165,7 +165,7 @@ public: > void fillRect(float x, float y, float width, float height); > void strokeRect(float x, float y, float width, float height); > >- void setShadow(float width, float height, float blur, const String& color = String(), std::optional<float> alpha = std::nullopt); >+ void setShadow(float width, float height, float blur, const String& color = String(), WTF::Optional<float> alpha = WTF::nullopt); > void setShadow(float width, float height, float blur, float grayLevel, float alpha = 1.0); > void setShadow(float width, float height, float blur, float r, float g, float b, float a); > void setShadow(float width, float height, float blur, float c, float m, float y, float k, float a); >diff --git a/Source/WebCore/html/canvas/CanvasStyle.cpp b/Source/WebCore/html/canvas/CanvasStyle.cpp >index aca8a60d8c62b3ece8aaed4853a59001829bc1da..ca6f35de02062b7eb0e6e22503d76cacdcdf081c 100644 >--- a/Source/WebCore/html/canvas/CanvasStyle.cpp >+++ b/Source/WebCore/html/canvas/CanvasStyle.cpp >@@ -112,7 +112,7 @@ inline CanvasStyle::CanvasStyle(CurrentColor color) > CanvasStyle CanvasStyle::createFromString(const String& colorString) > { > if (isCurrentColorString(colorString)) >- return CurrentColor { std::nullopt }; >+ return CurrentColor { WTF::nullopt }; > > Color color = parseColor(colorString); > if (!color.isValid()) >diff --git a/Source/WebCore/html/canvas/CanvasStyle.h b/Source/WebCore/html/canvas/CanvasStyle.h >index bead14e2c0cab6b62b9fa282282a71c1884bf88f..125ab8e422237cbcecf7f26e68404076375bd32e 100644 >--- a/Source/WebCore/html/canvas/CanvasStyle.h >+++ b/Source/WebCore/html/canvas/CanvasStyle.h >@@ -79,7 +79,7 @@ private: > }; > > struct CurrentColor { >- std::optional<float> overrideAlpha; >+ WTF::Optional<float> overrideAlpha; > }; > > CanvasStyle(CurrentColor); >diff --git a/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp b/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp >index 45cdeee695a9f278c1c31b6a9b7d10205f6c489b..46cfe2aaea48c29e2bc9ba5801c4df0e15f4e65e 100644 >--- a/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp >+++ b/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp >@@ -113,12 +113,12 @@ void WebGL2RenderingContext::initializeShaderExtensions() > m_context->getExtensions().ensureEnabled("GL_EXT_frag_depth"); > } > >-inline static std::optional<unsigned> arrayBufferViewElementSize(const ArrayBufferView& data) >+inline static WTF::Optional<unsigned> arrayBufferViewElementSize(const ArrayBufferView& data) > { > switch (data.getType()) { > case JSC::NotTypedArray: > case JSC::TypeDataView: >- return std::nullopt; >+ return WTF::nullopt; > case JSC::TypeInt8: > case JSC::TypeUint8: > case JSC::TypeUint8Clamped: >@@ -1236,10 +1236,10 @@ WebGLAny WebGL2RenderingContext::getIndexedParameter(GC3Denum target, GC3Duint) > } > } > >-std::optional<Vector<GC3Duint>> WebGL2RenderingContext::getUniformIndices(WebGLProgram&, const Vector<String>&) >+WTF::Optional<Vector<GC3Duint>> WebGL2RenderingContext::getUniformIndices(WebGLProgram&, const Vector<String>&) > { > LOG(WebGL, "[[ NOT IMPLEMENTED ]] getUniformIndices()"); >- return std::nullopt; >+ return WTF::nullopt; > } > > WebGLAny WebGL2RenderingContext::getActiveUniforms(WebGLProgram& program, const Vector<GC3Duint>& uniformIndices, GC3Denum pname) >@@ -1380,10 +1380,10 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name) > return nullptr; > } > >-std::optional<Vector<String>> WebGL2RenderingContext::getSupportedExtensions() >+WTF::Optional<Vector<String>> WebGL2RenderingContext::getSupportedExtensions() > { > if (isContextLost()) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<String> result; > >@@ -2106,7 +2106,7 @@ bool WebGL2RenderingContext::validateIndexArrayConservative(GC3Denum type, unsig > auto buffer = elementArrayBuffer->elementArrayBuffer(); > ASSERT(buffer); > >- std::optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type); >+ WTF::Optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type); > if (!maxIndex) { > // Compute the maximum index in the entire buffer for the given type of index. > switch (type) { >diff --git a/Source/WebCore/html/canvas/WebGL2RenderingContext.h b/Source/WebCore/html/canvas/WebGL2RenderingContext.h >index 6407976833fe07be22f654cfd4566b496c57056e..de76a22414841266312d5d0bf36123ecc36c786c 100644 >--- a/Source/WebCore/html/canvas/WebGL2RenderingContext.h >+++ b/Source/WebCore/html/canvas/WebGL2RenderingContext.h >@@ -184,7 +184,7 @@ public: > void bindBufferBase(GC3Denum target, GC3Duint index, WebGLBuffer*); > void bindBufferRange(GC3Denum target, GC3Duint index, WebGLBuffer*, GC3Dint64 offset, GC3Dint64 size); > WebGLAny getIndexedParameter(GC3Denum target, GC3Duint index); >- std::optional<Vector<GC3Duint>> getUniformIndices(WebGLProgram&, const Vector<String>& uniformNames); >+ WTF::Optional<Vector<GC3Duint>> getUniformIndices(WebGLProgram&, const Vector<String>& uniformNames); > WebGLAny getActiveUniforms(WebGLProgram&, const Vector<GC3Duint>& uniformIndices, GC3Denum pname); > GC3Duint getUniformBlockIndex(WebGLProgram&, const String& uniformBlockName); > WebGLAny getActiveUniformBlockParameter(WebGLProgram&, GC3Duint uniformBlockIndex, GC3Denum pname); >@@ -198,7 +198,7 @@ public: > void bindVertexArray(WebGLVertexArrayObject* vertexArray); > > WebGLExtension* getExtension(const String&) final; >- std::optional<Vector<String>> getSupportedExtensions() final; >+ WTF::Optional<Vector<String>> getSupportedExtensions() final; > WebGLAny getParameter(GC3Denum pname) final; > > void renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) final; >diff --git a/Source/WebCore/html/canvas/WebGLBuffer.cpp b/Source/WebCore/html/canvas/WebGLBuffer.cpp >index bc914a4a782fce41078211ffcc1e80a1e993e2e7..d56366bee49a16b7baaeb9ed50db06ab863e321b 100644 >--- a/Source/WebCore/html/canvas/WebGLBuffer.cpp >+++ b/Source/WebCore/html/canvas/WebGLBuffer.cpp >@@ -228,13 +228,13 @@ GC3Dsizeiptr WebGLBuffer::byteLength() const > return m_byteLength; > } > >-std::optional<unsigned> WebGLBuffer::getCachedMaxIndex(GC3Denum type) >+WTF::Optional<unsigned> WebGLBuffer::getCachedMaxIndex(GC3Denum type) > { > for (auto& cache : m_maxIndexCache) { > if (cache.type == type) > return cache.maxIndex; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > void WebGLBuffer::setCachedMaxIndex(GC3Denum type, unsigned value) >diff --git a/Source/WebCore/html/canvas/WebGLBuffer.h b/Source/WebCore/html/canvas/WebGLBuffer.h >index c396b3a46be6ffc75eefff9e40546722cc5c0533..ca318c7f0bc6a2848bb6a6367bf026b5df4e25e5 100644 >--- a/Source/WebCore/html/canvas/WebGLBuffer.h >+++ b/Source/WebCore/html/canvas/WebGLBuffer.h >@@ -53,7 +53,7 @@ public: > const RefPtr<JSC::ArrayBuffer> elementArrayBuffer() const { return m_elementArrayBuffer; } > > // Gets the cached max index for the given type if one has been set. >- std::optional<unsigned> getCachedMaxIndex(GC3Denum type); >+ WTF::Optional<unsigned> getCachedMaxIndex(GC3Denum type); > // Sets the cached max index for the given type. > void setCachedMaxIndex(GC3Denum type, unsigned value); > >diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp >index b7a989a8d2d3d4b9768e2c9f681524b512a2fdfe..ef108ce4888c1533d0bc8937735846a0dbcea622 100644 >--- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp >+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp >@@ -179,10 +179,10 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name) > return nullptr; > } > >-std::optional<Vector<String>> WebGLRenderingContext::getSupportedExtensions() >+WTF::Optional<Vector<String>> WebGLRenderingContext::getSupportedExtensions() > { > if (isContextLost()) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<String> result; > >@@ -691,7 +691,7 @@ bool WebGLRenderingContext::validateIndexArrayConservative(GC3Denum type, unsign > auto buffer = elementArrayBuffer->elementArrayBuffer(); > ASSERT(buffer); > >- std::optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type); >+ WTF::Optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type); > if (!maxIndex) { > // Compute the maximum index in the entire buffer for the given type of index. > switch (type) { >diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h >index bacf9ebdea5e0d07b83dad71a2d0073d5c96027c..82814712b0383f69b7d71e02cc0c217e6f3fccd8 100644 >--- a/Source/WebCore/html/canvas/WebGLRenderingContext.h >+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h >@@ -41,7 +41,7 @@ public: > > WebGLExtension* getExtension(const String&) final; > WebGLAny getParameter(GC3Denum pname) final; >- std::optional<Vector<String>> getSupportedExtensions() final; >+ WTF::Optional<Vector<String>> getSupportedExtensions() final; > > WebGLAny getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname) final; > void renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) final; >diff --git a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp b/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp >index cfb3ad4811b787bb4f7f20282794f52aa93d9693..caf94a09f5da1b215e2bd8b756eaddff99099da3 100644 >--- a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp >+++ b/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp >@@ -1422,7 +1422,7 @@ void WebGLRenderingContextBase::bufferData(GC3Denum target, long long size, GC3D > } > } > >-void WebGLRenderingContextBase::bufferData(GC3Denum target, std::optional<BufferDataSource>&& data, GC3Denum usage) >+void WebGLRenderingContextBase::bufferData(GC3Denum target, WTF::Optional<BufferDataSource>&& data, GC3Denum usage) > { > if (isContextLostOrPending()) > return; >@@ -1449,7 +1449,7 @@ void WebGLRenderingContextBase::bufferData(GC3Denum target, std::optional<Buffer > }, data.value()); > } > >-void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset, std::optional<BufferDataSource>&& data) >+void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset, WTF::Optional<BufferDataSource>&& data) > { > if (isContextLostOrPending()) > return; >@@ -2541,10 +2541,10 @@ RefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLProgram > return WebGLActiveInfo::create(info.name, info.type, info.size); > } > >-std::optional<Vector<RefPtr<WebGLShader>>> WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program) >+WTF::Optional<Vector<RefPtr<WebGLShader>>> WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program) > { > if (isContextLostOrPending() || !validateWebGLObject("getAttachedShaders", program)) >- return std::nullopt; >+ return WTF::nullopt; > > const GC3Denum shaderTypes[] = { > GraphicsContext3D::VERTEX_SHADER, >@@ -2614,10 +2614,10 @@ WebGLAny WebGLRenderingContextBase::getBufferParameter(GC3Denum target, GC3Denum > return static_cast<unsigned>(value); > } > >-std::optional<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes() >+WTF::Optional<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes() > { > if (isContextLostOrPending()) >- return std::nullopt; >+ return WTF::nullopt; > > // Also, we need to enforce requested values of "false" for depth > // and stencil, regardless of the properties of the underlying >@@ -3880,7 +3880,7 @@ void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC > m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment); > } > >-ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, std::optional<TexImageSource>&& source) >+ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, WTF::Optional<TexImageSource>&& source) > { > if (!source) { > synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "source is null"); >@@ -4042,7 +4042,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D > return WTF::visit(visitor, source.value()); > } > >-bool WebGLRenderingContextBase::validateArrayBufferType(const char* functionName, GC3Denum type, std::optional<JSC::TypedArrayType> arrayType) >+bool WebGLRenderingContextBase::validateArrayBufferType(const char* functionName, GC3Denum type, WTF::Optional<JSC::TypedArrayType> arrayType) > { > #define TYPE_VALIDATION_CASE(arrayTypeMacro) if (arrayType && arrayType.value() != JSC::arrayTypeMacro) { \ > synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not " #arrayTypeMacro); \ >@@ -4103,7 +4103,7 @@ bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GC > return false; > if (!validateSettableTexInternalFormat(functionName, internalFormat)) > return false; >- if (!validateArrayBufferType(functionName, type, pixels ? std::optional<JSC::TypedArrayType>(pixels->getType()) : std::nullopt)) >+ if (!validateArrayBufferType(functionName, type, pixels ? WTF::Optional<JSC::TypedArrayType>(pixels->getType()) : WTF::nullopt)) > return false; > > unsigned totalBytesRequired; >@@ -4449,7 +4449,7 @@ static bool isRGBFormat(GC3Denum internalFormat) > || internalFormat == GraphicsContext3D::RGBA8; > } > >-ExceptionOr<void> WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, std::optional<TexImageSource> source) >+ExceptionOr<void> WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, WTF::Optional<TexImageSource> source) > { > if (!source) { > synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "source is null"); >@@ -5835,7 +5835,7 @@ bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* func > > WebGLBuffer* WebGLRenderingContextBase::validateBufferDataParameters(const char* functionName, GC3Denum target, GC3Denum usage) > { >- std::optional<WebGLBuffer*> buffer; >+ WTF::Optional<WebGLBuffer*> buffer; > switch (target) { > case GraphicsContext3D::ELEMENT_ARRAY_BUFFER: > buffer = m_boundVertexArrayObject->getElementArrayBuffer(); >@@ -6046,7 +6046,7 @@ bool WebGLRenderingContextBase::validateSimulatedVertexAttrib0(GC3Duint numVerte > return !bufferDataSize.hasOverflowed() && bufferDataSize.unsafeGet() > 0; > } > >-std::optional<bool> WebGLRenderingContextBase::simulateVertexAttrib0(GC3Duint numVertex) >+WTF::Optional<bool> WebGLRenderingContextBase::simulateVertexAttrib0(GC3Duint numVertex) > { > if (!m_currentProgram) > return false; >@@ -6074,7 +6074,7 @@ std::optional<bool> WebGLRenderingContextBase::simulateVertexAttrib0(GC3Duint nu > m_vertexAttrib0UsedBefore = false; > m_vertexAttrib0BufferSize = 0; > m_forceAttrib0BufferRefill = true; >- return std::nullopt; >+ return WTF::nullopt; > } > m_vertexAttrib0BufferSize = bufferDataSize; > m_forceAttrib0BufferRefill = true; >diff --git a/Source/WebCore/html/canvas/WebGLRenderingContextBase.h b/Source/WebCore/html/canvas/WebGLRenderingContextBase.h >index 96cc17bd85b313e9379d9b60c552c72179d5789e..09cc9e06112fede20df962d6bbea0e53a92d9b48 100644 >--- a/Source/WebCore/html/canvas/WebGLRenderingContextBase.h >+++ b/Source/WebCore/html/canvas/WebGLRenderingContextBase.h >@@ -119,8 +119,8 @@ public: > > using BufferDataSource = WTF::Variant<RefPtr<ArrayBuffer>, RefPtr<ArrayBufferView>>; > void bufferData(GC3Denum target, long long size, GC3Denum usage); >- void bufferData(GC3Denum target, std::optional<BufferDataSource>&&, GC3Denum usage); >- void bufferSubData(GC3Denum target, long long offset, std::optional<BufferDataSource>&&); >+ void bufferData(GC3Denum target, WTF::Optional<BufferDataSource>&&, GC3Denum usage); >+ void bufferSubData(GC3Denum target, long long offset, WTF::Optional<BufferDataSource>&&); > > GC3Denum checkFramebufferStatus(GC3Denum target); > virtual void clear(GC3Dbitfield mask) = 0; >@@ -172,10 +172,10 @@ public: > > RefPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, GC3Duint index); > RefPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, GC3Duint index); >- std::optional<Vector<RefPtr<WebGLShader>>> getAttachedShaders(WebGLProgram*); >+ WTF::Optional<Vector<RefPtr<WebGLShader>>> getAttachedShaders(WebGLProgram*); > GC3Dint getAttribLocation(WebGLProgram*, const String& name); > WebGLAny getBufferParameter(GC3Denum target, GC3Denum pname); >- std::optional<WebGLContextAttributes> getContextAttributes(); >+ WTF::Optional<WebGLContextAttributes> getContextAttributes(); > GC3Denum getError(); > virtual WebGLExtension* getExtension(const String& name) = 0; > virtual WebGLAny getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname) = 0; >@@ -187,7 +187,7 @@ public: > String getShaderInfoLog(WebGLShader*); > RefPtr<WebGLShaderPrecisionFormat> getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType); > String getShaderSource(WebGLShader*); >- virtual std::optional<Vector<String>> getSupportedExtensions() = 0; >+ virtual WTF::Optional<Vector<String>> getSupportedExtensions() = 0; > WebGLAny getTexParameter(GC3Denum target, GC3Denum pname); > WebGLAny getUniform(WebGLProgram*, const WebGLUniformLocation*); > RefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const String&); >@@ -238,13 +238,13 @@ public: > using TexImageSource = WTF::Variant<RefPtr<ImageBitmap>, RefPtr<ImageData>, RefPtr<HTMLImageElement>, RefPtr<HTMLCanvasElement>>; > #endif > >- ExceptionOr<void> texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, std::optional<TexImageSource>); >+ ExceptionOr<void> texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, WTF::Optional<TexImageSource>); > > void texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param); > void texParameteri(GC3Denum target, GC3Denum pname, GC3Dint param); > > void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, RefPtr<ArrayBufferView>&&); >- ExceptionOr<void> texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, std::optional<TexImageSource>&&); >+ ExceptionOr<void> texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, WTF::Optional<TexImageSource>&&); > > template <class TypedArray, class DataType> > class TypedList { >@@ -797,7 +797,7 @@ protected: > > // Helpers for simulating vertexAttrib0. > void initVertexAttrib0(); >- std::optional<bool> simulateVertexAttrib0(GC3Duint numVertex); >+ WTF::Optional<bool> simulateVertexAttrib0(GC3Duint numVertex); > bool validateSimulatedVertexAttrib0(GC3Duint numVertex); > void restoreStatesAfterVertexAttrib0Simulation(); > >@@ -834,11 +834,11 @@ protected: > HTMLCanvasElement* htmlCanvas(); > OffscreenCanvas* offscreenCanvas(); > >- template <typename T> inline std::optional<T> checkedAddAndMultiply(T value, T add, T multiply); >+ template <typename T> inline WTF::Optional<T> checkedAddAndMultiply(T value, T add, T multiply); > template <typename T> unsigned getMaxIndex(const RefPtr<JSC::ArrayBuffer> elementArrayBuffer, GC3Dintptr uoffset, GC3Dsizei n); > > private: >- bool validateArrayBufferType(const char* functionName, GC3Denum type, std::optional<JSC::TypedArrayType>); >+ bool validateArrayBufferType(const char* functionName, GC3Denum type, WTF::Optional<JSC::TypedArrayType>); > void registerWithWebGLStateTracker(); > void checkForContextLossHandling(); > >@@ -849,13 +849,13 @@ private: > }; > > template <typename T> >-inline std::optional<T> WebGLRenderingContextBase::checkedAddAndMultiply(T value, T add, T multiply) >+inline WTF::Optional<T> WebGLRenderingContextBase::checkedAddAndMultiply(T value, T add, T multiply) > { > Checked<T, RecordOverflow> checkedResult = Checked<T>(value); > checkedResult += Checked<T>(add); > checkedResult *= Checked<T>(multiply); > if (checkedResult.hasOverflowed()) >- return std::nullopt; >+ return WTF::nullopt; > > return checkedResult.unsafeGet(); > } >diff --git a/Source/WebCore/html/canvas/WebMetalEnums.cpp b/Source/WebCore/html/canvas/WebMetalEnums.cpp >index d7f9255846bbc63a5578df607fd9fb72bb9ea4f0..9d8082ae5f67a8252d52f0879ff16c6cce669608 100644 >--- a/Source/WebCore/html/canvas/WebMetalEnums.cpp >+++ b/Source/WebCore/html/canvas/WebMetalEnums.cpp >@@ -33,7 +33,7 @@ > > namespace WebCore { > >-std::optional<WebMetalCompareFunction> toWebMetalCompareFunction(const String& name) >+WTF::Optional<WebMetalCompareFunction> toWebMetalCompareFunction(const String& name) > { > if (equalLettersIgnoringASCIICase(name, "never")) > return WebMetalCompareFunction::Never; >@@ -53,7 +53,7 @@ std::optional<WebMetalCompareFunction> toWebMetalCompareFunction(const String& n > return WebMetalCompareFunction::Always; > > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > > String web3DCompareFunctionName(WebMetalCompareFunction value) >diff --git a/Source/WebCore/html/canvas/WebMetalEnums.h b/Source/WebCore/html/canvas/WebMetalEnums.h >index 9119b123d0bc6110cd20d128db2ae6d2f82f339c..885cc5321a3870885e32a2bf4b3c7aca39d95766 100644 >--- a/Source/WebCore/html/canvas/WebMetalEnums.h >+++ b/Source/WebCore/html/canvas/WebMetalEnums.h >@@ -45,7 +45,7 @@ enum class WebMetalCompareFunction { > Always > }; > >-std::optional<WebMetalCompareFunction> toWebMetalCompareFunction(const String&); >+WTF::Optional<WebMetalCompareFunction> toWebMetalCompareFunction(const String&); > String web3DCompareFunctionName(WebMetalCompareFunction); > GPULegacyCompareFunction toGPULegacyCompareFunction(WebMetalCompareFunction); > >diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp >index aca51a77f03153392662f40c3d4e2579bddd04b2..7dd4f6d0321a5efaebec3b5a6433c20417e21d91 100644 >--- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp >+++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp >@@ -720,17 +720,17 @@ Ref<HTMLStackItem> HTMLConstructionSite::createElementFromSavedToken(HTMLStackIt > return HTMLStackItem::create(createHTMLElement(fakeToken), WTFMove(fakeToken), item.namespaceURI()); > } > >-std::optional<unsigned> HTMLConstructionSite::indexOfFirstUnopenFormattingElement() const >+WTF::Optional<unsigned> HTMLConstructionSite::indexOfFirstUnopenFormattingElement() const > { > if (m_activeFormattingElements.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > unsigned index = m_activeFormattingElements.size(); > do { > --index; > const auto& entry = m_activeFormattingElements.at(index); > if (entry.isMarker() || m_openElements.contains(entry.element())) { > unsigned firstUnopenElementIndex = index + 1; >- return firstUnopenElementIndex < m_activeFormattingElements.size() ? firstUnopenElementIndex : std::optional<unsigned>(std::nullopt); >+ return firstUnopenElementIndex < m_activeFormattingElements.size() ? firstUnopenElementIndex : WTF::Optional<unsigned>(WTF::nullopt); > } > } while (index); > >@@ -739,7 +739,7 @@ std::optional<unsigned> HTMLConstructionSite::indexOfFirstUnopenFormattingElemen > > void HTMLConstructionSite::reconstructTheActiveFormattingElements() > { >- std::optional<unsigned> firstUnopenElementIndex = indexOfFirstUnopenFormattingElement(); >+ WTF::Optional<unsigned> firstUnopenElementIndex = indexOfFirstUnopenFormattingElement(); > if (!firstUnopenElementIndex) > return; > >diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.h b/Source/WebCore/html/parser/HTMLConstructionSite.h >index 96e64cfc7a98abec92f459c21f5b1fa0179949df..a2d556f2f63da57c224a7ab3d4acd4f35edcf6cd 100644 >--- a/Source/WebCore/html/parser/HTMLConstructionSite.h >+++ b/Source/WebCore/html/parser/HTMLConstructionSite.h >@@ -130,7 +130,7 @@ public: > bool shouldFosterParent() const; > void fosterParent(Ref<Node>&&); > >- std::optional<unsigned> indexOfFirstUnopenFormattingElement() const; >+ WTF::Optional<unsigned> indexOfFirstUnopenFormattingElement() const; > void reconstructTheActiveFormattingElements(); > > void generateImpliedEndTags(); >diff --git a/Source/WebCore/html/parser/HTMLParserIdioms.cpp b/Source/WebCore/html/parser/HTMLParserIdioms.cpp >index 42309268e9bdd095ac9bf16ad9f7332a371cd5b7..e059346b90091364cd158cc09dd6043c796e9c8f 100644 >--- a/Source/WebCore/html/parser/HTMLParserIdioms.cpp >+++ b/Source/WebCore/html/parser/HTMLParserIdioms.cpp >@@ -218,26 +218,26 @@ Expected<unsigned, HTMLIntegerParsingError> parseHTMLNonNegativeInteger(StringVi > } > > template <typename CharacterType> >-static std::optional<int> parseValidHTMLNonNegativeIntegerInternal(const CharacterType* position, const CharacterType* end) >+static WTF::Optional<int> parseValidHTMLNonNegativeIntegerInternal(const CharacterType* position, const CharacterType* end) > { > // A string is a valid non-negative integer if it consists of one or more ASCII digits. > for (auto* c = position; c < end; ++c) { > if (!isASCIIDigit(*c)) >- return std::nullopt; >+ return WTF::nullopt; > } > > auto optionalSignedValue = parseHTMLIntegerInternal(position, end); > if (!optionalSignedValue || optionalSignedValue.value() < 0) >- return std::nullopt; >+ return WTF::nullopt; > > return optionalSignedValue.value(); > } > > // https://html.spec.whatwg.org/#valid-non-negative-integer >-std::optional<int> parseValidHTMLNonNegativeInteger(StringView input) >+WTF::Optional<int> parseValidHTMLNonNegativeInteger(StringView input) > { > if (input.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > if (LIKELY(input.is8Bit())) { > auto* start = input.characters8(); >@@ -249,25 +249,25 @@ std::optional<int> parseValidHTMLNonNegativeInteger(StringView input) > } > > template <typename CharacterType> >-static std::optional<double> parseValidHTMLFloatingPointNumberInternal(const CharacterType* position, size_t length) >+static WTF::Optional<double> parseValidHTMLFloatingPointNumberInternal(const CharacterType* position, size_t length) > { > ASSERT(length > 0); > > // parseDouble() allows the string to start with a '+' or to end with a '.' but those > // are not valid floating point numbers as per HTML. > if (*position == '+' || *(position + length - 1) == '.') >- return std::nullopt; >+ return WTF::nullopt; > > size_t parsedLength = 0; > double number = parseDouble(position, length, parsedLength); >- return parsedLength == length && std::isfinite(number) ? number : std::optional<double>(); >+ return parsedLength == length && std::isfinite(number) ? number : WTF::Optional<double>(); > } > > // https://html.spec.whatwg.org/#valid-floating-point-number >-std::optional<double> parseValidHTMLFloatingPointNumber(StringView input) >+WTF::Optional<double> parseValidHTMLFloatingPointNumber(StringView input) > { > if (input.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > if (LIKELY(input.is8Bit())) { > auto* start = input.characters8(); >diff --git a/Source/WebCore/html/parser/HTMLParserIdioms.h b/Source/WebCore/html/parser/HTMLParserIdioms.h >index dcccc269945564bf1ebfc3d151f8b1de0c60d757..050ae01f307af28b4fae7f5267623b414eafa6ba 100644 >--- a/Source/WebCore/html/parser/HTMLParserIdioms.h >+++ b/Source/WebCore/html/parser/HTMLParserIdioms.h >@@ -71,10 +71,10 @@ WEBCORE_EXPORT Expected<int, HTMLIntegerParsingError> parseHTMLInteger(StringVie > WEBCORE_EXPORT Expected<unsigned, HTMLIntegerParsingError> parseHTMLNonNegativeInteger(StringView); > > // https://html.spec.whatwg.org/#valid-non-negative-integer >-std::optional<int> parseValidHTMLNonNegativeInteger(StringView); >+WTF::Optional<int> parseValidHTMLNonNegativeInteger(StringView); > > // https://html.spec.whatwg.org/#valid-floating-point-number >-std::optional<double> parseValidHTMLFloatingPointNumber(StringView); >+WTF::Optional<double> parseValidHTMLFloatingPointNumber(StringView); > > // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-floating-point-number-values > Vector<double> parseHTMLListOfOfFloatingPointNumberValues(StringView); >diff --git a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp >index 6c6d7ed8763c602c8de7faf3673297d65da514d4..5707b8db69b6e3e009bd95f4849992e2635b8caa 100644 >--- a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp >+++ b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp >@@ -305,7 +305,7 @@ private: > return m_charset; > } > >- std::optional<CachedResource::Type> resourceType() const >+ WTF::Optional<CachedResource::Type> resourceType() const > { > switch (m_tagId) { > case TagId::Script: >diff --git a/Source/WebCore/html/parser/HTMLSrcsetParser.cpp b/Source/WebCore/html/parser/HTMLSrcsetParser.cpp >index 3a35b8bb72d299765eb06cafb1bbe3242d3e8f26..3f6ec95d620d2e399cbe7ad9e870676b348a3131 100644 >--- a/Source/WebCore/html/parser/HTMLSrcsetParser.cpp >+++ b/Source/WebCore/html/parser/HTMLSrcsetParser.cpp >@@ -134,14 +134,14 @@ static bool parseDescriptors(Vector<StringView>& descriptors, DescriptorParsingR > if (descriptorChar == 'x') { > if (result.hasDensity() || result.hasHeight() || result.hasWidth()) > return false; >- std::optional<double> density = parseValidHTMLFloatingPointNumber(descriptor); >+ WTF::Optional<double> density = parseValidHTMLFloatingPointNumber(descriptor); > if (!density || density.value() < 0) > return false; > result.setDensity(density.value()); > } else if (descriptorChar == 'w') { > if (result.hasDensity() || result.hasWidth()) > return false; >- std::optional<int> resourceWidth = parseValidHTMLNonNegativeInteger(descriptor); >+ WTF::Optional<int> resourceWidth = parseValidHTMLNonNegativeInteger(descriptor); > if (!resourceWidth || resourceWidth.value() <= 0) > return false; > result.setResourceWidth(resourceWidth.value()); >@@ -150,7 +150,7 @@ static bool parseDescriptors(Vector<StringView>& descriptors, DescriptorParsingR > // The value of the 'h' descriptor is not used. > if (result.hasDensity() || result.hasHeight()) > return false; >- std::optional<int> resourceHeight = parseValidHTMLNonNegativeInteger(descriptor); >+ WTF::Optional<int> resourceHeight = parseValidHTMLNonNegativeInteger(descriptor); > if (!resourceHeight || resourceHeight.value() <= 0) > return false; > result.setResourceHeight(resourceHeight.value()); >diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp >index 9c459f23b01c0563889d6430621b8e7a0335f82d..db907cd01cfabb64842af6009cd374991b4c5b0c 100644 >--- a/Source/WebCore/html/shadow/SliderThumbElement.cpp >+++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp >@@ -298,7 +298,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& absolutePoint) > #if ENABLE(DATALIST_ELEMENT) > const LayoutUnit snappingThreshold = renderer()->theme().sliderTickSnappingThreshold(); > if (snappingThreshold > 0) { >- if (std::optional<Decimal> closest = input->findClosestTickMarkValue(value)) { >+ if (WTF::Optional<Decimal> closest = input->findClosestTickMarkValue(value)) { > double closestFraction = stepRange.proportionFromValue(*closest).toDouble(); > double closestRatio = isVertical || !isLeftToRightDirection ? 1.0 - closestFraction : closestFraction; > LayoutUnit closestPosition = trackLength * closestRatio; >@@ -590,7 +590,7 @@ RefPtr<HTMLInputElement> SliderThumbElement::hostInput() const > return downcast<HTMLInputElement>(shadowHost()); > } > >-std::optional<ElementStyle> SliderThumbElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle) >+WTF::Optional<ElementStyle> SliderThumbElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle) > { > // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known. > >@@ -598,7 +598,7 @@ std::optional<ElementStyle> SliderThumbElement::resolveCustomStyle(const RenderS > static NeverDestroyed<const AtomicString> mediaSliderThumbShadowPseudoId("-webkit-media-slider-thumb", AtomicString::ConstructFromLiteral); > > if (!hostStyle) >- return std::nullopt; >+ return WTF::nullopt; > > switch (hostStyle->appearance()) { > case MediaSliderPart: >@@ -613,7 +613,7 @@ std::optional<ElementStyle> SliderThumbElement::resolveCustomStyle(const RenderS > m_shadowPseudoId = sliderThumbShadowPseudoId; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > const AtomicString& SliderThumbElement::shadowPseudoId() const >@@ -644,7 +644,7 @@ RenderPtr<RenderElement> SliderContainerElement::createElementRenderer(RenderSty > return createRenderer<RenderSliderContainer>(*this, WTFMove(style)); > } > >-std::optional<ElementStyle> SliderContainerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle) >+WTF::Optional<ElementStyle> SliderContainerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle) > { > // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known. > >@@ -652,7 +652,7 @@ std::optional<ElementStyle> SliderContainerElement::resolveCustomStyle(const Ren > static NeverDestroyed<const AtomicString> sliderContainer("-webkit-slider-container", AtomicString::ConstructFromLiteral); > > if (!hostStyle) >- return std::nullopt; >+ return WTF::nullopt; > > switch (hostStyle->appearance()) { > case MediaSliderPart: >@@ -667,7 +667,7 @@ std::optional<ElementStyle> SliderContainerElement::resolveCustomStyle(const Ren > m_shadowPseudoId = sliderContainer; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > const AtomicString& SliderContainerElement::shadowPseudoId() const >diff --git a/Source/WebCore/html/shadow/SliderThumbElement.h b/Source/WebCore/html/shadow/SliderThumbElement.h >index 054a2e428f095ed637ca8b5b6e4e5da0477a3fde..d8af1f8c256a849a03917713ab86f2d3163ba3d4 100644 >--- a/Source/WebCore/html/shadow/SliderThumbElement.h >+++ b/Source/WebCore/html/shadow/SliderThumbElement.h >@@ -77,7 +77,7 @@ private: > #endif > void willDetachRenderers() final; > >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final; >+ WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final; > const AtomicString& shadowPseudoId() const final; > > void startDragging(); >@@ -136,7 +136,7 @@ public: > private: > SliderContainerElement(Document&); > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final; >+ WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final; > const AtomicString& shadowPseudoId() const final; > bool isSliderContainerElement() const final { return true; } > >diff --git a/Source/WebCore/html/shadow/TextControlInnerElements.cpp b/Source/WebCore/html/shadow/TextControlInnerElements.cpp >index 08c6e50b58548dc87713e20c2084096642a13fa4..47ac69ceeecda631780dec4259f62323968c318e 100644 >--- a/Source/WebCore/html/shadow/TextControlInnerElements.cpp >+++ b/Source/WebCore/html/shadow/TextControlInnerElements.cpp >@@ -80,7 +80,7 @@ static inline bool isStrongPasswordTextField(const Element* element) > return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element)->hasAutoFillStrongPasswordButton(); > } > >-std::optional<ElementStyle> TextControlInnerContainer::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*) >+WTF::Optional<ElementStyle> TextControlInnerContainer::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*) > { > auto elementStyle = resolveStyle(&parentStyle); > if (isStrongPasswordTextField(shadowHost())) { >@@ -102,7 +102,7 @@ Ref<TextControlInnerElement> TextControlInnerElement::create(Document& document) > return adoptRef(*new TextControlInnerElement(document)); > } > >-std::optional<ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle) >+WTF::Optional<ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle) > { > auto newStyle = RenderStyle::createPtr(); > newStyle->inheritFrom(*shadowHostStyle); >@@ -172,7 +172,7 @@ RenderTextControlInnerBlock* TextControlInnerTextElement::renderer() const > return downcast<RenderTextControlInnerBlock>(HTMLDivElement::renderer()); > } > >-std::optional<ElementStyle> TextControlInnerTextElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle) >+WTF::Optional<ElementStyle> TextControlInnerTextElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle) > { > auto style = downcast<HTMLTextFormControlElement>(*shadowHost()).createInnerTextStyle(*shadowHostStyle); > return ElementStyle(std::make_unique<RenderStyle>(WTFMove(style))); >@@ -192,7 +192,7 @@ Ref<TextControlPlaceholderElement> TextControlPlaceholderElement::create(Documen > return adoptRef(*new TextControlPlaceholderElement(document)); > } > >-std::optional<ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) >+WTF::Optional<ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) > { > auto style = resolveStyle(&parentStyle); > >diff --git a/Source/WebCore/html/shadow/TextControlInnerElements.h b/Source/WebCore/html/shadow/TextControlInnerElements.h >index 4125191714ed0fb7176df6e7223c677a975942a7..e8f1a1178ef06784069d10f9fa67d9206c421d90 100644 >--- a/Source/WebCore/html/shadow/TextControlInnerElements.h >+++ b/Source/WebCore/html/shadow/TextControlInnerElements.h >@@ -40,7 +40,7 @@ public: > protected: > TextControlInnerContainer(Document&); > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; >+ WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > }; > > class TextControlInnerElement final : public HTMLDivElement { >@@ -50,7 +50,7 @@ public: > > protected: > TextControlInnerElement(Document&); >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; >+ WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > > private: > bool isMouseFocusable() const override { return false; } >@@ -68,7 +68,7 @@ public: > private: > TextControlInnerTextElement(Document&); > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; >+ WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > bool isMouseFocusable() const override { return false; } > bool isTextControlInnerTextElement() const override { return true; } > }; >@@ -81,7 +81,7 @@ public: > private: > TextControlPlaceholderElement(Document&); > >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; >+ WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > }; > > class SearchFieldResultsButtonElement final : public HTMLDivElement { >diff --git a/Source/WebCore/html/track/BufferedLineReader.cpp b/Source/WebCore/html/track/BufferedLineReader.cpp >index 8f2362512850962680b1cb4992b1fb838eda03cc..90a6acc913a5bae0404f3e8595dfdc4194186fda 100644 >--- a/Source/WebCore/html/track/BufferedLineReader.cpp >+++ b/Source/WebCore/html/track/BufferedLineReader.cpp >@@ -35,7 +35,7 @@ > > namespace WebCore { > >-std::optional<String> BufferedLineReader::nextLine() >+WTF::Optional<String> BufferedLineReader::nextLine() > { > if (m_maybeSkipLF) { > // We ran out of data after a CR (U+000D), which means that we may be >@@ -98,7 +98,7 @@ std::optional<String> BufferedLineReader::nextLine() > } > > ASSERT(m_buffer.isEmpty()); >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WebCore >diff --git a/Source/WebCore/html/track/BufferedLineReader.h b/Source/WebCore/html/track/BufferedLineReader.h >index 9334ae73efe9b329a98ffdfc88d22ee220d445e6..6f92436c4178722287010b6f54ffeaf3269859ad 100644 >--- a/Source/WebCore/html/track/BufferedLineReader.h >+++ b/Source/WebCore/html/track/BufferedLineReader.h >@@ -56,7 +56,7 @@ public: > void appendEndOfStream() { m_endOfStream = true; } > bool isAtEndOfStream() const { return m_endOfStream && m_buffer.isEmpty(); } > >- std::optional<String> nextLine(); >+ WTF::Optional<String> nextLine(); > > private: > SegmentedString m_buffer; >diff --git a/Source/WebCore/html/track/TextTrack.cpp b/Source/WebCore/html/track/TextTrack.cpp >index cb14e49f38b106a4a0f1b8dbc40ae0d4d1dea03b..bcc59876f648ab466b3c64f37b94281f4a0c717d 100644 >--- a/Source/WebCore/html/track/TextTrack.cpp >+++ b/Source/WebCore/html/track/TextTrack.cpp >@@ -446,8 +446,8 @@ int TextTrack::trackIndex() > > void TextTrack::invalidateTrackIndex() > { >- m_trackIndex = std::nullopt; >- m_renderedTrackIndex = std::nullopt; >+ m_trackIndex = WTF::nullopt; >+ m_renderedTrackIndex = WTF::nullopt; > } > > bool TextTrack::isRendered() >diff --git a/Source/WebCore/html/track/TextTrack.h b/Source/WebCore/html/track/TextTrack.h >index 003a247db4d40feaf23f89f165a0cba2e50ee1dd..d06dbf7874150538b7cb1041a25a779899e6e107 100644 >--- a/Source/WebCore/html/track/TextTrack.h >+++ b/Source/WebCore/html/track/TextTrack.h >@@ -144,7 +144,7 @@ public: > using RefCounted<TrackBase>::ref; > using RefCounted<TrackBase>::deref; > >- const std::optional<Vector<String>>& styleSheets() const { return m_styleSheets; } >+ const WTF::Optional<Vector<String>>& styleSheets() const { return m_styleSheets; } > > protected: > TextTrack(ScriptExecutionContext*, TextTrackClient*, const AtomicString& kind, const AtomicString& id, const AtomicString& label, const AtomicString& language, TextTrackType); >@@ -154,7 +154,7 @@ protected: > #endif > > RefPtr<TextTrackCueList> m_cues; >- std::optional<Vector<String>> m_styleSheets; >+ WTF::Optional<Vector<String>> m_styleSheets; > > private: > bool enabled() const override; >@@ -172,8 +172,8 @@ private: > TextTrackClient* m_client; > TextTrackType m_trackType; > ReadinessState m_readinessState { NotLoaded }; >- std::optional<int> m_trackIndex; >- std::optional<int> m_renderedTrackIndex; >+ WTF::Optional<int> m_trackIndex; >+ WTF::Optional<int> m_renderedTrackIndex; > bool m_hasBeenConfigured { false }; > }; > >diff --git a/Source/WebCore/html/track/TrackEvent.cpp b/Source/WebCore/html/track/TrackEvent.cpp >index 15404ac504f128aed4d0b6800a4347bcd3f9b547..9a8437869c3d6ab47b27016b4d32c94d239626e5 100644 >--- a/Source/WebCore/html/track/TrackEvent.cpp >+++ b/Source/WebCore/html/track/TrackEvent.cpp >@@ -31,11 +31,11 @@ > > namespace WebCore { > >-static inline std::optional<TrackEvent::TrackEventTrack> convertToTrackEventTrack(Ref<TrackBase>&& track) >+static inline WTF::Optional<TrackEvent::TrackEventTrack> convertToTrackEventTrack(Ref<TrackBase>&& track) > { > switch (track->type()) { > case TrackBase::BaseTrack: >- return std::nullopt; >+ return WTF::nullopt; > case TrackBase::TextTrack: > return TrackEvent::TrackEventTrack { RefPtr<TextTrack>(&downcast<TextTrack>(track.get())) }; > case TrackBase::AudioTrack: >@@ -45,7 +45,7 @@ static inline std::optional<TrackEvent::TrackEventTrack> convertToTrackEventTrac > } > > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > > TrackEvent::TrackEvent(const AtomicString& type, CanBubble canBubble, IsCancelable cancelable, Ref<TrackBase>&& track) >diff --git a/Source/WebCore/html/track/TrackEvent.h b/Source/WebCore/html/track/TrackEvent.h >index 61e7ed626a49164d44cd9d080fdc8f5f07dc0a49..be6a09a4f569c88a570564ab25c8703e1087d170 100644 >--- a/Source/WebCore/html/track/TrackEvent.h >+++ b/Source/WebCore/html/track/TrackEvent.h >@@ -46,7 +46,7 @@ public: > using TrackEventTrack = Variant<RefPtr<VideoTrack>, RefPtr<AudioTrack>, RefPtr<TextTrack>>; > > struct Init : public EventInit { >- std::optional<TrackEventTrack> track; >+ WTF::Optional<TrackEventTrack> track; > }; > > static Ref<TrackEvent> create(const AtomicString& type, Init&& initializer, IsTrusted isTrusted = IsTrusted::No) >@@ -54,7 +54,7 @@ public: > return adoptRef(*new TrackEvent(type, WTFMove(initializer), isTrusted)); > } > >- std::optional<TrackEventTrack> track() const { return m_track; } >+ WTF::Optional<TrackEventTrack> track() const { return m_track; } > > private: > TrackEvent(const AtomicString& type, CanBubble, IsCancelable, Ref<TrackBase>&&); >@@ -62,7 +62,7 @@ private: > > EventInterface eventInterface() const override; > >- std::optional<TrackEventTrack> m_track; >+ WTF::Optional<TrackEventTrack> m_track; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/inspector/InspectorCanvas.cpp b/Source/WebCore/inspector/InspectorCanvas.cpp >index 1f38aa2004b2573488b160d739cfe9633efc6ec5..e45ed8053c78117e428c93ba8accec60a6d64fbe 100644 >--- a/Source/WebCore/inspector/InspectorCanvas.cpp >+++ b/Source/WebCore/inspector/InspectorCanvas.cpp >@@ -103,7 +103,7 @@ void InspectorCanvas::resetRecordingData() > m_recordingName = { }; > m_bufferLimit = 100 * 1024 * 1024; > m_bufferUsed = 0; >- m_frameCount = std::nullopt; >+ m_frameCount = WTF::nullopt; > m_framesCaptured = 0; > > m_context.setCallTracingActive(false); >@@ -221,7 +221,7 @@ void InspectorCanvas::setFrameCount(long frameCount) > if (frameCount > 0) > m_frameCount = std::min<long>(frameCount, std::numeric_limits<int>::max()); > else >- m_frameCount = std::nullopt; >+ m_frameCount = WTF::nullopt; > } > > bool InspectorCanvas::overFrameCount() const >@@ -274,7 +274,7 @@ Ref<Inspector::Protocol::Canvas::Canvas> InspectorCanvas::buildObjectForCanvas(b > } > #if ENABLE(WEBGL) > else if (is<WebGLRenderingContextBase>(m_context)) { >- if (std::optional<WebGLContextAttributes> attributes = downcast<WebGLRenderingContextBase>(m_context).getContextAttributes()) { >+ if (WTF::Optional<WebGLContextAttributes> attributes = downcast<WebGLRenderingContextBase>(m_context).getContextAttributes()) { > auto contextAttributes = Inspector::Protocol::Canvas::ContextAttributes::create() > .release(); > contextAttributes->setAlpha(attributes->alpha); >@@ -532,7 +532,7 @@ Ref<Inspector::Protocol::Recording::InitialState> InspectorCanvas::buildInitialS > #if ENABLE(WEBGL) > else if (is<WebGLRenderingContextBase>(m_context)) { > WebGLRenderingContextBase& contextWebGLBase = downcast<WebGLRenderingContextBase>(m_context); >- if (std::optional<WebGLContextAttributes> webGLContextAttributes = contextWebGLBase.getContextAttributes()) { >+ if (WTF::Optional<WebGLContextAttributes> webGLContextAttributes = contextWebGLBase.getContextAttributes()) { > RefPtr<JSON::Object> webGLContextAttributesPayload = JSON::Object::create(); > webGLContextAttributesPayload->setBoolean("alpha"_s, webGLContextAttributes->alpha); > webGLContextAttributesPayload->setBoolean("depth"_s, webGLContextAttributes->depth); >diff --git a/Source/WebCore/inspector/InspectorCanvas.h b/Source/WebCore/inspector/InspectorCanvas.h >index dbab6433319713601217942ecd7e65b24dd6ef5a..a607e4c4c407554a239d6d6524feca508b32cc6a 100644 >--- a/Source/WebCore/inspector/InspectorCanvas.h >+++ b/Source/WebCore/inspector/InspectorCanvas.h >@@ -119,7 +119,7 @@ private: > MonotonicTime m_currentFrameStartTime { MonotonicTime::nan() }; > size_t m_bufferLimit { 100 * 1024 * 1024 }; > size_t m_bufferUsed { 0 }; >- std::optional<size_t> m_frameCount; >+ WTF::Optional<size_t> m_frameCount; > size_t m_framesCaptured { 0 }; > }; > >diff --git a/Source/WebCore/inspector/InspectorFrontendHost.h b/Source/WebCore/inspector/InspectorFrontendHost.h >index 8078f5c0d5d13d5f9312b4605c3d589a4c23bd3b..ca8fc28355200247b2c9ed547099dad7b5a605cf 100644 >--- a/Source/WebCore/inspector/InspectorFrontendHost.h >+++ b/Source/WebCore/inspector/InspectorFrontendHost.h >@@ -94,10 +94,10 @@ public: > struct ContextMenuItem { > String type; > String label; >- std::optional<int> id; >- std::optional<bool> enabled; >- std::optional<bool> checked; >- std::optional<Vector<ContextMenuItem>> subItems; >+ WTF::Optional<int> id; >+ WTF::Optional<bool> enabled; >+ WTF::Optional<bool> checked; >+ WTF::Optional<Vector<ContextMenuItem>> subItems; > }; > void showContextMenu(Event&, Vector<ContextMenuItem>&&); > >diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp >index 3cdec85051ed0c314e7e42c49bfba085555377c7..d19f2ac8576b292cccc7ac9ec3083344198ee0e1 100644 >--- a/Source/WebCore/inspector/InspectorStyleSheet.cpp >+++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp >@@ -923,7 +923,7 @@ ExceptionOr<CSSStyleRule*> InspectorStyleSheet::addRule(const String& selector) > if (text.hasException()) > return text.releaseException(); > >- auto addRuleResult = m_pageStyleSheet->addRule(selector, emptyString(), std::nullopt); >+ auto addRuleResult = m_pageStyleSheet->addRule(selector, emptyString(), WTF::nullopt); > if (addRuleResult.hasException()) > return addRuleResult.releaseException(); > >diff --git a/Source/WebCore/inspector/NetworkResourcesData.cpp b/Source/WebCore/inspector/NetworkResourcesData.cpp >index 90520f3e5e36369d427a7a954550f31959312d7f..3180c2398bcb065bff473ccfacd55981377e12b0 100644 >--- a/Source/WebCore/inspector/NetworkResourcesData.cpp >+++ b/Source/WebCore/inspector/NetworkResourcesData.cpp >@@ -296,7 +296,7 @@ Vector<String> NetworkResourcesData::removeCachedResource(CachedResource* cached > return result; > } > >-void NetworkResourcesData::clear(std::optional<String> preservedLoaderId) >+void NetworkResourcesData::clear(WTF::Optional<String> preservedLoaderId) > { > m_requestIdsDeque.clear(); > m_contentSize = 0; >diff --git a/Source/WebCore/inspector/NetworkResourcesData.h b/Source/WebCore/inspector/NetworkResourcesData.h >index 9a5fc2dac76e674071c3186a843f49163c24cf8f..b5a70625c3a3067a0e85af4e96167f9d5a264bbe 100644 >--- a/Source/WebCore/inspector/NetworkResourcesData.h >+++ b/Source/WebCore/inspector/NetworkResourcesData.h >@@ -84,8 +84,8 @@ public: > RefPtr<SharedBuffer> buffer() const { return m_buffer.copyRef(); } > void setBuffer(RefPtr<SharedBuffer>&& buffer) { m_buffer = WTFMove(buffer); } > >- const std::optional<CertificateInfo>& certificateInfo() const { return m_certificateInfo; } >- void setCertificateInfo(const std::optional<CertificateInfo>& certificateInfo) { m_certificateInfo = certificateInfo; } >+ const WTF::Optional<CertificateInfo>& certificateInfo() const { return m_certificateInfo; } >+ void setCertificateInfo(const WTF::Optional<CertificateInfo>& certificateInfo) { m_certificateInfo = certificateInfo; } > > CachedResource* cachedResource() const { return m_cachedResource; } > void setCachedResource(CachedResource* cachedResource) { m_cachedResource = cachedResource; } >@@ -110,7 +110,7 @@ public: > RefPtr<TextResourceDecoder> m_decoder; > RefPtr<SharedBuffer> m_dataBuffer; > RefPtr<SharedBuffer> m_buffer; >- std::optional<CertificateInfo> m_certificateInfo; >+ WTF::Optional<CertificateInfo> m_certificateInfo; > CachedResource* m_cachedResource { nullptr }; > InspectorPageAgent::ResourceType m_type { InspectorPageAgent::OtherResource }; > int m_httpStatusCode { 0 }; >@@ -134,7 +134,7 @@ public: > void addResourceSharedBuffer(const String& requestId, RefPtr<SharedBuffer>&&, const String& textEncodingName); > ResourceData const* data(const String& requestId); > Vector<String> removeCachedResource(CachedResource*); >- void clear(std::optional<String> preservedLoaderId = std::nullopt); >+ void clear(WTF::Optional<String> preservedLoaderId = WTF::nullopt); > Vector<ResourceData*> resources(); > > private: >diff --git a/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp b/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp >index f2ed5ef8766d0479ae47d0d2334dd97a49030e9d..b03edb6b1cf7557f16fecf4ba7803a41e911a343 100644 >--- a/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp >@@ -95,7 +95,7 @@ void InspectorCanvasAgent::enable(ErrorString&) > if (m_enabled) > return; > >- m_recordingAutoCaptureFrameCount = std::nullopt; >+ m_recordingAutoCaptureFrameCount = WTF::nullopt; > > m_enabled = true; > >@@ -106,7 +106,7 @@ void InspectorCanvasAgent::enable(ErrorString&) > #if ENABLE(WEBGL) > if (is<WebGLRenderingContextBase>(inspectorCanvas->context())) { > WebGLRenderingContextBase& contextWebGL = downcast<WebGLRenderingContextBase>(inspectorCanvas->context()); >- if (std::optional<Vector<String>> extensions = contextWebGL.getSupportedExtensions()) { >+ if (WTF::Optional<Vector<String>> extensions = contextWebGL.getSupportedExtensions()) { > for (const String& extension : *extensions) { > if (contextWebGL.extensionIsEnabled(extension)) > m_frontendDispatcher->extensionEnabled(inspectorCanvas->identifier(), extension); >@@ -140,7 +140,7 @@ void InspectorCanvasAgent::disable(ErrorString&) > for (auto& inspectorCanvas : m_identifierToInspectorCanvas.values()) > inspectorCanvas->resetRecordingData(); > >- m_recordingAutoCaptureFrameCount = std::nullopt; >+ m_recordingAutoCaptureFrameCount = WTF::nullopt; > > m_enabled = false; > } >@@ -270,7 +270,7 @@ void InspectorCanvasAgent::setRecordingAutoCaptureFrameCount(ErrorString&, int c > if (count > 0) > m_recordingAutoCaptureFrameCount = count; > else >- m_recordingAutoCaptureFrameCount = std::nullopt; >+ m_recordingAutoCaptureFrameCount = WTF::nullopt; > } > > void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const int* frameCount, const int* memoryLimit) >diff --git a/Source/WebCore/inspector/agents/InspectorCanvasAgent.h b/Source/WebCore/inspector/agents/InspectorCanvasAgent.h >index 6a32ff9efada09b58f2eecb1ce1d7c6a361ee901..bf3ae308445550d781f6e8d03fd0dc7934c96949 100644 >--- a/Source/WebCore/inspector/agents/InspectorCanvasAgent.h >+++ b/Source/WebCore/inspector/agents/InspectorCanvasAgent.h >@@ -105,9 +105,9 @@ public: > > private: > struct RecordingOptions { >- std::optional<long> frameCount; >- std::optional<long> memoryLimit; >- std::optional<String> name; >+ WTF::Optional<long> frameCount; >+ WTF::Optional<long> memoryLimit; >+ WTF::Optional<String> name; > }; > void startRecording(InspectorCanvas&, Inspector::Protocol::Recording::Initiator, RecordingOptions&& = { }); > >@@ -132,7 +132,7 @@ private: > Vector<String> m_removedCanvasIdentifiers; > Timer m_canvasDestroyedTimer; > Timer m_canvasRecordingTimer; >- std::optional<size_t> m_recordingAutoCaptureFrameCount; >+ WTF::Optional<size_t> m_recordingAutoCaptureFrameCount; > > bool m_enabled { false }; > }; >diff --git a/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp >index 8064affe6a7403a323db0eaf847ac72f0ec02ad7..6c4015f4cb80fef634096c24fd827474be0ef2a8 100644 >--- a/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp >@@ -161,7 +161,7 @@ void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, cons > return; > } > >- auto result = idbFactory->open(*context(), databaseName, std::nullopt); >+ auto result = idbFactory->open(*context(), databaseName, WTF::nullopt); > if (result.hasException()) { > requestCallback().sendFailure("Could not open database."); > return; >@@ -171,7 +171,7 @@ void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, cons > } > > >-static RefPtr<KeyPath> keyPathFromIDBKeyPath(const std::optional<IDBKeyPath>& idbKeyPath) >+static RefPtr<KeyPath> keyPathFromIDBKeyPath(const WTF::Optional<IDBKeyPath>& idbKeyPath) > { > if (!idbKeyPath) > return KeyPath::create().setType(KeyPath::Type::Null).release(); >diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp >index 2230993d232ddd55472e6d9c8185100e885059b8..e49c6230dd2fba45b8b7d678eca2d00b197eba59 100644 >--- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp >@@ -474,7 +474,7 @@ void InspectorNetworkAgent::didReceiveResponse(unsigned long identifier, Documen > > String requestId = IdentifiersFactory::requestId(identifier); > >- std::optional<ResourceResponse> realResponse; >+ WTF::Optional<ResourceResponse> realResponse; > if (platformStrategies()->loaderStrategy()->havePerformedSecurityChecks(response)) { > callOnMainThreadAndWait([&] { > // We do not need to isolate response since it comes straight from IPC, but we might want to isolate it for extra safety. >@@ -566,7 +566,7 @@ void InspectorNetworkAgent::didFinishLoading(unsigned long identifier, DocumentL > if (resourceData && resourceData->cachedResource()) > sourceMappingURL = InspectorPageAgent::sourceMapURLForResource(resourceData->cachedResource()); > >- std::optional<NetworkLoadMetrics> realMetrics; >+ WTF::Optional<NetworkLoadMetrics> realMetrics; > if (platformStrategies()->loaderStrategy()->shouldPerformSecurityChecks() && !networkLoadMetrics.isComplete()) { > callOnMainThreadAndWait([&] { > realMetrics = platformStrategies()->loaderStrategy()->networkMetricsFromResourceLoadIdentifier(identifier).isolatedCopy(); >@@ -680,7 +680,7 @@ void InspectorNetworkAgent::didScheduleStyleRecalculation(Document& document) > m_styleRecalculationInitiator = buildInitiatorObject(&document); > } > >-RefPtr<Inspector::Protocol::Network::Initiator> InspectorNetworkAgent::buildInitiatorObject(Document* document, std::optional<const ResourceRequest&> resourceRequest) >+RefPtr<Inspector::Protocol::Network::Initiator> InspectorNetworkAgent::buildInitiatorObject(Document* document, WTF::Optional<const ResourceRequest&> resourceRequest) > { > // FIXME: Worker support. > if (!isMainThread()) { >@@ -997,10 +997,10 @@ Ref<TextResourceDecoder> InspectorNetworkAgent::createTextDecoder(const String& > return TextResourceDecoder::create("text/plain"_s, "UTF-8"); > } > >-std::optional<String> InspectorNetworkAgent::textContentForCachedResource(CachedResource& cachedResource) >+WTF::Optional<String> InspectorNetworkAgent::textContentForCachedResource(CachedResource& cachedResource) > { > if (!InspectorNetworkAgent::shouldTreatAsText(cachedResource.mimeType())) >- return std::nullopt; >+ return WTF::nullopt; > > String result; > bool base64Encoded; >@@ -1009,7 +1009,7 @@ std::optional<String> InspectorNetworkAgent::textContentForCachedResource(Cached > return result; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > bool InspectorNetworkAgent::cachedResourceContent(CachedResource& resource, String* result, bool* base64Encoded) >@@ -1062,7 +1062,7 @@ static Ref<Inspector::Protocol::Page::SearchResult> buildObjectForSearchResult(c > return searchResult; > } > >-static std::optional<String> textContentForResourceData(const NetworkResourcesData::ResourceData& resourceData) >+static WTF::Optional<String> textContentForResourceData(const NetworkResourcesData::ResourceData& resourceData) > { > if (resourceData.hasContent() && !resourceData.base64Encoded()) > return resourceData.content(); >@@ -1070,7 +1070,7 @@ static std::optional<String> textContentForResourceData(const NetworkResourcesDa > if (resourceData.cachedResource()) > return InspectorNetworkAgent::textContentForCachedResource(*resourceData.cachedResource()); > >- return std::nullopt; >+ return WTF::nullopt; > } > > void InspectorNetworkAgent::searchOtherRequests(const JSC::Yarr::RegularExpression& regex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>& result) >diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.h b/Source/WebCore/inspector/agents/InspectorNetworkAgent.h >index 65735fe209476269daf3ad2cb4fd9f32664daacc..2c2df571c807a07412063c43e8d5518a9b63222b 100644 >--- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.h >+++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.h >@@ -73,7 +73,7 @@ public: > > static bool shouldTreatAsText(const String& mimeType); > static Ref<TextResourceDecoder> createTextDecoder(const String& mimeType, const String& textEncodingName); >- static std::optional<String> textContentForCachedResource(CachedResource&); >+ static WTF::Optional<String> textContentForCachedResource(CachedResource&); > static bool cachedResourceContent(CachedResource&, String* result, bool* base64Encoded); > > void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override; >@@ -132,7 +132,7 @@ private: > > WebSocket* webSocketForRequestId(const String& requestId); > >- RefPtr<Inspector::Protocol::Network::Initiator> buildInitiatorObject(Document*, std::optional<const ResourceRequest&> = std::nullopt); >+ RefPtr<Inspector::Protocol::Network::Initiator> buildInitiatorObject(Document*, WTF::Optional<const ResourceRequest&> = WTF::nullopt); > Ref<Inspector::Protocol::Network::ResourceTiming> buildObjectForTiming(const NetworkLoadMetrics&, ResourceLoader&); > Ref<Inspector::Protocol::Network::Metrics> buildObjectForMetrics(const NetworkLoadMetrics&); > RefPtr<Inspector::Protocol::Network::Response> buildObjectForResourceResponse(const ResourceResponse&, ResourceLoader*); >diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >index ee44eacabde5aa1073245594825ca76dd23117d5..2b60c45b788598a0659b8fadc8576b391b84e5d1 100644 >--- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >@@ -830,7 +830,7 @@ void InspectorPageAgent::setForcedAppearance(ErrorString&, const String& appeara > else if (appearance == "Dark"_s) > m_page.setUseDarkAppearanceOverride(true); > else >- m_page.setUseDarkAppearanceOverride(std::nullopt); >+ m_page.setUseDarkAppearanceOverride(WTF::nullopt); > } > > void InspectorPageAgent::applyEmulatedMedia(String& media) >@@ -866,7 +866,7 @@ void InspectorPageAgent::snapshotNode(ErrorString& errorString, int nodeId, Stri > return; > } > >- *outDataURL = snapshot->toDataURL("image/png"_s, std::nullopt, PreserveResolution::Yes); >+ *outDataURL = snapshot->toDataURL("image/png"_s, WTF::nullopt, PreserveResolution::Yes); > } > > void InspectorPageAgent::snapshotRect(ErrorString& errorString, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) >@@ -885,7 +885,7 @@ void InspectorPageAgent::snapshotRect(ErrorString& errorString, int x, int y, in > return; > } > >- *outDataURL = snapshot->toDataURL("image/png"_s, std::nullopt, PreserveResolution::Yes); >+ *outDataURL = snapshot->toDataURL("image/png"_s, WTF::nullopt, PreserveResolution::Yes); > } > > void InspectorPageAgent::archive(ErrorString& errorString, String* data) >diff --git a/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp >index 93b8d9625b9a17c55b963f41458a088605598377..ede27bdb4447ee0f210c46825f00f0b1998413ce 100644 >--- a/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp >@@ -141,7 +141,7 @@ void InspectorTimelineAgent::setInstruments(ErrorString& errorString, const JSON > return; > } > >- std::optional<Protocol::Timeline::Instrument> instrumentType = Protocol::InspectorHelpers::parseEnumValueFromString<Protocol::Timeline::Instrument>(enumValueString); >+ WTF::Optional<Protocol::Timeline::Instrument> instrumentType = Protocol::InspectorHelpers::parseEnumValueFromString<Protocol::Timeline::Instrument>(enumValueString); > if (!instrumentType) { > errorString = makeString("Unexpected enum value: ", enumValueString); > return; >diff --git a/Source/WebCore/inspector/agents/WebConsoleAgent.cpp b/Source/WebCore/inspector/agents/WebConsoleAgent.cpp >index f5dbdf8b2017cf2dd3d12e5f6ae1d857ae80b8e7..2eb2479ae75dbe916affb57e486f3c444967b550 100644 >--- a/Source/WebCore/inspector/agents/WebConsoleAgent.cpp >+++ b/Source/WebCore/inspector/agents/WebConsoleAgent.cpp >@@ -89,7 +89,7 @@ void WebConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Insp > } > } > >-static std::optional<std::pair<WTFLogChannelState, WTFLogLevel>> channelConfigurationForString(const String& levelString) >+static WTF::Optional<std::pair<WTFLogChannelState, WTFLogLevel>> channelConfigurationForString(const String& levelString) > { > WTFLogChannelState state; > WTFLogLevel level; >@@ -104,7 +104,7 @@ static std::optional<std::pair<WTFLogChannelState, WTFLogLevel>> channelConfigur > else if (equalIgnoringASCIICase(levelString, "verbose")) > level = WTFLogLevelDebug; > else >- return std::nullopt; >+ return WTF::nullopt; > } > > return { { state, level } }; >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index cd8d5c6b3552e6ae5f9d4c0733246438f01e4274..3f665dcedb7df31235fc350bec624e0bc06d6d6b 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -67,7 +67,7 @@ void FormattingContext::computeOutOfFlowHorizontalGeometry(const Box& layoutBox) > { > auto& layoutState = this->layoutState(); > >- auto compute = [&](std::optional<LayoutUnit> usedWidth) { >+ auto compute = [&](WTF::Optional<LayoutUnit> usedWidth) { > return Geometry::outOfFlowHorizontalGeometry(layoutState, layoutBox, usedWidth); > }; > >@@ -97,7 +97,7 @@ void FormattingContext::computeOutOfFlowVerticalGeometry(const Box& layoutBox) c > { > auto& layoutState = this->layoutState(); > >- auto compute = [&](std::optional<LayoutUnit> usedHeight) { >+ auto compute = [&](WTF::Optional<LayoutUnit> usedHeight) { > return Geometry::outOfFlowVerticalGeometry(layoutState, layoutBox, usedHeight); > }; > >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 3216302ec9df2f66da3ead4760065834232f0a9e..7cc3e57157bf85888c56f18ec3b80111abb21051 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -78,48 +78,48 @@ protected: > // This class implements generic positioning and sizing. > class Geometry { > public: >- static VerticalGeometry outOfFlowVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static VerticalGeometry outOfFlowVerticalGeometry(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > >- static HeightAndMargin floatingHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static WidthAndMargin floatingWidthAndMargin(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static HeightAndMargin floatingHeightAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static WidthAndMargin floatingWidthAndMargin(LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > >- static HeightAndMargin inlineReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static WidthAndMargin inlineReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }, >- std::optional<LayoutUnit> precomputedMarginStart = { }, std::optional<LayoutUnit> precomputedMarginEnd = { }); >+ static HeightAndMargin inlineReplacedHeightAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static WidthAndMargin inlineReplacedWidthAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }, >+ WTF::Optional<LayoutUnit> precomputedMarginStart = { }, WTF::Optional<LayoutUnit> precomputedMarginEnd = { }); > > static LayoutSize inFlowPositionedPositionOffset(const LayoutState&, const Box&); > >- static HeightAndMargin complicatedCases(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >+ static HeightAndMargin complicatedCases(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); > static LayoutUnit shrinkToFitWidth(LayoutState&, const Box&); > > static Edges computedBorder(const LayoutState&, const Box&); >- static std::optional<Edges> computedPadding(const LayoutState&, const Box&); >+ static WTF::Optional<Edges> computedPadding(const LayoutState&, const Box&); > > static HorizontalMargin computedNonCollapsedHorizontalMarginValue(const LayoutState&, const Box&); > static VerticalMargin::ComputedValues computedNonCollapsedVerticalMarginValue(const LayoutState&, const Box&); > >- static std::optional<LayoutUnit> computedValueIfNotAuto(const Length& geometryProperty, LayoutUnit containingBlockWidth); >- static std::optional<LayoutUnit> fixedValue(const Length& geometryProperty); >+ static WTF::Optional<LayoutUnit> computedValueIfNotAuto(const Length& geometryProperty, LayoutUnit containingBlockWidth); >+ static WTF::Optional<LayoutUnit> fixedValue(const Length& geometryProperty); > >- static std::optional<LayoutUnit> computedMinHeight(const LayoutState&, const Box&); >- static std::optional<LayoutUnit> computedMaxHeight(const LayoutState&, const Box&); >+ static WTF::Optional<LayoutUnit> computedMinHeight(const LayoutState&, const Box&); >+ static WTF::Optional<LayoutUnit> computedMaxHeight(const LayoutState&, const Box&); > > protected: > enum class HeightType { Min, Max, Normal }; >- static std::optional<LayoutUnit> computedHeightValue(const LayoutState&, const Box&, HeightType); >+ static WTF::Optional<LayoutUnit> computedHeightValue(const LayoutState&, const Box&, HeightType); > > private: >- static VerticalGeometry outOfFlowReplacedVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static VerticalGeometry outOfFlowReplacedVerticalGeometry(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > >- static VerticalGeometry outOfFlowNonReplacedVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static VerticalGeometry outOfFlowNonReplacedVerticalGeometry(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > >- static HeightAndMargin floatingReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static WidthAndMargin floatingReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static HeightAndMargin floatingReplacedHeightAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static WidthAndMargin floatingReplacedWidthAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > >- static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > }; > > class Quirks { >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index 14bba1eb34055bedb4b4b4868506f01ed15a1214..b9fdefff26d9819b6eaf4ed768f97e8f22e01168 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -57,7 +57,7 @@ static inline bool isHeightAuto(const Box& layoutBox) > return false; > } > >-std::optional<LayoutUnit> FormattingContext::Geometry::computedHeightValue(const LayoutState& layoutState, const Box& layoutBox, HeightType heightType) >+WTF::Optional<LayoutUnit> FormattingContext::Geometry::computedHeightValue(const LayoutState& layoutState, const Box& layoutBox, HeightType heightType) > { > auto& style = layoutBox.style(); > auto height = heightType == HeightType::Normal ? style.logicalHeight() : heightType == HeightType::Min ? style.logicalMinHeight() : style.logicalMaxHeight(); >@@ -67,7 +67,7 @@ std::optional<LayoutUnit> FormattingContext::Geometry::computedHeightValue(const > if (height.isFixed()) > return { height.value() }; > >- std::optional<LayoutUnit> containingBlockHeightValue; >+ WTF::Optional<LayoutUnit> containingBlockHeightValue; > if (layoutBox.isOutOfFlowPositioned()) { > // Containing block's height is already computed since we layout the out-of-flow boxes as the last step. > containingBlockHeightValue = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).height(); >@@ -136,21 +136,21 @@ static LayoutUnit contentHeightForFormattingContextRoot(const LayoutState& layou > return computedHeight; > } > >-std::optional<LayoutUnit> FormattingContext::Geometry::computedValueIfNotAuto(const Length& geometryProperty, LayoutUnit containingBlockWidth) >+WTF::Optional<LayoutUnit> FormattingContext::Geometry::computedValueIfNotAuto(const Length& geometryProperty, LayoutUnit containingBlockWidth) > { > if (geometryProperty.isUndefined()) >- return std::nullopt; >+ return WTF::nullopt; > > if (geometryProperty.isAuto()) >- return std::nullopt; >+ return WTF::nullopt; > > return valueForLength(geometryProperty, containingBlockWidth); > } > >-std::optional<LayoutUnit> FormattingContext::Geometry::fixedValue(const Length& geometryProperty) >+WTF::Optional<LayoutUnit> FormattingContext::Geometry::fixedValue(const Length& geometryProperty) > { > if (!geometryProperty.isFixed()) >- return std::nullopt; >+ return WTF::nullopt; > return { geometryProperty.value() }; > } > >@@ -158,12 +158,12 @@ std::optional<LayoutUnit> FormattingContext::Geometry::fixedValue(const Length& > // Specifies a percentage for determining the used value. The percentage is calculated with respect to the height of the generated box's containing block. > // If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, > // the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height'). >-std::optional<LayoutUnit> FormattingContext::Geometry::computedMaxHeight(const LayoutState& layoutState, const Box& layoutBox) >+WTF::Optional<LayoutUnit> FormattingContext::Geometry::computedMaxHeight(const LayoutState& layoutState, const Box& layoutBox) > { > return computedHeightValue(layoutState, layoutBox, HeightType::Max); > } > >-std::optional<LayoutUnit> FormattingContext::Geometry::computedMinHeight(const LayoutState& layoutState, const Box& layoutBox) >+WTF::Optional<LayoutUnit> FormattingContext::Geometry::computedMinHeight(const LayoutState& layoutState, const Box& layoutBox) > { > if (auto minHeightValue = computedHeightValue(layoutState, layoutBox, HeightType::Min)) > return minHeightValue; >@@ -243,7 +243,7 @@ LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(LayoutState& layoutStat > return std::min(std::max(instrinsicWidthConstraints.minimum, availableWidth), instrinsicWidthConstraints.maximum); > } > >-VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced()); > >@@ -359,7 +359,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet > return { *top, *bottom, { *height, { { *marginBefore, *marginAfter }, { } } } }; > } > >-HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced()); > >@@ -505,7 +505,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe > return { *left, *right, { *width, { *marginStart, *marginEnd }, { nonComputedMarginStart, nonComputedMarginEnd } } }; > } > >-VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced()); > >@@ -574,7 +574,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > return { *top, *bottom, { height, { { *marginBefore, *marginAfter }, { } } } }; > } > >-HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced()); > >@@ -672,7 +672,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome > return { *left, *right, { width, { *marginStart, *marginEnd }, { nonComputedMarginStart, nonComputedMarginEnd } } }; > } > >-HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(!layoutBox.replaced()); > // TODO: Use complicated-case for document renderer for now (see BlockFormattingContext::Geometry::inFlowHeightAndMargin). >@@ -713,7 +713,7 @@ HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& > return HeightAndMargin { *height, { { *marginBefore, *marginAfter }, { } } }; > } > >-WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced()); > >@@ -736,7 +736,7 @@ WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(La > return WidthAndMargin { *width, margin, margin }; > } > >-HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced()); > >@@ -746,7 +746,7 @@ HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(con > return inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight); > } > >-WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced()); > >@@ -760,7 +760,7 @@ WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const > return inlineReplacedWidthAndMargin(layoutState, layoutBox, usedWidth, margin.start, margin.end); > } > >-VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(layoutBox.isOutOfFlowPositioned()); > >@@ -769,7 +769,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const La > return outOfFlowReplacedVerticalGeometry(layoutState, layoutBox, usedHeight); > } > >-HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isOutOfFlowPositioned()); > >@@ -778,7 +778,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(Layo > return outOfFlowReplacedHorizontalGeometry(layoutState, layoutBox, usedWidth); > } > >-HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(layoutBox.isFloatingPositioned()); > >@@ -787,7 +787,7 @@ HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(const Layou > return floatingReplacedHeightAndMargin(layoutState, layoutBox, usedHeight); > } > >-WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isFloatingPositioned()); > >@@ -796,7 +796,7 @@ WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutState& > return floatingReplacedWidthAndMargin(layoutState, layoutBox, usedWidth); > } > >-HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced()); > >@@ -842,7 +842,7 @@ HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const > } > > WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, >- std::optional<LayoutUnit> usedWidth, std::optional<LayoutUnit> precomputedMarginStart, std::optional<LayoutUnit> precomputedMarginEnd) >+ WTF::Optional<LayoutUnit> usedWidth, WTF::Optional<LayoutUnit> precomputedMarginStart, WTF::Optional<LayoutUnit> precomputedMarginEnd) > { > ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced()); > >@@ -951,7 +951,7 @@ LayoutSize FormattingContext::Geometry::inFlowPositionedPositionOffset(const Lay > bottom = -*top; > } else { > // #4 >- bottom = std::nullopt; >+ bottom = WTF::nullopt; > } > > // For relatively positioned elements, 'left' and 'right' move the box(es) horizontally, without changing their size. >@@ -983,7 +983,7 @@ LayoutSize FormattingContext::Geometry::inFlowPositionedPositionOffset(const Lay > if (isLeftToRightDirection) > right = -*left; > else >- left = std::nullopt; >+ left = WTF::nullopt; > } > > ASSERT(!bottom || *top == -*bottom); >@@ -1006,10 +1006,10 @@ Edges FormattingContext::Geometry::computedBorder(const LayoutState&, const Box& > }; > } > >-std::optional<Edges> FormattingContext::Geometry::computedPadding(const LayoutState& layoutState, const Box& layoutBox) >+WTF::Optional<Edges> FormattingContext::Geometry::computedPadding(const LayoutState& layoutState, const Box& layoutBox) > { > if (!layoutBox.isPaddingApplicable()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& style = layoutBox.style(); > auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth(); >diff --git a/Source/WebCore/layout/FormattingState.h b/Source/WebCore/layout/FormattingState.h >index 0e91e6959c59d4136a945ba0089422d4836b60e7..939f897548eca6571b807bcf47418f02added455 100644 >--- a/Source/WebCore/layout/FormattingState.h >+++ b/Source/WebCore/layout/FormattingState.h >@@ -55,7 +55,7 @@ public: > > void setInstrinsicWidthConstraints(const Box&, FormattingContext::InstrinsicWidthConstraints); > void clearInstrinsicWidthConstraints(const Box&); >- std::optional<FormattingContext::InstrinsicWidthConstraints> instrinsicWidthConstraints(const Box&) const; >+ WTF::Optional<FormattingContext::InstrinsicWidthConstraints> instrinsicWidthConstraints(const Box&) const; > > bool isBlockFormattingState() const { return m_type == Type::Block; } > bool isInlineFormattingState() const { return m_type == Type::Inline; } >@@ -85,7 +85,7 @@ inline void FormattingState::clearInstrinsicWidthConstraints(const Box& layoutBo > m_instrinsicWidthConstraints.remove(&layoutBox); > } > >-inline std::optional<FormattingContext::InstrinsicWidthConstraints> FormattingState::instrinsicWidthConstraints(const Box& layoutBox) const >+inline WTF::Optional<FormattingContext::InstrinsicWidthConstraints> FormattingState::instrinsicWidthConstraints(const Box& layoutBox) const > { > ASSERT(&m_layoutState.formattingStateForBox(layoutBox) == this); > auto iterator = m_instrinsicWidthConstraints.find(&layoutBox); >diff --git a/Source/WebCore/layout/MarginTypes.h b/Source/WebCore/layout/MarginTypes.h >index 6e53f8879ac999e5ddee6bad70a07eacdc36ebe6..82d36eae49a94590cf931532d4716be08c62e417 100644 >--- a/Source/WebCore/layout/MarginTypes.h >+++ b/Source/WebCore/layout/MarginTypes.h >@@ -41,19 +41,19 @@ struct VerticalMargin { > ComputedValues nonCollapsedValues() const { return m_nonCollapsed; } > > struct CollapsedValues { >- std::optional<LayoutUnit> before; >- std::optional<LayoutUnit> after; >+ WTF::Optional<LayoutUnit> before; >+ WTF::Optional<LayoutUnit> after; > }; >- std::optional<CollapsedValues> collapsedValues() const { return m_collapsed; } >+ WTF::Optional<CollapsedValues> collapsedValues() const { return m_collapsed; } > void setCollapsedValues(CollapsedValues collapsedValues) { m_collapsed = collapsedValues; } > >- VerticalMargin(ComputedValues nonCollapsed, std::optional<CollapsedValues>); >+ VerticalMargin(ComputedValues nonCollapsed, WTF::Optional<CollapsedValues>); > > VerticalMargin() = default; > ~VerticalMargin() = default; > private: > ComputedValues m_nonCollapsed; >- std::optional<CollapsedValues> m_collapsed; >+ WTF::Optional<CollapsedValues> m_collapsed; > }; > > struct HorizontalMargin { >@@ -63,14 +63,14 @@ struct HorizontalMargin { > > struct PositiveAndNegativeVerticalMargin { > struct Values { >- std::optional<LayoutUnit> positive; >- std::optional<LayoutUnit> negative; >+ WTF::Optional<LayoutUnit> positive; >+ WTF::Optional<LayoutUnit> negative; > }; > Values before; > Values after; > }; > >-inline VerticalMargin::VerticalMargin(VerticalMargin::ComputedValues nonCollapsed, std::optional<VerticalMargin::CollapsedValues> collapsed) >+inline VerticalMargin::VerticalMargin(VerticalMargin::ComputedValues nonCollapsed, WTF::Optional<VerticalMargin::CollapsedValues> collapsed) > : m_nonCollapsed(nonCollapsed) > , m_collapsed(collapsed) > { >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 6afad42102c8d75b6b836852887122a28b23d5f0..a7d46b46a2affe6a9e186c6f6a7e1e02f0b921d1 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -302,7 +302,7 @@ void BlockFormattingContext::computeWidthAndMargin(const Box& layoutBox) const > { > auto& layoutState = this->layoutState(); > >- auto compute = [&](std::optional<LayoutUnit> usedWidth) -> WidthAndMargin { >+ auto compute = [&](WTF::Optional<LayoutUnit> usedWidth) -> WidthAndMargin { > > if (layoutBox.isInFlow()) > return Geometry::inFlowWidthAndMargin(layoutState, layoutBox, usedWidth); >@@ -340,7 +340,7 @@ void BlockFormattingContext::computeHeightAndMargin(const Box& layoutBox) const > { > auto& layoutState = this->layoutState(); > >- auto compute = [&](std::optional<LayoutUnit> usedHeight) -> HeightAndMargin { >+ auto compute = [&](WTF::Optional<LayoutUnit> usedHeight) -> HeightAndMargin { > > if (layoutBox.isInFlow()) > return Geometry::inFlowHeightAndMargin(layoutState, layoutBox, usedHeight); >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index f44e02157f2012c64a764afd9ca6df9a1371c356..a511642e42bf96ec6442b03f24bfc441febe1345 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -71,8 +71,8 @@ private: > // This class implements positioning and sizing for boxes participating in a block formatting context. > class Geometry : public FormattingContext::Geometry { > public: >- static HeightAndMargin inFlowHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static WidthAndMargin inFlowWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static HeightAndMargin inFlowHeightAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static WidthAndMargin inFlowWidthAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > > static Point staticPosition(const LayoutState&, const Box&); > >@@ -105,9 +105,9 @@ private: > static bool isMarginBeforeCollapsedWithParent(const LayoutState&, const Box&); > }; > >- static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { }); >- static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >- static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }); >+ static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedHeight = { }); >+ static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); >+ static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutState&, const Box&, WTF::Optional<LayoutUnit> usedWidth = { }); > static Point staticPositionForOutOfFlowPositioned(const LayoutState&, const Box&); > }; > >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 39f940b87eab9394532a7c51acf849a2655277e2..f7c17383a3ffa142647dacd5a7f53f685256c561 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -37,7 +37,7 @@ > namespace WebCore { > namespace Layout { > >-HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(layoutBox.isInFlow() && !layoutBox.replaced()); > ASSERT(layoutBox.isOverflowVisible()); >@@ -108,7 +108,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg > return heightAndMargin; > } > >-WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isInFlow() && !layoutBox.replaced()); > >@@ -200,7 +200,7 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin > return widthAndMargin; > } > >-WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isInFlow() && layoutBox.replaced()); > >@@ -239,7 +239,7 @@ Point BlockFormattingContext::Geometry::staticPosition(const LayoutState& layout > return { left, top }; > } > >-HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight) >+HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedHeight) > { > ASSERT(layoutBox.isInFlow()); > >@@ -267,7 +267,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const La > return heightAndMargin; > } > >-WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth) >+WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, WTF::Optional<LayoutUnit> usedWidth) > { > ASSERT(layoutBox.isInFlow()); > >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.h b/Source/WebCore/layout/displaytree/DisplayBox.h >index 9f5590ff37457e08d5305ec275c61a6e610591d2..e8b6218c1404959575a8a7e09716814aa1cefb40 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.h >+++ b/Source/WebCore/layout/displaytree/DisplayBox.h >@@ -149,17 +149,17 @@ public: > LayoutUnit nonComputedMarginStart() const; > LayoutUnit nonComputedMarginEnd() const; > >- std::optional<LayoutUnit> estimatedMarginBefore() const { return m_estimatedMarginBefore; } >+ WTF::Optional<LayoutUnit> estimatedMarginBefore() const { return m_estimatedMarginBefore; } > > LayoutUnit borderTop() const; > LayoutUnit borderLeft() const; > LayoutUnit borderBottom() const; > LayoutUnit borderRight() const; > >- std::optional<LayoutUnit> paddingTop() const; >- std::optional<LayoutUnit> paddingLeft() const; >- std::optional<LayoutUnit> paddingBottom() const; >- std::optional<LayoutUnit> paddingRight() const; >+ WTF::Optional<LayoutUnit> paddingTop() const; >+ WTF::Optional<LayoutUnit> paddingLeft() const; >+ WTF::Optional<LayoutUnit> paddingBottom() const; >+ WTF::Optional<LayoutUnit> paddingRight() const; > > LayoutUnit contentBoxTop() const { return borderTop() + paddingTop().value_or(0); } > LayoutUnit contentBoxLeft() const { return borderLeft() + paddingLeft().value_or(0); } >@@ -197,7 +197,7 @@ private: > void setEstimatedMarginBefore(LayoutUnit marginBefore) { m_estimatedMarginBefore = marginBefore; } > > void setBorder(Layout::Edges); >- void setPadding(std::optional<Layout::Edges>); >+ void setPadding(WTF::Optional<Layout::Edges>); > > #if !ASSERT_DISABLED > void invalidateMargin(); >@@ -227,10 +227,10 @@ private: > Layout::HorizontalMargin m_horizontalMargin; > Layout::VerticalMargin m_verticalMargin; > Layout::HorizontalMargin m_horizontalNonComputedMargin; >- std::optional<LayoutUnit> m_estimatedMarginBefore; >+ WTF::Optional<LayoutUnit> m_estimatedMarginBefore; > > Layout::Edges m_border; >- std::optional<Layout::Edges> m_padding; >+ WTF::Optional<Layout::Edges> m_padding; > > #if !ASSERT_DISABLED > bool m_hasValidTop { false }; >@@ -541,7 +541,7 @@ inline void Box::setBorder(Layout::Edges border) > m_border = border; > } > >-inline void Box::setPadding(std::optional<Layout::Edges> padding) >+inline void Box::setPadding(WTF::Optional<Layout::Edges> padding) > { > #if !ASSERT_DISABLED > setHasValidPadding(); >@@ -603,7 +603,7 @@ inline LayoutUnit Box::nonComputedMarginEnd() const > return m_horizontalNonComputedMargin.end; > } > >-inline std::optional<LayoutUnit> Box::paddingTop() const >+inline WTF::Optional<LayoutUnit> Box::paddingTop() const > { > ASSERT(m_hasValidPadding); > if (!m_padding) >@@ -611,7 +611,7 @@ inline std::optional<LayoutUnit> Box::paddingTop() const > return m_padding->vertical.top; > } > >-inline std::optional<LayoutUnit> Box::paddingLeft() const >+inline WTF::Optional<LayoutUnit> Box::paddingLeft() const > { > ASSERT(m_hasValidPadding); > if (!m_padding) >@@ -619,7 +619,7 @@ inline std::optional<LayoutUnit> Box::paddingLeft() const > return m_padding->horizontal.left; > } > >-inline std::optional<LayoutUnit> Box::paddingBottom() const >+inline WTF::Optional<LayoutUnit> Box::paddingBottom() const > { > ASSERT(m_hasValidPadding); > if (!m_padding) >@@ -627,7 +627,7 @@ inline std::optional<LayoutUnit> Box::paddingBottom() const > return m_padding->vertical.bottom; > } > >-inline std::optional<LayoutUnit> Box::paddingRight() const >+inline WTF::Optional<LayoutUnit> Box::paddingRight() const > { > ASSERT(m_hasValidPadding); > if (!m_padding) >diff --git a/Source/WebCore/layout/floats/FloatAvoider.h b/Source/WebCore/layout/floats/FloatAvoider.h >index 7ad37a148dec9ecc5715311650e818364c70bc94..a29ceb98f00554f53671d85244851fd44612c0e3 100644 >--- a/Source/WebCore/layout/floats/FloatAvoider.h >+++ b/Source/WebCore/layout/floats/FloatAvoider.h >@@ -50,8 +50,8 @@ public: > Display::Box::Rect rectInContainingBlock() const; > > struct HorizontalConstraints { >- std::optional<PositionInContextRoot> left; >- std::optional<PositionInContextRoot> right; >+ WTF::Optional<PositionInContextRoot> left; >+ WTF::Optional<PositionInContextRoot> right; > }; > void setHorizontalConstraints(HorizontalConstraints); > void setVerticalConstraint(PositionInContextRoot); >diff --git a/Source/WebCore/layout/floats/FloatingContext.cpp b/Source/WebCore/layout/floats/FloatingContext.cpp >index 1314a178c8e768f792e303d680172c086ef0a2eb..30d9046765d7a650f61cfb94524ace3ffb64d265 100644 >--- a/Source/WebCore/layout/floats/FloatingContext.cpp >+++ b/Source/WebCore/layout/floats/FloatingContext.cpp >@@ -79,14 +79,14 @@ private: > > const FloatingState::FloatList& m_floats; > >- std::optional<unsigned> m_leftIndex; >- std::optional<unsigned> m_rightIndex; >+ WTF::Optional<unsigned> m_leftIndex; >+ WTF::Optional<unsigned> m_rightIndex; > PositionInContextRoot m_verticalPosition; > }; > > class Iterator { > public: >- Iterator(const FloatingState::FloatList&, std::optional<PositionInContextRoot> verticalPosition); >+ Iterator(const FloatingState::FloatList&, WTF::Optional<PositionInContextRoot> verticalPosition); > > const FloatingPair& operator*() const { return m_current; } > Iterator& operator++(); >@@ -108,7 +108,7 @@ static Iterator begin(const FloatingState& floatingState, PositionInContextRoot > > static Iterator end(const FloatingState& floatingState) > { >- return Iterator(floatingState.floats(), std::nullopt); >+ return Iterator(floatingState.floats(), WTF::nullopt); > } > > FloatingContext::FloatingContext(FloatingState& floatingState) >@@ -143,7 +143,7 @@ Point FloatingContext::positionForFloat(const Box& layoutBox) const > return floatBox.rectInContainingBlock().topLeft(); > } > >-std::optional<Point> FloatingContext::positionForFloatAvoiding(const Box& layoutBox) const >+WTF::Optional<Point> FloatingContext::positionForFloatAvoiding(const Box& layoutBox) const > { > ASSERT(layoutBox.establishesBlockFormattingContext()); > ASSERT(!layoutBox.isFloatingPositioned()); >@@ -157,7 +157,7 @@ std::optional<Point> FloatingContext::positionForFloatAvoiding(const Box& layout > return { floatAvoider.rectInContainingBlock().topLeft() }; > } > >-std::optional<Position> FloatingContext::verticalPositionWithClearance(const Box& layoutBox) const >+WTF::Optional<Position> FloatingContext::verticalPositionWithClearance(const Box& layoutBox) const > { > ASSERT(layoutBox.hasFloatClear()); > ASSERT(layoutBox.isBlockLevelBox()); >@@ -165,7 +165,7 @@ std::optional<Position> FloatingContext::verticalPositionWithClearance(const Box > if (m_floatingState.isEmpty()) > return { }; > >- auto bottom = [&](std::optional<PositionInContextRoot> floatBottom) -> std::optional<Position> { >+ auto bottom = [&](WTF::Optional<PositionInContextRoot> floatBottom) -> WTF::Optional<Position> { > // 'bottom' is in the formatting root's coordinate system. > if (!floatBottom) > return { }; >@@ -242,7 +242,7 @@ void FloatingContext::floatingPosition(FloatAvoider& floatAvoider) const > // Ensure the float avoider starts with no constraints. > floatAvoider.resetPosition(); > >- std::optional<PositionInContextRoot> bottomMost; >+ WTF::Optional<PositionInContextRoot> bottomMost; > auto end = Layout::end(m_floatingState); > for (auto iterator = begin(m_floatingState, { floatAvoider.rect().top() }); iterator != end; ++iterator) { > ASSERT(!(*iterator).isEmpty()); >@@ -332,8 +332,8 @@ bool FloatingPair::operator ==(const FloatingPair& other) const > > FloatAvoider::HorizontalConstraints FloatingPair::horizontalConstraints() const > { >- std::optional<PositionInContextRoot> leftEdge; >- std::optional<PositionInContextRoot> rightEdge; >+ WTF::Optional<PositionInContextRoot> leftEdge; >+ WTF::Optional<PositionInContextRoot> rightEdge; > > if (left()) > leftEdge = PositionInContextRoot { left()->rectWithMargin().right() }; >@@ -350,8 +350,8 @@ PositionInContextRoot FloatingPair::bottom() const > auto* right = this->right(); > ASSERT(left || right); > >- auto leftBottom = left ? std::optional<PositionInContextRoot>(PositionInContextRoot { left->rectWithMargin().bottom() }) : std::nullopt; >- auto rightBottom = right ? std::optional<PositionInContextRoot>(PositionInContextRoot { right->rectWithMargin().bottom() }) : std::nullopt; >+ auto leftBottom = left ? WTF::Optional<PositionInContextRoot>(PositionInContextRoot { left->rectWithMargin().bottom() }) : WTF::nullopt; >+ auto rightBottom = right ? WTF::Optional<PositionInContextRoot>(PositionInContextRoot { right->rectWithMargin().bottom() }) : WTF::nullopt; > > if (leftBottom && rightBottom) > return std::max(*leftBottom, *rightBottom); >@@ -362,7 +362,7 @@ PositionInContextRoot FloatingPair::bottom() const > return *rightBottom; > } > >-Iterator::Iterator(const FloatingState::FloatList& floats, std::optional<PositionInContextRoot> verticalPosition) >+Iterator::Iterator(const FloatingState::FloatList& floats, WTF::Optional<PositionInContextRoot> verticalPosition) > : m_floats(floats) > , m_current(floats) > { >@@ -370,7 +370,7 @@ Iterator::Iterator(const FloatingState::FloatList& floats, std::optional<Positio > set(*verticalPosition); > } > >-inline static std::optional<unsigned> previousFloatingIndex(Float floatingType, const FloatingState::FloatList& floats, unsigned currentIndex) >+inline static WTF::Optional<unsigned> previousFloatingIndex(Float floatingType, const FloatingState::FloatList& floats, unsigned currentIndex) > { > RELEASE_ASSERT(currentIndex <= floats.size()); > >@@ -390,7 +390,7 @@ Iterator& Iterator::operator++() > return *this; > } > >- auto findPreviousFloatingWithLowerBottom = [&](Float floatingType, unsigned currentIndex) -> std::optional<unsigned> { >+ auto findPreviousFloatingWithLowerBottom = [&](Float floatingType, unsigned currentIndex) -> WTF::Optional<unsigned> { > > RELEASE_ASSERT(currentIndex < m_floats.size()); > >@@ -400,7 +400,7 @@ Iterator& Iterator::operator++() > > auto currentBottom = m_floats[currentIndex].rectWithMargin().bottom(); > >- std::optional<unsigned> index = currentIndex; >+ WTF::Optional<unsigned> index = currentIndex; > while (true) { > index = previousFloatingIndex(floatingType, m_floats, *index); > if (!index) >@@ -420,8 +420,8 @@ Iterator& Iterator::operator++() > // Ensure that the new floating's bottom edge is positioned lower than the current one -which essentially means skipping in-between floats that are positioned higher). > // 3. Reset the vertical position and align it with the new left-right pair. These floats are now the inner-most boxes for the current vertical position. > // As the result we have more horizontal space on the current vertical position. >- auto leftBottom = m_current.left() ? std::optional<PositionInContextRoot>(m_current.left()->bottom()) : std::nullopt; >- auto rightBottom = m_current.right() ? std::optional<PositionInContextRoot>(m_current.right()->bottom()) : std::nullopt; >+ auto leftBottom = m_current.left() ? WTF::Optional<PositionInContextRoot>(m_current.left()->bottom()) : WTF::nullopt; >+ auto rightBottom = m_current.right() ? WTF::Optional<PositionInContextRoot>(m_current.right()->bottom()) : WTF::nullopt; > > auto updateLeft = (leftBottom == rightBottom) || (!rightBottom || (leftBottom && leftBottom < rightBottom)); > auto updateRight = (leftBottom == rightBottom) || (!leftBottom || (rightBottom && leftBottom > rightBottom)); >@@ -458,7 +458,7 @@ void Iterator::set(PositionInContextRoot verticalPosition) > return; > } > >- auto findFloatingBelow = [&](Float floatingType) -> std::optional<unsigned> { >+ auto findFloatingBelow = [&](Float floatingType) -> WTF::Optional<unsigned> { > > ASSERT(!m_floats.isEmpty()); > >diff --git a/Source/WebCore/layout/floats/FloatingContext.h b/Source/WebCore/layout/floats/FloatingContext.h >index 42eea7a3cb7d62c51e16f551efcdf53139d438d3..71f5f1e2c614f9b7fc57cee4b51392d0222dc009 100644 >--- a/Source/WebCore/layout/floats/FloatingContext.h >+++ b/Source/WebCore/layout/floats/FloatingContext.h >@@ -51,8 +51,8 @@ public: > FloatingState& floatingState() const { return m_floatingState; } > > Point positionForFloat(const Box&) const; >- std::optional<Point> positionForFloatAvoiding(const Box&) const; >- std::optional<Position> verticalPositionWithClearance(const Box&) const; >+ WTF::Optional<Point> positionForFloatAvoiding(const Box&) const; >+ WTF::Optional<Position> verticalPositionWithClearance(const Box&) const; > > private: > LayoutState& layoutState() const { return m_floatingState.layoutState(); } >diff --git a/Source/WebCore/layout/floats/FloatingState.cpp b/Source/WebCore/layout/floats/FloatingState.cpp >index 91634968d82c71555834981956c2f09137e5795d..358959cf9c1996c703cac19e3890ae98b4908398 100644 >--- a/Source/WebCore/layout/floats/FloatingState.cpp >+++ b/Source/WebCore/layout/floats/FloatingState.cpp >@@ -134,14 +134,14 @@ FloatingState::Constraints FloatingState::constraints(PositionInContextRoot vert > return constraints; > } > >-std::optional<PositionInContextRoot> FloatingState::bottom(const Box& formattingContextRoot, Clear type) const >+WTF::Optional<PositionInContextRoot> FloatingState::bottom(const Box& formattingContextRoot, Clear type) const > { > if (m_floats.isEmpty()) > return { }; > > // TODO: Currently this is only called once for each formatting context root with floats per layout. > // Cache the value if we end up calling it more frequently (and update it at append/remove). >- std::optional<PositionInContextRoot> bottom; >+ WTF::Optional<PositionInContextRoot> bottom; > for (auto& floatItem : m_floats) { > // Ignore floats from other formatting contexts when the floating state is inherited. > if (!floatItem.inFormattingContext(formattingContextRoot)) >diff --git a/Source/WebCore/layout/floats/FloatingState.h b/Source/WebCore/layout/floats/FloatingState.h >index 8678277dd1b6d15984d35a056fe6d6ac2b75c666..805bb5ec269a651b6addd8c779285824818068ba 100644 >--- a/Source/WebCore/layout/floats/FloatingState.h >+++ b/Source/WebCore/layout/floats/FloatingState.h >@@ -54,13 +54,13 @@ public: > > const Box& root() const { return *m_formattingContextRoot; } > >- std::optional<PositionInContextRoot> leftBottom(const Box& formattingContextRoot) const; >- std::optional<PositionInContextRoot> rightBottom(const Box& formattingContextRoot) const; >- std::optional<PositionInContextRoot> bottom(const Box& formattingContextRoot) const; >+ WTF::Optional<PositionInContextRoot> leftBottom(const Box& formattingContextRoot) const; >+ WTF::Optional<PositionInContextRoot> rightBottom(const Box& formattingContextRoot) const; >+ WTF::Optional<PositionInContextRoot> bottom(const Box& formattingContextRoot) const; > > struct Constraints { >- std::optional<PositionInContextRoot> left; >- std::optional<PositionInContextRoot> right; >+ WTF::Optional<PositionInContextRoot> left; >+ WTF::Optional<PositionInContextRoot> right; > }; > Constraints constraints(PositionInContextRoot verticalPosition, const Box& formattingContextRoot) const; > >@@ -90,26 +90,26 @@ private: > > LayoutState& layoutState() const { return m_layoutState; } > >- std::optional<PositionInContextRoot> bottom(const Box& formattingContextRoot, Clear) const; >+ WTF::Optional<PositionInContextRoot> bottom(const Box& formattingContextRoot, Clear) const; > > LayoutState& m_layoutState; > WeakPtr<const Box> m_formattingContextRoot; > FloatList m_floats; > }; > >-inline std::optional<PositionInContextRoot> FloatingState::leftBottom(const Box& formattingContextRoot) const >+inline WTF::Optional<PositionInContextRoot> FloatingState::leftBottom(const Box& formattingContextRoot) const > { > ASSERT(formattingContextRoot.establishesFormattingContext()); > return bottom(formattingContextRoot, Clear::Left); > } > >-inline std::optional<PositionInContextRoot> FloatingState::rightBottom(const Box& formattingContextRoot) const >+inline WTF::Optional<PositionInContextRoot> FloatingState::rightBottom(const Box& formattingContextRoot) const > { > ASSERT(formattingContextRoot.establishesFormattingContext()); > return bottom(formattingContextRoot, Clear::Right); > } > >-inline std::optional<PositionInContextRoot> FloatingState::bottom(const Box& formattingContextRoot) const >+inline WTF::Optional<PositionInContextRoot> FloatingState::bottom(const Box& formattingContextRoot) const > { > ASSERT(formattingContextRoot.establishesFormattingContext()); > return bottom(formattingContextRoot, Clear::Both); >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >index fb554ff15d796389126ba7a8017cdb1e3acfd4e1..85d10e47ce16e45bd771c956d9765d0d34bbae46 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >@@ -143,7 +143,7 @@ void InlineFormattingContext::splitInlineRunIfNeeded(const InlineRun& inlineRun, > const InlineItem* lastInlineItem { nullptr }; > unsigned length { 0 }; > }; >- std::optional<Uncommitted> uncommitted; >+ WTF::Optional<Uncommitted> uncommitted; > > auto commit = [&] { > if (!uncommitted) >@@ -411,7 +411,7 @@ void InlineFormattingContext::placeInFlowPositionedChildren(unsigned fistRunInde > > auto positionOffset = [&](auto& layoutBox) { > // FIXME: Need to figure out whether in-flow offset should stick. This might very well be temporary. >- std::optional<LayoutSize> offset; >+ WTF::Optional<LayoutSize> offset; > for (auto* box = &layoutBox; box != &root(); box = box->parent()) { > if (!box->isInFlowPositioned()) > continue; >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >index f0aed35de5c077723d13cfb37dd5783fa5cbdc8d..f8d8810e59186399edbdc93ce68c89e4b94df21d 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >@@ -66,7 +66,7 @@ private: > LayoutUnit contentLogicalRight() const; > LayoutUnit contentLogicalLeft() const { return m_logicalRect.left(); } > LayoutUnit availableWidth() const { return m_availableWidth; } >- std::optional<InlineRunProvider::Run::Type> lastRunType() const { return m_lastRunType; } >+ WTF::Optional<InlineRunProvider::Run::Type> lastRunType() const { return m_lastRunType; } > > LayoutUnit logicalTop() const { return m_logicalRect.top(); } > LayoutUnit logicalBottom() const { return m_logicalRect.bottom(); } >@@ -77,8 +77,8 @@ private: > LayoutUnit width; > unsigned length; > }; >- std::optional<TrailingTrimmableContent> m_trailingTrimmableContent; >- std::optional<InlineRunProvider::Run::Type> m_lastRunType; >+ WTF::Optional<TrailingTrimmableContent> m_trailingTrimmableContent; >+ WTF::Optional<InlineRunProvider::Run::Type> m_lastRunType; > bool m_lastRunCanExpand { false }; > > Display::Box::Rect m_logicalRect; >diff --git a/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp b/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp >index 4096e42d7275d94a124a695e726206116c74602a..78f85af05f1c12004cf3d5ef5d28f4c977f04c0a 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp >@@ -46,16 +46,16 @@ InlineLineBreaker::InlineLineBreaker(const LayoutState& layoutState, const Inlin > { > } > >-std::optional<InlineLineBreaker::Run> InlineLineBreaker::nextRun(LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool lineIsEmpty) >+WTF::Optional<InlineLineBreaker::Run> InlineLineBreaker::nextRun(LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool lineIsEmpty) > { > if (isAtContentEnd()) >- return std::nullopt; >+ return WTF::nullopt; > > InlineRunProvider::Run currentInlineRun = m_inlineRuns[m_currentRunIndex]; > // Adjust the current run if it is split midword. > if (m_splitPosition) { > ASSERT(currentInlineRun.isText()); >- m_splitPosition = std::nullopt; >+ m_splitPosition = WTF::nullopt; > } > > if (currentInlineRun.isLineBreak()) { >@@ -190,7 +190,7 @@ InlineLineBreaker::Run InlineLineBreaker::splitRun(const InlineRunProvider::Run& > return { Run::Position::Undetermined, { }, inlineRun }; > } > >-std::optional<ItemPosition> InlineLineBreaker::adjustSplitPositionWithHyphenation(const InlineRunProvider::Run&, ItemPosition, LayoutUnit, LayoutUnit, bool) const >+WTF::Optional<ItemPosition> InlineLineBreaker::adjustSplitPositionWithHyphenation(const InlineRunProvider::Run&, ItemPosition, LayoutUnit, LayoutUnit, bool) const > { > return { }; > } >diff --git a/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h b/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h >index 438af65d44cad8a2abed34ac37256a2fd6aa5a02..88a3a5d40dbe4088bfa8692495326421ab1ba74c 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h >+++ b/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h >@@ -44,7 +44,7 @@ public: > LayoutUnit width; > InlineRunProvider::Run content; > }; >- std::optional<Run> nextRun(LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool lineIsEmpty); >+ WTF::Optional<Run> nextRun(LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool lineIsEmpty); > > private: > enum class LineBreakingBehavior { Keep, Break, WrapToNextLine }; >@@ -53,14 +53,14 @@ private: > Run splitRun(const InlineRunProvider::Run&, LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool lineIsEmpty); > LayoutUnit runWidth(const InlineRunProvider::Run&, LayoutUnit contentLogicalLeft) const; > LayoutUnit textWidth(const InlineRunProvider::Run&, LayoutUnit contentLogicalLeft) const; >- std::optional<ItemPosition> adjustSplitPositionWithHyphenation(const InlineRunProvider::Run&, ItemPosition splitPosition, LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool isLineEmpty) const; >+ WTF::Optional<ItemPosition> adjustSplitPositionWithHyphenation(const InlineRunProvider::Run&, ItemPosition splitPosition, LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool isLineEmpty) const; > > const LayoutState& m_layoutState; > const InlineContent& m_inlineContent; > const Vector<InlineRunProvider::Run>& m_inlineRuns; > > unsigned m_currentRunIndex { 0 }; >- std::optional<ItemPosition> m_splitPosition; >+ WTF::Optional<ItemPosition> m_splitPosition; > bool m_hyphenationIsDisabled { false }; > }; > >diff --git a/Source/WebCore/layout/inlineformatting/InlineRun.h b/Source/WebCore/layout/inlineformatting/InlineRun.h >index 7ef3854c12e852671965d61c063098fa5408105e..171f5b7b27513e4d6eb6a74eaab57b174430297d 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineRun.h >+++ b/Source/WebCore/layout/inlineformatting/InlineRun.h >@@ -73,8 +73,8 @@ struct InlineRun { > unsigned m_length; > }; > void setTextContext(TextContext textContext) { m_textContext.emplace(textContext); } >- std::optional<TextContext>& textContext() { return m_textContext; } >- std::optional<TextContext> textContext() const { return m_textContext; } >+ WTF::Optional<TextContext>& textContext() { return m_textContext; } >+ WTF::Optional<TextContext> textContext() const { return m_textContext; } > > const InlineItem& inlineItem() const { return m_inlineItem; } > >@@ -83,7 +83,7 @@ private: > ExpansionOpportunity m_expansionOpportunity; > > const InlineItem& m_inlineItem; >- std::optional<TextContext> m_textContext; >+ WTF::Optional<TextContext> m_textContext; > }; > > using InlineRuns = Vector<InlineRun>; >diff --git a/Source/WebCore/layout/inlineformatting/InlineRunProvider.h b/Source/WebCore/layout/inlineformatting/InlineRunProvider.h >index 4cdfe33cda86c18ca005594f789d7a06f1a55483..c1680ac209fc31c653ffded9d6893a5b05a814ea 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineRunProvider.h >+++ b/Source/WebCore/layout/inlineformatting/InlineRunProvider.h >@@ -89,7 +89,7 @@ public: > unsigned m_length { 0 }; > IsCollapsed m_isCollapsed { IsCollapsed::No }; > }; >- std::optional<TextContext> textContext() const { return m_textContext; } >+ WTF::Optional<TextContext> textContext() const { return m_textContext; } > // Note that style() and inlineItem() always returns the first InlineItem for a run. > const RenderStyle& style() const { return m_inlineItem.style(); } > const InlineItem& inlineItem() const { return m_inlineItem; } >@@ -97,12 +97,12 @@ public: > private: > friend class InlineRunProvider; > >- Run(const InlineItem&, Type, std::optional<TextContext>); >- std::optional<TextContext>& textContext() { return m_textContext; } >+ Run(const InlineItem&, Type, WTF::Optional<TextContext>); >+ WTF::Optional<TextContext>& textContext() { return m_textContext; } > > const Type m_type; > const InlineItem& m_inlineItem; >- std::optional<TextContext> m_textContext; >+ WTF::Optional<TextContext> m_textContext; > }; > const Vector<InlineRunProvider::Run>& runs() const { return m_inlineRuns; } > >@@ -120,22 +120,22 @@ private: > > inline InlineRunProvider::Run InlineRunProvider::Run::createBoxRun(const InlineItem& inlineItem) > { >- return { inlineItem, Type::Box, std::nullopt }; >+ return { inlineItem, Type::Box, WTF::nullopt }; > } > > inline InlineRunProvider::Run InlineRunProvider::Run::createFloatRun(const InlineItem& inlineItem) > { >- return { inlineItem, Type::Float, std::nullopt }; >+ return { inlineItem, Type::Float, WTF::nullopt }; > } > > inline InlineRunProvider::Run InlineRunProvider::Run::createSoftLineBreakRun(const InlineItem& inlineItem) > { >- return { inlineItem, Type::SoftLineBreak, std::nullopt }; >+ return { inlineItem, Type::SoftLineBreak, WTF::nullopt }; > } > > inline InlineRunProvider::Run InlineRunProvider::Run::createHardLineBreakRun(const InlineItem& inlineItem) > { >- return { inlineItem, Type::HardLineBreak, std::nullopt }; >+ return { inlineItem, Type::HardLineBreak, WTF::nullopt }; > } > > inline InlineRunProvider::Run InlineRunProvider::Run::createWhitespaceRun(const InlineItem& inlineItem, ItemPosition start, unsigned length, bool isCollapsible) >@@ -150,7 +150,7 @@ inline InlineRunProvider::Run InlineRunProvider::Run::createNonWhitespaceRun(con > return { inlineItem, Type::NonWhitespace, TextContext(start, length, TextContext::IsCollapsed::No) }; > } > >-inline InlineRunProvider::Run::Run(const InlineItem& inlineItem, Type type, std::optional<TextContext> textContext) >+inline InlineRunProvider::Run::Run(const InlineItem& inlineItem, Type type, WTF::Optional<TextContext> textContext) > : m_type(type) > , m_inlineItem(inlineItem) > , m_textContext(textContext) >diff --git a/Source/WebCore/layout/inlineformatting/Line.cpp b/Source/WebCore/layout/inlineformatting/Line.cpp >index 33b4e3489c89d814327c6086873e1c4fd64541b2..080429b7681050a1679ae036744dd8bb68393632 100644 >--- a/Source/WebCore/layout/inlineformatting/Line.cpp >+++ b/Source/WebCore/layout/inlineformatting/Line.cpp >@@ -83,7 +83,7 @@ void InlineFormattingContext::Line::appendContent(const InlineRunProvider::Run& > ASSERT(!isClosed()); > > // Append this text run to the end of the last text run, if the last run is continuous. >- std::optional<InlineRun::TextContext> textRun; >+ WTF::Optional<InlineRun::TextContext> textRun; > if (run.isText()) { > auto textContext = run.textContext(); > auto runLength = textContext->isCollapsed() ? 1 : textContext->length(); >diff --git a/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp b/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp >index 4888d6c4ec925e25fa337874d276f1a0ad93d027..0511553b81994657ba9c88a668bb7a0f7e38bad0 100644 >--- a/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp >+++ b/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp >@@ -34,9 +34,9 @@ > namespace WebCore { > namespace Layout { > >-std::optional<ItemPosition> TextUtil::hyphenPositionBefore(const InlineItem&, ItemPosition, unsigned) >+WTF::Optional<ItemPosition> TextUtil::hyphenPositionBefore(const InlineItem&, ItemPosition, unsigned) > { >- return std::nullopt; >+ return WTF::nullopt; > } > > LayoutUnit TextUtil::width(const InlineItem& inlineTextItem, ItemPosition from, ItemPosition to, LayoutUnit contentLogicalLeft) >diff --git a/Source/WebCore/layout/inlineformatting/text/TextUtil.h b/Source/WebCore/layout/inlineformatting/text/TextUtil.h >index 888d5e3b22b03f9a4b78733c8b21947656eeb815..ed8b1cb64c3b50c3f10bceed56dc55d3b4840e05 100644 >--- a/Source/WebCore/layout/inlineformatting/text/TextUtil.h >+++ b/Source/WebCore/layout/inlineformatting/text/TextUtil.h >@@ -36,7 +36,7 @@ namespace Layout { > class TextUtil { > public: > static LayoutUnit width(const InlineItem&, ItemPosition from, ItemPosition to, LayoutUnit contentLogicalLeft); >- static std::optional<ItemPosition> hyphenPositionBefore(const InlineItem&, ItemPosition from, unsigned length); >+ static WTF::Optional<ItemPosition> hyphenPositionBefore(const InlineItem&, ItemPosition from, unsigned length); > > private: > static LayoutUnit fixedPitchWidth(String, const RenderStyle&, ItemPosition from, ItemPosition to, LayoutUnit contentLogicalLeft); >diff --git a/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp b/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp >index 881aa2a3562fd93435e07774e58668a4bcea29fb..c8c0d69807745965dc8d5cc47cca3288bf39f663 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp >@@ -36,7 +36,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(BlockContainer); > >-BlockContainer::BlockContainer(std::optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+BlockContainer::BlockContainer(WTF::Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) > : Container(attributes, WTFMove(style), baseTypeFlags | BlockContainerFlag) > { > } >diff --git a/Source/WebCore/layout/layouttree/LayoutBlockContainer.h b/Source/WebCore/layout/layouttree/LayoutBlockContainer.h >index 2f74b3faec24faf5dff214289cbe1f8f50fb7d72..f1f881f09e7a5262e6eea8489f5953caa5eada08 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBlockContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutBlockContainer.h >@@ -39,7 +39,7 @@ namespace Layout { > class BlockContainer : public Container { > WTF_MAKE_ISO_ALLOCATED(BlockContainer); > public: >- BlockContainer(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = BlockContainerFlag); >+ BlockContainer(WTF::Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = BlockContainerFlag); > > bool establishesInlineFormattingContext() const final; > >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.cpp b/Source/WebCore/layout/layouttree/LayoutBox.cpp >index bf5b38a1f5ccc52a93d8b13290fc89fac41c2314..b826047cabe3f10c16c95621c0de2fafdcaa499d 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutBox.cpp >@@ -37,7 +37,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(Box); > >-Box::Box(std::optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+Box::Box(WTF::Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) > : m_style(WTFMove(style)) > , m_elementAttributes(attributes) > , m_baseTypeFlags(baseTypeFlags) >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.h b/Source/WebCore/layout/layouttree/LayoutBox.h >index 2e73cec4fdbca625a6d1a4292de082314fb246cf..e6afed59f43614b5d7a9895eaa0adfb30f957135 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutBox.h >@@ -69,7 +69,7 @@ public: > }; > typedef unsigned BaseTypeFlags; > >- Box(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags); >+ Box(WTF::Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags); > virtual ~Box(); > > bool establishesFormattingContext() const; >@@ -137,7 +137,7 @@ public: > > private: > RenderStyle m_style; >- std::optional<ElementAttributes> m_elementAttributes; >+ WTF::Optional<ElementAttributes> m_elementAttributes; > > Container* m_parent { nullptr }; > Box* m_previousSibling { nullptr }; >diff --git a/Source/WebCore/layout/layouttree/LayoutContainer.cpp b/Source/WebCore/layout/layouttree/LayoutContainer.cpp >index 252fc8e39e5d433b7d595da08f6370532ef5f0ba..af6c5915616e567f95a63df1ea3e24bc2c66f238 100644 >--- a/Source/WebCore/layout/layouttree/LayoutContainer.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutContainer.cpp >@@ -36,7 +36,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(Container); > >-Container::Container(std::optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+Container::Container(WTF::Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) > : Box(attributes, WTFMove(style), baseTypeFlags | ContainerFlag) > { > } >diff --git a/Source/WebCore/layout/layouttree/LayoutContainer.h b/Source/WebCore/layout/layouttree/LayoutContainer.h >index 480c7c582f2a2508250515db3456864e09129b8a..24a899500ab19068c9caaf0ac07fcec0751609d1 100644 >--- a/Source/WebCore/layout/layouttree/LayoutContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutContainer.h >@@ -40,7 +40,7 @@ namespace Layout { > class Container : public Box { > WTF_MAKE_ISO_ALLOCATED(Container); > public: >- Container(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags); >+ Container(WTF::Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags); > > const Box* firstChild() const { return m_firstChild; } > const Box* firstInFlowChild() const; >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp b/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp >index fb134f72e76b817cd14e9bfc115ffcc1c21bd588..c400abd1605dff47e585b283145b7ad50c681b57 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp >@@ -36,7 +36,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(InlineBox); > >-InlineBox::InlineBox(std::optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+InlineBox::InlineBox(WTF::Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) > : Box(attributes, WTFMove(style), baseTypeFlags | InlineBoxFlag) > { > } >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineBox.h b/Source/WebCore/layout/layouttree/LayoutInlineBox.h >index 88f5cd34b42060af35bef34ad0653cee967604ea..f0484b6c3debe4e40ae15df0f36b98e695b5f7bf 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutInlineBox.h >@@ -39,7 +39,7 @@ namespace Layout { > class InlineBox : public Box { > WTF_MAKE_ISO_ALLOCATED(InlineBox); > public: >- InlineBox(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = InlineBoxFlag); >+ InlineBox(WTF::Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = InlineBoxFlag); > > void setTextContent(String text) { m_textContent = text; } > bool hasTextContent() const { return !m_textContent.isNull(); } >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp b/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >index 5ed09f3611f80f977fc63f85a25fa104531497de..f77e02880e21130d57bb6219b0ba13b0e93f3dcb 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >@@ -36,7 +36,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(InlineContainer); > >-InlineContainer::InlineContainer(std::optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+InlineContainer::InlineContainer(WTF::Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) > : Container(attributes, WTFMove(style), baseTypeFlags | InlineContainerFlag) > { > } >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineContainer.h b/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >index 12333ac66910ecdd90f3d17eda88c54a2aa8ba6a..d0360e673cdc964967f96f35c15db51f6f6b94c9 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >@@ -39,7 +39,7 @@ namespace Layout { > class InlineContainer : public Container { > WTF_MAKE_ISO_ALLOCATED(InlineContainer); > public: >- InlineContainer(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = InlineContainerFlag); >+ InlineContainer(WTF::Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = InlineContainerFlag); > > bool establishesInlineFormattingContext() const final; > }; >diff --git a/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp b/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp >index 6a1d2154ed355a180a79573dd81f57a395dec86e..84819e57c9a221ac8bc021aa83c9915b43d53530 100644 >--- a/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp >@@ -36,7 +36,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(LineBreakBox); > >-LineBreakBox::LineBreakBox(std::optional<ElementAttributes> attributes, RenderStyle&& style) >+LineBreakBox::LineBreakBox(WTF::Optional<ElementAttributes> attributes, RenderStyle&& style) > : InlineBox(attributes, WTFMove(style), LineBreakBoxFlag) > { > } >diff --git a/Source/WebCore/layout/layouttree/LayoutLineBreakBox.h b/Source/WebCore/layout/layouttree/LayoutLineBreakBox.h >index 0be528aeab5d7feb7bd8c5a29da3609091ab6aac..314186add326bdd6e129220139b6ad73edb0fd6b 100644 >--- a/Source/WebCore/layout/layouttree/LayoutLineBreakBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutLineBreakBox.h >@@ -39,7 +39,7 @@ namespace Layout { > class LineBreakBox : public InlineBox { > WTF_MAKE_ISO_ALLOCATED(LineBreakBox); > public: >- LineBreakBox(std::optional<ElementAttributes>, RenderStyle&&); >+ LineBreakBox(WTF::Optional<ElementAttributes>, RenderStyle&&); > }; > > } >diff --git a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >index d40307575eb40aab0ef600c8567ed5fa00ed24d2..9d74085de8ea4b56c75f985fcc549933a0d697dd 100644 >--- a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >@@ -50,14 +50,14 @@ namespace Layout { > > std::unique_ptr<Container> TreeBuilder::createLayoutTree(const RenderView& renderView) > { >- std::unique_ptr<Container> initialContainingBlock(new BlockContainer(std::nullopt, RenderStyle::clone(renderView.style()))); >+ std::unique_ptr<Container> initialContainingBlock(new BlockContainer(WTF::nullopt, RenderStyle::clone(renderView.style()))); > TreeBuilder::createSubTree(renderView, *initialContainingBlock); > return initialContainingBlock; > } > > void TreeBuilder::createSubTree(const RenderElement& rootRenderer, Container& rootContainer) > { >- auto elementAttributes = [] (const RenderElement& renderer) -> std::optional<Box::ElementAttributes> { >+ auto elementAttributes = [] (const RenderElement& renderer) -> WTF::Optional<Box::ElementAttributes> { > if (renderer.isDocumentElementRenderer()) > return Box::ElementAttributes { Box::ElementType::Document }; > if (auto* element = renderer.element()) { >@@ -81,14 +81,14 @@ void TreeBuilder::createSubTree(const RenderElement& rootRenderer, Container& ro > return Box::ElementAttributes { Box::ElementType::Replaced }; > return Box::ElementAttributes { Box::ElementType::GenericElement }; > } >- return std::nullopt; >+ return WTF::nullopt; > }; > > for (auto& child : childrenOfType<RenderObject>(rootRenderer)) { > std::unique_ptr<Box> box; > > if (is<RenderText>(child)) { >- box = std::make_unique<InlineBox>(std::optional<Box::ElementAttributes>(), RenderStyle::createAnonymousStyleWithDisplay(rootRenderer.style(), DisplayType::Inline)); >+ box = std::make_unique<InlineBox>(WTF::Optional<Box::ElementAttributes>(), RenderStyle::createAnonymousStyleWithDisplay(rootRenderer.style(), DisplayType::Inline)); > downcast<InlineBox>(*box).setTextContent(downcast<RenderText>(child).originalText()); > } else if (is<RenderReplaced>(child)) { > auto& renderer = downcast<RenderReplaced>(child); >diff --git a/Source/WebCore/loader/ApplicationManifestLoader.cpp b/Source/WebCore/loader/ApplicationManifestLoader.cpp >index fbb3f8646eb56d922b46ccff7712f9d54699f50b..fdb7fa538066d50ff0cf2cbd883c023adc393636 100644 >--- a/Source/WebCore/loader/ApplicationManifestLoader.cpp >+++ b/Source/WebCore/loader/ApplicationManifestLoader.cpp >@@ -102,7 +102,7 @@ void ApplicationManifestLoader::stopLoading() > } > } > >-std::optional<ApplicationManifest>& ApplicationManifestLoader::processManifest() >+WTF::Optional<ApplicationManifest>& ApplicationManifestLoader::processManifest() > { > if (!m_processedManifest && m_resource) { > auto manifestURL = m_url; >diff --git a/Source/WebCore/loader/ApplicationManifestLoader.h b/Source/WebCore/loader/ApplicationManifestLoader.h >index 1b0f760d2ecebd5c28ef5c2ec42eda12f03f3beb..5fab1c9d56d90fd65437610f12ef94c6bdc8b3ee 100644 >--- a/Source/WebCore/loader/ApplicationManifestLoader.h >+++ b/Source/WebCore/loader/ApplicationManifestLoader.h >@@ -49,13 +49,13 @@ public: > bool startLoading(); > void stopLoading(); > >- std::optional<ApplicationManifest>& processManifest(); >+ WTF::Optional<ApplicationManifest>& processManifest(); > > private: > void notifyFinished(CachedResource&); > > DocumentLoader& m_documentLoader; >- std::optional<ApplicationManifest> m_processedManifest; >+ WTF::Optional<ApplicationManifest> m_processedManifest; > URL m_url; > bool m_useCredentials; > CachedResourceHandle<CachedApplicationManifest> m_resource; >diff --git a/Source/WebCore/loader/CookieJar.cpp b/Source/WebCore/loader/CookieJar.cpp >index 068306744af814bd2760a5e1865a5a9ab4352b13..397f0db4b27d983ba396352e9437b32f64dc2233 100644 >--- a/Source/WebCore/loader/CookieJar.cpp >+++ b/Source/WebCore/loader/CookieJar.cpp >@@ -80,7 +80,7 @@ String cookies(Document& document, const URL& url) > if (frame) > result = platformStrategies()->cookiesStrategy()->cookiesForDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies); > else >- result = platformStrategies()->cookiesStrategy()->cookiesForDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, std::nullopt, std::nullopt, includeSecureCookies); >+ result = platformStrategies()->cookiesStrategy()->cookiesForDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies); > > if (result.second) > document.setSecureCookiesAccessed(); >@@ -111,7 +111,7 @@ void setCookies(Document& document, const URL& url, const String& cookieString) > if (frame) > platformStrategies()->cookiesStrategy()->setCookiesFromDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookieString); > else >- platformStrategies()->cookiesStrategy()->setCookiesFromDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, std::nullopt, std::nullopt, cookieString); >+ platformStrategies()->cookiesStrategy()->setCookiesFromDOM(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookieString); > } > > bool cookiesEnabled(const Document& document) >@@ -128,7 +128,7 @@ String cookieRequestHeaderFieldValue(Document& document, const URL& url) > if (frame) > result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies); > else >- result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, std::nullopt, std::nullopt, includeSecureCookies); >+ result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies); > > if (result.second) > document.setSecureCookiesAccessed(); >@@ -142,7 +142,7 @@ bool getRawCookies(const Document& document, const URL& url, Vector<Cookie>& coo > if (frame) > return platformStrategies()->cookiesStrategy()->getRawCookies(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookies); > >- return platformStrategies()->cookiesStrategy()->getRawCookies(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, std::nullopt, std::nullopt, cookies); >+ return platformStrategies()->cookiesStrategy()->getRawCookies(storageSession(document), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookies); > } > > void deleteCookie(const Document& document, const URL& url, const String& cookieName) >diff --git a/Source/WebCore/loader/CrossOriginAccessControl.cpp b/Source/WebCore/loader/CrossOriginAccessControl.cpp >index effbb5731f54300a7908c04f52d5ae6d1d833620..5190491601eda637a74607e1cfc00af93a018119 100644 >--- a/Source/WebCore/loader/CrossOriginAccessControl.cpp >+++ b/Source/WebCore/loader/CrossOriginAccessControl.cpp >@@ -240,11 +240,11 @@ static inline bool shouldCrossOriginResourcePolicyCancelLoad(const SecurityOrigi > return false; > } > >-std::optional<ResourceError> validateCrossOriginResourcePolicy(const SecurityOrigin& origin, const URL& requestURL, const ResourceResponse& response) >+WTF::Optional<ResourceError> validateCrossOriginResourcePolicy(const SecurityOrigin& origin, const URL& requestURL, const ResourceResponse& response) > { > if (shouldCrossOriginResourcePolicyCancelLoad(origin, response)) > return ResourceError { errorDomainWebKitInternal, 0, requestURL, makeString("Cancelled load to ", response.url().stringCenterEllipsizedToLength(), " because it violates the resource's Cross-Origin-Resource-Policy response header."), ResourceError::Type::AccessControl }; >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WebCore >diff --git a/Source/WebCore/loader/CrossOriginAccessControl.h b/Source/WebCore/loader/CrossOriginAccessControl.h >index 2af3d4a1c52091293de1c483a2fc173ac66ea276..b2f53bcf12044090040b3488fdad79b73c0e5533 100644 >--- a/Source/WebCore/loader/CrossOriginAccessControl.h >+++ b/Source/WebCore/loader/CrossOriginAccessControl.h >@@ -62,6 +62,6 @@ WEBCORE_EXPORT void cleanHTTPRequestHeadersForAccessControl(ResourceRequest&, co > WEBCORE_EXPORT bool passesAccessControlCheck(const ResourceResponse&, StoredCredentialsPolicy, SecurityOrigin&, String& errorDescription); > WEBCORE_EXPORT bool validatePreflightResponse(const ResourceRequest&, const ResourceResponse&, StoredCredentialsPolicy, SecurityOrigin&, String& errorDescription); > >-WEBCORE_EXPORT std::optional<ResourceError> validateCrossOriginResourcePolicy(const SecurityOrigin&, const URL&, const ResourceResponse&); >+WEBCORE_EXPORT WTF::Optional<ResourceError> validateCrossOriginResourcePolicy(const SecurityOrigin&, const URL&, const ResourceResponse&); > > } // namespace WebCore >diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp >index 2f508ebc63b71718b81e3627ff28cc46712cfbdb..1f17ba76b74cdb119ec2dad0f37c6245b2d79f56 100644 >--- a/Source/WebCore/loader/DocumentLoader.cpp >+++ b/Source/WebCore/loader/DocumentLoader.cpp >@@ -294,7 +294,7 @@ void DocumentLoader::stopLoading() > > #if ENABLE(APPLICATION_MANIFEST) > for (auto callbackIdentifier : m_applicationManifestLoaders.values()) >- notifyFinishedLoadingApplicationManifest(callbackIdentifier, std::nullopt); >+ notifyFinishedLoadingApplicationManifest(callbackIdentifier, WTF::nullopt); > m_applicationManifestLoaders.clear(); > #endif > >@@ -484,7 +484,7 @@ void DocumentLoader::matchRegistration(const URL& url, SWClientConnection::Regis > { > auto shouldTryLoadingThroughServiceWorker = !frameLoader()->isReloadingFromOrigin() && m_frame->page() && RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled() && SchemeRegistry::canServiceWorkersHandleURLScheme(url.protocol().toStringWithoutCopying()); > if (!shouldTryLoadingThroughServiceWorker) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -492,7 +492,7 @@ void DocumentLoader::matchRegistration(const URL& url, SWClientConnection::Regis > auto sessionID = m_frame->page()->sessionID(); > auto& provider = ServiceWorkerProvider::singleton(); > if (!provider.mayHaveServiceWorkerRegisteredForOrigin(sessionID, origin)) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -500,7 +500,7 @@ void DocumentLoader::matchRegistration(const URL& url, SWClientConnection::Regis > connection.matchRegistration(WTFMove(origin), url, WTFMove(callback)); > } > >-static inline bool areRegistrationsEqual(const std::optional<ServiceWorkerRegistrationData>& a, const std::optional<ServiceWorkerRegistrationData>& b) >+static inline bool areRegistrationsEqual(const WTF::Optional<ServiceWorkerRegistrationData>& a, const WTF::Optional<ServiceWorkerRegistrationData>& b) > { > if (!a) > return !b; >@@ -702,7 +702,7 @@ bool DocumentLoader::tryLoadingRedirectRequestFromApplicationCache(const Resourc > } > > #if ENABLE(SERVICE_WORKER) >-void DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange(ResourceRequest&& request, std::optional<ServiceWorkerRegistrationData>&& registrationData) >+void DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange(ResourceRequest&& request, WTF::Optional<ServiceWorkerRegistrationData>&& registrationData) > { > clearMainResource(); > >@@ -1263,7 +1263,7 @@ void DocumentLoader::finishedLoadingApplicationManifest(ApplicationManifestLoade > m_applicationManifestLoaders.remove(&loader); > } > >-void DocumentLoader::notifyFinishedLoadingApplicationManifest(uint64_t callbackIdentifier, std::optional<ApplicationManifest> manifest) >+void DocumentLoader::notifyFinishedLoadingApplicationManifest(uint64_t callbackIdentifier, WTF::Optional<ApplicationManifest> manifest) > { > RELEASE_ASSERT(callbackIdentifier); > RELEASE_ASSERT(m_frame); >@@ -1780,7 +1780,7 @@ void DocumentLoader::unregisterTemporaryServiceWorkerClient() > return; > > m_temporaryServiceWorkerClient->serviceWorkerConnection->unregisterServiceWorkerClient(m_temporaryServiceWorkerClient->documentIdentifier); >- m_temporaryServiceWorkerClient = std::nullopt; >+ m_temporaryServiceWorkerClient = WTF::nullopt; > #endif > } > >@@ -1964,7 +1964,7 @@ void DocumentLoader::startIconLoading() > > auto findResult = m_linkIcons.findMatching([](auto& icon) { return icon.type == LinkIconType::Favicon; }); > if (findResult == notFound) >- m_linkIcons.append({ document->completeURL("/favicon.ico"_s), LinkIconType::Favicon, String(), std::nullopt, { } }); >+ m_linkIcons.append({ document->completeURL("/favicon.ico"_s), LinkIconType::Favicon, String(), WTF::nullopt, { } }); > > if (!m_linkIcons.size()) > return; >diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h >index feac90020b78a74ebdd77248041d91ab085bcc25..0cadd412c53a881ba9a8141dd47b28dbcfc8bdb7 100644 >--- a/Source/WebCore/loader/DocumentLoader.h >+++ b/Source/WebCore/loader/DocumentLoader.h >@@ -345,7 +345,7 @@ private: > Document* document() const; > > #if ENABLE(SERVICE_WORKER) >- void matchRegistration(const URL&, CompletionHandler<void(std::optional<ServiceWorkerRegistrationData>&&)>&&); >+ void matchRegistration(const URL&, CompletionHandler<void(WTF::Optional<ServiceWorkerRegistrationData>&&)>&&); > #endif > void registerTemporaryServiceWorkerClient(const URL&); > void unregisterTemporaryServiceWorkerClient(); >@@ -387,7 +387,7 @@ private: > bool tryLoadingSubstituteData(); > bool tryLoadingRedirectRequestFromApplicationCache(const ResourceRequest&); > #if ENABLE(SERVICE_WORKER) >- void restartLoadingDueToServiceWorkerRegistrationChange(ResourceRequest&&, std::optional<ServiceWorkerRegistrationData>&&); >+ void restartLoadingDueToServiceWorkerRegistrationChange(ResourceRequest&&, WTF::Optional<ServiceWorkerRegistrationData>&&); > #endif > void continueAfterContentPolicy(PolicyAction); > >@@ -413,7 +413,7 @@ private: > void notifyFinishedLoadingIcon(uint64_t callbackIdentifier, SharedBuffer*); > > #if ENABLE(APPLICATION_MANIFEST) >- void notifyFinishedLoadingApplicationManifest(uint64_t callbackIdentifier, std::optional<ApplicationManifest>); >+ void notifyFinishedLoadingApplicationManifest(uint64_t callbackIdentifier, WTF::Optional<ApplicationManifest>); > #endif > > // ContentSecurityPolicyClient >@@ -542,12 +542,12 @@ private: > PopUpPolicy m_popUpPolicy { PopUpPolicy::Default }; > > #if ENABLE(SERVICE_WORKER) >- std::optional<ServiceWorkerRegistrationData> m_serviceWorkerRegistrationData; >+ WTF::Optional<ServiceWorkerRegistrationData> m_serviceWorkerRegistrationData; > struct TemporaryServiceWorkerClient { > DocumentIdentifier documentIdentifier; > Ref<SWClientConnection> serviceWorkerConnection; > }; >- std::optional<TemporaryServiceWorkerClient> m_temporaryServiceWorkerClient; >+ WTF::Optional<TemporaryServiceWorkerClient> m_temporaryServiceWorkerClient; > #endif > > #ifndef NDEBUG >diff --git a/Source/WebCore/loader/DocumentThreadableLoader.cpp b/Source/WebCore/loader/DocumentThreadableLoader.cpp >index 9b1e5b35ab24eef8d45d50990cd05b51730db8e1..614b4e45a650a4411901875d41aa705b0fd76f3a 100644 >--- a/Source/WebCore/loader/DocumentThreadableLoader.cpp >+++ b/Source/WebCore/loader/DocumentThreadableLoader.cpp >@@ -275,7 +275,7 @@ void DocumentThreadableLoader::clearResource() > resource->removeClient(*this); > } > if (m_preflightChecker) >- m_preflightChecker = std::nullopt; >+ m_preflightChecker = WTF::nullopt; > } > > void DocumentThreadableLoader::redirectReceived(CachedResource& resource, ResourceRequest&& request, const ResourceResponse& redirectResponse, CompletionHandler<void(ResourceRequest&&)>&& completionHandler) >@@ -474,7 +474,7 @@ void DocumentThreadableLoader::didFail(unsigned long, const ResourceError& error > m_options.serviceWorkersMode = ServiceWorkersMode::None; > makeCrossOriginAccessRequestWithPreflight(WTFMove(m_bypassingPreflightForServiceWorkerRequest.value())); > ASSERT(m_bypassingPreflightForServiceWorkerRequest->isNull()); >- m_bypassingPreflightForServiceWorkerRequest = std::nullopt; >+ m_bypassingPreflightForServiceWorkerRequest = WTF::nullopt; > return; > } > #endif >@@ -490,7 +490,7 @@ void DocumentThreadableLoader::preflightSuccess(ResourceRequest&& request) > ResourceRequest actualRequest(WTFMove(request)); > updateRequestForAccessControl(actualRequest, securityOrigin(), m_options.storedCredentialsPolicy); > >- m_preflightChecker = std::nullopt; >+ m_preflightChecker = WTF::nullopt; > > // It should be ok to skip the security check since we already asked about the preflight request. > loadRequest(WTFMove(actualRequest), SecurityCheckPolicy::SkipSecurityCheck); >@@ -498,7 +498,7 @@ void DocumentThreadableLoader::preflightSuccess(ResourceRequest&& request) > > void DocumentThreadableLoader::preflightFailure(unsigned long identifier, const ResourceError& error) > { >- m_preflightChecker = std::nullopt; >+ m_preflightChecker = WTF::nullopt; > > InspectorInstrumentation::didFailLoading(m_document.frame(), m_document.frame()->loader().documentLoader(), identifier, error); > >diff --git a/Source/WebCore/loader/DocumentThreadableLoader.h b/Source/WebCore/loader/DocumentThreadableLoader.h >index 38382edf4cdd31ea21f546bd7da6481acb17eb19..c0f74eb8e1381e8bb0ebfd369af59ed6fce215cf 100644 >--- a/Source/WebCore/loader/DocumentThreadableLoader.h >+++ b/Source/WebCore/loader/DocumentThreadableLoader.h >@@ -132,12 +132,12 @@ namespace WebCore { > bool m_async; > bool m_delayCallbacksForIntegrityCheck; > std::unique_ptr<ContentSecurityPolicy> m_contentSecurityPolicy; >- std::optional<CrossOriginPreflightChecker> m_preflightChecker; >- std::optional<HTTPHeaderMap> m_originalHeaders; >+ WTF::Optional<CrossOriginPreflightChecker> m_preflightChecker; >+ WTF::Optional<HTTPHeaderMap> m_originalHeaders; > > ShouldLogError m_shouldLogError; > #if ENABLE(SERVICE_WORKER) >- std::optional<ResourceRequest> m_bypassingPreflightForServiceWorkerRequest; >+ WTF::Optional<ResourceRequest> m_bypassingPreflightForServiceWorkerRequest; > #endif > }; > >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index 9f65aebc9df6a65bd2ff487dfa367b7c3edfb962..21ae2d0ceffa57ea1c83ec5f6cd4f68d6e2cdce4 100644 >--- a/Source/WebCore/loader/EmptyClients.cpp >+++ b/Source/WebCore/loader/EmptyClients.cpp >@@ -311,16 +311,16 @@ class EmptyInspectorClient final : public InspectorClient { > > class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient { > bool supportsVersion(unsigned) final { return false; } >- std::optional<String> validatedPaymentNetwork(const String&) final { return std::nullopt; } >+ WTF::Optional<String> validatedPaymentNetwork(const String&) final { return WTF::nullopt; } > bool canMakePayments() final { return false; } > void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)] { completionHandler(false); }); } > void openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)] { completionHandler(false); }); } > bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final { return false; } > void completeMerchantValidation(const PaymentMerchantSession&) final { } >- void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) final { } >- void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final { } >- void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) final { } >- void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) final { } >+ void completeShippingMethodSelection(WTF::Optional<ShippingMethodUpdate>&&) final { } >+ void completeShippingContactSelection(WTF::Optional<ShippingContactUpdate>&&) final { } >+ void completePaymentMethodSelection(WTF::Optional<PaymentMethodUpdate>&&) final { } >+ void completePaymentSession(WTF::Optional<PaymentAuthorizationResult>&&) final { } > void cancelPaymentSession() final { } > void abortPaymentSession() final { } > void paymentCoordinatorDestroyed() final { } >@@ -330,7 +330,7 @@ class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient { > > class EmptyPluginInfoProvider final : public PluginInfoProvider { > void refreshPlugins() final { }; >- Vector<PluginInfo> pluginInfo(Page&, std::optional<Vector<SupportedPluginIdentifier>>&) final { return { }; } >+ Vector<PluginInfo> pluginInfo(Page&, WTF::Optional<Vector<SupportedPluginIdentifier>>&) final { return { }; } > Vector<PluginInfo> webVisiblePluginInfo(Page&, const URL&) final { return { }; } > }; > >diff --git a/Source/WebCore/loader/EmptyFrameLoaderClient.h b/Source/WebCore/loader/EmptyFrameLoaderClient.h >index 4ff8df13ed5516ea8f254e0dbb787b45869291e6..df45b8420670b4bd3176ae484c974a73f3c2c2e5 100644 >--- a/Source/WebCore/loader/EmptyFrameLoaderClient.h >+++ b/Source/WebCore/loader/EmptyFrameLoaderClient.h >@@ -32,8 +32,8 @@ class WEBCORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient { > > void frameLoaderDestroyed() override { } > >- std::optional<uint64_t> frameID() const override { return std::nullopt; } >- std::optional<uint64_t> pageID() const override { return std::nullopt; } >+ WTF::Optional<uint64_t> frameID() const override { return WTF::nullopt; } >+ WTF::Optional<uint64_t> pageID() const override { return WTF::nullopt; } > PAL::SessionID sessionID() const override; > > bool hasWebView() const final { return true; } // mainly for assertions >@@ -83,7 +83,7 @@ class WEBCORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient { > void dispatchWillClose() final { } > void dispatchDidStartProvisionalLoad(CompletionHandler<void()>&& completionHandler) final { completionHandler(); } > void dispatchDidReceiveTitle(const StringWithDirection&) final { } >- void dispatchDidCommitLoad(std::optional<HasInsecureContent>) final { } >+ void dispatchDidCommitLoad(WTF::Optional<HasInsecureContent>) final { } > void dispatchDidFailProvisionalLoad(const ResourceError&) final { } > void dispatchDidFailLoad(const ResourceError&) final { } > void dispatchDidFinishDocumentLoad() final { } >diff --git a/Source/WebCore/loader/FetchOptions.h b/Source/WebCore/loader/FetchOptions.h >index bff16acc83aafa191f7df98676f87fcb73dfa051..7ed2ae1d6dad04cfa24aaa249caa7dd0d5b41a86 100644 >--- a/Source/WebCore/loader/FetchOptions.h >+++ b/Source/WebCore/loader/FetchOptions.h >@@ -48,7 +48,7 @@ struct FetchOptions { > template<class Encoder> void encodePersistent(Encoder&) const; > template<class Decoder> static bool decodePersistent(Decoder&, FetchOptions&); > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<FetchOptions> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<FetchOptions> decode(Decoder&); > > Destination destination { Destination::EmptyString }; > Mode mode { Mode::NoCors }; >@@ -58,7 +58,7 @@ struct FetchOptions { > ReferrerPolicy referrerPolicy { ReferrerPolicy::EmptyString }; > bool keepAlive { false }; > String integrity; >- std::optional<DocumentIdentifier> clientIdentifier; >+ WTF::Optional<DocumentIdentifier> clientIdentifier; > }; > > inline FetchOptions::FetchOptions(Destination destination, Mode mode, Credentials credentials, Cache cache, Redirect redirect, ReferrerPolicy referrerPolicy, String&& integrity, bool keepAlive) >@@ -231,16 +231,16 @@ template<class Encoder> inline void FetchOptions::encode(Encoder& encoder) const > encoder << clientIdentifier; > } > >-template<class Decoder> inline std::optional<FetchOptions> FetchOptions::decode(Decoder& decoder) >+template<class Decoder> inline WTF::Optional<FetchOptions> FetchOptions::decode(Decoder& decoder) > { > FetchOptions options; > if (!decodePersistent(decoder, options)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<DocumentIdentifier>> clientIdentifier; >+ WTF::Optional<WTF::Optional<DocumentIdentifier>> clientIdentifier; > decoder >> clientIdentifier; > if (!clientIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > options.clientIdentifier = WTFMove(clientIdentifier.value()); > > return WTFMove(options); >diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp >index 55354791147e588a094eb6cbac1b427a17efddae..9d0e55f7687891e635bd00e2e7970829487599e3 100644 >--- a/Source/WebCore/loader/FrameLoader.cpp >+++ b/Source/WebCore/loader/FrameLoader.cpp >@@ -379,7 +379,7 @@ void FrameLoader::changeLocation(FrameLoadRequest&& request) > urlSelected(WTFMove(request), nullptr); > } > >-void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> openerPolicy, const AtomicString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo) >+void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, WTF::Optional<NewFrameOpenerPolicy> openerPolicy, const AtomicString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo) > { > auto* frame = lexicalFrameFromCommonVM(); > auto initiatedByMainFrame = frame && frame->isMainFrame() ? InitiatedByMainFrame::Yes : InitiatedByMainFrame::Unknown; >@@ -679,7 +679,7 @@ void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool > > void FrameLoader::receivedFirstData() > { >- dispatchDidCommitLoad(std::nullopt); >+ dispatchDidCommitLoad(WTF::nullopt); > dispatchDidClearWindowObjectsInAllWorlds(); > dispatchGlobalObjectAvailableInAllWorlds(); > >@@ -2003,7 +2003,7 @@ void FrameLoader::commitProvisionalLoad() > requestFromDelegate(mainResourceRequest, mainResourceIdentifier, mainResouceError); > notifier().dispatchDidReceiveResponse(cachedPage->documentLoader(), mainResourceIdentifier, cachedPage->documentLoader()->response()); > >- std::optional<HasInsecureContent> hasInsecureContent = cachedPage->cachedMainFrame()->hasInsecureContent(); >+ WTF::Optional<HasInsecureContent> hasInsecureContent = cachedPage->cachedMainFrame()->hasInsecureContent(); > > // FIXME: This API should be turned around so that we ground CachedPage into the Page. > cachedPage->restore(*m_frame.page()); >@@ -2277,7 +2277,7 @@ void FrameLoader::open(CachedFrameBase& cachedFrame) > ASSERT(view); > view->setWasScrolledByUser(false); > >- std::optional<IntRect> previousViewFrameRect = m_frame.view() ? m_frame.view()->frameRect() : std::optional<IntRect>(std::nullopt); >+ WTF::Optional<IntRect> previousViewFrameRect = m_frame.view() ? m_frame.view()->frameRect() : WTF::Optional<IntRect>(WTF::nullopt); > m_frame.setView(view); > > // Use the previous ScrollView's frame rect. >@@ -3840,7 +3840,7 @@ void FrameLoader::didChangeTitle(DocumentLoader* loader) > #endif > } > >-void FrameLoader::dispatchDidCommitLoad(std::optional<HasInsecureContent> initialHasInsecureContent) >+void FrameLoader::dispatchDidCommitLoad(WTF::Optional<HasInsecureContent> initialHasInsecureContent) > { > if (m_stateMachine.creatingInitialEmptyDocument()) > return; >@@ -3904,8 +3904,8 @@ void FrameLoader::forcePageTransitionIfNeeded() > > void FrameLoader::clearTestingOverrides() > { >- m_overrideCachePolicyForTesting = std::nullopt; >- m_overrideResourceLoadPriorityForTesting = std::nullopt; >+ m_overrideCachePolicyForTesting = WTF::nullopt; >+ m_overrideResourceLoadPriorityForTesting = WTF::nullopt; > m_isStrictRawResourceValidationPolicyDisabledForTesting = false; > } > >diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h >index 2d8295532da1ff34ff5e1ce1316642611a0fc01e..c627e9c21a0f847f6ddefad12b41bdd9c9623939 100644 >--- a/Source/WebCore/loader/FrameLoader.h >+++ b/Source/WebCore/loader/FrameLoader.h >@@ -124,7 +124,7 @@ public: > unsigned long loadResourceSynchronously(const ResourceRequest&, ClientCredentialPolicy, const FetchOptions&, const HTTPHeaderMap&, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>& data); > > void changeLocation(FrameLoadRequest&&); >- WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> = std::nullopt, const AtomicString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { }); >+ WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, WTF::Optional<NewFrameOpenerPolicy> = WTF::nullopt, const AtomicString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { }); > void submitForm(Ref<FormSubmission>&&); > > WEBCORE_EXPORT void reload(OptionSet<ReloadOption> = { }); >@@ -366,7 +366,7 @@ private: > > bool shouldReloadToHandleUnreachableURL(DocumentLoader&); > >- void dispatchDidCommitLoad(std::optional<HasInsecureContent> initialHasInsecureContent); >+ void dispatchDidCommitLoad(WTF::Optional<HasInsecureContent> initialHasInsecureContent); > > void urlSelected(FrameLoadRequest&&, Event*); > >@@ -469,8 +469,8 @@ private: > > RefPtr<FrameNetworkingContext> m_networkingContext; > >- std::optional<ResourceRequestCachePolicy> m_overrideCachePolicyForTesting; >- std::optional<ResourceLoadPriority> m_overrideResourceLoadPriorityForTesting; >+ WTF::Optional<ResourceRequestCachePolicy> m_overrideCachePolicyForTesting; >+ WTF::Optional<ResourceLoadPriority> m_overrideResourceLoadPriorityForTesting; > bool m_isStrictRawResourceValidationPolicyDisabledForTesting { false }; > bool m_currentLoadShouldBeTreatedAsContinuingLoad { false }; > >diff --git a/Source/WebCore/loader/FrameLoaderClient.h b/Source/WebCore/loader/FrameLoaderClient.h >index 688c6b2528c9d225c6bf8537c0127e67e2e77aba..18f9d6856985a0610407851f6da2b4687214b6b5 100644 >--- a/Source/WebCore/loader/FrameLoaderClient.h >+++ b/Source/WebCore/loader/FrameLoaderClient.h >@@ -125,8 +125,8 @@ public: > > virtual void makeRepresentation(DocumentLoader*) = 0; > >- virtual std::optional<uint64_t> pageID() const = 0; >- virtual std::optional<uint64_t> frameID() const = 0; >+ virtual WTF::Optional<uint64_t> pageID() const = 0; >+ virtual WTF::Optional<uint64_t> frameID() const = 0; > virtual PAL::SessionID sessionID() const = 0; > > #if PLATFORM(IOS_FAMILY) >@@ -175,7 +175,7 @@ public: > virtual void dispatchDidReceiveIcon() { } > virtual void dispatchDidStartProvisionalLoad(CompletionHandler<void()>&&) = 0; > virtual void dispatchDidReceiveTitle(const StringWithDirection&) = 0; >- virtual void dispatchDidCommitLoad(std::optional<HasInsecureContent>) = 0; >+ virtual void dispatchDidCommitLoad(WTF::Optional<HasInsecureContent>) = 0; > virtual void dispatchDidFailProvisionalLoad(const ResourceError&) = 0; > virtual void dispatchDidFailLoad(const ResourceError&) = 0; > virtual void dispatchDidFinishDocumentLoad() = 0; >@@ -370,7 +370,7 @@ public: > virtual void didCreateWindow(DOMWindow&) { } > > #if ENABLE(APPLICATION_MANIFEST) >- virtual void finishedLoadingApplicationManifest(uint64_t, const std::optional<ApplicationManifest>&) { } >+ virtual void finishedLoadingApplicationManifest(uint64_t, const WTF::Optional<ApplicationManifest>&) { } > #endif > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >diff --git a/Source/WebCore/loader/HTTPHeaderField.cpp b/Source/WebCore/loader/HTTPHeaderField.cpp >index 4fe16f130b8d329d3f83f52540437f11eb6a00c5..3fcce31d59e2d260aa30d8d5d261d30e35b47b1c 100644 >--- a/Source/WebCore/loader/HTTPHeaderField.cpp >+++ b/Source/WebCore/loader/HTTPHeaderField.cpp >@@ -202,12 +202,12 @@ static bool isValidValue(StringView value) > > } // namespace RFC7230 > >-std::optional<HTTPHeaderField> HTTPHeaderField::create(String&& unparsedName, String&& unparsedValue) >+WTF::Optional<HTTPHeaderField> HTTPHeaderField::create(String&& unparsedName, String&& unparsedValue) > { > StringView strippedName = StringView(unparsedName).stripLeadingAndTrailingMatchedCharacters(RFC7230::isWhitespace); > StringView strippedValue = StringView(unparsedValue).stripLeadingAndTrailingMatchedCharacters(RFC7230::isWhitespace); > if (!RFC7230::isValidName(strippedName) || !RFC7230::isValidValue(strippedValue)) >- return std::nullopt; >+ return WTF::nullopt; > > String name = strippedName.length() == unparsedName.length() ? WTFMove(unparsedName) : strippedName.toString(); > String value = strippedValue.length() == unparsedValue.length() ? WTFMove(unparsedValue) : strippedValue.toString(); >diff --git a/Source/WebCore/loader/HTTPHeaderField.h b/Source/WebCore/loader/HTTPHeaderField.h >index 7ce12230fdeee053507be2ef399a146d65c063f1..72088c791dd4fe472685f65536f45b24aca77c59 100644 >--- a/Source/WebCore/loader/HTTPHeaderField.h >+++ b/Source/WebCore/loader/HTTPHeaderField.h >@@ -31,13 +31,13 @@ namespace WebCore { > > class WEBCORE_EXPORT HTTPHeaderField { > public: >- static std::optional<HTTPHeaderField> create(String&& name, String&& value); >+ static WTF::Optional<HTTPHeaderField> create(String&& name, String&& value); > > const String& name() const { return m_name; } > const String& value() const { return m_value; } > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<HTTPHeaderField> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<HTTPHeaderField> decode(Decoder&); > > private: > HTTPHeaderField(String&& name, String&& value) >@@ -56,17 +56,17 @@ void HTTPHeaderField::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<HTTPHeaderField> HTTPHeaderField::decode(Decoder& decoder) >+WTF::Optional<HTTPHeaderField> HTTPHeaderField::decode(Decoder& decoder) > { >- std::optional<String> name; >+ WTF::Optional<String> name; > decoder >> name; > if (!name) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> value; >+ WTF::Optional<String> value; > decoder >> value; > if (!value) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*name), WTFMove(*value) }}; > } >diff --git a/Source/WebCore/loader/LinkHeader.cpp b/Source/WebCore/loader/LinkHeader.cpp >index bc0ff6420d1621d924e24b6731634c79b0f7456e..c642387b43d139a1cd1e13f5dddd6262ae31363c 100644 >--- a/Source/WebCore/loader/LinkHeader.cpp >+++ b/Source/WebCore/loader/LinkHeader.cpp >@@ -86,12 +86,12 @@ static bool isExtensionParameter(LinkHeader::LinkParameterName name) > // ^ ^ > // position end > template <typename CharacterType> >-static std::optional<String> findURLBoundaries(CharacterType*& position, CharacterType* const end) >+static WTF::Optional<String> findURLBoundaries(CharacterType*& position, CharacterType* const end) > { > ASSERT(position <= end); > skipWhile<CharacterType, isSpaceOrTab>(position, end); > if (!skipExactly<CharacterType>(position, end, '<')) >- return std::nullopt; >+ return WTF::nullopt; > skipWhile<CharacterType, isSpaceOrTab>(position, end); > > CharacterType* urlStart = position; >@@ -99,7 +99,7 @@ static std::optional<String> findURLBoundaries(CharacterType*& position, Charact > CharacterType* urlEnd = position; > skipUntil<CharacterType>(position, end, '>'); > if (!skipExactly<CharacterType>(position, end, '>')) >- return std::nullopt; >+ return WTF::nullopt; > > return String(urlStart, urlEnd - urlStart); > } >@@ -309,7 +309,7 @@ LinkHeader::LinkHeader(CharacterType*& position, CharacterType* const end) > { > ASSERT(position <= end); > auto urlResult = findURLBoundaries(position, end); >- if (urlResult == std::nullopt) { >+ if (urlResult == WTF::nullopt) { > m_isValid = false; > findNextHeader(position, end); > return; >diff --git a/Source/WebCore/loader/LinkLoader.cpp b/Source/WebCore/loader/LinkLoader.cpp >index 62be7b92a141bedc2817d03135264a615f5656ce..4329896f3c39db420ac687c12d24f6c32375ea49 100644 >--- a/Source/WebCore/loader/LinkLoader.cpp >+++ b/Source/WebCore/loader/LinkLoader.cpp >@@ -112,7 +112,7 @@ void LinkLoader::loadLinksFromHeader(const String& headerValue, const URL& baseU > } > } > >-std::optional<CachedResource::Type> LinkLoader::resourceTypeFromAsAttribute(const String& as) >+WTF::Optional<CachedResource::Type> LinkLoader::resourceTypeFromAsAttribute(const String& as) > { > if (equalLettersIgnoringASCIICase(as, "fetch")) > return CachedResource::Type::RawResource; >@@ -130,7 +130,7 @@ std::optional<CachedResource::Type> LinkLoader::resourceTypeFromAsAttribute(cons > if (equalLettersIgnoringASCIICase(as, "track")) > return CachedResource::Type::TextTrackResource; > #endif >- return std::nullopt; >+ return WTF::nullopt; > } > > static std::unique_ptr<LinkPreloadResourceClient> createLinkPreloadResourceClient(CachedResource& resource, LinkLoader& loader) >@@ -269,7 +269,7 @@ void LinkLoader::prefetchIfNeeded(const LinkRelAttribute& relAttribute, const UR > return; > > ASSERT(RuntimeEnabledFeatures::sharedFeatures().linkPrefetchEnabled()); >- std::optional<ResourceLoadPriority> priority; >+ WTF::Optional<ResourceLoadPriority> priority; > CachedResource::Type type = CachedResource::Type::LinkPrefetch; > > if (m_cachedLinkResource) { >diff --git a/Source/WebCore/loader/LinkLoader.h b/Source/WebCore/loader/LinkLoader.h >index 54d722310d8dff921f1e9de0545bd9e1c620947c..bbb828392b09262e6917051024e840936f36932c 100644 >--- a/Source/WebCore/loader/LinkLoader.h >+++ b/Source/WebCore/loader/LinkLoader.h >@@ -51,7 +51,7 @@ public: > virtual ~LinkLoader(); > > bool loadLink(const LinkRelAttribute&, const URL&, const String& as, const String& media, const String& type, const String& crossOrigin, Document&); >- static std::optional<CachedResource::Type> resourceTypeFromAsAttribute(const String& as); >+ static WTF::Optional<CachedResource::Type> resourceTypeFromAsAttribute(const String& as); > > enum class MediaAttributeCheck { MediaAttributeEmpty, MediaAttributeNotEmpty, SkipMediaAttributeCheck }; > static void loadLinksFromHeader(const String& headerValue, const URL& baseURL, Document&, MediaAttributeCheck); >diff --git a/Source/WebCore/loader/NavigationAction.cpp b/Source/WebCore/loader/NavigationAction.cpp >index e6a490b1d6daaced5682588d0c80f7d2df98006c..abc9919964c10492818e6551a95e335c93c5f237 100644 >--- a/Source/WebCore/loader/NavigationAction.cpp >+++ b/Source/WebCore/loader/NavigationAction.cpp >@@ -77,20 +77,20 @@ static bool shouldTreatAsSameOriginNavigation(const Document& document, const UR > return url.protocolIsAbout() || url.protocolIsData() || (url.protocolIsBlob() && document.securityOrigin().canRequest(url)); > } > >-static std::optional<NavigationAction::UIEventWithKeyStateData> keyStateDataForFirstEventWithKeyState(Event* event) >+static WTF::Optional<NavigationAction::UIEventWithKeyStateData> keyStateDataForFirstEventWithKeyState(Event* event) > { > if (UIEventWithKeyState* uiEvent = findEventWithKeyState(event)) > return NavigationAction::UIEventWithKeyStateData { *uiEvent }; >- return std::nullopt; >+ return WTF::nullopt; > } > >-static std::optional<NavigationAction::MouseEventData> mouseEventDataForFirstMouseEvent(Event* event) >+static WTF::Optional<NavigationAction::MouseEventData> mouseEventDataForFirstMouseEvent(Event* event) > { > for (Event* e = event; e; e = e->underlyingEvent()) { > if (e->isMouseEvent()) > return NavigationAction::MouseEventData { static_cast<const MouseEvent&>(*e) }; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > NavigationAction::NavigationAction(Document& requester, const ResourceRequest& resourceRequest, InitiatedByMainFrame initiatedByMainFrame, NavigationType type, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, Event* event, const AtomicString& downloadAttribute) >diff --git a/Source/WebCore/loader/NavigationAction.h b/Source/WebCore/loader/NavigationAction.h >index 1e636ac74b50d90fd98ace4066246dce5dd24f11..88b1997a15a5eca74e6eae090201b127e9a6ea53 100644 >--- a/Source/WebCore/loader/NavigationAction.h >+++ b/Source/WebCore/loader/NavigationAction.h >@@ -75,7 +75,7 @@ public: > RefPtr<SecurityOrigin> m_origin; > PageIDAndFrameIDPair m_pageIDAndFrameIDPair; > }; >- const std::optional<Requester>& requester() const { return m_requester; } >+ const WTF::Optional<Requester>& requester() const { return m_requester; } > > struct UIEventWithKeyStateData { > UIEventWithKeyStateData(const UIEventWithKeyState&); >@@ -95,8 +95,8 @@ public: > unsigned short syntheticClickType; > bool buttonDown; > }; >- const std::optional<UIEventWithKeyStateData>& keyStateEventData() const { return m_keyStateEventData; } >- const std::optional<MouseEventData>& mouseEventData() const { return m_mouseEventData; } >+ const WTF::Optional<UIEventWithKeyStateData>& keyStateEventData() const { return m_keyStateEventData; } >+ const WTF::Optional<MouseEventData>& mouseEventData() const { return m_mouseEventData; } > > NavigationAction copyWithShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy) const; > >@@ -125,7 +125,7 @@ public: > void setOpenedByDOMWithOpener() { m_openedByDOMWithOpener = true; } > > void setTargetBackForwardItem(HistoryItem&); >- const std::optional<BackForwardItemIdentifier>& targetBackForwardItemIdentifier() const { return m_targetBackForwardItemIdentifier; } >+ const WTF::Optional<BackForwardItemIdentifier>& targetBackForwardItemIdentifier() const { return m_targetBackForwardItemIdentifier; } > > LockHistory lockHistory() const { return m_lockHistory; } > void setLockHistory(LockHistory lockHistory) { m_lockHistory = lockHistory; } >@@ -136,19 +136,19 @@ public: > private: > // Do not add a strong reference to the originating document or a subobject that holds the > // originating document. See comment above the class for more details. >- std::optional<Requester> m_requester; >+ WTF::Optional<Requester> m_requester; > ResourceRequest m_resourceRequest; > NavigationType m_type; > ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy; > InitiatedByMainFrame m_initiatedByMainFrame; >- std::optional<UIEventWithKeyStateData> m_keyStateEventData; >- std::optional<MouseEventData> m_mouseEventData; >+ WTF::Optional<UIEventWithKeyStateData> m_keyStateEventData; >+ WTF::Optional<MouseEventData> m_mouseEventData; > RefPtr<UserGestureToken> m_userGestureToken { UserGestureIndicator::currentUserGesture() }; > AtomicString m_downloadAttribute; > bool m_treatAsSameOriginNavigation; > bool m_hasOpenedFrames { false }; > bool m_openedByDOMWithOpener { false }; >- std::optional<BackForwardItemIdentifier> m_targetBackForwardItemIdentifier; >+ WTF::Optional<BackForwardItemIdentifier> m_targetBackForwardItemIdentifier; > LockHistory m_lockHistory { LockHistory::No }; > LockBackForwardList m_lockBackForwardList { LockBackForwardList::No }; > }; >diff --git a/Source/WebCore/loader/ResourceCryptographicDigest.cpp b/Source/WebCore/loader/ResourceCryptographicDigest.cpp >index 158323afa4604c60ed573f51b928799aa326becb..a3133cd5380185629182d432dc719c3de9cb189f 100644 >--- a/Source/WebCore/loader/ResourceCryptographicDigest.cpp >+++ b/Source/WebCore/loader/ResourceCryptographicDigest.cpp >@@ -55,17 +55,17 @@ static bool parseHashAlgorithmAdvancingPosition(const CharacterType*& position, > } > > template<typename CharacterType> >-static std::optional<ResourceCryptographicDigest> parseCryptographicDigestImpl(const CharacterType*& position, const CharacterType* end) >+static WTF::Optional<ResourceCryptographicDigest> parseCryptographicDigestImpl(const CharacterType*& position, const CharacterType* end) > { > if (position == end) >- return std::nullopt; >+ return WTF::nullopt; > > ResourceCryptographicDigest::Algorithm algorithm; > if (!parseHashAlgorithmAdvancingPosition(position, end, algorithm)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!skipExactly<CharacterType>(position, end, '-')) >- return std::nullopt; >+ return WTF::nullopt; > > const CharacterType* beginHashValue = position; > skipWhile<CharacterType, isBase64OrBase64URLCharacter>(position, end); >@@ -73,40 +73,40 @@ static std::optional<ResourceCryptographicDigest> parseCryptographicDigestImpl(c > skipExactly<CharacterType>(position, end, '='); > > if (position == beginHashValue) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<uint8_t> digest; > StringView hashValue(beginHashValue, position - beginHashValue); > if (!base64Decode(hashValue, digest, Base64ValidatePadding)) { > if (!base64URLDecode(hashValue, digest)) >- return std::nullopt; >+ return WTF::nullopt; > } > > return ResourceCryptographicDigest { algorithm, WTFMove(digest) }; > } > >-std::optional<ResourceCryptographicDigest> parseCryptographicDigest(const UChar*& begin, const UChar* end) >+WTF::Optional<ResourceCryptographicDigest> parseCryptographicDigest(const UChar*& begin, const UChar* end) > { > return parseCryptographicDigestImpl(begin, end); > } > >-std::optional<ResourceCryptographicDigest> parseCryptographicDigest(const LChar*& begin, const LChar* end) >+WTF::Optional<ResourceCryptographicDigest> parseCryptographicDigest(const LChar*& begin, const LChar* end) > { > return parseCryptographicDigestImpl(begin, end); > } > > template<typename CharacterType> >-static std::optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigestImpl(const CharacterType*& position, const CharacterType* end) >+static WTF::Optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigestImpl(const CharacterType*& position, const CharacterType* end) > { > if (position == end) >- return std::nullopt; >+ return WTF::nullopt; > > EncodedResourceCryptographicDigest::Algorithm algorithm; > if (!parseHashAlgorithmAdvancingPosition(position, end, algorithm)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!skipExactly<CharacterType>(position, end, '-')) >- return std::nullopt; >+ return WTF::nullopt; > > const CharacterType* beginHashValue = position; > skipWhile<CharacterType, isBase64OrBase64URLCharacter>(position, end); >@@ -114,27 +114,27 @@ static std::optional<EncodedResourceCryptographicDigest> parseEncodedCryptograph > skipExactly<CharacterType>(position, end, '='); > > if (position == beginHashValue) >- return std::nullopt; >+ return WTF::nullopt; > > return EncodedResourceCryptographicDigest { algorithm, String(beginHashValue, position - beginHashValue) }; > } > >-std::optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const UChar*& begin, const UChar* end) >+WTF::Optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const UChar*& begin, const UChar* end) > { > return parseEncodedCryptographicDigestImpl(begin, end); > } > >-std::optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const LChar*& begin, const LChar* end) >+WTF::Optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const LChar*& begin, const LChar* end) > { > return parseEncodedCryptographicDigestImpl(begin, end); > } > >-std::optional<ResourceCryptographicDigest> decodeEncodedResourceCryptographicDigest(const EncodedResourceCryptographicDigest& encodedDigest) >+WTF::Optional<ResourceCryptographicDigest> decodeEncodedResourceCryptographicDigest(const EncodedResourceCryptographicDigest& encodedDigest) > { > Vector<uint8_t> digest; > if (!base64Decode(encodedDigest.digest, digest, Base64ValidatePadding)) { > if (!base64URLDecode(encodedDigest.digest, digest)) >- return std::nullopt; >+ return WTF::nullopt; > } > > return ResourceCryptographicDigest { encodedDigest.algorithm, WTFMove(digest) }; >diff --git a/Source/WebCore/loader/ResourceCryptographicDigest.h b/Source/WebCore/loader/ResourceCryptographicDigest.h >index e4a82ae74658156c776b57fef1a8fd97d4491ba4..df79d53a20e5012120d59798d023317301caf7e3 100644 >--- a/Source/WebCore/loader/ResourceCryptographicDigest.h >+++ b/Source/WebCore/loader/ResourceCryptographicDigest.h >@@ -68,13 +68,13 @@ struct EncodedResourceCryptographicDigest { > String digest; > }; > >-std::optional<ResourceCryptographicDigest> parseCryptographicDigest(const UChar*& begin, const UChar* end); >-std::optional<ResourceCryptographicDigest> parseCryptographicDigest(const LChar*& begin, const LChar* end); >+WTF::Optional<ResourceCryptographicDigest> parseCryptographicDigest(const UChar*& begin, const UChar* end); >+WTF::Optional<ResourceCryptographicDigest> parseCryptographicDigest(const LChar*& begin, const LChar* end); > >-std::optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const UChar*& begin, const UChar* end); >-std::optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const LChar*& begin, const LChar* end); >+WTF::Optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const UChar*& begin, const UChar* end); >+WTF::Optional<EncodedResourceCryptographicDigest> parseEncodedCryptographicDigest(const LChar*& begin, const LChar* end); > >-std::optional<ResourceCryptographicDigest> decodeEncodedResourceCryptographicDigest(const EncodedResourceCryptographicDigest&); >+WTF::Optional<ResourceCryptographicDigest> decodeEncodedResourceCryptographicDigest(const EncodedResourceCryptographicDigest&); > > ResourceCryptographicDigest cryptographicDigestForBytes(ResourceCryptographicDigest::Algorithm, const void* bytes, size_t length); > >diff --git a/Source/WebCore/loader/ResourceLoaderOptions.h b/Source/WebCore/loader/ResourceLoaderOptions.h >index fa79be2072cb5bad24f01a8d62badfe03eb7de2f..eef64be584d3357bb2913ca2c21f85d8c224bfd7 100644 >--- a/Source/WebCore/loader/ResourceLoaderOptions.h >+++ b/Source/WebCore/loader/ResourceLoaderOptions.h >@@ -149,10 +149,10 @@ struct ResourceLoaderOptions : public FetchOptions { > } > > #if ENABLE(SERVICE_WORKER) >- std::optional<ServiceWorkerRegistrationIdentifier> serviceWorkerRegistrationIdentifier; >+ WTF::Optional<ServiceWorkerRegistrationIdentifier> serviceWorkerRegistrationIdentifier; > #endif > HashSet<HTTPHeaderName, WTF::IntHash<HTTPHeaderName>, WTF::StrongEnumHashTraits<HTTPHeaderName>> httpHeadersToKeep; >- std::optional<ContentSecurityPolicyResponseHeaders> cspResponseHeaders; >+ WTF::Optional<ContentSecurityPolicyResponseHeaders> cspResponseHeaders; > unsigned maxRedirectCount { 20 }; > > SendCallbackPolicy sendLoadCallbacks { SendCallbackPolicy::DoNotSendCallbacks }; >diff --git a/Source/WebCore/loader/SubresourceIntegrity.cpp b/Source/WebCore/loader/SubresourceIntegrity.cpp >index cb97072bef6fc3b2378bc90b83c95ef5dbea1396..6da03fcb4656a9b69ed5d4e4fceba739537c88d7 100644 >--- a/Source/WebCore/loader/SubresourceIntegrity.cpp >+++ b/Source/WebCore/loader/SubresourceIntegrity.cpp >@@ -45,14 +45,14 @@ static bool isVCHAR(CharacterType c) > template<typename CharacterType> > struct IntegrityMetadataParser { > public: >- IntegrityMetadataParser(std::optional<Vector<EncodedResourceCryptographicDigest>>& digests) >+ IntegrityMetadataParser(WTF::Optional<Vector<EncodedResourceCryptographicDigest>>& digests) > : m_digests(digests) > { > } > > bool operator()(const CharacterType*& position, const CharacterType* end) > { >- // Initialize hashes to be something other std::nullopt, to indicate >+ // Initialize hashes to be something other WTF::nullopt, to indicate > // that at least one token was seen, and thus setting the empty flag > // from section 3.3.3 Parse metadata, to false. > if (!m_digests) >@@ -78,7 +78,7 @@ public: > } > > private: >- std::optional<Vector<EncodedResourceCryptographicDigest>>& m_digests; >+ WTF::Optional<Vector<EncodedResourceCryptographicDigest>>& m_digests; > }; > > } >@@ -98,12 +98,12 @@ static inline void splitOnSpaces(const CharacterType* begin, const CharacterType > } > } > >-static std::optional<Vector<EncodedResourceCryptographicDigest>> parseIntegrityMetadata(const String& integrityMetadata) >+static WTF::Optional<Vector<EncodedResourceCryptographicDigest>> parseIntegrityMetadata(const String& integrityMetadata) > { > if (integrityMetadata.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<EncodedResourceCryptographicDigest>> result; >+ WTF::Optional<Vector<EncodedResourceCryptographicDigest>> result; > > const StringImpl& stringImpl = *integrityMetadata.impl(); > if (stringImpl.is8Bit()) >@@ -120,10 +120,10 @@ static bool isResponseEligible(const CachedResource& resource) > return resource.isCORSSameOrigin(); > } > >-static std::optional<EncodedResourceCryptographicDigest::Algorithm> prioritizedHashFunction(EncodedResourceCryptographicDigest::Algorithm a, EncodedResourceCryptographicDigest::Algorithm b) >+static WTF::Optional<EncodedResourceCryptographicDigest::Algorithm> prioritizedHashFunction(EncodedResourceCryptographicDigest::Algorithm a, EncodedResourceCryptographicDigest::Algorithm b) > { > if (a == b) >- return std::nullopt; >+ return WTF::nullopt; > return (a > b) ? a : b; > } > >diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp >index 5fdfda93b17129b6f8cf521618289ac7f469e97a..7b98e8b57e436a343e6eeaddeda4ddf366d3c51a 100644 >--- a/Source/WebCore/loader/SubresourceLoader.cpp >+++ b/Source/WebCore/loader/SubresourceLoader.cpp >@@ -377,7 +377,7 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response, Com > m_loadingMultipartContent = true; > > // We don't count multiParts in a CachedResourceLoader's request count >- m_requestCountTracker = std::nullopt; >+ m_requestCountTracker = WTF::nullopt; > if (!m_resource->isImage()) { > cancel(); > return; >@@ -726,7 +726,7 @@ void SubresourceLoader::notifyDone(LoadCompletionType type) > if (reachedTerminalState()) > return; > >- m_requestCountTracker = std::nullopt; >+ m_requestCountTracker = WTF::nullopt; > bool shouldPerformPostLoadActions = true; > #if PLATFORM(IOS_FAMILY) > if (m_state == CancelledWhileInitializing) >diff --git a/Source/WebCore/loader/SubresourceLoader.h b/Source/WebCore/loader/SubresourceLoader.h >index ab2f685e993beb28ac166a93f7e51382294a96cf..ff63db43091d7b7af6423af825dbd5ed3a1011bc 100644 >--- a/Source/WebCore/loader/SubresourceLoader.h >+++ b/Source/WebCore/loader/SubresourceLoader.h >@@ -128,7 +128,7 @@ private: > #endif > CachedResource* m_resource; > SubresourceLoaderState m_state; >- std::optional<RequestCountTracker> m_requestCountTracker; >+ WTF::Optional<RequestCountTracker> m_requestCountTracker; > RefPtr<SecurityOrigin> m_origin; > CompletionHandler<void()> m_policyForResponseCompletionHandler; > unsigned m_redirectCount { 0 }; >diff --git a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp >index 040d8b7ad6a091eb1c9e435b5e0c3401f93ae252..c21b577b1c840a160467797d30662a10bc706986 100644 >--- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp >+++ b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp >@@ -1308,18 +1308,18 @@ bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer& dat > return true; > } > >-std::optional<Vector<URL>> ApplicationCacheStorage::manifestURLs() >+WTF::Optional<Vector<URL>> ApplicationCacheStorage::manifestURLs() > { > SQLiteTransactionInProgressAutoCounter transactionCounter; > > openDatabase(false); > if (!m_database.isOpen()) >- return std::nullopt; >+ return WTF::nullopt; > > SQLiteStatement selectURLs(m_database, "SELECT manifestURL FROM CacheGroups"); > > if (selectURLs.prepare() != SQLITE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<URL> urls; > while (selectURLs.step() == SQLITE_ROW) >diff --git a/Source/WebCore/loader/appcache/ApplicationCacheStorage.h b/Source/WebCore/loader/appcache/ApplicationCacheStorage.h >index 68c361e52b42d91d361e9cc8290ef35c350152b5..20dfc0e425cb1fcc42e0982518de4e78a5d903f8 100644 >--- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.h >+++ b/Source/WebCore/loader/appcache/ApplicationCacheStorage.h >@@ -106,7 +106,7 @@ private: > > RefPtr<ApplicationCache> loadCache(unsigned storageID); > ApplicationCacheGroup* loadCacheGroup(const URL& manifestURL); >- std::optional<Vector<URL>> manifestURLs(); >+ WTF::Optional<Vector<URL>> manifestURLs(); > ApplicationCacheGroup* findInMemoryCacheGroup(const URL& manifestURL) const; > bool deleteCacheGroup(const String& manifestURL); > void vacuumDatabaseFile(); >diff --git a/Source/WebCore/loader/cache/CachedApplicationManifest.cpp b/Source/WebCore/loader/cache/CachedApplicationManifest.cpp >index 860171da30b14d49f134a95616c2b2f4e39dd94f..a4bb9a9a8a2b08d0334cf5080f32b5bedbfc50fa 100644 >--- a/Source/WebCore/loader/cache/CachedApplicationManifest.cpp >+++ b/Source/WebCore/loader/cache/CachedApplicationManifest.cpp >@@ -59,10 +59,10 @@ String CachedApplicationManifest::encoding() const > return m_decoder->encoding().name(); > } > >-std::optional<ApplicationManifest> CachedApplicationManifest::process(const URL& manifestURL, const URL& documentURL, RefPtr<ScriptExecutionContext> scriptExecutionContext) >+WTF::Optional<ApplicationManifest> CachedApplicationManifest::process(const URL& manifestURL, const URL& documentURL, RefPtr<ScriptExecutionContext> scriptExecutionContext) > { > if (!m_text) >- return std::nullopt; >+ return WTF::nullopt; > if (scriptExecutionContext) > return ApplicationManifestParser::parse(*scriptExecutionContext, *m_text, manifestURL, documentURL); > return ApplicationManifestParser::parse(*m_text, manifestURL, documentURL); >diff --git a/Source/WebCore/loader/cache/CachedApplicationManifest.h b/Source/WebCore/loader/cache/CachedApplicationManifest.h >index 95458351d3bae794f1953ab3ff7a4be13f879e04..2ac375404820dc73d8e2038b5b224f4060dc083c 100644 >--- a/Source/WebCore/loader/cache/CachedApplicationManifest.h >+++ b/Source/WebCore/loader/cache/CachedApplicationManifest.h >@@ -40,7 +40,7 @@ class CachedApplicationManifest final : public CachedResource { > public: > CachedApplicationManifest(CachedResourceRequest&&, PAL::SessionID); > >- std::optional<struct ApplicationManifest> process(const URL& manifestURL, const URL& documentURL, RefPtr<ScriptExecutionContext> = nullptr); >+ WTF::Optional<struct ApplicationManifest> process(const URL& manifestURL, const URL& documentURL, RefPtr<ScriptExecutionContext> = nullptr); > > private: > void finishLoading(SharedBuffer*) override; >@@ -49,7 +49,7 @@ private: > String encoding() const override; > > Ref<TextResourceDecoder> m_decoder; >- std::optional<String> m_text; >+ WTF::Optional<String> m_text; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/loader/cache/CachedRawResource.cpp b/Source/WebCore/loader/cache/CachedRawResource.cpp >index 32540d08c5bc2f755b4097552764d76df0853f6f..03bba47914a745493157c3b12af1ca09e549e093 100644 >--- a/Source/WebCore/loader/cache/CachedRawResource.cpp >+++ b/Source/WebCore/loader/cache/CachedRawResource.cpp >@@ -46,11 +46,11 @@ CachedRawResource::CachedRawResource(CachedResourceRequest&& request, Type type, > ASSERT(isMainOrMediaOrIconOrRawResource()); > } > >-std::optional<SharedBufferDataView> CachedRawResource::calculateIncrementalDataChunk(const SharedBuffer* data) const >+WTF::Optional<SharedBufferDataView> CachedRawResource::calculateIncrementalDataChunk(const SharedBuffer* data) const > { > size_t previousDataLength = encodedSize(); > if (!data || data->size() <= previousDataLength) >- return std::nullopt; >+ return WTF::nullopt; > return data->getSomeData(previousDataLength); > } > >@@ -82,7 +82,7 @@ void CachedRawResource::updateBuffer(SharedBuffer& data) > CachedResource::updateBuffer(data); > > if (m_delayedFinishLoading) { >- auto delayedFinishLoading = std::exchange(m_delayedFinishLoading, std::nullopt); >+ auto delayedFinishLoading = std::exchange(m_delayedFinishLoading, WTF::nullopt); > finishLoading(delayedFinishLoading->buffer.get()); > } > } >@@ -99,7 +99,7 @@ void CachedRawResource::finishLoading(SharedBuffer* data) > if (m_inIncrementalDataNotify) { > // We may get here synchronously from updateBuffer() if the callback there ends up spinning a runloop. > // In that case delay the call. >- m_delayedFinishLoading = std::make_optional(DelayedFinishLoading { data }); >+ m_delayedFinishLoading = WTF::makeOptional(DelayedFinishLoading { data }); > return; > }; > CachedResourceHandle<CachedRawResource> protectedThis(this); >diff --git a/Source/WebCore/loader/cache/CachedRawResource.h b/Source/WebCore/loader/cache/CachedRawResource.h >index cf29c30f2a90cbbb5281b4ac9167ebf59c34a1cf..a10c545d7e678944b2509acd8a18ecc0ab1a419b 100644 >--- a/Source/WebCore/loader/cache/CachedRawResource.h >+++ b/Source/WebCore/loader/cache/CachedRawResource.h >@@ -66,7 +66,7 @@ private: > void switchClientsToRevalidatedResource() override; > bool mayTryReplaceEncodedData() const override { return m_allowEncodedDataReplacement; } > >- std::optional<SharedBufferDataView> calculateIncrementalDataChunk(const SharedBuffer*) const; >+ WTF::Optional<SharedBufferDataView> calculateIncrementalDataChunk(const SharedBuffer*) const; > void notifyClientsDataWasReceived(const char* data, unsigned length); > > unsigned long m_identifier; >@@ -90,7 +90,7 @@ private: > struct DelayedFinishLoading { > RefPtr<SharedBuffer> buffer; > }; >- std::optional<DelayedFinishLoading> m_delayedFinishLoading; >+ WTF::Optional<DelayedFinishLoading> m_delayedFinishLoading; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp >index 8f5dd206174ff486f412cedf812a980dd63dc52d..ad72abb9e976adcdb4e123b74e85f32c2b403cfe 100644 >--- a/Source/WebCore/loader/cache/CachedResource.cpp >+++ b/Source/WebCore/loader/cache/CachedResource.cpp >@@ -873,7 +873,7 @@ bool CachedResource::areAllClientsXMLHttpRequests() const > return true; > } > >-void CachedResource::setLoadPriority(const std::optional<ResourceLoadPriority>& loadPriority) >+void CachedResource::setLoadPriority(const WTF::Optional<ResourceLoadPriority>& loadPriority) > { > if (loadPriority) > m_loadPriority = loadPriority.value(); >diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h >index b3a67ceecf6330d033bd97aca6952c54201e2a9d..858478afa81f432099a880f1b279ebb1407e7949 100644 >--- a/Source/WebCore/loader/cache/CachedResource.h >+++ b/Source/WebCore/loader/cache/CachedResource.h >@@ -123,7 +123,7 @@ public: > static bool shouldUsePingLoad(Type type) { return type == Type::Beacon; } > > ResourceLoadPriority loadPriority() const { return m_loadPriority; } >- void setLoadPriority(const std::optional<ResourceLoadPriority>&); >+ void setLoadPriority(const WTF::Optional<ResourceLoadPriority>&); > > WEBCORE_EXPORT void addClient(CachedResourceClient&); > WEBCORE_EXPORT void removeClient(CachedResourceClient&); >diff --git a/Source/WebCore/loader/cache/CachedResourceRequest.cpp b/Source/WebCore/loader/cache/CachedResourceRequest.cpp >index 720ead197ec99f353382751f1fb5cfde59c8ffe7..1ecf3bfae8814ab99e4a285db4219f15feea3b0d 100644 >--- a/Source/WebCore/loader/cache/CachedResourceRequest.cpp >+++ b/Source/WebCore/loader/cache/CachedResourceRequest.cpp >@@ -40,7 +40,7 @@ > > namespace WebCore { > >-CachedResourceRequest::CachedResourceRequest(ResourceRequest&& resourceRequest, const ResourceLoaderOptions& options, std::optional<ResourceLoadPriority> priority, String&& charset) >+CachedResourceRequest::CachedResourceRequest(ResourceRequest&& resourceRequest, const ResourceLoaderOptions& options, WTF::Optional<ResourceLoadPriority> priority, String&& charset) > : m_resourceRequest(WTFMove(resourceRequest)) > , m_charset(WTFMove(charset)) > , m_options(options) >@@ -300,7 +300,7 @@ void CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeed > m_options.serviceWorkerRegistrationIdentifier = identifier; > } > >-void CachedResourceRequest::setNavigationServiceWorkerRegistrationData(const std::optional<ServiceWorkerRegistrationData>& data) >+void CachedResourceRequest::setNavigationServiceWorkerRegistrationData(const WTF::Optional<ServiceWorkerRegistrationData>& data) > { > if (!data || !data->activeWorker) { > m_options.serviceWorkersMode = ServiceWorkersMode::None; >diff --git a/Source/WebCore/loader/cache/CachedResourceRequest.h b/Source/WebCore/loader/cache/CachedResourceRequest.h >index 89cca69bc71ef42e8fb6d542d06e0437844e5006..40a75de0c00c96c63271ba0011759ed81e4451a0 100644 >--- a/Source/WebCore/loader/cache/CachedResourceRequest.h >+++ b/Source/WebCore/loader/cache/CachedResourceRequest.h >@@ -50,7 +50,7 @@ bool isRequestCrossOrigin(SecurityOrigin*, const URL& requestURL, const Resource > > class CachedResourceRequest { > public: >- CachedResourceRequest(ResourceRequest&&, const ResourceLoaderOptions&, std::optional<ResourceLoadPriority> = std::nullopt, String&& charset = String()); >+ CachedResourceRequest(ResourceRequest&&, const ResourceLoaderOptions&, WTF::Optional<ResourceLoadPriority> = WTF::nullopt, String&& charset = String()); > > ResourceRequest&& releaseResourceRequest() { return WTFMove(m_resourceRequest); } > const ResourceRequest& resourceRequest() const { return m_resourceRequest; } >@@ -62,8 +62,8 @@ public: > const ResourceLoaderOptions& options() const { return m_options; } > void setOptions(const ResourceLoaderOptions& options) { m_options = options; } > >- const std::optional<ResourceLoadPriority>& priority() const { return m_priority; } >- void setPriority(std::optional<ResourceLoadPriority>&& priority) { m_priority = WTFMove(priority); } >+ const WTF::Optional<ResourceLoadPriority>& priority() const { return m_priority; } >+ void setPriority(WTF::Optional<ResourceLoadPriority>&& priority) { m_priority = WTFMove(priority); } > > void setInitiator(Element&); > void setInitiator(const AtomicString& name); >@@ -110,14 +110,14 @@ public: > #if ENABLE(SERVICE_WORKER) > void setClientIdentifierIfNeeded(DocumentIdentifier); > void setSelectedServiceWorkerRegistrationIdentifierIfNeeded(ServiceWorkerRegistrationIdentifier); >- void setNavigationServiceWorkerRegistrationData(const std::optional<ServiceWorkerRegistrationData>&); >+ void setNavigationServiceWorkerRegistrationData(const WTF::Optional<ServiceWorkerRegistrationData>&); > #endif > > private: > ResourceRequest m_resourceRequest; > String m_charset; > ResourceLoaderOptions m_options; >- std::optional<ResourceLoadPriority> m_priority; >+ WTF::Optional<ResourceLoadPriority> m_priority; > RefPtr<Element> m_initiatorElement; > AtomicString m_initiatorName; > RefPtr<SecurityOrigin> m_origin; >diff --git a/Source/WebCore/mathml/MathMLElement.h b/Source/WebCore/mathml/MathMLElement.h >index f1ed867228ba5f1b6141b10d8b970163328e965b..48fbad61aadbf1f0880033ff2094eaa1be808c7a 100644 >--- a/Source/WebCore/mathml/MathMLElement.h >+++ b/Source/WebCore/mathml/MathMLElement.h >@@ -85,8 +85,8 @@ public: > Stretched = 18 > }; > >- virtual std::optional<bool> specifiedDisplayStyle() { return std::nullopt; } >- virtual std::optional<MathVariant> specifiedMathVariant() { return std::nullopt; } >+ virtual WTF::Optional<bool> specifiedDisplayStyle() { return WTF::nullopt; } >+ virtual WTF::Optional<MathVariant> specifiedMathVariant() { return WTF::nullopt; } > > virtual void updateSelectedChild() { } > >diff --git a/Source/WebCore/mathml/MathMLFractionElement.cpp b/Source/WebCore/mathml/MathMLFractionElement.cpp >index c3484223ee7178978bbc140a264a5d0377890715..8a77ff721b0ecdd0dc8b1ff267123faf00d42826 100644 >--- a/Source/WebCore/mathml/MathMLFractionElement.cpp >+++ b/Source/WebCore/mathml/MathMLFractionElement.cpp >@@ -72,7 +72,7 @@ const MathMLElement::Length& MathMLFractionElement::lineThickness() > return m_lineThickness.value(); > } > >-MathMLFractionElement::FractionAlignment MathMLFractionElement::cachedFractionAlignment(const QualifiedName& name, std::optional<FractionAlignment>& alignment) >+MathMLFractionElement::FractionAlignment MathMLFractionElement::cachedFractionAlignment(const QualifiedName& name, WTF::Optional<FractionAlignment>& alignment) > { > if (alignment) > return alignment.value(); >@@ -100,11 +100,11 @@ MathMLFractionElement::FractionAlignment MathMLFractionElement::denominatorAlign > void MathMLFractionElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == linethicknessAttr) >- m_lineThickness = std::nullopt; >+ m_lineThickness = WTF::nullopt; > else if (name == numalignAttr) >- m_numeratorAlignment = std::nullopt; >+ m_numeratorAlignment = WTF::nullopt; > else if (name == denomalignAttr) >- m_denominatorAlignment = std::nullopt; >+ m_denominatorAlignment = WTF::nullopt; > > MathMLElement::parseAttribute(name, value); > } >diff --git a/Source/WebCore/mathml/MathMLFractionElement.h b/Source/WebCore/mathml/MathMLFractionElement.h >index f73fa24192760d1ea2d05c75e2a4c2f753f23419..ab346b5ba1ad2eef65c3ab422b8db01d0ab3b8c9 100644 >--- a/Source/WebCore/mathml/MathMLFractionElement.h >+++ b/Source/WebCore/mathml/MathMLFractionElement.h >@@ -49,11 +49,11 @@ private: > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > void parseAttribute(const QualifiedName&, const AtomicString&) final; > >- FractionAlignment cachedFractionAlignment(const QualifiedName&, std::optional<FractionAlignment>&); >+ FractionAlignment cachedFractionAlignment(const QualifiedName&, WTF::Optional<FractionAlignment>&); > >- std::optional<Length> m_lineThickness; >- std::optional<FractionAlignment> m_numeratorAlignment; >- std::optional<FractionAlignment> m_denominatorAlignment; >+ WTF::Optional<Length> m_lineThickness; >+ WTF::Optional<FractionAlignment> m_numeratorAlignment; >+ WTF::Optional<FractionAlignment> m_denominatorAlignment; > }; > > } >diff --git a/Source/WebCore/mathml/MathMLMathElement.cpp b/Source/WebCore/mathml/MathMLMathElement.cpp >index a1f6dbd507b746615a549c951c1fdb2c9fce3c73..6a2d53cf5921dd48ddc5b2ac54db8c9192dbcb97 100644 >--- a/Source/WebCore/mathml/MathMLMathElement.cpp >+++ b/Source/WebCore/mathml/MathMLMathElement.cpp >@@ -56,7 +56,7 @@ RenderPtr<RenderElement> MathMLMathElement::createElementRenderer(RenderStyle&& > return createRenderer<RenderMathMLMath>(*this, WTFMove(style)); > } > >-std::optional<bool> MathMLMathElement::specifiedDisplayStyle() >+WTF::Optional<bool> MathMLMathElement::specifiedDisplayStyle() > { > if (cachedBooleanAttribute(displaystyleAttr, m_displayStyle) == BooleanValue::Default) { > // The default displaystyle value of the <math> depends on the display attribute, so we parse it here. >@@ -74,9 +74,9 @@ void MathMLMathElement::parseAttribute(const QualifiedName& name, const AtomicSt > bool displayStyleAttribute = (name == displaystyleAttr || name == displayAttr); > bool mathVariantAttribute = name == mathvariantAttr; > if (displayStyleAttribute) >- m_displayStyle = std::nullopt; >+ m_displayStyle = WTF::nullopt; > if (mathVariantAttribute) >- m_mathVariant = std::nullopt; >+ m_mathVariant = WTF::nullopt; > if ((displayStyleAttribute || mathVariantAttribute) && renderer()) > MathMLStyle::resolveMathMLStyleTree(renderer()); > >diff --git a/Source/WebCore/mathml/MathMLMathElement.h b/Source/WebCore/mathml/MathMLMathElement.h >index 57ab272bb38443704b78251c5d783ee50468c136..5d4f28340c92f0c68297b5da5c99ebb8a43a3089 100644 >--- a/Source/WebCore/mathml/MathMLMathElement.h >+++ b/Source/WebCore/mathml/MathMLMathElement.h >@@ -45,7 +45,7 @@ private: > > bool acceptsDisplayStyleAttribute() final { return true; } > bool acceptsMathVariantAttribute() final { return true; } >- std::optional<bool> specifiedDisplayStyle() final; >+ WTF::Optional<bool> specifiedDisplayStyle() final; > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > }; >diff --git a/Source/WebCore/mathml/MathMLMencloseElement.cpp b/Source/WebCore/mathml/MathMLMencloseElement.cpp >index 3619ad56564d18b32ae443b4de5e0aaa1a8ee612..f6444f8a10873300761908c33674d50abcfd734a 100644 >--- a/Source/WebCore/mathml/MathMLMencloseElement.cpp >+++ b/Source/WebCore/mathml/MathMLMencloseElement.cpp >@@ -135,7 +135,7 @@ bool MathMLMencloseElement::hasNotation(MencloseNotationFlag notationFlag) > void MathMLMencloseElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == notationAttr) >- m_notationFlags = std::nullopt; >+ m_notationFlags = WTF::nullopt; > > MathMLRowElement::parseAttribute(name, value); > } >diff --git a/Source/WebCore/mathml/MathMLMencloseElement.h b/Source/WebCore/mathml/MathMLMencloseElement.h >index c51a6e64f346c5b9caaaaf5b3057d3941ee66b45..e27f0b7289c8b09ee5e7f2e37cbfa4616d20e04d 100644 >--- a/Source/WebCore/mathml/MathMLMencloseElement.h >+++ b/Source/WebCore/mathml/MathMLMencloseElement.h >@@ -64,7 +64,7 @@ private: > void clearNotations() { m_notationFlags = 0; } > void addNotation(MencloseNotationFlag notationFlag) { m_notationFlags.value() |= notationFlag; } > void addNotationFlags(StringView notation); >- std::optional<uint16_t> m_notationFlags; >+ WTF::Optional<uint16_t> m_notationFlags; > }; > > } >diff --git a/Source/WebCore/mathml/MathMLOperatorDictionary.cpp b/Source/WebCore/mathml/MathMLOperatorDictionary.cpp >index 6854f0dad7d9f779bf49a6f94987378f48034a17..4960fcf85073028606772b4f3584455bc8dd2a03 100644 >--- a/Source/WebCore/mathml/MathMLOperatorDictionary.cpp >+++ b/Source/WebCore/mathml/MathMLOperatorDictionary.cpp >@@ -1107,17 +1107,17 @@ static const UChar32 horizontalOperators[] = { > 0x003D, 0x005E, 0x005F, 0x007E, 0x00AF, 0x02C6, 0x02C7, 0x02C9, 0x02CD, 0x02DC, 0x02F7, 0x0302, 0x0332, 0x203E, 0x20D0, 0x20D1, 0x20D6, 0x20D7, 0x20E1, 0x2190, 0x2192, 0x2194, 0x2198, 0x2199, 0x219C, 0x219D, 0x219E, 0x21A0, 0x21A2, 0x21A3, 0x21A4, 0x21A6, 0x21A9, 0x21AA, 0x21AB, 0x21AC, 0x21AD, 0x21B4, 0x21B9, 0x21BC, 0x21BD, 0x21C0, 0x21C1, 0x21C4, 0x21C6, 0x21C7, 0x21C9, 0x21CB, 0x21CC, 0x21D0, 0x21D2, 0x21D4, 0x21DA, 0x21DB, 0x21DC, 0x21DD, 0x21E0, 0x21E2, 0x21E4, 0x21E5, 0x21E6, 0x21E8, 0x21F0, 0x21F6, 0x21FD, 0x21FE, 0x21FF, 0x23B4, 0x23B5, 0x23DC, 0x23DD, 0x23DE, 0x23DF, 0x23E0, 0x23E1, 0x2500, 0x27F5, 0x27F6, 0x27F7, 0x27F8, 0x27F9, 0x27FA, 0x27FB, 0x27FC, 0x27FD, 0x27FE, 0x27FF, 0x290C, 0x290D, 0x290E, 0x290F, 0x2910, 0x294E, 0x2950, 0x2952, 0x2953, 0x2956, 0x2957, 0x295A, 0x295B, 0x295E, 0x295F, 0x2B45, 0x2B46, 0xFE35, 0xFE36, 0xFE37, 0xFE38, 0x1EEF0, 0x1EEF1 > }; > >-std::optional<Property> MathMLOperatorDictionary::search(UChar32 character, Form form, bool explicitForm) >+WTF::Optional<Property> MathMLOperatorDictionary::search(UChar32 character, Form form, bool explicitForm) > { > if (!character) >- return std::nullopt; >+ return WTF::nullopt; > > // We try and find the default values from the operator dictionary. > if (auto* entry = tryBinarySearch<const Entry, Key>(dictionary, dictionarySize, Key(character, form), ExtractKey)) > return ExtractProperty(*entry); > > if (explicitForm) >- return std::nullopt; >+ return WTF::nullopt; > > // If we did not find the desired operator form and if it was not set explicitely, we use the first one in the following order: Infix, Prefix, Postfix. > // This is to handle bad MathML markup without explicit <mrow> delimiters like "<mo>(</mo><mi>a</mi><mo>)</mo><mo>(</mo><mi>b</mi><mo>)</mo>" where innerfences should not be considered infix. >@@ -1130,7 +1130,7 @@ std::optional<Property> MathMLOperatorDictionary::search(UChar32 character, Form > return ExtractProperty(*entry); > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > bool MathMLOperatorDictionary::isVertical(UChar32 textContent) >diff --git a/Source/WebCore/mathml/MathMLOperatorDictionary.h b/Source/WebCore/mathml/MathMLOperatorDictionary.h >index e0316d71450f2b277ab2f7440d27d823cba09237..33086c11ff06a81f69190f70ca9556bdd519278f 100644 >--- a/Source/WebCore/mathml/MathMLOperatorDictionary.h >+++ b/Source/WebCore/mathml/MathMLOperatorDictionary.h >@@ -52,7 +52,7 @@ struct Property { > // Default operator properties are all set to "false". > unsigned short flags { 0 }; > }; >-std::optional<Property> search(UChar32, Form, bool explicitForm); >+WTF::Optional<Property> search(UChar32, Form, bool explicitForm); > bool isVertical(UChar32); > } > >diff --git a/Source/WebCore/mathml/MathMLOperatorElement.cpp b/Source/WebCore/mathml/MathMLOperatorElement.cpp >index 120bf0a75e79e353f93e4339d029cc6a82afcbf3..e3da44954b08fb8fef7568f866279b43e8f9f26c 100644 >--- a/Source/WebCore/mathml/MathMLOperatorElement.cpp >+++ b/Source/WebCore/mathml/MathMLOperatorElement.cpp >@@ -136,7 +136,7 @@ void MathMLOperatorElement::computeOperatorFlag(MathMLOperatorDictionary::Flag f > { > ASSERT(m_properties.dirtyFlags & flag); > >- std::optional<BooleanValue> property; >+ WTF::Optional<BooleanValue> property; > const auto& name = propertyFlagToAttributeName(flag); > const BooleanValue& value = cachedBooleanAttribute(name, property); > switch (value) { >@@ -214,13 +214,13 @@ const MathMLElement::Length& MathMLOperatorElement::maxSize() > > void MathMLOperatorElement::childrenChanged(const ChildChange& change) > { >- m_operatorChar = std::nullopt; >- m_dictionaryProperty = std::nullopt; >+ m_operatorChar = WTF::nullopt; >+ m_dictionaryProperty = WTF::nullopt; > m_properties.dirtyFlags = MathMLOperatorDictionary::allFlags; > MathMLTokenElement::childrenChanged(change); > } > >-static std::optional<MathMLOperatorDictionary::Flag> attributeNameToPropertyFlag(const QualifiedName& name) >+static WTF::Optional<MathMLOperatorDictionary::Flag> attributeNameToPropertyFlag(const QualifiedName& name) > { > if (name == accentAttr) > return Accent; >@@ -236,24 +236,24 @@ static std::optional<MathMLOperatorDictionary::Flag> attributeNameToPropertyFlag > return Stretchy; > if (name == symmetricAttr) > return Symmetric; >- return std::nullopt; >+ return WTF::nullopt; > } > > void MathMLOperatorElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == formAttr) { >- m_dictionaryProperty = std::nullopt; >+ m_dictionaryProperty = WTF::nullopt; > m_properties.dirtyFlags = MathMLOperatorDictionary::allFlags; > } else if (auto flag = attributeNameToPropertyFlag(name)) > m_properties.dirtyFlags |= flag.value(); > else if (name == lspaceAttr) >- m_leadingSpace = std::nullopt; >+ m_leadingSpace = WTF::nullopt; > else if (name == rspaceAttr) >- m_trailingSpace = std::nullopt; >+ m_trailingSpace = WTF::nullopt; > else if (name == minsizeAttr) >- m_minSize = std::nullopt; >+ m_minSize = WTF::nullopt; > else if (name == maxsizeAttr) >- m_maxSize = std::nullopt; >+ m_maxSize = WTF::nullopt; > > if ((name == stretchyAttr || name == lspaceAttr || name == rspaceAttr || name == movablelimitsAttr) && renderer()) { > downcast<RenderMathMLOperator>(*renderer()).updateFromElement(); >diff --git a/Source/WebCore/mathml/MathMLOperatorElement.h b/Source/WebCore/mathml/MathMLOperatorElement.h >index b076bd5f40f590afedc5337780639e280824f6f3..d8e1ddb0e7bb5c744822c2b558a12066fcff7114 100644 >--- a/Source/WebCore/mathml/MathMLOperatorElement.h >+++ b/Source/WebCore/mathml/MathMLOperatorElement.h >@@ -42,7 +42,7 @@ public: > }; > static OperatorChar parseOperatorChar(const String&); > const OperatorChar& operatorChar(); >- void setOperatorFormDirty() { m_dictionaryProperty = std::nullopt; } >+ void setOperatorFormDirty() { m_dictionaryProperty = WTF::nullopt; } > MathMLOperatorDictionary::Form form() { return dictionaryProperty().form; } > bool hasProperty(MathMLOperatorDictionary::Flag); > Length defaultLeadingSpace(); >@@ -58,9 +58,9 @@ private: > void childrenChanged(const ChildChange&) final; > void parseAttribute(const QualifiedName&, const AtomicString&) final; > >- std::optional<OperatorChar> m_operatorChar; >+ WTF::Optional<OperatorChar> m_operatorChar; > >- std::optional<MathMLOperatorDictionary::Property> m_dictionaryProperty; >+ WTF::Optional<MathMLOperatorDictionary::Property> m_dictionaryProperty; > MathMLOperatorDictionary::Property computeDictionaryProperty(); > const MathMLOperatorDictionary::Property& dictionaryProperty(); > >@@ -71,10 +71,10 @@ private: > OperatorProperties m_properties; > void computeOperatorFlag(MathMLOperatorDictionary::Flag); > >- std::optional<Length> m_leadingSpace; >- std::optional<Length> m_trailingSpace; >- std::optional<Length> m_minSize; >- std::optional<Length> m_maxSize; >+ WTF::Optional<Length> m_leadingSpace; >+ WTF::Optional<Length> m_trailingSpace; >+ WTF::Optional<Length> m_minSize; >+ WTF::Optional<Length> m_maxSize; > }; > > } >diff --git a/Source/WebCore/mathml/MathMLPaddedElement.cpp b/Source/WebCore/mathml/MathMLPaddedElement.cpp >index 44e8fe1ced13eda2053f24234dda3e123c94ed55..6e42866bb07dcc9ad26271b32d38a1a289fadcf3 100644 >--- a/Source/WebCore/mathml/MathMLPaddedElement.cpp >+++ b/Source/WebCore/mathml/MathMLPaddedElement.cpp >@@ -76,15 +76,15 @@ const MathMLElement::Length& MathMLPaddedElement::voffset() > void MathMLPaddedElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == widthAttr) >- m_width = std::nullopt; >+ m_width = WTF::nullopt; > else if (name == heightAttr) >- m_height = std::nullopt; >+ m_height = WTF::nullopt; > else if (name == depthAttr) >- m_depth = std::nullopt; >+ m_depth = WTF::nullopt; > else if (name == lspaceAttr) >- m_lspace = std::nullopt; >+ m_lspace = WTF::nullopt; > else if (name == voffsetAttr) >- m_voffset = std::nullopt; >+ m_voffset = WTF::nullopt; > > MathMLElement::parseAttribute(name, value); > } >diff --git a/Source/WebCore/mathml/MathMLPaddedElement.h b/Source/WebCore/mathml/MathMLPaddedElement.h >index 22222da4dff865c74b7390904aadeb81a59cfcc1..b5e5248feb3a9e9f823989f9f1e91e58e9518701 100644 >--- a/Source/WebCore/mathml/MathMLPaddedElement.h >+++ b/Source/WebCore/mathml/MathMLPaddedElement.h >@@ -46,11 +46,11 @@ private: > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > void parseAttribute(const QualifiedName&, const AtomicString&) final; > >- std::optional<Length> m_width; >- std::optional<Length> m_height; >- std::optional<Length> m_depth; >- std::optional<Length> m_lspace; >- std::optional<Length> m_voffset; >+ WTF::Optional<Length> m_width; >+ WTF::Optional<Length> m_height; >+ WTF::Optional<Length> m_depth; >+ WTF::Optional<Length> m_lspace; >+ WTF::Optional<Length> m_voffset; > }; > > } >diff --git a/Source/WebCore/mathml/MathMLPresentationElement.cpp b/Source/WebCore/mathml/MathMLPresentationElement.cpp >index ba004e927fde624d54678da9235c99b61841d4ba..2ec4c13855cf9e020c5d5e2219ffefeeefba86d0 100644 >--- a/Source/WebCore/mathml/MathMLPresentationElement.cpp >+++ b/Source/WebCore/mathml/MathMLPresentationElement.cpp >@@ -184,7 +184,7 @@ bool MathMLPresentationElement::isFlowContent(const Node& node) > || htmlElement.hasTagName(HTMLNames::ulTag); > } > >-const MathMLElement::BooleanValue& MathMLPresentationElement::cachedBooleanAttribute(const QualifiedName& name, std::optional<BooleanValue>& attribute) >+const MathMLElement::BooleanValue& MathMLPresentationElement::cachedBooleanAttribute(const QualifiedName& name, WTF::Optional<BooleanValue>& attribute) > { > if (attribute) > return attribute.value(); >@@ -308,7 +308,7 @@ MathMLElement::Length MathMLPresentationElement::parseMathMLLength(const String& > return parseNamedSpace(stringView); > } > >-const MathMLElement::Length& MathMLPresentationElement::cachedMathMLLength(const QualifiedName& name, std::optional<Length>& length) >+const MathMLElement::Length& MathMLPresentationElement::cachedMathMLLength(const QualifiedName& name, WTF::Optional<Length>& length) > { > if (length) > return length.value(); >@@ -321,10 +321,10 @@ bool MathMLPresentationElement::acceptsDisplayStyleAttribute() > return hasTagName(mtableTag); > } > >-std::optional<bool> MathMLPresentationElement::specifiedDisplayStyle() >+WTF::Optional<bool> MathMLPresentationElement::specifiedDisplayStyle() > { > if (!acceptsDisplayStyleAttribute()) >- return std::nullopt; >+ return WTF::nullopt; > const MathMLElement::BooleanValue& specifiedDisplayStyle = cachedBooleanAttribute(displaystyleAttr, m_displayStyle); > return toOptionalBool(specifiedDisplayStyle); > } >@@ -371,13 +371,13 @@ MathMLElement::MathVariant MathMLPresentationElement::parseMathVariantAttribute( > return MathVariant::None; > } > >-std::optional<MathMLElement::MathVariant> MathMLPresentationElement::specifiedMathVariant() >+WTF::Optional<MathMLElement::MathVariant> MathMLPresentationElement::specifiedMathVariant() > { > if (!acceptsMathVariantAttribute()) >- return std::nullopt; >+ return WTF::nullopt; > if (!m_mathVariant) > m_mathVariant = parseMathVariantAttribute(attributeWithoutSynchronization(mathvariantAttr)); >- return m_mathVariant.value() == MathVariant::None ? std::nullopt : m_mathVariant; >+ return m_mathVariant.value() == MathVariant::None ? WTF::nullopt : m_mathVariant; > } > > void MathMLPresentationElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -385,9 +385,9 @@ void MathMLPresentationElement::parseAttribute(const QualifiedName& name, const > bool displayStyleAttribute = name == displaystyleAttr && acceptsDisplayStyleAttribute(); > bool mathVariantAttribute = name == mathvariantAttr && acceptsMathVariantAttribute(); > if (displayStyleAttribute) >- m_displayStyle = std::nullopt; >+ m_displayStyle = WTF::nullopt; > if (mathVariantAttribute) >- m_mathVariant = std::nullopt; >+ m_mathVariant = WTF::nullopt; > if ((displayStyleAttribute || mathVariantAttribute) && renderer()) > MathMLStyle::resolveMathMLStyleTree(renderer()); > >diff --git a/Source/WebCore/mathml/MathMLPresentationElement.h b/Source/WebCore/mathml/MathMLPresentationElement.h >index 576d79a70d2d4675045fbcfa14c89afe6d6b6b14..b3eaa575e58288afea2782540054cb3dd686dcba 100644 >--- a/Source/WebCore/mathml/MathMLPresentationElement.h >+++ b/Source/WebCore/mathml/MathMLPresentationElement.h >@@ -45,20 +45,20 @@ protected: > static bool isPhrasingContent(const Node&); > static bool isFlowContent(const Node&); > >- static std::optional<bool> toOptionalBool(const BooleanValue& value) { return value == BooleanValue::Default ? std::nullopt : std::optional<bool>(value == BooleanValue::True); } >- const BooleanValue& cachedBooleanAttribute(const QualifiedName&, std::optional<BooleanValue>&); >+ static WTF::Optional<bool> toOptionalBool(const BooleanValue& value) { return value == BooleanValue::Default ? WTF::nullopt : WTF::Optional<bool>(value == BooleanValue::True); } >+ const BooleanValue& cachedBooleanAttribute(const QualifiedName&, WTF::Optional<BooleanValue>&); > > static Length parseMathMLLength(const String&); >- const Length& cachedMathMLLength(const QualifiedName&, std::optional<Length>&); >+ const Length& cachedMathMLLength(const QualifiedName&, WTF::Optional<Length>&); > > virtual bool acceptsDisplayStyleAttribute(); >- std::optional<bool> specifiedDisplayStyle() override; >+ WTF::Optional<bool> specifiedDisplayStyle() override; > > virtual bool acceptsMathVariantAttribute() { return false; } >- std::optional<MathVariant> specifiedMathVariant() final; >+ WTF::Optional<MathVariant> specifiedMathVariant() final; > >- std::optional<BooleanValue> m_displayStyle; >- std::optional<MathVariant> m_mathVariant; >+ WTF::Optional<BooleanValue> m_displayStyle; >+ WTF::Optional<MathVariant> m_mathVariant; > > private: > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; >diff --git a/Source/WebCore/mathml/MathMLScriptsElement.cpp b/Source/WebCore/mathml/MathMLScriptsElement.cpp >index 2dca2f5466463f0ba2d53856cf2651999bd33027..b11977d3ec3da6ce90bcef6cb4af1cecb51ef937 100644 >--- a/Source/WebCore/mathml/MathMLScriptsElement.cpp >+++ b/Source/WebCore/mathml/MathMLScriptsElement.cpp >@@ -80,9 +80,9 @@ const MathMLElement::Length& MathMLScriptsElement::superscriptShift() > void MathMLScriptsElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == subscriptshiftAttr) >- m_subscriptShift = std::nullopt; >+ m_subscriptShift = WTF::nullopt; > else if (name == superscriptshiftAttr) >- m_superscriptShift = std::nullopt; >+ m_superscriptShift = WTF::nullopt; > > MathMLElement::parseAttribute(name, value); > } >diff --git a/Source/WebCore/mathml/MathMLScriptsElement.h b/Source/WebCore/mathml/MathMLScriptsElement.h >index a14b569b57a8e7851edcdc37e94691cbcafeaa29..cb65e9eaa0e65064b2b58e3aefa610ff6015bca9 100644 >--- a/Source/WebCore/mathml/MathMLScriptsElement.h >+++ b/Source/WebCore/mathml/MathMLScriptsElement.h >@@ -49,8 +49,8 @@ private: > void parseAttribute(const QualifiedName&, const AtomicString&) override; > > const ScriptType m_scriptType; >- std::optional<Length> m_subscriptShift; >- std::optional<Length> m_superscriptShift; >+ WTF::Optional<Length> m_subscriptShift; >+ WTF::Optional<Length> m_superscriptShift; > }; > > } >diff --git a/Source/WebCore/mathml/MathMLSpaceElement.cpp b/Source/WebCore/mathml/MathMLSpaceElement.cpp >index c06b5d212101745d0eae8db01572f6553f134d99..4ab1a0556db8fe4523abf58ae3aec0ba2462b65a 100644 >--- a/Source/WebCore/mathml/MathMLSpaceElement.cpp >+++ b/Source/WebCore/mathml/MathMLSpaceElement.cpp >@@ -66,11 +66,11 @@ const MathMLElement::Length& MathMLSpaceElement::depth() > void MathMLSpaceElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == widthAttr) >- m_width = std::nullopt; >+ m_width = WTF::nullopt; > else if (name == heightAttr) >- m_height = std::nullopt; >+ m_height = WTF::nullopt; > else if (name == depthAttr) >- m_depth = std::nullopt; >+ m_depth = WTF::nullopt; > > MathMLPresentationElement::parseAttribute(name, value); > } >diff --git a/Source/WebCore/mathml/MathMLSpaceElement.h b/Source/WebCore/mathml/MathMLSpaceElement.h >index f42cf9a99243baa6ff657b04e5bd322f46c869f5..cc4d50a3ee11bd0ab23bdbbdb11775751ef84df5 100644 >--- a/Source/WebCore/mathml/MathMLSpaceElement.h >+++ b/Source/WebCore/mathml/MathMLSpaceElement.h >@@ -45,9 +45,9 @@ private: > > bool acceptsDisplayStyleAttribute() final { return false; } > >- std::optional<Length> m_width; >- std::optional<Length> m_height; >- std::optional<Length> m_depth; >+ WTF::Optional<Length> m_width; >+ WTF::Optional<Length> m_height; >+ WTF::Optional<Length> m_depth; > }; > > } >diff --git a/Source/WebCore/mathml/MathMLTokenElement.cpp b/Source/WebCore/mathml/MathMLTokenElement.cpp >index 4db3575409c2bd529d6c885b2cf251159e165eb0..686e890663303f388e21786b9c8651ec08ef1ede 100644 >--- a/Source/WebCore/mathml/MathMLTokenElement.cpp >+++ b/Source/WebCore/mathml/MathMLTokenElement.cpp >@@ -80,15 +80,15 @@ bool MathMLTokenElement::childShouldCreateRenderer(const Node& child) const > return isPhrasingContent(child) && StyledElement::childShouldCreateRenderer(child); > } > >-std::optional<UChar32> MathMLTokenElement::convertToSingleCodePoint(StringView string) >+WTF::Optional<UChar32> MathMLTokenElement::convertToSingleCodePoint(StringView string) > { > auto codePoints = stripLeadingAndTrailingWhitespace(string).codePoints(); > auto iterator = codePoints.begin(); > if (iterator == codePoints.end()) >- return std::nullopt; >- std::optional<UChar32> character = *iterator; >+ return WTF::nullopt; >+ WTF::Optional<UChar32> character = *iterator; > ++iterator; >- return iterator == codePoints.end() ? character : std::nullopt; >+ return iterator == codePoints.end() ? character : WTF::nullopt; > } > > } >diff --git a/Source/WebCore/mathml/MathMLTokenElement.h b/Source/WebCore/mathml/MathMLTokenElement.h >index 693132283642efe613ddc5d420cefda8560e8742..4c93b5c5eaf5f11b30303fc0b895e71e2709a069 100644 >--- a/Source/WebCore/mathml/MathMLTokenElement.h >+++ b/Source/WebCore/mathml/MathMLTokenElement.h >@@ -38,7 +38,7 @@ class MathMLTokenElement : public MathMLPresentationElement { > public: > static Ref<MathMLTokenElement> create(const QualifiedName& tagName, Document&); > >- static std::optional<UChar32> convertToSingleCodePoint(StringView); >+ static WTF::Optional<UChar32> convertToSingleCodePoint(StringView); > > protected: > MathMLTokenElement(const QualifiedName& tagName, Document&); >diff --git a/Source/WebCore/mathml/MathMLUnderOverElement.cpp b/Source/WebCore/mathml/MathMLUnderOverElement.cpp >index 30bafddc0b00ecbd824c8fc9a01e4a052efcaf8c..0c1dfeab957a9968e3ebbe3d967ff90f0654608f 100644 >--- a/Source/WebCore/mathml/MathMLUnderOverElement.cpp >+++ b/Source/WebCore/mathml/MathMLUnderOverElement.cpp >@@ -61,9 +61,9 @@ const MathMLElement::BooleanValue& MathMLUnderOverElement::accentUnder() > void MathMLUnderOverElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == accentAttr) >- m_accent = std::nullopt; >+ m_accent = WTF::nullopt; > else if (name == accentunderAttr) >- m_accentUnder = std::nullopt; >+ m_accentUnder = WTF::nullopt; > > MathMLElement::parseAttribute(name, value); > } >diff --git a/Source/WebCore/mathml/MathMLUnderOverElement.h b/Source/WebCore/mathml/MathMLUnderOverElement.h >index 0b6200827c910ef6e25395101db1f48b3bc9059a..72870593d7196edb7f1910c783c5b89b78869a18 100644 >--- a/Source/WebCore/mathml/MathMLUnderOverElement.h >+++ b/Source/WebCore/mathml/MathMLUnderOverElement.h >@@ -43,8 +43,8 @@ private: > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > void parseAttribute(const QualifiedName&, const AtomicString&) final; > >- std::optional<BooleanValue> m_accent; >- std::optional<BooleanValue> m_accentUnder; >+ WTF::Optional<BooleanValue> m_accent; >+ WTF::Optional<BooleanValue> m_accentUnder; > }; > > } >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index 08f583e2ece9606d6e4e0f019f8416b4f8994ff1..0efd7928b6f2c788566a75d685215e59c898822d 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -403,7 +403,7 @@ public: > virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { } > virtual void recommendedScrollbarStyleDidChange(ScrollbarStyle) { } > >- virtual std::optional<ScrollbarOverlayStyle> preferredScrollbarOverlayStyle() { return ScrollbarOverlayStyleDefault; } >+ virtual WTF::Optional<ScrollbarOverlayStyle> preferredScrollbarOverlayStyle() { return ScrollbarOverlayStyleDefault; } > > virtual void wheelEventHandlersChanged(bool hasHandlers) = 0; > >diff --git a/Source/WebCore/page/ClientOrigin.h b/Source/WebCore/page/ClientOrigin.h >index b87505a050579e3bf138502a5eff4a4552ed1c0c..425797934accb7ae90d78a214d3f252a477a1950 100644 >--- a/Source/WebCore/page/ClientOrigin.h >+++ b/Source/WebCore/page/ClientOrigin.h >@@ -37,7 +37,7 @@ struct ClientOrigin { > bool operator==(const ClientOrigin&) const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ClientOrigin> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ClientOrigin> decode(Decoder&); > > ClientOrigin isolatedCopy() const; > >@@ -70,16 +70,16 @@ template<class Encoder> inline void ClientOrigin::encode(Encoder& encoder) const > encoder << clientOrigin; > } > >-template<class Decoder> inline std::optional<ClientOrigin> ClientOrigin::decode(Decoder& decoder) >+template<class Decoder> inline WTF::Optional<ClientOrigin> ClientOrigin::decode(Decoder& decoder) > { >- std::optional<SecurityOriginData> topOrigin; >- std::optional<SecurityOriginData> clientOrigin; >+ WTF::Optional<SecurityOriginData> topOrigin; >+ WTF::Optional<SecurityOriginData> clientOrigin; > decoder >> topOrigin; > if (!topOrigin) >- return std::nullopt; >+ return WTF::nullopt; > decoder >> clientOrigin; > if (!clientOrigin) >- return std::nullopt; >+ return WTF::nullopt; > > return ClientOrigin { WTFMove(*topOrigin), WTFMove(*clientOrigin) }; > } >diff --git a/Source/WebCore/page/DOMTimer.cpp b/Source/WebCore/page/DOMTimer.cpp >index f8bcd90df32556709b7c7ae866275ef3ca5242ee..63d411adada4c6733e41ce36ef3fa6367fa8b83e 100644 >--- a/Source/WebCore/page/DOMTimer.cpp >+++ b/Source/WebCore/page/DOMTimer.cpp >@@ -444,11 +444,11 @@ Seconds DOMTimer::intervalClampedToMinimum() const > return interval; > } > >-std::optional<MonotonicTime> DOMTimer::alignedFireTime(MonotonicTime fireTime) const >+WTF::Optional<MonotonicTime> DOMTimer::alignedFireTime(MonotonicTime fireTime) const > { > Seconds alignmentInterval = scriptExecutionContext()->domTimerAlignmentInterval(m_nestingLevel >= maxTimerNestingLevel); > if (!alignmentInterval) >- return std::nullopt; >+ return WTF::nullopt; > > static const double randomizedProportion = randomNumber(); > >diff --git a/Source/WebCore/page/DOMTimer.h b/Source/WebCore/page/DOMTimer.h >index 0d76539fdda8792cba5dc5cfc8e2eb7b4592b688..342ebafe1a7cef380ebdd4819762477a9bd4cf3d 100644 >--- a/Source/WebCore/page/DOMTimer.h >+++ b/Source/WebCore/page/DOMTimer.h >@@ -75,7 +75,7 @@ private: > // SuspendableTimer > void fired() override; > void didStop() override; >- WEBCORE_EXPORT std::optional<MonotonicTime> alignedFireTime(MonotonicTime) const override; >+ WEBCORE_EXPORT WTF::Optional<MonotonicTime> alignedFireTime(MonotonicTime) const override; > > // ActiveDOMObject API. > const char* activeDOMObjectName() const override; >diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp >index 2772950454b30b852284d6ceb5156227b6a97de2..5354f0d85df5572bf683552c31d494c8208efee0 100644 >--- a/Source/WebCore/page/DOMWindow.cpp >+++ b/Source/WebCore/page/DOMWindow.cpp >@@ -162,7 +162,7 @@ public: > > Ref<MessageEvent> event(ScriptExecutionContext& context) > { >- return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_message.transferredPorts)), m_message.message.releaseNonNull(), m_origin, { }, m_source ? std::make_optional(MessageEventSource(WTFMove(m_source))) : std::nullopt); >+ return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_message.transferredPorts)), m_message.message.releaseNonNull(), m_origin, { }, m_source ? WTF::makeOptional(MessageEventSource(WTFMove(m_source))) : WTF::nullopt); > } > > SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } >diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h >index fd8a5093f3cd06da6bca45722f8402a8db9eb485..039d8d92b564a3177ad463d9fa456b896a670f69 100644 >--- a/Source/WebCore/page/DOMWindow.h >+++ b/Source/WebCore/page/DOMWindow.h >@@ -362,7 +362,7 @@ private: > > bool m_shouldPrintWhenFinishedLoading { false }; > bool m_suspendedForDocumentSuspension { false }; >- std::optional<bool> m_canShowModalDialogOverride; >+ WTF::Optional<bool> m_canShowModalDialogOverride; > > HashSet<DOMWindowProperty*> m_properties; > >diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp >index 4bb304448b67ebc88387d916f49e1c1ce3e15209..b02a507bf7c0f65be75b359b12d906eaa3693237 100644 >--- a/Source/WebCore/page/DragController.cpp >+++ b/Source/WebCore/page/DragController.cpp >@@ -245,7 +245,7 @@ inline static bool dragIsHandledByDocument(DragHandlingMethod dragHandlingMethod > bool DragController::performDragOperation(const DragData& dragData) > { > SetForScope<bool> isPerformingDrop(m_isPerformingDrop, true); >- TemporarySelectionChange ignoreSelectionChanges(m_page.focusController().focusedOrMainFrame(), std::nullopt, TemporarySelectionOption::IgnoreSelectionChanges); >+ TemporarySelectionChange ignoreSelectionChanges(m_page.focusController().focusedOrMainFrame(), WTF::nullopt, TemporarySelectionOption::IgnoreSelectionChanges); > > m_documentUnderMouse = m_page.mainFrame().documentAtPoint(dragData.clientPosition()); > >diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp >index 6d141eafdafaca72378a1e34cc9b8eeb2531c1d3..8b41ef92ef80eff079e4c38bf5668e1074332f63 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -1405,17 +1405,17 @@ void EventHandler::updateCursor(FrameView& view, const HitTestResult& result, bo > } > } > >-std::optional<Cursor> EventHandler::selectCursor(const HitTestResult& result, bool shiftKey) >+WTF::Optional<Cursor> EventHandler::selectCursor(const HitTestResult& result, bool shiftKey) > { > if (m_resizeLayer && m_resizeLayer->inResizeMode()) >- return std::nullopt; >+ return WTF::nullopt; > > if (!m_frame.page()) >- return std::nullopt; >+ return WTF::nullopt; > > #if ENABLE(PAN_SCROLLING) > if (m_frame.mainFrame().eventHandler().panScrollInProgress()) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > Ref<Frame> protectedFrame(m_frame); >@@ -1430,7 +1430,7 @@ std::optional<Cursor> EventHandler::selectCursor(const HitTestResult& result, bo > > Node* node = result.targetNode(); > if (!node) >- return std::nullopt; >+ return WTF::nullopt; > > auto renderer = node->renderer(); > auto* style = renderer ? &renderer->style() : nullptr; >@@ -1452,7 +1452,7 @@ std::optional<Cursor> EventHandler::selectCursor(const HitTestResult& result, bo > case SetCursor: > return overrideCursor; > case DoNotSetCursor: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -2330,7 +2330,7 @@ EventHandler::DragTargetResponse EventHandler::dispatchDragEnterOrDragOverEvent( > dataTransfer->makeInvalidForSecurity(); > if (accept && !dataTransfer->dropEffectIsUninitialized()) > return { true, dataTransfer->destinationOperation() }; >- return { accept, std::nullopt }; >+ return { accept, WTF::nullopt }; > } > > EventHandler::DragTargetResponse EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, const std::function<std::unique_ptr<Pasteboard>()>& makePasteboard, DragOperation sourceOperation, bool draggingFiles) >diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h >index 92fbc5afcf88eb204440492012cc9da8406bb429..535be01e37da0ca30cc6e146834e5a8503600918 100644 >--- a/Source/WebCore/page/EventHandler.h >+++ b/Source/WebCore/page/EventHandler.h >@@ -162,7 +162,7 @@ public: > #if ENABLE(DRAG_SUPPORT) > struct DragTargetResponse { > bool accept { false }; >- std::optional<DragOperation> operation; >+ WTF::Optional<DragOperation> operation; > }; > DragTargetResponse updateDragAndDrop(const PlatformMouseEvent&, const std::function<std::unique_ptr<Pasteboard>()>&, DragOperation sourceOperation, bool draggingFiles); > void cancelDragAndDrop(const PlatformMouseEvent&, std::unique_ptr<Pasteboard>&&, DragOperation, bool draggingFiles); >@@ -369,7 +369,7 @@ private: > > bool internalKeyEvent(const PlatformKeyboardEvent&); > >- std::optional<Cursor> selectCursor(const HitTestResult&, bool shiftKey); >+ WTF::Optional<Cursor> selectCursor(const HitTestResult&, bool shiftKey); > void updateCursor(FrameView&, const HitTestResult&, bool shiftKey); > > void hoverTimerFired(); >diff --git a/Source/WebCore/page/EventSource.cpp b/Source/WebCore/page/EventSource.cpp >index 30859ebb0572a30a15e337f602add023853b3a06..9afd33b19b56eb5543caffc1d3b8f4ce5d70278b 100644 >--- a/Source/WebCore/page/EventSource.cpp >+++ b/Source/WebCore/page/EventSource.cpp >@@ -278,8 +278,8 @@ void EventSource::parseEventStream() > m_discardTrailingNewline = false; > } > >- std::optional<unsigned> lineLength; >- std::optional<unsigned> fieldLength; >+ WTF::Optional<unsigned> lineLength; >+ WTF::Optional<unsigned> fieldLength; > for (unsigned i = position; !lineLength && i < size; ++i) { > switch (m_receiveBuffer[i]) { > case ':': >@@ -315,7 +315,7 @@ void EventSource::parseEventStream() > m_receiveBuffer.remove(0, position); > } > >-void EventSource::parseEventStreamLine(unsigned position, std::optional<unsigned> fieldLength, unsigned lineLength) >+void EventSource::parseEventStreamLine(unsigned position, WTF::Optional<unsigned> fieldLength, unsigned lineLength) > { > if (!lineLength) { > if (!m_data.isEmpty()) >diff --git a/Source/WebCore/page/EventSource.h b/Source/WebCore/page/EventSource.h >index 58a4c38749e950b478cf87068a2639310adef09a..626e58b7c4d286f7a57f29eb4ddf6e5bdd0fe8d1 100644 >--- a/Source/WebCore/page/EventSource.h >+++ b/Source/WebCore/page/EventSource.h >@@ -94,7 +94,7 @@ private: > void scheduleReconnect(); > void abortConnectionAttempt(); > void parseEventStream(); >- void parseEventStreamLine(unsigned position, std::optional<unsigned> fieldLength, unsigned lineLength); >+ void parseEventStreamLine(unsigned position, WTF::Optional<unsigned> fieldLength, unsigned lineLength); > void dispatchMessageEvent(); > > bool responseIsValid(const ResourceResponse&) const; >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index edd1ceb2144d055e52e42ea2f3bd628dc5d1f83d..9026ce32cab0455380e1a8f05064572a1024af97 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -390,7 +390,7 @@ void FrameView::detachCustomScrollbars() > void FrameView::recalculateScrollbarOverlayStyle() > { > ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle(); >- std::optional<ScrollbarOverlayStyle> clientOverlayStyle = frame().page() ? frame().page()->chrome().client().preferredScrollbarOverlayStyle() : ScrollbarOverlayStyleDefault; >+ WTF::Optional<ScrollbarOverlayStyle> clientOverlayStyle = frame().page() ? frame().page()->chrome().client().preferredScrollbarOverlayStyle() : ScrollbarOverlayStyleDefault; > if (clientOverlayStyle) { > if (clientOverlayStyle.value() != oldOverlayStyle) > setScrollbarOverlayStyle(clientOverlayStyle.value()); >@@ -1659,7 +1659,7 @@ void FrameView::setBaseLayoutViewportOrigin(LayoutPoint origin, TriggerLayoutOrN > } > } > >-void FrameView::setLayoutViewportOverrideRect(std::optional<LayoutRect> rect, TriggerLayoutOrNot layoutTriggering) >+void FrameView::setLayoutViewportOverrideRect(WTF::Optional<LayoutRect> rect, TriggerLayoutOrNot layoutTriggering) > { > if (rect == m_layoutViewportOverrideRect) > return; >@@ -1677,7 +1677,7 @@ void FrameView::setLayoutViewportOverrideRect(std::optional<LayoutRect> rect, Tr > setViewportConstrainedObjectsNeedLayout(); > } > >-void FrameView::setVisualViewportOverrideRect(std::optional<LayoutRect> rect) >+void FrameView::setVisualViewportOverrideRect(WTF::Optional<LayoutRect> rect) > { > m_visualViewportOverrideRect = rect; > } >@@ -4566,7 +4566,7 @@ void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In > setNeedsLayout(); > layoutContext().scheduleLayout(); > if (m_shouldAutoSize) { >- overrideViewportSizeForCSSViewportUnits({ minSize.width(), m_overrideViewportSize ? m_overrideViewportSize->height : std::nullopt }); >+ overrideViewportSizeForCSSViewportUnits({ minSize.width(), m_overrideViewportSize ? m_overrideViewportSize->height : WTF::nullopt }); > return; > } > >@@ -4820,30 +4820,30 @@ IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const > return parentPoint; > } > >-float FrameView::documentToAbsoluteScaleFactor(std::optional<float> effectiveZoom) const >+float FrameView::documentToAbsoluteScaleFactor(WTF::Optional<float> effectiveZoom) const > { > // If effectiveZoom is passed, it already factors in pageZoomFactor(). > return effectiveZoom.value_or(frame().pageZoomFactor()) * frame().frameScaleFactor(); > } > >-float FrameView::absoluteToDocumentScaleFactor(std::optional<float> effectiveZoom) const >+float FrameView::absoluteToDocumentScaleFactor(WTF::Optional<float> effectiveZoom) const > { > // If effectiveZoom is passed, it already factors in pageZoomFactor(). > return 1 / documentToAbsoluteScaleFactor(effectiveZoom); > } > >-FloatRect FrameView::absoluteToDocumentRect(FloatRect rect, std::optional<float> effectiveZoom) const >+FloatRect FrameView::absoluteToDocumentRect(FloatRect rect, WTF::Optional<float> effectiveZoom) const > { > rect.scale(absoluteToDocumentScaleFactor(effectiveZoom)); > return rect; > } > >-FloatPoint FrameView::absoluteToDocumentPoint(FloatPoint p, std::optional<float> effectiveZoom) const >+FloatPoint FrameView::absoluteToDocumentPoint(FloatPoint p, WTF::Optional<float> effectiveZoom) const > { > return p.scaled(absoluteToDocumentScaleFactor(effectiveZoom)); > } > >-FloatRect FrameView::absoluteToClientRect(FloatRect rect, std::optional<float> effectiveZoom) const >+FloatRect FrameView::absoluteToClientRect(FloatRect rect, WTF::Optional<float> effectiveZoom) const > { > return documentToClientRect(absoluteToDocumentRect(rect, effectiveZoom)); > } >@@ -5303,7 +5303,7 @@ void FrameView::notifyWidgets(WidgetNotification notification) > widget->notifyWidget(notification); > } > >-void FrameView::setViewExposedRect(std::optional<FloatRect> viewExposedRect) >+void FrameView::setViewExposedRect(WTF::Optional<FloatRect> viewExposedRect) > { > if (m_viewExposedRect == viewExposedRect) > return; >@@ -5336,7 +5336,7 @@ void FrameView::clearViewportSizeOverrideForCSSViewportUnits() > if (!m_overrideViewportSize) > return; > >- m_overrideViewportSize = std::nullopt; >+ m_overrideViewportSize = WTF::nullopt; > if (auto* document = frame().document()) > document->styleScope().didChangeStyleSheetEnvironment(); > } >diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h >index bc993a8ec6c284863880fdd29a27f01c315a5eb0..20fa25981f670a7346613b314f432323021be910 100644 >--- a/Source/WebCore/page/FrameView.h >+++ b/Source/WebCore/page/FrameView.h >@@ -257,9 +257,9 @@ public: > > // If set, overrides the default "m_layoutViewportOrigin, size of initial containing block" rect. > // Used with delegated scrolling (i.e. iOS). >- WEBCORE_EXPORT void setLayoutViewportOverrideRect(std::optional<LayoutRect>, TriggerLayoutOrNot = TriggerLayoutOrNot::Yes); >+ WEBCORE_EXPORT void setLayoutViewportOverrideRect(WTF::Optional<LayoutRect>, TriggerLayoutOrNot = TriggerLayoutOrNot::Yes); > >- WEBCORE_EXPORT void setVisualViewportOverrideRect(std::optional<LayoutRect>); >+ WEBCORE_EXPORT void setVisualViewportOverrideRect(WTF::Optional<LayoutRect>); > > // These are in document coordinates, unaffected by page scale (but affected by zooming). > WEBCORE_EXPORT LayoutRect layoutViewportRect() const; >@@ -470,13 +470,13 @@ public: > IntPoint convertToContainingView(const IntPoint&) const final; > IntPoint convertFromContainingView(const IntPoint&) const final; > >- float documentToAbsoluteScaleFactor(std::optional<float> effectiveZoom = std::nullopt) const; >- float absoluteToDocumentScaleFactor(std::optional<float> effectiveZoom = std::nullopt) const; >+ float documentToAbsoluteScaleFactor(WTF::Optional<float> effectiveZoom = WTF::nullopt) const; >+ float absoluteToDocumentScaleFactor(WTF::Optional<float> effectiveZoom = WTF::nullopt) const; > >- FloatRect absoluteToDocumentRect(FloatRect, std::optional<float> effectiveZoom = std::nullopt) const; >- FloatPoint absoluteToDocumentPoint(FloatPoint, std::optional<float> effectiveZoom = std::nullopt) const; >+ FloatRect absoluteToDocumentRect(FloatRect, WTF::Optional<float> effectiveZoom = WTF::nullopt) const; >+ FloatPoint absoluteToDocumentPoint(FloatPoint, WTF::Optional<float> effectiveZoom = WTF::nullopt) const; > >- FloatRect absoluteToClientRect(FloatRect, std::optional<float> effectiveZoom = std::nullopt) const; >+ FloatRect absoluteToClientRect(FloatRect, WTF::Optional<float> effectiveZoom = WTF::nullopt) const; > > FloatSize documentToClientOffset() const; > FloatRect documentToClientRect(FloatRect) const; >@@ -622,8 +622,8 @@ public: > // of the view is actually exposed on screen (taking into account > // clipping by other UI elements), whereas visibleContentRect is > // internal to WebCore and doesn't respect those things. >- WEBCORE_EXPORT void setViewExposedRect(std::optional<FloatRect>); >- std::optional<FloatRect> viewExposedRect() const { return m_viewExposedRect; } >+ WEBCORE_EXPORT void setViewExposedRect(WTF::Optional<FloatRect>); >+ WTF::Optional<FloatRect> viewExposedRect() const { return m_viewExposedRect; } > > #if ENABLE(CSS_SCROLL_SNAP) > void updateSnapOffsets() final; >@@ -801,8 +801,8 @@ private: > void didLayout(WeakPtr<RenderElement> layoutRoot); > > struct OverrideViewportSize { >- std::optional<int> width; >- std::optional<int> height; >+ WTF::Optional<int> width; >+ WTF::Optional<int> height; > > bool operator==(const OverrideViewportSize& rhs) const { return rhs.width == width && rhs.height == height; } > }; >@@ -863,11 +863,11 @@ private: > > bool m_shouldUpdateWhileOffscreen; > >- std::optional<FloatRect> m_viewExposedRect; >+ WTF::Optional<FloatRect> m_viewExposedRect; > > LayoutPoint m_layoutViewportOrigin; >- std::optional<LayoutRect> m_layoutViewportOverrideRect; >- std::optional<LayoutRect> m_visualViewportOverrideRect; // Used when the iOS keyboard is showing. >+ WTF::Optional<LayoutRect> m_layoutViewportOverrideRect; >+ WTF::Optional<LayoutRect> m_visualViewportOverrideRect; // Used when the iOS keyboard is showing. > > RefPtr<Node> m_nodeToDraw; > OptionSet<PaintBehavior> m_paintBehavior; >@@ -900,7 +900,7 @@ private: > IntSize m_customSizeForResizeEvent; > #endif > >- std::optional<OverrideViewportSize> m_overrideViewportSize; >+ WTF::Optional<OverrideViewportSize> m_overrideViewportSize; > > // If true, automatically resize the frame view around its content. > bool m_shouldAutoSize; >diff --git a/Source/WebCore/page/GlobalFrameIdentifier.h b/Source/WebCore/page/GlobalFrameIdentifier.h >index 536ee37dfca6354244a586a3461294d4c2c35799..1e0cb6fa7fb502a5c72f0fe4a65d04632d43346e 100644 >--- a/Source/WebCore/page/GlobalFrameIdentifier.h >+++ b/Source/WebCore/page/GlobalFrameIdentifier.h >@@ -35,7 +35,7 @@ struct GlobalFrameIdentifier { > uint64_t frameID; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<GlobalFrameIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<GlobalFrameIdentifier> decode(Decoder&); > }; > > template<class Encoder> >@@ -45,17 +45,17 @@ void GlobalFrameIdentifier::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<GlobalFrameIdentifier> GlobalFrameIdentifier::decode(Decoder& decoder) >+WTF::Optional<GlobalFrameIdentifier> GlobalFrameIdentifier::decode(Decoder& decoder) > { >- std::optional<uint64_t> pageID; >+ WTF::Optional<uint64_t> pageID; > decoder >> pageID; > if (!pageID) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> frameID; >+ WTF::Optional<uint64_t> frameID; > decoder >> frameID; > if (!frameID) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*pageID), WTFMove(*frameID) } }; > } >diff --git a/Source/WebCore/page/GlobalWindowIdentifier.h b/Source/WebCore/page/GlobalWindowIdentifier.h >index 215a74616cc6ff64a17da01de9e1de3a8678f4f1..08a4045cb1407316c8792d9ed0b4a020576cb265 100644 >--- a/Source/WebCore/page/GlobalWindowIdentifier.h >+++ b/Source/WebCore/page/GlobalWindowIdentifier.h >@@ -42,7 +42,7 @@ struct GlobalWindowIdentifier { > unsigned hash() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<GlobalWindowIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<GlobalWindowIdentifier> decode(Decoder&); > }; > > inline bool operator==(const GlobalWindowIdentifier& a, const GlobalWindowIdentifier& b) >@@ -66,17 +66,17 @@ void GlobalWindowIdentifier::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<GlobalWindowIdentifier> GlobalWindowIdentifier::decode(Decoder& decoder) >+WTF::Optional<GlobalWindowIdentifier> GlobalWindowIdentifier::decode(Decoder& decoder) > { >- std::optional<ProcessIdentifier> processIdentifier; >+ WTF::Optional<ProcessIdentifier> processIdentifier; > decoder >> processIdentifier; > if (!processIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WindowIdentifier> windowIdentifier; >+ WTF::Optional<WindowIdentifier> windowIdentifier; > decoder >> windowIdentifier; > if (!windowIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*processIdentifier), WTFMove(*windowIdentifier) } }; > } >diff --git a/Source/WebCore/page/IntersectionObserver.cpp b/Source/WebCore/page/IntersectionObserver.cpp >index 0b4ef288b36f9b71cd66c3bf6a0515e3911bccb5..4313beaf08093c31ce24e91cad7830397d9a4852 100644 >--- a/Source/WebCore/page/IntersectionObserver.cpp >+++ b/Source/WebCore/page/IntersectionObserver.cpp >@@ -150,7 +150,7 @@ void IntersectionObserver::observe(Element& target) > if (!trackingDocument() || !m_callback || m_observationTargets.contains(&target)) > return; > >- target.ensureIntersectionObserverData().registrations.append({ makeWeakPtr(this), std::nullopt }); >+ target.ensureIntersectionObserverData().registrations.append({ makeWeakPtr(this), WTF::nullopt }); > bool hadObservationTargets = hasObservationTargets(); > m_observationTargets.append(&target); > auto* document = trackingDocument(); >diff --git a/Source/WebCore/page/IntersectionObserver.h b/Source/WebCore/page/IntersectionObserver.h >index faf30fda0bccecb17ab0a5423bf1790ce974c621..caf95cec914d76b03736565254e9a25f19b5a15c 100644 >--- a/Source/WebCore/page/IntersectionObserver.h >+++ b/Source/WebCore/page/IntersectionObserver.h >@@ -44,7 +44,7 @@ class Element; > > struct IntersectionObserverRegistration { > WeakPtr<IntersectionObserver> observer; >- std::optional<size_t> previousThresholdIndex; >+ WTF::Optional<size_t> previousThresholdIndex; > }; > > struct IntersectionObserverData { >diff --git a/Source/WebCore/page/IntersectionObserverEntry.h b/Source/WebCore/page/IntersectionObserverEntry.h >index b799642684c4719628614145bc7a83ca3e9db5d3..7ba001eb82041e0bee582c3bf02c4504bac4f3d9 100644 >--- a/Source/WebCore/page/IntersectionObserverEntry.h >+++ b/Source/WebCore/page/IntersectionObserverEntry.h >@@ -43,7 +43,7 @@ public: > > struct Init { > double time; >- std::optional<DOMRectInit> rootBounds; >+ WTF::Optional<DOMRectInit> rootBounds; > DOMRectInit boundingClientRect; > DOMRectInit intersectionRect; > double intersectionRatio; >diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp >index a40fd22670f3f64197aabe7b4c375716b7404804..971253790d91d1d180892c4ee416402982c4a1e0 100644 >--- a/Source/WebCore/page/Navigator.cpp >+++ b/Source/WebCore/page/Navigator.cpp >@@ -119,7 +119,7 @@ void Navigator::share(ScriptExecutionContext& context, ShareData data, Ref<Defer > return; > } > >- std::optional<URL> url; >+ WTF::Optional<URL> url; > if (!data.url.isEmpty()) { > url = context.completeURL(data.url); > if (!url->isValid()) { >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index 1c7fea39328a15ef5501d5d40ba74815fd7e5791..1b83b480b92ac1add14e53537e9928cf331bdf4b 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -602,7 +602,7 @@ bool Page::showAllPlugins() const > return false; > } > >-inline std::optional<std::pair<MediaCanStartListener&, Document&>> Page::takeAnyMediaCanStartListener() >+inline WTF::Optional<std::pair<MediaCanStartListener&, Document&>> Page::takeAnyMediaCanStartListener() > { > for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { > if (!frame->document()) >@@ -610,7 +610,7 @@ inline std::optional<std::pair<MediaCanStartListener&, Document&>> Page::takeAn > if (MediaCanStartListener* listener = frame->document()->takeAnyMediaCanStartListener()) > return { { *listener, *frame->document() } }; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > void Page::setCanStartMedia(bool canStartMedia) >@@ -1125,7 +1125,7 @@ bool Page::isLowPowerModeEnabled() const > return m_lowPowerModeNotifier->isLowPowerModeEnabled(); > } > >-void Page::setLowPowerModeEnabledOverrideForTesting(std::optional<bool> isEnabled) >+void Page::setLowPowerModeEnabledOverrideForTesting(WTF::Optional<bool> isEnabled) > { > m_lowPowerModeEnabledOverrideForTesting = isEnabled; > handleLowModePowerChange(m_lowPowerModeEnabledOverrideForTesting.value_or(false)); >@@ -1347,7 +1347,7 @@ void Page::userStyleSheetLocationChanged() > > m_didLoadUserStyleSheet = false; > m_userStyleSheet = String(); >- m_userStyleSheetModificationTime = std::nullopt; >+ m_userStyleSheetModificationTime = WTF::nullopt; > > // Data URLs with base64-encoded UTF-8 style sheets are common. We can process them > // synchronously and avoid using a loader. >@@ -1871,7 +1871,7 @@ void Page::setIsVisibleInternal(bool isVisible) > > if (m_navigationToLogWhenVisible) { > logNavigation(m_navigationToLogWhenVisible.value()); >- m_navigationToLogWhenVisible = std::nullopt; >+ m_navigationToLogWhenVisible = WTF::nullopt; > } > } > >@@ -2337,7 +2337,7 @@ void Page::mainFrameLoadStarted(const URL& destinationURL, FrameLoadType type) > return; > } > >- m_navigationToLogWhenVisible = std::nullopt; >+ m_navigationToLogWhenVisible = WTF::nullopt; > logNavigation(navigation); > } > >@@ -2645,7 +2645,7 @@ bool Page::useDarkAppearance() const > return m_useDarkAppearance; > } > >-void Page::setUseDarkAppearanceOverride(std::optional<bool> valueOverride) >+void Page::setUseDarkAppearanceOverride(WTF::Optional<bool> valueOverride) > { > if (valueOverride == m_useDarkAppearanceOverride) > return; >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index d656f1e83effa14c58d572a18bbafbf7197d0e45..c85fc0dbc3944591e21f8344a9f561d6b0bc2e95 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -360,7 +360,7 @@ public: > WEBCORE_EXPORT bool useDarkAppearance() const; > WEBCORE_EXPORT void setUseDarkAppearance(bool); > bool defaultUseDarkAppearance() const { return m_useDarkAppearance; } >- void setUseDarkAppearanceOverride(std::optional<bool>); >+ void setUseDarkAppearanceOverride(WTF::Optional<bool>); > > #if ENABLE(TEXT_AUTOSIZING) > float textAutosizingWidth() const { return m_textAutosizingWidth; } >@@ -426,7 +426,7 @@ public: > #endif > > #if ENABLE(APPLICATION_MANIFEST) >- const std::optional<ApplicationManifest>& applicationManifest() const { return m_applicationManifest; } >+ const WTF::Optional<ApplicationManifest>& applicationManifest() const { return m_applicationManifest; } > #endif > > // Notifications when the Page starts and stops being presented via a native window. >@@ -656,11 +656,11 @@ public: > // Web Inspector can override whatever value is set via WebKit SPI, but only while it is open. > void setResourceCachingDisabledOverride(bool disabled) { m_resourceCachingDisabledOverride = disabled; } > >- std::optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const { return m_eventThrottlingBehaviorOverride; } >- void setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior> throttling) { m_eventThrottlingBehaviorOverride = throttling; } >+ WTF::Optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const { return m_eventThrottlingBehaviorOverride; } >+ void setEventThrottlingBehaviorOverride(WTF::Optional<EventThrottlingBehavior> throttling) { m_eventThrottlingBehaviorOverride = throttling; } > >- std::optional<CompositingPolicy> compositingPolicyOverride() const { return m_compositingPolicyOverride; } >- void setCompositingPolicyOverride(std::optional<CompositingPolicy> policy) { m_compositingPolicyOverride = policy; } >+ WTF::Optional<CompositingPolicy> compositingPolicyOverride() const { return m_compositingPolicyOverride; } >+ void setCompositingPolicyOverride(WTF::Optional<CompositingPolicy> policy) { m_compositingPolicyOverride = policy; } > > WebGLStateTracker* webGLStateTracker() const { return m_webGLStateTracker.get(); } > >@@ -672,7 +672,7 @@ public: > #endif > > bool isLowPowerModeEnabled() const; >- WEBCORE_EXPORT void setLowPowerModeEnabledOverrideForTesting(std::optional<bool>); >+ WEBCORE_EXPORT void setLowPowerModeEnabledOverrideForTesting(WTF::Optional<bool>); > > WEBCORE_EXPORT void applicationWillResignActive(); > WEBCORE_EXPORT void applicationDidEnterBackground(); >@@ -705,7 +705,7 @@ private: > > unsigned findMatchesForText(const String&, FindOptions, unsigned maxMatchCount, ShouldHighlightMatches, ShouldMarkMatches); > >- std::optional<std::pair<MediaCanStartListener&, Document&>> takeAnyMediaCanStartListener(); >+ WTF::Optional<std::pair<MediaCanStartListener&, Document&>> takeAnyMediaCanStartListener(); > > #if ENABLE(VIDEO) > void playbackControlsManagerUpdateTimerFired(); >@@ -794,7 +794,7 @@ private: > > bool m_useSystemAppearance { false }; > bool m_useDarkAppearance { false }; >- std::optional<bool> m_useDarkAppearanceOverride; >+ WTF::Optional<bool> m_useDarkAppearanceOverride; > > #if ENABLE(TEXT_AUTOSIZING) > float m_textAutosizingWidth { 0 }; >@@ -811,7 +811,7 @@ private: > String m_userStyleSheetPath; > mutable String m_userStyleSheet; > mutable bool m_didLoadUserStyleSheet { false }; >- mutable std::optional<WallTime> m_userStyleSheetModificationTime; >+ mutable WTF::Optional<WallTime> m_userStyleSheetModificationTime; > > String m_captionUserPreferencesStyleSheet; > >@@ -912,14 +912,14 @@ private: > UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { UserInterfaceLayoutDirection::LTR }; > > // For testing. >- std::optional<EventThrottlingBehavior> m_eventThrottlingBehaviorOverride; >- std::optional<CompositingPolicy> m_compositingPolicyOverride; >+ WTF::Optional<EventThrottlingBehavior> m_eventThrottlingBehaviorOverride; >+ WTF::Optional<CompositingPolicy> m_compositingPolicyOverride; > > std::unique_ptr<PerformanceMonitor> m_performanceMonitor; > std::unique_ptr<LowPowerModeNotifier> m_lowPowerModeNotifier; >- std::optional<bool> m_lowPowerModeEnabledOverrideForTesting; >+ WTF::Optional<bool> m_lowPowerModeEnabledOverrideForTesting; > >- std::optional<Navigation> m_navigationToLogWhenVisible; >+ WTF::Optional<Navigation> m_navigationToLogWhenVisible; > > std::unique_ptr<PerformanceLogging> m_performanceLogging; > #if PLATFORM(MAC) >@@ -941,7 +941,7 @@ private: > #endif > > #if ENABLE(APPLICATION_MANIFEST) >- std::optional<ApplicationManifest> m_applicationManifest; >+ WTF::Optional<ApplicationManifest> m_applicationManifest; > #endif > > bool m_shouldEnableICECandidateFilteringByDefault { true }; >diff --git a/Source/WebCore/page/PageConfiguration.h b/Source/WebCore/page/PageConfiguration.h >index 18a7723310055915ce8e06414298ae648f2cd176..2c0af4314d57298798fe9022c8edcb5504d873bb 100644 >--- a/Source/WebCore/page/PageConfiguration.h >+++ b/Source/WebCore/page/PageConfiguration.h >@@ -87,7 +87,7 @@ public: > #endif > > #if ENABLE(APPLICATION_MANIFEST) >- std::optional<ApplicationManifest> applicationManifest; >+ WTF::Optional<ApplicationManifest> applicationManifest; > #endif > > UniqueRef<LibWebRTCProvider> libWebRTCProvider; >diff --git a/Source/WebCore/page/PerformanceEntry.cpp b/Source/WebCore/page/PerformanceEntry.cpp >index 7fc81ab1be9f8d68395ddb16cc0a27680a20a42a..446fb65099daff127f9fe1ee74351d9540c7f7ba 100644 >--- a/Source/WebCore/page/PerformanceEntry.cpp >+++ b/Source/WebCore/page/PerformanceEntry.cpp >@@ -46,24 +46,24 @@ PerformanceEntry::PerformanceEntry(Type type, const String& name, const String& > > PerformanceEntry::~PerformanceEntry() = default; > >-std::optional<PerformanceEntry::Type> PerformanceEntry::parseEntryTypeString(const String& entryType) >+WTF::Optional<PerformanceEntry::Type> PerformanceEntry::parseEntryTypeString(const String& entryType) > { > if (entryType == "navigation") >- return std::optional<Type>(Type::Navigation); >+ return WTF::Optional<Type>(Type::Navigation); > > if (RuntimeEnabledFeatures::sharedFeatures().userTimingEnabled()) { > if (entryType == "mark") >- return std::optional<Type>(Type::Mark); >+ return WTF::Optional<Type>(Type::Mark); > if (entryType == "measure") >- return std::optional<Type>(Type::Measure); >+ return WTF::Optional<Type>(Type::Measure); > } > > if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) { > if (entryType == "resource") >- return std::optional<Type>(Type::Resource); >+ return WTF::Optional<Type>(Type::Resource); > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WebCore >diff --git a/Source/WebCore/page/PerformanceEntry.h b/Source/WebCore/page/PerformanceEntry.h >index 918aa18f591d6b43077872c0ce73d3f3c45e93d2..6682dab4beb591d4208ba53adcd7c578d8c51c79 100644 >--- a/Source/WebCore/page/PerformanceEntry.h >+++ b/Source/WebCore/page/PerformanceEntry.h >@@ -56,7 +56,7 @@ public: > > Type type() const { return m_type; } > >- static std::optional<Type> parseEntryTypeString(const String& entryType); >+ static WTF::Optional<Type> parseEntryTypeString(const String& entryType); > > bool isResource() const { return m_type == Type::Resource; } > bool isMark() const { return m_type == Type::Mark; } >diff --git a/Source/WebCore/page/PerformanceLogging.cpp b/Source/WebCore/page/PerformanceLogging.cpp >index a875fdb71ddee87149efc886a520667e57793dcf..f851a064b2db4ee902fb6b87521d6b9064fe55d8 100644 >--- a/Source/WebCore/page/PerformanceLogging.cpp >+++ b/Source/WebCore/page/PerformanceLogging.cpp >@@ -105,7 +105,7 @@ void PerformanceLogging::didReachPointOfInterest(PointOfInterest poi) > > #if !PLATFORM(COCOA) > void PerformanceLogging::getPlatformMemoryUsageStatistics(HashMap<const char*, size_t>&) { } >-std::optional<uint64_t> PerformanceLogging::physicalFootprint() { return std::nullopt; } >+WTF::Optional<uint64_t> PerformanceLogging::physicalFootprint() { return WTF::nullopt; } > #endif > > } >diff --git a/Source/WebCore/page/PerformanceLogging.h b/Source/WebCore/page/PerformanceLogging.h >index 32b4c0e9a1e121829dab6fbcec089cabdd699904..42742ac994696eb9fedc224bf890c679b041d4fe 100644 >--- a/Source/WebCore/page/PerformanceLogging.h >+++ b/Source/WebCore/page/PerformanceLogging.h >@@ -49,7 +49,7 @@ public: > > WEBCORE_EXPORT static HashCountedSet<const char*> javaScriptObjectCounts(); > WEBCORE_EXPORT static HashMap<const char*, size_t> memoryUsageStatistics(ShouldIncludeExpensiveComputations); >- WEBCORE_EXPORT static std::optional<uint64_t> physicalFootprint(); >+ WEBCORE_EXPORT static WTF::Optional<uint64_t> physicalFootprint(); > > private: > static void getPlatformMemoryUsageStatistics(HashMap<const char*, size_t>&); >diff --git a/Source/WebCore/page/PerformanceMonitor.cpp b/Source/WebCore/page/PerformanceMonitor.cpp >index ab5c35039d83303e657d31f432f92ba6618abd84..0ced7761747b9e8e7f73ec6566e8f597c7a24045 100644 >--- a/Source/WebCore/page/PerformanceMonitor.cpp >+++ b/Source/WebCore/page/PerformanceMonitor.cpp >@@ -83,7 +83,7 @@ PerformanceMonitor::PerformanceMonitor(Page& page) > > void PerformanceMonitor::didStartProvisionalLoad() > { >- m_postLoadCPUTime = std::nullopt; >+ m_postLoadCPUTime = WTF::nullopt; > m_postPageLoadCPUUsageTimer.stop(); > m_postPageLoadMemoryUsageTimer.stop(); > } >@@ -92,7 +92,7 @@ void PerformanceMonitor::didFinishLoad() > { > // Only do post-load CPU usage measurement if there is a single Page in the process in order to reduce noise. > if (DeprecatedGlobalSettings::isPostLoadCPUUsageMeasurementEnabled() && m_page.isOnlyNonUtilityPage()) { >- m_postLoadCPUTime = std::nullopt; >+ m_postLoadCPUTime = WTF::nullopt; > m_postPageLoadCPUUsageTimer.startOneShot(cpuUsageMeasurementDelay); > } > >@@ -108,7 +108,7 @@ void PerformanceMonitor::activityStateChanged(OptionSet<ActivityState::Flag> old > > // Measure CPU usage of pages when they are no longer visible. > if (DeprecatedGlobalSettings::isPostBackgroundingCPUUsageMeasurementEnabled() && visibilityChanged) { >- m_postBackgroundingCPUTime = std::nullopt; >+ m_postBackgroundingCPUTime = WTF::nullopt; > if (newState & ActivityState::IsVisible) > m_postBackgroundingCPUUsageTimer.stop(); > else if (m_page.isOnlyNonUtilityPage()) >@@ -169,7 +169,7 @@ static void reportPageOverPostLoadResourceThreshold(Page& page, ReportingReason > void PerformanceMonitor::measurePostLoadCPUUsage() > { > if (!m_page.isOnlyNonUtilityPage()) { >- m_postLoadCPUTime = std::nullopt; >+ m_postLoadCPUTime = WTF::nullopt; > return; > } > >@@ -179,7 +179,7 @@ void PerformanceMonitor::measurePostLoadCPUUsage() > m_postPageLoadCPUUsageTimer.startOneShot(postLoadCPUUsageMeasurementDuration); > return; > } >- std::optional<CPUTime> cpuTime = CPUTime::get(); >+ WTF::Optional<CPUTime> cpuTime = CPUTime::get(); > if (!cpuTime) > return; > >@@ -196,7 +196,7 @@ void PerformanceMonitor::measurePostLoadMemoryUsage() > if (!m_page.isOnlyNonUtilityPage()) > return; > >- std::optional<uint64_t> memoryUsage = PerformanceLogging::physicalFootprint(); >+ WTF::Optional<uint64_t> memoryUsage = PerformanceLogging::physicalFootprint(); > if (!memoryUsage) > return; > >@@ -215,7 +215,7 @@ void PerformanceMonitor::measurePostBackgroundingMemoryUsage() > if (!m_page.isOnlyNonUtilityPage()) > return; > >- std::optional<uint64_t> memoryUsage = PerformanceLogging::physicalFootprint(); >+ WTF::Optional<uint64_t> memoryUsage = PerformanceLogging::physicalFootprint(); > if (!memoryUsage) > return; > >@@ -226,7 +226,7 @@ void PerformanceMonitor::measurePostBackgroundingMemoryUsage() > void PerformanceMonitor::measurePostBackgroundingCPUUsage() > { > if (!m_page.isOnlyNonUtilityPage()) { >- m_postBackgroundingCPUTime = std::nullopt; >+ m_postBackgroundingCPUTime = WTF::nullopt; > return; > } > >@@ -236,7 +236,7 @@ void PerformanceMonitor::measurePostBackgroundingCPUUsage() > m_postBackgroundingCPUUsageTimer.startOneShot(backgroundCPUUsageMeasurementDuration); > return; > } >- std::optional<CPUTime> cpuTime = CPUTime::get(); >+ WTF::Optional<CPUTime> cpuTime = CPUTime::get(); > if (!cpuTime) > return; > >@@ -269,7 +269,7 @@ static inline const char* stringForCPUSamplingActivityState(ActivityStateForCPUS > void PerformanceMonitor::measureCPUUsageInActivityState(ActivityStateForCPUSampling activityState) > { > if (!m_page.isOnlyNonUtilityPage()) { >- m_perActivityStateCPUTime = std::nullopt; >+ m_perActivityStateCPUTime = WTF::nullopt; > return; > } > >@@ -278,9 +278,9 @@ void PerformanceMonitor::measureCPUUsageInActivityState(ActivityStateForCPUSampl > return; > } > >- std::optional<CPUTime> cpuTime = CPUTime::get(); >+ WTF::Optional<CPUTime> cpuTime = CPUTime::get(); > if (!cpuTime) { >- m_perActivityStateCPUTime = std::nullopt; >+ m_perActivityStateCPUTime = WTF::nullopt; > return; > } > >diff --git a/Source/WebCore/page/PerformanceMonitor.h b/Source/WebCore/page/PerformanceMonitor.h >index 29c81c72290b832269113f65d364fa30c8403254..6c8e7de6a2d28b3c5e5607c6bb6e637ecf13c893 100644 >--- a/Source/WebCore/page/PerformanceMonitor.h >+++ b/Source/WebCore/page/PerformanceMonitor.h >@@ -55,11 +55,11 @@ private: > Page& m_page; > > Timer m_postPageLoadCPUUsageTimer; >- std::optional<CPUTime> m_postLoadCPUTime; >+ WTF::Optional<CPUTime> m_postLoadCPUTime; > Timer m_postBackgroundingCPUUsageTimer; >- std::optional<CPUTime> m_postBackgroundingCPUTime; >+ WTF::Optional<CPUTime> m_postBackgroundingCPUTime; > Timer m_perActivityStateCPUUsageTimer; >- std::optional<CPUTime> m_perActivityStateCPUTime; >+ WTF::Optional<CPUTime> m_perActivityStateCPUTime; > > Timer m_postPageLoadMemoryUsageTimer; > Timer m_postBackgroundingMemoryUsageTimer; >diff --git a/Source/WebCore/page/PerformanceObserverEntryList.cpp b/Source/WebCore/page/PerformanceObserverEntryList.cpp >index 238634db6abb59e6e2a0aa1fea34a845474cf89d..658615279438eb3d714393d653e93faaf7206560 100644 >--- a/Source/WebCore/page/PerformanceObserverEntryList.cpp >+++ b/Source/WebCore/page/PerformanceObserverEntryList.cpp >@@ -54,7 +54,7 @@ Vector<RefPtr<PerformanceEntry>> PerformanceObserverEntryList::getEntriesByName( > > // PerformanceObservers can only be registered for valid types. > // So if the incoming entryType is an unknown type, there will be no matches. >- std::optional<PerformanceEntry::Type> type; >+ WTF::Optional<PerformanceEntry::Type> type; > if (!entryType.isNull()) { > type = PerformanceEntry::parseEntryTypeString(entryType); > if (!type) >diff --git a/Source/WebCore/page/PrewarmInformation.h b/Source/WebCore/page/PrewarmInformation.h >index 1ba98922853ca7e94f4d03762e5deee881d3b45b..3be63ef87bd27b4c5076560e699fd004e8707acd 100644 >--- a/Source/WebCore/page/PrewarmInformation.h >+++ b/Source/WebCore/page/PrewarmInformation.h >@@ -35,7 +35,7 @@ struct WEBCORE_EXPORT PrewarmInformation { > FontCache::PrewarmInformation fontCache; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<PrewarmInformation> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<PrewarmInformation> decode(Decoder&); > }; > > template<class Encoder> >@@ -45,9 +45,9 @@ void PrewarmInformation::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<PrewarmInformation> PrewarmInformation::decode(Decoder& decoder) >+WTF::Optional<PrewarmInformation> PrewarmInformation::decode(Decoder& decoder) > { >- std::optional<FontCache::PrewarmInformation> fontCachePrewarmInformation; >+ WTF::Optional<FontCache::PrewarmInformation> fontCachePrewarmInformation; > decoder >> fontCachePrewarmInformation; > if (!fontCachePrewarmInformation) > return { }; >diff --git a/Source/WebCore/page/Quirks.h b/Source/WebCore/page/Quirks.h >index d95bf095105bfec498eefaf805da7b98070b77ad..a909aad9e68c19b5cbe7df8e47f1c576df66e872 100644 >--- a/Source/WebCore/page/Quirks.h >+++ b/Source/WebCore/page/Quirks.h >@@ -42,7 +42,7 @@ public: > private: > WeakPtr<Document> m_document; > >- mutable std::optional<bool> m_hasBrokenEncryptedMediaAPISupportQuirk; >+ mutable WTF::Optional<bool> m_hasBrokenEncryptedMediaAPISupportQuirk; > }; > > } >diff --git a/Source/WebCore/page/ScrollIntoViewOptions.h b/Source/WebCore/page/ScrollIntoViewOptions.h >index 328d2ec3cf2df587706df2991c7244534ca38d44..2f3318aadbc7a1af838d21cff875dc87bd89b6fe 100644 >--- a/Source/WebCore/page/ScrollIntoViewOptions.h >+++ b/Source/WebCore/page/ScrollIntoViewOptions.h >@@ -26,8 +26,8 @@ namespace WebCore { > class Element; > > struct ScrollIntoViewOptions { >- std::optional<ScrollLogicalPosition> blockPosition { ScrollLogicalPosition::Start }; >- std::optional<ScrollLogicalPosition> inlinePosition { ScrollLogicalPosition::Nearest }; >+ WTF::Optional<ScrollLogicalPosition> blockPosition { ScrollLogicalPosition::Start }; >+ WTF::Optional<ScrollLogicalPosition> inlinePosition { ScrollLogicalPosition::Nearest }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/page/ScrollToOptions.h b/Source/WebCore/page/ScrollToOptions.h >index 87eeaa9cca9527681f383fc2b4d449f0d480e24f..60367266441d20f525a046ae9ee3818edad5cfbd 100644 >--- a/Source/WebCore/page/ScrollToOptions.h >+++ b/Source/WebCore/page/ScrollToOptions.h >@@ -34,11 +34,11 @@ > namespace WebCore { > > struct ScrollToOptions { >- std::optional<double> left; >- std::optional<double> top; >+ WTF::Optional<double> left; >+ WTF::Optional<double> top; > }; > >-inline double normalizeNonFiniteValueOrFallBackTo(std::optional<double> value, double fallbackValue) >+inline double normalizeNonFiniteValueOrFallBackTo(WTF::Optional<double> value, double fallbackValue) > { > // Normalize non-finite values (https://drafts.csswg.org/cssom-view/#normalize-non-finite-values). > return value ? (std::isfinite(*value) ? *value : 0) : fallbackValue; >diff --git a/Source/WebCore/page/SecurityOrigin.cpp b/Source/WebCore/page/SecurityOrigin.cpp >index d98a061e552222a406faae0f1c113c12c65954f3..8cabf6727a7436145b58c879ea1fa064edf57b6a 100644 >--- a/Source/WebCore/page/SecurityOrigin.cpp >+++ b/Source/WebCore/page/SecurityOrigin.cpp >@@ -149,7 +149,7 @@ SecurityOrigin::SecurityOrigin(const URL& url) > m_domain = m_data.host; > > if (m_data.port && WTF::isDefaultPortForProtocol(m_data.port.value(), m_data.protocol)) >- m_data.port = std::nullopt; >+ m_data.port = WTF::nullopt; > > // By default, only local SecurityOrigins can load local resources. > m_canLoadLocalResources = isLocal(); >@@ -161,7 +161,7 @@ SecurityOrigin::SecurityOrigin(const URL& url) > } > > SecurityOrigin::SecurityOrigin() >- : m_data { emptyString(), emptyString(), std::nullopt } >+ : m_data { emptyString(), emptyString(), WTF::nullopt } > , m_domain { emptyString() } > , m_isUnique { true } > , m_isPotentiallyTrustworthy { true } >@@ -512,7 +512,7 @@ Ref<SecurityOrigin> SecurityOrigin::createFromString(const String& originString) > return SecurityOrigin::create(URL(URL(), originString)); > } > >-Ref<SecurityOrigin> SecurityOrigin::create(const String& protocol, const String& host, std::optional<uint16_t> port) >+Ref<SecurityOrigin> SecurityOrigin::create(const String& protocol, const String& host, WTF::Optional<uint16_t> port) > { > String decodedHost = decodeURLEscapeSequences(host); > auto origin = create(URL(URL(), protocol + "://" + host + "/")); >diff --git a/Source/WebCore/page/SecurityOrigin.h b/Source/WebCore/page/SecurityOrigin.h >index ba78b6cdef31e242d8d0332de6f302d2f00e804c..f3ec8d69bb1c9a85422f8ce932ad1f93412fbddc 100644 >--- a/Source/WebCore/page/SecurityOrigin.h >+++ b/Source/WebCore/page/SecurityOrigin.h >@@ -52,7 +52,7 @@ public: > WEBCORE_EXPORT static Ref<SecurityOrigin> createUnique(); > > WEBCORE_EXPORT static Ref<SecurityOrigin> createFromString(const String&); >- WEBCORE_EXPORT static Ref<SecurityOrigin> create(const String& protocol, const String& host, std::optional<uint16_t> port); >+ WEBCORE_EXPORT static Ref<SecurityOrigin> create(const String& protocol, const String& host, WTF::Optional<uint16_t> port); > > // Some URL schemes use nested URLs for their security context. For example, > // filesystem URLs look like the following: >@@ -80,7 +80,7 @@ public: > const String& protocol() const { return m_data.protocol; } > const String& host() const { return m_data.host; } > const String& domain() const { return m_domain; } >- std::optional<uint16_t> port() const { return m_data.port; } >+ WTF::Optional<uint16_t> port() const { return m_data.port; } > > // Returns true if a given URL is secure, based either directly on its > // own protocol, or, when relevant, on the protocol of its "inner URL" >@@ -261,7 +261,7 @@ template<class Encoder> inline void SecurityOrigin::encode(Encoder& encoder) con > > template<class Decoder> inline RefPtr<SecurityOrigin> SecurityOrigin::decode(Decoder& decoder) > { >- std::optional<SecurityOriginData> data; >+ WTF::Optional<SecurityOriginData> data; > decoder >> data; > if (!data) > return nullptr; >diff --git a/Source/WebCore/page/SecurityOriginData.cpp b/Source/WebCore/page/SecurityOriginData.cpp >index b7f83cee2674d55acfcc98e9e1139a407151a0a6..be7b70067d5e19a1e1028fadb07e6c8f74ef0012 100644 >--- a/Source/WebCore/page/SecurityOriginData.cpp >+++ b/Source/WebCore/page/SecurityOriginData.cpp >@@ -85,37 +85,37 @@ String SecurityOriginData::databaseIdentifier() const > return stringBuilder.toString(); > } > >-std::optional<SecurityOriginData> SecurityOriginData::fromDatabaseIdentifier(const String& databaseIdentifier) >+WTF::Optional<SecurityOriginData> SecurityOriginData::fromDatabaseIdentifier(const String& databaseIdentifier) > { > // Make sure there's a first separator > size_t separator1 = databaseIdentifier.find(separatorCharacter); > if (separator1 == notFound) >- return std::nullopt; >+ return WTF::nullopt; > > // Make sure there's a second separator > size_t separator2 = databaseIdentifier.reverseFind(separatorCharacter); > if (separator2 == notFound) >- return std::nullopt; >+ return WTF::nullopt; > > // Ensure there were at least 2 separator characters. Some hostnames on intranets have > // underscores in them, so we'll assume that any additional underscores are part of the host. > if (separator1 == separator2) >- return std::nullopt; >+ return WTF::nullopt; > > // Make sure the port section is a valid port number or doesn't exist > bool portOkay; > int port = databaseIdentifier.right(databaseIdentifier.length() - separator2 - 1).toInt(&portOkay); > bool portAbsent = (separator2 == databaseIdentifier.length() - 1); > if (!(portOkay || portAbsent)) >- return std::nullopt; >+ return WTF::nullopt; > > if (port < 0 || port > std::numeric_limits<uint16_t>::max()) >- return std::nullopt; >+ return WTF::nullopt; > > auto protocol = databaseIdentifier.substring(0, separator1); > auto host = databaseIdentifier.substring(separator1 + 1, separator2 - separator1 - 1); > if (!port) >- return SecurityOriginData { protocol, host, std::nullopt }; >+ return SecurityOriginData { protocol, host, WTF::nullopt }; > > return SecurityOriginData { protocol, host, static_cast<uint16_t>(port) }; > } >diff --git a/Source/WebCore/page/SecurityOriginData.h b/Source/WebCore/page/SecurityOriginData.h >index 27762ea21d6d2065e9dd0146db979b332ec456c0..9625f517103bb655d5474d99ede3ff4cadda233a 100644 >--- a/Source/WebCore/page/SecurityOriginData.h >+++ b/Source/WebCore/page/SecurityOriginData.h >@@ -34,7 +34,7 @@ class SecurityOrigin; > > struct SecurityOriginData { > SecurityOriginData() = default; >- SecurityOriginData(const String& protocol, const String& host, std::optional<uint16_t> port) >+ SecurityOriginData(const String& protocol, const String& host, WTF::Optional<uint16_t> port) > : protocol(protocol) > , host(host) > , port(port) >@@ -62,21 +62,21 @@ struct SecurityOriginData { > > String protocol; > String host; >- std::optional<uint16_t> port; >+ WTF::Optional<uint16_t> port; > > WEBCORE_EXPORT SecurityOriginData isolatedCopy() const; > > // Serialize the security origin to a string that could be used as part of > // file names. This format should be used in storage APIs only. > WEBCORE_EXPORT String databaseIdentifier() const; >- WEBCORE_EXPORT static std::optional<SecurityOriginData> fromDatabaseIdentifier(const String&); >+ WEBCORE_EXPORT static WTF::Optional<SecurityOriginData> fromDatabaseIdentifier(const String&); > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<SecurityOriginData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<SecurityOriginData> decode(Decoder&); > > bool isEmpty() const > { >- return protocol.isNull() && host.isNull() && port == std::nullopt; >+ return protocol.isNull() && host.isNull() && port == WTF::nullopt; > } > > bool isHashTableDeletedValue() const >@@ -103,21 +103,21 @@ void SecurityOriginData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<SecurityOriginData> SecurityOriginData::decode(Decoder& decoder) >+WTF::Optional<SecurityOriginData> SecurityOriginData::decode(Decoder& decoder) > { >- std::optional<String> protocol; >+ WTF::Optional<String> protocol; > decoder >> protocol; > if (!protocol) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> host; >+ WTF::Optional<String> host; > decoder >> host; > if (!host) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint16_t> port; >+ WTF::Optional<uint16_t> port; > if (!decoder.decode(port)) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*protocol), WTFMove(*host), WTFMove(port) }}; > } >diff --git a/Source/WebCore/page/ShareData.h b/Source/WebCore/page/ShareData.h >index 44d0a33f393c83a85a7e36a24d886e3efb57a1a3..e5dc0917c93b6f89d18ea58077670482351bd9b9 100644 >--- a/Source/WebCore/page/ShareData.h >+++ b/Source/WebCore/page/ShareData.h >@@ -36,7 +36,7 @@ struct ShareData { > > struct ShareDataWithParsedURL { > ShareData shareData; >- std::optional<URL> url; >+ WTF::Optional<URL> url; > }; > > } >diff --git a/Source/WebCore/page/ViewportConfiguration.cpp b/Source/WebCore/page/ViewportConfiguration.cpp >index d4bf6c2bcf99da41d4974d61631f46a895b0fe0a..63846932fcb2cd4de1aebe663cff401705982349 100644 >--- a/Source/WebCore/page/ViewportConfiguration.cpp >+++ b/Source/WebCore/page/ViewportConfiguration.cpp >@@ -114,7 +114,7 @@ bool ViewportConfiguration::setContentsSize(const IntSize& contentSize) > return true; > } > >-bool ViewportConfiguration::setViewLayoutSize(const FloatSize& viewLayoutSize, std::optional<double>&& scaleFactor, std::optional<double>&& minimumEffectiveDeviceWidth) >+bool ViewportConfiguration::setViewLayoutSize(const FloatSize& viewLayoutSize, WTF::Optional<double>&& scaleFactor, WTF::Optional<double>&& minimumEffectiveDeviceWidth) > { > double newScaleFactor = scaleFactor.value_or(m_layoutSizeScaleFactor); > double newEffectiveWidth = minimumEffectiveDeviceWidth.value_or(m_minimumEffectiveDeviceWidth); >diff --git a/Source/WebCore/page/ViewportConfiguration.h b/Source/WebCore/page/ViewportConfiguration.h >index 4da765af20aa9ebffb595919d4db5a75951e0ec5..f85c74601e8a1c51ac4684ccf8336aace02a2173 100644 >--- a/Source/WebCore/page/ViewportConfiguration.h >+++ b/Source/WebCore/page/ViewportConfiguration.h >@@ -77,7 +77,7 @@ public: > const FloatSize& viewLayoutSize() const { return m_viewLayoutSize; } > > const FloatSize& minimumLayoutSize() const { return m_minimumLayoutSize; } >- WEBCORE_EXPORT bool setViewLayoutSize(const FloatSize&, std::optional<double>&& scaleFactor = std::nullopt, std::optional<double>&& effectiveWidth = std::nullopt); >+ WEBCORE_EXPORT bool setViewLayoutSize(const FloatSize&, WTF::Optional<double>&& scaleFactor = WTF::nullopt, WTF::Optional<double>&& effectiveWidth = WTF::nullopt); > > const OptionSet<DisabledAdaptations>& disabledAdaptations() const { return m_disabledAdaptations; } > WEBCORE_EXPORT bool setDisabledAdaptations(const OptionSet<DisabledAdaptations>&); >diff --git a/Source/WebCore/page/WindowFeatures.cpp b/Source/WebCore/page/WindowFeatures.cpp >index 067645c7251e25718004bea58202f51554138d15..872e6e6a10652a3974c32b0eced39df786531638 100644 >--- a/Source/WebCore/page/WindowFeatures.cpp >+++ b/Source/WebCore/page/WindowFeatures.cpp >@@ -37,8 +37,8 @@ typedef HashMap<String, String, ASCIICaseInsensitiveHash> DialogFeaturesMap; > static void setWindowFeature(WindowFeatures&, StringView key, StringView value); > > static DialogFeaturesMap parseDialogFeaturesMap(const String&); >-static std::optional<bool> boolFeature(const DialogFeaturesMap&, const char* key); >-static std::optional<float> floatFeature(const DialogFeaturesMap&, const char* key, float min, float max); >+static WTF::Optional<bool> boolFeature(const DialogFeaturesMap&, const char* key); >+static WTF::Optional<float> floatFeature(const DialogFeaturesMap&, const char* key, float min, float max); > > // https://html.spec.whatwg.org/#feature-separator > static bool isSeparator(UChar character, FeatureMode mode) >@@ -205,11 +205,11 @@ WindowFeatures parseDialogFeatures(const String& dialogFeaturesString, const Flo > return features; > } > >-static std::optional<bool> boolFeature(const DialogFeaturesMap& features, const char* key) >+static WTF::Optional<bool> boolFeature(const DialogFeaturesMap& features, const char* key) > { > auto it = features.find(key); > if (it == features.end()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& value = it->value; > return value.isNull() >@@ -218,18 +218,18 @@ static std::optional<bool> boolFeature(const DialogFeaturesMap& features, const > || equalLettersIgnoringASCIICase(value, "on"); > } > >-static std::optional<float> floatFeature(const DialogFeaturesMap& features, const char* key, float min, float max) >+static WTF::Optional<float> floatFeature(const DialogFeaturesMap& features, const char* key, float min, float max) > { > auto it = features.find(key); > if (it == features.end()) >- return std::nullopt; >+ return WTF::nullopt; > > // FIXME: The toDouble function does not offer a way to tell "0q" from string with no digits in it: Both > // return the number 0 and false for ok. But "0q" should yield the minimum rather than the default. > bool ok; > double parsedNumber = it->value.toDouble(&ok); > if ((!parsedNumber && !ok) || std::isnan(parsedNumber)) >- return std::nullopt; >+ return WTF::nullopt; > if (parsedNumber < min || max <= min) > return min; > if (parsedNumber > max) >diff --git a/Source/WebCore/page/WindowFeatures.h b/Source/WebCore/page/WindowFeatures.h >index fec577caa2273361114c93c9483e7e400cdd87e1..acb1e9eff9ea3cd841faeb24fdb692746b09f885 100644 >--- a/Source/WebCore/page/WindowFeatures.h >+++ b/Source/WebCore/page/WindowFeatures.h >@@ -40,10 +40,10 @@ namespace WebCore { > class FloatRect; > > struct WindowFeatures { >- std::optional<float> x; >- std::optional<float> y; >- std::optional<float> width; >- std::optional<float> height; >+ WTF::Optional<float> x; >+ WTF::Optional<float> y; >+ WTF::Optional<float> width; >+ WTF::Optional<float> height; > > bool menuBarVisible { true }; > bool statusBarVisible { true }; >diff --git a/Source/WebCore/page/animation/AnimationBase.cpp b/Source/WebCore/page/animation/AnimationBase.cpp >index d4b56cf24ece83a214ad801967fede953253be4a..baa4b36ad557e3c85d87835e76804bba5aa48140 100644 >--- a/Source/WebCore/page/animation/AnimationBase.cpp >+++ b/Source/WebCore/page/animation/AnimationBase.cpp >@@ -161,10 +161,10 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param) > m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(this); > LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState)); > m_animationState = AnimationState::New; >- m_startTime = std::nullopt; >- m_pauseTime = std::nullopt; >+ m_startTime = WTF::nullopt; >+ m_pauseTime = WTF::nullopt; > m_requestedStartTime = 0; >- m_nextIterationDuration = std::nullopt; >+ m_nextIterationDuration = WTF::nullopt; > endAnimation(); > return; > } >@@ -174,10 +174,10 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param) > m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(this); > LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState)); > m_animationState = AnimationState::New; >- m_startTime = std::nullopt; >- m_pauseTime = std::nullopt; >+ m_startTime = WTF::nullopt; >+ m_pauseTime = WTF::nullopt; > m_requestedStartTime = 0; >- m_nextIterationDuration = std::nullopt; >+ m_nextIterationDuration = WTF::nullopt; > endAnimation(); > > if (!paused()) >@@ -225,7 +225,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param) > // We are pausing before we even started. > LOG(Animations, "%p AnimationState %s -> AnimationState::PausedNew", this, nameForState(m_animationState)); > m_animationState = AnimationState::PausedNew; >- m_pauseTime = std::nullopt; >+ m_pauseTime = WTF::nullopt; > } > > break; >@@ -376,7 +376,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param) > ASSERT(paused()); > // Update the times > m_startTime = m_startTime.value_or(0) + beginAnimationUpdateTime() - m_pauseTime.value_or(0); >- m_pauseTime = std::nullopt; >+ m_pauseTime = WTF::nullopt; > > // we were waiting for the start timer to fire, go back and wait again > LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState)); >@@ -400,7 +400,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param) > // to start, so jump back to the New state and reset. > LOG(Animations, "%p AnimationState %s -> AnimationState::New", this, nameForState(m_animationState)); > m_animationState = AnimationState::New; >- m_pauseTime = std::nullopt; >+ m_pauseTime = WTF::nullopt; > updateStateMachine(input, param); > break; > } >@@ -411,7 +411,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param) > else > m_startTime = 0; > >- m_pauseTime = std::nullopt; >+ m_pauseTime = WTF::nullopt; > > if (m_animationState == AnimationState::PausedWaitStyleAvailable) { > LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animationState)); >@@ -546,12 +546,12 @@ void AnimationBase::updatePlayState(AnimationPlayState playState) > updateStateMachine(pause ? AnimationStateInput::PlayStatePaused : AnimationStateInput::PlayStateRunning, -1); > } > >-std::optional<Seconds> AnimationBase::timeToNextService() >+WTF::Optional<Seconds> AnimationBase::timeToNextService() > { >- // Returns the time at which next service is required. std::nullopt means no service is required. 0 means >+ // Returns the time at which next service is required. WTF::nullopt means no service is required. 0 means > // service is required now, and > 0 means service is required that many seconds in the future. > if (paused() || isNew() || postActive() || fillingForwards()) >- return std::nullopt; >+ return WTF::nullopt; > > if (m_animationState == AnimationState::StartWaitTimer) { > double timeFromNow = m_animation->delay() - (beginAnimationUpdateTime() - m_requestedStartTime); >diff --git a/Source/WebCore/page/animation/AnimationBase.h b/Source/WebCore/page/animation/AnimationBase.h >index b6ccec2138ee7e2103e42e07a92f1deb2f7a5681..126028d3ed555be512b880d8dce058abbd8f8e81 100644 >--- a/Source/WebCore/page/animation/AnimationBase.h >+++ b/Source/WebCore/page/animation/AnimationBase.h >@@ -129,7 +129,7 @@ public: > > bool isAccelerated() const override { return m_isAccelerated; } > >- virtual std::optional<Seconds> timeToNextService(); >+ virtual WTF::Optional<Seconds> timeToNextService(); > > double progress(double scale = 1, double offset = 0, const TimingFunction* = nullptr) const; > >@@ -256,11 +256,11 @@ protected: > CompositeAnimation* m_compositeAnimation; // Ideally this would be a reference, but it has to be cleared if an animation is destroyed inside an event callback. > Ref<Animation> m_animation; > >- std::optional<double> m_startTime; >- std::optional<double> m_pauseTime; >+ WTF::Optional<double> m_startTime; >+ WTF::Optional<double> m_pauseTime; > double m_requestedStartTime { 0 }; >- std::optional<double> m_totalDuration; >- std::optional<double> m_nextIterationDuration; >+ WTF::Optional<double> m_totalDuration; >+ WTF::Optional<double> m_nextIterationDuration; > > AnimationState m_animationState { AnimationState::New }; > bool m_colorFilterFunctionListsMatch { false }; >diff --git a/Source/WebCore/page/animation/CSSAnimationController.cpp b/Source/WebCore/page/animation/CSSAnimationController.cpp >index 5d56afc6682667def2bc57f8029ae5c0a84ffa1b..271b05149aff6812bc7c2cd1fcc999bcfea06a23 100644 >--- a/Source/WebCore/page/animation/CSSAnimationController.cpp >+++ b/Source/WebCore/page/animation/CSSAnimationController.cpp >@@ -128,16 +128,16 @@ bool CSSAnimationControllerPrivate::clear(Element& element) > return result; > } > >-std::optional<Seconds> CSSAnimationControllerPrivate::updateAnimations(SetChanged callSetChanged/* = DoNotCallSetChanged*/) >+WTF::Optional<Seconds> CSSAnimationControllerPrivate::updateAnimations(SetChanged callSetChanged/* = DoNotCallSetChanged*/) > { > AnimationPrivateUpdateBlock updateBlock(*this); >- std::optional<Seconds> timeToNextService; >+ WTF::Optional<Seconds> timeToNextService; > bool calledSetChanged = false; > > for (auto& compositeAnimation : m_compositeAnimations) { > CompositeAnimation& animation = *compositeAnimation.value; > if (!animation.isSuspended() && animation.hasAnimations()) { >- std::optional<Seconds> t = animation.timeToNextService(); >+ WTF::Optional<Seconds> t = animation.timeToNextService(); > if (t && (!timeToNextService || t.value() < timeToNextService.value())) > timeToNextService = t.value(); > if (timeToNextService && timeToNextService.value() == 0_s) { >@@ -159,7 +159,7 @@ std::optional<Seconds> CSSAnimationControllerPrivate::updateAnimations(SetChange > > void CSSAnimationControllerPrivate::updateAnimationTimerForElement(Element& element) > { >- std::optional<Seconds> timeToNextService; >+ WTF::Optional<Seconds> timeToNextService; > > const CompositeAnimation* compositeAnimation = m_compositeAnimations.get(&element); > if (!compositeAnimation->isSuspended() && compositeAnimation->hasAnimations()) >@@ -176,7 +176,7 @@ void CSSAnimationControllerPrivate::updateAnimationTimerForElement(Element& elem > > void CSSAnimationControllerPrivate::updateAnimationTimer(SetChanged callSetChanged/* = DoNotCallSetChanged*/) > { >- std::optional<Seconds> timeToNextService = updateAnimations(callSetChanged); >+ WTF::Optional<Seconds> timeToNextService = updateAnimations(callSetChanged); > > LOG(Animations, "updateAnimationTimer: timeToNextService is %.2f", timeToNextService.value_or(Seconds { -1 }).value()); > >@@ -254,7 +254,7 @@ void CSSAnimationControllerPrivate::addElementChangeToDispatch(Element& element) > > void CSSAnimationControllerPrivate::animationFrameCallbackFired() > { >- std::optional<Seconds> timeToNextService = updateAnimations(CallSetChanged); >+ WTF::Optional<Seconds> timeToNextService = updateAnimations(CallSetChanged); > > if (timeToNextService) > m_frame.document()->view()->scheduleAnimation(); >@@ -444,7 +444,7 @@ MonotonicTime CSSAnimationControllerPrivate::beginAnimationUpdateTime() > void CSSAnimationControllerPrivate::beginAnimationUpdate() > { > if (!m_beginAnimationUpdateCount) >- m_beginAnimationUpdateTime = std::nullopt; >+ m_beginAnimationUpdateTime = WTF::nullopt; > ++m_beginAnimationUpdateCount; > } > >diff --git a/Source/WebCore/page/animation/CSSAnimationControllerPrivate.h b/Source/WebCore/page/animation/CSSAnimationControllerPrivate.h >index baeea46107c7848b63005ff87a2c990f6f3e0df0..d25e4c86c9579292c0f908bbe513975494c3d22d 100644 >--- a/Source/WebCore/page/animation/CSSAnimationControllerPrivate.h >+++ b/Source/WebCore/page/animation/CSSAnimationControllerPrivate.h >@@ -49,7 +49,7 @@ public: > ~CSSAnimationControllerPrivate(); > > // Returns the time until the next animation needs to be serviced, or -1 if there are none. >- std::optional<Seconds> updateAnimations(SetChanged callSetChanged = DoNotCallSetChanged); >+ WTF::Optional<Seconds> updateAnimations(SetChanged callSetChanged = DoNotCallSetChanged); > void updateAnimationTimer(SetChanged callSetChanged = DoNotCallSetChanged); > > CompositeAnimation& ensureCompositeAnimation(Element&); >@@ -130,7 +130,7 @@ private: > Vector<Ref<Element>> m_elementChangesToDispatch; > HashSet<Document*> m_suspendedDocuments; > >- std::optional<MonotonicTime> m_beginAnimationUpdateTime; >+ WTF::Optional<MonotonicTime> m_beginAnimationUpdateTime; > > using AnimationsSet = HashSet<RefPtr<AnimationBase>>; > AnimationsSet m_animationsWaitingForStyle; >diff --git a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp b/Source/WebCore/page/animation/CSSPropertyAnimation.cpp >index b462b9f55fa63fb2b39338d2037769db2fd90f44..ff96f76b753279e6750d1447b03f618deb4df6d1 100644 >--- a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp >+++ b/Source/WebCore/page/animation/CSSPropertyAnimation.cpp >@@ -429,7 +429,7 @@ static inline FontSelectionValue blendFunc(const CSSPropertyBlendingClient* anim > return FontSelectionValue(blendFunc(anim, static_cast<float>(from), static_cast<float>(to), progress)); > } > >-static inline std::optional<FontSelectionValue> blendFunc(const CSSPropertyBlendingClient* anim, std::optional<FontSelectionValue> from, std::optional<FontSelectionValue> to, double progress) >+static inline WTF::Optional<FontSelectionValue> blendFunc(const CSSPropertyBlendingClient* anim, WTF::Optional<FontSelectionValue> from, WTF::Optional<FontSelectionValue> to, double progress) > { > return FontSelectionValue(blendFunc(anim, static_cast<float>(from.value()), static_cast<float>(to.value()), progress)); > } >@@ -1459,11 +1459,11 @@ private: > void (RenderStyle::*m_setter)(const Color&); > }; > >-class PropertyWrapperFontStyle : public PropertyWrapper<std::optional<FontSelectionValue>> { >+class PropertyWrapperFontStyle : public PropertyWrapper<WTF::Optional<FontSelectionValue>> { > WTF_MAKE_FAST_ALLOCATED; > public: > PropertyWrapperFontStyle() >- : PropertyWrapper<std::optional<FontSelectionValue>>(CSSPropertyFontStyle, &RenderStyle::fontItalic, &RenderStyle::setFontItalic) >+ : PropertyWrapper<WTF::Optional<FontSelectionValue>>(CSSPropertyFontStyle, &RenderStyle::fontItalic, &RenderStyle::setFontItalic) > { > } > >@@ -1848,7 +1848,7 @@ bool CSSPropertyAnimation::canPropertyBeInterpolated(CSSPropertyID prop, const R > return false; > } > >-CSSPropertyID CSSPropertyAnimation::getPropertyAtIndex(int i, std::optional<bool>& isShorthand) >+CSSPropertyID CSSPropertyAnimation::getPropertyAtIndex(int i, WTF::Optional<bool>& isShorthand) > { > CSSPropertyAnimationWrapperMap& map = CSSPropertyAnimationWrapperMap::singleton(); > >diff --git a/Source/WebCore/page/animation/CSSPropertyAnimation.h b/Source/WebCore/page/animation/CSSPropertyAnimation.h >index acb24fe80029a8e325a4eb12901e6173aff7bc31..8265e17c08efd8c2b7d8de0b2c853a07f11531c6 100644 >--- a/Source/WebCore/page/animation/CSSPropertyAnimation.h >+++ b/Source/WebCore/page/animation/CSSPropertyAnimation.h >@@ -42,7 +42,7 @@ public: > static bool animationOfPropertyIsAccelerated(CSSPropertyID); > static bool propertiesEqual(CSSPropertyID, const RenderStyle* a, const RenderStyle* b); > static bool canPropertyBeInterpolated(CSSPropertyID, const RenderStyle* a, const RenderStyle* b); >- static CSSPropertyID getPropertyAtIndex(int, std::optional<bool>& isShorthand); >+ static CSSPropertyID getPropertyAtIndex(int, WTF::Optional<bool>& isShorthand); > static int getNumProperties(); > > static HashSet<CSSPropertyID> animatableShorthandsAffectingProperty(CSSPropertyID); >diff --git a/Source/WebCore/page/animation/CompositeAnimation.cpp b/Source/WebCore/page/animation/CompositeAnimation.cpp >index dcebf08eb5b4532b6cc25100a5af871161d694d7..4f158c6b68185e66f9e525ba367c76529f4669e8 100644 >--- a/Source/WebCore/page/animation/CompositeAnimation.cpp >+++ b/Source/WebCore/page/animation/CompositeAnimation.cpp >@@ -109,7 +109,7 @@ void CompositeAnimation::updateTransitions(Element& element, const RenderStyle* > for (int propertyIndex = 0; propertyIndex < CSSPropertyAnimation::getNumProperties(); ++propertyIndex) { > if (all) { > // Get the next property which is not a shorthand. >- std::optional<bool> isShorthand; >+ WTF::Optional<bool> isShorthand; > prop = CSSPropertyAnimation::getPropertyAtIndex(propertyIndex, isShorthand); > if (isShorthand && *isShorthand) > continue; >@@ -364,15 +364,15 @@ std::unique_ptr<RenderStyle> CompositeAnimation::getAnimatedStyle() const > return resultStyle; > } > >-std::optional<Seconds> CompositeAnimation::timeToNextService() const >+WTF::Optional<Seconds> CompositeAnimation::timeToNextService() const > { >- // Returns the time at which next service is required. std::nullopt means no service is required. 0 means >+ // Returns the time at which next service is required. WTF::nullopt means no service is required. 0 means > // service is required now, and > 0 means service is required that many seconds in the future. >- std::optional<Seconds> minT; >+ WTF::Optional<Seconds> minT; > > if (!m_transitions.isEmpty()) { > for (auto& transition : m_transitions.values()) { >- std::optional<Seconds> t = transition->timeToNextService(); >+ WTF::Optional<Seconds> t = transition->timeToNextService(); > if (!t) > continue; > if (!minT || t.value() < minT.value()) >@@ -384,7 +384,7 @@ std::optional<Seconds> CompositeAnimation::timeToNextService() const > if (!m_keyframeAnimations.isEmpty()) { > m_keyframeAnimations.checkConsistency(); > for (auto& animation : m_keyframeAnimations.values()) { >- std::optional<Seconds> t = animation->timeToNextService(); >+ WTF::Optional<Seconds> t = animation->timeToNextService(); > if (!t) > continue; > if (!minT || t.value() < minT.value()) >diff --git a/Source/WebCore/page/animation/CompositeAnimation.h b/Source/WebCore/page/animation/CompositeAnimation.h >index cf754c7274c4ee3095e7c5a9ed584106a98b56a7..34c66b9ec320ed8085fb78e1b5f622751b043d75 100644 >--- a/Source/WebCore/page/animation/CompositeAnimation.h >+++ b/Source/WebCore/page/animation/CompositeAnimation.h >@@ -59,7 +59,7 @@ public: > std::unique_ptr<RenderStyle> getAnimatedStyle() const; > bool computeExtentOfTransformAnimation(LayoutRect&) const; > >- std::optional<Seconds> timeToNextService() const; >+ WTF::Optional<Seconds> timeToNextService() const; > > CSSAnimationControllerPrivate& animationController() const { return m_animationController; } > >diff --git a/Source/WebCore/page/animation/ImplicitAnimation.cpp b/Source/WebCore/page/animation/ImplicitAnimation.cpp >index c4125d5af5275ffd442358f61ed400b5e13146b4..1ba4d304ec0da4ea44bced3f33508c5349339347 100644 >--- a/Source/WebCore/page/animation/ImplicitAnimation.cpp >+++ b/Source/WebCore/page/animation/ImplicitAnimation.cpp >@@ -322,9 +322,9 @@ void ImplicitAnimation::checkForMatchingColorFilterFunctionLists() > m_colorFilterFunctionListsMatch = filterOperationsMatch(&m_fromStyle->appleColorFilter(), m_toStyle->appleColorFilter()); > } > >-std::optional<Seconds> ImplicitAnimation::timeToNextService() >+WTF::Optional<Seconds> ImplicitAnimation::timeToNextService() > { >- std::optional<Seconds> t = AnimationBase::timeToNextService(); >+ WTF::Optional<Seconds> t = AnimationBase::timeToNextService(); > if (!t || t.value() != 0_s || preActive()) > return t; > >diff --git a/Source/WebCore/page/animation/ImplicitAnimation.h b/Source/WebCore/page/animation/ImplicitAnimation.h >index 4b0a28e14a7a9b473e69d73dc1d23fab42d86d32..adc638137dd553b5723e7a5d649766dbdc3f4d21 100644 >--- a/Source/WebCore/page/animation/ImplicitAnimation.h >+++ b/Source/WebCore/page/animation/ImplicitAnimation.h >@@ -70,7 +70,7 @@ public: > > void blendPropertyValueInStyle(CSSPropertyID, RenderStyle*); > >- std::optional<Seconds> timeToNextService() override; >+ WTF::Optional<Seconds> timeToNextService() override; > > bool active() const { return m_active; } > void setActive(bool b) { m_active = b; } >diff --git a/Source/WebCore/page/animation/KeyframeAnimation.cpp b/Source/WebCore/page/animation/KeyframeAnimation.cpp >index f999ff643c50b7824cf9263a56431ea59d7d8b18..685460415edfffceeb9b38c9b2e73af0de924260 100644 >--- a/Source/WebCore/page/animation/KeyframeAnimation.cpp >+++ b/Source/WebCore/page/animation/KeyframeAnimation.cpp >@@ -506,9 +506,9 @@ void KeyframeAnimation::checkForMatchingColorFilterFunctionLists() > }); > } > >-std::optional<Seconds> KeyframeAnimation::timeToNextService() >+WTF::Optional<Seconds> KeyframeAnimation::timeToNextService() > { >- std::optional<Seconds> t = AnimationBase::timeToNextService(); >+ WTF::Optional<Seconds> t = AnimationBase::timeToNextService(); > if (!t || t.value() != 0_s || preActive()) > return t; > >diff --git a/Source/WebCore/page/animation/KeyframeAnimation.h b/Source/WebCore/page/animation/KeyframeAnimation.h >index 837dd397174994acafee80b2dc09ad6e43ed42e6..9eb231ab33981b0aebde98c3242e477912a37d0b 100644 >--- a/Source/WebCore/page/animation/KeyframeAnimation.h >+++ b/Source/WebCore/page/animation/KeyframeAnimation.h >@@ -62,7 +62,7 @@ public: > void setUnanimatedStyle(std::unique_ptr<RenderStyle> style) { m_unanimatedStyle = WTFMove(style); } > const RenderStyle& unanimatedStyle() const override { return *m_unanimatedStyle; } > >- std::optional<Seconds> timeToNextService() override; >+ WTF::Optional<Seconds> timeToNextService() override; > > protected: > void onAnimationStart(double elapsedTime) override; >diff --git a/Source/WebCore/page/cocoa/PerformanceLoggingCocoa.mm b/Source/WebCore/page/cocoa/PerformanceLoggingCocoa.mm >index 2896fe1976ffb18adfa79666fe68e1637ab250fc..cd07af51302f11de46e00336b950a2efb2335d72 100644 >--- a/Source/WebCore/page/cocoa/PerformanceLoggingCocoa.mm >+++ b/Source/WebCore/page/cocoa/PerformanceLoggingCocoa.mm >@@ -31,13 +31,13 @@ > > namespace WebCore { > >-std::optional<uint64_t> PerformanceLogging::physicalFootprint() >+WTF::Optional<uint64_t> PerformanceLogging::physicalFootprint() > { > task_vm_info_data_t vmInfo; > mach_msg_type_number_t count = TASK_VM_INFO_COUNT; > kern_return_t result = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vmInfo, &count); > if (result != KERN_SUCCESS) >- return std::nullopt; >+ return WTF::nullopt; > return vmInfo.phys_footprint; > } > >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicy.cpp b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp >index 751fd70ddbdd9f552068ff959d0acc0ef95db432..403dc60284b3aafc467af1919c65783c38e034b5 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicy.cpp >+++ b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp >@@ -208,7 +208,7 @@ void ContentSecurityPolicy::didReceiveHeader(const String& header, ContentSecuri > m_hasAPIPolicy = true; > } > >- m_cachedResponseHeaders = std::nullopt; >+ m_cachedResponseHeaders = WTF::nullopt; > > // RFC2616, section 4.2 specifies that headers appearing multiple times can > // be combined with a comma. Walk the header string, and parse each comma >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicy.h b/Source/WebCore/page/csp/ContentSecurityPolicy.h >index e02a7ab6c59bfcf5b99e648ffc6c7e2544cffe35..65572d12a48f6ec058ffffc15aeb9d4ca1c11c03 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicy.h >+++ b/Source/WebCore/page/csp/ContentSecurityPolicy.h >@@ -229,7 +229,7 @@ private: > OptionSet<ContentSecurityPolicyHashAlgorithm> m_hashAlgorithmsForInlineScripts; > OptionSet<ContentSecurityPolicyHashAlgorithm> m_hashAlgorithmsForInlineStylesheets; > HashSet<SecurityOriginData> m_insecureNavigationRequestsToUpgrade; >- mutable std::optional<ContentSecurityPolicyResponseHeaders> m_cachedResponseHeaders; >+ mutable WTF::Optional<ContentSecurityPolicyResponseHeaders> m_cachedResponseHeaders; > }; > > } >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp b/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp >index c82f856c2c7822dd645e32b171cf343798154ad4..d24e24474f8cefe4fb404f98c48862f6fb8e7a9b 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp >@@ -34,7 +34,7 @@ > > namespace WebCore { > >-ContentSecurityPolicySource::ContentSecurityPolicySource(const ContentSecurityPolicy& policy, const String& scheme, const String& host, std::optional<uint16_t> port, const String& path, bool hostHasWildcard, bool portHasWildcard) >+ContentSecurityPolicySource::ContentSecurityPolicySource(const ContentSecurityPolicy& policy, const String& scheme, const String& host, WTF::Optional<uint16_t> port, const String& path, bool hostHasWildcard, bool portHasWildcard) > : m_policy(policy) > , m_scheme(scheme) > , m_host(host) >@@ -96,7 +96,7 @@ bool ContentSecurityPolicySource::portMatches(const URL& url) const > if (m_portHasWildcard) > return true; > >- std::optional<uint16_t> port = url.port(); >+ WTF::Optional<uint16_t> port = url.port(); > > if (port == m_port) > return true; >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySource.h b/Source/WebCore/page/csp/ContentSecurityPolicySource.h >index a2db5043898f2e6947bc7b0a2dd6443ab51438d0..9f608f5364a796717ac70cde943ed2459a7dc68a 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySource.h >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySource.h >@@ -36,7 +36,7 @@ struct SecurityOriginData; > class ContentSecurityPolicySource { > WTF_MAKE_FAST_ALLOCATED; > public: >- ContentSecurityPolicySource(const ContentSecurityPolicy&, const String& scheme, const String& host, std::optional<uint16_t> port, const String& path, bool hostHasWildcard, bool portHasWildcard); >+ ContentSecurityPolicySource(const ContentSecurityPolicy&, const String& scheme, const String& host, WTF::Optional<uint16_t> port, const String& path, bool hostHasWildcard, bool portHasWildcard); > > bool matches(const URL&, bool didReceiveRedirectResponse = false) const; > >@@ -53,7 +53,7 @@ private: > String m_scheme; > String m_host; > String m_path; >- std::optional<uint16_t> m_port; >+ WTF::Optional<uint16_t> m_port; > > bool m_hostHasWildcard; > bool m_portHasWildcard; >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp >index 26da91153764aff7048678e627f72fc4c7981d5c..305f916366549db3b45bfa6da35d62d6e84a4751 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp >@@ -173,7 +173,7 @@ void ContentSecurityPolicySourceList::parse(const UChar* begin, const UChar* end > skipWhile<UChar, isSourceCharacter>(position, end); > > String scheme, host, path; >- std::optional<uint16_t> port; >+ WTF::Optional<uint16_t> port; > bool hostHasWildcard = false; > bool portHasWildcard = false; > >@@ -205,7 +205,7 @@ void ContentSecurityPolicySourceList::parse(const UChar* begin, const UChar* end > // / ( [ scheme "://" ] host [ port ] [ path ] ) > // / "'self'" > // >-bool ContentSecurityPolicySourceList::parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, std::optional<uint16_t>& port, String& path, bool& hostHasWildcard, bool& portHasWildcard) >+bool ContentSecurityPolicySourceList::parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, WTF::Optional<uint16_t>& port, String& path, bool& hostHasWildcard, bool& portHasWildcard) > { > if (begin == end) > return false; >@@ -294,7 +294,7 @@ bool ContentSecurityPolicySourceList::parseSource(const UChar* begin, const UCha > return false; > > if (!beginPort) >- port = std::nullopt; >+ port = WTF::nullopt; > else { > if (!parsePort(beginPort, beginPath, port, portHasWildcard)) > return false; >@@ -396,7 +396,7 @@ bool ContentSecurityPolicySourceList::parsePath(const UChar* begin, const UChar* > > // port = ":" ( 1*DIGIT / "*" ) > // >-bool ContentSecurityPolicySourceList::parsePort(const UChar* begin, const UChar* end, std::optional<uint16_t>& port, bool& portHasWildcard) >+bool ContentSecurityPolicySourceList::parsePort(const UChar* begin, const UChar* end, WTF::Optional<uint16_t>& port, bool& portHasWildcard) > { > ASSERT(begin <= end); > ASSERT(!port); >@@ -409,7 +409,7 @@ bool ContentSecurityPolicySourceList::parsePort(const UChar* begin, const UChar* > return false; > > if (end - begin == 1 && *begin == '*') { >- port = std::nullopt; >+ port = WTF::nullopt; > portHasWildcard = true; > return true; > } >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h >index 5fcf3b2eae4a9e5f84810bd53c455524407726fd..cabfeaa358f81ec13863d0aa98e6fc5876da1ad6 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h >@@ -57,10 +57,10 @@ public: > private: > void parse(const UChar* begin, const UChar* end); > >- bool parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, std::optional<uint16_t>& port, String& path, bool& hostHasWildcard, bool& portHasWildcard); >+ bool parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, WTF::Optional<uint16_t>& port, String& path, bool& hostHasWildcard, bool& portHasWildcard); > bool parseScheme(const UChar* begin, const UChar* end, String& scheme); > bool parseHost(const UChar* begin, const UChar* end, String& host, bool& hostHasWildcard); >- bool parsePort(const UChar* begin, const UChar* end, std::optional<uint16_t>& port, bool& portHasWildcard); >+ bool parsePort(const UChar* begin, const UChar* end, WTF::Optional<uint16_t>& port, bool& portHasWildcard); > bool parsePath(const UChar* begin, const UChar* end, String& path); > > bool parseNonceSource(const UChar* begin, const UChar* end); >diff --git a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp b/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp >index 76e4268a076bbd16784f5c499dff01137300d084..b926e8daa118c14d000b76419604348729fc5feb 100644 >--- a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp >+++ b/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp >@@ -240,7 +240,7 @@ bool AsyncScrollingCoordinator::requestScrollPositionUpdate(FrameView& frameView > > bool isProgrammaticScroll = frameView.inProgrammaticScroll(); > if (isProgrammaticScroll || frameView.frame().document()->pageCacheState() != Document::NotInPageCache) >- updateScrollPositionAfterAsyncScroll(frameView.scrollLayerID(), scrollPosition, std::nullopt, isProgrammaticScroll, ScrollingLayerPositionAction::Set); >+ updateScrollPositionAfterAsyncScroll(frameView.scrollLayerID(), scrollPosition, WTF::nullopt, isProgrammaticScroll, ScrollingLayerPositionAction::Set); > > // If this frame view's document is being put into the page cache, we don't want to update our > // main frame scroll position. Just let the FrameView think that we did. >@@ -255,7 +255,7 @@ bool AsyncScrollingCoordinator::requestScrollPositionUpdate(FrameView& frameView > return true; > } > >-void AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction scrollingLayerPositionAction) >+void AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction scrollingLayerPositionAction) > { > ScheduledScrollUpdate scrollUpdate(nodeID, scrollPosition, layoutViewportOrigin, programmaticScroll, scrollingLayerPositionAction); > >@@ -318,7 +318,7 @@ FrameView* AsyncScrollingCoordinator::frameViewForScrollingNode(ScrollingNodeID > return nullptr; > } > >-void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, std::optional<FloatPoint> layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction scrollingLayerPositionAction) >+void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, WTF::Optional<FloatPoint> layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction scrollingLayerPositionAction) > { > ASSERT(isMainThread()); > >@@ -372,13 +372,13 @@ void AsyncScrollingCoordinator::reconcileScrollingState(FrameView& frameView, co > > LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator " << this << " reconcileScrollingState scrollPosition " << scrollPosition << " programmaticScroll " << programmaticScroll << " stability " << viewportRectStability << " " << scrollingLayerPositionAction); > >- std::optional<FloatRect> layoutViewportRect; >+ WTF::Optional<FloatRect> layoutViewportRect; > > WTF::switchOn(layoutViewportOriginOrOverrideRect, >- [&frameView](std::optional<FloatPoint> origin) { >+ [&frameView](WTF::Optional<FloatPoint> origin) { > if (origin) > frameView.setBaseLayoutViewportOrigin(LayoutPoint(origin.value()), FrameView::TriggerLayoutOrNot::No); >- }, [&frameView, &layoutViewportRect, viewportRectStability, visualViewportEnabled = visualViewportEnabled()](std::optional<FloatRect> overrideRect) { >+ }, [&frameView, &layoutViewportRect, viewportRectStability, visualViewportEnabled = visualViewportEnabled()](WTF::Optional<FloatRect> overrideRect) { > if (!overrideRect) > return; > >diff --git a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h b/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h >index 03ae58aa66e06e82046c4e2e813385030f4c2b0b..d92907da47cb34e4ce8bb5db8dc6890ddb337082 100644 >--- a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h >+++ b/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h >@@ -51,7 +51,7 @@ public: > > void scrollingStateTreePropertiesChanged(); > >- WEBCORE_EXPORT void scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, const std::optional<FloatPoint>& layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction); >+ WEBCORE_EXPORT void scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, const WTF::Optional<FloatPoint>& layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction); > > #if PLATFORM(COCOA) > WEBCORE_EXPORT void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex); >@@ -77,7 +77,7 @@ protected: > > RefPtr<ScrollingTree> releaseScrollingTree() { return WTFMove(m_scrollingTree); } > >- void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, std::optional<FloatPoint> layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction); >+ void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, WTF::Optional<FloatPoint> layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction); > > WEBCORE_EXPORT String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const override; > WEBCORE_EXPORT void willCommitTree() override; >@@ -136,7 +136,7 @@ private: > > struct ScheduledScrollUpdate { > ScheduledScrollUpdate() = default; >- ScheduledScrollUpdate(ScrollingNodeID scrollingNodeID, FloatPoint point, std::optional<FloatPoint> viewportOrigin, bool isProgrammatic, ScrollingLayerPositionAction udpateAction) >+ ScheduledScrollUpdate(ScrollingNodeID scrollingNodeID, FloatPoint point, WTF::Optional<FloatPoint> viewportOrigin, bool isProgrammatic, ScrollingLayerPositionAction udpateAction) > : nodeID(scrollingNodeID) > , scrollPosition(point) > , layoutViewportOrigin(viewportOrigin) >@@ -146,7 +146,7 @@ private: > > ScrollingNodeID nodeID { 0 }; > FloatPoint scrollPosition; >- std::optional<FloatPoint> layoutViewportOrigin; >+ WTF::Optional<FloatPoint> layoutViewportOrigin; > bool isProgrammaticScroll { false }; > ScrollingLayerPositionAction updateLayerPositionAction { ScrollingLayerPositionAction::Sync }; > >diff --git a/Source/WebCore/page/scrolling/ScrollingCoordinator.h b/Source/WebCore/page/scrolling/ScrollingCoordinator.h >index aa64e95bbc8b47d58c59fffd3dac6a430b5ef04d..f0d12d6713cc1cee518014b9c6759a272f541705 100644 >--- a/Source/WebCore/page/scrolling/ScrollingCoordinator.h >+++ b/Source/WebCore/page/scrolling/ScrollingCoordinator.h >@@ -137,7 +137,7 @@ public: > // Should be called whenever the given frame view has been laid out. > virtual void frameViewLayoutUpdated(FrameView&) { } > >- using LayoutViewportOriginOrOverrideRect = WTF::Variant<std::optional<FloatPoint>, std::optional<FloatRect>>; >+ using LayoutViewportOriginOrOverrideRect = WTF::Variant<WTF::Optional<FloatPoint>, WTF::Optional<FloatRect>>; > virtual void reconcileScrollingState(FrameView&, const FloatPoint&, const LayoutViewportOriginOrOverrideRect&, bool /* programmaticScroll */, ViewportRectStability, ScrollingLayerPositionAction) { } > > // Should be called whenever the slow repaint objects counter changes between zero and one. >diff --git a/Source/WebCore/page/scrolling/ScrollingMomentumCalculator.h b/Source/WebCore/page/scrolling/ScrollingMomentumCalculator.h >index 1d3d8395e3993f13353a9ab2836d4092e3385d23..0474185eff8bcff60f5be890849069ed62524588 100644 >--- a/Source/WebCore/page/scrolling/ScrollingMomentumCalculator.h >+++ b/Source/WebCore/page/scrolling/ScrollingMomentumCalculator.h >@@ -61,7 +61,7 @@ protected: > FloatSize m_contentSize; > > private: >- std::optional<FloatSize> m_retargetedScrollOffset; >+ WTF::Optional<FloatSize> m_retargetedScrollOffset; > }; > > class BasicScrollingMomentumCalculator final : public ScrollingMomentumCalculator { >@@ -82,7 +82,7 @@ private: > FloatSize m_snapAnimationCurveCoefficients[4] { }; > bool m_forceLinearAnimationCurve { false }; > bool m_momentumCalculatorRequiresInitialization { true }; >- std::optional<FloatSize> m_predictedDestinationOffset; >+ WTF::Optional<FloatSize> m_predictedDestinationOffset; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/page/scrolling/ScrollingTree.cpp b/Source/WebCore/page/scrolling/ScrollingTree.cpp >index 03dfbe49fc98be8703a046c7a816be600e3c993d..524393dd16aa637ff161d675b80ffd94e7aa1500 100644 >--- a/Source/WebCore/page/scrolling/ScrollingTree.cpp >+++ b/Source/WebCore/page/scrolling/ScrollingTree.cpp >@@ -108,7 +108,7 @@ void ScrollingTree::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID n > downcast<ScrollingTreeScrollingNode>(*node).updateLayersAfterDelegatedScroll(scrollPosition); > > // Update GraphicsLayers and scroll state. >- scrollingTreeNodeDidScroll(nodeID, scrollPosition, std::nullopt, inUserInteraction ? ScrollingLayerPositionAction::Sync : ScrollingLayerPositionAction::Set); >+ scrollingTreeNodeDidScroll(nodeID, scrollPosition, WTF::nullopt, inUserInteraction ? ScrollingLayerPositionAction::Sync : ScrollingLayerPositionAction::Set); > } > > void ScrollingTree::commitTreeState(std::unique_ptr<ScrollingStateTree> scrollingStateTree) >diff --git a/Source/WebCore/page/scrolling/ScrollingTree.h b/Source/WebCore/page/scrolling/ScrollingTree.h >index f87f055375d28bff9802890f52f7f1f5ad026968..4c03a22a5b625b6a67e56775d1a42fc3a4bd4908 100644 >--- a/Source/WebCore/page/scrolling/ScrollingTree.h >+++ b/Source/WebCore/page/scrolling/ScrollingTree.h >@@ -78,7 +78,7 @@ public: > > // Called after a scrolling tree node has handled a scroll and updated its layers. > // Updates FrameView/RenderLayer scrolling state and GraphicsLayers. >- virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) = 0; >+ virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) = 0; > > // Called for requested scroll position updates. > virtual void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, bool /*representsProgrammaticScroll*/) { } >diff --git a/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp b/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp >index 74a873dde40cf5447c9988e84fc57c1325fc209b..b41f7e1a529ab26dcffd45867760baa15fa5664f 100644 >--- a/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp >+++ b/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp >@@ -118,7 +118,7 @@ void ScrollingTreeScrollingNode::setScrollPosition(const FloatPoint& scrollPosit > void ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints(const FloatPoint& scrollPosition) > { > setScrollLayerPosition(scrollPosition, { }); >- scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, std::nullopt); >+ scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, WTF::nullopt); > } > > FloatPoint ScrollingTreeScrollingNode::minimumScrollPosition() const >diff --git a/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp b/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp >index 5c7ba803b6f98c1ba7c1f5f4a1b5d65e6c0f5865..ee440f62cd104222fbc822e96e57bcfaa559ca84 100644 >--- a/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp >+++ b/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp >@@ -90,7 +90,7 @@ void ThreadedScrollingTree::commitTreeState(std::unique_ptr<ScrollingStateTree> > ScrollingTree::commitTreeState(WTFMove(scrollingStateTree)); > } > >-void ThreadedScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) >+void ThreadedScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) > { > if (!m_scrollingCoordinator) > return; >diff --git a/Source/WebCore/page/scrolling/ThreadedScrollingTree.h b/Source/WebCore/page/scrolling/ThreadedScrollingTree.h >index db3c3d5cfb9e908b3f7d23dd168f920d1c7a3481..d92a843ddc1ea83e8943d65d5754fb965aebd774 100644 >--- a/Source/WebCore/page/scrolling/ThreadedScrollingTree.h >+++ b/Source/WebCore/page/scrolling/ThreadedScrollingTree.h >@@ -57,7 +57,7 @@ public: > protected: > explicit ThreadedScrollingTree(AsyncScrollingCoordinator&); > >- void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override; >+ void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override; > #if PLATFORM(MAC) > void handleWheelEventPhase(PlatformWheelEventPhase) override; > void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex) override; >diff --git a/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm b/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm >index 0d202abd5165f17d34fbe6763465334b58de6f19..14f6ce7a56dca96552dd05d51fe9f2c6d73834aa 100644 >--- a/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm >+++ b/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm >@@ -108,13 +108,13 @@ void ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeCons > { > if (shouldUpdateScrollLayerPositionSynchronously()) { > m_probableMainThreadScrollPosition = scrollPosition; >- scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, std::nullopt, ScrollingLayerPositionAction::Set); >+ scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, WTF::nullopt, ScrollingLayerPositionAction::Set); > return; > } > > FloatRect layoutViewport; // FIXME: implement for iOS WK1. > setScrollLayerPosition(scrollPosition, layoutViewport); >- scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, std::nullopt); >+ scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, WTF::nullopt); > } > > void ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect&) >diff --git a/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp b/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp >index 598715438f5b807244527e806817dd35c6dc3f99..51d2b42c8607cd519cf7f2226534cfefb707ffba 100644 >--- a/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp >+++ b/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp >@@ -70,7 +70,7 @@ void ScrollingTreeIOS::invalidate() > }); > } > >-void ScrollingTreeIOS::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) >+void ScrollingTreeIOS::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) > { > if (!m_scrollingCoordinator) > return; >diff --git a/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h b/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h >index f2a96cf5018c687a230dbac15897a8818579cf02..8032cf393146a00c71d0f4c09082512680af3df9 100644 >--- a/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h >+++ b/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h >@@ -51,7 +51,7 @@ private: > void invalidate() final; > > Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) final; >- void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) final; >+ void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) final; > void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) final; > FloatRect fixedPositionRect() final; > >diff --git a/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.h b/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.h >index 89f336b6e9c605c2f9448cdf1ace22e748d6521a..ec51d6d337804bf936814f448637719aceaec6e4 100644 >--- a/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.h >+++ b/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.h >@@ -45,7 +45,7 @@ private: > bool requiresMomentumScrolling(); > > RetainPtr<_NSScrollingMomentumCalculator> m_platformMomentumCalculator; >- std::optional<bool> m_requiresMomentumScrolling; >+ WTF::Optional<bool> m_requiresMomentumScrolling; > FloatPoint m_initialDestinationOrigin; > }; > >diff --git a/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.mm >index 3c4ca5f89fece01a97dc945124da16155a78535a..1c7ab76a151e6350d8b614c36d05bce65c6c9584 100644 >--- a/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.mm >+++ b/Source/WebCore/page/scrolling/mac/ScrollingMomentumCalculatorMac.mm >@@ -83,7 +83,7 @@ Seconds ScrollingMomentumCalculatorMac::animationDuration() > > bool ScrollingMomentumCalculatorMac::requiresMomentumScrolling() > { >- if (m_requiresMomentumScrolling == std::nullopt) >+ if (m_requiresMomentumScrolling == WTF::nullopt) > m_requiresMomentumScrolling = m_initialScrollOffset != retargetedScrollOffset() || m_initialVelocity.area(); > return m_requiresMomentumScrolling.value(); > } >diff --git a/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm >index 243196cc928d8fb28de514269b70261bbe5c4af7..2ad90220275e37f1d8ef742c9748fcd70bce6007 100644 >--- a/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm >+++ b/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm >@@ -396,7 +396,7 @@ void ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeCons > { > updateMainFramePinState(scrollPosition); > >- std::optional<FloatPoint> layoutViewportOrigin; >+ WTF::Optional<FloatPoint> layoutViewportOrigin; > if (scrollingTree().visualViewportEnabled()) { > FloatPoint visibleContentOrigin = scrollPosition; > FloatRect newLayoutViewport = layoutViewportForScrollPosition(visibleContentOrigin, frameScaleFactor()); >diff --git a/Source/WebCore/platform/AbortableTaskQueue.h b/Source/WebCore/platform/AbortableTaskQueue.h >index a669d9415cdefa41dedb82eba29a16cbbb2c1cab..5403d7cd2a5e54f58ac19313f2b7467a2b25bfe7 100644 >--- a/Source/WebCore/platform/AbortableTaskQueue.h >+++ b/Source/WebCore/platform/AbortableTaskQueue.h >@@ -138,16 +138,16 @@ public: > // It is allowed for the main thread task handler to abort the AbortableTaskQueue. In that case, the return > // value is discarded and the caller receives an empty optional. > template<typename R> >- std::optional<R> enqueueTaskAndWait(WTF::Function<R()>&& mainThreadTaskHandler) >+ WTF::Optional<R> enqueueTaskAndWait(WTF::Function<R()>&& mainThreadTaskHandler) > { > // Don't deadlock the main thread with itself. > ASSERT(!isMainThread()); > > LockHolder lockHolder(m_mutex); > if (m_aborting) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<R> response = std::nullopt; >+ WTF::Optional<R> response = WTF::nullopt; > postTask([this, &response, &mainThreadTaskHandler]() { > R responseValue = mainThreadTaskHandler(); > LockHolder lockHolder(m_mutex); >diff --git a/Source/WebCore/platform/CPUMonitor.cpp b/Source/WebCore/platform/CPUMonitor.cpp >index 5faaf66e602e77e1d9b21765390e14f37ac8a7fb..2f67ca38a41597776a5e53ecd9bc7d5961c2f6ab 100644 >--- a/Source/WebCore/platform/CPUMonitor.cpp >+++ b/Source/WebCore/platform/CPUMonitor.cpp >@@ -35,7 +35,7 @@ CPUMonitor::CPUMonitor(Seconds checkInterval, ExceededCPULimitHandler&& exceeded > { > } > >-void CPUMonitor::setCPULimit(std::optional<double> cpuLimit) >+void CPUMonitor::setCPULimit(WTF::Optional<double> cpuLimit) > { > if (m_cpuLimit == cpuLimit) > return; >diff --git a/Source/WebCore/platform/CPUMonitor.h b/Source/WebCore/platform/CPUMonitor.h >index d4ddb778d6d4e6afd8d2e2ff4bab92958a568447..49770ed117a1f7c1bbc8a45d20046702b8e13165 100644 >--- a/Source/WebCore/platform/CPUMonitor.h >+++ b/Source/WebCore/platform/CPUMonitor.h >@@ -37,7 +37,7 @@ public: > using ExceededCPULimitHandler = WTF::Function<void(double)>; > WEBCORE_EXPORT CPUMonitor(Seconds checkInterval, ExceededCPULimitHandler&&); > >- WEBCORE_EXPORT void setCPULimit(std::optional<double>); >+ WEBCORE_EXPORT void setCPULimit(WTF::Optional<double>); > > private: > void timerFired(); >@@ -45,8 +45,8 @@ private: > Seconds m_checkInterval; > ExceededCPULimitHandler m_exceededCPULimitHandler; > Timer m_timer; >- std::optional<double> m_cpuLimit; >- std::optional<CPUTime> m_lastCPUTime; >+ WTF::Optional<double> m_cpuLimit; >+ WTF::Optional<CPUTime> m_lastCPUTime; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/Cookie.h b/Source/WebCore/platform/Cookie.h >index b1517db6c3f668df2ded9aa363ed5d06b9e2ffae..7214a73ebbfddacb27f6024e7690a098f26b671a 100644 >--- a/Source/WebCore/platform/Cookie.h >+++ b/Source/WebCore/platform/Cookie.h >@@ -48,7 +48,7 @@ struct Cookie { > } > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<Cookie> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<Cookie> decode(Decoder&); > > WEBCORE_EXPORT bool operator==(const Cookie&) const; > WEBCORE_EXPORT unsigned hash() const; >@@ -126,35 +126,35 @@ void Cookie::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<Cookie> Cookie::decode(Decoder& decoder) >+WTF::Optional<Cookie> Cookie::decode(Decoder& decoder) > { > Cookie cookie; > if (!decoder.decode(cookie.name)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.value)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.domain)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.path)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.created)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.expires)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.httpOnly)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.secure)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.session)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.comment)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.commentURL)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.ports)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(cookie.sameSite)) >- return std::nullopt; >+ return WTF::nullopt; > return cookie; > } > >diff --git a/Source/WebCore/platform/CookiesStrategy.h b/Source/WebCore/platform/CookiesStrategy.h >index 8a5c594830c07d61c900bb2ea784878141770abf..be5d2aef62727a8b5800729b62c903d185a9ca5d 100644 >--- a/Source/WebCore/platform/CookiesStrategy.h >+++ b/Source/WebCore/platform/CookiesStrategy.h >@@ -40,12 +40,12 @@ enum class IncludeSecureCookies : bool { No, Yes }; > > class CookiesStrategy { > public: >- virtual std::pair<String, bool> cookiesForDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) = 0; >- virtual void setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& cookieString) = 0; >+ virtual std::pair<String, bool> cookiesForDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) = 0; >+ virtual void setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& cookieString) = 0; > virtual bool cookiesEnabled(const NetworkStorageSession&) = 0; >- virtual std::pair<String, bool> cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) = 0; >- virtual std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) = 0; >- virtual bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>&) = 0; >+ virtual std::pair<String, bool> cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) = 0; >+ virtual std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) = 0; >+ virtual bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>&) = 0; > virtual void deleteCookie(const NetworkStorageSession&, const URL&, const String& cookieName) = 0; > > protected: >diff --git a/Source/WebCore/platform/DragImage.cpp b/Source/WebCore/platform/DragImage.cpp >index 27b721688dd358e5f19ab9a0e8a4ecdc642e278b..aea77e268e43c5e05308c98bb2dc711e09edc170 100644 >--- a/Source/WebCore/platform/DragImage.cpp >+++ b/Source/WebCore/platform/DragImage.cpp >@@ -155,7 +155,7 @@ struct ScopedFrameSelectionState { > } > > const Frame& frame; >- std::optional<SelectionRangeData::Context> selection; >+ WTF::Optional<SelectionRangeData::Context> selection; > }; > > #if !PLATFORM(IOS_FAMILY) >diff --git a/Source/WebCore/platform/DragImage.h b/Source/WebCore/platform/DragImage.h >index b28c5e04f46c3d3a682acc5a4dc2f2698231d20b..ed01beaa8794e1803317a327bafd5d0ffa4023f7 100644 >--- a/Source/WebCore/platform/DragImage.h >+++ b/Source/WebCore/platform/DragImage.h >@@ -109,19 +109,19 @@ public: > > void setIndicatorData(const TextIndicatorData& data) { m_indicatorData = data; } > bool hasIndicatorData() const { return !!m_indicatorData; } >- std::optional<TextIndicatorData> indicatorData() const { return m_indicatorData; } >+ WTF::Optional<TextIndicatorData> indicatorData() const { return m_indicatorData; } > > void setVisiblePath(const Path& path) { m_visiblePath = path; } > bool hasVisiblePath() const { return !!m_visiblePath; } >- std::optional<Path> visiblePath() const { return m_visiblePath; } >+ WTF::Optional<Path> visiblePath() const { return m_visiblePath; } > > explicit operator bool() const { return !!m_dragImageRef; } > DragImageRef get() const { return m_dragImageRef; } > > private: > DragImageRef m_dragImageRef; >- std::optional<TextIndicatorData> m_indicatorData; >- std::optional<Path> m_visiblePath; >+ WTF::Optional<TextIndicatorData> m_indicatorData; >+ WTF::Optional<Path> m_visiblePath; > }; > > } >diff --git a/Source/WebCore/platform/DragItem.h b/Source/WebCore/platform/DragItem.h >index 5992bea18bb360d283a2e7c919fcf8c505e3bc91..fda793199dfb43c25c00cf9bc844524188d8dba9 100644 >--- a/Source/WebCore/platform/DragItem.h >+++ b/Source/WebCore/platform/DragItem.h >@@ -97,7 +97,7 @@ bool DragItem::decode(Decoder& decoder, DragItem& result) > if (!decoder.decode(hasIndicatorData)) > return false; > if (hasIndicatorData) { >- std::optional<TextIndicatorData> indicatorData; >+ WTF::Optional<TextIndicatorData> indicatorData; > decoder >> indicatorData; > if (!indicatorData) > return false; >@@ -107,7 +107,7 @@ bool DragItem::decode(Decoder& decoder, DragItem& result) > if (!decoder.decode(hasVisiblePath)) > return false; > if (hasVisiblePath) { >- std::optional<Path> visiblePath; >+ WTF::Optional<Path> visiblePath; > decoder >> visiblePath; > if (!visiblePath) > return false; >diff --git a/Source/WebCore/platform/FileStream.cpp b/Source/WebCore/platform/FileStream.cpp >index a2190aa84baf875869e157dc00ede0dd655e5769..453d2abd11b29df7981306790f95ec3a0e448361 100644 >--- a/Source/WebCore/platform/FileStream.cpp >+++ b/Source/WebCore/platform/FileStream.cpp >@@ -49,7 +49,7 @@ FileStream::~FileStream() > close(); > } > >-long long FileStream::getSize(const String& path, std::optional<WallTime> expectedModificationTime) >+long long FileStream::getSize(const String& path, WTF::Optional<WallTime> expectedModificationTime) > { > // Check the modification time for the possible file change. > auto modificationTime = FileSystem::getFileModificationTime(path); >diff --git a/Source/WebCore/platform/FileStream.h b/Source/WebCore/platform/FileStream.h >index 7a681b49d50de23214acd20ca9ed9c917e33f2ab..1dba41ce6cf23e4c3d8e707c97e447e5fb5bf64d 100644 >--- a/Source/WebCore/platform/FileStream.h >+++ b/Source/WebCore/platform/FileStream.h >@@ -43,7 +43,7 @@ public: > > // Gets the size of a file. Also validates if the file has been changed or not if the expected modification time is provided, i.e. non-zero. > // Returns total number of bytes if successful. -1 otherwise. >- long long getSize(const String& path, std::optional<WallTime> expectedModificationTime); >+ long long getSize(const String& path, WTF::Optional<WallTime> expectedModificationTime); > > // Opens a file for reading. The reading starts at the specified offset and lasts till the specified length. > // Returns true on success. False otherwise. >diff --git a/Source/WebCore/platform/FileSystem.h b/Source/WebCore/platform/FileSystem.h >index 8018935c386a0d999821cbcaf2d95a47100b3522..0ce08bedd81afaa5876d686863247b3fcb1bba55 100644 >--- a/Source/WebCore/platform/FileSystem.h >+++ b/Source/WebCore/platform/FileSystem.h >@@ -104,10 +104,10 @@ WEBCORE_EXPORT bool deleteEmptyDirectory(const String&); > WEBCORE_EXPORT bool moveFile(const String& oldPath, const String& newPath); > WEBCORE_EXPORT bool getFileSize(const String&, long long& result); > WEBCORE_EXPORT bool getFileSize(PlatformFileHandle, long long& result); >-WEBCORE_EXPORT std::optional<WallTime> getFileModificationTime(const String&); >-WEBCORE_EXPORT std::optional<WallTime> getFileCreationTime(const String&); // Not all platforms store file creation time. >-WEBCORE_EXPORT std::optional<FileMetadata> fileMetadata(const String& path); >-WEBCORE_EXPORT std::optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path); >+WEBCORE_EXPORT WTF::Optional<WallTime> getFileModificationTime(const String&); >+WEBCORE_EXPORT WTF::Optional<WallTime> getFileCreationTime(const String&); // Not all platforms store file creation time. >+WEBCORE_EXPORT WTF::Optional<FileMetadata> fileMetadata(const String& path); >+WEBCORE_EXPORT WTF::Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path); > WEBCORE_EXPORT bool fileIsDirectory(const String&, ShouldFollowSymbolicLinks); > WEBCORE_EXPORT String pathByAppendingComponent(const String& path, const String& component); > String pathByAppendingComponents(StringView path, const Vector<StringView>& components); >@@ -117,7 +117,7 @@ String homeDirectoryPath(); > WEBCORE_EXPORT String pathGetFileName(const String&); > WEBCORE_EXPORT String directoryName(const String&); > WEBCORE_EXPORT bool getVolumeFreeSpace(const String&, uint64_t&); >-WEBCORE_EXPORT std::optional<int32_t> getFileDeviceId(const CString&); >+WEBCORE_EXPORT WTF::Optional<int32_t> getFileDeviceId(const CString&); > WEBCORE_EXPORT bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath); > > WEBCORE_EXPORT void setMetadataURL(const String& path, const String& urlString, const String& referrer = { }); >diff --git a/Source/WebCore/platform/LinkIcon.h b/Source/WebCore/platform/LinkIcon.h >index 89e2f8969bb526a364db6b90e30a9b771cde586a..e6302871dc3c09229cdfe6462d9676421bc5ca23 100644 >--- a/Source/WebCore/platform/LinkIcon.h >+++ b/Source/WebCore/platform/LinkIcon.h >@@ -37,7 +37,7 @@ struct LinkIcon { > URL url; > LinkIconType type; > String mimeType; >- std::optional<unsigned> size; >+ WTF::Optional<unsigned> size; > Vector<std::pair<String, String>> attributes; > > template<class Encoder> void encode(Encoder&) const; >diff --git a/Source/WebCore/platform/LogInitialization.h b/Source/WebCore/platform/LogInitialization.h >index 2ca770addf4938fb9ab3aa4bead4c7d5ad1d4376..51b3040edab921864507512fbd6f70a0c487a6a2 100644 >--- a/Source/WebCore/platform/LogInitialization.h >+++ b/Source/WebCore/platform/LogInitialization.h >@@ -37,7 +37,7 @@ namespace WebCore { > String logLevelString(); > bool isLogChannelEnabled(const String& name); > WEBCORE_EXPORT void setLogChannelToAccumulate(const String& name); >-WEBCORE_EXPORT void initializeLogChannelsIfNecessary(std::optional<String> = std::nullopt); >+WEBCORE_EXPORT void initializeLogChannelsIfNecessary(WTF::Optional<String> = WTF::nullopt); > > #endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED > >diff --git a/Source/WebCore/platform/Logging.cpp b/Source/WebCore/platform/Logging.cpp >index f74514c6c84e2e3ff1b11d5edcd3564f9420ace9..9825f7c02e0b4addae0c50752606e7ae83f191ae 100644 >--- a/Source/WebCore/platform/Logging.cpp >+++ b/Source/WebCore/platform/Logging.cpp >@@ -69,7 +69,7 @@ void setLogChannelToAccumulate(const String& name) > logChannelsNeedInitialization = true; > } > >-void initializeLogChannelsIfNecessary(std::optional<String> logChannelString) >+void initializeLogChannelsIfNecessary(WTF::Optional<String> logChannelString) > { > if (!logChannelsNeedInitialization && !logChannelString) > return; >diff --git a/Source/WebCore/platform/PODIntervalTree.h b/Source/WebCore/platform/PODIntervalTree.h >index 7f2b70774b6b60048ad64bd56168ccee00f4341c..4a7a8c3bc41bd0641fca36507c7158183f660322 100644 >--- a/Source/WebCore/platform/PODIntervalTree.h >+++ b/Source/WebCore/platform/PODIntervalTree.h >@@ -116,11 +116,11 @@ public: > return IntervalType(low, high, data); > } > >- std::optional<IntervalType> nextIntervalAfter(const IntervalType& interval) >+ WTF::Optional<IntervalType> nextIntervalAfter(const IntervalType& interval) > { > auto next = smallestNodeGreaterThanFrom(interval, this->root()); > if (!next) >- return std::nullopt; >+ return WTF::nullopt; > > return next->data(); > } >diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h >index 79d819beaf39e8c27a96e5ec59f4d3ebf30ba27e..8d63e9e0f50637e4eb66716c722efb565659916d 100644 >--- a/Source/WebCore/platform/Pasteboard.h >+++ b/Source/WebCore/platform/Pasteboard.h >@@ -317,7 +317,7 @@ private: > #if PLATFORM(COCOA) > String m_pasteboardName; > long m_changeCount; >- std::optional<PasteboardCustomData> m_customDataCache; >+ WTF::Optional<PasteboardCustomData> m_customDataCache; > #endif > > #if PLATFORM(MAC) >diff --git a/Source/WebCore/platform/PasteboardItemInfo.h b/Source/WebCore/platform/PasteboardItemInfo.h >index d627df45e4121cd572f7e96cd081f209fc49eebe..496652a0e38fbacbd5f4f4b9f616f307a5a36c03 100644 >--- a/Source/WebCore/platform/PasteboardItemInfo.h >+++ b/Source/WebCore/platform/PasteboardItemInfo.h >@@ -65,7 +65,7 @@ struct PasteboardItemInfo { > } > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<PasteboardItemInfo> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<PasteboardItemInfo> decode(Decoder&); > }; > > template<class Encoder> >@@ -76,26 +76,26 @@ void PasteboardItemInfo::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<PasteboardItemInfo> PasteboardItemInfo::decode(Decoder& decoder) >+WTF::Optional<PasteboardItemInfo> PasteboardItemInfo::decode(Decoder& decoder) > { > PasteboardItemInfo result; > if (!decoder.decode(result.pathsForFileUpload)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.contentTypesForFileUpload)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.suggestedFileName)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.isNonTextType)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.containsFileURLAndFileUploadContent)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(result.preferredPresentationStyle)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >diff --git a/Source/WebCore/platform/PasteboardWriterData.h b/Source/WebCore/platform/PasteboardWriterData.h >index 5f47592b1019511911797688e78550f48bbed56f..f8f0ad1e4330e4f34b593c224945272fdc1d7fdc 100644 >--- a/Source/WebCore/platform/PasteboardWriterData.h >+++ b/Source/WebCore/platform/PasteboardWriterData.h >@@ -63,7 +63,7 @@ public: > #endif > }; > >- const std::optional<PlainText>& plainText() const { return m_plainText; } >+ const WTF::Optional<PlainText>& plainText() const { return m_plainText; } > void setPlainText(PlainText); > > struct URLData { >@@ -76,16 +76,16 @@ public: > #endif > }; > >- const std::optional<URLData>& urlData() const { return m_url; } >+ const WTF::Optional<URLData>& urlData() const { return m_url; } > void setURLData(URLData); > >- const std::optional<WebContent>& webContent() const { return m_webContent; } >+ const WTF::Optional<WebContent>& webContent() const { return m_webContent; } > void setWebContent(WebContent); > > private: >- std::optional<PlainText> m_plainText; >- std::optional<URLData> m_url; >- std::optional<WebContent> m_webContent; >+ WTF::Optional<PlainText> m_plainText; >+ WTF::Optional<URLData> m_url; >+ WTF::Optional<WebContent> m_webContent; > }; > > } >diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.cpp b/Source/WebCore/platform/PlatformKeyboardEvent.cpp >index c1799cc67c57914cc026ebf2301f641d52c582b2..09b9e6f1c74420e10b682d73654f868c89b670ac 100644 >--- a/Source/WebCore/platform/PlatformKeyboardEvent.cpp >+++ b/Source/WebCore/platform/PlatformKeyboardEvent.cpp >@@ -30,7 +30,7 @@ > > namespace WebCore { > >-std::optional<OptionSet<PlatformEvent::Modifier>> PlatformKeyboardEvent::s_currentModifiers; >+WTF::Optional<OptionSet<PlatformEvent::Modifier>> PlatformKeyboardEvent::s_currentModifiers; > > void PlatformKeyboardEvent::setCurrentModifierState(OptionSet<Modifier> modifiers) > { >diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h >index dc994f689f4ece228a0856523c5d4a36513cf671..55aea80ecd20d6ef317f1a52ae0d6e3725386383 100644 >--- a/Source/WebCore/platform/PlatformKeyboardEvent.h >+++ b/Source/WebCore/platform/PlatformKeyboardEvent.h >@@ -210,7 +210,7 @@ namespace WebCore { > #endif > > // The modifier state is optional, since it is not needed in the UI process or in legacy WebKit. >- static std::optional<OptionSet<Modifier>> s_currentModifiers; >+ static WTF::Optional<OptionSet<Modifier>> s_currentModifiers; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/Process.cpp b/Source/WebCore/platform/Process.cpp >index c24d9e55c009caa124a59b862615c3659b4204dc..9d9cf2c6dbf780ba4a2e8c5bfca39088a23df7c5 100644 >--- a/Source/WebCore/platform/Process.cpp >+++ b/Source/WebCore/platform/Process.cpp >@@ -31,7 +31,7 @@ > namespace WebCore { > namespace Process { > >-static std::optional<ProcessIdentifier> globalIdentifier; >+static WTF::Optional<ProcessIdentifier> globalIdentifier; > > void setIdentifier(ProcessIdentifier processIdentifier) > { >diff --git a/Source/WebCore/platform/ReferrerPolicy.cpp b/Source/WebCore/platform/ReferrerPolicy.cpp >index c509363a851218b9d857769a8e2c20c4fd2d8d90..0bbbe9e854224079e0ae77062685c3bf03f2d6a1 100644 >--- a/Source/WebCore/platform/ReferrerPolicy.cpp >+++ b/Source/WebCore/platform/ReferrerPolicy.cpp >@@ -31,7 +31,7 @@ namespace WebCore { > > enum class ShouldParseLegacyKeywords { No, Yes }; > >-static std::optional<ReferrerPolicy> parseReferrerPolicyToken(StringView policy, ShouldParseLegacyKeywords shouldParseLegacyKeywords) >+static WTF::Optional<ReferrerPolicy> parseReferrerPolicyToken(StringView policy, ShouldParseLegacyKeywords shouldParseLegacyKeywords) > { > // "never" / "default" / "always" are legacy keywords that we support and still defined in the HTML specification: > // https://html.spec.whatwg.org/#meta-referrer >@@ -63,15 +63,15 @@ static std::optional<ReferrerPolicy> parseReferrerPolicyToken(StringView policy, > if (!policy.isNull() && policy.isEmpty()) > return ReferrerPolicy::EmptyString; > >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<ReferrerPolicy> parseReferrerPolicy(StringView policyString, ReferrerPolicySource source) >+WTF::Optional<ReferrerPolicy> parseReferrerPolicy(StringView policyString, ReferrerPolicySource source) > { > switch (source) { > case ReferrerPolicySource::HTTPHeader: { > // Implementing https://www.w3.org/TR/2017/CR-referrer-policy-20170126/#parse-referrer-policy-from-header. >- std::optional<ReferrerPolicy> result; >+ WTF::Optional<ReferrerPolicy> result; > for (auto tokenView : policyString.split(',')) { > auto token = parseReferrerPolicyToken(stripLeadingAndTrailingHTTPSpaces(tokenView), ShouldParseLegacyKeywords::No); > if (token && token.value() != ReferrerPolicy::EmptyString) >@@ -83,7 +83,7 @@ std::optional<ReferrerPolicy> parseReferrerPolicy(StringView policyString, Refer > return parseReferrerPolicyToken(policyString, ShouldParseLegacyKeywords::Yes); > } > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WebCore >diff --git a/Source/WebCore/platform/ReferrerPolicy.h b/Source/WebCore/platform/ReferrerPolicy.h >index 2a2a23c5bdb55fc565d780dc14d5aa8a75b5c192..956e5f1555de4127876f95d0c35afa1ab489803e 100644 >--- a/Source/WebCore/platform/ReferrerPolicy.h >+++ b/Source/WebCore/platform/ReferrerPolicy.h >@@ -50,7 +50,7 @@ enum class ReferrerPolicy : uint8_t { > }; > > enum class ReferrerPolicySource : uint8_t { MetaTag, HTTPHeader }; >-std::optional<ReferrerPolicy> parseReferrerPolicy(StringView, ReferrerPolicySource); >+WTF::Optional<ReferrerPolicy> parseReferrerPolicy(StringView, ReferrerPolicySource); > > } > >diff --git a/Source/WebCore/platform/RuntimeApplicationChecks.cpp b/Source/WebCore/platform/RuntimeApplicationChecks.cpp >index 2fe42a9f3a19e5b0b4a01b3c8dadf2766e297d41..8e8413e56ea61b93942b30c8e7e37b9aa22d164b 100644 >--- a/Source/WebCore/platform/RuntimeApplicationChecks.cpp >+++ b/Source/WebCore/platform/RuntimeApplicationChecks.cpp >@@ -37,9 +37,9 @@ namespace WebCore { > static bool presentingApplicationPIDOverrideWasQueried; > #endif > >-static std::optional<int>& presentingApplicationPIDOverride() >+static WTF::Optional<int>& presentingApplicationPIDOverride() > { >- static NeverDestroyed<std::optional<int>> pid; >+ static NeverDestroyed<WTF::Optional<int>> pid; > #if !ASSERT_MSG_DISABLED > presentingApplicationPIDOverrideWasQueried = true; > #endif >diff --git a/Source/WebCore/platform/ScreenProperties.h b/Source/WebCore/platform/ScreenProperties.h >index 39655f6147bae2fd22ed0cca80fa9c61ac7cd880..138989c82f1e3c41c511921257cc3c0d01701542 100644 >--- a/Source/WebCore/platform/ScreenProperties.h >+++ b/Source/WebCore/platform/ScreenProperties.h >@@ -55,7 +55,7 @@ struct ScreenData { > }; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ScreenData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ScreenData> decode(Decoder&); > }; > > typedef HashMap<PlatformDisplayID, ScreenData> ScreenDataMap; >@@ -65,7 +65,7 @@ struct ScreenProperties { > ScreenDataMap screenDataMap; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ScreenProperties> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ScreenProperties> decode(Decoder&); > }; > > template<class Encoder> >@@ -76,17 +76,17 @@ void ScreenProperties::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ScreenProperties> ScreenProperties::decode(Decoder& decoder) >+WTF::Optional<ScreenProperties> ScreenProperties::decode(Decoder& decoder) > { >- std::optional<PlatformDisplayID> primaryDisplayID; >+ WTF::Optional<PlatformDisplayID> primaryDisplayID; > decoder >> primaryDisplayID; > if (!primaryDisplayID) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ScreenDataMap> screenDataMap; >+ WTF::Optional<ScreenDataMap> screenDataMap; > decoder >> screenDataMap; > if (!screenDataMap) >- return std::nullopt; >+ return WTF::nullopt; > > return { { *primaryDisplayID, WTFMove(*screenDataMap) } }; > } >@@ -121,77 +121,77 @@ void ScreenData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ScreenData> ScreenData::decode(Decoder& decoder) >+WTF::Optional<ScreenData> ScreenData::decode(Decoder& decoder) > { >- std::optional<FloatRect> screenAvailableRect; >+ WTF::Optional<FloatRect> screenAvailableRect; > decoder >> screenAvailableRect; > if (!screenAvailableRect) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<FloatRect> screenRect; >+ WTF::Optional<FloatRect> screenRect; > decoder >> screenRect; > if (!screenRect) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> screenDepth; >+ WTF::Optional<int> screenDepth; > decoder >> screenDepth; > if (!screenDepth) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> screenDepthPerComponent; >+ WTF::Optional<int> screenDepthPerComponent; > decoder >> screenDepthPerComponent; > if (!screenDepthPerComponent) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> screenSupportsExtendedColor; >+ WTF::Optional<bool> screenSupportsExtendedColor; > decoder >> screenSupportsExtendedColor; > if (!screenSupportsExtendedColor) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> screenHasInvertedColors; >+ WTF::Optional<bool> screenHasInvertedColors; > decoder >> screenHasInvertedColors; > if (!screenHasInvertedColors) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> screenIsMonochrome; >+ WTF::Optional<bool> screenIsMonochrome; > decoder >> screenIsMonochrome; > if (!screenIsMonochrome) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint32_t> displayMask; >+ WTF::Optional<uint32_t> displayMask; > decoder >> displayMask; > if (!displayMask) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<IORegistryGPUID> gpuID; >+ WTF::Optional<IORegistryGPUID> gpuID; > decoder >> gpuID; > if (!gpuID) >- return std::nullopt; >+ return WTF::nullopt; > > EncodedColorSpaceDataType dataType; > if (!decoder.decodeEnum(dataType)) >- return std::nullopt; >+ return WTF::nullopt; > > RetainPtr<CGColorSpaceRef> cgColorSpace; > switch (dataType) { > case Null: > break; > case ColorSpaceName: { >- std::optional<String> colorSpaceName; >+ WTF::Optional<String> colorSpaceName; > decoder >> colorSpaceName; > ASSERT(colorSpaceName); > if (!colorSpaceName) >- return std::nullopt; >+ return WTF::nullopt; > > cgColorSpace = adoptCF(CGColorSpaceCreateWithName(colorSpaceName->createCFString().get())); > break; > } > case ColorSpaceData: { >- std::optional<Vector<uint8_t>> iccData; >+ WTF::Optional<Vector<uint8_t>> iccData; > decoder >> iccData; > ASSERT(iccData); > if (!iccData) >- return std::nullopt; >+ return WTF::nullopt; > > auto colorSpaceData = adoptCF(CFDataCreate(kCFAllocatorDefault, iccData->data(), iccData->size())); > // FIXME: <http://webkit.org/b/184358> We should switch to CGColorSpaceCreateICCBased. >diff --git a/Source/WebCore/platform/ScrollAnimationKinetic.cpp b/Source/WebCore/platform/ScrollAnimationKinetic.cpp >index ab477937fed9ad2b1e36ee7b6184b993e06fe27c..7466ee93c4aec6cf8b9b8e57ac4233061b10deed 100644 >--- a/Source/WebCore/platform/ScrollAnimationKinetic.cpp >+++ b/Source/WebCore/platform/ScrollAnimationKinetic.cpp >@@ -114,8 +114,8 @@ ScrollAnimationKinetic::~ScrollAnimationKinetic() = default; > void ScrollAnimationKinetic::stop() > { > m_animationTimer.stop(); >- m_horizontalData = std::nullopt; >- m_verticalData = std::nullopt; >+ m_horizontalData = WTF::nullopt; >+ m_verticalData = WTF::nullopt; > } > > void ScrollAnimationKinetic::start(const FloatPoint& initialPosition, const FloatPoint& velocity, bool mayHScroll, bool mayVScroll) >@@ -148,10 +148,10 @@ void ScrollAnimationKinetic::animationTimerFired() > Seconds deltaToNextFrame = 1_s * ceil((currentTime - m_startTime).value() * frameRate) / frameRate - (currentTime - m_startTime); > > if (m_horizontalData && !m_horizontalData.value().animateScroll(deltaToNextFrame)) >- m_horizontalData = std::nullopt; >+ m_horizontalData = WTF::nullopt; > > if (m_verticalData && !m_verticalData.value().animateScroll(deltaToNextFrame)) >- m_verticalData = std::nullopt; >+ m_verticalData = WTF::nullopt; > > // If one of the axes didn't finish its animation we must continue it. > if (m_horizontalData || m_verticalData) >diff --git a/Source/WebCore/platform/ScrollAnimationKinetic.h b/Source/WebCore/platform/ScrollAnimationKinetic.h >index 5458c533075475f9e921759300d5a63ca9dd55ca..8ccbbcd2d36485e70ad1dae9912265f41daf494f 100644 >--- a/Source/WebCore/platform/ScrollAnimationKinetic.h >+++ b/Source/WebCore/platform/ScrollAnimationKinetic.h >@@ -69,8 +69,8 @@ private: > > std::function<void(FloatPoint&&)> m_notifyPositionChangedFunction; > >- std::optional<PerAxisData> m_horizontalData; >- std::optional<PerAxisData> m_verticalData; >+ WTF::Optional<PerAxisData> m_horizontalData; >+ WTF::Optional<PerAxisData> m_verticalData; > > MonotonicTime m_startTime; > Timer m_animationTimer; >diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp >index 98d4ecae887c81197bdfc4a7ff7d2c319b90554d..b19806f2635949f9165d54ddb068b223a9218b5b 100644 >--- a/Source/WebCore/platform/ScrollView.cpp >+++ b/Source/WebCore/platform/ScrollView.cpp >@@ -433,8 +433,8 @@ void ScrollView::handleDeferredScrollUpdateAfterContentSizeChange() > else if (m_deferredScrollOffsets) > scrollOffsetChangedViaPlatformWidgetImpl(m_deferredScrollOffsets.value().first, m_deferredScrollOffsets.value().second); > >- m_deferredScrollDelta = std::nullopt; >- m_deferredScrollOffsets = std::nullopt; >+ m_deferredScrollDelta = WTF::nullopt; >+ m_deferredScrollOffsets = WTF::nullopt; > } > > void ScrollView::scrollTo(const ScrollPosition& newPosition) >diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h >index a84546219723004ad4334616126fed8aaffcd943..f7c2dc1be54318fb08a3e6e6f1dd8d4a52ec154d 100644 >--- a/Source/WebCore/platform/ScrollView.h >+++ b/Source/WebCore/platform/ScrollView.h >@@ -459,8 +459,8 @@ private: > IntSize m_fixedLayoutSize; > IntSize m_contentsSize; > >- std::optional<IntSize> m_deferredScrollDelta; // Needed for WebKit scrolling >- std::optional<std::pair<ScrollOffset, ScrollOffset>> m_deferredScrollOffsets; // Needed for platform widget scrolling >+ WTF::Optional<IntSize> m_deferredScrollDelta; // Needed for WebKit scrolling >+ WTF::Optional<std::pair<ScrollOffset, ScrollOffset>> m_deferredScrollOffsets; // Needed for platform widget scrolling > > IntPoint m_panScrollIconPoint; > >diff --git a/Source/WebCore/platform/Theme.cpp b/Source/WebCore/platform/Theme.cpp >index c0af192b1d1525b05ad3af5fc809487c7b2610e2..737a75ff97ab078451b33fc8e269647c8f4db8fe 100644 >--- a/Source/WebCore/platform/Theme.cpp >+++ b/Source/WebCore/platform/Theme.cpp >@@ -37,9 +37,9 @@ int Theme::baselinePositionAdjustment(ControlPart) const > return 0; > } > >-std::optional<FontCascadeDescription> Theme::controlFont(ControlPart, const FontCascade&, float) const >+WTF::Optional<FontCascadeDescription> Theme::controlFont(ControlPart, const FontCascade&, float) const > { >- return std::nullopt; >+ return WTF::nullopt; > } > > LengthSize Theme::controlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float) const >diff --git a/Source/WebCore/platform/Theme.h b/Source/WebCore/platform/Theme.h >index e8cec35d5916bcdeb1de3988aa369b5be244e032..c5b4c071420bfb1f687df50f0fddedc2b554a97f 100644 >--- a/Source/WebCore/platform/Theme.h >+++ b/Source/WebCore/platform/Theme.h >@@ -52,7 +52,7 @@ public: > virtual int baselinePositionAdjustment(ControlPart) const; > > // The font description result should have a zoomed font size. >- virtual std::optional<FontCascadeDescription> controlFont(ControlPart, const FontCascade&, float zoomFactor) const; >+ virtual WTF::Optional<FontCascadeDescription> controlFont(ControlPart, const FontCascade&, float zoomFactor) const; > > // The size here is in zoomed coordinates already. If a new size is returned, it also needs to be in zoomed coordinates. > virtual LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float zoomFactor) const; >diff --git a/Source/WebCore/platform/Timer.h b/Source/WebCore/platform/Timer.h >index 1741ab9380ddb54d07a1847cd139da6851c48c5b..8b057e475048476c5357ad6dd26bdbb88a027337 100644 >--- a/Source/WebCore/platform/Timer.h >+++ b/Source/WebCore/platform/Timer.h >@@ -73,7 +73,7 @@ public: > private: > virtual void fired() = 0; > >- virtual std::optional<MonotonicTime> alignedFireTime(MonotonicTime) const { return std::nullopt; } >+ virtual WTF::Optional<MonotonicTime> alignedFireTime(MonotonicTime) const { return WTF::nullopt; } > > void checkConsistency() const; > void checkHeapIndex() const; >diff --git a/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp b/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp >index 9a1d1979d458a3796ffa0af942362a6e2ce7335c..93e329440c17e2b8755c533329117b69bb79461a 100644 >--- a/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp >+++ b/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp >@@ -308,7 +308,7 @@ static void webKitWebAudioSrcGetProperty(GObject* object, guint propertyId, GVal > } > } > >-static std::optional<Vector<GRefPtr<GstBuffer>>> webKitWebAudioSrcAllocateBuffersAndRenderAudio(WebKitWebAudioSrc* src) >+static WTF::Optional<Vector<GRefPtr<GstBuffer>>> webKitWebAudioSrcAllocateBuffersAndRenderAudio(WebKitWebAudioSrc* src) > { > WebKitWebAudioSourcePrivate* priv = src->priv; > >@@ -317,7 +317,7 @@ static std::optional<Vector<GRefPtr<GstBuffer>>> webKitWebAudioSrcAllocateBuffer > if (!priv->provider || !priv->bus) { > GST_ELEMENT_ERROR(src, CORE, FAILED, ("Internal WebAudioSrc error"), ("Can't start without provider or bus")); > gst_task_stop(src->priv->task.get()); >- return std::nullopt; >+ return WTF::nullopt; > } > > ASSERT(priv->pool); >@@ -336,7 +336,7 @@ static std::optional<Vector<GRefPtr<GstBuffer>>> webKitWebAudioSrcAllocateBuffer > // FLUSHING and EOS are not errors. > if (ret < GST_FLOW_EOS || ret == GST_FLOW_NOT_LINKED) > GST_ELEMENT_ERROR(src, CORE, PAD, ("Internal WebAudioSrc error"), ("Failed to allocate buffer for flow: %s", gst_flow_get_name(ret))); >- return std::nullopt; >+ return WTF::nullopt; > } > > ASSERT(buffer); >@@ -352,14 +352,14 @@ static std::optional<Vector<GRefPtr<GstBuffer>>> webKitWebAudioSrcAllocateBuffer > // FIXME: Add support for local/live audio input. > priv->provider->render(nullptr, priv->bus, priv->framesToPull); > >- return std::make_optional(channelBufferList); >+ return WTF::makeOptional(channelBufferList); > } > > static void webKitWebAudioSrcLoop(WebKitWebAudioSrc* src) > { > WebKitWebAudioSourcePrivate* priv = src->priv; > >- std::optional<Vector<GRefPtr<GstBuffer>>> channelBufferList = webKitWebAudioSrcAllocateBuffersAndRenderAudio(src); >+ WTF::Optional<Vector<GRefPtr<GstBuffer>>> channelBufferList = webKitWebAudioSrcAllocateBuffersAndRenderAudio(src); > if (!channelBufferList) { > gst_task_stop(src->priv->task.get()); > return; >diff --git a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >index a5b97831cb58543712da5e1d76e7ec37ad389f19..092db9002fa59923ccdf6999649e7d8ca992a7bf 100644 >--- a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >+++ b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >@@ -66,9 +66,9 @@ void setApplicationBundleIdentifier(const String& bundleIdentifier) > applicationBundleIdentifierOverride() = bundleIdentifier; > } > >-static std::optional<uint32_t>& applicationSDKVersionOverride() >+static WTF::Optional<uint32_t>& applicationSDKVersionOverride() > { >- static NeverDestroyed<std::optional<uint32_t>> version; >+ static NeverDestroyed<WTF::Optional<uint32_t>> version; > return version; > } > >diff --git a/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h b/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h >index c538c4efb33aec88576f041d8d8ac7e25eabb522..a888709e7643c0b57e73139d008f32ee9a6b91d2 100644 >--- a/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h >+++ b/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h >@@ -70,7 +70,7 @@ public: > > using KeyStatusVector = CDMInstanceSessionClient::KeyStatusVector; > using Message = std::pair<MessageType, Ref<SharedBuffer>>; >- using LicenseUpdateCallback = CompletionHandler<void(bool sessionWasClosed, std::optional<KeyStatusVector>&& changedKeys, std::optional<double>&& changedExpiration, std::optional<Message>&& message, SuccessValue succeeded)>; >+ using LicenseUpdateCallback = CompletionHandler<void(bool sessionWasClosed, WTF::Optional<KeyStatusVector>&& changedKeys, WTF::Optional<double>&& changedExpiration, WTF::Optional<Message>&& message, SuccessValue succeeded)>; > virtual void updateLicense(const String& sessionId, LicenseType, const SharedBuffer& response, LicenseUpdateCallback&&) = 0; > > enum class SessionLoadFailure { >@@ -81,13 +81,13 @@ public: > Other, > }; > >- using LoadSessionCallback = CompletionHandler<void(std::optional<KeyStatusVector>&&, std::optional<double>&&, std::optional<Message>&&, SuccessValue, SessionLoadFailure)>; >+ using LoadSessionCallback = CompletionHandler<void(WTF::Optional<KeyStatusVector>&&, WTF::Optional<double>&&, WTF::Optional<Message>&&, SuccessValue, SessionLoadFailure)>; > virtual void loadSession(LicenseType, const String& sessionId, const String& origin, LoadSessionCallback&&) = 0; > > using CloseSessionCallback = CompletionHandler<void()>; > virtual void closeSession(const String& sessionId, CloseSessionCallback&&) = 0; > >- using RemoveSessionDataCallback = CompletionHandler<void(KeyStatusVector&&, std::optional<Ref<SharedBuffer>>&&, SuccessValue)>; >+ using RemoveSessionDataCallback = CompletionHandler<void(KeyStatusVector&&, WTF::Optional<Ref<SharedBuffer>>&&, SuccessValue)>; > virtual void removeSessionData(const String& sessionId, LicenseType, RemoveSessionDataCallback&&) = 0; > > virtual void storeRecordOfKeyUsage(const String& sessionId) = 0; >diff --git a/Source/WebCore/platform/encryptedmedia/CDMMediaCapability.h b/Source/WebCore/platform/encryptedmedia/CDMMediaCapability.h >index 66d021148438823d6c533e0b046c38026bbd728e..fa2fb014657132cd3e56ea5ed3e1bfc125446aa4 100644 >--- a/Source/WebCore/platform/encryptedmedia/CDMMediaCapability.h >+++ b/Source/WebCore/platform/encryptedmedia/CDMMediaCapability.h >@@ -38,7 +38,7 @@ namespace WebCore { > struct CDMMediaCapability { > String contentType; > String robustness; >- std::optional<CDMEncryptionScheme> encryptionScheme; >+ WTF::Optional<CDMEncryptionScheme> encryptionScheme; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/encryptedmedia/CDMPrivate.h b/Source/WebCore/platform/encryptedmedia/CDMPrivate.h >index b6df13a90510218835768d99fb6273ccde0b09f4..5d87470fc57558870af660c3bf3e3e21d1e259eb 100644 >--- a/Source/WebCore/platform/encryptedmedia/CDMPrivate.h >+++ b/Source/WebCore/platform/encryptedmedia/CDMPrivate.h >@@ -55,7 +55,7 @@ public: > virtual bool supportsSessions() const = 0; > virtual bool supportsInitData(const AtomicString&, const SharedBuffer&) const = 0; > virtual RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const = 0; >- virtual std::optional<String> sanitizeSessionId(const String&) const = 0; >+ virtual WTF::Optional<String> sanitizeSessionId(const String&) const = 0; > }; > > } >diff --git a/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp b/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp >index 1a1e0ec65cd916656e23dc13c8fbe618e13dddee..ebf240d4d936620cc151550a250268cfbadae624 100644 >--- a/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp >+++ b/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp >@@ -87,18 +87,18 @@ static RefPtr<JSON::Object> parseJSONObject(const SharedBuffer& buffer) > return object; > } > >-static std::optional<Vector<CDMInstanceClearKey::Key>> parseLicenseFormat(const JSON::Object& root) >+static WTF::Optional<Vector<CDMInstanceClearKey::Key>> parseLicenseFormat(const JSON::Object& root) > { > // If the 'keys' key is present in the root object, parse the JSON further > // according to the specified 'license' format. > auto it = root.find("keys"); > if (it == root.end()) >- return std::nullopt; >+ return WTF::nullopt; > > // Retrieve the keys array. > RefPtr<JSON::Array> keysArray; > if (!it->value->asArray(keysArray)) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<CDMInstanceClearKey::Key> decodedKeys; > bool validFormat = std::all_of(keysArray->begin(), keysArray->end(), >@@ -123,7 +123,7 @@ static std::optional<Vector<CDMInstanceClearKey::Key>> parseLicenseFormat(const > return true; > }); > if (!validFormat) >- return std::nullopt; >+ return WTF::nullopt; > > return decodedKeys; > } >@@ -446,13 +446,13 @@ RefPtr<SharedBuffer> CDMPrivateClearKey::sanitizeResponse(const SharedBuffer& re > return response.copy(); > } > >-std::optional<String> CDMPrivateClearKey::sanitizeSessionId(const String& sessionId) const >+WTF::Optional<String> CDMPrivateClearKey::sanitizeSessionId(const String& sessionId) const > { > // Validate the session ID string as an 32-bit integer. > bool ok; > sessionId.toUIntStrict(&ok); > if (!ok) >- return std::nullopt; >+ return WTF::nullopt; > return sessionId; > } > >@@ -544,20 +544,20 @@ void CDMInstanceSessionClearKey::updateLicense(const String& sessionId, LicenseT > // Use a helper functor that schedules the callback dispatch, avoiding > // duplicated callOnMainThread() calls. > auto dispatchCallback = >- [this, &callback](bool sessionWasClosed, std::optional<KeyStatusVector>&& changedKeys, SuccessValue succeeded) { >+ [this, &callback](bool sessionWasClosed, WTF::Optional<KeyStatusVector>&& changedKeys, SuccessValue succeeded) { > callOnMainThread( > [weakThis = makeWeakPtr(*this), callback = WTFMove(callback), sessionWasClosed, changedKeys = WTFMove(changedKeys), succeeded] () mutable { > if (!weakThis) > return; > >- callback(sessionWasClosed, WTFMove(changedKeys), std::nullopt, std::nullopt, succeeded); >+ callback(sessionWasClosed, WTFMove(changedKeys), WTF::nullopt, WTF::nullopt, succeeded); > }); > }; > > // Parse the response buffer as an JSON object. > RefPtr<JSON::Object> root = parseJSONObject(response); > if (!root) { >- dispatchCallback(false, std::nullopt, SuccessValue::Failed); >+ dispatchCallback(false, WTF::nullopt, SuccessValue::Failed); > return; > } > >@@ -594,7 +594,7 @@ void CDMInstanceSessionClearKey::updateLicense(const String& sessionId, LicenseT > > // In case of changed keys, we have to provide a KeyStatusVector of all the keys for > // this session. >- std::optional<KeyStatusVector> changedKeys; >+ WTF::Optional<KeyStatusVector> changedKeys; > if (keysChanged) { > // First a helper Vector is constructed, cotaining pairs of SharedBuffer RefPtrs > // representint key ID data, and the corresponding key statuses. >@@ -615,7 +615,7 @@ void CDMInstanceSessionClearKey::updateLicense(const String& sessionId, LicenseT > }); > > // Finally construct the mirroring KeyStatusVector object and move it into the >- // std::optional<> object that will be passed to the callback. >+ // WTF::Optional<> object that will be passed to the callback. > KeyStatusVector keyStatusVector; > keyStatusVector.reserveInitialCapacity(keys.size()); > for (auto& it : keys) >@@ -632,25 +632,25 @@ void CDMInstanceSessionClearKey::updateLicense(const String& sessionId, LicenseT > if (parseLicenseReleaseAcknowledgementFormat(*root)) { > // FIXME: Retrieve the key ID information and use it to validate the keys for this sessionId. > ClearKeyState::singleton().keys().remove(sessionId); >- dispatchCallback(true, std::nullopt, SuccessValue::Succeeded); >+ dispatchCallback(true, WTF::nullopt, SuccessValue::Succeeded); > return; > } > > // Bail in case no format was recognized. >- dispatchCallback(false, std::nullopt, SuccessValue::Failed); >+ dispatchCallback(false, WTF::nullopt, SuccessValue::Failed); > } > > void CDMInstanceSessionClearKey::loadSession(LicenseType, const String& sessionId, const String&, LoadSessionCallback&& callback) > { > // Use a helper functor that schedules the callback dispatch, avoiding duplicated callOnMainThread() calls. > auto dispatchCallback = >- [this, &callback](std::optional<KeyStatusVector>&& existingKeys, SuccessValue success, SessionLoadFailure loadFailure) { >+ [this, &callback](WTF::Optional<KeyStatusVector>&& existingKeys, SuccessValue success, SessionLoadFailure loadFailure) { > callOnMainThread( > [weakThis = makeWeakPtr(*this), callback = WTFMove(callback), existingKeys = WTFMove(existingKeys), success, loadFailure]() mutable { > if (!weakThis) > return; > >- callback(WTFMove(existingKeys), std::nullopt, std::nullopt, success, loadFailure); >+ callback(WTFMove(existingKeys), WTF::nullopt, WTF::nullopt, success, loadFailure); > }); > }; > >@@ -660,7 +660,7 @@ void CDMInstanceSessionClearKey::loadSession(LicenseType, const String& sessionI > auto& keys = ClearKeyState::singleton().keys(); > auto it = keys.find(sessionId); > if (it == keys.end()) { >- dispatchCallback(std::nullopt, Failed, SessionLoadFailure::NoSessionData); >+ dispatchCallback(WTF::nullopt, Failed, SessionLoadFailure::NoSessionData); > return; > } > >@@ -688,7 +688,7 @@ void CDMInstanceSessionClearKey::removeSessionData(const String& sessionId, Lice > { > // Use a helper functor that schedules the callback dispatch, avoiding duplicated callOnMainThread() calls. > auto dispatchCallback = >- [this, &callback](KeyStatusVector&& keyStatusVector, std::optional<Ref<SharedBuffer>>&& message, SuccessValue success) { >+ [this, &callback](KeyStatusVector&& keyStatusVector, WTF::Optional<Ref<SharedBuffer>>&& message, SuccessValue success) { > callOnMainThread( > [weakThis = makeWeakPtr(*this), callback = WTFMove(callback), keyStatusVector = WTFMove(keyStatusVector), message = WTFMove(message), success]() mutable { > if (!weakThis) >@@ -707,7 +707,7 @@ void CDMInstanceSessionClearKey::removeSessionData(const String& sessionId, Lice > auto& keys = ClearKeyState::singleton().keys(); > auto it = keys.find(sessionId); > if (it == keys.end()) { >- dispatchCallback(KeyStatusVector { }, std::nullopt, SuccessValue::Failed); >+ dispatchCallback(KeyStatusVector { }, WTF::nullopt, SuccessValue::Failed); > return; > } > >diff --git a/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h b/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h >index f11ccdc8c421c99249d4d80c0a7f5c03534550b4..c86351b1eea7e06edc60f27bc4b816a85bfa81bb 100644 >--- a/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h >+++ b/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h >@@ -72,7 +72,7 @@ public: > bool supportsSessions() const final; > bool supportsInitData(const AtomicString&, const SharedBuffer&) const final; > RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const final; >- std::optional<String> sanitizeSessionId(const String&) const final; >+ WTF::Optional<String> sanitizeSessionId(const String&) const final; > }; > > class CDMInstanceClearKey final : public CDMInstance, public CanMakeWeakPtr<CDMInstanceClearKey> { >diff --git a/Source/WebCore/platform/glib/FileSystemGlib.cpp b/Source/WebCore/platform/glib/FileSystemGlib.cpp >index b90eec66e23768c71f0a5af18cd8a98aa2fec317..91680a373760bb3e9f34834d0f493f111b9f6dec 100644 >--- a/Source/WebCore/platform/glib/FileSystemGlib.cpp >+++ b/Source/WebCore/platform/glib/FileSystemGlib.cpp >@@ -151,17 +151,17 @@ bool getFileSize(PlatformFileHandle, long long&) > return false; > } > >-std::optional<WallTime> getFileCreationTime(const String&) >+WTF::Optional<WallTime> getFileCreationTime(const String&) > { > // FIXME: Is there a way to retrieve file creation time with Gtk on platforms that support it? >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<WallTime> getFileModificationTime(const String& path) >+WTF::Optional<WallTime> getFileModificationTime(const String& path) > { > GStatBuf statResult; > if (!getFileStat(path, &statResult)) >- return std::nullopt; >+ return WTF::nullopt; > > return WallTime::fromRawSeconds(statResult.st_mtime); > } >@@ -175,11 +175,11 @@ static FileMetadata::Type toFileMetataType(GStatBuf statResult) > return FileMetadata::Type::File; > } > >-static std::optional<FileMetadata> fileMetadataUsingFunction(const String& path, bool (*statFunc)(const String&, GStatBuf*)) >+static WTF::Optional<FileMetadata> fileMetadataUsingFunction(const String& path, bool (*statFunc)(const String&, GStatBuf*)) > { > GStatBuf statResult; > if (!statFunc(path, &statResult)) >- return std::nullopt; >+ return WTF::nullopt; > > String filename = pathGetFileName(path); > bool isHidden = !filename.isEmpty() && filename[0] == '.'; >@@ -192,12 +192,12 @@ static std::optional<FileMetadata> fileMetadataUsingFunction(const String& path, > }; > } > >-std::optional<FileMetadata> fileMetadata(const String& path) >+WTF::Optional<FileMetadata> fileMetadata(const String& path) > { > return fileMetadataUsingFunction(path, &getFileLStat); > } > >-std::optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >+WTF::Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) > { > return fileMetadataUsingFunction(path, &getFileStat); > } >@@ -429,16 +429,16 @@ bool hardLinkOrCopyFile(const String& source, const String& destination) > #endif > } > >-std::optional<int32_t> getFileDeviceId(const CString& fsFile) >+WTF::Optional<int32_t> getFileDeviceId(const CString& fsFile) > { > GUniquePtr<gchar> filename = unescapedFilename(fsFile.data()); > if (!filename) >- return std::nullopt; >+ return WTF::nullopt; > > GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get())); > GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_UNIX_DEVICE, nullptr, nullptr)); > if (!fileInfo) >- return std::nullopt; >+ return WTF::nullopt; > > return g_file_info_get_attribute_uint32(fileInfo.get(), G_FILE_ATTRIBUTE_UNIX_DEVICE); > } >diff --git a/Source/WebCore/platform/graphics/BitmapImage.cpp b/Source/WebCore/platform/graphics/BitmapImage.cpp >index 614bc3f4774c76691c738d395865990392543848..15ae1edb0aefdc30e0812af6c67f764f48fee91a 100644 >--- a/Source/WebCore/platform/graphics/BitmapImage.cpp >+++ b/Source/WebCore/platform/graphics/BitmapImage.cpp >@@ -440,7 +440,7 @@ BitmapImage::StartAnimationStatus BitmapImage::internalStartAnimation() > // through the callback newFrameNativeImageAvailableAtIndex(). Otherwise, advanceAnimation() will be called > // when the timer fires and m_currentFrame will be advanced to nextFrame since it is not being decoded. > if (shouldUseAsyncDecodingForAnimatedImages()) { >- if (frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(nextFrame, m_currentSubsamplingLevel, DecodingOptions(std::optional<IntSize>()))) >+ if (frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(nextFrame, m_currentSubsamplingLevel, DecodingOptions(WTF::Optional<IntSize>()))) > LOG(Images, "BitmapImage::%s - %p - url: %s [cachedFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().string().utf8().data(), ++m_cachedFrameCount, nextFrame); > else { > m_source->requestFrameAsyncDecodingAtIndex(nextFrame, m_currentSubsamplingLevel); >@@ -531,25 +531,25 @@ void BitmapImage::decode(WTF::Function<void()>&& callback) > } > > // The animated image has not been displayed. In this case, either the first frame has not been decoded yet or the animation has not started yet. >- bool frameIsCompatible = frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, std::optional<IntSize>()); >- bool frameIsBeingDecoded = frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex(m_currentFrame, std::optional<IntSize>()); >+ bool frameIsCompatible = frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, WTF::Optional<IntSize>()); >+ bool frameIsBeingDecoded = frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex(m_currentFrame, WTF::Optional<IntSize>()); > > if (frameIsCompatible) > internalStartAnimation(); > else if (!frameIsBeingDecoded) { >- m_source->requestFrameAsyncDecodingAtIndex(m_currentFrame, m_currentSubsamplingLevel, std::optional<IntSize>()); >+ m_source->requestFrameAsyncDecodingAtIndex(m_currentFrame, m_currentSubsamplingLevel, WTF::Optional<IntSize>()); > m_currentFrameDecodingStatus = DecodingStatus::Decoding; > } > return; > } > >- bool frameIsCompatible = frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, std::optional<IntSize>()); >- bool frameIsBeingDecoded = frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex(m_currentFrame, std::optional<IntSize>()); >+ bool frameIsCompatible = frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, WTF::Optional<IntSize>()); >+ bool frameIsBeingDecoded = frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex(m_currentFrame, WTF::Optional<IntSize>()); > > if (frameIsCompatible) > callDecodingCallbacks(); > else if (!frameIsBeingDecoded) { >- m_source->requestFrameAsyncDecodingAtIndex(m_currentFrame, m_currentSubsamplingLevel, std::optional<IntSize>()); >+ m_source->requestFrameAsyncDecodingAtIndex(m_currentFrame, m_currentSubsamplingLevel, WTF::Optional<IntSize>()); > m_currentFrameDecodingStatus = DecodingStatus::Decoding; > } > } >@@ -595,7 +595,7 @@ void BitmapImage::imageFrameAvailableAtIndex(size_t index) > ++m_decodeCountForTesting; > > // Call m_decodingCallbacks only if the image frame was decoded with the native size. >- if (frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, std::optional<IntSize>())) >+ if (frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, WTF::Optional<IntSize>())) > callDecodingCallbacks(); > > if (imageObserver()) >diff --git a/Source/WebCore/platform/graphics/BitmapImage.h b/Source/WebCore/platform/graphics/BitmapImage.h >index ab814ea7f5a01675c4283a79e642e9e70a8ced3a..913b9ac127e344d9a0fe08bfc7667f65f6c498dd 100644 >--- a/Source/WebCore/platform/graphics/BitmapImage.h >+++ b/Source/WebCore/platform/graphics/BitmapImage.h >@@ -78,7 +78,7 @@ public: > RepetitionCount repetitionCount() const { return m_source->repetitionCount(); } > String uti() const override { return m_source->uti(); } > String filenameExtension() const override { return m_source->filenameExtension(); } >- std::optional<IntPoint> hotSpot() const override { return m_source->hotSpot(); } >+ WTF::Optional<IntPoint> hotSpot() const override { return m_source->hotSpot(); } > > // FloatSize due to override. > FloatSize size() const override { return m_source->size(); } >@@ -90,7 +90,7 @@ public: > bool frameHasAlphaAtIndex(size_t index) const { return m_source->frameHasAlphaAtIndex(index); } > > bool frameHasFullSizeNativeImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel) { return m_source->frameHasFullSizeNativeImageAtIndex(index, subsamplingLevel); } >- bool frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t index, const std::optional<SubsamplingLevel>& subsamplingLevel, const DecodingOptions& decodingOptions) { return m_source->frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(index, subsamplingLevel, decodingOptions); } >+ bool frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t index, const WTF::Optional<SubsamplingLevel>& subsamplingLevel, const DecodingOptions& decodingOptions) { return m_source->frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(index, subsamplingLevel, decodingOptions); } > > SubsamplingLevel frameSubsamplingLevelAtIndex(size_t index) const { return m_source->frameSubsamplingLevelAtIndex(index); } > >diff --git a/Source/WebCore/platform/graphics/Color.h b/Source/WebCore/platform/graphics/Color.h >index f08d00c2fc9cb20bc31acc82399a1c3a1a0bcdd3..ad4fd9e29ed950915150eb4f80d33a5c3f4b5686 100644 >--- a/Source/WebCore/platform/graphics/Color.h >+++ b/Source/WebCore/platform/graphics/Color.h >@@ -70,7 +70,7 @@ RGBA32 makePremultipliedRGBA(int r, int g, int b, int a, bool ceiling = true); > RGBA32 makeUnPremultipliedRGBA(int r, int g, int b, int a); > > WEBCORE_EXPORT RGBA32 colorWithOverrideAlpha(RGBA32 color, float overrideAlpha); >-RGBA32 colorWithOverrideAlpha(RGBA32 color, std::optional<float> overrideAlpha); >+RGBA32 colorWithOverrideAlpha(RGBA32 color, WTF::Optional<float> overrideAlpha); > > WEBCORE_EXPORT RGBA32 makeRGBA32FromFloats(float r, float g, float b, float a); > RGBA32 makeRGBAFromHSLA(double h, double s, double l, double a); >@@ -433,7 +433,7 @@ inline uint16_t fastDivideBy255(uint16_t value) > return approximation + (remainder >> 8); > } > >-inline RGBA32 colorWithOverrideAlpha(RGBA32 color, std::optional<float> overrideAlpha) >+inline RGBA32 colorWithOverrideAlpha(RGBA32 color, WTF::Optional<float> overrideAlpha) > { > return overrideAlpha ? colorWithOverrideAlpha(color, overrideAlpha.value()) : color; > } >diff --git a/Source/WebCore/platform/graphics/ComplexTextController.cpp b/Source/WebCore/platform/graphics/ComplexTextController.cpp >index e07a72d864892c2c876be4875a0a255354dbb667..3bef7f7daa94efc5d24aaaf59c021894b10aedb9 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.cpp >+++ b/Source/WebCore/platform/graphics/ComplexTextController.cpp >@@ -316,19 +316,19 @@ static bool advanceByCombiningCharacterSequence(const UChar*& iterator, const UC > } > > // FIXME: Capitalization is language-dependent and context-dependent and should operate on grapheme clusters instead of codepoints. >-static inline std::optional<UChar32> capitalized(UChar32 baseCharacter) >+static inline WTF::Optional<UChar32> capitalized(UChar32 baseCharacter) > { > if (U_GET_GC_MASK(baseCharacter) & U_GC_M_MASK) >- return std::nullopt; >+ return WTF::nullopt; > > UChar32 uppercaseCharacter = u_toupper(baseCharacter); > ASSERT(uppercaseCharacter == baseCharacter || (U_IS_BMP(baseCharacter) == U_IS_BMP(uppercaseCharacter))); > if (uppercaseCharacter != baseCharacter) > return uppercaseCharacter; >- return std::nullopt; >+ return WTF::nullopt; > } > >-static bool shouldSynthesize(bool dontSynthesizeSmallCaps, const Font* nextFont, UChar32 baseCharacter, std::optional<UChar32> capitalizedBase, FontVariantCaps fontVariantCaps, bool engageAllSmallCapsProcessing) >+static bool shouldSynthesize(bool dontSynthesizeSmallCaps, const Font* nextFont, UChar32 baseCharacter, WTF::Optional<UChar32> capitalizedBase, FontVariantCaps fontVariantCaps, bool engageAllSmallCapsProcessing) > { > if (dontSynthesizeSmallCaps) > return false; >diff --git a/Source/WebCore/platform/graphics/DecodingOptions.h b/Source/WebCore/platform/graphics/DecodingOptions.h >index 7e993f1537b35d83dd5727a3529c1dcc89b4c5da..eca6dc60bf544137c92ecd93de1efd6b522041c4 100644 >--- a/Source/WebCore/platform/graphics/DecodingOptions.h >+++ b/Source/WebCore/platform/graphics/DecodingOptions.h >@@ -44,7 +44,7 @@ public: > { > } > >- DecodingOptions(const std::optional<IntSize>& sizeForDrawing) >+ DecodingOptions(const WTF::Optional<IntSize>& sizeForDrawing) > : m_decodingModeOrSize(sizeForDrawing) > { > } >@@ -107,10 +107,10 @@ public: > return hasSize() && sizeForDrawing(); > } > >- std::optional<IntSize> sizeForDrawing() const >+ WTF::Optional<IntSize> sizeForDrawing() const > { > ASSERT(hasSize()); >- return WTF::get<std::optional<IntSize>>(m_decodingModeOrSize); >+ return WTF::get<WTF::Optional<IntSize>>(m_decodingModeOrSize); > } > > static int maxDimension(const IntSize& size) >@@ -132,15 +132,15 @@ private: > > bool hasSize() const > { >- return has<std::optional<IntSize>>(); >+ return has<WTF::Optional<IntSize>>(); > } > > // Four states of the decoding: > // - Synchronous: DecodingMode::Synchronous > // - Asynchronous + anySize: DecodingMode::Asynchronous >- // - Asynchronous + intrinsicSize: an empty std::optional<IntSize>> >- // - Asynchronous + sizeForDrawing: a none empty std::optional<IntSize>> >- using DecodingModeOrSize = Variant<DecodingMode, std::optional<IntSize>>; >+ // - Asynchronous + intrinsicSize: an empty WTF::Optional<IntSize>> >+ // - Asynchronous + sizeForDrawing: a none empty WTF::Optional<IntSize>> >+ using DecodingModeOrSize = Variant<DecodingMode, WTF::Optional<IntSize>>; > DecodingModeOrSize m_decodingModeOrSize; > }; > >diff --git a/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h b/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h >index 8fa114c45144598f1e754f3e1c61aafc2dc86315..644eae005b8040d07bf5111057a3188217bbbbcd 100644 >--- a/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h >+++ b/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h >@@ -56,7 +56,7 @@ public: > > private: > bool m_scheduled { false }; >- std::optional<PlatformDisplayID> m_displayID; >+ WTF::Optional<PlatformDisplayID> m_displayID; > }; > > } >diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp >index 2ddc79c6d6df468272e832d11af35d920c925f9f..56fd543cb5d6cd3257d62be4ecbc3f7e364eab2b 100644 >--- a/Source/WebCore/platform/graphics/Font.cpp >+++ b/Source/WebCore/platform/graphics/Font.cpp >@@ -148,7 +148,7 @@ static bool fillGlyphPage(GlyphPage& pageToFill, UChar* buffer, unsigned bufferL > return hasGlyphs; > } > >-static std::optional<size_t> codePointSupportIndex(UChar32 codePoint) >+static WTF::Optional<size_t> codePointSupportIndex(UChar32 codePoint) > { > // FIXME: Consider reordering these so the most common ones are at the front. > // Doing this could cause the BitVector to fit inside inline storage and therefore >@@ -157,7 +157,7 @@ static std::optional<size_t> codePointSupportIndex(UChar32 codePoint) > return codePoint; > if (codePoint >= 0x7F && codePoint < 0xA0) > return codePoint - 0x7F + 0x20; >- std::optional<size_t> result; >+ WTF::Optional<size_t> result; > switch (codePoint) { > case softHyphen: > result = 0x41; >@@ -220,7 +220,7 @@ static std::optional<size_t> codePointSupportIndex(UChar32 codePoint) > result = 0x54; > break; > default: >- result = std::nullopt; >+ result = WTF::nullopt; > } > > #ifndef NDEBUG >diff --git a/Source/WebCore/platform/graphics/Font.h b/Source/WebCore/platform/graphics/Font.h >index cd1b9553db22d633b1ad46c3f114f8ed41de401f..b77b880cc94734637a9249f2236096cc4b81ec21 100644 >--- a/Source/WebCore/platform/graphics/Font.h >+++ b/Source/WebCore/platform/graphics/Font.h >@@ -255,7 +255,7 @@ private: > mutable HashMap<unsigned, RefPtr<GlyphPage>> m_glyphPages; > mutable std::unique_ptr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; > mutable GlyphMetricsMap<float> m_glyphToWidthMap; >- mutable GlyphMetricsMap<std::optional<Path>> m_glyphPathMap; >+ mutable GlyphMetricsMap<WTF::Optional<Path>> m_glyphPathMap; > mutable BitVector m_codePointSupport; > > mutable RefPtr<OpenTypeMathData> m_mathData; >@@ -283,10 +283,10 @@ private: > #if PLATFORM(COCOA) > mutable RetainPtr<CFMutableDictionaryRef> m_nonKernedCFStringAttributes; > mutable RetainPtr<CFMutableDictionaryRef> m_kernedCFStringAttributes; >- mutable std::optional<BitVector> m_glyphsSupportedBySmallCaps; >- mutable std::optional<BitVector> m_glyphsSupportedByAllSmallCaps; >- mutable std::optional<BitVector> m_glyphsSupportedByPetiteCaps; >- mutable std::optional<BitVector> m_glyphsSupportedByAllPetiteCaps; >+ mutable WTF::Optional<BitVector> m_glyphsSupportedBySmallCaps; >+ mutable WTF::Optional<BitVector> m_glyphsSupportedByAllSmallCaps; >+ mutable WTF::Optional<BitVector> m_glyphsSupportedByPetiteCaps; >+ mutable WTF::Optional<BitVector> m_glyphsSupportedByAllPetiteCaps; > #endif > > #if PLATFORM(WIN) >diff --git a/Source/WebCore/platform/graphics/FontCache.h b/Source/WebCore/platform/graphics/FontCache.h >index 396036a1fee335c15c5a56dcace7b440c5938b51..be64cd702d2c0352d8712680f929d3480324ce64 100644 >--- a/Source/WebCore/platform/graphics/FontCache.h >+++ b/Source/WebCore/platform/graphics/FontCache.h >@@ -245,7 +245,7 @@ public: > PrewarmInformation isolatedCopy() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<PrewarmInformation> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<PrewarmInformation> decode(Decoder&); > }; > PrewarmInformation collectPrewarmInformation() const; > void prewarm(const PrewarmInformation&); >@@ -314,7 +314,7 @@ void FontCache::PrewarmInformation::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<FontCache::PrewarmInformation> FontCache::PrewarmInformation::decode(Decoder& decoder) >+WTF::Optional<FontCache::PrewarmInformation> FontCache::PrewarmInformation::decode(Decoder& decoder) > { > PrewarmInformation prewarmInformation; > if (!decoder.decode(prewarmInformation.seenFamilies)) >diff --git a/Source/WebCore/platform/graphics/FontCascade.cpp b/Source/WebCore/platform/graphics/FontCascade.cpp >index e2d31b296473b57c8753063bed164f33f652e0fd..c6f24a7f5b574a6dea93c79a2af09f6bbe1676a4 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.cpp >+++ b/Source/WebCore/platform/graphics/FontCascade.cpp >@@ -284,7 +284,7 @@ float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& > return getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer); > } > >-float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, unsigned from, std::optional<unsigned> to, CustomFontNotReadyAction customFontNotReadyAction) const >+float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, unsigned from, WTF::Optional<unsigned> to, CustomFontNotReadyAction customFontNotReadyAction) const > { > unsigned destination = to.value_or(run.length()); > GlyphBuffer glyphBuffer; >@@ -298,7 +298,7 @@ float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const > return startPoint.x() - startX; > } > >-void FontCascade::drawEmphasisMarks(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, std::optional<unsigned> to) const >+void FontCascade::drawEmphasisMarks(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, WTF::Optional<unsigned> to) const > { > if (isLoadingCustomFonts()) > return; >@@ -310,7 +310,7 @@ void FontCascade::drawEmphasisMarks(GraphicsContext& context, const TextRun& run > drawEmphasisMarksForComplexText(context, run, mark, point, from, destination); > } > >-std::unique_ptr<DisplayList::DisplayList> FontCascade::displayListForTextRun(GraphicsContext& context, const TextRun& run, unsigned from, std::optional<unsigned> to, CustomFontNotReadyAction customFontNotReadyAction) const >+std::unique_ptr<DisplayList::DisplayList> FontCascade::displayListForTextRun(GraphicsContext& context, const TextRun& run, unsigned from, WTF::Optional<unsigned> to, CustomFontNotReadyAction customFontNotReadyAction) const > { > ASSERT(!context.paintingDisabled()); > unsigned destination = to.value_or(run.length()); >@@ -543,7 +543,7 @@ bool FontCascade::fastAverageCharWidthIfAvailable(float& width) const > return success; > } > >-void FontCascade::adjustSelectionRectForText(const TextRun& run, LayoutRect& selectionRect, unsigned from, std::optional<unsigned> to) const >+void FontCascade::adjustSelectionRectForText(const TextRun& run, LayoutRect& selectionRect, unsigned from, WTF::Optional<unsigned> to) const > { > unsigned destination = to.value_or(run.length()); > if (codePath(run, from, to) != Complex) >@@ -605,7 +605,7 @@ FontCascade::CodePath FontCascade::codePath() > return s_codePath; > } > >-FontCascade::CodePath FontCascade::codePath(const TextRun& run, std::optional<unsigned> from, std::optional<unsigned> to) const >+FontCascade::CodePath FontCascade::codePath(const TextRun& run, WTF::Optional<unsigned> from, WTF::Optional<unsigned> to) const > { > if (s_codePath != Auto) > return s_codePath; >@@ -1300,27 +1300,27 @@ static GlyphUnderlineType computeUnderlineType(const TextRun& textRun, const Gly > > // FIXME: This function may not work if the emphasis mark uses a complex script, but none of the > // standard emphasis marks do so. >-std::optional<GlyphData> FontCascade::getEmphasisMarkGlyphData(const AtomicString& mark) const >+WTF::Optional<GlyphData> FontCascade::getEmphasisMarkGlyphData(const AtomicString& mark) const > { > if (mark.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > UChar32 character; > if (!mark.is8Bit()) { > SurrogatePairAwareTextIterator iterator(mark.characters16(), 0, mark.length(), mark.length()); > unsigned clusterLength; > if (!iterator.consume(character, clusterLength)) >- return std::nullopt; >+ return WTF::nullopt; > } else > character = mark[0]; > >- std::optional<GlyphData> glyphData(glyphDataForCharacter(character, false, EmphasisMarkVariant)); >- return glyphData.value().isValid() ? glyphData : std::nullopt; >+ WTF::Optional<GlyphData> glyphData(glyphDataForCharacter(character, false, EmphasisMarkVariant)); >+ return glyphData.value().isValid() ? glyphData : WTF::nullopt; > } > > int FontCascade::emphasisMarkAscent(const AtomicString& mark) const > { >- std::optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); >+ WTF::Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); > if (!markGlyphData) > return 0; > >@@ -1334,7 +1334,7 @@ int FontCascade::emphasisMarkAscent(const AtomicString& mark) const > > int FontCascade::emphasisMarkDescent(const AtomicString& mark) const > { >- std::optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); >+ WTF::Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); > if (!markGlyphData) > return 0; > >@@ -1348,7 +1348,7 @@ int FontCascade::emphasisMarkDescent(const AtomicString& mark) const > > int FontCascade::emphasisMarkHeight(const AtomicString& mark) const > { >- std::optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); >+ WTF::Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); > if (!markGlyphData) > return 0; > >@@ -1495,7 +1495,7 @@ inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer& glyphBuffer, > > void FontCascade::drawEmphasisMarks(GraphicsContext& context, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const > { >- std::optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); >+ WTF::Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); > if (!markGlyphData) > return; > >@@ -1674,11 +1674,11 @@ struct GlyphIterationState { > float maxX; > }; > >-static std::optional<float> findIntersectionPoint(float y, FloatPoint p1, FloatPoint p2) >+static WTF::Optional<float> findIntersectionPoint(float y, FloatPoint p1, FloatPoint p2) > { > if ((p1.y() < y && p2.y() > y) || (p1.y() > y && p2.y() < y)) > return p1.x() + (y - p1.y()) * (p2.x() - p1.x()) / (p2.y() - p1.y()); >- return std::nullopt; >+ return WTF::nullopt; > } > > static void updateX(GlyphIterationState& state, float x) >diff --git a/Source/WebCore/platform/graphics/FontCascade.h b/Source/WebCore/platform/graphics/FontCascade.h >index a792de3e5b9ac2f5f6bfe1dfcd18b6b234af33f3..77186bbb2d498212b93f671c838ce4314420d70b 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.h >+++ b/Source/WebCore/platform/graphics/FontCascade.h >@@ -107,9 +107,9 @@ public: > WEBCORE_EXPORT void update(RefPtr<FontSelector>&& = nullptr) const; > > enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady }; >- WEBCORE_EXPORT float drawText(GraphicsContext&, const TextRun&, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; >+ WEBCORE_EXPORT float drawText(GraphicsContext&, const TextRun&, const FloatPoint&, unsigned from = 0, WTF::Optional<unsigned> to = WTF::nullopt, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; > static void drawGlyphs(GraphicsContext&, const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, FontSmoothingMode); >- void drawEmphasisMarks(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt) const; >+ void drawEmphasisMarks(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, unsigned from = 0, WTF::Optional<unsigned> to = WTF::nullopt) const; > > DashArray dashesForIntersectionsWithRect(const TextRun&, const FloatPoint& textOrigin, const FloatRect& lineExtents) const; > >@@ -121,7 +121,7 @@ public: > static float width(TextLayout&, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts = 0); > > int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const; >- void adjustSelectionRectForText(const TextRun&, LayoutRect& selectionRect, unsigned from = 0, std::optional<unsigned> to = std::nullopt) const; >+ void adjustSelectionRectForText(const TextRun&, LayoutRect& selectionRect, unsigned from = 0, WTF::Optional<unsigned> to = WTF::nullopt) const; > > bool isSmallCaps() const { return m_fontDescription.variantCaps() == FontVariantCaps::Small; } > >@@ -140,8 +140,8 @@ public: > unsigned familyCount() const { return m_fontDescription.familyCount(); } > const AtomicString& familyAt(unsigned i) const { return m_fontDescription.familyAt(i); } > >- // A std::nullopt return value indicates "font-style: normal". >- std::optional<FontSelectionValue> italic() const { return m_fontDescription.italic(); } >+ // A WTF::nullopt return value indicates "font-style: normal". >+ WTF::Optional<FontSelectionValue> italic() const { return m_fontDescription.italic(); } > FontSelectionValue weight() const { return m_fontDescription.weight(); } > FontWidthVariant widthVariant() const { return m_fontDescription.widthVariant(); } > >@@ -182,13 +182,13 @@ public: > WEBCORE_EXPORT static bool shouldUseSmoothing(); > > enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow }; >- CodePath codePath(const TextRun&, std::optional<unsigned> from = std::nullopt, std::optional<unsigned> to = std::nullopt) const; >+ CodePath codePath(const TextRun&, WTF::Optional<unsigned> from = WTF::nullopt, WTF::Optional<unsigned> to = WTF::nullopt) const; > static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simple; } > static CodePath characterRangeCodePath(const UChar*, unsigned len); > > bool primaryFontIsSystemFont() const; > >- std::unique_ptr<DisplayList::DisplayList> displayListForTextRun(GraphicsContext&, const TextRun&, unsigned from = 0, std::optional<unsigned> to = { }, CustomFontNotReadyAction = CustomFontNotReadyAction::DoNotPaintIfFontNotReady) const; >+ std::unique_ptr<DisplayList::DisplayList> displayListForTextRun(GraphicsContext&, const TextRun&, unsigned from = 0, WTF::Optional<unsigned> to = { }, CustomFontNotReadyAction = CustomFontNotReadyAction::DoNotPaintIfFontNotReady) const; > > #if PLATFORM(WIN) && USE(CG) > static void setFontSmoothingLevel(int); >@@ -211,7 +211,7 @@ private: > int offsetForPositionForSimpleText(const TextRun&, float position, bool includePartialGlyphs) const; > void adjustSelectionRectForSimpleText(const TextRun&, LayoutRect& selectionRect, unsigned from, unsigned to) const; > >- std::optional<GlyphData> getEmphasisMarkGlyphData(const AtomicString&) const; >+ WTF::Optional<GlyphData> getEmphasisMarkGlyphData(const AtomicString&) const; > > static bool canReturnFallbackFontsForComplexText(); > static bool canExpandAroundIdeographsInComplexText(); >diff --git a/Source/WebCore/platform/graphics/FontCascadeDescription.h b/Source/WebCore/platform/graphics/FontCascadeDescription.h >index b71c354407bad429283e5bdf87b8b85d15b04300..32ed007fff709cf524e244facac1caca78aa93de 100644 >--- a/Source/WebCore/platform/graphics/FontCascadeDescription.h >+++ b/Source/WebCore/platform/graphics/FontCascadeDescription.h >@@ -119,7 +119,7 @@ public: > #endif > > // Initial values for font properties. >- static std::optional<FontSelectionValue> initialItalic() { return std::nullopt; } >+ static WTF::Optional<FontSelectionValue> initialItalic() { return WTF::nullopt; } > static FontStyleAxis initialFontStyleAxis() { return FontStyleAxis::slnt; } > static FontSelectionValue initialWeight() { return normalWeightValue(); } > static FontSelectionValue initialStretch() { return normalStretchValue(); } >diff --git a/Source/WebCore/platform/graphics/FontDescription.h b/Source/WebCore/platform/graphics/FontDescription.h >index 5621eddcecfa7b9400b1c179b1cb6c07a57c45fe..3864fe2d703d11e7bd4037a636a29ac47c7bd127 100644 >--- a/Source/WebCore/platform/graphics/FontDescription.h >+++ b/Source/WebCore/platform/graphics/FontDescription.h >@@ -46,7 +46,7 @@ public: > > float computedSize() const { return m_computedSize; } > unsigned computedPixelSize() const { return unsigned(m_computedSize + 0.5f); } >- std::optional<FontSelectionValue> italic() const { return m_fontSelectionRequest.slope; } >+ WTF::Optional<FontSelectionValue> italic() const { return m_fontSelectionRequest.slope; } > FontSelectionValue stretch() const { return m_fontSelectionRequest.width; } > FontSelectionValue weight() const { return m_fontSelectionRequest.weight; } > FontSelectionRequest fontSelectionRequest() const { return m_fontSelectionRequest; } >@@ -99,9 +99,9 @@ public: > AllowUserInstalledFonts shouldAllowUserInstalledFonts() const { return static_cast<AllowUserInstalledFonts>(m_shouldAllowUserInstalledFonts); } > > void setComputedSize(float s) { m_computedSize = clampToFloat(s); } >- void setItalic(std::optional<FontSelectionValue> italic) { m_fontSelectionRequest.slope = italic; } >+ void setItalic(WTF::Optional<FontSelectionValue> italic) { m_fontSelectionRequest.slope = italic; } > void setStretch(FontSelectionValue stretch) { m_fontSelectionRequest.width = stretch; } >- void setIsItalic(bool isItalic) { setItalic(isItalic ? std::optional<FontSelectionValue> { italicValue() } : std::optional<FontSelectionValue> { }); } >+ void setIsItalic(bool isItalic) { setItalic(isItalic ? WTF::Optional<FontSelectionValue> { italicValue() } : WTF::Optional<FontSelectionValue> { }); } > void setWeight(FontSelectionValue weight) { m_fontSelectionRequest.weight = weight; } > void setRenderingMode(FontRenderingMode mode) { m_renderingMode = static_cast<unsigned>(mode); } > void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = static_cast<unsigned>(rendering); } >diff --git a/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp b/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp >index 33dc429ca9626a6cf233a6266ffc1693c31cae4d..9ea7f7019051465344e2f80a7d6776e0c37d7afa 100644 >--- a/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp >+++ b/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp >@@ -28,7 +28,7 @@ > > namespace WebCore { > >-FontSelectionAlgorithm::FontSelectionAlgorithm(FontSelectionRequest request, const Vector<Capabilities>& capabilities, std::optional<Capabilities> bounds) >+FontSelectionAlgorithm::FontSelectionAlgorithm(FontSelectionRequest request, const Vector<Capabilities>& capabilities, WTF::Optional<Capabilities> bounds) > : m_request(request) > , m_capabilities(capabilities) > { >@@ -139,7 +139,7 @@ auto FontSelectionAlgorithm::weightDistance(Capabilities capabilities) const -> > > FontSelectionValue FontSelectionAlgorithm::bestValue(const bool eliminated[], DistanceFunction computeDistance) const > { >- std::optional<DistanceResult> smallestDistance; >+ WTF::Optional<DistanceResult> smallestDistance; > for (size_t i = 0, size = m_capabilities.size(); i < size; ++i) { > if (eliminated[i]) > continue; >diff --git a/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h b/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h >index bc8bd021729c2be25786a4c6ee8de07e6cc95aaa..950fa533c0be1d0d6ca9b746569ed33ab756b472 100644 >--- a/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h >+++ b/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h >@@ -171,7 +171,7 @@ constexpr FontSelectionValue italicThreshold() > return FontSelectionValue { 20 }; > } > >-constexpr bool isItalic(std::optional<FontSelectionValue> fontWeight) >+constexpr bool isItalic(WTF::Optional<FontSelectionValue> fontWeight) > { > return fontWeight && fontWeight.value() >= italicThreshold(); > } >@@ -337,9 +337,9 @@ struct FontSelectionRequest { > // "fontStyleAxis" on the FontDescription. We should come up with a tri-state member > // so that it's a lot clearer whether we're dealing with a "normal", "italic" or explicit > // "oblique" font style. See webkit.org/b/187774. >- std::optional<Value> slope; >+ WTF::Optional<Value> slope; > >- std::tuple<Value, Value, std::optional<Value>> tied() const >+ std::tuple<Value, Value, WTF::Optional<Value>> tied() const > { > return WTF::tie(weight, width, slope); > } >@@ -351,7 +351,7 @@ inline TextStream& operator<<(TextStream& ts, const FontSelectionValue& fontSele > return ts; > } > >-inline TextStream& operator<<(TextStream& ts, const std::optional<FontSelectionValue>& optionalFontSelectionValue) >+inline TextStream& operator<<(TextStream& ts, const WTF::Optional<FontSelectionValue>& optionalFontSelectionValue) > { > ts << optionalFontSelectionValue.value_or(normalItalicValue()); > return ts; >@@ -407,7 +407,7 @@ constexpr bool operator!=(const FontSelectionCapabilities& a, const FontSelectio > struct FontSelectionSpecifiedCapabilities { > using Capabilities = FontSelectionCapabilities; > using Range = FontSelectionRange; >- using OptionalRange = std::optional<Range>; >+ using OptionalRange = WTF::Optional<Range>; > > constexpr Capabilities computeFontSelectionCapabilities() const > { >@@ -465,7 +465,7 @@ public: > using Capabilities = FontSelectionCapabilities; > > FontSelectionAlgorithm() = delete; >- FontSelectionAlgorithm(FontSelectionRequest, const Vector<Capabilities>&, std::optional<Capabilities> capabilitiesBounds = std::nullopt); >+ FontSelectionAlgorithm(FontSelectionRequest, const Vector<Capabilities>&, WTF::Optional<Capabilities> capabilitiesBounds = WTF::nullopt); > > struct DistanceResult { > FontSelectionValue distance; >diff --git a/Source/WebCore/platform/graphics/FourCC.cpp b/Source/WebCore/platform/graphics/FourCC.cpp >index d9a8962b0bb0e9a7b86c8573308b85d972b5d1ac..55adb1b3b7fbc4df94bded72de86b3f144f1389d 100644 >--- a/Source/WebCore/platform/graphics/FourCC.cpp >+++ b/Source/WebCore/platform/graphics/FourCC.cpp >@@ -28,11 +28,11 @@ > > namespace WebCore { > >-std::optional<FourCC> FourCC::fromString(const String& stringValue) >+WTF::Optional<FourCC> FourCC::fromString(const String& stringValue) > { > auto asciiValue = stringValue.ascii(); > if (asciiValue.length() != 4) >- return std::nullopt; >+ return WTF::nullopt; > > const char* data = asciiValue.data(); > ASSERT(asciiValue.data()); >diff --git a/Source/WebCore/platform/graphics/FourCC.h b/Source/WebCore/platform/graphics/FourCC.h >index ad40a9fbd63b51bffcf308802d57f8d4fa3fc270..5c2266f24553231b169095891ebfd80998928818 100644 >--- a/Source/WebCore/platform/graphics/FourCC.h >+++ b/Source/WebCore/platform/graphics/FourCC.h >@@ -40,7 +40,7 @@ struct FourCC { > } > > String toString() const; >- WEBCORE_EXPORT static std::optional<FourCC> fromString(const String&); >+ WEBCORE_EXPORT static WTF::Optional<FourCC> fromString(const String&); > > bool operator==(const FourCC& other) const { return value == other.value; } > bool operator!=(const FourCC& other) const { return value != other.value; } >diff --git a/Source/WebCore/platform/graphics/GlyphMetricsMap.h b/Source/WebCore/platform/graphics/GlyphMetricsMap.h >index 3c92b765ed5caf625bfbe0625cb101de348185d0..26d349736d6f679bc59a3c73c6b368b2bc76cdde 100644 >--- a/Source/WebCore/platform/graphics/GlyphMetricsMap.h >+++ b/Source/WebCore/platform/graphics/GlyphMetricsMap.h >@@ -115,9 +115,9 @@ template<> inline FloatRect GlyphMetricsMap<FloatRect>::unknownMetrics() > return FloatRect(0, 0, cGlyphSizeUnknown, cGlyphSizeUnknown); > } > >-template<> inline std::optional<Path> GlyphMetricsMap<std::optional<Path>>::unknownMetrics() >+template<> inline WTF::Optional<Path> GlyphMetricsMap<WTF::Optional<Path>>::unknownMetrics() > { >- return std::nullopt; >+ return WTF::nullopt; > } > > template<class T> typename GlyphMetricsMap<T>::GlyphMetricsPage& GlyphMetricsMap<T>::locatePageSlowCase(unsigned pageNumber) >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp >index 0b5769cd12d21eb7ea7e1897e9f2eb90098121dd..45efbc12ebeafd13b22d0483bc173a8667c2c809 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp >@@ -631,7 +631,7 @@ void GraphicsContext::endTransparencyLayer() > --m_transparencyCount; > } > >-float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, const FloatPoint& point, unsigned from, std::optional<unsigned> to) >+float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, const FloatPoint& point, unsigned from, WTF::Optional<unsigned> to) > { > if (paintingDisabled()) > return 0; >@@ -653,7 +653,7 @@ void GraphicsContext::drawGlyphs(const Font& font, const GlyphBuffer& buffer, un > FontCascade::drawGlyphs(*this, font, buffer, from, numGlyphs, point, fontSmoothingMode); > } > >-void GraphicsContext::drawEmphasisMarks(const FontCascade& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, std::optional<unsigned> to) >+void GraphicsContext::drawEmphasisMarks(const FontCascade& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, WTF::Optional<unsigned> to) > { > if (paintingDisabled()) > return; >@@ -686,7 +686,7 @@ void GraphicsContext::drawBidiText(const FontCascade& font, const TextRun& run, > subrun.setDirection(isRTL ? TextDirection::RTL : TextDirection::LTR); > subrun.setDirectionalOverride(bidiRun->dirOverride(false)); > >- float width = font.drawText(*this, subrun, currPoint, 0, std::nullopt, customFontNotReadyAction); >+ float width = font.drawText(*this, subrun, currPoint, 0, WTF::nullopt, customFontNotReadyAction); > currPoint.move(width, 0); > > bidiRun = bidiRun->next(); >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h >index f9afe8e60600ee276bc00304583e24abf402cf38..5351aa242bfeb0d34bc914cd41fc55f98a00270d 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.h >+++ b/Source/WebCore/platform/graphics/GraphicsContext.h >@@ -410,9 +410,9 @@ public: > void setTextDrawingMode(TextDrawingModeFlags); > TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode; } > >- float drawText(const FontCascade&, const TextRun&, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt); >+ float drawText(const FontCascade&, const TextRun&, const FloatPoint&, unsigned from = 0, WTF::Optional<unsigned> to = WTF::nullopt); > void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, FontSmoothingMode); >- void drawEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& mark, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt); >+ void drawEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& mark, const FloatPoint&, unsigned from = 0, WTF::Optional<unsigned> to = WTF::nullopt); > void drawBidiText(const FontCascade&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady); > > void applyState(const GraphicsContextState&); >@@ -697,7 +697,7 @@ public: > m_graphicsContext.setImageInterpolationQuality(interpolationQualityToUse); > } > >- explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, std::optional<InterpolationQuality> interpolationQuality) >+ explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, WTF::Optional<InterpolationQuality> interpolationQuality) > : InterpolationQualityMaintainer(graphicsContext, interpolationQuality ? interpolationQuality.value() : graphicsContext.imageInterpolationQuality()) > { > } >diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h >index fd138d402296d12d59f7f6619b87b76ddbe07ee7..f2eea604e40a3f632c474527e6beb4a9cc0e3408 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext3D.h >+++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h >@@ -1413,8 +1413,8 @@ private: > String mappedSymbolName(Platform3DObject program, ANGLEShaderSymbolType, const String& name); > String mappedSymbolName(Platform3DObject shaders[2], size_t count, const String& name); > String originalSymbolName(Platform3DObject program, ANGLEShaderSymbolType, const String& name); >- std::optional<String> mappedSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType, const String& name); >- std::optional<String> originalSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType, const String& name); >+ WTF::Optional<String> mappedSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType, const String& name); >+ WTF::Optional<String> originalSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType, const String& name); > > std::unique_ptr<ShaderNameHash> nameHashMapForShaders; > >diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h >index 31c727338caa7373c4576dd8778ae9d2f5d0e0c1..b4991359053c9f77372ca615bdd36ee6d39e1d18 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/GraphicsLayer.h >@@ -320,7 +320,7 @@ public: > > // The position of the layer (the location of its top-left corner in its parent) > const FloatPoint& position() const { return m_position; } >- virtual void setPosition(const FloatPoint& p) { m_approximatePosition = std::nullopt; m_position = p; } >+ virtual void setPosition(const FloatPoint& p) { m_approximatePosition = WTF::nullopt; m_position = p; } > > // approximatePosition, if set, overrides position() and is used during coverage rect computation. > FloatPoint approximatePosition() const { return m_approximatePosition ? m_approximatePosition.value() : m_position; } >@@ -609,8 +609,8 @@ public: > virtual bool isGraphicsLayerTextureMapper() const { return false; } > virtual bool isCoordinatedGraphicsLayer() const { return false; } > >- const std::optional<FloatRect>& animationExtent() const { return m_animationExtent; } >- void setAnimationExtent(std::optional<FloatRect> animationExtent) { m_animationExtent = animationExtent; } >+ const WTF::Optional<FloatRect>& animationExtent() const { return m_animationExtent; } >+ void setAnimationExtent(WTF::Optional<FloatRect> animationExtent) { m_animationExtent = animationExtent; } > > static void traverse(GraphicsLayer&, const WTF::Function<void (GraphicsLayer&)>&); > >@@ -663,7 +663,7 @@ protected: > FloatPoint m_position; > > // If set, overrides m_position. Only used for coverage computation. >- std::optional<FloatPoint> m_approximatePosition; >+ WTF::Optional<FloatPoint> m_approximatePosition; > > FloatPoint3D m_anchorPoint { 0.5f, 0.5f, 0 }; > FloatSize m_size; >@@ -724,7 +724,7 @@ protected: > FloatSize m_contentsTilePhase; > FloatSize m_contentsTileSize; > FloatRoundedRect m_backdropFiltersRect; >- std::optional<FloatRect> m_animationExtent; >+ WTF::Optional<FloatRect> m_animationExtent; > > #if USE(CA) > WindRule m_shapeLayerWindRule { WindRule::NonZero }; >diff --git a/Source/WebCore/platform/graphics/HEVCUtilities.cpp b/Source/WebCore/platform/graphics/HEVCUtilities.cpp >index d17600c91bf706121e43ae7595b87fb1e56b9dad..aa0aede0cad594de9751d80a7c741fda50f753b4 100644 >--- a/Source/WebCore/platform/graphics/HEVCUtilities.cpp >+++ b/Source/WebCore/platform/graphics/HEVCUtilities.cpp >@@ -30,30 +30,30 @@ > > namespace WebCore { > >-std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString) >+WTF::Optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString) > { > // The format of the 'hevc' codec string is specified in ISO/IEC 14496-15:2014, Annex E.3. > StringView codecView(codecString); > auto codecSplit = codecView.split('.'); > auto nextElement = codecSplit.begin(); > if (nextElement == codecSplit.end()) >- return std::nullopt; >+ return WTF::nullopt; > > HEVCParameterSet parameters; > > // Codec identifier: legal values are specified in ISO/IEC 14496-15:2014, section 8: > parameters.codecName = (*nextElement).toString(); > if (!equal(parameters.codecName, "hvc1") && !equal(parameters.codecName, "hev1")) >- return std::nullopt; >+ return WTF::nullopt; > > if (++nextElement == codecSplit.end()) >- return std::nullopt; >+ return WTF::nullopt; > > // First element: Optional General Profile Space parameter ['A', 'B', 'C'], mapping to [1, 2, 3] > // and [0] for absent, then General Profile IDC as a 5-bit decimal number. > auto profileSpace = *nextElement; > if (!profileSpace.length()) >- return std::nullopt; >+ return WTF::nullopt; > > auto firstCharacter = profileSpace[0]; > bool hasProfileSpace = firstCharacter >= 'A' && firstCharacter <= 'C'; >@@ -65,10 +65,10 @@ std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecStri > bool isValidProfileIDC = false; > parameters.generalProfileIDC = toIntegralType<uint8_t>(profileSpace, &isValidProfileIDC); > if (!isValidProfileIDC) >- return std::nullopt; >+ return WTF::nullopt; > > if (++nextElement == codecSplit.end()) >- return std::nullopt; >+ return WTF::nullopt; > > // Second element: 32 bit of General Profile Compatibility Flags, in reverse bit order, > // in hex with leading zeros omitted. >@@ -76,23 +76,23 @@ std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecStri > bool isValidCompatibilityFlags = false; > parameters.generalProfileCompatibilityFlags = toIntegralType<uint32_t>(compatibilityFlags, &isValidCompatibilityFlags, 16); > if (!isValidCompatibilityFlags) >- return std::nullopt; >+ return WTF::nullopt; > > if (++nextElement == codecSplit.end()) >- return std::nullopt; >+ return WTF::nullopt; > > // Third element: General Tier Flag ['L', 'H'], mapping to [false, true], followed by > // General Level IDC as a 8-bit decimal number. > auto generalTier = *nextElement; > firstCharacter = generalTier[0]; > if (firstCharacter != 'L' && firstCharacter != 'H') >- return std::nullopt; >+ return WTF::nullopt; > > parameters.generalTierFlag = firstCharacter == 'H'; > bool isValidGeneralLevelIDC = false; > parameters.generalLevelIDC = toIntegralType<uint8_t>(generalTier.substring(1), &isValidGeneralLevelIDC); > if (!isValidGeneralLevelIDC) >- return std::nullopt; >+ return WTF::nullopt; > > // Optional fourth and remaning elements: a sequence of 6 1-byte constraint flags, each byte encoded > // in hex, and separated by a period, with trailing zero bytes omitted. >@@ -104,7 +104,7 @@ std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecStri > bool isValidFlag = false; > flag = toIntegralType<uint8_t>(*nextElement, &isValidFlag, 16); > if (!isValidFlag) >- return std::nullopt; >+ return WTF::nullopt; > } > > return WTFMove(parameters); >diff --git a/Source/WebCore/platform/graphics/HEVCUtilities.h b/Source/WebCore/platform/graphics/HEVCUtilities.h >index 466d9ff0886fb27b5b642f9cefffde9f6dcf34ce..5f835fe616c06d39f27544ffad6fd6d01ec0883a 100644 >--- a/Source/WebCore/platform/graphics/HEVCUtilities.h >+++ b/Source/WebCore/platform/graphics/HEVCUtilities.h >@@ -40,6 +40,6 @@ struct HEVCParameterSet { > Vector<unsigned short> constraintFlags { 6, 0 }; > }; > >-WEBCORE_EXPORT std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString); >+WEBCORE_EXPORT WTF::Optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString); > > } >diff --git a/Source/WebCore/platform/graphics/Image.h b/Source/WebCore/platform/graphics/Image.h >index 65cb08eab007272e62652ae2001ef11f1a2bafab..94e4eca29bed415744f95d43be4bfd15ee6b7a01 100644 >--- a/Source/WebCore/platform/graphics/Image.h >+++ b/Source/WebCore/platform/graphics/Image.h >@@ -114,7 +114,7 @@ public: > FloatRect rect() const { return FloatRect(FloatPoint(), size()); } > float width() const { return size().width(); } > float height() const { return size().height(); } >- virtual std::optional<IntPoint> hotSpot() const { return std::nullopt; } >+ virtual WTF::Optional<IntPoint> hotSpot() const { return WTF::nullopt; } > > #if PLATFORM(IOS_FAMILY) > virtual FloatSize originalSize() const { return size(); } >diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h >index 380b992ae9fd30926c7d2ceccd2d3804df07cde1..3631fd926cee40e435e621b80cae8219110838ac 100644 >--- a/Source/WebCore/platform/graphics/ImageBuffer.h >+++ b/Source/WebCore/platform/graphics/ImageBuffer.h >@@ -106,8 +106,8 @@ public: > > void convertToLuminanceMask(); > >- String toDataURL(const String& mimeType, std::optional<double> quality = std::nullopt, PreserveResolution = PreserveResolution::No) const; >- Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality = std::nullopt) const; >+ String toDataURL(const String& mimeType, WTF::Optional<double> quality = WTF::nullopt, PreserveResolution = PreserveResolution::No) const; >+ Vector<uint8_t> toData(const String& mimeType, WTF::Optional<double> quality = WTF::nullopt) const; > Vector<uint8_t> toBGRAData() const; > > #if !USE(CG) >@@ -171,15 +171,15 @@ private: > WEBCORE_EXPORT ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, const HostWindow*, bool& success); > #if USE(CG) > ImageBuffer(const FloatSize&, float resolutionScale, CGColorSpaceRef, RenderingMode, const HostWindow*, bool& success); >- RetainPtr<CFDataRef> toCFData(const String& mimeType, std::optional<double> quality, PreserveResolution) const; >+ RetainPtr<CFDataRef> toCFData(const String& mimeType, WTF::Optional<double> quality, PreserveResolution) const; > #elif USE(DIRECT2D) > ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, const HostWindow*, const GraphicsContext*, bool& success); > #endif > }; > > #if USE(CG) >-String dataURL(const ImageData&, const String& mimeType, std::optional<double> quality); >-Vector<uint8_t> data(const ImageData&, const String& mimeType, std::optional<double> quality); >+String dataURL(const ImageData&, const String& mimeType, WTF::Optional<double> quality); >+Vector<uint8_t> data(const ImageData&, const String& mimeType, WTF::Optional<double> quality); > #endif > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/ImageDecoder.h b/Source/WebCore/platform/graphics/ImageDecoder.h >index 53b5746834b6cdcd84e5c55f5ffbbb43d1895a12..a97f91e60e5fdd4a416fe2e138ccc1c534b47604 100644 >--- a/Source/WebCore/platform/graphics/ImageDecoder.h >+++ b/Source/WebCore/platform/graphics/ImageDecoder.h >@@ -61,7 +61,7 @@ public: > virtual RepetitionCount repetitionCount() const = 0; > virtual String uti() const { return emptyString(); } > virtual String filenameExtension() const = 0; >- virtual std::optional<IntPoint> hotSpot() const = 0; >+ virtual WTF::Optional<IntPoint> hotSpot() const = 0; > > virtual IntSize frameSizeAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const = 0; > virtual bool frameIsCompleteAtIndex(size_t) const = 0; >diff --git a/Source/WebCore/platform/graphics/ImageFrame.cpp b/Source/WebCore/platform/graphics/ImageFrame.cpp >index a10a069b585262c50e8c6125ff7468d07ae6d2c1..17ea8a225335ff073d5c4b2a2646a1a064927f70 100644 >--- a/Source/WebCore/platform/graphics/ImageFrame.cpp >+++ b/Source/WebCore/platform/graphics/ImageFrame.cpp >@@ -101,17 +101,17 @@ IntSize ImageFrame::size() const > return m_size; > } > >-bool ImageFrame::hasNativeImage(const std::optional<SubsamplingLevel>& subsamplingLevel) const >+bool ImageFrame::hasNativeImage(const WTF::Optional<SubsamplingLevel>& subsamplingLevel) const > { > return m_nativeImage && (!subsamplingLevel || *subsamplingLevel >= m_subsamplingLevel); > } > >-bool ImageFrame::hasFullSizeNativeImage(const std::optional<SubsamplingLevel>& subsamplingLevel) const >+bool ImageFrame::hasFullSizeNativeImage(const WTF::Optional<SubsamplingLevel>& subsamplingLevel) const > { > return hasNativeImage(subsamplingLevel) && (m_decodingOptions.isSynchronous() || m_decodingOptions.hasFullSize()); > } > >-bool ImageFrame::hasDecodedNativeImageCompatibleWithOptions(const std::optional<SubsamplingLevel>& subsamplingLevel, const DecodingOptions& decodingOptions) const >+bool ImageFrame::hasDecodedNativeImageCompatibleWithOptions(const WTF::Optional<SubsamplingLevel>& subsamplingLevel, const DecodingOptions& decodingOptions) const > { > return hasNativeImage(subsamplingLevel) && m_decodingOptions.isAsynchronousCompatibleWith(decodingOptions); > } >diff --git a/Source/WebCore/platform/graphics/ImageFrame.h b/Source/WebCore/platform/graphics/ImageFrame.h >index da7e6ea8c88c825037895f055b22cd3c60f1fe91..6e216179b8c2b24fc19255d0ca4eeecd95d042af 100644 >--- a/Source/WebCore/platform/graphics/ImageFrame.h >+++ b/Source/WebCore/platform/graphics/ImageFrame.h >@@ -76,9 +76,9 @@ public: > void setHasAlpha(bool hasAlpha) { m_hasAlpha = hasAlpha; } > bool hasAlpha() const { return !hasMetadata() || m_hasAlpha; } > >- bool hasNativeImage(const std::optional<SubsamplingLevel>& = { }) const; >- bool hasFullSizeNativeImage(const std::optional<SubsamplingLevel>& = { }) const; >- bool hasDecodedNativeImageCompatibleWithOptions(const std::optional<SubsamplingLevel>&, const DecodingOptions&) const; >+ bool hasNativeImage(const WTF::Optional<SubsamplingLevel>& = { }) const; >+ bool hasFullSizeNativeImage(const WTF::Optional<SubsamplingLevel>& = { }) const; >+ bool hasDecodedNativeImageCompatibleWithOptions(const WTF::Optional<SubsamplingLevel>&, const DecodingOptions&) const; > bool hasMetadata() const { return !size().isEmpty(); } > > Color singlePixelSolidColor() const; >diff --git a/Source/WebCore/platform/graphics/ImageSource.cpp b/Source/WebCore/platform/graphics/ImageSource.cpp >index 68d12a13888c421884eed0b118c998ec5865d96b..089012317daf93a102cbf1d0e6094a7dd39717d8 100644 >--- a/Source/WebCore/platform/graphics/ImageSource.cpp >+++ b/Source/WebCore/platform/graphics/ImageSource.cpp >@@ -365,7 +365,7 @@ void ImageSource::startAsyncDecodingQueue() > }); > } > >-void ImageSource::requestFrameAsyncDecodingAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const std::optional<IntSize>& sizeForDrawing) >+void ImageSource::requestFrameAsyncDecodingAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const WTF::Optional<IntSize>& sizeForDrawing) > { > ASSERT(isDecoderAvailable()); > if (!hasAsyncDecodingQueue()) >@@ -406,7 +406,7 @@ void ImageSource::stopAsyncDecodingQueue() > LOG(Images, "ImageSource::%s - %p - url: %s [decoding has been stopped]", __FUNCTION__, this, sourceURL().string().utf8().data()); > } > >-const ImageFrame& ImageSource::frameAtIndexCacheIfNeeded(size_t index, ImageFrame::Caching caching, const std::optional<SubsamplingLevel>& subsamplingLevel) >+const ImageFrame& ImageSource::frameAtIndexCacheIfNeeded(size_t index, ImageFrame::Caching caching, const WTF::Optional<SubsamplingLevel>& subsamplingLevel) > { > ASSERT(index < m_frames.size()); > ImageFrame& frame = m_frames[index]; >@@ -439,11 +439,11 @@ const ImageFrame& ImageSource::frameAtIndexCacheIfNeeded(size_t index, ImageFram > > void ImageSource::clearMetadata() > { >- m_frameCount = std::nullopt; >- m_repetitionCount = std::nullopt; >- m_singlePixelSolidColor = std::nullopt; >- m_encodedDataStatus = std::nullopt; >- m_uti = std::nullopt; >+ m_frameCount = WTF::nullopt; >+ m_repetitionCount = WTF::nullopt; >+ m_singlePixelSolidColor = WTF::nullopt; >+ m_encodedDataStatus = WTF::nullopt; >+ m_uti = WTF::nullopt; > } > > URL ImageSource::sourceURL() const >@@ -462,7 +462,7 @@ long long ImageSource::expectedContentLength() const > } > > template<typename T, T (ImageDecoder::*functor)() const> >-T ImageSource::metadata(const T& defaultValue, std::optional<T>* cachedValue) >+T ImageSource::metadata(const T& defaultValue, WTF::Optional<T>* cachedValue) > { > if (cachedValue && *cachedValue) > return cachedValue->value(); >@@ -486,7 +486,7 @@ T ImageSource::frameMetadataAtIndex(size_t index, T (ImageFrame::*functor)(Args. > } > > template<typename T, typename... Args> >-T ImageSource::frameMetadataAtIndexCacheIfNeeded(size_t index, T (ImageFrame::*functor)() const, std::optional<T>* cachedValue, Args&&... args) >+T ImageSource::frameMetadataAtIndexCacheIfNeeded(size_t index, T (ImageFrame::*functor)() const, WTF::Optional<T>* cachedValue, Args&&... args) > { > if (cachedValue && *cachedValue) > return cachedValue->value(); >@@ -530,9 +530,9 @@ String ImageSource::filenameExtension() > return metadata<String, (&ImageDecoder::filenameExtension)>(String(), &m_filenameExtension); > } > >-std::optional<IntPoint> ImageSource::hotSpot() >+WTF::Optional<IntPoint> ImageSource::hotSpot() > { >- return metadata<std::optional<IntPoint>, (&ImageDecoder::hotSpot)>(std::nullopt, &m_hotSpot); >+ return metadata<WTF::Optional<IntPoint>, (&ImageDecoder::hotSpot)>(WTF::nullopt, &m_hotSpot); > } > > IntSize ImageSource::size() >@@ -603,12 +603,12 @@ bool ImageSource::frameHasAlphaAtIndex(size_t index) > return frameMetadataAtIndex<bool>(index, (&ImageFrame::hasAlpha)); > } > >-bool ImageSource::frameHasFullSizeNativeImageAtIndex(size_t index, const std::optional<SubsamplingLevel>& subsamplingLevel) >+bool ImageSource::frameHasFullSizeNativeImageAtIndex(size_t index, const WTF::Optional<SubsamplingLevel>& subsamplingLevel) > { > return frameMetadataAtIndex<bool>(index, (&ImageFrame::hasFullSizeNativeImage), subsamplingLevel); > } > >-bool ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t index, const std::optional<SubsamplingLevel>& subsamplingLevel, const DecodingOptions& decodingOptions) >+bool ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t index, const WTF::Optional<SubsamplingLevel>& subsamplingLevel, const DecodingOptions& decodingOptions) > { > return frameMetadataAtIndex<bool>(index, (&ImageFrame::hasDecodedNativeImageCompatibleWithOptions), subsamplingLevel, decodingOptions); > } >diff --git a/Source/WebCore/platform/graphics/ImageSource.h b/Source/WebCore/platform/graphics/ImageSource.h >index 980d60ee50d50bc26a00305e03e51b4d44cc9e4f..2492389c7fcbd7ff9c9b71b8c42b8c65689bfb19 100644 >--- a/Source/WebCore/platform/graphics/ImageSource.h >+++ b/Source/WebCore/platform/graphics/ImageSource.h >@@ -76,7 +76,7 @@ public: > // Asynchronous image decoding > bool canUseAsyncDecoding(); > void startAsyncDecodingQueue(); >- void requestFrameAsyncDecodingAtIndex(size_t, SubsamplingLevel, const std::optional<IntSize>& = { }); >+ void requestFrameAsyncDecodingAtIndex(size_t, SubsamplingLevel, const WTF::Optional<IntSize>& = { }); > void stopAsyncDecodingQueue(); > bool hasAsyncDecodingQueue() const { return m_decodingQueue; } > bool isAsyncDecodingQueueIdle() const; >@@ -91,7 +91,7 @@ public: > RepetitionCount repetitionCount(); > String uti(); > String filenameExtension(); >- std::optional<IntPoint> hotSpot(); >+ WTF::Optional<IntPoint> hotSpot(); > > // Image metadata which is calculated from the first ImageFrame. > WEBCORE_EXPORT IntSize size(); >@@ -104,8 +104,8 @@ public: > DecodingStatus frameDecodingStatusAtIndex(size_t); > bool frameHasAlphaAtIndex(size_t); > bool frameHasImageAtIndex(size_t); >- bool frameHasFullSizeNativeImageAtIndex(size_t, const std::optional<SubsamplingLevel>&); >- bool frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t, const std::optional<SubsamplingLevel>&, const DecodingOptions&); >+ bool frameHasFullSizeNativeImageAtIndex(size_t, const WTF::Optional<SubsamplingLevel>&); >+ bool frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t, const WTF::Optional<SubsamplingLevel>&, const DecodingOptions&); > SubsamplingLevel frameSubsamplingLevelAtIndex(size_t); > > // ImageFrame metadata which forces caching or re-caching the ImageFrame. >@@ -126,13 +126,13 @@ private: > ImageSource(NativeImagePtr&&); > > template<typename T, T (ImageDecoder::*functor)() const> >- T metadata(const T& defaultValue, std::optional<T>* cachedValue = nullptr); >+ T metadata(const T& defaultValue, WTF::Optional<T>* cachedValue = nullptr); > > template<typename T, typename... Args> > T frameMetadataAtIndex(size_t, T (ImageFrame::*functor)(Args...) const, Args&&...); > > template<typename T, typename... Args> >- T frameMetadataAtIndexCacheIfNeeded(size_t, T (ImageFrame::*functor)() const, std::optional<T>* cachedValue, Args&&...); >+ T frameMetadataAtIndexCacheIfNeeded(size_t, T (ImageFrame::*functor)() const, WTF::Optional<T>* cachedValue, Args&&...); > > bool ensureDecoderAvailable(SharedBuffer* data); > bool isDecoderAvailable() const { return m_decoder; } >@@ -153,7 +153,7 @@ private: > WorkQueue& decodingQueue(); > SynchronizedFixedQueue<ImageFrameRequest, BufferSize>& frameRequestQueue(); > >- const ImageFrame& frameAtIndexCacheIfNeeded(size_t, ImageFrame::Caching, const std::optional<SubsamplingLevel>& = { }); >+ const ImageFrame& frameAtIndexCacheIfNeeded(size_t, ImageFrame::Caching, const WTF::Optional<SubsamplingLevel>& = { }); > > void dump(TextStream&); > >@@ -185,18 +185,18 @@ private: > Seconds m_frameDecodingDurationForTesting; > > // Image metadata. >- std::optional<EncodedDataStatus> m_encodedDataStatus; >- std::optional<size_t> m_frameCount; >- std::optional<RepetitionCount> m_repetitionCount; >- std::optional<String> m_uti; >- std::optional<String> m_filenameExtension; >- std::optional<std::optional<IntPoint>> m_hotSpot; >+ WTF::Optional<EncodedDataStatus> m_encodedDataStatus; >+ WTF::Optional<size_t> m_frameCount; >+ WTF::Optional<RepetitionCount> m_repetitionCount; >+ WTF::Optional<String> m_uti; >+ WTF::Optional<String> m_filenameExtension; >+ WTF::Optional<WTF::Optional<IntPoint>> m_hotSpot; > > // Image metadata which is calculated from the first ImageFrame. >- std::optional<IntSize> m_size; >- std::optional<IntSize> m_sizeRespectingOrientation; >- std::optional<Color> m_singlePixelSolidColor; >- std::optional<SubsamplingLevel> m_maximumSubsamplingLevel; >+ WTF::Optional<IntSize> m_size; >+ WTF::Optional<IntSize> m_sizeRespectingOrientation; >+ WTF::Optional<Color> m_singlePixelSolidColor; >+ WTF::Optional<SubsamplingLevel> m_maximumSubsamplingLevel; > }; > > } >diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp >index be14a72a46f23eef3556581bfcaec33bda3e18eb..a62edcfe63a14a129eac8448ba2a783e4cc0a49c 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayer.cpp >+++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp >@@ -1462,10 +1462,10 @@ bool MediaPlayer::ended() const > return m_private->ended(); > } > >-std::optional<VideoPlaybackQualityMetrics> MediaPlayer::videoPlaybackQualityMetrics() >+WTF::Optional<VideoPlaybackQualityMetrics> MediaPlayer::videoPlaybackQualityMetrics() > { > if (!m_private) >- return std::nullopt; >+ return WTF::nullopt; > > return m_private->videoPlaybackQualityMetrics(); > } >diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h >index c2816bdd277a2252805bdb1582ccbbd6716403c1..9c0b79e1ab8b4b0f866068e5a5910f3df8171217 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayer.h >+++ b/Source/WebCore/platform/graphics/MediaPlayer.h >@@ -544,7 +544,7 @@ public: > > unsigned long long fileSize() const; > >- std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); >+ WTF::Optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); > > void handlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType); > String sourceApplicationIdentifier() const; >diff --git a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h >index 2ad0fabafaec44455023339944adf0c87011dbf5..471f13dc134d79ed1239c273c6d278911fc1710e 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h >+++ b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h >@@ -191,7 +191,7 @@ public: > > virtual bool hasSingleSecurityOrigin() const { return false; } > virtual bool didPassCORSAccessCheck() const { return false; } >- virtual std::optional<bool> wouldTaintOrigin(const SecurityOrigin&) const { return std::nullopt; } >+ virtual WTF::Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const { return WTF::nullopt; } > > virtual MediaPlayer::MovieLoadType movieLoadType() const { return MediaPlayer::Unknown; } > >@@ -266,7 +266,7 @@ public: > > virtual bool ended() const { return false; } > >- virtual std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() { return std::nullopt; } >+ virtual WTF::Optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() { return WTF::nullopt; } > > #if ENABLE(AVF_CAPTIONS) > virtual void notifyTrackModeChanged() { } >diff --git a/Source/WebCore/platform/graphics/PathUtilities.cpp b/Source/WebCore/platform/graphics/PathUtilities.cpp >index 68ba059ad370dbe563b8d79ec36023ef1a2b033a..e392d22c87a434664a5c2480ebd378061de1951c 100644 >--- a/Source/WebCore/platform/graphics/PathUtilities.cpp >+++ b/Source/WebCore/platform/graphics/PathUtilities.cpp >@@ -464,13 +464,13 @@ static FloatRoundedRect::Radii adjustedtRadiiForHuggingCurve(const FloatSize& to > return radii; > } > >-static std::optional<FloatRect> rectFromPolygon(const FloatPointGraph::Polygon& poly) >+static WTF::Optional<FloatRect> rectFromPolygon(const FloatPointGraph::Polygon& poly) > { > if (poly.size() != 4) >- return std::optional<FloatRect>(); >+ return WTF::Optional<FloatRect>(); > >- std::optional<FloatPoint> topLeft; >- std::optional<FloatPoint> bottomRight; >+ WTF::Optional<FloatPoint> topLeft; >+ WTF::Optional<FloatPoint> bottomRight; > for (unsigned i = 0; i < poly.size(); ++i) { > const auto& toEdge = poly[i]; > const auto& fromEdge = (i > 0) ? poly[i - 1] : poly[poly.size() - 1]; >@@ -484,7 +484,7 @@ static std::optional<FloatRect> rectFromPolygon(const FloatPointGraph::Polygon& > } > } > if (!topLeft || !bottomRight) >- return std::optional<FloatRect>(); >+ return WTF::Optional<FloatRect>(); > return FloatRect(topLeft.value(), bottomRight.value()); > } > >@@ -519,7 +519,7 @@ Path PathUtilities::pathWithShrinkWrappedRectsForOutline(const Vector<FloatRect> > return Path(); > const auto& poly = polys.at(0); > // Fast path when poly has one rect only. >- std::optional<FloatRect> rect = rectFromPolygon(poly); >+ WTF::Optional<FloatRect> rect = rectFromPolygon(poly); > if (rect) > return roundedRect(rect.value()); > >diff --git a/Source/WebCore/platform/graphics/TiledBacking.h b/Source/WebCore/platform/graphics/TiledBacking.h >index 02b752cc6d9013b54814fe9c761170d794ba65c2..4d0c85e9d350e2cd16c9dfa5733775ddeb1e61e4 100644 >--- a/Source/WebCore/platform/graphics/TiledBacking.h >+++ b/Source/WebCore/platform/graphics/TiledBacking.h >@@ -77,7 +77,7 @@ public: > virtual FloatRect visibleRect() const = 0; > > // Only used to update the tile coverage map. >- virtual void setLayoutViewportRect(std::optional<FloatRect>) = 0; >+ virtual void setLayoutViewportRect(WTF::Optional<FloatRect>) = 0; > > virtual void setCoverageRect(const FloatRect&) = 0; > virtual FloatRect coverageRect() const = 0; >diff --git a/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp b/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp >index 500f33a4054e1f7a921f67ee2ad792d7e2965f69..e719b326653faba2a897ba322b6785bad8614fc0 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp >+++ b/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp >@@ -121,8 +121,8 @@ static SchemeAndKeyResult extractSchemeAndKeyIdFromSinf(const SharedBuffer& buff > SchemeAndKeyResult result; > for (auto& buffer : buffers) { > unsigned offset = 0; >- std::optional<FourCC> scheme; >- std::optional<Vector<uint8_t>> keyID; >+ WTF::Optional<FourCC> scheme; >+ WTF::Optional<Vector<uint8_t>> keyID; > > auto view = JSC::DataView::create(buffer->tryCreateArrayBuffer(), offset, buffer->size()); > while (auto optionalBoxType = ISOBox::peekBox(view, offset)) { >@@ -158,7 +158,7 @@ static SchemeAndKeyResult extractSchemeAndKeyIdFromSinf(const SharedBuffer& buff > return result; > } > >-std::optional<Vector<Ref<SharedBuffer>>> CDMPrivateFairPlayStreaming::extractKeyIDsSinf(const SharedBuffer& buffer) >+WTF::Optional<Vector<Ref<SharedBuffer>>> CDMPrivateFairPlayStreaming::extractKeyIDsSinf(const SharedBuffer& buffer) > { > Vector<Ref<SharedBuffer>> keyIDs; > auto results = extractSchemeAndKeyIdFromSinf(buffer); >@@ -186,7 +186,7 @@ RefPtr<SharedBuffer> CDMPrivateFairPlayStreaming::sanitizeSkd(const SharedBuffer > return buffer.copy(); > } > >-std::optional<Vector<Ref<SharedBuffer>>> CDMPrivateFairPlayStreaming::extractKeyIDsSkd(const SharedBuffer& buffer) >+WTF::Optional<Vector<Ref<SharedBuffer>>> CDMPrivateFairPlayStreaming::extractKeyIDsSkd(const SharedBuffer& buffer) > { > // In the 'skd' scheme, the init data is the key ID. > Vector<Ref<SharedBuffer>> keyIDs; >@@ -376,7 +376,7 @@ RefPtr<SharedBuffer> CDMPrivateFairPlayStreaming::sanitizeResponse(const SharedB > return response.copy(); > } > >-std::optional<String> CDMPrivateFairPlayStreaming::sanitizeSessionId(const String& sessionId) const >+WTF::Optional<String> CDMPrivateFairPlayStreaming::sanitizeSessionId(const String& sessionId) const > { > return sessionId; > } >diff --git a/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h b/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h >index 144c021a2f4cf7756776d5ed4e006e6814f1992d..9667d4aa3306833d22687fe8bb0f9ed04da6e464 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h >+++ b/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h >@@ -65,14 +65,14 @@ public: > bool supportsSessions() const override; > bool supportsInitData(const AtomicString&, const SharedBuffer&) const override; > RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const override; >- std::optional<String> sanitizeSessionId(const String&) const override; >+ WTF::Optional<String> sanitizeSessionId(const String&) const override; > > static const AtomicString& sinfName(); >- static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsSinf(const SharedBuffer&); >+ static WTF::Optional<Vector<Ref<SharedBuffer>>> extractKeyIDsSinf(const SharedBuffer&); > static RefPtr<SharedBuffer> sanitizeSinf(const SharedBuffer&); > > static const AtomicString& skdName(); >- static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsSkd(const SharedBuffer&); >+ static WTF::Optional<Vector<Ref<SharedBuffer>>> extractKeyIDsSkd(const SharedBuffer&); > static RefPtr<SharedBuffer> sanitizeSkd(const SharedBuffer&); > }; > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >index 6732da0c441524d881115b09ea43609b6f2109bd..b6bf07c6a3d483643cffa21bb8fb4c7ef6fb6925 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >@@ -57,7 +57,7 @@ private: > > void loadMIMETypes(); > >- std::optional<HashSet<String, ASCIICaseInsensitiveHash>> m_cache; >+ WTF::Optional<HashSet<String, ASCIICaseInsensitiveHash>> m_cache; > CacheMIMETypesCallback m_cacheTypeCallback; > }; > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm >index b3a7a9aae718943e5ab6e4abb2f826d38def2a6d..4319c7ed63db7a5f1d9db14c27eba8ca8f64c921 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm >@@ -344,13 +344,13 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense(const String&, Li > auto* storageDirectory = m_instance->storageDirectory(); > > if (!certificate || !storageDirectory) { >- callback(false, std::nullopt, std::nullopt, std::nullopt, Failed); >+ callback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed); > return; > } > > RetainPtr<NSData> appIdentifier = certificate->createNSData(); > [getAVContentKeySessionClass() removePendingExpiredSessionReports:expiredSessions.get() withAppIdentifier:appIdentifier.get() storageDirectoryAtURL:storageDirectory]; >- callback(false, { }, std::nullopt, std::nullopt, Succeeded); >+ callback(false, { }, WTF::nullopt, WTF::nullopt, Succeeded); > return; > } > >@@ -361,12 +361,12 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense(const String&, Li > } > > if (!m_currentRequest) { >- callback(false, std::nullopt, std::nullopt, std::nullopt, Failed); >+ callback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed); > return; > } > Vector<Ref<SharedBuffer>> keyIDs = keyIDsForRequest(m_currentRequest.get()); > if (keyIDs.isEmpty()) { >- callback(false, std::nullopt, std::nullopt, std::nullopt, Failed); >+ callback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed); > return; > } > >@@ -378,7 +378,7 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense(const String&, Li > KeyStatusVector keyStatuses; > keyStatuses.reserveInitialCapacity(1); > keyStatuses.uncheckedAppend(std::make_pair(WTFMove(keyIDs.first()), KeyStatus::Usable)); >- callback(false, std::make_optional(WTFMove(keyStatuses)), std::nullopt, std::nullopt, Succeeded); >+ callback(false, WTF::makeOptional(WTFMove(keyStatuses)), WTF::nullopt, WTF::nullopt, Succeeded); > return; > } > >@@ -391,12 +391,12 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::loadSession(LicenseType license > if (licenseType == LicenseType::PersistentUsageRecord) { > auto* storageDirectory = m_instance->storageDirectory(); > if (!m_instance->persistentStateAllowed() || storageDirectory) { >- callback(std::nullopt, std::nullopt, std::nullopt, Failed, SessionLoadFailure::MismatchedSessionType); >+ callback(WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed, SessionLoadFailure::MismatchedSessionType); > return; > } > auto* certificate = m_instance->serverCertificate(); > if (!certificate) { >- callback(std::nullopt, std::nullopt, std::nullopt, Failed, SessionLoadFailure::NoSessionData); >+ callback(WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed, SessionLoadFailure::NoSessionData); > return; > } > >@@ -416,11 +416,11 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::loadSession(LicenseType license > } > > if (changedKeys.isEmpty()) { >- callback(std::nullopt, std::nullopt, std::nullopt, Failed, SessionLoadFailure::NoSessionData); >+ callback(WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed, SessionLoadFailure::NoSessionData); > return; > } > >- callback(WTFMove(changedKeys), std::nullopt, std::nullopt, Succeeded, SessionLoadFailure::None); >+ callback(WTFMove(changedKeys), WTF::nullopt, WTF::nullopt, Succeeded, SessionLoadFailure::None); > } > } > >@@ -431,11 +431,11 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession(const String&, Clo > ASSERT(!m_requestLicenseCallback); > } > if (m_updateLicenseCallback) { >- m_updateLicenseCallback(true, std::nullopt, std::nullopt, std::nullopt, Failed); >+ m_updateLicenseCallback(true, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed); > ASSERT(!m_updateLicenseCallback); > } > if (m_removeSessionDataCallback) { >- m_removeSessionDataCallback({ }, std::nullopt, Failed); >+ m_removeSessionDataCallback({ }, WTF::nullopt, Failed); > ASSERT(!m_removeSessionDataCallback); > } > m_currentRequest = nullptr; >@@ -454,7 +454,7 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData(const String& > auto* certificate = m_instance->serverCertificate(); > > if (!m_instance->persistentStateAllowed() || !storageDirectory || !certificate) { >- callback({ }, std::nullopt, Failed); >+ callback({ }, WTF::nullopt, Failed); > return; > } > >@@ -564,9 +564,9 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest(AVCon > return; > > if (error && m_updateLicenseCallback) >- m_updateLicenseCallback(false, std::nullopt, std::nullopt, std::nullopt, Failed); >+ m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed); > else if (m_updateLicenseCallback) >- m_updateLicenseCallback(false, std::nullopt, std::nullopt, Message(MessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get())), Succeeded); >+ m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, Message(MessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get())), Succeeded); > else if (m_client) > m_client->sendMessage(CDMMessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get())); > ASSERT(!m_updateLicenseCallback); >@@ -584,7 +584,7 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest(AVConte > UNUSED_PARAM(request); > UNUSED_PARAM(error); > if (m_updateLicenseCallback) { >- m_updateLicenseCallback(false, std::nullopt, std::nullopt, std::nullopt, Failed); >+ m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed); > ASSERT(!m_updateLicenseCallback); > } > >@@ -597,7 +597,7 @@ void CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed(AVContentKeyR > { > UNUSED_PARAM(request); > if (m_updateLicenseCallback) { >- m_updateLicenseCallback(false, std::make_optional(keyStatuses()), std::nullopt, std::nullopt, Succeeded); >+ m_updateLicenseCallback(false, WTF::makeOptional(keyStatuses()), WTF::nullopt, WTF::nullopt, Succeeded); > ASSERT(!m_updateLicenseCallback); > } > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h >index fd1a9eef399d2070976fc94ed5fc1a3fb7d78951..a041333e152d0ccbda1d0a2104480a2344fa2fb6 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h >@@ -72,7 +72,7 @@ public: > RepetitionCount repetitionCount() const final; > String uti() const final; > String filenameExtension() const final; >- std::optional<IntPoint> hotSpot() const final { return std::nullopt; } >+ WTF::Optional<IntPoint> hotSpot() const final { return WTF::nullopt; } > > IntSize frameSizeAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const final; > bool frameIsCompleteAtIndex(size_t) const final; >@@ -123,8 +123,8 @@ private: > DecodeOrderSampleMap::iterator m_cursor; > Lock m_sampleGeneratorLock; > bool m_isAllDataReceived { false }; >- std::optional<IntSize> m_size; >- std::optional<RotationProperties> m_rotation; >+ WTF::Optional<IntSize> m_size; >+ WTF::Optional<RotationProperties> m_rotation; > }; > > } >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >index 71a698c69dd9216e28612040cf8053e4129d1322..3d0a97e4a62c5979bc77dc59718cd1ffa541a25b 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >@@ -232,7 +232,7 @@ private: > void updateVideoLayerGravity() override; > > bool didPassCORSAccessCheck() const override; >- std::optional<bool> wouldTaintOrigin(const SecurityOrigin&) const final; >+ WTF::Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const final; > > > MediaTime getStartDate() const override; >@@ -324,7 +324,7 @@ private: > > void setShouldDisableSleep(bool) override; > >- std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() final; >+ WTF::Optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() final; > > #if !RELEASE_LOG_DISABLED > const char* logClassName() const final { return "MediaPlayerPrivateAVFoundationObjC"; } >@@ -428,7 +428,7 @@ private: > bool m_cachedCanPlayFastForward; > bool m_cachedCanPlayFastReverse; > bool m_muted { false }; >- mutable std::optional<bool> m_tracksArePlayable; >+ mutable WTF::Optional<bool> m_tracksArePlayable; > #if ENABLE(WIRELESS_PLAYBACK_TARGET) > mutable bool m_allowsWirelessVideoPlayback; > bool m_shouldPlayToPlaybackTarget { false }; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index d05785cae3616dffbe9939e03da5193c6914954f..062fb12a04717163e64c66abd51287d6455594a6 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -2216,7 +2216,7 @@ bool MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck() const > return false; > } > >-std::optional<bool> MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin(const SecurityOrigin& origin) const >+WTF::Optional<bool> MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin(const SecurityOrigin& origin) const > { > AVAssetResourceLoader *resourceLoader = m_avAsset.get().resourceLoader; > if (!DeprecatedGlobalSettings::isAVFoundationNSURLSessionEnabled() >@@ -2227,7 +2227,7 @@ std::optional<bool> MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin(const S > if ([session isKindOfClass:[WebCoreNSURLSession class]]) > return [session wouldTaintOrigin:origin]; > >- return std::nullopt; >+ return WTF::nullopt; > } > > >@@ -3264,19 +3264,19 @@ void MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep(bool flag) > #endif > } > >-std::optional<VideoPlaybackQualityMetrics> MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics() >+WTF::Optional<VideoPlaybackQualityMetrics> MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics() > { > if (![m_videoLayer respondsToSelector:@selector(videoPerformanceMetrics)]) >- return std::nullopt; >+ return WTF::nullopt; > > #if PLATFORM(WATCHOS) >- return std::nullopt; >+ return WTF::nullopt; > #else > ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN > > auto metrics = [m_videoLayer videoPerformanceMetrics]; > if (!metrics) >- return std::nullopt; >+ return WTF::nullopt; > > uint32_t displayCompositedFrames = 0; > if ([metrics respondsToSelector:@selector(numberOfDisplayCompositedVideoFrames)]) >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >index 03605fc42a81b868c9863c6f21f7ecc642530571..9a630288f7b4f56c2e3b96416edb26821a592af1 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >@@ -224,7 +224,7 @@ private: > > size_t extraMemoryCost() const override; > >- std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; >+ WTF::Optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; > > #if ENABLE(WIRELESS_PLAYBACK_TARGET) > bool isCurrentPlaybackTargetWireless() const override; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >index 2b50c1a0b46c298df8a5e8580fe56d8067a6378e..3506ac58031781c02f6b0bb85e02fc68458b4f51 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >@@ -640,7 +640,7 @@ size_t MediaPlayerPrivateMediaSourceAVFObjC::extraMemoryCost() const > return 0; > } > >-std::optional<VideoPlaybackQualityMetrics> MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics() >+WTF::Optional<VideoPlaybackQualityMetrics> MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics() > { > if (m_decompressionSession) { > return VideoPlaybackQualityMetrics { >@@ -654,7 +654,7 @@ std::optional<VideoPlaybackQualityMetrics> MediaPlayerPrivateMediaSourceAVFObjC: > > auto metrics = [m_sampleBufferDisplayLayer videoPerformanceMetrics]; > if (!metrics) >- return std::nullopt; >+ return WTF::nullopt; > > uint32_t displayCompositedFrames = 0; > ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h >index 8300dc3b6e39e8cab145aeba2176e9811dfc9871..dbfc52e81da8d06a34b5f9a348e11156c0745af3 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h >@@ -188,7 +188,7 @@ private: > Vector<Ref<SharedBuffer>> m_keyIDs; > #endif > >- std::optional<FloatSize> m_cachedSize; >+ WTF::Optional<FloatSize> m_cachedSize; > FloatSize m_currentSize; > bool m_parsingSucceeded { true }; > bool m_parserStateWasReset { false }; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm >index a99feb7f653c99116d0f339ec3775fc20cef0bed..2eb952347381d540dfe9ac9d50d4b3243da3f7c9 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm >@@ -1064,7 +1064,7 @@ void SourceBufferPrivateAVFObjC::flushVideo() > }); > } > >- m_cachedSize = std::nullopt; >+ m_cachedSize = WTF::nullopt; > > if (m_mediaSource) { > m_mediaSource->player()->setHasAvailableVideoFrame(false); >diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >index c55f5ff8d00cba445428b141301a24f9b72d7385..85d40b6560300523812ff9ffe508d27762642d6a 100644 >--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >@@ -1420,7 +1420,7 @@ GraphicsLayerCA::VisibleAndCoverageRects GraphicsLayerCA::computeVisibleAndCover > } > > FloatRect coverageRect = clipRectForSelf; >- std::optional<FloatQuad> quad = state.mappedSecondaryQuad(&mapWasClamped); >+ WTF::Optional<FloatQuad> quad = state.mappedSecondaryQuad(&mapWasClamped); > if (quad && !mapWasClamped && !applyWasClamped) > coverageRect = (*quad).boundingBox(); > >diff --git a/Source/WebCore/platform/graphics/ca/TileController.cpp b/Source/WebCore/platform/graphics/ca/TileController.cpp >index 80cfc4fac345c92ecd61737fc9254dcd8b755bf8..6bf6905b69470aad692494e7795b5bb4f0429df5 100644 >--- a/Source/WebCore/platform/graphics/ca/TileController.cpp >+++ b/Source/WebCore/platform/graphics/ca/TileController.cpp >@@ -209,7 +209,7 @@ void TileController::setVisibleRect(const FloatRect& rect) > updateTileCoverageMap(); > } > >-void TileController::setLayoutViewportRect(std::optional<FloatRect> rect) >+void TileController::setLayoutViewportRect(WTF::Optional<FloatRect> rect) > { > if (rect == m_layoutViewportRect) > return; >diff --git a/Source/WebCore/platform/graphics/ca/TileController.h b/Source/WebCore/platform/graphics/ca/TileController.h >index ae19b8c5171fd5741a5515f76a69886662faf07c..b0ed7de144c2a9e94a4069816e3c2ba0184a9dfe 100644 >--- a/Source/WebCore/platform/graphics/ca/TileController.h >+++ b/Source/WebCore/platform/graphics/ca/TileController.h >@@ -88,7 +88,7 @@ public: > > FloatRect visibleRect() const override { return m_visibleRect; } > FloatRect coverageRect() const override { return m_coverageRect; } >- std::optional<FloatRect> layoutViewportRect() const { return m_layoutViewportRect; } >+ WTF::Optional<FloatRect> layoutViewportRect() const { return m_layoutViewportRect; } > > void setTileSizeUpdateDelayDisabledForTesting(bool) final; > >@@ -151,7 +151,7 @@ private: > > // TiledBacking member functions. > void setVisibleRect(const FloatRect&) override; >- void setLayoutViewportRect(std::optional<FloatRect>) override; >+ void setLayoutViewportRect(WTF::Optional<FloatRect>) override; > void setCoverageRect(const FloatRect&) override; > bool tilesWouldChangeForCoverageRect(const FloatRect&) const override; > void setTiledScrollingIndicatorPosition(const FloatPoint&) override; >@@ -202,7 +202,7 @@ private: > std::unique_ptr<TileGrid> m_zoomedOutTileGrid; > > FloatRect m_visibleRect; // Only used for scroll performance logging. >- std::optional<FloatRect> m_layoutViewportRect; // Only used by the tiled scrolling indicator. >+ WTF::Optional<FloatRect> m_layoutViewportRect; // Only used by the tiled scrolling indicator. > FloatRect m_coverageRect; > IntRect m_boundsAtLastRevalidate; > >diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp >index ccbbe1f156e0f9e3a0f031da7cce428a6fee94eb..0235f6679279ae1965a7fd00ffe2b038723948eb 100644 >--- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp >@@ -648,7 +648,7 @@ static bool encodeImage(cairo_surface_t* image, const String& mimeType, Vector<u > return cairo_surface_write_to_png_stream(image, writeFunction, output) == CAIRO_STATUS_SUCCESS; > } > >-String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> quality, PreserveResolution) const >+String ImageBuffer::toDataURL(const String& mimeType, WTF::Optional<double> quality, PreserveResolution) const > { > Vector<uint8_t> encodedImage = toData(mimeType, quality); > if (encodedImage.isEmpty()) >@@ -660,7 +660,7 @@ String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> qual > return "data:" + mimeType + ";base64," + base64Data; > } > >-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double>) const >+Vector<uint8_t> ImageBuffer::toData(const String& mimeType, WTF::Optional<double>) const > { > ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); > >diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >index 6d40895149979361d79b8d85d695758373f29395..01ce11c60ad53b888579b08ca7cb2251b8e48028 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >@@ -472,7 +472,7 @@ static RetainPtr<CFStringRef> utiFromImageBufferMIMEType(const String& mimeType) > #endif > } > >-static bool encodeImage(CGImageRef image, CFStringRef uti, std::optional<double> quality, CFMutableDataRef data) >+static bool encodeImage(CGImageRef image, CFStringRef uti, WTF::Optional<double> quality, CFMutableDataRef data) > { > if (!image || !uti || !data) > return false; >@@ -512,21 +512,21 @@ static Vector<uint8_t> dataVector(CFDataRef cfData) > return data; > } > >-String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> quality, PreserveResolution preserveResolution) const >+String ImageBuffer::toDataURL(const String& mimeType, WTF::Optional<double> quality, PreserveResolution preserveResolution) const > { > if (auto data = toCFData(mimeType, quality, preserveResolution)) > return dataURL(data.get(), mimeType); > return "data:,"_s; > } > >-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const >+Vector<uint8_t> ImageBuffer::toData(const String& mimeType, WTF::Optional<double> quality) const > { > if (auto data = toCFData(mimeType, quality, PreserveResolution::No)) > return dataVector(data.get()); > return { }; > } > >-RetainPtr<CFDataRef> ImageBuffer::toCFData(const String& mimeType, std::optional<double> quality, PreserveResolution preserveResolution) const >+RetainPtr<CFDataRef> ImageBuffer::toCFData(const String& mimeType, WTF::Optional<double> quality, PreserveResolution preserveResolution) const > { > ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); > >@@ -572,7 +572,7 @@ RetainPtr<CFDataRef> ImageBuffer::toCFData(const String& mimeType, std::optional > return WTFMove(cfData); > } > >-static RetainPtr<CFDataRef> cfData(const ImageData& source, const String& mimeType, std::optional<double> quality) >+static RetainPtr<CFDataRef> cfData(const ImageData& source, const String& mimeType, WTF::Optional<double> quality) > { > ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); > >@@ -622,14 +622,14 @@ static RetainPtr<CFDataRef> cfData(const ImageData& source, const String& mimeTy > return WTFMove(cfData); > } > >-String dataURL(const ImageData& source, const String& mimeType, std::optional<double> quality) >+String dataURL(const ImageData& source, const String& mimeType, WTF::Optional<double> quality) > { > if (auto data = cfData(source, mimeType, quality)) > return dataURL(data.get(), mimeType); > return "data:,"_s; > } > >-Vector<uint8_t> data(const ImageData& source, const String& mimeType, std::optional<double> quality) >+Vector<uint8_t> data(const ImageData& source, const String& mimeType, WTF::Optional<double> quality) > { > if (auto data = cfData(source, mimeType, quality)) > return dataVector(data.get()); >diff --git a/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp b/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp >index e18e63fefd6014ca5605b66a508fa6cf4382a00c..e10ab3ff5a6d21f1c0216fa6c95bed9e1f882193 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp >@@ -266,23 +266,23 @@ RepetitionCount ImageDecoderCG::repetitionCount() const > return RepetitionCountNone; > } > >-std::optional<IntPoint> ImageDecoderCG::hotSpot() const >+WTF::Optional<IntPoint> ImageDecoderCG::hotSpot() const > { > RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_nativeDecoder.get(), 0, imageSourceOptions().get())); > if (!properties) >- return std::nullopt; >+ return WTF::nullopt; > > int x = -1, y = -1; > CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotX")); > if (!num || !CFNumberGetValue(num, kCFNumberIntType, &x)) >- return std::nullopt; >+ return WTF::nullopt; > > num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotY")); > if (!num || !CFNumberGetValue(num, kCFNumberIntType, &y)) >- return std::nullopt; >+ return WTF::nullopt; > > if (x < 0 || y < 0) >- return std::nullopt; >+ return WTF::nullopt; > > return IntPoint(x, y); > } >@@ -405,7 +405,7 @@ NativeImagePtr ImageDecoderCG::createFrameImageAtIndex(size_t index, Subsampling > > if (decodingOptions.hasSizeForDrawing()) { > // See which size is smaller: the image native size or the sizeForDrawing. >- std::optional<IntSize> sizeForDrawing = decodingOptions.sizeForDrawing(); >+ WTF::Optional<IntSize> sizeForDrawing = decodingOptions.sizeForDrawing(); > if (sizeForDrawing.value().unclampedArea() < size.unclampedArea()) > size = sizeForDrawing.value(); > } >diff --git a/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h b/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h >index eac32d55c42d1b2ea8b7529a1d1cdd10efa2c6d6..c28c566636c0285e7e2785e06db0e5c06bbe1df4 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h >+++ b/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h >@@ -50,7 +50,7 @@ public: > RepetitionCount repetitionCount() const final; > String uti() const final; > String filenameExtension() const final; >- std::optional<IntPoint> hotSpot() const final; >+ WTF::Optional<IntPoint> hotSpot() const final; > > IntSize frameSizeAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const final; > bool frameIsCompleteAtIndex(size_t) const final; >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >index 30244cf658255f5495f6c45c17f2cafc554ca399..9d28f4cd842e9f7403afd343bf209a59270d2560 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >@@ -971,13 +971,13 @@ struct MinMax { > }; > > struct VariationCapabilities { >- std::optional<MinMax> weight; >- std::optional<MinMax> width; >- std::optional<MinMax> slope; >+ WTF::Optional<MinMax> weight; >+ WTF::Optional<MinMax> width; >+ WTF::Optional<MinMax> slope; > }; > > #if ENABLE(VARIATION_FONTS) >-static std::optional<MinMax> extractVariationBounds(CFDictionaryRef axis) >+static WTF::Optional<MinMax> extractVariationBounds(CFDictionaryRef axis) > { > CFNumberRef minimumValue = static_cast<CFNumberRef>(CFDictionaryGetValue(axis, kCTFontVariationAxisMinimumValueKey)); > CFNumberRef maximumValue = static_cast<CFNumberRef>(CFDictionaryGetValue(axis, kCTFontVariationAxisMaximumValueKey)); >@@ -987,7 +987,7 @@ static std::optional<MinMax> extractVariationBounds(CFDictionaryRef axis) > CFNumberGetValue(maximumValue, kCFNumberFloatType, &rawMaximumValue); > if (rawMinimumValue < rawMaximumValue) > return {{ rawMinimumValue, rawMaximumValue }}; >- return std::nullopt; >+ return WTF::nullopt; > } > #endif > >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm >index 5d4300024adce28ecef88933a2ec9fe549e3e1f5..2e324c5b523fb65e4729be0ed0e1e9d0ddbc6d01 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm >+++ b/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm >@@ -395,7 +395,7 @@ static inline bool isTrueTypeFeature(CFDictionaryRef feature) > return CFDictionaryContainsKey(feature, kCTFontFeatureTypeIdentifierKey) && CFDictionaryContainsKey(feature, kCTFontFeatureSelectorIdentifierKey); > } > >-static inline std::optional<CFStringRef> openTypeFeature(CFDictionaryRef feature) >+static inline WTF::Optional<CFStringRef> openTypeFeature(CFDictionaryRef feature) > { > ASSERT(isOpenTypeFeature(feature)); > CFStringRef tag = static_cast<CFStringRef>(CFDictionaryGetValue(feature, kCTFontOpenTypeFeatureTag)); >@@ -403,7 +403,7 @@ static inline std::optional<CFStringRef> openTypeFeature(CFDictionaryRef feature > CFNumberRef value = static_cast<CFNumberRef>(CFDictionaryGetValue(feature, kCTFontOpenTypeFeatureValue)); > auto success = CFNumberGetValue(value, kCFNumberIntType, &rawValue); > ASSERT_UNUSED(success, success); >- return rawValue ? std::optional<CFStringRef>(tag) : std::nullopt; >+ return rawValue ? WTF::Optional<CFStringRef>(tag) : WTF::nullopt; > } > > static inline std::pair<int, int> trueTypeFeature(CFDictionaryRef feature) >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >index 6f91cd0e55d966a35ce2e40748d698d8df2df01d..f5c220d109b07744f94d8c7c5011416a4d8d1112 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >@@ -391,7 +391,7 @@ void DrawGlyphs::computeBounds() > } > } > >-std::optional<FloatRect> DrawGlyphs::localBounds(const GraphicsContext&) const >+WTF::Optional<FloatRect> DrawGlyphs::localBounds(const GraphicsContext&) const > { > FloatRect localBounds = m_bounds; > localBounds.move(m_blockLocation.x(), m_blockLocation.y()); >@@ -571,7 +571,7 @@ static TextStream& operator<<(TextStream& ts, const DrawRect& item) > return ts; > } > >-std::optional<FloatRect> DrawLine::localBounds(const GraphicsContext&) const >+WTF::Optional<FloatRect> DrawLine::localBounds(const GraphicsContext&) const > { > FloatRect bounds; > bounds.fitToPoints(m_point1, m_point2); >@@ -596,7 +596,7 @@ void DrawLinesForText::apply(GraphicsContext& context) const > context.drawLinesForText(point(), m_thickness, m_widths, m_printing, m_doubleLines); > } > >-std::optional<FloatRect> DrawLinesForText::localBounds(const GraphicsContext&) const >+WTF::Optional<FloatRect> DrawLinesForText::localBounds(const GraphicsContext&) const > { > // This function needs to return a value equal to or enclosing what GraphicsContext::computeLineBoundsAndAntialiasingModeForText() returns. > >@@ -627,7 +627,7 @@ void DrawDotsForDocumentMarker::apply(GraphicsContext& context) const > context.drawDotsForDocumentMarker(m_rect, m_style); > } > >-std::optional<FloatRect> DrawDotsForDocumentMarker::localBounds(const GraphicsContext&) const >+WTF::Optional<FloatRect> DrawDotsForDocumentMarker::localBounds(const GraphicsContext&) const > { > return m_rect; > } >@@ -671,7 +671,7 @@ void DrawFocusRingPath::apply(GraphicsContext& context) const > context.drawFocusRing(m_path, m_width, m_offset, m_color); > } > >-std::optional<FloatRect> DrawFocusRingPath::localBounds(const GraphicsContext&) const >+WTF::Optional<FloatRect> DrawFocusRingPath::localBounds(const GraphicsContext&) const > { > FloatRect result = m_path.fastBoundingRect(); > result.inflate(platformFocusRingWidth); >@@ -693,7 +693,7 @@ void DrawFocusRingRects::apply(GraphicsContext& context) const > context.drawFocusRing(m_rects, m_width, m_offset, m_color); > } > >-std::optional<FloatRect> DrawFocusRingRects::localBounds(const GraphicsContext&) const >+WTF::Optional<FloatRect> DrawFocusRingRects::localBounds(const GraphicsContext&) const > { > FloatRect result; > for (auto& rect : m_rects) >@@ -817,7 +817,7 @@ static TextStream& operator<<(TextStream& ts, const FillEllipse& item) > return ts; > } > >-std::optional<FloatRect> StrokeRect::localBounds(const GraphicsContext&) const >+WTF::Optional<FloatRect> StrokeRect::localBounds(const GraphicsContext&) const > { > FloatRect bounds = m_rect; > bounds.expand(m_lineWidth, m_lineWidth); >@@ -837,7 +837,7 @@ static TextStream& operator<<(TextStream& ts, const StrokeRect& item) > return ts; > } > >-std::optional<FloatRect> StrokePath::localBounds(const GraphicsContext& context) const >+WTF::Optional<FloatRect> StrokePath::localBounds(const GraphicsContext& context) const > { > // FIXME: Need to take stroke thickness into account correctly, via CGPathByStrokingPath(). > float strokeThickness = context.strokeThickness(); >@@ -859,7 +859,7 @@ static TextStream& operator<<(TextStream& ts, const StrokePath& item) > return ts; > } > >-std::optional<FloatRect> StrokeEllipse::localBounds(const GraphicsContext& context) const >+WTF::Optional<FloatRect> StrokeEllipse::localBounds(const GraphicsContext& context) const > { > float strokeThickness = context.strokeThickness(); > >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >index 2b7d14cb05d206366618237b451a4a4cb1cb6e33..5fcf360726e6fb59ca815d756f6fef1f187864fb 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >@@ -174,12 +174,12 @@ public: > > // Return bounds of this drawing operation in local coordinates. > // Does not include effets of transform, shadow etc in the state. >- virtual std::optional<FloatRect> localBounds(const GraphicsContext&) const { return std::nullopt; } >+ virtual WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const { return WTF::nullopt; } > > private: > bool isDrawingItem() const override { return true; } > >- std::optional<FloatRect> m_extent; // In base coordinates, taking shadows and transforms into account. >+ WTF::Optional<FloatRect> m_extent; // In base coordinates, taking shadows and transforms into account. > }; > > class Save : public Item { >@@ -545,7 +545,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > GlyphBuffer generateGlyphBuffer() const; > >@@ -574,7 +574,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } > > mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. > FloatRect m_destination; >@@ -601,7 +601,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } > > mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. > FloatRect m_destination; >@@ -627,7 +627,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } > > mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. > FloatRect m_destination; >@@ -654,7 +654,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } > > #if USE(CG) > RetainPtr<CGImageRef> m_image; >@@ -689,7 +689,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } > > mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. > AffineTransform m_patternTransform; >@@ -758,7 +758,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > float m_borderThickness; >@@ -783,7 +783,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > FloatPoint m_point1; > FloatPoint m_point2; >@@ -819,7 +819,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > FloatPoint m_blockLocation; > FloatSize m_localAnchor; >@@ -848,7 +848,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > FloatRect m_rect; > DocumentMarkerLineStyle m_style; >@@ -871,7 +871,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > }; >@@ -894,7 +894,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_path.fastBoundingRect(); } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_path.fastBoundingRect(); } > > const Path m_path; > }; >@@ -923,7 +923,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > const Path m_path; > float m_width; >@@ -955,7 +955,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > Vector<FloatRect> m_rects; > float m_width; >@@ -980,7 +980,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > }; >@@ -1005,7 +1005,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > Color m_color; >@@ -1029,7 +1029,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > mutable Ref<Gradient> m_gradient; // FIXME: Make this not mutable >@@ -1058,7 +1058,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > Color m_color; >@@ -1087,7 +1087,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect.rect(); } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect.rect(); } > > FloatRoundedRect m_rect; > Color m_color; >@@ -1115,7 +1115,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > FloatRoundedRect m_roundedHoleRect; >@@ -1139,7 +1139,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_path.fastBoundingRect(); } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_path.fastBoundingRect(); } > > const Path m_path; > }; >@@ -1162,7 +1162,7 @@ private: > > void apply(GraphicsContext&) const override; > >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > }; >@@ -1186,7 +1186,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > FloatRect m_rect; > float m_lineWidth; >@@ -1209,7 +1209,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > const Path m_path; > FloatPoint m_blockLocation; >@@ -1232,7 +1232,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override; > > FloatRect m_rect; > }; >@@ -1254,7 +1254,7 @@ private: > } > > void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >+ WTF::Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } > > FloatRect m_rect; > }; >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >index 9039b78ee2af4dd489d3afb6e674e115aebc08bc..492b916eb38f2a51116dc6e6be91ca0f8e6caf42 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >@@ -404,7 +404,7 @@ Item& Recorder::appendItem(Ref<Item>&& item) > > void Recorder::updateItemExtent(DrawingItem& item) const > { >- if (std::optional<FloatRect> rect = item.localBounds(graphicsContext())) >+ if (WTF::Optional<FloatRect> rect = item.localBounds(graphicsContext())) > item.setExtent(extentFromLocalBounds(rect.value())); > } > >@@ -473,7 +473,7 @@ void Recorder::ContextState::rotate(float angleInRadians) > AffineTransform rotation; > rotation.rotate(angleInDegrees); > >- if (std::optional<AffineTransform> inverse = rotation.inverse()) >+ if (WTF::Optional<AffineTransform> inverse = rotation.inverse()) > clipBounds = inverse.value().mapRect(clipBounds); > } > >@@ -487,7 +487,7 @@ void Recorder::ContextState::concatCTM(const AffineTransform& matrix) > { > ctm *= matrix; > >- if (std::optional<AffineTransform> inverse = matrix.inverse()) >+ if (WTF::Optional<AffineTransform> inverse = matrix.inverse()) > clipBounds = inverse.value().mapRect(clipBounds); > } > >diff --git a/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp >index 4bff7cc83d0983b969af9ce2579b76bb4352d47f..b27ee9a1ce2cd3854c303a3b342b181414c3b65c 100644 >--- a/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp >+++ b/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp >@@ -84,7 +84,7 @@ void Font::platformInit() > float descent = narrowPrecisionToFloat(fontExtents.descent); > float capHeight = narrowPrecisionToFloat(fontExtents.height); > float lineGap = narrowPrecisionToFloat(fontExtents.height - fontExtents.ascent - fontExtents.descent); >- std::optional<float> xHeight; >+ WTF::Optional<float> xHeight; > > { > CairoFtFaceLocker cairoFtFaceLocker(m_platformData.scaledFont()); >diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm >index c81983622b75795d4ab1300c755c82a3a0e13595..d3ed253ad8426d57ab49b69aa5491233e718415c 100644 >--- a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm >@@ -83,7 +83,7 @@ static bool setFunctionsForPipelineDescriptor(const char* const functionName, MT > return true; > } > >-static std::optional<MTLVertexFormat> validateAndConvertVertexFormatToMTLVertexFormat(GPUVertexFormatEnum format) >+static WTF::Optional<MTLVertexFormat> validateAndConvertVertexFormatToMTLVertexFormat(GPUVertexFormatEnum format) > { > switch (format) { > case GPUVertexFormat::FloatR32G32B32A32: >@@ -95,11 +95,11 @@ static std::optional<MTLVertexFormat> validateAndConvertVertexFormatToMTLVertexF > case GPUVertexFormat::FloatR32: > return MTLVertexFormatFloat; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-static std::optional<MTLVertexStepFunction> validateAndConvertStepModeToMTLStepFunction(GPUInputStepModeEnum mode) >+static WTF::Optional<MTLVertexStepFunction> validateAndConvertStepModeToMTLStepFunction(GPUInputStepModeEnum mode) > { > switch (mode) { > case GPUInputStepMode::Vertex: >@@ -107,7 +107,7 @@ static std::optional<MTLVertexStepFunction> validateAndConvertStepModeToMTLStepF > case GPUInputStepMode::Instance: > return MTLVertexStepFunctionPerInstance; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >index 2f1dd08ad63090b075dc7b19b7364ad5970fac31..236aff89df6b79c6794e5ca5c3269268ef618ee1 100644 >--- a/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >@@ -80,7 +80,7 @@ void GPUSwapChain::setDevice(const GPUDevice& device) > [m_platformSwapLayer setDevice:device.platformDevice()]; > } > >-static std::optional<PlatformTextureFormat> platformTextureFormatForGPUTextureFormat(GPUTextureFormatEnum format) >+static WTF::Optional<PlatformTextureFormat> platformTextureFormatForGPUTextureFormat(GPUTextureFormatEnum format) > { > switch (format) { > case GPUTextureFormatEnum::R8G8B8A8Unorm: >@@ -93,7 +93,7 @@ static std::optional<PlatformTextureFormat> platformTextureFormatForGPUTextureFo > return MTLPixelFormatDepth32Float_Stencil8; > default: > LOG(WebGPU, "GPUSwapChain::setFormat(): Invalid texture format specified!"); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp >index 52649bba7ab8c4d9ab7539ae329964838381fc99..529fdf1820d1de88b9e76bf80ebb7f7ad77ea88d 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp >@@ -110,11 +110,11 @@ bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVid > return true; > } > >-std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps* caps) >+WTF::Optional<FloatSize> getVideoResolutionFromCaps(const GstCaps* caps) > { > if (!doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { > GST_WARNING("Failed to get the video resolution, these are not a video caps"); >- return std::nullopt; >+ return WTF::nullopt; > } > > int width = 0, height = 0; >@@ -129,7 +129,7 @@ std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps* caps) > GstVideoInfo info; > gst_video_info_init(&info); > if (!gst_video_info_from_caps(&info, caps)) >- return std::nullopt; >+ return WTF::nullopt; > > width = GST_VIDEO_INFO_WIDTH(&info); > height = GST_VIDEO_INFO_HEIGHT(&info); >@@ -137,7 +137,7 @@ std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps* caps) > pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info); > } > >- return std::make_optional(FloatSize(width, height * (static_cast<float>(pixelAspectRatioDenominator) / static_cast<float>(pixelAspectRatioNumerator)))); >+ return WTF::makeOptional(FloatSize(width, height * (static_cast<float>(pixelAspectRatioDenominator) / static_cast<float>(pixelAspectRatioNumerator)))); > } > > bool getSampleVideoInfo(GstSample* sample, GstVideoInfo& videoInfo) >@@ -215,7 +215,7 @@ Vector<String> extractGStreamerOptionsFromCommandLine() > return options; > } > >-bool initializeGStreamer(std::optional<Vector<String>>&& options) >+bool initializeGStreamer(WTF::Optional<Vector<String>>&& options) > { > static std::once_flag onceFlag; > static bool isGStreamerInitialized; >diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h >index 5d44d47401bc718cede46290e609137190f2700f..6d37387663d537de236a82fc0e801593f222dd3f 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h >+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h >@@ -60,14 +60,14 @@ inline bool webkitGstCheckVersion(guint major, guint minor, guint micro) > GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate*, const gchar* name, GstPad* target); > #if ENABLE(VIDEO) > bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride); >-std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps*); >+WTF::Optional<FloatSize> getVideoResolutionFromCaps(const GstCaps*); > bool getSampleVideoInfo(GstSample*, GstVideoInfo&); > #endif > const char* capsMediaType(const GstCaps*); > bool doCapsHaveType(const GstCaps*, const char*); > bool areEncryptedCaps(const GstCaps*); > Vector<String> extractGStreamerOptionsFromCommandLine(); >-bool initializeGStreamer(std::optional<Vector<String>>&& = std::nullopt); >+bool initializeGStreamer(WTF::Optional<Vector<String>>&& = WTF::nullopt); > bool initializeGStreamerAndRegisterWebKitElements(); > unsigned getGstPlayFlag(const char* nick); > uint64_t toGstUnsigned64Time(const MediaTime&); >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp >index 94768dc1a92a2f64bf2ce21268814aa29a09f6cf..3cc434dfbf2c8454c320e533688e2b37d16497c3 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp >@@ -309,7 +309,7 @@ void MediaPlayerPrivateGStreamer::loadFull(const String& urlString, const gchar* > m_player->readyStateChanged(); > m_volumeAndMuteInitialized = false; > m_durationAtEOS = MediaTime::invalidTime(); >- m_hasTaintedOrigin = std::nullopt; >+ m_hasTaintedOrigin = WTF::nullopt; > > if (!m_delayingLoad) > commitLoad(); >@@ -2671,7 +2671,7 @@ bool MediaPlayerPrivateGStreamer::canSaveMediaData() const > return false; > } > >-std::optional<bool> MediaPlayerPrivateGStreamer::wouldTaintOrigin(const SecurityOrigin&) const >+WTF::Optional<bool> MediaPlayerPrivateGStreamer::wouldTaintOrigin(const SecurityOrigin&) const > { > // Ideally the given origin should always be verified with > // webKitSrcWouldTaintOrigin() instead of only checking it for >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >index 8d6af4f35963adab62ecbb0a759c172b1ecad278..7e66421faf46e4286647576d43b8198cddaeb2a0 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >@@ -109,7 +109,7 @@ public: > MediaTime maxTimeLoaded() const override; > > bool hasSingleSecurityOrigin() const override; >- std::optional<bool> wouldTaintOrigin(const SecurityOrigin&) const override; >+ WTF::Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const override; > > void loadStateChanged(); > void timeChanged(); >@@ -259,7 +259,7 @@ private: > mutable unsigned long long m_totalBytes; > URL m_url; > bool m_preservesPitch; >- mutable std::optional<Seconds> m_lastQueryTime; >+ mutable WTF::Optional<Seconds> m_lastQueryTime; > bool m_isLegacyPlaybin; > #if GST_CHECK_VERSION(1, 10, 0) > GRefPtr<GstStreamCollection> m_streamCollection; >@@ -288,7 +288,7 @@ private: > #endif > virtual bool isMediaSource() const { return false; } > >- std::optional<bool> m_hasTaintedOrigin { std::nullopt }; >+ WTF::Optional<bool> m_hasTaintedOrigin { WTF::nullopt }; > }; > } > >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >index 026a20573ec32adb2a3bc8a686023ea80ad83108..a5c8af4f2dc52feafad856166fa8c49430898b03 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >@@ -382,7 +382,7 @@ void AppendPipeline::parseDemuxerSrcPadCaps(GstCaps* demuxerSrcPadCaps) > m_presentationSize = WebCore::FloatSize(); > m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Invalid; > } else if (doCapsHaveType(m_demuxerSrcPadCaps.get(), GST_VIDEO_CAPS_TYPE_PREFIX)) { >- std::optional<FloatSize> size = getVideoResolutionFromCaps(m_demuxerSrcPadCaps.get()); >+ WTF::Optional<FloatSize> size = getVideoResolutionFromCaps(m_demuxerSrcPadCaps.get()); > if (size.has_value()) > m_presentationSize = size.value(); > else >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >index b63e5deee72c95c49d856dc5470baab3f6149e8c..b0d6f2b566370e4bd1112514043a68e46dc60c99 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >@@ -720,7 +720,7 @@ void MediaPlayerPrivateGStreamerMSE::trackDetected(RefPtr<AppendPipeline> append > GST_DEBUG("track ID: %s, caps: %" GST_PTR_FORMAT, newTrack->id().string().latin1().data(), caps); > > if (doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { >- std::optional<FloatSize> size = getVideoResolutionFromCaps(caps); >+ WTF::Optional<FloatSize> size = getVideoResolutionFromCaps(caps); > if (size.has_value()) > m_videoSize = size.value(); > } >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp >index 969a422442e583d3ed1af7cfe43d29e42aa9eb61..938bea33268b114ff4112e56e50ce5c31f0a40ec 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp >@@ -458,7 +458,7 @@ void webKitMediaSrcUpdatePresentationSize(GstCaps* caps, Stream* stream) > { > GST_OBJECT_LOCK(stream->parent); > if (WebCore::doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { >- std::optional<WebCore::FloatSize> size = WebCore::getVideoResolutionFromCaps(caps); >+ WTF::Optional<WebCore::FloatSize> size = WebCore::getVideoResolutionFromCaps(caps); > if (size.has_value()) > stream->presentationSize = size.value(); > else >diff --git a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp >index 8e6095c9ac8023453aa16ed5546878f494fdf441..ea15ba9333749413309bafa378684cf1dccf9f51 100644 >--- a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp >+++ b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp >@@ -32,7 +32,7 @@ > > namespace WebCore { > >-static bool encodeImage(cairo_surface_t* surface, const String& mimeType, std::optional<double> quality, GUniqueOutPtr<gchar>& buffer, gsize& bufferSize) >+static bool encodeImage(cairo_surface_t* surface, const String& mimeType, WTF::Optional<double> quality, GUniqueOutPtr<gchar>& buffer, gsize& bufferSize) > { > // List of supported image encoding types comes from the GdkPixbuf documentation. > // http://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-bufferv >@@ -75,7 +75,7 @@ static bool encodeImage(cairo_surface_t* surface, const String& mimeType, std::o > return !error; > } > >-String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> quality, PreserveResolution) const >+String ImageBuffer::toDataURL(const String& mimeType, WTF::Optional<double> quality, PreserveResolution) const > { > Vector<uint8_t> imageData = toData(mimeType, quality); > if (imageData.isEmpty()) >@@ -87,7 +87,7 @@ String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> qual > return "data:" + mimeType + ";base64," + base64Data; > } > >-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const >+Vector<uint8_t> ImageBuffer::toData(const String& mimeType, WTF::Optional<double> quality) const > { > ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); > >diff --git a/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >index 44226972e470b860deae04c7617c4fc06eb253c8..c59ba95b4c3e3f0cb9699059d4b04fb796a757ac 100644 >--- a/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >+++ b/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >@@ -201,12 +201,12 @@ static Vector<hb_feature_t, 4> fontFeatures(const FontCascade& font, FontOrienta > return features; > } > >-static std::optional<UScriptCode> characterScript(UChar32 character) >+static WTF::Optional<UScriptCode> characterScript(UChar32 character) > { > UErrorCode errorCode = U_ZERO_ERROR; > UScriptCode script = uscript_getScript(character, &errorCode); > if (U_FAILURE(errorCode)) >- return std::nullopt; >+ return WTF::nullopt; > return script; > } > >@@ -216,17 +216,17 @@ struct HBRun { > UScriptCode script; > }; > >-static std::optional<HBRun> findNextRun(const UChar* characters, unsigned length, unsigned offset) >+static WTF::Optional<HBRun> findNextRun(const UChar* characters, unsigned length, unsigned offset) > { > SurrogatePairAwareTextIterator textIterator(characters + offset, offset, length, length); > UChar32 character; > unsigned clusterLength = 0; > if (!textIterator.consume(character, clusterLength)) >- return std::nullopt; >+ return WTF::nullopt; > > auto currentScript = characterScript(character); > if (!currentScript) >- return std::nullopt; >+ return WTF::nullopt; > > unsigned startIndex = offset; > for (textIterator.advance(clusterLength); textIterator.consume(character, clusterLength); textIterator.advance(clusterLength)) { >@@ -235,7 +235,7 @@ static std::optional<HBRun> findNextRun(const UChar* characters, unsigned length > > auto nextScript = characterScript(character); > if (!nextScript) >- return std::nullopt; >+ return WTF::nullopt; > > // §5.1 Handling Characters with the Common Script Property. > // Programs must resolve any of the special Script property values, such as Common, >@@ -256,10 +256,10 @@ static std::optional<HBRun> findNextRun(const UChar* characters, unsigned length > } > > if (currentScript != nextScript && !uscript_hasScript(character, currentScript.value())) >- return std::optional<HBRun>({ startIndex, textIterator.currentIndex(), currentScript.value() }); >+ return WTF::Optional<HBRun>({ startIndex, textIterator.currentIndex(), currentScript.value() }); > } > >- return std::optional<HBRun>({ startIndex, textIterator.currentIndex(), currentScript.value() }); >+ return WTF::Optional<HBRun>({ startIndex, textIterator.currentIndex(), currentScript.value() }); > } > > static hb_script_t findScriptForVerticalGlyphSubstitution(hb_face_t* face) >diff --git a/Source/WebCore/platform/graphics/iso/ISOBox.cpp b/Source/WebCore/platform/graphics/iso/ISOBox.cpp >index c06e3a6338860f11eb0ebcfa438d3520266f5d48..e0a4466bbdf5520ac338b714e50b73e782627750 100644 >--- a/Source/WebCore/platform/graphics/iso/ISOBox.cpp >+++ b/Source/WebCore/platform/graphics/iso/ISOBox.cpp >@@ -36,14 +36,14 @@ ISOBox::PeekResult ISOBox::peekBox(DataView& view, unsigned offset) > { > uint64_t size = 0; > if (!checkedRead<uint32_t>(size, view, offset, BigEndian)) >- return std::nullopt; >+ return WTF::nullopt; > > FourCC type = { uint32_t { 0 } }; > if (!checkedRead<uint32_t>(type, view, offset, BigEndian)) >- return std::nullopt; >+ return WTF::nullopt; > > if (size == 1 && !checkedRead<uint64_t>(size, view, offset, BigEndian)) >- return std::nullopt; >+ return WTF::nullopt; > else if (!size) > size = view.byteLength(); > >diff --git a/Source/WebCore/platform/graphics/iso/ISOBox.h b/Source/WebCore/platform/graphics/iso/ISOBox.h >index db42c3321f21a383c84ac0d2a2b1740c1fc171e7..b90953fdf947048f18df8e9a9a81505ea78e4775 100644 >--- a/Source/WebCore/platform/graphics/iso/ISOBox.h >+++ b/Source/WebCore/platform/graphics/iso/ISOBox.h >@@ -39,7 +39,7 @@ class WEBCORE_EXPORT ISOBox { > public: > virtual ~ISOBox() = default; > >- using PeekResult = std::optional<std::pair<FourCC, uint64_t>>; >+ using PeekResult = WTF::Optional<std::pair<FourCC, uint64_t>>; > static PeekResult peekBox(JSC::DataView&, unsigned offset); > static size_t minimumBoxSize() { return 2 * sizeof(uint32_t); } > >diff --git a/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h b/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h >index 1e063fe6be8cf18845b6c965b8eca9287cd89f7c..69ea8bc9447841d1fe653a004d5338c2d6c4860f 100644 >--- a/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h >+++ b/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h >@@ -33,8 +33,8 @@ class WEBCORE_EXPORT ISOTrackEncryptionBox : public ISOFullBox { > public: > static FourCC boxTypeName() { return "tenc"; } > >- std::optional<int8_t> defaultCryptByteBlock() const { return m_defaultCryptByteBlock; } >- std::optional<int8_t> defaultSkipByteBlock() const { return m_defaultSkipByteBlock; } >+ WTF::Optional<int8_t> defaultCryptByteBlock() const { return m_defaultCryptByteBlock; } >+ WTF::Optional<int8_t> defaultSkipByteBlock() const { return m_defaultSkipByteBlock; } > int8_t defaultIsProtected() const { return m_defaultIsProtected; } > int8_t defaultPerSampleIVSize() const { return m_defaultPerSampleIVSize; } > Vector<uint8_t> defaultKID() const { return m_defaultKID; } >@@ -43,8 +43,8 @@ public: > protected: > bool parse(JSC::DataView&, unsigned& offset) override; > >- std::optional<int8_t> m_defaultCryptByteBlock; >- std::optional<int8_t> m_defaultSkipByteBlock; >+ WTF::Optional<int8_t> m_defaultCryptByteBlock; >+ WTF::Optional<int8_t> m_defaultSkipByteBlock; > int8_t m_defaultIsProtected { 0 }; > int8_t m_defaultPerSampleIVSize { 0 }; > Vector<uint8_t> m_defaultKID; >diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp >index eb93bc093437a1853988d7aa394020434fb7a715..c13969df3d031ec034d0bd89db4a5c18113af69a 100644 >--- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp >+++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp >@@ -980,16 +980,16 @@ static String generateHashedName(const String& name) > return builder.toString(); > } > >-std::optional<String> GraphicsContext3D::mappedSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType symbolType, const String& name) >+WTF::Optional<String> GraphicsContext3D::mappedSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType symbolType, const String& name) > { > auto result = m_shaderSourceMap.find(shader); > if (result == m_shaderSourceMap.end()) >- return std::nullopt; >+ return WTF::nullopt; > > const auto& symbolMap = result->value.symbolMap(symbolType); > auto symbolEntry = symbolMap.find(name); > if (symbolEntry == symbolMap.end()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& mappedName = symbolEntry->value.mappedName; > return String(mappedName.c_str(), mappedName.length()); >@@ -1038,18 +1038,18 @@ String GraphicsContext3D::mappedSymbolName(Platform3DObject program, ANGLEShader > return name; > } > >-std::optional<String> GraphicsContext3D::originalSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType symbolType, const String& name) >+WTF::Optional<String> GraphicsContext3D::originalSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType symbolType, const String& name) > { > auto result = m_shaderSourceMap.find(shader); > if (result == m_shaderSourceMap.end()) >- return std::nullopt; >+ return WTF::nullopt; > > const auto& symbolMap = result->value.symbolMap(symbolType); > for (const auto& symbolEntry : symbolMap) { > if (name == symbolEntry.value.mappedName.c_str()) > return symbolEntry.key; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > String GraphicsContext3D::originalSymbolName(Platform3DObject program, ANGLEShaderSymbolType symbolType, const String& name) >diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h >index 09e212c109b9b4ded737d5a9edf179eb9248be7d..2d613e319e9dba3505922875507818f13cda089b 100644 >--- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h >+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h >@@ -31,9 +31,9 @@ public: > enum class AnimationState { Playing, Paused, Stopped }; > > struct ApplicationResult { >- std::optional<TransformationMatrix> transform; >- std::optional<double> opacity; >- std::optional<FilterOperations> filters; >+ WTF::Optional<TransformationMatrix> transform; >+ WTF::Optional<double> opacity; >+ WTF::Optional<FilterOperations> filters; > bool hasRunningAnimations { false }; > }; > >diff --git a/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp b/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp >index eebf228a1c4934d8263280d86df6371c5f4faec4..e5aedc36e6edda24421f5e7f0fb8e6a099d30f55 100644 >--- a/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp >+++ b/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp >@@ -104,11 +104,11 @@ bool AffineTransform::isInvertible() const > return std::isfinite(determinant) && determinant != 0; > } > >-std::optional<AffineTransform> AffineTransform::inverse() const >+WTF::Optional<AffineTransform> AffineTransform::inverse() const > { > double determinant = det(m_transform); > if (!std::isfinite(determinant) || determinant == 0) >- return std::nullopt; >+ return WTF::nullopt; > > AffineTransform result; > if (isIdentityOrTranslation()) { >diff --git a/Source/WebCore/platform/graphics/transforms/AffineTransform.h b/Source/WebCore/platform/graphics/transforms/AffineTransform.h >index a8f09b796d2ae308c315f0de00246e37ff4d778f..eef1ac8160e6f757475514ea6194b29cd68d5f98 100644 >--- a/Source/WebCore/platform/graphics/transforms/AffineTransform.h >+++ b/Source/WebCore/platform/graphics/transforms/AffineTransform.h >@@ -129,7 +129,7 @@ public: > WEBCORE_EXPORT double yScale() const; > > bool isInvertible() const; // If you call this this, you're probably doing it wrong. >- WEBCORE_EXPORT std::optional<AffineTransform> inverse() const; >+ WEBCORE_EXPORT WTF::Optional<AffineTransform> inverse() const; > > WEBCORE_EXPORT void blend(const AffineTransform& from, double progress); > >diff --git a/Source/WebCore/platform/graphics/transforms/TransformState.cpp b/Source/WebCore/platform/graphics/transforms/TransformState.cpp >index 5ef0e5bf40b9deb4e78ce743917a82210831ee6b..626b6cb0abc9a5c383a939ca88bf997620a52cf4 100644 >--- a/Source/WebCore/platform/graphics/transforms/TransformState.cpp >+++ b/Source/WebCore/platform/graphics/transforms/TransformState.cpp >@@ -183,13 +183,13 @@ FloatQuad TransformState::mappedQuad(bool* wasClamped) const > return quad; > } > >-std::optional<FloatQuad> TransformState::mappedSecondaryQuad(bool* wasClamped) const >+WTF::Optional<FloatQuad> TransformState::mappedSecondaryQuad(bool* wasClamped) const > { > if (wasClamped) > *wasClamped = false; > > if (!m_lastPlanarSecondaryQuad) >- return std::optional<FloatQuad>(); >+ return WTF::Optional<FloatQuad>(); > > FloatQuad quad = *m_lastPlanarSecondaryQuad; > mapQuad(quad, m_direction, wasClamped); >diff --git a/Source/WebCore/platform/graphics/transforms/TransformState.h b/Source/WebCore/platform/graphics/transforms/TransformState.h >index ae04c8bbf15cc8bd2a9e1c9a876df0bc94d47274..b41abff29ad921914b02dd550913c55ca9fd9287 100644 >--- a/Source/WebCore/platform/graphics/transforms/TransformState.h >+++ b/Source/WebCore/platform/graphics/transforms/TransformState.h >@@ -79,7 +79,7 @@ public: > m_lastPlanarQuad = quad; > } > >- // FIXME: webkit.org/b/144226 use std::optional<FloatQuad>. >+ // FIXME: webkit.org/b/144226 use WTF::Optional<FloatQuad>. > void setSecondaryQuad(const FloatQuad* quad) > { > // We must be in a flattened state (no accumulated offset) when setting this secondary quad. >@@ -90,7 +90,7 @@ public: > m_lastPlanarSecondaryQuad = nullptr; > } > >- // FIXME: webkit.org/b/144226 use std::optional<FloatQuad>. >+ // FIXME: webkit.org/b/144226 use WTF::Optional<FloatQuad>. > void setLastPlanarSecondaryQuad(const FloatQuad*); > > void move(LayoutUnit x, LayoutUnit y, TransformAccumulation accumulate = FlattenTransform) >@@ -112,7 +112,7 @@ public: > // Return the point or quad mapped through the current transform > FloatPoint mappedPoint(bool* wasClamped = nullptr) const; > FloatQuad mappedQuad(bool* wasClamped = nullptr) const; >- std::optional<FloatQuad> mappedSecondaryQuad(bool* wasClamped = nullptr) const; >+ WTF::Optional<FloatQuad> mappedSecondaryQuad(bool* wasClamped = nullptr) const; > > private: > void translateTransform(const LayoutSize&); >diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp >index d2570f7c548db68570c3034ad330862ebc7c8c30..18225ce02b69a5e381d2efc6d97638195f23e849 100644 >--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp >+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp >@@ -1460,7 +1460,7 @@ bool TransformationMatrix::isInvertible() const > return true; > } > >-std::optional<TransformationMatrix> TransformationMatrix::inverse() const >+WTF::Optional<TransformationMatrix> TransformationMatrix::inverse() const > { > if (isIdentityOrTranslation()) { > // identity matrix >@@ -1478,7 +1478,7 @@ std::optional<TransformationMatrix> TransformationMatrix::inverse() const > // FIXME: Use LU decomposition to apply the inverse instead of calculating the inverse explicitly. > // Calculating the inverse of a 4x4 matrix using cofactors is numerically unstable and unnecessary to apply the inverse transformation to a point. > if (!WebCore::inverse(m_matrix, invMat.m_matrix)) >- return std::nullopt; >+ return WTF::nullopt; > > return invMat; > } >diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >index 77e6d95ca35efc62cb507b9b05395d8b97cc3df2..31c345877ed8363182153f64a2952fb8a1631a07 100644 >--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >@@ -280,7 +280,7 @@ public: > WEBCORE_EXPORT static TransformationMatrix rectToRect(const FloatRect&, const FloatRect&); > > bool isInvertible() const; // If you call this this, you're probably doing it wrong. >- WEBCORE_EXPORT std::optional<TransformationMatrix> inverse() const; >+ WEBCORE_EXPORT WTF::Optional<TransformationMatrix> inverse() const; > > // Decompose the matrix into its component parts. > struct Decomposed2Type { >diff --git a/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp b/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp >index 1a7a26632d3f31c1ae23e7e898c92b8aad81665c..4e78cc26f9507779a3ad8478f539ffb1e3836ae6 100644 >--- a/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp >+++ b/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp >@@ -332,13 +332,13 @@ void ImageBuffer::putByteArray(const Uint8ClampedArray& source, AlphaPremultipli > m_data.putData(source, bufferFormat, scaledSourceSize, scaledSourceRect, destPoint, internalSize(), context().isAcceleratedContext(), 1); > } > >-String ImageBuffer::toDataURL(const String&, std::optional<double>, PreserveResolution) const >+String ImageBuffer::toDataURL(const String&, WTF::Optional<double>, PreserveResolution) const > { > notImplemented(); > return "data:,"_s; > } > >-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const >+Vector<uint8_t> ImageBuffer::toData(const String& mimeType, WTF::Optional<double> quality) const > { > notImplemented(); > return { }; >diff --git a/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp b/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp >index fa698c5fd43054e18b95fa7c2e715f334c6595fa..078bfe5d5a9720c454a451b255cd229a72587dd9 100644 >--- a/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp >+++ b/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp >@@ -122,7 +122,7 @@ RepetitionCount ImageDecoderDirect2D::repetitionCount() const > return RepetitionCountNone; > } > >-std::optional<IntPoint> ImageDecoderDirect2D::hotSpot() const >+WTF::Optional<IntPoint> ImageDecoderDirect2D::hotSpot() const > { > return IntPoint(); > } >diff --git a/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h b/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h >index 8a3f4f33b63746226dececb236c9082aedf0458b..a9f95157efc92c5804af78c0acd90dae37da223e 100644 >--- a/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h >+++ b/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h >@@ -60,7 +60,7 @@ public: > size_t frameCount() const final; > > RepetitionCount repetitionCount() const final; >- std::optional<IntPoint> hotSpot() const final; >+ WTF::Optional<IntPoint> hotSpot() const final; > > IntSize frameSizeAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const final; > bool frameIsCompleteAtIndex(size_t) const final; >diff --git a/Source/WebCore/platform/graphics/win/PathDirect2D.cpp b/Source/WebCore/platform/graphics/win/PathDirect2D.cpp >index 5465ea732610903fa375b6d6a7710ee6911bbda3..abf95b15fb19f0b6f71ce3a462f036ba2c6bbac0 100644 >--- a/Source/WebCore/platform/graphics/win/PathDirect2D.cpp >+++ b/Source/WebCore/platform/graphics/win/PathDirect2D.cpp >@@ -286,7 +286,7 @@ void Path::transform(const AffineTransform& transform) > if (transform.isIdentity() || isEmpty()) > return; > >- std::optional<FloatPoint> currentPoint; >+ WTF::Optional<FloatPoint> currentPoint; > if (hasCurrentPoint()) > currentPoint = this->currentPoint(); > >diff --git a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp >index f26536f1190a198b9b4eb92dec6f2f89c46f1053..d2bc13dcb46cd82853e0e3ddfcf6b370b1221d9e 100644 >--- a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp >+++ b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp >@@ -103,7 +103,7 @@ bool PlatformDisplayX11::supportsXComposite() const > return m_supportsXComposite.value(); > } > >-bool PlatformDisplayX11::supportsXDamage(std::optional<int>& damageEventBase, std::optional<int>& damageErrorBase) const >+bool PlatformDisplayX11::supportsXDamage(WTF::Optional<int>& damageEventBase, WTF::Optional<int>& damageErrorBase) const > { > if (!m_supportsXDamage) { > m_supportsXDamage = false; >diff --git a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h >index e5d38325df14b91c456db5e389b5ffd1371663de..74df048fde02c4174130e519d0d5b80fff70c662 100644 >--- a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h >+++ b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h >@@ -44,7 +44,7 @@ public: > > Display* native() const { return m_display; } > bool supportsXComposite() const; >- bool supportsXDamage(std::optional<int>& damageEventBase, std::optional<int>& damageErrorBase) const; >+ bool supportsXDamage(WTF::Optional<int>& damageEventBase, WTF::Optional<int>& damageErrorBase) const; > > private: > PlatformDisplayX11(Display*, NativeDisplayOwned); >@@ -56,10 +56,10 @@ private: > #endif > > Display* m_display { nullptr }; >- mutable std::optional<bool> m_supportsXComposite; >- mutable std::optional<bool> m_supportsXDamage; >- mutable std::optional<int> m_damageEventBase; >- mutable std::optional<int> m_damageErrorBase; >+ mutable WTF::Optional<bool> m_supportsXComposite; >+ mutable WTF::Optional<bool> m_supportsXDamage; >+ mutable WTF::Optional<int> m_damageEventBase; >+ mutable WTF::Optional<int> m_damageErrorBase; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h b/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h >index 24e6665f6f85e7bb60df79dc7db8b51c61fdb716..9832021441f5c9996bab6ac677b34df04bd3efb1 100644 >--- a/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h >+++ b/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h >@@ -194,7 +194,7 @@ public: > > // If the image has a cursor hot-spot, stores it in the argument > // and returns true. Otherwise returns false. >- std::optional<IntPoint> hotSpot() const override { return std::nullopt; } >+ WTF::Optional<IntPoint> hotSpot() const override { return WTF::nullopt; } > > protected: > void prepareScaleDataIfNecessary(); >diff --git a/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp b/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp >index 860da38638ef52a90ed1fd89b52dee965430153c..5ce72610da479d0fbd5acbb44f2420a6a83b7e7f 100644 >--- a/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp >+++ b/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp >@@ -109,7 +109,7 @@ bool ICOImageDecoder::setFailed() > return ScalableImageDecoder::setFailed(); > } > >-std::optional<IntPoint> ICOImageDecoder::hotSpot() const >+WTF::Optional<IntPoint> ICOImageDecoder::hotSpot() const > { > // When unspecified, the default frame is always frame 0. This is consistent with > // BitmapImage where currentFrame() starts at 0 and only increases when animation is >@@ -117,10 +117,10 @@ std::optional<IntPoint> ICOImageDecoder::hotSpot() const > return hotSpotAtIndex(0); > } > >-std::optional<IntPoint> ICOImageDecoder::hotSpotAtIndex(size_t index) const >+WTF::Optional<IntPoint> ICOImageDecoder::hotSpotAtIndex(size_t index) const > { > if (index >= m_dirEntries.size() || m_fileType != CURSOR) >- return std::nullopt; >+ return WTF::nullopt; > > return m_dirEntries[index].m_hotSpot; > } >diff --git a/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h b/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h >index a76eb397d14d628203d0151d690efa1b4d26a209..0d8720ed7dd19fd85fdbee7e2f8c68baadf04a82 100644 >--- a/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h >+++ b/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h >@@ -56,7 +56,7 @@ public: > // avoid accessing deleted memory, especially when calling this from > // inside BMPImageReader! > bool setFailed() final; >- std::optional<IntPoint> hotSpot() const final; >+ WTF::Optional<IntPoint> hotSpot() const final; > > private: > enum ImageType { >@@ -119,8 +119,8 @@ private: > // could be decoded. > bool processDirectoryEntries(); > >- // Returns the hot-spot for |index|, returns std::nullopt if there is none. >- std::optional<IntPoint> hotSpotAtIndex(size_t) const; >+ // Returns the hot-spot for |index|, returns WTF::nullopt if there is none. >+ WTF::Optional<IntPoint> hotSpotAtIndex(size_t) const; > > // Reads and returns a directory entry from the current offset into > // |data|. >diff --git a/Source/WebCore/platform/ios/LegacyTileCache.h b/Source/WebCore/platform/ios/LegacyTileCache.h >index e9153d4c1cadab4dde17f03182b555689b7f1cd6..a06d573769bcc547ffb85d06a6ffd37dccdbf870 100644 >--- a/Source/WebCore/platform/ios/LegacyTileCache.h >+++ b/Source/WebCore/platform/ios/LegacyTileCache.h >@@ -143,7 +143,7 @@ public: > unsigned tileCapacityForGrid(LegacyTileGrid*); > Color colorForGridTileBorder(LegacyTileGrid*) const; > bool setOverrideVisibleRect(const FloatRect&); >- void clearOverrideVisibleRect() { m_overrideVisibleRect = std::nullopt; } >+ void clearOverrideVisibleRect() { m_overrideVisibleRect = WTF::nullopt; } > > void doPendingRepaints(); > >@@ -184,7 +184,7 @@ private: > // Ensure there are no async calls on a dead tile cache. > RetainPtr<LegacyTileCacheTombstone> m_tombstone; > >- std::optional<FloatRect> m_overrideVisibleRect; >+ WTF::Optional<FloatRect> m_overrideVisibleRect; > > IntSize m_tileSize { 512, 512 }; > >diff --git a/Source/WebCore/platform/mac/NSScrollerImpDetails.h b/Source/WebCore/platform/mac/NSScrollerImpDetails.h >index f448074d28ece49a393f3808222f298aabf2a389..7c08d969d2339491159d5bc1f9f0070c4bc0c9a7 100644 >--- a/Source/WebCore/platform/mac/NSScrollerImpDetails.h >+++ b/Source/WebCore/platform/mac/NSScrollerImpDetails.h >@@ -38,7 +38,7 @@ public: > WEBCORE_EXPORT static void setUseOverlayScrollbars(bool); > > private: >- static std::optional<bool> m_useOverlayScrollbars; >+ static WTF::Optional<bool> m_useOverlayScrollbars; > }; > > } >diff --git a/Source/WebCore/platform/mac/NSScrollerImpDetails.mm b/Source/WebCore/platform/mac/NSScrollerImpDetails.mm >index 4d4fc0d0a2ff82198cc29e210d2188fe2131d685..b726df1a213f53cb8d2231d2fae43418cdf28749 100644 >--- a/Source/WebCore/platform/mac/NSScrollerImpDetails.mm >+++ b/Source/WebCore/platform/mac/NSScrollerImpDetails.mm >@@ -34,7 +34,7 @@ > > namespace WebCore { > >-std::optional<bool> ScrollerStyle::m_useOverlayScrollbars; >+WTF::Optional<bool> ScrollerStyle::m_useOverlayScrollbars; > > NSScrollerStyle ScrollerStyle::recommendedScrollerStyle() > { >diff --git a/Source/WebCore/platform/mac/ThemeMac.h b/Source/WebCore/platform/mac/ThemeMac.h >index 49028f1b43c73c35cc31370a7df4e98414fdc626..50d647ea19987fe916a6ff30d02ed0e6b42f4492 100644 >--- a/Source/WebCore/platform/mac/ThemeMac.h >+++ b/Source/WebCore/platform/mac/ThemeMac.h >@@ -43,7 +43,7 @@ private: > > int baselinePositionAdjustment(ControlPart) const final; > >- std::optional<FontCascadeDescription> controlFont(ControlPart, const FontCascade&, float zoomFactor) const final; >+ WTF::Optional<FontCascadeDescription> controlFont(ControlPart, const FontCascade&, float zoomFactor) const final; > > LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float zoomFactor) const final; > LengthSize minimumControlSize(ControlPart, const FontCascade&, float zoomFactor) const final; >diff --git a/Source/WebCore/platform/mac/ThemeMac.mm b/Source/WebCore/platform/mac/ThemeMac.mm >index 5e3eae0bde3f07c3b0ab2c4700117b83050a494d..8c22f011e5d8ab81a3afc0211b9921e880db67de 100644 >--- a/Source/WebCore/platform/mac/ThemeMac.mm >+++ b/Source/WebCore/platform/mac/ThemeMac.mm >@@ -763,7 +763,7 @@ int ThemeMac::baselinePositionAdjustment(ControlPart part) const > return Theme::baselinePositionAdjustment(part); > } > >-std::optional<FontCascadeDescription> ThemeMac::controlFont(ControlPart part, const FontCascade& font, float zoomFactor) const >+WTF::Optional<FontCascadeDescription> ThemeMac::controlFont(ControlPart part, const FontCascade& font, float zoomFactor) const > { > switch (part) { > case PushButtonPart: { >@@ -777,7 +777,7 @@ std::optional<FontCascadeDescription> ThemeMac::controlFont(ControlPart part, co > return fontDescription; > } > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >diff --git a/Source/WebCore/platform/mediacapabilities/MediaConfiguration.h b/Source/WebCore/platform/mediacapabilities/MediaConfiguration.h >index 3bdc83f2830a304de7ee2f0396328a88b9a92ff1..f39a0b96a7ba14e863128b2be1fcda322b24e521 100644 >--- a/Source/WebCore/platform/mediacapabilities/MediaConfiguration.h >+++ b/Source/WebCore/platform/mediacapabilities/MediaConfiguration.h >@@ -32,8 +32,8 @@ > namespace WebCore { > > struct MediaConfiguration { >- std::optional<VideoConfiguration> video; >- std::optional<AudioConfiguration> audio; >+ WTF::Optional<VideoConfiguration> video; >+ WTF::Optional<AudioConfiguration> audio; > }; > > } >diff --git a/Source/WebCore/platform/mediastream/CaptureDevice.h b/Source/WebCore/platform/mediastream/CaptureDevice.h >index fbf1c09d6d8365b98cf323b272dec7d003339128..a5135f654fdfae97ac673026ad9691319c010044 100644 >--- a/Source/WebCore/platform/mediastream/CaptureDevice.h >+++ b/Source/WebCore/platform/mediastream/CaptureDevice.h >@@ -68,34 +68,34 @@ public: > } > > template <class Decoder> >- static std::optional<CaptureDevice> decode(Decoder& decoder) >+ static WTF::Optional<CaptureDevice> decode(Decoder& decoder) > { >- std::optional<String> persistentId; >+ WTF::Optional<String> persistentId; > decoder >> persistentId; > if (!persistentId) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> label; >+ WTF::Optional<String> label; > decoder >> label; > if (!label) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> groupId; >+ WTF::Optional<String> groupId; > decoder >> groupId; > if (!groupId) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> enabled; >+ WTF::Optional<bool> enabled; > decoder >> enabled; > if (!enabled) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<CaptureDevice::DeviceType> type; >+ WTF::Optional<CaptureDevice::DeviceType> type; > decoder >> type; > if (!type) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<CaptureDevice> device = {{ WTFMove(*persistentId), WTFMove(*type), WTFMove(*label), WTFMove(*groupId) }}; >+ WTF::Optional<CaptureDevice> device = {{ WTFMove(*persistentId), WTFMove(*type), WTFMove(*label), WTFMove(*groupId) }}; > device->setEnabled(*enabled); > return device; > } >diff --git a/Source/WebCore/platform/mediastream/CaptureDeviceManager.h b/Source/WebCore/platform/mediastream/CaptureDeviceManager.h >index e91b47ced6d60787418e451075c2bd4957ac55db..4a42adc46f9c00df96b682c9fbedc212647f3cae 100644 >--- a/Source/WebCore/platform/mediastream/CaptureDeviceManager.h >+++ b/Source/WebCore/platform/mediastream/CaptureDeviceManager.h >@@ -36,7 +36,7 @@ namespace WebCore { > class WEBCORE_EXPORT CaptureDeviceManager : public CanMakeWeakPtr<CaptureDeviceManager> { > public: > virtual const Vector<CaptureDevice>& captureDevices() = 0; >- virtual std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&) { return std::nullopt; } >+ virtual WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&) { return WTF::nullopt; } > > protected: > virtual ~CaptureDeviceManager(); >diff --git a/Source/WebCore/platform/mediastream/MediaConstraints.cpp b/Source/WebCore/platform/mediastream/MediaConstraints.cpp >index 545a2f81e26aa876c7c39ac264813bc35a0abc8a..85231a34aa8a74060240d0d5e21daa94b9e5c933 100644 >--- a/Source/WebCore/platform/mediastream/MediaConstraints.cpp >+++ b/Source/WebCore/platform/mediastream/MediaConstraints.cpp >@@ -219,7 +219,7 @@ void MediaTrackConstraintSetMap::filter(const WTF::Function<bool(const MediaCons > return; > } > >-void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, std::optional<IntConstraint>&& constraint) >+void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, WTF::Optional<IntConstraint>&& constraint) > { > switch (constraintType) { > case MediaConstraintType::Width: >@@ -250,7 +250,7 @@ void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, std::op > } > } > >-void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, std::optional<DoubleConstraint>&& constraint) >+void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, WTF::Optional<DoubleConstraint>&& constraint) > { > switch (constraintType) { > case MediaConstraintType::AspectRatio: >@@ -279,7 +279,7 @@ void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, std::op > } > } > >-void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, std::optional<BooleanConstraint>&& constraint) >+void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, WTF::Optional<BooleanConstraint>&& constraint) > { > switch (constraintType) { > case MediaConstraintType::EchoCancellation: >@@ -308,7 +308,7 @@ void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, std::op > } > } > >-void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, std::optional<StringConstraint>&& constraint) >+void MediaTrackConstraintSetMap::set(MediaConstraintType constraintType, WTF::Optional<StringConstraint>&& constraint) > { > switch (constraintType) { > case MediaConstraintType::FacingMode: >diff --git a/Source/WebCore/platform/mediastream/MediaConstraints.h b/Source/WebCore/platform/mediastream/MediaConstraints.h >index b42710ab8a1d30ac029306ecbb803716430bd2ac..805052c0564bfe2671f6580837402d5294eba702 100644 >--- a/Source/WebCore/platform/mediastream/MediaConstraints.h >+++ b/Source/WebCore/platform/mediastream/MediaConstraints.h >@@ -293,8 +293,8 @@ public: > ValueType valueForDiscreteCapabilityValues(ValueType current, const Vector<ValueType>& discreteCapabilityValues) const > { > ValueType value { 0 }; >- std::optional<ValueType> min; >- std::optional<ValueType> max; >+ WTF::Optional<ValueType> min; >+ WTF::Optional<ValueType> max; > > if (m_exact) { > ASSERT(discreteCapabilityValues.contains(m_exact.value())); >@@ -394,10 +394,10 @@ protected: > } > } > >- std::optional<ValueType> m_min; >- std::optional<ValueType> m_max; >- std::optional<ValueType> m_exact; >- std::optional<ValueType> m_ideal; >+ WTF::Optional<ValueType> m_min; >+ WTF::Optional<ValueType> m_max; >+ WTF::Optional<ValueType> m_exact; >+ WTF::Optional<ValueType> m_ideal; > }; > > class IntConstraint final : public NumericConstraint<int> { >@@ -527,8 +527,8 @@ public: > } > > private: >- std::optional<bool> m_exact; >- std::optional<bool> m_ideal; >+ WTF::Optional<bool> m_exact; >+ WTF::Optional<bool> m_ideal; > }; > > class StringConstraint : public MediaConstraint { >@@ -635,27 +635,27 @@ public: > bool isEmpty() const; > WEBCORE_EXPORT size_t size() const; > >- WEBCORE_EXPORT void set(MediaConstraintType, std::optional<IntConstraint>&&); >- WEBCORE_EXPORT void set(MediaConstraintType, std::optional<DoubleConstraint>&&); >- WEBCORE_EXPORT void set(MediaConstraintType, std::optional<BooleanConstraint>&&); >- WEBCORE_EXPORT void set(MediaConstraintType, std::optional<StringConstraint>&&); >+ WEBCORE_EXPORT void set(MediaConstraintType, WTF::Optional<IntConstraint>&&); >+ WEBCORE_EXPORT void set(MediaConstraintType, WTF::Optional<DoubleConstraint>&&); >+ WEBCORE_EXPORT void set(MediaConstraintType, WTF::Optional<BooleanConstraint>&&); >+ WEBCORE_EXPORT void set(MediaConstraintType, WTF::Optional<StringConstraint>&&); > >- std::optional<IntConstraint> width() const { return m_width; } >- std::optional<IntConstraint> height() const { return m_height; } >- std::optional<IntConstraint> sampleRate() const { return m_sampleRate; } >- std::optional<IntConstraint> sampleSize() const { return m_sampleSize; } >+ WTF::Optional<IntConstraint> width() const { return m_width; } >+ WTF::Optional<IntConstraint> height() const { return m_height; } >+ WTF::Optional<IntConstraint> sampleRate() const { return m_sampleRate; } >+ WTF::Optional<IntConstraint> sampleSize() const { return m_sampleSize; } > >- std::optional<DoubleConstraint> aspectRatio() const { return m_aspectRatio; } >- std::optional<DoubleConstraint> frameRate() const { return m_frameRate; } >- std::optional<DoubleConstraint> volume() const { return m_volume; } >+ WTF::Optional<DoubleConstraint> aspectRatio() const { return m_aspectRatio; } >+ WTF::Optional<DoubleConstraint> frameRate() const { return m_frameRate; } >+ WTF::Optional<DoubleConstraint> volume() const { return m_volume; } > >- std::optional<BooleanConstraint> echoCancellation() const { return m_echoCancellation; } >- std::optional<BooleanConstraint> displaySurface() const { return m_displaySurface; } >- std::optional<BooleanConstraint> logicalSurface() const { return m_logicalSurface; } >+ WTF::Optional<BooleanConstraint> echoCancellation() const { return m_echoCancellation; } >+ WTF::Optional<BooleanConstraint> displaySurface() const { return m_displaySurface; } >+ WTF::Optional<BooleanConstraint> logicalSurface() const { return m_logicalSurface; } > >- std::optional<StringConstraint> facingMode() const { return m_facingMode; } >- std::optional<StringConstraint> deviceId() const { return m_deviceId; } >- std::optional<StringConstraint> groupId() const { return m_groupId; } >+ WTF::Optional<StringConstraint> facingMode() const { return m_facingMode; } >+ WTF::Optional<StringConstraint> deviceId() const { return m_deviceId; } >+ WTF::Optional<StringConstraint> groupId() const { return m_groupId; } > > template <class Encoder> void encode(Encoder& encoder) const > { >@@ -677,59 +677,59 @@ public: > encoder << m_groupId; > } > >- template <class Decoder> static std::optional<MediaTrackConstraintSetMap> decode(Decoder& decoder) >+ template <class Decoder> static WTF::Optional<MediaTrackConstraintSetMap> decode(Decoder& decoder) > { > MediaTrackConstraintSetMap map; > if (!decoder.decode(map.m_width)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_height)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_sampleRate)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_sampleSize)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(map.m_aspectRatio)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_frameRate)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_volume)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(map.m_echoCancellation)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_displaySurface)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_logicalSurface)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(map.m_facingMode)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_deviceId)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(map.m_groupId)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(map); > } > > private: >- std::optional<IntConstraint> m_width; >- std::optional<IntConstraint> m_height; >- std::optional<IntConstraint> m_sampleRate; >- std::optional<IntConstraint> m_sampleSize; >- >- std::optional<DoubleConstraint> m_aspectRatio; >- std::optional<DoubleConstraint> m_frameRate; >- std::optional<DoubleConstraint> m_volume; >- >- std::optional<BooleanConstraint> m_echoCancellation; >- std::optional<BooleanConstraint> m_displaySurface; >- std::optional<BooleanConstraint> m_logicalSurface; >- >- std::optional<StringConstraint> m_facingMode; >- std::optional<StringConstraint> m_deviceId; >- std::optional<StringConstraint> m_groupId; >+ WTF::Optional<IntConstraint> m_width; >+ WTF::Optional<IntConstraint> m_height; >+ WTF::Optional<IntConstraint> m_sampleRate; >+ WTF::Optional<IntConstraint> m_sampleSize; >+ >+ WTF::Optional<DoubleConstraint> m_aspectRatio; >+ WTF::Optional<DoubleConstraint> m_frameRate; >+ WTF::Optional<DoubleConstraint> m_volume; >+ >+ WTF::Optional<BooleanConstraint> m_echoCancellation; >+ WTF::Optional<BooleanConstraint> m_displaySurface; >+ WTF::Optional<BooleanConstraint> m_logicalSurface; >+ >+ WTF::Optional<StringConstraint> m_facingMode; >+ WTF::Optional<StringConstraint> m_deviceId; >+ WTF::Optional<StringConstraint> m_groupId; > }; > > class FlattenedConstraint { >diff --git a/Source/WebCore/platform/mediastream/MediaStreamRequest.h b/Source/WebCore/platform/mediastream/MediaStreamRequest.h >index d927d7627abd07f428daa4d345c4d276bf81958c..2a06a176adafd8aee01fbe0f591e77575ba1b4fa 100644 >--- a/Source/WebCore/platform/mediastream/MediaStreamRequest.h >+++ b/Source/WebCore/platform/mediastream/MediaStreamRequest.h >@@ -45,13 +45,13 @@ struct MediaStreamRequest { > encoder << videoConstraints; > } > >- template <class Decoder> static std::optional<MediaStreamRequest> decode(Decoder& decoder) >+ template <class Decoder> static WTF::Optional<MediaStreamRequest> decode(Decoder& decoder) > { > MediaStreamRequest request; > if (decoder.decodeEnum(request.type) && decoder.decode(request.audioConstraints) && decoder.decode(request.videoConstraints)) > return WTFMove(request); > >- return std::nullopt; >+ return WTF::nullopt; > } > }; > >diff --git a/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h b/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h >index ddc16ef31a77b5573b877625135dd76d38ec5726..24a8c276db859c263dcec8d47590099b71fcb23f 100644 >--- a/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h >+++ b/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h >@@ -33,12 +33,12 @@ > namespace WebCore { > > struct RTCDataChannelInit { >- std::optional<bool> ordered; >- std::optional<unsigned short> maxPacketLifeTime; >- std::optional<unsigned short> maxRetransmits; >+ WTF::Optional<bool> ordered; >+ WTF::Optional<unsigned short> maxPacketLifeTime; >+ WTF::Optional<unsigned short> maxRetransmits; > String protocol; >- std::optional<bool> negotiated; >- std::optional<unsigned short> id; >+ WTF::Optional<bool> negotiated; >+ WTF::Optional<unsigned short> id; > }; > > class RTCDataChannelHandlerClient; >diff --git a/Source/WebCore/platform/mediastream/RTCRtpCapabilities.h b/Source/WebCore/platform/mediastream/RTCRtpCapabilities.h >index 3fa66447e4a4cb4e6fd4e0577bb4b91ad47c83aa..bd216c79ef28de72809162d204655d599c7c60fb 100644 >--- a/Source/WebCore/platform/mediastream/RTCRtpCapabilities.h >+++ b/Source/WebCore/platform/mediastream/RTCRtpCapabilities.h >@@ -35,7 +35,7 @@ struct RTCRtpCapabilities { > struct CodecCapability { > String mimeType; > uint32_t clockRate { 0 }; >- std::optional<uint16_t> channels; >+ WTF::Optional<uint16_t> channels; > String sdpFmtpLine; > }; > struct HeaderExtensionCapability { >diff --git a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >index d4115b26b63edc33493594ef79b2ca45c63b6725..907b9b6182ca2bdf78bd0dfcd7d92f9ac28860a2 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >@@ -101,7 +101,7 @@ const RealtimeMediaSourceSettings& RealtimeIncomingVideoSource::settings() > void RealtimeIncomingVideoSource::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag> settings) > { > if (settings.containsAny({ RealtimeMediaSourceSettings::Flag::Width, RealtimeMediaSourceSettings::Flag::Height })) >- m_currentSettings = std::nullopt; >+ m_currentSettings = WTF::nullopt; > } > > } // namespace WebCore >diff --git a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h >index 2da1a8035069156257d0eaa9e82d79361d876054..59c74572501c1b06361e7ca1ac269f26604bf5af 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h >@@ -71,7 +71,7 @@ private: > > bool isIncomingVideoSource() const final { return true; } > >- std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > rtc::scoped_refptr<webrtc::VideoTrackInterface> m_videoTrack; > }; > >diff --git a/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp b/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp >index 3bac9336a4eb7a4b6c8962d53357ee40969eb4c2..fa5cae70e6ab360e06caa7c21882fb116f5b5431 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp >@@ -228,13 +228,13 @@ void RealtimeMediaSource::captureFailed() > }); > } > >-bool RealtimeMediaSource::supportsSizeAndFrameRate(std::optional<int>, std::optional<int>, std::optional<double>) >+bool RealtimeMediaSource::supportsSizeAndFrameRate(WTF::Optional<int>, WTF::Optional<int>, WTF::Optional<double>) > { > // The size and frame rate are within the capability limits, so they are supported. > return true; > } > >-bool RealtimeMediaSource::supportsSizeAndFrameRate(std::optional<IntConstraint> widthConstraint, std::optional<IntConstraint> heightConstraint, std::optional<DoubleConstraint> frameRateConstraint, String& badConstraint, double& distance) >+bool RealtimeMediaSource::supportsSizeAndFrameRate(WTF::Optional<IntConstraint> widthConstraint, WTF::Optional<IntConstraint> heightConstraint, WTF::Optional<DoubleConstraint> frameRateConstraint, String& badConstraint, double& distance) > { > if (!widthConstraint && !heightConstraint && !frameRateConstraint) > return true; >@@ -243,7 +243,7 @@ bool RealtimeMediaSource::supportsSizeAndFrameRate(std::optional<IntConstraint> > > distance = std::numeric_limits<double>::infinity(); > >- std::optional<int> width; >+ WTF::Optional<int> width; > if (widthConstraint && capabilities.supportsWidth()) { > double constraintDistance = fitnessDistance(*widthConstraint); > if (std::isinf(constraintDistance)) { >@@ -258,7 +258,7 @@ bool RealtimeMediaSource::supportsSizeAndFrameRate(std::optional<IntConstraint> > } > } > >- std::optional<int> height; >+ WTF::Optional<int> height; > if (heightConstraint && capabilities.supportsHeight()) { > double constraintDistance = fitnessDistance(*heightConstraint); > if (std::isinf(constraintDistance)) { >@@ -273,7 +273,7 @@ bool RealtimeMediaSource::supportsSizeAndFrameRate(std::optional<IntConstraint> > } > } > >- std::optional<double> frameRate; >+ WTF::Optional<double> frameRate; > if (frameRateConstraint && capabilities.supportsFrameRate()) { > double constraintDistance = fitnessDistance(*frameRateConstraint); > if (std::isinf(constraintDistance)) { >@@ -433,7 +433,7 @@ double RealtimeMediaSource::fitnessDistance(const MediaConstraint& constraint) > } > > template <typename ValueType> >-static void applyNumericConstraint(const NumericConstraint<ValueType>& constraint, ValueType current, std::optional<Vector<ValueType>> discreteCapabilityValues, ValueType capabilityMin, ValueType capabilityMax, RealtimeMediaSource& source, void (RealtimeMediaSource::*applier)(ValueType)) >+static void applyNumericConstraint(const NumericConstraint<ValueType>& constraint, ValueType current, WTF::Optional<Vector<ValueType>> discreteCapabilityValues, ValueType capabilityMin, ValueType capabilityMax, RealtimeMediaSource& source, void (RealtimeMediaSource::*applier)(ValueType)) > { > if (discreteCapabilityValues) { > int value = constraint.valueForDiscreteCapabilityValues(current, *discreteCapabilityValues); >@@ -447,7 +447,7 @@ static void applyNumericConstraint(const NumericConstraint<ValueType>& constrain > (source.*applier)(value); > } > >-void RealtimeMediaSource::setSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double> frameRate) >+void RealtimeMediaSource::setSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double> frameRate) > { > IntSize size; > if (width) >@@ -798,7 +798,7 @@ void RealtimeMediaSource::applyConstraints(const FlattenedConstraint& constraint > > auto& capabilities = this->capabilities(); > >- std::optional<int> width; >+ WTF::Optional<int> width; > if (const MediaConstraint* constraint = constraints.find(MediaConstraintType::Width)) { > ASSERT(constraint->isInt()); > if (capabilities.supportsWidth()) { >@@ -807,7 +807,7 @@ void RealtimeMediaSource::applyConstraints(const FlattenedConstraint& constraint > } > } > >- std::optional<int> height; >+ WTF::Optional<int> height; > if (const MediaConstraint* constraint = constraints.find(MediaConstraintType::Height)) { > ASSERT(constraint->isInt()); > if (capabilities.supportsHeight()) { >@@ -816,7 +816,7 @@ void RealtimeMediaSource::applyConstraints(const FlattenedConstraint& constraint > } > } > >- std::optional<double> frameRate; >+ WTF::Optional<double> frameRate; > if (const MediaConstraint* constraint = constraints.find(MediaConstraintType::FrameRate)) { > ASSERT(constraint->isDouble()); > if (capabilities.supportsFrameRate()) { >@@ -838,7 +838,7 @@ void RealtimeMediaSource::applyConstraints(const FlattenedConstraint& constraint > commitConfiguration(); > } > >-std::optional<std::pair<String, String>> RealtimeMediaSource::applyConstraints(const MediaConstraints& constraints) >+WTF::Optional<std::pair<String, String>> RealtimeMediaSource::applyConstraints(const MediaConstraints& constraints) > { > ASSERT(constraints.isValid); > >@@ -848,7 +848,7 @@ std::optional<std::pair<String, String>> RealtimeMediaSource::applyConstraints(c > return { { failedConstraint, "Constraint not supported"_s } }; > > applyConstraints(candidates); >- return std::nullopt; >+ return WTF::nullopt; > } > > void RealtimeMediaSource::applyConstraints(const MediaConstraints& constraints, SuccessHandler&& successHandler, FailureHandler&& failureHandler) >@@ -945,9 +945,9 @@ void RealtimeMediaSource::setSampleRate(int rate) > notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::SampleRate); > } > >-std::optional<Vector<int>> RealtimeMediaSource::discreteSampleRates() const >+WTF::Optional<Vector<int>> RealtimeMediaSource::discreteSampleRates() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > > void RealtimeMediaSource::setSampleSize(int size) >@@ -959,9 +959,9 @@ void RealtimeMediaSource::setSampleSize(int size) > notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::SampleSize); > } > >-std::optional<Vector<int>> RealtimeMediaSource::discreteSampleSizes() const >+WTF::Optional<Vector<int>> RealtimeMediaSource::discreteSampleSizes() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > > void RealtimeMediaSource::setEchoCancellation(bool echoCancellation) >diff --git a/Source/WebCore/platform/mediastream/RealtimeMediaSource.h b/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >index 6de176298a3dc8aa5bd22e7f5bcba175d49aa441..cf094a85311f74da593a063c123f6f2319bf3943 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >@@ -138,11 +138,11 @@ public: > > int sampleRate() const { return m_sampleRate; } > void setSampleRate(int); >- virtual std::optional<Vector<int>> discreteSampleRates() const; >+ virtual WTF::Optional<Vector<int>> discreteSampleRates() const; > > int sampleSize() const { return m_sampleSize; } > void setSampleSize(int); >- virtual std::optional<Vector<int>> discreteSampleSizes() const; >+ virtual WTF::Optional<Vector<int>> discreteSampleSizes() const; > > bool echoCancellation() const { return m_echoCancellation; } > void setEchoCancellation(bool); >@@ -153,7 +153,7 @@ public: > using SuccessHandler = WTF::Function<void()>; > using FailureHandler = WTF::Function<void(const String& badConstraint, const String& errorString)>; > virtual void applyConstraints(const MediaConstraints&, SuccessHandler&&, FailureHandler&&); >- std::optional<std::pair<String, String>> applyConstraints(const MediaConstraints&); >+ WTF::Optional<std::pair<String, String>> applyConstraints(const MediaConstraints&); > > bool supportsConstraints(const MediaConstraints&, String&); > bool supportsConstraint(const MediaConstraint&); >@@ -189,10 +189,10 @@ protected: > double fitnessDistance(const MediaConstraint&); > void applyConstraint(const MediaConstraint&); > void applyConstraints(const FlattenedConstraint&); >- bool supportsSizeAndFrameRate(std::optional<IntConstraint> width, std::optional<IntConstraint> height, std::optional<DoubleConstraint>, String&, double& fitnessDistance); >+ bool supportsSizeAndFrameRate(WTF::Optional<IntConstraint> width, WTF::Optional<IntConstraint> height, WTF::Optional<DoubleConstraint>, String&, double& fitnessDistance); > >- virtual bool supportsSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double>); >- virtual void setSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double>); >+ virtual bool supportsSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double>); >+ virtual void setSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double>); > > void notifyMutedObservers() const; > void notifyMutedChange(bool muted); >diff --git a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >index a1b1e9832aa473fb5c4d372fbd6409ce36cd6c93..699451c295b1f7a9f06d3ce00020b7c0c28564dc 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >@@ -112,7 +112,7 @@ private: > void trackEnded(MediaStreamTrackPrivate&) final { } > > Ref<MediaStreamTrackPrivate> m_videoSource; >- std::optional<RealtimeMediaSourceSettings> m_initialSettings; >+ WTF::Optional<RealtimeMediaSourceSettings> m_initialSettings; > Timer m_blackFrameTimer; > rtc::scoped_refptr<webrtc::VideoFrameBuffer> m_blackFrame; > >diff --git a/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp b/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >index 90ac7dc6b609a309ce016a398f727249ee57990b..74ce12fd1b69c58427da28aedb6a556af2a661da 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >@@ -191,7 +191,7 @@ void RealtimeVideoSource::updateCapabilities(RealtimeMediaSourceCapabilities& ca > capabilities.setFrameRate({ minimumFrameRate, maximumFrameRate }); > } > >-bool RealtimeVideoSource::supportsSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double> frameRate) >+bool RealtimeVideoSource::supportsSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double> frameRate) > { > if (!width && !height && !frameRate) > return true; >@@ -215,7 +215,7 @@ bool RealtimeVideoSource::presetSupportsFrameRate(RefPtr<VideoPreset> preset, do > return false; > } > >-bool RealtimeVideoSource::supportsCaptureSize(std::optional<int> width, std::optional<int> height, const Function<bool(const IntSize&)>&& function) >+bool RealtimeVideoSource::supportsCaptureSize(WTF::Optional<int> width, WTF::Optional<int> height, const Function<bool(const IntSize&)>&& function) > { > if (width && height) > return function({ width.value(), height.value() }); >@@ -242,7 +242,7 @@ bool RealtimeVideoSource::shouldUsePreset(VideoPreset& current, VideoPreset& can > return candidate.size.width() <= current.size.width() && candidate.size.height() <= current.size.height() && prefersPreset(candidate); > } > >-std::optional<RealtimeVideoSource::CaptureSizeAndFrameRate> RealtimeVideoSource::bestSupportedSizeAndFrameRate(std::optional<int> requestedWidth, std::optional<int> requestedHeight, std::optional<double> requestedFrameRate) >+WTF::Optional<RealtimeVideoSource::CaptureSizeAndFrameRate> RealtimeVideoSource::bestSupportedSizeAndFrameRate(WTF::Optional<int> requestedWidth, WTF::Optional<int> requestedHeight, WTF::Optional<double> requestedFrameRate) > { > if (!requestedWidth && !requestedHeight && !requestedFrameRate) > return { }; >@@ -350,9 +350,9 @@ std::optional<RealtimeVideoSource::CaptureSizeAndFrameRate> RealtimeVideoSource: > return result; > } > >-void RealtimeVideoSource::setSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double> frameRate) >+void RealtimeVideoSource::setSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double> frameRate) > { >- std::optional<RealtimeVideoSource::CaptureSizeAndFrameRate> match; >+ WTF::Optional<RealtimeVideoSource::CaptureSizeAndFrameRate> match; > > auto size = this->size(); > if (!width && !height && !size.isEmpty()) { >diff --git a/Source/WebCore/platform/mediastream/RealtimeVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >index 84268ab666e39d7705d8088dcac853d551e6fad9..24d3747db4476906ed6745d43fac2d48c1aa0db9 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >@@ -47,8 +47,8 @@ protected: > RealtimeVideoSource(String&& name, String&& id, String&& hashSalt); > > void prepareToProduceData(); >- bool supportsSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double>) override; >- void setSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double>) override; >+ bool supportsSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double>) override; >+ void setSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double>) override; > > virtual void generatePresets() = 0; > virtual bool prefersPreset(VideoPreset&) { return true; } >@@ -77,8 +77,8 @@ private: > IntSize requestedSize; > double requestedFrameRate { 0 }; > }; >- bool supportsCaptureSize(std::optional<int>, std::optional<int>, const Function<bool(const IntSize&)>&&); >- std::optional<CaptureSizeAndFrameRate> bestSupportedSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double>); >+ bool supportsCaptureSize(WTF::Optional<int>, WTF::Optional<int>, const Function<bool(const IntSize&)>&&); >+ WTF::Optional<CaptureSizeAndFrameRate> bestSupportedSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double>); > bool presetSupportsFrameRate(RefPtr<VideoPreset>, double); > > Vector<Ref<VideoPreset>> m_presets; >diff --git a/Source/WebCore/platform/mediastream/VideoPreset.h b/Source/WebCore/platform/mediastream/VideoPreset.h >index 40702c8e4d3d4dcbe6168cb54fe18a004fcc673b..dcf2b9403a18f23a30794e7e619e1aa1ffd23945 100644 >--- a/Source/WebCore/platform/mediastream/VideoPreset.h >+++ b/Source/WebCore/platform/mediastream/VideoPreset.h >@@ -41,7 +41,7 @@ struct FrameRateRange { > double maximum; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<FrameRateRange> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<FrameRateRange> decode(Decoder&); > }; > > template<class Encoder> >@@ -52,17 +52,17 @@ void FrameRateRange::encode(Encoder& encoder) const > } > > template <class Decoder> >-std::optional<FrameRateRange> FrameRateRange::decode(Decoder& decoder) >+WTF::Optional<FrameRateRange> FrameRateRange::decode(Decoder& decoder) > { >- std::optional<double> minimum; >+ WTF::Optional<double> minimum; > decoder >> minimum; > if (!minimum) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<double> maximum; >+ WTF::Optional<double> maximum; > decoder >> maximum; > if (!maximum) >- return std::nullopt; >+ return WTF::nullopt; > > return FrameRateRange { *minimum, *maximum }; > } >@@ -72,7 +72,7 @@ struct VideoPresetData { > Vector<FrameRateRange> frameRateRanges; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<VideoPresetData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<VideoPresetData> decode(Decoder&); > }; > > template<class Encoder> >@@ -83,17 +83,17 @@ void VideoPresetData::encode(Encoder& encoder) const > } > > template <class Decoder> >-std::optional<VideoPresetData> VideoPresetData::decode(Decoder& decoder) >+WTF::Optional<VideoPresetData> VideoPresetData::decode(Decoder& decoder) > { >- std::optional<IntSize> size; >+ WTF::Optional<IntSize> size; > decoder >> size; > if (!size) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<FrameRateRange>> frameRateRanges; >+ WTF::Optional<Vector<FrameRateRange>> frameRateRanges; > decoder >> frameRateRanges; > if (!frameRateRanges) >- return std::nullopt; >+ return WTF::nullopt; > > return VideoPresetData { *size, *frameRateRanges }; > } >diff --git a/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h b/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h >index fa34194da2e35cde0a1fedede9feee64d6d8ffd0..9e6530b94534c2ff08b2952d5ef246c236a157b3 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h >@@ -46,8 +46,8 @@ protected: > void startProducingData() override; > void stopProducingData() override; > >- mutable std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >- mutable std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ mutable WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ mutable WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > > private: > bool isCaptureSource() const final { return true; } >diff --git a/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp b/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp >index c7cf33b8bd6d924b38182cdf485a03fdd2292224..31e1a87be19fbf9a8aa532ce2d01eadb2548193f 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp >+++ b/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp >@@ -66,7 +66,7 @@ GStreamerDisplayCaptureDeviceManager& GStreamerDisplayCaptureDeviceManager::sing > return manager; > } > >-std::optional<GStreamerCaptureDevice> GStreamerCaptureDeviceManager::gstreamerDeviceWithUID(const String& deviceID) >+WTF::Optional<GStreamerCaptureDevice> GStreamerCaptureDeviceManager::gstreamerDeviceWithUID(const String& deviceID) > { > captureDevices(); > >@@ -74,7 +74,7 @@ std::optional<GStreamerCaptureDevice> GStreamerCaptureDeviceManager::gstreamerDe > if (device.persistentId() == deviceID) > return device; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > const Vector<CaptureDevice>& GStreamerCaptureDeviceManager::captureDevices() >diff --git a/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h b/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h >index ce11c4f3a8c3ff156a85ecad3232c85f079671f9..03f196411dc027f174bf7cbde6028a2ca09c9f2d 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h >+++ b/Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h >@@ -32,7 +32,7 @@ namespace WebCore { > > class GStreamerCaptureDeviceManager : public CaptureDeviceManager { > public: >- std::optional<GStreamerCaptureDevice> gstreamerDeviceWithUID(const String&); >+ WTF::Optional<GStreamerCaptureDevice> gstreamerDeviceWithUID(const String&); > > const Vector<CaptureDevice>& captureDevices() final; > virtual CaptureDevice::DeviceType deviceType() = 0; >diff --git a/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h b/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h >index c9fa15a621bd7f144bfe1344ae011056c01f050f..ac26c64ff79e4c63bb140fa9832c454fb3333fdb 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h >@@ -50,8 +50,8 @@ protected: > void generatePresets() final; > > >- mutable std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >- mutable std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ mutable WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ mutable WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > > private: > static GstFlowReturn newSampleCallback(GstElement*, GStreamerVideoCaptureSource*); >diff --git a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp >index 16bb68cb64ac5c878100c6df296a6054113aacaa..a4797fe8ab63c61c5dec5025a7c8d318c9a63a82 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp >+++ b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp >@@ -123,7 +123,7 @@ public: > } > > GRefPtr<GstElement> m_src; >- std::optional<GStreamerAudioStreamDescription> m_streamFormat; >+ WTF::Optional<GStreamerAudioStreamDescription> m_streamFormat; > Vector<float> m_bipBopBuffer; > uint32_t m_maximiumFrameCount; > uint64_t m_samplesEmitted { 0 }; >@@ -141,7 +141,7 @@ CaptureSourceOrError MockRealtimeAudioSource::create(String&& deviceID, > return CaptureSourceOrError(WTFMove(source)); > } > >-std::optional<std::pair<String, String>> MockGStreamerAudioCaptureSource::applyConstraints(const MediaConstraints& constraints) >+WTF::Optional<std::pair<String, String>> MockGStreamerAudioCaptureSource::applyConstraints(const MediaConstraints& constraints) > { > m_wrappedSource->applyConstraints(constraints); > return GStreamerAudioCaptureSource::applyConstraints(constraints); >diff --git a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h >index 8a4bbe85f377de67064a908eb4161562fa4d67fb..a97f030b29ed9a703a695bf6335ba7d11e0223b8 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h >@@ -31,7 +31,7 @@ class MockGStreamerAudioCaptureSource final : public GStreamerAudioCaptureSource > public: > MockGStreamerAudioCaptureSource(String&& deviceID, String&& name, String&& hashSalt); > ~MockGStreamerAudioCaptureSource(); >- std::optional<std::pair<String, String>> applyConstraints(const MediaConstraints&); >+ WTF::Optional<std::pair<String, String>> applyConstraints(const MediaConstraints&); > void applyConstraints(const MediaConstraints&, SuccessHandler&&, FailureHandler&&) final; > > private: >diff --git a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp >index cb30696609dbd88f862f0beab6a99fdf26a89ef5..fe8545a507df414aae75efc8e3d332fa688a59b1 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp >+++ b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp >@@ -107,7 +107,7 @@ MockGStreamerVideoCaptureSource::~MockGStreamerVideoCaptureSource() > m_wrappedSource->removeObserver(*this); > } > >-std::optional<std::pair<String, String>> MockGStreamerVideoCaptureSource::applyConstraints(const MediaConstraints& constraints) >+WTF::Optional<std::pair<String, String>> MockGStreamerVideoCaptureSource::applyConstraints(const MediaConstraints& constraints) > { > m_wrappedSource->applyConstraints(constraints); > return GStreamerVideoCaptureSource::applyConstraints(constraints); >diff --git a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h >index c2486323b31a3ee5fd44614911d88b6da3cef958..7da0c9c8cd4af50db22a68e390e72bf321b0902a 100644 >--- a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h >@@ -36,7 +36,7 @@ class MockGStreamerVideoCaptureSource final : public GStreamerVideoCaptureSource > public: > MockGStreamerVideoCaptureSource(String&& deviceID, String&& name, String&& hashSalt); > ~MockGStreamerVideoCaptureSource(); >- std::optional<std::pair<String, String>> applyConstraints(const MediaConstraints&); >+ WTF::Optional<std::pair<String, String>> applyConstraints(const MediaConstraints&); > void applyConstraints(const MediaConstraints&, SuccessHandler&&, FailureHandler&&) final; > > private: >diff --git a/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h b/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h >index 00d76dd9a1245eeafcf3aa4eed36e232bd2c1495..309f7a1078cbbe30a8ba4dfecc3b324ecda5fc80 100644 >--- a/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h >+++ b/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h >@@ -45,10 +45,10 @@ public: > static AVAudioSessionCaptureDeviceManager& singleton(); > > const Vector<CaptureDevice>& captureDevices() final; >- std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); >+ WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); > > Vector<AVAudioSessionCaptureDevice>& audioSessionCaptureDevices(); >- std::optional<AVAudioSessionCaptureDevice> audioSessionDeviceWithUID(const String&); >+ WTF::Optional<AVAudioSessionCaptureDevice> audioSessionDeviceWithUID(const String&); > > private: > AVAudioSessionCaptureDeviceManager() = default; >@@ -56,8 +56,8 @@ private: > > void refreshAudioCaptureDevices(); > >- std::optional<Vector<CaptureDevice>> m_devices; >- std::optional<Vector<AVAudioSessionCaptureDevice>> m_audioSessionCaptureDevices; >+ WTF::Optional<Vector<CaptureDevice>> m_devices; >+ WTF::Optional<Vector<AVAudioSessionCaptureDevice>> m_audioSessionCaptureDevices; > RetainPtr<WebAVAudioSessionAvailableInputsListener> m_listener; > }; > >diff --git a/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm b/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm >index 2b35b33c27c5702b1b6635aa60b252cf11295d60..f7694c61ac50815ef2e8e077a7ab8e3a30298b1f 100644 >--- a/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm >+++ b/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm >@@ -92,14 +92,14 @@ const Vector<CaptureDevice>& AVAudioSessionCaptureDeviceManager::captureDevices( > return m_devices.value(); > } > >-std::optional<CaptureDevice> AVAudioSessionCaptureDeviceManager::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& deviceID) >+WTF::Optional<CaptureDevice> AVAudioSessionCaptureDeviceManager::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& deviceID) > { > ASSERT_UNUSED(type, type == CaptureDevice::DeviceType::Microphone); > for (auto& device : captureDevices()) { > if (device.persistentId() == deviceID) > return device; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > Vector<AVAudioSessionCaptureDevice>& AVAudioSessionCaptureDeviceManager::audioSessionCaptureDevices() >@@ -109,7 +109,7 @@ Vector<AVAudioSessionCaptureDevice>& AVAudioSessionCaptureDeviceManager::audioSe > return m_audioSessionCaptureDevices.value(); > } > >-std::optional<AVAudioSessionCaptureDevice> AVAudioSessionCaptureDeviceManager::audioSessionDeviceWithUID(const String& deviceID) >+WTF::Optional<AVAudioSessionCaptureDevice> AVAudioSessionCaptureDeviceManager::audioSessionDeviceWithUID(const String& deviceID) > { > if (!m_audioSessionCaptureDevices) > refreshAudioCaptureDevices(); >@@ -118,7 +118,7 @@ std::optional<AVAudioSessionCaptureDevice> AVAudioSessionCaptureDeviceManager::a > if (device.persistentId() == deviceID) > return device; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > void AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices() >diff --git a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp >index c24dc0799d14052b7025aaa515fce807bf9bad1c..74b53d5daf69674961e7a89be83ad2750eda9b39 100644 >--- a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp >+++ b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp >@@ -287,7 +287,7 @@ rtc::RTCCertificateGenerator& LibWebRTCProvider::certificateGenerator() > return *factoryAndThreads.certificateGenerator; > } > >-static inline std::optional<cricket::MediaType> typeFromKind(const String& kind) >+static inline WTF::Optional<cricket::MediaType> typeFromKind(const String& kind) > { > if (kind == "audio"_s) > return cricket::MediaType::MEDIA_TYPE_AUDIO; >@@ -301,7 +301,7 @@ static inline String fromStdString(const std::string& value) > return String::fromUTF8(value.data(), value.length()); > } > >-static inline std::optional<uint16_t> toChannels(absl::optional<int> numChannels) >+static inline WTF::Optional<uint16_t> toChannels(absl::optional<int> numChannels) > { > if (!numChannels) > return { }; >@@ -323,7 +323,7 @@ static inline RTCRtpCapabilities toRTCRtpCapabilities(const webrtc::RtpCapabilit > return capabilities; > } > >-std::optional<RTCRtpCapabilities> LibWebRTCProvider::receiverCapabilities(const String& kind) >+WTF::Optional<RTCRtpCapabilities> LibWebRTCProvider::receiverCapabilities(const String& kind) > { > auto mediaType = typeFromKind(kind); > if (!mediaType) >@@ -336,7 +336,7 @@ std::optional<RTCRtpCapabilities> LibWebRTCProvider::receiverCapabilities(const > return toRTCRtpCapabilities(factory->GetRtpReceiverCapabilities(*mediaType)); > } > >-std::optional<RTCRtpCapabilities> LibWebRTCProvider::senderCapabilities(const String& kind) >+WTF::Optional<RTCRtpCapabilities> LibWebRTCProvider::senderCapabilities(const String& kind) > { > auto mediaType = typeFromKind(kind); > if (!mediaType) >diff --git a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h >index c2494275df285ffd4735e748974eb9cfcb7960cc..7b3f9d902ab068aac406209e9c985df31921e31c 100644 >--- a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h >+++ b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h >@@ -110,8 +110,8 @@ public: > > rtc::RTCCertificateGenerator& certificateGenerator(); > >- std::optional<RTCRtpCapabilities> receiverCapabilities(const String& kind); >- std::optional<RTCRtpCapabilities> senderCapabilities(const String& kind); >+ WTF::Optional<RTCRtpCapabilities> receiverCapabilities(const String& kind); >+ WTF::Optional<RTCRtpCapabilities> senderCapabilities(const String& kind); > > protected: > LibWebRTCProvider() = default; >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >index a83d6618635ec815f61a9be2e52ca25f4ccb94d8..b8e75f8d8661d1bf4c0f8044a2feca0d3107bbd5 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >@@ -114,8 +114,8 @@ private: > int m_deviceOrientation { 0 }; > MediaSample::VideoRotation m_sampleRotation { MediaSample::VideoRotation::None }; > >- std::optional<RealtimeMediaSourceSettings> m_currentSettings; >- std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; >+ WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; > RetainPtr<WebCoreAVVideoCaptureSourceObserver> m_objcObserver; > RetainPtr<AVCaptureSession> m_session; > RetainPtr<AVCaptureDevice> m_device; >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >index 9410587736c69c9dcf1de146d5feb8dcfd8c80b5..24871011a6c6138d7facfa361f6dc3a9ab9a653f 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm >@@ -239,7 +239,7 @@ void AVVideoCaptureSource::commitConfiguration() > > void AVVideoCaptureSource::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) > { >- m_currentSettings = std::nullopt; >+ m_currentSettings = WTF::nullopt; > } > > const RealtimeMediaSourceSettings& AVVideoCaptureSource::settings() >diff --git a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.cpp b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.cpp >index 0e6338fa2319dbaf81a4232941fbb68b86bb375e..b4c274f66b90c6350d3d709f90ef717a66ebb4a7 100644 >--- a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.cpp >+++ b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.cpp >@@ -65,12 +65,12 @@ static bool getDeviceInfo(uint32_t deviceID, String& persistentID, String& label > return true; > } > >-std::optional<CoreAudioCaptureDevice> CoreAudioCaptureDevice::create(uint32_t deviceID) >+WTF::Optional<CoreAudioCaptureDevice> CoreAudioCaptureDevice::create(uint32_t deviceID) > { > String persistentID; > String label; > if (!getDeviceInfo(deviceID, persistentID, label)) >- return std::nullopt; >+ return WTF::nullopt; > > return CoreAudioCaptureDevice(deviceID, persistentID, label); > } >diff --git a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.h b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.h >index f8f9bb39a4bfd49462dc2b2eda83379b96667a5e..0385eb567725b3164eac5c8e2755685151ded8f3 100644 >--- a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.h >+++ b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.h >@@ -38,7 +38,7 @@ namespace WebCore { > class CoreAudioCaptureDevice : public CaptureDevice { > public: > >- static std::optional<CoreAudioCaptureDevice> create(uint32_t); >+ static WTF::Optional<CoreAudioCaptureDevice> create(uint32_t); > virtual ~CoreAudioCaptureDevice() = default; > > uint32_t deviceID() const { return m_deviceID; } >diff --git a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp >index 1111eab0320f41be16b308fb70843443bef4e941..611417326bcef90277872be23ff2174013f205b6 100644 >--- a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp >+++ b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp >@@ -52,14 +52,14 @@ const Vector<CaptureDevice>& CoreAudioCaptureDeviceManager::captureDevices() > return m_devices; > } > >-std::optional<CaptureDevice> CoreAudioCaptureDeviceManager::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& deviceID) >+WTF::Optional<CaptureDevice> CoreAudioCaptureDeviceManager::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& deviceID) > { > ASSERT_UNUSED(type, type == CaptureDevice::DeviceType::Microphone); > for (auto& device : captureDevices()) { > if (device.persistentId() == deviceID) > return device; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > static bool deviceHasInputStreams(AudioObjectID deviceID) >@@ -100,13 +100,13 @@ Vector<CoreAudioCaptureDevice>& CoreAudioCaptureDeviceManager::coreAudioCaptureD > return m_coreAudioCaptureDevices; > } > >-std::optional<CoreAudioCaptureDevice> CoreAudioCaptureDeviceManager::coreAudioDeviceWithUID(const String& deviceID) >+WTF::Optional<CoreAudioCaptureDevice> CoreAudioCaptureDeviceManager::coreAudioDeviceWithUID(const String& deviceID) > { > for (auto& device : coreAudioCaptureDevices()) { > if (device.persistentId() == deviceID) > return device; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > >diff --git a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h >index cf48276414b242aafa486d9250375c8814cc1b9f..9da5f136968915c905e3a60a9ec3b8ee4d0bd9ad 100644 >--- a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h >+++ b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h >@@ -44,9 +44,9 @@ public: > static CoreAudioCaptureDeviceManager& singleton(); > > const Vector<CaptureDevice>& captureDevices() final; >- std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); >+ WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); > >- std::optional<CoreAudioCaptureDevice> coreAudioDeviceWithUID(const String&); >+ WTF::Optional<CoreAudioCaptureDevice> coreAudioDeviceWithUID(const String&); > > private: > CoreAudioCaptureDeviceManager() = default; >diff --git a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp >index 72be7307bab19c718ef41a1535c0d32dec728aa7..453f1c2e4ba5b06d44946778e7458a380ebb323b 100644 >--- a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp >+++ b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp >@@ -153,7 +153,7 @@ private: > int32_t m_producingCount { 0 }; > > mutable std::unique_ptr<RealtimeMediaSourceCapabilities> m_capabilities; >- mutable std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ mutable WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > > #if !LOG_DISABLED > void checkTimestamps(const AudioTimeStamp&, uint64_t, double); >@@ -896,7 +896,7 @@ void CoreAudioCaptureSource::settingsDidChange(OptionSet<RealtimeMediaSourceSett > scheduleReconfiguration(); > } > >- m_currentSettings = std::nullopt; >+ m_currentSettings = WTF::nullopt; > } > > void CoreAudioCaptureSource::scheduleReconfiguration() >diff --git a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h >index 84a634fdbaee8ce19a74453df5beebf87450cb32..3bee5515bb71c62bb58d8317a577290e904d814f 100644 >--- a/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h >@@ -85,7 +85,7 @@ private: > void startProducingData() final; > void stopProducingData() final; > >- std::optional<Vector<int>> discreteSampleRates() const final { return { { 8000, 16000, 32000, 44100, 48000, 96000 } }; } >+ WTF::Optional<Vector<int>> discreteSampleRates() const final { return { { 8000, 16000, 32000, 44100, 48000, 96000 } }; } > > const RealtimeMediaSourceCapabilities& capabilities() final; > const RealtimeMediaSourceSettings& settings() final; >@@ -95,8 +95,8 @@ private: > > uint32_t m_captureDeviceID { 0 }; > >- std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >- std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > > enum class SuspensionType { None, WhilePaused, WhilePlaying }; > SuspensionType m_suspendType { SuspensionType::None }; >diff --git a/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp b/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp >index 06da625e29c55eb0da1d3593d675fcaa3cef559a..7086cf35ec49e62c50385a52f1281a7e08fdb101 100644 >--- a/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp >+++ b/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp >@@ -72,27 +72,27 @@ void DisplayCaptureManagerCocoa::updateWindowCaptureDevices() > #endif > } > >-std::optional<CaptureDevice> DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID(const String& deviceID) >+WTF::Optional<CaptureDevice> DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID(const String& deviceID) > { > #if PLATFORM(MAC) > return ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID(deviceID); > #else > UNUSED_PARAM(deviceID); >- return std::nullopt; >+ return WTF::nullopt; > #endif > } > >-std::optional<CaptureDevice> DisplayCaptureManagerCocoa::windowCaptureDeviceWithPersistentID(const String& deviceID) >+WTF::Optional<CaptureDevice> DisplayCaptureManagerCocoa::windowCaptureDeviceWithPersistentID(const String& deviceID) > { > #if PLATFORM(MAC) > return WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID(deviceID); > #else > UNUSED_PARAM(deviceID); >- return std::nullopt; >+ return WTF::nullopt; > #endif > } > >-std::optional<CaptureDevice> DisplayCaptureManagerCocoa::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) >+WTF::Optional<CaptureDevice> DisplayCaptureManagerCocoa::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) > { > switch (type) { > case CaptureDevice::DeviceType::Screen: >@@ -114,7 +114,7 @@ std::optional<CaptureDevice> DisplayCaptureManagerCocoa::captureDeviceWithPersis > break; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WebCore >diff --git a/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.h b/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.h >index 28fff40a797137069669048574332d8eb22ef3a3..0d2fabdb0d94900fc200829d68a30252e177c020 100644 >--- a/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.h >+++ b/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.h >@@ -45,9 +45,9 @@ private: > > const Vector<CaptureDevice>& captureDevices() final; > >- std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&) final; >- std::optional<CaptureDevice> screenCaptureDeviceWithPersistentID(const String&); >- std::optional<CaptureDevice> windowCaptureDeviceWithPersistentID(const String&); >+ WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&) final; >+ WTF::Optional<CaptureDevice> screenCaptureDeviceWithPersistentID(const String&); >+ WTF::Optional<CaptureDevice> windowCaptureDeviceWithPersistentID(const String&); > > Vector<CaptureDevice> m_devices; > }; >diff --git a/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h b/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h >index ed79d2cb49117ca87869c0a54f941ef271df3d53..00032efa112656e6472eb16a194ac3b823df413f 100644 >--- a/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h >+++ b/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h >@@ -79,8 +79,8 @@ private: > > void emitFrame(); > >- std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >- std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > RealtimeMediaSourceSupportedConstraints m_supportedConstraints; > > MonotonicTime m_startTime { MonotonicTime::nan() }; >diff --git a/Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.h b/Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.h >index 5208b262a3c0377f6283c30ac2ca8356c42f3dbc..8e4e2968117e32cd43d3f0dfaf67421bb1ae5084 100644 >--- a/Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.h >+++ b/Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.h >@@ -51,7 +51,7 @@ private: > MockRealtimeAudioSourceMac(String&& deviceID, String&& name, String&& hashSalt); > > void settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) final; >- std::optional<Vector<int>> discreteSampleRates() const final { return { { 44100, 48000 } }; } >+ WTF::Optional<Vector<int>> discreteSampleRates() const final { return { { 44100, 48000 } }; } > > void emitSampleBuffers(uint32_t); > void render(Seconds) final; >diff --git a/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h b/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h >index 05ebeae9da3849b3f3aa4bf75eaf9d45b21d6a6a..5f446932cf6ec7663df868de62fad4ae12baba64 100644 >--- a/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h >+++ b/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h >@@ -43,7 +43,7 @@ class ScreenDisplayCaptureSourceMac : public DisplayCaptureSourceCocoa { > public: > static CaptureSourceOrError create(String&&, const MediaConstraints*); > >- static std::optional<CaptureDevice> screenCaptureDeviceWithPersistentID(const String&); >+ static WTF::Optional<CaptureDevice> screenCaptureDeviceWithPersistentID(const String&); > static void screenCaptureDevices(Vector<CaptureDevice>&); > > private: >diff --git a/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm b/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm >index 8200e9019183552a88614e1df53a8fa6e272d729..ec1c53dfa2b7ba28a20ee30e31f7087aec4454bc 100644 >--- a/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm >+++ b/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm >@@ -47,25 +47,25 @@ size_t CGDisplayModeGetPixelsHigh(CGDisplayModeRef); > > namespace WebCore { > >-static std::optional<CGDirectDisplayID> updateDisplayID(CGDirectDisplayID displayID) >+static WTF::Optional<CGDirectDisplayID> updateDisplayID(CGDirectDisplayID displayID) > { > uint32_t displayCount = 0; > auto err = CGGetActiveDisplayList(0, nullptr, &displayCount); > if (err) { > RELEASE_LOG(Media, "CGGetActiveDisplayList() returned error %d when trying to get display count", static_cast<int>(err)); >- return std::nullopt; >+ return WTF::nullopt; > } > > if (!displayCount) { > RELEASE_LOG(Media, "CGGetActiveDisplayList() returned a display count of 0"); >- return std::nullopt; >+ return WTF::nullopt; > } > > CGDirectDisplayID activeDisplays[displayCount]; > err = CGGetActiveDisplayList(displayCount, &(activeDisplays[0]), &displayCount); > if (err) { > RELEASE_LOG(Media, "CGGetActiveDisplayList() returned error %d when trying to get the active display list", static_cast<int>(err)); >- return std::nullopt; >+ return WTF::nullopt; > } > > auto displayMask = CGDisplayIDToOpenGLDisplayMask(displayID); >@@ -74,7 +74,7 @@ static std::optional<CGDirectDisplayID> updateDisplayID(CGDirectDisplayID displa > return display; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > CaptureSourceOrError ScreenDisplayCaptureSourceMac::create(String&& deviceID, const MediaConstraints* constraints) >@@ -277,18 +277,18 @@ void ScreenDisplayCaptureSourceMac::frameAvailable(CGDisplayStreamFrameStatus st > m_currentFrame = frameSurface; > } > >-std::optional<CaptureDevice> ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID(const String& deviceID) >+WTF::Optional<CaptureDevice> ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID(const String& deviceID) > { > bool ok; > auto displayID = deviceID.toUIntStrict(&ok); > if (!ok) { > RELEASE_LOG(Media, "ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID: display ID does not convert to 32-bit integer"); >- return std::nullopt; >+ return WTF::nullopt; > } > > auto actualDisplayID = updateDisplayID(displayID); > if (!actualDisplayID) >- return std::nullopt; >+ return WTF::nullopt; > > auto device = CaptureDevice(String::number(actualDisplayID.value()), CaptureDevice::DeviceType::Screen, "ScreenCaptureDevice"_s); > device.setEnabled(true); >diff --git a/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h b/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h >index 2899ff21a722f17138655ac9a30e6a1a3bdc64e4..53512b226c59d9edf2f5b6ae563188ecd94df1d6 100644 >--- a/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h >+++ b/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h >@@ -69,8 +69,8 @@ private: > void trackEnabledChanged(MediaStreamTrackPrivate&) final { } > > size_t m_listBufferSize { 0 }; >- std::optional<CAAudioStreamDescription> m_inputDescription; >- std::optional<CAAudioStreamDescription> m_outputDescription; >+ WTF::Optional<CAAudioStreamDescription> m_inputDescription; >+ WTF::Optional<CAAudioStreamDescription> m_outputDescription; > RefPtr<AudioSampleDataSource> m_dataSource; > > uint64_t m_writeCount { 0 }; >diff --git a/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm b/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm >index 94efae695ddd292cf8f4214e3c3d04d181638e35..dadf2b5c63857823e50223ab17dcf6ba4fd17f76 100644 >--- a/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm >+++ b/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm >@@ -149,8 +149,8 @@ void WebAudioSourceProviderAVFObjC::unprepare() > { > std::lock_guard<Lock> lock(m_mutex); > >- m_inputDescription = std::nullopt; >- m_outputDescription = std::nullopt; >+ m_inputDescription = WTF::nullopt; >+ m_outputDescription = WTF::nullopt; > m_dataSource = nullptr; > m_listBufferSize = 0; > if (m_captureSource) { >diff --git a/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h b/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h >index 2d1a66e0312badca89d9bcf0b8066ed432db2d56..ea0828fc93407f612dd07e06e6fafc7af19f6422 100644 >--- a/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h >+++ b/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h >@@ -42,7 +42,7 @@ class WindowDisplayCaptureSourceMac : public DisplayCaptureSourceCocoa { > public: > static CaptureSourceOrError create(String&&, const MediaConstraints*); > >- static std::optional<CaptureDevice> windowCaptureDeviceWithPersistentID(const String&); >+ static WTF::Optional<CaptureDevice> windowCaptureDeviceWithPersistentID(const String&); > static void windowCaptureDevices(Vector<CaptureDevice>&); > > private: >diff --git a/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm b/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm >index 9c5d5d4312d6d53684c85f2a780d83b326951581..7866b721c2f1b1b04187b323efad61bcef706134 100644 >--- a/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm >+++ b/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm >@@ -144,13 +144,13 @@ DisplayCaptureSourceCocoa::DisplayFrameType WindowDisplayCaptureSourceMac::gener > return DisplayCaptureSourceCocoa::DisplayFrameType { RetainPtr<CGImageRef> { windowImage() } }; > } > >-std::optional<CaptureDevice> WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID(const String& idString) >+WTF::Optional<CaptureDevice> WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID(const String& idString) > { > bool ok; > auto windowID = idString.toUIntStrict(&ok); > if (!ok) { > RELEASE_LOG(Media, "WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID: window ID does not convert to 32-bit integer"); >- return std::nullopt; >+ return WTF::nullopt; > } > > String windowTitle; >@@ -163,7 +163,7 @@ std::optional<CaptureDevice> WindowDisplayCaptureSourceMac::windowCaptureDeviceW > > })) { > RELEASE_LOG(Media, "WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID: window ID is not valid"); >- return std::nullopt; >+ return WTF::nullopt; > } > > auto device = CaptureDevice(String::number(windowID), CaptureDevice::DeviceType::Window, windowTitle); >diff --git a/Source/WebCore/platform/mock/GeolocationClientMock.cpp b/Source/WebCore/platform/mock/GeolocationClientMock.cpp >index 18dafd9e7fcbd4bb315b9e473d7e77d0eda88546..7da03473fa430dd18eedeb67effbc59ca50a3a61 100644 >--- a/Source/WebCore/platform/mock/GeolocationClientMock.cpp >+++ b/Source/WebCore/platform/mock/GeolocationClientMock.cpp >@@ -72,7 +72,7 @@ void GeolocationClientMock::setPositionUnavailableError(const String& errorMessa > { > m_hasError = true; > m_errorMessage = errorMessage; >- m_lastPosition = std::nullopt; >+ m_lastPosition = WTF::nullopt; > asyncUpdateController(); > } > >@@ -126,7 +126,7 @@ void GeolocationClientMock::permissionTimerFired() > > void GeolocationClientMock::reset() > { >- m_lastPosition = std::nullopt; >+ m_lastPosition = WTF::nullopt; > clearError(); > m_permissionState = PermissionStateUnset; > } >@@ -156,7 +156,7 @@ void GeolocationClientMock::setEnableHighAccuracy(bool) > // See https://bugs.webkit.org/show_bug.cgi?id=49438 > } > >-std::optional<GeolocationPosition> GeolocationClientMock::lastPosition() >+WTF::Optional<GeolocationPosition> GeolocationClientMock::lastPosition() > { > return m_lastPosition; > } >diff --git a/Source/WebCore/platform/mock/GeolocationClientMock.h b/Source/WebCore/platform/mock/GeolocationClientMock.h >index fc1b51d7f710fc38621edcc76e604fc76daa1045..1bbbbf67e6f703ee71267a3302fec4ffcf84ba31 100644 >--- a/Source/WebCore/platform/mock/GeolocationClientMock.h >+++ b/Source/WebCore/platform/mock/GeolocationClientMock.h >@@ -62,7 +62,7 @@ public: > void startUpdating() override; > void stopUpdating() override; > void setEnableHighAccuracy(bool) override; >- std::optional<GeolocationPosition> lastPosition() override; >+ WTF::Optional<GeolocationPosition> lastPosition() override; > void requestPermission(Geolocation&) override; > void cancelPermissionRequest(Geolocation&) override; > >@@ -76,7 +76,7 @@ private: > void clearError(); > > GeolocationController* m_controller; >- std::optional<GeolocationPosition> m_lastPosition; >+ WTF::Optional<GeolocationPosition> m_lastPosition; > bool m_hasError; > String m_errorMessage; > Timer m_controllerTimer; >diff --git a/Source/WebCore/platform/mock/MockMediaDevice.h b/Source/WebCore/platform/mock/MockMediaDevice.h >index 6546503e88fdb4c428a4030e42eab077283933ab..546e7ecbf98c93f471a9ff4bc8cc842dffe71caf 100644 >--- a/Source/WebCore/platform/mock/MockMediaDevice.h >+++ b/Source/WebCore/platform/mock/MockMediaDevice.h >@@ -43,12 +43,12 @@ struct MockMicrophoneProperties { > } > > template <class Decoder> >- static std::optional<MockMicrophoneProperties> decode(Decoder& decoder) >+ static WTF::Optional<MockMicrophoneProperties> decode(Decoder& decoder) > { >- std::optional<int32_t> defaultSampleRate; >+ WTF::Optional<int32_t> defaultSampleRate; > decoder >> defaultSampleRate; > if (!defaultSampleRate) >- return std::nullopt; >+ return WTF::nullopt; > return MockMicrophoneProperties { *defaultSampleRate }; > } > >@@ -67,27 +67,27 @@ struct MockCameraProperties { > } > > template <class Decoder> >- static std::optional<MockCameraProperties> decode(Decoder& decoder) >+ static WTF::Optional<MockCameraProperties> decode(Decoder& decoder) > { >- std::optional<double> defaultFrameRate; >+ WTF::Optional<double> defaultFrameRate; > decoder >> defaultFrameRate; > if (!defaultFrameRate) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<RealtimeMediaSourceSettings::VideoFacingMode> facingMode; >+ WTF::Optional<RealtimeMediaSourceSettings::VideoFacingMode> facingMode; > decoder >> facingMode; > if (!facingMode) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<VideoPresetData>> presets; >+ WTF::Optional<Vector<VideoPresetData>> presets; > decoder >> presets; > if (!presets) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Color> fillColor; >+ WTF::Optional<Color> fillColor; > decoder >> fillColor; > if (!fillColor) >- return std::nullopt; >+ return WTF::nullopt; > > return MockCameraProperties { *defaultFrameRate, *facingMode, WTFMove(*presets), *fillColor }; > } >@@ -108,21 +108,21 @@ struct MockDisplayProperties { > } > > template <class Decoder> >- static std::optional<MockDisplayProperties> decode(Decoder& decoder) >+ static WTF::Optional<MockDisplayProperties> decode(Decoder& decoder) > { >- std::optional<CaptureDevice::DeviceType> type; >+ WTF::Optional<CaptureDevice::DeviceType> type; > decoder >> type; >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Color> fillColor; >+ WTF::Optional<Color> fillColor; > decoder >> fillColor; > if (!fillColor) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<IntSize> defaultSize; >+ WTF::Optional<IntSize> defaultSize; > decoder >> defaultSize; > if (!defaultSize) >- return std::nullopt; >+ return WTF::nullopt; > > return MockDisplayProperties { *type, *fillColor, *defaultSize }; > } >@@ -166,32 +166,32 @@ struct MockMediaDevice { > } > > template <typename Properties, typename Decoder> >- static std::optional<MockMediaDevice> decodeMockMediaDevice(Decoder& decoder, String&& persistentId, String&& label) >+ static WTF::Optional<MockMediaDevice> decodeMockMediaDevice(Decoder& decoder, String&& persistentId, String&& label) > { >- std::optional<Properties> properties; >+ WTF::Optional<Properties> properties; > decoder >> properties; > if (!properties) >- return std::nullopt; >+ return WTF::nullopt; > return MockMediaDevice { WTFMove(persistentId), WTFMove(label), WTFMove(*properties) }; > } > > template <class Decoder> >- static std::optional<MockMediaDevice> decode(Decoder& decoder) >+ static WTF::Optional<MockMediaDevice> decode(Decoder& decoder) > { >- std::optional<String> persistentId; >+ WTF::Optional<String> persistentId; > decoder >> persistentId; > if (!persistentId) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> label; >+ WTF::Optional<String> label; > decoder >> label; > if (!label) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint8_t> index; >+ WTF::Optional<uint8_t> index; > decoder >> index; > if (!index) >- return std::nullopt; >+ return WTF::nullopt; > > switch (*index) { > case 1: >@@ -201,7 +201,7 @@ struct MockMediaDevice { > case 3: > return decodeMockMediaDevice<MockDisplayProperties>(decoder, WTFMove(*persistentId), WTFMove(*label)); > } >- return std::nullopt; >+ return WTF::nullopt; > } > > String persistentId; >diff --git a/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp b/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp >index dc5a2d6e660e40efc437304f7164b509d72711df..a14aee21e3172a6b326e2c1987fc81acf487d080 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp >@@ -114,7 +114,7 @@ const RealtimeMediaSourceCapabilities& MockRealtimeAudioSource::capabilities() > > void MockRealtimeAudioSource::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) > { >- m_currentSettings = std::nullopt; >+ m_currentSettings = WTF::nullopt; > } > > void MockRealtimeAudioSource::startProducingData() >diff --git a/Source/WebCore/platform/mock/MockRealtimeAudioSource.h b/Source/WebCore/platform/mock/MockRealtimeAudioSource.h >index 1d1d5b186727a9eb842b09bdeba2696acce784f6..58f4337f07c1cf18055afb32cfd5a22babf14d14 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeAudioSource.h >+++ b/Source/WebCore/platform/mock/MockRealtimeAudioSource.h >@@ -67,8 +67,8 @@ private: > > void delaySamples(Seconds) final; > >- std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >- std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > RealtimeMediaSourceSupportedConstraints m_supportedConstraints; > > RunLoop::Timer<MockRealtimeAudioSource> m_timer; >diff --git a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >index 2719d15b2c34acc7a86535a9035d0edee64f43c3..097c60bd1af13ba7da92c8186b8901c035e5f0fa 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >@@ -267,26 +267,26 @@ void MockRealtimeMediaSourceCenter::removeDevice(const String& persistentId) > RealtimeMediaSourceCenter::singleton().captureDevicesChanged(); > } > >-std::optional<MockMediaDevice> MockRealtimeMediaSourceCenter::mockDeviceWithPersistentID(const String& id) >+WTF::Optional<MockMediaDevice> MockRealtimeMediaSourceCenter::mockDeviceWithPersistentID(const String& id) > { > ASSERT(!id.isEmpty()); > > auto& map = deviceMap(); > auto iterator = map.find(id); > if (iterator == map.end()) >- return std::nullopt; >+ return WTF::nullopt; > > return iterator->value; > } > >-std::optional<CaptureDevice> MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) >+WTF::Optional<CaptureDevice> MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) > { > ASSERT(!id.isEmpty()); > > auto& map = deviceMap(); > auto iterator = map.find(id); > if (iterator == map.end() || iterator->value.type() != type) >- return std::nullopt; >+ return WTF::nullopt; > > CaptureDevice device { iterator->value.persistentId, type, iterator->value.label }; > device.setEnabled(true); >diff --git a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h >index 60590876448cc8f75a9d5837c06394a8f4007d79..5793517cc2ba60b031d5303c984032cf294cf67e 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h >+++ b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h >@@ -55,8 +55,8 @@ public: > static Vector<CaptureDevice>& videoDevices(); > static Vector<CaptureDevice>& displayDevices(); > >- static std::optional<MockMediaDevice> mockDeviceWithPersistentID(const String&); >- static std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); >+ static WTF::Optional<MockMediaDevice> mockDeviceWithPersistentID(const String&); >+ static WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); > > CaptureDeviceManager& audioCaptureDeviceManager() { return m_audioCaptureDeviceManager; } > CaptureDeviceManager& videoCaptureDeviceManager() { return m_videoCaptureDeviceManager; } >@@ -73,17 +73,17 @@ private: > class MockAudioCaptureDeviceManager final : public CaptureDeviceManager { > private: > const Vector<CaptureDevice>& captureDevices() final { return MockRealtimeMediaSourceCenter::audioDevices(); } >- std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) final { return MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(type, id); } >+ WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) final { return MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(type, id); } > }; > class MockVideoCaptureDeviceManager final : public CaptureDeviceManager { > private: > const Vector<CaptureDevice>& captureDevices() final { return MockRealtimeMediaSourceCenter::videoDevices(); } >- std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) final { return MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(type, id); } >+ WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) final { return MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(type, id); } > }; > class MockDisplayCaptureDeviceManager final : public CaptureDeviceManager { > private: > const Vector<CaptureDevice>& captureDevices() final { return MockRealtimeMediaSourceCenter::displayDevices(); } >- std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) final { return MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(type, id); } >+ WTF::Optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id) final { return MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(type, id); } > }; > > MockAudioCaptureDeviceManager m_audioCaptureDeviceManager; >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >index 4e7336e2c8121fc54f9e20d62723524b53abc0d2..9ab3944bc08005da46c6e72ff696889b15c0a6de 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >@@ -92,7 +92,7 @@ MockRealtimeVideoSource::MockRealtimeVideoSource(String&& deviceID, String&& nam > m_fillColor = properties.fillColor; > } > >-bool MockRealtimeVideoSource::supportsSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double> rate) >+bool MockRealtimeVideoSource::supportsSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double> rate) > { > // FIXME: consider splitting mock display into another class so we don't don't have to do this silly dance > // because of the RealtimeVideoSource inheritance. >@@ -102,7 +102,7 @@ bool MockRealtimeVideoSource::supportsSizeAndFrameRate(std::optional<int> width, > return RealtimeMediaSource::supportsSizeAndFrameRate(width, height, rate); > } > >-void MockRealtimeVideoSource::setSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double> rate) >+void MockRealtimeVideoSource::setSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double> rate) > { > // FIXME: consider splitting mock display into another class so we don't don't have to do this silly dance > // because of the RealtimeVideoSource inheritance. >@@ -195,7 +195,7 @@ IntSize MockRealtimeVideoSource::captureSize() const > > void MockRealtimeVideoSource::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag> settings) > { >- m_currentSettings = std::nullopt; >+ m_currentSettings = WTF::nullopt; > if (settings.containsAny({ RealtimeMediaSourceSettings::Flag::Width, RealtimeMediaSourceSettings::Flag::Height })) { > m_baseFontSize = captureSize().height() * .08; > m_bipBopFontSize = m_baseFontSize * 2.5; >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.h b/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >index 58b8e4292afa78c23b413b6609017fc898198176..1f3103f684ea9f59bc4bfb83aa667e6bc16c95cd 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >@@ -68,8 +68,8 @@ private: > void startProducingData() final; > void stopProducingData() final; > bool isCaptureSource() const final { return true; } >- bool supportsSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double>) final; >- void setSizeAndFrameRate(std::optional<int> width, std::optional<int> height, std::optional<double>) final; >+ bool supportsSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double>) final; >+ void setSizeAndFrameRate(WTF::Optional<int> width, WTF::Optional<int> height, WTF::Optional<double>) final; > void setSizeAndFrameRateWithPreset(IntSize, double, RefPtr<VideoPreset>) final; > IntSize captureSize() const; > >@@ -105,8 +105,8 @@ private: > > unsigned m_frameNumber { 0 }; > RunLoop::Timer<MockRealtimeVideoSource> m_emitFrameTimer; >- std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >- std::optional<RealtimeMediaSourceSettings> m_currentSettings; >+ WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ WTF::Optional<RealtimeMediaSourceSettings> m_currentSettings; > RealtimeMediaSourceSupportedConstraints m_supportedConstraints; > Color m_fillColor { Color::black }; > MockMediaDevice m_device; >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp >index 72af0711c58a027c02938dd8f1a9d43d741091f2..6b5e3e2e030a3e6af824179285840456d4dcdeca 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp >@@ -271,9 +271,9 @@ void MockMediaPlayerMediaSource::seekCompleted() > }); > } > >-std::optional<VideoPlaybackQualityMetrics> MockMediaPlayerMediaSource::videoPlaybackQualityMetrics() >+WTF::Optional<VideoPlaybackQualityMetrics> MockMediaPlayerMediaSource::videoPlaybackQualityMetrics() > { >- return m_mediaSourcePrivate ? m_mediaSourcePrivate->videoPlaybackQualityMetrics() : std::nullopt; >+ return m_mediaSourcePrivate ? m_mediaSourcePrivate->videoPlaybackQualityMetrics() : WTF::nullopt; > } > > } >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h >index 031a10ec0b834a557ab77d6826fc9505d393c242..ea269b8836397d16e79cb58d564788cc3831c783 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h >@@ -81,7 +81,7 @@ private: > MediaTime currentMediaTime() const override; > MediaTime durationMediaTime() const override; > void seekWithTolerance(const MediaTime&, const MediaTime&, const MediaTime&) override; >- std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; >+ WTF::Optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; > > MediaPlayer* m_player; > RefPtr<MockMediaSourcePrivate> m_mediaSourcePrivate; >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp >index abc3ba574e5512882cdad5cf19b0773f2d5092af..96f7b1fa63586752098dab5e3ac2c9ccb2bec96f 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp >@@ -171,7 +171,7 @@ MediaTime MockMediaSourcePrivate::seekToTime(const MediaTime& targetTime, const > return seekTime; > } > >-std::optional<VideoPlaybackQualityMetrics> MockMediaSourcePrivate::videoPlaybackQualityMetrics() >+WTF::Optional<VideoPlaybackQualityMetrics> MockMediaSourcePrivate::videoPlaybackQualityMetrics() > { > return VideoPlaybackQualityMetrics { > m_totalVideoFrames, >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h >index 4d94566c3248678be36f85ce869c15e35894f910..3b32ec3b79be9c6371bfa6ea8b711afe474100c4 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h >@@ -53,7 +53,7 @@ public: > void seekToTime(const MediaTime&); > MediaTime seekToTime(const MediaTime&, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold); > >- std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); >+ WTF::Optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); > > void incrementTotalVideoFrames() { ++m_totalVideoFrames; } > void incrementDroppedFrames() { ++m_droppedVideoFrames; } >diff --git a/Source/WebCore/platform/network/BlobDataFileReference.cpp b/Source/WebCore/platform/network/BlobDataFileReference.cpp >index b8d1312afe5ff1b42365b82bf215009fd54c87dc..d3414b8d568e5a1e41968f238c2bcc15b9ed0bf7 100644 >--- a/Source/WebCore/platform/network/BlobDataFileReference.cpp >+++ b/Source/WebCore/platform/network/BlobDataFileReference.cpp >@@ -68,13 +68,13 @@ unsigned long long BlobDataFileReference::size() > return m_size; > } > >-std::optional<WallTime> BlobDataFileReference::expectedModificationTime() >+WTF::Optional<WallTime> BlobDataFileReference::expectedModificationTime() > { > #if ENABLE(FILE_REPLACEMENT) > // We do not currently track modifications for generated files, because we have a snapshot. > // Unfortunately, this is inconsistent with regular file handling - File objects should be invalidated when underlying files change. > if (m_replacementShouldBeGenerated || !m_replacementPath.isNull()) >- return std::nullopt; >+ return WTF::nullopt; > #endif > return m_expectedModificationTime; > } >diff --git a/Source/WebCore/platform/network/BlobDataFileReference.h b/Source/WebCore/platform/network/BlobDataFileReference.h >index 40def69f6f8c7ba8cb64307e5c99cda94fd2e808..7043453e2d6135ea3e209bf85f93f54cec3adbf2 100644 >--- a/Source/WebCore/platform/network/BlobDataFileReference.h >+++ b/Source/WebCore/platform/network/BlobDataFileReference.h >@@ -46,7 +46,7 @@ public: > > const String& path(); > unsigned long long size(); >- std::optional<WallTime> expectedModificationTime(); >+ WTF::Optional<WallTime> expectedModificationTime(); > > virtual void prepareForFileAccess(); > virtual void revokeFileAccess(); >diff --git a/Source/WebCore/platform/network/CacheValidation.cpp b/Source/WebCore/platform/network/CacheValidation.cpp >index 910fbf956821fb70c6e63251f0ab4815223f1e02..0212bc9f1c7e311b616534de13ec90142489ed59 100644 >--- a/Source/WebCore/platform/network/CacheValidation.cpp >+++ b/Source/WebCore/platform/network/CacheValidation.cpp >@@ -337,9 +337,9 @@ static String headerValueForVary(const ResourceRequest& request, const String& h > auto* cookieStrategy = platformStrategies() ? platformStrategies()->cookiesStrategy() : nullptr; > if (!cookieStrategy) { > ASSERT(sessionID == PAL::SessionID::defaultSessionID()); >- return NetworkStorageSession::defaultStorageSession().cookieRequestHeaderFieldValue(request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), std::nullopt, std::nullopt, includeSecureCookies).first; >+ return NetworkStorageSession::defaultStorageSession().cookieRequestHeaderFieldValue(request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; > } >- return cookieStrategy->cookieRequestHeaderFieldValue(sessionID, request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), std::nullopt, std::nullopt, includeSecureCookies).first; >+ return cookieStrategy->cookieRequestHeaderFieldValue(sessionID, request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; > } > return request.httpHeaderField(headerName); > } >diff --git a/Source/WebCore/platform/network/CertificateInfoBase.h b/Source/WebCore/platform/network/CertificateInfoBase.h >index b01b97f78a364506a1f308a2a78bbc287358eb3e..08610707b242466b4447fb8f415f1cae85c2df9d 100644 >--- a/Source/WebCore/platform/network/CertificateInfoBase.h >+++ b/Source/WebCore/platform/network/CertificateInfoBase.h >@@ -43,7 +43,7 @@ public: > Vector<String> dnsNames; > Vector<String> ipAddresses; > }; >- std::optional<SummaryInfo> summaryInfo() const { return std::nullopt; }; >+ WTF::Optional<SummaryInfo> summaryInfo() const { return WTF::nullopt; }; > > bool isEmpty() const { return true; }; > }; >diff --git a/Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h b/Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h >index 32a6f57c0a2196047c7439b0939dfe2cd0c369e7..acf7b998d8613c387e7ccbe7674652b8db90eb9e 100644 >--- a/Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h >+++ b/Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h >@@ -37,12 +37,12 @@ struct CookieRequestHeaderFieldProxy { > URL firstParty; > SameSiteInfo sameSiteInfo; > URL url; >- std::optional<uint64_t> frameID; >- std::optional<uint64_t> pageID; >+ WTF::Optional<uint64_t> frameID; >+ WTF::Optional<uint64_t> pageID; > IncludeSecureCookies includeSecureCookies { IncludeSecureCookies::No }; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<CookieRequestHeaderFieldProxy> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<CookieRequestHeaderFieldProxy> decode(Decoder&); > }; > > template<class Encoder> >@@ -58,23 +58,23 @@ void CookieRequestHeaderFieldProxy::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<CookieRequestHeaderFieldProxy> CookieRequestHeaderFieldProxy::decode(Decoder& decoder) >+WTF::Optional<CookieRequestHeaderFieldProxy> CookieRequestHeaderFieldProxy::decode(Decoder& decoder) > { > CookieRequestHeaderFieldProxy result; > if (!decoder.decode(result.sessionID)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.firstParty)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.sameSiteInfo)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.url)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.frameID)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.pageID)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.includeSecureCookies)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > } > >diff --git a/Source/WebCore/platform/network/DataURLDecoder.h b/Source/WebCore/platform/network/DataURLDecoder.h >index 974d9cebeb195188b5c84692aa0f5b26ba990cd6..ba4b6425bfed8283ad7c71f53b2039b8f1a557d2 100644 >--- a/Source/WebCore/platform/network/DataURLDecoder.h >+++ b/Source/WebCore/platform/network/DataURLDecoder.h >@@ -46,7 +46,7 @@ struct Result { > RefPtr<SharedBuffer> data; > }; > >-using DecodeCompletionHandler = WTF::Function<void (std::optional<Result>)>; >+using DecodeCompletionHandler = WTF::Function<void (WTF::Optional<Result>)>; > struct ScheduleContext { > #if HAVE(RUNLOOP_TIMER) > SchedulePairHashSet scheduledPairs; >diff --git a/Source/WebCore/platform/network/FormData.cpp b/Source/WebCore/platform/network/FormData.cpp >index 45aebae5209c9b5d50f1f2145da553f9e45ee9d3..c79c38069e2ecfd7418090e50e0dc6d2ba721e37 100644 >--- a/Source/WebCore/platform/network/FormData.cpp >+++ b/Source/WebCore/platform/network/FormData.cpp >@@ -172,7 +172,7 @@ FormDataElement FormDataElement::isolatedCopy() const > > void FormData::appendData(const void* data, size_t size) > { >- m_lengthInBytes = std::nullopt; >+ m_lengthInBytes = WTF::nullopt; > if (!m_elements.isEmpty()) { > if (auto* vector = WTF::get_if<Vector<char>>(m_elements.last().data)) { > vector->append(reinterpret_cast<const char*>(data), size); >@@ -186,20 +186,20 @@ void FormData::appendData(const void* data, size_t size) > > void FormData::appendFile(const String& filename, bool shouldGenerateFile) > { >- m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, std::nullopt, shouldGenerateFile)); >- m_lengthInBytes = std::nullopt; >+ m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, WTF::nullopt, shouldGenerateFile)); >+ m_lengthInBytes = WTF::nullopt; > } > >-void FormData::appendFileRange(const String& filename, long long start, long long length, std::optional<WallTime> expectedModificationTime, bool shouldGenerateFile) >+void FormData::appendFileRange(const String& filename, long long start, long long length, WTF::Optional<WallTime> expectedModificationTime, bool shouldGenerateFile) > { > m_elements.append(FormDataElement(filename, start, length, expectedModificationTime, shouldGenerateFile)); >- m_lengthInBytes = std::nullopt; >+ m_lengthInBytes = WTF::nullopt; > } > > void FormData::appendBlob(const URL& blobURL) > { > m_elements.append(FormDataElement(blobURL)); >- m_lengthInBytes = std::nullopt; >+ m_lengthInBytes = WTF::nullopt; > } > > static Vector<uint8_t> normalizeStringData(TextEncoding& encoding, const String& value) >diff --git a/Source/WebCore/platform/network/FormData.h b/Source/WebCore/platform/network/FormData.h >index d7c1e5faa0de50783bfb47724bf59919ab66f91d..7d13664baa598515e41c09e1535368cfac297c32 100644 >--- a/Source/WebCore/platform/network/FormData.h >+++ b/Source/WebCore/platform/network/FormData.h >@@ -45,7 +45,7 @@ struct FormDataElement { > : data(WTFMove(data)) { } > explicit FormDataElement(Vector<char>&& array) > : data(WTFMove(array)) { } >- FormDataElement(const String& filename, int64_t fileStart, int64_t fileLength, std::optional<WallTime> expectedFileModificationTime, bool shouldGenerateFile) >+ FormDataElement(const String& filename, int64_t fileStart, int64_t fileLength, WTF::Optional<WallTime> expectedFileModificationTime, bool shouldGenerateFile) > : data(EncodedFileData { filename, fileStart, fileLength, expectedFileModificationTime, { }, shouldGenerateFile, false }) { } > explicit FormDataElement(const URL& blobURL) > : data(EncodedBlobData { blobURL }) { } >@@ -58,12 +58,12 @@ struct FormDataElement { > { > encoder << data; > } >- template<typename Decoder> static std::optional<FormDataElement> decode(Decoder& decoder) >+ template<typename Decoder> static WTF::Optional<FormDataElement> decode(Decoder& decoder) > { >- std::optional<Data> data; >+ WTF::Optional<Data> data; > decoder >> data; > if (!data) >- return std::nullopt; >+ return WTF::nullopt; > return FormDataElement(WTFMove(*data)); > } > >@@ -71,7 +71,7 @@ struct FormDataElement { > String filename; > int64_t fileStart { 0 }; > int64_t fileLength { 0 }; >- std::optional<WallTime> expectedFileModificationTime; >+ WTF::Optional<WallTime> expectedFileModificationTime; > String generatedFilename; > bool shouldGenerateFile { false }; > bool ownsGeneratedFile { false }; >@@ -99,37 +99,37 @@ struct FormDataElement { > { > encoder << filename << fileStart << fileLength << expectedFileModificationTime << generatedFilename << shouldGenerateFile; > } >- template<typename Decoder> static std::optional<EncodedFileData> decode(Decoder& decoder) >+ template<typename Decoder> static WTF::Optional<EncodedFileData> decode(Decoder& decoder) > { >- std::optional<String> filename; >+ WTF::Optional<String> filename; > decoder >> filename; > if (!filename) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int64_t> fileStart; >+ WTF::Optional<int64_t> fileStart; > decoder >> fileStart; > if (!fileStart) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int64_t> fileLength; >+ WTF::Optional<int64_t> fileLength; > decoder >> fileLength; > if (!fileLength) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<WallTime>> expectedFileModificationTime; >+ WTF::Optional<WTF::Optional<WallTime>> expectedFileModificationTime; > decoder >> expectedFileModificationTime; > if (!expectedFileModificationTime) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> generatedFilename; >+ WTF::Optional<String> generatedFilename; > decoder >> generatedFilename; > if (!generatedFilename) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> shouldGenerateFile; >+ WTF::Optional<bool> shouldGenerateFile; > decoder >> shouldGenerateFile; > if (!shouldGenerateFile) >- return std::nullopt; >+ return WTF::nullopt; > > bool ownsGeneratedFile = false; > >@@ -157,12 +157,12 @@ struct FormDataElement { > { > encoder << url; > } >- template<typename Decoder> static std::optional<EncodedBlobData> decode(Decoder& decoder) >+ template<typename Decoder> static WTF::Optional<EncodedBlobData> decode(Decoder& decoder) > { >- std::optional<URL> url; >+ WTF::Optional<URL> url; > decoder >> url; > if (!url) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*url) }}; > } >@@ -218,7 +218,7 @@ public: > > WEBCORE_EXPORT void appendData(const void* data, size_t); > void appendFile(const String& filePath, bool shouldGenerateFile = false); >- WEBCORE_EXPORT void appendFileRange(const String& filename, long long start, long long length, std::optional<WallTime> expectedModificationTime, bool shouldGenerateFile = false); >+ WEBCORE_EXPORT void appendFileRange(const String& filename, long long start, long long length, WTF::Optional<WallTime> expectedModificationTime, bool shouldGenerateFile = false); > WEBCORE_EXPORT void appendBlob(const URL& blobURL); > > Vector<char> flatten() const; // omits files >@@ -279,7 +279,7 @@ private: > bool m_alwaysStream { false }; > Vector<char> m_boundary; > bool m_containsPasswordData { false }; >- mutable std::optional<uint64_t> m_lengthInBytes; >+ mutable WTF::Optional<uint64_t> m_lengthInBytes; > }; > > inline bool operator==(const FormData& a, const FormData& b) >diff --git a/Source/WebCore/platform/network/HTTPHeaderMap.h b/Source/WebCore/platform/network/HTTPHeaderMap.h >index 0bcb03f979002e4b05b052cfba6addcac512214e..2e86c3d0a298006876daff704b90724ef1489526 100644 >--- a/Source/WebCore/platform/network/HTTPHeaderMap.h >+++ b/Source/WebCore/platform/network/HTTPHeaderMap.h >@@ -44,7 +44,7 @@ public: > > CommonHeader isolatedCopy() const { return { key , value.isolatedCopy() }; } > template <class Encoder> void encode(Encoder&) const; >- template <class Decoder> static std::optional<CommonHeader> decode(Decoder&); >+ template <class Decoder> static WTF::Optional<CommonHeader> decode(Decoder&); > > bool operator==(const CommonHeader& other) const { return key == other.key && value == other.value; } > }; >@@ -55,7 +55,7 @@ public: > > UncommonHeader isolatedCopy() const { return { key.isolatedCopy() , value.isolatedCopy() }; } > template <class Encoder> void encode(Encoder&) const; >- template <class Decoder> static std::optional<UncommonHeader> decode(Decoder&); >+ template <class Decoder> static WTF::Optional<UncommonHeader> decode(Decoder&); > > bool operator==(const UncommonHeader& other) const { return key == other.key && value == other.value; } > }; >@@ -76,7 +76,7 @@ public: > > struct KeyValue { > String key; >- std::optional<HTTPHeaderName> keyAsHTTPHeaderName; >+ WTF::Optional<HTTPHeaderName> keyAsHTTPHeaderName; > String value; > }; > >@@ -121,7 +121,7 @@ public: > if (it == m_table.uncommonHeaders().end()) > return false; > m_keyValue.key = it->key; >- m_keyValue.keyAsHTTPHeaderName = std::nullopt; >+ m_keyValue.keyAsHTTPHeaderName = WTF::nullopt; > m_keyValue.value = it->value; > return true; > } >@@ -214,14 +214,14 @@ void HTTPHeaderMap::CommonHeader::encode(Encoder& encoder) const > } > > template <class Decoder> >-auto HTTPHeaderMap::CommonHeader::decode(Decoder& decoder) -> std::optional<CommonHeader> >+auto HTTPHeaderMap::CommonHeader::decode(Decoder& decoder) -> WTF::Optional<CommonHeader> > { > HTTPHeaderName name; > if (!decoder.decodeEnum(name)) >- return std::nullopt; >+ return WTF::nullopt; > String value; > if (!decoder.decode(value)) >- return std::nullopt; >+ return WTF::nullopt; > > return CommonHeader { name, WTFMove(value) }; > } >@@ -234,14 +234,14 @@ void HTTPHeaderMap::UncommonHeader::encode(Encoder& encoder) const > } > > template <class Decoder> >-auto HTTPHeaderMap::UncommonHeader::decode(Decoder& decoder) -> std::optional<UncommonHeader> >+auto HTTPHeaderMap::UncommonHeader::decode(Decoder& decoder) -> WTF::Optional<UncommonHeader> > { > String name; > if (!decoder.decode(name)) >- return std::nullopt; >+ return WTF::nullopt; > String value; > if (!decoder.decode(value)) >- return std::nullopt; >+ return WTF::nullopt; > > return UncommonHeader { WTFMove(name), WTFMove(value) }; > } >diff --git a/Source/WebCore/platform/network/HTTPParsers.cpp b/Source/WebCore/platform/network/HTTPParsers.cpp >index fa00f9ef103fed44693837f9b91677c9efbde4d7..6d5624003e795954e0db95caa1d52538d5dec43b 100644 >--- a/Source/WebCore/platform/network/HTTPParsers.cpp >+++ b/Source/WebCore/platform/network/HTTPParsers.cpp >@@ -260,11 +260,11 @@ bool parseHTTPRefresh(const String& refresh, double& delay, String& url) > } > } > >-std::optional<WallTime> parseHTTPDate(const String& value) >+WTF::Optional<WallTime> parseHTTPDate(const String& value) > { > double dateInMillisecondsSinceEpoch = parseDateFromNullTerminatedCharacters(value.utf8().data()); > if (!std::isfinite(dateInMillisecondsSinceEpoch)) >- return std::nullopt; >+ return WTF::nullopt; > // This assumes system_clock epoch equals Unix epoch which is true for all implementations but unspecified. > // FIXME: The parsing function should be switched to WallTime too. > return WallTime::fromRawSeconds(dateInMillisecondsSinceEpoch / 1000.0); >diff --git a/Source/WebCore/platform/network/HTTPParsers.h b/Source/WebCore/platform/network/HTTPParsers.h >index 0c9fd97cf17d7ec076544be3d33506fa9ff78a4f..97cae9a8c8c4140d01960179b6d46c231f9c0bb5 100644 >--- a/Source/WebCore/platform/network/HTTPParsers.h >+++ b/Source/WebCore/platform/network/HTTPParsers.h >@@ -77,7 +77,7 @@ bool isValidAcceptHeaderValue(const String&); > bool isValidLanguageHeaderValue(const String&); > bool isValidHTTPToken(const String&); > bool parseHTTPRefresh(const String& refresh, double& delay, String& url); >-std::optional<WallTime> parseHTTPDate(const String&); >+WTF::Optional<WallTime> parseHTTPDate(const String&); > String filenameFromHTTPContentDisposition(const String&); > String extractMIMETypeFromMediaType(const String&); > String extractCharsetFromMediaType(const String&); >diff --git a/Source/WebCore/platform/network/NetworkLoadInformation.h b/Source/WebCore/platform/network/NetworkLoadInformation.h >index e3b89c6f185eae07e69d8c9bd525e16e0b632e0e..37a90af62165c9cb25bf094085b06e480687bade 100644 >--- a/Source/WebCore/platform/network/NetworkLoadInformation.h >+++ b/Source/WebCore/platform/network/NetworkLoadInformation.h >@@ -40,7 +40,7 @@ struct NetworkTransactionInformation { > NetworkLoadMetrics metrics; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<NetworkTransactionInformation> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<NetworkTransactionInformation> decode(Decoder&); > }; > > struct NetworkLoadInformation { >@@ -72,18 +72,18 @@ template<class Encoder> inline void NetworkTransactionInformation::encode(Encode > encoder << metrics; > } > >-template<class Decoder> inline std::optional<NetworkTransactionInformation> NetworkTransactionInformation::decode(Decoder& decoder) >+template<class Decoder> inline WTF::Optional<NetworkTransactionInformation> NetworkTransactionInformation::decode(Decoder& decoder) > { > NetworkTransactionInformation information; > > if (!decoder.decode(information.type)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(information.request)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(information.response)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(information.metrics)) >- return std::nullopt; >+ return WTF::nullopt; > > return information; > } >diff --git a/Source/WebCore/platform/network/NetworkLoadMetrics.h b/Source/WebCore/platform/network/NetworkLoadMetrics.h >index 05d660a33c14557b569e89e97d00b9f8af6e593e..d953a9f854799c9f46e0e0c099e2776dd58ac692 100644 >--- a/Source/WebCore/platform/network/NetworkLoadMetrics.h >+++ b/Source/WebCore/platform/network/NetworkLoadMetrics.h >@@ -236,13 +236,13 @@ bool NetworkLoadMetrics::decode(Decoder& decoder, NetworkLoadMetrics& metrics) > namespace WTF { > namespace Persistence { > >-template<> struct Coder<std::optional<WebCore::NetworkLoadPriority>> { >- static NO_RETURN_DUE_TO_ASSERT void encode(Encoder&, const std::optional<WebCore::NetworkLoadPriority>&) >+template<> struct Coder<WTF::Optional<WebCore::NetworkLoadPriority>> { >+ static NO_RETURN_DUE_TO_ASSERT void encode(Encoder&, const WTF::Optional<WebCore::NetworkLoadPriority>&) > { > ASSERT_NOT_REACHED(); > } > >- static bool decode(Decoder&, std::optional<WebCore::NetworkLoadPriority>&) >+ static bool decode(Decoder&, WTF::Optional<WebCore::NetworkLoadPriority>&) > { > ASSERT_NOT_REACHED(); > return false; >diff --git a/Source/WebCore/platform/network/NetworkStateNotifier.h b/Source/WebCore/platform/network/NetworkStateNotifier.h >index 3fc259868b6cb486f7414fdb2a1d0f26ecf15c71..da0812a872d5004e8492b3c0d3e1cbdf742b620e 100644 >--- a/Source/WebCore/platform/network/NetworkStateNotifier.h >+++ b/Source/WebCore/platform/network/NetworkStateNotifier.h >@@ -71,7 +71,7 @@ private: > static void networkChangedCallback(NetworkStateNotifier*); > #endif > >- std::optional<bool> m_isOnLine; >+ WTF::Optional<bool> m_isOnLine; > Vector<WTF::Function<void(bool)>> m_listeners; > Timer m_updateStateTimer; > >diff --git a/Source/WebCore/platform/network/NetworkStorageSession.cpp b/Source/WebCore/platform/network/NetworkStorageSession.cpp >index 1a9c8daec7fe17a4920413e87d52b11fb7a5da25..15bcd5bad6850ace60be3c7ed1d4a7fc59816bd2 100644 >--- a/Source/WebCore/platform/network/NetworkStorageSession.cpp >+++ b/Source/WebCore/platform/network/NetworkStorageSession.cpp >@@ -103,12 +103,12 @@ bool NetworkStorageSession::shouldBlockThirdPartyCookies(const String& topPrivat > return m_topPrivatelyControlledDomainsToBlock.contains(topPrivatelyControlledDomain); > } > >-bool NetworkStorageSession::shouldBlockCookies(const ResourceRequest& request, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const >+bool NetworkStorageSession::shouldBlockCookies(const ResourceRequest& request, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID) const > { > return shouldBlockCookies(request.firstPartyForCookies(), request.url(), frameID, pageID); > } > >-bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const >+bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID) const > { > auto firstPartyDomain = getPartitioningDomain(firstPartyForCookies); > if (firstPartyDomain.isEmpty()) >@@ -127,14 +127,14 @@ bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, > return shouldBlockThirdPartyCookies(resourceDomain); > } > >-std::optional<Seconds> NetworkStorageSession::maxAgeCacheCap(const ResourceRequest& request) >+WTF::Optional<Seconds> NetworkStorageSession::maxAgeCacheCap(const ResourceRequest& request) > { >- if (m_cacheMaxAgeCapForPrevalentResources && shouldBlockCookies(request, std::nullopt, std::nullopt)) >+ if (m_cacheMaxAgeCapForPrevalentResources && shouldBlockCookies(request, WTF::nullopt, WTF::nullopt)) > return m_cacheMaxAgeCapForPrevalentResources; >- return std::nullopt; >+ return WTF::nullopt; > } > >-void NetworkStorageSession::setAgeCapForClientSideCookies(std::optional<Seconds> seconds) >+void NetworkStorageSession::setAgeCapForClientSideCookies(WTF::Optional<Seconds> seconds) > { > m_ageCapForClientSideCookies = seconds; > } >@@ -151,7 +151,7 @@ void NetworkStorageSession::removePrevalentDomains(const Vector<String>& domains > m_topPrivatelyControlledDomainsToBlock.remove(domain); > } > >-bool NetworkStorageSession::hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID) const >+bool NetworkStorageSession::hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID) const > { > if (frameID) { > auto framesGrantedIterator = m_framesGrantedStorageAccess.find(pageID); >@@ -184,7 +184,7 @@ Vector<String> NetworkStorageSession::getAllStorageAccessEntries() const > return entries; > } > >-void NetworkStorageSession::grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID) >+void NetworkStorageSession::grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID) > { > if (!frameID) { > if (firstPartyDomain.isEmpty()) >@@ -246,7 +246,7 @@ void NetworkStorageSession::setCacheMaxAgeCapForPrevalentResources(Seconds secon > > void NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources() > { >- m_cacheMaxAgeCapForPrevalentResources = std::nullopt; >+ m_cacheMaxAgeCapForPrevalentResources = WTF::nullopt; > } > #endif // ENABLE(RESOURCE_LOAD_STATISTICS) > >diff --git a/Source/WebCore/platform/network/NetworkStorageSession.h b/Source/WebCore/platform/network/NetworkStorageSession.h >index 2fb390f48589e49e546327293bf57a72c5c0c747..ed9771f3af8247dc8f6222ca0cf65815e03c078f 100644 >--- a/Source/WebCore/platform/network/NetworkStorageSession.h >+++ b/Source/WebCore/platform/network/NetworkStorageSession.h >@@ -133,7 +133,7 @@ public: > WEBCORE_EXPORT bool cookiesEnabled() const; > WEBCORE_EXPORT void setCookie(const Cookie&); > WEBCORE_EXPORT void setCookies(const Vector<Cookie>&, const URL&, const URL& mainDocumentURL); >- WEBCORE_EXPORT void setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String&) const; >+ WEBCORE_EXPORT void setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String&) const; > WEBCORE_EXPORT void deleteCookie(const Cookie&); > WEBCORE_EXPORT void deleteCookie(const URL&, const String&) const; > WEBCORE_EXPORT void deleteAllCookies(); >@@ -141,28 +141,28 @@ public: > WEBCORE_EXPORT void deleteCookiesForHostnames(const Vector<String>& cookieHostNames); > WEBCORE_EXPORT Vector<Cookie> getAllCookies(); > WEBCORE_EXPORT Vector<Cookie> getCookies(const URL&); >- WEBCORE_EXPORT bool getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>&) const; >+ WEBCORE_EXPORT bool getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>&) const; > WEBCORE_EXPORT void flushCookieStore(); > WEBCORE_EXPORT void getHostnamesWithCookies(HashSet<String>& hostnames); >- WEBCORE_EXPORT std::pair<String, bool> cookiesForDOM(const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const; >- WEBCORE_EXPORT std::pair<String, bool> cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const; >+ WEBCORE_EXPORT std::pair<String, bool> cookiesForDOM(const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const; >+ WEBCORE_EXPORT std::pair<String, bool> cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const; > WEBCORE_EXPORT std::pair<String, bool> cookieRequestHeaderFieldValue(const CookieRequestHeaderFieldProxy&) const; > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- WEBCORE_EXPORT bool shouldBlockCookies(const ResourceRequest&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const; >- WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const; >+ WEBCORE_EXPORT bool shouldBlockCookies(const ResourceRequest&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID) const; >+ WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID) const; > WEBCORE_EXPORT void setPrevalentDomainsToBlockCookiesFor(const Vector<String>&); >- WEBCORE_EXPORT void setAgeCapForClientSideCookies(std::optional<Seconds>); >+ WEBCORE_EXPORT void setAgeCapForClientSideCookies(WTF::Optional<Seconds>); > WEBCORE_EXPORT void removePrevalentDomains(const Vector<String>& domains); >- WEBCORE_EXPORT bool hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID) const; >+ WEBCORE_EXPORT bool hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID) const; > WEBCORE_EXPORT Vector<String> getAllStorageAccessEntries() const; >- WEBCORE_EXPORT void grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID); >+ WEBCORE_EXPORT void grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID); > WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID); > WEBCORE_EXPORT void removeStorageAccessForAllFramesOnPage(uint64_t pageID); > WEBCORE_EXPORT void removeAllStorageAccess(); > WEBCORE_EXPORT void setCacheMaxAgeCapForPrevalentResources(Seconds); > WEBCORE_EXPORT void resetCacheMaxAgeCapForPrevalentResources(); >- WEBCORE_EXPORT std::optional<Seconds> maxAgeCacheCap(const ResourceRequest&); >+ WEBCORE_EXPORT WTF::Optional<Seconds> maxAgeCacheCap(const ResourceRequest&); > #endif > > private: >@@ -194,8 +194,8 @@ private: > HashSet<String> m_topPrivatelyControlledDomainsToBlock; > HashMap<uint64_t, HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess; > HashMap<uint64_t, HashMap<String, String>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_pagesGrantedStorageAccess; >- std::optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { }; >- std::optional<Seconds> m_ageCapForClientSideCookies { }; >+ WTF::Optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { }; >+ WTF::Optional<Seconds> m_ageCapForClientSideCookies { }; > #endif > > #if PLATFORM(COCOA) >diff --git a/Source/WebCore/platform/network/ParsedContentType.cpp b/Source/WebCore/platform/network/ParsedContentType.cpp >index d729a05dbc0a528172a48ea9371cd8c51f3e1002..930a7a5f3b37dce7e39f032aeaf03b6915dc9420 100644 >--- a/Source/WebCore/platform/network/ParsedContentType.cpp >+++ b/Source/WebCore/platform/network/ParsedContentType.cpp >@@ -53,14 +53,14 @@ static bool isTokenCharacter(char c) > return isASCII(c) && c > ' ' && c != '"' && c != '(' && c != ')' && c != ',' && c != '/' && (c < ':' || c > '@') && (c < '[' || c > ']'); > } > >-static std::optional<SubstringRange> parseToken(const String& input, unsigned& startIndex) >+static WTF::Optional<SubstringRange> parseToken(const String& input, unsigned& startIndex) > { > unsigned inputLength = input.length(); > unsigned tokenStart = startIndex; > unsigned& tokenEnd = startIndex; > > if (tokenEnd >= inputLength) >- return std::nullopt; >+ return WTF::nullopt; > > while (tokenEnd < inputLength) { > if (!isTokenCharacter(input[tokenEnd])) >@@ -69,27 +69,27 @@ static std::optional<SubstringRange> parseToken(const String& input, unsigned& s > } > > if (tokenEnd == tokenStart) >- return std::nullopt; >+ return WTF::nullopt; > return SubstringRange(tokenStart, tokenEnd - tokenStart); > } > >-static std::optional<SubstringRange> parseQuotedString(const String& input, unsigned& startIndex) >+static WTF::Optional<SubstringRange> parseQuotedString(const String& input, unsigned& startIndex) > { > unsigned inputLength = input.length(); > unsigned quotedStringStart = startIndex + 1; > unsigned& quotedStringEnd = startIndex; > > if (quotedStringEnd >= inputLength) >- return std::nullopt; >+ return WTF::nullopt; > > if (input[quotedStringEnd++] != '"' || quotedStringEnd >= inputLength) >- return std::nullopt; >+ return WTF::nullopt; > > bool lastCharacterWasBackslash = false; > char currentCharacter; > while ((currentCharacter = input[quotedStringEnd++]) != '"' || lastCharacterWasBackslash) { > if (quotedStringEnd >= inputLength) >- return std::nullopt; >+ return WTF::nullopt; > if (currentCharacter == '\\' && !lastCharacterWasBackslash) { > lastCharacterWasBackslash = true; > continue; >@@ -205,7 +205,7 @@ bool parseContentType(const String& contentType, ReceiverType& receiver) > > // Should we tolerate spaces here? > String value; >- std::optional<SubstringRange> valueRange; >+ WTF::Optional<SubstringRange> valueRange; > if (contentType[index] == '"') > valueRange = parseQuotedString(contentType, index); > else >diff --git a/Source/WebCore/platform/network/ResourceHandle.cpp b/Source/WebCore/platform/network/ResourceHandle.cpp >index d2ea9a107de679ac2a65ab56ec00384c113a6e49..e1288c46cd6f78c3a4a311a7d737eed703993e13 100644 >--- a/Source/WebCore/platform/network/ResourceHandle.cpp >+++ b/Source/WebCore/platform/network/ResourceHandle.cpp >@@ -155,7 +155,7 @@ void ResourceHandle::didReceiveResponse(ResourceResponse&& response, CompletionH > { > if (response.isHTTP09()) { > auto url = response.url(); >- std::optional<uint16_t> port = url.port(); >+ WTF::Optional<uint16_t> port = url.port(); > if (port && !WTF::isDefaultPortForProtocol(port.value(), url.protocol())) { > cancel(); > String message = "Cancelled load from '" + url.stringCenterEllipsizedToLength() + "' because it is using HTTP/0.9."; >diff --git a/Source/WebCore/platform/network/ResourceHandle.h b/Source/WebCore/platform/network/ResourceHandle.h >index b59ab21aa0a547f5d57c4b0288eb8b723689cfbd..0663de70c03b14eab27565efe605a0ecf83a79ea 100644 >--- a/Source/WebCore/platform/network/ResourceHandle.h >+++ b/Source/WebCore/platform/network/ResourceHandle.h >@@ -262,7 +262,7 @@ private: > > bool shouldRedirectAsGET(const ResourceRequest&, bool crossOrigin); > >- std::optional<Credential> getCredential(const ResourceRequest&, bool); >+ WTF::Optional<Credential> getCredential(const ResourceRequest&, bool); > void restartRequestWithCredential(const ProtectionSpace&, const Credential&); > > void handleDataURL(); >diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h >index 30d4b1062dd0388845e847c9cd69ac44d297166a..b12e8f743c487412388fe9b663795d68c22563a7 100644 >--- a/Source/WebCore/platform/network/ResourceRequestBase.h >+++ b/Source/WebCore/platform/network/ResourceRequestBase.h >@@ -173,7 +173,7 @@ public: > void setInitiatorIdentifier(const String& identifier) { m_initiatorIdentifier = identifier; } > > // Additional information for the Inspector to be able to identify the node that initiated this request. >- const std::optional<int>& inspectorInitiatorNodeIdentifier() const { return m_inspectorInitiatorNodeIdentifier; } >+ const WTF::Optional<int>& inspectorInitiatorNodeIdentifier() const { return m_inspectorInitiatorNodeIdentifier; } > void setInspectorInitiatorNodeIdentifier(int inspectorInitiatorNodeIdentifier) { m_inspectorInitiatorNodeIdentifier = inspectorInitiatorNodeIdentifier; } > > #if USE(SYSTEM_PREVIEW) >@@ -236,7 +236,7 @@ protected: > SameSiteDisposition m_sameSiteDisposition { SameSiteDisposition::Unspecified }; > ResourceLoadPriority m_priority { ResourceLoadPriority::Low }; > Requester m_requester { Requester::Unspecified }; >- std::optional<int> m_inspectorInitiatorNodeIdentifier; >+ WTF::Optional<int> m_inspectorInitiatorNodeIdentifier; > bool m_allowCookies { false }; > mutable bool m_resourceRequestUpdated { false }; > mutable bool m_platformRequestUpdated { false }; >diff --git a/Source/WebCore/platform/network/ResourceResponseBase.cpp b/Source/WebCore/platform/network/ResourceResponseBase.cpp >index f32de8c9217e7d6eb68859d891dd0461cdbe6aa6..32f07f8b21af385386b54bdf4e204845a10c3d88 100644 >--- a/Source/WebCore/platform/network/ResourceResponseBase.cpp >+++ b/Source/WebCore/platform/network/ResourceResponseBase.cpp >@@ -653,18 +653,18 @@ bool ResourceResponseBase::hasCacheValidatorFields() const > return !m_httpHeaderFields.get(HTTPHeaderName::LastModified).isEmpty() || !m_httpHeaderFields.get(HTTPHeaderName::ETag).isEmpty(); > } > >-std::optional<Seconds> ResourceResponseBase::cacheControlMaxAge() const >+WTF::Optional<Seconds> ResourceResponseBase::cacheControlMaxAge() const > { > if (!m_haveParsedCacheControlHeader) > parseCacheControlDirectives(); > return m_cacheControlDirectives.maxAge; > } > >-static std::optional<WallTime> parseDateValueInHeader(const HTTPHeaderMap& headers, HTTPHeaderName headerName) >+static WTF::Optional<WallTime> parseDateValueInHeader(const HTTPHeaderMap& headers, HTTPHeaderName headerName) > { > String headerValue = headers.get(headerName); > if (headerValue.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > // This handles all date formats required by RFC2616: > // Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 > // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 >@@ -672,7 +672,7 @@ static std::optional<WallTime> parseDateValueInHeader(const HTTPHeaderMap& heade > return parseHTTPDate(headerValue); > } > >-std::optional<WallTime> ResourceResponseBase::date() const >+WTF::Optional<WallTime> ResourceResponseBase::date() const > { > lazyInit(CommonFieldsOnly); > >@@ -683,7 +683,7 @@ std::optional<WallTime> ResourceResponseBase::date() const > return m_date; > } > >-std::optional<Seconds> ResourceResponseBase::age() const >+WTF::Optional<Seconds> ResourceResponseBase::age() const > { > lazyInit(CommonFieldsOnly); > >@@ -698,7 +698,7 @@ std::optional<Seconds> ResourceResponseBase::age() const > return m_age; > } > >-std::optional<WallTime> ResourceResponseBase::expires() const >+WTF::Optional<WallTime> ResourceResponseBase::expires() const > { > lazyInit(CommonFieldsOnly); > >@@ -709,7 +709,7 @@ std::optional<WallTime> ResourceResponseBase::expires() const > return m_expires; > } > >-std::optional<WallTime> ResourceResponseBase::lastModified() const >+WTF::Optional<WallTime> ResourceResponseBase::lastModified() const > { > lazyInit(CommonFieldsOnly); > >@@ -720,7 +720,7 @@ std::optional<WallTime> ResourceResponseBase::lastModified() const > // an invalid value (rdar://problem/22352838). > const WallTime epoch = WallTime::fromRawSeconds(0); > if (m_lastModified && m_lastModified.value() == epoch) >- m_lastModified = std::nullopt; >+ m_lastModified = WTF::nullopt; > #endif > m_haveParsedLastModifiedHeader = true; > } >diff --git a/Source/WebCore/platform/network/ResourceResponseBase.h b/Source/WebCore/platform/network/ResourceResponseBase.h >index 19c55068d799c36bbcea2816903043cee121db16..7af0989f4dfdcaa38560c1646c9416dac4538230 100644 >--- a/Source/WebCore/platform/network/ResourceResponseBase.h >+++ b/Source/WebCore/platform/network/ResourceResponseBase.h >@@ -127,7 +127,7 @@ public: > WEBCORE_EXPORT static String sanitizeSuggestedFilename(const String&); > > WEBCORE_EXPORT void includeCertificateInfo() const; >- const std::optional<CertificateInfo>& certificateInfo() const { return m_certificateInfo; }; >+ const WTF::Optional<CertificateInfo>& certificateInfo() const { return m_certificateInfo; }; > > // These functions return parsed values of the corresponding response headers. > WEBCORE_EXPORT bool cacheControlContainsNoCache() const; >@@ -135,11 +135,11 @@ public: > WEBCORE_EXPORT bool cacheControlContainsMustRevalidate() const; > WEBCORE_EXPORT bool cacheControlContainsImmutable() const; > WEBCORE_EXPORT bool hasCacheValidatorFields() const; >- WEBCORE_EXPORT std::optional<Seconds> cacheControlMaxAge() const; >- WEBCORE_EXPORT std::optional<WallTime> date() const; >- WEBCORE_EXPORT std::optional<Seconds> age() const; >- WEBCORE_EXPORT std::optional<WallTime> expires() const; >- WEBCORE_EXPORT std::optional<WallTime> lastModified() const; >+ WEBCORE_EXPORT WTF::Optional<Seconds> cacheControlMaxAge() const; >+ WEBCORE_EXPORT WTF::Optional<WallTime> date() const; >+ WEBCORE_EXPORT WTF::Optional<Seconds> age() const; >+ WEBCORE_EXPORT WTF::Optional<WallTime> expires() const; >+ WEBCORE_EXPORT WTF::Optional<WallTime> lastModified() const; > const ParsedContentRange& contentRange() const; > > enum class Source : uint8_t { Unknown, Network, DiskCache, DiskCacheAfterValidation, MemoryCache, MemoryCacheAfterValidation, ServiceWorker, ApplicationCache }; >@@ -214,7 +214,7 @@ protected: > HTTPHeaderMap m_httpHeaderFields; > mutable NetworkLoadMetrics m_networkLoadMetrics; > >- mutable std::optional<CertificateInfo> m_certificateInfo; >+ mutable WTF::Optional<CertificateInfo> m_certificateInfo; > > private: > mutable Markable<Seconds, Seconds::MarkableTraits> m_age; >diff --git a/Source/WebCore/platform/network/SocketStreamHandle.cpp b/Source/WebCore/platform/network/SocketStreamHandle.cpp >index 270f6134b9d6e9fa47154907dab233df265e95bb..a92898aa9d08a6175ca63895edf462dbe9a863e6 100644 >--- a/Source/WebCore/platform/network/SocketStreamHandle.cpp >+++ b/Source/WebCore/platform/network/SocketStreamHandle.cpp >@@ -56,7 +56,7 @@ void SocketStreamHandle::sendData(const char* data, size_t length, Function<void > platformSend(reinterpret_cast<const uint8_t*>(data), length, WTFMove(completionHandler)); > } > >-void SocketStreamHandle::sendHandshake(CString&& handshake, std::optional<CookieRequestHeaderFieldProxy>&& headerFieldProxy, Function<void(bool, bool)> completionHandler) >+void SocketStreamHandle::sendHandshake(CString&& handshake, WTF::Optional<CookieRequestHeaderFieldProxy>&& headerFieldProxy, Function<void(bool, bool)> completionHandler) > { > if (m_state == Connecting || m_state == Closing) > return completionHandler(false, false); >diff --git a/Source/WebCore/platform/network/SocketStreamHandle.h b/Source/WebCore/platform/network/SocketStreamHandle.h >index 6d1fd1a8309939894b49ea84b77a59f117d8a021..825e4a8a94e97c6e5fc978de8adbb82991770f5c 100644 >--- a/Source/WebCore/platform/network/SocketStreamHandle.h >+++ b/Source/WebCore/platform/network/SocketStreamHandle.h >@@ -54,7 +54,7 @@ public: > SocketStreamState state() const; > > void sendData(const char* data, size_t length, Function<void(bool)>); >- void sendHandshake(CString&& handshake, std::optional<CookieRequestHeaderFieldProxy>&&, Function<void(bool, bool)>); >+ void sendHandshake(CString&& handshake, WTF::Optional<CookieRequestHeaderFieldProxy>&&, Function<void(bool, bool)>); > void close(); // Disconnect after all data in buffer are sent. > void disconnect(); > virtual size_t bufferedAmount() = 0; >@@ -63,7 +63,7 @@ protected: > WEBCORE_EXPORT SocketStreamHandle(const URL&, SocketStreamHandleClient&); > > virtual void platformSend(const uint8_t* data, size_t length, Function<void(bool)>&&) = 0; >- virtual void platformSendHandshake(const uint8_t* data, size_t length, const std::optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) = 0; >+ virtual void platformSendHandshake(const uint8_t* data, size_t length, const WTF::Optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) = 0; > virtual void platformClose() = 0; > > URL m_url; >diff --git a/Source/WebCore/platform/network/SocketStreamHandleImpl.cpp b/Source/WebCore/platform/network/SocketStreamHandleImpl.cpp >index 389b6ea0366a69afc65ca30f18571ddf440ae4d3..5b9173e1d3fbbc8740785c130808d12e00444b39 100644 >--- a/Source/WebCore/platform/network/SocketStreamHandleImpl.cpp >+++ b/Source/WebCore/platform/network/SocketStreamHandleImpl.cpp >@@ -76,11 +76,11 @@ static size_t removeTerminationCharacters(const uint8_t* data, size_t dataLength > return dataLength - 2; > } > >-static std::optional<std::pair<Vector<uint8_t>, bool>> cookieDataForHandshake(const CookieRequestHeaderFieldProxy& headerFieldProxy) >+static WTF::Optional<std::pair<Vector<uint8_t>, bool>> cookieDataForHandshake(const CookieRequestHeaderFieldProxy& headerFieldProxy) > { > auto networkStorageSession = NetworkStorageSession::storageSession(headerFieldProxy.sessionID); > if (!networkStorageSession) >- return std::nullopt; >+ return WTF::nullopt; > > String cookieDataString; > bool secureCookiesAccessed = false; >@@ -97,7 +97,7 @@ static std::optional<std::pair<Vector<uint8_t>, bool>> cookieDataForHandshake(co > return std::pair<Vector<uint8_t>, bool> { data, secureCookiesAccessed }; > } > >-void SocketStreamHandleImpl::platformSendHandshake(const uint8_t* data, size_t length, const std::optional<CookieRequestHeaderFieldProxy>& headerFieldProxy, Function<void(bool, bool)>&& completionHandler) >+void SocketStreamHandleImpl::platformSendHandshake(const uint8_t* data, size_t length, const WTF::Optional<CookieRequestHeaderFieldProxy>& headerFieldProxy, Function<void(bool, bool)>&& completionHandler) > { > Vector<uint8_t> cookieData; > bool secureCookiesAccessed = false; >diff --git a/Source/WebCore/platform/network/cf/CertificateInfo.h b/Source/WebCore/platform/network/cf/CertificateInfo.h >index 3a711834dd6a4578ae256051ada96ccb41af1057..2747ca94c52200eb5de0712856a721de6ce69967 100644 >--- a/Source/WebCore/platform/network/cf/CertificateInfo.h >+++ b/Source/WebCore/platform/network/cf/CertificateInfo.h >@@ -74,7 +74,7 @@ public: > WEBCORE_EXPORT Type type() const; > WEBCORE_EXPORT bool containsNonRootSHA1SignedCertificate() const; > >- std::optional<SummaryInfo> summaryInfo() const; >+ WTF::Optional<SummaryInfo> summaryInfo() const; > > bool isEmpty() const { return type() == Type::None; } > >diff --git a/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp b/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp >index 448def8ca28bfb0cd64bb60facf73d8015585df7..148168206cd6e927accf4a88737620d52031679b 100644 >--- a/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp >@@ -93,11 +93,11 @@ bool CertificateInfo::containsNonRootSHA1SignedCertificate() const > return false; > } > >-std::optional<CertificateInfo::SummaryInfo> CertificateInfo::summaryInfo() const >+WTF::Optional<CertificateInfo::SummaryInfo> CertificateInfo::summaryInfo() const > { > auto chain = certificateChain(); > if (!chain) >- return std::nullopt; >+ return WTF::nullopt; > > SummaryInfo summaryInfo; > >diff --git a/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp b/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >index 5226f855b6bfa6c5eb93e9289a923d0ed2c782d5..ef33acbcf3f9cdbe1689ad6580935c79576ae824 100644 >--- a/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >@@ -365,7 +365,7 @@ static CFArrayRef createCookies(CFDictionaryRef headerFields, CFURLRef url) > return parsedCookies; > } > >-void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& value) const >+void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& value) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -401,7 +401,7 @@ static bool containsSecureCookies(CFArrayRef cookies) > return false; > } > >-std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -416,7 +416,7 @@ std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstPar > return { cookieString, didAccessSecureCookies }; > } > >-std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -440,7 +440,7 @@ bool NetworkStorageSession::cookiesEnabled() const > return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways; > } > >-bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const >+bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h b/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h >index c5f9c760cca7eecda253780a9ab5c227cffee8c8..122e41811123850b296b623d930aadd11a508f69 100644 >--- a/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h >+++ b/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h >@@ -51,11 +51,11 @@ public: > virtual ~SocketStreamHandleImpl(); > > WEBCORE_EXPORT void platformSend(const uint8_t* data, size_t length, Function<void(bool)>&&) final; >- WEBCORE_EXPORT void platformSendHandshake(const uint8_t* data, size_t length, const std::optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) final; >+ WEBCORE_EXPORT void platformSendHandshake(const uint8_t* data, size_t length, const WTF::Optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) final; > WEBCORE_EXPORT void platformClose() final; > private: > size_t bufferedAmount() final; >- std::optional<size_t> platformSendInternal(const uint8_t*, size_t); >+ WTF::Optional<size_t> platformSendInternal(const uint8_t*, size_t); > bool sendPendingData(); > > WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, SourceApplicationAuditToken&&); >diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp b/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >index ca73b70236455b17f30f3f1835923e6c4c1f7944..459fb60d1b28f3496a44f99933c39d4467ba7b3a 100644 >--- a/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >@@ -693,7 +693,7 @@ SocketStreamHandleImpl::~SocketStreamHandleImpl() > ASSERT(!m_pacRunLoopSource); > } > >-std::optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t* data, size_t length) >+WTF::Optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t* data, size_t length) > { > if (!m_writeStream) > return 0; >@@ -703,7 +703,7 @@ std::optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t > > CFIndex result = CFWriteStreamWrite(m_writeStream.get(), reinterpret_cast<const UInt8*>(data), length); > if (result == -1) >- return std::nullopt; >+ return WTF::nullopt; > > ASSERT(result >= 0); > return static_cast<size_t>(result); >diff --git a/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm b/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm >index c0900aeb5d16f433e4e715a90d3061dc4f55d085..2905d1a1ec76522c5b5e6f8f6db84a113cc5e720 100644 >--- a/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm >+++ b/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm >@@ -199,10 +199,10 @@ static RetainPtr<NSDictionary> policyProperties(const SameSiteInfo& sameSiteInfo > } > #endif > >-static NSArray *cookiesForURL(NSHTTPCookieStorage *storage, NSURL *url, NSURL *mainDocumentURL, const std::optional<SameSiteInfo>& sameSiteInfo, NSString *partition = nullptr) >+static NSArray *cookiesForURL(NSHTTPCookieStorage *storage, NSURL *url, NSURL *mainDocumentURL, const WTF::Optional<SameSiteInfo>& sameSiteInfo, NSString *partition = nullptr) > { >- // The _getCookiesForURL: method calls the completionHandler synchronously. We use std::optional<> to ensure this invariant. >- std::optional<RetainPtr<NSArray *>> cookiesPtr; >+ // The _getCookiesForURL: method calls the completionHandler synchronously. We use WTF::Optional<> to ensure this invariant. >+ WTF::Optional<RetainPtr<NSArray *>> cookiesPtr; > auto completionHandler = [&cookiesPtr] (NSArray *cookies) { > cookiesPtr = retainPtr(cookies); > }; >@@ -248,7 +248,7 @@ static void setHTTPCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSArray * > #endif > } > >-static NSArray *httpCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSURL *firstParty, const std::optional<SameSiteInfo>& sameSiteInfo, NSURL *url) >+static NSArray *httpCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSURL *firstParty, const WTF::Optional<SameSiteInfo>& sameSiteInfo, NSURL *url) > { > ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); > if (!cookieStorage) >@@ -260,7 +260,7 @@ static NSArray *httpCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSURL *f > return cookiesForURL(nsCookieStorage.get(), url, firstParty, sameSiteInfo); > } > >-static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies, std::optional<Seconds> cappedLifetime) >+static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies, WTF::Optional<Seconds> cappedLifetime) > { > ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); > NSUInteger count = [unfilteredCookies count]; >@@ -295,7 +295,7 @@ static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies, std::optiona > return filteredCookies; > } > >-static NSArray *cookiesForURL(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) >+static NSArray *cookiesForURL(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID) > { > #if ENABLE(RESOURCE_LOAD_STATISTICS) > if (session.shouldBlockCookies(firstParty, url, frameID, pageID)) >@@ -308,7 +308,7 @@ static NSArray *cookiesForURL(const NetworkStorageSession& session, const URL& f > } > > enum IncludeHTTPOnlyOrNot { DoNotIncludeHTTPOnly, IncludeHTTPOnly }; >-static std::pair<String, bool> cookiesForSession(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeHTTPOnlyOrNot includeHTTPOnly, IncludeSecureCookies includeSecureCookies) >+static std::pair<String, bool> cookiesForSession(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeHTTPOnlyOrNot includeHTTPOnly, IncludeSecureCookies includeSecureCookies) > { > ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); > >@@ -364,12 +364,12 @@ static void deleteAllHTTPCookies(CFHTTPCookieStorageRef cookieStorage) > CFHTTPCookieStorageDeleteAllCookies(cookieStorage); > } > >-std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > return cookiesForSession(*this, firstParty, sameSiteInfo, url, frameID, pageID, DoNotIncludeHTTPOnly, includeSecureCookies); > } > >-std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > return cookiesForSession(*this, firstParty, sameSiteInfo, url, frameID, pageID, IncludeHTTPOnly, includeSecureCookies); > } >@@ -379,7 +379,7 @@ std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(con > return cookiesForSession(*this, headerFieldProxy.firstParty, headerFieldProxy.sameSiteInfo, headerFieldProxy.url, headerFieldProxy.frameID, headerFieldProxy.pageID, IncludeHTTPOnly, headerFieldProxy.includeSecureCookies); > } > >-void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& cookieStr) const >+void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& cookieStr) const > { > ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); > >@@ -444,7 +444,7 @@ bool NetworkStorageSession::cookiesEnabled() const > return false; > } > >-bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const >+bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const > { > rawCookies.clear(); > BEGIN_BLOCK_OBJC_EXCEPTIONS; >@@ -468,7 +468,7 @@ void NetworkStorageSession::deleteCookie(const URL& url, const String& cookieNam > BEGIN_BLOCK_OBJC_EXCEPTIONS; > > RetainPtr<CFHTTPCookieStorageRef> cookieStorage = this->cookieStorage(); >- NSArray *cookies = httpCookiesForURL(cookieStorage.get(), nil, std::nullopt, url); >+ NSArray *cookies = httpCookiesForURL(cookieStorage.get(), nil, WTF::nullopt, url); > > NSString *cookieNameString = cookieName; > >diff --git a/Source/WebCore/platform/network/curl/AuthenticationChallenge.h b/Source/WebCore/platform/network/curl/AuthenticationChallenge.h >index 54de3d6b29dc2b1315c8f9bf044271f7d3273b67..a5d2cac48cfe88837b89e6d6c0ba816d17d0e8d1 100644 >--- a/Source/WebCore/platform/network/curl/AuthenticationChallenge.h >+++ b/Source/WebCore/platform/network/curl/AuthenticationChallenge.h >@@ -50,7 +50,7 @@ public: > private: > ProtectionSpaceServerType protectionSpaceServerTypeFromURI(const URL&, bool isForProxy); > ProtectionSpace protectionSpaceFromHandle(const CurlResponse&, const ResourceResponse&); >- std::optional<uint16_t> determineProxyPort(const URL&); >+ WTF::Optional<uint16_t> determineProxyPort(const URL&); > ProtectionSpaceAuthenticationScheme authenticationSchemeFromCurlAuth(long); > String parseRealm(const ResourceResponse&); > void removeLeadingAndTrailingQuotes(String&); >diff --git a/Source/WebCore/platform/network/curl/AuthenticationChallengeCurl.cpp b/Source/WebCore/platform/network/curl/AuthenticationChallengeCurl.cpp >index eb99b9787b3bd2dfae327229248d0214c7e1850c..79a997a26a429be9750b0642a456de2c67961c6d 100644 >--- a/Source/WebCore/platform/network/curl/AuthenticationChallengeCurl.cpp >+++ b/Source/WebCore/platform/network/curl/AuthenticationChallengeCurl.cpp >@@ -65,7 +65,7 @@ ProtectionSpace AuthenticationChallenge::protectionSpaceFromHandle(const CurlRes > return ProtectionSpace(url.host().toString(), static_cast<int>(port ? *port : 0), serverType, parseRealm(response), authenticationScheme); > } > >-std::optional<uint16_t> AuthenticationChallenge::determineProxyPort(const URL& url) >+WTF::Optional<uint16_t> AuthenticationChallenge::determineProxyPort(const URL& url) > { > static const uint16_t socksPort = 1080; > >@@ -78,7 +78,7 @@ std::optional<uint16_t> AuthenticationChallenge::determineProxyPort(const URL& u > if (protocolIsInSocksFamily(url)) > return socksPort; > >- return std::nullopt; >+ return WTF::nullopt; > } > > ProtectionSpaceAuthenticationScheme AuthenticationChallenge::authenticationSchemeFromCurlAuth(long curlAuth) >diff --git a/Source/WebCore/platform/network/curl/CertificateInfo.h b/Source/WebCore/platform/network/curl/CertificateInfo.h >index eed863b8118b68ea992371ed5b86be92737ea6ca..d95e13975ea65290c2381806556fcaca68910609 100644 >--- a/Source/WebCore/platform/network/curl/CertificateInfo.h >+++ b/Source/WebCore/platform/network/curl/CertificateInfo.h >@@ -49,7 +49,7 @@ public: > > bool containsNonRootSHA1SignedCertificate() const { notImplemented(); return false; } > >- std::optional<SummaryInfo> summaryInfo() const { notImplemented(); return std::nullopt; } >+ WTF::Optional<SummaryInfo> summaryInfo() const { notImplemented(); return WTF::nullopt; } > > bool isEmpty() const { return m_certificateChain.isEmpty(); } > >diff --git a/Source/WebCore/platform/network/curl/CookieJarCurl.cpp b/Source/WebCore/platform/network/curl/CookieJarCurl.cpp >index ef606b65603fcdb91937da2162a436dbe6d48b9e..408e1563784db3411a748f431197bd7efc30ec50 100644 >--- a/Source/WebCore/platform/network/curl/CookieJarCurl.cpp >+++ b/Source/WebCore/platform/network/curl/CookieJarCurl.cpp >@@ -44,10 +44,10 @@ static String cookiesForSession(const NetworkStorageSession& session, const URL& > StringBuilder cookies; > > CookieJarDB& cookieJarDB = session.cookieDatabase(); >- auto searchHTTPOnly = (forHTTPHeader ? std::nullopt : std::optional<bool> {false}); >- auto secure = url.protocolIs("https") ? std::nullopt : std::optional<bool> {false}; >+ auto searchHTTPOnly = (forHTTPHeader ? WTF::nullopt : WTF::Optional<bool> {false}); >+ auto secure = url.protocolIs("https") ? WTF::nullopt : WTF::Optional<bool> {false}; > >- if (auto result = cookieJarDB.searchCookies(url.string(), searchHTTPOnly, secure, std::nullopt)) { >+ if (auto result = cookieJarDB.searchCookies(url.string(), searchHTTPOnly, secure, WTF::nullopt)) { > for (auto& cookie : *result) { > if (!cookies.isEmpty()) > cookies.append("; "); >@@ -59,7 +59,7 @@ static String cookiesForSession(const NetworkStorageSession& session, const URL& > return cookies.toString(); > } > >-void CookieJarCurl::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& value) const >+void CookieJarCurl::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& value) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -75,7 +75,7 @@ void CookieJarCurl::setCookiesFromHTTPResponse(const NetworkStorageSession& sess > cookieJarDB.setCookie(url.string(), value, CookieJarDB::Source::Network); > } > >-std::pair<String, bool> CookieJarCurl::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const >+std::pair<String, bool> CookieJarCurl::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -84,7 +84,7 @@ std::pair<String, bool> CookieJarCurl::cookiesForDOM(const NetworkStorageSession > return { cookiesForSession(session, firstParty, url, false), false }; > } > >-std::pair<String, bool> CookieJarCurl::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const >+std::pair<String, bool> CookieJarCurl::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -103,13 +103,13 @@ bool CookieJarCurl::cookiesEnabled(const NetworkStorageSession& session) const > return session.cookieDatabase().isEnabled(); > } > >-bool CookieJarCurl::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const >+bool CookieJarCurl::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); > > CookieJarDB& cookieJarDB = session.cookieDatabase(); >- if (auto cookies = cookieJarDB.searchCookies(firstParty.string(), std::nullopt, std::nullopt, std::nullopt)) { >+ if (auto cookies = cookieJarDB.searchCookies(firstParty.string(), WTF::nullopt, WTF::nullopt, WTF::nullopt)) { > rawCookies = WTFMove(*cookies); > return true; > } >diff --git a/Source/WebCore/platform/network/curl/CookieJarCurl.h b/Source/WebCore/platform/network/curl/CookieJarCurl.h >index 9f69bd409789a7677feb02fa94798e2ae26676e6..79a32143775c80224029d31012e12aaa5621fda9 100644 >--- a/Source/WebCore/platform/network/curl/CookieJarCurl.h >+++ b/Source/WebCore/platform/network/curl/CookieJarCurl.h >@@ -40,13 +40,13 @@ struct SameSiteInfo; > > class CookieJarCurl { > public: >- std::pair<String, bool> cookiesForDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const; >- void setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String&) const; >+ std::pair<String, bool> cookiesForDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const; >+ void setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String&) const; > void setCookiesFromHTTPResponse(const NetworkStorageSession&, const URL&, const String&) const; > bool cookiesEnabled(const NetworkStorageSession&) const; >- std::pair<String, bool> cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const; >+ std::pair<String, bool> cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const; > std::pair<String, bool> cookieRequestHeaderFieldValue(const NetworkStorageSession&, const CookieRequestHeaderFieldProxy&) const; >- bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>&) const; >+ bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>&) const; > void deleteCookie(const NetworkStorageSession&, const URL&, const String&) const; > void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) const; > void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) const; >diff --git a/Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp b/Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp >index c2d051e3793f5a8e868a4e79dfe1646567517aff..5d719f4f788cc66e0a6cbee2a61f6fa47b84d287 100644 >--- a/Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp >+++ b/Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp >@@ -44,11 +44,11 @@ static String cookiesForSession(const NetworkStorageSession& session, const URL& > StringBuilder cookies; > > CookieJarDB& cookieJarDB = session.cookieDatabase(); >- auto searchHTTPOnly = (forHTTPHeader ? std::nullopt : std::optional<bool> {false}); >- auto secure = url.protocolIs("https") ? std::nullopt : std::optional<bool> {false}; >+ auto searchHTTPOnly = (forHTTPHeader ? WTF::nullopt : WTF::Optional<bool> {false}); >+ auto secure = url.protocolIs("https") ? WTF::nullopt : WTF::Optional<bool> {false}; > > Vector<Cookie> results; >- if (cookieJarDB.searchCookies(url.string(), searchHTTPOnly, secure, std::nullopt, results)) { >+ if (cookieJarDB.searchCookies(url.string(), searchHTTPOnly, secure, WTF::nullopt, results)) { > for (auto result : results) { > if (!cookies.isEmpty()) > cookies.append("; "); >@@ -60,7 +60,7 @@ static String cookiesForSession(const NetworkStorageSession& session, const URL& > return cookies.toString(); > } > >-void CookieJarCurlDatabase::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& value) const >+void CookieJarCurlDatabase::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& value) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -76,7 +76,7 @@ void CookieJarCurlDatabase::setCookiesFromHTTPResponse(const NetworkStorageSessi > cookieJarDB.setCookie(url.string(), value, false); > } > >-std::pair<String, bool> CookieJarCurlDatabase::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const >+std::pair<String, bool> CookieJarCurlDatabase::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -85,7 +85,7 @@ std::pair<String, bool> CookieJarCurlDatabase::cookiesForDOM(const NetworkStorag > return { cookiesForSession(session, firstParty, url, false), false }; > } > >-std::pair<String, bool> CookieJarCurlDatabase::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies) const >+std::pair<String, bool> CookieJarCurlDatabase::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -104,13 +104,13 @@ bool CookieJarCurlDatabase::cookiesEnabled(const NetworkStorageSession& session) > return session.cookieDatabase().isEnabled(); > } > >-bool CookieJarCurlDatabase::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const >+bool CookieJarCurlDatabase::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); > > CookieJarDB& cookieJarDB = session.cookieDatabase(); >- return cookieJarDB.searchCookies(firstParty.string(), std::nullopt, std::nullopt, std::nullopt, rawCookies); >+ return cookieJarDB.searchCookies(firstParty.string(), WTF::nullopt, WTF::nullopt, WTF::nullopt, rawCookies); > } > > void CookieJarCurlDatabase::deleteCookie(const NetworkStorageSession& session, const URL& url, const String& name) const >diff --git a/Source/WebCore/platform/network/curl/CookieJarDB.cpp b/Source/WebCore/platform/network/curl/CookieJarDB.cpp >index 12921c7f53b6f7e0a479a5b99f979efb7c2674d5..68294077956ec27b1c72e909761b01c4d29fd06f 100644 >--- a/Source/WebCore/platform/network/curl/CookieJarDB.cpp >+++ b/Source/WebCore/platform/network/curl/CookieJarDB.cpp >@@ -312,17 +312,17 @@ bool CookieJarDB::isEnabled() const > return m_isEnabled; > } > >-std::optional<Vector<Cookie>> CookieJarDB::searchCookies(const String& requestUrl, const std::optional<bool>& httpOnly, const std::optional<bool>& secure, const std::optional<bool>& session) >+WTF::Optional<Vector<Cookie>> CookieJarDB::searchCookies(const String& requestUrl, const WTF::Optional<bool>& httpOnly, const WTF::Optional<bool>& secure, const WTF::Optional<bool>& session) > { > if (!isEnabled() || !m_database.isOpen()) >- return std::nullopt; >+ return WTF::nullopt; > > URL requestUrlObj({ }, requestUrl); > String requestHost(requestUrlObj.host().toString().convertToASCIILowercase()); > String requestPath(requestUrlObj.path().convertToASCIILowercase()); > > if (requestHost.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > if (requestPath.isEmpty()) > requestPath = "/"; >@@ -338,7 +338,7 @@ std::optional<Vector<Cookie>> CookieJarDB::searchCookies(const String& requestUr > > auto pstmt = std::make_unique<SQLiteStatement>(m_database, sql); > if (!pstmt) >- return std::nullopt; >+ return WTF::nullopt; > > pstmt->prepare(); > pstmt->bindInt(1, httpOnly ? *httpOnly : -1); >@@ -368,7 +368,7 @@ std::optional<Vector<Cookie>> CookieJarDB::searchCookies(const String& requestUr > } > > if (!pstmt) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<Cookie> results; > >diff --git a/Source/WebCore/platform/network/curl/CookieJarDB.h b/Source/WebCore/platform/network/curl/CookieJarDB.h >index 7759614500487632641df515fbeaaa7e5f9235f0..dc14517fbc8095a6ac2084f58dc5f6f47ec663eb 100644 >--- a/Source/WebCore/platform/network/curl/CookieJarDB.h >+++ b/Source/WebCore/platform/network/curl/CookieJarDB.h >@@ -48,7 +48,7 @@ public: > bool isEnabled() const; > void setEnabled(bool); > >- std::optional<Vector<Cookie>> searchCookies(const String& requestUrl, const std::optional<bool>& httpOnly, const std::optional<bool>& secure, const std::optional<bool>& session); >+ WTF::Optional<Vector<Cookie>> searchCookies(const String& requestUrl, const WTF::Optional<bool>& httpOnly, const WTF::Optional<bool>& secure, const WTF::Optional<bool>& session); > bool setCookie(const String& url, const String& cookie, Source); > bool setCookie(const Cookie&); > >diff --git a/Source/WebCore/platform/network/curl/CookieUtil.cpp b/Source/WebCore/platform/network/curl/CookieUtil.cpp >index be5e79ae2d715eb6f6859a9a7de59fd7e4b7546d..e49bcdb902b66292d5e1d60fbef5b1d70ec62e86 100644 >--- a/Source/WebCore/platform/network/curl/CookieUtil.cpp >+++ b/Source/WebCore/platform/network/curl/CookieUtil.cpp >@@ -79,13 +79,13 @@ bool domainMatch(const String& cookieDomain, const String& host) > return false; > } > >-static std::optional<double> parseExpires(const char* expires) >+static WTF::Optional<double> parseExpires(const char* expires) > { > double tmp = WTF::parseDateFromNullTerminatedCharacters(expires); > if (isnan(tmp)) > return { }; > >- return std::optional<double> {tmp / WTF::msPerSecond}; >+ return WTF::Optional<double> {tmp / WTF::msPerSecond}; > } > > static void parseCookieAttributes(const String& attribute, bool& hasMaxAge, Cookie& result) >@@ -137,10 +137,10 @@ static void parseCookieAttributes(const String& attribute, bool& hasMaxAge, Cook > } > } > >-std::optional<Cookie> parseCookieHeader(const String& cookieLine) >+WTF::Optional<Cookie> parseCookieHeader(const String& cookieLine) > { > if (cookieLine.length() >= MAX_COOKIE_LINE) >- return std::nullopt; >+ return WTF::nullopt; > > // This Algorithm is based on the algorithm defined in RFC 6265 5.2 https://tools.ietf.org/html/rfc6265#section-5.2/ > >diff --git a/Source/WebCore/platform/network/curl/CookieUtil.h b/Source/WebCore/platform/network/curl/CookieUtil.h >index 84d38df7e0bec734a8343209345cfe8d7f850edf..5a39bc74dc90906318cf9d086275602651ee3682 100644 >--- a/Source/WebCore/platform/network/curl/CookieUtil.h >+++ b/Source/WebCore/platform/network/curl/CookieUtil.h >@@ -34,7 +34,7 @@ struct Cookie; > > namespace CookieUtil { > >-std::optional<Cookie> parseCookieHeader(const String&); >+WTF::Optional<Cookie> parseCookieHeader(const String&); > > bool isIPAddress(const String&); > >diff --git a/Source/WebCore/platform/network/curl/CurlContext.cpp b/Source/WebCore/platform/network/curl/CurlContext.cpp >index f79ba8f86245eb74637a2c5a83c9658e05c1cbd8..6f7ad8ad23341900f56df8fd2c0f5c71ebc0b650 100644 >--- a/Source/WebCore/platform/network/curl/CurlContext.cpp >+++ b/Source/WebCore/platform/network/curl/CurlContext.cpp >@@ -52,7 +52,7 @@ public: > const char* read(const char* name) { return ::getenv(name); } > bool defined(const char* name) { return read(name) != nullptr; } > >- template<typename T> std::optional<T> readAs(const char* name) >+ template<typename T> WTF::Optional<T> readAs(const char* name) > { > if (const char* valueStr = read(name)) { > T value; >@@ -60,7 +60,7 @@ public: > return value; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > private: >@@ -639,95 +639,95 @@ void CurlHandle::enableConnectionOnly() > curl_easy_setopt(m_handle, CURLOPT_CONNECT_ONLY, 1L); > } > >-std::optional<String> CurlHandle::getProxyUrl() >+WTF::Optional<String> CurlHandle::getProxyUrl() > { > auto& proxy = CurlContext::singleton().proxySettings(); > if (proxy.mode() == CurlProxySettings::Mode::Default) >- return std::nullopt; >+ return WTF::nullopt; > > return proxy.url(); > } > >-std::optional<long> CurlHandle::getResponseCode() >+WTF::Optional<long> CurlHandle::getResponseCode() > { > if (!m_handle) >- return std::nullopt; >+ return WTF::nullopt; > > long responseCode; > CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_RESPONSE_CODE, &responseCode); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > return responseCode; > } > >-std::optional<long> CurlHandle::getHttpConnectCode() >+WTF::Optional<long> CurlHandle::getHttpConnectCode() > { > if (!m_handle) >- return std::nullopt; >+ return WTF::nullopt; > > long httpConnectCode; > CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_HTTP_CONNECTCODE, &httpConnectCode); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > return httpConnectCode; > } > >-std::optional<long long> CurlHandle::getContentLength() >+WTF::Optional<long long> CurlHandle::getContentLength() > { > if (!m_handle) >- return std::nullopt; >+ return WTF::nullopt; > > double contentLength; > > CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &contentLength); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > return static_cast<long long>(contentLength); > } > >-std::optional<long> CurlHandle::getHttpAuthAvail() >+WTF::Optional<long> CurlHandle::getHttpAuthAvail() > { > if (!m_handle) >- return std::nullopt; >+ return WTF::nullopt; > > long httpAuthAvailable; > CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_HTTPAUTH_AVAIL, &httpAuthAvailable); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > return httpAuthAvailable; > } > >-std::optional<long> CurlHandle::getProxyAuthAvail() >+WTF::Optional<long> CurlHandle::getProxyAuthAvail() > { > if (!m_handle) >- return std::nullopt; >+ return WTF::nullopt; > > long proxyAuthAvailable; > CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_PROXYAUTH_AVAIL, &proxyAuthAvailable); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > return proxyAuthAvailable; > } > >-std::optional<long> CurlHandle::getHttpVersion() >+WTF::Optional<long> CurlHandle::getHttpVersion() > { > if (!m_handle) >- return std::nullopt; >+ return WTF::nullopt; > > long version; > CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_HTTP_VERSION, &version); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > return version; > } > >-std::optional<NetworkLoadMetrics> CurlHandle::getNetworkLoadMetrics(const WTF::Seconds& domainLookupStart) >+WTF::Optional<NetworkLoadMetrics> CurlHandle::getNetworkLoadMetrics(const WTF::Seconds& domainLookupStart) > { > double nameLookup = 0.0; > double connect = 0.0; >@@ -736,27 +736,27 @@ std::optional<NetworkLoadMetrics> CurlHandle::getNetworkLoadMetrics(const WTF::S > long version = 0; > > if (!m_handle) >- return std::nullopt; >+ return WTF::nullopt; > > CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_NAMELOOKUP_TIME, &nameLookup); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > errorCode = curl_easy_getinfo(m_handle, CURLINFO_CONNECT_TIME, &connect); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > errorCode = curl_easy_getinfo(m_handle, CURLINFO_APPCONNECT_TIME, &appConnect); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > errorCode = curl_easy_getinfo(m_handle, CURLINFO_STARTTRANSFER_TIME, &startTransfer); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > errorCode = curl_easy_getinfo(m_handle, CURLINFO_HTTP_VERSION, &version); > if (errorCode != CURLE_OK) >- return std::nullopt; >+ return WTF::nullopt; > > NetworkLoadMetrics networkLoadMetrics; > >@@ -829,10 +829,10 @@ void CurlHandle::addExtraNetworkLoadMetrics(NetworkLoadMetrics& networkLoadMetri > } > } > >-std::optional<CertificateInfo> CurlHandle::certificateInfo() const >+WTF::Optional<CertificateInfo> CurlHandle::certificateInfo() const > { > if (!m_sslVerifier) >- return std::nullopt; >+ return WTF::nullopt; > > return m_sslVerifier->certificateInfo(); > } >@@ -921,7 +921,7 @@ size_t CurlSocketHandle::send(const uint8_t* buffer, size_t size) > return totalBytesSent; > } > >-std::optional<size_t> CurlSocketHandle::receive(uint8_t* buffer, size_t bufferSize) >+WTF::Optional<size_t> CurlSocketHandle::receive(uint8_t* buffer, size_t bufferSize) > { > size_t bytesRead = 0; > >@@ -930,19 +930,19 @@ std::optional<size_t> CurlSocketHandle::receive(uint8_t* buffer, size_t bufferSi > if (errorCode != CURLE_AGAIN) > m_errorHandler(errorCode); > >- return std::nullopt; >+ return WTF::nullopt; > } > > return bytesRead; > } > >-std::optional<CurlSocketHandle::WaitResult> CurlSocketHandle::wait(const Seconds& timeout, bool alsoWaitForWrite) >+WTF::Optional<CurlSocketHandle::WaitResult> CurlSocketHandle::wait(const Seconds& timeout, bool alsoWaitForWrite) > { > curl_socket_t socket; > CURLcode errorCode = curl_easy_getinfo(handle(), CURLINFO_ACTIVESOCKET, &socket); > if (errorCode != CURLE_OK) { > m_errorHandler(errorCode); >- return std::nullopt; >+ return WTF::nullopt; > } > > int64_t usec = timeout.microsecondsAs<int64_t>(); >@@ -978,7 +978,7 @@ std::optional<CurlSocketHandle::WaitResult> CurlSocketHandle::wait(const Seconds > } while (rc == -1 && errno == EINTR); > > if (rc <= 0) >- return std::nullopt; >+ return WTF::nullopt; > > WaitResult result; > result.readable = FD_ISSET(socket, &fdread) || FD_ISSET(socket, &fderr); >diff --git a/Source/WebCore/platform/network/curl/CurlContext.h b/Source/WebCore/platform/network/curl/CurlContext.h >index e741038dc43cc2ae36e66eebc87f16659e48fdad..f332a008cdfd969a788258ab6ab1c909e383868c 100644 >--- a/Source/WebCore/platform/network/curl/CurlContext.h >+++ b/Source/WebCore/platform/network/curl/CurlContext.h >@@ -274,18 +274,18 @@ public: > void setSslCtxCallbackFunction(curl_ssl_ctx_callback, void*); > > // Status >- std::optional<String> getProxyUrl(); >- std::optional<long> getResponseCode(); >- std::optional<long> getHttpConnectCode(); >- std::optional<long long> getContentLength(); >- std::optional<long> getHttpAuthAvail(); >- std::optional<long> getProxyAuthAvail(); >- std::optional<long> getHttpVersion(); >- std::optional<NetworkLoadMetrics> getNetworkLoadMetrics(const WTF::Seconds& domainLookupStart); >+ WTF::Optional<String> getProxyUrl(); >+ WTF::Optional<long> getResponseCode(); >+ WTF::Optional<long> getHttpConnectCode(); >+ WTF::Optional<long long> getContentLength(); >+ WTF::Optional<long> getHttpAuthAvail(); >+ WTF::Optional<long> getProxyAuthAvail(); >+ WTF::Optional<long> getHttpVersion(); >+ WTF::Optional<NetworkLoadMetrics> getNetworkLoadMetrics(const WTF::Seconds& domainLookupStart); > void addExtraNetworkLoadMetrics(NetworkLoadMetrics&); > > int sslErrors() const; >- std::optional<CertificateInfo> certificateInfo() const; >+ WTF::Optional<CertificateInfo> certificateInfo() const; > > static long long maxCurlOffT(); > >@@ -322,8 +322,8 @@ public: > > bool connect(); > size_t send(const uint8_t*, size_t); >- std::optional<size_t> receive(uint8_t*, size_t); >- std::optional<WaitResult> wait(const Seconds& timeout, bool alsoWaitForWrite); >+ WTF::Optional<size_t> receive(uint8_t*, size_t); >+ WTF::Optional<WaitResult> wait(const Seconds& timeout, bool alsoWaitForWrite); > > private: > Function<void(CURLcode)> m_errorHandler; >diff --git a/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp b/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp >index 7ece8953b20b0957904248a4c9de2de9d62b57c3..0b0bf39e024c90392686334b9785401f00912097 100644 >--- a/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp >+++ b/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp >@@ -107,10 +107,10 @@ void CurlFormDataStream::computeContentLength() > m_totalSize += element.lengthInBytes(); > } > >-std::optional<size_t> CurlFormDataStream::read(char* buffer, size_t size) >+WTF::Optional<size_t> CurlFormDataStream::read(char* buffer, size_t size) > { > if (!m_formData) >- return std::nullopt; >+ return WTF::nullopt; > > const auto totalElementSize = m_formData->elements().size(); > if (m_elementPosition >= totalElementSize) >@@ -124,19 +124,19 @@ std::optional<size_t> CurlFormDataStream::read(char* buffer, size_t size) > size_t bufferSize = size - totalReadBytes; > char* bufferPosition = buffer + totalReadBytes; > >- std::optional<size_t> readBytes = switchOn(element.data, >+ WTF::Optional<size_t> readBytes = switchOn(element.data, > [&] (const Vector<char>& bytes) { > return readFromData(bytes, bufferPosition, bufferSize); > }, [&] (const FormDataElement::EncodedFileData& fileData) { > return readFromFile(fileData, bufferPosition, bufferSize); > }, [] (const FormDataElement::EncodedBlobData& blobData) { > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > ); > > if (!readBytes) >- return std::nullopt; >+ return WTF::nullopt; > > totalReadBytes += *readBytes; > } >@@ -146,7 +146,7 @@ std::optional<size_t> CurlFormDataStream::read(char* buffer, size_t size) > return totalReadBytes; > } > >-std::optional<size_t> CurlFormDataStream::readFromFile(const FormDataElement::EncodedFileData& fileData, char* buffer, size_t size) >+WTF::Optional<size_t> CurlFormDataStream::readFromFile(const FormDataElement::EncodedFileData& fileData, char* buffer, size_t size) > { > if (m_fileHandle == FileSystem::invalidPlatformFileHandle) > m_fileHandle = FileSystem::openFile(fileData.filename, FileSystem::FileOpenMode::Read); >@@ -154,7 +154,7 @@ std::optional<size_t> CurlFormDataStream::readFromFile(const FormDataElement::En > if (!FileSystem::isHandleValid(m_fileHandle)) { > LOG(Network, "Curl - Failed while trying to open %s for upload\n", fileData.filename.utf8().data()); > m_fileHandle = FileSystem::invalidPlatformFileHandle; >- return std::nullopt; >+ return WTF::nullopt; > } > > auto readBytes = FileSystem::readFromFile(m_fileHandle, buffer, size); >@@ -162,7 +162,7 @@ std::optional<size_t> CurlFormDataStream::readFromFile(const FormDataElement::En > LOG(Network, "Curl - Failed while trying to read %s for upload\n", fileData.filename.utf8().data()); > FileSystem::closeFile(m_fileHandle); > m_fileHandle = FileSystem::invalidPlatformFileHandle; >- return std::nullopt; >+ return WTF::nullopt; > } > > if (!readBytes) { >@@ -174,7 +174,7 @@ std::optional<size_t> CurlFormDataStream::readFromFile(const FormDataElement::En > return readBytes; > } > >-std::optional<size_t> CurlFormDataStream::readFromData(const Vector<char>& data, char* buffer, size_t size) >+WTF::Optional<size_t> CurlFormDataStream::readFromData(const Vector<char>& data, char* buffer, size_t size) > { > size_t elementSize = data.size() - m_dataOffset; > const char* elementBuffer = data.data() + m_dataOffset; >diff --git a/Source/WebCore/platform/network/curl/CurlFormDataStream.h b/Source/WebCore/platform/network/curl/CurlFormDataStream.h >index 6c7a00e15eca42eb2a480b69db36c7f60ee81a9d..cb7b1e5f45ccbd966e06a85ab3b0584335470b85 100644 >--- a/Source/WebCore/platform/network/curl/CurlFormDataStream.h >+++ b/Source/WebCore/platform/network/curl/CurlFormDataStream.h >@@ -45,14 +45,14 @@ public: > bool shouldUseChunkTransfer(); > unsigned long long totalSize(); > >- std::optional<size_t> read(char*, size_t); >+ WTF::Optional<size_t> read(char*, size_t); > unsigned long long totalReadSize() { return m_totalReadSize; } > > private: > void computeContentLength(); > >- std::optional<size_t> readFromFile(const FormDataElement::EncodedFileData&, char*, size_t); >- std::optional<size_t> readFromData(const Vector<char>&, char*, size_t); >+ WTF::Optional<size_t> readFromFile(const FormDataElement::EncodedFileData&, char*, size_t); >+ WTF::Optional<size_t> readFromData(const Vector<char>&, char*, size_t); > > RefPtr<FormData> m_formData; > >diff --git a/Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp b/Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp >index 9948c55920c5bb936d925e8c95c2b7c8c1ce5583..386c0616b4d3166a8e6f3538c625757015d88593 100644 >--- a/Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp >+++ b/Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp >@@ -49,7 +49,7 @@ std::unique_ptr<CurlMultipartHandle> CurlMultipartHandle::createIfNeeded(CurlMul > return std::make_unique<CurlMultipartHandle>(client, *boundary); > } > >-std::optional<String> CurlMultipartHandle::extractBoundary(const CurlResponse& response) >+WTF::Optional<String> CurlMultipartHandle::extractBoundary(const CurlResponse& response) > { > for (auto header : response.headers) { > auto splitPosistion = header.find(":"); >@@ -72,16 +72,16 @@ std::optional<String> CurlMultipartHandle::extractBoundary(const CurlResponse& r > return String("--" + *boundary); > } > >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<String> CurlMultipartHandle::extractBoundaryFromContentType(const String& contentType) >+WTF::Optional<String> CurlMultipartHandle::extractBoundaryFromContentType(const String& contentType) > { > static const size_t length = strlen("boundary="); > > auto boundaryStart = contentType.findIgnoringASCIICase("boundary="); > if (boundaryStart == notFound) >- return std::nullopt; >+ return WTF::nullopt; > > boundaryStart += length; > size_t boundaryEnd = 0; >@@ -91,13 +91,13 @@ std::optional<String> CurlMultipartHandle::extractBoundaryFromContentType(const > ++boundaryStart; > boundaryEnd = contentType.find('"', boundaryStart); > if (boundaryEnd == notFound) >- return std::nullopt; >+ return WTF::nullopt; > } else if (contentType[boundaryStart] == '\'') { > // Boundary value starts with a ' quote. Search for the closing one. > ++boundaryStart; > boundaryEnd = contentType.find('\'', boundaryStart); > if (boundaryEnd == notFound) >- return std::nullopt; >+ return WTF::nullopt; > } else { > // Check for the end of the boundary. That can be a semicolon or a newline. > boundaryEnd = contentType.find(';', boundaryStart); >@@ -107,7 +107,7 @@ std::optional<String> CurlMultipartHandle::extractBoundaryFromContentType(const > > // The boundary end should not be before the start > if (boundaryEnd <= boundaryStart) >- return std::nullopt; >+ return WTF::nullopt; > > return contentType.substring(boundaryStart, boundaryEnd - boundaryStart); > } >diff --git a/Source/WebCore/platform/network/curl/CurlMultipartHandle.h b/Source/WebCore/platform/network/curl/CurlMultipartHandle.h >index e5268683521bf752e6307c3d808b14fd3e47c449..f46851b34376f5a93b0c65e0c28c34abe5f7c78c 100644 >--- a/Source/WebCore/platform/network/curl/CurlMultipartHandle.h >+++ b/Source/WebCore/platform/network/curl/CurlMultipartHandle.h >@@ -56,8 +56,8 @@ private: > End > }; > >- static std::optional<String> extractBoundary(const CurlResponse&); >- static std::optional<String> extractBoundaryFromContentType(const String&); >+ static WTF::Optional<String> extractBoundary(const CurlResponse&); >+ static WTF::Optional<String> extractBoundaryFromContentType(const String&); > > bool processContent(); > bool checkForBoundary(size_t& boundaryStartPosition, size_t& lastPartialMatchPosition); >diff --git a/Source/WebCore/platform/network/curl/CurlProxySettings.cpp b/Source/WebCore/platform/network/curl/CurlProxySettings.cpp >index 4caf0ad34a67c6f2e5ccdcbc924ebbb33eb3ce4f..41124a3b871eefdb662fb936c5bde875ed2c6570 100644 >--- a/Source/WebCore/platform/network/curl/CurlProxySettings.cpp >+++ b/Source/WebCore/platform/network/curl/CurlProxySettings.cpp >@@ -38,8 +38,8 @@ namespace WebCore { > > static const uint16_t SocksProxyPort = 1080; > >-static std::optional<uint16_t> getProxyPort(const URL&); >-static std::optional<String> createProxyUrl(const URL&); >+static WTF::Optional<uint16_t> getProxyPort(const URL&); >+static WTF::Optional<String> createProxyUrl(const URL&); > > CurlProxySettings::CurlProxySettings(URL&& proxyUrl, String&& ignoreHosts) > : m_mode(Mode::Custom) >@@ -89,7 +89,7 @@ bool protocolIsInSocksFamily(const URL& url) > return url.protocolIs("socks4") || url.protocolIs("socks4a") || url.protocolIs("socks5") || url.protocolIs("socks5h"); > } > >-static std::optional<uint16_t> getProxyPort(const URL& url) >+static WTF::Optional<uint16_t> getProxyPort(const URL& url) > { > auto port = url.port(); > if (port) >@@ -103,20 +103,20 @@ static std::optional<uint16_t> getProxyPort(const URL& url) > if (protocolIsInSocksFamily(url)) > return SocksProxyPort; > >- return std::nullopt; >+ return WTF::nullopt; > } > >-static std::optional<String> createProxyUrl(const URL &url) >+static WTF::Optional<String> createProxyUrl(const URL &url) > { > if (url.isEmpty() || url.host().isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > if (!url.protocolIsInHTTPFamily() && !protocolIsInSocksFamily(url)) >- return std::nullopt; >+ return WTF::nullopt; > > auto port = getProxyPort(url); > if (!port) >- return std::nullopt; >+ return WTF::nullopt; > > auto userpass = (url.hasUsername() || url.hasPassword()) ? makeString(url.user(), ":", url.pass(), "@") : String(); > return makeString(url.protocol(), "://", userpass, url.host(), ":", String::number(*port)); >diff --git a/Source/WebCore/platform/network/curl/CurlSSLHandle.cpp b/Source/WebCore/platform/network/curl/CurlSSLHandle.cpp >index 2dd6192cf6775abe13dd75659452bf5c0526b22c..b0f48e27014fc0848e4c1943e6ede2cac3cdc18a 100644 >--- a/Source/WebCore/platform/network/curl/CurlSSLHandle.cpp >+++ b/Source/WebCore/platform/network/curl/CurlSSLHandle.cpp >@@ -82,13 +82,13 @@ void CurlSSLHandle::setClientCertificateInfo(const String& hostName, const Strin > m_allowedClientHosts.set(hostName, ClientCertificate { certificate, key }); > } > >-std::optional<CurlSSLHandle::ClientCertificate> CurlSSLHandle::getSSLClientCertificate(const String& hostName) const >+WTF::Optional<CurlSSLHandle::ClientCertificate> CurlSSLHandle::getSSLClientCertificate(const String& hostName) const > { > LockHolder mutex(m_allowedClientHostsLock); > > auto it = m_allowedClientHosts.find(hostName); > if (it == m_allowedClientHosts.end()) >- return std::nullopt; >+ return WTF::nullopt; > > return it->value; > } >diff --git a/Source/WebCore/platform/network/curl/CurlSSLHandle.h b/Source/WebCore/platform/network/curl/CurlSSLHandle.h >index e0768a12e728d3270aef421fe07307dfc602c471..16c9216e5d55a59b7db0433a41c7cca2a54f1b14 100644 >--- a/Source/WebCore/platform/network/curl/CurlSSLHandle.h >+++ b/Source/WebCore/platform/network/curl/CurlSSLHandle.h >@@ -73,7 +73,7 @@ public: > bool canIgnoreAnyHTTPSCertificatesForHost(const String&) const; > > WEBCORE_EXPORT void setClientCertificateInfo(const String&, const String&, const String&); >- std::optional<ClientCertificate> getSSLClientCertificate(const String&) const; >+ WTF::Optional<ClientCertificate> getSSLClientCertificate(const String&) const; > > private: > #if NEED_OPENSSL_THREAD_SUPPORT >diff --git a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp >index 25f1ec2bc1371fbdae345c7e76feb9ee520f96e4..4db03b092a5276175873c7a2242ec26f720e07e9 100644 >--- a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp >+++ b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp >@@ -111,7 +111,7 @@ void NetworkStorageSession::switchToNewTestingSession() > // FIXME: Implement for WebKit to use. > } > >-void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& value) const >+void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& value) const > { > cookieStorage().setCookiesFromDOM(*this, firstParty, sameSiteInfo, url, frameID, pageID, value); > } >@@ -121,7 +121,7 @@ bool NetworkStorageSession::cookiesEnabled() const > return cookieStorage().cookiesEnabled(*this); > } > >-std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > return cookieStorage().cookiesForDOM(*this, firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } >@@ -178,7 +178,7 @@ Vector<Cookie> NetworkStorageSession::getCookies(const URL&) > return { }; > } > >-bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const >+bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const > { > return cookieStorage().getRawCookies(*this, firstParty, sameSiteInfo, url, frameID, pageID, rawCookies); > } >@@ -188,7 +188,7 @@ void NetworkStorageSession::flushCookieStore() > // FIXME: Implement for WebKit to use. > } > >-std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > return cookieStorage().cookieRequestHeaderFieldValue(*this, firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } >diff --git a/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp b/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp >index 5df367641429f700c2278ead052ab3835d88a752..9bf9451abb46a5ef09b76684747b5f66387ec9dc 100644 >--- a/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp >+++ b/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp >@@ -148,7 +148,7 @@ Ref<CurlRequest> ResourceHandle::createCurlRequest(ResourceRequest&& request, Re > auto& storageSession = NetworkStorageSession::defaultStorageSession(); > auto& cookieJar = storageSession.cookieStorage(); > auto includeSecureCookies = request.url().protocolIs("https") ? IncludeSecureCookies::Yes : IncludeSecureCookies::No; >- String cookieHeaderField = cookieJar.cookieRequestHeaderFieldValue(storageSession, request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), std::nullopt, std::nullopt, includeSecureCookies).first; >+ String cookieHeaderField = cookieJar.cookieRequestHeaderFieldValue(storageSession, request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; > if (!cookieHeaderField.isEmpty()) > request.addHTTPHeaderField(HTTPHeaderName::Cookie, cookieHeaderField); > } >@@ -335,7 +335,7 @@ void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&) > ASSERT_NOT_REACHED(); > } > >-std::optional<Credential> ResourceHandle::getCredential(const ResourceRequest& request, bool redirect) >+WTF::Optional<Credential> ResourceHandle::getCredential(const ResourceRequest& request, bool redirect) > { > // m_user/m_pass are credentials given manually, for instance, by the arguments passed to XMLHttpRequest.open(). > Credential credential { d->m_user, d->m_pass, CredentialPersistenceNone }; >@@ -359,7 +359,7 @@ std::optional<Credential> ResourceHandle::getCredential(const ResourceRequest& r > if (!d->m_initialCredential.isEmpty()) > return d->m_initialCredential; > >- return std::nullopt; >+ return WTF::nullopt; > } > > void ResourceHandle::restartRequestWithCredential(const ProtectionSpace& protectionSpace, const Credential& credential) >diff --git a/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h b/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h >index 365938cfcc2186a10092479eaecdeb1b30ff3d9c..cd4139c1de77dc628aaed70061726f2da4880372 100644 >--- a/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h >+++ b/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h >@@ -52,14 +52,14 @@ public: > virtual ~SocketStreamHandleImpl(); > > WEBCORE_EXPORT void platformSend(const uint8_t* data, size_t length, Function<void(bool)>&&) final; >- WEBCORE_EXPORT void platformSendHandshake(const uint8_t* data, size_t length, const std::optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) final; >+ WEBCORE_EXPORT void platformSendHandshake(const uint8_t* data, size_t length, const WTF::Optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) final; > WEBCORE_EXPORT void platformClose() final; > > private: > WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&); > > size_t bufferedAmount() final; >- std::optional<size_t> platformSendInternal(const uint8_t*, size_t); >+ WTF::Optional<size_t> platformSendInternal(const uint8_t*, size_t); > bool sendPendingData(); > > void threadEntryPoint(); >diff --git a/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp b/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp >index 0710caee2503c1f3f3808e20437058827ed36dc5..3ab739be08c7e44e7f6dcaddfbcef1b462ad6011 100644 >--- a/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp >+++ b/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp >@@ -67,7 +67,7 @@ SocketStreamHandleImpl::~SocketStreamHandleImpl() > stopThread(); > } > >-std::optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t* data, size_t length) >+WTF::Optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t* data, size_t length) > { > LOG(Network, "SocketStreamHandle %p platformSend", this); > ASSERT(isMainThread()); >diff --git a/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h b/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h >index 3eda27ea8a217c620f9a3eda75b0ef680d81423a..c92186e7d2356888fe3a6285e1f096f6943e4667 100644 >--- a/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h >+++ b/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h >@@ -46,7 +46,7 @@ class ResourceHandle; > RetainPtr<NSURLRequest> m_requestResult; > Lock m_mutex; > RetainPtr<NSCachedURLResponse> m_cachedResponseResult; >- std::optional<SchedulePairHashSet> m_scheduledPairs; >+ WTF::Optional<SchedulePairHashSet> m_scheduledPairs; > BOOL m_boolResult; > } > >diff --git a/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm b/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm >index ec7d01babb1a78492a181346dc85ef1c4006ceb9..91da1c91a7387e263c6f29741004856cf315646c 100644 >--- a/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm >+++ b/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm >@@ -43,7 +43,7 @@ > > using namespace WebCore; > >-static bool scheduledWithCustomRunLoopMode(const std::optional<SchedulePairHashSet>& pairs) >+static bool scheduledWithCustomRunLoopMode(const WTF::Optional<SchedulePairHashSet>& pairs) > { > if (!pairs) > return false; >diff --git a/Source/WebCore/platform/network/soup/CertificateInfo.h b/Source/WebCore/platform/network/soup/CertificateInfo.h >index af99352d61264fb1370790d5edb8697b0192a8fe..4797bb0023495704a6c5ff03833a2e15b3ca43fe 100644 >--- a/Source/WebCore/platform/network/soup/CertificateInfo.h >+++ b/Source/WebCore/platform/network/soup/CertificateInfo.h >@@ -55,7 +55,7 @@ public: > > bool containsNonRootSHA1SignedCertificate() const { notImplemented(); return false; } > >- std::optional<SummaryInfo> summaryInfo() const { notImplemented(); return std::nullopt; } >+ WTF::Optional<SummaryInfo> summaryInfo() const { notImplemented(); return WTF::nullopt; } > > bool isEmpty() const { return !m_certificate; } > >diff --git a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp >index 7e213e8a75874cca8659671f9b724bac75eb7ff6..a47e6cd4b0a004ba052939f6db529297c165e6d4 100644 >--- a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp >+++ b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp >@@ -315,7 +315,7 @@ static inline bool httpOnlyCookieExists(const GSList* cookies, const gchar* name > return false; > } > >-void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& value) const >+void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& value) const > { > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -461,7 +461,7 @@ Vector<Cookie> NetworkStorageSession::getCookies(const URL& url) > return cookies; > } > >-bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const >+bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) const > { > UNUSED_PARAM(firstParty); > UNUSED_PARAM(frameID); >@@ -531,7 +531,7 @@ static std::pair<String, bool> cookiesForSession(const NetworkStorageSession& se > return { String::fromUTF8(cookieHeader.get()), didAccessSecureCookies }; > } > >-std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > UNUSED_PARAM(firstParty); > UNUSED_PARAM(frameID); >@@ -539,7 +539,7 @@ std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstPar > return cookiesForSession(*this, url, false, includeSecureCookies); > } > >-std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo&, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo&, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { > UNUSED_PARAM(firstParty); > UNUSED_PARAM(frameID); >diff --git a/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h b/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h >index 6c4ddbbbc35ae7579b2944386da1aed39e093b44..da31979acbe23f1cb7807677286ab2a48e8ec437 100644 >--- a/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h >+++ b/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h >@@ -57,13 +57,13 @@ public: > const URL& url() const { return m_url; } > > void platformSend(const uint8_t* data, size_t length, Function<void(bool)>&&) final; >- void platformSendHandshake(const uint8_t* data, size_t length, const std::optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) final; >+ void platformSendHandshake(const uint8_t* data, size_t length, const WTF::Optional<CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&) final; > void platformClose() final; > private: > SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&); > > size_t bufferedAmount() final; >- std::optional<size_t> platformSendInternal(const uint8_t*, size_t); >+ WTF::Optional<size_t> platformSendInternal(const uint8_t*, size_t); > bool sendPendingData(); > > void beginWaitingForSocketWritability(); >diff --git a/Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp b/Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp >index b5ebde6526cc9fdea014af3d2743eada68aef568..57e669210962f0b9fb01d58907257ab484f2a64b 100644 >--- a/Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp >+++ b/Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp >@@ -216,7 +216,7 @@ void SocketStreamHandleImpl::writeReady() > sendPendingData(); > } > >-std::optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t* data, size_t length) >+WTF::Optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t* data, size_t length) > { > LOG(Network, "SocketStreamHandle %p platformSend", this); > if (!m_outputStream || !data) >@@ -229,7 +229,7 @@ std::optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t > beginWaitingForSocketWritability(); > else > didFail(SocketStreamError(error->code, String(), error->message)); >- return std::nullopt; >+ return WTF::nullopt; > } > > // If we did not send all the bytes we were given, we know that >@@ -238,7 +238,7 @@ std::optional<size_t> SocketStreamHandleImpl::platformSendInternal(const uint8_t > beginWaitingForSocketWritability(); > > if (written == -1) >- return std::nullopt; >+ return WTF::nullopt; > > return static_cast<size_t>(written); > } >diff --git a/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp b/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp >index f24e265c96eafb5de4371a1d22638cc718e69516..536eb0f73b3e14902f2d8baad0d29f954734ae66 100644 >--- a/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp >+++ b/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp >@@ -276,17 +276,17 @@ void SoupNetworkSession::setShouldIgnoreTLSErrors(bool ignoreTLSErrors) > gIgnoreTLSErrors = ignoreTLSErrors; > } > >-std::optional<ResourceError> SoupNetworkSession::checkTLSErrors(const URL& requestURL, GTlsCertificate* certificate, GTlsCertificateFlags tlsErrors) >+WTF::Optional<ResourceError> SoupNetworkSession::checkTLSErrors(const URL& requestURL, GTlsCertificate* certificate, GTlsCertificateFlags tlsErrors) > { > if (gIgnoreTLSErrors) >- return std::nullopt; >+ return WTF::nullopt; > > if (!tlsErrors) >- return std::nullopt; >+ return WTF::nullopt; > > auto it = clientCertificates().find(requestURL.host().toString()); > if (it != clientCertificates().end() && it->value.contains(certificate)) >- return std::nullopt; >+ return WTF::nullopt; > > return ResourceError::tlsError(requestURL, tlsErrors, certificate); > } >diff --git a/Source/WebCore/platform/network/soup/SoupNetworkSession.h b/Source/WebCore/platform/network/soup/SoupNetworkSession.h >index 5b5ff7977347151961a45c3497ea2f551344b1aa..0494cd8d5e3c7cd50d9baf44251ed290cc5fd205 100644 >--- a/Source/WebCore/platform/network/soup/SoupNetworkSession.h >+++ b/Source/WebCore/platform/network/soup/SoupNetworkSession.h >@@ -66,7 +66,7 @@ public: > void setAcceptLanguages(const CString&); > > static void setShouldIgnoreTLSErrors(bool); >- static std::optional<ResourceError> checkTLSErrors(const URL&, GTlsCertificate*, GTlsCertificateFlags); >+ static WTF::Optional<ResourceError> checkTLSErrors(const URL&, GTlsCertificate*, GTlsCertificateFlags); > static void allowSpecificHTTPSCertificateForHost(const CertificateInfo&, const String& host); > > static void setCustomProtocolRequestType(GType); >diff --git a/Source/WebCore/platform/posix/FileSystemPOSIX.cpp b/Source/WebCore/platform/posix/FileSystemPOSIX.cpp >index 8d284c25fa01057786c73c056c27784c80f5b7bc..5f3b9ac183844c6bb8f99196763b126d42f10a7e 100644 >--- a/Source/WebCore/platform/posix/FileSystemPOSIX.cpp >+++ b/Source/WebCore/platform/posix/FileSystemPOSIX.cpp >@@ -202,37 +202,37 @@ bool getFileSize(PlatformFileHandle handle, long long& result) > return true; > } > >-std::optional<WallTime> getFileCreationTime(const String& path) >+WTF::Optional<WallTime> getFileCreationTime(const String& path) > { > #if OS(DARWIN) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD) > CString fsRep = fileSystemRepresentation(path); > > if (!fsRep.data() || fsRep.data()[0] == '\0') >- return std::nullopt; >+ return WTF::nullopt; > > struct stat fileInfo; > > if (stat(fsRep.data(), &fileInfo)) >- return std::nullopt; >+ return WTF::nullopt; > > return WallTime::fromRawSeconds(fileInfo.st_birthtime); > #else > UNUSED_PARAM(path); >- return std::nullopt; >+ return WTF::nullopt; > #endif > } > >-std::optional<WallTime> getFileModificationTime(const String& path) >+WTF::Optional<WallTime> getFileModificationTime(const String& path) > { > CString fsRep = fileSystemRepresentation(path); > > if (!fsRep.data() || fsRep.data()[0] == '\0') >- return std::nullopt; >+ return WTF::nullopt; > > struct stat fileInfo; > > if (stat(fsRep.data(), &fileInfo)) >- return std::nullopt; >+ return WTF::nullopt; > > return WallTime::fromRawSeconds(fileInfo.st_mtime); > } >@@ -246,16 +246,16 @@ static FileMetadata::Type toFileMetataType(struct stat fileInfo) > return FileMetadata::Type::File; > } > >-static std::optional<FileMetadata> fileMetadataUsingFunction(const String& path, int (*statFunc)(const char*, struct stat*)) >+static WTF::Optional<FileMetadata> fileMetadataUsingFunction(const String& path, int (*statFunc)(const char*, struct stat*)) > { > CString fsRep = fileSystemRepresentation(path); > > if (!fsRep.data() || fsRep.data()[0] == '\0') >- return std::nullopt; >+ return WTF::nullopt; > > struct stat fileInfo; > if (statFunc(fsRep.data(), &fileInfo)) >- return std::nullopt; >+ return WTF::nullopt; > > String filename = pathGetFileName(path); > bool isHidden = !filename.isEmpty() && filename[0] == '.'; >@@ -267,12 +267,12 @@ static std::optional<FileMetadata> fileMetadataUsingFunction(const String& path, > }; > } > >-std::optional<FileMetadata> fileMetadata(const String& path) >+WTF::Optional<FileMetadata> fileMetadata(const String& path) > { > return fileMetadataUsingFunction(path, &lstat); > } > >-std::optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >+WTF::Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) > { > return fileMetadataUsingFunction(path, &stat); > } >@@ -472,11 +472,11 @@ bool hardLinkOrCopyFile(const String& source, const String& destination) > return appendResult; > } > >-std::optional<int32_t> getFileDeviceId(const CString& fsFile) >+WTF::Optional<int32_t> getFileDeviceId(const CString& fsFile) > { > struct stat fileStat; > if (stat(fsFile.data(), &fileStat) == -1) >- return std::nullopt; >+ return WTF::nullopt; > > return fileStat.st_dev; > } >diff --git a/Source/WebCore/platform/sql/SQLiteFileSystem.cpp b/Source/WebCore/platform/sql/SQLiteFileSystem.cpp >index 5b110a8bde8238ec9e1899ada32d94225b7d77ea..aa4009e1f8f58d2185ecc6dec07c32eab16544a3 100644 >--- a/Source/WebCore/platform/sql/SQLiteFileSystem.cpp >+++ b/Source/WebCore/platform/sql/SQLiteFileSystem.cpp >@@ -108,12 +108,12 @@ long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName) > return FileSystem::getFileSize(fileName, size) ? size : 0; > } > >-std::optional<WallTime> SQLiteFileSystem::databaseCreationTime(const String& fileName) >+WTF::Optional<WallTime> SQLiteFileSystem::databaseCreationTime(const String& fileName) > { > return FileSystem::getFileCreationTime(fileName); > } > >-std::optional<WallTime> SQLiteFileSystem::databaseModificationTime(const String& fileName) >+WTF::Optional<WallTime> SQLiteFileSystem::databaseModificationTime(const String& fileName) > { > return FileSystem::getFileModificationTime(fileName); > } >diff --git a/Source/WebCore/platform/sql/SQLiteFileSystem.h b/Source/WebCore/platform/sql/SQLiteFileSystem.h >index 17bfa0628790bb981294093eea5a0c0b386b894a..a86eeb5e3ef1b6ace8874c62523924f2e283e0a4 100644 >--- a/Source/WebCore/platform/sql/SQLiteFileSystem.h >+++ b/Source/WebCore/platform/sql/SQLiteFileSystem.h >@@ -97,8 +97,8 @@ public: > #endif > > static long long getDatabaseFileSize(const String& fileName); >- WEBCORE_EXPORT static std::optional<WallTime> databaseCreationTime(const String& fileName); >- WEBCORE_EXPORT static std::optional<WallTime> databaseModificationTime(const String& fileName); >+ WEBCORE_EXPORT static WTF::Optional<WallTime> databaseCreationTime(const String& fileName); >+ WEBCORE_EXPORT static WTF::Optional<WallTime> databaseModificationTime(const String& fileName); > > private: > // do not instantiate this class >diff --git a/Source/WebCore/platform/vr/VRManager.cpp b/Source/WebCore/platform/vr/VRManager.cpp >index c97c5f431bf54f6d0f438291c973cff61549e81e..dc5ddd5245ee798016dc958bb5714f735164ff4d 100644 >--- a/Source/WebCore/platform/vr/VRManager.cpp >+++ b/Source/WebCore/platform/vr/VRManager.cpp >@@ -48,10 +48,10 @@ VRManager::~VRManager() > m_platformManager = nullptr; > } > >-std::optional<VRManager::VRDisplaysVector> VRManager::getVRDisplays() >+WTF::Optional<VRManager::VRDisplaysVector> VRManager::getVRDisplays() > { > if (!m_platformManager) >- return std::nullopt; >+ return WTF::nullopt; > > auto displays = m_platformManager->getVRDisplays(); > VRDisplaysHashMap newDisplays; >diff --git a/Source/WebCore/platform/vr/VRManager.h b/Source/WebCore/platform/vr/VRManager.h >index fb3b7cd2f8ee13a64759df694caed5a5d4e8ed8d..a5812ed424f94c7cf0065bf9994004cfb2c7aa6c 100644 >--- a/Source/WebCore/platform/vr/VRManager.h >+++ b/Source/WebCore/platform/vr/VRManager.h >@@ -39,7 +39,7 @@ public: > > WEBCORE_EXPORT static VRManager& singleton(); > >- std::optional<VRDisplaysVector> getVRDisplays(); >+ WTF::Optional<VRDisplaysVector> getVRDisplays(); > > private: > VRManager(); >diff --git a/Source/WebCore/platform/vr/VRPlatformDisplay.h b/Source/WebCore/platform/vr/VRPlatformDisplay.h >index 21fa3e0f0383611c680bf0c03117318becb43f14..b179598bcf59818ad0288ff12b0cf99730ac52a4 100644 >--- a/Source/WebCore/platform/vr/VRPlatformDisplay.h >+++ b/Source/WebCore/platform/vr/VRPlatformDisplay.h >@@ -83,10 +83,10 @@ public: > void setRenderSize(const RenderSize& renderSize) { m_renderSize = renderSize; } > > void setPlayAreaBounds(const FloatSize& playAreaBounds) { m_playAreaBounds = playAreaBounds; } >- const std::optional<FloatSize>& playAreaBounds() const { return m_playAreaBounds; } >+ const WTF::Optional<FloatSize>& playAreaBounds() const { return m_playAreaBounds; } > > void setSittingToStandingTransform(const TransformationMatrix& transform) { m_sittingToStandingTransform = transform; } >- const std::optional<TransformationMatrix>& sittingToStandingTransform() const { return m_sittingToStandingTransform; } >+ const WTF::Optional<TransformationMatrix>& sittingToStandingTransform() const { return m_sittingToStandingTransform; } > > private: > String m_displayName; >@@ -100,8 +100,8 @@ private: > RenderSize m_renderSize; > FieldOfView m_eyeFieldOfView[Eye::NumEyes]; > >- std::optional<FloatSize> m_playAreaBounds; >- std::optional<TransformationMatrix> m_sittingToStandingTransform; >+ WTF::Optional<FloatSize> m_playAreaBounds; >+ WTF::Optional<TransformationMatrix> m_sittingToStandingTransform; > }; > > struct VRPlatformTrackingInfo { >@@ -141,20 +141,20 @@ struct VRPlatformTrackingInfo { > void clear() > { > timestamp = 0; >- position = std::nullopt; >- orientation = std::nullopt; >- angularAcceleration = std::nullopt; >- angularVelocity = std::nullopt; >- linearAcceleration = std::nullopt; >- linearVelocity = std::nullopt; >+ position = WTF::nullopt; >+ orientation = WTF::nullopt; >+ angularAcceleration = WTF::nullopt; >+ angularVelocity = WTF::nullopt; >+ linearAcceleration = WTF::nullopt; >+ linearVelocity = WTF::nullopt; > } > >- std::optional<Quaternion> orientation; >- std::optional<FloatPoint3D> position; >- std::optional<Float3> angularAcceleration; >- std::optional<Float3> angularVelocity; >- std::optional<Float3> linearAcceleration; >- std::optional<Float3> linearVelocity; >+ WTF::Optional<Quaternion> orientation; >+ WTF::Optional<FloatPoint3D> position; >+ WTF::Optional<Float3> angularAcceleration; >+ WTF::Optional<Float3> angularVelocity; >+ WTF::Optional<Float3> linearAcceleration; >+ WTF::Optional<Float3> linearVelocity; > double timestamp { 0 }; > }; > >diff --git a/Source/WebCore/platform/win/FileSystemWin.cpp b/Source/WebCore/platform/win/FileSystemWin.cpp >index b30621f9430b281b3452026532d5c310faa8d4f9..46860ebe77e4793a38a006732ba8abc2e0b53c98 100644 >--- a/Source/WebCore/platform/win/FileSystemWin.cpp >+++ b/Source/WebCore/platform/win/FileSystemWin.cpp >@@ -124,22 +124,22 @@ bool getFileSize(PlatformFileHandle fileHandle, long long& size) > return getFileSizeFromByHandleFileInformationStructure(fileInformation, size); > } > >-std::optional<WallTime> getFileModificationTime(const String& path) >+WTF::Optional<WallTime> getFileModificationTime(const String& path) > { > WIN32_FIND_DATAW findData; > if (!getFindData(path, findData)) >- return std::nullopt; >+ return WTF::nullopt; > > time_t time = 0; > getFileModificationTimeFromFindData(findData, time); > return WallTime::fromRawSeconds(time); > } > >-std::optional<WallTime> getFileCreationTime(const String& path) >+WTF::Optional<WallTime> getFileCreationTime(const String& path) > { > WIN32_FIND_DATAW findData; > if (!getFindData(path, findData)) >- return std::nullopt; >+ return WTF::nullopt; > > time_t time = 0; > getFileCreationTimeFromFindData(findData, time); >@@ -177,11 +177,11 @@ static FileMetadata::Type toFileMetadataType(WIN32_FIND_DATAW findData) > return FileMetadata::Type::File; > } > >-static std::optional<FileMetadata> findDataToFileMetadata(WIN32_FIND_DATAW findData) >+static WTF::Optional<FileMetadata> findDataToFileMetadata(WIN32_FIND_DATAW findData) > { > long long length; > if (!getFileSizeFromFindData(findData, length)) >- return std::nullopt; >+ return WTF::nullopt; > > time_t modificationTime; > getFileModificationTimeFromFindData(findData, modificationTime); >@@ -194,27 +194,27 @@ static std::optional<FileMetadata> findDataToFileMetadata(WIN32_FIND_DATAW findD > }; > } > >-std::optional<FileMetadata> fileMetadata(const String& path) >+WTF::Optional<FileMetadata> fileMetadata(const String& path) > { > WIN32_FIND_DATAW findData; > if (!getFindData(path, findData)) >- return std::nullopt; >+ return WTF::nullopt; > > return findDataToFileMetadata(findData); > } > >-std::optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >+WTF::Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) > { > WIN32_FIND_DATAW findData; > if (!getFindData(path, findData)) >- return std::nullopt; >+ return WTF::nullopt; > > if (isSymbolicLink(findData)) { > String targetPath = getFinalPathName(path); > if (targetPath.isNull()) >- return std::nullopt; >+ return WTF::nullopt; > if (!getFindData(targetPath, findData)) >- return std::nullopt; >+ return WTF::nullopt; > } > > return findDataToFileMetadata(findData); >@@ -541,16 +541,16 @@ bool getVolumeFreeSpace(const String&, uint64_t&) > return false; > } > >-std::optional<int32_t> getFileDeviceId(const CString& fsFile) >+WTF::Optional<int32_t> getFileDeviceId(const CString& fsFile) > { > auto handle = openFile(fsFile.data(), FileOpenMode::Read); > if (!isHandleValid(handle)) >- return std::nullopt; >+ return WTF::nullopt; > > BY_HANDLE_FILE_INFORMATION fileInformation = { }; > if (!::GetFileInformationByHandle(handle, &fileInformation)) { > closeFile(handle); >- return std::nullopt; >+ return WTF::nullopt; > } > > closeFile(handle); >diff --git a/Source/WebCore/plugins/PluginData.cpp b/Source/WebCore/plugins/PluginData.cpp >index 6f3cf86a59bcd33491090266448ff938b57c0533..c5922da81dec2f8ceff2c8ee71f3724cfa78bd84 100644 >--- a/Source/WebCore/plugins/PluginData.cpp >+++ b/Source/WebCore/plugins/PluginData.cpp >@@ -42,7 +42,7 @@ const Vector<PluginInfo>& PluginData::webVisiblePlugins() const > auto documentURL = m_page.mainFrame().document() ? m_page.mainFrame().document()->url() : URL { }; > if (!documentURL.isNull() && !protocolHostAndPortAreEqual(m_cachedVisiblePlugins.pageURL, documentURL)) { > m_cachedVisiblePlugins.pageURL = WTFMove(documentURL); >- m_cachedVisiblePlugins.pluginList = std::nullopt; >+ m_cachedVisiblePlugins.pluginList = WTF::nullopt; > } > > if (!m_cachedVisiblePlugins.pluginList) >diff --git a/Source/WebCore/plugins/PluginData.h b/Source/WebCore/plugins/PluginData.h >index f040b0af96f3b8bbd9f549329312b8f4f7069ed9..e65a828baeef0dbb52f767ebe79064b0cfeb0c51 100644 >--- a/Source/WebCore/plugins/PluginData.h >+++ b/Source/WebCore/plugins/PluginData.h >@@ -93,7 +93,7 @@ struct SupportedPluginIdentifier { > String pluginIdentifier; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<SupportedPluginIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<SupportedPluginIdentifier> decode(Decoder&); > }; > > // FIXME: merge with PluginDatabase in the future >@@ -128,11 +128,11 @@ private: > protected: > Page& m_page; > Vector<PluginInfo> m_plugins; >- std::optional<Vector<SupportedPluginIdentifier>> m_supportedPluginIdentifiers; >+ WTF::Optional<Vector<SupportedPluginIdentifier>> m_supportedPluginIdentifiers; > > struct CachedVisiblePlugins { > URL pageURL; >- std::optional<Vector<PluginInfo>> pluginList; >+ WTF::Optional<Vector<PluginInfo>> pluginList; > }; > mutable CachedVisiblePlugins m_cachedVisiblePlugins; > }; >@@ -144,17 +144,17 @@ inline bool isSupportedPlugin(const Vector<SupportedPluginIdentifier>& pluginIde > }) != notFound; > } > >-template<class Decoder> inline std::optional<SupportedPluginIdentifier> SupportedPluginIdentifier::decode(Decoder& decoder) >+template<class Decoder> inline WTF::Optional<SupportedPluginIdentifier> SupportedPluginIdentifier::decode(Decoder& decoder) > { >- std::optional<String> matchingDomain; >+ WTF::Optional<String> matchingDomain; > decoder >> matchingDomain; > if (!matchingDomain) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> pluginIdentifier; >+ WTF::Optional<String> pluginIdentifier; > decoder >> pluginIdentifier; > if (!pluginIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return SupportedPluginIdentifier { WTFMove(matchingDomain.value()), WTFMove(pluginIdentifier.value()) }; > } >diff --git a/Source/WebCore/plugins/PluginInfoProvider.h b/Source/WebCore/plugins/PluginInfoProvider.h >index f4707b7d69392f24cebb71387ce967520e43534d..1926d2ca7b732027921f4d656fdd13e5e0476abb 100644 >--- a/Source/WebCore/plugins/PluginInfoProvider.h >+++ b/Source/WebCore/plugins/PluginInfoProvider.h >@@ -40,7 +40,7 @@ public: > void removePage(Page&); > void clearPagesPluginData(); > >- virtual Vector<PluginInfo> pluginInfo(Page&, std::optional<Vector<SupportedPluginIdentifier>>&) = 0; >+ virtual Vector<PluginInfo> pluginInfo(Page&, WTF::Optional<Vector<SupportedPluginIdentifier>>&) = 0; > virtual Vector<PluginInfo> webVisiblePluginInfo(Page&, const URL&) = 0; > > private: >diff --git a/Source/WebCore/rendering/BreakLines.h b/Source/WebCore/rendering/BreakLines.h >index c7e5a86b293d454d024f012d16f7ec4ed22bf6ef..f59e82f644b34292966e2b8d3bd8ef2ea90393d8 100644 >--- a/Source/WebCore/rendering/BreakLines.h >+++ b/Source/WebCore/rendering/BreakLines.h >@@ -90,7 +90,7 @@ inline bool needsLineBreakIterator(UChar character) > template<typename CharacterType, NonBreakingSpaceBehavior nonBreakingSpaceBehavior, CanUseShortcut canUseShortcut> > inline unsigned nextBreakablePosition(LazyLineBreakIterator& lazyBreakIterator, const CharacterType* string, unsigned length, unsigned startPosition) > { >- std::optional<unsigned> nextBreak; >+ WTF::Optional<unsigned> nextBreak; > > CharacterType lastLastCharacter = startPosition > 1 ? string[startPosition - 2] : static_cast<CharacterType>(lazyBreakIterator.secondToLastCharacter()); > CharacterType lastCharacter = startPosition > 0 ? string[startPosition - 1] : static_cast<CharacterType>(lazyBreakIterator.lastCharacter()); >@@ -109,7 +109,7 @@ inline unsigned nextBreakablePosition(LazyLineBreakIterator& lazyBreakIterator, > if (breakIterator) { > int candidate = ubrk_following(breakIterator, i - 1 + priorContextLength); > if (candidate == UBRK_DONE) >- nextBreak = std::nullopt; >+ nextBreak = WTF::nullopt; > else { > unsigned result = candidate; > ASSERT(result >= priorContextLength); >@@ -187,7 +187,7 @@ inline unsigned nextBreakablePositionIgnoringNBSPWithoutShortcut(LazyLineBreakIt > return nextBreakablePosition<UChar, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace, CanUseShortcut::No>(lazyBreakIterator, stringView.characters16(), stringView.length(), startPosition); > } > >-inline bool isBreakable(LazyLineBreakIterator& lazyBreakIterator, unsigned startPosition, std::optional<unsigned>& nextBreakable, bool breakNBSP, bool canUseShortcut, bool keepAllWords) >+inline bool isBreakable(LazyLineBreakIterator& lazyBreakIterator, unsigned startPosition, WTF::Optional<unsigned>& nextBreakable, bool breakNBSP, bool canUseShortcut, bool keepAllWords) > { > if (nextBreakable && nextBreakable.value() >= startPosition) > return startPosition == nextBreakable; >diff --git a/Source/WebCore/rendering/FloatingObjects.cpp b/Source/WebCore/rendering/FloatingObjects.cpp >index 2a340add8521bbb0bd17513fe7d600158d6eee18..cfdd9af4b188554321534408499ebfe1974c497e 100644 >--- a/Source/WebCore/rendering/FloatingObjects.cpp >+++ b/Source/WebCore/rendering/FloatingObjects.cpp >@@ -201,8 +201,8 @@ public: > private: > WeakPtr<const RenderBlockFlow> m_renderer; > LayoutUnit m_belowLogicalHeight; >- std::optional<LayoutUnit> m_nextLogicalBottom; >- std::optional<LayoutUnit> m_nextShapeLogicalBottom; >+ WTF::Optional<LayoutUnit> m_nextLogicalBottom; >+ WTF::Optional<LayoutUnit> m_nextShapeLogicalBottom; > }; > > inline void FindNextFloatLogicalBottomAdapter::collectIfNeeded(const IntervalType& interval) >diff --git a/Source/WebCore/rendering/GridLayoutFunctions.cpp b/Source/WebCore/rendering/GridLayoutFunctions.cpp >index 7e315be7b4f3a0b4dac9b96997d54bac3cbb7a66..19d88b5bb3f9fc5bb447093943f33a0961021cd9 100644 >--- a/Source/WebCore/rendering/GridLayoutFunctions.cpp >+++ b/Source/WebCore/rendering/GridLayoutFunctions.cpp >@@ -89,7 +89,7 @@ bool hasOverrideContainingBlockContentSizeForChild(const RenderBox& child, GridT > return direction == ForColumns ? child.hasOverrideContainingBlockContentLogicalWidth() : child.hasOverrideContainingBlockContentLogicalHeight(); > } > >-std::optional<LayoutUnit> overrideContainingBlockContentSizeForChild(const RenderBox& child, GridTrackSizingDirection direction) >+WTF::Optional<LayoutUnit> overrideContainingBlockContentSizeForChild(const RenderBox& child, GridTrackSizingDirection direction) > { > return direction == ForColumns ? child.overrideContainingBlockContentLogicalWidth() : child.overrideContainingBlockContentLogicalHeight(); > } >diff --git a/Source/WebCore/rendering/GridLayoutFunctions.h b/Source/WebCore/rendering/GridLayoutFunctions.h >index 874fe55452f8f1eb33b03f845c76cd5675b696da..2d06e811d9c5916418d7f73f430fa2a0efecc648 100644 >--- a/Source/WebCore/rendering/GridLayoutFunctions.h >+++ b/Source/WebCore/rendering/GridLayoutFunctions.h >@@ -39,7 +39,7 @@ LayoutUnit marginLogicalSizeForChild(const RenderGrid&, GridTrackSizingDirection > bool isOrthogonalChild(const RenderGrid&, const RenderBox&); > GridTrackSizingDirection flowAwareDirectionForChild(const RenderGrid&, const RenderBox&, GridTrackSizingDirection); > bool hasOverrideContainingBlockContentSizeForChild(const RenderBox&, GridTrackSizingDirection); >-std::optional<LayoutUnit> overrideContainingBlockContentSizeForChild(const RenderBox&, GridTrackSizingDirection); >+WTF::Optional<LayoutUnit> overrideContainingBlockContentSizeForChild(const RenderBox&, GridTrackSizingDirection); > > } > >diff --git a/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp b/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp >index 3a024162e5ac1705af30233224416290bd805af2..937ffaaa653901fda515124841df42f978d80b7f 100644 >--- a/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp >+++ b/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp >@@ -77,7 +77,7 @@ void GridTrack::growTempSize(const LayoutUnit& tempSize) > m_tempSize += tempSize; > } > >-void GridTrack::setGrowthLimitCap(std::optional<LayoutUnit> growthLimitCap) >+void GridTrack::setGrowthLimitCap(WTF::Optional<LayoutUnit> growthLimitCap) > { > ASSERT(!growthLimitCap || growthLimitCap.value() >= 0); > m_growthLimitCap = growthLimitCap; >@@ -108,7 +108,7 @@ static bool shouldClearOverrideContainingBlockContentSizeForChild(const RenderBo > return child.hasRelativeLogicalHeight() || child.style().logicalHeight().isIntrinsicOrAuto(); > } > >-static void setOverrideContainingBlockContentSizeForChild(RenderBox& child, GridTrackSizingDirection direction, std::optional<LayoutUnit> size) >+static void setOverrideContainingBlockContentSizeForChild(RenderBox& child, GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> size) > { > if (direction == ForColumns) > child.setOverrideContainingBlockContentLogicalWidth(size); >@@ -134,7 +134,7 @@ static LayoutUnit marginIntrinsicLogicalWidthForChild(const RenderGrid* renderGr > > // GridTrackSizingAlgorithm private. > >-void GridTrackSizingAlgorithm::setFreeSpace(GridTrackSizingDirection direction, std::optional<LayoutUnit> freeSpace) >+void GridTrackSizingAlgorithm::setFreeSpace(GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> freeSpace) > { > if (direction == ForColumns) > m_freeSpaceColumns = freeSpace; >@@ -142,13 +142,13 @@ void GridTrackSizingAlgorithm::setFreeSpace(GridTrackSizingDirection direction, > m_freeSpaceRows = freeSpace; > } > >-std::optional<LayoutUnit> GridTrackSizingAlgorithm::availableSpace() const >+WTF::Optional<LayoutUnit> GridTrackSizingAlgorithm::availableSpace() const > { > ASSERT(wasSetup()); > return availableSpace(m_direction); > } > >-void GridTrackSizingAlgorithm::setAvailableSpace(GridTrackSizingDirection direction, std::optional<LayoutUnit> availableSpace) >+void GridTrackSizingAlgorithm::setAvailableSpace(GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> availableSpace) > { > if (direction == ForColumns) > m_availableSpaceColumns = availableSpace; >@@ -559,7 +559,7 @@ LayoutUnit GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild(const Rend > const GridSpan& span = m_grid.gridItemSpan(child, direction); > LayoutUnit gridAreaSize; > bool gridAreaIsIndefinite = false; >- std::optional<LayoutUnit> availableSize = availableSpace(direction); >+ WTF::Optional<LayoutUnit> availableSize = availableSpace(direction); > for (auto trackPosition : span) { > // We may need to estimate the grid area size before running the track > // sizing algorithm in order to perform the pre-layout of orthogonal >@@ -744,7 +744,7 @@ void GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes() > m_maxContentSize += track.growthLimit(); > // The growth limit caps must be cleared now in order to properly sort > // tracks by growth potential on an eventual "Maximize Tracks". >- track.setGrowthLimitCap(std::nullopt); >+ track.setGrowthLimitCap(WTF::nullopt); > } > } > >@@ -755,7 +755,7 @@ LayoutUnit GridTrackSizingAlgorithmStrategy::logicalHeightForChild(RenderBox& ch > // If |child| has a relative logical height, we shouldn't let it override its intrinsic height, which is > // what we are interested in here. Thus we need to set the block-axis override size to -1 (no possible resolution). > if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForRows)) { >- setOverrideContainingBlockContentSizeForChild(child, childBlockDirection, std::nullopt); >+ setOverrideContainingBlockContentSizeForChild(child, childBlockDirection, WTF::nullopt); > child.setNeedsLayout(MarkOnlyThis); > } > >@@ -831,7 +831,7 @@ LayoutUnit GridTrackSizingAlgorithmStrategy::minSizeForChild(RenderBox& child) c > bool overrideSizeHasChanged = updateOverrideContainingBlockContentSizeForChild(child, childInlineDirection, gridAreaSize); > layoutGridItemForMinSizeComputation(child, overrideSizeHasChanged); > >- return child.computeLogicalHeightUsing(MinSize, childMinSize, std::nullopt).value_or(0) + child.marginLogicalHeight() + child.scrollbarLogicalHeight() + baselineShim; >+ return child.computeLogicalHeightUsing(MinSize, childMinSize, WTF::nullopt).value_or(0) + child.marginLogicalHeight() + child.scrollbarLogicalHeight() + baselineShim; > } > > bool GridTrackSizingAlgorithm::canParticipateInBaselineAlignment(const RenderBox& child, GridAxis baselineAxis) const >@@ -902,7 +902,7 @@ void GridTrackSizingAlgorithm::copyBaselineItemsCache(const GridTrackSizingAlgor > m_rowBaselineItemsMap = source.m_rowBaselineItemsMap; > } > >-bool GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild(RenderBox& child, GridTrackSizingDirection direction, std::optional<LayoutUnit> overrideSize) const >+bool GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild(RenderBox& child, GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> overrideSize) const > { > if (!overrideSize) > overrideSize = m_algorithm.gridAreaBreadthForChild(child, direction); >@@ -921,8 +921,8 @@ public: > private: > LayoutUnit minLogicalWidthForChild(RenderBox&, Length childMinSize, LayoutUnit availableSize) const override; > void layoutGridItemForMinSizeComputation(RenderBox&, bool overrideSizeHasChanged) const override; >- void maximizeTracks(Vector<GridTrack>&, std::optional<LayoutUnit>& freeSpace) override; >- double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, std::optional<LayoutUnit> freeSpace) const override; >+ void maximizeTracks(Vector<GridTrack>&, WTF::Optional<LayoutUnit>& freeSpace) override; >+ double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, WTF::Optional<LayoutUnit> freeSpace) const override; > bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const override; > LayoutUnit freeSpaceForStretchAutoTracksStep() const override; > }; >@@ -939,7 +939,7 @@ void IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation(RenderBox& chil > child.layoutIfNeeded(); > } > >-void IndefiniteSizeStrategy::maximizeTracks(Vector<GridTrack>& tracks, std::optional<LayoutUnit>& freeSpace) >+void IndefiniteSizeStrategy::maximizeTracks(Vector<GridTrack>& tracks, WTF::Optional<LayoutUnit>& freeSpace) > { > UNUSED_PARAM(freeSpace); > for (auto& track : tracks) >@@ -952,7 +952,7 @@ static inline double normalizedFlexFraction(const GridTrack& track, double flexF > return track.baseSize() / std::max<double>(1, flexFactor); > } > >-double IndefiniteSizeStrategy::findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection direction, std::optional<LayoutUnit> freeSpace) const >+double IndefiniteSizeStrategy::findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> freeSpace) const > { > UNUSED_PARAM(freeSpace); > auto allTracks = m_algorithm.tracks(direction); >@@ -993,8 +993,8 @@ bool IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded(double& flexFract > > const RenderGrid* renderGrid = this->renderGrid(); > >- auto minSize = renderGrid->computeContentLogicalHeight(MinSize, renderGrid->style().logicalMinHeight(), std::nullopt); >- auto maxSize = renderGrid->computeContentLogicalHeight(MaxSize, renderGrid->style().logicalMaxHeight(), std::nullopt); >+ auto minSize = renderGrid->computeContentLogicalHeight(MinSize, renderGrid->style().logicalMinHeight(), WTF::nullopt); >+ auto maxSize = renderGrid->computeContentLogicalHeight(MaxSize, renderGrid->style().logicalMaxHeight(), WTF::nullopt); > > // Redo the flex fraction computation using min|max-height as definite available space in case > // the total height is smaller than min-height or larger than max-height. >@@ -1021,8 +1021,8 @@ public: > private: > LayoutUnit minLogicalWidthForChild(RenderBox&, Length childMinSize, LayoutUnit availableSize) const override; > void layoutGridItemForMinSizeComputation(RenderBox&, bool overrideSizeHasChanged) const override; >- void maximizeTracks(Vector<GridTrack>&, std::optional<LayoutUnit>& freeSpace) override; >- double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, std::optional<LayoutUnit> freeSpace) const override; >+ void maximizeTracks(Vector<GridTrack>&, WTF::Optional<LayoutUnit>& freeSpace) override; >+ double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, WTF::Optional<LayoutUnit> freeSpace) const override; > bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const override; > LayoutUnit freeSpaceForStretchAutoTracksStep() const override; > }; >@@ -1033,7 +1033,7 @@ LayoutUnit IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep() const > if (direction() == ForColumns) > return 0_lu; > >- auto minSize = renderGrid()->computeContentLogicalHeight(MinSize, renderGrid()->style().logicalMinHeight(), std::nullopt); >+ auto minSize = renderGrid()->computeContentLogicalHeight(MinSize, renderGrid()->style().logicalMinHeight(), WTF::nullopt); > if (!minSize) > return 0_lu; > return minSize.value() - computeTrackBasedSize(); >@@ -1046,7 +1046,7 @@ LayoutUnit DefiniteSizeStrategy::minLogicalWidthForChild(RenderBox& child, Lengt > return child.computeLogicalWidthInFragmentUsing(MinSize, childMinSize, availableSize, *renderGrid(), nullptr) + marginLogicalWidth; > } > >-void DefiniteSizeStrategy::maximizeTracks(Vector<GridTrack>& tracks, std::optional<LayoutUnit>& freeSpace) >+void DefiniteSizeStrategy::maximizeTracks(Vector<GridTrack>& tracks, WTF::Optional<LayoutUnit>& freeSpace) > { > size_t tracksSize = tracks.size(); > Vector<GridTrack*> tracksForDistribution(tracksSize); >@@ -1070,7 +1070,7 @@ void DefiniteSizeStrategy::layoutGridItemForMinSizeComputation(RenderBox& child, > child.layoutIfNeeded(); > } > >-double DefiniteSizeStrategy::findUsedFlexFraction(Vector<unsigned>&, GridTrackSizingDirection direction, std::optional<LayoutUnit> freeSpace) const >+double DefiniteSizeStrategy::findUsedFlexFraction(Vector<unsigned>&, GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> freeSpace) const > { > GridSpan allTracksSpan = GridSpan::translatedDefiniteGridSpan(0, m_algorithm.tracks(direction).size()); > ASSERT(freeSpace); >@@ -1173,7 +1173,7 @@ void GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes() > } > } > >-void GridTrackSizingAlgorithm::stretchFlexibleTracks(std::optional<LayoutUnit> freeSpace) >+void GridTrackSizingAlgorithm::stretchFlexibleTracks(WTF::Optional<LayoutUnit> freeSpace) > { > if (m_flexibleSizedTracksIndex.isEmpty()) > return; >@@ -1255,7 +1255,7 @@ bool GridTrackSizingAlgorithm::isValidTransition() const > > // GridTrackSizingAlgorithm API. > >-void GridTrackSizingAlgorithm::setup(GridTrackSizingDirection direction, unsigned numTracks, SizingOperation sizingOperation, std::optional<LayoutUnit> availableSpace, std::optional<LayoutUnit> freeSpace) >+void GridTrackSizingAlgorithm::setup(GridTrackSizingDirection direction, unsigned numTracks, SizingOperation sizingOperation, WTF::Optional<LayoutUnit> availableSpace, WTF::Optional<LayoutUnit> freeSpace) > { > ASSERT(m_needsSetup); > m_direction = direction; >@@ -1309,7 +1309,7 @@ void GridTrackSizingAlgorithm::run() > StateMachine stateMachine(*this); > > // Step 1. >- const std::optional<LayoutUnit> initialFreeSpace = freeSpace(m_direction); >+ const WTF::Optional<LayoutUnit> initialFreeSpace = freeSpace(m_direction); > initializeTrackSizes(); > > // Step 2. >@@ -1346,8 +1346,8 @@ void GridTrackSizingAlgorithm::reset() > m_contentSizedTracksIndex.shrink(0); > m_flexibleSizedTracksIndex.shrink(0); > m_autoSizedTracksForStretchIndex.shrink(0); >- setAvailableSpace(ForRows, std::nullopt); >- setAvailableSpace(ForColumns, std::nullopt); >+ setAvailableSpace(ForRows, WTF::nullopt); >+ setAvailableSpace(ForColumns, WTF::nullopt); > m_hasPercentSizedRowsIndefiniteHeight = false; > } > >diff --git a/Source/WebCore/rendering/GridTrackSizingAlgorithm.h b/Source/WebCore/rendering/GridTrackSizingAlgorithm.h >index 06062207159ab72390e6a887dc6087c5b4dabea1..102e310a31750077d48fa4b747f0c9613a8921f3 100644 >--- a/Source/WebCore/rendering/GridTrackSizingAlgorithm.h >+++ b/Source/WebCore/rendering/GridTrackSizingAlgorithm.h >@@ -70,8 +70,8 @@ public: > bool infinitelyGrowable() const { return m_infinitelyGrowable; } > void setInfinitelyGrowable(bool infinitelyGrowable) { m_infinitelyGrowable = infinitelyGrowable; } > >- void setGrowthLimitCap(std::optional<LayoutUnit>); >- std::optional<LayoutUnit> growthLimitCap() const { return m_growthLimitCap; } >+ void setGrowthLimitCap(WTF::Optional<LayoutUnit>); >+ WTF::Optional<LayoutUnit> growthLimitCap() const { return m_growthLimitCap; } > > private: > bool isGrowthLimitBiggerThanBaseSize() const { return growthLimitIsInfinite() || m_growthLimit >= m_baseSize; } >@@ -82,7 +82,7 @@ private: > LayoutUnit m_growthLimit { 0 }; > LayoutUnit m_plannedSize { 0 }; > LayoutUnit m_tempSize { 0 }; >- std::optional<LayoutUnit> m_growthLimitCap; >+ WTF::Optional<LayoutUnit> m_growthLimitCap; > bool m_infinitelyGrowable { false }; > }; > >@@ -97,7 +97,7 @@ public: > { > } > >- void setup(GridTrackSizingDirection, unsigned numTracks, SizingOperation, std::optional<LayoutUnit> availableSpace, std::optional<LayoutUnit> freeSpace); >+ void setup(GridTrackSizingDirection, unsigned numTracks, SizingOperation, WTF::Optional<LayoutUnit> availableSpace, WTF::Optional<LayoutUnit> freeSpace); > void run(); > void reset(); > >@@ -120,11 +120,11 @@ public: > Vector<GridTrack>& tracks(GridTrackSizingDirection direction) { return direction == ForColumns ? m_columns : m_rows; } > const Vector<GridTrack>& tracks(GridTrackSizingDirection direction) const { return direction == ForColumns ? m_columns : m_rows; } > >- std::optional<LayoutUnit> freeSpace(GridTrackSizingDirection direction) const { return direction == ForColumns ? m_freeSpaceColumns : m_freeSpaceRows; } >- void setFreeSpace(GridTrackSizingDirection, std::optional<LayoutUnit>); >+ WTF::Optional<LayoutUnit> freeSpace(GridTrackSizingDirection direction) const { return direction == ForColumns ? m_freeSpaceColumns : m_freeSpaceRows; } >+ void setFreeSpace(GridTrackSizingDirection, WTF::Optional<LayoutUnit>); > >- std::optional<LayoutUnit> availableSpace(GridTrackSizingDirection direction) const { return direction == ForColumns ? m_availableSpaceColumns : m_availableSpaceRows; } >- void setAvailableSpace(GridTrackSizingDirection, std::optional<LayoutUnit>); >+ WTF::Optional<LayoutUnit> availableSpace(GridTrackSizingDirection direction) const { return direction == ForColumns ? m_availableSpaceColumns : m_availableSpaceRows; } >+ void setAvailableSpace(GridTrackSizingDirection, WTF::Optional<LayoutUnit>); > > LayoutUnit computeTrackBasedSize() const; > >@@ -135,7 +135,7 @@ public: > #endif > > private: >- std::optional<LayoutUnit> availableSpace() const; >+ WTF::Optional<LayoutUnit> availableSpace() const; > bool isRelativeGridLengthAsAuto(const GridLength&, GridTrackSizingDirection) const; > GridTrackSize gridTrackSize(GridTrackSizingDirection, unsigned translatedIndex) const; > const GridTrackSize& rawGridTrackSize(GridTrackSizingDirection, unsigned translatedIndex) const; >@@ -173,7 +173,7 @@ private: > // method at thise level. > void initializeTrackSizes(); > void resolveIntrinsicTrackSizes(); >- void stretchFlexibleTracks(std::optional<LayoutUnit> freeSpace); >+ void stretchFlexibleTracks(WTF::Optional<LayoutUnit> freeSpace); > void stretchAutoTracks(); > > // State machine. >@@ -184,11 +184,11 @@ private: > bool wasSetup() const { return !!m_strategy; } > bool m_needsSetup { true }; > bool m_hasPercentSizedRowsIndefiniteHeight { false }; >- std::optional<LayoutUnit> m_availableSpaceRows; >- std::optional<LayoutUnit> m_availableSpaceColumns; >+ WTF::Optional<LayoutUnit> m_availableSpaceRows; >+ WTF::Optional<LayoutUnit> m_availableSpaceColumns; > >- std::optional<LayoutUnit> m_freeSpaceColumns; >- std::optional<LayoutUnit> m_freeSpaceRows; >+ WTF::Optional<LayoutUnit> m_freeSpaceColumns; >+ WTF::Optional<LayoutUnit> m_freeSpaceRows; > > // We need to keep both alive in order to properly size grids with orthogonal > // writing modes. >@@ -249,8 +249,8 @@ public: > > virtual ~GridTrackSizingAlgorithmStrategy() = default; > >- virtual void maximizeTracks(Vector<GridTrack>&, std::optional<LayoutUnit>& freeSpace) = 0; >- virtual double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, std::optional<LayoutUnit> initialFreeSpace) const = 0; >+ virtual void maximizeTracks(Vector<GridTrack>&, WTF::Optional<LayoutUnit>& freeSpace) = 0; >+ virtual double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, WTF::Optional<LayoutUnit> initialFreeSpace) const = 0; > virtual bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const = 0; > virtual LayoutUnit freeSpaceForStretchAutoTracksStep() const = 0; > >@@ -262,7 +262,7 @@ protected: > virtual void layoutGridItemForMinSizeComputation(RenderBox&, bool overrideSizeHasChanged) const = 0; > > LayoutUnit logicalHeightForChild(RenderBox&) const; >- bool updateOverrideContainingBlockContentSizeForChild(RenderBox&, GridTrackSizingDirection, std::optional<LayoutUnit> = std::nullopt) const; >+ bool updateOverrideContainingBlockContentSizeForChild(RenderBox&, GridTrackSizingDirection, WTF::Optional<LayoutUnit> = WTF::nullopt) const; > > GridTrackSize gridTrackSize(GridTrackSizingDirection direction, size_t translatedIndex) const { return m_algorithm.gridTrackSize(direction, translatedIndex); } > >@@ -272,7 +272,7 @@ protected: > double findFrUnitSize(const GridSpan& tracksSpan, LayoutUnit leftOverSpace) const { return m_algorithm.findFrUnitSize(tracksSpan, leftOverSpace); } > void distributeSpaceToTracks(Vector<GridTrack*>& tracks, LayoutUnit& availableLogicalSpace) const { m_algorithm.distributeSpaceToTracks<MaximizeTracks>(tracks, nullptr, availableLogicalSpace); } > const RenderGrid* renderGrid() const { return m_algorithm.m_renderGrid; } >- std::optional<LayoutUnit> availableSpace() const { return m_algorithm.availableSpace(); } >+ WTF::Optional<LayoutUnit> availableSpace() const { return m_algorithm.availableSpace(); } > > GridTrackSizingAlgorithm& m_algorithm; > }; >diff --git a/Source/WebCore/rendering/HitTestingTransformState.cpp b/Source/WebCore/rendering/HitTestingTransformState.cpp >index 6316b3a82f786cc43a6c908324124be6f2edc3d1..c507cf68b8d5117bb17f49d79c27cd09432c9446 100644 >--- a/Source/WebCore/rendering/HitTestingTransformState.cpp >+++ b/Source/WebCore/rendering/HitTestingTransformState.cpp >@@ -55,7 +55,7 @@ void HitTestingTransformState::flatten() > > void HitTestingTransformState::flattenWithTransform(const TransformationMatrix& t) > { >- if (std::optional<TransformationMatrix> inverse = t.inverse()) { >+ if (WTF::Optional<TransformationMatrix> inverse = t.inverse()) { > m_lastPlanarPoint = inverse.value().projectPoint(m_lastPlanarPoint); > m_lastPlanarQuad = inverse.value().projectQuad(m_lastPlanarQuad); > m_lastPlanarArea = inverse.value().projectQuad(m_lastPlanarArea); >diff --git a/Source/WebCore/rendering/ImageQualityController.cpp b/Source/WebCore/rendering/ImageQualityController.cpp >index f3dbef95f7d98bb0a4f039d6cd4592f7e321963c..40a44ff81b75bcbd41be04a387cd138c5d985fb0 100644 >--- a/Source/WebCore/rendering/ImageQualityController.cpp >+++ b/Source/WebCore/rendering/ImageQualityController.cpp >@@ -97,7 +97,7 @@ void ImageQualityController::restartTimer() > m_timer.startOneShot(lowQualityTimeThreshold); > } > >-std::optional<InterpolationQuality> ImageQualityController::interpolationQualityFromStyle(const RenderStyle& style) >+WTF::Optional<InterpolationQuality> ImageQualityController::interpolationQualityFromStyle(const RenderStyle& style) > { > switch (style.imageRendering()) { > case ImageRendering::OptimizeSpeed: >@@ -110,7 +110,7 @@ std::optional<InterpolationQuality> ImageQualityController::interpolationQuality > case ImageRendering::Auto: > break; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > InterpolationQuality ImageQualityController::chooseInterpolationQuality(GraphicsContext& context, RenderBoxModelObject* object, Image& image, const void* layer, const LayoutSize& size) >@@ -119,7 +119,7 @@ InterpolationQuality ImageQualityController::chooseInterpolationQuality(Graphics > if (!(image.isBitmapImage() || image.isPDFDocumentImage()) || context.paintingDisabled()) > return InterpolationDefault; > >- if (std::optional<InterpolationQuality> styleInterpolation = interpolationQualityFromStyle(object->style())) >+ if (WTF::Optional<InterpolationQuality> styleInterpolation = interpolationQualityFromStyle(object->style())) > return styleInterpolation.value(); > > // Make sure to use the unzoomed image size, since if a full page zoom is in effect, the image >diff --git a/Source/WebCore/rendering/ImageQualityController.h b/Source/WebCore/rendering/ImageQualityController.h >index eb4f1535be4b3d68d6a446fca5643749bd24b268..cd7fb4761969f72a97bc240cd32088a58aec67f8 100644 >--- a/Source/WebCore/rendering/ImageQualityController.h >+++ b/Source/WebCore/rendering/ImageQualityController.h >@@ -44,7 +44,7 @@ class ImageQualityController { > public: > explicit ImageQualityController(const RenderView&); > >- static std::optional<InterpolationQuality> interpolationQualityFromStyle(const RenderStyle&); >+ static WTF::Optional<InterpolationQuality> interpolationQualityFromStyle(const RenderStyle&); > InterpolationQuality chooseInterpolationQuality(GraphicsContext&, RenderBoxModelObject*, Image&, const void* layer, const LayoutSize&); > > void rendererWillBeDestroyed(RenderBoxModelObject& renderer) { removeObject(&renderer); } >diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp >index 853bccbd55e808ef049e40a5aedbd195d0073674..b6217959b0471986747213be41a9b7f4a335b6bc 100644 >--- a/Source/WebCore/rendering/InlineFlowBox.cpp >+++ b/Source/WebCore/rendering/InlineFlowBox.cpp >@@ -705,7 +705,7 @@ void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei > } > } > if (is<InlineTextBox>(*child)) { >- if (std::optional<bool> markExistsAndIsAbove = downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle)) { >+ if (WTF::Optional<bool> markExistsAndIsAbove = downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle)) { > if (*markExistsAndIsAbove != childLineStyle.isFlippedLinesWritingMode()) > hasAnnotationsBefore = true; > else >@@ -900,7 +900,7 @@ inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox& textBox, Glyp > int leftGlyphOverflow = -strokeOverflow - leftGlyphEdge; > int rightGlyphOverflow = strokeOverflow + rightGlyphEdge; > >- if (std::optional<bool> markExistsAndIsAbove = textBox.emphasisMarkExistsAndIsAbove(lineStyle)) { >+ if (WTF::Optional<bool> markExistsAndIsAbove = textBox.emphasisMarkExistsAndIsAbove(lineStyle)) { > int emphasisMarkHeight = lineStyle.fontCascade().emphasisMarkHeight(lineStyle.textEmphasisMarkString()); > if (*markExistsAndIsAbove == !lineStyle.isFlippedLinesWritingMode()) > topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight); >@@ -1591,7 +1591,7 @@ LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi > > if (is<InlineTextBox>(*child)) { > const RenderStyle& childLineStyle = child->lineStyle(); >- std::optional<bool> markExistsAndIsAbove = downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle); >+ WTF::Optional<bool> markExistsAndIsAbove = downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle); > if (markExistsAndIsAbove && *markExistsAndIsAbove) { > if (!childLineStyle.isFlippedLinesWritingMode()) { > int topOfEmphasisMark = child->logicalTop() - childLineStyle.fontCascade().emphasisMarkHeight(childLineStyle.textEmphasisMarkString()); >@@ -1639,7 +1639,7 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos > > if (is<InlineTextBox>(*child)) { > const RenderStyle& childLineStyle = child->lineStyle(); >- std::optional<bool> markExistsAndIsAbove = downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle); >+ WTF::Optional<bool> markExistsAndIsAbove = downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle); > if (markExistsAndIsAbove && !*markExistsAndIsAbove) { > if (!childLineStyle.isFlippedLinesWritingMode()) { > LayoutUnit bottomOfEmphasisMark = child->logicalBottom() + childLineStyle.fontCascade().emphasisMarkHeight(childLineStyle.textEmphasisMarkString()); >diff --git a/Source/WebCore/rendering/InlineIterator.h b/Source/WebCore/rendering/InlineIterator.h >index fb9e5af1a62ae5b3307a66023a739e068de6839a..5422a3c720908717299bc5708c7bc59acfbf4834 100644 >--- a/Source/WebCore/rendering/InlineIterator.h >+++ b/Source/WebCore/rendering/InlineIterator.h >@@ -74,7 +74,7 @@ public: > moveTo(object, 0); > } > >- void moveTo(RenderObject& object, unsigned offset, std::optional<unsigned> nextBreak = std::optional<unsigned>()) >+ void moveTo(RenderObject& object, unsigned offset, WTF::Optional<unsigned> nextBreak = WTF::Optional<unsigned>()) > { > setRenderer(&object); > setOffset(offset); >@@ -86,8 +86,8 @@ public: > unsigned offset() const { return m_pos; } > void setOffset(unsigned position); > RenderElement* root() const { return m_root; } >- std::optional<unsigned> nextBreakablePosition() const { return m_nextBreakablePosition; } >- void setNextBreakablePosition(std::optional<unsigned> position) { m_nextBreakablePosition = position; } >+ WTF::Optional<unsigned> nextBreakablePosition() const { return m_nextBreakablePosition; } >+ void setNextBreakablePosition(WTF::Optional<unsigned> position) { m_nextBreakablePosition = position; } > bool refersToEndOfPreviousNode() const { return m_refersToEndOfPreviousNode; } > void setRefersToEndOfPreviousNode(); > >@@ -118,7 +118,7 @@ private: > RenderElement* m_root { nullptr }; > RenderObject* m_renderer { nullptr }; > >- std::optional<unsigned> m_nextBreakablePosition; >+ WTF::Optional<unsigned> m_nextBreakablePosition; > unsigned m_pos { 0 }; > > // There are a couple places where we want to decrement an InlineIterator. >diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp >index 1d01090b11fba959f1d09acf63c355616c1c2ef3..d5d48175e177638f0d68d66334a776b452bbe02b 100644 >--- a/Source/WebCore/rendering/InlineTextBox.cpp >+++ b/Source/WebCore/rendering/InlineTextBox.cpp >@@ -364,11 +364,11 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re > return false; > } > >-std::optional<bool> InlineTextBox::emphasisMarkExistsAndIsAbove(const RenderStyle& style) const >+WTF::Optional<bool> InlineTextBox::emphasisMarkExistsAndIsAbove(const RenderStyle& style) const > { > // This function returns true if there are text emphasis marks and they are suppressed by ruby text. > if (style.textEmphasisMark() == TextEmphasisMark::None) >- return std::nullopt; >+ return WTF::nullopt; > > const OptionSet<TextEmphasisPosition> horizontalMask { TextEmphasisPosition::Left, TextEmphasisPosition::Right }; > >@@ -400,7 +400,7 @@ std::optional<bool> InlineTextBox::emphasisMarkExistsAndIsAbove(const RenderStyl > > // The emphasis marks over are suppressed only if there is a ruby text box and it not empty. > if (rubyText && rubyText->hasLines()) >- return std::nullopt; >+ return WTF::nullopt; > > return isAbove; > } >@@ -422,7 +422,7 @@ struct InlineTextBox::MarkedTextStyle { > Color backgroundColor; > TextPaintStyle textStyles; > TextDecorationPainter::Styles textDecorationStyles; >- std::optional<ShadowData> textShadow; >+ WTF::Optional<ShadowData> textShadow; > float alpha; > }; > >@@ -1031,7 +1031,7 @@ void InlineTextBox::paintMarkedTextForeground(PaintInfo& paintInfo, const FloatR > const RenderStyle& lineStyle = this->lineStyle(); > > float emphasisMarkOffset = 0; >- std::optional<bool> markExistsAndIsAbove = emphasisMarkExistsAndIsAbove(lineStyle); >+ WTF::Optional<bool> markExistsAndIsAbove = emphasisMarkExistsAndIsAbove(lineStyle); > const AtomicString& emphasisMark = markExistsAndIsAbove ? lineStyle.textEmphasisMarkString() : nullAtom(); > if (!emphasisMark.isEmpty()) > emphasisMarkOffset = *markExistsAndIsAbove ? -font.fontMetrics().ascent() - font.emphasisMarkDescent(emphasisMark) : font.fontMetrics().descent() + font.emphasisMarkAscent(emphasisMark); >diff --git a/Source/WebCore/rendering/InlineTextBox.h b/Source/WebCore/rendering/InlineTextBox.h >index ae77a66986ae8b260977087c609c2bba2a0f0991..f0e1863a8d5fe1625bd51e19892e7777ef36c446 100644 >--- a/Source/WebCore/rendering/InlineTextBox.h >+++ b/Source/WebCore/rendering/InlineTextBox.h >@@ -94,7 +94,7 @@ public: > int baselinePosition(FontBaseline) const final; > LayoutUnit lineHeight() const final; > >- std::optional<bool> emphasisMarkExistsAndIsAbove(const RenderStyle&) const; >+ WTF::Optional<bool> emphasisMarkExistsAndIsAbove(const RenderStyle&) const; > > LayoutRect logicalOverflowRect() const; > void setLogicalOverflowRect(const LayoutRect&); >diff --git a/Source/WebCore/rendering/MarkedText.cpp b/Source/WebCore/rendering/MarkedText.cpp >index 499bd12fefbcd44ff55529c3b96bafe69048ba8a..9fb79c3ac696ba265d075faedb5a5178d3f91e87 100644 >--- a/Source/WebCore/rendering/MarkedText.cpp >+++ b/Source/WebCore/rendering/MarkedText.cpp >@@ -68,7 +68,7 @@ Vector<MarkedText> subdivide(const Vector<MarkedText>& markedTexts, OverlapStrat > for (unsigned i = 1; i < numberOfOffsets; ++i) { > if (offsets[i].value > offsets[i - 1].value) { > if (overlapStrategy == OverlapStrategy::Frontmost) { >- std::optional<unsigned> frontmost; >+ WTF::Optional<unsigned> frontmost; > for (unsigned j = 0; j < i; ++j) { > if (!processedMarkedTexts.contains(offsets[j].markedText) && (!frontmost || offsets[j].markedText->type > offsets[*frontmost].markedText->type)) > frontmost = j; >diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp >index 547299e6edc918e2043834d07221d390acf13652..22d4151971d7f616efc182e2d1a070dbd2bd2779 100644 >--- a/Source/WebCore/rendering/RenderBlock.cpp >+++ b/Source/WebCore/rendering/RenderBlock.cpp >@@ -257,7 +257,7 @@ public: > LayoutUnit m_pageLogicalOffset; > LayoutUnit m_intrinsicBorderForFieldset; > >- std::optional<WeakPtr<RenderFragmentedFlow>> m_enclosingFragmentedFlow; >+ WTF::Optional<WeakPtr<RenderFragmentedFlow>> m_enclosingFragmentedFlow; > }; > > typedef HashMap<const RenderBlock*, std::unique_ptr<RenderBlockRareData>> RenderBlockRareDataMap; >@@ -2382,16 +2382,16 @@ void RenderBlock::computeChildPreferredLogicalWidths(RenderObject& child, Layout > > // The preferred widths of flexbox children should never depend on override sizes. They should > // always be computed without regard for any overrides that are present. >- std::optional<LayoutUnit> overrideHeight; >- std::optional<LayoutUnit> overrideWidth; >+ WTF::Optional<LayoutUnit> overrideHeight; >+ WTF::Optional<LayoutUnit> overrideWidth; > > if (child.isBox()) { > auto& box = downcast<RenderBox>(child); > if (box.isFlexItem()) { > if (box.hasOverrideContentLogicalHeight()) >- overrideHeight = std::optional<LayoutUnit>(box.overrideContentLogicalHeight()); >+ overrideHeight = WTF::Optional<LayoutUnit>(box.overrideContentLogicalHeight()); > if (box.hasOverrideContentLogicalWidth()) >- overrideWidth = std::optional<LayoutUnit>(box.overrideContentLogicalWidth()); >+ overrideWidth = WTF::Optional<LayoutUnit>(box.overrideContentLogicalWidth()); > box.clearOverrideContentSize(); > } > } >@@ -2470,7 +2470,7 @@ int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin > bool ignoreBaseline = (layer() && (layer()->marquee() || (direction == HorizontalLine ? (layer()->verticalScrollbar() || layer()->scrollOffset().y() != 0) > : (layer()->horizontalScrollbar() || layer()->scrollOffset().x() != 0)))) || (isWritingModeRoot() && !isRubyRun()); > >- std::optional<int> baselinePos = ignoreBaseline ? std::optional<int>() : inlineBlockBaseline(direction); >+ WTF::Optional<int> baselinePos = ignoreBaseline ? WTF::Optional<int>() : inlineBlockBaseline(direction); > > if (isDeprecatedFlexibleBox()) { > // Historically, we did this check for all baselines. But we can't >@@ -2480,7 +2480,7 @@ int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin > // For simplicity, we use this for all uses of deprecated flexbox. > LayoutUnit bottomOfContent = direction == HorizontalLine ? borderTop() + paddingTop() + contentHeight() : borderRight() + paddingRight() + contentWidth(); > if (baselinePos && baselinePos.value() > bottomOfContent) >- baselinePos = std::optional<int>(); >+ baselinePos = WTF::Optional<int>(); > } > if (baselinePos) > return direction == HorizontalLine ? marginTop() + baselinePos.value() : marginRight() + baselinePos.value(); >@@ -2505,43 +2505,43 @@ LayoutUnit RenderBlock::minLineHeightForReplacedRenderer(bool isFirstLine, Layou > return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)); > } > >-std::optional<int> RenderBlock::firstLineBaseline() const >+WTF::Optional<int> RenderBlock::firstLineBaseline() const > { > if (isWritingModeRoot() && !isRubyRun()) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > > for (RenderBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBox()) { > if (!curr->isFloatingOrOutOfFlowPositioned()) { >- if (std::optional<int> result = curr->firstLineBaseline()) >- return std::optional<int>(curr->logicalTop() + result.value()); // Translate to our coordinate space. >+ if (WTF::Optional<int> result = curr->firstLineBaseline()) >+ return WTF::Optional<int>(curr->logicalTop() + result.value()); // Translate to our coordinate space. > } > } > >- return std::optional<int>(); >+ return WTF::Optional<int>(); > } > >-std::optional<int> RenderBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const >+WTF::Optional<int> RenderBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const > { > if (isWritingModeRoot() && !isRubyRun()) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > > bool haveNormalFlowChild = false; > for (auto* box = lastChildBox(); box; box = box->previousSiblingBox()) { > if (box->isFloatingOrOutOfFlowPositioned()) > continue; > haveNormalFlowChild = true; >- if (std::optional<int> result = box->inlineBlockBaseline(lineDirection)) >- return std::optional<int>(box->logicalTop() + result.value()); // Translate to our coordinate space. >+ if (WTF::Optional<int> result = box->inlineBlockBaseline(lineDirection)) >+ return WTF::Optional<int>(box->logicalTop() + result.value()); // Translate to our coordinate space. > } > > if (!haveNormalFlowChild && hasLineIfEmpty()) { > auto& fontMetrics = firstLineStyle().fontMetrics(); >- return std::optional<int>(fontMetrics.ascent() >+ return WTF::Optional<int>(fontMetrics.ascent() > + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2 > + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight())); > } > >- return std::optional<int>(); >+ return WTF::Optional<int>(); > } > > static inline bool isRenderBlockFlowOrRenderButton(RenderElement& renderElement) >@@ -2674,7 +2674,7 @@ bool RenderBlock::cachedEnclosingFragmentedFlowNeedsUpdate() const > void RenderBlock::setCachedEnclosingFragmentedFlowNeedsUpdate() > { > RenderBlockRareData& rareData = ensureBlockRareData(*this); >- rareData.m_enclosingFragmentedFlow = std::nullopt; >+ rareData.m_enclosingFragmentedFlow = WTF::nullopt; > } > > RenderFragmentedFlow* RenderBlock::updateCachedEnclosingFragmentedFlow(RenderFragmentedFlow* fragmentedFlow) const >@@ -3159,9 +3159,9 @@ bool RenderBlock::hasDefiniteLogicalHeight() const > return (bool)availableLogicalHeightForPercentageComputation(); > } > >-std::optional<LayoutUnit> RenderBlock::availableLogicalHeightForPercentageComputation() const >+WTF::Optional<LayoutUnit> RenderBlock::availableLogicalHeightForPercentageComputation() const > { >- std::optional<LayoutUnit> availableHeight; >+ WTF::Optional<LayoutUnit> availableHeight; > > // For anonymous blocks that are skipped during percentage height calculation, > // we consider them to have an indefinite height. >@@ -3175,7 +3175,7 @@ std::optional<LayoutUnit> RenderBlock::availableLogicalHeightForPercentageComput > // that can be used for any percentage computations. > bool isOutOfFlowPositionedWithSpecifiedHeight = isOutOfFlowPositioned() && (!styleToUse.logicalHeight().isAuto() || (!styleToUse.logicalTop().isAuto() && !styleToUse.logicalBottom().isAuto())); > >- std::optional<LayoutUnit> stretchedFlexHeight; >+ WTF::Optional<LayoutUnit> stretchedFlexHeight; > if (isFlexItem()) > stretchedFlexHeight = downcast<RenderFlexibleBox>(parent())->childLogicalHeightForPercentageResolution(*this); > >@@ -3185,16 +3185,16 @@ std::optional<LayoutUnit> RenderBlock::availableLogicalHeightForPercentageComput > availableHeight = overrideContentLogicalHeight(); > else if (styleToUse.logicalHeight().isFixed()) { > LayoutUnit contentBoxHeight = adjustContentBoxLogicalHeightForBoxSizing((LayoutUnit)styleToUse.logicalHeight().value()); >- availableHeight = std::max(0_lu, constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - scrollbarLogicalHeight(), std::nullopt)); >+ availableHeight = std::max(0_lu, constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - scrollbarLogicalHeight(), WTF::nullopt)); > } else if (styleToUse.logicalHeight().isPercentOrCalculated() && !isOutOfFlowPositionedWithSpecifiedHeight) { >- std::optional<LayoutUnit> heightWithScrollbar = computePercentageLogicalHeight(styleToUse.logicalHeight()); >+ WTF::Optional<LayoutUnit> heightWithScrollbar = computePercentageLogicalHeight(styleToUse.logicalHeight()); > if (heightWithScrollbar) { > LayoutUnit contentBoxHeightWithScrollbar = adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar.value()); > // We need to adjust for min/max height because this method does not > // handle the min/max of the current block, its caller does. So the > // return value from the recursive call will not have been adjusted > // yet. >- LayoutUnit contentBoxHeight = constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - scrollbarLogicalHeight(), std::nullopt); >+ LayoutUnit contentBoxHeight = constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - scrollbarLogicalHeight(), WTF::nullopt); > availableHeight = std::max(0_lu, contentBoxHeight); > } > } else if (isOutOfFlowPositionedWithSpecifiedHeight) { >@@ -3442,7 +3442,7 @@ LayoutUnit RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit heig > return std::max(height, bordersPlusPadding); > } > >-LayoutUnit RenderBlock::adjustContentBoxLogicalHeightForBoxSizing(std::optional<LayoutUnit> height) const >+LayoutUnit RenderBlock::adjustContentBoxLogicalHeightForBoxSizing(WTF::Optional<LayoutUnit> height) const > { > // FIXME: We're doing this to match other browsers even though it's questionable. > // Shouldn't height:100px mean the fieldset content gets 100px of height even if the >diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h >index f2667085b2b59b265adc4886c0db1a0844d327c1..910679d73a274f04341cc5a2fe7c1c733ce84a94 100644 >--- a/Source/WebCore/rendering/RenderBlock.h >+++ b/Source/WebCore/rendering/RenderBlock.h >@@ -231,7 +231,7 @@ public: > LayoutUnit borderRight() const override; > LayoutUnit borderBefore() const override; > LayoutUnit adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const override; >- LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(std::optional<LayoutUnit> height) const override; >+ LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(WTF::Optional<LayoutUnit> height) const override; > void paintExcludedChildrenInBorder(PaintInfo&, const LayoutPoint&); > > // Accessors for logical width/height and margins in the containing block's block-flow direction. >@@ -315,7 +315,7 @@ public: > virtual bool cachedEnclosingFragmentedFlowNeedsUpdate() const; > void resetEnclosingFragmentedFlowAndChildInfoIncludingDescendants(RenderFragmentedFlow* = nullptr) final; > >- std::optional<LayoutUnit> availableLogicalHeightForPercentageComputation() const; >+ WTF::Optional<LayoutUnit> availableLogicalHeightForPercentageComputation() const; > bool hasDefiniteLogicalHeight() const; > > protected: >@@ -351,8 +351,8 @@ protected: > void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; > void computePreferredLogicalWidths() override; > >- std::optional<int> firstLineBaseline() const override; >- std::optional<int> inlineBlockBaseline(LineDirectionMode) const override; >+ WTF::Optional<int> firstLineBaseline() const override; >+ WTF::Optional<int> inlineBlockBaseline(LineDirectionMode) const override; > > // Delay updating scrollbars until endAndCommitUpdateScrollInfoAfterLayoutTransaction() is called. These functions are used > // when a flexbox is laying out its descendants. If multiple calls are made to beginUpdateScrollInfoAfterLayoutTransaction() >diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp >index 2df8068df84bc65cf91b103f460d34e7d3a8a339..5a4045afd549357e06725fef31e9f322b4129fe8 100644 >--- a/Source/WebCore/rendering/RenderBlockFlow.cpp >+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp >@@ -404,7 +404,7 @@ void RenderBlockFlow::computeColumnCountAndWidth() > setComputedColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); > } > >-bool RenderBlockFlow::willCreateColumns(std::optional<unsigned> desiredColumnCount) const >+bool RenderBlockFlow::willCreateColumns(WTF::Optional<unsigned> desiredColumnCount) const > { > // The following types are not supposed to create multicol context. > if (isFileUploadControl() || isTextControl() || isListBox()) >@@ -2998,19 +2998,19 @@ void RenderBlockFlow::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUn > } > } > >-std::optional<int> RenderBlockFlow::firstLineBaseline() const >+WTF::Optional<int> RenderBlockFlow::firstLineBaseline() const > { > if (isWritingModeRoot() && !isRubyRun() && !isGridItem()) >- return std::nullopt; >+ return WTF::nullopt; > > if (!childrenInline()) > return RenderBlock::firstLineBaseline(); > > if (!hasLines()) >- return std::nullopt; >+ return WTF::nullopt; > > if (auto simpleLineLayout = this->simpleLineLayout()) >- return std::optional<int>(SimpleLineLayout::computeFlowFirstLineBaseline(*this, *simpleLineLayout)); >+ return WTF::Optional<int>(SimpleLineLayout::computeFlowFirstLineBaseline(*this, *simpleLineLayout)); > > ASSERT(firstRootBox()); > if (style().isFlippedLinesWritingMode()) >@@ -3018,25 +3018,25 @@ std::optional<int> RenderBlockFlow::firstLineBaseline() const > return firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().ascent(firstRootBox()->baselineType()); > } > >-std::optional<int> RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const >+WTF::Optional<int> RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const > { > if (isWritingModeRoot() && !isRubyRun()) >- return std::nullopt; >+ return WTF::nullopt; > > // Note that here we only take the left and bottom into consideration. Our caller takes the right and top into consideration. > float boxHeight = lineDirection == HorizontalLine ? height() + m_marginBox.bottom() : width() + m_marginBox.left(); > float lastBaseline; > if (!childrenInline()) { >- std::optional<int> inlineBlockBaseline = RenderBlock::inlineBlockBaseline(lineDirection); >+ WTF::Optional<int> inlineBlockBaseline = RenderBlock::inlineBlockBaseline(lineDirection); > if (!inlineBlockBaseline) > return inlineBlockBaseline; > lastBaseline = inlineBlockBaseline.value(); > } else { > if (!hasLines()) { > if (!hasLineIfEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > const auto& fontMetrics = firstLineStyle().fontMetrics(); >- return std::optional<int>(fontMetrics.ascent() >+ return WTF::Optional<int>(fontMetrics.ascent() > + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2 > + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight())); > } >diff --git a/Source/WebCore/rendering/RenderBlockFlow.h b/Source/WebCore/rendering/RenderBlockFlow.h >index 4e40b114d84e0d2de47d70b168f06a00a75bc1b3..563ad003634d130b1da9e7dfec3bef78645d1ff7 100644 >--- a/Source/WebCore/rendering/RenderBlockFlow.h >+++ b/Source/WebCore/rendering/RenderBlockFlow.h >@@ -267,7 +267,7 @@ public: > RenderMultiColumnFlow* multiColumnFlow() const { return hasRareBlockFlowData() ? rareBlockFlowData()->m_multiColumnFlow.get() : nullptr; } > void setMultiColumnFlow(RenderMultiColumnFlow&); > void clearMultiColumnFlow(); >- bool willCreateColumns(std::optional<unsigned> desiredColumnCount = std::nullopt) const; >+ bool willCreateColumns(WTF::Optional<unsigned> desiredColumnCount = WTF::nullopt) const; > virtual bool requiresColumns(int) const; > > bool containsFloats() const override { return m_floatingObjects && !m_floatingObjects->set().isEmpty(); } >@@ -438,8 +438,8 @@ protected: > > void createFloatingObjects(); > >- std::optional<int> firstLineBaseline() const override; >- std::optional<int> inlineBlockBaseline(LineDirectionMode) const override; >+ WTF::Optional<int> firstLineBaseline() const override; >+ WTF::Optional<int> inlineBlockBaseline(LineDirectionMode) const override; > > bool isMultiColumnBlockFlow() const override { return multiColumnFlow(); } > >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index c0f3ff08271a4ef4fb6b178e0def6015b9279405..fd2e5096d96d4e6182c2e3d50517d475bc792b67 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -98,7 +98,7 @@ static OverrideSizeMap* gOverrideContentLogicalHeightMap = nullptr; > static OverrideSizeMap* gOverrideContentLogicalWidthMap = nullptr; > > // Used by grid elements to properly size their grid items. >-typedef WTF::HashMap<const RenderBox*, std::optional<LayoutUnit>> OverrideOptionalSizeMap; >+typedef WTF::HashMap<const RenderBox*, WTF::Optional<LayoutUnit>> OverrideOptionalSizeMap; > static OverrideOptionalSizeMap* gOverrideContainingBlockContentLogicalHeightMap = nullptr; > static OverrideOptionalSizeMap* gOverrideContainingBlockContentLogicalWidthMap = nullptr; > >@@ -621,26 +621,26 @@ LayoutUnit RenderBox::constrainLogicalWidthInFragmentByMinMax(LayoutUnit logical > return std::max(logicalWidth, computeLogicalWidthInFragmentUsing(MinSize, styleToUse.logicalMinWidth(), availableWidth, cb, fragment)); > } > >-LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const >+LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, WTF::Optional<LayoutUnit> intrinsicContentHeight) const > { > const RenderStyle& styleToUse = style(); > if (!styleToUse.logicalMaxHeight().isUndefined()) { >- if (std::optional<LayoutUnit> maxH = computeLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight)) >+ if (WTF::Optional<LayoutUnit> maxH = computeLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight)) > logicalHeight = std::min(logicalHeight, maxH.value()); > } >- if (std::optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight)) >+ if (WTF::Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight)) > return std::max(logicalHeight, computedLogicalHeight.value()); > return logicalHeight; > } > >-LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const >+LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, WTF::Optional<LayoutUnit> intrinsicContentHeight) const > { > const RenderStyle& styleToUse = style(); > if (!styleToUse.logicalMaxHeight().isUndefined()) { >- if (std::optional<LayoutUnit> maxH = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight)) >+ if (WTF::Optional<LayoutUnit> maxH = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight)) > logicalHeight = std::min(logicalHeight, maxH.value()); > } >- if (std::optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight)) >+ if (WTF::Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight)) > return std::max(logicalHeight, computedContentLogicalHeight.value()); > return logicalHeight; > } >@@ -1086,13 +1086,13 @@ LayoutUnit RenderBox::overrideContentLogicalHeight() const > return gOverrideContentLogicalHeightMap->get(this); > } > >-std::optional<LayoutUnit> RenderBox::overrideContainingBlockContentLogicalWidth() const >+WTF::Optional<LayoutUnit> RenderBox::overrideContainingBlockContentLogicalWidth() const > { > ASSERT(hasOverrideContainingBlockContentLogicalWidth()); > return gOverrideContainingBlockContentLogicalWidthMap->get(this); > } > >-std::optional<LayoutUnit> RenderBox::overrideContainingBlockContentLogicalHeight() const >+WTF::Optional<LayoutUnit> RenderBox::overrideContainingBlockContentLogicalHeight() const > { > ASSERT(hasOverrideContainingBlockContentLogicalHeight()); > return gOverrideContainingBlockContentLogicalHeightMap->get(this); >@@ -1108,14 +1108,14 @@ bool RenderBox::hasOverrideContainingBlockContentLogicalHeight() const > return gOverrideContainingBlockContentLogicalHeightMap && gOverrideContainingBlockContentLogicalHeightMap->contains(this); > } > >-void RenderBox::setOverrideContainingBlockContentLogicalWidth(std::optional<LayoutUnit> logicalWidth) >+void RenderBox::setOverrideContainingBlockContentLogicalWidth(WTF::Optional<LayoutUnit> logicalWidth) > { > if (!gOverrideContainingBlockContentLogicalWidthMap) > gOverrideContainingBlockContentLogicalWidthMap = new OverrideOptionalSizeMap; > gOverrideContainingBlockContentLogicalWidthMap->set(this, logicalWidth); > } > >-void RenderBox::setOverrideContainingBlockContentLogicalHeight(std::optional<LayoutUnit> logicalHeight) >+void RenderBox::setOverrideContainingBlockContentLogicalHeight(WTF::Optional<LayoutUnit> logicalHeight) > { > if (!gOverrideContainingBlockContentLogicalHeightMap) > gOverrideContainingBlockContentLogicalHeightMap = new OverrideOptionalSizeMap; >@@ -1158,7 +1158,7 @@ LayoutUnit RenderBox::adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width) > return std::max<LayoutUnit>(0, width); > } > >-LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(std::optional<LayoutUnit> height) const >+LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(WTF::Optional<LayoutUnit> height) const > { > if (!height) > return 0; >@@ -2158,7 +2158,7 @@ LayoutRect RenderBox::computeVisibleRectUsingPaintOffset(const LayoutRect& rect) > return adjustedRect; > } > >-std::optional<LayoutRect> RenderBox::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<LayoutRect> RenderBox::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > // The rect we compute at each step is shifted by our x/y offset in the parent container's coordinate space. > // Only when we cross a writing mode boundary will we have to possibly flipForWritingMode (to convert into a more appropriate >@@ -2263,7 +2263,7 @@ std::optional<LayoutRect> RenderBox::computeVisibleRectInContainer(const LayoutR > bool isEmpty = !containerBox.applyCachedClipAndScrollPosition(adjustedRect, container, context); > if (isEmpty) { > if (context.m_options.contains(VisibleRectContextOption::UseEdgeInclusiveIntersection)) >- return std::nullopt; >+ return WTF::nullopt; > return adjustedRect; > } > } >@@ -2803,21 +2803,21 @@ LayoutUnit RenderBox::computeLogicalHeightWithoutLayout() const > return computedValues.m_extent; > } > >-std::optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const >+WTF::Optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height, WTF::Optional<LayoutUnit> intrinsicContentHeight) const > { >- if (std::optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight)) >+ if (WTF::Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight)) > return adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight.value()); >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<LayoutUnit> RenderBox::computeContentLogicalHeight(SizeType heightType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const >+WTF::Optional<LayoutUnit> RenderBox::computeContentLogicalHeight(SizeType heightType, const Length& height, WTF::Optional<LayoutUnit> intrinsicContentHeight) const > { >- if (std::optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight)) >+ if (WTF::Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight)) > return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<LayoutUnit> RenderBox::computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, std::optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const >+WTF::Optional<LayoutUnit> RenderBox::computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, WTF::Optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const > { > // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to. > // If that happens, this code will have to change. >@@ -2834,10 +2834,10 @@ std::optional<LayoutUnit> RenderBox::computeIntrinsicLogicalContentHeightUsing(L > return 0_lu; > } > >-std::optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const >+WTF::Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, const Length& height, WTF::Optional<LayoutUnit> intrinsicContentHeight) const > { > if (height.isAuto()) >- return heightType == MinSize ? std::optional<LayoutUnit>(0) : std::nullopt; >+ return heightType == MinSize ? WTF::Optional<LayoutUnit>(0) : WTF::nullopt; > // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to. > // If that happens, this code will have to change. > if (height.isIntrinsic()) >@@ -2846,7 +2846,7 @@ std::optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsin > return LayoutUnit(height.value()); > if (height.isPercentOrCalculated()) > return computePercentageLogicalHeight(height); >- return std::nullopt; >+ return WTF::nullopt; > } > > bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox& containingBlock, bool isPerpendicularWritingMode) const >@@ -2901,9 +2901,9 @@ static bool tableCellShouldHaveZeroInitialSize(const RenderBlock& block, const R > return scrollsOverflowY && !child.shouldTreatChildAsReplacedInTableCells() && (!cell.style().logicalHeight().isAuto() || !cell.table()->style().logicalHeight().isAuto()); > } > >-std::optional<LayoutUnit> RenderBox::computePercentageLogicalHeight(const Length& height) const >+WTF::Optional<LayoutUnit> RenderBox::computePercentageLogicalHeight(const Length& height) const > { >- std::optional<LayoutUnit> availableHeight; >+ WTF::Optional<LayoutUnit> availableHeight; > > bool skippedAutoHeightContainingBlock = false; > RenderBlock* cb = containingBlock(); >@@ -2929,7 +2929,7 @@ std::optional<LayoutUnit> RenderBox::computePercentageLogicalHeight(const Length > // don't care if the cell specified a height or not. We just always make ourselves > // be a percentage of the cell's current content height. > if (!cb->hasOverrideContentLogicalHeight()) >- return tableCellShouldHaveZeroInitialSize(*cb, *this, scrollsOverflowY()) ? std::optional<LayoutUnit>(0) : std::nullopt; >+ return tableCellShouldHaveZeroInitialSize(*cb, *this, scrollsOverflowY()) ? WTF::Optional<LayoutUnit>(0) : WTF::nullopt; > > availableHeight = cb->overrideContentLogicalHeight(); > } >@@ -3015,7 +3015,7 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType widthType, Lengt > return 0; > } > >-LayoutUnit RenderBox::computeReplacedLogicalHeight(std::optional<LayoutUnit>) const >+LayoutUnit RenderBox::computeReplacedLogicalHeight(WTF::Optional<LayoutUnit>) const > { > return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight())); > } >@@ -3065,7 +3065,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Len > { > ASSERT(heightType == MinSize || heightType == MainOrPreferredSize || !logicalHeight.isAuto()); > if (heightType == MinSize && logicalHeight.isAuto()) >- return adjustContentBoxLogicalHeightForBoxSizing(std::optional<LayoutUnit>(0)); >+ return adjustContentBoxLogicalHeightForBoxSizing(WTF::Optional<LayoutUnit>(0)); > > switch (logicalHeight.type()) { > case Fixed: >@@ -3080,7 +3080,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Len > break; > container = container->containingBlock(); > } >- std::optional<LayoutUnit> stretchedHeight; >+ WTF::Optional<LayoutUnit> stretchedHeight; > if (is<RenderBlock>(container)) { > auto* block = downcast<RenderBlock>(container); > block->addPercentHeightDescendant(*const_cast<RenderBox*>(this)); >@@ -3143,7 +3143,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Len > > LayoutUnit RenderBox::availableLogicalHeight(AvailableLogicalHeightType heightType) const > { >- return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style().logicalHeight(), heightType), std::nullopt); >+ return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style().logicalHeight(), heightType), WTF::nullopt); > } > > LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogicalHeightType heightType) const >@@ -3170,7 +3170,7 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi > return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight)); > } > >- if (std::optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h, std::nullopt)) >+ if (WTF::Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h, WTF::nullopt)) > return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); > > // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical writing-mode. >@@ -4626,7 +4626,7 @@ bool RenderBox::percentageLogicalHeightIsResolvable() const > // Do this to avoid duplicating all the logic that already exists when computing > // an actual percentage height. > Length fakeLength(100, Percent); >- return computePercentageLogicalHeight(fakeLength) != std::nullopt; >+ return computePercentageLogicalHeight(fakeLength) != WTF::nullopt; > } > > bool RenderBox::hasUnsplittableScrollingOverflow() const >diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h >index db1094d69e57333f5bab39490ad2ab0da861bcc8..d27bdadfdfdde21daedc006767502b064c6e924d 100644 >--- a/Source/WebCore/rendering/RenderBox.h >+++ b/Source/WebCore/rendering/RenderBox.h >@@ -84,8 +84,8 @@ public: > LayoutUnit logicalHeight() const { return style().isHorizontalWritingMode() ? height() : width(); } > > LayoutUnit constrainLogicalWidthInFragmentByMinMax(LayoutUnit, LayoutUnit, RenderBlock&, RenderFragmentContainer* = nullptr) const; >- LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const; >- LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const; >+ LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, WTF::Optional<LayoutUnit> intrinsicContentHeight) const; >+ LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, WTF::Optional<LayoutUnit> intrinsicContentHeight) const; > > void setLogicalLeft(LayoutUnit left) > { >@@ -314,12 +314,12 @@ public: > void clearOverrideContentLogicalHeight(); > void clearOverrideContentLogicalWidth(); > >- std::optional<LayoutUnit> overrideContainingBlockContentLogicalWidth() const; >- std::optional<LayoutUnit> overrideContainingBlockContentLogicalHeight() const; >+ WTF::Optional<LayoutUnit> overrideContainingBlockContentLogicalWidth() const; >+ WTF::Optional<LayoutUnit> overrideContainingBlockContentLogicalHeight() const; > bool hasOverrideContainingBlockContentLogicalWidth() const; > bool hasOverrideContainingBlockContentLogicalHeight() const; >- void setOverrideContainingBlockContentLogicalWidth(std::optional<LayoutUnit>); >- void setOverrideContainingBlockContentLogicalHeight(std::optional<LayoutUnit>); >+ void setOverrideContainingBlockContentLogicalWidth(WTF::Optional<LayoutUnit>); >+ void setOverrideContainingBlockContentLogicalHeight(WTF::Optional<LayoutUnit>); > void clearOverrideContainingBlockContentSize(); > void clearOverrideContainingBlockContentLogicalHeight(); > >@@ -330,7 +330,7 @@ public: > > // Overridden by fieldsets to subtract out the intrinsic border. > virtual LayoutUnit adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const; >- virtual LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(std::optional<LayoutUnit> height) const; >+ virtual LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(WTF::Optional<LayoutUnit> height) const; > > struct ComputedMarginValues { > LayoutUnit m_before; >@@ -371,7 +371,7 @@ public: > void deleteLineBoxWrapper(); > > LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; >- std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const >+ WTF::Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const > override; > void repaintDuringLayoutIfMoved(const LayoutRect&); > virtual void repaintOverhangingFloats(bool paintAllDescendants); >@@ -421,18 +421,18 @@ override; > LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock& cb, RenderFragmentContainer*) const; > > LayoutUnit computeLogicalWidthInFragmentUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock& containingBlock, RenderFragmentContainer*) const; >- std::optional<LayoutUnit> computeLogicalHeightUsing(SizeType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const; >- std::optional<LayoutUnit> computeContentLogicalHeight(SizeType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const; >- std::optional<LayoutUnit> computeContentAndScrollbarLogicalHeightUsing(SizeType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const; >+ WTF::Optional<LayoutUnit> computeLogicalHeightUsing(SizeType, const Length& height, WTF::Optional<LayoutUnit> intrinsicContentHeight) const; >+ WTF::Optional<LayoutUnit> computeContentLogicalHeight(SizeType, const Length& height, WTF::Optional<LayoutUnit> intrinsicContentHeight) const; >+ WTF::Optional<LayoutUnit> computeContentAndScrollbarLogicalHeightUsing(SizeType, const Length& height, WTF::Optional<LayoutUnit> intrinsicContentHeight) const; > LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const; > LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const; > LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const; > LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const; > > virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const; >- virtual LayoutUnit computeReplacedLogicalHeight(std::optional<LayoutUnit> estimatedUsedWidth = std::nullopt) const; >+ virtual LayoutUnit computeReplacedLogicalHeight(WTF::Optional<LayoutUnit> estimatedUsedWidth = WTF::nullopt) const; > >- std::optional<LayoutUnit> computePercentageLogicalHeight(const Length& height) const; >+ WTF::Optional<LayoutUnit> computePercentageLogicalHeight(const Length& height) const; > > virtual LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); } > virtual LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const; >@@ -519,8 +519,8 @@ override; > > RenderLayer* enclosingFloatPaintingLayer() const; > >- virtual std::optional<int> firstLineBaseline() const { return std::optional<int>(); } >- virtual std::optional<int> inlineBlockBaseline(LineDirectionMode) const { return std::optional<int>(); } // Returns empty if we should skip this box when computing the baseline of an inline-block. >+ virtual WTF::Optional<int> firstLineBaseline() const { return WTF::Optional<int>(); } >+ virtual WTF::Optional<int> inlineBlockBaseline(LineDirectionMode) const { return WTF::Optional<int>(); } // Returns empty if we should skip this box when computing the baseline of an inline-block. > > bool shrinkToAvoidFloats() const; > virtual bool avoidsFloats() const; >@@ -660,7 +660,7 @@ protected: > void computePositionedLogicalWidth(LogicalExtentComputedValues&, RenderFragmentContainer* = nullptr) const; > > LayoutUnit computeIntrinsicLogicalWidthUsing(Length logicalWidthLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; >- virtual std::optional<LayoutUnit> computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, std::optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const; >+ virtual WTF::Optional<LayoutUnit> computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, WTF::Optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const; > > virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } > >diff --git a/Source/WebCore/rendering/RenderCombineText.cpp b/Source/WebCore/rendering/RenderCombineText.cpp >index cc86c3dd406e6e57d786987c704a8c6967236fad..227a793b68d4e4f96d5832765eb0b83840a72e7d 100644 >--- a/Source/WebCore/rendering/RenderCombineText.cpp >+++ b/Source/WebCore/rendering/RenderCombineText.cpp >@@ -76,10 +76,10 @@ float RenderCombineText::width(unsigned from, unsigned length, const FontCascade > return RenderText::width(from, length, font, xPosition, fallbackFonts, glyphOverflow); > } > >-std::optional<FloatPoint> RenderCombineText::computeTextOrigin(const FloatRect& boxRect) const >+WTF::Optional<FloatPoint> RenderCombineText::computeTextOrigin(const FloatRect& boxRect) const > { > if (!m_isCombined) >- return std::nullopt; >+ return WTF::nullopt; > > // Visually center m_combinedTextWidth/Ascent/Descent within boxRect > FloatPoint result = boxRect.minXMaxYCorner(); >diff --git a/Source/WebCore/rendering/RenderCombineText.h b/Source/WebCore/rendering/RenderCombineText.h >index 15850f15a35f132cc6fee2a98babe30b1b1a5731..0e97690f123abeddd08b28666120a820e8c32e6a 100644 >--- a/Source/WebCore/rendering/RenderCombineText.h >+++ b/Source/WebCore/rendering/RenderCombineText.h >@@ -34,7 +34,7 @@ public: > Text& textNode() const { return downcast<Text>(nodeForNonAnonymous()); } > > void combineTextIfNeeded(); >- std::optional<FloatPoint> computeTextOrigin(const FloatRect& boxRect) const; >+ WTF::Optional<FloatPoint> computeTextOrigin(const FloatRect& boxRect) const; > String combinedStringForRendering() const; > bool isCombined() const { return m_isCombined; } > float combinedTextWidth(const FontCascade& font) const { return font.size(); } >diff --git a/Source/WebCore/rendering/RenderCounter.cpp b/Source/WebCore/rendering/RenderCounter.cpp >index 11e547bb6ab90b6e3aa3110de14534362c6726fb..1f1882878e9ec7ccb5b548105c219c3f885e6eea 100644 >--- a/Source/WebCore/rendering/RenderCounter.cpp >+++ b/Source/WebCore/rendering/RenderCounter.cpp >@@ -111,8 +111,8 @@ static CounterDirectives listItemCounterDirectives(RenderElement& renderer) > if (is<RenderListItem>(renderer)) { > auto& item = downcast<RenderListItem>(renderer); > if (auto explicitValue = item.explicitValue()) >- return { *explicitValue, std::nullopt }; >- return { std::nullopt, item.isInReversedOrderedList() ? -1 : 1 }; >+ return { *explicitValue, WTF::nullopt }; >+ return { WTF::nullopt, item.isInReversedOrderedList() ? -1 : 1 }; > } > if (auto element = renderer.element()) { > if (is<HTMLOListElement>(*element)) { >@@ -120,7 +120,7 @@ static CounterDirectives listItemCounterDirectives(RenderElement& renderer) > return { list.start(), list.isReversed() ? 1 : -1 }; > } > if (isHTMLListElement(*element)) >- return { 0, std::nullopt }; >+ return { 0, WTF::nullopt }; > } > return { }; > } >@@ -130,12 +130,12 @@ struct CounterPlan { > int value; > }; > >-static std::optional<CounterPlan> planCounter(RenderElement& renderer, const AtomicString& identifier) >+static WTF::Optional<CounterPlan> planCounter(RenderElement& renderer, const AtomicString& identifier) > { > // We must have a generating node or else we cannot have a counter. > Element* generatingElement = renderer.generatingElement(); > if (!generatingElement) >- return std::nullopt; >+ return WTF::nullopt; > > auto& style = renderer.style(); > >@@ -144,13 +144,13 @@ static std::optional<CounterPlan> planCounter(RenderElement& renderer, const Ato > // Sometimes elements have more then one renderer. Only the first one gets the counter > // LayoutTests/http/tests/css/counter-crash.html > if (generatingElement->renderer() != &renderer) >- return std::nullopt; >+ return WTF::nullopt; > break; > case PseudoId::Before: > case PseudoId::After: > break; > default: >- return std::nullopt; // Counters are forbidden from all other pseudo elements. >+ return WTF::nullopt; // Counters are forbidden from all other pseudo elements. > } > > CounterDirectives directives; >@@ -170,7 +170,7 @@ static std::optional<CounterPlan> planCounter(RenderElement& renderer, const Ato > return CounterPlan { true, saturatedAddition(*directives.resetValue, directives.incrementValue.value_or(0)) }; > if (directives.incrementValue) > return CounterPlan { false, *directives.incrementValue }; >- return std::nullopt; >+ return WTF::nullopt; > } > > // - Finds the insertion point for the counter described by counterOwner, isReset and >diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp >index 01bdf07e3e948694e1526d9af99557ac6023abf0..3da44ecf7b27b2c829d98b965f6e236cd6a4119f 100644 >--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp >+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp >@@ -178,10 +178,10 @@ int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di > return baseline + marginAscent; > } > >-std::optional<int> RenderFlexibleBox::firstLineBaseline() const >+WTF::Optional<int> RenderFlexibleBox::firstLineBaseline() const > { > if (isWritingModeRoot() || m_numberOfInFlowChildrenOnFirstLine <= 0) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > RenderBox* baselineChild = nullptr; > int childNumber = 0; > for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) { >@@ -200,27 +200,27 @@ std::optional<int> RenderFlexibleBox::firstLineBaseline() const > } > > if (!baselineChild) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > > if (!isColumnFlow() && hasOrthogonalFlow(*baselineChild)) >- return std::optional<int>(crossAxisExtentForChild(*baselineChild) + baselineChild->logicalTop()); >+ return WTF::Optional<int>(crossAxisExtentForChild(*baselineChild) + baselineChild->logicalTop()); > if (isColumnFlow() && !hasOrthogonalFlow(*baselineChild)) >- return std::optional<int>(mainAxisExtentForChild(*baselineChild) + baselineChild->logicalTop()); >+ return WTF::Optional<int>(mainAxisExtentForChild(*baselineChild) + baselineChild->logicalTop()); > >- std::optional<int> baseline = baselineChild->firstLineBaseline(); >+ WTF::Optional<int> baseline = baselineChild->firstLineBaseline(); > if (!baseline) { > // FIXME: We should pass |direction| into firstLineBoxBaseline and stop bailing out if we're a writing mode root. > // This would also fix some cases where the flexbox is orthogonal to its container. > LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine; >- return std::optional<int>(synthesizedBaselineFromContentBox(*baselineChild, direction) + baselineChild->logicalTop()); >+ return WTF::Optional<int>(synthesizedBaselineFromContentBox(*baselineChild, direction) + baselineChild->logicalTop()); > } > >- return std::optional<int>(baseline.value() + baselineChild->logicalTop()); >+ return WTF::Optional<int>(baseline.value() + baselineChild->logicalTop()); > } > >-std::optional<int> RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const >+WTF::Optional<int> RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const > { >- if (std::optional<int> baseline = firstLineBaseline()) >+ if (WTF::Optional<int> baseline = firstLineBaseline()) > return baseline; > > int marginAscent = direction == HorizontalLine ? marginTop() : marginRight(); >@@ -517,7 +517,7 @@ LayoutUnit RenderFlexibleBox::mainAxisContentExtent(LayoutUnit contentLogicalHei > return contentLogicalWidth(); > } > >-std::optional<LayoutUnit> RenderFlexibleBox::computeMainAxisExtentForChild(const RenderBox& child, SizeType sizeType, const Length& size) >+WTF::Optional<LayoutUnit> RenderFlexibleBox::computeMainAxisExtentForChild(const RenderBox& child, SizeType sizeType, const Length& size) > { > // If we have a horizontal flow, that means the main size is the width. > // That's the logical width for horizontal writing modes, and the logical >@@ -533,7 +533,7 @@ std::optional<LayoutUnit> RenderFlexibleBox::computeMainAxisExtentForChild(const > // if necessary (see ComputeNextFlexLine and the call to > // childHasIntrinsicMainAxisSize) so we can be sure that the two height > // calls here will return up-to-date data. >- std::optional<LayoutUnit> height = child.computeContentLogicalHeight(sizeType, size, cachedChildIntrinsicContentLogicalHeight(child)); >+ WTF::Optional<LayoutUnit> height = child.computeContentLogicalHeight(sizeType, size, cachedChildIntrinsicContentLogicalHeight(child)); > if (!height) > return height; > return height.value() + child.scrollbarLogicalHeight(); >@@ -733,7 +733,7 @@ LayoutUnit RenderFlexibleBox::computeMainSizeFromAspectRatioUsing(const RenderBo > ASSERT(child.hasAspectRatio()); > ASSERT(child.intrinsicSize().height()); > >- std::optional<LayoutUnit> crossSize; >+ WTF::Optional<LayoutUnit> crossSize; > if (crossSizeLength.isFixed()) > crossSize = LayoutUnit(crossSizeLength.value()); > else { >@@ -768,7 +768,7 @@ bool RenderFlexibleBox::mainAxisLengthIsDefinite(const RenderBox& child, const L > return true; > if (m_hasDefiniteHeight == SizeDefiniteness::Indefinite) > return false; >- bool definite = child.computePercentageLogicalHeight(flexBasis) != std::nullopt; >+ bool definite = child.computePercentageLogicalHeight(flexBasis) != WTF::nullopt; > if (m_inLayout) { > // We can reach this code even while we're not laying ourselves out, such > // as from mainSizeForPercentageResolution. >@@ -1071,7 +1071,7 @@ void RenderFlexibleBox::prepareOrderIteratorAndMargins() > LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(const RenderBox& child, LayoutUnit childSize) > { > Length max = isHorizontalFlow() ? child.style().maxWidth() : child.style().maxHeight(); >- std::optional<LayoutUnit> maxExtent = std::nullopt; >+ WTF::Optional<LayoutUnit> maxExtent = WTF::nullopt; > if (max.isSpecifiedOrIntrinsic()) { > maxExtent = computeMainAxisExtentForChild(child, MaxSize, max); > childSize = std::min(childSize, maxExtent.value_or(childSize)); >@@ -1105,7 +1105,7 @@ LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(const RenderBox& child > > if (useChildAspectRatio(child)) { > Length crossSizeLength = isHorizontalFlow() ? child.style().height() : child.style().width(); >- std::optional<LayoutUnit> transferredSize = computeMainSizeFromAspectRatioUsing(child, crossSizeLength); >+ WTF::Optional<LayoutUnit> transferredSize = computeMainSizeFromAspectRatioUsing(child, crossSizeLength); > if (transferredSize) { > transferredSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, transferredSize.value()); > return std::max(childSize, std::min(transferredSize.value(), contentSize)); >@@ -1118,10 +1118,10 @@ LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(const RenderBox& child > return std::max(0_lu, childSize); > } > >-std::optional<LayoutUnit> RenderFlexibleBox::crossSizeForPercentageResolution(const RenderBox& child) >+WTF::Optional<LayoutUnit> RenderFlexibleBox::crossSizeForPercentageResolution(const RenderBox& child) > { > if (alignmentForChild(child) != ItemPosition::Stretch) >- return std::nullopt; >+ return WTF::nullopt; > > // Here we implement https://drafts.csswg.org/css-flexbox/#algo-stretch > if (hasOrthogonalFlow(child) && child.hasOverrideContentLogicalWidth()) >@@ -1135,10 +1135,10 @@ std::optional<LayoutUnit> RenderFlexibleBox::crossSizeForPercentageResolution(co > // definite size, which itself is not cheap. We can consider implementing it > // at a later time. (The correctness is ensured by redoing layout in > // applyStretchAlignmentToChild) >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<LayoutUnit> RenderFlexibleBox::mainSizeForPercentageResolution(const RenderBox& child) >+WTF::Optional<LayoutUnit> RenderFlexibleBox::mainSizeForPercentageResolution(const RenderBox& child) > { > // This function implements section 9.8. Definite and Indefinite Sizes, case > // 2) of the flexbox spec. >@@ -1146,21 +1146,21 @@ std::optional<LayoutUnit> RenderFlexibleBox::mainSizeForPercentageResolution(con > // flex item to have a definite flex basis. > const Length& flexBasis = flexBasisForChild(child); > if (!mainAxisLengthIsDefinite(child, flexBasis)) >- return std::nullopt; >+ return WTF::nullopt; > if (!flexBasis.isPercentOrCalculated()) { > // If flex basis had a percentage, our size is guaranteed to be definite or > // the flex item's size could not be definite. Otherwise, we make up a > // percentage to check whether we have a definite size. > if (!mainAxisLengthIsDefinite(child, Length(0, Percent))) >- return std::nullopt; >+ return WTF::nullopt; > } > > if (hasOrthogonalFlow(child)) >- return child.hasOverrideContentLogicalHeight() ? std::optional<LayoutUnit>(child.overrideContentLogicalHeight()) : std::nullopt; >- return child.hasOverrideContentLogicalWidth() ? std::optional<LayoutUnit>(child.overrideContentLogicalWidth()) : std::nullopt; >+ return child.hasOverrideContentLogicalHeight() ? WTF::Optional<LayoutUnit>(child.overrideContentLogicalHeight()) : WTF::nullopt; >+ return child.hasOverrideContentLogicalWidth() ? WTF::Optional<LayoutUnit>(child.overrideContentLogicalWidth()) : WTF::nullopt; > } > >-std::optional<LayoutUnit> RenderFlexibleBox::childLogicalHeightForPercentageResolution(const RenderBox& child) >+WTF::Optional<LayoutUnit> RenderFlexibleBox::childLogicalHeightForPercentageResolution(const RenderBox& child) > { > if (!hasOrthogonalFlow(child)) > return crossSizeForPercentageResolution(child); >diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h >index 79bfeeee2cfc62961e73dd6a4ddacd9dfb3da467..4c9de7885cf385bf7cbc7f862e8222edd0027f96 100644 >--- a/Source/WebCore/rendering/RenderFlexibleBox.h >+++ b/Source/WebCore/rendering/RenderFlexibleBox.h >@@ -53,8 +53,8 @@ public: > void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final; > > int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override; >- std::optional<int> firstLineBaseline() const override; >- std::optional<int> inlineBlockBaseline(LineDirectionMode) const override; >+ WTF::Optional<int> firstLineBaseline() const override; >+ WTF::Optional<int> inlineBlockBaseline(LineDirectionMode) const override; > > void styleDidChange(StyleDifference, const RenderStyle*) override; > void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override; >@@ -68,9 +68,9 @@ public: > > virtual bool isFlexibleBoxImpl() const { return false; }; > >- std::optional<LayoutUnit> crossSizeForPercentageResolution(const RenderBox&); >- std::optional<LayoutUnit> mainSizeForPercentageResolution(const RenderBox&); >- std::optional<LayoutUnit> childLogicalHeightForPercentageResolution(const RenderBox&); >+ WTF::Optional<LayoutUnit> crossSizeForPercentageResolution(const RenderBox&); >+ WTF::Optional<LayoutUnit> mainSizeForPercentageResolution(const RenderBox&); >+ WTF::Optional<LayoutUnit> childLogicalHeightForPercentageResolution(const RenderBox&); > > void clearCachedMainSizeForChild(const RenderBox& child); > >@@ -122,7 +122,7 @@ private: > LayoutUnit mainAxisExtent() const; > LayoutUnit crossAxisContentExtent() const; > LayoutUnit mainAxisContentExtent(LayoutUnit contentLogicalHeight); >- std::optional<LayoutUnit> computeMainAxisExtentForChild(const RenderBox& child, SizeType, const Length& size); >+ WTF::Optional<LayoutUnit> computeMainAxisExtentForChild(const RenderBox& child, SizeType, const Length& size); > WritingMode transformedWritingMode() const; > LayoutUnit flowAwareBorderStart() const; > LayoutUnit flowAwareBorderEnd() const; >diff --git a/Source/WebCore/rendering/RenderGrid.cpp b/Source/WebCore/rendering/RenderGrid.cpp >index ef45ce1a1c9bcd23cb9b3c5977d0713773b16d59..95c958d336b3b587c43eb24b0c3ade1ff1fd6418 100644 >--- a/Source/WebCore/rendering/RenderGrid.cpp >+++ b/Source/WebCore/rendering/RenderGrid.cpp >@@ -127,12 +127,12 @@ bool RenderGrid::namedGridLinesDefinitionDidChange(const RenderStyle& oldStyle) > > // This method optimizes the gutters computation by skiping the available size > // call if gaps are fixed size (it's only needed for percentages). >-std::optional<LayoutUnit> RenderGrid::availableSpaceForGutters(GridTrackSizingDirection direction) const >+WTF::Optional<LayoutUnit> RenderGrid::availableSpaceForGutters(GridTrackSizingDirection direction) const > { > bool isRowAxis = direction == ForColumns; > const GapLength& gapLength = isRowAxis ? style().columnGap() : style().rowGap(); > if (gapLength.isNormal() || !gapLength.length().isPercentOrCalculated()) >- return std::nullopt; >+ return WTF::nullopt; > > return isRowAxis ? availableLogicalWidth() : contentLogicalHeight(); > } >@@ -192,7 +192,7 @@ void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit) > LayoutSize previousSize = size(); > // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff. > // FIXME: Consider caching the hasDefiniteLogicalHeight value throughout the layout. >- bool hasDefiniteLogicalHeight = hasOverrideContentLogicalHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), std::nullopt); >+ bool hasDefiniteLogicalHeight = hasOverrideContentLogicalHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), WTF::nullopt); > > m_hasAnyOrthogonalItem = false; > for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) { >@@ -304,7 +304,7 @@ void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit) > m_baselineItemsCached = false; > } > >-LayoutUnit RenderGrid::gridGap(GridTrackSizingDirection direction, std::optional<LayoutUnit> availableSize) const >+LayoutUnit RenderGrid::gridGap(GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> availableSize) const > { > const GapLength& gapLength = direction == ForColumns? style().columnGap() : style().rowGap(); > if (gapLength.isNormal()) >@@ -323,7 +323,7 @@ LayoutUnit RenderGrid::gridItemOffset(GridTrackSizingDirection direction) const > return direction == ForRows ? m_offsetBetweenRows.distributionOffset : m_offsetBetweenColumns.distributionOffset; > } > >-LayoutUnit RenderGrid::guttersSize(const Grid& grid, GridTrackSizingDirection direction, unsigned startLine, unsigned span, std::optional<LayoutUnit> availableSize) const >+LayoutUnit RenderGrid::guttersSize(const Grid& grid, GridTrackSizingDirection direction, unsigned startLine, unsigned span, WTF::Optional<LayoutUnit> availableSize) const > { > if (span <= 1) > return { }; >@@ -399,7 +399,7 @@ void RenderGrid::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo > > Grid grid(const_cast<RenderGrid&>(*this)); > GridTrackSizingAlgorithm algorithm(this, grid); >- placeItemsOnGrid(algorithm, std::nullopt); >+ placeItemsOnGrid(algorithm, WTF::nullopt); > > performGridItemsPreLayout(algorithm); > >@@ -429,11 +429,11 @@ void RenderGrid::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo > void RenderGrid::computeTrackSizesForIndefiniteSize(GridTrackSizingAlgorithm& algorithm, GridTrackSizingDirection direction, LayoutUnit* minIntrinsicSize, LayoutUnit* maxIntrinsicSize) const > { > const Grid& grid = algorithm.grid(); >- algorithm.setup(direction, numTracks(direction, grid), IntrinsicSizeComputation, std::nullopt, std::nullopt); >+ algorithm.setup(direction, numTracks(direction, grid), IntrinsicSizeComputation, WTF::nullopt, WTF::nullopt); > algorithm.run(); > > size_t numberOfTracks = algorithm.tracks(direction).size(); >- LayoutUnit totalGuttersSize = guttersSize(grid, direction, 0, numberOfTracks, std::nullopt); >+ LayoutUnit totalGuttersSize = guttersSize(grid, direction, 0, numberOfTracks, WTF::nullopt); > > if (minIntrinsicSize) > *minIntrinsicSize = algorithm.minContentSize() + totalGuttersSize; >@@ -443,7 +443,7 @@ void RenderGrid::computeTrackSizesForIndefiniteSize(GridTrackSizingAlgorithm& al > ASSERT(algorithm.tracksAreWiderThanMinTrackBreadth()); > } > >-unsigned RenderGrid::computeAutoRepeatTracksCount(GridTrackSizingDirection direction, std::optional<LayoutUnit> availableSize) const >+unsigned RenderGrid::computeAutoRepeatTracksCount(GridTrackSizingDirection direction, WTF::Optional<LayoutUnit> availableSize) const > { > ASSERT(!availableSize || availableSize.value() != -1); > bool isRowAxis = direction == ForColumns; >@@ -456,9 +456,9 @@ unsigned RenderGrid::computeAutoRepeatTracksCount(GridTrackSizingDirection direc > if (!isRowAxis && !availableSize) { > const Length& maxLength = style().logicalMaxHeight(); > if (!maxLength.isUndefined()) { >- availableSize = computeContentLogicalHeight(MaxSize, maxLength, std::nullopt); >+ availableSize = computeContentLogicalHeight(MaxSize, maxLength, WTF::nullopt); > if (availableSize) >- availableSize = constrainContentBoxLogicalHeightByMinMax(availableSize.value(), std::nullopt); >+ availableSize = constrainContentBoxLogicalHeightByMinMax(availableSize.value(), WTF::nullopt); > } > } > >@@ -569,7 +569,7 @@ unsigned RenderGrid::clampAutoRepeatTracks(GridTrackSizingDirection direction, u > // availableLogicalWidth() does always return a value even if we cannot resolve it like when > // computing the intrinsic size (preferred widths). That's why we pass the responsibility to the > // caller who does know whether the available logical width is indefinite or not. >-void RenderGrid::placeItemsOnGrid(GridTrackSizingAlgorithm& algorithm, std::optional<LayoutUnit> availableLogicalWidth) const >+void RenderGrid::placeItemsOnGrid(GridTrackSizingAlgorithm& algorithm, WTF::Optional<LayoutUnit> availableLogicalWidth) const > { > Grid& grid = algorithm.mutableGrid(); > unsigned autoRepeatColumns = computeAutoRepeatTracksCount(ForColumns, availableLogicalWidth); >@@ -1229,10 +1229,10 @@ int RenderGrid::baselinePosition(FontBaseline, bool, LineDirectionMode direction > return firstLineBaseline().value_or(synthesizedBaselineFromMarginBox(*this, direction)); > } > >-std::optional<int> RenderGrid::firstLineBaseline() const >+WTF::Optional<int> RenderGrid::firstLineBaseline() const > { > if (isWritingModeRoot() || !m_grid.hasGridItems()) >- return std::nullopt; >+ return WTF::nullopt; > > const RenderBox* baselineChild = nullptr; > // Finding the first grid item in grid order. >@@ -1252,9 +1252,9 @@ std::optional<int> RenderGrid::firstLineBaseline() const > } > > if (!baselineChild) >- return std::nullopt; >+ return WTF::nullopt; > >- auto baseline = GridLayoutFunctions::isOrthogonalChild(*this, *baselineChild) ? std::nullopt : baselineChild->firstLineBaseline(); >+ auto baseline = GridLayoutFunctions::isOrthogonalChild(*this, *baselineChild) ? WTF::nullopt : baselineChild->firstLineBaseline(); > // We take border-box's bottom if no valid baseline. > if (!baseline) { > // FIXME: We should pass |direction| into firstLineBaseline and stop bailing out if we're a writing >@@ -1265,9 +1265,9 @@ std::optional<int> RenderGrid::firstLineBaseline() const > return baseline.value() + baselineChild->logicalTop().toInt(); > } > >-std::optional<int> RenderGrid::inlineBlockBaseline(LineDirectionMode direction) const >+WTF::Optional<int> RenderGrid::inlineBlockBaseline(LineDirectionMode direction) const > { >- if (std::optional<int> baseline = firstLineBaseline()) >+ if (WTF::Optional<int> baseline = firstLineBaseline()) > return baseline; > > int marginAscent = direction == HorizontalLine ? marginBottom() : marginRight(); >@@ -1542,7 +1542,7 @@ LayoutUnit RenderGrid::gridAreaBreadthForOutOfFlowChild(const RenderBox& child, > else { > end = positions[endLine]; > // These vectors store line positions including gaps, but we shouldn't consider them for the edges of the grid. >- std::optional<LayoutUnit> availableSizeForGutters = availableSpaceForGutters(direction); >+ WTF::Optional<LayoutUnit> availableSizeForGutters = availableSpaceForGutters(direction); > if (endLine > 0 && endLine < lastLine) { > ASSERT(!m_grid.needsItemsPlacement()); > end -= guttersSize(m_grid, direction, endLine - 1, 2, availableSizeForGutters); >diff --git a/Source/WebCore/rendering/RenderGrid.h b/Source/WebCore/rendering/RenderGrid.h >index 00924cee61538513bdb1b10170975b5993591e15..76e9ef95b583cbeaeafcee17fad388946c3444c1 100644 >--- a/Source/WebCore/rendering/RenderGrid.h >+++ b/Source/WebCore/rendering/RenderGrid.h >@@ -70,7 +70,7 @@ public: > unsigned autoRepeatCountForDirection(GridTrackSizingDirection direction) const { return m_grid.autoRepeatTracks(direction); } > > // Required by GridTrackSizingAlgorithm. Keep them under control. >- LayoutUnit guttersSize(const Grid&, GridTrackSizingDirection, unsigned startLine, unsigned span, std::optional<LayoutUnit> availableSize) const; >+ LayoutUnit guttersSize(const Grid&, GridTrackSizingDirection, unsigned startLine, unsigned span, WTF::Optional<LayoutUnit> availableSize) const; > LayoutUnit gridItemOffset(GridTrackSizingDirection) const; > > void updateGridAreaLogicalSize(RenderBox&, LayoutSize) const; >@@ -96,12 +96,12 @@ private: > bool selfAlignmentChangedToStretch(GridAxis, const RenderStyle& oldStyle, const RenderStyle& newStyle, const RenderBox&) const; > bool selfAlignmentChangedFromStretch(GridAxis, const RenderStyle& oldStyle, const RenderStyle& newStyle, const RenderBox&) const; > >- std::optional<LayoutUnit> availableSpaceForGutters(GridTrackSizingDirection) const; >+ WTF::Optional<LayoutUnit> availableSpaceForGutters(GridTrackSizingDirection) const; > > bool explicitGridDidResize(const RenderStyle&) const; > bool namedGridLinesDefinitionDidChange(const RenderStyle&) const; > >- unsigned computeAutoRepeatTracksCount(GridTrackSizingDirection, std::optional<LayoutUnit> availableSize) const; >+ unsigned computeAutoRepeatTracksCount(GridTrackSizingDirection, WTF::Optional<LayoutUnit> availableSize) const; > > unsigned clampAutoRepeatTracks(GridTrackSizingDirection, unsigned autoRepeatTracks) const; > >@@ -109,7 +109,7 @@ private: > > void performGridItemsPreLayout(const GridTrackSizingAlgorithm&) const; > >- void placeItemsOnGrid(GridTrackSizingAlgorithm&, std::optional<LayoutUnit> availableLogicalWidth) const; >+ void placeItemsOnGrid(GridTrackSizingAlgorithm&, WTF::Optional<LayoutUnit> availableLogicalWidth) const; > void populateExplicitGridAndOrderIterator(Grid&) const; > std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(Grid&, const RenderBox&, GridTrackSizingDirection, const GridSpan&) const; > void placeSpecifiedMajorAxisItemsOnGrid(Grid&, const Vector<RenderBox*>&) const; >@@ -169,15 +169,15 @@ private: > void updateAutoMarginsInRowAxisIfNeeded(RenderBox&); > > int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final; >- std::optional<int> firstLineBaseline() const final; >- std::optional<int> inlineBlockBaseline(LineDirectionMode) const final; >+ WTF::Optional<int> firstLineBaseline() const final; >+ WTF::Optional<int> inlineBlockBaseline(LineDirectionMode) const final; > bool isInlineBaselineAlignedChild(const RenderBox&) const; > > LayoutUnit columnAxisBaselineOffsetForChild(const RenderBox&) const; > LayoutUnit rowAxisBaselineOffsetForChild(const RenderBox&) const; > > LayoutUnit gridGap(GridTrackSizingDirection) const; >- LayoutUnit gridGap(GridTrackSizingDirection, std::optional<LayoutUnit> availableSize) const; >+ LayoutUnit gridGap(GridTrackSizingDirection, WTF::Optional<LayoutUnit> availableSize) const; > > unsigned nonCollapsedTracks(GridTrackSizingDirection) const; > unsigned numTracks(GridTrackSizingDirection, const Grid&) const; >@@ -194,7 +194,7 @@ private: > ContentAlignmentData m_offsetBetweenColumns; > ContentAlignmentData m_offsetBetweenRows; > >- typedef HashMap<const RenderBox*, std::optional<size_t>> OutOfFlowPositionsMap; >+ typedef HashMap<const RenderBox*, WTF::Optional<size_t>> OutOfFlowPositionsMap; > OutOfFlowPositionsMap m_outOfFlowItemColumn; > OutOfFlowPositionsMap m_outOfFlowItemRow; > >diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp >index 9c1b9c5b4eeff6741b515269935cf07c0996909d..6ae709583ab4cd66c880888be1c1a59e75d43e5e 100644 >--- a/Source/WebCore/rendering/RenderInline.cpp >+++ b/Source/WebCore/rendering/RenderInline.cpp >@@ -884,7 +884,7 @@ LayoutRect RenderInline::computeVisibleRectUsingPaintOffset(const LayoutRect& re > return adjustedRect; > } > >-std::optional<LayoutRect> RenderInline::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<LayoutRect> RenderInline::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > // Repaint offset cache is only valid for root-relative repainting > if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !container && !context.m_options.contains(VisibleRectContextOption::UseEdgeInclusiveIntersection)) >@@ -918,7 +918,7 @@ std::optional<LayoutRect> RenderInline::computeVisibleRectInContainer(const Layo > bool isEmpty = !downcast<RenderBox>(*localContainer).applyCachedClipAndScrollPosition(adjustedRect, container, context); > if (isEmpty) { > if (context.m_options.contains(VisibleRectContextOption::UseEdgeInclusiveIntersection)) >- return std::nullopt; >+ return WTF::nullopt; > return adjustedRect; > } > } >diff --git a/Source/WebCore/rendering/RenderInline.h b/Source/WebCore/rendering/RenderInline.h >index 4689d8cbf3713ac25bfc46c6c76264ae2e12ceea..f92f949a711f1765c46b043944be9e725bf5e037 100644 >--- a/Source/WebCore/rendering/RenderInline.h >+++ b/Source/WebCore/rendering/RenderInline.h >@@ -130,7 +130,7 @@ private: > LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; > LayoutRect rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const final; > >- std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const final; >+ WTF::Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const final; > LayoutRect computeVisibleRectUsingPaintOffset(const LayoutRect&) const; > > void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override; >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index db183544719bde917b5dbd5dfd3d3992fbbc5233..0021daf999918806ccb58787fcf70ffe3a916da7 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -2303,7 +2303,7 @@ void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollableArea** scr > } > } > >-void RenderLayer::setPostLayoutScrollPosition(std::optional<ScrollPosition> position) >+void RenderLayer::setPostLayoutScrollPosition(WTF::Optional<ScrollPosition> position) > { > m_postLayoutScrollPosition = position; > } >@@ -2314,7 +2314,7 @@ void RenderLayer::applyPostLayoutScrollPositionIfNeeded() > return; > > scrollToOffset(scrollOffsetFromPosition(m_postLayoutScrollPosition.value())); >- m_postLayoutScrollPosition = std::nullopt; >+ m_postLayoutScrollPosition = WTF::nullopt; > } > > void RenderLayer::scrollToXPosition(int x, ScrollClamping clamping) >@@ -5037,7 +5037,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont > > // Check for hit test on backface if backface-visibility is 'hidden' > if (localTransformState && renderer().style().backfaceVisibility() == BackfaceVisibility::Hidden) { >- std::optional<TransformationMatrix> invertedMatrix = localTransformState->m_accumulatedTransform.inverse(); >+ WTF::Optional<TransformationMatrix> invertedMatrix = localTransformState->m_accumulatedTransform.inverse(); > // If the z-vector of the matrix is negative, the back is facing towards the viewer. > if (invertedMatrix && invertedMatrix.value().m33() < 0) > return nullptr; >diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h >index 1a86ea78c0f4782229dfbd64d7a332fac0cd6212..951c28ea67b79b99975d27dfbaae837985cf6c82 100644 >--- a/Source/WebCore/rendering/RenderLayer.h >+++ b/Source/WebCore/rendering/RenderLayer.h >@@ -413,7 +413,7 @@ public: > void scrollToXPosition(int x, ScrollClamping = ScrollClamping::Clamped); > void scrollToYPosition(int y, ScrollClamping = ScrollClamping::Clamped); > >- void setPostLayoutScrollPosition(std::optional<ScrollPosition>); >+ void setPostLayoutScrollPosition(WTF::Optional<ScrollPosition>); > void applyPostLayoutScrollPositionIfNeeded(); > > ScrollOffset scrollOffset() const { return scrollOffsetFromPosition(m_scrollPosition); } >@@ -1243,7 +1243,7 @@ private: > IntSize m_layerSize; > > ScrollPosition m_scrollPosition; >- std::optional<ScrollPosition> m_postLayoutScrollPosition; >+ WTF::Optional<ScrollPosition> m_postLayoutScrollPosition; > > // The width/height of our scrolled area. > IntSize m_scrollSize; >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index 54984777de9bb673a92f840d66110e866501b4f0..8ff79c7dcd073f924431afca494ff4221b7ceb31 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -905,9 +905,9 @@ private: > return m_fromAncestorGraphicsLayer.value(); > } > >- std::optional<LayoutSize> m_fromAncestorGraphicsLayer; >- std::optional<LayoutSize> m_fromParentGraphicsLayer; >- std::optional<LayoutSize> m_fromPrimaryGraphicsLayer; >+ WTF::Optional<LayoutSize> m_fromAncestorGraphicsLayer; >+ WTF::Optional<LayoutSize> m_fromParentGraphicsLayer; >+ WTF::Optional<LayoutSize> m_fromPrimaryGraphicsLayer; > > const RenderLayer& m_renderLayer; > // Location is relative to the renderer. >@@ -1026,7 +1026,7 @@ void RenderLayerBacking::updateGeometry() > m_graphicsLayer->setPosition(primaryGraphicsLayerRect.location()); > m_graphicsLayer->setSize(primaryGraphicsLayerRect.size()); > >- auto computeAnimationExtent = [&] () -> std::optional<FloatRect> { >+ auto computeAnimationExtent = [&] () -> WTF::Optional<FloatRect> { > LayoutRect animatedBounds; > if (isRunningAcceleratedTransformAnimation && m_owningLayer.getOverlapBoundsIncludingChildrenAccountingForTransformAnimations(animatedBounds, RenderLayer::IncludeCompositedDescendants)) > return FloatRect(animatedBounds); >diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp >index cf7f2b9bee7e666eca30318f4ab47aa3501af92a..d87d3693328581bf13714569c313164b1c451dc7 100644 >--- a/Source/WebCore/rendering/RenderListBox.cpp >+++ b/Source/WebCore/rendering/RenderListBox.cpp >@@ -130,7 +130,7 @@ void RenderListBox::updateFromElement() > if (m_optionsChanged) { > float width = 0; > auto& normalFont = style().fontCascade(); >- std::optional<FontCascade> boldFont; >+ WTF::Optional<FontCascade> boldFont; > for (auto* element : selectElement().listItems()) { > String text; > WTF::Function<const FontCascade&()> selectFont = [&normalFont] () -> const FontCascade& { >@@ -693,8 +693,8 @@ int RenderListBox::numberOfVisibleItemsInPaddingBottom() const > > void RenderListBox::computeFirstIndexesVisibleInPaddingTopBottomAreas() > { >- m_indexOfFirstVisibleItemInsidePaddingTopArea = std::nullopt; >- m_indexOfFirstVisibleItemInsidePaddingBottomArea = std::nullopt; >+ m_indexOfFirstVisibleItemInsidePaddingTopArea = WTF::nullopt; >+ m_indexOfFirstVisibleItemInsidePaddingBottomArea = WTF::nullopt; > > int maximumNumberOfItemsThatFitInPaddingTopArea = paddingTop() / itemHeight(); > if (maximumNumberOfItemsThatFitInPaddingTopArea) { >diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h >index 93f6ae60c33d2ac30e6501b9f40c5cd0535fca5c..361c5b0b66bc2380b627fb109d35819f7598fc11 100644 >--- a/Source/WebCore/rendering/RenderListBox.h >+++ b/Source/WebCore/rendering/RenderListBox.h >@@ -178,8 +178,8 @@ private: > int m_optionsWidth; > int m_indexOffset; > >- std::optional<int> m_indexOfFirstVisibleItemInsidePaddingTopArea; >- std::optional<int> m_indexOfFirstVisibleItemInsidePaddingBottomArea; >+ WTF::Optional<int> m_indexOfFirstVisibleItemInsidePaddingTopArea; >+ WTF::Optional<int> m_indexOfFirstVisibleItemInsidePaddingBottomArea; > > RefPtr<Scrollbar> m_vBar; > }; >diff --git a/Source/WebCore/rendering/RenderListItem.cpp b/Source/WebCore/rendering/RenderListItem.cpp >index 653c1a64b69de3e906549687b67e37d4dd2c2205..3a1ab954533325a7eafb251a5bc04d2665ce690c 100644 >--- a/Source/WebCore/rendering/RenderListItem.cpp >+++ b/Source/WebCore/rendering/RenderListItem.cpp >@@ -232,7 +232,7 @@ void RenderListItem::updateValueNow() const > void RenderListItem::updateValue() > { > if (!m_valueWasSetExplicitly) { >- m_value = std::nullopt; >+ m_value = WTF::nullopt; > if (m_marker) > m_marker->setNeedsLayoutAndPrefWidthsRecalc(); > } >@@ -398,7 +398,7 @@ void RenderListItem::explicitValueChanged() > item->updateValue(); > } > >-void RenderListItem::setExplicitValue(std::optional<int> value) >+void RenderListItem::setExplicitValue(WTF::Optional<int> value) > { > if (!value) { > if (!m_valueWasSetExplicitly) >diff --git a/Source/WebCore/rendering/RenderListItem.h b/Source/WebCore/rendering/RenderListItem.h >index b701567e8fd882718bb76d1d753aa97f5d099696..86567e934659c8cd2577bb33c338f524ee734e12 100644 >--- a/Source/WebCore/rendering/RenderListItem.h >+++ b/Source/WebCore/rendering/RenderListItem.h >@@ -40,8 +40,8 @@ public: > int value() const; > void updateValue(); > >- std::optional<int> explicitValue() const { return m_valueWasSetExplicitly ? m_value : std::nullopt; } >- void setExplicitValue(std::optional<int>); >+ WTF::Optional<int> explicitValue() const { return m_valueWasSetExplicitly ? m_value : WTF::nullopt; } >+ void setExplicitValue(WTF::Optional<int>); > > void setNotInList(bool notInList) { m_notInList = notInList; } > bool notInList() const { return m_notInList; } >@@ -83,7 +83,7 @@ private: > void explicitValueChanged(); > > WeakPtr<RenderListMarker> m_marker; >- mutable std::optional<int> m_value; >+ mutable WTF::Optional<int> m_value; > bool m_valueWasSetExplicitly { false }; > bool m_notInList { false }; > }; >diff --git a/Source/WebCore/rendering/RenderMenuList.h b/Source/WebCore/rendering/RenderMenuList.h >index 37964dc186f604b2845bd684869cb8703daebfd9..32ae9f6a68187c1ebc3cbba4c7db470f0da6c2d3 100644 >--- a/Source/WebCore/rendering/RenderMenuList.h >+++ b/Source/WebCore/rendering/RenderMenuList.h >@@ -125,8 +125,8 @@ private: > { > return RenderBlock::baselinePosition(baseline, firstLine, direction, position); > } >- std::optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); } >- std::optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } >+ WTF::Optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); } >+ WTF::Optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } > > void getItemBackgroundColor(unsigned listIndex, Color&, bool& itemHasCustomBackgroundColor) const; > >@@ -145,7 +145,7 @@ private: > bool m_needsOptionsWidthUpdate; > int m_optionsWidth; > >- std::optional<int> m_lastActiveIndex; >+ WTF::Optional<int> m_lastActiveIndex; > > std::unique_ptr<RenderStyle> m_optionStyle; > >diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.cpp b/Source/WebCore/rendering/RenderMultiColumnSet.cpp >index 1c12ba856844478fd41887d5f7c5881b34f1ca5e..dbb8ac58a1fde8b4ae269d65b0d151b882bdc227 100644 >--- a/Source/WebCore/rendering/RenderMultiColumnSet.cpp >+++ b/Source/WebCore/rendering/RenderMultiColumnSet.cpp >@@ -420,7 +420,7 @@ LayoutUnit RenderMultiColumnSet::calculateMaxColumnHeight() const > LayoutUnit availableHeight = multiColumnFlow()->columnHeightAvailable(); > LayoutUnit maxColumnHeight = availableHeight ? availableHeight : RenderFragmentedFlow::maxLogicalHeight(); > if (!multicolStyle.logicalMaxHeight().isUndefined()) >- maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight(MaxSize, multicolStyle.logicalMaxHeight(), std::nullopt).value_or(maxColumnHeight)); >+ maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight(MaxSize, multicolStyle.logicalMaxHeight(), WTF::nullopt).value_or(maxColumnHeight)); > return heightAdjustedForSetOffset(maxColumnHeight); > } > >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index d5f8085e836800e7e164b6f37c5a0e5d82d2494c..36a3da2a766623099e00ba345f7087f34e22df32 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -989,7 +989,7 @@ FloatRect RenderObject::computeFloatRectForRepaint(const FloatRect& rect, const > return *computeFloatVisibleRectInContainer(rect, repaintContainer, visibleRectContextForRepaint()); > } > >-std::optional<LayoutRect> RenderObject::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<LayoutRect> RenderObject::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > if (container == this) > return rect; >@@ -1003,14 +1003,14 @@ std::optional<LayoutRect> RenderObject::computeVisibleRectInContainer(const Layo > bool isEmpty = !downcast<RenderBox>(*parent).applyCachedClipAndScrollPosition(adjustedRect, container, context); > if (isEmpty) { > if (context.m_options.contains(VisibleRectContextOption::UseEdgeInclusiveIntersection)) >- return std::nullopt; >+ return WTF::nullopt; > return adjustedRect; > } > } > return parent->computeVisibleRectInContainer(adjustedRect, container, context); > } > >-std::optional<FloatRect> RenderObject::computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject*, VisibleRectContext) const >+WTF::Optional<FloatRect> RenderObject::computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject*, VisibleRectContext) const > { > ASSERT_NOT_REACHED(); > return FloatRect(); >diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h >index 6745c07485c80cdb7c2bb2f691904c4cf79a01d6..2c31ffb90defe99c3a137b0cc475851545ab77ce 100644 >--- a/Source/WebCore/rendering/RenderObject.h >+++ b/Source/WebCore/rendering/RenderObject.h >@@ -684,7 +684,7 @@ public: > FloatRect computeFloatRectForRepaint(const FloatRect&, const RenderLayerModelObject* repaintContainer) const; > > // Given a rect in the object's coordinate space, compute the location in container space where this rect is visible, >- // when clipping and scrolling as specified by the context. When using edge-inclusive intersection, return std::nullopt >+ // when clipping and scrolling as specified by the context. When using edge-inclusive intersection, return WTF::nullopt > // rather than an empty rect if the rect is completely clipped out in container space. > enum class VisibleRectContextOption { > UseEdgeInclusiveIntersection = 1 << 0, >@@ -702,8 +702,8 @@ public: > bool m_dirtyRectIsFlipped; > OptionSet<VisibleRectContextOption> m_options; > }; >- virtual std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* repaintContainer, VisibleRectContext) const; >- virtual std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* repaintContainer, VisibleRectContext) const; >+ virtual WTF::Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* repaintContainer, VisibleRectContext) const; >+ virtual WTF::Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* repaintContainer, VisibleRectContext) const; > > virtual unsigned int length() const { return 1; } > >diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp >index a0f08398dbbb5b89e1a766db5a821db1a4ccf24b..a1e5b2cf4391da2088747ea3b9deb00392cbe3cd 100644 >--- a/Source/WebCore/rendering/RenderReplaced.cpp >+++ b/Source/WebCore/rendering/RenderReplaced.cpp >@@ -478,7 +478,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh > // of 'width' is: (used height) * (intrinsic ratio) > if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !computedHeightIsAuto)) { > LayoutUnit estimatedUsedWidth = hasIntrinsicWidth ? LayoutUnit(constrainedSize.width()) : computeConstrainedLogicalWidth(shouldComputePreferred); >- LayoutUnit logicalHeight = computeReplacedLogicalHeight(std::optional<LayoutUnit>(estimatedUsedWidth)); >+ LayoutUnit logicalHeight = computeReplacedLogicalHeight(WTF::Optional<LayoutUnit>(estimatedUsedWidth)); > return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred); > } > >@@ -508,7 +508,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh > return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), shouldComputePreferred); > } > >-LayoutUnit RenderReplaced::computeReplacedLogicalHeight(std::optional<LayoutUnit> estimatedUsedWidth) const >+LayoutUnit RenderReplaced::computeReplacedLogicalHeight(WTF::Optional<LayoutUnit> estimatedUsedWidth) const > { > // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height > if (hasReplacedLogicalHeight()) >diff --git a/Source/WebCore/rendering/RenderReplaced.h b/Source/WebCore/rendering/RenderReplaced.h >index a8db86a44fa3d9989fe690ecc6878bb8dbdc1c8a..f07e42152a416a9b42e0ccdad7c7e2737dfd6f99 100644 >--- a/Source/WebCore/rendering/RenderReplaced.h >+++ b/Source/WebCore/rendering/RenderReplaced.h >@@ -31,7 +31,7 @@ public: > virtual ~RenderReplaced(); > > LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const override; >- LayoutUnit computeReplacedLogicalHeight(std::optional<LayoutUnit> estimatedUsedWidth = std::nullopt) const override; >+ LayoutUnit computeReplacedLogicalHeight(WTF::Optional<LayoutUnit> estimatedUsedWidth = WTF::nullopt) const override; > > LayoutRect replacedContentRect(const LayoutSize& intrinsicSize) const; > LayoutRect replacedContentRect() const { return replacedContentRect(intrinsicSize()); } >diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp >index d114a912f1ad12a3ca39e69cba85dfec3de85fb5..ad758dd61774095b766052b4ba2eb8112498be0c 100644 >--- a/Source/WebCore/rendering/RenderTable.cpp >+++ b/Source/WebCore/rendering/RenderTable.cpp >@@ -1440,32 +1440,32 @@ int RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, Lin > }); > } > >-std::optional<int> RenderTable::inlineBlockBaseline(LineDirectionMode) const >+WTF::Optional<int> RenderTable::inlineBlockBaseline(LineDirectionMode) const > { > // Tables are skipped when computing an inline-block's baseline. >- return std::optional<int>(); >+ return WTF::Optional<int>(); > } > >-std::optional<int> RenderTable::firstLineBaseline() const >+WTF::Optional<int> RenderTable::firstLineBaseline() const > { > // The baseline of a 'table' is the same as the 'inline-table' baseline per CSS 3 Flexbox (CSS 2.1 > // doesn't define the baseline of a 'table' only an 'inline-table'). > // This is also needed to properly determine the baseline of a cell if it has a table child. > > if (isWritingModeRoot()) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > > recalcSectionsIfNeeded(); > > const RenderTableSection* topNonEmptySection = this->topNonEmptySection(); > if (!topNonEmptySection) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > >- if (std::optional<int> baseline = topNonEmptySection->firstLineBaseline()) >- return std::optional<int>(topNonEmptySection->logicalTop() + baseline.value()); >+ if (WTF::Optional<int> baseline = topNonEmptySection->firstLineBaseline()) >+ return WTF::Optional<int>(topNonEmptySection->logicalTop() + baseline.value()); > > // FIXME: A table row always has a baseline per CSS 2.1. Will this return the right value? >- return std::optional<int>(); >+ return WTF::Optional<int>(); > } > > LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase phase) >diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h >index 9ad6d26bf47146a0de0c966075c9dbe2dbd8c3dd..41a694ea69c546b450109e069698c91d3efdc953 100644 >--- a/Source/WebCore/rendering/RenderTable.h >+++ b/Source/WebCore/rendering/RenderTable.h >@@ -293,8 +293,8 @@ private: > bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; > > int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final; >- std::optional<int> firstLineBaseline() const override; >- std::optional<int> inlineBlockBaseline(LineDirectionMode) const final; >+ WTF::Optional<int> firstLineBaseline() const override; >+ WTF::Optional<int> inlineBlockBaseline(LineDirectionMode) const final; > > RenderTableCol* slowColElement(unsigned col, bool* startEdge, bool* endEdge) const; > >diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp >index 58b2270fcc541c3730247707b185ae47eae91c63..0a2939f24f9228518c774e2b374cc49092cc5842 100644 >--- a/Source/WebCore/rendering/RenderTableCell.cpp >+++ b/Source/WebCore/rendering/RenderTableCell.cpp >@@ -395,7 +395,7 @@ LayoutRect RenderTableCell::clippedOverflowRectForRepaint(const RenderLayerModel > return computeRectForRepaint(r, repaintContainer); > } > >-std::optional<LayoutRect> RenderTableCell::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<LayoutRect> RenderTableCell::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > if (container == this) > return rect; >diff --git a/Source/WebCore/rendering/RenderTableCell.h b/Source/WebCore/rendering/RenderTableCell.h >index 66a8b55b9add91f1b34f04b317f406977398150f..228145dbdc6d4e2ac642a4a3c1aef7decc442eb5 100644 >--- a/Source/WebCore/rendering/RenderTableCell.h >+++ b/Source/WebCore/rendering/RenderTableCell.h >@@ -155,7 +155,7 @@ private: > bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance, InlineFlowBox*) const override; > > LayoutSize offsetFromContainer(RenderElement&, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const override; >- std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >+ WTF::Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; > > LayoutUnit borderHalfLeft(bool outer) const; > LayoutUnit borderHalfRight(bool outer) const; >diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp >index b623c90356da0953e3ca1556c1e595ea0a775efc..c5b28d9c82e10697fc88f1af52feaf02265c9127 100644 >--- a/Source/WebCore/rendering/RenderTableSection.cpp >+++ b/Source/WebCore/rendering/RenderTableSection.cpp >@@ -871,16 +871,16 @@ void RenderTableSection::recalcOuterBorder() > m_outerBorderEnd = calcOuterBorderEnd(); > } > >-std::optional<int> RenderTableSection::firstLineBaseline() const >+WTF::Optional<int> RenderTableSection::firstLineBaseline() const > { > if (!m_grid.size()) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > > int firstLineBaseline = m_grid[0].baseline; > if (firstLineBaseline) > return firstLineBaseline + roundToInt(m_rowPos[0]); > >- std::optional<int> result; >+ WTF::Optional<int> result; > const Row& firstRow = m_grid[0].row; > for (size_t i = 0; i < firstRow.size(); ++i) { > const CellStruct& cs = firstRow.at(i); >diff --git a/Source/WebCore/rendering/RenderTableSection.h b/Source/WebCore/rendering/RenderTableSection.h >index 4ce7bfd4e76b5ac4b0c32fd3c10e0f7fa742db7c..c1a032754cf8b5aa0ea05299b9a648ee6eaca16a 100644 >--- a/Source/WebCore/rendering/RenderTableSection.h >+++ b/Source/WebCore/rendering/RenderTableSection.h >@@ -62,7 +62,7 @@ public: > RenderTableRow* firstRow() const; > RenderTableRow* lastRow() const; > >- std::optional<int> firstLineBaseline() const override; >+ WTF::Optional<int> firstLineBaseline() const override; > > void addCell(RenderTableCell*, RenderTableRow* row); > >diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp >index 42257f725b503c61e03195045eec949a9135430c..7e91104ca87e555fdf6c1c4ffe21b698d0ada288 100644 >--- a/Source/WebCore/rendering/RenderText.cpp >+++ b/Source/WebCore/rendering/RenderText.cpp >@@ -808,7 +808,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Fo > bool isSpace = false; > bool firstWord = true; > bool firstLine = true; >- std::optional<unsigned> nextBreakable; >+ WTF::Optional<unsigned> nextBreakable; > unsigned lastWordBoundary = 0; > > WordTrailingSpace wordTrailingSpace(style); >@@ -828,7 +828,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Fo > minimumSuffixLength = after < 0 ? 2 : after; > } > >- std::optional<int> firstGlyphLeftOverflow; >+ WTF::Optional<int> firstGlyphLeftOverflow; > > bool breakNBSP = style.autoWrap() && style.nbspMode() == NBSPMode::Space; > >@@ -904,7 +904,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Fo > float currMinWidth = 0; > bool isSpace = (j < length) && isSpaceAccordingToStyle(c, style); > float w; >- std::optional<float> wordTrailingSpaceWidth; >+ WTF::Optional<float> wordTrailingSpaceWidth; > if (isSpace) > wordTrailingSpaceWidth = wordTrailingSpace.width(fallbackFonts); > if (wordTrailingSpaceWidth) >@@ -921,7 +921,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Fo > > if (suffixStart) { > float suffixWidth; >- std::optional<float> wordTrailingSpaceWidth; >+ WTF::Optional<float> wordTrailingSpaceWidth; > if (isSpace) > wordTrailingSpaceWidth = wordTrailingSpace.width(fallbackFonts); > if (wordTrailingSpaceWidth) >@@ -1545,7 +1545,7 @@ void RenderText::momentarilyRevealLastTypedCharacter(unsigned offsetAfterLastTyp > secureTextTimer->restart(offsetAfterLastTypedCharacter); > } > >-StringView RenderText::stringView(unsigned start, std::optional<unsigned> stop) const >+StringView RenderText::stringView(unsigned start, WTF::Optional<unsigned> stop) const > { > unsigned destination = stop.value_or(text().length()); > ASSERT(start <= length()); >diff --git a/Source/WebCore/rendering/RenderText.h b/Source/WebCore/rendering/RenderText.h >index 4d19b109c113436e850159121ebdc2cacdf5c9d2..251f74269c1c3fb30f1db487435c660149a8709a 100644 >--- a/Source/WebCore/rendering/RenderText.h >+++ b/Source/WebCore/rendering/RenderText.h >@@ -167,7 +167,7 @@ public: > void deleteLineBoxesBeforeSimpleLineLayout(); > const SimpleLineLayout::Layout* simpleLineLayout() const; > >- StringView stringView(unsigned start = 0, std::optional<unsigned> stop = std::nullopt) const; >+ StringView stringView(unsigned start = 0, WTF::Optional<unsigned> stop = WTF::nullopt) const; > > LayoutUnit topOfFirstText() const; > >diff --git a/Source/WebCore/rendering/RenderTextControl.h b/Source/WebCore/rendering/RenderTextControl.h >index 18dc19db0fac004044d232400088f2a38e4b723b..f51e36ec47109860e80c897d013594c483b0f61d 100644 >--- a/Source/WebCore/rendering/RenderTextControl.h >+++ b/Source/WebCore/rendering/RenderTextControl.h >@@ -98,8 +98,8 @@ public: > { > return RenderBlock::baselinePosition(baseline, firstLine, direction, position); > } >- std::optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); } >- std::optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } >+ WTF::Optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); } >+ WTF::Optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } > > private: > bool isFlexibleBoxImpl() const override { return true; } >diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp >index d2535c4a33571b8e87215b1ce7d4aeb935d6af1a..b2fbb2e4dccd2ebbb4fc339e1986a4e357d204c8 100644 >--- a/Source/WebCore/rendering/RenderView.cpp >+++ b/Source/WebCore/rendering/RenderView.cpp >@@ -577,7 +577,7 @@ LayoutRect RenderView::visualOverflowRect() const > return RenderBlockFlow::visualOverflowRect(); > } > >-std::optional<LayoutRect> RenderView::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<LayoutRect> RenderView::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > // If a container was specified, and was not nullptr or the RenderView, > // then we should have found it by now. >diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h >index 8f17d3646c2e35cff2d558bff54a98f7013540f5..e88847c8381514f8b80d1a1141490f86c1ea4813 100644 >--- a/Source/WebCore/rendering/RenderView.h >+++ b/Source/WebCore/rendering/RenderView.h >@@ -72,7 +72,7 @@ public: > FrameView& frameView() const { return m_frameView; } > > LayoutRect visualOverflowRect() const override; >- std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >+ WTF::Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; > void repaintRootContents(); > void repaintViewRectangle(const LayoutRect&) const; > void repaintViewAndCompositedLayers(); >@@ -242,7 +242,7 @@ private: > HashSet<RenderBox*> m_renderersNeedingLazyRepaint; > > std::unique_ptr<ImageQualityController> m_imageQualityController; >- std::optional<LayoutSize> m_pageLogicalSize; >+ WTF::Optional<LayoutSize> m_pageLogicalSize; > bool m_pageLogicalHeightChanged { false }; > std::unique_ptr<RenderLayerCompositor> m_compositor; > >diff --git a/Source/WebCore/rendering/SelectionRangeData.cpp b/Source/WebCore/rendering/SelectionRangeData.cpp >index aacf5e84a6e7c4a1df8450cb9ecd7752e37eec2e..5a3516d8d516a86d701937e709bf65d10870c7e8 100644 >--- a/Source/WebCore/rendering/SelectionRangeData.cpp >+++ b/Source/WebCore/rendering/SelectionRangeData.cpp >@@ -49,8 +49,8 @@ struct SelectionData { > using RendererMap = HashMap<RenderObject*, std::unique_ptr<RenderSelectionInfo>>; > using RenderBlockMap = HashMap<const RenderBlock*, std::unique_ptr<RenderBlockSelectionInfo>>; > >- std::optional<unsigned> startPosition; >- std::optional<unsigned> endPosition; >+ WTF::Optional<unsigned> startPosition; >+ WTF::Optional<unsigned> endPosition; > RendererMap renderers; > RenderBlockMap blocks; > }; >diff --git a/Source/WebCore/rendering/SelectionRangeData.h b/Source/WebCore/rendering/SelectionRangeData.h >index 8a7f1e55c24e13bf5f0291418f2b45088c500d11..4d1ae363463ebe2b22d54fc13e2fd86cb74916fb 100644 >--- a/Source/WebCore/rendering/SelectionRangeData.h >+++ b/Source/WebCore/rendering/SelectionRangeData.h >@@ -57,8 +57,8 @@ public: > > RenderObject* start() const { return m_start.get(); } > RenderObject* end() const { return m_end.get(); } >- std::optional<unsigned> startPosition() const { return m_startPosition; } >- std::optional<unsigned> endPosition() const { return m_endPosition; } >+ WTF::Optional<unsigned> startPosition() const { return m_startPosition; } >+ WTF::Optional<unsigned> endPosition() const { return m_endPosition; } > > bool operator==(const Context& other) const > { >@@ -68,8 +68,8 @@ public: > private: > WeakPtr<RenderObject> m_start; > WeakPtr<RenderObject> m_end; >- std::optional<unsigned> m_startPosition; >- std::optional<unsigned> m_endPosition; >+ WTF::Optional<unsigned> m_startPosition; >+ WTF::Optional<unsigned> m_endPosition; > }; > > enum class RepaintMode { NewXOROld, NewMinusOld, Nothing }; >diff --git a/Source/WebCore/rendering/SimpleLineLayout.cpp b/Source/WebCore/rendering/SimpleLineLayout.cpp >index 112a7fa819bb1eefa85d0e09953cf6e52bf5df4e..cf1c089db4025bd4a0e389e9a444d6ae127e4792 100644 >--- a/Source/WebCore/rendering/SimpleLineLayout.cpp >+++ b/Source/WebCore/rendering/SimpleLineLayout.cpp >@@ -107,7 +107,7 @@ template<> AvoidanceReasonFlags canUseForCharacter(LChar, bool, IncludeReasons) > } > > template <typename CharacterType> >-static AvoidanceReasonFlags canUseForText(const CharacterType* text, unsigned length, const FontCascade& fontCascade, std::optional<float> lineHeightConstraint, >+static AvoidanceReasonFlags canUseForText(const CharacterType* text, unsigned length, const FontCascade& fontCascade, WTF::Optional<float> lineHeightConstraint, > bool textIsJustified, IncludeReasons includeReasons) > { > AvoidanceReasonFlags reasons = { }; >@@ -146,7 +146,7 @@ static AvoidanceReasonFlags canUseForText(const CharacterType* text, unsigned le > return reasons; > } > >-static AvoidanceReasonFlags canUseForText(StringView text, const FontCascade& fontCascade, std::optional<float> lineHeightConstraint, bool textIsJustified, IncludeReasons includeReasons) >+static AvoidanceReasonFlags canUseForText(StringView text, const FontCascade& fontCascade, WTF::Optional<float> lineHeightConstraint, bool textIsJustified, IncludeReasons includeReasons) > { > if (text.is8Bit()) > return canUseForText(text.characters8(), text.length(), fontCascade, lineHeightConstraint, textIsJustified, includeReasons); >@@ -161,7 +161,7 @@ static AvoidanceReasonFlags canUseForFontAndText(const RenderBlockFlow& flow, In > auto& fontCascade = style.fontCascade(); > if (fontCascade.primaryFont().isInterstitial()) > SET_REASON_AND_RETURN_IF_NEEDED(FlowIsMissingPrimaryFont, reasons, includeReasons); >- std::optional<float> lineHeightConstraint; >+ WTF::Optional<float> lineHeightConstraint; > if (style.lineBoxContain() & LineBoxContainGlyphs) > lineHeightConstraint = lineHeightFromFlow(flow).toFloat(); > bool flowIsJustified = style.textAlign() == TextAlignMode::Justify; >@@ -245,7 +245,7 @@ static AvoidanceReasonFlags canUseForStyle(const RenderStyle& style, IncludeReas > SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonAutoTrailingWord, reasons, includeReasons); > #endif > if (style.hyphens() == Hyphens::Auto) { >- auto textReasons = canUseForText(style.hyphenString(), style.fontCascade(), std::nullopt, false, includeReasons); >+ auto textReasons = canUseForText(style.hyphenString(), style.fontCascade(), WTF::nullopt, false, includeReasons); > if (textReasons != NoReason) > SET_REASON_AND_RETURN_IF_NEEDED(textReasons, reasons, includeReasons); > } >@@ -570,7 +570,7 @@ private: > float m_runsWidth { 0 }; > TextFragmentIterator::TextFragment m_overflowedFragment; > TextFragmentIterator::TextFragment m_lastFragment; >- std::optional<TextFragmentIterator::TextFragment> m_lastNonWhitespaceFragment; >+ WTF::Optional<TextFragmentIterator::TextFragment> m_lastNonWhitespaceFragment; > TextFragmentIterator::TextFragment m_lastCompleteFragment; > float m_uncompletedWidth { 0 }; > float m_trailingWhitespaceWidth { 0 }; // Use this to remove trailing whitespace without re-mesuring the text. >@@ -579,7 +579,7 @@ private: > // First character of the first fragment might be forced on to the current line even if it does not fit. > bool m_firstCharacterFits { false }; > bool m_hyphenationDisabled { false }; >- std::optional<Vector<TextFragmentIterator::TextFragment, 30>> m_fragments; >+ WTF::Optional<Vector<TextFragmentIterator::TextFragment, 30>> m_fragments; > }; > > static bool preWrap(const TextFragmentIterator::Style& style) >@@ -622,12 +622,12 @@ struct SplitFragmentData { > unsigned position; > float width; > }; >-static std::optional<unsigned> hyphenPositionForFragment(SplitFragmentData splitData, const TextFragmentIterator::TextFragment& fragmentToSplit, >+static WTF::Optional<unsigned> hyphenPositionForFragment(SplitFragmentData splitData, const TextFragmentIterator::TextFragment& fragmentToSplit, > const LineState& line, const TextFragmentIterator& textFragmentIterator, float availableWidth) > { > auto& style = textFragmentIterator.style(); > if (!style.shouldHyphenate || line.isHyphenationDisabled()) >- return std::nullopt; >+ return WTF::nullopt; > > // FIXME: This is a workaround for webkit.org/b/169613. See maxPrefixWidth computation in tryHyphenating(). > // It does not work properly with non-collapsed leading tabs when font is enlarged. >@@ -635,7 +635,7 @@ static std::optional<unsigned> hyphenPositionForFragment(SplitFragmentData split > if (!line.isEmpty()) > adjustedAvailableWidth += style.font.spaceWidth(); > if (!enoughWidthForHyphenation(adjustedAvailableWidth, style.font.pixelSize())) >- return std::nullopt; >+ return WTF::nullopt; > > // We might be able to fit the hyphen at the split position. > auto splitPositionWithHyphen = splitData.position; >@@ -644,7 +644,7 @@ static std::optional<unsigned> hyphenPositionForFragment(SplitFragmentData split > auto leftSideWidth = splitData.width; > while (leftSideWidth + style.hyphenStringWidth > availableWidth) { > if (--splitPositionWithHyphen <= start) >- return std::nullopt; // No space for hyphen. >+ return WTF::nullopt; // No space for hyphen. > leftSideWidth -= textFragmentIterator.textWidth(splitPositionWithHyphen, splitPositionWithHyphen + 1, 0); > } > ASSERT(splitPositionWithHyphen > start); >@@ -684,7 +684,7 @@ static TextFragmentIterator::TextFragment splitFragmentToFitLine(TextFragmentIte > { > auto availableWidth = line.availableWidth() - line.width(); > auto splitFragmentData = split(fragmentToSplit, availableWidth, textFragmentIterator); >- std::optional<unsigned> hyphenPosition = std::nullopt; >+ WTF::Optional<unsigned> hyphenPosition = WTF::nullopt; > // Does first character fit this line? > if (splitFragmentData.position == fragmentToSplit.start()) { > // Keep at least one character on empty lines. >@@ -916,7 +916,7 @@ static TextAlignMode textAlignForLine(const TextFragmentIterator::Style& style, > return textAlign; > } > >-static void closeLineEndingAndAdjustRuns(LineState& line, Layout::RunVector& runs, std::optional<unsigned> lastRunIndexOfPreviousLine, unsigned& lineCount, >+static void closeLineEndingAndAdjustRuns(LineState& line, Layout::RunVector& runs, WTF::Optional<unsigned> lastRunIndexOfPreviousLine, unsigned& lineCount, > const TextFragmentIterator& textFragmentIterator, bool lastLineInFlow) > { > if (!runs.size() || (lastRunIndexOfPreviousLine && runs.size() - 1 == lastRunIndexOfPreviousLine.value())) >@@ -949,7 +949,7 @@ static void createTextRuns(Layout::RunVector& runs, RenderBlockFlow& flow, unsig > unsigned numberOfPrecedingLinesWithHyphen = 0; > bool isEndOfContent = false; > TextFragmentIterator textFragmentIterator = TextFragmentIterator(flow); >- std::optional<unsigned> lastRunIndexOfPreviousLine; >+ WTF::Optional<unsigned> lastRunIndexOfPreviousLine; > do { > flow.setLogicalHeight(lineHeight * lineCount + borderAndPaddingBefore); > LineState previousLine = line; >diff --git a/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp b/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp >index d26c0483c845568f7f68d5a92b575e3a8b21630d..a3b4265c8cd9ade7bf381bb3a35279a26001a3d3 100644 >--- a/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp >+++ b/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp >@@ -93,7 +93,7 @@ void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& pai > textPainter.setShadow(debugShadow.get()); > } > >- std::optional<TextDecorationPainter> textDecorationPainter; >+ WTF::Optional<TextDecorationPainter> textDecorationPainter; > if (!style.textDecorationsInEffect().isEmpty()) { > const RenderText* textRenderer = childrenOfType<RenderText>(flow).first(); > if (textRenderer) { >diff --git a/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp b/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp >index b313cd34b6687695c4d3f055ca6a86866ea38bfd..b2e1cf90c0bf974a2b9dd469a7793eef892ed97f 100644 >--- a/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp >+++ b/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp >@@ -164,7 +164,7 @@ unsigned RunResolver::adjustLineIndexForStruts(LayoutUnit y, IndexType type, uns > if (strut.lineBreak >= lineIndexCandidate) > return lineIndexCandidate; > unsigned strutIndex = 0; >- std::optional<unsigned> lastIndexCandidate; >+ WTF::Optional<unsigned> lastIndexCandidate; > auto top = strut.lineBreak * m_lineHeight; > auto lineHeightWithOverflow = m_lineHeight; > // If font is larger than the line height (glyphs overflow), use the font size when checking line boundaries. >diff --git a/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp b/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp >index 510a0cb8d942d43d7581498fafc6fd23c7f16160..dae59ce8b2cfd595b612cbab34bca98ccab7b447 100644 >--- a/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp >+++ b/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp >@@ -167,22 +167,22 @@ unsigned TextFragmentIterator::nextNonWhitespacePosition(const FlowContents::Seg > return position; > } > >-std::optional<unsigned> TextFragmentIterator::lastHyphenPosition(const TextFragmentIterator::TextFragment& run, unsigned before) const >+WTF::Optional<unsigned> TextFragmentIterator::lastHyphenPosition(const TextFragmentIterator::TextFragment& run, unsigned before) const > { > ASSERT(run.start() < before); > auto& segment = *m_currentSegment; > ASSERT(segment.start <= before && before <= segment.end); > ASSERT(is<RenderText>(segment.renderer)); > if (!m_style.shouldHyphenate || run.type() != TextFragment::NonWhitespace) >- return std::nullopt; >+ return WTF::nullopt; > // Check if there are enough characters in the run. > unsigned runLength = run.end() - run.start(); > if (m_style.hyphenLimitBefore >= runLength || m_style.hyphenLimitAfter >= runLength || m_style.hyphenLimitBefore + m_style.hyphenLimitAfter > runLength) >- return std::nullopt; >+ return WTF::nullopt; > auto runStart = segment.toSegmentPosition(run.start()); > auto beforeIndex = segment.toSegmentPosition(before) - runStart; > if (beforeIndex <= m_style.hyphenLimitBefore) >- return std::nullopt; >+ return WTF::nullopt; > // Adjust before index to accommodate the limit-after value (this is the last potential hyphen location). > beforeIndex = std::min(beforeIndex, runLength - m_style.hyphenLimitAfter + 1); > auto substringForHyphenation = StringView(segment.text).substring(runStart, run.end() - run.start()); >@@ -190,7 +190,7 @@ std::optional<unsigned> TextFragmentIterator::lastHyphenPosition(const TextFragm > // Check if there are enough characters before and after the hyphen. > if (hyphenLocation && hyphenLocation >= m_style.hyphenLimitBefore && m_style.hyphenLimitAfter <= (runLength - hyphenLocation)) > return segment.toRenderPosition(hyphenLocation + runStart); >- return std::nullopt; >+ return WTF::nullopt; > } > > unsigned TextFragmentIterator::skipToNextPosition(PositionType positionType, unsigned startPosition, float& width, float xPosition, bool& overlappingFragment) >diff --git a/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h b/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h >index df135bd083dea76071ef8e4707dd498b9c29a1d0..6849dc310cee4043cb9c185d41c401f492bfb41b 100644 >--- a/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h >+++ b/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h >@@ -100,7 +100,7 @@ public: > > // FIXME: These functions below should be decoupled from the text iterator. > float textWidth(unsigned startPosition, unsigned endPosition, float xPosition) const; >- std::optional<unsigned> lastHyphenPosition(const TextFragmentIterator::TextFragment& run, unsigned beforeIndex) const; >+ WTF::Optional<unsigned> lastHyphenPosition(const TextFragmentIterator::TextFragment& run, unsigned beforeIndex) const; > > struct Style { > explicit Style(const RenderStyle&); >@@ -122,7 +122,7 @@ public: > unsigned hyphenLimitBefore; > unsigned hyphenLimitAfter; > AtomicString locale; >- std::optional<unsigned> hyphenLimitLines; >+ WTF::Optional<unsigned> hyphenLimitLines; > }; > const Style& style() const { return m_style; } > >diff --git a/Source/WebCore/rendering/TextDecorationPainter.cpp b/Source/WebCore/rendering/TextDecorationPainter.cpp >index 729cdefce0c215f6662d7efc157d74d104dce33f..76a6bdb559db5c080e42ae33ace777deab5dcc9a 100644 >--- a/Source/WebCore/rendering/TextDecorationPainter.cpp >+++ b/Source/WebCore/rendering/TextDecorationPainter.cpp >@@ -197,7 +197,7 @@ bool TextDecorationPainter::Styles::operator==(const Styles& other) const > && underlineStyle == other.underlineStyle && overlineStyle == other.overlineStyle && linethroughStyle == other.linethroughStyle; > } > >-TextDecorationPainter::TextDecorationPainter(GraphicsContext& context, OptionSet<TextDecoration> decorations, const RenderText& renderer, bool isFirstLine, const FontCascade& font, std::optional<Styles> styles) >+TextDecorationPainter::TextDecorationPainter(GraphicsContext& context, OptionSet<TextDecoration> decorations, const RenderText& renderer, bool isFirstLine, const FontCascade& font, WTF::Optional<Styles> styles) > : m_context { context } > , m_decorations { decorations } > , m_wavyOffset { wavyOffsetFromDecoration() } >diff --git a/Source/WebCore/rendering/TextDecorationPainter.h b/Source/WebCore/rendering/TextDecorationPainter.h >index a6d14b2b5f4563783602a2ea790046ef9c801b00..eee0fcbd4e826db9c2eaabcfadb5194571d67533 100644 >--- a/Source/WebCore/rendering/TextDecorationPainter.h >+++ b/Source/WebCore/rendering/TextDecorationPainter.h >@@ -42,7 +42,7 @@ class TextRun; > class TextDecorationPainter { > public: > struct Styles; >- TextDecorationPainter(GraphicsContext&, OptionSet<TextDecoration> decorations, const RenderText&, bool isFirstLine, const FontCascade&, std::optional<Styles> = std::nullopt); >+ TextDecorationPainter(GraphicsContext&, OptionSet<TextDecoration> decorations, const RenderText&, bool isFirstLine, const FontCascade&, WTF::Optional<Styles> = WTF::nullopt); > > void setInlineTextBox(const InlineTextBox* inlineTextBox) { m_inlineTextBox = inlineTextBox; } > void setIsHorizontal(bool isHorizontal) { m_isHorizontal = isHorizontal; } >diff --git a/Source/WebCore/rendering/TextPaintStyle.cpp b/Source/WebCore/rendering/TextPaintStyle.cpp >index 6b0a1848995e0ec5cb28427945c1065ae6cde927..a26f0571a3b32a8ebdab40a8679699b841ea3d54 100644 >--- a/Source/WebCore/rendering/TextPaintStyle.cpp >+++ b/Source/WebCore/rendering/TextPaintStyle.cpp >@@ -135,7 +135,7 @@ TextPaintStyle computeTextPaintStyle(const Frame& frame, const RenderStyle& line > return paintStyle; > } > >-TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle& textPaintStyle, const RenderText& renderer, const RenderStyle& lineStyle, const PaintInfo& paintInfo, std::optional<ShadowData>& selectionShadow) >+TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle& textPaintStyle, const RenderText& renderer, const RenderStyle& lineStyle, const PaintInfo& paintInfo, WTF::Optional<ShadowData>& selectionShadow) > { > TextPaintStyle selectionPaintStyle = textPaintStyle; > >diff --git a/Source/WebCore/rendering/TextPaintStyle.h b/Source/WebCore/rendering/TextPaintStyle.h >index 260c4d0b506b6f086f5ade8a36022d2a48901f5f..cc6de90d3fd3e034e53bb5b2fb71cb403b756ae9 100644 >--- a/Source/WebCore/rendering/TextPaintStyle.h >+++ b/Source/WebCore/rendering/TextPaintStyle.h >@@ -60,7 +60,7 @@ struct TextPaintStyle { > > bool textColorIsLegibleAgainstBackgroundColor(const Color& textColor, const Color& backgroundColor); > TextPaintStyle computeTextPaintStyle(const Frame&, const RenderStyle&, const PaintInfo&); >-TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&, const RenderText&, const RenderStyle&, const PaintInfo&, std::optional<ShadowData>& selectionShadow); >+TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&, const RenderText&, const RenderStyle&, const PaintInfo&, WTF::Optional<ShadowData>& selectionShadow); > > enum FillColorType { UseNormalFillColor, UseEmphasisMarkColor }; > void updateGraphicsContext(GraphicsContext&, const TextPaintStyle&, FillColorType = UseNormalFillColor); >diff --git a/Source/WebCore/rendering/line/BreakingContext.h b/Source/WebCore/rendering/line/BreakingContext.h >index 1ba01dd41210ab348f686778a6ad7d67fa4416bb..0f869cfa1bd82fdb9da937e286fb8b12f193471a 100644 >--- a/Source/WebCore/rendering/line/BreakingContext.h >+++ b/Source/WebCore/rendering/line/BreakingContext.h >@@ -73,7 +73,7 @@ struct WordTrailingSpace { > m_state = WordTrailingSpaceState::Initialized; > } > >- std::optional<float> width(HashSet<const Font*>& fallbackFonts) >+ WTF::Optional<float> width(HashSet<const Font*>& fallbackFonts) > { > if (m_state == WordTrailingSpaceState::Initialized) > return m_width; >@@ -88,7 +88,7 @@ private: > enum class WordTrailingSpaceState { Uninitialized, Initialized }; > const RenderStyle& m_style; > WordTrailingSpaceState m_state { WordTrailingSpaceState::Uninitialized }; >- std::optional<float> m_width; >+ WTF::Optional<float> m_width; > }; > > class BreakingContext { >@@ -173,7 +173,7 @@ public: > m_hangsAtEnd = false; > } > >- void commitLineBreakAtCurrentWidth(RenderObject& object, unsigned offset = 0, std::optional<unsigned> nextBreak = std::optional<unsigned>()) >+ void commitLineBreakAtCurrentWidth(RenderObject& object, unsigned offset = 0, WTF::Optional<unsigned> nextBreak = WTF::Optional<unsigned>()) > { > m_width.commit(); > m_lineBreakHistory.moveTo(object, offset, nextBreak); >@@ -210,14 +210,14 @@ private: > > RenderObject* renderer() const { return this->at(0).renderer(); } > unsigned offset() const { return this->at(0).offset(); } >- std::optional<unsigned> nextBreakablePosition() const { return this->at(0).nextBreakablePosition(); } >+ WTF::Optional<unsigned> nextBreakablePosition() const { return this->at(0).nextBreakablePosition(); } > bool atTextParagraphSeparator() const { return this->at(0).atTextParagraphSeparator(); } > UChar previousInSameNode() const { return this->at(0).previousInSameNode(); } > const InlineIterator& get(size_t i) const { return this->at(i); }; > const InlineIterator& current() const { return get(0); } > size_t historyLength() const { return this->size(); } > >- void moveTo(RenderObject& object, unsigned offset, std::optional<unsigned> nextBreak = std::nullopt) >+ void moveTo(RenderObject& object, unsigned offset, WTF::Optional<unsigned> nextBreak = WTF::nullopt) > { > push([&](InlineIterator& modifyMe) { > modifyMe.moveTo(object, offset, nextBreak); >@@ -643,7 +643,7 @@ inline void ensureCharacterGetsLineBox(LineWhitespaceCollapsingState& lineWhites > lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset())); > } > >-inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, float availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, std::optional<unsigned> nextBreakable, bool& hyphenated) >+inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, float availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, WTF::Optional<unsigned> nextBreakable, bool& hyphenated) > { > // Map 'hyphenate-limit-{before,after}: auto;' to 2. > unsigned minimumPrefixLength; >@@ -716,7 +716,7 @@ inline float BreakingContext::computeAdditionalBetweenWordsWidth(RenderText& ren > wordMeasurement.startOffset = lastSpace; > > float additionalTempWidth = 0; >- std::optional<float> wordTrailingSpaceWidth; >+ WTF::Optional<float> wordTrailingSpaceWidth; > if (currentCharacter == ' ') > wordTrailingSpaceWidth = wordTrailingSpace.width(fallbackFonts); > if (wordTrailingSpaceWidth) >@@ -846,7 +846,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool > midWordBreak = m_width.committedWidth() + wrapW + charWidth > m_width.availableWidth(); > } > >- std::optional<unsigned> nextBreakablePosition = m_current.nextBreakablePosition(); >+ WTF::Optional<unsigned> nextBreakablePosition = m_current.nextBreakablePosition(); > bool betweenWords = c == '\n' || (m_currWS != WhiteSpace::Pre && !m_atStart && isBreakable(m_renderTextInfo.lineBreakIterator, m_current.offset(), nextBreakablePosition, breakNBSP, canUseLineBreakShortcut, keepAllWords) > && (style.hyphens() != Hyphens::None || (m_current.previousInSameNode() != softHyphen))); > m_current.setNextBreakablePosition(nextBreakablePosition); >@@ -948,7 +948,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool > } > // Check if the last breaking position is a soft-hyphen. > if (!hyphenated && style.hyphens() != Hyphens::None) { >- std::optional<unsigned> lastBreakingPositon; >+ WTF::Optional<unsigned> lastBreakingPositon; > const RenderObject* rendererAtBreakingPosition = nullptr; > if (m_lineBreakHistory.offset() || m_lineBreakHistory.nextBreakablePosition()) { > lastBreakingPositon = m_lineBreakHistory.offset(); >@@ -959,7 +959,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool > rendererAtBreakingPosition = m_current.renderer(); > } > if (lastBreakingPositon) { >- std::optional<UChar> characterBeforeBreakingPosition; >+ WTF::Optional<UChar> characterBeforeBreakingPosition; > // When last breaking position points to the start of the current context, we need to look at the last character from > // the previous non-empty text renderer. > if (!lastBreakingPositon.value()) >@@ -1318,7 +1318,7 @@ inline InlineIterator BreakingContext::optimalLineBreakLocationForTrailingWord() > return lineBreak; > bool canUseLineBreakShortcut = m_renderTextInfo.lineBreakIterator.mode() == LineBreakIteratorMode::Default; > bool breakNBSP = m_autoWrap && m_currentStyle->nbspMode() == NBSPMode::Space; >- std::optional<unsigned> nextBreakablePosition = lineBreak.nextBreakablePosition(); >+ WTF::Optional<unsigned> nextBreakablePosition = lineBreak.nextBreakablePosition(); > isBreakable(m_renderTextInfo.lineBreakIterator, lineBreak.offset() + 1, nextBreakablePosition, breakNBSP, canUseLineBreakShortcut, m_currentStyle->wordBreak() == WordBreak::KeepAll); > if (!nextBreakablePosition || nextBreakablePosition.value() != renderText.text().length()) > return lineBreak; >diff --git a/Source/WebCore/rendering/mathml/MathMLStyle.cpp b/Source/WebCore/rendering/mathml/MathMLStyle.cpp >index 6000da66854d75d0cb77355d58b8b367fe21f088..b413f509fbdf03cfcc1b1f26d09eedd46f9991bc 100644 >--- a/Source/WebCore/rendering/mathml/MathMLStyle.cpp >+++ b/Source/WebCore/rendering/mathml/MathMLStyle.cpp >@@ -136,10 +136,10 @@ void MathMLStyle::resolveMathMLStyle(RenderObject* renderer) > // The displaystyle and mathvariant attributes override the default behavior. > auto* element = downcast<RenderElement>(renderer)->element(); > if (is<MathMLElement>(element)) { >- std::optional<bool> displayStyle = downcast<MathMLElement>(element)->specifiedDisplayStyle(); >+ WTF::Optional<bool> displayStyle = downcast<MathMLElement>(element)->specifiedDisplayStyle(); > if (displayStyle) > m_displayStyle = displayStyle.value(); >- std::optional<MathMLElement::MathVariant> mathVariant = downcast<MathMLElement>(element)->specifiedMathVariant(); >+ WTF::Optional<MathMLElement::MathVariant> mathVariant = downcast<MathMLElement>(element)->specifiedMathVariant(); > if (mathVariant) > m_mathVariant = mathVariant.value(); > } >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp >index 00bde6d6694d8ac84313bf7158d0319f10f8337b..c4e8e7224064b667500d341438e9818fd4999a6e 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp >@@ -178,11 +178,11 @@ LayoutUnit toUserUnits(const MathMLElement::Length& length, const RenderStyle& s > } > } > >-std::optional<int> RenderMathMLTable::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLTable::firstLineBaseline() const > { > // By default the vertical center of <mtable> is aligned on the math axis. > // This is different than RenderTable::firstLineBoxBaseline, which returns the baseline of the first row of a <table>. >- return std::optional<int>(logicalHeight() / 2 + axisHeight(style())); >+ return WTF::Optional<int>(logicalHeight() / 2 + axisHeight(style())); > } > > void RenderMathMLBlock::layoutItems(bool relayoutChildren) >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h >index 3c4e6de40e58ed6687f84fc01ff359dcf4e47e65..dcb4d53eb1393e837cc344fb39999c88e769797a 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h >@@ -111,7 +111,7 @@ public: > private: > bool isRenderMathMLTable() const final { return true; } > const char* renderName() const final { return "RenderMathMLTable"; } >- std::optional<int> firstLineBaseline() const final; >+ WTF::Optional<int> firstLineBaseline() const final; > > Ref<MathMLStyle> m_mathMLStyle; > }; >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp >index 4958571c1287b2463e42dc494ca1e88130e15cb5..b49765e7fe7a0dd118928d3220a8695f162c8499 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp >@@ -268,10 +268,10 @@ void RenderMathMLFraction::paint(PaintInfo& info, const LayoutPoint& paintOffset > info.context().drawLine(adjustedPaintOffset, roundedIntPoint(LayoutPoint(adjustedPaintOffset.x() + logicalWidth(), adjustedPaintOffset.y()))); > } > >-std::optional<int> RenderMathMLFraction::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLFraction::firstLineBaseline() const > { > if (isValid()) >- return std::optional<int>(std::lround(static_cast<float>(ascentOverHorizontalAxis() + mathAxisHeight()))); >+ return WTF::Optional<int>(std::lround(static_cast<float>(ascentOverHorizontalAxis() + mathAxisHeight()))); > return RenderMathMLBlock::firstLineBaseline(); > } > >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h >index 5d1d17a9232de4f4b8fde0256325b12208477661..e6b94a773ea32fd1f8a0c35d8f940f7ca32c342f 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h >@@ -51,7 +51,7 @@ private: > > void computePreferredLogicalWidths() final; > void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final; >- std::optional<int> firstLineBaseline() const final; >+ WTF::Optional<int> firstLineBaseline() const final; > void paint(PaintInfo&, const LayoutPoint&) final; > RenderMathMLOperator* unembellishedOperator() const final; > >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >index 18bd9ccc215484598b135a4a000236c4fcfc6686..50cec27ef1c9f3342422c84b436f29092907b69b 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >@@ -295,10 +295,10 @@ LayoutUnit RenderMathMLOperator::verticalStretchedOperatorShift() const > return (m_stretchDepthBelowBaseline - m_stretchHeightAboveBaseline - m_mathOperator.descent() + m_mathOperator.ascent()) / 2; > } > >-std::optional<int> RenderMathMLOperator::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLOperator::firstLineBaseline() const > { > if (useMathOperator()) >- return std::optional<int>(std::lround(static_cast<float>(m_mathOperator.ascent() - verticalStretchedOperatorShift()))); >+ return WTF::Optional<int>(std::lround(static_cast<float>(m_mathOperator.ascent() - verticalStretchedOperatorShift()))); > return RenderMathMLToken::firstLineBaseline(); > } > >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h >index 44b52cc8364456f8ce3527fdca03ba728ab689f5..867c4e55ea5876e66465c1048253c604ef6c85db 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h >@@ -79,7 +79,7 @@ private: > bool isRenderMathMLOperator() const final { return true; } > bool isInvisibleOperator() const; > >- std::optional<int> firstLineBaseline() const final; >+ WTF::Optional<int> firstLineBaseline() const final; > RenderMathMLOperator* unembellishedOperator() const final { return const_cast<RenderMathMLOperator*>(this); } > > LayoutUnit verticalStretchedOperatorShift() const; >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp b/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp >index 94f8eb22a1c9626a036613d716f7f329432aefa5..1db6425b4481b7a2228d9418948e8544cea61036 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp >@@ -114,7 +114,7 @@ void RenderMathMLPadded::layoutBlock(bool relayoutChildren, LayoutUnit) > clearNeedsLayout(); > } > >-std::optional<int> RenderMathMLPadded::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLPadded::firstLineBaseline() const > { > // We try and calculate the baseline from the position of the first child. > LayoutUnit ascent; >@@ -122,7 +122,7 @@ std::optional<int> RenderMathMLPadded::firstLineBaseline() const > ascent = ascentForChild(*baselineChild) + baselineChild->logicalTop() + voffset(); > else > ascent = mpaddedHeight(0); >- return std::optional<int>(std::lround(static_cast<float>(ascent))); >+ return WTF::Optional<int>(std::lround(static_cast<float>(ascent))); > } > > } >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLPadded.h b/Source/WebCore/rendering/mathml/RenderMathMLPadded.h >index 0906379f2d26d46ecc4b32b693dc3d317df2cd10..2b06fd6923703b1d59885cf1dc60d4d4990b787c 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLPadded.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLPadded.h >@@ -43,7 +43,7 @@ private: > > void computePreferredLogicalWidths() final; > void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final; >- std::optional<int> firstLineBaseline() const final; >+ WTF::Optional<int> firstLineBaseline() const final; > > MathMLPaddedElement& element() const { return static_cast<MathMLPaddedElement&>(nodeForNonAnonymous()); } > LayoutUnit voffset() const; >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp >index 1c527a8ac40962df56cee0c03d1be8a0c21658e5..0a5e9cb73a36da668b908870de6a3c1802899432 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp >@@ -52,13 +52,13 @@ MathMLRowElement& RenderMathMLRow::element() const > return static_cast<MathMLRowElement&>(nodeForNonAnonymous()); > } > >-std::optional<int> RenderMathMLRow::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLRow::firstLineBaseline() const > { > auto* baselineChild = firstChildBox(); > if (!baselineChild) >- return std::optional<int>(); >+ return WTF::Optional<int>(); > >- return std::optional<int>(static_cast<int>(lroundf(ascentForChild(*baselineChild) + baselineChild->logicalTop()))); >+ return WTF::Optional<int>(static_cast<int>(lroundf(ascentForChild(*baselineChild) + baselineChild->logicalTop()))); > } > > static RenderMathMLOperator* toVerticalStretchyOperator(RenderBox* box) >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRow.h b/Source/WebCore/rendering/mathml/RenderMathMLRow.h >index 119d2b91ffb8175811fabc8cc3732ddf0d0a6ffb..19e11929c227835bf6d715eb5289a93e6b4b35c7 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLRow.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLRow.h >@@ -42,7 +42,7 @@ public: > > protected: > void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override; >- std::optional<int> firstLineBaseline() const override; >+ WTF::Optional<int> firstLineBaseline() const override; > > void stretchVerticalOperatorsAndLayoutChildren(); > void getContentBoundingBox(LayoutUnit& width, LayoutUnit& ascent, LayoutUnit& descent) const; >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp b/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp >index 5fb73d29251e04ca9e52208c36b2c49b4846d913..6951c985b62386797853aeb203af0f63716d5257 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp >@@ -67,13 +67,13 @@ RenderMathMLOperator* RenderMathMLScripts::unembellishedOperator() const > return downcast<RenderMathMLBlock>(base)->unembellishedOperator(); > } > >-std::optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::validateAndGetReferenceChildren() >+WTF::Optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::validateAndGetReferenceChildren() > { > // All scripted elements must have at least one child. > // The first child is the base. > auto base = firstChildBox(); > if (!base) >- return std::nullopt; >+ return WTF::nullopt; > > ReferenceChildren reference; > reference.base = base; >@@ -94,7 +94,7 @@ std::optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::valid > // <mover> base overscript </mover> > auto script = base->nextSiblingBox(); > if (!script || isPrescriptDelimiter(*script) || script->nextSiblingBox()) >- return std::nullopt; >+ return WTF::nullopt; > reference.firstPostScript = script; > return reference; > } >@@ -106,10 +106,10 @@ std::optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::valid > // <munderover> base subscript superscript </munderover> > auto subScript = base->nextSiblingBox(); > if (!subScript || isPrescriptDelimiter(*subScript)) >- return std::nullopt; >+ return WTF::nullopt; > auto superScript = subScript->nextSiblingBox(); > if (!superScript || isPrescriptDelimiter(*superScript) || superScript->nextSiblingBox()) >- return std::nullopt; >+ return WTF::nullopt; > reference.firstPostScript = subScript; > return reference; > } >@@ -139,19 +139,19 @@ std::optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::valid > if (isPrescriptDelimiter(*script)) { > // This is a <mprescripts/>. Let's check 2a) and 2c). > if (!numberOfScriptIsEven || reference.firstPreScript) >- return std::nullopt; >+ return WTF::nullopt; > reference.firstPreScript = script->nextSiblingBox(); // We do 1). > reference.prescriptDelimiter = script; > continue; > } > numberOfScriptIsEven = !numberOfScriptIsEven; > } >- return numberOfScriptIsEven ? std::optional<ReferenceChildren>(reference) : std::nullopt; // We verify 2b). >+ return numberOfScriptIsEven ? WTF::Optional<ReferenceChildren>(reference) : WTF::nullopt; // We verify 2b). > } > } > > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > > LayoutUnit RenderMathMLScripts::spaceAfterScript() >@@ -464,12 +464,12 @@ void RenderMathMLScripts::layoutBlock(bool relayoutChildren, LayoutUnit) > clearNeedsLayout(); > } > >-std::optional<int> RenderMathMLScripts::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLScripts::firstLineBaseline() const > { > auto* base = firstChildBox(); > if (!base) >- return std::optional<int>(); >- return std::optional<int>(static_cast<int>(lroundf(ascentForChild(*base) + base->logicalTop()))); >+ return WTF::Optional<int>(); >+ return WTF::Optional<int>(static_cast<int>(lroundf(ascentForChild(*base) + base->logicalTop()))); > } > > } >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLScripts.h b/Source/WebCore/rendering/mathml/RenderMathMLScripts.h >index 6cc77d8f4ab0b863a82525022fe57b5f466994d6..ca9fef7db905883bb4167e75a5f98a77e6e3580c 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLScripts.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLScripts.h >@@ -53,14 +53,14 @@ protected: > > private: > MathMLScriptsElement& element() const; >- std::optional<int> firstLineBaseline() const final; >+ WTF::Optional<int> firstLineBaseline() const final; > struct ReferenceChildren { > RenderBox* base; > RenderBox* prescriptDelimiter; > RenderBox* firstPostScript; > RenderBox* firstPreScript; > }; >- std::optional<ReferenceChildren> validateAndGetReferenceChildren(); >+ WTF::Optional<ReferenceChildren> validateAndGetReferenceChildren(); > LayoutUnit spaceAfterScript(); > LayoutUnit italicCorrection(const ReferenceChildren&); > struct VerticalParameters { >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp b/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp >index b64517684ed0cf9d4b23021332911def95ebc415..c10b42789af6491b7752e60ecd16762cf8d0cf9f 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp >@@ -84,11 +84,11 @@ void RenderMathMLSpace::layoutBlock(bool relayoutChildren, LayoutUnit) > clearNeedsLayout(); > } > >-std::optional<int> RenderMathMLSpace::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLSpace::firstLineBaseline() const > { > LayoutUnit height, depth; > getSpaceHeightAndDepth(height, depth); >- return std::optional<int>(height); >+ return WTF::Optional<int>(height); > } > > } >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSpace.h b/Source/WebCore/rendering/mathml/RenderMathMLSpace.h >index 9dcec7b6b1c81b535321295b7bbda991658b844b..c592acb7efac5dcef992c92002581c33a016ea69 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLSpace.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLSpace.h >@@ -44,7 +44,7 @@ private: > bool isChildAllowed(const RenderObject&, const RenderStyle&) const final { return false; } > void computePreferredLogicalWidths() final; > void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final; >- std::optional<int> firstLineBaseline() const final; >+ WTF::Optional<int> firstLineBaseline() const final; > > LayoutUnit spaceWidth() const; > void getSpaceHeightAndDepth(LayoutUnit& height, LayoutUnit& depth) const; >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp b/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp >index 5d4166b8bab4b055736d9e7d2f40e5ce452e4177..555d4f5278ae5fc43522112559565a7b3d9fc1e7 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp >@@ -519,7 +519,7 @@ void RenderMathMLToken::updateMathVariantGlyph() > { > ASSERT(m_mathVariantGlyphDirty); > >- m_mathVariantCodePoint = std::nullopt; >+ m_mathVariantCodePoint = WTF::nullopt; > m_mathVariantGlyphDirty = false; > > // Early return if the token element contains RenderElements. >@@ -554,12 +554,12 @@ void RenderMathMLToken::updateFromElement() > setMathVariantGlyphDirty(); > } > >-std::optional<int> RenderMathMLToken::firstLineBaseline() const >+WTF::Optional<int> RenderMathMLToken::firstLineBaseline() const > { > if (m_mathVariantCodePoint) { > auto mathVariantGlyph = style().fontCascade().glyphDataForCharacter(m_mathVariantCodePoint.value(), m_mathVariantIsMirrored); > if (mathVariantGlyph.font) >- return std::optional<int>(static_cast<int>(lroundf(-mathVariantGlyph.font->boundsForGlyph(mathVariantGlyph.glyph).y()))); >+ return WTF::Optional<int>(static_cast<int>(lroundf(-mathVariantGlyph.font->boundsForGlyph(mathVariantGlyph.glyph).y()))); > } > return RenderMathMLBlock::firstLineBaseline(); > } >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLToken.h b/Source/WebCore/rendering/mathml/RenderMathMLToken.h >index 9ce8f583f559758767f6b709b0029fc91aec3973..09f7c9e6efc381a1bd7f3abef932a79d0b319087 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLToken.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLToken.h >@@ -49,7 +49,7 @@ public: > protected: > void paint(PaintInfo&, const LayoutPoint&) override; > void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override; >- std::optional<int> firstLineBaseline() const override; >+ WTF::Optional<int> firstLineBaseline() const override; > void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override; > void computePreferredLogicalWidths() override; > >@@ -64,7 +64,7 @@ private: > m_mathVariantGlyphDirty = true; > setNeedsLayoutAndPrefWidthsRecalc(); > } >- std::optional<UChar32> m_mathVariantCodePoint { std::nullopt }; >+ WTF::Optional<UChar32> m_mathVariantCodePoint { WTF::nullopt }; > bool m_mathVariantIsMirrored { false }; > bool m_mathVariantGlyphDirty { false }; > }; >diff --git a/Source/WebCore/rendering/style/CounterDirectives.h b/Source/WebCore/rendering/style/CounterDirectives.h >index 4a9aade6664f02f3b2da4ada479436f2cbba3dd1..4d831691d8a9bf1730d80e36652cf13127c51345 100644 >--- a/Source/WebCore/rendering/style/CounterDirectives.h >+++ b/Source/WebCore/rendering/style/CounterDirectives.h >@@ -26,8 +26,8 @@ > namespace WebCore { > > struct CounterDirectives { >- std::optional<int> resetValue; >- std::optional<int> incrementValue; >+ WTF::Optional<int> resetValue; >+ WTF::Optional<int> incrementValue; > }; > > constexpr bool operator==(const CounterDirectives& a, const CounterDirectives& b) >diff --git a/Source/WebCore/rendering/style/GridPosition.cpp b/Source/WebCore/rendering/style/GridPosition.cpp >index d596736e6d78ee568ef89c61801049849eeb3a76..df304def5aa2a3d8d004a4e695bf46209e6cd96a 100644 >--- a/Source/WebCore/rendering/style/GridPosition.cpp >+++ b/Source/WebCore/rendering/style/GridPosition.cpp >@@ -33,7 +33,7 @@ > > namespace WebCore { > >-std::optional<int> GridPosition::gMaxPositionForTesting; >+WTF::Optional<int> GridPosition::gMaxPositionForTesting; > static const int kGridMaxPosition = 1000000; > > void GridPosition::setExplicitPosition(int position, const String& namedGridLine) >diff --git a/Source/WebCore/rendering/style/GridPosition.h b/Source/WebCore/rendering/style/GridPosition.h >index a39f4d8e06559dd732a4fbeb0d54a38a96961b0d..7c97876422875a46feab5d17bf8b25aee098c360 100644 >--- a/Source/WebCore/rendering/style/GridPosition.h >+++ b/Source/WebCore/rendering/style/GridPosition.h >@@ -85,7 +85,7 @@ public: > WEBCORE_EXPORT static void setMaxPositionForTesting(unsigned); > > private: >- static std::optional<int> gMaxPositionForTesting; >+ static WTF::Optional<int> gMaxPositionForTesting; > > void setIntegerPosition(int integerPosition) { m_integerPosition = clampTo(integerPosition, min(), max()); } > >diff --git a/Source/WebCore/rendering/style/NinePieceImage.h b/Source/WebCore/rendering/style/NinePieceImage.h >index d5465e94e9252ec45584a9c4c43c5dc1ed987b0a..dea5a0e3ad1d6edb20930ece925e4b7023996221 100644 >--- a/Source/WebCore/rendering/style/NinePieceImage.h >+++ b/Source/WebCore/rendering/style/NinePieceImage.h >@@ -76,7 +76,7 @@ inline bool isVerticalPiece(ImagePiece piece) > return piece == LeftPiece || piece == RightPiece || piece == MiddlePiece; > } > >-inline std::optional<PhysicalBoxSide> imagePieceHorizontalSide(ImagePiece piece) >+inline WTF::Optional<PhysicalBoxSide> imagePieceHorizontalSide(ImagePiece piece) > { > if (piece == TopLeftPiece || piece == TopPiece || piece == TopRightPiece) > return PhysicalBoxSide::Top; >@@ -84,10 +84,10 @@ inline std::optional<PhysicalBoxSide> imagePieceHorizontalSide(ImagePiece piece) > if (piece == BottomLeftPiece || piece == BottomPiece || piece == BottomRightPiece) > return PhysicalBoxSide::Bottom; > >- return std::nullopt; >+ return WTF::nullopt; > } > >-inline std::optional<PhysicalBoxSide> imagePieceVerticalSide(ImagePiece piece) >+inline WTF::Optional<PhysicalBoxSide> imagePieceVerticalSide(ImagePiece piece) > { > if (piece == TopLeftPiece || piece == LeftPiece || piece == BottomLeftPiece) > return PhysicalBoxSide::Left; >@@ -95,7 +95,7 @@ inline std::optional<PhysicalBoxSide> imagePieceVerticalSide(ImagePiece piece) > if (piece == TopRightPiece || piece == RightPiece || piece == BottomRightPiece) > return PhysicalBoxSide::Right; > >- return std::nullopt; >+ return WTF::nullopt; > } > > class NinePieceImage { >diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp >index 552aafcd4394ef834698a415ccced67d2813cc2e..de14b8e50ed39dbd1b5ae99caad671c149a2f434 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.cpp >+++ b/Source/WebCore/rendering/style/RenderStyle.cpp >@@ -1797,7 +1797,7 @@ void RenderStyle::setFontStretch(FontSelectionValue value) > fontCascade().update(currentFontSelector); > } > >-void RenderStyle::setFontItalic(std::optional<FontSelectionValue> value) >+void RenderStyle::setFontItalic(WTF::Optional<FontSelectionValue> value) > { > FontSelector* currentFontSelector = fontCascade().fontSelector(); > auto description = fontDescription(); >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index dbaaf0c763eedcd5dd6a3c16cf16b7ea44961218..6bcaba05f96a539106d20e42d84551d8feb21ec6 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -369,7 +369,7 @@ public: > #endif > FontSelectionValue fontWeight() const { return fontDescription().weight(); } > FontSelectionValue fontStretch() const { return fontDescription().stretch(); } >- std::optional<FontSelectionValue> fontItalic() const { return fontDescription().italic(); } >+ WTF::Optional<FontSelectionValue> fontItalic() const { return fontDescription().italic(); } > > const Length& textIndent() const { return m_rareInheritedData->indent; } > TextAlignMode textAlign() const { return static_cast<TextAlignMode>(m_inheritedFlags.textAlign); } >@@ -922,7 +922,7 @@ public: > #endif > void setFontWeight(FontSelectionValue); > void setFontStretch(FontSelectionValue); >- void setFontItalic(std::optional<FontSelectionValue>); >+ void setFontItalic(WTF::Optional<FontSelectionValue>); > > void setColor(const Color&); > void setTextIndent(Length&& length) { SET_VAR(m_rareInheritedData, indent, WTFMove(length)); } >diff --git a/Source/WebCore/rendering/style/ShadowData.cpp b/Source/WebCore/rendering/style/ShadowData.cpp >index acad18e63742067a3f39f90d87cdeb4eb7bb5084..ac1a9421ec0c6aede102931a982156fd6723c264 100644 >--- a/Source/WebCore/rendering/style/ShadowData.cpp >+++ b/Source/WebCore/rendering/style/ShadowData.cpp >@@ -37,10 +37,10 @@ ShadowData::ShadowData(const ShadowData& o) > { > } > >-std::optional<ShadowData> ShadowData::clone(const ShadowData* data) >+WTF::Optional<ShadowData> ShadowData::clone(const ShadowData* data) > { > if (!data) >- return std::nullopt; >+ return WTF::nullopt; > return *data; > } > >diff --git a/Source/WebCore/rendering/style/ShadowData.h b/Source/WebCore/rendering/style/ShadowData.h >index 0177103df3638d7343bd8b192e024aa7218ad1e1..2357902c5c6df3db40ca6fb69ff0e32cf3a993d8 100644 >--- a/Source/WebCore/rendering/style/ShadowData.h >+++ b/Source/WebCore/rendering/style/ShadowData.h >@@ -56,7 +56,7 @@ public: > } > > ShadowData(const ShadowData&); >- static std::optional<ShadowData> clone(const ShadowData*); >+ static WTF::Optional<ShadowData> clone(const ShadowData*); > > ShadowData& operator=(ShadowData&&) = default; > >diff --git a/Source/WebCore/rendering/style/TextUnderlineOffset.h b/Source/WebCore/rendering/style/TextUnderlineOffset.h >index 961e7b2d9312d2a1990d8eab5669030dc9325a3b..b2084c0da2305411e3880c4f772180f7399bac90 100644 >--- a/Source/WebCore/rendering/style/TextUnderlineOffset.h >+++ b/Source/WebCore/rendering/style/TextUnderlineOffset.h >@@ -93,7 +93,7 @@ private: > m_length = 0; > } > >- std::optional<float> m_length; >+ WTF::Optional<float> m_length; > }; > > inline TextStream& operator<<(TextStream& ts, const TextUnderlineOffset& offset) >diff --git a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp >index 22fa7d010908ac56c13b245344847ce0998b3264..a65e2ba5b525af5f50986df2cdd43066d5002dc2 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp >@@ -98,17 +98,17 @@ LayoutRect RenderSVGForeignObject::clippedOverflowRectForRepaint(const RenderLay > return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer); > } > >-std::optional<FloatRect> RenderSVGForeignObject::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<FloatRect> RenderSVGForeignObject::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context); > } > >-std::optional<LayoutRect> RenderSVGForeignObject::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<LayoutRect> RenderSVGForeignObject::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { >- std::optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context); >+ WTF::Optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context); > if (adjustedRect) > return enclosingLayoutRect(*adjustedRect); >- return std::nullopt; >+ return WTF::nullopt; > } > > const AffineTransform& RenderSVGForeignObject::localToParentTransform() const >diff --git a/Source/WebCore/rendering/svg/RenderSVGForeignObject.h b/Source/WebCore/rendering/svg/RenderSVGForeignObject.h >index 35def3075bc875c6b4a34e326f8085f74fbf16c8..64eef298d76247fb7d90e34336a3a1778d5783c5 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGForeignObject.h >+++ b/Source/WebCore/rendering/svg/RenderSVGForeignObject.h >@@ -40,8 +40,8 @@ public: > void paint(PaintInfo&, const LayoutPoint&) override; > > LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; >- std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >- std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >+ WTF::Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >+ WTF::Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; > > bool requiresLayer() const override { return false; } > void layout() override; >diff --git a/Source/WebCore/rendering/svg/RenderSVGInline.cpp b/Source/WebCore/rendering/svg/RenderSVGInline.cpp >index 0f60e6ca18d9655e89f3f2670dc1b9b5ae3457e3..c6c93031017aa46c4d5c20663e9cb469e2570c40 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGInline.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGInline.cpp >@@ -75,7 +75,7 @@ LayoutRect RenderSVGInline::clippedOverflowRectForRepaint(const RenderLayerModel > return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer); > } > >-std::optional<FloatRect> RenderSVGInline::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<FloatRect> RenderSVGInline::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context); > } >diff --git a/Source/WebCore/rendering/svg/RenderSVGInline.h b/Source/WebCore/rendering/svg/RenderSVGInline.h >index 294d461113065ec60a23245b864f64948dc71839..fd3ac4122a402c37d41d96817e45e25568781180 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGInline.h >+++ b/Source/WebCore/rendering/svg/RenderSVGInline.h >@@ -51,7 +51,7 @@ private: > FloatRect repaintRectInLocalCoordinates() const final; > > LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const final; >- std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final; >+ WTF::Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final; > void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const final; > const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const final; > void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const final; >diff --git a/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp b/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp >index 7e3448a194ae19e5ae75946eaeb2752a1286b2f4..ee99ca89b0d04181223378658a0be8b86c6d311c 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp >@@ -52,7 +52,7 @@ LayoutRect RenderSVGModelObject::clippedOverflowRectForRepaint(const RenderLayer > return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer); > } > >-std::optional<FloatRect> RenderSVGModelObject::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<FloatRect> RenderSVGModelObject::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context); > } >diff --git a/Source/WebCore/rendering/svg/RenderSVGModelObject.h b/Source/WebCore/rendering/svg/RenderSVGModelObject.h >index 07ec0f5fcf33cbcfda8e01ae530377b43d6c3d5a..b604cd2396051dae9f304e5178e4f60988630c2b 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGModelObject.h >+++ b/Source/WebCore/rendering/svg/RenderSVGModelObject.h >@@ -47,7 +47,7 @@ class RenderSVGModelObject : public RenderElement { > WTF_MAKE_ISO_ALLOCATED(RenderSVGModelObject); > public: > LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; >- std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final; >+ WTF::Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final; > LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap*) const final; > > void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const final; >diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp >index e63200697a6848c4fd2a0c8e0490af41bfba772b..7bb8d0ff991d5f0f94b6c1ada37f6f389614f4e7 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp >@@ -125,7 +125,7 @@ LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred sho > return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred); > } > >-LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight(std::optional<LayoutUnit> estimatedUsedWidth) const >+LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight(WTF::Optional<LayoutUnit> estimatedUsedWidth) const > { > // When we're embedded through SVGImage (border-image/background-image/<html:img>/...) we're forced to resize to a specific size. > if (!m_containerSize.isEmpty()) >@@ -341,7 +341,7 @@ LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(const RenderLayerModelOb > return RenderReplaced::computeRectForRepaint(enclosingIntRect(repaintRect), repaintContainer); > } > >-std::optional<FloatRect> RenderSVGRoot::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<FloatRect> RenderSVGRoot::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > // Apply our local transforms (except for x/y translation), then our shadow, > // and then call RenderBox's method to handle all the normal CSS Box model bits >@@ -355,7 +355,7 @@ std::optional<FloatRect> RenderSVGRoot::computeFloatVisibleRectInContainer(const > if (shouldApplyViewportClip()) { > if (context.m_options.contains(VisibleRectContextOption::UseEdgeInclusiveIntersection)) { > if (!adjustedRect.edgeInclusiveIntersect(snappedIntRect(borderBoxRect()))) >- return std::nullopt; >+ return WTF::nullopt; > } else > adjustedRect.intersect(snappedIntRect(borderBoxRect())); > } >@@ -367,9 +367,9 @@ std::optional<FloatRect> RenderSVGRoot::computeFloatVisibleRectInContainer(const > adjustedRect.unite(decoratedRepaintRect); > } > >- if (std::optional<LayoutRect> rectInContainer = RenderReplaced::computeVisibleRectInContainer(enclosingIntRect(adjustedRect), container, context)) >+ if (WTF::Optional<LayoutRect> rectInContainer = RenderReplaced::computeVisibleRectInContainer(enclosingIntRect(adjustedRect), container, context)) > return FloatRect(*rectInContainer); >- return std::nullopt; >+ return WTF::nullopt; > } > > // This method expects local CSS box coordinates. >diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.h b/Source/WebCore/rendering/svg/RenderSVGRoot.h >index 0743a75aa69eb26a21093a680a6f17ef246e6a27..2907d72e88acaaec8e59114f5a6d156067b1faf2 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGRoot.h >+++ b/Source/WebCore/rendering/svg/RenderSVGRoot.h >@@ -69,7 +69,7 @@ private: > const char* renderName() const override { return "RenderSVGRoot"; } > > LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const override; >- LayoutUnit computeReplacedLogicalHeight(std::optional<LayoutUnit> estimatedUsedWidth = std::nullopt) const override; >+ LayoutUnit computeReplacedLogicalHeight(WTF::Optional<LayoutUnit> estimatedUsedWidth = WTF::nullopt) const override; > void layout() override; > void paintReplaced(PaintInfo&, const LayoutPoint&) override; > >@@ -92,7 +92,7 @@ private: > bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; > > LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; >- std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >+ WTF::Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; > > void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override; > const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override; >diff --git a/Source/WebCore/rendering/svg/RenderSVGShape.cpp b/Source/WebCore/rendering/svg/RenderSVGShape.cpp >index ea43610610f224d088a137aa41f168d219ca5ed2..29fb16d3939f8bf216d56beda59b579d7ab8e8f6 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGShape.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGShape.cpp >@@ -200,7 +200,7 @@ Path* RenderSVGShape::nonScalingStrokePath(const Path* path, const AffineTransfo > > bool RenderSVGShape::setupNonScalingStrokeContext(AffineTransform& strokeTransform, GraphicsContextStateSaver& stateSaver) > { >- std::optional<AffineTransform> inverse = strokeTransform.inverse(); >+ WTF::Optional<AffineTransform> inverse = strokeTransform.inverse(); > if (!inverse) > return false; > >@@ -441,7 +441,7 @@ FloatRect RenderSVGShape::calculateStrokeBoundingBox() const > BoundingRectStrokeStyleApplier strokeStyle(*this); > if (hasNonScalingStroke()) { > AffineTransform nonScalingTransform = nonScalingStrokeTransform(); >- if (std::optional<AffineTransform> inverse = nonScalingTransform.inverse()) { >+ if (WTF::Optional<AffineTransform> inverse = nonScalingTransform.inverse()) { > Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); > FloatRect strokeBoundingRect = usePath->strokeBoundingRect(&strokeStyle); > strokeBoundingRect = inverse.value().mapRect(strokeBoundingRect); >diff --git a/Source/WebCore/rendering/svg/RenderSVGText.cpp b/Source/WebCore/rendering/svg/RenderSVGText.cpp >index 8b355faf36fc492fea9ecf78a2b5651a7bcf96e8..28841d6c98146ea586f311f30c127c763339449a 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGText.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGText.cpp >@@ -92,15 +92,15 @@ LayoutRect RenderSVGText::clippedOverflowRectForRepaint(const RenderLayerModelOb > return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer); > } > >-std::optional<LayoutRect> RenderSVGText::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<LayoutRect> RenderSVGText::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { >- std::optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context); >+ WTF::Optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context); > if (adjustedRect) > return enclosingLayoutRect(*adjustedRect); >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<FloatRect> RenderSVGText::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const >+WTF::Optional<FloatRect> RenderSVGText::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const > { > return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context); > } >diff --git a/Source/WebCore/rendering/svg/RenderSVGText.h b/Source/WebCore/rendering/svg/RenderSVGText.h >index f88c769c02826dfb6b092ccdabc5c1c4c636b27c..cb1417eef2d124645425eabc05f43e6b9e01f535 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGText.h >+++ b/Source/WebCore/rendering/svg/RenderSVGText.h >@@ -78,8 +78,8 @@ private: > void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; > > LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; >- std::optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >- std::optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >+ WTF::Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; >+ WTF::Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; > > void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override; > const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override; >diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp >index f036802c3e00de3a4a7a3733763ebb50f24dcc35..2cb9bba053f6b64e6b8ad2dafd2a1d69220da14c 100644 >--- a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp >+++ b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp >@@ -62,7 +62,7 @@ LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderElement& > return enclosingLayoutRect(renderer.computeFloatRectForRepaint(repaintRect, repaintContainer)); > } > >-std::optional<FloatRect> SVGRenderSupport::computeFloatVisibleRectInContainer(const RenderElement& renderer, const FloatRect& rect, const RenderLayerModelObject* container, RenderObject::VisibleRectContext context) >+WTF::Optional<FloatRect> SVGRenderSupport::computeFloatVisibleRectInContainer(const RenderElement& renderer, const FloatRect& rect, const RenderLayerModelObject* container, RenderObject::VisibleRectContext context) > { > FloatRect adjustedRect = rect; > const SVGRenderStyle& svgStyle = renderer.style().svgStyle(); >diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.h b/Source/WebCore/rendering/svg/SVGRenderSupport.h >index 2b77c2afa759931b40f929cbc8be994d67677ffb..8e56ca322d3ca654bd65f3c8b21d791de59d5e14 100644 >--- a/Source/WebCore/rendering/svg/SVGRenderSupport.h >+++ b/Source/WebCore/rendering/svg/SVGRenderSupport.h >@@ -65,7 +65,7 @@ public: > > // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations > static LayoutRect clippedOverflowRectForRepaint(const RenderElement&, const RenderLayerModelObject* repaintContainer); >- static std::optional<FloatRect> computeFloatVisibleRectInContainer(const RenderElement&, const FloatRect&, const RenderLayerModelObject* container, RenderObject::VisibleRectContext); >+ static WTF::Optional<FloatRect> computeFloatVisibleRectInContainer(const RenderElement&, const FloatRect&, const RenderLayerModelObject* container, RenderObject::VisibleRectContext); > static const RenderElement& localToParentTransform(const RenderElement&, AffineTransform &); > static void mapLocalToContainer(const RenderElement&, const RenderLayerModelObject* repaintContainer, TransformState&, bool* wasFixed); > static const RenderElement* pushMappingToContainer(const RenderElement&, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&); >diff --git a/Source/WebCore/rendering/svg/SVGTextQuery.cpp b/Source/WebCore/rendering/svg/SVGTextQuery.cpp >index fd8902294b6a004ca50586f57aba644b6e03e5e7..dc33382f0c6eeff516c5327150988097b598d7ad 100644 >--- a/Source/WebCore/rendering/svg/SVGTextQuery.cpp >+++ b/Source/WebCore/rendering/svg/SVGTextQuery.cpp >@@ -169,7 +169,7 @@ void SVGTextQuery::modifyStartEndPositionsRespectingLigatures(Data* queryData, u > bool alterStartPosition = true; > bool alterEndPosition = true; > >- std::optional<unsigned> lastPositionOffset; >+ WTF::Optional<unsigned> lastPositionOffset; > for (; textMetricsOffset < textMetricsSize && positionOffset < positionSize; ++textMetricsOffset) { > SVGTextMetrics& metrics = textMetricsValues[textMetricsOffset]; > >diff --git a/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp b/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp >index d3a6f8cb630c7cdf23ccc8e0cf0120195e40b156..db56bd9c063da73259ab759cf583e7f9b5f98d09 100644 >--- a/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp >+++ b/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp >@@ -79,7 +79,7 @@ RenderTreeUpdater::Parent::Parent(ContainerNode& root) > RenderTreeUpdater::Parent::Parent(Element& element, const Style::ElementUpdates* updates) > : element(&element) > , updates(updates) >- , renderTreePosition(element.renderer() ? std::make_optional(RenderTreePosition(*element.renderer())) : std::nullopt) >+ , renderTreePosition(element.renderer() ? WTF::makeOptional(RenderTreePosition(*element.renderer())) : WTF::nullopt) > { > } > >diff --git a/Source/WebCore/rendering/updating/RenderTreeUpdater.h b/Source/WebCore/rendering/updating/RenderTreeUpdater.h >index 45b729ced32803aeac3ef9a36d3391b9e25bc7ff..fd3c619720ab955805fe769468600b622549fa13 100644 >--- a/Source/WebCore/rendering/updating/RenderTreeUpdater.h >+++ b/Source/WebCore/rendering/updating/RenderTreeUpdater.h >@@ -68,7 +68,7 @@ private: > struct Parent { > Element* element { nullptr }; > const Style::ElementUpdates* updates { nullptr }; >- std::optional<RenderTreePosition> renderTreePosition; >+ WTF::Optional<RenderTreePosition> renderTreePosition; > > bool didCreateOrDestroyChildRenderer { false }; > RenderObject* previousChildRenderer { nullptr }; >diff --git a/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp b/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp >index 45cf49013e3d1027eabff4b7e88d5af96b3e1f11..648bd9e47141cd447aa3eb4ebec24066906e45d2 100644 >--- a/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp >+++ b/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp >@@ -89,7 +89,7 @@ static void updateStyleForContentRenderers(RenderElement& pseudoRenderer, const > } > } > >-void RenderTreeUpdater::GeneratedContent::updatePseudoElement(Element& current, const std::optional<Style::ElementUpdate>& update, PseudoId pseudoId) >+void RenderTreeUpdater::GeneratedContent::updatePseudoElement(Element& current, const WTF::Optional<Style::ElementUpdate>& update, PseudoId pseudoId) > { > PseudoElement* pseudoElement = pseudoId == PseudoId::Before ? current.beforePseudoElement() : current.afterPseudoElement(); > >@@ -154,7 +154,7 @@ void RenderTreeUpdater::GeneratedContent::updatePseudoElement(Element& current, > m_updater.m_builder.updateAfterDescendants(*pseudoElementRenderer); > } > >-bool RenderTreeUpdater::GeneratedContent::needsPseudoElement(const std::optional<Style::ElementUpdate>& update) >+bool RenderTreeUpdater::GeneratedContent::needsPseudoElement(const WTF::Optional<Style::ElementUpdate>& update) > { > if (!update) > return false; >diff --git a/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.h b/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.h >index d16367cfaa0a3ac229ebe6d12f43725c1da7c2dd..2cde0d74d61b80074c051b10e41c7172516f5e22 100644 >--- a/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.h >+++ b/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.h >@@ -38,7 +38,7 @@ class RenderTreeUpdater::GeneratedContent { > public: > GeneratedContent(RenderTreeUpdater&); > >- void updatePseudoElement(Element&, const std::optional<Style::ElementUpdate>&, PseudoId); >+ void updatePseudoElement(Element&, const WTF::Optional<Style::ElementUpdate>&, PseudoId); > void updateRemainingQuotes(); > > static void removeBeforePseudoElement(Element&, RenderTreeBuilder&); >@@ -47,7 +47,7 @@ public: > private: > void updateQuotesUpTo(RenderQuote*); > >- bool needsPseudoElement(const std::optional<Style::ElementUpdate>&); >+ bool needsPseudoElement(const WTF::Optional<Style::ElementUpdate>&); > > RenderTreeUpdater& m_updater; > WeakPtr<RenderQuote> m_previousUpdatedQuote; >diff --git a/Source/WebCore/style/StyleScope.h b/Source/WebCore/style/StyleScope.h >index 366fca6003a90d2ffb5c9296ea02803a0562f8fb..9a41ffe68ed4a1263384a5d2a20a841a7ed996f5 100644 >--- a/Source/WebCore/style/StyleScope.h >+++ b/Source/WebCore/style/StyleScope.h >@@ -171,7 +171,7 @@ private: > HashSet<const Element*> m_elementsInHeadWithPendingSheets; > HashSet<const Element*> m_elementsInBodyWithPendingSheets; > >- std::optional<UpdateType> m_pendingUpdate; >+ WTF::Optional<UpdateType> m_pendingUpdate; > bool m_hasDescendantWithPendingUpdate { false }; > > ListHashSet<Node*> m_styleSheetCandidateNodes; >diff --git a/Source/WebCore/style/StyleUpdate.h b/Source/WebCore/style/StyleUpdate.h >index d9d18af3f3b44f5ac07d88c33a5fc32e11b5dfc5..fb66669f56944656cb6b941267d17f5a0726dccb 100644 >--- a/Source/WebCore/style/StyleUpdate.h >+++ b/Source/WebCore/style/StyleUpdate.h >@@ -53,14 +53,14 @@ enum class DescendantsToResolve { None, ChildrenWithExplicitInherit, Children, A > struct ElementUpdates { > ElementUpdate update; > DescendantsToResolve descendantsToResolve { DescendantsToResolve::None }; >- std::optional<ElementUpdate> beforePseudoElementUpdate; >- std::optional<ElementUpdate> afterPseudoElementUpdate; >+ WTF::Optional<ElementUpdate> beforePseudoElementUpdate; >+ WTF::Optional<ElementUpdate> afterPseudoElementUpdate; > }; > > struct TextUpdate { > unsigned offset { 0 }; > unsigned length { std::numeric_limits<unsigned>::max() }; >- std::optional<std::unique_ptr<RenderStyle>> inheritedDisplayContentsStyle; >+ WTF::Optional<std::unique_ptr<RenderStyle>> inheritedDisplayContentsStyle; > }; > > class Update { >diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp >index 025b96bbcb4448611c7345b0cdfc7a10d96ce506..5d1fed147c99ed2b2ac9a907d3988b912703dc95 100644 >--- a/Source/WebCore/svg/SVGElement.cpp >+++ b/Source/WebCore/svg/SVGElement.cpp >@@ -712,11 +712,11 @@ void SVGElement::synchronizeAnimatedSVGAttribute(const QualifiedName& name) cons > nonConstThis->synchronizeAttribute(name); > } > >-std::optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*) >+WTF::Optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*) > { > // If the element is in a <use> tree we get the style from the definition tree. > if (auto styleElement = makeRefPtr(this->correspondingElement())) { >- std::optional<ElementStyle> style = styleElement->resolveStyle(&parentStyle); >+ WTF::Optional<ElementStyle> style = styleElement->resolveStyle(&parentStyle); > StyleResolver::adjustSVGElementStyle(*this, *style->renderStyle); > return style; > } >diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h >index f8339e44289ab5cc40805948e01afbe681cbbc78..417c48bc963c353b063f89083b8b4cff7afb99c8 100644 >--- a/Source/WebCore/svg/SVGElement.h >+++ b/Source/WebCore/svg/SVGElement.h >@@ -107,7 +107,7 @@ public: > void synchronizeAnimatedSVGAttribute(const QualifiedName&) const; > static void synchronizeAllAnimatedSVGAttribute(SVGElement*); > >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; >+ WTF::Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > > static QualifiedName animatableAttributeForName(const AtomicString&); > #ifndef NDEBUG >diff --git a/Source/WebCore/svg/SVGLengthListValues.h b/Source/WebCore/svg/SVGLengthListValues.h >index b07286064439d09a970523e853d074fd3c763568..6436f1b46fad2d1a1344f9ec4f29993120793687 100644 >--- a/Source/WebCore/svg/SVGLengthListValues.h >+++ b/Source/WebCore/svg/SVGLengthListValues.h >@@ -43,7 +43,7 @@ struct SVGPropertyTraits<SVGLengthListValues> { > list.parse(string, lengthMode); > return list; > } >- static std::optional<SVGLengthListValues> parse(const QualifiedName& attrName, const String& string) >+ static WTF::Optional<SVGLengthListValues> parse(const QualifiedName& attrName, const String& string) > { > SVGLengthListValues list; > list.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName)); >diff --git a/Source/WebCore/svg/SVGLengthValue.h b/Source/WebCore/svg/SVGLengthValue.h >index f84bf03b667f8294e782790139894ac86adc2f1b..0b262e780250dbbc4118e12e9afeba2873725bd6 100644 >--- a/Source/WebCore/svg/SVGLengthValue.h >+++ b/Source/WebCore/svg/SVGLengthValue.h >@@ -147,7 +147,7 @@ private: > > template<> struct SVGPropertyTraits<SVGLengthValue> { > static SVGLengthValue initialValue() { return { }; } >- static std::optional<SVGLengthValue> parse(const QualifiedName& attrName, const String& string) >+ static WTF::Optional<SVGLengthValue> parse(const QualifiedName& attrName, const String& string) > { > SVGLengthValue length; > length.setValueAsString(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName)).hasException(); >diff --git a/Source/WebCore/svg/SVGMarkerTypes.h b/Source/WebCore/svg/SVGMarkerTypes.h >index fac187c322917bb21086ceb9715eb7143fa77596..e35bad22cdce3d61d83eed575b257f4c252060f3 100644 >--- a/Source/WebCore/svg/SVGMarkerTypes.h >+++ b/Source/WebCore/svg/SVGMarkerTypes.h >@@ -103,7 +103,7 @@ struct SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>> { > angle = { }; > return std::pair<SVGAngleValue, unsigned>(angle, orientType); > } >- static std::optional<std::pair<SVGAngleValue, unsigned>> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<std::pair<SVGAngleValue, unsigned>> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(const std::pair<SVGAngleValue, unsigned>&) { ASSERT_NOT_REACHED(); return emptyString(); } > }; > >diff --git a/Source/WebCore/svg/SVGNumberListValues.h b/Source/WebCore/svg/SVGNumberListValues.h >index 30c2db3f988276ca8612792ee8833edf149926a1..033d052a23ac2b03e8404450d4e3966941c80f27 100644 >--- a/Source/WebCore/svg/SVGNumberListValues.h >+++ b/Source/WebCore/svg/SVGNumberListValues.h >@@ -42,7 +42,7 @@ template<> struct SVGPropertyTraits<SVGNumberListValues> { > list.parse(string); > return list; > } >- static std::optional<SVGNumberListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<SVGNumberListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(const SVGNumberListValues& list) { return list.valueAsString(); } > > using ListItemType = float; >diff --git a/Source/WebCore/svg/SVGPathByteStream.h b/Source/WebCore/svg/SVGPathByteStream.h >index d28c59ebb8985522216ddbd74e147b825f53864f..444cd7e1f0ba057fe72b4dacb4e0d7e7791150b6 100644 >--- a/Source/WebCore/svg/SVGPathByteStream.h >+++ b/Source/WebCore/svg/SVGPathByteStream.h >@@ -108,7 +108,7 @@ struct SVGPropertyTraits<SVGPathByteStream> { > buildSVGPathByteStreamFromString(string, byteStream, UnalteredParsing); > return byteStream; > } >- static std::optional<SVGPathByteStream> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; } >+ static WTF::Optional<SVGPathByteStream> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; } > static String toString(const SVGPathByteStream&) { ASSERT_NOT_REACHED(); return emptyString(); } > }; > >diff --git a/Source/WebCore/svg/SVGPathElement.cpp b/Source/WebCore/svg/SVGPathElement.cpp >index f9391b7d388564dc13eeb8dbcbac407125091943..a28e71452cc82c6107734bcdbc7e475fc3cbfc33 100644 >--- a/Source/WebCore/svg/SVGPathElement.cpp >+++ b/Source/WebCore/svg/SVGPathElement.cpp >@@ -198,7 +198,7 @@ void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin > if (name == SVGNames::dAttr) { > if (!buildSVGPathByteStreamFromString(value, m_pathByteStream, UnalteredParsing)) > document().accessSVGExtensions().reportError("Problem parsing d=\"" + value + "\""); >- m_cachedPath = std::nullopt; >+ m_cachedPath = WTF::nullopt; > return; > } > >@@ -341,7 +341,7 @@ void SVGPathElement::pathSegListChanged(SVGPathSegRole role, ListModification li > appendSVGPathByteStreamFromSVGPathSeg(pathSegList.last().copyRef(), m_pathByteStream, UnalteredParsing); > } else > buildSVGPathByteStreamFromSVGPathSegListValues(pathSegList, m_pathByteStream, UnalteredParsing); >- m_cachedPath = std::nullopt; >+ m_cachedPath = WTF::nullopt; > break; > } > case PathSegUndefinedRole: >diff --git a/Source/WebCore/svg/SVGPathElement.h b/Source/WebCore/svg/SVGPathElement.h >index 667a620945759dd57c9e2fff4e88b61443ada98d..587b547a0e164ca1b51c206bd2870b28c0cbb60b 100644 >--- a/Source/WebCore/svg/SVGPathElement.h >+++ b/Source/WebCore/svg/SVGPathElement.h >@@ -131,7 +131,7 @@ private: > > private: > SVGPathByteStream m_pathByteStream; >- mutable std::optional<Path> m_cachedPath; >+ mutable WTF::Optional<Path> m_cachedPath; > bool m_isAnimValObserved { false }; > > class SVGAnimatedCustomPathSegListAttribute : public SVGAnimatedPathSegListAttribute { >diff --git a/Source/WebCore/svg/SVGPointListValues.h b/Source/WebCore/svg/SVGPointListValues.h >index 362fdcc5d7d341c0f9371e5b5cbee2e5f265e584..a385c31e017db0d8ab6ea33528a4d58fecb28ea8 100644 >--- a/Source/WebCore/svg/SVGPointListValues.h >+++ b/Source/WebCore/svg/SVGPointListValues.h >@@ -44,7 +44,7 @@ struct SVGPropertyTraits<SVGPointListValues> { > pointsListFromSVGData(list, string); > return list; > } >- static std::optional<SVGPointListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; } >+ static WTF::Optional<SVGPointListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; } > static String toString(const SVGPointListValues& list) { return list.valueAsString(); } > > using ListItemType = FloatPoint; >diff --git a/Source/WebCore/svg/SVGPreserveAspectRatioValue.h b/Source/WebCore/svg/SVGPreserveAspectRatioValue.h >index 6a7fca24a4d8d918c041a6cbbfa45dd21c38bd58..cc287f543ba4959c9ad8cea831ff3bf226cb7322 100644 >--- a/Source/WebCore/svg/SVGPreserveAspectRatioValue.h >+++ b/Source/WebCore/svg/SVGPreserveAspectRatioValue.h >@@ -79,7 +79,7 @@ private: > template<> struct SVGPropertyTraits<SVGPreserveAspectRatioValue> { > static SVGPreserveAspectRatioValue initialValue() { return SVGPreserveAspectRatioValue(); } > static SVGPreserveAspectRatioValue fromString(const String& string) { return SVGPreserveAspectRatioValue(string); } >- static std::optional<SVGPreserveAspectRatioValue> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<SVGPreserveAspectRatioValue> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(const SVGPreserveAspectRatioValue& type) { return type.valueAsString(); } > }; > >diff --git a/Source/WebCore/svg/SVGToOTFFontConversion.cpp b/Source/WebCore/svg/SVGToOTFFontConversion.cpp >index 2322791d2ebd9a37620c9ee99b05e1f8aad69e4c..dbf6d1feba056036d8982bb96e4183438176f98d 100644 >--- a/Source/WebCore/svg/SVGToOTFFontConversion.cpp >+++ b/Source/WebCore/svg/SVGToOTFFontConversion.cpp >@@ -196,7 +196,7 @@ private: > > uint32_t calculateChecksum(size_t startingOffset, size_t endingOffset) const; > >- void processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement*, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, std::optional<FloatRect>& boundingBox); >+ void processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement*, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, WTF::Optional<FloatRect>& boundingBox); > > typedef void (SVGToOTFFontConverter::*FontAppendingFunction)(); > void appendTable(const char identifier[4], FontAppendingFunction); >@@ -222,7 +222,7 @@ private: > > void appendValidCFFString(const String&); > >- Vector<char> transcodeGlyphPaths(float width, const SVGElement& glyphOrMissingGlyphElement, std::optional<FloatRect>& boundingBox) const; >+ Vector<char> transcodeGlyphPaths(float width, const SVGElement& glyphOrMissingGlyphElement, WTF::Optional<FloatRect>& boundingBox) const; > > void addCodepointRanges(const UnicodeRanges&, HashSet<Glyph>& glyphSet) const; > void addCodepoints(const HashSet<String>& codepoints, HashSet<Glyph>& glyphSet) const; >@@ -1141,7 +1141,7 @@ public: > m_cffData.append(rMoveTo); > } > >- std::optional<FloatRect> boundingBox() const >+ WTF::Optional<FloatRect> boundingBox() const > { > return m_boundingBox; > } >@@ -1232,11 +1232,11 @@ private: > Vector<char>& m_cffData; > FloatPoint m_startingPoint; > FloatPoint m_current; >- std::optional<FloatRect> m_boundingBox; >+ WTF::Optional<FloatRect> m_boundingBox; > float m_unitsPerEmScalar; > }; > >-Vector<char> SVGToOTFFontConverter::transcodeGlyphPaths(float width, const SVGElement& glyphOrMissingGlyphElement, std::optional<FloatRect>& boundingBox) const >+Vector<char> SVGToOTFFontConverter::transcodeGlyphPaths(float width, const SVGElement& glyphOrMissingGlyphElement, WTF::Optional<FloatRect>& boundingBox) const > { > Vector<char> result; > >@@ -1272,7 +1272,7 @@ Vector<char> SVGToOTFFontConverter::transcodeGlyphPaths(float width, const SVGEl > return result; > } > >-void SVGToOTFFontConverter::processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement* glyphElement, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, std::optional<FloatRect>& boundingBox) >+void SVGToOTFFontConverter::processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement* glyphElement, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, WTF::Optional<FloatRect>& boundingBox) > { > bool ok; > float horizontalAdvance = scaleUnitsPerEm(glyphOrMissingGlyphElement.attributeWithoutSynchronization(SVGNames::horiz_adv_xAttr).toFloat(&ok)); >@@ -1284,7 +1284,7 @@ void SVGToOTFFontConverter::processGlyphElement(const SVGElement& glyphOrMissing > verticalAdvance = defaultVerticalAdvance; > m_advanceHeightMax = std::max(m_advanceHeightMax, verticalAdvance); > >- std::optional<FloatRect> glyphBoundingBox; >+ WTF::Optional<FloatRect> glyphBoundingBox; > auto path = transcodeGlyphPaths(horizontalAdvance, glyphOrMissingGlyphElement, glyphBoundingBox); > if (!path.size()) { > // It's better to use a fallback font rather than use a font without all its glyphs. >@@ -1407,7 +1407,7 @@ SVGToOTFFontConverter::SVGToOTFFontConverter(const SVGFontElement& fontElement) > > populateEmptyGlyphCharString(m_emptyGlyphCharString, s_outputUnitsPerEm); > >- std::optional<FloatRect> boundingBox; >+ WTF::Optional<FloatRect> boundingBox; > if (m_missingGlyphElement) > processGlyphElement(*m_missingGlyphElement, nullptr, defaultHorizontalAdvance, defaultVerticalAdvance, String(), boundingBox); > else { >@@ -1563,13 +1563,13 @@ bool SVGToOTFFontConverter::convertSVGToOTFFont() > return true; > } > >-std::optional<Vector<char>> convertSVGToOTFFont(const SVGFontElement& element) >+WTF::Optional<Vector<char>> convertSVGToOTFFont(const SVGFontElement& element) > { > SVGToOTFFontConverter converter(element); > if (converter.error()) >- return std::nullopt; >+ return WTF::nullopt; > if (!converter.convertSVGToOTFFont()) >- return std::nullopt; >+ return WTF::nullopt; > return converter.releaseResult(); > } > >diff --git a/Source/WebCore/svg/SVGToOTFFontConversion.h b/Source/WebCore/svg/SVGToOTFFontConversion.h >index 7756e4529b67c0e3abe27644e49095c9db581179..71cd093159a53f378fcfa60b455e4cccd1095446 100644 >--- a/Source/WebCore/svg/SVGToOTFFontConversion.h >+++ b/Source/WebCore/svg/SVGToOTFFontConversion.h >@@ -32,6 +32,6 @@ namespace WebCore { > > class SVGFontElement; > >-std::optional<Vector<char>> convertSVGToOTFFont(const SVGFontElement&); >+WTF::Optional<Vector<char>> convertSVGToOTFFont(const SVGFontElement&); > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTransformListValues.h b/Source/WebCore/svg/SVGTransformListValues.h >index 2f32951e4be5b84da389ddf6ee09dbefc3564c0e..45bfb042f3a82cc6b646d6f912f741bb36e53667 100644 >--- a/Source/WebCore/svg/SVGTransformListValues.h >+++ b/Source/WebCore/svg/SVGTransformListValues.h >@@ -50,7 +50,7 @@ template<> struct SVGPropertyTraits<SVGTransformListValues> { > values.parse(string); > return values; > } >- static std::optional<SVGTransformListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<SVGTransformListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(const SVGTransformListValues& list) { return list.valueAsString(); } > > using ListItemType = SVGTransformValue; >diff --git a/Source/WebCore/svg/properties/SVGPropertyTraits.h b/Source/WebCore/svg/properties/SVGPropertyTraits.h >index a2327e6c4cf526119249e1a6234bd67a35b88800..6031e24e69f2596a503e522b185cf4039504533e 100644 >--- a/Source/WebCore/svg/properties/SVGPropertyTraits.h >+++ b/Source/WebCore/svg/properties/SVGPropertyTraits.h >@@ -39,7 +39,7 @@ template<> > struct SVGPropertyTraits<bool> { > static bool initialValue() { return false; } > static bool fromString(const String& string) { return string == "true"; } >- static std::optional<bool> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<bool> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(bool type) { return type ? "true" : "false"; } > }; > >@@ -47,11 +47,11 @@ template<> > struct SVGPropertyTraits<Color> { > static Color initialValue() { return Color(); } > static Color fromString(const String& string) { return CSSParser::parseColor(string.stripWhiteSpace()); } >- static std::optional<Color> parse(const QualifiedName&, const String& string) >+ static WTF::Optional<Color> parse(const QualifiedName&, const String& string) > { > Color color = CSSParser::parseColor(string.stripWhiteSpace()); > if (!color.isValid()) >- return std::nullopt; >+ return WTF::nullopt; > return color; > } > static String toString(const Color& type) { return type.serialized(); } >@@ -60,7 +60,7 @@ struct SVGPropertyTraits<Color> { > template<> > struct SVGPropertyTraits<unsigned> { > static unsigned initialValue() { return 0; } >- static std::optional<unsigned> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<unsigned> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(unsigned type) { return String::number(type); } > }; > >@@ -68,7 +68,7 @@ template<> > struct SVGPropertyTraits<int> { > static int initialValue() { return 0; } > static int fromString(const String&string) { return string.toIntStrict(); } >- static std::optional<int> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<int> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(int type) { return String::number(type); } > }; > >@@ -82,7 +82,7 @@ struct SVGPropertyTraits<std::pair<int, int>> { > return { }; > return std::make_pair(static_cast<int>(roundf(firstNumber)), static_cast<int>(roundf(secondNumber))); > } >- static std::optional<std::pair<int, int>> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<std::pair<int, int>> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(std::pair<int, int>) { ASSERT_NOT_REACHED(); return emptyString(); } > }; > >@@ -96,11 +96,11 @@ struct SVGPropertyTraits<float> { > return 0; > return number; > } >- static std::optional<float> parse(const QualifiedName&, const String& string) >+ static WTF::Optional<float> parse(const QualifiedName&, const String& string) > { > float number; > if (!parseNumberFromString(string, number)) >- return std::nullopt; >+ return WTF::nullopt; > return number; > } > static String toString(float type) { return String::number(type); } >@@ -116,7 +116,7 @@ struct SVGPropertyTraits<std::pair<float, float>> { > return { }; > return std::make_pair(firstNumber, secondNumber); > } >- static std::optional<std::pair<float, float>> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } >+ static WTF::Optional<std::pair<float, float>> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); } > static String toString(std::pair<float, float>) { ASSERT_NOT_REACHED(); return emptyString(); } > }; > >@@ -130,11 +130,11 @@ struct SVGPropertyTraits<FloatPoint> { > return { }; > return point; > } >- static std::optional<FloatPoint> parse(const QualifiedName&, const String& string) >+ static WTF::Optional<FloatPoint> parse(const QualifiedName&, const String& string) > { > FloatPoint point; > if (!parsePoint(string, point)) >- return std::nullopt; >+ return WTF::nullopt; > return point; > } > static String toString(const FloatPoint& type) >@@ -157,11 +157,11 @@ struct SVGPropertyTraits<FloatRect> { > return { }; > return rect; > } >- static std::optional<FloatRect> parse(const QualifiedName&, const String& string) >+ static WTF::Optional<FloatRect> parse(const QualifiedName&, const String& string) > { > FloatRect rect; > if (!parseRect(string, rect)) >- return std::nullopt; >+ return WTF::nullopt; > return rect; > } > static String toString(const FloatRect& type) >@@ -182,7 +182,7 @@ template<> > struct SVGPropertyTraits<String> { > static String initialValue() { return String(); } > static String fromString(const String& string) { return string; } >- static std::optional<String> parse(const QualifiedName&, const String& string) { return string; } >+ static WTF::Optional<String> parse(const QualifiedName&, const String& string) { return string; } > static String toString(const String& string) { return string; } > }; > >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index c3227214ae82a344ea5c63abb13749ff2a8aa1c5..83b30f244f4df95ebe86917d3182ca1f6fe93e00 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -445,7 +445,7 @@ void Internals::resetToConsistentState(Page& page) > > page.mainFrame().setTextZoomFactor(1.0f); > >- page.setCompositingPolicyOverride(std::nullopt); >+ page.setCompositingPolicyOverride(WTF::nullopt); > > FrameView* mainFrameView = page.mainFrame().view(); > if (mainFrameView) { >@@ -497,7 +497,7 @@ void Internals::resetToConsistentState(Page& page) > #endif > > page.setShowAllPlugins(false); >- page.setLowPowerModeEnabledOverrideForTesting(std::nullopt); >+ page.setLowPowerModeEnabledOverrideForTesting(WTF::nullopt); > > #if USE(QUICK_LOOK) > MockPreviewLoaderClient::singleton().setPassword(""); >@@ -1298,14 +1298,14 @@ bool Internals::areTimersThrottled() const > return contextDocument()->isTimerThrottlingEnabled(); > } > >-void Internals::setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior> value) >+void Internals::setEventThrottlingBehaviorOverride(WTF::Optional<EventThrottlingBehavior> value) > { > Document* document = contextDocument(); > if (!document || !document->page()) > return; > > if (!value) { >- document->page()->setEventThrottlingBehaviorOverride(std::nullopt); >+ document->page()->setEventThrottlingBehaviorOverride(WTF::nullopt); > return; > } > >@@ -1319,15 +1319,15 @@ void Internals::setEventThrottlingBehaviorOverride(std::optional<EventThrottling > } > } > >-std::optional<Internals::EventThrottlingBehavior> Internals::eventThrottlingBehaviorOverride() const >+WTF::Optional<Internals::EventThrottlingBehavior> Internals::eventThrottlingBehaviorOverride() const > { > Document* document = contextDocument(); > if (!document || !document->page()) >- return std::nullopt; >+ return WTF::nullopt; > > auto behavior = document->page()->eventThrottlingBehaviorOverride(); > if (!behavior) >- return std::nullopt; >+ return WTF::nullopt; > > switch (behavior.value()) { > case WebCore::EventThrottlingBehavior::Responsive: >@@ -1336,7 +1336,7 @@ std::optional<Internals::EventThrottlingBehavior> Internals::eventThrottlingBeha > return Internals::EventThrottlingBehavior::Unresponsive; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > String Internals::visiblePlaceholder(Element& element) >@@ -3110,14 +3110,14 @@ ExceptionOr<unsigned> Internals::compositingUpdateCount() > return document->renderView()->compositor().compositingUpdateCount(); > } > >-ExceptionOr<void> Internals::setCompositingPolicyOverride(std::optional<CompositingPolicy> policyOverride) >+ExceptionOr<void> Internals::setCompositingPolicyOverride(WTF::Optional<CompositingPolicy> policyOverride) > { > Document* document = contextDocument(); > if (!document) > return Exception { InvalidAccessError }; > > if (!policyOverride) { >- document->page()->setCompositingPolicyOverride(std::nullopt); >+ document->page()->setCompositingPolicyOverride(WTF::nullopt); > return { }; > } > >@@ -3133,7 +3133,7 @@ ExceptionOr<void> Internals::setCompositingPolicyOverride(std::optional<Composit > return { }; > } > >-ExceptionOr<std::optional<Internals::CompositingPolicy>> Internals::compositingPolicyOverride() const >+ExceptionOr<WTF::Optional<Internals::CompositingPolicy>> Internals::compositingPolicyOverride() const > { > Document* document = contextDocument(); > if (!document) >@@ -3141,7 +3141,7 @@ ExceptionOr<std::optional<Internals::CompositingPolicy>> Internals::compositingP > > auto policyOverride = document->page()->compositingPolicyOverride(); > if (!policyOverride) >- return { std::nullopt }; >+ return { WTF::nullopt }; > > switch (policyOverride.value()) { > case WebCore::CompositingPolicy::Normal: >@@ -4564,7 +4564,7 @@ void Internals::videoSampleAvailable(MediaSample& sample) > m_nextTrackFramePromise->resolve(imageData.releaseReturnValue().releaseNonNull()); > else > m_nextTrackFramePromise->reject(imageData.exception().code()); >- m_nextTrackFramePromise = std::nullopt; >+ m_nextTrackFramePromise = WTF::nullopt; > } > > void Internals::delayMediaStreamTrackSamples(MediaStreamTrack& track, float delay) >@@ -4829,7 +4829,7 @@ bool Internals::supportsVCPEncoder() > #endif > } > >-std::optional<HEVCParameterSet> Internals::parseHEVCCodecParameters(const String& codecString) >+WTF::Optional<HEVCParameterSet> Internals::parseHEVCCodecParameters(const String& codecString) > { > return WebCore::parseHEVCCodecParameters(codecString); > } >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 03f474ead26a4349d666d173e47ea680ec1c743b..6852a25f7bd4bc2e874af5ffb2d7abd847d155bc 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -181,8 +181,8 @@ public: > bool areTimersThrottled() const; > > enum EventThrottlingBehavior { Responsive, Unresponsive }; >- void setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior>); >- std::optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const; >+ void setEventThrottlingBehaviorOverride(WTF::Optional<EventThrottlingBehavior>); >+ WTF::Optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const; > > // Spatial Navigation testing. > ExceptionOr<unsigned> lastSpatialNavigationCandidateCount() const; >@@ -466,8 +466,8 @@ public: > ExceptionOr<unsigned> compositingUpdateCount(); > > enum CompositingPolicy { Normal, Conservative }; >- ExceptionOr<void> setCompositingPolicyOverride(std::optional<CompositingPolicy>); >- ExceptionOr<std::optional<CompositingPolicy>> compositingPolicyOverride() const; >+ ExceptionOr<void> setCompositingPolicyOverride(WTF::Optional<CompositingPolicy>); >+ ExceptionOr<WTF::Optional<CompositingPolicy>> compositingPolicyOverride() const; > > ExceptionOr<void> updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*); > unsigned layoutCount() const; >@@ -756,7 +756,7 @@ public: > bool supportsVCPEncoder(); > > using HEVCParameterSet = WebCore::HEVCParameterSet; >- std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString); >+ WTF::Optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString); > > struct CookieData { > String name; >@@ -808,7 +808,7 @@ private: > unsigned long m_trackVideoSampleCount { 0 }; > unsigned long m_trackAudioSampleCount { 0 }; > RefPtr<MediaStreamTrack> m_track; >- std::optional<TrackFramePromise> m_nextTrackFramePromise; >+ WTF::Optional<TrackFramePromise> m_nextTrackFramePromise; > #endif > > std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend; >diff --git a/Source/WebCore/testing/MockCDMFactory.cpp b/Source/WebCore/testing/MockCDMFactory.cpp >index 34283f17302e024e8acd15cea2d7bf22372f8ed9..9b02e6ea7114bc1c9a4e615a50a65e661056b706 100644 >--- a/Source/WebCore/testing/MockCDMFactory.cpp >+++ b/Source/WebCore/testing/MockCDMFactory.cpp >@@ -219,11 +219,11 @@ RefPtr<SharedBuffer> MockCDM::sanitizeResponse(const SharedBuffer& response) con > return response.copy(); > } > >-std::optional<String> MockCDM::sanitizeSessionId(const String& sessionId) const >+WTF::Optional<String> MockCDM::sanitizeSessionId(const String& sessionId) const > { > if (equalLettersIgnoringASCIICase(sessionId, "valid-loaded-session")) > return sessionId; >- return std::nullopt; >+ return WTF::nullopt; > } > > MockCDMInstance::MockCDMInstance(WeakPtr<MockCDM> cdm) >@@ -329,18 +329,18 @@ void MockCDMInstanceSession::updateLicense(const String& sessionID, LicenseType, > { > MockCDMFactory* factory = m_instance ? m_instance->factory() : nullptr; > if (!factory) { >- callback(false, std::nullopt, std::nullopt, std::nullopt, SuccessValue::Failed); >+ callback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, SuccessValue::Failed); > return; > } > > Vector<String> responseVector = String(response.data(), response.size()).split(' '); > > if (responseVector.contains(String("invalid-format"_s))) { >- callback(false, std::nullopt, std::nullopt, std::nullopt, SuccessValue::Failed); >+ callback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, SuccessValue::Failed); > return; > } > >- std::optional<KeyStatusVector> changedKeys; >+ WTF::Optional<KeyStatusVector> changedKeys; > if (responseVector.contains(String("keys-changed"_s))) { > const auto* keys = factory->keysForSessionWithID(sessionID); > if (keys) { >@@ -356,14 +356,14 @@ void MockCDMInstanceSession::updateLicense(const String& sessionID, LicenseType, > // FIXME: Session closure, expiration and message handling should be implemented > // once the relevant algorithms are supported. > >- callback(false, WTFMove(changedKeys), std::nullopt, std::nullopt, SuccessValue::Succeeded); >+ callback(false, WTFMove(changedKeys), WTF::nullopt, WTF::nullopt, SuccessValue::Succeeded); > } > > void MockCDMInstanceSession::loadSession(LicenseType, const String&, const String&, LoadSessionCallback&& callback) > { > MockCDMFactory* factory = m_instance ? m_instance->factory() : nullptr; > if (!factory) { >- callback(std::nullopt, std::nullopt, std::nullopt, SuccessValue::Failed, SessionLoadFailure::Other); >+ callback(WTF::nullopt, WTF::nullopt, WTF::nullopt, SuccessValue::Failed, SessionLoadFailure::Other); > return; > } > >@@ -372,7 +372,7 @@ void MockCDMInstanceSession::loadSession(LicenseType, const String&, const Strin > CString messageData { "session loaded" }; > Message message { MessageType::LicenseRenewal, SharedBuffer::create(messageData.data(), messageData.length()) }; > >- callback(std::nullopt, std::nullopt, WTFMove(message), SuccessValue::Succeeded, SessionLoadFailure::None); >+ callback(WTF::nullopt, WTF::nullopt, WTFMove(message), SuccessValue::Succeeded, SessionLoadFailure::None); > } > > void MockCDMInstanceSession::closeSession(const String& sessionID, CloseSessionCallback&& callback) >@@ -391,7 +391,7 @@ void MockCDMInstanceSession::removeSessionData(const String& id, LicenseType, Re > { > MockCDMFactory* factory = m_instance ? m_instance->factory() : nullptr; > if (!factory) { >- callback({ }, std::nullopt, SuccessValue::Failed); >+ callback({ }, WTF::nullopt, SuccessValue::Failed); > return; > } > >diff --git a/Source/WebCore/testing/MockCDMFactory.h b/Source/WebCore/testing/MockCDMFactory.h >index 843a08a34264405936d636456b337da2dd9cb962..6b394e7b69b32465f9cbb603be04cbac790ac1b6 100644 >--- a/Source/WebCore/testing/MockCDMFactory.h >+++ b/Source/WebCore/testing/MockCDMFactory.h >@@ -122,7 +122,7 @@ private: > bool supportsSessions() const final; > bool supportsInitData(const AtomicString&, const SharedBuffer&) const final; > RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const final; >- std::optional<String> sanitizeSessionId(const String&) const final; >+ WTF::Optional<String> sanitizeSessionId(const String&) const final; > > WeakPtr<MockCDMFactory> m_factory; > }; >diff --git a/Source/WebCore/testing/MockPaymentCoordinator.cpp b/Source/WebCore/testing/MockPaymentCoordinator.cpp >index f56c485e444f836092725157506106eafc0423e9..3d811a869029bfc739a9c5a00b14e7c95789b857 100644 >--- a/Source/WebCore/testing/MockPaymentCoordinator.cpp >+++ b/Source/WebCore/testing/MockPaymentCoordinator.cpp >@@ -68,11 +68,11 @@ bool MockPaymentCoordinator::supportsVersion(unsigned version) > return version <= currentVersion; > } > >-std::optional<String> MockPaymentCoordinator::validatedPaymentNetwork(const String& paymentNetwork) >+WTF::Optional<String> MockPaymentCoordinator::validatedPaymentNetwork(const String& paymentNetwork) > { > auto result = m_availablePaymentNetworks.find(paymentNetwork); > if (result == m_availablePaymentNetworks.end()) >- return std::nullopt; >+ return WTF::nullopt; > return *result; > } > >@@ -152,13 +152,13 @@ void MockPaymentCoordinator::updateTotalAndLineItems(const ApplePaySessionPaymen > m_lineItems.append(convert(lineItem)); > } > >-void MockPaymentCoordinator::completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&& shippingMethodUpdate) >+void MockPaymentCoordinator::completeShippingMethodSelection(WTF::Optional<ShippingMethodUpdate>&& shippingMethodUpdate) > { > if (shippingMethodUpdate) > updateTotalAndLineItems(shippingMethodUpdate->newTotalAndLineItems); > } > >-void MockPaymentCoordinator::completeShippingContactSelection(std::optional<ShippingContactUpdate>&& shippingContactUpdate) >+void MockPaymentCoordinator::completeShippingContactSelection(WTF::Optional<ShippingContactUpdate>&& shippingContactUpdate) > { > if (!shippingContactUpdate) > return; >@@ -168,7 +168,7 @@ void MockPaymentCoordinator::completeShippingContactSelection(std::optional<Ship > m_errors = WTFMove(shippingContactUpdate->errors); > } > >-void MockPaymentCoordinator::completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&& paymentMethodUpdate) >+void MockPaymentCoordinator::completePaymentMethodSelection(WTF::Optional<PaymentMethodUpdate>&& paymentMethodUpdate) > { > if (paymentMethodUpdate) > updateTotalAndLineItems(paymentMethodUpdate->newTotalAndLineItems); >@@ -208,7 +208,7 @@ void MockPaymentCoordinator::cancelPayment() > }); > } > >-void MockPaymentCoordinator::completePaymentSession(std::optional<PaymentAuthorizationResult>&& result) >+void MockPaymentCoordinator::completePaymentSession(WTF::Optional<PaymentAuthorizationResult>&& result) > { > auto isFinalState = isFinalStateResult(result); > m_errors = WTFMove(result->errors); >diff --git a/Source/WebCore/testing/MockPaymentCoordinator.h b/Source/WebCore/testing/MockPaymentCoordinator.h >index 9b5a3e5833b51180ec5c364f4dbb3d3e60debf0a..0bce849ec960227f811abd8483f367fc1e49e646 100644 >--- a/Source/WebCore/testing/MockPaymentCoordinator.h >+++ b/Source/WebCore/testing/MockPaymentCoordinator.h >@@ -62,16 +62,16 @@ public: > > private: > bool supportsVersion(unsigned) final; >- std::optional<String> validatedPaymentNetwork(const String&) final; >+ WTF::Optional<String> validatedPaymentNetwork(const String&) final; > bool canMakePayments() final; > void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&&); > void openPaymentSetup(const String&, const String&, WTF::Function<void(bool)>&&); > bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final; > void completeMerchantValidation(const PaymentMerchantSession&) final; >- void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) final; >- void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final; >- void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) final; >- void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) final; >+ void completeShippingMethodSelection(WTF::Optional<ShippingMethodUpdate>&&) final; >+ void completeShippingContactSelection(WTF::Optional<ShippingContactUpdate>&&) final; >+ void completePaymentMethodSelection(WTF::Optional<PaymentMethodUpdate>&&) final; >+ void completePaymentSession(WTF::Optional<PaymentAuthorizationResult>&&) final; > void abortPaymentSession() final; > void cancelPaymentSession() final; > void paymentCoordinatorDestroyed() final; >diff --git a/Source/WebCore/workers/Worker.h b/Source/WebCore/workers/Worker.h >index 2dccf2062f2cdf740c0d3428a1ecfba2eb5b3bdb..2f0f05f58f2050ccdd8ec3f8e6b88a1028280325 100644 >--- a/Source/WebCore/workers/Worker.h >+++ b/Source/WebCore/workers/Worker.h >@@ -86,7 +86,7 @@ private: > String m_name; > String m_identifier; > WorkerGlobalScopeProxy& m_contextProxy; // The proxy outlives the worker to perform thread shutdown. >- std::optional<ContentSecurityPolicyResponseHeaders> m_contentSecurityPolicyResponseHeaders; >+ WTF::Optional<ContentSecurityPolicyResponseHeaders> m_contentSecurityPolicyResponseHeaders; > MonotonicTime m_workerCreationTime; > bool m_shouldBypassMainWorldContentSecurityPolicy { false }; > JSC::RuntimeFlags m_runtimeFlags; >diff --git a/Source/WebCore/workers/WorkerScriptLoader.cpp b/Source/WebCore/workers/WorkerScriptLoader.cpp >index 8db171e51f304fb79845a32e999d6648039455e1..ce281869ff511f6e563abe9670c4194c7d3205d2 100644 >--- a/Source/WebCore/workers/WorkerScriptLoader.cpp >+++ b/Source/WebCore/workers/WorkerScriptLoader.cpp >@@ -46,7 +46,7 @@ WorkerScriptLoader::WorkerScriptLoader() = default; > > WorkerScriptLoader::~WorkerScriptLoader() = default; > >-std::optional<Exception> WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecutionContext, const URL& url, FetchOptions::Mode mode, FetchOptions::Cache cachePolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, const String& initiatorIdentifier) >+WTF::Optional<Exception> WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecutionContext, const URL& url, FetchOptions::Mode mode, FetchOptions::Cache cachePolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, const String& initiatorIdentifier) > { > ASSERT(scriptExecutionContext); > auto& workerGlobalScope = downcast<WorkerGlobalScope>(*scriptExecutionContext); >@@ -62,14 +62,14 @@ std::optional<Exception> WorkerScriptLoader::loadSynchronously(ScriptExecutionCo > m_script.append(scriptResource->script); > m_responseURL = URL { URL { }, scriptResource->responseURL }; > m_responseMIMEType = scriptResource->mimeType; >- return std::nullopt; >+ return WTF::nullopt; > } > } > #endif > > std::unique_ptr<ResourceRequest> request(createResourceRequest(initiatorIdentifier)); > if (!request) >- return std::nullopt; >+ return WTF::nullopt; > > ASSERT_WITH_SECURITY_IMPLICATION(is<WorkerGlobalScope>(scriptExecutionContext)); > >@@ -103,7 +103,7 @@ std::optional<Exception> WorkerScriptLoader::loadSynchronously(ScriptExecutionCo > downcast<ServiceWorkerGlobalScope>(workerGlobalScope).setScriptResource(url, ServiceWorkerContextData::ImportedScript { script(), m_responseURL, m_responseMIMEType }); > } > #endif >- return std::nullopt; >+ return WTF::nullopt; > } > > void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext& scriptExecutionContext, ResourceRequest&& scriptRequest, FetchOptions&& fetchOptions, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, ServiceWorkersMode serviceWorkerMode, WorkerScriptLoaderClient& client) >diff --git a/Source/WebCore/workers/WorkerScriptLoader.h b/Source/WebCore/workers/WorkerScriptLoader.h >index 04a41c21cb2f7531fde619e4d67dd5644905f98d..94af661fa557d6151297e275aaac0288ef05f295 100644 >--- a/Source/WebCore/workers/WorkerScriptLoader.h >+++ b/Source/WebCore/workers/WorkerScriptLoader.h >@@ -54,7 +54,7 @@ public: > return adoptRef(*new WorkerScriptLoader); > } > >- std::optional<Exception> loadSynchronously(ScriptExecutionContext*, const URL&, FetchOptions::Mode, FetchOptions::Cache, ContentSecurityPolicyEnforcement, const String& initiatorIdentifier); >+ WTF::Optional<Exception> loadSynchronously(ScriptExecutionContext*, const URL&, FetchOptions::Mode, FetchOptions::Cache, ContentSecurityPolicyEnforcement, const String& initiatorIdentifier); > void loadAsynchronously(ScriptExecutionContext&, ResourceRequest&&, FetchOptions&&, ContentSecurityPolicyEnforcement, ServiceWorkersMode, WorkerScriptLoaderClient&); > > void notifyError(); >diff --git a/Source/WebCore/workers/service/ExtendableMessageEvent.cpp b/Source/WebCore/workers/service/ExtendableMessageEvent.cpp >index efbcab4043c0e6e8ae3510e34596cba1840956f7..d63988b2b1d3fd1de89c35231da14c4a9cd03338 100644 >--- a/Source/WebCore/workers/service/ExtendableMessageEvent.cpp >+++ b/Source/WebCore/workers/service/ExtendableMessageEvent.cpp >@@ -32,7 +32,7 @@ > > namespace WebCore { > >-Ref<ExtendableMessageEvent> ExtendableMessageEvent::create(Vector<RefPtr<MessagePort>>&& ports, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, std::optional<ExtendableMessageEventSource>&& source) >+Ref<ExtendableMessageEvent> ExtendableMessageEvent::create(Vector<RefPtr<MessagePort>>&& ports, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, WTF::Optional<ExtendableMessageEventSource>&& source) > { > return adoptRef(*new ExtendableMessageEvent(WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports))); > } >@@ -47,7 +47,7 @@ ExtendableMessageEvent::ExtendableMessageEvent(JSC::ExecState& state, const Atom > { > } > >-ExtendableMessageEvent::ExtendableMessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, std::optional<ExtendableMessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports) >+ExtendableMessageEvent::ExtendableMessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, WTF::Optional<ExtendableMessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports) > : ExtendableEvent(eventNames().messageEvent, CanBubble::No, IsCancelable::No) > , m_data(WTFMove(data)) > , m_origin(origin) >diff --git a/Source/WebCore/workers/service/ExtendableMessageEvent.h b/Source/WebCore/workers/service/ExtendableMessageEvent.h >index c0587cb85eafcec05ad14dbfddb42dbf7f16e4c9..ddf989b87a5a91dd46e7f45fa15b75b13a67148e 100644 >--- a/Source/WebCore/workers/service/ExtendableMessageEvent.h >+++ b/Source/WebCore/workers/service/ExtendableMessageEvent.h >@@ -53,7 +53,7 @@ public: > JSC::JSValue data; > String origin; > String lastEventId; >- std::optional<ExtendableMessageEventSource> source; >+ WTF::Optional<ExtendableMessageEventSource> source; > Vector<RefPtr<MessagePort>> ports; > }; > >@@ -62,26 +62,26 @@ public: > return adoptRef(*new ExtendableMessageEvent(state, type, initializer, isTrusted)); > } > >- static Ref<ExtendableMessageEvent> create(Vector<RefPtr<MessagePort>>&&, RefPtr<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, std::optional<ExtendableMessageEventSource>&& source = std::nullopt); >+ static Ref<ExtendableMessageEvent> create(Vector<RefPtr<MessagePort>>&&, RefPtr<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, WTF::Optional<ExtendableMessageEventSource>&& source = WTF::nullopt); > > ~ExtendableMessageEvent(); > > SerializedScriptValue* data() const { return m_data.get(); } > const String& origin() const { return m_origin; } > const String& lastEventId() const { return m_lastEventId; } >- const std::optional<ExtendableMessageEventSource>& source() const { return m_source; } >+ const WTF::Optional<ExtendableMessageEventSource>& source() const { return m_source; } > const Vector<RefPtr<MessagePort>>& ports() const { return m_ports; } > > EventInterface eventInterface() const final { return ExtendableMessageEventInterfaceType; } > > private: > ExtendableMessageEvent(JSC::ExecState&, const AtomicString&, const Init&, IsTrusted); >- ExtendableMessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, std::optional<ExtendableMessageEventSource>&&, Vector<RefPtr<MessagePort>>&&); >+ ExtendableMessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, WTF::Optional<ExtendableMessageEventSource>&&, Vector<RefPtr<MessagePort>>&&); > > RefPtr<SerializedScriptValue> m_data; > String m_origin; > String m_lastEventId; >- std::optional<ExtendableMessageEventSource> m_source; >+ WTF::Optional<ExtendableMessageEventSource> m_source; > Vector<RefPtr<MessagePort>> m_ports; > }; > >diff --git a/Source/WebCore/workers/service/SWClientConnection.cpp b/Source/WebCore/workers/service/SWClientConnection.cpp >index e56b05cca4d069e5e862263d0c8c558f93b2fa61..39f31ce6fdc2fcf74226734c72a6f63a92e4dd0f 100644 >--- a/Source/WebCore/workers/service/SWClientConnection.cpp >+++ b/Source/WebCore/workers/service/SWClientConnection.cpp >@@ -135,7 +135,7 @@ void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier des > container->dispatchEvent(messageEvent); > } > >-void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData) >+void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const WTF::Optional<ServiceWorkerData>& serviceWorkerData) > { > ASSERT(isMainThread()); > >diff --git a/Source/WebCore/workers/service/SWClientConnection.h b/Source/WebCore/workers/service/SWClientConnection.h >index da7e3dd64a421ad44bbc0fa4b33232b029491b0e..ad129a347a43e5c9cec2c326e03beb6a32d6582a 100644 >--- a/Source/WebCore/workers/service/SWClientConnection.h >+++ b/Source/WebCore/workers/service/SWClientConnection.h >@@ -57,7 +57,7 @@ class SWClientConnection : public ThreadSafeRefCounted<SWClientConnection> { > public: > WEBCORE_EXPORT virtual ~SWClientConnection(); > >- using RegistrationCallback = WTF::CompletionHandler<void(std::optional<ServiceWorkerRegistrationData>&&)>; >+ using RegistrationCallback = WTF::CompletionHandler<void(WTF::Optional<ServiceWorkerRegistrationData>&&)>; > virtual void matchRegistration(SecurityOriginData&& topOrigin, const URL& clientURL, RegistrationCallback&&) = 0; > > using GetRegistrationsCallback = WTF::CompletionHandler<void(Vector<ServiceWorkerRegistrationData>&&)>; >@@ -80,7 +80,7 @@ public: > virtual bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData&) const = 0; > virtual void syncTerminateWorker(ServiceWorkerIdentifier) = 0; > >- virtual void registerServiceWorkerClient(const SecurityOrigin& topOrigin, const ServiceWorkerClientData&, const std::optional<ServiceWorkerRegistrationIdentifier>&) = 0; >+ virtual void registerServiceWorkerClient(const SecurityOrigin& topOrigin, const ServiceWorkerClientData&, const WTF::Optional<ServiceWorkerRegistrationIdentifier>&) = 0; > virtual void unregisterServiceWorkerClient(DocumentIdentifier) = 0; > > virtual void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) = 0; >@@ -93,7 +93,7 @@ protected: > WEBCORE_EXPORT void unregistrationJobResolvedInServer(ServiceWorkerJobIdentifier, bool unregistrationResult); > WEBCORE_EXPORT void startScriptFetchForServer(ServiceWorkerJobIdentifier, const ServiceWorkerRegistrationKey&, FetchOptions::Cache); > WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&&, ServiceWorkerData&& source, const String& sourceOrigin); >- WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const std::optional<ServiceWorkerData>&); >+ WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const WTF::Optional<ServiceWorkerData>&); > WEBCORE_EXPORT void updateWorkerState(ServiceWorkerIdentifier, ServiceWorkerState); > WEBCORE_EXPORT void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier); > WEBCORE_EXPORT void setRegistrationLastUpdateTime(ServiceWorkerRegistrationIdentifier, WallTime); >diff --git a/Source/WebCore/workers/service/ServiceWorkerClientData.h b/Source/WebCore/workers/service/ServiceWorkerClientData.h >index f991f32ce6d3a9b257a5612b46365a679ae2d17d..653278eba80ab31ce6610e0e117b563457eee010 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerClientData.h >+++ b/Source/WebCore/workers/service/ServiceWorkerClientData.h >@@ -48,7 +48,7 @@ struct ServiceWorkerClientData { > static ServiceWorkerClientData from(ScriptExecutionContext&, SWClientConnection&); > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerClientData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerClientData> decode(Decoder&); > }; > > template<class Encoder> >@@ -58,27 +58,27 @@ void ServiceWorkerClientData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerClientData> ServiceWorkerClientData::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerClientData> ServiceWorkerClientData::decode(Decoder& decoder) > { >- std::optional<ServiceWorkerClientIdentifier> identifier; >+ WTF::Optional<ServiceWorkerClientIdentifier> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerClientType> type; >+ WTF::Optional<ServiceWorkerClientType> type; > decoder >> type; > if (!type) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerClientFrameType> frameType; >+ WTF::Optional<ServiceWorkerClientFrameType> frameType; > decoder >> frameType; > if (!frameType) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<URL> url; >+ WTF::Optional<URL> url; > decoder >> url; > if (!url) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*identifier), WTFMove(*type), WTFMove(*frameType), WTFMove(*url) } }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h b/Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h >index 0d0e92eb325f5555120de93d8a65f517a19bd710..0ce40b4635c8c7e9ffcc3d41d17d870311b90b0b 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h >+++ b/Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h >@@ -40,10 +40,10 @@ struct ServiceWorkerClientIdentifier { > unsigned hash() const; > > String toString() const { return String::number(serverConnectionIdentifier.toUInt64()) + "-" + String::number(contextIdentifier.toUInt64()); } >- static std::optional<ServiceWorkerClientIdentifier> fromString(StringView); >+ static WTF::Optional<ServiceWorkerClientIdentifier> fromString(StringView); > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerClientIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerClientIdentifier> decode(Decoder&); > }; > > inline bool operator==(const ServiceWorkerClientIdentifier& a, const ServiceWorkerClientIdentifier& b) >@@ -51,7 +51,7 @@ inline bool operator==(const ServiceWorkerClientIdentifier& a, const ServiceWork > return a.serverConnectionIdentifier == b.serverConnectionIdentifier && a.contextIdentifier == b.contextIdentifier; > } > >-inline std::optional<ServiceWorkerClientIdentifier> ServiceWorkerClientIdentifier::fromString(StringView string) >+inline WTF::Optional<ServiceWorkerClientIdentifier> ServiceWorkerClientIdentifier::fromString(StringView string) > { > ServiceWorkerClientIdentifier clientIdentifier; > >@@ -59,13 +59,13 @@ inline std::optional<ServiceWorkerClientIdentifier> ServiceWorkerClientIdentifie > for (auto item : string.split('-')) { > auto identifier = item.toUInt64Strict(); > if (!identifier || !*identifier) >- return std::nullopt; >+ return WTF::nullopt; > if (!counter++) > clientIdentifier.serverConnectionIdentifier = makeObjectIdentifier<SWServerConnectionIdentifierType>(identifier.value()); > else if (counter == 2) > clientIdentifier.contextIdentifier = makeObjectIdentifier<DocumentIdentifierType>(identifier.value()); > } >- return (counter == 2) ? std::make_optional(WTFMove(clientIdentifier)) : std::nullopt; >+ return (counter == 2) ? WTF::makeOptional(WTFMove(clientIdentifier)) : WTF::nullopt; > } > > template<class Encoder> >@@ -75,17 +75,17 @@ void ServiceWorkerClientIdentifier::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerClientIdentifier> ServiceWorkerClientIdentifier::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerClientIdentifier> ServiceWorkerClientIdentifier::decode(Decoder& decoder) > { >- std::optional<SWServerConnectionIdentifier> serverConnectionIdentifier; >+ WTF::Optional<SWServerConnectionIdentifier> serverConnectionIdentifier; > decoder >> serverConnectionIdentifier; > if (!serverConnectionIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<DocumentIdentifier> contextIdentifier; >+ WTF::Optional<DocumentIdentifier> contextIdentifier; > decoder >> contextIdentifier; > if (!contextIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*serverConnectionIdentifier), WTFMove(*contextIdentifier) } }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerClientQueryOptions.h b/Source/WebCore/workers/service/ServiceWorkerClientQueryOptions.h >index 14aaef6c97cfef84d0add526e609a7410d020893..b9ff2ba2a94a4b5566893a8d05df1db677625349 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerClientQueryOptions.h >+++ b/Source/WebCore/workers/service/ServiceWorkerClientQueryOptions.h >@@ -36,7 +36,7 @@ struct ServiceWorkerClientQueryOptions { > ServiceWorkerClientType type { ServiceWorkerClientType::Window }; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerClientQueryOptions> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerClientQueryOptions> decode(Decoder&); > }; > > template<class Encoder> >@@ -46,17 +46,17 @@ void ServiceWorkerClientQueryOptions::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerClientQueryOptions> ServiceWorkerClientQueryOptions::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerClientQueryOptions> ServiceWorkerClientQueryOptions::decode(Decoder& decoder) > { >- std::optional<bool> includeUncontrolled; >+ WTF::Optional<bool> includeUncontrolled; > decoder >> includeUncontrolled; > if (!includeUncontrolled) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerClientType> type; >+ WTF::Optional<ServiceWorkerClientType> type; > decoder >> type; > if (!type) >- return std::nullopt; >+ return WTF::nullopt; > > return { { *includeUncontrolled, *type } }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerClients.cpp b/Source/WebCore/workers/service/ServiceWorkerClients.cpp >index 9652bd07b12514aa5dc5b64a38f017b685a80a3c..a0843d65317e9fd40ae65a5e5b93012437749502 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerClients.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerClients.cpp >@@ -34,7 +34,7 @@ > > namespace WebCore { > >-static inline void didFinishGetRequest(ServiceWorkerGlobalScope& scope, DeferredPromise& promise, ExceptionOr<std::optional<ServiceWorkerClientData>>&& clientData) >+static inline void didFinishGetRequest(ServiceWorkerGlobalScope& scope, DeferredPromise& promise, ExceptionOr<WTF::Optional<ServiceWorkerClientData>>&& clientData) > { > if (clientData.hasException()) { > promise.reject(clientData.releaseException()); >diff --git a/Source/WebCore/workers/service/ServiceWorkerContainer.cpp b/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >index 0ef9bf3503135101fac5f9fad959387eab91a27f..11ea0b803760a1043131e60ac71af93aade3b5aa 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >@@ -284,7 +284,7 @@ void ServiceWorkerContainer::getRegistration(const String& clientURL, Ref<Deferr > }); > } > >-void ServiceWorkerContainer::didFinishGetRegistrationRequest(uint64_t pendingPromiseIdentifier, std::optional<ServiceWorkerRegistrationData>&& result) >+void ServiceWorkerContainer::didFinishGetRegistrationRequest(uint64_t pendingPromiseIdentifier, WTF::Optional<ServiceWorkerRegistrationData>&& result) > { > #ifndef NDEBUG > ASSERT(m_creationThread.ptr() == &Thread::current()); >@@ -308,7 +308,7 @@ void ServiceWorkerContainer::didFinishGetRegistrationRequest(uint64_t pendingPro > pendingPromise->promise->resolve<IDLInterface<ServiceWorkerRegistration>>(WTFMove(registration)); > } > >-void ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData) >+void ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const WTF::Optional<ServiceWorkerData>& serviceWorkerData) > { > auto* context = scriptExecutionContext(); > if (!context) >@@ -532,7 +532,7 @@ void ServiceWorkerContainer::jobFinishedLoadingScript(ServiceWorkerJob& job, con > }); > } > >-void ServiceWorkerContainer::jobFailedLoadingScript(ServiceWorkerJob& job, const ResourceError& error, std::optional<Exception>&& exception) >+void ServiceWorkerContainer::jobFailedLoadingScript(ServiceWorkerJob& job, const ResourceError& error, WTF::Optional<Exception>&& exception) > { > #ifndef NDEBUG > ASSERT(m_creationThread.ptr() == &Thread::current()); >diff --git a/Source/WebCore/workers/service/ServiceWorkerContainer.h b/Source/WebCore/workers/service/ServiceWorkerContainer.h >index 9b77454ea4edcdd4a9d52dd9c54f83a85eb547e7..58a3aac207e24ff7ea6cfc95ce3e57fe7ddf0fee 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerContainer.h >+++ b/Source/WebCore/workers/service/ServiceWorkerContainer.h >@@ -66,7 +66,7 @@ public: > void updateRegistration(const URL& scopeURL, const URL& scriptURL, WorkerType, RefPtr<DeferredPromise>&&); > > void getRegistration(const String& clientURL, Ref<DeferredPromise>&&); >- void scheduleTaskToUpdateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const std::optional<ServiceWorkerData>&); >+ void scheduleTaskToUpdateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const WTF::Optional<ServiceWorkerData>&); > void scheduleTaskToFireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier); > void scheduleTaskToFireControllerChangeEvent(); > >@@ -96,11 +96,11 @@ private: > void jobResolvedWithUnregistrationResult(ServiceWorkerJob&, bool unregistrationResult) final; > void startScriptFetchForJob(ServiceWorkerJob&, FetchOptions::Cache) final; > void jobFinishedLoadingScript(ServiceWorkerJob&, const String& script, const ContentSecurityPolicyResponseHeaders&) final; >- void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&, std::optional<Exception>&&) final; >+ void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&, WTF::Optional<Exception>&&) final; > > void jobDidFinish(ServiceWorkerJob&); > >- void didFinishGetRegistrationRequest(uint64_t requestIdentifier, std::optional<ServiceWorkerRegistrationData>&&); >+ void didFinishGetRegistrationRequest(uint64_t requestIdentifier, WTF::Optional<ServiceWorkerRegistrationData>&&); > void didFinishGetRegistrationsRequest(uint64_t requestIdentifier, Vector<ServiceWorkerRegistrationData>&&); > > SWServerConnectionIdentifier connectionIdentifier() final; >diff --git a/Source/WebCore/workers/service/ServiceWorkerContextData.h b/Source/WebCore/workers/service/ServiceWorkerContextData.h >index 4d620889f934a7efa260b3209b4e176b02ab0d20..67cfd8bf0a41ff974b4e655c1be299af80f067da 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerContextData.h >+++ b/Source/WebCore/workers/service/ServiceWorkerContextData.h >@@ -70,7 +70,7 @@ struct ServiceWorkerContextData { > } > }; > >- std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier; >+ WTF::Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier; > ServiceWorkerRegistrationData registration; > ServiceWorkerIdentifier serviceWorkerIdentifier; > String script; >@@ -82,7 +82,7 @@ struct ServiceWorkerContextData { > HashMap<URL, ImportedScript> scriptResourceMap; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerContextData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerContextData> decode(Decoder&); > > ServiceWorkerContextData isolatedCopy() const; > }; >@@ -95,49 +95,49 @@ void ServiceWorkerContextData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerContextData> ServiceWorkerContextData::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerContextData> ServiceWorkerContextData::decode(Decoder& decoder) > { >- std::optional<std::optional<ServiceWorkerJobDataIdentifier>> jobDataIdentifier; >+ WTF::Optional<WTF::Optional<ServiceWorkerJobDataIdentifier>> jobDataIdentifier; > decoder >> jobDataIdentifier; > if (!jobDataIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerRegistrationData> registration; >+ WTF::Optional<ServiceWorkerRegistrationData> registration; > decoder >> registration; > if (!registration) >- return std::nullopt; >+ return WTF::nullopt; > > auto serviceWorkerIdentifier = ServiceWorkerIdentifier::decode(decoder); > if (!serviceWorkerIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > String script; > if (!decoder.decode(script)) >- return std::nullopt; >+ return WTF::nullopt; > > ContentSecurityPolicyResponseHeaders contentSecurityPolicy; > if (!decoder.decode(contentSecurityPolicy)) >- return std::nullopt; >+ return WTF::nullopt; > > URL scriptURL; > if (!decoder.decode(scriptURL)) >- return std::nullopt; >+ return WTF::nullopt; > > WorkerType workerType; > if (!decoder.decodeEnum(workerType)) >- return std::nullopt; >+ return WTF::nullopt; > > PAL::SessionID sessionID; > if (!decoder.decode(sessionID)) >- return std::nullopt; >+ return WTF::nullopt; > > bool loadedFromDisk; > if (!decoder.decode(loadedFromDisk)) >- return std::nullopt; >+ return WTF::nullopt; > > HashMap<URL, ImportedScript> scriptResourceMap; > if (!decoder.decode(scriptResourceMap)) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*jobDataIdentifier), WTFMove(*registration), WTFMove(*serviceWorkerIdentifier), WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(scriptURL), workerType, sessionID, loadedFromDisk, WTFMove(scriptResourceMap) }}; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerData.h b/Source/WebCore/workers/service/ServiceWorkerData.h >index ce361d3f3d0f3873a86dc8a938baf03f1d164a58..c47ab52ea186ee1e64fe73721c03fef127d73878 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerData.h >+++ b/Source/WebCore/workers/service/ServiceWorkerData.h >@@ -44,7 +44,7 @@ struct ServiceWorkerData { > ServiceWorkerData isolatedCopy() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerData> decode(Decoder&); > }; > > template<class Encoder> >@@ -54,32 +54,32 @@ void ServiceWorkerData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerData> ServiceWorkerData::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerData> ServiceWorkerData::decode(Decoder& decoder) > { >- std::optional<ServiceWorkerIdentifier> identifier; >+ WTF::Optional<ServiceWorkerIdentifier> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<URL> scriptURL; >+ WTF::Optional<URL> scriptURL; > decoder >> scriptURL; > if (!scriptURL) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerState> state; >+ WTF::Optional<ServiceWorkerState> state; > decoder >> state; > if (!state) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WorkerType> type; >+ WTF::Optional<WorkerType> type; > decoder >> type; > if (!type) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerRegistrationIdentifier> registrationIdentifier; >+ WTF::Optional<ServiceWorkerRegistrationIdentifier> registrationIdentifier; > decoder >> registrationIdentifier; > if (!registrationIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*identifier), WTFMove(*scriptURL), WTFMove(*state), WTFMove(*type), WTFMove(*registrationIdentifier) } }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerFetchResult.h b/Source/WebCore/workers/service/ServiceWorkerFetchResult.h >index e0a599976192d8b34d48faea9a9ed2770a3faee4..0892062a763e633572d5a6ce3f07cbd350a11da8 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerFetchResult.h >+++ b/Source/WebCore/workers/service/ServiceWorkerFetchResult.h >@@ -54,7 +54,7 @@ void ServiceWorkerFetchResult::encode(Encoder& encoder) const > template<class Decoder> > bool ServiceWorkerFetchResult::decode(Decoder& decoder, ServiceWorkerFetchResult& result) > { >- std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier; >+ WTF::Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier; > decoder >> jobDataIdentifier; > if (!jobDataIdentifier) > return false; >diff --git a/Source/WebCore/workers/service/ServiceWorkerJob.cpp b/Source/WebCore/workers/service/ServiceWorkerJob.cpp >index 488b857fb6bd35b63a142e7450e29742b80a67c2..bbacdc01fbc484f66d13998ed905501ff6c8bd74 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerJob.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerJob.cpp >@@ -150,7 +150,7 @@ void ServiceWorkerJob::notifyFinished() > else { > auto& error = m_scriptLoader->error(); > ASSERT(!error.isNull()); >- m_client->jobFailedLoadingScript(*this, error, std::nullopt); >+ m_client->jobFailedLoadingScript(*this, error, WTF::nullopt); > } > > m_scriptLoader = nullptr; >diff --git a/Source/WebCore/workers/service/ServiceWorkerJobClient.h b/Source/WebCore/workers/service/ServiceWorkerJobClient.h >index 6737ecaf1ec2df1ed5fbcbec6eb398bd73f0feaa..56b5fa81cd893a59e3faf19d105ccb23e7de70d1 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerJobClient.h >+++ b/Source/WebCore/workers/service/ServiceWorkerJobClient.h >@@ -50,7 +50,7 @@ public: > virtual void jobResolvedWithUnregistrationResult(ServiceWorkerJob&, bool unregistrationResult) = 0; > virtual void startScriptFetchForJob(ServiceWorkerJob&, FetchOptions::Cache) = 0; > virtual void jobFinishedLoadingScript(ServiceWorkerJob&, const String& script, const ContentSecurityPolicyResponseHeaders&) = 0; >- virtual void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&, std::optional<Exception>&&) = 0; >+ virtual void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&, WTF::Optional<Exception>&&) = 0; > > virtual SWServerConnectionIdentifier connectionIdentifier() = 0; > >diff --git a/Source/WebCore/workers/service/ServiceWorkerJobData.h b/Source/WebCore/workers/service/ServiceWorkerJobData.h >index 93c2df6ff0d2f398e841268be19664f7a9ce64fc..54e1ed162b2de58e4427379461dab305ae3af437 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerJobData.h >+++ b/Source/WebCore/workers/service/ServiceWorkerJobData.h >@@ -60,7 +60,7 @@ struct ServiceWorkerJobData { > ServiceWorkerJobData isolatedCopy() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerJobData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerJobData> decode(Decoder&); > > private: > WEBCORE_EXPORT explicit ServiceWorkerJobData(const Identifier&); >@@ -84,39 +84,39 @@ void ServiceWorkerJobData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerJobData> ServiceWorkerJobData::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerJobData> ServiceWorkerJobData::decode(Decoder& decoder) > { >- std::optional<ServiceWorkerJobDataIdentifier> identifier; >+ WTF::Optional<ServiceWorkerJobDataIdentifier> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > > ServiceWorkerJobData jobData { WTFMove(*identifier) }; > > if (!decoder.decode(jobData.scriptURL)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(jobData.clientCreationURL)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<SecurityOriginData> topOrigin; >+ WTF::Optional<SecurityOriginData> topOrigin; > decoder >> topOrigin; > if (!topOrigin) >- return std::nullopt; >+ return WTF::nullopt; > jobData.topOrigin = WTFMove(*topOrigin); > > if (!decoder.decode(jobData.scopeURL)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(jobData.sourceContext)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decodeEnum(jobData.type)) >- return std::nullopt; >+ return WTF::nullopt; > > switch (jobData.type) { > case ServiceWorkerJobType::Register: { >- std::optional<ServiceWorkerRegistrationOptions> registrationOptions; >+ WTF::Optional<ServiceWorkerRegistrationOptions> registrationOptions; > decoder >> registrationOptions; > if (!registrationOptions) >- return std::nullopt; >+ return WTF::nullopt; > jobData.registrationOptions = WTFMove(*registrationOptions); > break; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerJobDataIdentifier.h b/Source/WebCore/workers/service/ServiceWorkerJobDataIdentifier.h >index 725a83ac210affb129c0e586186e19be2d078152..bdad5b22abf38c15b3f586ba1bb967baee7783eb 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerJobDataIdentifier.h >+++ b/Source/WebCore/workers/service/ServiceWorkerJobDataIdentifier.h >@@ -41,7 +41,7 @@ struct ServiceWorkerJobDataIdentifier { > } > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerJobDataIdentifier> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerJobDataIdentifier> decode(Decoder&); > }; > > inline bool operator==(const ServiceWorkerJobDataIdentifier& a, const ServiceWorkerJobDataIdentifier& b) >@@ -56,17 +56,17 @@ void ServiceWorkerJobDataIdentifier::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerJobDataIdentifier> ServiceWorkerJobDataIdentifier::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerJobDataIdentifier> ServiceWorkerJobDataIdentifier::decode(Decoder& decoder) > { >- std::optional<SWServerConnectionIdentifier> connectionIdentifier; >+ WTF::Optional<SWServerConnectionIdentifier> connectionIdentifier; > decoder >> connectionIdentifier; > if (!connectionIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerJobIdentifier> jobIdentifier; >+ WTF::Optional<ServiceWorkerJobIdentifier> jobIdentifier; > decoder >> jobIdentifier; > if (!jobIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*connectionIdentifier), WTFMove(*jobIdentifier) } }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp b/Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp >index 0ca5850b5cced517d436cb780aecdedf0978322c..0c809e64d2f5d3e007f5c74e48886d4b40732e70 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp >@@ -38,9 +38,9 @@ ServiceWorkerRegistrationData ServiceWorkerRegistrationData::isolatedCopy() cons > scopeURL.isolatedCopy(), > updateViaCache, > lastUpdateTime, >- installingWorker ? std::optional<ServiceWorkerData>(installingWorker->isolatedCopy()) : std::nullopt, >- waitingWorker ? std::optional<ServiceWorkerData>(waitingWorker->isolatedCopy()) : std::nullopt, >- activeWorker ? std::optional<ServiceWorkerData>(activeWorker->isolatedCopy()) : std::nullopt, >+ installingWorker ? WTF::Optional<ServiceWorkerData>(installingWorker->isolatedCopy()) : WTF::nullopt, >+ waitingWorker ? WTF::Optional<ServiceWorkerData>(waitingWorker->isolatedCopy()) : WTF::nullopt, >+ activeWorker ? WTF::Optional<ServiceWorkerData>(activeWorker->isolatedCopy()) : WTF::nullopt, > }; > } > >diff --git a/Source/WebCore/workers/service/ServiceWorkerRegistrationData.h b/Source/WebCore/workers/service/ServiceWorkerRegistrationData.h >index 3ff4049f52d4b3137e2a47cdd2314e77693b8c9a..b0a9a932da92a59784d9bbac8779caf8e8e7aa45 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerRegistrationData.h >+++ b/Source/WebCore/workers/service/ServiceWorkerRegistrationData.h >@@ -45,14 +45,14 @@ struct ServiceWorkerRegistrationData { > ServiceWorkerUpdateViaCache updateViaCache; > WallTime lastUpdateTime; > >- std::optional<ServiceWorkerData> installingWorker; >- std::optional<ServiceWorkerData> waitingWorker; >- std::optional<ServiceWorkerData> activeWorker; >+ WTF::Optional<ServiceWorkerData> installingWorker; >+ WTF::Optional<ServiceWorkerData> waitingWorker; >+ WTF::Optional<ServiceWorkerData> activeWorker; > > ServiceWorkerRegistrationData isolatedCopy() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerRegistrationData> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerRegistrationData> decode(Decoder&); > }; > > >@@ -63,47 +63,47 @@ void ServiceWorkerRegistrationData::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerRegistrationData> ServiceWorkerRegistrationData::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerRegistrationData> ServiceWorkerRegistrationData::decode(Decoder& decoder) > { >- std::optional<ServiceWorkerRegistrationKey> key; >+ WTF::Optional<ServiceWorkerRegistrationKey> key; > decoder >> key; > if (!key) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerRegistrationIdentifier> identifier; >+ WTF::Optional<ServiceWorkerRegistrationIdentifier> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<URL> scopeURL; >+ WTF::Optional<URL> scopeURL; > decoder >> scopeURL; > if (!scopeURL) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerUpdateViaCache> updateViaCache; >+ WTF::Optional<ServiceWorkerUpdateViaCache> updateViaCache; > decoder >> updateViaCache; > if (!updateViaCache) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<double> rawWallTime; >+ WTF::Optional<double> rawWallTime; > decoder >> rawWallTime; > if (!rawWallTime) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<ServiceWorkerData>> installingWorker; >+ WTF::Optional<WTF::Optional<ServiceWorkerData>> installingWorker; > decoder >> installingWorker; > if (!installingWorker) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<ServiceWorkerData>> waitingWorker; >+ WTF::Optional<WTF::Optional<ServiceWorkerData>> waitingWorker; > decoder >> waitingWorker; > if (!waitingWorker) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<ServiceWorkerData>> activeWorker; >+ WTF::Optional<WTF::Optional<ServiceWorkerData>> activeWorker; > decoder >> activeWorker; > if (!activeWorker) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*key), WTFMove(*identifier), WTFMove(*scopeURL), WTFMove(*updateViaCache), WallTime::fromRawSeconds(*rawWallTime), WTFMove(*installingWorker), WTFMove(*waitingWorker), WTFMove(*activeWorker) } }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp b/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp >index bc297da66f53f4b7b851870456ffbcab3da0b6b2..c21132ef3960145ecfa627b6be8eb5aa1fd0d9b4 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp >@@ -94,16 +94,16 @@ String ServiceWorkerRegistrationKey::toDatabaseKey() const > return makeString(m_topOrigin.protocol, separatorCharacter, m_topOrigin.host, separatorCharacter, separatorCharacter, m_scope.string()); > } > >-std::optional<ServiceWorkerRegistrationKey> ServiceWorkerRegistrationKey::fromDatabaseKey(const String& key) >+WTF::Optional<ServiceWorkerRegistrationKey> ServiceWorkerRegistrationKey::fromDatabaseKey(const String& key) > { > auto first = key.find(separatorCharacter, 0); > auto second = key.find(separatorCharacter, first + 1); > auto third = key.find(separatorCharacter, second + 1); > > if (first == second || second == third) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint16_t> shortPort; >+ WTF::Optional<uint16_t> shortPort; > > // If there's a gap between third and second, we expect to have a port to decode > if (third - second > 1) { >@@ -115,17 +115,17 @@ std::optional<ServiceWorkerRegistrationKey> ServiceWorkerRegistrationKey::fromDa > port = charactersToUIntStrict(key.characters16() + second + 1, third - second - 1, &ok); > > if (!ok) >- return std::nullopt; >+ return WTF::nullopt; > > if (port > std::numeric_limits<uint16_t>::max()) >- return std::nullopt; >+ return WTF::nullopt; > > shortPort = static_cast<uint16_t>(port); > } > > auto scope = URL { URL(), key.substring(third + 1) }; > if (!scope.isValid()) >- return std::nullopt; >+ return WTF::nullopt; > > return ServiceWorkerRegistrationKey { { key.substring(0, first), key.substring(first + 1, second - first - 1), shortPort }, WTFMove(scope) }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h b/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h >index eb9d7fa0148dae4108104b9fbcf49d7d95228c48..9faf0a60ea535fadfe36d070ea40f2b793384ef5 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h >+++ b/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h >@@ -54,10 +54,10 @@ public: > ServiceWorkerRegistrationKey isolatedCopy() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerRegistrationKey> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerRegistrationKey> decode(Decoder&); > > String toDatabaseKey() const; >- static std::optional<ServiceWorkerRegistrationKey> fromDatabaseKey(const String&); >+ static WTF::Optional<ServiceWorkerRegistrationKey> fromDatabaseKey(const String&); > > #if !LOG_DISABLED > String loggingString() const; >@@ -75,16 +75,16 @@ void ServiceWorkerRegistrationKey::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerRegistrationKey> ServiceWorkerRegistrationKey::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerRegistrationKey> ServiceWorkerRegistrationKey::decode(Decoder& decoder) > { >- std::optional<SecurityOriginData> topOrigin; >+ WTF::Optional<SecurityOriginData> topOrigin; > decoder >> topOrigin; > if (!topOrigin) >- return std::nullopt; >+ return WTF::nullopt; > > URL scope; > if (!decoder.decode(scope)) >- return std::nullopt; >+ return WTF::nullopt; > > return ServiceWorkerRegistrationKey { WTFMove(*topOrigin), WTFMove(scope) }; > } >diff --git a/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h b/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h >index 09a245ded8ef7f4adffcd632cbd7bd603897c8af..780b0b6926cb67e5e3cfdebae6886bb1df069fe0 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h >+++ b/Source/WebCore/workers/service/ServiceWorkerRegistrationOptions.h >@@ -42,7 +42,7 @@ struct ServiceWorkerRegistrationOptions { > ServiceWorkerRegistrationOptions isolatedCopy() const; > > template<class Encoder> void encode(Encoder&) const; >- template<class Decoder> static std::optional<ServiceWorkerRegistrationOptions> decode(Decoder&); >+ template<class Decoder> static WTF::Optional<ServiceWorkerRegistrationOptions> decode(Decoder&); > }; > > template<class Encoder> >@@ -52,22 +52,22 @@ void ServiceWorkerRegistrationOptions::encode(Encoder& encoder) const > } > > template<class Decoder> >-std::optional<ServiceWorkerRegistrationOptions> ServiceWorkerRegistrationOptions::decode(Decoder& decoder) >+WTF::Optional<ServiceWorkerRegistrationOptions> ServiceWorkerRegistrationOptions::decode(Decoder& decoder) > { >- std::optional<String> scope; >+ WTF::Optional<String> scope; > decoder >> scope; > if (!scope) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WorkerType> type; >+ WTF::Optional<WorkerType> type; > decoder >> type; > if (!type) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ServiceWorkerUpdateViaCache> updateViaCache; >+ WTF::Optional<ServiceWorkerUpdateViaCache> updateViaCache; > decoder >> updateViaCache; > if (!updateViaCache) >- return std::nullopt; >+ return WTF::nullopt; > > return ServiceWorkerRegistrationOptions { WTFMove(*scope), WTFMove(*type), WTFMove(*updateViaCache) }; > } >diff --git a/Source/WebCore/workers/service/context/SWContextManager.cpp b/Source/WebCore/workers/service/context/SWContextManager.cpp >index 61eebe3d1666072484696162a2a6fecb69d9a8ac..24d6a8d664ad46cd801b181d9404f451cbc9b029 100644 >--- a/Source/WebCore/workers/service/context/SWContextManager.cpp >+++ b/Source/WebCore/workers/service/context/SWContextManager.cpp >@@ -64,7 +64,7 @@ void SWContextManager::registerServiceWorkerThreadForInstall(Ref<ServiceWorkerTh > }); > } > >-void SWContextManager::startedServiceWorker(std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage) >+void SWContextManager::startedServiceWorker(WTF::Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage) > { > connection()->serviceWorkerStartedWithMessage(jobDataIdentifier, serviceWorkerIdentifier, exceptionMessage); > if (m_serviceWorkerCreationCallback) >diff --git a/Source/WebCore/workers/service/context/SWContextManager.h b/Source/WebCore/workers/service/context/SWContextManager.h >index b7b52e6b4e5ab66c334fb321b6aa430473d3347c..8a2041e6251001d9bf2565a466a3320694d3d8d3 100644 >--- a/Source/WebCore/workers/service/context/SWContextManager.h >+++ b/Source/WebCore/workers/service/context/SWContextManager.h >@@ -49,15 +49,15 @@ public: > virtual ~Connection() { } > > virtual void postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&&, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0; >- virtual void serviceWorkerStartedWithMessage(std::optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage) = 0; >- virtual void didFinishInstall(std::optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, bool wasSuccessful) = 0; >+ virtual void serviceWorkerStartedWithMessage(WTF::Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage) = 0; >+ virtual void didFinishInstall(WTF::Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, bool wasSuccessful) = 0; > virtual void didFinishActivation(ServiceWorkerIdentifier) = 0; > virtual void setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier, bool) = 0; > virtual void workerTerminated(ServiceWorkerIdentifier) = 0; > virtual void skipWaiting(ServiceWorkerIdentifier, Function<void()>&&) = 0; > virtual void setScriptResource(ServiceWorkerIdentifier, const URL&, const ServiceWorkerContextData::ImportedScript&) = 0; > >- using FindClientByIdentifierCallback = CompletionHandler<void(ExceptionOr<std::optional<ServiceWorkerClientData>>&&)>; >+ using FindClientByIdentifierCallback = CompletionHandler<void(ExceptionOr<WTF::Optional<ServiceWorkerClientData>>&&)>; > virtual void findClientByIdentifier(ServiceWorkerIdentifier, ServiceWorkerClientIdentifier, FindClientByIdentifierCallback&&) = 0; > virtual void matchAll(ServiceWorkerIdentifier, const ServiceWorkerClientQueryOptions&, ServiceWorkerClientsMatchAllCallback&&) = 0; > virtual void claim(ServiceWorkerIdentifier, CompletionHandler<void()>&&) = 0; >@@ -85,7 +85,7 @@ public: > private: > SWContextManager() = default; > >- void startedServiceWorker(std::optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage); >+ void startedServiceWorker(WTF::Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage); > void serviceWorkerFailedToTerminate(ServiceWorkerIdentifier); > > HashMap<ServiceWorkerIdentifier, RefPtr<ServiceWorkerThreadProxy>> m_workerMap; >diff --git a/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp b/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp >index 7e5a60db045689a5f686f2e77fef60fa5149a789..73ed37aac072b9a4f0cd2a8d7fbd3ed405aa0544 100644 >--- a/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp >+++ b/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp >@@ -84,7 +84,7 @@ static void processResponse(Ref<Client>&& client, Expected<Ref<FetchResponse>, R > }); > } > >-void dispatchFetchEvent(Ref<Client>&& client, ServiceWorkerGlobalScope& globalScope, std::optional<ServiceWorkerClientIdentifier> clientId, ResourceRequest&& request, String&& referrer, FetchOptions&& options) >+void dispatchFetchEvent(Ref<Client>&& client, ServiceWorkerGlobalScope& globalScope, WTF::Optional<ServiceWorkerClientIdentifier> clientId, ResourceRequest&& request, String&& referrer, FetchOptions&& options) > { > auto requestHeaders = FetchHeaders::create(FetchHeaders::Guard::Immutable, HTTPHeaderMap { request.httpHeaderFields() }); > >@@ -96,7 +96,7 @@ void dispatchFetchEvent(Ref<Client>&& client, ServiceWorkerGlobalScope& globalSc > ASSERT(globalScope.registration().active()->state() == ServiceWorkerState::Activated); > > auto* formData = request.httpBody(); >- std::optional<FetchBody> body; >+ WTF::Optional<FetchBody> body; > if (formData && !formData->isEmpty()) { > body = FetchBody::fromFormData(*formData); > if (!body) { >diff --git a/Source/WebCore/workers/service/context/ServiceWorkerFetch.h b/Source/WebCore/workers/service/context/ServiceWorkerFetch.h >index 861228ce2f241802ab71258db5b1e7274a9c0251..e33c4dc0f2332b216b235fef6f0b7959636f64e8 100644 >--- a/Source/WebCore/workers/service/context/ServiceWorkerFetch.h >+++ b/Source/WebCore/workers/service/context/ServiceWorkerFetch.h >@@ -57,7 +57,7 @@ public: > virtual void cancel() = 0; > }; > >-void dispatchFetchEvent(Ref<Client>&&, ServiceWorkerGlobalScope&, std::optional<ServiceWorkerClientIdentifier>, ResourceRequest&&, String&& referrer, FetchOptions&&); >+void dispatchFetchEvent(Ref<Client>&&, ServiceWorkerGlobalScope&, WTF::Optional<ServiceWorkerClientIdentifier>, ResourceRequest&&, String&& referrer, FetchOptions&&); > }; > > } // namespace WebCore >diff --git a/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp b/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp >index 51760aa79678d2b7ba6f771c622206be03f5de6d..8fbeed3c0fdf1dbaccf07263d0eb3d3e7405a487 100644 >--- a/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp >+++ b/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp >@@ -93,7 +93,7 @@ void ServiceWorkerThread::runEventLoop() > WorkerThread::runEventLoop(); > } > >-void ServiceWorkerThread::postFetchTask(Ref<ServiceWorkerFetch::Client>&& client, std::optional<ServiceWorkerClientIdentifier>&& clientId, ResourceRequest&& request, String&& referrer, FetchOptions&& options) >+void ServiceWorkerThread::postFetchTask(Ref<ServiceWorkerFetch::Client>&& client, WTF::Optional<ServiceWorkerClientIdentifier>&& clientId, ResourceRequest&& request, String&& referrer, FetchOptions&& options) > { > // FIXME: instead of directly using runLoop(), we should be using something like WorkerGlobalScopeProxy. > // FIXME: request and options come straigth from IPC so are already isolated. We should be able to take benefit of that. >diff --git a/Source/WebCore/workers/service/context/ServiceWorkerThread.h b/Source/WebCore/workers/service/context/ServiceWorkerThread.h >index 3492a39fe0bfbc00ef6c48a7e1cf6260ad324e92..bae12d7fe93729999b50923d83ab3e56319962d7 100644 >--- a/Source/WebCore/workers/service/context/ServiceWorkerThread.h >+++ b/Source/WebCore/workers/service/context/ServiceWorkerThread.h >@@ -55,7 +55,7 @@ public: > > WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } > >- WEBCORE_EXPORT void postFetchTask(Ref<ServiceWorkerFetch::Client>&&, std::optional<ServiceWorkerClientIdentifier>&&, ResourceRequest&&, String&& referrer, FetchOptions&&); >+ WEBCORE_EXPORT void postFetchTask(Ref<ServiceWorkerFetch::Client>&&, WTF::Optional<ServiceWorkerClientIdentifier>&&, ResourceRequest&&, String&& referrer, FetchOptions&&); > WEBCORE_EXPORT void postMessageToServiceWorker(MessageWithMessagePorts&&, ServiceWorkerOrClientData&& sourceData); > > void fireInstallEvent(); >diff --git a/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp b/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp >index 72da981eb91d0527f6e6bc1dac0a012f0d3ac70e..17314c08bc7877eb3f9e06014f840b798653360c 100644 >--- a/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp >+++ b/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp >@@ -185,7 +185,7 @@ void ServiceWorkerThreadProxy::notifyNetworkStateChange(bool isOnline) > }, WorkerRunLoop::defaultMode()); > } > >-void ServiceWorkerThreadProxy::startFetch(SWServerConnectionIdentifier connectionIdentifier, FetchIdentifier fetchIdentifier, Ref<ServiceWorkerFetch::Client>&& client, std::optional<ServiceWorkerClientIdentifier>&& clientId, ResourceRequest&& request, String&& referrer, FetchOptions&& options) >+void ServiceWorkerThreadProxy::startFetch(SWServerConnectionIdentifier connectionIdentifier, FetchIdentifier fetchIdentifier, Ref<ServiceWorkerFetch::Client>&& client, WTF::Optional<ServiceWorkerClientIdentifier>&& clientId, ResourceRequest&& request, String&& referrer, FetchOptions&& options) > { > auto key = std::make_pair(connectionIdentifier, fetchIdentifier); > >diff --git a/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h b/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h >index 49628299c845175faca66ff404e33d8e86bb3d46..906abdebdbb7a59cd3427c328050688d0ff4b561 100644 >--- a/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h >+++ b/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h >@@ -71,7 +71,7 @@ public: > // Public only for testing purposes. > WEBCORE_TESTSUPPORT_EXPORT void notifyNetworkStateChange(bool isOnline); > >- WEBCORE_EXPORT void startFetch(SWServerConnectionIdentifier, FetchIdentifier, Ref<ServiceWorkerFetch::Client>&&, std::optional<ServiceWorkerClientIdentifier>&&, ResourceRequest&&, String&& referrer, FetchOptions&&); >+ WEBCORE_EXPORT void startFetch(SWServerConnectionIdentifier, FetchIdentifier, Ref<ServiceWorkerFetch::Client>&&, WTF::Optional<ServiceWorkerClientIdentifier>&&, ResourceRequest&&, String&& referrer, FetchOptions&&); > WEBCORE_EXPORT void cancelFetch(SWServerConnectionIdentifier, FetchIdentifier); > WEBCORE_EXPORT void removeFetch(SWServerConnectionIdentifier, FetchIdentifier); > >diff --git a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp b/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >index a4cb2534262332dad1c55fcffc66d1b8194da02b..3261b3bbf33ac6aa3b353e131ee31b83b43bbf00 100644 >--- a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >+++ b/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >@@ -237,7 +237,7 @@ static String updateViaCacheToString(ServiceWorkerUpdateViaCache update) > RELEASE_ASSERT_NOT_REACHED(); > } > >-static std::optional<ServiceWorkerUpdateViaCache> stringToUpdateViaCache(const String& update) >+static WTF::Optional<ServiceWorkerUpdateViaCache> stringToUpdateViaCache(const String& update) > { > if (update == "Imports") > return ServiceWorkerUpdateViaCache::Imports; >@@ -246,7 +246,7 @@ static std::optional<ServiceWorkerUpdateViaCache> stringToUpdateViaCache(const S > if (update == "None") > return ServiceWorkerUpdateViaCache::None; > >- return std::nullopt; >+ return WTF::nullopt; > } > > static String workerTypeToString(WorkerType workerType) >@@ -261,14 +261,14 @@ static String workerTypeToString(WorkerType workerType) > RELEASE_ASSERT_NOT_REACHED(); > } > >-static std::optional<WorkerType> stringToWorkerType(const String& type) >+static WTF::Optional<WorkerType> stringToWorkerType(const String& type) > { > if (type == "Classic") > return WorkerType::Classic; > if (type == "Module") > return WorkerType::Module; > >- return std::nullopt; >+ return WTF::nullopt; > } > > void RegistrationDatabase::pushChanges(Vector<ServiceWorkerContextData>&& datas, CompletionHandler<void()>&& completionHandler) >@@ -400,8 +400,8 @@ String RegistrationDatabase::importRecords() > auto workerIdentifier = generateObjectIdentifier<ServiceWorkerIdentifierType>(); > auto registrationIdentifier = generateObjectIdentifier<ServiceWorkerRegistrationIdentifierType>(); > auto serviceWorkerData = ServiceWorkerData { workerIdentifier, scriptURL, ServiceWorkerState::Activated, *workerType, registrationIdentifier }; >- auto registration = ServiceWorkerRegistrationData { WTFMove(*key), registrationIdentifier, URL(originURL, scopePath), *updateViaCache, lastUpdateCheckTime, std::nullopt, std::nullopt, WTFMove(serviceWorkerData) }; >- auto contextData = ServiceWorkerContextData { std::nullopt, WTFMove(registration), workerIdentifier, WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(scriptURL), *workerType, m_sessionID, true, WTFMove(scriptResourceMap) }; >+ auto registration = ServiceWorkerRegistrationData { WTFMove(*key), registrationIdentifier, URL(originURL, scopePath), *updateViaCache, lastUpdateCheckTime, WTF::nullopt, WTF::nullopt, WTFMove(serviceWorkerData) }; >+ auto contextData = ServiceWorkerContextData { WTF::nullopt, WTFMove(registration), workerIdentifier, WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(scriptURL), *workerType, m_sessionID, true, WTFMove(scriptResourceMap) }; > > callOnMainThread([protectedThis = makeRef(*this), contextData = contextData.isolatedCopy()]() mutable { > protectedThis->addRegistrationToStore(WTFMove(contextData)); >diff --git a/Source/WebCore/workers/service/server/SWServer.cpp b/Source/WebCore/workers/service/server/SWServer.cpp >index 11405950552a43a436a1f63702c158ffb73cc419..01430348d8a554929d8476814e67f67a1907eb92 100644 >--- a/Source/WebCore/workers/service/server/SWServer.cpp >+++ b/Source/WebCore/workers/service/server/SWServer.cpp >@@ -78,14 +78,14 @@ SWServerWorker* SWServer::workerByID(ServiceWorkerIdentifier identifier) const > return worker; > } > >-std::optional<ServiceWorkerClientData> SWServer::serviceWorkerClientWithOriginByID(const ClientOrigin& clientOrigin, const ServiceWorkerClientIdentifier& clientIdentifier) const >+WTF::Optional<ServiceWorkerClientData> SWServer::serviceWorkerClientWithOriginByID(const ClientOrigin& clientOrigin, const ServiceWorkerClientIdentifier& clientIdentifier) const > { > auto iterator = m_clientIdentifiersPerOrigin.find(clientOrigin); > if (iterator == m_clientIdentifiersPerOrigin.end()) >- return std::nullopt; >+ return WTF::nullopt; > > if (!iterator->value.identifiers.contains(clientIdentifier)) >- return std::nullopt; >+ return WTF::nullopt; > > auto clientIterator = m_clientsById.find(clientIdentifier); > ASSERT(clientIterator != m_clientsById.end()); >@@ -348,7 +348,7 @@ void SWServer::scriptFetchFinished(Connection& connection, const ServiceWorkerFe > jobQueue->scriptFetchFinished(connection, result); > } > >-void SWServer::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker, const String& message) >+void SWServer::scriptContextFailedToStart(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker, const String& message) > { > if (!jobDataIdentifier) > return; >@@ -364,7 +364,7 @@ void SWServer::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDa > jobQueue->scriptContextFailedToStart(*jobDataIdentifier, worker.identifier(), message); > } > >-void SWServer::scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker) >+void SWServer::scriptContextStarted(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker) > { > if (!jobDataIdentifier) > return; >@@ -386,7 +386,7 @@ void SWServer::terminatePreinstallationWorker(SWServerWorker& worker) > registration->setPreInstallationWorker(nullptr); > } > >-void SWServer::didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker, bool wasSuccessful) >+void SWServer::didFinishInstall(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker, bool wasSuccessful) > { > if (!jobDataIdentifier) > return; >@@ -731,7 +731,7 @@ SWServerRegistration* SWServer::registrationFromServiceWorkerIdentifier(ServiceW > return m_registrations.get(iterator->value->registrationKey()); > } > >-void SWServer::registerServiceWorkerClient(ClientOrigin&& clientOrigin, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier) >+void SWServer::registerServiceWorkerClient(ClientOrigin&& clientOrigin, ServiceWorkerClientData&& data, const WTF::Optional<ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier) > { > auto clientIdentifier = data.identifier; > >diff --git a/Source/WebCore/workers/service/server/SWServer.h b/Source/WebCore/workers/service/server/SWServer.h >index 75bcc1cff12d40bf396442449b9b5e10332ccc88..36e9f19e9eb163f2f7bc6944de661af1e09d26d8 100644 >--- a/Source/WebCore/workers/service/server/SWServer.h >+++ b/Source/WebCore/workers/service/server/SWServer.h >@@ -79,7 +79,7 @@ public: > void resolveRegistrationReadyRequests(SWServerRegistration&); > > // Messages to the client WebProcess >- virtual void updateRegistrationStateInClient(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const std::optional<ServiceWorkerData>&) = 0; >+ virtual void updateRegistrationStateInClient(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const WTF::Optional<ServiceWorkerData>&) = 0; > virtual void updateWorkerStateInClient(ServiceWorkerIdentifier, ServiceWorkerState) = 0; > virtual void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier) = 0; > virtual void setRegistrationLastUpdateTime(ServiceWorkerRegistrationIdentifier, WallTime) = 0; >@@ -140,7 +140,7 @@ public: > void fireActivateEvent(SWServerWorker&); > > WEBCORE_EXPORT SWServerWorker* workerByID(ServiceWorkerIdentifier) const; >- std::optional<ServiceWorkerClientData> serviceWorkerClientWithOriginByID(const ClientOrigin&, const ServiceWorkerClientIdentifier&) const; >+ WTF::Optional<ServiceWorkerClientData> serviceWorkerClientWithOriginByID(const ClientOrigin&, const ServiceWorkerClientIdentifier&) const; > WEBCORE_EXPORT SWServerWorker* activeWorkerFromRegistrationID(ServiceWorkerRegistrationIdentifier); > > WEBCORE_EXPORT void markAllWorkersForOriginAsTerminated(const SecurityOriginData&); >@@ -151,9 +151,9 @@ public: > > SWOriginStore& originStore() { return m_originStore; } > >- void scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&, const String& message); >- void scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&); >- void didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&, bool wasSuccessful); >+ void scriptContextFailedToStart(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&, const String& message); >+ void scriptContextStarted(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&); >+ void didFinishInstall(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&, bool wasSuccessful); > void didFinishActivation(SWServerWorker&); > void workerContextTerminated(SWServerWorker&); > void matchAll(SWServerWorker&, const ServiceWorkerClientQueryOptions&, ServiceWorkerClientsMatchAllCallback&&); >@@ -163,7 +163,7 @@ public: > > WEBCORE_EXPORT static HashSet<SWServer*>& allServers(); > >- WEBCORE_EXPORT void registerServiceWorkerClient(ClientOrigin&&, ServiceWorkerClientData&&, const std::optional<ServiceWorkerRegistrationIdentifier>&); >+ WEBCORE_EXPORT void registerServiceWorkerClient(ClientOrigin&&, ServiceWorkerClientData&&, const WTF::Optional<ServiceWorkerRegistrationIdentifier>&); > WEBCORE_EXPORT void unregisterServiceWorkerClient(const ClientOrigin&, ServiceWorkerClientIdentifier); > > using RunServiceWorkerCallback = WTF::Function<void(SWServerToContextConnection*)>; >diff --git a/Source/WebCore/workers/service/server/SWServerRegistration.cpp b/Source/WebCore/workers/service/server/SWServerRegistration.cpp >index 3a1b6d1cdbb8913b19beb8cba43734bf45825d27..1b153261964723a6e95632f4b4a3dc49173eb54b 100644 >--- a/Source/WebCore/workers/service/server/SWServerRegistration.cpp >+++ b/Source/WebCore/workers/service/server/SWServerRegistration.cpp >@@ -94,7 +94,7 @@ void SWServerRegistration::updateRegistrationState(ServiceWorkerRegistrationStat > break; > }; > >- std::optional<ServiceWorkerData> serviceWorkerData; >+ WTF::Optional<ServiceWorkerData> serviceWorkerData; > if (worker) > serviceWorkerData = worker->data(); > >@@ -143,15 +143,15 @@ void SWServerRegistration::forEachConnection(const WTF::Function<void(SWServer:: > > ServiceWorkerRegistrationData SWServerRegistration::data() const > { >- std::optional<ServiceWorkerData> installingWorkerData; >+ WTF::Optional<ServiceWorkerData> installingWorkerData; > if (m_installingWorker) > installingWorkerData = m_installingWorker->data(); > >- std::optional<ServiceWorkerData> waitingWorkerData; >+ WTF::Optional<ServiceWorkerData> waitingWorkerData; > if (m_waitingWorker) > waitingWorkerData = m_waitingWorker->data(); > >- std::optional<ServiceWorkerData> activeWorkerData; >+ WTF::Optional<ServiceWorkerData> activeWorkerData; > if (m_activeWorker) > activeWorkerData = m_activeWorker->data(); > >diff --git a/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp b/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp >index 57ce37deda1bb5e38ffbdf42e4bb3188d4e10e69..ae6dcb8cc51ad3b836ed91795b9131cec05a1a13 100644 >--- a/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp >+++ b/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp >@@ -64,19 +64,19 @@ SWServerToContextConnection* SWServerToContextConnection::connectionForOrigin(co > return allConnectionsByOrigin().get(securityOrigin); > } > >-void SWServerToContextConnection::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& message) >+void SWServerToContextConnection::scriptContextFailedToStart(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& message) > { > if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier)) > worker->scriptContextFailedToStart(jobDataIdentifier, message); > } > >-void SWServerToContextConnection::scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier) >+void SWServerToContextConnection::scriptContextStarted(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier) > { > if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier)) > worker->scriptContextStarted(jobDataIdentifier); > } > >-void SWServerToContextConnection::didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful) >+void SWServerToContextConnection::didFinishInstall(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful) > { > if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier)) > worker->didFinishInstall(jobDataIdentifier, wasSuccessful); >diff --git a/Source/WebCore/workers/service/server/SWServerToContextConnection.h b/Source/WebCore/workers/service/server/SWServerToContextConnection.h >index 606c389fa18de9c528052903cc8f8bb1a3a0cc3e..99a5a3afd3591c80211fce0244e1f054e22985a9 100644 >--- a/Source/WebCore/workers/service/server/SWServerToContextConnection.h >+++ b/Source/WebCore/workers/service/server/SWServerToContextConnection.h >@@ -58,15 +58,15 @@ public: > virtual void fireActivateEvent(ServiceWorkerIdentifier) = 0; > virtual void terminateWorker(ServiceWorkerIdentifier) = 0; > virtual void syncTerminateWorker(ServiceWorkerIdentifier) = 0; >- virtual void findClientByIdentifierCompleted(uint64_t requestIdentifier, const std::optional<ServiceWorkerClientData>&, bool hasSecurityError) = 0; >+ virtual void findClientByIdentifierCompleted(uint64_t requestIdentifier, const WTF::Optional<ServiceWorkerClientData>&, bool hasSecurityError) = 0; > virtual void matchAllCompleted(uint64_t requestIdentifier, const Vector<ServiceWorkerClientData>&) = 0; > virtual void claimCompleted(uint64_t requestIdentifier) = 0; > virtual void didFinishSkipWaiting(uint64_t callbackID) = 0; > > // Messages back from the SW host process >- WEBCORE_EXPORT void scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, const String& message); >- WEBCORE_EXPORT void scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier); >- WEBCORE_EXPORT void didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, bool wasSuccessful); >+ WEBCORE_EXPORT void scriptContextFailedToStart(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, const String& message); >+ WEBCORE_EXPORT void scriptContextStarted(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier); >+ WEBCORE_EXPORT void didFinishInstall(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, bool wasSuccessful); > WEBCORE_EXPORT void didFinishActivation(ServiceWorkerIdentifier); > WEBCORE_EXPORT void setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier, bool hasPendingEvents); > WEBCORE_EXPORT void skipWaiting(ServiceWorkerIdentifier, uint64_t callbackID); >diff --git a/Source/WebCore/workers/service/server/SWServerWorker.cpp b/Source/WebCore/workers/service/server/SWServerWorker.cpp >index 78ff60b8285ddca3e3f2fc6543f25536d95d1be4..9e7087f1d8d8e62cd0d90dd127da986248133848 100644 >--- a/Source/WebCore/workers/service/server/SWServerWorker.cpp >+++ b/Source/WebCore/workers/service/server/SWServerWorker.cpp >@@ -74,7 +74,7 @@ ServiceWorkerContextData SWServerWorker::contextData() const > auto* registration = m_server.getRegistration(m_registrationKey); > ASSERT(registration); > >- return { std::nullopt, registration->data(), m_data.identifier, m_script, m_contentSecurityPolicy, m_data.scriptURL, m_data.type, m_server.sessionID(), false, m_scriptResourceMap }; >+ return { WTF::nullopt, registration->data(), m_data.identifier, m_script, m_contentSecurityPolicy, m_data.scriptURL, m_data.type, m_server.sessionID(), false, m_scriptResourceMap }; > } > > void SWServerWorker::terminate() >@@ -101,17 +101,17 @@ SWServerToContextConnection* SWServerWorker::contextConnection() > return SWServerToContextConnection::connectionForOrigin(securityOrigin()); > } > >-void SWServerWorker::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, const String& message) >+void SWServerWorker::scriptContextFailedToStart(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, const String& message) > { > m_server.scriptContextFailedToStart(jobDataIdentifier, *this, message); > } > >-void SWServerWorker::scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier) >+void SWServerWorker::scriptContextStarted(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier) > { > m_server.scriptContextStarted(jobDataIdentifier, *this); > } > >-void SWServerWorker::didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, bool wasSuccessful) >+void SWServerWorker::didFinishInstall(const WTF::Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, bool wasSuccessful) > { > m_server.didFinishInstall(jobDataIdentifier, *this, wasSuccessful); > } >@@ -126,7 +126,7 @@ void SWServerWorker::contextTerminated() > m_server.workerContextTerminated(*this); > } > >-std::optional<ServiceWorkerClientData> SWServerWorker::findClientByIdentifier(const ServiceWorkerClientIdentifier& clientId) const >+WTF::Optional<ServiceWorkerClientData> SWServerWorker::findClientByIdentifier(const ServiceWorkerClientIdentifier& clientId) const > { > return m_server.serviceWorkerClientWithOriginByID(origin(), clientId); > } >diff --git a/Source/WebCore/workers/service/server/SWServerWorker.h b/Source/WebCore/workers/service/server/SWServerWorker.h >index 3419fd20f56da7cd4bcd7e303b61c41c7e05dc2c..8a46fc5eab5df3fc38fd89ec4fb2b4489842e989 100644 >--- a/Source/WebCore/workers/service/server/SWServerWorker.h >+++ b/Source/WebCore/workers/service/server/SWServerWorker.h >@@ -86,12 +86,12 @@ public: > bool hasPendingEvents() const { return m_hasPendingEvents; } > void setHasPendingEvents(bool); > >- void scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>&, const String& message); >- void scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>&); >- void didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>&, bool wasSuccessful); >+ void scriptContextFailedToStart(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, const String& message); >+ void scriptContextStarted(const WTF::Optional<ServiceWorkerJobDataIdentifier>&); >+ void didFinishInstall(const WTF::Optional<ServiceWorkerJobDataIdentifier>&, bool wasSuccessful); > void didFinishActivation(); > void contextTerminated(); >- WEBCORE_EXPORT std::optional<ServiceWorkerClientData> findClientByIdentifier(const ServiceWorkerClientIdentifier&) const; >+ WEBCORE_EXPORT WTF::Optional<ServiceWorkerClientData> findClientByIdentifier(const ServiceWorkerClientIdentifier&) const; > void matchAll(const ServiceWorkerClientQueryOptions&, ServiceWorkerClientsMatchAllCallback&&); > void claim(); > void setScriptResource(URL&&, ServiceWorkerContextData::ImportedScript&&); >@@ -122,7 +122,7 @@ private: > ContentSecurityPolicyResponseHeaders m_contentSecurityPolicy; > bool m_hasPendingEvents { false }; > State m_state { State::NotRunning }; >- mutable std::optional<ClientOrigin> m_origin; >+ mutable WTF::Optional<ClientOrigin> m_origin; > bool m_isSkipWaitingFlagSet { false }; > Vector<Function<void(bool)>> m_whenActivatedHandlers; > HashMap<URL, ServiceWorkerContextData::ImportedScript> m_scriptResourceMap; >diff --git a/Source/WebCore/xml/XMLErrors.h b/Source/WebCore/xml/XMLErrors.h >index 617ceb02b728efd20d0c433b725566fd26ec9868..a831712388ba48fdfc26089c7a484431afeba922 100644 >--- a/Source/WebCore/xml/XMLErrors.h >+++ b/Source/WebCore/xml/XMLErrors.h >@@ -51,7 +51,7 @@ private: > > Document& m_document; > int m_errorCount { 0 }; >- std::optional<TextPosition> m_lastErrorPosition; >+ WTF::Optional<TextPosition> m_lastErrorPosition; > StringBuilder m_errorMessages; > }; > >diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp >index b9eccf352fa940749e671dfef6e6f8e7b0905a18..f9c8d0659bf38f2314ecdface4ace1b59d1449dd 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.cpp >+++ b/Source/WebCore/xml/XMLHttpRequest.cpp >@@ -411,10 +411,10 @@ ExceptionOr<void> XMLHttpRequest::open(const String& method, const String& url, > return open(method, urlWithCredentials, async); > } > >-std::optional<ExceptionOr<void>> XMLHttpRequest::prepareToSend() >+WTF::Optional<ExceptionOr<void>> XMLHttpRequest::prepareToSend() > { >- // A return value other than std::nullopt means we should not try to send, and we should return that value to the caller. >- // std::nullopt means we are ready to send and should continue with the send algorithm. >+ // A return value other than WTF::nullopt means we should not try to send, and we should return that value to the caller. >+ // WTF::nullopt means we are ready to send and should continue with the send algorithm. > > if (!scriptExecutionContext()) > return ExceptionOr<void> { }; >@@ -436,10 +436,10 @@ std::optional<ExceptionOr<void>> XMLHttpRequest::prepareToSend() > } > > m_error = false; >- return std::nullopt; >+ return WTF::nullopt; > } > >-ExceptionOr<void> XMLHttpRequest::send(std::optional<SendTypes>&& sendType) >+ExceptionOr<void> XMLHttpRequest::send(WTF::Optional<SendTypes>&& sendType) > { > InspectorInstrumentation::willSendXMLHttpRequest(scriptExecutionContext(), url()); > >@@ -627,7 +627,7 @@ ExceptionOr<void> XMLHttpRequest::createRequest() > } > } > >- m_exceptionCode = std::nullopt; >+ m_exceptionCode = WTF::nullopt; > m_error = false; > m_uploadComplete = !request.httpBody(); > m_sendFlag = true; >diff --git a/Source/WebCore/xml/XMLHttpRequest.h b/Source/WebCore/xml/XMLHttpRequest.h >index b489db39fe7ae7ceb17e24de7c7a52a9f0396f93..ab203b939bccfaa771b76f11fbfed794125c42e4 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.h >+++ b/Source/WebCore/xml/XMLHttpRequest.h >@@ -80,7 +80,7 @@ public: > ExceptionOr<void> open(const String& method, const String& url); > ExceptionOr<void> open(const String& method, const URL&, bool async); > ExceptionOr<void> open(const String& method, const String&, bool async, const String& user, const String& password); >- ExceptionOr<void> send(std::optional<SendTypes>&&); >+ ExceptionOr<void> send(WTF::Optional<SendTypes>&&); > void abort(); > ExceptionOr<void> setRequestHeader(const String& name, const String& value); > ExceptionOr<void> overrideMimeType(const String& override); >@@ -157,7 +157,7 @@ private: > > bool responseIsXML() const; > >- std::optional<ExceptionOr<void>> prepareToSend(); >+ WTF::Optional<ExceptionOr<void>> prepareToSend(); > ExceptionOr<void> send(Document&); > ExceptionOr<void> send(const String& = { }); > ExceptionOr<void> send(Blob&); >@@ -240,7 +240,7 @@ private: > > MonotonicTime m_sendingTime; > >- std::optional<ExceptionCode> m_exceptionCode; >+ WTF::Optional<ExceptionCode> m_exceptionCode; > }; > > inline auto XMLHttpRequest::responseType() const -> ResponseType >diff --git a/Source/WebCore/xml/parser/XMLDocumentParser.h b/Source/WebCore/xml/parser/XMLDocumentParser.h >index cbdf5fe96e0bfdd450109af67482f873fc4c09a5..6bde2dd3cd8460ccd2aad2a468be10eb64c2d267 100644 >--- a/Source/WebCore/xml/parser/XMLDocumentParser.h >+++ b/Source/WebCore/xml/parser/XMLDocumentParser.h >@@ -190,6 +190,6 @@ private: > xmlDocPtr xmlDocPtrForString(CachedResourceLoader&, const String& source, const String& url); > #endif > >-std::optional<HashMap<String, String>> parseAttributes(const String&); >+WTF::Optional<HashMap<String, String>> parseAttributes(const String&); > > } // namespace WebCore >diff --git a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp >index d7998bb8970a3a6b74a88b25e7f60046d97c726d..6edb14866436d1d23a7e451b9de096ac0eed1aa1 100644 >--- a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp >+++ b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp >@@ -1453,7 +1453,7 @@ bool XMLDocumentParser::appendFragmentSource(const String& chunk) > > // -------------------------------- > >-using AttributeParseState = std::optional<HashMap<String, String>>; >+using AttributeParseState = WTF::Optional<HashMap<String, String>>; > > static void attributesStartElementNsHandler(void* closure, const xmlChar* xmlLocalName, const xmlChar* /*xmlPrefix*/, const xmlChar* /*xmlURI*/, int /*numNamespaces*/, const xmlChar** /*namespaces*/, int numAttributes, int /*numDefaulted*/, const xmlChar** libxmlAttributes) > { >@@ -1476,7 +1476,7 @@ static void attributesStartElementNsHandler(void* closure, const xmlChar* xmlLoc > } > } > >-std::optional<HashMap<String, String>> parseAttributes(const String& string) >+WTF::Optional<HashMap<String, String>> parseAttributes(const String& string) > { > String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; > >diff --git a/Source/WebDriver/Actions.h b/Source/WebDriver/Actions.h >index fdc9ac6feef871d6226f3cc4142e098776691ac0..56f9ddc0f9a309d8c5494c25f40f30d40c979c46 100644 >--- a/Source/WebDriver/Actions.h >+++ b/Source/WebDriver/Actions.h >@@ -36,7 +36,7 @@ struct InputSource { > enum class Type { None, Key, Pointer }; > > Type type; >- std::optional<PointerType> pointerType; >+ WTF::Optional<PointerType> pointerType; > }; > > struct PointerParameters { >@@ -47,7 +47,7 @@ struct PointerOrigin { > enum class Type { Viewport, Pointer, Element }; > > Type type; >- std::optional<String> elementID; >+ WTF::Optional<String> elementID; > }; > > struct Action { >@@ -64,15 +64,15 @@ struct Action { > String id; > Type type; > Subtype subtype; >- std::optional<unsigned> duration; >+ WTF::Optional<unsigned> duration; > >- std::optional<PointerType> pointerType; >- std::optional<MouseButton> button; >- std::optional<PointerOrigin> origin; >- std::optional<int64_t> x; >- std::optional<int64_t> y; >+ WTF::Optional<PointerType> pointerType; >+ WTF::Optional<MouseButton> button; >+ WTF::Optional<PointerOrigin> origin; >+ WTF::Optional<int64_t> x; >+ WTF::Optional<int64_t> y; > >- std::optional<String> key; >+ WTF::Optional<String> key; > }; > > } // WebDriver >diff --git a/Source/WebDriver/Capabilities.h b/Source/WebDriver/Capabilities.h >index 815115a70dc48d471950fff3fa7de059cea067aa..9f400cd05e82434d04f11c17fe931acb90446e1a 100644 >--- a/Source/WebDriver/Capabilities.h >+++ b/Source/WebDriver/Capabilities.h >@@ -34,9 +34,9 @@ > namespace WebDriver { > > struct Timeouts { >- std::optional<Seconds> script; >- std::optional<Seconds> pageLoad; >- std::optional<Seconds> implicit; >+ WTF::Optional<Seconds> script; >+ WTF::Optional<Seconds> pageLoad; >+ WTF::Optional<Seconds> implicit; > }; > > enum class PageLoadStrategy { >@@ -54,21 +54,21 @@ enum class UnhandledPromptBehavior { > }; > > struct Capabilities { >- std::optional<String> browserName; >- std::optional<String> browserVersion; >- std::optional<String> platformName; >- std::optional<bool> acceptInsecureCerts; >- std::optional<bool> setWindowRect; >- std::optional<Timeouts> timeouts; >- std::optional<PageLoadStrategy> pageLoadStrategy; >- std::optional<UnhandledPromptBehavior> unhandledPromptBehavior; >+ WTF::Optional<String> browserName; >+ WTF::Optional<String> browserVersion; >+ WTF::Optional<String> platformName; >+ WTF::Optional<bool> acceptInsecureCerts; >+ WTF::Optional<bool> setWindowRect; >+ WTF::Optional<Timeouts> timeouts; >+ WTF::Optional<PageLoadStrategy> pageLoadStrategy; >+ WTF::Optional<UnhandledPromptBehavior> unhandledPromptBehavior; > #if PLATFORM(GTK) || PLATFORM(WPE) >- std::optional<String> browserBinary; >- std::optional<Vector<String>> browserArguments; >- std::optional<Vector<std::pair<String, String>>> certificates; >+ WTF::Optional<String> browserBinary; >+ WTF::Optional<Vector<String>> browserArguments; >+ WTF::Optional<Vector<std::pair<String, String>>> certificates; > #endif > #if PLATFORM(GTK) >- std::optional<bool> useOverlayScrollbars; >+ WTF::Optional<bool> useOverlayScrollbars; > #endif > }; > >diff --git a/Source/WebDriver/CommandResult.cpp b/Source/WebDriver/CommandResult.cpp >index e0f85fa3b05768a0083056aac2681229703e7b31..f4164cf2f95bf38c2b16bd8c31c08e24ee204f3a 100644 >--- a/Source/WebDriver/CommandResult.cpp >+++ b/Source/WebDriver/CommandResult.cpp >@@ -38,7 +38,7 @@ enum ProtocolErrorCode { > ServerError = -32000 > }; > >-CommandResult::CommandResult(RefPtr<JSON::Value>&& result, std::optional<ErrorCode> errorCode) >+CommandResult::CommandResult(RefPtr<JSON::Value>&& result, WTF::Optional<ErrorCode> errorCode) > : m_errorCode(errorCode) > { > if (!m_errorCode) { >@@ -116,7 +116,7 @@ CommandResult::CommandResult(RefPtr<JSON::Value>&& result, std::optional<ErrorCo > } > } > >-CommandResult::CommandResult(ErrorCode errorCode, std::optional<String> errorMessage) >+CommandResult::CommandResult(ErrorCode errorCode, WTF::Optional<String> errorMessage) > : m_errorCode(errorCode) > , m_errorMessage(errorMessage) > { >diff --git a/Source/WebDriver/CommandResult.h b/Source/WebDriver/CommandResult.h >index 29dda759309e6127e62d71d0497fb15693548169..b87827b41f5a20cacf20f501433987e726211ec5 100644 >--- a/Source/WebDriver/CommandResult.h >+++ b/Source/WebDriver/CommandResult.h >@@ -71,7 +71,7 @@ public: > return CommandResult(WTFMove(result), CommandResult::ErrorCode::UnknownError); > } > >- static CommandResult fail(ErrorCode errorCode, std::optional<String> errorMessage = std::nullopt) >+ static CommandResult fail(ErrorCode errorCode, WTF::Optional<String> errorMessage = WTF::nullopt) > { > return CommandResult(errorCode, errorMessage); > } >@@ -82,16 +82,16 @@ public: > bool isError() const { return !!m_errorCode; } > ErrorCode errorCode() const { ASSERT(isError()); return m_errorCode.value(); } > String errorString() const; >- std::optional<String> errorMessage() const { ASSERT(isError()); return m_errorMessage; } >+ WTF::Optional<String> errorMessage() const { ASSERT(isError()); return m_errorMessage; } > const RefPtr<JSON::Object>& additionalErrorData() const { return m_errorAdditionalData; } > > private: >- explicit CommandResult(RefPtr<JSON::Value>&&, std::optional<ErrorCode> = std::nullopt); >- explicit CommandResult(ErrorCode, std::optional<String> = std::nullopt); >+ explicit CommandResult(RefPtr<JSON::Value>&&, WTF::Optional<ErrorCode> = WTF::nullopt); >+ explicit CommandResult(ErrorCode, WTF::Optional<String> = WTF::nullopt); > > RefPtr<JSON::Value> m_result; >- std::optional<ErrorCode> m_errorCode; >- std::optional<String> m_errorMessage; >+ WTF::Optional<ErrorCode> m_errorCode; >+ WTF::Optional<String> m_errorMessage; > RefPtr<JSON::Object> m_errorAdditionalData; > }; > >diff --git a/Source/WebDriver/HTTPServer.h b/Source/WebDriver/HTTPServer.h >index 9748b57f18063a081221142e09969aef300a2877..c70b376bf85126b122a90ed4fdc7de3737efcd55 100644 >--- a/Source/WebDriver/HTTPServer.h >+++ b/Source/WebDriver/HTTPServer.h >@@ -57,7 +57,7 @@ public: > explicit HTTPServer(HTTPRequestHandler&); > ~HTTPServer() = default; > >- bool listen(const std::optional<String>& host, unsigned port); >+ bool listen(const WTF::Optional<String>& host, unsigned port); > void disconnect(); > > private: >diff --git a/Source/WebDriver/Session.cpp b/Source/WebDriver/Session.cpp >index fa861ec21c4a21532c79effbbc5ae8288c876d8b..9fcbccc657388e026cf4122e048043bacec2a026 100644 >--- a/Source/WebDriver/Session.cpp >+++ b/Source/WebDriver/Session.cpp >@@ -80,7 +80,7 @@ bool Session::isConnected() const > return m_host->isConnected(); > } > >-static std::optional<String> firstWindowHandleInResult(JSON::Value& result) >+static WTF::Optional<String> firstWindowHandleInResult(JSON::Value& result) > { > RefPtr<JSON::Array> handles; > if (result.asArray(handles) && handles->length()) { >@@ -89,7 +89,7 @@ static std::optional<String> firstWindowHandleInResult(JSON::Value& result) > if (handleValue->asString(handle)) > return handle; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > void Session::closeAllToplevelBrowsingContexts(const String& toplevelBrowsingContext, Function<void (CommandResult&&)>&& completionHandler) >@@ -109,7 +109,7 @@ void Session::closeAllToplevelBrowsingContexts(const String& toplevelBrowsingCon > > void Session::close(Function<void (CommandResult&&)>&& completionHandler) > { >- m_toplevelBrowsingContext = std::nullopt; >+ m_toplevelBrowsingContext = WTF::nullopt; > getWindowHandles([this, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { > if (result.isError()) { > completionHandler(WTFMove(result)); >@@ -143,25 +143,25 @@ void Session::setTimeouts(const Timeouts& timeouts, Function<void (CommandResult > completionHandler(CommandResult::success()); > } > >-void Session::switchToTopLevelBrowsingContext(std::optional<String> toplevelBrowsingContext) >+void Session::switchToTopLevelBrowsingContext(WTF::Optional<String> toplevelBrowsingContext) > { > m_toplevelBrowsingContext = toplevelBrowsingContext; >- m_currentBrowsingContext = std::nullopt; >+ m_currentBrowsingContext = WTF::nullopt; > } > >-void Session::switchToBrowsingContext(std::optional<String> browsingContext) >+void Session::switchToBrowsingContext(WTF::Optional<String> browsingContext) > { > // Automation sends empty strings for main frame. > if (!browsingContext || browsingContext.value().isEmpty()) >- m_currentBrowsingContext = std::nullopt; >+ m_currentBrowsingContext = WTF::nullopt; > else > m_currentBrowsingContext = browsingContext; > } > >-std::optional<String> Session::pageLoadStrategyString() const >+WTF::Optional<String> Session::pageLoadStrategyString() const > { > if (!capabilities().pageLoadStrategy) >- return std::nullopt; >+ return WTF::nullopt; > > switch (capabilities().pageLoadStrategy.value()) { > case PageLoadStrategy::None: >@@ -172,7 +172,7 @@ std::optional<String> Session::pageLoadStrategyString() const > return String("Eager"); > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > void Session::createTopLevelBrowsingContext(Function<void (CommandResult&&)>&& completionHandler) >@@ -267,7 +267,7 @@ void Session::acceptAndNotifyAlert(Function<void (CommandResult&&)>&& completion > void Session::reportUnexpectedAlertOpen(Function<void (CommandResult&&)>&& completionHandler) > { > getAlertText([completionHandler = WTFMove(completionHandler)](CommandResult&& result) { >- std::optional<String> alertText; >+ WTF::Optional<String> alertText; > if (!result.isError()) { > String valueString; > if (result.result()->asString(valueString)) >@@ -307,7 +307,7 @@ void Session::go(const String& url, Function<void (CommandResult&&)>&& completio > completionHandler(CommandResult::fail(WTFMove(response.responseObject))); > return; > } >- switchToBrowsingContext(std::nullopt); >+ switchToBrowsingContext(WTF::nullopt); > completionHandler(CommandResult::success()); > }); > }); >@@ -370,7 +370,7 @@ void Session::back(Function<void (CommandResult&&)>&& completionHandler) > completionHandler(CommandResult::fail(WTFMove(response.responseObject))); > return; > } >- switchToBrowsingContext(std::nullopt); >+ switchToBrowsingContext(WTF::nullopt); > completionHandler(CommandResult::success()); > }); > }); >@@ -398,7 +398,7 @@ void Session::forward(Function<void (CommandResult&&)>&& completionHandler) > completionHandler(CommandResult::fail(WTFMove(response.responseObject))); > return; > } >- switchToBrowsingContext(std::nullopt); >+ switchToBrowsingContext(WTF::nullopt); > completionHandler(CommandResult::success()); > }); > }); >@@ -426,7 +426,7 @@ void Session::refresh(Function<void (CommandResult&&)>&& completionHandler) > completionHandler(CommandResult::fail(WTFMove(response.responseObject))); > return; > } >- switchToBrowsingContext(std::nullopt); >+ switchToBrowsingContext(WTF::nullopt); > completionHandler(CommandResult::success()); > }); > }); >@@ -534,7 +534,7 @@ void Session::closeWindow(Function<void (CommandResult&&)>&& completionHandler) > completionHandler(WTFMove(result)); > return; > } >- auto toplevelBrowsingContext = std::exchange(m_toplevelBrowsingContext, std::nullopt); >+ auto toplevelBrowsingContext = std::exchange(m_toplevelBrowsingContext, WTF::nullopt); > closeTopLevelBrowsingContext(toplevelBrowsingContext.value(), WTFMove(completionHandler)); > }); > } >@@ -594,7 +594,7 @@ void Session::switchToFrame(RefPtr<JSON::Value>&& frameID, Function<void (Comman > } > > if (frameID->isNull()) { >- switchToBrowsingContext(std::nullopt); >+ switchToBrowsingContext(WTF::nullopt); > completionHandler(CommandResult::success()); > return; > } >@@ -737,7 +737,7 @@ void Session::getWindowRect(Function<void (CommandResult&&)>&& completionHandler > }); > } > >-void Session::setWindowRect(std::optional<double> x, std::optional<double> y, std::optional<double> width, std::optional<double> height, Function<void (CommandResult&&)>&& completionHandler) >+void Session::setWindowRect(WTF::Optional<double> x, WTF::Optional<double> y, WTF::Optional<double> width, WTF::Optional<double> height, Function<void (CommandResult&&)>&& completionHandler) > { > if (!m_toplevelBrowsingContext) { > completionHandler(CommandResult::fail(CommandResult::ErrorCode::NoSuchWindow)); >@@ -905,7 +905,7 @@ String Session::extractElementID(JSON::Value& value) > return elementID; > } > >-void Session::computeElementLayout(const String& elementID, OptionSet<ElementLayoutOption> options, Function<void (std::optional<Rect>&&, std::optional<Point>&&, bool, RefPtr<JSON::Object>&&)>&& completionHandler) >+void Session::computeElementLayout(const String& elementID, OptionSet<ElementLayoutOption> options, Function<void (WTF::Optional<Rect>&&, WTF::Optional<Point>&&, bool, RefPtr<JSON::Object>&&)>&& completionHandler) > { > ASSERT(m_toplevelBrowsingContext.value()); > >@@ -917,16 +917,16 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay > parameters->setString("coordinateSystem"_s, options.contains(ElementLayoutOption::UseViewportCoordinates) ? "LayoutViewport"_s : "Page"_s); > m_host->sendCommandToBackend("computeElementLayout"_s, WTFMove(parameters), [protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) mutable { > if (response.isError || !response.responseObject) { >- completionHandler(std::nullopt, std::nullopt, false, WTFMove(response.responseObject)); >+ completionHandler(WTF::nullopt, WTF::nullopt, false, WTFMove(response.responseObject)); > return; > } > RefPtr<JSON::Object> rectObject; > if (!response.responseObject->getObject("rect"_s, rectObject)) { >- completionHandler(std::nullopt, std::nullopt, false, nullptr); >+ completionHandler(WTF::nullopt, WTF::nullopt, false, nullptr); > return; > } >- std::optional<int> elementX; >- std::optional<int> elementY; >+ WTF::Optional<int> elementX; >+ WTF::Optional<int> elementY; > RefPtr<JSON::Object> elementPosition; > if (rectObject->getObject("origin"_s, elementPosition)) { > int x, y; >@@ -936,11 +936,11 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay > } > } > if (!elementX || !elementY) { >- completionHandler(std::nullopt, std::nullopt, false, nullptr); >+ completionHandler(WTF::nullopt, WTF::nullopt, false, nullptr); > return; > } >- std::optional<int> elementWidth; >- std::optional<int> elementHeight; >+ WTF::Optional<int> elementWidth; >+ WTF::Optional<int> elementHeight; > RefPtr<JSON::Object> elementSize; > if (rectObject->getObject("size"_s, elementSize)) { > int width, height; >@@ -950,25 +950,25 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay > } > } > if (!elementWidth || !elementHeight) { >- completionHandler(std::nullopt, std::nullopt, false, nullptr); >+ completionHandler(WTF::nullopt, WTF::nullopt, false, nullptr); > return; > } > Rect rect = { { elementX.value(), elementY.value() }, { elementWidth.value(), elementHeight.value() } }; > > bool isObscured; > if (!response.responseObject->getBoolean("isObscured"_s, isObscured)) { >- completionHandler(std::nullopt, std::nullopt, false, nullptr); >+ completionHandler(WTF::nullopt, WTF::nullopt, false, nullptr); > return; > } > RefPtr<JSON::Object> inViewCenterPointObject; > if (!response.responseObject->getObject("inViewCenterPoint"_s, inViewCenterPointObject)) { >- completionHandler(rect, std::nullopt, isObscured, nullptr); >+ completionHandler(rect, WTF::nullopt, isObscured, nullptr); > return; > } > int inViewCenterPointX, inViewCenterPointY; > if (!inViewCenterPointObject->getInteger("x"_s, inViewCenterPointX) > || !inViewCenterPointObject->getInteger("y"_s, inViewCenterPointY)) { >- completionHandler(std::nullopt, std::nullopt, isObscured, nullptr); >+ completionHandler(WTF::nullopt, WTF::nullopt, isObscured, nullptr); > return; > } > Point inViewCenterPoint = { inViewCenterPointX, inViewCenterPointY }; >@@ -1236,7 +1236,7 @@ void Session::getElementRect(const String& elementID, Function<void (CommandResu > completionHandler(WTFMove(result)); > return; > } >- computeElementLayout(elementID, { }, [protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](std::optional<Rect>&& rect, std::optional<Point>&&, bool, RefPtr<JSON::Object>&& error) { >+ computeElementLayout(elementID, { }, [protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](WTF::Optional<Rect>&& rect, WTF::Optional<Point>&&, bool, RefPtr<JSON::Object>&& error) { > if (!rect || error) { > completionHandler(CommandResult::fail(WTFMove(error))); > return; >@@ -1477,11 +1477,11 @@ void Session::waitForNavigationToComplete(Function<void (CommandResult&&)>&& com > switch (result.errorCode()) { > case CommandResult::ErrorCode::NoSuchWindow: > // Window was closed, reset the top level browsing context and ignore the error. >- m_toplevelBrowsingContext = std::nullopt; >+ m_toplevelBrowsingContext = WTF::nullopt; > break; > case CommandResult::ErrorCode::NoSuchFrame: > // Navigation destroyed the current frame, switch to top level browsing context and ignore the error. >- switchToBrowsingContext(std::nullopt); >+ switchToBrowsingContext(WTF::nullopt); > break; > default: > completionHandler(WTFMove(result)); >@@ -1515,7 +1515,7 @@ void Session::elementClick(const String& elementID, Function<void (CommandResult > } > > OptionSet<ElementLayoutOption> options = { ElementLayoutOption::ScrollIntoViewIfNeeded, ElementLayoutOption::UseViewportCoordinates }; >- computeElementLayout(elementID, options, [this, protectedThis = makeRef(*this), elementID, completionHandler = WTFMove(completionHandler)](std::optional<Rect>&& rect, std::optional<Point>&& inViewCenter, bool isObscured, RefPtr<JSON::Object>&& error) mutable { >+ computeElementLayout(elementID, options, [this, protectedThis = makeRef(*this), elementID, completionHandler = WTFMove(completionHandler)](WTF::Optional<Rect>&& rect, WTF::Optional<Point>&& inViewCenter, bool isObscured, RefPtr<JSON::Object>&& error) mutable { > if (!rect || error) { > completionHandler(CommandResult::fail(WTFMove(error))); > return; >@@ -1784,13 +1784,13 @@ void Session::elementSendKeys(const String& elementID, const String& text, Funct > // Reset sticky modifiers if needed. > if (stickyModifiers) { > if (stickyModifiers & KeyModifier::Shift) >- interactions.append({ KeyboardInteractionType::KeyRelease, std::nullopt, std::optional<String>("Shift"_s) }); >+ interactions.append({ KeyboardInteractionType::KeyRelease, WTF::nullopt, WTF::Optional<String>("Shift"_s) }); > if (stickyModifiers & KeyModifier::Control) >- interactions.append({ KeyboardInteractionType::KeyRelease, std::nullopt, std::optional<String>("Control"_s) }); >+ interactions.append({ KeyboardInteractionType::KeyRelease, WTF::nullopt, WTF::Optional<String>("Control"_s) }); > if (stickyModifiers & KeyModifier::Alternate) >- interactions.append({ KeyboardInteractionType::KeyRelease, std::nullopt, std::optional<String>("Alternate"_s) }); >+ interactions.append({ KeyboardInteractionType::KeyRelease, WTF::nullopt, WTF::Optional<String>("Alternate"_s) }); > if (stickyModifiers & KeyModifier::Meta) >- interactions.append({ KeyboardInteractionType::KeyRelease, std::nullopt, std::optional<String>("Meta"_s) }); >+ interactions.append({ KeyboardInteractionType::KeyRelease, WTF::nullopt, WTF::Optional<String>("Meta"_s) }); > } > > performKeyboardInteractions(WTFMove(interactions), WTFMove(completionHandler)); >@@ -1968,13 +1968,13 @@ void Session::performKeyboardInteractions(Vector<KeyboardInteraction>&& interact > }); > } > >-static std::optional<Session::Cookie> parseAutomationCookie(const JSON::Object& cookieObject) >+static WTF::Optional<Session::Cookie> parseAutomationCookie(const JSON::Object& cookieObject) > { > Session::Cookie cookie; > if (!cookieObject.getString("name"_s, cookie.name)) >- return std::nullopt; >+ return WTF::nullopt; > if (!cookieObject.getString("value"_s, cookie.value)) >- return std::nullopt; >+ return WTF::nullopt; > > String path; > if (cookieObject.getString("path"_s, path)) >@@ -2175,7 +2175,7 @@ void Session::deleteAllCookies(Function<void (CommandResult&&)>&& completionHand > }); > } > >-InputSource& Session::getOrCreateInputSource(const String& id, InputSource::Type type, std::optional<PointerType> pointerType) >+InputSource& Session::getOrCreateInputSource(const String& id, InputSource::Type type, WTF::Optional<PointerType> pointerType) > { > auto addResult = m_activeInputSources.add(id, InputSource()); > if (addResult.isNewEntry) >@@ -2262,7 +2262,7 @@ void Session::performActions(Vector<Vector<Action>>&& actionsByTick, Function<vo > case Action::Type::Pointer: { > switch (action.subtype) { > case Action::Subtype::PointerUp: >- currentState.pressedButton = std::nullopt; >+ currentState.pressedButton = WTF::nullopt; > break; > case Action::Subtype::PointerDown: > currentState.pressedButton = action.button.value(); >@@ -2282,7 +2282,7 @@ void Session::performActions(Vector<Vector<Action>>&& actionsByTick, Function<vo > state->setDouble("duration"_s, action.duration.value()); > break; > case Action::Subtype::PointerCancel: >- currentState.pressedButton = std::nullopt; >+ currentState.pressedButton = WTF::nullopt; > break; > case Action::Subtype::KeyUp: > case Action::Subtype::KeyDown: >@@ -2296,9 +2296,9 @@ void Session::performActions(Vector<Vector<Action>>&& actionsByTick, Function<vo > switch (action.subtype) { > case Action::Subtype::KeyUp: > if (currentState.pressedVirtualKey) >- currentState.pressedVirtualKey = std::nullopt; >+ currentState.pressedVirtualKey = WTF::nullopt; > else >- currentState.pressedKey = std::nullopt; >+ currentState.pressedKey = WTF::nullopt; > break; > case Action::Subtype::KeyDown: { > KeyModifier modifier; >@@ -2446,7 +2446,7 @@ void Session::sendAlertText(const String& text, Function<void (CommandResult&&)> > }); > } > >-void Session::takeScreenshot(std::optional<String> elementID, std::optional<bool> scrollIntoView, Function<void (CommandResult&&)>&& completionHandler) >+void Session::takeScreenshot(WTF::Optional<String> elementID, WTF::Optional<bool> scrollIntoView, Function<void (CommandResult&&)>&& completionHandler) > { > if (!m_toplevelBrowsingContext) { > completionHandler(CommandResult::fail(CommandResult::ErrorCode::NoSuchWindow)); >diff --git a/Source/WebDriver/Session.h b/Source/WebDriver/Session.h >index d3fbcb777edb7a32de8010b9d246fe075e0ce9e5..5da24d04fed34e1e7956fdce4486aec12dac3d23 100644 >--- a/Source/WebDriver/Session.h >+++ b/Source/WebDriver/Session.h >@@ -61,14 +61,14 @@ public: > struct Cookie { > String name; > String value; >- std::optional<String> path; >- std::optional<String> domain; >- std::optional<bool> secure; >- std::optional<bool> httpOnly; >- std::optional<uint64_t> expiry; >+ WTF::Optional<String> path; >+ WTF::Optional<String> domain; >+ WTF::Optional<bool> secure; >+ WTF::Optional<bool> httpOnly; >+ WTF::Optional<uint64_t> expiry; > }; > >- InputSource& getOrCreateInputSource(const String& id, InputSource::Type, std::optional<PointerType>); >+ InputSource& getOrCreateInputSource(const String& id, InputSource::Type, WTF::Optional<PointerType>); > > void waitForNavigationToComplete(Function<void (CommandResult&&)>&&); > void createTopLevelBrowsingContext(Function<void (CommandResult&&)>&&); >@@ -89,7 +89,7 @@ public: > void switchToFrame(RefPtr<JSON::Value>&&, Function<void (CommandResult&&)>&&); > void switchToParentFrame(Function<void (CommandResult&&)>&&); > void getWindowRect(Function<void (CommandResult&&)>&&); >- void setWindowRect(std::optional<double> x, std::optional<double> y, std::optional<double> width, std::optional<double> height, Function<void (CommandResult&&)>&&); >+ void setWindowRect(WTF::Optional<double> x, WTF::Optional<double> y, WTF::Optional<double> width, WTF::Optional<double> height, Function<void (CommandResult&&)>&&); > void maximizeWindow(Function<void (CommandResult&&)>&&); > void minimizeWindow(Function<void (CommandResult&&)>&&); > void fullscreenWindow(Function<void (CommandResult&&)>&&); >@@ -119,19 +119,19 @@ public: > void acceptAlert(Function<void (CommandResult&&)>&&); > void getAlertText(Function<void (CommandResult&&)>&&); > void sendAlertText(const String&, Function<void (CommandResult&&)>&&); >- void takeScreenshot(std::optional<String> elementID, std::optional<bool> scrollIntoView, Function<void (CommandResult&&)>&&); >+ void takeScreenshot(WTF::Optional<String> elementID, WTF::Optional<bool> scrollIntoView, Function<void (CommandResult&&)>&&); > > private: > Session(std::unique_ptr<SessionHost>&&); > >- void switchToTopLevelBrowsingContext(std::optional<String>); >- void switchToBrowsingContext(std::optional<String>); >+ void switchToTopLevelBrowsingContext(WTF::Optional<String>); >+ void switchToBrowsingContext(WTF::Optional<String>); > void closeTopLevelBrowsingContext(const String& toplevelBrowsingContext, Function<void (CommandResult&&)>&&); > void closeAllToplevelBrowsingContexts(const String& toplevelBrowsingContext, Function<void (CommandResult&&)>&&); > > void getToplevelBrowsingContextRect(Function<void (CommandResult&&)>&&); > >- std::optional<String> pageLoadStrategyString() const; >+ WTF::Optional<String> pageLoadStrategyString() const; > > void handleUserPrompts(Function<void (CommandResult&&)>&&); > void handleUnexpectedAlertOpen(Function<void (CommandResult&&)>&&); >@@ -164,7 +164,7 @@ private: > ScrollIntoViewIfNeeded = 1 << 0, > UseViewportCoordinates = 1 << 1, > }; >- void computeElementLayout(const String& elementID, OptionSet<ElementLayoutOption>, Function<void (std::optional<Rect>&&, std::optional<Point>&&, bool, RefPtr<JSON::Object>&&)>&&); >+ void computeElementLayout(const String& elementID, OptionSet<ElementLayoutOption>, Function<void (WTF::Optional<Rect>&&, WTF::Optional<Point>&&, bool, RefPtr<JSON::Object>&&)>&&); > > void selectOptionElement(const String& elementID, Function<void (CommandResult&&)>&&); > >@@ -174,8 +174,8 @@ private: > enum class KeyboardInteractionType { KeyPress, KeyRelease, InsertByKey }; > struct KeyboardInteraction { > KeyboardInteractionType type { KeyboardInteractionType::InsertByKey }; >- std::optional<String> text; >- std::optional<String> key; >+ WTF::Optional<String> text; >+ WTF::Optional<String> key; > }; > enum KeyModifier { > None = 0, >@@ -192,9 +192,9 @@ private: > > Type type; > String subtype; >- std::optional<MouseButton> pressedButton; >- std::optional<String> pressedKey; >- std::optional<String> pressedVirtualKey; >+ WTF::Optional<MouseButton> pressedButton; >+ WTF::Optional<String> pressedKey; >+ WTF::Optional<String> pressedVirtualKey; > }; > InputSourceState& inputSourceState(const String& id); > >@@ -202,8 +202,8 @@ private: > Seconds m_scriptTimeout; > Seconds m_pageLoadTimeout; > Seconds m_implicitWaitTimeout; >- std::optional<String> m_toplevelBrowsingContext; >- std::optional<String> m_currentBrowsingContext; >+ WTF::Optional<String> m_toplevelBrowsingContext; >+ WTF::Optional<String> m_currentBrowsingContext; > HashMap<String, InputSource> m_activeInputSources; > HashMap<String, InputSourceState> m_inputStateTable; > }; >diff --git a/Source/WebDriver/SessionHost.h b/Source/WebDriver/SessionHost.h >index 97b525eead66c5bfe946701c31eb184f1581ed2d..62acc3c242ebd3198dd71dc21ea1022e2c3549bc 100644 >--- a/Source/WebDriver/SessionHost.h >+++ b/Source/WebDriver/SessionHost.h >@@ -54,8 +54,8 @@ public: > const String& sessionID() const { return m_sessionID; } > const Capabilities& capabilities() const { return m_capabilities; } > >- void connectToBrowser(Function<void (std::optional<String> error)>&&); >- void startAutomationSession(Function<void (bool, std::optional<String>)>&&); >+ void connectToBrowser(Function<void (WTF::Optional<String> error)>&&); >+ void startAutomationSession(Function<void (bool, WTF::Optional<String>)>&&); > > struct CommandResponse { > RefPtr<JSON::Object> responseObject; >@@ -77,7 +77,7 @@ private: > #if USE(GLIB) > static void dbusConnectionClosedCallback(SessionHost*); > static const GDBusInterfaceVTable s_interfaceVTable; >- void launchBrowser(Function<void (std::optional<String> error)>&&); >+ void launchBrowser(Function<void (WTF::Optional<String> error)>&&); > void connectToBrowser(std::unique_ptr<ConnectToBrowserAsyncData>&&); > bool matchCapabilities(GVariant*); > bool buildSessionCapabilities(GVariantBuilder*) const; >@@ -95,7 +95,7 @@ private: > HashMap<long, Function<void (CommandResponse&&)>> m_commandRequests; > > #if USE(GLIB) >- Function<void (bool, std::optional<String>)> m_startSessionCompletionHandler; >+ Function<void (bool, WTF::Optional<String>)> m_startSessionCompletionHandler; > GRefPtr<GSubprocess> m_browser; > GRefPtr<GDBusConnection> m_dbusConnection; > GRefPtr<GCancellable> m_cancellable; >diff --git a/Source/WebDriver/WebDriverService.cpp b/Source/WebDriver/WebDriverService.cpp >index 7d528b265f8ad7ad4431d8a752376de7da3787c5..e22558e586b7ef1b6ccd96e69b02913e52c84c74 100644 >--- a/Source/WebDriver/WebDriverService.cpp >+++ b/Source/WebDriver/WebDriverService.cpp >@@ -54,7 +54,7 @@ static void printUsageStatement(const char* programName) > int WebDriverService::run(int argc, char** argv) > { > String portString; >- std::optional<String> host; >+ WTF::Optional<String> host; > for (int i = 1 ; i < argc; ++i) { > const char* arg = argv[i]; > if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) { >@@ -177,7 +177,7 @@ const WebDriverService::Command WebDriverService::s_commands[] = { > { HTTPMethod::Get, "/session/$sessionId/element/$elementId/displayed", &WebDriverService::isElementDisplayed }, > }; > >-std::optional<WebDriverService::HTTPMethod> WebDriverService::toCommandHTTPMethod(const String& method) >+WTF::Optional<WebDriverService::HTTPMethod> WebDriverService::toCommandHTTPMethod(const String& method) > { > auto lowerCaseMethod = method.convertToASCIILowercase(); > if (lowerCaseMethod == "get") >@@ -187,7 +187,7 @@ std::optional<WebDriverService::HTTPMethod> WebDriverService::toCommandHTTPMetho > if (lowerCaseMethod == "delete") > return WebDriverService::HTTPMethod::Delete; > >- return std::nullopt; >+ return WTF::nullopt; > } > > bool WebDriverService::findCommand(HTTPMethod method, const String& path, CommandHandler* handler, HashMap<String, String>& parameters) >@@ -287,38 +287,38 @@ void WebDriverService::sendResponse(Function<void (HTTPRequestHandler::Response& > replyHandler({ result.httpStatusCode(), responseObject->toJSONString().utf8(), "application/json; charset=utf-8"_s }); > } > >-static std::optional<double> valueAsNumberInRange(const JSON::Value& value, double minAllowed = 0, double maxAllowed = std::numeric_limits<int>::max()) >+static WTF::Optional<double> valueAsNumberInRange(const JSON::Value& value, double minAllowed = 0, double maxAllowed = std::numeric_limits<int>::max()) > { > double number; > if (!value.asDouble(number)) >- return std::nullopt; >+ return WTF::nullopt; > > if (std::isnan(number) || std::isinf(number)) >- return std::nullopt; >+ return WTF::nullopt; > > if (number < minAllowed || number > maxAllowed) >- return std::nullopt; >+ return WTF::nullopt; > > return number; > } > >-static std::optional<uint64_t> unsignedValue(JSON::Value& value) >+static WTF::Optional<uint64_t> unsignedValue(JSON::Value& value) > { > auto number = valueAsNumberInRange(value, 0, maxSafeInteger); > if (!number) >- return std::nullopt; >+ return WTF::nullopt; > > auto intValue = static_cast<uint64_t>(number.value()); > // If the contained value is a double, bail in case it doesn't match the integer > // value, i.e. if the double value was not originally in integer form. > // https://w3c.github.io/webdriver/webdriver-spec.html#dfn-integer > if (number.value() != intValue) >- return std::nullopt; >+ return WTF::nullopt; > > return intValue; > } > >-static std::optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject) >+static WTF::Optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject) > { > // §8.5 Set Timeouts. > // https://w3c.github.io/webdriver/webdriver-spec.html#dfn-deserialize-as-a-timeout >@@ -331,7 +331,7 @@ static std::optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject) > // If value is not an integer, or it is less than 0 or greater than the maximum safe integer, return error with error code invalid argument. > auto timeoutMS = unsignedValue(*it->value); > if (!timeoutMS) >- return std::nullopt; >+ return WTF::nullopt; > > if (it->key == "script") > timeouts.script = Seconds::fromMilliseconds(timeoutMS.value()); >@@ -340,12 +340,12 @@ static std::optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject) > else if (it->key == "implicit") > timeouts.implicit = Seconds::fromMilliseconds(timeoutMS.value()); > else >- return std::nullopt; >+ return WTF::nullopt; > } > return timeouts; > } > >-static std::optional<PageLoadStrategy> deserializePageLoadStrategy(const String& pageLoadStrategy) >+static WTF::Optional<PageLoadStrategy> deserializePageLoadStrategy(const String& pageLoadStrategy) > { > if (pageLoadStrategy == "none") > return PageLoadStrategy::None; >@@ -353,10 +353,10 @@ static std::optional<PageLoadStrategy> deserializePageLoadStrategy(const String& > return PageLoadStrategy::Normal; > if (pageLoadStrategy == "eager") > return PageLoadStrategy::Eager; >- return std::nullopt; >+ return WTF::nullopt; > } > >-static std::optional<UnhandledPromptBehavior> deserializeUnhandledPromptBehavior(const String& unhandledPromptBehavior) >+static WTF::Optional<UnhandledPromptBehavior> deserializeUnhandledPromptBehavior(const String& unhandledPromptBehavior) > { > if (unhandledPromptBehavior == "dismiss") > return UnhandledPromptBehavior::Dismiss; >@@ -368,7 +368,7 @@ static std::optional<UnhandledPromptBehavior> deserializeUnhandledPromptBehavior > return UnhandledPromptBehavior::AcceptAndNotify; > if (unhandledPromptBehavior == "ignore") > return UnhandledPromptBehavior::Ignore; >- return std::nullopt; >+ return WTF::nullopt; > } > > void WebDriverService::parseCapabilities(const JSON::Object& matchedCapabilities, Capabilities& capabilities) const >@@ -659,7 +659,7 @@ void WebDriverService::connectToBrowser(Vector<Capabilities>&& capabilitiesList, > > auto sessionHost = std::make_unique<SessionHost>(capabilitiesList.takeLast()); > auto* sessionHostPtr = sessionHost.get(); >- sessionHostPtr->connectToBrowser([this, capabilitiesList = WTFMove(capabilitiesList), sessionHost = WTFMove(sessionHost), completionHandler = WTFMove(completionHandler)](std::optional<String> error) mutable { >+ sessionHostPtr->connectToBrowser([this, capabilitiesList = WTFMove(capabilitiesList), sessionHost = WTFMove(sessionHost), completionHandler = WTFMove(completionHandler)](WTF::Optional<String> error) mutable { > if (error) { > completionHandler(CommandResult::fail(CommandResult::ErrorCode::SessionNotCreated, makeString("Failed to connect to browser: ", error.value()))); > return; >@@ -672,7 +672,7 @@ void WebDriverService::connectToBrowser(Vector<Capabilities>&& capabilitiesList, > void WebDriverService::createSession(Vector<Capabilities>&& capabilitiesList, std::unique_ptr<SessionHost>&& sessionHost, Function<void (CommandResult&&)>&& completionHandler) > { > auto* sessionHostPtr = sessionHost.get(); >- sessionHostPtr->startAutomationSession([this, capabilitiesList = WTFMove(capabilitiesList), sessionHost = WTFMove(sessionHost), completionHandler = WTFMove(completionHandler)](bool capabilitiesDidMatch, std::optional<String> errorMessage) mutable { >+ sessionHostPtr->startAutomationSession([this, capabilitiesList = WTFMove(capabilitiesList), sessionHost = WTFMove(sessionHost), completionHandler = WTFMove(completionHandler)](bool capabilitiesDidMatch, WTF::Optional<String> errorMessage) mutable { > if (errorMessage) { > completionHandler(CommandResult::fail(CommandResult::ErrorCode::UnknownError, errorMessage.value())); > return; >@@ -926,7 +926,7 @@ void WebDriverService::setWindowRect(RefPtr<JSON::Object>&& parameters, Function > // §10.7.2 Set Window Rect. > // https://w3c.github.io/webdriver/webdriver-spec.html#set-window-rect > RefPtr<JSON::Value> value; >- std::optional<double> width; >+ WTF::Optional<double> width; > if (parameters->getValue("width"_s, value)) { > if (auto number = valueAsNumberInRange(*value)) > width = number; >@@ -935,7 +935,7 @@ void WebDriverService::setWindowRect(RefPtr<JSON::Object>&& parameters, Function > return; > } > } >- std::optional<double> height; >+ WTF::Optional<double> height; > if (parameters->getValue("height"_s, value)) { > if (auto number = valueAsNumberInRange(*value)) > height = number; >@@ -944,7 +944,7 @@ void WebDriverService::setWindowRect(RefPtr<JSON::Object>&& parameters, Function > return; > } > } >- std::optional<double> x; >+ WTF::Optional<double> x; > if (parameters->getValue("x"_s, value)) { > if (auto number = valueAsNumberInRange(*value, INT_MIN)) > x = number; >@@ -953,7 +953,7 @@ void WebDriverService::setWindowRect(RefPtr<JSON::Object>&& parameters, Function > return; > } > } >- std::optional<double> y; >+ WTF::Optional<double> y; > if (parameters->getValue("y"_s, value)) { > if (auto number = valueAsNumberInRange(*value, INT_MIN)) > y = number; >@@ -1077,12 +1077,12 @@ void WebDriverService::switchToParentFrame(RefPtr<JSON::Object>&& parameters, Fu > }); > } > >-static std::optional<String> findElementOrCompleteWithError(JSON::Object& parameters, Function<void (CommandResult&&)>& completionHandler) >+static WTF::Optional<String> findElementOrCompleteWithError(JSON::Object& parameters, Function<void (CommandResult&&)>& completionHandler) > { > String elementID; > if (!parameters.getString("elementId"_s, elementID) || elementID.isEmpty()) { > completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument)); >- return std::nullopt; >+ return WTF::nullopt; > } > return elementID; > } >@@ -1488,43 +1488,43 @@ void WebDriverService::getNamedCookie(RefPtr<JSON::Object>&& parameters, Functio > }); > } > >-static std::optional<Session::Cookie> deserializeCookie(JSON::Object& cookieObject) >+static WTF::Optional<Session::Cookie> deserializeCookie(JSON::Object& cookieObject) > { > Session::Cookie cookie; > if (!cookieObject.getString("name"_s, cookie.name) || cookie.name.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > if (!cookieObject.getString("value"_s, cookie.value) || cookie.value.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > RefPtr<JSON::Value> value; > if (cookieObject.getValue("path"_s, value)) { > String path; > if (!value->asString(path)) >- return std::nullopt; >+ return WTF::nullopt; > cookie.path = path; > } > if (cookieObject.getValue("domain"_s, value)) { > String domain; > if (!value->asString(domain)) >- return std::nullopt; >+ return WTF::nullopt; > cookie.domain = domain; > } > if (cookieObject.getValue("secure"_s, value)) { > bool secure; > if (!value->asBoolean(secure)) >- return std::nullopt; >+ return WTF::nullopt; > cookie.secure = secure; > } > if (cookieObject.getValue("httpOnly"_s, value)) { > bool httpOnly; > if (!value->asBoolean(httpOnly)) >- return std::nullopt; >+ return WTF::nullopt; > cookie.httpOnly = httpOnly; > } > if (cookieObject.getValue("expiry"_s, value)) { > auto expiry = unsignedValue(*value); > if (!expiry) >- return std::nullopt; >+ return WTF::nullopt; > cookie.expiry = expiry.value(); > } > >@@ -1597,7 +1597,7 @@ void WebDriverService::deleteAllCookies(RefPtr<JSON::Object>&& parameters, Funct > }); > } > >-static bool processPauseAction(JSON::Object& actionItem, Action& action, std::optional<String>& errorMessage) >+static bool processPauseAction(JSON::Object& actionItem, Action& action, WTF::Optional<String>& errorMessage) > { > RefPtr<JSON::Value> durationValue; > if (!actionItem.getValue("duration"_s, durationValue)) { >@@ -1615,23 +1615,23 @@ static bool processPauseAction(JSON::Object& actionItem, Action& action, std::op > return true; > } > >-static std::optional<Action> processNullAction(const String& id, JSON::Object& actionItem, std::optional<String>& errorMessage) >+static WTF::Optional<Action> processNullAction(const String& id, JSON::Object& actionItem, WTF::Optional<String>& errorMessage) > { > String subtype; > actionItem.getString("type"_s, subtype); > if (subtype != "pause") { > errorMessage = String("The parameter 'type' in null action is invalid or missing"); >- return std::nullopt; >+ return WTF::nullopt; > } > > Action action(id, Action::Type::None, Action::Subtype::Pause); > if (!processPauseAction(actionItem, action, errorMessage)) >- return std::nullopt; >+ return WTF::nullopt; > > return action; > } > >-static std::optional<Action> processKeyAction(const String& id, JSON::Object& actionItem, std::optional<String>& errorMessage) >+static WTF::Optional<Action> processKeyAction(const String& id, JSON::Object& actionItem, WTF::Optional<String>& errorMessage) > { > Action::Subtype actionSubtype; > String subtype; >@@ -1644,7 +1644,7 @@ static std::optional<Action> processKeyAction(const String& id, JSON::Object& ac > actionSubtype = Action::Subtype::KeyDown; > else { > errorMessage = String("The parameter 'type' of key action is invalid"); >- return std::nullopt; >+ return WTF::nullopt; > } > > Action action(id, Action::Type::Key, actionSubtype); >@@ -1652,19 +1652,19 @@ static std::optional<Action> processKeyAction(const String& id, JSON::Object& ac > switch (actionSubtype) { > case Action::Subtype::Pause: > if (!processPauseAction(actionItem, action, errorMessage)) >- return std::nullopt; >+ return WTF::nullopt; > break; > case Action::Subtype::KeyUp: > case Action::Subtype::KeyDown: { > RefPtr<JSON::Value> keyValue; > if (!actionItem.getValue("value"_s, keyValue)) { > errorMessage = String("The paramater 'value' is missing for key up/down action"); >- return std::nullopt; >+ return WTF::nullopt; > } > String key; > if (!keyValue->asString(key) || key.isEmpty()) { > errorMessage = String("The paramater 'value' is invalid for key up/down action"); >- return std::nullopt; >+ return WTF::nullopt; > } > // FIXME: check single unicode code point. > action.key = key; >@@ -1696,7 +1696,7 @@ static MouseButton actionMouseButton(unsigned button) > return MouseButton::None; > } > >-static std::optional<Action> processPointerAction(const String& id, PointerParameters& parameters, JSON::Object& actionItem, std::optional<String>& errorMessage) >+static WTF::Optional<Action> processPointerAction(const String& id, PointerParameters& parameters, JSON::Object& actionItem, WTF::Optional<String>& errorMessage) > { > Action::Subtype actionSubtype; > String subtype; >@@ -1713,7 +1713,7 @@ static std::optional<Action> processPointerAction(const String& id, PointerParam > actionSubtype = Action::Subtype::PointerCancel; > else { > errorMessage = String("The parameter 'type' of pointer action is invalid"); >- return std::nullopt; >+ return WTF::nullopt; > } > > Action action(id, Action::Type::Pointer, actionSubtype); >@@ -1722,19 +1722,19 @@ static std::optional<Action> processPointerAction(const String& id, PointerParam > switch (actionSubtype) { > case Action::Subtype::Pause: > if (!processPauseAction(actionItem, action, errorMessage)) >- return std::nullopt; >+ return WTF::nullopt; > break; > case Action::Subtype::PointerUp: > case Action::Subtype::PointerDown: { > RefPtr<JSON::Value> buttonValue; > if (!actionItem.getValue("button"_s, buttonValue)) { > errorMessage = String("The paramater 'button' is missing for pointer up/down action"); >- return std::nullopt; >+ return WTF::nullopt; > } > auto button = unsignedValue(*buttonValue); > if (!button) { > errorMessage = String("The paramater 'button' is invalid for pointer up/down action"); >- return std::nullopt; >+ return WTF::nullopt; > } > action.button = actionMouseButton(button.value()); > break; >@@ -1745,7 +1745,7 @@ static std::optional<Action> processPointerAction(const String& id, PointerParam > auto duration = unsignedValue(*durationValue); > if (!duration) { > errorMessage = String("The parameter 'duration' is invalid in pointer move action"); >- return std::nullopt; >+ return WTF::nullopt; > } > action.duration = duration.value(); > } >@@ -1758,30 +1758,30 @@ static std::optional<Action> processPointerAction(const String& id, PointerParam > String elementID; > if (!originObject->getString(Session::webElementIdentifier(), elementID)) { > errorMessage = String("The parameter 'origin' is not a valid web element object in pointer move action"); >- return std::nullopt; >+ return WTF::nullopt; > } > action.origin = PointerOrigin { PointerOrigin::Type::Element, elementID }; > } else { > String origin; > originValue->asString(origin); > if (origin == "viewport") >- action.origin = PointerOrigin { PointerOrigin::Type::Viewport, std::nullopt }; >+ action.origin = PointerOrigin { PointerOrigin::Type::Viewport, WTF::nullopt }; > else if (origin == "pointer") >- action.origin = PointerOrigin { PointerOrigin::Type::Pointer, std::nullopt }; >+ action.origin = PointerOrigin { PointerOrigin::Type::Pointer, WTF::nullopt }; > else { > errorMessage = String("The parameter 'origin' is invalid in pointer move action"); >- return std::nullopt; >+ return WTF::nullopt; > } > } > } else >- action.origin = PointerOrigin { PointerOrigin::Type::Viewport, std::nullopt }; >+ action.origin = PointerOrigin { PointerOrigin::Type::Viewport, WTF::nullopt }; > > RefPtr<JSON::Value> xValue; > if (actionItem.getValue("x"_s, xValue)) { > auto x = valueAsNumberInRange(*xValue, INT_MIN); > if (!x) { > errorMessage = String("The paramater 'x' is invalid for pointer move action"); >- return std::nullopt; >+ return WTF::nullopt; > } > action.x = x.value(); > } >@@ -1791,7 +1791,7 @@ static std::optional<Action> processPointerAction(const String& id, PointerParam > auto y = valueAsNumberInRange(*yValue, INT_MIN); > if (!y) { > errorMessage = String("The paramater 'y' is invalid for pointer move action"); >- return std::nullopt; >+ return WTF::nullopt; > } > action.y = y.value(); > } >@@ -1807,7 +1807,7 @@ static std::optional<Action> processPointerAction(const String& id, PointerParam > return action; > } > >-static std::optional<PointerParameters> processPointerParameters(JSON::Object& actionSequence, std::optional<String>& errorMessage) >+static WTF::Optional<PointerParameters> processPointerParameters(JSON::Object& actionSequence, WTF::Optional<String>& errorMessage) > { > PointerParameters parameters; > RefPtr<JSON::Value> parametersDataValue; >@@ -1817,7 +1817,7 @@ static std::optional<PointerParameters> processPointerParameters(JSON::Object& a > RefPtr<JSON::Object> parametersData; > if (!parametersDataValue->asObject(parametersData)) { > errorMessage = String("Action sequence pointer parameters is not an object"); >- return std::nullopt; >+ return WTF::nullopt; > } > > String pointerType; >@@ -1832,18 +1832,18 @@ static std::optional<PointerParameters> processPointerParameters(JSON::Object& a > parameters.pointerType = PointerType::Touch; > else { > errorMessage = String("The parameter 'pointerType' in action sequence pointer parameters is invalid"); >- return std::nullopt; >+ return WTF::nullopt; > } > > return parameters; > } > >-static std::optional<Vector<Action>> processInputActionSequence(Session& session, JSON::Value& actionSequenceValue, std::optional<String>& errorMessage) >+static WTF::Optional<Vector<Action>> processInputActionSequence(Session& session, JSON::Value& actionSequenceValue, WTF::Optional<String>& errorMessage) > { > RefPtr<JSON::Object> actionSequence; > if (!actionSequenceValue.asObject(actionSequence)) { > errorMessage = String("The action sequence is not an object"); >- return std::nullopt; >+ return WTF::nullopt; > } > > String type; >@@ -1857,21 +1857,21 @@ static std::optional<Vector<Action>> processInputActionSequence(Session& session > inputSourceType = InputSource::Type::None; > else { > errorMessage = String("The parameter 'type' is invalid or missing in action sequence"); >- return std::nullopt; >+ return WTF::nullopt; > } > > String id; > if (!actionSequence->getString("id"_s, id)) { > errorMessage = String("The parameter 'id' is invalid or missing in action sequence"); >- return std::nullopt; >+ return WTF::nullopt; > } > >- std::optional<PointerParameters> parameters; >- std::optional<PointerType> pointerType; >+ WTF::Optional<PointerParameters> parameters; >+ WTF::Optional<PointerType> pointerType; > if (inputSourceType == InputSource::Type::Pointer) { > parameters = processPointerParameters(*actionSequence, errorMessage); > if (!parameters) >- return std::nullopt; >+ return WTF::nullopt; > > pointerType = parameters->pointerType; > } >@@ -1879,18 +1879,18 @@ static std::optional<Vector<Action>> processInputActionSequence(Session& session > auto& inputSource = session.getOrCreateInputSource(id, inputSourceType, pointerType); > if (inputSource.type != inputSourceType) { > errorMessage = String("Action sequence type doesn't match input source type"); >- return std::nullopt; >+ return WTF::nullopt; > } > > if (inputSource.type == InputSource::Type::Pointer && inputSource.pointerType != pointerType) { > errorMessage = String("Action sequence pointer type doesn't match input source pointer type"); >- return std::nullopt; >+ return WTF::nullopt; > } > > RefPtr<JSON::Array> actionItems; > if (!actionSequence->getArray("actions"_s, actionItems)) { > errorMessage = String("The parameter 'actions' is invalid or not present in action sequence"); >- return std::nullopt; >+ return WTF::nullopt; > } > > Vector<Action> actions; >@@ -1900,10 +1900,10 @@ static std::optional<Vector<Action>> processInputActionSequence(Session& session > RefPtr<JSON::Object> actionItem; > if (!actionItemValue->asObject(actionItem)) { > errorMessage = String("An action in action sequence is not an object"); >- return std::nullopt; >+ return WTF::nullopt; > } > >- std::optional<Action> action; >+ WTF::Optional<Action> action; > if (inputSourceType == InputSource::Type::None) > action = processNullAction(id, *actionItem, errorMessage); > else if (inputSourceType == InputSource::Type::Key) >@@ -1911,7 +1911,7 @@ static std::optional<Vector<Action>> processInputActionSequence(Session& session > else if (inputSourceType == InputSource::Type::Pointer) > action = processPointerAction(id, parameters.value(), *actionItem, errorMessage); > if (!action) >- return std::nullopt; >+ return WTF::nullopt; > > actions.append(action.value()); > } >@@ -1932,7 +1932,7 @@ void WebDriverService::performActions(RefPtr<JSON::Object>&& parameters, Functio > return; > } > >- std::optional<String> errorMessage; >+ WTF::Optional<String> errorMessage; > Vector<Vector<Action>> actionsByTick; > unsigned actionsArrayLength = actionsArray->length(); > for (unsigned i = 0; i < actionsArrayLength; ++i) { >@@ -2044,7 +2044,7 @@ void WebDriverService::takeScreenshot(RefPtr<JSON::Object>&& parameters, Functio > completionHandler(WTFMove(result)); > return; > } >- m_session->takeScreenshot(std::nullopt, std::nullopt, WTFMove(completionHandler)); >+ m_session->takeScreenshot(WTF::nullopt, WTF::nullopt, WTFMove(completionHandler)); > }); > } > >diff --git a/Source/WebDriver/WebDriverService.h b/Source/WebDriver/WebDriverService.h >index 4d6878ef45dcdb45248e2137a3b1773e3b9f68c9..da96af50f05ba2fe1771a33cd93a37f03c05c277 100644 >--- a/Source/WebDriver/WebDriverService.h >+++ b/Source/WebDriver/WebDriverService.h >@@ -57,7 +57,7 @@ private: > }; > static const Command s_commands[]; > >- static std::optional<HTTPMethod> toCommandHTTPMethod(const String& method); >+ static WTF::Optional<HTTPMethod> toCommandHTTPMethod(const String& method); > static bool findCommand(HTTPMethod, const String& path, CommandHandler*, HashMap<String, String>& parameters); > > void newSession(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&); >diff --git a/Source/WebDriver/glib/SessionHostGlib.cpp b/Source/WebDriver/glib/SessionHostGlib.cpp >index a5aa783593ba034c1bab916bc09f93c1102ba650..46173e5c43659aca943f05d62439db6ab7abe60f 100644 >--- a/Source/WebDriver/glib/SessionHostGlib.cpp >+++ b/Source/WebDriver/glib/SessionHostGlib.cpp >@@ -99,7 +99,7 @@ const GDBusInterfaceVTable SessionHost::s_interfaceVTable = { > { 0 } > }; > >-void SessionHost::connectToBrowser(Function<void (std::optional<String> error)>&& completionHandler) >+void SessionHost::connectToBrowser(Function<void (WTF::Optional<String> error)>&& completionHandler) > { > launchBrowser(WTFMove(completionHandler)); > } >@@ -110,7 +110,7 @@ bool SessionHost::isConnected() const > } > > struct ConnectToBrowserAsyncData { >- ConnectToBrowserAsyncData(SessionHost* sessionHost, GUniquePtr<char>&& dbusAddress, GCancellable* cancellable, Function<void (std::optional<String> error)>&& completionHandler) >+ ConnectToBrowserAsyncData(SessionHost* sessionHost, GUniquePtr<char>&& dbusAddress, GCancellable* cancellable, Function<void (WTF::Optional<String> error)>&& completionHandler) > : sessionHost(sessionHost) > , dbusAddress(WTFMove(dbusAddress)) > , cancellable(cancellable) >@@ -121,7 +121,7 @@ struct ConnectToBrowserAsyncData { > SessionHost* sessionHost; > GUniquePtr<char> dbusAddress; > GRefPtr<GCancellable> cancellable; >- Function<void (std::optional<String> error)> completionHandler; >+ Function<void (WTF::Optional<String> error)> completionHandler; > }; > > static guint16 freePort() >@@ -136,7 +136,7 @@ static guint16 freePort() > return g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS(address.get())); > } > >-void SessionHost::launchBrowser(Function<void (std::optional<String> error)>&& completionHandler) >+void SessionHost::launchBrowser(Function<void (WTF::Optional<String> error)>&& completionHandler) > { > m_cancellable = adoptGRef(g_cancellable_new()); > GRefPtr<GSubprocessLauncher> launcher = adoptGRef(g_subprocess_launcher_new(G_SUBPROCESS_FLAGS_NONE)); >@@ -201,7 +201,7 @@ void SessionHost::connectToBrowser(std::unique_ptr<ConnectToBrowserAsyncData>&& > return; > } > data->sessionHost->setupConnection(WTFMove(connection)); >- data->completionHandler(std::nullopt); >+ data->completionHandler(WTF::nullopt); > }, data); > }); > } >@@ -283,7 +283,7 @@ bool SessionHost::buildSessionCapabilities(GVariantBuilder* builder) const > return true; > } > >-void SessionHost::startAutomationSession(Function<void (bool, std::optional<String>)>&& completionHandler) >+void SessionHost::startAutomationSession(Function<void (bool, WTF::Optional<String>)>&& completionHandler) > { > ASSERT(m_dbusConnection); > ASSERT(!m_startSessionCompletionHandler); >@@ -311,7 +311,7 @@ void SessionHost::startAutomationSession(Function<void (bool, std::optional<Stri > > if (!sessionHost->matchCapabilities(resultVariant.get())) { > auto completionHandler = std::exchange(sessionHost->m_startSessionCompletionHandler, nullptr); >- completionHandler(false, std::nullopt); >+ completionHandler(false, WTF::nullopt); > return; > } > }, this >@@ -355,7 +355,7 @@ void SessionHost::setTargetList(uint64_t connectionID, Vector<Target>&& targetLi > -1, m_cancellable.get(), dbusConnectionCallAsyncReadyCallback, nullptr); > > auto startSessionCompletionHandler = std::exchange(m_startSessionCompletionHandler, nullptr); >- startSessionCompletionHandler(true, std::nullopt); >+ startSessionCompletionHandler(true, WTF::nullopt); > } > > void SessionHost::sendMessageToFrontend(uint64_t connectionID, uint64_t targetID, const char* message) >diff --git a/Source/WebDriver/gtk/WebDriverServiceGtk.cpp b/Source/WebDriver/gtk/WebDriverServiceGtk.cpp >index 808b7e2298adf3f8dee6d8b558e9aaeb1dec41ad..24d1bdd014a070b597644b55367d437407e2c194 100644 >--- a/Source/WebDriver/gtk/WebDriverServiceGtk.cpp >+++ b/Source/WebDriver/gtk/WebDriverServiceGtk.cpp >@@ -123,7 +123,7 @@ void WebDriverService::platformParseCapabilities(const JSON::Object& matchedCapa > String browserBinary; > if (browserOptions->getString("binary"_s, browserBinary)) { > capabilities.browserBinary = browserBinary; >- capabilities.browserArguments = std::nullopt; >+ capabilities.browserArguments = WTF::nullopt; > } > > RefPtr<JSON::Array> browserArguments; >diff --git a/Source/WebDriver/soup/HTTPServerSoup.cpp b/Source/WebDriver/soup/HTTPServerSoup.cpp >index 45e199e40199e12261ffca3bbebad6894f60cb89..f821572b1a06bdbc9c19fe1ce326c316f2f7ff99 100644 >--- a/Source/WebDriver/soup/HTTPServerSoup.cpp >+++ b/Source/WebDriver/soup/HTTPServerSoup.cpp >@@ -32,7 +32,7 @@ > > namespace WebDriver { > >-static bool soupServerListen(SoupServer* server, const std::optional<String>& host, unsigned port, GError** error) >+static bool soupServerListen(SoupServer* server, const WTF::Optional<String>& host, unsigned port, GError** error) > { > static const auto options = static_cast<SoupServerListenOptions>(0); > if (!host || host.value() == "local") >@@ -50,7 +50,7 @@ static bool soupServerListen(SoupServer* server, const std::optional<String>& ho > return soup_server_listen(server, address.get(), options, error); > } > >-bool HTTPServer::listen(const std::optional<String>& host, unsigned port) >+bool HTTPServer::listen(const WTF::Optional<String>& host, unsigned port) > { > m_soupServer = adoptGRef(soup_server_new(SOUP_SERVER_SERVER_HEADER, "WebKitWebDriver", nullptr)); > GUniqueOutPtr<GError> error; >diff --git a/Source/WebDriver/wpe/WebDriverServiceWPE.cpp b/Source/WebDriver/wpe/WebDriverServiceWPE.cpp >index 66ae94e4a6ac8d5dfcd755cbf8ad5241f183d084..06d3a5c2a8252918e74f103ebc89cb52379e9037 100644 >--- a/Source/WebDriver/wpe/WebDriverServiceWPE.cpp >+++ b/Source/WebDriver/wpe/WebDriverServiceWPE.cpp >@@ -115,7 +115,7 @@ void WebDriverService::platformParseCapabilities(const JSON::Object& matchedCapa > String browserBinary; > if (browserOptions->getString("binary"_s, browserBinary)) { > capabilities.browserBinary = browserBinary; >- capabilities.browserArguments = std::nullopt; >+ capabilities.browserArguments = WTF::nullopt; > } > > RefPtr<JSON::Array> browserArguments; >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >index 9bba7809ee238c0016531c028a3fa2735de1db8e..d1e570b6c18d998737fcf159bcc23dc852ec8cc7 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >@@ -446,26 +446,26 @@ void NetworkConnectionToWebProcess::convertMainResourceLoadToDownload(PAL::Sessi > loader->convertToDownload(downloadID, request, response); > } > >-void NetworkConnectionToWebProcess::cookiesForDOM(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies, String& cookieString, bool& secureCookiesAccessed) >+void NetworkConnectionToWebProcess::cookiesForDOM(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies, String& cookieString, bool& secureCookiesAccessed) > { > auto& networkStorageSession = storageSession(sessionID); > std::tie(cookieString, secureCookiesAccessed) = networkStorageSession.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED > if (auto session = SessionTracker::networkSession(sessionID)) { > if (session->shouldLogCookieInformation()) >- NetworkResourceLoader::logCookieInformation("NetworkConnectionToWebProcess::cookiesForDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, std::nullopt); >+ NetworkResourceLoader::logCookieInformation("NetworkConnectionToWebProcess::cookiesForDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, WTF::nullopt); > } > #endif > } > >-void NetworkConnectionToWebProcess::setCookiesFromDOM(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& cookieString) >+void NetworkConnectionToWebProcess::setCookiesFromDOM(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& cookieString) > { > auto& networkStorageSession = storageSession(sessionID); > networkStorageSession.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString); > #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED > if (auto session = SessionTracker::networkSession(sessionID)) { > if (session->shouldLogCookieInformation()) >- NetworkResourceLoader::logCookieInformation("NetworkConnectionToWebProcess::setCookiesFromDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, std::nullopt); >+ NetworkResourceLoader::logCookieInformation("NetworkConnectionToWebProcess::setCookiesFromDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, WTF::nullopt); > } > #endif > } >@@ -475,12 +475,12 @@ void NetworkConnectionToWebProcess::cookiesEnabled(PAL::SessionID sessionID, boo > result = storageSession(sessionID).cookiesEnabled(); > } > >-void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies, String& cookieString, bool& secureCookiesAccessed) >+void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies, String& cookieString, bool& secureCookiesAccessed) > { > std::tie(cookieString, secureCookiesAccessed) = storageSession(sessionID).cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-void NetworkConnectionToWebProcess::getRawCookies(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& result) >+void NetworkConnectionToWebProcess::getRawCookies(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& result) > { > storageSession(sessionID).getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, result); > } >@@ -593,10 +593,10 @@ void NetworkConnectionToWebProcess::resetOriginAccessWhitelists() > SecurityPolicy::resetOriginAccessWhitelists(); > } > >-std::optional<NetworkActivityTracker> NetworkConnectionToWebProcess::startTrackingResourceLoad(uint64_t pageID, ResourceLoadIdentifier resourceID, bool isMainResource, const PAL::SessionID& sessionID) >+WTF::Optional<NetworkActivityTracker> NetworkConnectionToWebProcess::startTrackingResourceLoad(uint64_t pageID, ResourceLoadIdentifier resourceID, bool isMainResource, const PAL::SessionID& sessionID) > { > if (sessionID.isEphemeral()) >- return std::nullopt; >+ return WTF::nullopt; > > // Either get the existing root activity tracker for this page or create a > // new one if this is the main resource. >@@ -621,7 +621,7 @@ std::optional<NetworkActivityTracker> NetworkConnectionToWebProcess::startTracki > // This could happen if the Networking process crashes, taking its > // previous state with it. > if (rootActivityIndex == notFound) >- return std::nullopt; >+ return WTF::nullopt; > > #if HAVE(NW_ACTIVITY) > ASSERT(m_networkActivityTrackers[rootActivityIndex].networkActivity.getPlatformObject()); >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >index 9be001aa994bf713b2f72f5e3092bb7b52d40dc1..e4f18e24ca7c16839ee072835dc99fc7ce5417f2 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >@@ -116,7 +116,7 @@ public: > m_networkLoadInformationByID.remove(identifier); > } > >- std::optional<NetworkActivityTracker> startTrackingResourceLoad(uint64_t pageID, ResourceLoadIdentifier resourceID, bool isMainResource, const PAL::SessionID&); >+ WTF::Optional<NetworkActivityTracker> startTrackingResourceLoad(uint64_t pageID, ResourceLoadIdentifier resourceID, bool isMainResource, const PAL::SessionID&); > void stopTrackingResourceLoad(ResourceLoadIdentifier resourceID, NetworkActivityTracker::CompletionCode); > > private: >@@ -147,11 +147,11 @@ private: > void startDownload(PAL::SessionID, DownloadID, const WebCore::ResourceRequest&, const String& suggestedName = { }); > void convertMainResourceLoadToDownload(PAL::SessionID, uint64_t mainResourceLoadIdentifier, DownloadID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); > >- void cookiesForDOM(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies, String& cookieString, bool& secureCookiesAccessed); >- void setCookiesFromDOM(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String&); >+ void cookiesForDOM(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies, String& cookieString, bool& secureCookiesAccessed); >+ void setCookiesFromDOM(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String&); > void cookiesEnabled(PAL::SessionID, bool& result); >- void cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies, String& cookieString, bool& secureCookiesAccessed); >- void getRawCookies(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<WebCore::Cookie>&); >+ void cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies, String& cookieString, bool& secureCookiesAccessed); >+ void getRawCookies(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<WebCore::Cookie>&); > void deleteCookie(PAL::SessionID, const URL&, const String& cookieName); > > void registerFileBlobURL(const URL&, const String& path, SandboxExtension::Handle&&, const String& contentType); >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >index a774963f61de94c5b08ab0f6be4ee161c624b01b..29c430ed67b1063d9facc36d4f34afbdb3c0b01e 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >@@ -34,11 +34,11 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver { > StartDownload(PAL::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, String suggestedName) > ConvertMainResourceLoadToDownload(PAL::SessionID sessionID, uint64_t mainResourceLoadIdentifier, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, WebCore::ResourceResponse response) > >- CookiesForDOM(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, enum:bool WebCore::IncludeSecureCookies includeSecureCookies) -> (String cookieString, bool didAccessSecureCookies) LegacySync >- SetCookiesFromDOM(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, String cookieString) >+ CookiesForDOM(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, enum:bool WebCore::IncludeSecureCookies includeSecureCookies) -> (String cookieString, bool didAccessSecureCookies) LegacySync >+ SetCookiesFromDOM(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, String cookieString) > CookiesEnabled(PAL::SessionID sessionID) -> (bool enabled) LegacySync >- CookieRequestHeaderFieldValue(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, enum:bool WebCore::IncludeSecureCookies includeSecureCookies) -> (String cookieString, bool didAccessSecureCookies) LegacySync >- GetRawCookies(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) -> (Vector<WebCore::Cookie> cookies) LegacySync >+ CookieRequestHeaderFieldValue(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, enum:bool WebCore::IncludeSecureCookies includeSecureCookies) -> (String cookieString, bool didAccessSecureCookies) LegacySync >+ GetRawCookies(PAL::SessionID sessionID, URL firstParty, struct WebCore::SameSiteInfo sameSiteInfo, URL url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID) -> (Vector<WebCore::Cookie> cookies) LegacySync > DeleteCookie(PAL::SessionID sessionID, URL url, String cookieName) > > RegisterFileBlobURL(URL url, String path, WebKit::SandboxExtension::Handle extensionHandle, String contentType) >diff --git a/Source/WebKit/NetworkProcess/NetworkDataTask.cpp b/Source/WebKit/NetworkProcess/NetworkDataTask.cpp >index 4f4c415a17c8fc3c30e7fd01b3f74fda9d8594e7..4cf5dae43562f935a5ddea786b0c538a1df8a6b3 100644 >--- a/Source/WebKit/NetworkProcess/NetworkDataTask.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkDataTask.cpp >@@ -103,7 +103,7 @@ void NetworkDataTask::didReceiveResponse(ResourceResponse&& response, ResponseCo > ASSERT(m_client); > if (response.isHTTP09()) { > auto url = response.url(); >- std::optional<uint16_t> port = url.port(); >+ WTF::Optional<uint16_t> port = url.port(); > if (port && !WTF::isDefaultPortForProtocol(port.value(), url.protocol())) { > completionHandler(PolicyAction::Ignore); > cancel(); >diff --git a/Source/WebKit/NetworkProcess/NetworkLoadChecker.h b/Source/WebKit/NetworkProcess/NetworkLoadChecker.h >index 6227c957d44ce62b6436033a834538169077e8c8..8b4b29caac70eb8e45200fdeaa78e124812507d3 100644 >--- a/Source/WebKit/NetworkProcess/NetworkLoadChecker.h >+++ b/Source/WebKit/NetworkProcess/NetworkLoadChecker.h >@@ -68,7 +68,7 @@ public: > > void setCSPResponseHeaders(WebCore::ContentSecurityPolicyResponseHeaders&& headers) { m_cspResponseHeaders = WTFMove(headers); } > #if ENABLE(CONTENT_EXTENSIONS) >- void setContentExtensionController(URL&& mainDocumentURL, std::optional<UserContentControllerIdentifier> identifier) >+ void setContentExtensionController(URL&& mainDocumentURL, WTF::Optional<UserContentControllerIdentifier> identifier) > { > m_mainDocumentURL = WTFMove(mainDocumentURL); > m_userContentControllerIdentifier = identifier; >@@ -125,10 +125,10 @@ private: > WebCore::HTTPHeaderMap m_firstRequestHeaders; // Needed for CORS checks. > URL m_url; > RefPtr<WebCore::SecurityOrigin> m_origin; >- std::optional<WebCore::ContentSecurityPolicyResponseHeaders> m_cspResponseHeaders; >+ WTF::Optional<WebCore::ContentSecurityPolicyResponseHeaders> m_cspResponseHeaders; > #if ENABLE(CONTENT_EXTENSIONS) > URL m_mainDocumentURL; >- std::optional<UserContentControllerIdentifier> m_userContentControllerIdentifier; >+ WTF::Optional<UserContentControllerIdentifier> m_userContentControllerIdentifier; > #endif > > std::unique_ptr<NetworkCORSPreflightChecker> m_corsPreflightChecker; >diff --git a/Source/WebKit/NetworkProcess/NetworkLoadParameters.h b/Source/WebKit/NetworkProcess/NetworkLoadParameters.h >index decb94e73ee97665f8ae312baf87e4b9713d8790..6ea9a622c543c6496de8a2361cfc351cc6663b26 100644 >--- a/Source/WebKit/NetworkProcess/NetworkLoadParameters.h >+++ b/Source/WebKit/NetworkProcess/NetworkLoadParameters.h >@@ -51,7 +51,7 @@ public: > bool isMainFrameNavigation { false }; > Vector<RefPtr<WebCore::BlobDataFileReference>> blobFileReferences; > PreconnectOnly shouldPreconnectOnly { PreconnectOnly::No }; >- std::optional<NetworkActivityTracker> networkActivityTracker; >+ WTF::Optional<NetworkActivityTracker> networkActivityTracker; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >index 0b31ff7733dc24ca061cbdebe644bba9e013ac35..83ea37f90788e70ff7bc4b70950ef745bd5da37c 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >@@ -484,7 +484,7 @@ void NetworkProcess::updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sess > parentProcessConnection()->send(Messages::NetworkProcessProxy::DidUpdateBlockCookies(contextId), 0); > } > >-void NetworkProcess::setAgeCapForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, uint64_t contextId) >+void NetworkProcess::setAgeCapForClientSideCookies(PAL::SessionID sessionID, WTF::Optional<Seconds> seconds, uint64_t contextId) > { > if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) > networkStorageSession->setAgeCapForClientSideCookies(seconds); >@@ -507,7 +507,7 @@ void NetworkProcess::getAllStorageAccessEntries(PAL::SessionID sessionID, uint64 > ASSERT_NOT_REACHED(); > } > >-void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) >+void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) > { > bool isStorageGranted = false; > if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) { >@@ -1201,7 +1201,7 @@ void NetworkProcess::connectionToContextProcessWasClosed(Ref<WebSWServerToContex > > if (needsServerToContextConnectionForOrigin(securityOrigin)) { > RELEASE_LOG(ServiceWorker, "Connection to service worker process was closed but is still needed, relaunching it"); >- createServerToContextConnection(securityOrigin, std::nullopt); >+ createServerToContextConnection(securityOrigin, WTF::nullopt); > } > } > >@@ -1249,7 +1249,7 @@ WebSWServerToContextConnection* NetworkProcess::serverToContextConnectionForOrig > return m_serverToContextConnections.get(securityOrigin); > } > >-void NetworkProcess::createServerToContextConnection(const SecurityOriginData& securityOrigin, std::optional<PAL::SessionID> sessionID) >+void NetworkProcess::createServerToContextConnection(const SecurityOriginData& securityOrigin, WTF::Optional<PAL::SessionID> sessionID) > { > if (m_waitingForServerToContextProcessConnection) > return; >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h >index f5c2fedbfc7e779b51d350e1c1e9e6a550458ee3..7199481288701964910bfbee8c8ce4ba2475340b 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h >@@ -149,10 +149,10 @@ public: > > #if ENABLE(RESOURCE_LOAD_STATISTICS) > void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<String>& domainsToBlock, uint64_t contextId); >- void setAgeCapForClientSideCookies(PAL::SessionID, std::optional<Seconds>, uint64_t contextId); >+ void setAgeCapForClientSideCookies(PAL::SessionID, WTF::Optional<Seconds>, uint64_t contextId); > void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId); > void getAllStorageAccessEntries(PAL::SessionID, uint64_t contextId); >- void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId); >+ void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId); > void removeAllStorageAccess(PAL::SessionID, uint64_t contextId); > void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains); > void setCacheMaxAgeCapForPrevalentResources(PAL::SessionID, Seconds, uint64_t contextId); >@@ -186,7 +186,7 @@ public: > > #if ENABLE(SERVICE_WORKER) > WebSWServerToContextConnection* serverToContextConnectionForOrigin(const WebCore::SecurityOriginData&); >- void createServerToContextConnection(const WebCore::SecurityOriginData&, std::optional<PAL::SessionID>); >+ void createServerToContextConnection(const WebCore::SecurityOriginData&, WTF::Optional<PAL::SessionID>); > > WebCore::SWServer& swServerForSession(PAL::SessionID); > void registerSWServerConnection(WebSWServerConnection&); >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >index 50795a282279b1367160091b28ad9c71b03d5fe1..8587bf533a535d72dd4ce12b9b5ff9f070a23673 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >@@ -86,10 +86,10 @@ messages -> NetworkProcess LegacyReceiver { > > #if ENABLE(RESOURCE_LOAD_STATISTICS) > UpdatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, Vector<String> domainsToBlock, uint64_t contextId) >- SetAgeCapForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, uint64_t contextId) >+ SetAgeCapForClientSideCookies(PAL::SessionID sessionID, WTF::Optional<Seconds> seconds, uint64_t contextId) > HasStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) > GetAllStorageAccessEntries(PAL::SessionID sessionID, uint64_t contextId) >- GrantStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) >+ GrantStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) > RemoveAllStorageAccess(PAL::SessionID sessionID, uint64_t contextId) > RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction) > SetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID, Seconds seconds, uint64_t contextId) >diff --git a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp >index 639752e182a58b92a72a0fd0de1899056dd7d797..fffb825372a87e9b938a4cba810aea8f1757fe72 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp >@@ -119,7 +119,7 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc > if (!decoder.decode(result.diskCacheDirectory)) > return false; > >- std::optional<SandboxExtension::Handle> diskCacheDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> diskCacheDirectoryExtensionHandle; > decoder >> diskCacheDirectoryExtensionHandle; > if (!diskCacheDirectoryExtensionHandle) > return false; >@@ -138,26 +138,26 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc > if (!decoder.decode(result.defaultSessionPendingCookies)) > return false; > #if PLATFORM(IOS_FAMILY) >- std::optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle; > decoder >> cookieStorageDirectoryExtensionHandle; > if (!cookieStorageDirectoryExtensionHandle) > return false; > result.cookieStorageDirectoryExtensionHandle = WTFMove(*cookieStorageDirectoryExtensionHandle); > >- std::optional<SandboxExtension::Handle> containerCachesDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> containerCachesDirectoryExtensionHandle; > decoder >> containerCachesDirectoryExtensionHandle; > if (!containerCachesDirectoryExtensionHandle) > return false; > result.containerCachesDirectoryExtensionHandle = WTFMove(*containerCachesDirectoryExtensionHandle); > >- std::optional<SandboxExtension::Handle> parentBundleDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> parentBundleDirectoryExtensionHandle; > decoder >> parentBundleDirectoryExtensionHandle; > if (!parentBundleDirectoryExtensionHandle) > return false; > result.parentBundleDirectoryExtensionHandle = WTFMove(*parentBundleDirectoryExtensionHandle); > > #if ENABLE(INDEXED_DATABASE) >- std::optional<SandboxExtension::Handle> indexedDatabaseTempBlobDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> indexedDatabaseTempBlobDirectoryExtensionHandle; > decoder >> indexedDatabaseTempBlobDirectoryExtensionHandle; > if (!indexedDatabaseTempBlobDirectoryExtensionHandle) > return false; >@@ -235,7 +235,7 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc > if (!decoder.decode(result.indexedDatabaseDirectory)) > return false; > >- std::optional<SandboxExtension::Handle> indexedDatabaseDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> indexedDatabaseDirectoryExtensionHandle; > decoder >> indexedDatabaseDirectoryExtensionHandle; > if (!indexedDatabaseDirectoryExtensionHandle) > return false; >@@ -246,7 +246,7 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc > if (!decoder.decode(result.serviceWorkerRegistrationDirectory)) > return false; > >- std::optional<SandboxExtension::Handle> serviceWorkerRegistrationDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> serviceWorkerRegistrationDirectoryExtensionHandle; > decoder >> serviceWorkerRegistrationDirectoryExtensionHandle; > if (!serviceWorkerRegistrationDirectoryExtensionHandle) > return false; >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp >index 1b57415be89c3b9a46939143df9c93c0dd927a5e..5de9b8d53ebaf6fc802629b3bb8cac6ea0ee2385 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp >@@ -128,7 +128,7 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > return false; > result.request.setHTTPBody(WTFMove(formData)); > >- std::optional<SandboxExtension::HandleArray> requestBodySandboxExtensionHandles; >+ WTF::Optional<SandboxExtension::HandleArray> requestBodySandboxExtensionHandles; > decoder >> requestBodySandboxExtensionHandles; > if (!requestBodySandboxExtensionHandles) > return false; >@@ -139,7 +139,7 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > } > > if (result.request.url().isLocalFile()) { >- std::optional<SandboxExtension::Handle> resourceSandboxExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> resourceSandboxExtensionHandle; > decoder >> resourceSandboxExtensionHandle; > if (!resourceSandboxExtensionHandle) > return false; >@@ -176,7 +176,7 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > return false; > } > >- std::optional<FetchOptions> options; >+ WTF::Optional<FetchOptions> options; > decoder >> options; > if (!options) > return false; >@@ -187,7 +187,7 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > if (!decoder.decode(result.originalRequestHeaders)) > return false; > >- std::optional<bool> shouldRestrictHTTPResponseAccess; >+ WTF::Optional<bool> shouldRestrictHTTPResponseAccess; > decoder >> shouldRestrictHTTPResponseAccess; > if (!shouldRestrictHTTPResponseAccess) > return false; >@@ -196,7 +196,7 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > if (!decoder.decodeEnum(result.preflightPolicy)) > return false; > >- std::optional<bool> shouldEnableCrossOriginResourcePolicy; >+ WTF::Optional<bool> shouldEnableCrossOriginResourcePolicy; > decoder >> shouldEnableCrossOriginResourcePolicy; > if (!shouldEnableCrossOriginResourcePolicy) > return false; >@@ -209,7 +209,7 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc > if (!decoder.decode(result.mainDocumentURL)) > return false; > >- std::optional<std::optional<UserContentControllerIdentifier>> userContentControllerIdentifier; >+ WTF::Optional<WTF::Optional<UserContentControllerIdentifier>> userContentControllerIdentifier; > decoder >> userContentControllerIdentifier; > if (!userContentControllerIdentifier) > return false; >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h b/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h >index ba987d88a480ea085bdddce468b9fcfd3174b07d..d0c7a240310a70fc2091f2dfef341c2e9b19990d 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h >@@ -53,7 +53,7 @@ public: > Seconds maximumBufferingTime; > RefPtr<WebCore::SecurityOrigin> sourceOrigin; > WebCore::FetchOptions options; >- std::optional<WebCore::ContentSecurityPolicyResponseHeaders> cspResponseHeaders; >+ WTF::Optional<WebCore::ContentSecurityPolicyResponseHeaders> cspResponseHeaders; > WebCore::HTTPHeaderMap originalRequestHeaders; > bool shouldRestrictHTTPResponseAccess { false }; > WebCore::PreflightPolicy preflightPolicy { WebCore::PreflightPolicy::Consider }; >@@ -62,7 +62,7 @@ public: > > #if ENABLE(CONTENT_EXTENSIONS) > URL mainDocumentURL; >- std::optional<UserContentControllerIdentifier> userContentControllerIdentifier; >+ WTF::Optional<UserContentControllerIdentifier> userContentControllerIdentifier; > #endif > }; > >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >index e38927be3148ccbe255264ad4523def9ebb52350..214352192eb9a954ca73acdd0c5924e15a82a7f5 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >@@ -593,7 +593,7 @@ void NetworkResourceLoader::didBlockAuthenticationChallenge() > send(Messages::WebResourceLoader::DidBlockAuthenticationChallenge()); > } > >-std::optional<Seconds> NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation(const ResourceRequest& request, const ResourceRequest& redirectRequest, const ResourceResponse& redirectResponse) >+WTF::Optional<Seconds> NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation(const ResourceRequest& request, const ResourceRequest& redirectRequest, const ResourceResponse& redirectResponse) > { > #if ENABLE(RESOURCE_LOAD_STATISTICS) > bool existingCacheEntryMatchesNewResponse = false; >@@ -612,7 +612,7 @@ std::optional<Seconds> NetworkResourceLoader::validateCacheEntryForMaxAgeCapVali > return networkStorageSession->maxAgeCacheCap(request); > } > #endif >- return std::nullopt; >+ return WTF::nullopt; > } > > void NetworkResourceLoader::willSendRedirectedRequest(ResourceRequest&& request, ResourceRequest&& redirectRequest, ResourceResponse&& redirectResponse) >@@ -965,7 +965,7 @@ static String escapeForJSON(String s) > return s.replace('\\', "\\\\").replace('"', "\\\""); > } > >-static String escapeIDForJSON(const std::optional<uint64_t>& value) >+static String escapeIDForJSON(const WTF::Optional<uint64_t>& value) > { > return value ? String::number(value.value()) : String("None"); > }; >@@ -980,7 +980,7 @@ void NetworkResourceLoader::logCookieInformation() const > logCookieInformation("NetworkResourceLoader", reinterpret_cast<const void*>(this), *networkStorageSession, originalRequest().firstPartyForCookies(), SameSiteInfo::create(originalRequest()), originalRequest().url(), originalRequest().httpReferrer(), frameID(), pageID(), identifier()); > } > >-static void logBlockedCookieInformation(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, std::optional<uint64_t> identifier) >+static void logBlockedCookieInformation(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WTF::Optional<uint64_t> identifier) > { > ASSERT(NetworkResourceLoader::shouldLogCookieInformation(networkStorageSession.sessionID())); > >@@ -1007,7 +1007,7 @@ static void logBlockedCookieInformation(const String& label, const void* loggedO > #undef LOCAL_LOG_IF_ALLOWED > } > >-static void logCookieInformationInternal(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, std::optional<uint64_t> identifier) >+static void logCookieInformationInternal(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WTF::Optional<uint64_t> identifier) > { > ASSERT(NetworkResourceLoader::shouldLogCookieInformation(networkStorageSession.sessionID())); > >@@ -1068,7 +1068,7 @@ static void logCookieInformationInternal(const String& label, const void* logged > #undef LOCAL_LOG_IF_ALLOWED > } > >-void NetworkResourceLoader::logCookieInformation(const String& label, const void* loggedObject, const NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, std::optional<uint64_t> identifier) >+void NetworkResourceLoader::logCookieInformation(const String& label, const void* loggedObject, const NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WTF::Optional<uint64_t> identifier) > { > ASSERT(shouldLogCookieInformation(networkStorageSession.sessionID())); > >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.h b/Source/WebKit/NetworkProcess/NetworkResourceLoader.h >index a2c492b0ab1ef0633a53363c75ee6c09e04de1d0..2fea18061aa288c5081f603463391ee066585a9d 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoader.h >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoader.h >@@ -110,7 +110,7 @@ public: > > #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED > static bool shouldLogCookieInformation(const PAL::SessionID&); >- static void logCookieInformation(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, const String& referrer, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, std::optional<uint64_t> identifier); >+ static void logCookieInformation(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, const String& referrer, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WTF::Optional<uint64_t> identifier); > #endif > > private: >@@ -170,7 +170,7 @@ private: > > void logSlowCacheRetrieveIfNeeded(const NetworkCache::Cache::RetrieveInfo&); > >- std::optional<Seconds> validateCacheEntryForMaxAgeCapValidation(const WebCore::ResourceRequest&, const WebCore::ResourceRequest& redirectRequest, const WebCore::ResourceResponse&); >+ WTF::Optional<Seconds> validateCacheEntryForMaxAgeCapValidation(const WebCore::ResourceRequest&, const WebCore::ResourceRequest& redirectRequest, const WebCore::ResourceResponse&); > > const NetworkResourceLoadParameters m_parameters; > >@@ -206,7 +206,7 @@ private: > bool m_shouldRestartLoad { false }; > ResponseCompletionHandler m_responseCompletionHandler; > >- std::optional<NetworkActivityTracker> m_networkActivityTracker; >+ WTF::Optional<NetworkActivityTracker> m_networkActivityTracker; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp b/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp >index b5a44849887d21b305032d6b4cfa9540b1c56e1a..3564686a122796e543ba2c3bf63955d34e361e7d 100644 >--- a/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp >@@ -67,53 +67,53 @@ void NetworkSessionCreationParameters::encode(IPC::Encoder& encoder) const > #endif > } > >-std::optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::decode(IPC::Decoder& decoder) >+WTF::Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::decode(IPC::Decoder& decoder) > { > PAL::SessionID sessionID; > if (!decoder.decode(sessionID)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> boundInterfaceIdentifier; >+ WTF::Optional<String> boundInterfaceIdentifier; > decoder >> boundInterfaceIdentifier; > if (!boundInterfaceIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<AllowsCellularAccess> allowsCellularAccess; >+ WTF::Optional<AllowsCellularAccess> allowsCellularAccess; > decoder >> allowsCellularAccess; > if (!allowsCellularAccess) >- return std::nullopt; >+ return WTF::nullopt; > > #if PLATFORM(COCOA) > RetainPtr<CFDictionaryRef> proxyConfiguration; > if (!IPC::decode(decoder, proxyConfiguration)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> sourceApplicationBundleIdentifier; >+ WTF::Optional<String> sourceApplicationBundleIdentifier; > decoder >> sourceApplicationBundleIdentifier; > if (!sourceApplicationBundleIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> sourceApplicationSecondaryIdentifier; >+ WTF::Optional<String> sourceApplicationSecondaryIdentifier; > decoder >> sourceApplicationSecondaryIdentifier; > if (!sourceApplicationSecondaryIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> shouldLogCookieInformation; >+ WTF::Optional<bool> shouldLogCookieInformation; > decoder >> shouldLogCookieInformation; > if (!shouldLogCookieInformation) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Seconds> loadThrottleLatency; >+ WTF::Optional<Seconds> loadThrottleLatency; > decoder >> loadThrottleLatency; > if (!loadThrottleLatency) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > #if USE(CURL) >- std::optional<WebCore::CurlProxySettings> proxySettings; >+ WTF::Optional<WebCore::CurlProxySettings> proxySettings; > decoder >> proxySettings; > if (!proxySettings) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > return {{ >diff --git a/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h b/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h >index 27ce7b88d90eb4e685a9bb958944204ef2d7a096..882991ed91ac6735aa5376397a0fe9c3eb14b3e6 100644 >--- a/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h >+++ b/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h >@@ -44,7 +44,7 @@ enum class AllowsCellularAccess : bool { No, Yes }; > > struct NetworkSessionCreationParameters { > void encode(IPC::Encoder&) const; >- static std::optional<NetworkSessionCreationParameters> decode(IPC::Decoder&); >+ static WTF::Optional<NetworkSessionCreationParameters> decode(IPC::Decoder&); > static NetworkSessionCreationParameters privateSessionParameters(const PAL::SessionID&); > > PAL::SessionID sessionID { PAL::SessionID::defaultSessionID() }; >diff --git a/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp b/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp >index 4c70830a9e0c531e517197e62bbd1de1ba5f9f52..03e50f0b0027ebd880e2935823af8480bcff240a 100644 >--- a/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp >@@ -53,7 +53,7 @@ void NetworkSocketStream::sendData(const IPC::DataReference& data, uint64_t iden > }); > } > >-void NetworkSocketStream::sendHandshake(const IPC::DataReference& data, const std::optional<CookieRequestHeaderFieldProxy>& headerFieldProxy, uint64_t identifier) >+void NetworkSocketStream::sendHandshake(const IPC::DataReference& data, const WTF::Optional<CookieRequestHeaderFieldProxy>& headerFieldProxy, uint64_t identifier) > { > m_impl->platformSendHandshake(data.data(), data.size(), headerFieldProxy, [this, protectedThis = makeRef(*this), identifier] (bool success, bool didAccessSecureCookies) { > send(Messages::WebSocketStream::DidSendHandshake(identifier, success, didAccessSecureCookies)); >diff --git a/Source/WebKit/NetworkProcess/NetworkSocketStream.h b/Source/WebKit/NetworkProcess/NetworkSocketStream.h >index b0a25470ac277e047fb273812cd71d197b81fe91..7f110649ba1d0377f9406810fd48a39acd4dff76 100644 >--- a/Source/WebKit/NetworkProcess/NetworkSocketStream.h >+++ b/Source/WebKit/NetworkProcess/NetworkSocketStream.h >@@ -47,7 +47,7 @@ public: > void didReceiveMessage(IPC::Connection&, IPC::Decoder&); > > void sendData(const IPC::DataReference&, uint64_t); >- void sendHandshake(const IPC::DataReference&, const std::optional<WebCore::CookieRequestHeaderFieldProxy>&, uint64_t); >+ void sendHandshake(const IPC::DataReference&, const WTF::Optional<WebCore::CookieRequestHeaderFieldProxy>&, uint64_t); > void close(); > > // SocketStreamHandleClient >diff --git a/Source/WebKit/NetworkProcess/NetworkSocketStream.messages.in b/Source/WebKit/NetworkProcess/NetworkSocketStream.messages.in >index 02e8518b01b030f6ebc7d66f01ea250610caae4f..a27d571e8c1a46c97fc6cf4015d674c85bbb087a 100644 >--- a/Source/WebKit/NetworkProcess/NetworkSocketStream.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkSocketStream.messages.in >@@ -22,6 +22,6 @@ > > messages -> NetworkSocketStream { > SendData(IPC::DataReference data, uint64_t identifier) >- SendHandshake(IPC::DataReference data, std::optional<WebCore::CookieRequestHeaderFieldProxy> headerFieldProxy, uint64_t identifier) >+ SendHandshake(IPC::DataReference data, WTF::Optional<WebCore::CookieRequestHeaderFieldProxy> headerFieldProxy, uint64_t identifier) > Close() > } >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >index e6959f4cdc06c445cf102e9826f187e9dff00fee..faa3ebb214a85049fb36d269df2f32ff8ffd9c94 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >@@ -95,7 +95,7 @@ void WebSWServerConnection::startScriptFetchInClient(ServiceWorkerJobIdentifier > send(Messages::WebSWClientConnection::StartScriptFetchForServer(jobIdentifier, registrationKey, cachePolicy)); > } > >-void WebSWServerConnection::updateRegistrationStateInClient(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData) >+void WebSWServerConnection::updateRegistrationStateInClient(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const WTF::Optional<ServiceWorkerData>& serviceWorkerData) > { > send(Messages::WebSWClientConnection::UpdateRegistrationState(identifier, state, serviceWorkerData)); > } >@@ -195,7 +195,7 @@ void WebSWServerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier d > if (!destinationWorker) > return; > >- std::optional<ServiceWorkerOrClientData> sourceData; >+ WTF::Optional<ServiceWorkerOrClientData> sourceData; > WTF::switchOn(sourceIdentifier, [&](ServiceWorkerIdentifier identifier) { > if (auto* sourceWorker = server().workerByID(identifier)) > sourceData = ServiceWorkerOrClientData { sourceWorker->data() }; >@@ -277,7 +277,7 @@ void WebSWServerConnection::matchRegistration(uint64_t registrationMatchRequestI > send(Messages::WebSWClientConnection::DidMatchRegistration { registrationMatchRequestIdentifier, registration->data() }); > return; > } >- send(Messages::WebSWClientConnection::DidMatchRegistration { registrationMatchRequestIdentifier, std::nullopt }); >+ send(Messages::WebSWClientConnection::DidMatchRegistration { registrationMatchRequestIdentifier, WTF::nullopt }); > } > > void WebSWServerConnection::registrationReady(uint64_t registrationReadyRequestIdentifier, ServiceWorkerRegistrationData&& registrationData) >@@ -291,7 +291,7 @@ void WebSWServerConnection::getRegistrations(uint64_t registrationMatchRequestId > send(Messages::WebSWClientConnection::DidGetRegistrations { registrationMatchRequestIdentifier, registrations }); > } > >-void WebSWServerConnection::registerServiceWorkerClient(SecurityOriginData&& topOrigin, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier) >+void WebSWServerConnection::registerServiceWorkerClient(SecurityOriginData&& topOrigin, ServiceWorkerClientData&& data, const WTF::Optional<ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier) > { > auto clientOrigin = ClientOrigin { WTFMove(topOrigin), SecurityOriginData::fromURL(data.url) }; > m_clientOrigins.add(data.identifier, clientOrigin); >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h >index 9d17037894f5b511038de06bad09dd7f634c7f1a..b6b14bb0539e5a96712349692aadad3d547eca59 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h >@@ -77,7 +77,7 @@ private: > void resolveRegistrationJobInClient(WebCore::ServiceWorkerJobIdentifier, const WebCore::ServiceWorkerRegistrationData&, WebCore::ShouldNotifyWhenResolved) final; > void resolveUnregistrationJobInClient(WebCore::ServiceWorkerJobIdentifier, const WebCore::ServiceWorkerRegistrationKey&, bool unregistrationResult) final; > void startScriptFetchInClient(WebCore::ServiceWorkerJobIdentifier, const WebCore::ServiceWorkerRegistrationKey&, WebCore::FetchOptions::Cache) final; >- void updateRegistrationStateInClient(WebCore::ServiceWorkerRegistrationIdentifier, WebCore::ServiceWorkerRegistrationState, const std::optional<WebCore::ServiceWorkerData>&) final; >+ void updateRegistrationStateInClient(WebCore::ServiceWorkerRegistrationIdentifier, WebCore::ServiceWorkerRegistrationState, const WTF::Optional<WebCore::ServiceWorkerData>&) final; > void updateWorkerStateInClient(WebCore::ServiceWorkerIdentifier, WebCore::ServiceWorkerState) final; > void fireUpdateFoundEvent(WebCore::ServiceWorkerRegistrationIdentifier) final; > void setRegistrationLastUpdateTime(WebCore::ServiceWorkerRegistrationIdentifier, WallTime) final; >@@ -93,7 +93,7 @@ private: > void matchRegistration(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const URL& clientURL); > void getRegistrations(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const URL& clientURL); > >- void registerServiceWorkerClient(WebCore::SecurityOriginData&& topOrigin, WebCore::ServiceWorkerClientData&&, const std::optional<WebCore::ServiceWorkerRegistrationIdentifier>&); >+ void registerServiceWorkerClient(WebCore::SecurityOriginData&& topOrigin, WebCore::ServiceWorkerClientData&&, const WTF::Optional<WebCore::ServiceWorkerRegistrationIdentifier>&); > void unregisterServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier&); > > IPC::Connection* messageSenderConnection() final { return m_contentConnection.ptr(); } >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >index d533c35c9b7eb42c886cd1ca978ac87568d9edbb..8d7dbb1b0e8d4602efba71922b27ab1f4753f873 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >@@ -39,7 +39,7 @@ messages -> WebSWServerConnection { > MatchRegistration(uint64_t serviceRegistrationMatchRequestIdentifier, struct WebCore::SecurityOriginData topOrigin, URL clientURL) > WhenRegistrationReady(uint64_t serviceRegistrationMatchRequestIdentifier, struct WebCore::SecurityOriginData topOrigin, URL clientURL) > GetRegistrations(uint64_t serviceRegistrationMatchRequestIdentifier, struct WebCore::SecurityOriginData topOrigin, URL clientURL) >- RegisterServiceWorkerClient(struct WebCore::SecurityOriginData topOrigin, struct WebCore::ServiceWorkerClientData data, std::optional<WebCore::ServiceWorkerRegistrationIdentifier> controllingServiceWorkerRegistrationIdentifier) >+ RegisterServiceWorkerClient(struct WebCore::SecurityOriginData topOrigin, struct WebCore::ServiceWorkerClientData data, WTF::Optional<WebCore::ServiceWorkerRegistrationIdentifier> controllingServiceWorkerRegistrationIdentifier) > UnregisterServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier identifier) > > SyncTerminateWorker(WebCore::ServiceWorkerIdentifier workerIdentifier) -> () LegacySync >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp >index e3d7aac205e28fd3fee4abfea53dc7c09ae29c63..caf0140f7cc27063495ae7312e2a91a8926f8894 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp >@@ -82,7 +82,7 @@ void WebSWServerToContextConnection::syncTerminateWorker(ServiceWorkerIdentifier > sendSync(Messages::WebSWContextManagerConnection::SyncTerminateWorker(serviceWorkerIdentifier), Messages::WebSWContextManagerConnection::SyncTerminateWorker::Reply()); > } > >-void WebSWServerToContextConnection::findClientByIdentifierCompleted(uint64_t requestIdentifier, const std::optional<ServiceWorkerClientData>& data, bool hasSecurityError) >+void WebSWServerToContextConnection::findClientByIdentifierCompleted(uint64_t requestIdentifier, const WTF::Optional<ServiceWorkerClientData>& data, bool hasSecurityError) > { > send(Messages::WebSWContextManagerConnection::FindClientByIdentifierCompleted { requestIdentifier, data, hasSecurityError }); > } >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h >index e9c3988c936eb8ebd8281d2b7c3182c328d9952e..1f00d1a649fccb096d651c33680c2f5cdc8dffd3 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h >@@ -62,7 +62,7 @@ private: > void fireActivateEvent(WebCore::ServiceWorkerIdentifier) final; > void terminateWorker(WebCore::ServiceWorkerIdentifier) final; > void syncTerminateWorker(WebCore::ServiceWorkerIdentifier) final; >- void findClientByIdentifierCompleted(uint64_t requestIdentifier, const std::optional<WebCore::ServiceWorkerClientData>&, bool hasSecurityError) final; >+ void findClientByIdentifierCompleted(uint64_t requestIdentifier, const WTF::Optional<WebCore::ServiceWorkerClientData>&, bool hasSecurityError) final; > void matchAllCompleted(uint64_t requestIdentifier, const Vector<WebCore::ServiceWorkerClientData>&) final; > void claimCompleted(uint64_t requestIdentifier) final; > void didFinishSkipWaiting(uint64_t callbackID) final; >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in >index 611692d1949972feb1e3ce85b88b858559fe64b0..ca5820d6f3cf30ae1e49a84022c28d7edb1a10f3 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in >@@ -25,9 +25,9 @@ > messages -> WebSWServerToContextConnection { > # When possible, these messages can be implemented directly by WebCore::SWServerToContextConnection > >- ScriptContextFailedToStart(std::optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message); >- ScriptContextStarted(std::optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier); >- DidFinishInstall(std::optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful); >+ ScriptContextFailedToStart(WTF::Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message); >+ ScriptContextStarted(WTF::Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier); >+ DidFinishInstall(WTF::Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful); > DidFinishActivation(WebCore::ServiceWorkerIdentifier identifier); > SetServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier identifier, bool hasPendingEvents); > SkipWaiting(WebCore::ServiceWorkerIdentifier identifier, uint64_t callbackID) >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp b/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp >index 2b9e543b9461554b43cfaabbc78c707bce2b6541..fc4ed2ea34cfad5998dfe439d2cdcaafb9b6f3d8 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp >@@ -285,13 +285,13 @@ void Engine::deleteMatchingRecords(uint64_t cacheIdentifier, WebCore::ResourceRe > void Engine::initialize(CompletionCallback&& callback) > { > if (m_salt) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > > if (!shouldPersist()) { > m_salt = NetworkCache::Salt { }; >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -312,14 +312,14 @@ void Engine::initialize(CompletionCallback&& callback) > > auto callbacks = WTFMove(m_initializationCallbacks); > for (auto& callback : callbacks) >- callback(m_salt ? std::nullopt : std::make_optional(Error::WriteDisk)); >+ callback(m_salt ? WTF::nullopt : WTF::makeOptional(Error::WriteDisk)); > }); > }); > } > > void Engine::readCachesFromDisk(const WebCore::ClientOrigin& origin, CachesCallback&& callback) > { >- initialize([this, origin, callback = WTFMove(callback)](std::optional<Error>&& error) mutable { >+ initialize([this, origin, callback = WTFMove(callback)](WTF::Optional<Error>&& error) mutable { > auto& caches = m_caches.ensure(origin, [&origin, this] { > auto path = cachesRootPath(origin); > return Caches::create(*this, WebCore::ClientOrigin { origin }, WTFMove(path), m_quota); >@@ -335,7 +335,7 @@ void Engine::readCachesFromDisk(const WebCore::ClientOrigin& origin, CachesCallb > return; > } > >- caches->initialize([callback = WTFMove(callback), caches = caches.copyRef()](std::optional<Error>&& error) mutable { >+ caches->initialize([callback = WTFMove(callback), caches = caches.copyRef()](WTF::Optional<Error>&& error) mutable { > if (error) { > callback(makeUnexpected(error.value())); > return; >@@ -354,7 +354,7 @@ void Engine::readCache(uint64_t cacheIdentifier, CacheCallback&& callback) > return; > } > if (!cache->isOpened()) { >- cache->open([this, protectedThis = makeRef(*this), cacheIdentifier, callback = WTFMove(callback)](std::optional<Error>&& error) mutable { >+ cache->open([this, protectedThis = makeRef(*this), cacheIdentifier, callback = WTFMove(callback)](WTF::Optional<Error>&& error) mutable { > if (error) { > callback(makeUnexpected(error.value())); > return; >@@ -386,7 +386,7 @@ Cache* Engine::cache(uint64_t cacheIdentifier) > void Engine::writeFile(const String& filename, NetworkCache::Data&& data, WebCore::DOMCacheEngine::CompletionCallback&& callback) > { > if (!shouldPersist()) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -410,7 +410,7 @@ void Engine::writeFile(const String& filename, NetworkCache::Data&& data, WebCor > callback(Error::WriteDisk); > return; > } >- callback(std::nullopt); >+ callback(WTF::nullopt); > }); > }); > } >@@ -575,7 +575,7 @@ void Engine::clearCachesForOriginFromDisk(const WebCore::SecurityOriginData& ori > for (auto& folderPath : WebCore::FileSystem::listDirectory(m_rootPath, "*")) { > if (!WebCore::FileSystem::fileIsDirectory(folderPath, WebCore::FileSystem::ShouldFollowSymbolicLinks::No)) > continue; >- Caches::retrieveOriginFromDirectory(folderPath, *m_ioQueue, [this, protectedThis = makeRef(*this), origin, callbackAggregator = callbackAggregator.copyRef(), folderPath] (std::optional<WebCore::ClientOrigin>&& folderOrigin) mutable { >+ Caches::retrieveOriginFromDirectory(folderPath, *m_ioQueue, [this, protectedThis = makeRef(*this), origin, callbackAggregator = callbackAggregator.copyRef(), folderPath] (WTF::Optional<WebCore::ClientOrigin>&& folderOrigin) mutable { > if (!folderOrigin) > return; > if (folderOrigin->topOrigin != origin && folderOrigin->clientOrigin != origin) >@@ -606,7 +606,7 @@ void Engine::clearMemoryRepresentation(const WebCore::ClientOrigin& origin, WebC > return; > } > result.value().get().clearMemoryRepresentation(); >- callback(std::nullopt); >+ callback(WTF::nullopt); > }); > } > >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h b/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h >index 7e14225bee50a977b5fc9251465467bb34d83524..771abfbe97f8d59809a984f87f8ad4183df69063 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h >@@ -132,7 +132,7 @@ private: > String m_rootPath; > uint64_t m_quota { 0 }; > RefPtr<WorkQueue> m_ioQueue; >- std::optional<NetworkCache::Salt> m_salt; >+ WTF::Optional<NetworkCache::Salt> m_salt; > HashMap<CacheIdentifier, LockCount> m_cacheLocks; > Vector<WebCore::DOMCacheEngine::CompletionCallback> m_initializationCallbacks; > HashMap<uint64_t, WebCore::DOMCacheEngine::CompletionCallback> m_pendingWriteCallbacks; >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp >index 61a4de5f636f76a354fdd89eb881fee03f2085d1..1e9b26c52bdd8a71611c4fba2003189ba59516e9 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp >@@ -160,7 +160,7 @@ static TraversalResult isolatedCopy(TraversalResult&& result) > void Cache::open(CompletionCallback&& callback) > { > if (m_state == State::Open) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > if (m_state == State::Opening) { >@@ -181,7 +181,7 @@ void Cache::open(CompletionCallback&& callback) > return; > } > cache->m_records = WTFMove(traversalResult.records); >- cache->finishOpening(WTFMove(callback), std::nullopt); >+ cache->finishOpening(WTFMove(callback), WTF::nullopt); > }); > return; > } >@@ -203,7 +203,7 @@ void Cache::open(CompletionCallback&& callback) > }); > } > >-void Cache::finishOpening(CompletionCallback&& callback, std::optional<Error>&& error) >+void Cache::finishOpening(CompletionCallback&& callback, WTF::Optional<Error>&& error) > { > Vector<std::reference_wrapper<RecordInformation>> records; > for (auto& value : m_records.values()) { >@@ -226,10 +226,10 @@ void Cache::finishOpening(CompletionCallback&& callback, std::optional<Error>&& > } > m_state = State::Open; > >- callback(std::nullopt); >+ callback(WTF::nullopt); > auto callbacks = WTFMove(m_pendingOpeningCallbacks); > for (auto& callback : callbacks) >- callback(std::nullopt); >+ callback(WTF::nullopt); > } > > class ReadRecordTaskCounter : public RefCounted<ReadRecordTaskCounter> { >@@ -370,7 +370,7 @@ private: > { > } > >- std::optional<Error> m_error; >+ WTF::Optional<Error> m_error; > RecordIdentifiersCallback m_callback; > Vector<uint64_t> m_recordIdentifiers; > }; >@@ -423,7 +423,7 @@ void Cache::put(Vector<Record>&& records, RecordIdentifiersCallback&& callback) > return; > } > >- m_caches.requestSpace(spaceRequired, [caches = makeRef(m_caches), identifier = m_identifier, records = WTFMove(records), callback = WTFMove(callback)](std::optional<DOMCacheEngine::Error>&& error) mutable { >+ m_caches.requestSpace(spaceRequired, [caches = makeRef(m_caches), identifier = m_identifier, records = WTFMove(records), callback = WTFMove(callback)](WTF::Optional<DOMCacheEngine::Error>&& error) mutable { > if (error) { > callback(makeUnexpected(error.value())); > return; >@@ -477,7 +477,7 @@ void Cache::removeFromRecordList(const Vector<uint64_t>& recordIdentifiers) > > void Cache::writeRecordToDisk(const RecordInformation& recordInformation, Record&& record, Ref<AsynchronousPutTaskCounter>&& taskCounter, uint64_t previousRecordSize) > { >- m_caches.writeRecord(*this, recordInformation, WTFMove(record), previousRecordSize, [taskCounter = WTFMove(taskCounter)](std::optional<Error>&& error) { >+ m_caches.writeRecord(*this, recordInformation, WTFMove(record), previousRecordSize, [taskCounter = WTFMove(taskCounter)](WTF::Optional<Error>&& error) { > if (error) > taskCounter->setError(error.value()); > }); >@@ -555,7 +555,7 @@ Storage::Record Cache::encode(const RecordInformation& recordInformation, const > return { recordInformation.key, { }, header, body, { } }; > } > >-std::optional<Cache::DecodedRecord> Cache::decodeRecordHeader(const Storage::Record& storage) >+WTF::Optional<Cache::DecodedRecord> Cache::decodeRecordHeader(const Storage::Record& storage) > { > WTF::Persistence::Decoder decoder(storage.header.data(), storage.header.size()); > >@@ -563,45 +563,45 @@ std::optional<Cache::DecodedRecord> Cache::decodeRecordHeader(const Storage::Rec > > double insertionTime; > if (!decoder.decode(insertionTime)) >- return std::nullopt; >+ return WTF::nullopt; > > uint64_t size; > if (!decoder.decode(size)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(record.requestHeadersGuard)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!record.request.decodeWithoutPlatformData(decoder)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!FetchOptions::decodePersistent(decoder, record.options)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(record.referrer)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(record.responseHeadersGuard)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(record.response)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(record.responseBodySize)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.verifyChecksum()) >- return std::nullopt; >+ return WTF::nullopt; > > return DecodedRecord { insertionTime, size, WTFMove(record) }; > } > >-std::optional<Record> Cache::decode(const Storage::Record& storage) >+WTF::Optional<Record> Cache::decode(const Storage::Record& storage) > { > auto result = decodeRecordHeader(storage); > > if (!result) >- return std::nullopt; >+ return WTF::nullopt; > > auto record = WTFMove(result->record); > record.responseBody = WebCore::SharedBuffer::create(storage.body.data(), storage.body.size()); >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h >index 898018e4ea37fb12fb632b192fe8aea1c7146576..16fd90d6663033b663a1e51d26b66d4c7cc8f6c4 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h >@@ -77,7 +77,7 @@ public: > void dispose(); > void clearMemoryRepresentation(); > >- static std::optional<WebCore::DOMCacheEngine::Record> decode(const NetworkCache::Storage::Record&); >+ static WTF::Optional<WebCore::DOMCacheEngine::Record> decode(const NetworkCache::Storage::Record&); > static NetworkCache::Storage::Record encode(const RecordInformation&, const WebCore::DOMCacheEngine::Record&); > > struct DecodedRecord { >@@ -91,7 +91,7 @@ public: > uint64_t size { 0 }; > WebCore::DOMCacheEngine::Record record; > }; >- static std::optional<DecodedRecord> decodeRecordHeader(const NetworkCache::Storage::Record&); >+ static WTF::Optional<DecodedRecord> decodeRecordHeader(const NetworkCache::Storage::Record&); > > private: > Vector<RecordInformation>* recordsFromURL(const URL&); >@@ -102,7 +102,7 @@ private: > > RecordInformation toRecordInformation(const WebCore::DOMCacheEngine::Record&); > >- void finishOpening(WebCore::DOMCacheEngine::CompletionCallback&&, std::optional<WebCore::DOMCacheEngine::Error>&&); >+ void finishOpening(WebCore::DOMCacheEngine::CompletionCallback&&, WTF::Optional<WebCore::DOMCacheEngine::Error>&&); > void retrieveRecord(const RecordInformation&, Ref<ReadRecordTaskCounter>&&); > > void readRecordsList(WebCore::DOMCacheEngine::CompletionCallback&&); >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp >index 7f04bf02d3676f0c15667e7dfd56714ea7f696d9..91744cf76f6f3a4f753ae6ffbc0f4426eeba95ef 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp >@@ -55,12 +55,12 @@ Caches::~Caches() > ASSERT(m_pendingWritingCachesToDiskCallbacks.isEmpty()); > } > >-void Caches::retrieveOriginFromDirectory(const String& folderPath, WorkQueue& queue, WTF::CompletionHandler<void(std::optional<WebCore::ClientOrigin>&&)>&& completionHandler) >+void Caches::retrieveOriginFromDirectory(const String& folderPath, WorkQueue& queue, WTF::CompletionHandler<void(WTF::Optional<WebCore::ClientOrigin>&&)>&& completionHandler) > { > queue.dispatch([completionHandler = WTFMove(completionHandler), filename = cachesOriginFilename(folderPath)]() mutable { > if (!WebCore::FileSystem::fileExists(filename)) { > RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() mutable { >- completionHandler(std::nullopt); >+ completionHandler(WTF::nullopt); > }); > return; > } >@@ -70,7 +70,7 @@ void Caches::retrieveOriginFromDirectory(const String& folderPath, WorkQueue& qu > ASSERT(RunLoop::isMain()); > if (error) { > RELEASE_LOG_ERROR(CacheStorage, "Caches::retrieveOriginFromDirectory failed reading channel with error %d", error); >- completionHandler(std::nullopt); >+ completionHandler(WTF::nullopt); > return; > } > completionHandler(readOrigin(data)); >@@ -95,43 +95,43 @@ void Caches::storeOrigin(CompletionCallback&& completionHandler) > encoder << m_origin.clientOrigin.protocol; > encoder << m_origin.clientOrigin.host; > encoder << m_origin.clientOrigin.port; >- m_engine->writeFile(cachesOriginFilename(m_rootPath), Data { encoder.buffer(), encoder.bufferSize() }, [protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (std::optional<Error>&& error) mutable { >+ m_engine->writeFile(cachesOriginFilename(m_rootPath), Data { encoder.buffer(), encoder.bufferSize() }, [protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (WTF::Optional<Error>&& error) mutable { > completionHandler(WTFMove(error)); > }); > } > >-std::optional<WebCore::ClientOrigin> Caches::readOrigin(const Data& data) >+WTF::Optional<WebCore::ClientOrigin> Caches::readOrigin(const Data& data) > { > // FIXME: We should be able to use modern decoders for persistent data. > WebCore::SecurityOriginData topOrigin, clientOrigin; > WTF::Persistence::Decoder decoder(data.data(), data.size()); > > if (!decoder.decode(topOrigin.protocol)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(topOrigin.host)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(topOrigin.port)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(clientOrigin.protocol)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(clientOrigin.host)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(clientOrigin.port)) >- return std::nullopt; >+ return WTF::nullopt; > return WebCore::ClientOrigin { WTFMove(topOrigin), WTFMove(clientOrigin) }; > } > > void Caches::initialize(WebCore::DOMCacheEngine::CompletionCallback&& callback) > { > if (m_isInitialized) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > > if (m_rootPath.isNull()) { > makeDirty(); > m_isInitialized = true; >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -151,7 +151,7 @@ void Caches::initialize(WebCore::DOMCacheEngine::CompletionCallback&& callback) > m_storage = storage.releaseNonNull(); > m_storage->writeWithoutWaiting(); > >- storeOrigin([this] (std::optional<Error>&& error) mutable { >+ storeOrigin([this] (WTF::Optional<Error>&& error) mutable { > if (error) { > RELEASE_LOG_ERROR(CacheStorage, "Caches::initialize failed storing origin with error %d", static_cast<int>(*error)); > >@@ -204,7 +204,7 @@ void Caches::initializeSize() > m_isInitialized = true; > auto pendingCallbacks = WTFMove(m_pendingInitializationCallbacks); > for (auto& callback : pendingCallbacks) >- callback(std::nullopt); >+ callback(WTF::nullopt); > > return; > } >@@ -289,7 +289,7 @@ void Caches::open(const String& name, CacheIdentifierCallback&& callback) > } > > if (auto* cache = find(name)) { >- cache->open([cacheIdentifier = cache->identifier(), callback = WTFMove(callback)](std::optional<Error>&& error) mutable { >+ cache->open([cacheIdentifier = cache->identifier(), callback = WTFMove(callback)](WTF::Optional<Error>&& error) mutable { > if (error) { > callback(makeUnexpected(error.value())); > return; >@@ -304,7 +304,7 @@ void Caches::open(const String& name, CacheIdentifierCallback&& callback) > uint64_t cacheIdentifier = m_engine->nextCacheIdentifier(); > m_caches.append(Cache { *this, cacheIdentifier, Cache::State::Open, String { name }, createCanonicalUUIDString() }); > >- writeCachesToDisk([callback = WTFMove(callback), cacheIdentifier](std::optional<Error>&& error) mutable { >+ writeCachesToDisk([callback = WTFMove(callback), cacheIdentifier](WTF::Optional<Error>&& error) mutable { > callback(CacheIdentifierOperationResult { cacheIdentifier, !!error }); > }); > } >@@ -338,7 +338,7 @@ void Caches::remove(uint64_t identifier, CacheIdentifierCallback&& callback) > m_removedCaches.append(WTFMove(m_caches[position])); > m_caches.remove(position); > >- writeCachesToDisk([callback = WTFMove(callback), identifier](std::optional<Error>&& error) mutable { >+ writeCachesToDisk([callback = WTFMove(callback), identifier](WTF::Optional<Error>&& error) mutable { > callback(CacheIdentifierOperationResult { identifier, !!error }); > }); > } >@@ -442,7 +442,7 @@ void Caches::writeCachesToDisk(CompletionCallback&& callback) > ASSERT(!m_isWritingCachesToDisk); > ASSERT(m_isInitialized); > if (!shouldPersist()) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -450,19 +450,19 @@ void Caches::writeCachesToDisk(CompletionCallback&& callback) > > if (m_caches.isEmpty()) { > m_engine->removeFile(cachesListFilename(m_rootPath)); >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > > m_isWritingCachesToDisk = true; >- m_engine->writeFile(cachesListFilename(m_rootPath), encodeCacheNames(m_caches), [this, protectedThis = makeRef(*this), callback = WTFMove(callback)](std::optional<Error>&& error) mutable { >+ m_engine->writeFile(cachesListFilename(m_rootPath), encodeCacheNames(m_caches), [this, protectedThis = makeRef(*this), callback = WTFMove(callback)](WTF::Optional<Error>&& error) mutable { > m_isWritingCachesToDisk = false; > if (error) > RELEASE_LOG_ERROR(CacheStorage, "Caches::writeCachesToDisk failed writing caches to disk with error %d", static_cast<int>(*error)); > > callback(WTFMove(error)); > while (!m_pendingWritingCachesToDiskCallbacks.isEmpty() && !m_isWritingCachesToDisk) >- m_pendingWritingCachesToDiskCallbacks.takeFirst()(std::nullopt); >+ m_pendingWritingCachesToDiskCallbacks.takeFirst()(WTF::nullopt); > }); > } > >@@ -498,7 +498,7 @@ void Caches::writeRecord(const Cache& cache, const RecordInformation& recordInfo > > if (!shouldPersist()) { > m_volatileStorage.set(recordInformation.key, WTFMove(record)); >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -508,7 +508,7 @@ void Caches::writeRecord(const Cache& cache, const RecordInformation& recordInfo > callback(Error::WriteDisk); > return; > } >- callback(std::nullopt); >+ callback(WTF::nullopt); > }); > } > >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h >index 823ec7003db54febcc76585668d6f0e92c3b2e88..4658275f52dfa2a392e320b442b6c3b84961747e 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h >@@ -42,7 +42,7 @@ public: > static Ref<Caches> create(Engine& engine, WebCore::ClientOrigin&& origin, String&& rootPath, uint64_t quota) { return adoptRef(*new Caches { engine, WTFMove(origin), WTFMove(rootPath), quota }); } > ~Caches(); > >- static void retrieveOriginFromDirectory(const String& folderPath, WorkQueue&, WTF::CompletionHandler<void(std::optional<WebCore::ClientOrigin>&&)>&&); >+ static void retrieveOriginFromDirectory(const String& folderPath, WorkQueue&, WTF::CompletionHandler<void(WTF::Optional<WebCore::ClientOrigin>&&)>&&); > > void initialize(WebCore::DOMCacheEngine::CompletionCallback&&); > void open(const String& name, WebCore::DOMCacheEngine::CacheIdentifierCallback&&); >@@ -85,7 +85,7 @@ private: > void writeCachesToDisk(WebCore::DOMCacheEngine::CompletionCallback&&); > > void storeOrigin(WebCore::DOMCacheEngine::CompletionCallback&&); >- static std::optional<WebCore::ClientOrigin> readOrigin(const NetworkCache::Data&); >+ static WTF::Optional<WebCore::ClientOrigin> readOrigin(const NetworkCache::Data&); > > Cache* find(const String& name); > void clearPendingWritingCachesToDiskCallbacks(); >@@ -104,10 +104,10 @@ private: > Vector<Cache> m_removedCaches; > RefPtr<NetworkCache::Storage> m_storage; > HashMap<NetworkCache::Key, WebCore::DOMCacheEngine::Record> m_volatileStorage; >- mutable std::optional<NetworkCache::Salt> m_volatileSalt; >+ mutable WTF::Optional<NetworkCache::Salt> m_volatileSalt; > Vector<WebCore::DOMCacheEngine::CompletionCallback> m_pendingInitializationCallbacks; > bool m_isWritingCachesToDisk { false }; >- Deque<CompletionHandler<void(std::optional<WebCore::DOMCacheEngine::Error>)>> m_pendingWritingCachesToDiskCallbacks; >+ Deque<CompletionHandler<void(WTF::Optional<WebCore::DOMCacheEngine::Error>)>> m_pendingWritingCachesToDiskCallbacks; > }; > > } // namespace CacheStorage >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp >index 3e32517e94bdfcf3bedb2103a12e8e4c86c4c5df..9ac8212b42fb46ed1d5e0ad5a59653cc36158a74 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp >@@ -151,7 +151,7 @@ void CacheStorageEngineConnection::dereference(PAL::SessionID sessionID, uint64_ > > void CacheStorageEngineConnection::clearMemoryRepresentation(PAL::SessionID sessionID, uint64_t requestIdentifier, WebCore::ClientOrigin&& origin) > { >- Engine::clearMemoryRepresentation(sessionID, WTFMove(origin), [connection = makeRef(m_connection.connection()), sessionID, requestIdentifier] (std::optional<Error>&& error) { >+ Engine::clearMemoryRepresentation(sessionID, WTFMove(origin), [connection = makeRef(m_connection.connection()), sessionID, requestIdentifier] (WTF::Optional<Error>&& error) { > connection->send(Messages::WebCacheStorageConnection::ClearMemoryRepresentationCompleted(requestIdentifier, error), sessionID.sessionID()); > }); > } >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp >index abe98ef3d0d004dafb7af0aee883ff0fa219f7f2..c4bb09e2ccd4759c0aab5af59b2964762d046fdb 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp >@@ -152,7 +152,7 @@ static bool cachePolicyAllowsExpired(WebCore::ResourceRequestCachePolicy policy) > return false; > } > >-static bool responseHasExpired(const WebCore::ResourceResponse& response, WallTime timestamp, std::optional<Seconds> maxStale) >+static bool responseHasExpired(const WebCore::ResourceResponse& response, WallTime timestamp, WTF::Optional<Seconds> maxStale) > { > if (response.cacheControlContainsNoCache()) > return true; >@@ -413,7 +413,7 @@ std::unique_ptr<Entry> Cache::store(const WebCore::ResourceRequest& request, con > return cacheEntry; > } > >-std::unique_ptr<Entry> Cache::storeRedirect(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& redirectRequest, std::optional<Seconds> maxAgeCap) >+std::unique_ptr<Entry> Cache::storeRedirect(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& redirectRequest, WTF::Optional<Seconds> maxAgeCap) > { > LOG(NetworkCache, "(NetworkProcess) storing redirect %s -> %s", request.url().string().latin1().data(), redirectRequest.url().string().latin1().data()); > >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCache.h b/Source/WebKit/NetworkProcess/cache/NetworkCache.h >index c2d0e964effdfced268659485c751d538db665a6..ba2e56f295b0879c27ca9ddca753d878803b6878 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCache.h >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCache.h >@@ -114,7 +114,7 @@ public: > using RetrieveCompletionHandler = Function<void (std::unique_ptr<Entry>, const RetrieveInfo&)>; > void retrieve(const WebCore::ResourceRequest&, const GlobalFrameID&, RetrieveCompletionHandler&&); > std::unique_ptr<Entry> store(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, RefPtr<WebCore::SharedBuffer>&&, Function<void (MappedBody&)>&&); >- std::unique_ptr<Entry> storeRedirect(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, const WebCore::ResourceRequest& redirectRequest, std::optional<Seconds> maxAgeCap); >+ std::unique_ptr<Entry> storeRedirect(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, const WebCore::ResourceRequest& redirectRequest, WTF::Optional<Seconds> maxAgeCap); > std::unique_ptr<Entry> update(const WebCore::ResourceRequest&, const GlobalFrameID&, const Entry&, const WebCore::ResourceResponse& validatingResponse); > > struct TraversalEntry { >@@ -155,7 +155,7 @@ private: > String dumpFilePath() const; > void deleteDumpFile(); > >- std::optional<Seconds> maxAgeCap(Entry&, const WebCore::ResourceRequest&, PAL::SessionID); >+ WTF::Optional<Seconds> maxAgeCap(Entry&, const WebCore::ResourceRequest&, PAL::SessionID); > > Ref<Storage> m_storage; > >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp >index a6e37be49128564091afb542083b755e710af101..c4e47b52459ea212c4eb2984b10ca52152d836d0 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp >@@ -151,7 +151,7 @@ static Salt makeSalt() > return salt; > } > >-std::optional<Salt> readOrMakeSalt(const String& path) >+WTF::Optional<Salt> readOrMakeSalt(const String& path) > { > #if !OS(WINDOWS) > auto cpath = WebCore::FileSystem::fileSystemRepresentation(path); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h b/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h >index 496108de63eb44de9f7ba58684efe2491da689bf..170c768d555ddbc99184c2613bc434cc5973c3bc 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h >@@ -102,7 +102,7 @@ Data mapFile(const char* path); > > using Salt = std::array<uint8_t, 8>; > >-std::optional<Salt> readOrMakeSalt(const String& path); >+WTF::Optional<Salt> readOrMakeSalt(const String& path); > SHA1::Digest computeSHA1(const Data&, const Salt&); > > } >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.h b/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.h >index deda86a44b61849d6dbb3d01d3420192e7729965..a9c6577679041838411149310f9f1e283da0756e 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.h >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.h >@@ -58,7 +58,7 @@ public: > const Vector<std::pair<String, String>>& varyingRequestHeaders() const { return m_varyingRequestHeaders; } > > WebCore::SharedBuffer* buffer() const; >- const std::optional<WebCore::ResourceRequest>& redirectRequest() const { return m_redirectRequest; } >+ const WTF::Optional<WebCore::ResourceRequest>& redirectRequest() const { return m_redirectRequest; } > > #if ENABLE(SHAREABLE_RESOURCE) > ShareableResource::Handle& shareableResourceHandle() const; >@@ -87,7 +87,7 @@ private: > WebCore::ResourceResponse m_response; > Vector<std::pair<String, String>> m_varyingRequestHeaders; > >- std::optional<WebCore::ResourceRequest> m_redirectRequest; >+ WTF::Optional<WebCore::ResourceRequest> m_redirectRequest; > mutable RefPtr<WebCore::SharedBuffer> m_buffer; > #if ENABLE(SHAREABLE_RESOURCE) > mutable ShareableResource::Handle m_shareableResourceHandle; >@@ -95,7 +95,7 @@ private: > > Storage::Record m_sourceStorageRecord { }; > >- std::optional<Seconds> m_maxAgeCap; >+ WTF::Optional<Seconds> m_maxAgeCap; > }; > > } >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp >index 6fad8590201e0c00afbe2a2fd6e81c0ffa8a8faf..f58f35614cce9ca4c30b5c8066dbcd430b7efd7f 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp >@@ -72,7 +72,7 @@ void SpeculativeLoad::willSendRedirectedRequest(ResourceRequest&& request, Resou > { > LOG(NetworkCacheSpeculativePreloading, "Speculative redirect %s -> %s", request.url().string().utf8().data(), redirectRequest.url().string().utf8().data()); > >- std::optional<Seconds> maxAgeCap; >+ WTF::Optional<Seconds> maxAgeCap; > #if ENABLE(RESOURCE_LOAD_STATISTICS) > if (auto networkStorageSession = WebCore::NetworkStorageSession::storageSession(PAL::SessionID::defaultSessionID())) > maxAgeCap = networkStorageSession->maxAgeCacheCap(request); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp >index 6b9aadee59eb0dc045a42c856f88d30d5d8bfb63..2155bdf098227b73638f1307d83fcf454b51c953 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp >@@ -138,7 +138,7 @@ private: > class SpeculativeLoadManager::PreloadedEntry : private ExpiringEntry { > WTF_MAKE_FAST_ALLOCATED; > public: >- PreloadedEntry(std::unique_ptr<Entry> entry, std::optional<ResourceRequest>&& speculativeValidationRequest, WTF::Function<void()>&& lifetimeReachedHandler) >+ PreloadedEntry(std::unique_ptr<Entry> entry, WTF::Optional<ResourceRequest>&& speculativeValidationRequest, WTF::Function<void()>&& lifetimeReachedHandler) > : ExpiringEntry(WTFMove(lifetimeReachedHandler)) > , m_entry(WTFMove(entry)) > , m_speculativeValidationRequest(WTFMove(speculativeValidationRequest)) >@@ -150,12 +150,12 @@ public: > return WTFMove(m_entry); > } > >- const std::optional<ResourceRequest>& revalidationRequest() const { return m_speculativeValidationRequest; } >+ const WTF::Optional<ResourceRequest>& revalidationRequest() const { return m_speculativeValidationRequest; } > bool wasRevalidated() const { return !!m_speculativeValidationRequest; } > > private: > std::unique_ptr<Entry> m_entry; >- std::optional<ResourceRequest> m_speculativeValidationRequest; >+ WTF::Optional<ResourceRequest> m_speculativeValidationRequest; > }; > > class SpeculativeLoadManager::PendingFrameLoad : public RefCounted<PendingFrameLoad> { >@@ -399,7 +399,7 @@ void SpeculativeLoadManager::registerLoad(const GlobalFrameID& frameID, const Re > pendingFrameLoad->registerSubresourceLoad(request, resourceKey); > } > >-void SpeculativeLoadManager::addPreloadedEntry(std::unique_ptr<Entry> entry, const GlobalFrameID& frameID, std::optional<ResourceRequest>&& revalidationRequest) >+void SpeculativeLoadManager::addPreloadedEntry(std::unique_ptr<Entry> entry, const GlobalFrameID& frameID, WTF::Optional<ResourceRequest>&& revalidationRequest) > { > ASSERT(entry); > ASSERT(!entry->needsValidation()); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h b/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h >index db6f4f236db15c8a8c5485a3af85dd75fd061876..5c18dcbc231a648a9f53c4222dc354dd9630c802 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h >@@ -59,7 +59,7 @@ public: > private: > class PreloadedEntry; > >- void addPreloadedEntry(std::unique_ptr<Entry>, const GlobalFrameID&, std::optional<WebCore::ResourceRequest>&& revalidationRequest = std::nullopt); >+ void addPreloadedEntry(std::unique_ptr<Entry>, const GlobalFrameID&, WTF::Optional<WebCore::ResourceRequest>&& revalidationRequest = WTF::nullopt); > void preloadEntry(const Key&, const SubresourceInfo&, const GlobalFrameID&); > void retrieveEntryFromStorage(const SubresourceInfo&, RetrieveCompletionHandler&&); > void revalidateSubresource(const SubresourceInfo&, std::unique_ptr<Entry>, const GlobalFrameID&); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >index 16579ba8209eb658578cc2c43141c9350c856db3..35ed540490863d6dee0128c518c7bfd73885771d 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >@@ -221,7 +221,7 @@ void Statistics::recordNotUsingCacheForRequest(uint64_t webPageID, const Key& ke > ASSERT(retrieveDecision != RetrieveDecision::Yes); > > auto hash = key.hashAsString(); >- queryWasEverRequested(hash, NeedUncachedReason::No, [this, hash, requestURL = request.url(), webPageID, retrieveDecision](bool wasEverRequested, const std::optional<StoreDecision>&) { >+ queryWasEverRequested(hash, NeedUncachedReason::No, [this, hash, requestURL = request.url(), webPageID, retrieveDecision](bool wasEverRequested, const WTF::Optional<StoreDecision>&) { > if (wasEverRequested) { > String diagnosticKey = retrieveDecisionToDiagnosticKey(retrieveDecision); > LOG(NetworkCache, "(NetworkProcess) webPageID %" PRIu64 ": %s was previously requested but we are not using the cache, reason: %s", webPageID, requestURL.string().ascii().data(), diagnosticKey.utf8().data()); >@@ -261,7 +261,7 @@ static String storeDecisionToDiagnosticKey(StoreDecision storeDecision) > void Statistics::recordRetrievalFailure(uint64_t webPageID, const Key& key, const WebCore::ResourceRequest& request) > { > auto hash = key.hashAsString(); >- queryWasEverRequested(hash, NeedUncachedReason::Yes, [this, hash, requestURL = request.url(), webPageID](bool wasPreviouslyRequested, const std::optional<StoreDecision>& storeDecision) { >+ queryWasEverRequested(hash, NeedUncachedReason::Yes, [this, hash, requestURL = request.url(), webPageID](bool wasPreviouslyRequested, const WTF::Optional<StoreDecision>& storeDecision) { > if (wasPreviouslyRequested) { > String diagnosticKey = storeDecisionToDiagnosticKey(storeDecision.value()); > LOG(NetworkCache, "(NetworkProcess) webPageID %" PRIu64 ": %s was previously request but is not in the cache, reason: %s", webPageID, requestURL.string().ascii().data(), diagnosticKey.utf8().data()); >@@ -355,7 +355,7 @@ void Statistics::queryWasEverRequested(const String& hash, NeedUncachedReason ne > // Query pending writes first. > bool wasAlreadyRequested = m_hashesToAdd.contains(hash); > if (wasAlreadyRequested && needUncachedReason == NeedUncachedReason::No) { >- completionHandler(true, std::nullopt); >+ completionHandler(true, WTF::nullopt); > return; > } > if (needUncachedReason == NeedUncachedReason::Yes && m_storeDecisionsToAdd.contains(hash)) { >@@ -369,7 +369,7 @@ void Statistics::queryWasEverRequested(const String& hash, NeedUncachedReason ne > m_activeQueries.add(WTFMove(everRequestedQuery)); > serialBackgroundIOQueue().dispatch([this, wasAlreadyRequested, &query] () mutable { > WebCore::SQLiteTransactionInProgressAutoCounter transactionCounter; >- std::optional<StoreDecision> storeDecision; >+ WTF::Optional<StoreDecision> storeDecision; > if (m_database.isOpen()) { > if (!wasAlreadyRequested) { > WebCore::SQLiteStatement statement(m_database, "SELECT hash FROM AlreadyRequested WHERE hash=?"_s); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.h b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.h >index 7771bff43544e8c73acaf0104f6b979eb45b4345..a94e00e921a587302eb7704a7edac130725b9ddc 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.h >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.h >@@ -64,7 +64,7 @@ private: > void addStoreDecisionsToDatabase(const HashMap<String, NetworkCache::StoreDecision>&); > void writeTimerFired(); > >- typedef Function<void (bool wasEverRequested, const std::optional<StoreDecision>&)> RequestedCompletionHandler; >+ typedef Function<void (bool wasEverRequested, const WTF::Optional<StoreDecision>&)> RequestedCompletionHandler; > enum class NeedUncachedReason { No, Yes }; > void queryWasEverRequested(const String&, NeedUncachedReason, RequestedCompletionHandler&&); > void markAsRequested(const String& hash); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp >index c810d135c1a973e7a09a690579b7b8c00619817e..0be9fa7897bd7ab4686ba1199c86e6722f4ea6c8 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp >@@ -522,7 +522,7 @@ static Data encodeRecordMetaData(const RecordMetaData& metaData) > return Data(encoder.buffer(), encoder.bufferSize()); > } > >-std::optional<BlobStorage::Blob> Storage::storeBodyAsBlob(WriteOperation& writeOperation) >+WTF::Optional<BlobStorage::Blob> Storage::storeBodyAsBlob(WriteOperation& writeOperation) > { > auto blobPath = blobPathForKey(writeOperation.record.key); > >@@ -547,7 +547,7 @@ std::optional<BlobStorage::Blob> Storage::storeBodyAsBlob(WriteOperation& writeO > return blob; > } > >-Data Storage::encodeRecord(const Record& record, std::optional<BlobStorage::Blob> blob) >+Data Storage::encodeRecord(const Record& record, WTF::Optional<BlobStorage::Blob> blob) > { > ASSERT(!blob || bytesEqual(blob.value().data, record.body)); > >@@ -813,7 +813,7 @@ void Storage::dispatchWriteOperation(std::unique_ptr<WriteOperation> writeOperat > ++writeOperation.activeCount; > > bool shouldStoreAsBlob = shouldStoreBodyAsBlob(writeOperation.record.body); >- auto blob = shouldStoreAsBlob ? storeBodyAsBlob(writeOperation) : std::nullopt; >+ auto blob = shouldStoreAsBlob ? storeBodyAsBlob(writeOperation) : WTF::nullopt; > > auto recordData = encodeRecord(writeOperation.record, blob); > >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h b/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h >index acd2fe4e1fa7fd1d3f9dc7b0ed13f0c827680428..1c57f8280211572eac51687b57f120751668a7c3 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h >@@ -55,7 +55,7 @@ public: > WallTime timeStamp; > Data header; > Data body; >- std::optional<SHA1::Digest> bodyHash; >+ WTF::Optional<SHA1::Digest> bodyHash; > > WTF_MAKE_FAST_ALLOCATED; > }; >@@ -147,8 +147,8 @@ private: > void finishWriteOperation(WriteOperation&, int error = 0); > > bool shouldStoreBodyAsBlob(const Data& bodyData); >- std::optional<BlobStorage::Blob> storeBodyAsBlob(WriteOperation&); >- Data encodeRecord(const Record&, std::optional<BlobStorage::Blob>); >+ WTF::Optional<BlobStorage::Blob> storeBodyAsBlob(WriteOperation&); >+ Data encodeRecord(const Record&, WTF::Optional<BlobStorage::Blob>); > void readRecord(ReadOperation&, const Data&); > > void updateFileModificationTime(const String& path); >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >index 030fa52bb235f1e78ccff1f1da6ea7e0b0fe1897..40c9de8cc3b4a9d4cf09379d309c3371f95a3110 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >@@ -42,7 +42,7 @@ class NetworkSessionCocoa; > class NetworkDataTaskCocoa final : public NetworkDataTask { > friend class NetworkSessionCocoa; > public: >- static Ref<NetworkDataTask> create(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, WebCore::ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy shouldContentEncodingSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly shouldPreconnectOnly, bool dataTaskIsForMainFrameNavigation, std::optional<NetworkActivityTracker> networkActivityTracker) >+ static Ref<NetworkDataTask> create(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, WebCore::ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy shouldContentEncodingSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly shouldPreconnectOnly, bool dataTaskIsForMainFrameNavigation, WTF::Optional<NetworkActivityTracker> networkActivityTracker) > { > return adoptRef(*new NetworkDataTaskCocoa(session, client, request, frameID, pageID, storedCredentialsPolicy, shouldContentSniff, shouldContentEncodingSniff, shouldClearReferrerOnHTTPSToHTTPRedirect, shouldPreconnectOnly, dataTaskIsForMainFrameNavigation, networkActivityTracker)); > } >@@ -84,7 +84,7 @@ public: > String description() const override; > > private: >- NetworkDataTaskCocoa(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy, WebCore::ContentSniffingPolicy, WebCore::ContentEncodingSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly, bool dataTaskIsForMainFrameNavigation, std::optional<NetworkActivityTracker>); >+ NetworkDataTaskCocoa(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy, WebCore::ContentSniffingPolicy, WebCore::ContentEncodingSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly, bool dataTaskIsForMainFrameNavigation, WTF::Optional<NetworkActivityTracker>); > > bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&); > void applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(__strong NSURLRequest*&, bool shouldContentSniff, bool shouldContentEncodingSniff); >@@ -107,7 +107,7 @@ private: > #endif > > #if ENABLE(PROXIMITY_NETWORKING) >- std::optional<NetworkProximityAssertion::Token> m_proximityAssertionToken; >+ WTF::Optional<NetworkProximityAssertion::Token> m_proximityAssertionToken; > #endif > }; > >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >index c84141b8dd48ebe722e1d59b67e0c4b133892dea..690cb5b96099eaf33840d9e941bb9d45fd91030f 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >@@ -162,7 +162,7 @@ static void updateTaskWithFirstPartyForSameSiteCookies(NSURLSessionDataTask* tas > #endif > } > >-NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& requestWithCredentials, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, WebCore::ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy shouldContentEncodingSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly shouldPreconnectOnly, bool dataTaskIsForMainFrameNavigation, std::optional<NetworkActivityTracker> networkActivityTracker) >+NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& requestWithCredentials, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, WebCore::ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy shouldContentEncodingSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly shouldPreconnectOnly, bool dataTaskIsForMainFrameNavigation, WTF::Optional<NetworkActivityTracker> networkActivityTracker) > : NetworkDataTask(session, client, requestWithCredentials, storedCredentialsPolicy, shouldClearReferrerOnHTTPSToHTTPRedirect, dataTaskIsForMainFrameNavigation) > , m_frameID(frameID) > , m_pageID(pageID) >diff --git a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp >index b1b7a8155f1ba191d92e86c824b523e764907c58..4871c213b86167d3626db44bb2518ab9b9f7bb56 100644 >--- a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp >+++ b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp >@@ -443,7 +443,7 @@ void NetworkDataTaskCurl::appendCookieHeader(WebCore::ResourceRequest& request) > const auto& storageSession = m_session->networkStorageSession(); > const auto& cookieJar = storageSession.cookieStorage(); > auto includeSecureCookies = request.url().protocolIs("https") ? IncludeSecureCookies::Yes : IncludeSecureCookies::No; >- auto cookieHeaderField = cookieJar.cookieRequestHeaderFieldValue(storageSession, request.firstPartyForCookies(), WebCore::SameSiteInfo::create(request), request.url(), std::nullopt, std::nullopt, includeSecureCookies).first; >+ auto cookieHeaderField = cookieJar.cookieRequestHeaderFieldValue(storageSession, request.firstPartyForCookies(), WebCore::SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; > if (!cookieHeaderField.isEmpty()) > request.addHTTPHeaderField(HTTPHeaderName::Cookie, cookieHeaderField); > } >diff --git a/Source/WebKit/Platform/IPC/ArgumentCoder.h b/Source/WebKit/Platform/IPC/ArgumentCoder.h >index 9ecfdae070c4134ddead8c9c237b72d2633717ff..e4918401cf4b6985d2ad4f73e12216bad21883ff 100644 >--- a/Source/WebKit/Platform/IPC/ArgumentCoder.h >+++ b/Source/WebKit/Platform/IPC/ArgumentCoder.h >@@ -45,9 +45,9 @@ template<typename U> > class UsesModernDecoder { > private: > template<typename T, T> struct Helper; >- template<typename T> static uint8_t check(Helper<std::optional<U> (*)(Decoder&), &T::decode>*); >+ template<typename T> static uint8_t check(Helper<WTF::Optional<U> (*)(Decoder&), &T::decode>*); > template<typename T> static uint16_t check(...); >- template<typename T> static uint8_t checkArgumentCoder(Helper<std::optional<U> (*)(Decoder&), &ArgumentCoder<T>::decode>*); >+ template<typename T> static uint8_t checkArgumentCoder(Helper<WTF::Optional<U> (*)(Decoder&), &ArgumentCoder<T>::decode>*); > template<typename T> static uint16_t checkArgumentCoder(...); > public: > static constexpr bool argumentCoderValue = sizeof(check<U>(nullptr)) == sizeof(uint8_t); >@@ -97,7 +97,7 @@ template<typename T> struct ArgumentCoder { > } > > template<typename U = T, std::enable_if_t<UsesModernDecoder<U>::argumentCoderValue>* = nullptr> >- static std::optional<U> decode(Decoder& decoder) >+ static WTF::Optional<U> decode(Decoder& decoder) > { > return U::decode(decoder); > } >diff --git a/Source/WebKit/Platform/IPC/ArgumentCoders.cpp b/Source/WebKit/Platform/IPC/ArgumentCoders.cpp >index fe919b819af4042d75f76a667a876f424d705823..666f366a906c6cf3b70a066b1fc0b7abc0db5da1 100644 >--- a/Source/WebKit/Platform/IPC/ArgumentCoders.cpp >+++ b/Source/WebKit/Platform/IPC/ArgumentCoders.cpp >@@ -47,12 +47,12 @@ bool ArgumentCoder<WallTime>::decode(Decoder& decoder, WallTime& time) > return true; > } > >-std::optional<WallTime> ArgumentCoder<WallTime>::decode(Decoder& decoder) >+WTF::Optional<WallTime> ArgumentCoder<WallTime>::decode(Decoder& decoder) > { >- std::optional<double> time; >+ WTF::Optional<double> time; > decoder >> time; > if (!time) >- return std::nullopt; >+ return WTF::nullopt; > return WallTime::fromRawSeconds(*time); > } > >@@ -170,11 +170,11 @@ bool ArgumentCoder<String>::decode(Decoder& decoder, String& result) > return decodeStringText<UChar>(decoder, length, result); > } > >-std::optional<String> ArgumentCoder<String>::decode(Decoder& decoder) >+WTF::Optional<String> ArgumentCoder<String>::decode(Decoder& decoder) > { > uint32_t length; > if (!decoder.decode(length)) >- return std::nullopt; >+ return WTF::nullopt; > > if (length == std::numeric_limits<uint32_t>::max()) { > // This is the null string. >@@ -183,16 +183,16 @@ std::optional<String> ArgumentCoder<String>::decode(Decoder& decoder) > > bool is8Bit; > if (!decoder.decode(is8Bit)) >- return std::nullopt; >+ return WTF::nullopt; > > String result; > if (is8Bit) { > if (!decodeStringText<LChar>(decoder, length, result)) >- return std::nullopt; >+ return WTF::nullopt; > return result; > } > if (!decodeStringText<UChar>(decoder, length, result)) >- return std::nullopt; >+ return WTF::nullopt; > return result; > } > >diff --git a/Source/WebKit/Platform/IPC/ArgumentCoders.h b/Source/WebKit/Platform/IPC/ArgumentCoders.h >index daea6269b90b9b952469e35b905d9f4f09f5339d..43632dd1a002e6de1dd3ff2db5c0bd92de32f9e1 100644 >--- a/Source/WebKit/Platform/IPC/ArgumentCoders.h >+++ b/Source/WebKit/Platform/IPC/ArgumentCoders.h >@@ -64,18 +64,18 @@ template<typename T> struct ArgumentCoder<OptionSet<T>> { > return true; > } > >- static std::optional<OptionSet<T>> decode(Decoder& decoder) >+ static WTF::Optional<OptionSet<T>> decode(Decoder& decoder) > { >- std::optional<uint64_t> value; >+ WTF::Optional<uint64_t> value; > decoder >> value; > if (!value) >- return std::nullopt; >+ return WTF::nullopt; > return OptionSet<T>::fromRaw(*value); > } > }; > >-template<typename T> struct ArgumentCoder<std::optional<T>> { >- static void encode(Encoder& encoder, const std::optional<T>& optional) >+template<typename T> struct ArgumentCoder<WTF::Optional<T>> { >+ static void encode(Encoder& encoder, const WTF::Optional<T>& optional) > { > if (!optional) { > encoder << false; >@@ -86,14 +86,14 @@ template<typename T> struct ArgumentCoder<std::optional<T>> { > encoder << optional.value(); > } > >- static bool decode(Decoder& decoder, std::optional<T>& optional) >+ static bool decode(Decoder& decoder, WTF::Optional<T>& optional) > { > bool isEngaged; > if (!decoder.decode(isEngaged)) > return false; > > if (!isEngaged) { >- optional = std::nullopt; >+ optional = WTF::nullopt; > return true; > } > >@@ -105,20 +105,20 @@ template<typename T> struct ArgumentCoder<std::optional<T>> { > return true; > } > >- static std::optional<std::optional<T>> decode(Decoder& decoder) >+ static WTF::Optional<WTF::Optional<T>> decode(Decoder& decoder) > { >- std::optional<bool> isEngaged; >+ WTF::Optional<bool> isEngaged; > decoder >> isEngaged; > if (!isEngaged) >- return std::nullopt; >+ return WTF::nullopt; > if (*isEngaged) { >- std::optional<T> value; >+ WTF::Optional<T> value; > decoder >> value; > if (!value) >- return std::nullopt; >- return std::optional<std::optional<T>>(WTFMove(*value)); >+ return WTF::nullopt; >+ return WTF::Optional<WTF::Optional<T>>(WTFMove(*value)); > } >- return std::optional<std::optional<T>>(std::optional<T>(std::nullopt)); >+ return WTF::Optional<WTF::Optional<T>>(WTF::Optional<T>(WTF::nullopt)); > } > }; > >@@ -143,17 +143,17 @@ template<typename T, typename U> struct ArgumentCoder<std::pair<T, U>> { > return true; > } > >- static std::optional<std::pair<T, U>> decode(Decoder& decoder) >+ static WTF::Optional<std::pair<T, U>> decode(Decoder& decoder) > { >- std::optional<T> first; >+ WTF::Optional<T> first; > decoder >> first; > if (!first) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<U> second; >+ WTF::Optional<U> second; > decoder >> second; > if (!second) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*first), WTFMove(*second) }}; > } >@@ -178,7 +178,7 @@ struct TupleCoder { > template<typename U = typename std::remove_reference<typename std::tuple_element<sizeof...(Elements) - index, std::tuple<Elements...>>::type>::type, std::enable_if_t<UsesModernDecoder<U>::value>* = nullptr> > static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple) > { >- std::optional<U> optional; >+ WTF::Optional<U> optional; > decoder >> optional; > if (!optional) > return false; >@@ -246,7 +246,7 @@ template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t min > > static bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector) > { >- std::optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> optional; >+ WTF::Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> optional; > decoder >> optional; > if (!optional) > return false; >@@ -254,18 +254,18 @@ template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t min > return true; > } > >- static std::optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) >+ static WTF::Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) > { > uint64_t size; > if (!decoder.decode(size)) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<T, inlineCapacity, OverflowHandler, minCapacity> vector; > for (size_t i = 0; i < size; ++i) { >- std::optional<T> element; >+ WTF::Optional<T> element; > decoder >> element; > if (!element) >- return std::nullopt; >+ return WTF::nullopt; > vector.append(WTFMove(*element)); > } > vector.shrinkToFit(); >@@ -303,18 +303,18 @@ template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t min > return true; > } > >- static std::optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) >+ static WTF::Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) > { > uint64_t size; > if (!decoder.decode(size)) >- return std::nullopt; >+ return WTF::nullopt; > > // Since we know the total size of the elements, we can allocate the vector in > // one fell swoop. Before allocating we must however make sure that the decoder buffer > // is big enough. > if (!decoder.bufferIsLargeEnoughToContain<T>(size)) { > decoder.markInvalid(); >- return std::nullopt; >+ return WTF::nullopt; > } > > Vector<T, inlineCapacity, OverflowHandler, minCapacity> vector; >@@ -364,28 +364,28 @@ template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTrai > return true; > } > >- static std::optional<HashMapType> decode(Decoder& decoder) >+ static WTF::Optional<HashMapType> decode(Decoder& decoder) > { > uint64_t hashMapSize; > if (!decoder.decode(hashMapSize)) >- return std::nullopt; >+ return WTF::nullopt; > > HashMapType hashMap; > for (uint64_t i = 0; i < hashMapSize; ++i) { >- std::optional<KeyArg> key; >+ WTF::Optional<KeyArg> key; > decoder >> key; > if (!key) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<MappedArg> value; >+ WTF::Optional<MappedArg> value; > decoder >> value; > if (!value) >- return std::nullopt; >+ return WTF::nullopt; > > if (!hashMap.add(WTFMove(key.value()), WTFMove(value.value())).isNewEntry) { > // The hash map already has the specified key, bail. > decoder.markInvalid(); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -405,7 +405,7 @@ template<typename KeyArg, typename HashArg, typename KeyTraitsArg> struct Argume > > static bool decode(Decoder& decoder, HashSetType& hashSet) > { >- std::optional<HashSetType> tempHashSet; >+ WTF::Optional<HashSetType> tempHashSet; > decoder >> tempHashSet; > if (!tempHashSet) > return false; >@@ -414,23 +414,23 @@ template<typename KeyArg, typename HashArg, typename KeyTraitsArg> struct Argume > return true; > } > >- static std::optional<HashSetType> decode(Decoder& decoder) >+ static WTF::Optional<HashSetType> decode(Decoder& decoder) > { > uint64_t hashSetSize; > if (!decoder.decode(hashSetSize)) >- return std::nullopt; >+ return WTF::nullopt; > > HashSetType hashSet; > for (uint64_t i = 0; i < hashSetSize; ++i) { >- std::optional<KeyArg> key; >+ WTF::Optional<KeyArg> key; > decoder >> key; > if (!key) >- return std::nullopt; >+ return WTF::nullopt; > > if (!hashSet.add(WTFMove(key.value())).isNewEntry) { > // The hash set already has the specified key, bail. > decoder.markInvalid(); >- return std::nullopt; >+ return WTF::nullopt; > } > } > >@@ -491,26 +491,26 @@ template<typename ValueType, typename ErrorType> struct ArgumentCoder<Expected<V > encoder << expected.value(); > } > >- static std::optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder) >+ static WTF::Optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder) > { >- std::optional<bool> hasValue; >+ WTF::Optional<bool> hasValue; > decoder >> hasValue; > if (!hasValue) >- return std::nullopt; >+ return WTF::nullopt; > > if (*hasValue) { >- std::optional<ValueType> value; >+ WTF::Optional<ValueType> value; > decoder >> value; > if (!value) >- return std::nullopt; >+ return WTF::nullopt; > > Expected<ValueType, ErrorType> expected(WTFMove(*value)); > return WTFMove(expected); > } >- std::optional<ErrorType> error; >+ WTF::Optional<ErrorType> error; > decoder >> error; > if (!error) >- return std::nullopt; >+ return WTF::nullopt; > return { makeUnexpected(WTFMove(*error)) }; > } > }; >@@ -526,13 +526,13 @@ struct VariantCoder { > VariantCoder<index - 1, Types...>::encode(encoder, variant, i); > } > >- static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) >+ static WTF::Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) > { > if (i == index) { >- std::optional<typename WTF::variant_alternative<index, WTF::Variant<Types...>>::type> optional; >+ WTF::Optional<typename WTF::variant_alternative<index, WTF::Variant<Types...>>::type> optional; > decoder >> optional; > if (!optional) >- return std::nullopt; >+ return WTF::nullopt; > return { WTFMove(*optional) }; > } > return VariantCoder<index - 1, Types...>::decode(decoder, i); >@@ -547,13 +547,13 @@ struct VariantCoder<0, Types...> { > encoder << WTF::get<0>(variant); > } > >- static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) >+ static WTF::Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) > { > ASSERT_UNUSED(i, !i); >- std::optional<typename WTF::variant_alternative<0, WTF::Variant<Types...>>::type> optional; >+ WTF::Optional<typename WTF::variant_alternative<0, WTF::Variant<Types...>>::type> optional; > decoder >> optional; > if (!optional) >- return std::nullopt; >+ return WTF::nullopt; > return { WTFMove(*optional) }; > } > }; >@@ -566,12 +566,12 @@ template<typename... Types> struct ArgumentCoder<WTF::Variant<Types...>> { > VariantCoder<sizeof...(Types) - 1, Types...>::encode(encoder, variant, i); > } > >- static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder) >+ static WTF::Optional<WTF::Variant<Types...>> decode(Decoder& decoder) > { >- std::optional<unsigned> i; >+ WTF::Optional<unsigned> i; > decoder >> i; > if (!i) >- return std::nullopt; >+ return WTF::nullopt; > return VariantCoder<sizeof...(Types) - 1, Types...>::decode(decoder, *i); > } > }; >@@ -579,7 +579,7 @@ template<typename... Types> struct ArgumentCoder<WTF::Variant<Types...>> { > template<> struct ArgumentCoder<WallTime> { > static void encode(Encoder&, const WallTime&); > static bool decode(Decoder&, WallTime&); >- static std::optional<WallTime> decode(Decoder&); >+ static WTF::Optional<WallTime> decode(Decoder&); > }; > > template<> struct ArgumentCoder<AtomicString> { >@@ -595,7 +595,7 @@ template<> struct ArgumentCoder<CString> { > template<> struct ArgumentCoder<String> { > static void encode(Encoder&, const String&); > static bool decode(Decoder&, String&); >- static std::optional<String> decode(Decoder&); >+ static WTF::Optional<String> decode(Decoder&); > }; > > template<> struct ArgumentCoder<SHA1::Digest> { >diff --git a/Source/WebKit/Platform/IPC/Connection.cpp b/Source/WebKit/Platform/IPC/Connection.cpp >index 188d36cf7c210f8183fbd307ad27081698944fca..e7cdd6e2b55d54da67be353aaf481a3c5a6e6353 100644 >--- a/Source/WebKit/Platform/IPC/Connection.cpp >+++ b/Source/WebKit/Platform/IPC/Connection.cpp >@@ -961,7 +961,7 @@ void Connection::dispatchMessage(Decoder& decoder) > { > RELEASE_ASSERT(isValid()); > if (decoder.messageReceiverName() == "AsyncReply") { >- std::optional<uint64_t> listenerID; >+ WTF::Optional<uint64_t> listenerID; > decoder >> listenerID; > if (!listenerID) { > ASSERT_NOT_REACHED(); >diff --git a/Source/WebKit/Platform/IPC/Connection.h b/Source/WebKit/Platform/IPC/Connection.h >index 0a7b33f30b47a3464f6640cdd01288e2ef7ba6bd..77fb3bc0f358dc2546a867a08d86e43fabdd3932 100644 >--- a/Source/WebKit/Platform/IPC/Connection.h >+++ b/Source/WebKit/Platform/IPC/Connection.h >@@ -179,7 +179,7 @@ public: > > template<typename T, typename... Args> void sendWithAsyncReply(T&& message, CompletionHandler<void(Args...)>&& args, uint64_t destinationID = 0); > template<typename T> bool send(T&& message, uint64_t destinationID, OptionSet<SendOption> sendOptions = { }); >- template<typename T> void sendWithReply(T&& message, uint64_t destinationID, FunctionDispatcher& replyDispatcher, Function<void(std::optional<typename CodingType<typename T::Reply>::Type>)>&& replyHandler); >+ template<typename T> void sendWithReply(T&& message, uint64_t destinationID, FunctionDispatcher& replyDispatcher, Function<void(WTF::Optional<typename CodingType<typename T::Reply>::Type>)>&& replyHandler); > template<typename T> bool sendSync(T&& message, typename T::Reply&& reply, uint64_t destinationID, Seconds timeout = Seconds::infinity(), OptionSet<SendSyncOption> sendSyncOptions = { }); > template<typename T> bool waitForAndDispatchImmediately(uint64_t destinationID, Seconds timeout, OptionSet<WaitForOption> waitForOptions = { }); > >@@ -434,7 +434,7 @@ void Connection::sendWithAsyncReply(T&& message, CompletionHandler<void(Args...) > } > > template<typename T> >-void Connection::sendWithReply(T&& message, uint64_t destinationID, FunctionDispatcher& replyDispatcher, Function<void(std::optional<typename CodingType<typename T::Reply>::Type>)>&& replyHandler) >+void Connection::sendWithReply(T&& message, uint64_t destinationID, FunctionDispatcher& replyDispatcher, Function<void(WTF::Optional<typename CodingType<typename T::Reply>::Type>)>&& replyHandler) > { > uint64_t requestID = 0; > std::unique_ptr<Encoder> encoder = createSyncMessageEncoder(T::receiverName(), T::name(), destinationID, requestID); >@@ -450,7 +450,7 @@ void Connection::sendWithReply(T&& message, uint64_t destinationID, FunctionDisp > } > } > >- replyHandler(std::nullopt); >+ replyHandler(WTF::nullopt); > }); > } > >diff --git a/Source/WebKit/Platform/IPC/Decoder.cpp b/Source/WebKit/Platform/IPC/Decoder.cpp >index 57b18a2046e3d200faab12b2a061b632c3a1a873..b4769efddc18c87b2ee3e4128e5f08f2e45ab9e9 100644 >--- a/Source/WebKit/Platform/IPC/Decoder.cpp >+++ b/Source/WebKit/Platform/IPC/Decoder.cpp >@@ -189,7 +189,7 @@ static void decodeValueFromBuffer(Type& value, const uint8_t*& bufferPosition) > } > > template<typename Type> >-Decoder& Decoder::getOptional(std::optional<Type>& optional) >+Decoder& Decoder::getOptional(WTF::Optional<Type>& optional) > { > Type result; > if (!alignBufferPosition(sizeof(result), sizeof(result))) >@@ -200,52 +200,52 @@ Decoder& Decoder::getOptional(std::optional<Type>& optional) > return *this; > } > >-Decoder& Decoder::operator>>(std::optional<bool>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<bool>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<uint8_t>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<uint8_t>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<uint16_t>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<uint16_t>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<uint32_t>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<uint32_t>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<uint64_t>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<uint64_t>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<int16_t>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<int16_t>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<int32_t>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<int32_t>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<int64_t>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<int64_t>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<float>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<float>& optional) > { > return getOptional(optional); > } > >-Decoder& Decoder::operator>>(std::optional<double>& optional) >+Decoder& Decoder::operator>>(WTF::Optional<double>& optional) > { > return getOptional(optional); > } >diff --git a/Source/WebKit/Platform/IPC/Decoder.h b/Source/WebKit/Platform/IPC/Decoder.h >index b788244a4e47aa80bf667fb1b5d9e79cc67aafee..94e67eb0eb795b9e6922faacf4ee1911ad1c383a 100644 >--- a/Source/WebKit/Platform/IPC/Decoder.h >+++ b/Source/WebKit/Platform/IPC/Decoder.h >@@ -78,25 +78,25 @@ public: > bool decodeVariableLengthByteArray(DataReference&); > > bool decode(bool&); >- Decoder& operator>>(std::optional<bool>&); >+ Decoder& operator>>(WTF::Optional<bool>&); > bool decode(uint8_t&); >- Decoder& operator>>(std::optional<uint8_t>&); >+ Decoder& operator>>(WTF::Optional<uint8_t>&); > bool decode(uint16_t&); >- Decoder& operator>>(std::optional<uint16_t>&); >+ Decoder& operator>>(WTF::Optional<uint16_t>&); > bool decode(uint32_t&); >- Decoder& operator>>(std::optional<uint32_t>&); >+ Decoder& operator>>(WTF::Optional<uint32_t>&); > bool decode(uint64_t&); >- Decoder& operator>>(std::optional<uint64_t>&); >+ Decoder& operator>>(WTF::Optional<uint64_t>&); > bool decode(int16_t&); >- Decoder& operator>>(std::optional<int16_t>&); >+ Decoder& operator>>(WTF::Optional<int16_t>&); > bool decode(int32_t&); >- Decoder& operator>>(std::optional<int32_t>&); >+ Decoder& operator>>(WTF::Optional<int32_t>&); > bool decode(int64_t&); >- Decoder& operator>>(std::optional<int64_t>&); >+ Decoder& operator>>(WTF::Optional<int64_t>&); > bool decode(float&); >- Decoder& operator>>(std::optional<float>&); >+ Decoder& operator>>(WTF::Optional<float>&); > bool decode(double&); >- Decoder& operator>>(std::optional<double>&); >+ Decoder& operator>>(WTF::Optional<double>&); > > template<typename E> > auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool> >@@ -112,9 +112,9 @@ public: > } > > template<typename E, std::enable_if_t<std::is_enum<E>::value>* = nullptr> >- Decoder& operator>>(std::optional<E>& optional) >+ Decoder& operator>>(WTF::Optional<E>& optional) > { >- std::optional<uint64_t> value; >+ WTF::Optional<uint64_t> value; > *this >> value; > if (value && isValidEnum<E>(*value)) > optional = static_cast<E>(*value); >@@ -151,7 +151,7 @@ public: > } > > template<typename T, std::enable_if_t<UsesModernDecoder<T>::value>* = nullptr> >- Decoder& operator>>(std::optional<T>& t) >+ Decoder& operator>>(WTF::Optional<T>& t) > { > t = ArgumentCoder<T>::decode(*this); > return *this; >@@ -164,7 +164,7 @@ public: > private: > bool alignBufferPosition(unsigned alignment, size_t); > bool bufferIsLargeEnoughToContain(unsigned alignment, size_t) const; >- template<typename Type> Decoder& getOptional(std::optional<Type>&); >+ template<typename Type> Decoder& getOptional(WTF::Optional<Type>&); > > const uint8_t* m_buffer; > const uint8_t* m_bufferPos; >diff --git a/Source/WebKit/Platform/IPC/FormDataReference.h b/Source/WebKit/Platform/IPC/FormDataReference.h >index a4d89bcbf6f32147e17711f09d4ea9eccf364d21..4b25d6dbef1e257f742ae46dad14eb912bec1531 100644 >--- a/Source/WebKit/Platform/IPC/FormDataReference.h >+++ b/Source/WebKit/Platform/IPC/FormDataReference.h >@@ -67,23 +67,23 @@ public: > encoder << sandboxExtensionHandles; > } > >- static std::optional<FormDataReference> decode(Decoder& decoder) >+ static WTF::Optional<FormDataReference> decode(Decoder& decoder) > { >- std::optional<bool> hasFormData; >+ WTF::Optional<bool> hasFormData; > decoder >> hasFormData; > if (!hasFormData) >- return std::nullopt; >+ return WTF::nullopt; > if (!hasFormData.value()) > return FormDataReference { }; > > auto formData = WebCore::FormData::decode(decoder); > if (!formData) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WebKit::SandboxExtension::HandleArray> sandboxExtensionHandles; >+ WTF::Optional<WebKit::SandboxExtension::HandleArray> sandboxExtensionHandles; > decoder >> sandboxExtensionHandles; > if (!sandboxExtensionHandles) >- return std::nullopt; >+ return WTF::nullopt; > > for (size_t i = 0; i < sandboxExtensionHandles->size(); ++i) > WebKit::SandboxExtension::consumePermanently(sandboxExtensionHandles->at(i)); >diff --git a/Source/WebKit/Platform/IPC/HandleMessage.h b/Source/WebKit/Platform/IPC/HandleMessage.h >index 32c12cb60d512d6c9a4bf420ac078eca14fe3d73..07aad4fcc13e7990bd7540ffd681736aa3b666a4 100644 >--- a/Source/WebKit/Platform/IPC/HandleMessage.h >+++ b/Source/WebKit/Platform/IPC/HandleMessage.h >@@ -190,7 +190,7 @@ void handleMessageDelayed(Connection& connection, Decoder& decoder, std::unique_ > template<typename T, typename C, typename MF> > void handleMessageAsync(Connection& connection, Decoder& decoder, C* object, MF function) > { >- std::optional<uint64_t> listenerID; >+ WTF::Optional<uint64_t> listenerID; > decoder >> listenerID; > if (!listenerID) { > ASSERT(decoder.isInvalid()); >diff --git a/Source/WebKit/Platform/LogInitialization.h b/Source/WebKit/Platform/LogInitialization.h >index 256a4597318d11adede075b1e1215fd63cfeaf81..975078df6de3d1de63324377cda7adffe6ab730d 100644 >--- a/Source/WebKit/Platform/LogInitialization.h >+++ b/Source/WebKit/Platform/LogInitialization.h >@@ -31,7 +31,7 @@ > > namespace WebKit { > >-void initializeLogChannelsIfNecessary(std::optional<String> = std::nullopt); >+void initializeLogChannelsIfNecessary(WTF::Optional<String> = WTF::nullopt); > String logLevelString(); > > } // namespace WebKit >diff --git a/Source/WebKit/Platform/Logging.cpp b/Source/WebKit/Platform/Logging.cpp >index 6ad6f0eb7e2c3b76c1b7edb28bf5edb40474424d..8dc95234272cdea925a187b398b2cacaaeed4a83 100644 >--- a/Source/WebKit/Platform/Logging.cpp >+++ b/Source/WebKit/Platform/Logging.cpp >@@ -44,7 +44,7 @@ namespace WebKit { > static const size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels); > static bool logChannelsNeedInitialization = true; > >-void initializeLogChannelsIfNecessary(std::optional<String> logChannelString) >+void initializeLogChannelsIfNecessary(WTF::Optional<String> logChannelString) > { > if (!logChannelsNeedInitialization && !logChannelString) > return; >diff --git a/Source/WebKit/Platform/SharedMemory.h b/Source/WebKit/Platform/SharedMemory.h >index 3eadb15f72a25472c7b560577f924e87b2df5065..c166879db3a2d1ba56aea1564181c3cab865788e 100644 >--- a/Source/WebKit/Platform/SharedMemory.h >+++ b/Source/WebKit/Platform/SharedMemory.h >@@ -129,7 +129,7 @@ private: > #endif > > #if USE(UNIX_DOMAIN_SOCKETS) >- std::optional<int> m_fileDescriptor; >+ WTF::Optional<int> m_fileDescriptor; > bool m_isWrappingMap { false }; > #elif OS(DARWIN) > mach_port_t m_port { MACH_PORT_NULL }; >diff --git a/Source/WebKit/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp b/Source/WebKit/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp >index b6f7fc3822f669efb57428e694b725a977b766b1..a8d8a65a09bf4bbe93ad0e5f049964db234054d6 100644 >--- a/Source/WebKit/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp >+++ b/Source/WebKit/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp >@@ -103,7 +103,7 @@ bool ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction() > > const struct svm_model* ResourceLoadStatisticsClassifierCocoa::singletonPredictionModel() > { >- static std::optional<struct svm_model*> corePredictionModel; >+ static WTF::Optional<struct svm_model*> corePredictionModel; > static dispatch_once_t onceToken; > dispatch_once(&onceToken, ^{ > auto path = storagePath(); >diff --git a/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp b/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp >index 520e7975992ed9dee48a0577e0ab2950d94dc5ed..b3fe6842bded9b8cdfbd0c145c23fe4c482a19cf 100644 >--- a/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp >+++ b/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp >@@ -192,7 +192,7 @@ RefPtr<SharedMemory> SharedMemory::map(const Handle& handle, Protection protecti > return nullptr; > > RefPtr<SharedMemory> instance = wrapMap(data, handle.m_attachment.size(), -1); >- instance->m_fileDescriptor = std::nullopt; >+ instance->m_fileDescriptor = WTF::nullopt; > instance->m_isWrappingMap = false; > return instance; > } >diff --git a/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp b/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp >index 9e6f5d2d8b6268e93423476d255007bc05203908..92a99af79739ee0560375f013f97874614789c4b 100644 >--- a/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp >+++ b/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp >@@ -45,7 +45,7 @@ namespace WebPage { > > void TestAsyncMessage::callReply(IPC::Decoder& decoder, CompletionHandler<void(uint64_t&&)>&& completionHandler) > { >- std::optional<uint64_t> result; >+ WTF::Optional<uint64_t> result; > decoder >> result; > if (!result) { > ASSERT_NOT_REACHED(); >@@ -90,13 +90,13 @@ void TestAsyncMessageWithNoArguments::send(std::unique_ptr<IPC::Encoder>&& encod > > void TestAsyncMessageWithMultipleArguments::callReply(IPC::Decoder& decoder, CompletionHandler<void(bool&&, uint64_t&&)>&& completionHandler) > { >- std::optional<bool> flag; >+ WTF::Optional<bool> flag; > decoder >> flag; > if (!flag) { > ASSERT_NOT_REACHED(); > return; > } >- std::optional<uint64_t> value; >+ WTF::Optional<uint64_t> value; > decoder >> value; > if (!value) { > ASSERT_NOT_REACHED(); >@@ -119,7 +119,7 @@ void TestAsyncMessageWithMultipleArguments::send(std::unique_ptr<IPC::Encoder>&& > > #endif > >-void TestDelayedMessage::send(std::unique_ptr<IPC::Encoder>&& encoder, IPC::Connection& connection, const std::optional<WebKit::TestClassName>& optionalReply) >+void TestDelayedMessage::send(std::unique_ptr<IPC::Encoder>&& encoder, IPC::Connection& connection, const WTF::Optional<WebKit::TestClassName>& optionalReply) > { > *encoder << optionalReply; > connection.sendSyncReply(WTFMove(encoder)); >diff --git a/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h b/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h >index d63971c62277683502d38154e1feab073fab9707..31128ecb87f6a2fa460b962d985d47f81d9f7a5a 100644 >--- a/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h >+++ b/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h >@@ -180,9 +180,9 @@ public: > static IPC::StringReference name() { return IPC::StringReference("TestDelayedMessage"); } > static const bool isSync = true; > >- using DelayedReply = CompletionHandler<void(const std::optional<WebKit::TestClassName>& optionalReply)>; >- static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const std::optional<WebKit::TestClassName>& optionalReply); >- typedef std::tuple<std::optional<WebKit::TestClassName>&> Reply; >+ using DelayedReply = CompletionHandler<void(const WTF::Optional<WebKit::TestClassName>& optionalReply)>; >+ static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const WTF::Optional<WebKit::TestClassName>& optionalReply); >+ typedef std::tuple<WTF::Optional<WebKit::TestClassName>&> Reply; > explicit TestDelayedMessage(bool value) > : m_arguments(value) > { >diff --git a/Source/WebKit/Scripts/webkit/messages.py b/Source/WebKit/Scripts/webkit/messages.py >index b52137b86566b372047eea70f03726e8833ba813..c87f33965c8c77444b0c53970ae5c6b15b78773f 100644 >--- a/Source/WebKit/Scripts/webkit/messages.py >+++ b/Source/WebKit/Scripts/webkit/messages.py >@@ -328,7 +328,7 @@ def class_template_headers(template_string): > 'WebCore::RectEdges': {'headers': ['<WebCore/RectEdges.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, > 'HashMap': {'headers': ['<wtf/HashMap.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, > 'HashSet': {'headers': ['<wtf/HashSet.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, >- 'std::optional': {'headers': ['<wtf/Optional.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, >+ 'WTF::Optional': {'headers': ['<wtf/Optional.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, > 'OptionSet': {'headers': ['<wtf/OptionSet.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, > 'Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, > 'std::pair': {'headers': ['<utility>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, >@@ -563,7 +563,7 @@ def generate_message_handler(file): > move_parameters = message.name, ', '.join([move_type(x.type) for x in message.reply_parameters]) > result.append('void %s::callReply(IPC::Decoder& decoder, CompletionHandler<void(%s)>&& completionHandler)\n{\n' % move_parameters) > for x in message.reply_parameters: >- result.append(' std::optional<%s> %s;\n' % (x.type, x.name)) >+ result.append(' WTF::Optional<%s> %s;\n' % (x.type, x.name)) > result.append(' decoder >> %s;\n' % x.name) > result.append(' if (!%s) {\n ASSERT_NOT_REACHED();\n return;\n }\n' % x.name) > result.append(' completionHandler(') >diff --git a/Source/WebKit/Scripts/webkit/messages_unittest.py b/Source/WebKit/Scripts/webkit/messages_unittest.py >index e8d8f00fbee2c8e799a2d5b9456844a204885e0a..a75b4bbf87aebbe6e9fa7e2fa1fe82d54c070064 100644 >--- a/Source/WebKit/Scripts/webkit/messages_unittest.py >+++ b/Source/WebKit/Scripts/webkit/messages_unittest.py >@@ -285,7 +285,7 @@ _expected_superclass_results = { > ('bool', 'value'), > ), > 'reply_parameters': ( >- ('std::optional<WebKit::TestClassName>', 'optionalReply'), >+ ('WTF::Optional<WebKit::TestClassName>', 'optionalReply'), > ), > 'conditions': (None), > }, >diff --git a/Source/WebKit/Scripts/webkit/test-superclass-messages.in b/Source/WebKit/Scripts/webkit/test-superclass-messages.in >index c5a055d06107bb96edc35b07a2b9117a48ad9b16..092ba9da7beefaaf638aa77f688b8e9dbfe135c9 100644 >--- a/Source/WebKit/Scripts/webkit/test-superclass-messages.in >+++ b/Source/WebKit/Scripts/webkit/test-superclass-messages.in >@@ -28,5 +28,5 @@ messages -> WebPage : WebPageBase { > TestAsyncMessageWithMultipleArguments() -> (bool flag, uint64_t value) Async > #endif > TestSyncMessage(uint32_t param) -> (uint8_t reply) Sync >- TestDelayedMessage(bool value) -> (std::optional<WebKit::TestClassName> optionalReply) Delayed >+ TestDelayedMessage(bool value) -> (WTF::Optional<WebKit::TestClassName> optionalReply) Delayed > } >diff --git a/Source/WebKit/Shared/API/APIPageGroupHandle.cpp b/Source/WebKit/Shared/API/APIPageGroupHandle.cpp >index 84db40809ee5f17a9ab0b09cd2645bf1b7df6e15..b541c8037f301e4ac470cef1de83446a06c7681b 100644 >--- a/Source/WebKit/Shared/API/APIPageGroupHandle.cpp >+++ b/Source/WebKit/Shared/API/APIPageGroupHandle.cpp >@@ -52,7 +52,7 @@ void PageGroupHandle::encode(IPC::Encoder& encoder) const > > bool PageGroupHandle::decode(IPC::Decoder& decoder, RefPtr<Object>& result) > { >- std::optional<WebKit::WebPageGroupData> webPageGroupData; >+ WTF::Optional<WebKit::WebPageGroupData> webPageGroupData; > decoder >> webPageGroupData; > if (!webPageGroupData) > return false; >diff --git a/Source/WebKit/Shared/API/APISecurityOrigin.h b/Source/WebKit/Shared/API/APISecurityOrigin.h >index b3893a158d78dfbcf2a7fba4a4838974646679cf..edc92bd50d3a921ab28f262bdb7b15219c8a3ccc 100644 >--- a/Source/WebKit/Shared/API/APISecurityOrigin.h >+++ b/Source/WebKit/Shared/API/APISecurityOrigin.h >@@ -38,7 +38,7 @@ public: > return create(WebCore::SecurityOrigin::createFromString(string)); > } > >- static Ref<SecurityOrigin> create(const WTF::String& protocol, const WTF::String& host, std::optional<uint16_t> port) >+ static Ref<SecurityOrigin> create(const WTF::String& protocol, const WTF::String& host, WTF::Optional<uint16_t> port) > { > return create(WebCore::SecurityOrigin::create(protocol, host, port)); > } >diff --git a/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm b/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm >index e7d804f2a766151986cb88ba9191ea9bcd72b1bb..735e2e7af9bed932c8fae71ec4f66fcb615dbd65 100644 >--- a/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm >+++ b/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm >@@ -53,7 +53,7 @@ struct MethodInfo { > CString replySignature; > Vector<HashSet<CFTypeRef>> allowedReplyClasses; > }; >- std::optional<ReplyInfo> replyInfo; >+ WTF::Optional<ReplyInfo> replyInfo; > }; > > @implementation _WKRemoteObjectInterface { >diff --git a/Source/WebKit/Shared/AssistedNodeInformation.cpp b/Source/WebKit/Shared/AssistedNodeInformation.cpp >index 5134791800315060a9ce8ff2cbaed31e93f22a72..df4743ff775e15122d93c9e9520ad18348eea0a4 100644 >--- a/Source/WebKit/Shared/AssistedNodeInformation.cpp >+++ b/Source/WebKit/Shared/AssistedNodeInformation.cpp >@@ -40,23 +40,23 @@ void OptionItem::encode(IPC::Encoder& encoder) const > encoder << parentGroupID; > } > >-std::optional<OptionItem> OptionItem::decode(IPC::Decoder& decoder) >+WTF::Optional<OptionItem> OptionItem::decode(IPC::Decoder& decoder) > { > OptionItem result; > if (!decoder.decode(result.text)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.isGroup)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.isSelected)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.disabled)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.parentGroupID)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >diff --git a/Source/WebKit/Shared/AssistedNodeInformation.h b/Source/WebKit/Shared/AssistedNodeInformation.h >index 9b1c3b0145f83f794851774e96b8586ae72d8d19..cb55d610f119a022db990850bb8695f2bc64357e 100644 >--- a/Source/WebKit/Shared/AssistedNodeInformation.h >+++ b/Source/WebKit/Shared/AssistedNodeInformation.h >@@ -90,7 +90,7 @@ struct OptionItem { > int parentGroupID { 0 }; > > void encode(IPC::Encoder&) const; >- static std::optional<OptionItem> decode(IPC::Decoder&); >+ static WTF::Optional<OptionItem> decode(IPC::Decoder&); > }; > > struct AssistedNodeInformation { >diff --git a/Source/WebKit/Shared/CallbackID.h b/Source/WebKit/Shared/CallbackID.h >index 8f18d4dcf770cb901a99f63a9af55a46f6c5cee3..48045e66b6b7fe3abbef7d5e34642914f696aae0 100644 >--- a/Source/WebKit/Shared/CallbackID.h >+++ b/Source/WebKit/Shared/CallbackID.h >@@ -75,12 +75,12 @@ public: > encoder << m_id; > } > >- template<class Decoder> static std::optional<CallbackID> decode(Decoder& decoder) >+ template<class Decoder> static WTF::Optional<CallbackID> decode(Decoder& decoder) > { >- std::optional<uint64_t> identifier; >+ WTF::Optional<uint64_t> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > RELEASE_ASSERT(isValidCallbackID(*identifier)); > return fromInteger(*identifier); > } >diff --git a/Source/WebKit/Shared/ChildProcess.h b/Source/WebKit/Shared/ChildProcess.h >index a72bc929dbd7c74c22669b82317a61ffabdf3769..ea03a9c3d667dd4383f9a26ad209c4b5d3dea839 100644 >--- a/Source/WebKit/Shared/ChildProcess.h >+++ b/Source/WebKit/Shared/ChildProcess.h >@@ -152,7 +152,7 @@ private: > struct ChildProcessInitializationParameters { > String uiProcessName; > String clientIdentifier; >- std::optional<WebCore::ProcessIdentifier> processIdentifier; >+ WTF::Optional<WebCore::ProcessIdentifier> processIdentifier; > IPC::Connection::Identifier connectionIdentifier; > HashMap<String, String> extraInitializationData; > ChildProcess::ProcessType processType; >diff --git a/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h b/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h >index d85d38886ea0eb5ea13326aa550aee33844ad865..222fdf5485b5fc2569e8cf6f8e609fce232814f6 100644 >--- a/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h >+++ b/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h >@@ -32,13 +32,13 @@ > namespace IPC { > > void encodeObject(Encoder&, id <NSSecureCoding>); >-std::optional<RetainPtr<id <NSSecureCoding>>> decodeObject(Decoder&, NSArray<Class> *allowedClasses); >+WTF::Optional<RetainPtr<id <NSSecureCoding>>> decodeObject(Decoder&, NSArray<Class> *allowedClasses); > >-template<typename T> std::optional<RetainPtr<T>> decode(Decoder&, Class allowedClass); >-template<typename T> std::optional<RetainPtr<T>> decode(Decoder&, NSArray<Class> *allowedClasses = @[ [T class] ]); >+template<typename T> WTF::Optional<RetainPtr<T>> decode(Decoder&, Class allowedClass); >+template<typename T> WTF::Optional<RetainPtr<T>> decode(Decoder&, NSArray<Class> *allowedClasses = @[ [T class] ]); > > template<typename T> >-std::optional<RetainPtr<T>> decode(Decoder& decoder, Class allowedClass) >+WTF::Optional<RetainPtr<T>> decode(Decoder& decoder, Class allowedClass) > { > return decode<T>(decoder, @[ allowedClass ]); > } >@@ -57,11 +57,11 @@ static inline bool isObjectClassAllowed(id object, NSArray<Class> *allowedClasse > #endif > > template<typename T> >-std::optional<RetainPtr<T>> decode(Decoder& decoder, NSArray<Class> *allowedClasses) >+WTF::Optional<RetainPtr<T>> decode(Decoder& decoder, NSArray<Class> *allowedClasses) > { > auto result = decodeObject(decoder, allowedClasses); > if (!result) >- return std::nullopt; >+ return WTF::nullopt; > > if (!*result) > return { nullptr }; >@@ -89,7 +89,7 @@ template<typename T> struct ArgumentCoder<RetainPtr<T>> { > } > > template <typename U = T, std::enable_if_t<ConformsToSecureCoding<U>::value>* = nullptr> >- static std::optional<RetainPtr<U>> decode(Decoder& decoder) >+ static WTF::Optional<RetainPtr<U>> decode(Decoder& decoder) > { > return IPC::decode<U>(decoder); > } >diff --git a/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm b/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm >index ca2049b1f39d78feebc26b452dcc9ca42bcfafba..27b934cfa2b3aebedc593f975bf9ff027398accd 100644 >--- a/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm >+++ b/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm >@@ -42,11 +42,11 @@ void encodeObject(Encoder& encoder, id <NSSecureCoding> object) > IPC::encode(encoder, (__bridge CFDataRef)[archiver encodedData]); > } > >-std::optional<RetainPtr<id <NSSecureCoding>>> decodeObject(Decoder& decoder, NSArray<Class> *allowedClasses) >+WTF::Optional<RetainPtr<id <NSSecureCoding>>> decodeObject(Decoder& decoder, NSArray<Class> *allowedClasses) > { > RetainPtr<CFDataRef> data; > if (!decode(decoder, data)) >- return std::nullopt; >+ return WTF::nullopt; > > auto unarchiver = secureUnarchiverFromData((__bridge NSData *)data.get()); > @try { >@@ -55,7 +55,7 @@ std::optional<RetainPtr<id <NSSecureCoding>>> decodeObject(Decoder& decoder, NSA > return { result }; > } @catch (NSException *exception) { > LOG_ERROR("Failed to decode object of classes %@: %@", allowedClasses, exception); >- return std::nullopt; >+ return WTF::nullopt; > } @finally { > [unarchiver finishDecoding]; > } >diff --git a/Source/WebKit/Shared/Cocoa/DataDetectionResult.h b/Source/WebKit/Shared/Cocoa/DataDetectionResult.h >index a0888f91896b495da82f970b86ad510cf5ad3cef..43bb8d6996cdc72ca62e28976fe7e583fdcb6cb6 100644 >--- a/Source/WebKit/Shared/Cocoa/DataDetectionResult.h >+++ b/Source/WebKit/Shared/Cocoa/DataDetectionResult.h >@@ -38,7 +38,7 @@ struct DataDetectionResult { > RetainPtr<NSArray> results; > > void encode(IPC::Encoder&) const; >- static std::optional<DataDetectionResult> decode(IPC::Decoder&); >+ static WTF::Optional<DataDetectionResult> decode(IPC::Decoder&); > }; > > } >diff --git a/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm b/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm >index 8de67a170b25c5eacf3cadc36722616fba42f865..a3d932508a8629876487b1f127b49a1f082476e4 100644 >--- a/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm >+++ b/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm >@@ -44,11 +44,11 @@ void DataDetectionResult::encode(IPC::Encoder& encoder) const > encoder << results; > } > >-std::optional<DataDetectionResult> DataDetectionResult::decode(IPC::Decoder& decoder) >+WTF::Optional<DataDetectionResult> DataDetectionResult::decode(IPC::Decoder& decoder) > { > auto results = IPC::decode<NSArray>(decoder, @[ [NSArray class], getDDScannerResultClass() ]); > if (!results) >- return std::nullopt; >+ return WTF::nullopt; > > DataDetectionResult result; > result.results = WTFMove(*results); >diff --git a/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm b/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm >index 0dd5d3c41834483a2c2f8fff3075f7e1759c5698..0f5c52bf94fb8a31ac96bb4379a3c3bfa6f8b63e 100644 >--- a/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm >+++ b/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm >@@ -42,11 +42,11 @@ void ArgumentCoder<WebCore::Payment>::encode(Encoder& encoder, const WebCore::Pa > encoder << payment.pkPayment(); > } > >-std::optional<WebCore::Payment> ArgumentCoder<WebCore::Payment>::decode(Decoder& decoder) >+WTF::Optional<WebCore::Payment> ArgumentCoder<WebCore::Payment>::decode(Decoder& decoder) > { > auto payment = IPC::decode<PKPayment>(decoder, PAL::getPKPaymentClass()); > if (!payment) >- return std::nullopt; >+ return WTF::nullopt; > > return Payment { WTFMove(*payment) }; > } >@@ -57,17 +57,17 @@ void ArgumentCoder<WebCore::PaymentAuthorizationResult>::encode(Encoder& encoder > encoder << result.errors; > } > >-std::optional<WebCore::PaymentAuthorizationResult> ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode(Decoder& decoder) >+WTF::Optional<WebCore::PaymentAuthorizationResult> ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode(Decoder& decoder) > { >- std::optional<PaymentAuthorizationStatus> status; >+ WTF::Optional<PaymentAuthorizationStatus> status; > decoder >> status; > if (!status) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<PaymentError>> errors; >+ WTF::Optional<Vector<PaymentError>> errors; > decoder >> errors; > if (!errors) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*status), WTFMove(*errors) }}; > } >@@ -77,11 +77,11 @@ void ArgumentCoder<WebCore::PaymentContact>::encode(Encoder& encoder, const WebC > encoder << paymentContact.pkContact(); > } > >-std::optional<WebCore::PaymentContact> ArgumentCoder<WebCore::PaymentContact>::decode(Decoder& decoder) >+WTF::Optional<WebCore::PaymentContact> ArgumentCoder<WebCore::PaymentContact>::decode(Decoder& decoder) > { > auto contact = IPC::decode<PKContact>(decoder, PAL::getPKContactClass()); > if (!contact) >- return std::nullopt; >+ return WTF::nullopt; > > return WebCore::PaymentContact { WTFMove(*contact) }; > } >@@ -93,22 +93,22 @@ void ArgumentCoder<WebCore::PaymentError>::encode(Encoder& encoder, const WebCor > encoder << error.contactField; > } > >-std::optional<WebCore::PaymentError> ArgumentCoder<WebCore::PaymentError>::decode(Decoder& decoder) >+WTF::Optional<WebCore::PaymentError> ArgumentCoder<WebCore::PaymentError>::decode(Decoder& decoder) > { >- std::optional<WebCore::PaymentError::Code> code; >+ WTF::Optional<WebCore::PaymentError::Code> code; > decoder >> code; > if (!code) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> message; >+ WTF::Optional<String> message; > decoder >> message; > if (!message) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<WebCore::PaymentError::ContactField>> contactField; >+ WTF::Optional<WTF::Optional<WebCore::PaymentError::ContactField>> contactField; > decoder >> contactField; > if (!contactField) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*code), WTFMove(*message), WTFMove(*contactField) }}; > } >@@ -118,11 +118,11 @@ void ArgumentCoder<WebCore::PaymentMerchantSession>::encode(Encoder& encoder, co > encoder << paymentMerchantSession.pkPaymentMerchantSession(); > } > >-std::optional<WebCore::PaymentMerchantSession> ArgumentCoder<WebCore::PaymentMerchantSession>::decode(Decoder& decoder) >+WTF::Optional<WebCore::PaymentMerchantSession> ArgumentCoder<WebCore::PaymentMerchantSession>::decode(Decoder& decoder) > { > auto paymentMerchantSession = IPC::decode<PKPaymentMerchantSession>(decoder, PAL::getPKPaymentMerchantSessionClass()); > if (!paymentMerchantSession) >- return std::nullopt; >+ return WTF::nullopt; > > return WebCore::PaymentMerchantSession { WTFMove(*paymentMerchantSession) }; > } >@@ -132,11 +132,11 @@ void ArgumentCoder<WebCore::PaymentMethod>::encode(Encoder& encoder, const WebCo > encoder << paymentMethod.pkPaymentMethod(); > } > >-std::optional<WebCore::PaymentMethod> ArgumentCoder<WebCore::PaymentMethod>::decode(Decoder& decoder) >+WTF::Optional<WebCore::PaymentMethod> ArgumentCoder<WebCore::PaymentMethod>::decode(Decoder& decoder) > { > auto paymentMethod = IPC::decode<PKPaymentMethod>(decoder, PAL::getPKPaymentMethodClass()); > if (!paymentMethod) >- return std::nullopt; >+ return WTF::nullopt; > > return PaymentMethod { WTFMove(*paymentMethod) }; > } >@@ -146,12 +146,12 @@ void ArgumentCoder<WebCore::PaymentMethodUpdate>::encode(Encoder& encoder, const > encoder << update.newTotalAndLineItems; > } > >-std::optional<WebCore::PaymentMethodUpdate> ArgumentCoder<WebCore::PaymentMethodUpdate>::decode(Decoder& decoder) >+WTF::Optional<WebCore::PaymentMethodUpdate> ArgumentCoder<WebCore::PaymentMethodUpdate>::decode(Decoder& decoder) > { >- std::optional<ApplePaySessionPaymentRequest::TotalAndLineItems> newTotalAndLineItems; >+ WTF::Optional<ApplePaySessionPaymentRequest::TotalAndLineItems> newTotalAndLineItems; > decoder >> newTotalAndLineItems; > if (!newTotalAndLineItems) >- return std::nullopt; >+ return WTF::nullopt; > return {{ WTFMove(*newTotalAndLineItems) }}; > } > >@@ -191,7 +191,7 @@ bool ArgumentCoder<ApplePaySessionPaymentRequest>::decode(Decoder& decoder, Appl > return false; > request.setRequiredBillingContactFields(requiredBillingContactFields); > >- std::optional<PaymentContact> billingContact; >+ WTF::Optional<PaymentContact> billingContact; > decoder >> billingContact; > if (!billingContact) > return false; >@@ -202,7 +202,7 @@ bool ArgumentCoder<ApplePaySessionPaymentRequest>::decode(Decoder& decoder, Appl > return false; > request.setRequiredShippingContactFields(requiredShippingContactFields); > >- std::optional<PaymentContact> shippingContact; >+ WTF::Optional<PaymentContact> shippingContact; > decoder >> shippingContact; > if (!shippingContact) > return false; >@@ -233,7 +233,7 @@ bool ArgumentCoder<ApplePaySessionPaymentRequest>::decode(Decoder& decoder, Appl > return false; > request.setLineItems(lineItems); > >- std::optional<ApplePaySessionPaymentRequest::LineItem> total; >+ WTF::Optional<ApplePaySessionPaymentRequest::LineItem> total; > decoder >> total; > if (!total) > return false; >@@ -289,15 +289,15 @@ void ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::encode(Encoder& enc > encoder << lineItem.amount; > } > >-std::optional<ApplePaySessionPaymentRequest::LineItem> ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode(Decoder& decoder) >+WTF::Optional<ApplePaySessionPaymentRequest::LineItem> ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode(Decoder& decoder) > { > WebCore::ApplePaySessionPaymentRequest::LineItem lineItem; > if (!decoder.decodeEnum(lineItem.type)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(lineItem.label)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(lineItem.amount)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(lineItem); > } >@@ -332,17 +332,17 @@ void ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::encode(Encode > encoder << shippingMethod.identifier; > } > >-std::optional<ApplePaySessionPaymentRequest::ShippingMethod> ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::decode(Decoder& decoder) >+WTF::Optional<ApplePaySessionPaymentRequest::ShippingMethod> ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::decode(Decoder& decoder) > { > ApplePaySessionPaymentRequest::ShippingMethod shippingMethod; > if (!decoder.decode(shippingMethod.label)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(shippingMethod.detail)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(shippingMethod.amount)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(shippingMethod.identifier)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(shippingMethod); > } > >@@ -352,17 +352,17 @@ void ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::encode(Enc > encoder << totalAndLineItems.lineItems; > } > >-std::optional<ApplePaySessionPaymentRequest::TotalAndLineItems> ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::decode(Decoder& decoder) >+WTF::Optional<ApplePaySessionPaymentRequest::TotalAndLineItems> ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::decode(Decoder& decoder) > { >- std::optional<ApplePaySessionPaymentRequest::LineItem> total; >+ WTF::Optional<ApplePaySessionPaymentRequest::LineItem> total; > decoder >> total; > if (!total) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<ApplePaySessionPaymentRequest::LineItem>> lineItems; >+ WTF::Optional<Vector<ApplePaySessionPaymentRequest::LineItem>> lineItems; > decoder >> lineItems; > if (!lineItems) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*total), WTFMove(*lineItems) }}; > } >@@ -374,22 +374,22 @@ void ArgumentCoder<WebCore::ShippingContactUpdate>::encode(Encoder& encoder, con > encoder << update.newTotalAndLineItems; > } > >-std::optional<WebCore::ShippingContactUpdate> ArgumentCoder<WebCore::ShippingContactUpdate>::decode(Decoder& decoder) >+WTF::Optional<WebCore::ShippingContactUpdate> ArgumentCoder<WebCore::ShippingContactUpdate>::decode(Decoder& decoder) > { >- std::optional<Vector<PaymentError>> errors; >+ WTF::Optional<Vector<PaymentError>> errors; > decoder >> errors; > if (!errors) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<ApplePaySessionPaymentRequest::ShippingMethod>> newShippingMethods; >+ WTF::Optional<Vector<ApplePaySessionPaymentRequest::ShippingMethod>> newShippingMethods; > decoder >> newShippingMethods; > if (!newShippingMethods) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<ApplePaySessionPaymentRequest::TotalAndLineItems> newTotalAndLineItems; >+ WTF::Optional<ApplePaySessionPaymentRequest::TotalAndLineItems> newTotalAndLineItems; > decoder >> newTotalAndLineItems; > if (!newTotalAndLineItems) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*errors), WTFMove(*newShippingMethods), WTFMove(*newTotalAndLineItems) }}; > } >@@ -399,12 +399,12 @@ void ArgumentCoder<WebCore::ShippingMethodUpdate>::encode(Encoder& encoder, cons > encoder << update.newTotalAndLineItems; > } > >-std::optional<WebCore::ShippingMethodUpdate> ArgumentCoder<WebCore::ShippingMethodUpdate>::decode(Decoder& decoder) >+WTF::Optional<WebCore::ShippingMethodUpdate> ArgumentCoder<WebCore::ShippingMethodUpdate>::decode(Decoder& decoder) > { >- std::optional<ApplePaySessionPaymentRequest::TotalAndLineItems> newTotalAndLineItems; >+ WTF::Optional<ApplePaySessionPaymentRequest::TotalAndLineItems> newTotalAndLineItems; > decoder >> newTotalAndLineItems; > if (!newTotalAndLineItems) >- return std::nullopt; >+ return WTF::nullopt; > return {{ WTFMove(*newTotalAndLineItems) }}; > } > >diff --git a/Source/WebKit/Shared/Databases/IndexedDB/WebIDBResult.cpp b/Source/WebKit/Shared/Databases/IndexedDB/WebIDBResult.cpp >index a5d5b74c59760b7b5ecdd023d1ace06c846dccd5..af181a5410e1446683ad10c828d00cbc66c2583b 100644 >--- a/Source/WebKit/Shared/Databases/IndexedDB/WebIDBResult.cpp >+++ b/Source/WebKit/Shared/Databases/IndexedDB/WebIDBResult.cpp >@@ -40,13 +40,13 @@ void WebIDBResult::encode(IPC::Encoder& encoder) const > > bool WebIDBResult::decode(IPC::Decoder& decoder, WebIDBResult& result) > { >- std::optional<WebCore::IDBResultData> resultData; >+ WTF::Optional<WebCore::IDBResultData> resultData; > decoder >> resultData; > if (!resultData) > return false; > result.m_resultData = WTFMove(*resultData); > >- std::optional<SandboxExtension::HandleArray> handles; >+ WTF::Optional<SandboxExtension::HandleArray> handles; > decoder >> handles; > if (!handles) > return false; >diff --git a/Source/WebKit/Shared/EditorState.cpp b/Source/WebKit/Shared/EditorState.cpp >index c8c8f89853e9abcc7e3f41504e01830345645e28..25a7a12cfcc0c1b867634f49493f4c5ef2bcc1bf 100644 >--- a/Source/WebKit/Shared/EditorState.cpp >+++ b/Source/WebKit/Shared/EditorState.cpp >@@ -203,7 +203,7 @@ bool EditorState::PostLayoutData::decode(IPC::Decoder& decoder, PostLayoutData& > return false; > #endif > >- std::optional<std::optional<FontAttributes>> optionalFontAttributes; >+ WTF::Optional<WTF::Optional<FontAttributes>> optionalFontAttributes; > decoder >> optionalFontAttributes; > if (!optionalFontAttributes) > return false; >diff --git a/Source/WebKit/Shared/EditorState.h b/Source/WebKit/Shared/EditorState.h >index 9e33906621ad942556fda03cce10cb2f6e41acfe..3163ab69cfc3fc3ca3baf3098cac45ca15fab04f 100644 >--- a/Source/WebKit/Shared/EditorState.h >+++ b/Source/WebKit/Shared/EditorState.h >@@ -116,7 +116,7 @@ struct EditorState { > String stringForCandidateRequest; > #endif > >- std::optional<WebCore::FontAttributes> fontAttributes; >+ WTF::Optional<WebCore::FontAttributes> fontAttributes; > > bool canCut { false }; > bool canCopy { false }; >diff --git a/Source/WebKit/Shared/FrameInfoData.cpp b/Source/WebKit/Shared/FrameInfoData.cpp >index 3c9c9b3ddbe8d5cf2a6f297a3fe9e4ff91955545..8eaaf7382b60a18e278e3cbadb30efad42e3516d 100644 >--- a/Source/WebKit/Shared/FrameInfoData.cpp >+++ b/Source/WebKit/Shared/FrameInfoData.cpp >@@ -44,7 +44,7 @@ bool FrameInfoData::decode(IPC::Decoder& decoder, FrameInfoData& result) > return false; > if (!decoder.decode(result.request)) > return false; >- std::optional<WebCore::SecurityOriginData> securityOrigin; >+ WTF::Optional<WebCore::SecurityOriginData> securityOrigin; > decoder >> securityOrigin; > if (!securityOrigin) > return false; >diff --git a/Source/WebKit/Shared/Gamepad/GamepadData.cpp b/Source/WebKit/Shared/Gamepad/GamepadData.cpp >index 905d827158349b3dcc0e005e57cd4a5cc946978f..a90a5d7e0b0453d060c6c72a05c88873f9415d9c 100644 >--- a/Source/WebKit/Shared/Gamepad/GamepadData.cpp >+++ b/Source/WebKit/Shared/Gamepad/GamepadData.cpp >@@ -59,29 +59,29 @@ void GamepadData::encode(IPC::Encoder& encoder) const > encoder << m_index << m_id << m_axisValues << m_buttonValues << m_lastUpdateTime; > } > >-std::optional<GamepadData> GamepadData::decode(IPC::Decoder& decoder) >+WTF::Optional<GamepadData> GamepadData::decode(IPC::Decoder& decoder) > { > GamepadData data; > if (!decoder.decode(data.m_isNull)) >- return std::nullopt; >+ return WTF::nullopt; > > if (data.m_isNull) > return data; > > if (!decoder.decode(data.m_index)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(data.m_id)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(data.m_axisValues)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(data.m_buttonValues)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(data.m_lastUpdateTime)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(data); > } >diff --git a/Source/WebKit/Shared/Gamepad/GamepadData.h b/Source/WebKit/Shared/Gamepad/GamepadData.h >index e80e04b808a7735236ef207b4701cbb56d11f51f..a4613b4d7a3eba24dade914de89f3d02ea0019e3 100644 >--- a/Source/WebKit/Shared/Gamepad/GamepadData.h >+++ b/Source/WebKit/Shared/Gamepad/GamepadData.h >@@ -49,7 +49,7 @@ public: > GamepadData(unsigned index, const String& id, const Vector<double>& axisValues, const Vector<double>& buttonValues, MonotonicTime lastUpdateTime); > > void encode(IPC::Encoder&) const; >- static std::optional<GamepadData> decode(IPC::Decoder&); >+ static WTF::Optional<GamepadData> decode(IPC::Decoder&); > > bool isNull() const { return m_isNull; } > >diff --git a/Source/WebKit/Shared/LoadParameters.cpp b/Source/WebKit/Shared/LoadParameters.cpp >index 46249e791245fe6990a9570477615e9cedb2fc28..4a91137095af2f256227b3abd5b73f438da706a5 100644 >--- a/Source/WebKit/Shared/LoadParameters.cpp >+++ b/Source/WebKit/Shared/LoadParameters.cpp >@@ -74,7 +74,7 @@ bool LoadParameters::decode(IPC::Decoder& decoder, LoadParameters& data) > > if (hasHTTPBody) { > // FormDataReference encoder / decoder takes care of passing and consuming the needed sandbox extensions. >- std::optional<IPC::FormDataReference> formDataReference; >+ WTF::Optional<IPC::FormDataReference> formDataReference; > decoder >> formDataReference; > if (!formDataReference) > return false; >@@ -82,7 +82,7 @@ bool LoadParameters::decode(IPC::Decoder& decoder, LoadParameters& data) > data.request.setHTTPBody(formDataReference->takeData()); > } > >- std::optional<SandboxExtension::Handle> sandboxExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> sandboxExtensionHandle; > decoder >> sandboxExtensionHandle; > if (!sandboxExtensionHandle) > return false; >@@ -106,7 +106,7 @@ bool LoadParameters::decode(IPC::Decoder& decoder, LoadParameters& data) > if (!decoder.decode(data.provisionalLoadErrorURLString)) > return false; > >- std::optional<std::optional<WebsitePoliciesData>> websitePolicies; >+ WTF::Optional<WTF::Optional<WebsitePoliciesData>> websitePolicies; > decoder >> websitePolicies; > if (!websitePolicies) > return false; >@@ -127,7 +127,7 @@ bool LoadParameters::decode(IPC::Decoder& decoder, LoadParameters& data) > if (!decoder.decodeEnum(data.lockBackForwardList)) > return false; > >- std::optional<String> clientRedirectSourceForHistory; >+ WTF::Optional<String> clientRedirectSourceForHistory; > decoder >> clientRedirectSourceForHistory; > if (!clientRedirectSourceForHistory) > return false; >diff --git a/Source/WebKit/Shared/LoadParameters.h b/Source/WebKit/Shared/LoadParameters.h >index eef1a610040a6ae5d2dd2d4a199264067064516c..5b3922df589f72f8b1b20457f2ba17f45f5462ce 100644 >--- a/Source/WebKit/Shared/LoadParameters.h >+++ b/Source/WebKit/Shared/LoadParameters.h >@@ -61,7 +61,7 @@ struct LoadParameters { > String unreachableURLString; > String provisionalLoadErrorURLString; > >- std::optional<WebsitePoliciesData> websitePolicies; >+ WTF::Optional<WebsitePoliciesData> websitePolicies; > > uint64_t shouldOpenExternalURLsPolicy; > bool shouldTreatAsContinuingLoad { false }; >diff --git a/Source/WebKit/Shared/NavigationActionData.cpp b/Source/WebKit/Shared/NavigationActionData.cpp >index 672059e45a6c7516951e6bb63eb924e4b4fbdc37..a7ce5cd1b7f4228840b808ce76e8e8bc7aa2726f 100644 >--- a/Source/WebKit/Shared/NavigationActionData.cpp >+++ b/Source/WebKit/Shared/NavigationActionData.cpp >@@ -55,89 +55,89 @@ void NavigationActionData::encode(IPC::Encoder& encoder) const > encoder << clientRedirectSourceForHistory; > } > >-std::optional<NavigationActionData> NavigationActionData::decode(IPC::Decoder& decoder) >+WTF::Optional<NavigationActionData> NavigationActionData::decode(IPC::Decoder& decoder) > { > WebCore::NavigationType navigationType; > if (!decoder.decodeEnum(navigationType)) >- return std::nullopt; >+ return WTF::nullopt; > > WebEvent::Modifiers modifiers; > if (!decoder.decodeEnum(modifiers)) >- return std::nullopt; >+ return WTF::nullopt; > > WebMouseEvent::Button mouseButton; > if (!decoder.decodeEnum(mouseButton)) >- return std::nullopt; >+ return WTF::nullopt; > > WebMouseEvent::SyntheticClickType syntheticClickType; > if (!decoder.decodeEnum(syntheticClickType)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> userGestureTokenIdentifier; >+ WTF::Optional<uint64_t> userGestureTokenIdentifier; > decoder >> userGestureTokenIdentifier; > if (!userGestureTokenIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> canHandleRequest; >+ WTF::Optional<bool> canHandleRequest; > decoder >> canHandleRequest; > if (!canHandleRequest) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy; > if (!decoder.decodeEnum(shouldOpenExternalURLsPolicy)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> downloadAttribute; >+ WTF::Optional<String> downloadAttribute; > decoder >> downloadAttribute; > if (!downloadAttribute) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::FloatPoint clickLocationInRootViewCoordinates; > if (!decoder.decode(clickLocationInRootViewCoordinates)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> isRedirect; >+ WTF::Optional<bool> isRedirect; > decoder >> isRedirect; > if (!isRedirect) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> treatAsSameOriginNavigation; >+ WTF::Optional<bool> treatAsSameOriginNavigation; > decoder >> treatAsSameOriginNavigation; > if (!treatAsSameOriginNavigation) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> hasOpenedFrames; >+ WTF::Optional<bool> hasOpenedFrames; > decoder >> hasOpenedFrames; > if (!hasOpenedFrames) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> openedByDOMWithOpener; >+ WTF::Optional<bool> openedByDOMWithOpener; > decoder >> openedByDOMWithOpener; > if (!openedByDOMWithOpener) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WebCore::SecurityOriginData> requesterOrigin; >+ WTF::Optional<WebCore::SecurityOriginData> requesterOrigin; > decoder >> requesterOrigin; > if (!requesterOrigin) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<WebCore::BackForwardItemIdentifier>> targetBackForwardItemIdentifier; >+ WTF::Optional<WTF::Optional<WebCore::BackForwardItemIdentifier>> targetBackForwardItemIdentifier; > decoder >> targetBackForwardItemIdentifier; > if (!targetBackForwardItemIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::LockHistory lockHistory; > if (!decoder.decodeEnum(lockHistory)) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::LockBackForwardList lockBackForwardList; > if (!decoder.decodeEnum(lockBackForwardList)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> clientRedirectSourceForHistory; >+ WTF::Optional<String> clientRedirectSourceForHistory; > decoder >> clientRedirectSourceForHistory; > if (!clientRedirectSourceForHistory) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(navigationType), WTFMove(modifiers), WTFMove(mouseButton), WTFMove(syntheticClickType), WTFMove(*userGestureTokenIdentifier), > WTFMove(*canHandleRequest), WTFMove(shouldOpenExternalURLsPolicy), WTFMove(*downloadAttribute), WTFMove(clickLocationInRootViewCoordinates), >diff --git a/Source/WebKit/Shared/NavigationActionData.h b/Source/WebKit/Shared/NavigationActionData.h >index 1285586471fe41e31bfb79b0813d1c6994d89d9f..6e77c0b6548c4f1b292f8816c89ebb7798721875 100644 >--- a/Source/WebKit/Shared/NavigationActionData.h >+++ b/Source/WebKit/Shared/NavigationActionData.h >@@ -40,7 +40,7 @@ namespace WebKit { > > struct NavigationActionData { > void encode(IPC::Encoder&) const; >- static std::optional<NavigationActionData> decode(IPC::Decoder&); >+ static WTF::Optional<NavigationActionData> decode(IPC::Decoder&); > > WebCore::NavigationType navigationType { WebCore::NavigationType::Other }; > WebEvent::Modifiers modifiers { }; >@@ -56,7 +56,7 @@ struct NavigationActionData { > bool hasOpenedFrames { false }; > bool openedByDOMWithOpener { false }; > WebCore::SecurityOriginData requesterOrigin; >- std::optional<WebCore::BackForwardItemIdentifier> targetBackForwardItemIdentifier; >+ WTF::Optional<WebCore::BackForwardItemIdentifier> targetBackForwardItemIdentifier; > WebCore::LockHistory lockHistory; > WebCore::LockBackForwardList lockBackForwardList; > WTF::String clientRedirectSourceForHistory; >diff --git a/Source/WebKit/Shared/PlatformPopupMenuData.cpp b/Source/WebKit/Shared/PlatformPopupMenuData.cpp >index b948819e6f0e6495eee0e710d9b5b57e767fb26c..d039b7f4545ac2d77c033d935931d91cfe2f9ba1 100644 >--- a/Source/WebKit/Shared/PlatformPopupMenuData.cpp >+++ b/Source/WebKit/Shared/PlatformPopupMenuData.cpp >@@ -99,11 +99,11 @@ bool PlatformPopupMenuData::decode(IPC::Decoder& decoder, PlatformPopupMenuData& > return true; > } > >-std::optional<PlatformPopupMenuData> PlatformPopupMenuData::decode(IPC::Decoder& decoder) >+WTF::Optional<PlatformPopupMenuData> PlatformPopupMenuData::decode(IPC::Decoder& decoder) > { > PlatformPopupMenuData data; > if (!decode(decoder, data)) >- return std::nullopt; >+ return WTF::nullopt; > return data; > } > >diff --git a/Source/WebKit/Shared/PlatformPopupMenuData.h b/Source/WebKit/Shared/PlatformPopupMenuData.h >index 59949870ecc423cc998c16e3a8e75918e3b80d04..c74ecf01df3c4ee702a5abfe40fad50db5481383 100644 >--- a/Source/WebKit/Shared/PlatformPopupMenuData.h >+++ b/Source/WebKit/Shared/PlatformPopupMenuData.h >@@ -42,7 +42,7 @@ struct PlatformPopupMenuData { > > void encode(IPC::Encoder&) const; > static bool decode(IPC::Decoder&, PlatformPopupMenuData&); >- static std::optional<PlatformPopupMenuData> decode(IPC::Decoder&); >+ static WTF::Optional<PlatformPopupMenuData> decode(IPC::Decoder&); > > #if PLATFORM(COCOA) > FontInfo fontInfo; >diff --git a/Source/WebKit/Shared/Plugins/NPIdentifierData.cpp b/Source/WebKit/Shared/Plugins/NPIdentifierData.cpp >index 925171e9c754f4fce5ae3aad971187cca640d581..1625f792ccf98cbb405c13ff2a2e95635526f573 100644 >--- a/Source/WebKit/Shared/Plugins/NPIdentifierData.cpp >+++ b/Source/WebKit/Shared/Plugins/NPIdentifierData.cpp >@@ -75,20 +75,20 @@ void NPIdentifierData::encode(IPC::Encoder& encoder) const > encoder << m_number; > } > >-std::optional<NPIdentifierData> NPIdentifierData::decode(IPC::Decoder& decoder) >+WTF::Optional<NPIdentifierData> NPIdentifierData::decode(IPC::Decoder& decoder) > { > NPIdentifierData result; > if (!decoder.decode(result.m_isString)) >- return std::nullopt; >+ return WTF::nullopt; > > if (result.m_isString) { > if (!decoder.decode(result.m_string)) >- return std::nullopt; >+ return WTF::nullopt; > return result; > } > > if (!decoder.decode(result.m_number)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > } > >diff --git a/Source/WebKit/Shared/Plugins/NPIdentifierData.h b/Source/WebKit/Shared/Plugins/NPIdentifierData.h >index c4aa24f11016fa16ce19ce54380c4d79444faf92..36a56b850d7339e7aeef1ba86cc31970f5984102 100644 >--- a/Source/WebKit/Shared/Plugins/NPIdentifierData.h >+++ b/Source/WebKit/Shared/Plugins/NPIdentifierData.h >@@ -45,7 +45,7 @@ public: > NPIdentifier createNPIdentifier() const; > > void encode(IPC::Encoder&) const; >- static std::optional<NPIdentifierData> decode(IPC::Decoder&); >+ static WTF::Optional<NPIdentifierData> decode(IPC::Decoder&); > > private: > bool m_isString; >diff --git a/Source/WebKit/Shared/Plugins/NPVariantData.cpp b/Source/WebKit/Shared/Plugins/NPVariantData.cpp >index 07dddbc611f45af6028df1ddfabebe3085150cf2..47766d73046ff7b710354b5347c38a427a6e5ddf 100644 >--- a/Source/WebKit/Shared/Plugins/NPVariantData.cpp >+++ b/Source/WebKit/Shared/Plugins/NPVariantData.cpp >@@ -147,12 +147,12 @@ void NPVariantData::encode(IPC::Encoder& encoder) const > } > } > >-std::optional<NPVariantData> NPVariantData::decode(IPC::Decoder& decoder) >+WTF::Optional<NPVariantData> NPVariantData::decode(IPC::Decoder& decoder) > { > NPVariantData result; > uint32_t type; > if (!decoder.decode(type)) >- return std::nullopt; >+ return WTF::nullopt; > > // We special-case LocalNPObjectID and RemoteNPObjectID here so a LocalNPObjectID is > // decoded as a RemoteNPObjectID and vice versa. >@@ -171,31 +171,31 @@ std::optional<NPVariantData> NPVariantData::decode(IPC::Decoder& decoder) > return WTFMove(result); > case NPVariantData::Bool: > if (!decoder.decode(result.m_boolValue)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > case NPVariantData::Int32: > if (!decoder.decode(result.m_int32Value)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > case NPVariantData::Double: > if (!decoder.decode(result.m_doubleValue)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > case NPVariantData::String: > if (!decoder.decode(result.m_stringValue)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > case NPVariantData::LocalNPObjectID: > if (!decoder.decode(result.m_localNPObjectIDValue)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > case NPVariantData::RemoteNPObjectID: > if (!decoder.decode(result.m_remoteNPObjectIDValue)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(result); > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > } // namespace WebKit >diff --git a/Source/WebKit/Shared/Plugins/NPVariantData.h b/Source/WebKit/Shared/Plugins/NPVariantData.h >index c58e2d504bad9b746d6374257905cce38fb73bfc..1e78a1a29c9a0737d781c1ae8fbe893636fa0891 100644 >--- a/Source/WebKit/Shared/Plugins/NPVariantData.h >+++ b/Source/WebKit/Shared/Plugins/NPVariantData.h >@@ -98,7 +98,7 @@ public: > } > > void encode(IPC::Encoder&) const; >- static std::optional<NPVariantData> decode(IPC::Decoder&); >+ static WTF::Optional<NPVariantData> decode(IPC::Decoder&); > > private: > uint32_t m_type; >diff --git a/Source/WebKit/Shared/RTCNetwork.cpp b/Source/WebKit/Shared/RTCNetwork.cpp >index 09096ab3f1e996c33cbe4fbe51ca901ed899c340..d6b0d21612f6b0ccefb84e12c626809e8e752226 100644 >--- a/Source/WebKit/Shared/RTCNetwork.cpp >+++ b/Source/WebKit/Shared/RTCNetwork.cpp >@@ -60,12 +60,12 @@ rtc::Network RTCNetwork::value() const > return network; > } > >-auto RTCNetwork::IPAddress::decode(IPC::Decoder& decoder) -> std::optional<IPAddress> >+auto RTCNetwork::IPAddress::decode(IPC::Decoder& decoder) -> WTF::Optional<IPAddress> > { > IPAddress result; > int family; > if (!decoder.decode(family)) >- return std::nullopt; >+ return WTF::nullopt; > > ASSERT(family == AF_INET || family == AF_INET6 || family == AF_UNSPEC); > >@@ -74,17 +74,17 @@ auto RTCNetwork::IPAddress::decode(IPC::Decoder& decoder) -> std::optional<IPAdd > > IPC::DataReference data; > if (!decoder.decode(data)) >- return std::nullopt; >+ return WTF::nullopt; > > if (family == AF_INET) { > if (data.size() != sizeof(in_addr)) >- return std::nullopt; >+ return WTF::nullopt; > result.value = rtc::IPAddress(*reinterpret_cast<const in_addr*>(data.data())); > return WTFMove(result); > } > > if (data.size() != sizeof(in6_addr)) >- return std::nullopt; >+ return WTF::nullopt; > result.value = rtc::IPAddress(*reinterpret_cast<const in6_addr*>(data.data())); > return WTFMove(result); > } >@@ -119,33 +119,33 @@ rtc::SocketAddress RTCNetwork::isolatedCopy(const rtc::SocketAddress& value) > return rtc::SocketAddress(copy); > } > >-auto RTCNetwork::SocketAddress::decode(IPC::Decoder& decoder) -> std::optional<SocketAddress> >+auto RTCNetwork::SocketAddress::decode(IPC::Decoder& decoder) -> WTF::Optional<SocketAddress> > { > SocketAddress result; > uint16_t port; > if (!decoder.decode(port)) >- return std::nullopt; >+ return WTF::nullopt; > int scopeId; > if (!decoder.decode(scopeId)) >- return std::nullopt; >+ return WTF::nullopt; > result.value.SetPort(port); > result.value.SetScopeID(scopeId); > > IPC::DataReference hostname; > if (!decoder.decode(hostname)) >- return std::nullopt; >+ return WTF::nullopt; > result.value.SetIP(std::string(reinterpret_cast<const char*>(hostname.data()), hostname.size())); > > bool isUnresolved; > if (!decoder.decode(isUnresolved)) >- return std::nullopt; >+ return WTF::nullopt; > if (isUnresolved) > return result; > >- std::optional<IPAddress> ipAddress; >+ WTF::Optional<IPAddress> ipAddress; > decoder >> ipAddress; > if (!ipAddress) >- return std::nullopt; >+ return WTF::nullopt; > result.value.SetResolvedIP(ipAddress->value); > return result; > } >@@ -166,48 +166,48 @@ void RTCNetwork::SocketAddress::encode(IPC::Encoder& encoder) const > encoder << RTCNetwork::IPAddress(value.ipaddr()); > } > >-std::optional<RTCNetwork> RTCNetwork::decode(IPC::Decoder& decoder) >+WTF::Optional<RTCNetwork> RTCNetwork::decode(IPC::Decoder& decoder) > { > RTCNetwork result; > IPC::DataReference name, description; > if (!decoder.decode(name)) >- return std::nullopt; >+ return WTF::nullopt; > result.name = std::string(reinterpret_cast<const char*>(name.data()), name.size()); > if (!decoder.decode(description)) >- return std::nullopt; >+ return WTF::nullopt; > result.description = std::string(reinterpret_cast<const char*>(description.data()), description.size()); >- std::optional<IPAddress> prefix; >+ WTF::Optional<IPAddress> prefix; > decoder >> prefix; > if (!prefix) >- return std::nullopt; >+ return WTF::nullopt; > result.prefix = WTFMove(*prefix); > if (!decoder.decode(result.prefixLength)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.type)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.id)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.preference)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.active)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.ignored)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.scopeID)) >- return std::nullopt; >+ return WTF::nullopt; > > uint64_t length; > if (!decoder.decode(length)) >- return std::nullopt; >+ return WTF::nullopt; > result.ips.reserve(length); > for (size_t index = 0; index < length; ++index) { >- std::optional<IPAddress> address; >+ WTF::Optional<IPAddress> address; > decoder >> address; > if (!address) >- return std::nullopt; >+ return WTF::nullopt; > int flags; > if (!decoder.decode(flags)) >- return std::nullopt; >+ return WTF::nullopt; > result.ips.push_back({ address->value, flags }); > } > return result; >diff --git a/Source/WebKit/Shared/RTCNetwork.h b/Source/WebKit/Shared/RTCNetwork.h >index eca1dfd8163bfb66ebb022ecb670aed390f40339..1f8d5e1f1320fe25ed5dcef39bf4df184550fe96 100644 >--- a/Source/WebKit/Shared/RTCNetwork.h >+++ b/Source/WebKit/Shared/RTCNetwork.h >@@ -45,14 +45,14 @@ struct RTCNetwork { > rtc::Network value() const; > > void encode(IPC::Encoder&) const; >- static std::optional<RTCNetwork> decode(IPC::Decoder&); >+ static WTF::Optional<RTCNetwork> decode(IPC::Decoder&); > > struct IPAddress { > IPAddress() = default; > explicit IPAddress(const rtc::IPAddress& address): value(address) { } > > void encode(IPC::Encoder&) const; >- static std::optional<IPAddress> decode(IPC::Decoder&); >+ static WTF::Optional<IPAddress> decode(IPC::Decoder&); > > rtc::IPAddress value; > }; >@@ -64,7 +64,7 @@ struct RTCNetwork { > explicit SocketAddress(const rtc::SocketAddress& address): value(address) { } > > void encode(IPC::Encoder&) const; >- static std::optional<SocketAddress> decode(IPC::Decoder&); >+ static WTF::Optional<SocketAddress> decode(IPC::Decoder&); > > rtc::SocketAddress value; > }; >diff --git a/Source/WebKit/Shared/RTCPacketOptions.cpp b/Source/WebKit/Shared/RTCPacketOptions.cpp >index 938b69e7cb4b6eefce60d2dcec52d9c98295fdec..6b1225a1961236522d78cfa0ac83b9ff93d00323 100644 >--- a/Source/WebKit/Shared/RTCPacketOptions.cpp >+++ b/Source/WebKit/Shared/RTCPacketOptions.cpp >@@ -46,47 +46,47 @@ void RTCPacketOptions::encode(IPC::Encoder& encoder) const > encoder << options.packet_time_params.srtp_packet_index; > } > >-std::optional<RTCPacketOptions> RTCPacketOptions::decode(IPC::Decoder& decoder) >+WTF::Optional<RTCPacketOptions> RTCPacketOptions::decode(IPC::Decoder& decoder) > { > rtc::PacketTimeUpdateParams params; > rtc::PacketOptions options; > > rtc::DiffServCodePoint dscp; > if (!decoder.decodeEnum(dscp)) >- return std::nullopt; >+ return WTF::nullopt; > options.dscp = dscp; > >- std::optional<int32_t> packetId; >+ WTF::Optional<int32_t> packetId; > decoder >> packetId; > if (!packetId) >- return std::nullopt; >+ return WTF::nullopt; > options.packet_id = packetId.value(); > >- std::optional<int> rtpSendtimeExtensionId; >+ WTF::Optional<int> rtpSendtimeExtensionId; > decoder >> rtpSendtimeExtensionId; > if (!rtpSendtimeExtensionId) >- return std::nullopt; >+ return WTF::nullopt; > params.rtp_sendtime_extension_id = rtpSendtimeExtensionId.value(); > >- std::optional<int64_t> srtpAuthTagLength; >+ WTF::Optional<int64_t> srtpAuthTagLength; > decoder >> srtpAuthTagLength; > if (!srtpAuthTagLength) >- return std::nullopt; >+ return WTF::nullopt; > params.srtp_auth_tag_len = srtpAuthTagLength.value(); > > if (params.srtp_auth_tag_len > 0) { > IPC::DataReference srtpAuthKey; > if (!decoder.decode(srtpAuthKey)) >- return std::nullopt; >+ return WTF::nullopt; > > params.srtp_auth_key = std::vector<char>(static_cast<size_t>(srtpAuthKey.size())); > memcpy(params.srtp_auth_key.data(), reinterpret_cast<const char*>(srtpAuthKey.data()), srtpAuthKey.size() * sizeof(char)); > } > >- std::optional<int64_t> srtpPacketIndex; >+ WTF::Optional<int64_t> srtpPacketIndex; > decoder >> srtpPacketIndex; > if (!srtpPacketIndex) >- return std::nullopt; >+ return WTF::nullopt; > params.srtp_packet_index = srtpPacketIndex.value(); > > options.packet_time_params = WTFMove(params); >diff --git a/Source/WebKit/Shared/RTCPacketOptions.h b/Source/WebKit/Shared/RTCPacketOptions.h >index 82b921b548aba2815e6bfb63fb1b0619323d643c..3098b9008f9e052d846cd50f79dc6128cfbd200a 100644 >--- a/Source/WebKit/Shared/RTCPacketOptions.h >+++ b/Source/WebKit/Shared/RTCPacketOptions.h >@@ -40,7 +40,7 @@ namespace WebKit { > > struct RTCPacketOptions { > void encode(IPC::Encoder&) const; >- static std::optional<RTCPacketOptions> decode(IPC::Decoder&); >+ static WTF::Optional<RTCPacketOptions> decode(IPC::Decoder&); > > rtc::PacketOptions options; > }; >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h >index 757f70afdf71d81824648de64540bd2429c058fa..9fbea822a53b2a62e96efcf76b06a837c2c476ff 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h >@@ -98,7 +98,7 @@ public: > LayerCreationProperties(); > > void encode(IPC::Encoder&) const; >- static std::optional<LayerCreationProperties> decode(IPC::Decoder&); >+ static WTF::Optional<LayerCreationProperties> decode(IPC::Decoder&); > > WebCore::GraphicsLayer::PlatformLayerID layerID; > WebCore::PlatformCALayer::LayerType type; >@@ -274,7 +274,7 @@ public: > const EditorState& editorState() const { return m_editorState.value(); } > void setEditorState(const EditorState& editorState) { m_editorState = editorState; } > >- std::optional<DynamicViewportSizeUpdateID> dynamicViewportSizeUpdateID() const { return m_dynamicViewportSizeUpdateID; } >+ WTF::Optional<DynamicViewportSizeUpdateID> dynamicViewportSizeUpdateID() const { return m_dynamicViewportSizeUpdateID; } > void setDynamicViewportSizeUpdateID(DynamicViewportSizeUpdateID resizeID) { m_dynamicViewportSizeUpdateID = resizeID; } > > private: >@@ -312,8 +312,8 @@ private: > bool m_viewportMetaTagCameFromImageDocument { false }; > bool m_isInStableState { false }; > >- std::optional<EditorState> m_editorState; >- std::optional<DynamicViewportSizeUpdateID> m_dynamicViewportSizeUpdateID; >+ WTF::Optional<EditorState> m_editorState; >+ WTF::Optional<DynamicViewportSizeUpdateID> m_dynamicViewportSizeUpdateID; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >index c1e18c4f21c21e3ad4dc123f219ad989502d4f67..15673eac53fe13446e10e4946468cbce5d7bd56a 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >@@ -56,23 +56,23 @@ void RemoteLayerTreeTransaction::LayerCreationProperties::encode(IPC::Encoder& e > encoder << hostingDeviceScaleFactor; > } > >-auto RemoteLayerTreeTransaction::LayerCreationProperties::decode(IPC::Decoder& decoder) -> std::optional<LayerCreationProperties> >+auto RemoteLayerTreeTransaction::LayerCreationProperties::decode(IPC::Decoder& decoder) -> WTF::Optional<LayerCreationProperties> > { > LayerCreationProperties result; > if (!decoder.decode(result.layerID)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(result.type)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.embeddedViewID)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.hostingContextID)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.hostingDeviceScaleFactor)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >@@ -678,7 +678,7 @@ bool RemoteLayerTreeTransaction::decode(IPC::Decoder& decoder, RemoteLayerTreeTr > if (!decoder.decode(result.m_isInStableState)) > return false; > >- std::optional<Vector<TransactionCallbackID>> callbackIDs; >+ WTF::Optional<Vector<TransactionCallbackID>> callbackIDs; > decoder >> callbackIDs; > if (!callbackIDs) > return false; >diff --git a/Source/WebKit/Shared/SandboxExtension.h b/Source/WebKit/Shared/SandboxExtension.h >index 116b9c83be90fd924a72015ce954d3d817b8f0f7..806ebf6eedb189ee8dffa23acedfc702edffaf41 100644 >--- a/Source/WebKit/Shared/SandboxExtension.h >+++ b/Source/WebKit/Shared/SandboxExtension.h >@@ -63,7 +63,7 @@ public: > ~Handle(); > > void encode(IPC::Encoder&) const; >- static std::optional<Handle> decode(IPC::Decoder&); >+ static WTF::Optional<Handle> decode(IPC::Decoder&); > > private: > friend class SandboxExtension; >@@ -85,7 +85,7 @@ public: > const Handle& operator[](size_t i) const; > size_t size() const; > void encode(IPC::Encoder&) const; >- static std::optional<HandleArray> decode(IPC::Decoder&); >+ static WTF::Optional<HandleArray> decode(IPC::Decoder&); > > private: > #if ENABLE(SANDBOX_EXTENSIONS) >@@ -122,7 +122,7 @@ private: > inline SandboxExtension::Handle::Handle() { } > inline SandboxExtension::Handle::~Handle() { } > inline void SandboxExtension::Handle::encode(IPC::Encoder&) const { } >-inline std::optional<SandboxExtension::Handle> SandboxExtension::Handle::decode(IPC::Decoder&) { return SandboxExtension::Handle { }; } >+inline WTF::Optional<SandboxExtension::Handle> SandboxExtension::Handle::decode(IPC::Decoder&) { return SandboxExtension::Handle { }; } > inline SandboxExtension::HandleArray::HandleArray() { } > inline SandboxExtension::HandleArray::~HandleArray() { } > inline void SandboxExtension::HandleArray::allocate(size_t) { } >@@ -130,7 +130,7 @@ inline size_t SandboxExtension::HandleArray::size() const { return 0; } > inline const SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) const { return m_emptyHandle; } > inline SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) { return m_emptyHandle; } > inline void SandboxExtension::HandleArray::encode(IPC::Encoder&) const { } >-inline auto SandboxExtension::HandleArray::decode(IPC::Decoder&) -> std::optional<HandleArray> { return {{ }}; } >+inline auto SandboxExtension::HandleArray::decode(IPC::Decoder&) -> WTF::Optional<HandleArray> { return {{ }}; } > inline RefPtr<SandboxExtension> SandboxExtension::create(Handle&&) { return nullptr; } > inline bool SandboxExtension::createHandle(const String&, Type, Handle&) { return true; } > inline bool SandboxExtension::createHandleWithoutResolvingPath(const String&, Type, Handle&) { return true; } >diff --git a/Source/WebKit/Shared/SessionState.cpp b/Source/WebKit/Shared/SessionState.cpp >index c2c2a3a2ab212c1c3bd57798b98dfa83b868ca65..718760d052f8057f12f0e3fade13443bcb228933 100644 >--- a/Source/WebKit/Shared/SessionState.cpp >+++ b/Source/WebKit/Shared/SessionState.cpp >@@ -66,23 +66,23 @@ static bool isValidEnum(HTTPBody::Element::Type type) > return false; > } > >-auto HTTPBody::Element::decode(IPC::Decoder& decoder) -> std::optional<Element> >+auto HTTPBody::Element::decode(IPC::Decoder& decoder) -> WTF::Optional<Element> > { > Element result; > if (!decoder.decodeEnum(result.type) || !isValidEnum(result.type)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.data)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.filePath)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.fileStart)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.fileLength)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.expectedFileModificationTime)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.blobURLString)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >@@ -133,53 +133,53 @@ void FrameState::encode(IPC::Encoder& encoder) const > encoder << children; > } > >-std::optional<FrameState> FrameState::decode(IPC::Decoder& decoder) >+WTF::Optional<FrameState> FrameState::decode(IPC::Decoder& decoder) > { > FrameState result; > if (!decoder.decode(result.urlString)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.originalURLString)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.referrer)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.target)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.documentState)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.stateObjectData)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.documentSequenceNumber)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.itemSequenceNumber)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.scrollPosition)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.shouldRestoreScrollPosition)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.pageScaleFactor)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.httpBody)) >- return std::nullopt; >+ return WTF::nullopt; > > #if PLATFORM(IOS_FAMILY) > if (!decoder.decode(result.exposedContentRect)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.unobscuredContentRect)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.minimumLayoutSizeInScrollViewCoordinates)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.contentSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.scaleIsInitial)) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > if (!decoder.decode(result.children)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >@@ -198,7 +198,7 @@ bool PageState::decode(IPC::Decoder& decoder, PageState& result) > { > if (!decoder.decode(result.title)) > return false; >- std::optional<FrameState> mainFrameState; >+ WTF::Optional<FrameState> mainFrameState; > decoder >> mainFrameState; > if (!mainFrameState) > return false; >@@ -228,17 +228,17 @@ void BackForwardListItemState::encode(IPC::Encoder& encoder) const > encoder << pageState; > } > >-std::optional<BackForwardListItemState> BackForwardListItemState::decode(IPC::Decoder& decoder) >+WTF::Optional<BackForwardListItemState> BackForwardListItemState::decode(IPC::Decoder& decoder) > { > BackForwardListItemState result; > > auto identifier = BackForwardItemIdentifier::decode(decoder); > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > result.identifier = *identifier; > > if (!decoder.decode(result.pageState)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >@@ -249,16 +249,16 @@ void BackForwardListState::encode(IPC::Encoder& encoder) const > encoder << currentIndex; > } > >-std::optional<BackForwardListState> BackForwardListState::decode(IPC::Decoder& decoder) >+WTF::Optional<BackForwardListState> BackForwardListState::decode(IPC::Decoder& decoder) > { >- std::optional<Vector<BackForwardListItemState>> items; >+ WTF::Optional<Vector<BackForwardListItemState>> items; > decoder >> items; > if (!items) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint32_t> currentIndex; >+ WTF::Optional<uint32_t> currentIndex; > if (!decoder.decode(currentIndex)) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*items), WTFMove(currentIndex) }}; > } >diff --git a/Source/WebKit/Shared/SessionState.h b/Source/WebKit/Shared/SessionState.h >index 92afdc598a2b37f91197adf897c61cf594165c3b..0346ab9893fbe3d3655eae6029813ca590054651 100644 >--- a/Source/WebKit/Shared/SessionState.h >+++ b/Source/WebKit/Shared/SessionState.h >@@ -51,7 +51,7 @@ bool isValidEnum(WebCore::ShouldOpenExternalURLsPolicy); > struct HTTPBody { > struct Element { > void encode(IPC::Encoder&) const; >- static std::optional<Element> decode(IPC::Decoder&); >+ static WTF::Optional<Element> decode(IPC::Decoder&); > > enum class Type { > Data, >@@ -68,8 +68,8 @@ struct HTTPBody { > // File. > String filePath; > int64_t fileStart; >- std::optional<int64_t> fileLength; >- std::optional<WallTime> expectedFileModificationTime; >+ WTF::Optional<int64_t> fileLength; >+ WTF::Optional<WallTime> expectedFileModificationTime; > > // Blob. > String blobURLString; >@@ -84,7 +84,7 @@ struct HTTPBody { > > struct FrameState { > void encode(IPC::Encoder&) const; >- static std::optional<FrameState> decode(IPC::Decoder&); >+ static WTF::Optional<FrameState> decode(IPC::Decoder&); > > String urlString; > String originalURLString; >@@ -92,7 +92,7 @@ struct FrameState { > String target; > > Vector<String> documentState; >- std::optional<Vector<uint8_t>> stateObjectData; >+ WTF::Optional<Vector<uint8_t>> stateObjectData; > > int64_t documentSequenceNumber { 0 }; > int64_t itemSequenceNumber { 0 }; >@@ -101,7 +101,7 @@ struct FrameState { > bool shouldRestoreScrollPosition { true }; > float pageScaleFactor { 0 }; > >- std::optional<HTTPBody> httpBody; >+ WTF::Optional<HTTPBody> httpBody; > > // FIXME: These should not be per frame. > #if PLATFORM(IOS_FAMILY) >@@ -127,7 +127,7 @@ struct PageState { > > struct BackForwardListItemState { > void encode(IPC::Encoder&) const; >- static std::optional<BackForwardListItemState> decode(IPC::Decoder&); >+ static WTF::Optional<BackForwardListItemState> decode(IPC::Decoder&); > > WebCore::BackForwardItemIdentifier identifier; > >@@ -139,10 +139,10 @@ struct BackForwardListItemState { > > struct BackForwardListState { > void encode(IPC::Encoder&) const; >- static std::optional<BackForwardListState> decode(IPC::Decoder&); >+ static WTF::Optional<BackForwardListState> decode(IPC::Decoder&); > > Vector<BackForwardListItemState> items; >- std::optional<uint32_t> currentIndex; >+ WTF::Optional<uint32_t> currentIndex; > }; > > struct SessionState { >diff --git a/Source/WebKit/Shared/TouchBarMenuItemData.cpp b/Source/WebKit/Shared/TouchBarMenuItemData.cpp >index 3cdee82d0adf3435c8ed9cfcd7dbd4639f810180..dec56a362c5eb3c7d6de55227fe26488586c75b5 100644 >--- a/Source/WebKit/Shared/TouchBarMenuItemData.cpp >+++ b/Source/WebKit/Shared/TouchBarMenuItemData.cpp >@@ -53,19 +53,19 @@ void TouchBarMenuItemData::encode(IPC::Encoder& encoder) const > encoder << priority; > } > >-std::optional<TouchBarMenuItemData> TouchBarMenuItemData::decode(IPC::Decoder& decoder) >+WTF::Optional<TouchBarMenuItemData> TouchBarMenuItemData::decode(IPC::Decoder& decoder) > { > TouchBarMenuItemData result; > if (!decoder.decodeEnum(result.type)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.identifier)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.priority)) >- return std::nullopt; >+ return WTF::nullopt; > >- return std::make_optional(WTFMove(result)); >+ return WTF::makeOptional(WTFMove(result)); > } > > } >diff --git a/Source/WebKit/Shared/TouchBarMenuItemData.h b/Source/WebKit/Shared/TouchBarMenuItemData.h >index 238e6363774e7b53af86e0ac1376ff1b205c3a0c..04a33c479e3fe79008bdbac2db10c06d973fd30e 100644 >--- a/Source/WebKit/Shared/TouchBarMenuItemData.h >+++ b/Source/WebKit/Shared/TouchBarMenuItemData.h >@@ -49,7 +49,7 @@ struct TouchBarMenuItemData { > explicit TouchBarMenuItemData(const TouchBarMenuItemData&) = default; > > void encode(IPC::Encoder&) const; >- static std::optional<TouchBarMenuItemData> decode(IPC::Decoder&); >+ static WTF::Optional<TouchBarMenuItemData> decode(IPC::Decoder&); > > ItemType type { ItemType::Button }; > String identifier; >diff --git a/Source/WebKit/Shared/URLSchemeTaskParameters.cpp b/Source/WebKit/Shared/URLSchemeTaskParameters.cpp >index aee450f851c4d12cab5c2a19943d1edf970e5f66..ecaac5b2ba63e892d90df828f5c5cdf2cce144aa 100644 >--- a/Source/WebKit/Shared/URLSchemeTaskParameters.cpp >+++ b/Source/WebKit/Shared/URLSchemeTaskParameters.cpp >@@ -44,30 +44,30 @@ void URLSchemeTaskParameters::encode(IPC::Encoder& encoder) const > encoder << false; > } > >-std::optional<URLSchemeTaskParameters> URLSchemeTaskParameters::decode(IPC::Decoder& decoder) >+WTF::Optional<URLSchemeTaskParameters> URLSchemeTaskParameters::decode(IPC::Decoder& decoder) > { >- std::optional<uint64_t> handlerIdentifier; >+ WTF::Optional<uint64_t> handlerIdentifier; > decoder >> handlerIdentifier; > if (!handlerIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> taskIdentifier; >+ WTF::Optional<uint64_t> taskIdentifier; > decoder >> taskIdentifier; > if (!taskIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::ResourceRequest request; > if (!decoder.decode(request)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> hasHTTPBody; >+ WTF::Optional<bool> hasHTTPBody; > decoder >> hasHTTPBody; > if (!hasHTTPBody) >- return std::nullopt; >+ return WTF::nullopt; > if (*hasHTTPBody) { > RefPtr<WebCore::FormData> formData = WebCore::FormData::decode(decoder); > if (!formData) >- return std::nullopt; >+ return WTF::nullopt; > request.setHTTPBody(WTFMove(formData)); > } > >diff --git a/Source/WebKit/Shared/URLSchemeTaskParameters.h b/Source/WebKit/Shared/URLSchemeTaskParameters.h >index 720ba1c2a6acb58b58a98d3130c561b93a54a5b4..b0bb856ba9b1b28a02c26b00825e535aea862db9 100644 >--- a/Source/WebKit/Shared/URLSchemeTaskParameters.h >+++ b/Source/WebKit/Shared/URLSchemeTaskParameters.h >@@ -40,7 +40,7 @@ struct URLSchemeTaskParameters { > WebCore::ResourceRequest request; > > void encode(IPC::Encoder&) const; >- static std::optional<URLSchemeTaskParameters> decode(IPC::Decoder&); >+ static WTF::Optional<URLSchemeTaskParameters> decode(IPC::Decoder&); > }; > > } // namespace WebKit >diff --git a/Source/WebKit/Shared/WebCompiledContentRuleListData.cpp b/Source/WebKit/Shared/WebCompiledContentRuleListData.cpp >index 514c8f0be431d77c70d662acad52dc82193bf1ff..6e61fba8285e53a010596369edb87056d5396a24 100644 >--- a/Source/WebKit/Shared/WebCompiledContentRuleListData.cpp >+++ b/Source/WebKit/Shared/WebCompiledContentRuleListData.cpp >@@ -49,32 +49,32 @@ void WebCompiledContentRuleListData::encode(IPC::Encoder& encoder) const > encoder << topURLFiltersBytecodeSize; > } > >-std::optional<WebCompiledContentRuleListData> WebCompiledContentRuleListData::decode(IPC::Decoder& decoder) >+WTF::Optional<WebCompiledContentRuleListData> WebCompiledContentRuleListData::decode(IPC::Decoder& decoder) > { > WebCompiledContentRuleListData compiledContentRuleListData; > SharedMemory::Handle handle; > if (!decoder.decode(handle)) >- return std::nullopt; >+ return WTF::nullopt; > compiledContentRuleListData.data = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly); > > if (!decoder.decode(compiledContentRuleListData.conditionsApplyOnlyToDomainOffset)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.actionsOffset)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.actionsSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeOffset)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeOffset)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeOffset)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeSize)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(compiledContentRuleListData); > } >diff --git a/Source/WebKit/Shared/WebCompiledContentRuleListData.h b/Source/WebKit/Shared/WebCompiledContentRuleListData.h >index f4383aa0145588e7624ee549ca8db064e3510474..076d518a9bc763153a92ec23b2832ef55e545589 100644 >--- a/Source/WebKit/Shared/WebCompiledContentRuleListData.h >+++ b/Source/WebKit/Shared/WebCompiledContentRuleListData.h >@@ -58,7 +58,7 @@ public: > } > > void encode(IPC::Encoder&) const; >- static std::optional<WebCompiledContentRuleListData> decode(IPC::Decoder&); >+ static WTF::Optional<WebCompiledContentRuleListData> decode(IPC::Decoder&); > > RefPtr<SharedMemory> data; > NetworkCache::Data fileData; >diff --git a/Source/WebKit/Shared/WebContextMenuItemData.cpp b/Source/WebKit/Shared/WebContextMenuItemData.cpp >index fdb4499e28ce6546d87d2ff36867643c69ce7ab9..6c5afc3512c63aa8f86d364fbd38aa311a047de8 100644 >--- a/Source/WebKit/Shared/WebContextMenuItemData.cpp >+++ b/Source/WebKit/Shared/WebContextMenuItemData.cpp >@@ -108,32 +108,32 @@ void WebContextMenuItemData::encode(IPC::Encoder& encoder) const > encoder << m_submenu; > } > >-std::optional<WebContextMenuItemData> WebContextMenuItemData::decode(IPC::Decoder& decoder) >+WTF::Optional<WebContextMenuItemData> WebContextMenuItemData::decode(IPC::Decoder& decoder) > { > WebCore::ContextMenuItemType type; > if (!decoder.decodeEnum(type)) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::ContextMenuAction action; > if (!decoder.decodeEnum(action)) >- return std::nullopt; >+ return WTF::nullopt; > > String title; > if (!decoder.decode(title)) >- return std::nullopt; >+ return WTF::nullopt; > > bool checked; > if (!decoder.decode(checked)) >- return std::nullopt; >+ return WTF::nullopt; > > bool enabled; > if (!decoder.decode(enabled)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<WebContextMenuItemData>> submenu; >+ WTF::Optional<Vector<WebContextMenuItemData>> submenu; > decoder >> submenu; > if (!submenu) >- return std::nullopt; >+ return WTF::nullopt; > > switch (type) { > case WebCore::ActionType: >@@ -146,7 +146,7 @@ std::optional<WebContextMenuItemData> WebContextMenuItemData::decode(IPC::Decode > break; > } > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > > Vector<WebContextMenuItemData> kitItems(const Vector<WebCore::ContextMenuItem>& coreItemVector) >diff --git a/Source/WebKit/Shared/WebContextMenuItemData.h b/Source/WebKit/Shared/WebContextMenuItemData.h >index 25ef165939536e941966db8cf65a2a8187208a6a..1933da3a706943f74d883ecd1a2dae9d383625c2 100644 >--- a/Source/WebKit/Shared/WebContextMenuItemData.h >+++ b/Source/WebKit/Shared/WebContextMenuItemData.h >@@ -61,7 +61,7 @@ public: > void setUserData(API::Object*); > > void encode(IPC::Encoder&) const; >- static std::optional<WebContextMenuItemData> decode(IPC::Decoder&); >+ static WTF::Optional<WebContextMenuItemData> decode(IPC::Decoder&); > > private: > WebCore::ContextMenuItemType m_type; >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >index ad227c2517ac86320c8c2d3f915adf6f2dabd9ec..681a84228a6303876713a8a15a1a50ac853fbbfc 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >@@ -222,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) -> WTF::Optional<DOMCacheEngine::CacheInfo> > { >- std::optional<uint64_t> identifier; >+ WTF::Optional<uint64_t> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> name; >+ WTF::Optional<String> name; > decoder >> name; > if (!name) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*identifier), WTFMove(*name) }}; > } >@@ -264,64 +264,64 @@ void ArgumentCoder<DOMCacheEngine::Record>::encode(Encoder& encoder, const DOMCa > }); > } > >-std::optional<DOMCacheEngine::Record> ArgumentCoder<DOMCacheEngine::Record>::decode(Decoder& decoder) >+WTF::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; >+ WTF::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(); > } > } >@@ -550,11 +550,11 @@ bool ArgumentCoder<FloatPoint>::decode(Decoder& decoder, FloatPoint& floatPoint) > return SimpleArgumentCoder<FloatPoint>::decode(decoder, floatPoint); > } > >-std::optional<FloatPoint> ArgumentCoder<FloatPoint>::decode(Decoder& decoder) >+WTF::Optional<FloatPoint> ArgumentCoder<FloatPoint>::decode(Decoder& decoder) > { > FloatPoint floatPoint; > if (!SimpleArgumentCoder<FloatPoint>::decode(decoder, floatPoint)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(floatPoint); > } > >@@ -579,11 +579,11 @@ bool ArgumentCoder<FloatRect>::decode(Decoder& decoder, FloatRect& floatRect) > return SimpleArgumentCoder<FloatRect>::decode(decoder, floatRect); > } > >-std::optional<FloatRect> ArgumentCoder<FloatRect>::decode(Decoder& decoder) >+WTF::Optional<FloatRect> ArgumentCoder<FloatRect>::decode(Decoder& decoder) > { > FloatRect floatRect; > if (!SimpleArgumentCoder<FloatRect>::decode(decoder, floatRect)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(floatRect); > } > >@@ -626,11 +626,11 @@ void ArgumentCoder<FloatQuad>::encode(Encoder& encoder, const FloatQuad& floatQu > SimpleArgumentCoder<FloatQuad>::encode(encoder, floatQuad); > } > >-std::optional<FloatQuad> ArgumentCoder<FloatQuad>::decode(Decoder& decoder) >+WTF::Optional<FloatQuad> ArgumentCoder<FloatQuad>::decode(Decoder& decoder) > { > FloatQuad floatQuad; > if (!SimpleArgumentCoder<FloatQuad>::decode(decoder, floatQuad)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(floatQuad); > } > >@@ -644,11 +644,11 @@ bool ArgumentCoder<ViewportArguments>::decode(Decoder& decoder, ViewportArgument > return SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments); > } > >-std::optional<ViewportArguments> ArgumentCoder<ViewportArguments>::decode(Decoder& decoder) >+WTF::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_FAMILY) >@@ -664,11 +664,11 @@ bool ArgumentCoder<IntPoint>::decode(Decoder& decoder, IntPoint& intPoint) > return SimpleArgumentCoder<IntPoint>::decode(decoder, intPoint); > } > >-std::optional<WebCore::IntPoint> ArgumentCoder<IntPoint>::decode(Decoder& decoder) >+WTF::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); > } > >@@ -682,11 +682,11 @@ bool ArgumentCoder<IntRect>::decode(Decoder& decoder, IntRect& intRect) > return SimpleArgumentCoder<IntRect>::decode(decoder, intRect); > } > >-std::optional<IntRect> ArgumentCoder<IntRect>::decode(Decoder& decoder) >+WTF::Optional<IntRect> ArgumentCoder<IntRect>::decode(Decoder& decoder) > { > IntRect rect; > if (!decode(decoder, rect)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(rect); > } > >@@ -700,11 +700,11 @@ bool ArgumentCoder<IntSize>::decode(Decoder& decoder, IntSize& intSize) > return SimpleArgumentCoder<IntSize>::decode(decoder, intSize); > } > >-std::optional<IntSize> ArgumentCoder<IntSize>::decode(Decoder& decoder) >+WTF::Optional<IntSize> ArgumentCoder<IntSize>::decode(Decoder& decoder) > { > IntSize intSize; > if (!SimpleArgumentCoder<IntSize>::decode(decoder, intSize)) >- return std::nullopt; >+ return WTF::nullopt; > return WTFMove(intSize); > } > >@@ -835,11 +835,11 @@ bool ArgumentCoder<Path>::decode(Decoder& decoder, Path& path) > return true; > } > >-std::optional<Path> ArgumentCoder<Path>::decode(Decoder& decoder) >+WTF::Optional<Path> ArgumentCoder<Path>::decode(Decoder& decoder) > { > Path path; > if (!decode(decoder, path)) >- return std::nullopt; >+ return WTF::nullopt; > > return path; > } >@@ -849,24 +849,24 @@ void ArgumentCoder<RecentSearch>::encode(Encoder& encoder, const RecentSearch& r > encoder << recentSearch.string << recentSearch.time; > } > >-std::optional<RecentSearch> ArgumentCoder<RecentSearch>::decode(Decoder& decoder) >+WTF::Optional<RecentSearch> ArgumentCoder<RecentSearch>::decode(Decoder& decoder) > { >- std::optional<String> string; >+ WTF::Optional<String> string; > decoder >> string; > if (!string) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WallTime> time; >+ WTF::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 WTF::Optional<Region::Span> decode(Decoder&); > }; > > void ArgumentCoder<Region::Span>::encode(Encoder& encoder, const Region::Span& span) >@@ -875,15 +875,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) >+WTF::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); >@@ -942,15 +942,15 @@ void ArgumentCoder<MimeClassInfo>::encode(Encoder& encoder, const MimeClassInfo& > encoder << mimeClassInfo.type << mimeClassInfo.desc << mimeClassInfo.extensions; > } > >-std::optional<MimeClassInfo> ArgumentCoder<MimeClassInfo>::decode(Decoder& decoder) >+WTF::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); > } >@@ -970,26 +970,26 @@ void ArgumentCoder<PluginInfo>::encode(Encoder& encoder, const PluginInfo& plugi > #endif > } > >-std::optional<WebCore::PluginInfo> ArgumentCoder<PluginInfo>::decode(Decoder& decoder) >+WTF::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); >@@ -1335,59 +1335,59 @@ void ArgumentCoder<SelectionRect>::encode(Encoder& encoder, const SelectionRect& > encoder << selectionRect.isHorizontal(); > } > >-std::optional<SelectionRect> ArgumentCoder<SelectionRect>::decode(Decoder& decoder) >+WTF::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); >@@ -1507,11 +1507,11 @@ bool ArgumentCoder<Color>::decode(Decoder& decoder, Color& color) > return true; > } > >-std::optional<Color> ArgumentCoder<Color>::decode(Decoder& decoder) >+WTF::Optional<Color> ArgumentCoder<Color>::decode(Decoder& decoder) > { > Color color; > if (!decode(decoder, color)) >- return std::nullopt; >+ return WTF::nullopt; > > return color; > } >@@ -1577,18 +1577,18 @@ void ArgumentCoder<CompositionUnderline>::encode(Encoder& encoder, const Composi > encoder << underline.color; > } > >-std::optional<CompositionUnderline> ArgumentCoder<CompositionUnderline>::decode(Decoder& decoder) >+WTF::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); > } >@@ -1621,11 +1621,11 @@ bool ArgumentCoder<DatabaseDetails>::decode(Decoder& decoder, DatabaseDetails& d > if (!decoder.decode(currentUsage)) > return false; > >- std::optional<WallTime> creationTime; >+ WTF::Optional<WallTime> creationTime; > if (!decoder.decode(creationTime)) > return false; > >- std::optional<WallTime> modificationTime; >+ WTF::Optional<WallTime> modificationTime; > if (!decoder.decode(modificationTime)) > return false; > >@@ -1849,22 +1849,22 @@ void ArgumentCoder<DictationAlternative>::encode(Encoder& encoder, const Dictati > encoder << dictationAlternative.dictationContext; > } > >-std::optional<DictationAlternative> ArgumentCoder<DictationAlternative>::decode(Decoder& decoder) >+WTF::Optional<DictationAlternative> ArgumentCoder<DictationAlternative>::decode(Decoder& decoder) > { >- std::optional<unsigned> rangeStart; >+ WTF::Optional<unsigned> rangeStart; > decoder >> rangeStart; > if (!rangeStart) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<unsigned> rangeLength; >+ WTF::Optional<unsigned> rangeLength; > decoder >> rangeLength; > if (!rangeLength) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> dictationContext; >+ WTF::Optional<uint64_t> dictationContext; > decoder >> dictationContext; > if (!dictationContext) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*rangeStart), WTFMove(*rangeLength), WTFMove(*dictationContext) }}; > } >@@ -1942,27 +1942,27 @@ void ArgumentCoder<GrammarDetail>::encode(Encoder& encoder, const GrammarDetail& > encoder << detail.userDescription; > } > >-std::optional<GrammarDetail> ArgumentCoder<GrammarDetail>::decode(Decoder& decoder) >+WTF::Optional<GrammarDetail> ArgumentCoder<GrammarDetail>::decode(Decoder& decoder) > { >- std::optional<int> location; >+ WTF::Optional<int> location; > decoder >> location; > if (!location) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> length; >+ WTF::Optional<int> length; > decoder >> length; > if (!length) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<String>> guesses; >+ WTF::Optional<Vector<String>> guesses; > decoder >> guesses; > if (!guesses) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> userDescription; >+ WTF::Optional<String> userDescription; > decoder >> userDescription; > if (!userDescription) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*location), WTFMove(*length), WTFMove(*guesses), WTFMove(*userDescription) }}; > } >@@ -2006,31 +2006,31 @@ void ArgumentCoder<TextCheckingResult>::encode(Encoder& encoder, const TextCheck > encoder << result.replacement; > } > >-std::optional<TextCheckingResult> ArgumentCoder<TextCheckingResult>::decode(Decoder& decoder) >+WTF::Optional<TextCheckingResult> ArgumentCoder<TextCheckingResult>::decode(Decoder& decoder) > { > TextCheckingType type; > if (!decoder.decodeEnum(type)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> location; >+ WTF::Optional<int> location; > decoder >> location; > if (!location) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> length; >+ WTF::Optional<int> length; > decoder >> length; > if (!length) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<GrammarDetail>> details; >+ WTF::Optional<Vector<GrammarDetail>> details; > decoder >> details; > if (!details) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> replacement; >+ WTF::Optional<String> replacement; > decoder >> replacement; > if (!replacement) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(type), WTFMove(*location), WTFMove(*length), WTFMove(*details), WTFMove(*replacement) }}; > } >@@ -2405,33 +2405,33 @@ void ArgumentCoder<BlobPart>::encode(Encoder& encoder, const BlobPart& blobPart) > } > } > >-std::optional<BlobPart> ArgumentCoder<BlobPart>::decode(Decoder& decoder) >+WTF::Optional<BlobPart> ArgumentCoder<BlobPart>::decode(Decoder& decoder) > { > BlobPart blobPart; > >- std::optional<uint32_t> type; >+ WTF::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; >+ WTF::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); >@@ -2453,43 +2453,43 @@ void ArgumentCoder<TextIndicatorData>::encode(Encoder& encoder, const TextIndica > encodeOptionalImage(encoder, textIndicatorData.contentImageWithoutSelection.get()); > } > >-std::optional<TextIndicatorData> ArgumentCoder<TextIndicatorData>::decode(Decoder& decoder) >+WTF::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); > } >@@ -2564,7 +2564,7 @@ bool ArgumentCoder<DictionaryPopupInfo>::decode(IPC::Decoder& decoder, Dictionar > if (!decoder.decode(result.origin)) > return false; > >- std::optional<TextIndicatorData> textIndicator; >+ WTF::Optional<TextIndicatorData> textIndicator; > decoder >> textIndicator; > if (!textIndicator) > return false; >@@ -2659,81 +2659,81 @@ void ArgumentCoder<ResourceLoadStatistics>::encode(Encoder& encoder, const WebCo > > } > >-std::optional<ResourceLoadStatistics> ArgumentCoder<ResourceLoadStatistics>::decode(Decoder& decoder) >+WTF::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 (!decoder.decode(statistics.fontsFailedToLoad)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(statistics.fontsSuccessfullyLoaded)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(statistics.canvasActivityRecord)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(statistics.navigatorFunctionsAccessed)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(statistics.screenFunctionsAccessed)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(statistics); > } >@@ -2748,7 +2748,7 @@ void ArgumentCoder<MediaConstraints>::encode(Encoder& encoder, const WebCore::Me > > bool ArgumentCoder<MediaConstraints>::decode(Decoder& decoder, WebCore::MediaConstraints& constraints) > { >- std::optional<WebCore::MediaTrackConstraintSetMap> mandatoryConstraints; >+ WTF::Optional<WebCore::MediaTrackConstraintSetMap> mandatoryConstraints; > decoder >> mandatoryConstraints; > if (!mandatoryConstraints) > return false; >@@ -2806,14 +2806,14 @@ bool ArgumentCoder<ServiceWorkerOrClientData>::decode(Decoder& decoder, ServiceW > if (!decoder.decode(isServiceWorkerData)) > return false; > if (isServiceWorkerData) { >- std::optional<ServiceWorkerData> workerData; >+ WTF::Optional<ServiceWorkerData> workerData; > decoder >> workerData; > if (!workerData) > return false; > > data = WTFMove(*workerData); > } else { >- std::optional<ServiceWorkerClientData> clientData; >+ WTF::Optional<ServiceWorkerClientData> clientData; > decoder >> clientData; > if (!clientData) > return false; >@@ -2839,14 +2839,14 @@ bool ArgumentCoder<ServiceWorkerOrClientIdentifier>::decode(Decoder& decoder, Se > if (!decoder.decode(isServiceWorkerIdentifier)) > return false; > if (isServiceWorkerIdentifier) { >- std::optional<ServiceWorkerIdentifier> workerIdentifier; >+ WTF::Optional<ServiceWorkerIdentifier> workerIdentifier; > decoder >> workerIdentifier; > if (!workerIdentifier) > return false; > > identifier = WTFMove(*workerIdentifier); > } else { >- std::optional<ServiceWorkerClientIdentifier> clientIdentifier; >+ WTF::Optional<ServiceWorkerClientIdentifier> clientIdentifier; > decoder >> clientIdentifier; > if (!clientIdentifier) > return false; >@@ -2865,16 +2865,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) -> WTF::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; >@@ -2889,17 +2889,17 @@ void ArgumentCoder<MediaSelectionOption>::encode(Encoder& encoder, const MediaSe > encoder << option.type; > } > >-std::optional<MediaSelectionOption> ArgumentCoder<MediaSelectionOption>::decode(Decoder& decoder) >+WTF::Optional<MediaSelectionOption> ArgumentCoder<MediaSelectionOption>::decode(Decoder& decoder) > { >- std::optional<String> displayName; >+ WTF::Optional<String> displayName; > decoder >> displayName; > if (!displayName) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<MediaSelectionOption::Type> type; >+ WTF::Optional<MediaSelectionOption::Type> type; > decoder >> type; > if (!type) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*displayName), WTFMove(*type) }}; > } >@@ -2973,41 +2973,41 @@ void ArgumentCoder<FontAttributes>::encode(Encoder& encoder, const FontAttribute > #endif > } > >-std::optional<FontAttributes> ArgumentCoder<FontAttributes>::decode(Decoder& decoder) >+WTF::Optional<FontAttributes> ArgumentCoder<FontAttributes>::decode(Decoder& decoder) > { > FontAttributes attributes; > > if (!decoder.decode(attributes.backgroundColor)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(attributes.foregroundColor)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(attributes.fontShadow)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(attributes.hasUnderline)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(attributes.hasStrikeThrough)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(attributes.textLists)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(attributes.horizontalAlignment)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(attributes.subscriptOrSuperscript)) >- return std::nullopt; >+ return WTF::nullopt; > > #if PLATFORM(COCOA) > bool hasFont = false; > if (!decoder.decode(hasFont)) >- return std::nullopt; >+ return WTF::nullopt; > > if (hasFont && !IPC::decode(decoder, attributes.font)) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > return attributes; >@@ -3020,19 +3020,19 @@ void ArgumentCoder<SerializedAttachmentData>::encode(IPC::Encoder& encoder, cons > encoder << data.identifier << data.mimeType << IPC::SharedBufferDataReference { data.data.get() }; > } > >-std::optional<SerializedAttachmentData> ArgumentCoder<WebCore::SerializedAttachmentData>::decode(IPC::Decoder& decoder) >+WTF::Optional<SerializedAttachmentData> ArgumentCoder<WebCore::SerializedAttachmentData>::decode(IPC::Decoder& decoder) > { > String identifier; > if (!decoder.decode(identifier)) >- return std::nullopt; >+ return WTF::nullopt; > > String mimeType; > if (!decoder.decode(mimeType)) >- return std::nullopt; >+ return WTF::nullopt; > > IPC::DataReference data; > if (!decoder.decode(data)) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(identifier), WTFMove(mimeType), WebCore::SharedBuffer::create(data.data(), data.size()) }}; > } >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.h b/Source/WebKit/Shared/WebCoreArgumentCoders.h >index 3a3ea994910869f57ca2886f9f7dd5c48e799038..8eb6f67a5f8078a7d7926e73b22e7b95b441be59 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.h >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.h >@@ -190,12 +190,12 @@ template<> struct ArgumentCoder<WebCore::CacheQueryOptions> { > > template<> struct ArgumentCoder<WebCore::DOMCacheEngine::CacheInfo> { > static void encode(Encoder&, const WebCore::DOMCacheEngine::CacheInfo&); >- static std::optional<WebCore::DOMCacheEngine::CacheInfo> decode(Decoder&); >+ static WTF::Optional<WebCore::DOMCacheEngine::CacheInfo> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::DOMCacheEngine::Record> { > static void encode(Encoder&, const WebCore::DOMCacheEngine::Record&); >- static std::optional<WebCore::DOMCacheEngine::Record> decode(Decoder&); >+ static WTF::Optional<WebCore::DOMCacheEngine::Record> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::EventTrackingRegions> { >@@ -236,7 +236,7 @@ template<> struct ArgumentCoder<WebCore::CertificateInfo> { > template<> struct ArgumentCoder<WebCore::FloatPoint> { > static void encode(Encoder&, const WebCore::FloatPoint&); > static bool decode(Decoder&, WebCore::FloatPoint&); >- static std::optional<WebCore::FloatPoint> decode(Decoder&); >+ static WTF::Optional<WebCore::FloatPoint> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::FloatPoint3D> { >@@ -247,7 +247,7 @@ template<> struct ArgumentCoder<WebCore::FloatPoint3D> { > template<> struct ArgumentCoder<WebCore::FloatRect> { > static void encode(Encoder&, const WebCore::FloatRect&); > static bool decode(Decoder&, WebCore::FloatRect&); >- static std::optional<WebCore::FloatRect> decode(Decoder&); >+ static WTF::Optional<WebCore::FloatRect> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::FloatBoxExtent> { >@@ -268,32 +268,32 @@ template<> struct ArgumentCoder<WebCore::FloatRoundedRect> { > #if PLATFORM(IOS_FAMILY) > template<> struct ArgumentCoder<WebCore::FloatQuad> { > static void encode(Encoder&, const WebCore::FloatQuad&); >- static std::optional<WebCore::FloatQuad> decode(Decoder&); >+ static WTF::Optional<WebCore::FloatQuad> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::ViewportArguments> { > static void encode(Encoder&, const WebCore::ViewportArguments&); > static bool decode(Decoder&, WebCore::ViewportArguments&); >- static std::optional<WebCore::ViewportArguments> decode(Decoder&); >+ static WTF::Optional<WebCore::ViewportArguments> decode(Decoder&); > }; > #endif // PLATFORM(IOS_FAMILY) > > template<> struct ArgumentCoder<WebCore::IntPoint> { > static void encode(Encoder&, const WebCore::IntPoint&); > static bool decode(Decoder&, WebCore::IntPoint&); >- static std::optional<WebCore::IntPoint> decode(Decoder&); >+ static WTF::Optional<WebCore::IntPoint> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::IntRect> { > static void encode(Encoder&, const WebCore::IntRect&); > static bool decode(Decoder&, WebCore::IntRect&); >- static std::optional<WebCore::IntRect> decode(Decoder&); >+ static WTF::Optional<WebCore::IntRect> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::IntSize> { > static void encode(Encoder&, const WebCore::IntSize&); > static bool decode(Decoder&, WebCore::IntSize&); >- static std::optional<WebCore::IntSize> decode(Decoder&); >+ static WTF::Optional<WebCore::IntSize> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::LayoutSize> { >@@ -309,7 +309,7 @@ template<> struct ArgumentCoder<WebCore::LayoutPoint> { > template<> struct ArgumentCoder<WebCore::Path> { > static void encode(Encoder&, const WebCore::Path&); > static bool decode(Decoder&, WebCore::Path&); >- static std::optional<WebCore::Path> decode(Decoder&); >+ static WTF::Optional<WebCore::Path> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::Region> { >@@ -329,12 +329,12 @@ template<> struct ArgumentCoder<WebCore::ViewportAttributes> { > > template<> struct ArgumentCoder<WebCore::MimeClassInfo> { > static void encode(Encoder&, const WebCore::MimeClassInfo&); >- static std::optional<WebCore::MimeClassInfo> decode(Decoder&); >+ static WTF::Optional<WebCore::MimeClassInfo> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PluginInfo> { > static void encode(Encoder&, const WebCore::PluginInfo&); >- static std::optional<WebCore::PluginInfo> decode(Decoder&); >+ static WTF::Optional<WebCore::PluginInfo> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> { >@@ -383,7 +383,7 @@ template<> struct ArgumentCoder<WebCore::WindowFeatures> { > template<> struct ArgumentCoder<WebCore::Color> { > static void encode(Encoder&, const WebCore::Color&); > static bool decode(Decoder&, WebCore::Color&); >- static std::optional<WebCore::Color> decode(Decoder&); >+ static WTF::Optional<WebCore::Color> decode(Decoder&); > }; > > #if ENABLE(DRAG_SUPPORT) >@@ -402,14 +402,14 @@ template<> struct ArgumentCoder<WTF::MachSendRight> { > > template<> struct ArgumentCoder<WebCore::KeypressCommand> { > static void encode(Encoder&, const WebCore::KeypressCommand&); >- static std::optional<WebCore::KeypressCommand> decode(Decoder&); >+ static WTF::Optional<WebCore::KeypressCommand> decode(Decoder&); > }; > #endif > > #if PLATFORM(IOS_FAMILY) > template<> struct ArgumentCoder<WebCore::SelectionRect> { > static void encode(Encoder&, const WebCore::SelectionRect&); >- static std::optional<WebCore::SelectionRect> decode(Decoder&); >+ static WTF::Optional<WebCore::SelectionRect> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::Highlight> { >@@ -455,13 +455,13 @@ template<> struct ArgumentCoder<WebCore::PasteboardWebContent> { > #if USE(CURL) > template<> struct ArgumentCoder<WebCore::CurlProxySettings> { > static void encode(Encoder&, const WebCore::CurlProxySettings&); >- static std::optional<WebCore::CurlProxySettings> decode(Decoder&); >+ static WTF::Optional<WebCore::CurlProxySettings> decode(Decoder&); > }; > #endif > > template<> struct ArgumentCoder<WebCore::CompositionUnderline> { > static void encode(Encoder&, const WebCore::CompositionUnderline&); >- static std::optional<WebCore::CompositionUnderline> decode(Decoder&); >+ static WTF::Optional<WebCore::CompositionUnderline> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::DatabaseDetails> { >@@ -478,7 +478,7 @@ template<> struct ArgumentCoder<WebCore::DataListSuggestionInformation> { > > template<> struct ArgumentCoder<WebCore::DictationAlternative> { > static void encode(Encoder&, const WebCore::DictationAlternative&); >- static std::optional<WebCore::DictationAlternative> decode(Decoder&); >+ static WTF::Optional<WebCore::DictationAlternative> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::FileChooserSettings> { >@@ -498,7 +498,7 @@ template<> struct ArgumentCoder<WebCore::ShareDataWithParsedURL> { > > template<> struct ArgumentCoder<WebCore::GrammarDetail> { > static void encode(Encoder&, const WebCore::GrammarDetail&); >- static std::optional<WebCore::GrammarDetail> decode(Decoder&); >+ static WTF::Optional<WebCore::GrammarDetail> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::TextCheckingRequestData> { >@@ -508,7 +508,7 @@ template<> struct ArgumentCoder<WebCore::TextCheckingRequestData> { > > template<> struct ArgumentCoder<WebCore::TextCheckingResult> { > static void encode(Encoder&, const WebCore::TextCheckingResult&); >- static std::optional<WebCore::TextCheckingResult> decode(Decoder&); >+ static WTF::Optional<WebCore::TextCheckingResult> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::UserStyleSheet> { >@@ -545,7 +545,7 @@ bool decodeFilterOperation(Decoder&, RefPtr<WebCore::FilterOperation>&); > > template<> struct ArgumentCoder<WebCore::BlobPart> { > static void encode(Encoder&, const WebCore::BlobPart&); >- static std::optional<WebCore::BlobPart> decode(Decoder&); >+ static WTF::Optional<WebCore::BlobPart> decode(Decoder&); > }; > > #if ENABLE(CONTENT_FILTERING) >@@ -564,7 +564,7 @@ template<> struct ArgumentCoder<WebCore::MediaSessionMetadata> { > > template<> struct ArgumentCoder<WebCore::TextIndicatorData> { > static void encode(Encoder&, const WebCore::TextIndicatorData&); >- static std::optional<WebCore::TextIndicatorData> decode(Decoder&); >+ static WTF::Optional<WebCore::TextIndicatorData> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::DictionaryPopupInfo> { >@@ -583,7 +583,7 @@ template<> struct ArgumentCoder<WebCore::MediaPlaybackTargetContext> { > > template<> struct ArgumentCoder<WebCore::RecentSearch> { > static void encode(Encoder&, const WebCore::RecentSearch&); >- static std::optional<WebCore::RecentSearch> decode(Decoder&); >+ static WTF::Optional<WebCore::RecentSearch> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::ExceptionDetails> { >@@ -593,44 +593,44 @@ template<> struct ArgumentCoder<WebCore::ExceptionDetails> { > > template<> struct ArgumentCoder<WebCore::ResourceLoadStatistics> { > static void encode(Encoder&, const WebCore::ResourceLoadStatistics&); >- static std::optional<WebCore::ResourceLoadStatistics> decode(Decoder&); >+ static WTF::Optional<WebCore::ResourceLoadStatistics> decode(Decoder&); > }; > > #if ENABLE(APPLE_PAY) > > template<> struct ArgumentCoder<WebCore::Payment> { > static void encode(Encoder&, const WebCore::Payment&); >- static std::optional<WebCore::Payment> decode(Decoder&); >+ static WTF::Optional<WebCore::Payment> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PaymentAuthorizationResult> { > static void encode(Encoder&, const WebCore::PaymentAuthorizationResult&); >- static std::optional<WebCore::PaymentAuthorizationResult> decode(Decoder&); >+ static WTF::Optional<WebCore::PaymentAuthorizationResult> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PaymentContact> { > static void encode(Encoder&, const WebCore::PaymentContact&); >- static std::optional<WebCore::PaymentContact> decode(Decoder&); >+ static WTF::Optional<WebCore::PaymentContact> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PaymentError> { > static void encode(Encoder&, const WebCore::PaymentError&); >- static std::optional<WebCore::PaymentError> decode(Decoder&); >+ static WTF::Optional<WebCore::PaymentError> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PaymentMerchantSession> { > static void encode(Encoder&, const WebCore::PaymentMerchantSession&); >- static std::optional<WebCore::PaymentMerchantSession> decode(Decoder&); >+ static WTF::Optional<WebCore::PaymentMerchantSession> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PaymentMethod> { > static void encode(Encoder&, const WebCore::PaymentMethod&); >- static std::optional<WebCore::PaymentMethod> decode(Decoder&); >+ static WTF::Optional<WebCore::PaymentMethod> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PaymentMethodUpdate> { > static void encode(Encoder&, const WebCore::PaymentMethodUpdate&); >- static std::optional<WebCore::PaymentMethodUpdate> decode(Decoder&); >+ static WTF::Optional<WebCore::PaymentMethodUpdate> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest> { >@@ -645,7 +645,7 @@ template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ContactF > > template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::LineItem> { > static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::LineItem&); >- static std::optional<WebCore::ApplePaySessionPaymentRequest::LineItem> decode(Decoder&); >+ static WTF::Optional<WebCore::ApplePaySessionPaymentRequest::LineItem> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities> { >@@ -655,22 +655,22 @@ template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::Merchant > > template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> { > static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&); >- static std::optional<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> decode(Decoder&); >+ static WTF::Optional<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> { > static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems&); >- static std::optional<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> decode(Decoder&); >+ static WTF::Optional<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::ShippingContactUpdate> { > static void encode(Encoder&, const WebCore::ShippingContactUpdate&); >- static std::optional<WebCore::ShippingContactUpdate> decode(Decoder&); >+ static WTF::Optional<WebCore::ShippingContactUpdate> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::ShippingMethodUpdate> { > static void encode(Encoder&, const WebCore::ShippingMethodUpdate&); >- static std::optional<WebCore::ShippingMethodUpdate> decode(Decoder&); >+ static WTF::Optional<WebCore::ShippingMethodUpdate> decode(Decoder&); > }; > > #endif >@@ -709,14 +709,14 @@ template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientIdentifier> { > > template<> struct ArgumentCoder<WebCore::ScrollOffsetRange<float>> { > static void encode(Encoder&, const WebCore::ScrollOffsetRange<float>&); >- static std::optional<WebCore::ScrollOffsetRange<float>> decode(Decoder&); >+ static WTF::Optional<WebCore::ScrollOffsetRange<float>> decode(Decoder&); > }; > > #endif > > template<> struct ArgumentCoder<WebCore::MediaSelectionOption> { > static void encode(Encoder&, const WebCore::MediaSelectionOption&); >- static std::optional<WebCore::MediaSelectionOption> decode(Decoder&); >+ static WTF::Optional<WebCore::MediaSelectionOption> decode(Decoder&); > }; > > template<> struct ArgumentCoder<WebCore::PromisedAttachmentInfo> { >@@ -731,14 +731,14 @@ template<> struct ArgumentCoder<Vector<RefPtr<WebCore::SecurityOrigin>>> { > > template<> struct ArgumentCoder<WebCore::FontAttributes> { > static void encode(Encoder&, const WebCore::FontAttributes&); >- static std::optional<WebCore::FontAttributes> decode(Decoder&); >+ static WTF::Optional<WebCore::FontAttributes> decode(Decoder&); > }; > > #if ENABLE(ATTACHMENT_ELEMENT) > > template<> struct ArgumentCoder<WebCore::SerializedAttachmentData> { > static void encode(Encoder&, const WebCore::SerializedAttachmentData&); >- static std::optional<WebCore::SerializedAttachmentData> decode(Decoder&); >+ static WTF::Optional<WebCore::SerializedAttachmentData> decode(Decoder&); > }; > > #endif // ENABLE(ATTACHMENT_ELEMENT) >diff --git a/Source/WebKit/Shared/WebEvent.h b/Source/WebKit/Shared/WebEvent.h >index 6c18f8c23ebe74dd483972060328bfc410052062..24e30460edfb9a6c044a82480ebe37362977032d 100644 >--- a/Source/WebKit/Shared/WebEvent.h >+++ b/Source/WebKit/Shared/WebEvent.h >@@ -367,7 +367,7 @@ public: > #endif > > void encode(IPC::Encoder&) const; >- static std::optional<WebPlatformTouchPoint> decode(IPC::Decoder&); >+ static WTF::Optional<WebPlatformTouchPoint> decode(IPC::Decoder&); > > private: > unsigned m_identifier; >@@ -460,7 +460,7 @@ public: > void setState(TouchPointState state) { m_state = state; } > > void encode(IPC::Encoder&) const; >- static std::optional<WebPlatformTouchPoint> decode(IPC::Decoder&); >+ static WTF::Optional<WebPlatformTouchPoint> decode(IPC::Decoder&); > > private: > uint32_t m_id; >diff --git a/Source/WebKit/Shared/WebGeolocationPosition.h b/Source/WebKit/Shared/WebGeolocationPosition.h >index 418ac363147e4409e42dffc1ad81b14b1c528e26..884878a90d6708c747fb83469d90a8f0c5e54822 100644 >--- a/Source/WebKit/Shared/WebGeolocationPosition.h >+++ b/Source/WebKit/Shared/WebGeolocationPosition.h >@@ -47,10 +47,10 @@ public: > double latitude() const { return m_corePosition.latitude; } > double longitude() const { return m_corePosition.longitude; } > double accuracy() const { return m_corePosition.accuracy; } >- std::optional<double> altitude() const { return m_corePosition.altitude; } >- std::optional<double> altitudeAccuracy() const { return m_corePosition.altitudeAccuracy; } >- std::optional<double> heading() const { return m_corePosition.heading; } >- std::optional<double> speed() const { return m_corePosition.speed; } >+ WTF::Optional<double> altitude() const { return m_corePosition.altitude; } >+ WTF::Optional<double> altitudeAccuracy() const { return m_corePosition.altitudeAccuracy; } >+ WTF::Optional<double> heading() const { return m_corePosition.heading; } >+ WTF::Optional<double> speed() const { return m_corePosition.speed; } > > const WebCore::GeolocationPosition& corePosition() const { return m_corePosition; } > >diff --git a/Source/WebKit/Shared/WebHitTestResultData.cpp b/Source/WebKit/Shared/WebHitTestResultData.cpp >index ada3f51a2cf971d98bd887b84c159a0e9cb35186..022d12373dc62fda492b01b3dfe2c33937ea558c 100644 >--- a/Source/WebKit/Shared/WebHitTestResultData.cpp >+++ b/Source/WebKit/Shared/WebHitTestResultData.cpp >@@ -159,7 +159,7 @@ bool WebHitTestResultData::decode(IPC::Decoder& decoder, WebHitTestResultData& h > return false; > > if (hasLinkTextIndicator) { >- std::optional<WebCore::TextIndicatorData> indicatorData; >+ WTF::Optional<WebCore::TextIndicatorData> indicatorData; > decoder >> indicatorData; > if (!indicatorData) > return false; >diff --git a/Source/WebKit/Shared/WebPageCreationParameters.cpp b/Source/WebKit/Shared/WebPageCreationParameters.cpp >index 3ea064ab0afc050084ad734632bdcaeccf9a9e19..a5b405abbb0167f5f8e8edb436a3ed70ea2e0dd7 100644 >--- a/Source/WebKit/Shared/WebPageCreationParameters.cpp >+++ b/Source/WebKit/Shared/WebPageCreationParameters.cpp >@@ -122,229 +122,229 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const > #endif > } > >-std::optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decoder& decoder) >+WTF::Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decoder& decoder) > { > WebPageCreationParameters parameters; > if (!decoder.decode(parameters.viewSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.activityState)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.store)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decodeEnum(parameters.drawingAreaType)) >- return std::nullopt; >- std::optional<WebPageGroupData> pageGroupData; >+ return WTF::nullopt; >+ WTF::Optional<WebPageGroupData> pageGroupData; > decoder >> pageGroupData; > if (!pageGroupData) >- return std::nullopt; >+ return WTF::nullopt; > parameters.pageGroupData = WTFMove(*pageGroupData); > if (!decoder.decode(parameters.drawsBackground)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.isEditable)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.underlayColor)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.useFixedLayout)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.fixedLayoutSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.alwaysShowsHorizontalScroller)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.alwaysShowsVerticalScroller)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decodeEnum(parameters.paginationMode)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.paginationBehavesLikeColumns)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.pageLength)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.gapBetweenPages)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.paginationLineGridEnabled)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> userAgent; >+ WTF::Optional<String> userAgent; > decoder >> userAgent; > if (!userAgent) >- return std::nullopt; >+ return WTF::nullopt; > parameters.userAgent = WTFMove(*userAgent); > >- std::optional<Vector<BackForwardListItemState>> itemStates; >+ WTF::Optional<Vector<BackForwardListItemState>> itemStates; > decoder >> itemStates; > if (!itemStates) >- return std::nullopt; >+ return WTF::nullopt; > parameters.itemStates = WTFMove(*itemStates); > > if (!decoder.decode(parameters.sessionID)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> userContentControllerIdentifier; >+ WTF::Optional<uint64_t> userContentControllerIdentifier; > decoder >> userContentControllerIdentifier; > if (!userContentControllerIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > parameters.userContentControllerID = makeObjectIdentifier<UserContentControllerIdentifierType>(*userContentControllerIdentifier); > > if (!decoder.decode(parameters.visitedLinkTableID)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.websiteDataStoreID)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.canRunBeforeUnloadConfirmPanel)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.canRunModal)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.deviceScaleFactor)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.viewScaleFactor)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.topContentInset)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.mediaVolume)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.muted)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.mayStartMediaWhenInWindow)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.viewLayoutSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.autoSizingShouldExpandToViewHeight)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.viewportSizeForCSSViewportUnits)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decodeEnum(parameters.scrollPinningBehavior)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<uint32_t>> scrollbarOverlayStyle; >+ WTF::Optional<WTF::Optional<uint32_t>> scrollbarOverlayStyle; > decoder >> scrollbarOverlayStyle; > if (!scrollbarOverlayStyle) >- return std::nullopt; >+ return WTF::nullopt; > parameters.scrollbarOverlayStyle = WTFMove(*scrollbarOverlayStyle); > > if (!decoder.decode(parameters.backgroundExtendsBeyondPage)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decodeEnum(parameters.layerHostingMode)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.mimeTypesWithCustomContentProviders)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.controlledByAutomation)) >- return std::nullopt; >+ return WTF::nullopt; > > #if PLATFORM(MAC) > if (!decoder.decode(parameters.colorSpace)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.useSystemAppearance)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.useDarkAppearance)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.shouldDelayAttachingDrawingArea)) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > #if PLATFORM(IOS_FAMILY) > if (!decoder.decode(parameters.screenSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.availableScreenSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.overrideScreenSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.textAutosizingWidth)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.ignoresViewportScaleLimits)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.viewportConfigurationViewLayoutSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.viewportConfigurationLayoutSizeScaleFactor)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.viewportConfigurationViewSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.maximumUnobscuredSize)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.deviceOrientation)) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > #if PLATFORM(COCOA) > if (!decoder.decode(parameters.smartInsertDeleteEnabled)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.additionalSupportedImageTypes)) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > if (!decoder.decode(parameters.appleMailPaginationQuirkEnabled)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(parameters.appleMailLinesClampEnabled)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(parameters.shouldScaleViewToFitDocument)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(parameters.userInterfaceLayoutDirection)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(parameters.observedLayoutMilestones)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(parameters.overrideContentSecurityPolicy)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<double>> cpuLimit; >+ WTF::Optional<WTF::Optional<double>> cpuLimit; > decoder >> cpuLimit; > if (!cpuLimit) >- return std::nullopt; >+ return WTF::nullopt; > parameters.cpuLimit = WTFMove(*cpuLimit); > > if (!decoder.decode(parameters.urlSchemeHandlers)) >- return std::nullopt; >+ return WTF::nullopt; > > #if ENABLE(APPLICATION_MANIFEST) >- std::optional<std::optional<WebCore::ApplicationManifest>> applicationManifest; >+ WTF::Optional<WTF::Optional<WebCore::ApplicationManifest>> applicationManifest; > decoder >> applicationManifest; > if (!applicationManifest) >- return std::nullopt; >+ return WTF::nullopt; > parameters.applicationManifest = WTFMove(*applicationManifest); > #endif > #if ENABLE(SERVICE_WORKER) > if (!decoder.decode(parameters.hasRegisteredServiceWorkers)) >- return std::nullopt; >+ return WTF::nullopt; > #endif > > if (!decoder.decode(parameters.needsFontAttributes)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(parameters.iceCandidateFilteringEnabled)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(parameters.enumeratingAllNetworkInterfacesEnabled)) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<std::pair<uint64_t, String>>> userContentWorlds; >+ WTF::Optional<Vector<std::pair<uint64_t, String>>> userContentWorlds; > decoder >> userContentWorlds; > if (!userContentWorlds) >- return std::nullopt; >+ return WTF::nullopt; > parameters.userContentWorlds = WTFMove(*userContentWorlds); > >- std::optional<Vector<WebUserScriptData>> userScripts; >+ WTF::Optional<Vector<WebUserScriptData>> userScripts; > decoder >> userScripts; > if (!userScripts) >- return std::nullopt; >+ return WTF::nullopt; > parameters.userScripts = WTFMove(*userScripts); > >- std::optional<Vector<WebUserStyleSheetData>> userStyleSheets; >+ WTF::Optional<Vector<WebUserStyleSheetData>> userStyleSheets; > decoder >> userStyleSheets; > if (!userStyleSheets) >- return std::nullopt; >+ return WTF::nullopt; > parameters.userStyleSheets = WTFMove(*userStyleSheets); > >- std::optional<Vector<WebScriptMessageHandlerData>> messageHandlers; >+ WTF::Optional<Vector<WebScriptMessageHandlerData>> messageHandlers; > decoder >> messageHandlers; > if (!messageHandlers) >- return std::nullopt; >+ return WTF::nullopt; > parameters.messageHandlers = WTFMove(*messageHandlers); > > #if ENABLE(CONTENT_EXTENSIONS) >- std::optional<Vector<std::pair<String, WebCompiledContentRuleListData>>> contentRuleLists; >+ WTF::Optional<Vector<std::pair<String, WebCompiledContentRuleListData>>> contentRuleLists; > decoder >> contentRuleLists; > if (!contentRuleLists) >- return std::nullopt; >+ return WTF::nullopt; > parameters.contentRuleLists = WTFMove(*contentRuleLists); > #endif > >diff --git a/Source/WebKit/Shared/WebPageCreationParameters.h b/Source/WebKit/Shared/WebPageCreationParameters.h >index 4f71d4dbd2f2784af623037a99235904a099aa9a..c2332fafb841eb02ab68032e9118c38cbe292fd3 100644 >--- a/Source/WebKit/Shared/WebPageCreationParameters.h >+++ b/Source/WebKit/Shared/WebPageCreationParameters.h >@@ -63,7 +63,7 @@ namespace WebKit { > > struct WebPageCreationParameters { > void encode(IPC::Encoder&) const; >- static std::optional<WebPageCreationParameters> decode(IPC::Decoder&); >+ static WTF::Optional<WebPageCreationParameters> decode(IPC::Decoder&); > > WebCore::IntSize viewSize; > >@@ -114,13 +114,13 @@ struct WebPageCreationParameters { > > WebCore::IntSize viewLayoutSize; > bool autoSizingShouldExpandToViewHeight; >- std::optional<WebCore::IntSize> viewportSizeForCSSViewportUnits; >+ WTF::Optional<WebCore::IntSize> viewportSizeForCSSViewportUnits; > > WebCore::ScrollPinningBehavior scrollPinningBehavior; > >- // FIXME: This should be std::optional<WebCore::ScrollbarOverlayStyle>, but we would need to >+ // FIXME: This should be WTF::Optional<WebCore::ScrollbarOverlayStyle>, but we would need to > // correctly handle enums inside Optionals when encoding and decoding. >- std::optional<uint32_t> scrollbarOverlayStyle; >+ WTF::Optional<uint32_t> scrollbarOverlayStyle; > > bool backgroundExtendsBeyondPage; > >@@ -160,12 +160,12 @@ struct WebPageCreationParameters { > OptionSet<WebCore::LayoutMilestone> observedLayoutMilestones; > > String overrideContentSecurityPolicy; >- std::optional<double> cpuLimit; >+ WTF::Optional<double> cpuLimit; > > HashMap<String, uint64_t> urlSchemeHandlers; > > #if ENABLE(APPLICATION_MANIFEST) >- std::optional<WebCore::ApplicationManifest> applicationManifest; >+ WTF::Optional<WebCore::ApplicationManifest> applicationManifest; > #endif > > #if ENABLE(SERVICE_WORKER) >diff --git a/Source/WebKit/Shared/WebPageGroupData.cpp b/Source/WebKit/Shared/WebPageGroupData.cpp >index e0842bd90a16da8c4da6384520fd6e0cff1ef3c7..7744f873af19d368055a300ab6834516e1f3ceae 100644 >--- a/Source/WebKit/Shared/WebPageGroupData.cpp >+++ b/Source/WebKit/Shared/WebPageGroupData.cpp >@@ -37,22 +37,22 @@ void WebPageGroupData::encode(IPC::Encoder& encoder) const > encoder << userContentControllerIdentifier.toUInt64(); > } > >-std::optional<WebPageGroupData> WebPageGroupData::decode(IPC::Decoder& decoder) >+WTF::Optional<WebPageGroupData> WebPageGroupData::decode(IPC::Decoder& decoder) > { >- std::optional<String> identifier; >+ WTF::Optional<String> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> pageGroupID; >+ WTF::Optional<uint64_t> pageGroupID; > decoder >> pageGroupID; > if (!pageGroupID) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> userContentControllerIdentifier; >+ WTF::Optional<uint64_t> userContentControllerIdentifier; > decoder >> userContentControllerIdentifier; > if (!userContentControllerIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*identifier), WTFMove(*pageGroupID), makeObjectIdentifier<UserContentControllerIdentifierType>(*userContentControllerIdentifier) }}; > } >diff --git a/Source/WebKit/Shared/WebPageGroupData.h b/Source/WebKit/Shared/WebPageGroupData.h >index 79eae45ea0dd930423251f8007b01bcbc2e5f5f8..adac49ee8591d25e8d42dcbc0f8a8a85f6332038 100644 >--- a/Source/WebKit/Shared/WebPageGroupData.h >+++ b/Source/WebKit/Shared/WebPageGroupData.h >@@ -37,7 +37,7 @@ namespace WebKit { > > struct WebPageGroupData { > void encode(IPC::Encoder&) const; >- static std::optional<WebPageGroupData> decode(IPC::Decoder&); >+ static WTF::Optional<WebPageGroupData> decode(IPC::Decoder&); > > String identifier; > uint64_t pageGroupID; >diff --git a/Source/WebKit/Shared/WebPlatformTouchPoint.cpp b/Source/WebKit/Shared/WebPlatformTouchPoint.cpp >index 2355fca00ec03dab869e337a64eba3173193cad7..762501ae2989a7a765bd2c5332caa15852e51a92 100644 >--- a/Source/WebKit/Shared/WebPlatformTouchPoint.cpp >+++ b/Source/WebKit/Shared/WebPlatformTouchPoint.cpp >@@ -65,23 +65,23 @@ void WebPlatformTouchPoint::encode(IPC::Encoder& encoder) const > encoder << m_force; > } > >-std::optional<WebPlatformTouchPoint> WebPlatformTouchPoint::decode(IPC::Decoder& decoder) >+WTF::Optional<WebPlatformTouchPoint> WebPlatformTouchPoint::decode(IPC::Decoder& decoder) > { > WebPlatformTouchPoint result; > if (!decoder.decode(result.m_id)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_state)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_screenPosition)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_position)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_radius)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_rotationAngle)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_force)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >diff --git a/Source/WebKit/Shared/WebPopupItem.cpp b/Source/WebKit/Shared/WebPopupItem.cpp >index 19073e7abbf751483d7af8b94b351229b10743b0..eea8eb764a64df4d35a3032ebd97ba862807fffc 100644 >--- a/Source/WebKit/Shared/WebPopupItem.cpp >+++ b/Source/WebKit/Shared/WebPopupItem.cpp >@@ -76,43 +76,43 @@ void WebPopupItem::encode(IPC::Encoder& encoder) const > encoder << m_isSelected; > } > >-std::optional<WebPopupItem> WebPopupItem::decode(IPC::Decoder& decoder) >+WTF::Optional<WebPopupItem> WebPopupItem::decode(IPC::Decoder& decoder) > { > Type type; > if (!decoder.decodeEnum(type)) >- return std::nullopt; >+ return WTF::nullopt; > > String text; > if (!decoder.decode(text)) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::TextDirection textDirection; > if (!decoder.decodeEnum(textDirection)) >- return std::nullopt; >+ return WTF::nullopt; > > bool hasTextDirectionOverride; > if (!decoder.decode(hasTextDirectionOverride)) >- return std::nullopt; >+ return WTF::nullopt; > > String toolTip; > if (!decoder.decode(toolTip)) >- return std::nullopt; >+ return WTF::nullopt; > > String accessibilityText; > if (!decoder.decode(accessibilityText)) >- return std::nullopt; >+ return WTF::nullopt; > > bool isEnabled; > if (!decoder.decode(isEnabled)) >- return std::nullopt; >+ return WTF::nullopt; > > bool isLabel; > if (!decoder.decode(isLabel)) >- return std::nullopt; >+ return WTF::nullopt; > > bool isSelected; > if (!decoder.decode(isSelected)) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel, isSelected }}; > } >diff --git a/Source/WebKit/Shared/WebPopupItem.h b/Source/WebKit/Shared/WebPopupItem.h >index 7a51454ad268e693762cd48ce02bea06c5f558ca..b30063578932758aa41d4712344054b65df3642b 100644 >--- a/Source/WebKit/Shared/WebPopupItem.h >+++ b/Source/WebKit/Shared/WebPopupItem.h >@@ -46,7 +46,7 @@ struct WebPopupItem { > WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel, bool isSelected); > > void encode(IPC::Encoder&) const; >- static std::optional<WebPopupItem> decode(IPC::Decoder&); >+ static WTF::Optional<WebPopupItem> decode(IPC::Decoder&); > > Type m_type; > String m_text; >diff --git a/Source/WebKit/Shared/WebPreferencesStore.cpp b/Source/WebKit/Shared/WebPreferencesStore.cpp >index 67a068782f133ac1706226ecedcdb5100c32cda4..7159b82cdf5fb1d199a033715f0e752b8061dcd4 100644 >--- a/Source/WebKit/Shared/WebPreferencesStore.cpp >+++ b/Source/WebKit/Shared/WebPreferencesStore.cpp >@@ -52,13 +52,13 @@ void WebPreferencesStore::encode(IPC::Encoder& encoder) const > > bool WebPreferencesStore::decode(IPC::Decoder& decoder, WebPreferencesStore& result) > { >- std::optional<HashMap<String, Value>> values; >+ WTF::Optional<HashMap<String, Value>> values; > decoder >> values; > if (!values) > return false; > result.m_values = WTFMove(*values); > >- std::optional<HashMap<String, Value>> overriddenDefaults; >+ WTF::Optional<HashMap<String, Value>> overriddenDefaults; > decoder >> overriddenDefaults; > if (!overriddenDefaults) > return false; >diff --git a/Source/WebKit/Shared/WebProcessCreationParameters.cpp b/Source/WebKit/Shared/WebProcessCreationParameters.cpp >index 475f208a949f2abc424611244cfe271d0e17325d..69e5f3a7b886563f5c0f9e6c8f3b81eac2683a3e 100644 >--- a/Source/WebKit/Shared/WebProcessCreationParameters.cpp >+++ b/Source/WebKit/Shared/WebProcessCreationParameters.cpp >@@ -167,13 +167,13 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > if (!decoder.decode(parameters.injectedBundlePath)) > return false; > >- std::optional<SandboxExtension::Handle> injectedBundlePathExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> injectedBundlePathExtensionHandle; > decoder >> injectedBundlePathExtensionHandle; > if (!injectedBundlePathExtensionHandle) > return false; > parameters.injectedBundlePathExtensionHandle = WTFMove(*injectedBundlePathExtensionHandle); > >- std::optional<SandboxExtension::HandleArray> additionalSandboxExtensionHandles; >+ WTF::Optional<SandboxExtension::HandleArray> additionalSandboxExtensionHandles; > decoder >> additionalSandboxExtensionHandles; > if (!additionalSandboxExtensionHandles) > return false; >@@ -185,7 +185,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > if (!decoder.decode(parameters.applicationCacheFlatFileSubdirectoryName)) > return false; > >- std::optional<SandboxExtension::Handle> applicationCacheDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> applicationCacheDirectoryExtensionHandle; > decoder >> applicationCacheDirectoryExtensionHandle; > if (!applicationCacheDirectoryExtensionHandle) > return false; >@@ -194,7 +194,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > if (!decoder.decode(parameters.webSQLDatabaseDirectory)) > return false; > >- std::optional<SandboxExtension::Handle> webSQLDatabaseDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> webSQLDatabaseDirectoryExtensionHandle; > decoder >> webSQLDatabaseDirectoryExtensionHandle; > if (!webSQLDatabaseDirectoryExtensionHandle) > return false; >@@ -203,7 +203,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > if (!decoder.decode(parameters.mediaCacheDirectory)) > return false; > >- std::optional<SandboxExtension::Handle> mediaCacheDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> mediaCacheDirectoryExtensionHandle; > decoder >> mediaCacheDirectoryExtensionHandle; > if (!mediaCacheDirectoryExtensionHandle) > return false; >@@ -212,7 +212,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > if (!decoder.decode(parameters.javaScriptConfigurationDirectory)) > return false; > >- std::optional<SandboxExtension::Handle> javaScriptConfigurationDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> javaScriptConfigurationDirectoryExtensionHandle; > decoder >> javaScriptConfigurationDirectoryExtensionHandle; > if (!javaScriptConfigurationDirectoryExtensionHandle) > return false; >@@ -220,19 +220,19 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > > #if PLATFORM(IOS_FAMILY) > >- std::optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle; > decoder >> cookieStorageDirectoryExtensionHandle; > if (!cookieStorageDirectoryExtensionHandle) > return false; > parameters.cookieStorageDirectoryExtensionHandle = WTFMove(*cookieStorageDirectoryExtensionHandle); > >- std::optional<SandboxExtension::Handle> containerCachesDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> containerCachesDirectoryExtensionHandle; > decoder >> containerCachesDirectoryExtensionHandle; > if (!containerCachesDirectoryExtensionHandle) > return false; > parameters.containerCachesDirectoryExtensionHandle = WTFMove(*containerCachesDirectoryExtensionHandle); > >- std::optional<SandboxExtension::Handle> containerTemporaryDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> containerTemporaryDirectoryExtensionHandle; > decoder >> containerTemporaryDirectoryExtensionHandle; > if (!containerTemporaryDirectoryExtensionHandle) > return false; >@@ -246,7 +246,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > if (!decoder.decode(parameters.webKitLoggingChannels)) > return false; > >- std::optional<SandboxExtension::Handle> mediaKeyStorageDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> mediaKeyStorageDirectoryExtensionHandle; > decoder >> mediaKeyStorageDirectoryExtensionHandle; > if (!mediaKeyStorageDirectoryExtensionHandle) > return false; >@@ -254,7 +254,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > > #if ENABLE(MEDIA_STREAM) > >- std::optional<SandboxExtension::Handle> audioCaptureExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> audioCaptureExtensionHandle; > decoder >> audioCaptureExtensionHandle; > if (!audioCaptureExtensionHandle) > return false; >@@ -337,7 +337,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > if (!decoder.decode(parameters.uiProcessBundleResourcePath)) > return false; > >- std::optional<SandboxExtension::Handle> uiProcessBundleResourcePathExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> uiProcessBundleResourcePathExtensionHandle; > decoder >> uiProcessBundleResourcePathExtensionHandle; > if (!uiProcessBundleResourcePathExtensionHandle) > return false; >@@ -415,7 +415,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat > #endif > > #if PLATFORM(MAC) >- std::optional<WebCore::ScreenProperties> screenProperties; >+ WTF::Optional<WebCore::ScreenProperties> screenProperties; > decoder >> screenProperties; > if (!screenProperties) > return false; >diff --git a/Source/WebKit/Shared/WebUserContentControllerDataTypes.cpp b/Source/WebKit/Shared/WebUserContentControllerDataTypes.cpp >index 10b3c99d3c7992bf05f5376bdfb3d968a4dde3ae..3174def85539c9b8e4293272bb0258d7da58ebc8 100644 >--- a/Source/WebKit/Shared/WebUserContentControllerDataTypes.cpp >+++ b/Source/WebKit/Shared/WebUserContentControllerDataTypes.cpp >@@ -37,21 +37,21 @@ void WebUserScriptData::encode(IPC::Encoder& encoder) const > encoder << userScript; > } > >-std::optional<WebUserScriptData> WebUserScriptData::decode(IPC::Decoder& decoder) >+WTF::Optional<WebUserScriptData> WebUserScriptData::decode(IPC::Decoder& decoder) > { >- std::optional<uint64_t> identifier; >+ WTF::Optional<uint64_t> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> worldIdentifier; >+ WTF::Optional<uint64_t> worldIdentifier; > decoder >> worldIdentifier; > if (!worldIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::UserScript userScript; > if (!decoder.decode(userScript)) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*identifier), WTFMove(*worldIdentifier), WTFMove(userScript) }}; > } >@@ -63,21 +63,21 @@ void WebUserStyleSheetData::encode(IPC::Encoder& encoder) const > encoder << userStyleSheet; > } > >-std::optional<WebUserStyleSheetData> WebUserStyleSheetData::decode(IPC::Decoder& decoder) >+WTF::Optional<WebUserStyleSheetData> WebUserStyleSheetData::decode(IPC::Decoder& decoder) > { >- std::optional<uint64_t> identifier; >+ WTF::Optional<uint64_t> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> worldIdentifier; >+ WTF::Optional<uint64_t> worldIdentifier; > decoder >> worldIdentifier; > if (!worldIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::UserStyleSheet userStyleSheet; > if (!decoder.decode(userStyleSheet)) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*identifier), WTFMove(*worldIdentifier), WTFMove(userStyleSheet) }}; > } >@@ -90,22 +90,22 @@ void WebScriptMessageHandlerData::encode(IPC::Encoder& encoder) const > encoder << name; > } > >-std::optional<WebScriptMessageHandlerData> WebScriptMessageHandlerData::decode(IPC::Decoder& decoder) >+WTF::Optional<WebScriptMessageHandlerData> WebScriptMessageHandlerData::decode(IPC::Decoder& decoder) > { >- std::optional<uint64_t> identifier; >+ WTF::Optional<uint64_t> identifier; > decoder >> identifier; > if (!identifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<uint64_t> worldIdentifier; >+ WTF::Optional<uint64_t> worldIdentifier; > decoder >> worldIdentifier; > if (!worldIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> name; >+ WTF::Optional<String> name; > decoder >> name; > if (!name) >- return std::nullopt; >+ return WTF::nullopt; > > return {{ WTFMove(*identifier), WTFMove(*worldIdentifier), WTFMove(*name) }}; > } >diff --git a/Source/WebKit/Shared/WebUserContentControllerDataTypes.h b/Source/WebKit/Shared/WebUserContentControllerDataTypes.h >index 5293c4335e61299c90226505848f858f22de6322..f1e73902549b91a76523f7706eb1c065bb755720 100644 >--- a/Source/WebKit/Shared/WebUserContentControllerDataTypes.h >+++ b/Source/WebKit/Shared/WebUserContentControllerDataTypes.h >@@ -37,7 +37,7 @@ namespace WebKit { > > struct WebUserScriptData { > void encode(IPC::Encoder&) const; >- static std::optional<WebUserScriptData> decode(IPC::Decoder&); >+ static WTF::Optional<WebUserScriptData> decode(IPC::Decoder&); > > uint64_t identifier; > uint64_t worldIdentifier; >@@ -46,7 +46,7 @@ struct WebUserScriptData { > > struct WebUserStyleSheetData { > void encode(IPC::Encoder&) const; >- static std::optional<WebUserStyleSheetData> decode(IPC::Decoder&); >+ static WTF::Optional<WebUserStyleSheetData> decode(IPC::Decoder&); > > uint64_t identifier; > uint64_t worldIdentifier; >@@ -55,7 +55,7 @@ struct WebUserStyleSheetData { > > struct WebScriptMessageHandlerData { > void encode(IPC::Encoder&) const; >- static std::optional<WebScriptMessageHandlerData> decode(IPC::Decoder&); >+ static WTF::Optional<WebScriptMessageHandlerData> decode(IPC::Decoder&); > > uint64_t identifier; > uint64_t worldIdentifier; >diff --git a/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp b/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp >index bf014a69ddf26293d9619cfc745ea042df36eaad..f80f525563fce4c421bbb09b189c1870549e7c99 100644 >--- a/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp >+++ b/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp >@@ -39,21 +39,21 @@ void WebsiteData::Entry::encode(IPC::Encoder& encoder) const > encoder << size; > } > >-auto WebsiteData::Entry::decode(IPC::Decoder& decoder) -> std::optional<Entry> >+auto WebsiteData::Entry::decode(IPC::Decoder& decoder) -> WTF::Optional<Entry> > { > Entry result; > >- std::optional<WebCore::SecurityOriginData> securityOriginData; >+ WTF::Optional<WebCore::SecurityOriginData> securityOriginData; > decoder >> securityOriginData; > if (!securityOriginData) >- return std::nullopt; >+ return WTF::nullopt; > result.origin = WTFMove(*securityOriginData); > > if (!decoder.decodeEnum(result.type)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(result.size)) >- return std::nullopt; >+ return WTF::nullopt; > > return WTFMove(result); > } >diff --git a/Source/WebKit/Shared/WebsiteData/WebsiteData.h b/Source/WebKit/Shared/WebsiteData/WebsiteData.h >index df1ef8bb3cac12e7c120826b8700f738c6829294..fbdd4f0c45ca53443c3a460cd93dcb0a4fd98480 100644 >--- a/Source/WebKit/Shared/WebsiteData/WebsiteData.h >+++ b/Source/WebKit/Shared/WebsiteData/WebsiteData.h >@@ -46,7 +46,7 @@ struct WebsiteData { > uint64_t size; > > void encode(IPC::Encoder&) const; >- static std::optional<WebsiteData::Entry> decode(IPC::Decoder&); >+ static WTF::Optional<WebsiteData::Entry> decode(IPC::Decoder&); > }; > > Vector<Entry> entries; >diff --git a/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp b/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp >index a50152758031b3c2aa29274e2431eb769fbccd8b..40792b0aedfd95bfa207549bf174feaec4be0986 100644 >--- a/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp >+++ b/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp >@@ -51,59 +51,59 @@ void WebsiteDataStoreParameters::encode(IPC::Encoder& encoder) const > #endif > } > >-std::optional<WebsiteDataStoreParameters> WebsiteDataStoreParameters::decode(IPC::Decoder& decoder) >+WTF::Optional<WebsiteDataStoreParameters> WebsiteDataStoreParameters::decode(IPC::Decoder& decoder) > { > WebsiteDataStoreParameters parameters; > >- std::optional<NetworkSessionCreationParameters> networkSessionParameters; >+ WTF::Optional<NetworkSessionCreationParameters> networkSessionParameters; > decoder >> networkSessionParameters; > if (!networkSessionParameters) >- return std::nullopt; >+ return WTF::nullopt; > parameters.networkSessionParameters = WTFMove(*networkSessionParameters); > >- std::optional<Vector<uint8_t>> uiProcessCookieStorageIdentifier; >+ WTF::Optional<Vector<uint8_t>> uiProcessCookieStorageIdentifier; > decoder >> uiProcessCookieStorageIdentifier; > if (!uiProcessCookieStorageIdentifier) >- return std::nullopt; >+ return WTF::nullopt; > parameters.uiProcessCookieStorageIdentifier = WTFMove(*uiProcessCookieStorageIdentifier); > >- std::optional<SandboxExtension::Handle> cookieStoragePathExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> cookieStoragePathExtensionHandle; > decoder >> cookieStoragePathExtensionHandle; > if (!cookieStoragePathExtensionHandle) >- return std::nullopt; >+ return WTF::nullopt; > parameters.cookieStoragePathExtensionHandle = WTFMove(*cookieStoragePathExtensionHandle); > >- std::optional<Vector<WebCore::Cookie>> pendingCookies; >+ WTF::Optional<Vector<WebCore::Cookie>> pendingCookies; > decoder >> pendingCookies; > if (!pendingCookies) >- return std::nullopt; >+ return WTF::nullopt; > parameters.pendingCookies = WTFMove(*pendingCookies); > > #if ENABLE(INDEXED_DATABASE) >- std::optional<String> indexedDatabaseDirectory; >+ WTF::Optional<String> indexedDatabaseDirectory; > decoder >> indexedDatabaseDirectory; > if (!indexedDatabaseDirectory) >- return std::nullopt; >+ return WTF::nullopt; > parameters.indexedDatabaseDirectory = WTFMove(*indexedDatabaseDirectory); > >- std::optional<SandboxExtension::Handle> indexedDatabaseDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> indexedDatabaseDirectoryExtensionHandle; > decoder >> indexedDatabaseDirectoryExtensionHandle; > if (!indexedDatabaseDirectoryExtensionHandle) >- return std::nullopt; >+ return WTF::nullopt; > parameters.indexedDatabaseDirectoryExtensionHandle = WTFMove(*indexedDatabaseDirectoryExtensionHandle); > #endif > > #if ENABLE(SERVICE_WORKER) >- std::optional<String> serviceWorkerRegistrationDirectory; >+ WTF::Optional<String> serviceWorkerRegistrationDirectory; > decoder >> serviceWorkerRegistrationDirectory; > if (!serviceWorkerRegistrationDirectory) >- return std::nullopt; >+ return WTF::nullopt; > parameters.serviceWorkerRegistrationDirectory = WTFMove(*serviceWorkerRegistrationDirectory); > >- std::optional<SandboxExtension::Handle> serviceWorkerRegistrationDirectoryExtensionHandle; >+ WTF::Optional<SandboxExtension::Handle> serviceWorkerRegistrationDirectoryExtensionHandle; > decoder >> serviceWorkerRegistrationDirectoryExtensionHandle; > if (!serviceWorkerRegistrationDirectoryExtensionHandle) >- return std::nullopt; >+ return WTF::nullopt; > parameters.serviceWorkerRegistrationDirectoryExtensionHandle = WTFMove(*serviceWorkerRegistrationDirectoryExtensionHandle); > #endif > >diff --git a/Source/WebKit/Shared/WebsiteDataStoreParameters.h b/Source/WebKit/Shared/WebsiteDataStoreParameters.h >index ff7b0706c10de61bb368428d943da5a6cfb14f34..3e85880463dd0fdaa0e64e43948d8086643c6be8 100644 >--- a/Source/WebKit/Shared/WebsiteDataStoreParameters.h >+++ b/Source/WebKit/Shared/WebsiteDataStoreParameters.h >@@ -49,7 +49,7 @@ struct WebsiteDataStoreParameters { > static WebsiteDataStoreParameters privateSessionParameters(PAL::SessionID); > > void encode(IPC::Encoder&) const; >- static std::optional<WebsiteDataStoreParameters> decode(IPC::Decoder&); >+ static WTF::Optional<WebsiteDataStoreParameters> decode(IPC::Decoder&); > > Vector<uint8_t> uiProcessCookieStorageIdentifier; > SandboxExtension::Handle cookieStoragePathExtensionHandle; >diff --git a/Source/WebKit/Shared/WebsitePoliciesData.cpp b/Source/WebKit/Shared/WebsitePoliciesData.cpp >index df6d3ae2c187da405b548d6774a85d295edada1e..f4dfba403e7668d9d4d8291daa8b6cfb486d38e0 100644 >--- a/Source/WebKit/Shared/WebsitePoliciesData.cpp >+++ b/Source/WebKit/Shared/WebsitePoliciesData.cpp >@@ -45,42 +45,42 @@ void WebsitePoliciesData::encode(IPC::Encoder& encoder) const > encoder << customUserAgent; > } > >-std::optional<WebsitePoliciesData> WebsitePoliciesData::decode(IPC::Decoder& decoder) >+WTF::Optional<WebsitePoliciesData> WebsitePoliciesData::decode(IPC::Decoder& decoder) > { >- std::optional<bool> contentBlockersEnabled; >+ WTF::Optional<bool> contentBlockersEnabled; > decoder >> contentBlockersEnabled; > if (!contentBlockersEnabled) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WebsiteAutoplayPolicy> autoplayPolicy; >+ WTF::Optional<WebsiteAutoplayPolicy> autoplayPolicy; > decoder >> autoplayPolicy; > if (!autoplayPolicy) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<OptionSet<WebsiteAutoplayQuirk>> allowedAutoplayQuirks; >+ WTF::Optional<OptionSet<WebsiteAutoplayQuirk>> allowedAutoplayQuirks; > decoder >> allowedAutoplayQuirks; > if (!allowedAutoplayQuirks) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<WebCore::HTTPHeaderField>> customHeaderFields; >+ WTF::Optional<Vector<WebCore::HTTPHeaderField>> customHeaderFields; > decoder >> customHeaderFields; > if (!customHeaderFields) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<WebsitePopUpPolicy> popUpPolicy; >+ WTF::Optional<WebsitePopUpPolicy> popUpPolicy; > decoder >> popUpPolicy; > if (!popUpPolicy) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<std::optional<WebsiteDataStoreParameters>> websiteDataStoreParameters; >+ WTF::Optional<WTF::Optional<WebsiteDataStoreParameters>> websiteDataStoreParameters; > decoder >> websiteDataStoreParameters; > if (!websiteDataStoreParameters) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> customUserAgent; >+ WTF::Optional<String> customUserAgent; > decoder >> customUserAgent; > if (!customUserAgent) >- return std::nullopt; >+ return WTF::nullopt; > > return { { > WTFMove(*contentBlockersEnabled), >diff --git a/Source/WebKit/Shared/WebsitePoliciesData.h b/Source/WebKit/Shared/WebsitePoliciesData.h >index 7944c466ec60e1637a5a93428a17fa6da64d2427..02e701fba88a511d1bf05b17dda4a7a4dd0078bf 100644 >--- a/Source/WebKit/Shared/WebsitePoliciesData.h >+++ b/Source/WebKit/Shared/WebsitePoliciesData.h >@@ -51,11 +51,11 @@ struct WebsitePoliciesData { > WebsiteAutoplayPolicy autoplayPolicy { WebsiteAutoplayPolicy::Default }; > Vector<WebCore::HTTPHeaderField> customHeaderFields; > WebsitePopUpPolicy popUpPolicy { WebsitePopUpPolicy::Default }; >- std::optional<WebsiteDataStoreParameters> websiteDataStoreParameters; >+ WTF::Optional<WebsiteDataStoreParameters> websiteDataStoreParameters; > String customUserAgent; > > void encode(IPC::Encoder&) const; >- static std::optional<WebsitePoliciesData> decode(IPC::Decoder&); >+ static WTF::Optional<WebsitePoliciesData> decode(IPC::Decoder&); > }; > > } // namespace WebKit >diff --git a/Source/WebKit/Shared/curl/WebCoreArgumentCodersCurl.cpp b/Source/WebKit/Shared/curl/WebCoreArgumentCodersCurl.cpp >index 9de3978d66af25ac29dfb6c6a46c1520dd609430..1e96c38f9c1c90a69e083e50349d24e22dc08bd4 100644 >--- a/Source/WebKit/Shared/curl/WebCoreArgumentCodersCurl.cpp >+++ b/Source/WebKit/Shared/curl/WebCoreArgumentCodersCurl.cpp >@@ -190,22 +190,22 @@ void ArgumentCoder<CurlProxySettings>::encode(Encoder& encoder, const CurlProxyS > encoder << settings.ignoreHosts(); > } > >-std::optional<CurlProxySettings> ArgumentCoder<CurlProxySettings>::decode(Decoder& decoder) >+WTF::Optional<CurlProxySettings> ArgumentCoder<CurlProxySettings>::decode(Decoder& decoder) > { > CurlProxySettings::Mode mode; > if (!decoder.decode(mode)) >- return std::nullopt; >+ return WTF::nullopt; > > if (mode != CurlProxySettings::Mode::Custom) > return CurlProxySettings { mode }; > > URL url; > if (!decoder.decode(url)) >- return std::nullopt; >+ return WTF::nullopt; > > String ignoreHosts; > if (!decoder.decode(ignoreHosts)) >- return std::nullopt; >+ return WTF::nullopt; > > return CurlProxySettings { WTFMove(url), WTFMove(ignoreHosts) }; > } >diff --git a/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm b/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm >index d0aa85196cd75ed98fdb9714ad4e63f606bf09ed..8e7b18b6724762dbba5bdf2c2f11462926116ecc 100644 >--- a/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm >+++ b/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm >@@ -150,7 +150,7 @@ bool InteractionInformationAtPosition::decode(IPC::Decoder& decoder, Interaction > if (!decoder.decode(result.textAfter)) > return false; > >- std::optional<WebCore::TextIndicatorData> linkIndicator; >+ WTF::Optional<WebCore::TextIndicatorData> linkIndicator; > decoder >> linkIndicator; > if (!linkIndicator) > return false; >diff --git a/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp b/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp >index 47dd9a05fd31e0230d84304eb44f73e934f61163..3f3c0639c8af411f96cd440ff8a30e4b90831da3 100644 >--- a/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp >+++ b/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp >@@ -49,30 +49,30 @@ void WebPlatformTouchPoint::encode(IPC::Encoder& encoder) const > #endif > } > >-std::optional<WebPlatformTouchPoint> WebPlatformTouchPoint::decode(IPC::Decoder& decoder) >+WTF::Optional<WebPlatformTouchPoint> WebPlatformTouchPoint::decode(IPC::Decoder& decoder) > { > WebPlatformTouchPoint result; > if (!decoder.decode(result.m_identifier)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_location)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_phase)) >- return std::nullopt; >+ return WTF::nullopt; > #if ENABLE(IOS_TOUCH_EVENTS) > if (!decoder.decode(result.m_radiusX)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_radiusY)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_rotationAngle)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_force)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_altitudeAngle)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_azimuthAngle)) >- return std::nullopt; >+ return WTF::nullopt; > if (!decoder.decode(result.m_touchType)) >- return std::nullopt; >+ return WTF::nullopt; > #endif > return WTFMove(result); > } >diff --git a/Source/WebKit/Shared/mac/ChildProcessMac.mm b/Source/WebKit/Shared/mac/ChildProcessMac.mm >index 756dacf6c0cab94f285e6c0d05dadb996bfa73a8..08c44bf285d6622ac86d0270ed64d184c8fd983c 100644 >--- a/Source/WebKit/Shared/mac/ChildProcessMac.mm >+++ b/Source/WebKit/Shared/mac/ChildProcessMac.mm >@@ -193,12 +193,12 @@ static OSStatus enableSandboxStyleFileQuarantine() > } > > #if USE(CACHE_COMPILED_SANDBOX) >-static std::optional<Vector<char>> fileContents(const String& path, bool shouldLock = false, OptionSet<FileSystem::FileLockMode> lockMode = FileSystem::FileLockMode::Exclusive) >+static WTF::Optional<Vector<char>> fileContents(const String& path, bool shouldLock = false, OptionSet<FileSystem::FileLockMode> lockMode = FileSystem::FileLockMode::Exclusive) > { > FileHandle file = shouldLock ? FileHandle(path, FileSystem::FileOpenMode::Read, lockMode) : FileHandle(path, FileSystem::FileOpenMode::Read); > file.open(); > if (!file) >- return std::nullopt; >+ return WTF::nullopt; > > char chunk[4096]; > constexpr size_t chunkSize = WTF_ARRAY_LENGTH(chunk); >@@ -230,7 +230,7 @@ constexpr const char* processStorageClass(ChildProcess::ProcessType type) > } > #endif // USE(APPLE_INTERNAL_SDK) > >-static std::optional<CString> setAndSerializeSandboxParameters(const SandboxInitializationParameters& initializationParameters, const SandboxParametersPtr& sandboxParameters, const String& profileOrProfilePath, bool isProfilePath) >+static WTF::Optional<CString> setAndSerializeSandboxParameters(const SandboxInitializationParameters& initializationParameters, const SandboxParametersPtr& sandboxParameters, const String& profileOrProfilePath, bool isProfilePath) > { > StringBuilder builder; > for (size_t i = 0; i < initializationParameters.count(); ++i) { >@@ -248,7 +248,7 @@ static std::optional<CString> setAndSerializeSandboxParameters(const SandboxInit > if (isProfilePath) { > auto contents = fileContents(profileOrProfilePath); > if (!contents) >- return std::nullopt; >+ return WTF::nullopt; > builder.append(contents->data(), contents->size()); > } else > builder.append(profileOrProfilePath); >diff --git a/Source/WebKit/Shared/mac/ObjCObjectGraph.mm b/Source/WebKit/Shared/mac/ObjCObjectGraph.mm >index 47eec8735804cc969ca70b6bb01b6f6125bab0b7..4c817c86ec99a46c6f82b664f298c0c60693e09b 100644 >--- a/Source/WebKit/Shared/mac/ObjCObjectGraph.mm >+++ b/Source/WebKit/Shared/mac/ObjCObjectGraph.mm >@@ -113,7 +113,7 @@ enum class ObjCType { > #endif > }; > >-static std::optional<ObjCType> typeFromObject(id object) >+static WTF::Optional<ObjCType> typeFromObject(id object) > { > ASSERT(object); > >@@ -139,7 +139,7 @@ static std::optional<ObjCType> typeFromObject(id object) > ALLOW_DEPRECATED_DECLARATIONS_END > #endif > >- return std::nullopt; >+ return WTF::nullopt; > } > > void ObjCObjectGraph::encode(IPC::Encoder& encoder, id object) >diff --git a/Source/WebKit/Shared/mac/PDFContextMenu.h b/Source/WebKit/Shared/mac/PDFContextMenu.h >index 7b27411906c5dec57cc7a665d0388584eaabc5d7..2a63a8b52a3cfcb89f489b8222ff437bf6403083 100644 >--- a/Source/WebKit/Shared/mac/PDFContextMenu.h >+++ b/Source/WebKit/Shared/mac/PDFContextMenu.h >@@ -41,37 +41,37 @@ struct PDFContextMenuItem { > encoder << title << enabled << separator << state << hasAction << tag; > } > >- template<class Decoder> static std::optional<PDFContextMenuItem> decode(Decoder& decoder) >+ template<class Decoder> static WTF::Optional<PDFContextMenuItem> decode(Decoder& decoder) > { >- std::optional<String> title; >+ WTF::Optional<String> title; > decoder >> title; > if (!title) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> enabled; >+ WTF::Optional<bool> enabled; > decoder >> enabled; > if (!enabled) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> separator; >+ WTF::Optional<bool> separator; > decoder >> separator; > if (!separator) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> state; >+ WTF::Optional<int> state; > decoder >> state; > if (!state) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<bool> hasAction; >+ WTF::Optional<bool> hasAction; > decoder >> hasAction; > if (!hasAction) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<int> tag; >+ WTF::Optional<int> tag; > decoder >> tag; > if (!tag) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*title), WTFMove(*enabled), WTFMove(*separator), WTFMove(*state), WTFMove(*hasAction), WTFMove(*tag) } }; > } >@@ -86,17 +86,17 @@ struct PDFContextMenu { > encoder << m_point << m_items; > } > >- template<class Decoder> static std::optional<PDFContextMenu> decode(Decoder& decoder) >+ template<class Decoder> static WTF::Optional<PDFContextMenu> decode(Decoder& decoder) > { >- std::optional<WebCore::IntPoint> point; >+ WTF::Optional<WebCore::IntPoint> point; > decoder >> point; > if (!point) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<Vector<PDFContextMenuItem>> items; >+ WTF::Optional<Vector<PDFContextMenuItem>> items; > decoder >> items; > if (!items) >- return std::nullopt; >+ return WTF::nullopt; > > return { { WTFMove(*point), WTFMove(*items) } }; > } >diff --git a/Source/WebKit/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit/Shared/mac/SandboxExtensionMac.mm >index 3f23ad24662c348697c2703a59ea66f204a8ef37..cb258b84d3de999aee625641810f7500a5abd72c 100644 >--- a/Source/WebKit/Shared/mac/SandboxExtensionMac.mm >+++ b/Source/WebKit/Shared/mac/SandboxExtensionMac.mm >@@ -134,11 +134,11 @@ void SandboxExtension::Handle::encode(IPC::Encoder& encoder) const > m_sandboxExtension = 0; > } > >-auto SandboxExtension::Handle::decode(IPC::Decoder& decoder) -> std::optional<Handle> >+auto SandboxExtension::Handle::decode(IPC::Decoder& decoder) -> WTF::Optional<Handle> > { > IPC::DataReference dataReference; > if (!decoder.decode(dataReference)) >- return std::nullopt; >+ return WTF::nullopt; > > if (dataReference.isEmpty()) > return {{ }}; >@@ -190,19 +190,19 @@ void SandboxExtension::HandleArray::encode(IPC::Encoder& encoder) const > encoder << handle; > } > >-std::optional<SandboxExtension::HandleArray> SandboxExtension::HandleArray::decode(IPC::Decoder& decoder) >+WTF::Optional<SandboxExtension::HandleArray> SandboxExtension::HandleArray::decode(IPC::Decoder& decoder) > { >- std::optional<uint64_t> size; >+ WTF::Optional<uint64_t> size; > decoder >> size; > if (!size) >- return std::nullopt; >+ return WTF::nullopt; > SandboxExtension::HandleArray handles; > handles.allocate(*size); > for (size_t i = 0; i < *size; ++i) { >- std::optional<SandboxExtension::Handle> handle; >+ WTF::Optional<SandboxExtension::Handle> handle; > decoder >> handle; > if (!handle) >- return std::nullopt; >+ return WTF::nullopt; > handles[i] = WTFMove(*handle); > } > return WTFMove(handles); >diff --git a/Source/WebKit/Shared/mac/SecItemShim.cpp b/Source/WebKit/Shared/mac/SecItemShim.cpp >index 5384dbcd59568955eba5817e21e24f61c07ef341..d6bc05ee98f027a17451901c2ac3075288c3f138 100644 >--- a/Source/WebKit/Shared/mac/SecItemShim.cpp >+++ b/Source/WebKit/Shared/mac/SecItemShim.cpp >@@ -72,9 +72,9 @@ static WorkQueue& workQueue() > return *workQueue; > } > >-static std::optional<SecItemResponseData> sendSecItemRequest(SecItemRequestData::Type requestType, CFDictionaryRef query, CFDictionaryRef attributesToMatch = 0) >+static WTF::Optional<SecItemResponseData> sendSecItemRequest(SecItemRequestData::Type requestType, CFDictionaryRef query, CFDictionaryRef attributesToMatch = 0) > { >- std::optional<SecItemResponseData> response; >+ WTF::Optional<SecItemResponseData> response; > > BinarySemaphore semaphore; > >diff --git a/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm >index 5fda7bf66c9c224c2295738e848e1debfbcce42d..c76a00a0292fedba3150d5bb48d1786f1bfe2dec 100644 >--- a/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm >+++ b/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm >@@ -533,17 +533,17 @@ void ArgumentCoder<WebCore::KeypressCommand>::encode(Encoder& encoder, const Web > encoder << keypressCommand.commandName << keypressCommand.text; > } > >-std::optional<WebCore::KeypressCommand> ArgumentCoder<WebCore::KeypressCommand>::decode(Decoder& decoder) >+WTF::Optional<WebCore::KeypressCommand> ArgumentCoder<WebCore::KeypressCommand>::decode(Decoder& decoder) > { >- std::optional<String> commandName; >+ WTF::Optional<String> commandName; > decoder >> commandName; > if (!commandName) >- return std::nullopt; >+ return WTF::nullopt; > >- std::optional<String> text; >+ WTF::Optional<String> text; > decoder >> text; > if (!text) >- return std::nullopt; >+ return WTF::nullopt; > > WebCore::KeypressCommand command; > command.commandName = WTFMove(*commandName); >diff --git a/Source/WebKit/Shared/mac/WebHitTestResultData.mm b/Source/WebKit/Shared/mac/WebHitTestResultData.mm >index 5881343e8b500416f52d5dfc7427ce4186d549d5..aaa5e9d686ec7bcd36ea756a0add83c4b272d9c9 100644 >--- a/Source/WebKit/Shared/mac/WebHitTestResultData.mm >+++ b/Source/WebKit/Shared/mac/WebHitTestResultData.mm >@@ -83,7 +83,7 @@ bool WebHitTestResultData::platformDecode(IPC::Decoder& decoder, WebHitTestResul > return false; > > if (hasDetectedDataTextIndicator) { >- std::optional<WebCore::TextIndicatorData> indicatorData; >+ WTF::Optional<WebCore::TextIndicatorData> indicatorData; > decoder >> indicatorData; > if (!indicatorData) > return false; >diff --git a/Source/WebKit/UIProcess/API/APIAttachment.cpp b/Source/WebKit/UIProcess/API/APIAttachment.cpp >index cf4c62e79279feb0cebd21d03b43bfd9016dd72a..4e2bc13af1313c5935bebe45914593ddb940e40d 100644 >--- a/Source/WebKit/UIProcess/API/APIAttachment.cpp >+++ b/Source/WebKit/UIProcess/API/APIAttachment.cpp >@@ -91,9 +91,9 @@ WTF::String Attachment::fileName() const > return { }; > } > >-std::optional<uint64_t> Attachment::fileSizeForDisplay() const >+WTF::Optional<uint64_t> Attachment::fileSizeForDisplay() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > > RefPtr<WebCore::SharedBuffer> Attachment::enclosingImageData() const >diff --git a/Source/WebKit/UIProcess/API/APIAttachment.h b/Source/WebKit/UIProcess/API/APIAttachment.h >index 75a6bde65a5ad1af098a2092cdc1654377fbbae4..5f181b29f86acbde716dc393cae97c7727734f8d 100644 >--- a/Source/WebKit/UIProcess/API/APIAttachment.h >+++ b/Source/WebKit/UIProcess/API/APIAttachment.h >@@ -82,7 +82,7 @@ public: > bool isEmpty() const; > > RefPtr<WebCore::SharedBuffer> enclosingImageData() const; >- std::optional<uint64_t> fileSizeForDisplay() const; >+ WTF::Optional<uint64_t> fileSizeForDisplay() const; > > void setHasEnclosingImage(bool hasEnclosingImage) { m_hasEnclosingImage = hasEnclosingImage; } > bool hasEnclosingImage() const { return m_hasEnclosingImage; } >diff --git a/Source/WebKit/UIProcess/API/APIAutomationSessionClient.h b/Source/WebKit/UIProcess/API/APIAutomationSessionClient.h >index 379c8857be94b619555edffec4c3a9a6e1779484..747309272fa37a329083b67fb15975e4d16de1a8 100644 >--- a/Source/WebKit/UIProcess/API/APIAutomationSessionClient.h >+++ b/Source/WebKit/UIProcess/API/APIAutomationSessionClient.h >@@ -63,7 +63,7 @@ public: > virtual void acceptCurrentJavaScriptDialogOnPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&) { } > virtual WTF::String messageOfCurrentJavaScriptDialogOnPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&) { return WTF::String(); } > virtual void setUserInputForCurrentJavaScriptPromptOnPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, const WTF::String&) { } >- virtual std::optional<JavaScriptDialogType> typeOfCurrentJavaScriptDialogOnPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&) { return std::nullopt; } >+ virtual WTF::Optional<JavaScriptDialogType> typeOfCurrentJavaScriptDialogOnPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&) { return WTF::nullopt; } > }; > > } // namespace API >diff --git a/Source/WebKit/UIProcess/API/APINavigation.h b/Source/WebKit/UIProcess/API/APINavigation.h >index f9e71056d04a4afda5657d9fabcc9e07775ffe91..e5e0e70d754ea0acb3c43b56084c19aeb2309360 100644 >--- a/Source/WebKit/UIProcess/API/APINavigation.h >+++ b/Source/WebKit/UIProcess/API/APINavigation.h >@@ -93,14 +93,14 @@ public: > const WebCore::ResourceRequest& originalRequest() const { return m_originalRequest; } > void setCurrentRequest(WebCore::ResourceRequest&&, WebCore::ProcessIdentifier); > const WebCore::ResourceRequest& currentRequest() const { return m_currentRequest; } >- std::optional<WebCore::ProcessIdentifier> currentRequestProcessIdentifier() const { return m_currentRequestProcessIdentifier; } >+ WTF::Optional<WebCore::ProcessIdentifier> currentRequestProcessIdentifier() const { return m_currentRequestProcessIdentifier; } > > bool currentRequestIsRedirect() const { return m_lastNavigationAction.isRedirect; } > > void setTargetItem(WebKit::WebBackForwardListItem& item) { m_targetItem = &item; } > WebKit::WebBackForwardListItem* targetItem() const { return m_targetItem.get(); } > WebKit::WebBackForwardListItem* fromItem() const { return m_fromItem.get(); } >- std::optional<WebCore::FrameLoadType> backForwardFrameLoadType() const { return m_backForwardFrameLoadType; } >+ WTF::Optional<WebCore::FrameLoadType> backForwardFrameLoadType() const { return m_backForwardFrameLoadType; } > > void appendRedirectionURL(const WTF::URL&); > Vector<WTF::URL> takeRedirectChain() { return WTFMove(m_redirectChain); } >@@ -150,12 +150,12 @@ private: > uint64_t m_navigationID; > WebCore::ResourceRequest m_originalRequest; > WebCore::ResourceRequest m_currentRequest; >- std::optional<WebCore::ProcessIdentifier> m_currentRequestProcessIdentifier; >+ WTF::Optional<WebCore::ProcessIdentifier> m_currentRequestProcessIdentifier; > Vector<WTF::URL> m_redirectChain; > > RefPtr<WebKit::WebBackForwardListItem> m_targetItem; > RefPtr<WebKit::WebBackForwardListItem> m_fromItem; >- std::optional<WebCore::FrameLoadType> m_backForwardFrameLoadType; >+ WTF::Optional<WebCore::FrameLoadType> m_backForwardFrameLoadType; > std::unique_ptr<SubstituteData> m_substituteData; > WebKit::NavigationActionData m_lastNavigationAction; > WebKit::FrameInfoData m_originatingFrameInfo; >diff --git a/Source/WebKit/UIProcess/API/APINavigationAction.h b/Source/WebKit/UIProcess/API/APINavigationAction.h >index 30871c7a09554d5cb8a7ed4ab82cbb148cde7874..4866471db84b9c00aac44076fa2cf185515f2b1f 100644 >--- a/Source/WebKit/UIProcess/API/APINavigationAction.h >+++ b/Source/WebKit/UIProcess/API/APINavigationAction.h >@@ -44,7 +44,7 @@ public: > > FrameInfo* sourceFrame() const { return m_sourceFrame.get(); } > FrameInfo* targetFrame() const { return m_targetFrame.get(); } >- std::optional<WTF::String> targetFrameName() const { return m_targetFrameName; } >+ WTF::Optional<WTF::String> targetFrameName() const { return m_targetFrameName; } > > const WebCore::ResourceRequest& request() const { return m_request; } > const WTF::URL& originalURL() const { return !m_originalURL.isNull() ? m_originalURL : m_request.url(); } >@@ -66,7 +66,7 @@ public: > Navigation* mainFrameNavigation() const { return m_mainFrameNavigation.get(); } > > private: >- NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, std::optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WTF::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction, API::Navigation* mainFrameNavigation) >+ NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, WTF::Optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WTF::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction, API::Navigation* mainFrameNavigation) > : m_sourceFrame(sourceFrame) > , m_targetFrame(targetFrame) > , m_targetFrameName(targetFrameName) >@@ -79,14 +79,14 @@ private: > { > } > >- NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, std::optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WTF::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction) >+ NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, WTF::Optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WTF::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction) > : NavigationAction(WTFMove(navigationActionData), sourceFrame, targetFrame, targetFrameName, WTFMove(request), originalURL, shouldOpenAppLinks, WTFMove(userInitiatedAction), nullptr) > { > } > > RefPtr<FrameInfo> m_sourceFrame; > RefPtr<FrameInfo> m_targetFrame; >- std::optional<WTF::String> m_targetFrameName; >+ WTF::Optional<WTF::String> m_targetFrameName; > > WebCore::ResourceRequest m_request; > WTF::URL m_originalURL; >diff --git a/Source/WebKit/UIProcess/API/APIPageConfiguration.h b/Source/WebKit/UIProcess/API/APIPageConfiguration.h >index 67ac5c66d895168c310de053b3a09c01ef067a76..09adbd66c892a001bbb346a12c24b73ec0396954 100644 >--- a/Source/WebKit/UIProcess/API/APIPageConfiguration.h >+++ b/Source/WebKit/UIProcess/API/APIPageConfiguration.h >@@ -95,7 +95,7 @@ public: > bool initialCapitalizationEnabled() { return m_initialCapitalizationEnabled; } > void setInitialCapitalizationEnabled(bool initialCapitalizationEnabled) { m_initialCapitalizationEnabled = initialCapitalizationEnabled; } > >- std::optional<double> cpuLimit() const { return m_cpuLimit; } >+ WTF::Optional<double> cpuLimit() const { return m_cpuLimit; } > void setCPULimit(double cpuLimit) { m_cpuLimit = cpuLimit; } > > bool waitsForPaintAfterViewDidMoveToWindow() const { return m_waitsForPaintAfterViewDidMoveToWindow; } >@@ -147,7 +147,7 @@ private: > bool m_waitsForPaintAfterViewDidMoveToWindow { true }; > bool m_drawsBackground { true }; > bool m_controlledByAutomation { false }; >- std::optional<double> m_cpuLimit; >+ WTF::Optional<double> m_cpuLimit; > > WTF::String m_overrideContentSecurityPolicy; > >diff --git a/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h b/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h >index 9881bd86d58f091aee39facda6936670ce676858..c7566ccf18eacb8273aad40134f636b2edc5cecd 100644 >--- a/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h >+++ b/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h >@@ -212,11 +212,11 @@ private: > bool m_shouldCaptureVideoInUIProcess { false }; > bool m_shouldCaptureDisplayInUIProcess { DEFAULT_CAPTURE_DISPLAY_IN_UI_PROCESS }; > ProcessID m_presentingApplicationPID { getCurrentProcessID() }; >- std::optional<bool> m_processSwapsOnNavigationFromClient; >+ WTF::Optional<bool> m_processSwapsOnNavigationFromClient; > bool m_processSwapsOnNavigationFromExperimentalFeatures { false }; > bool m_alwaysKeepAndReuseSwappedProcesses { false }; > bool m_processSwapsOnWindowOpenWithOpener { false }; >- std::optional<bool> m_isAutomaticProcessWarmingEnabledByClient; >+ WTF::Optional<bool> m_isAutomaticProcessWarmingEnabledByClient; > bool m_clientWouldBenefitFromAutomaticProcessPrewarming { false }; > WTF::String m_customWebContentServiceBundleIdentifier; > bool m_isJITEnabled { true }; >diff --git a/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp b/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp >index f4414425a9d4abfacbba3876fe7c4c29cc45100c..ee38407e1f1a58ed115cddb139f38644b0d5cd41 100644 >--- a/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp >+++ b/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp >@@ -53,7 +53,7 @@ void WebsitePolicies::setWebsiteDataStore(RefPtr<WebsiteDataStore>&& websiteData > > WebKit::WebsitePoliciesData WebsitePolicies::data() > { >- std::optional<WebKit::WebsiteDataStoreParameters> parameters; >+ WTF::Optional<WebKit::WebsiteDataStoreParameters> parameters; > if (m_websiteDataStore) > parameters = m_websiteDataStore->websiteDataStore().parameters(); > return { contentBlockersEnabled(), allowedAutoplayQuirks(), autoplayPolicy(), customHeaderFields(), popUpPolicy(), WTFMove(parameters), m_customUserAgent }; >diff --git a/Source/WebKit/UIProcess/API/C/WKPage.cpp b/Source/WebKit/UIProcess/API/C/WKPage.cpp >index 2537439641b6ffe27e1626155438525150334668..85de07f048508fc1d8f6f6abfbc0f0892e29bae2 100644 >--- a/Source/WebKit/UIProcess/API/C/WKPage.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKPage.cpp >@@ -1473,7 +1473,7 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient > > auto userInitiatedActivity = page.process().userInitiatedActivity(navigationActionData.userGestureTokenIdentifier); > bool shouldOpenAppLinks = !hostsAreEqual(sourceFrameInfo->request().url(), resourceRequest.url()); >- auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, std::nullopt, WTFMove(resourceRequest), URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity)); >+ auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, WTF::nullopt, WTFMove(resourceRequest), URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity)); > > auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures); > >@@ -2690,7 +2690,7 @@ ProcessID WKPageGetProcessIdentifier(WKPageRef page) > void WKPageGetApplicationManifest_b(WKPageRef page, WKPageGetApplicationManifestBlock block) > { > #if ENABLE(APPLICATION_MANIFEST) >- toImpl(page)->getApplicationManifest([block](const std::optional<WebCore::ApplicationManifest> &manifest, CallbackBase::Error) { >+ toImpl(page)->getApplicationManifest([block](const WTF::Optional<WebCore::ApplicationManifest> &manifest, CallbackBase::Error) { > block(); > }); > #else // ENABLE(APPLICATION_MANIFEST) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm b/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >index 29ec69a16bbb73d48a75eef1f718c871b8f05640..42c69b6f0a72e370959f4d171e5d2777d6db45a1 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >@@ -112,13 +112,13 @@ void Attachment::setFileWrapperAndUpdateContentType(NSFileWrapper *fileWrapper, > setFileWrapper(fileWrapper); > } > >-std::optional<uint64_t> Attachment::fileSizeForDisplay() const >+WTF::Optional<uint64_t> Attachment::fileSizeForDisplay() const > { > auto fileWrapper = this->fileWrapper(); > > if (![fileWrapper isRegularFile]) { > // FIXME: We should display a size estimate for directory-type file wrappers. >- return std::nullopt; >+ return WTF::nullopt; > } > > if (auto fileSize = [[fileWrapper fileAttributes][NSFileSize] unsignedLongLongValue]) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index ba2048eabaab68cd733825c64f8b920fab96441e..14cbfd207ffd6b929440012617870440b8607197 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -219,7 +219,7 @@ WKWebView* fromWebPageProxy(WebKit::WebPageProxy& page) > } > > #if PLATFORM(MAC) >-static _WKOverlayScrollbarStyle toAPIScrollbarStyle(std::optional<WebCore::ScrollbarOverlayStyle> coreScrollbarStyle) >+static _WKOverlayScrollbarStyle toAPIScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> coreScrollbarStyle) > { > if (!coreScrollbarStyle) > return _WKOverlayScrollbarStyleAutomatic; >@@ -236,7 +236,7 @@ static _WKOverlayScrollbarStyle toAPIScrollbarStyle(std::optional<WebCore::Scrol > return _WKOverlayScrollbarStyleAutomatic; > } > >-static std::optional<WebCore::ScrollbarOverlayStyle> toCoreScrollbarStyle(_WKOverlayScrollbarStyle scrollbarStyle) >+static WTF::Optional<WebCore::ScrollbarOverlayStyle> toCoreScrollbarStyle(_WKOverlayScrollbarStyle scrollbarStyle) > { > switch (scrollbarStyle) { > case _WKOverlayScrollbarStyleDark: >@@ -248,7 +248,7 @@ static std::optional<WebCore::ScrollbarOverlayStyle> toCoreScrollbarStyle(_WKOve > case _WKOverlayScrollbarStyleAutomatic: > break; > } >- return std::nullopt; >+ return WTF::nullopt; > } > #endif > >@@ -268,7 +268,7 @@ @implementation WKWebView { > > WeakObjCPtr<id <_WKInputDelegate>> _inputDelegate; > >- std::optional<BOOL> _resolutionForShareSheetImmediateCompletionForTesting; >+ WTF::Optional<BOOL> _resolutionForShareSheetImmediateCompletionForTesting; > RetainPtr<WKSafeBrowsingWarning> _safeBrowsingWarning; > > #if PLATFORM(IOS_FAMILY) >@@ -283,10 +283,10 @@ @implementation WKWebView { > > BOOL _overridesViewLayoutSize; > CGSize _viewLayoutSizeOverride; >- std::optional<WebCore::FloatSize> _lastSentViewLayoutSize; >+ WTF::Optional<WebCore::FloatSize> _lastSentViewLayoutSize; > BOOL _overridesMaximumUnobscuredSize; > CGSize _maximumUnobscuredSizeOverride; >- std::optional<WebCore::FloatSize> _lastSentMaximumUnobscuredSize; >+ WTF::Optional<WebCore::FloatSize> _lastSentMaximumUnobscuredSize; > CGRect _inputViewBounds; > CGFloat _viewportMetaTagWidth; > BOOL _viewportMetaTagWidthWasExplicit; >@@ -307,7 +307,7 @@ @implementation WKWebView { > > UIInterfaceOrientation _interfaceOrientationOverride; > BOOL _overridesInterfaceOrientation; >- std::optional<int32_t> _lastSentDeviceOrientation; >+ WTF::Optional<int32_t> _lastSentDeviceOrientation; > > BOOL _allowsViewportShrinkToFit; > >@@ -320,15 +320,15 @@ @implementation WKWebView { > CGFloat _animatedResizeOriginalContentWidth; > RetainPtr<UIView> _resizeAnimationView; > CGFloat _lastAdjustmentForScroller; >- std::optional<CGRect> _frozenVisibleContentRect; >- std::optional<CGRect> _frozenUnobscuredContentRect; >+ WTF::Optional<CGRect> _frozenVisibleContentRect; >+ WTF::Optional<CGRect> _frozenUnobscuredContentRect; > > BOOL _commitDidRestoreScrollPosition; >- std::optional<WebCore::FloatPoint> _scrollOffsetToRestore; >+ WTF::Optional<WebCore::FloatPoint> _scrollOffsetToRestore; > WebCore::FloatBoxExtent _obscuredInsetsWhenSaved; > >- std::optional<WebCore::FloatPoint> _unobscuredCenterToRestore; >- std::optional<uint64_t> _firstTransactionIDAfterPageRestore; >+ WTF::Optional<WebCore::FloatPoint> _unobscuredCenterToRestore; >+ WTF::Optional<uint64_t> _firstTransactionIDAfterPageRestore; > double _scaleToRestore; > > std::unique_ptr<WebKit::ViewGestureController> _gestureController; >@@ -1753,21 +1753,21 @@ - (void)_processWillSwapOrDidExit > _waitingForCommitAfterAnimatedResize = NO; > _animatedResizeOriginalContentWidth = 0; > [_contentView setHidden:NO]; >- _scrollOffsetToRestore = std::nullopt; >- _unobscuredCenterToRestore = std::nullopt; >+ _scrollOffsetToRestore = WTF::nullopt; >+ _unobscuredCenterToRestore = WTF::nullopt; > _scrollViewBackgroundColor = WebCore::Color(); > _delayUpdateVisibleContentRects = NO; > _hadDelayedUpdateVisibleContentRects = NO; > _currentlyAdjustingScrollViewInsetsForKeyboard = NO; >- _lastSentViewLayoutSize = std::nullopt; >- _lastSentMaximumUnobscuredSize = std::nullopt; >- _lastSentDeviceOrientation = std::nullopt; >+ _lastSentViewLayoutSize = WTF::nullopt; >+ _lastSentMaximumUnobscuredSize = WTF::nullopt; >+ _lastSentDeviceOrientation = WTF::nullopt; > >- _frozenVisibleContentRect = std::nullopt; >- _frozenUnobscuredContentRect = std::nullopt; >+ _frozenVisibleContentRect = WTF::nullopt; >+ _frozenUnobscuredContentRect = WTF::nullopt; > > _firstPaintAfterCommitLoadTransactionID = 0; >- _firstTransactionIDAfterPageRestore = std::nullopt; >+ _firstTransactionIDAfterPageRestore = WTF::nullopt; > > _hasScheduledVisibleRectUpdate = NO; > _commitDidRestoreScrollPosition = NO; >@@ -1953,7 +1953,7 @@ - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTree > if (_firstTransactionIDAfterPageRestore && layerTreeTransaction.transactionID() >= _firstTransactionIDAfterPageRestore.value()) { > if (_scrollOffsetToRestore) { > WebCore::FloatPoint scaledScrollOffset = _scrollOffsetToRestore.value(); >- _scrollOffsetToRestore = std::nullopt; >+ _scrollOffsetToRestore = WTF::nullopt; > > if (areEssentiallyEqualAsFloat(contentZoomScale(self), _scaleToRestore)) { > scaledScrollOffset.scale(_scaleToRestore); >@@ -1968,7 +1968,7 @@ - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTree > > if (_unobscuredCenterToRestore) { > WebCore::FloatPoint unobscuredCenterToRestore = _unobscuredCenterToRestore.value(); >- _unobscuredCenterToRestore = std::nullopt; >+ _unobscuredCenterToRestore = WTF::nullopt; > > if (areEssentiallyEqualAsFloat(contentZoomScale(self), _scaleToRestore)) { > CGRect unobscuredRect = UIEdgeInsetsInsetRect(self.bounds, _obscuredInsets); >@@ -1987,7 +1987,7 @@ - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTree > if (_gestureController) > _gestureController->didRestoreScrollPosition(); > >- _firstTransactionIDAfterPageRestore = std::nullopt; >+ _firstTransactionIDAfterPageRestore = WTF::nullopt; > } > > if (needUpdateVisibleContentRects) >@@ -2012,7 +2012,7 @@ - (void)_couldNotRestorePageState > _gestureController->didRestoreScrollPosition(); > } > >-- (void)_restorePageScrollPosition:(std::optional<WebCore::FloatPoint>)scrollPosition scrollOrigin:(WebCore::FloatPoint)scrollOrigin previousObscuredInset:(WebCore::FloatBoxExtent)obscuredInsets scale:(double)scale >+- (void)_restorePageScrollPosition:(WTF::Optional<WebCore::FloatPoint>)scrollPosition scrollOrigin:(WebCore::FloatPoint)scrollOrigin previousObscuredInset:(WebCore::FloatBoxExtent)obscuredInsets scale:(double)scale > { > if (_dynamicViewportUpdateMode != WebKit::DynamicViewportUpdateMode::NotResizing) > return; >@@ -2024,13 +2024,13 @@ - (void)_restorePageScrollPosition:(std::optional<WebCore::FloatPoint>)scrollPos > if (scrollPosition) > _scrollOffsetToRestore = WebCore::ScrollableArea::scrollOffsetFromPosition(WebCore::FloatPoint(scrollPosition.value()), WebCore::toFloatSize(scrollOrigin)); > else >- _scrollOffsetToRestore = std::nullopt; >+ _scrollOffsetToRestore = WTF::nullopt; > > _obscuredInsetsWhenSaved = obscuredInsets; > _scaleToRestore = scale; > } > >-- (void)_restorePageStateToUnobscuredCenter:(std::optional<WebCore::FloatPoint>)center scale:(double)scale >+- (void)_restorePageStateToUnobscuredCenter:(WTF::Optional<WebCore::FloatPoint>)center scale:(double)scale > { > if (_dynamicViewportUpdateMode != WebKit::DynamicViewportUpdateMode::NotResizing) > return; >@@ -3223,8 +3223,8 @@ - (void)_navigationGestureDidBegin > > - (void)_navigationGestureDidEnd > { >- _frozenVisibleContentRect = std::nullopt; >- _frozenUnobscuredContentRect = std::nullopt; >+ _frozenVisibleContentRect = WTF::nullopt; >+ _frozenUnobscuredContentRect = WTF::nullopt; > } > > - (void)_showPasswordViewWithDocumentName:(NSString *)documentName passwordHandler:(void (^)(NSString *))passwordHandler >@@ -4329,7 +4329,7 @@ + (BOOL)handlesURLScheme:(NSString *)urlScheme > return WebCore::SchemeRegistry::isBuiltinScheme(urlScheme); > } > >-- (std::optional<BOOL>)_resolutionForShareSheetImmediateCompletionForTesting >+- (WTF::Optional<BOOL>)_resolutionForShareSheetImmediateCompletionForTesting > { > return _resolutionForShareSheetImmediateCompletionForTesting; > } >@@ -4947,7 +4947,7 @@ - (void)_getContentsAsStringWithCompletionHandler:(void (^)(NSString *, NSError > - (void)_getApplicationManifestWithCompletionHandler:(void (^)(_WKApplicationManifest *))completionHandler > { > #if ENABLE(APPLICATION_MANIFEST) >- _page->getApplicationManifest([completionHandler = makeBlockPtr(completionHandler)](const std::optional<WebCore::ApplicationManifest>& manifest, WebKit::CallbackBase::Error error) { >+ _page->getApplicationManifest([completionHandler = makeBlockPtr(completionHandler)](const WTF::Optional<WebCore::ApplicationManifest>& manifest, WebKit::CallbackBase::Error error) { > UNUSED_PARAM(error); > if (completionHandler) { > if (manifest) { >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >index 1d15194cbfba9a9d6aa27479cc7ba5ae86b3b75a..425d30cd18c4ef3d391f11e00c810d044c5840a9 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >@@ -94,8 +94,8 @@ struct PrintInfo; > - (void)_layerTreeCommitComplete; > > - (void)_couldNotRestorePageState; >-- (void)_restorePageScrollPosition:(std::optional<WebCore::FloatPoint>)scrollPosition scrollOrigin:(WebCore::FloatPoint)scrollOrigin previousObscuredInset:(WebCore::FloatBoxExtent)insets scale:(double)scale; >-- (void)_restorePageStateToUnobscuredCenter:(std::optional<WebCore::FloatPoint>)center scale:(double)scale; // FIXME: needs scroll origin? >+- (void)_restorePageScrollPosition:(WTF::Optional<WebCore::FloatPoint>)scrollPosition scrollOrigin:(WebCore::FloatPoint)scrollOrigin previousObscuredInset:(WebCore::FloatBoxExtent)insets scale:(double)scale; >+- (void)_restorePageStateToUnobscuredCenter:(WTF::Optional<WebCore::FloatPoint>)center scale:(double)scale; // FIXME: needs scroll origin? > > - (RefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot; > >@@ -183,7 +183,7 @@ struct PrintInfo; > - (void)_showSafeBrowsingWarning:(const WebKit::SafeBrowsingWarning&)warning completionHandler:(CompletionHandler<void(Variant<WebKit::ContinueUnsafeLoad, URL>&&)>&&)completionHandler; > - (void)_clearSafeBrowsingWarning; > >-- (std::optional<BOOL>)_resolutionForShareSheetImmediateCompletionForTesting; >+- (WTF::Optional<BOOL>)_resolutionForShareSheetImmediateCompletionForTesting; > > - (WKPageRef)_pageForTesting; > - (WebKit::WebPageProxy*)_page; >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h >index c6b3eb552a1b5ede50d8b0612145622f0d4b36af..c807692e868b606ccf0d7846814256fbfe31d084 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h >@@ -38,7 +38,7 @@ template<> struct WrapperTraits<API::WebsiteDataRecord> { > using WrapperClass = WKWebsiteDataRecord; > }; > >-static inline std::optional<WebsiteDataType> toWebsiteDataType(NSString *websiteDataType) >+static inline WTF::Optional<WebsiteDataType> toWebsiteDataType(NSString *websiteDataType) > { > if ([websiteDataType isEqualToString:WKWebsiteDataTypeCookies]) > return WebsiteDataType::Cookies; >@@ -76,7 +76,7 @@ static inline std::optional<WebsiteDataType> toWebsiteDataType(NSString *website > return WebsiteDataType::ResourceLoadStatistics; > if ([websiteDataType isEqualToString:_WKWebsiteDataTypeCredentials]) > return WebsiteDataType::Credentials; >- return std::nullopt; >+ return WTF::nullopt; > } > > static inline OptionSet<WebKit::WebsiteDataType> toWebsiteDataTypes(NSSet *websiteDataTypes) >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp b/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp >index 298339ee532531be0977e649ec1297676457a89b..5ee24b22b89cb646ce2fdab606b52a1c48083dd3 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp >@@ -163,14 +163,14 @@ private: > webkitWebViewSetCurrentScriptDialogUserInput(webView, userInput); > } > >- std::optional<API::AutomationSessionClient::JavaScriptDialogType> typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy& page) override >+ WTF::Optional<API::AutomationSessionClient::JavaScriptDialogType> typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy& page) override > { > auto* webView = webkitWebContextGetWebViewForPage(m_session->priv->webContext, &page); > if (!webView) >- return std::nullopt; >+ return WTF::nullopt; > auto dialogType = webkitWebViewGetCurrentScriptDialogType(webView); > if (!dialogType) >- return std::nullopt; >+ return WTF::nullopt; > switch (dialogType.value()) { > case WEBKIT_SCRIPT_DIALOG_ALERT: > return API::AutomationSessionClient::JavaScriptDialogType::Alert; >@@ -183,7 +183,7 @@ private: > } > > ASSERT_NOT_REACHED(); >- return std::nullopt; >+ return WTF::nullopt; > } > > WebKitAutomationSession* m_session; >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitSecurityOrigin.cpp b/Source/WebKit/UIProcess/API/glib/WebKitSecurityOrigin.cpp >index 88336b3dc4684988ac77d169da6a595e61e59e55..0c2f7430f8ed6752a1863658b3567dd1d8f3f74b 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitSecurityOrigin.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitSecurityOrigin.cpp >@@ -87,7 +87,7 @@ WebKitSecurityOrigin* webkit_security_origin_new(const gchar* protocol, const gc > g_return_val_if_fail(protocol, nullptr); > g_return_val_if_fail(host, nullptr); > >- std::optional<uint16_t> optionalPort; >+ WTF::Optional<uint16_t> optionalPort; > if (port) > optionalPort = port; > >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp b/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp >index 1c7688690781f2a09c0c8b7b48f78e8eee55690f..b08ce1d0afc9b94f102645d19c660688e252c43c 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp >@@ -53,7 +53,7 @@ private: > void createNewPage(WebPageProxy& page, Ref<API::FrameInfo>&& frameInfo, WebCore::ResourceRequest&& resourceRequest, WebCore::WindowFeatures&& windowFeatures, NavigationActionData&& navigationActionData, CompletionHandler<void(RefPtr<WebPageProxy>&&)>&& completionHandler) final > { > auto userInitiatedActivity = page.process().userInitiatedActivity(navigationActionData.userGestureTokenIdentifier); >- WebKitNavigationAction navigationAction(API::NavigationAction::create(WTFMove(navigationActionData), frameInfo.ptr(), nullptr, std::nullopt, WTFMove(resourceRequest), URL { }, false, WTFMove(userInitiatedActivity))); >+ WebKitNavigationAction navigationAction(API::NavigationAction::create(WTFMove(navigationActionData), frameInfo.ptr(), nullptr, WTF::nullopt, WTFMove(resourceRequest), URL { }, false, WTFMove(userInitiatedActivity))); > completionHandler(webkitWebViewCreateNewPage(m_webView, windowFeatures, &navigationAction)); > } > >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp >index f6bffadcd762a805b3de1f7683ca513c6aa0ad9a..a908db4f69354dc1853e19849c2f0e48183ee961 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp >@@ -2208,10 +2208,10 @@ void webkitWebViewDismissCurrentScriptDialog(WebKitWebView* webView) > webkitScriptDialogDismiss(webView->priv->currentScriptDialog); > } > >-std::optional<WebKitScriptDialogType> webkitWebViewGetCurrentScriptDialogType(WebKitWebView* webView) >+WTF::Optional<WebKitScriptDialogType> webkitWebViewGetCurrentScriptDialogType(WebKitWebView* webView) > { > if (!webView->priv->currentScriptDialog) >- return std::nullopt; >+ return WTF::nullopt; > > return static_cast<WebKitScriptDialogType>(webView->priv->currentScriptDialog->type); > } >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h b/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h >index 1e599fc65f6902f641e303f8e578b0e0d3a460aa..4deba4ea59e9e76accad211dc0c5d8a5977f4f9e 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h >+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h >@@ -62,7 +62,7 @@ String webkitWebViewGetCurrentScriptDialogMessage(WebKitWebView*); > void webkitWebViewSetCurrentScriptDialogUserInput(WebKitWebView*, const String&); > void webkitWebViewAcceptCurrentScriptDialog(WebKitWebView*); > void webkitWebViewDismissCurrentScriptDialog(WebKitWebView*); >-std::optional<WebKitScriptDialogType> webkitWebViewGetCurrentScriptDialogType(WebKitWebView*); >+WTF::Optional<WebKitScriptDialogType> webkitWebViewGetCurrentScriptDialogType(WebKitWebView*); > void webkitWebViewMakePermissionRequest(WebKitWebView*, WebKitPermissionRequest*); > void webkitWebViewMakePolicyDecision(WebKitWebView*, WebKitPolicyDecisionType, WebKitPolicyDecision*); > void webkitWebViewMouseTargetChanged(WebKitWebView*, const WebKit::WebHitTestResultData&, WebKit::WebEvent::Modifiers); >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.cpp >index 202dd09c22abccd7a62d51f56e6c209ccc811812..384404c685681af10abd96ede7a029f8c55d8df4 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.cpp >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.cpp >@@ -34,7 +34,7 @@ WebKitPopupMenu::WebKitPopupMenu(GtkWidget* webView, WebPopupMenuProxy::Client& > > static void menuCloseCallback(WebKitPopupMenu* popupMenu) > { >- popupMenu->activateItem(std::nullopt); >+ popupMenu->activateItem(WTF::nullopt); > } > > void WebKitPopupMenu::showPopupMenu(const IntRect& rect, TextDirection direction, double pageScaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& platformData, int32_t selectedIndex) >@@ -68,7 +68,7 @@ void WebKitPopupMenu::cancelTracking() > m_menu = nullptr; > } > >-void WebKitPopupMenu::activateItem(std::optional<unsigned> itemIndex) >+void WebKitPopupMenu::activateItem(WTF::Optional<unsigned> itemIndex) > { > WebPopupMenuProxyGtk::activateItem(itemIndex); > if (m_menu) { >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.h b/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.h >index 8e8aedba64b36114acc7234ee7d0915dcd2f6cda..4d3723c44ce3068c6f77c704f2488852c61aea9a 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.h >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.h >@@ -34,7 +34,7 @@ public: > } > ~WebKitPopupMenu() = default; > >- void activateItem(std::optional<unsigned> itemIndex) override; >+ void activateItem(WTF::Optional<unsigned> itemIndex) override; > > private: > WebKitPopupMenu(GtkWidget*, WebPopupMenuProxy::Client&); >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >index e59435d2c536a5f9aa1c36b857c04e826d5e8cbd..6de601da2f7904da1621543622b3e191618761d8 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >@@ -808,7 +808,7 @@ static gboolean webkitWebViewBaseButtonReleaseEvent(GtkWidget* widget, GdkEventB > return GDK_EVENT_STOP; > } > >-static void webkitWebViewBaseHandleWheelEvent(WebKitWebViewBase* webViewBase, GdkEvent* event, std::optional<WebWheelEvent::Phase> phase = std::nullopt, std::optional<WebWheelEvent::Phase> momentum = std::nullopt) >+static void webkitWebViewBaseHandleWheelEvent(WebKitWebViewBase* webViewBase, GdkEvent* event, WTF::Optional<WebWheelEvent::Phase> phase = WTF::nullopt, WTF::Optional<WebWheelEvent::Phase> momentum = WTF::nullopt) > { > WebKitWebViewBasePrivate* priv = webViewBase->priv; > ASSERT(!priv->dialog); >diff --git a/Source/WebKit/UIProcess/API/mac/WKView.mm b/Source/WebKit/UIProcess/API/mac/WKView.mm >index 13967212e3e53510d4b1c70f00cb29d8b149c193..f87899ffc263b5198ba4e058ee25304234b3776d 100644 >--- a/Source/WebKit/UIProcess/API/mac/WKView.mm >+++ b/Source/WebKit/UIProcess/API/mac/WKView.mm >@@ -1456,7 +1456,7 @@ - (CGFloat)_totalHeightOfBanners > return _data->_impl->totalHeightOfBanners(); > } > >-static std::optional<WebCore::ScrollbarOverlayStyle> toCoreScrollbarStyle(_WKOverlayScrollbarStyle scrollbarStyle) >+static WTF::Optional<WebCore::ScrollbarOverlayStyle> toCoreScrollbarStyle(_WKOverlayScrollbarStyle scrollbarStyle) > { > switch (scrollbarStyle) { > case _WKOverlayScrollbarStyleDark: >@@ -1470,10 +1470,10 @@ static std::optional<WebCore::ScrollbarOverlayStyle> toCoreScrollbarStyle(_WKOve > break; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > >-static _WKOverlayScrollbarStyle toAPIScrollbarStyle(std::optional<WebCore::ScrollbarOverlayStyle> coreScrollbarStyle) >+static _WKOverlayScrollbarStyle toAPIScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> coreScrollbarStyle) > { > if (!coreScrollbarStyle) > return _WKOverlayScrollbarStyleAutomatic; >diff --git a/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp b/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp >index edae083e9e9845a42aada68c035323d237042bb1..4f2110a4397fee56946c19956faad707be52d524 100644 >--- a/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp >+++ b/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp >@@ -139,7 +139,7 @@ void WebPaymentCoordinatorProxy::completeMerchantValidation(const WebCore::Payme > m_merchantValidationState = MerchantValidationState::ValidationComplete; > } > >-void WebPaymentCoordinatorProxy::completeShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update) >+void WebPaymentCoordinatorProxy::completeShippingMethodSelection(const WTF::Optional<WebCore::ShippingMethodUpdate>& update) > { > // It's possible that the payment has been canceled already. > if (m_state == State::Idle) >@@ -152,7 +152,7 @@ void WebPaymentCoordinatorProxy::completeShippingMethodSelection(const std::opti > m_state = State::Active; > } > >-void WebPaymentCoordinatorProxy::completeShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update) >+void WebPaymentCoordinatorProxy::completeShippingContactSelection(const WTF::Optional<WebCore::ShippingContactUpdate>& update) > { > // It's possible that the payment has been canceled already. > if (m_state == State::Idle) >@@ -165,7 +165,7 @@ void WebPaymentCoordinatorProxy::completeShippingContactSelection(const std::opt > m_state = State::Active; > } > >-void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update) >+void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const WTF::Optional<WebCore::PaymentMethodUpdate>& update) > { > // It's possible that the payment has been canceled already. > if (m_state == State::Idle) >@@ -178,7 +178,7 @@ void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const std::optio > m_state = State::Active; > } > >-void WebPaymentCoordinatorProxy::completePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result) >+void WebPaymentCoordinatorProxy::completePaymentSession(const WTF::Optional<WebCore::PaymentAuthorizationResult>& result) > { > // It's possible that the payment has been canceled already. > if (!canCompletePayment()) >diff --git a/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h b/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h >index 1fbcd345613c07d4ee919a7de4595d0a256ceee2..117fe8f0aa4df5743cf6654b8dc8a12dd25b5c44 100644 >--- a/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h >+++ b/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h >@@ -84,10 +84,10 @@ private: > void openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID); > void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, bool& result); > void completeMerchantValidation(const WebCore::PaymentMerchantSession&); >- void completeShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>&); >- void completeShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>&); >- void completePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>&); >- void completePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>&); >+ void completeShippingMethodSelection(const WTF::Optional<WebCore::ShippingMethodUpdate>&); >+ void completeShippingContactSelection(const WTF::Optional<WebCore::ShippingContactUpdate>&); >+ void completePaymentMethodSelection(const WTF::Optional<WebCore::PaymentMethodUpdate>&); >+ void completePaymentSession(const WTF::Optional<WebCore::PaymentAuthorizationResult>&); > void abortPaymentSession(); > void cancelPaymentSession(); > >@@ -104,10 +104,10 @@ private: > void platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler); > void platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&, WTF::Function<void(bool)>&& completionHandler); > void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&); >- void platformCompleteShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>&); >- void platformCompleteShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>&); >- void platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>&); >- void platformCompletePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>&); >+ void platformCompleteShippingMethodSelection(const WTF::Optional<WebCore::ShippingMethodUpdate>&); >+ void platformCompleteShippingContactSelection(const WTF::Optional<WebCore::ShippingContactUpdate>&); >+ void platformCompletePaymentMethodSelection(const WTF::Optional<WebCore::PaymentMethodUpdate>&); >+ void platformCompletePaymentSession(const WTF::Optional<WebCore::PaymentAuthorizationResult>&); > > WebPageProxy& m_webPageProxy; > >diff --git a/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in b/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in >index 864b73b5874fb8f949179b5345ece2b0d4a81e86..434f6cb7662d547dbe4901279cbdc1f6e9ff5f4f 100644 >--- a/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in >+++ b/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in >@@ -33,10 +33,10 @@ messages -> WebPaymentCoordinatorProxy { > > ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) LegacySync > CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession) >- CompleteShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate> update) >- CompleteShippingContactSelection(std::optional<WebCore::ShippingContactUpdate> update) >- CompletePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate> update) >- CompletePaymentSession(std::optional<WebCore::PaymentAuthorizationResult> result) >+ CompleteShippingMethodSelection(WTF::Optional<WebCore::ShippingMethodUpdate> update) >+ CompleteShippingContactSelection(WTF::Optional<WebCore::ShippingContactUpdate> update) >+ CompletePaymentMethodSelection(WTF::Optional<WebCore::PaymentMethodUpdate> update) >+ CompletePaymentSession(WTF::Optional<WebCore::PaymentAuthorizationResult> result) > AbortPaymentSession() > CancelPaymentSession() > } >diff --git a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >index 440c10e800781703acc36383218965fa13ba0ab7..e120010d8058fd0e68d18b5010ff40a0d91ab8ca 100644 >--- a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >+++ b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >@@ -644,7 +644,7 @@ static RetainPtr<NSArray> toNSErrors(const Vector<WebCore::PaymentError>& errors > return result; > } > #else >-static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const std::optional<WebCore::PaymentAuthorizationResult>& result) >+static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const WTF::Optional<WebCore::PaymentAuthorizationResult>& result) > { > if (!result) > return PKPaymentAuthorizationStatusSuccess; >@@ -684,7 +684,7 @@ static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const std::op > } > #endif > >-void WebPaymentCoordinatorProxy::platformCompletePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result) >+void WebPaymentCoordinatorProxy::platformCompletePaymentSession(const WTF::Optional<WebCore::PaymentAuthorizationResult>& result) > { > ASSERT(m_paymentAuthorizationViewController); > ASSERT(m_paymentAuthorizationViewControllerDelegate); >@@ -710,7 +710,7 @@ void WebPaymentCoordinatorProxy::platformCompleteMerchantValidation(const WebCor > m_paymentAuthorizationViewControllerDelegate->_sessionBlock = nullptr; > } > >-void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update) >+void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(const WTF::Optional<WebCore::ShippingMethodUpdate>& update) > { > ASSERT(m_paymentAuthorizationViewController); > ASSERT(m_paymentAuthorizationViewControllerDelegate); >@@ -728,7 +728,7 @@ void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(const s > } > > #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) >-static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const std::optional<WebCore::ShippingContactUpdate>& update) >+static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const WTF::Optional<WebCore::ShippingContactUpdate>& update) > { > if (!update || update->errors.isEmpty()) > return PKPaymentAuthorizationStatusSuccess; >@@ -755,7 +755,7 @@ static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const std::op > } > #endif > >-void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update) >+void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(const WTF::Optional<WebCore::ShippingContactUpdate>& update) > { > ASSERT(m_paymentAuthorizationViewController); > ASSERT(m_paymentAuthorizationViewControllerDelegate); >@@ -779,7 +779,7 @@ void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(const > m_paymentAuthorizationViewControllerDelegate->_didSelectShippingContactCompletion = nullptr; > } > >-void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update) >+void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const WTF::Optional<WebCore::PaymentMethodUpdate>& update) > { > ASSERT(m_paymentAuthorizationViewController); > ASSERT(m_paymentAuthorizationViewControllerDelegate); >diff --git a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp >index 448b2715626823d71dfae3a2a8359562cca3069a..6081891c424da3c9fb608be7d49345df3ebb10e4 100644 >--- a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp >+++ b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp >@@ -117,7 +117,7 @@ void SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired() > > if (isKeyFrameTransitionComplete()) { > auto finish = std::exchange(m_keyFrameTransitionCompletionHandler, nullptr); >- finish(std::nullopt); >+ finish(WTF::nullopt); > } > } > >@@ -138,11 +138,11 @@ void SimulatedInputDispatcher::transitionToNextKeyFrame() > { > ++m_keyframeIndex; > if (m_keyframeIndex == m_keyframes.size()) { >- finishDispatching(std::nullopt); >+ finishDispatching(WTF::nullopt); > return; > } > >- transitionBetweenKeyFrames(m_keyframes[m_keyframeIndex - 1], m_keyframes[m_keyframeIndex], [this, protectedThis = makeRef(*this)](std::optional<AutomationCommandError> error) { >+ transitionBetweenKeyFrames(m_keyframes[m_keyframeIndex - 1], m_keyframes[m_keyframeIndex], [this, protectedThis = makeRef(*this)](WTF::Optional<AutomationCommandError> error) { > if (error) { > finishDispatching(error); > return; >@@ -156,7 +156,7 @@ void SimulatedInputDispatcher::transitionToNextInputSourceState() > { > if (isKeyFrameTransitionComplete()) { > auto finish = std::exchange(m_keyFrameTransitionCompletionHandler, nullptr); >- finish(std::nullopt); >+ finish(WTF::nullopt); > return; > } > >@@ -168,7 +168,7 @@ void SimulatedInputDispatcher::transitionToNextInputSourceState() > auto& postStateEntry = nextKeyFrame.states[m_inputSourceStateIndex]; > SimulatedInputSource& inputSource = postStateEntry.first; > >- transitionInputSourceToState(inputSource, postStateEntry.second, [this, protectedThis = makeRef(*this)](std::optional<AutomationCommandError> error) { >+ transitionInputSourceToState(inputSource, postStateEntry.second, [this, protectedThis = makeRef(*this)](WTF::Optional<AutomationCommandError> error) { > if (error) { > auto finish = std::exchange(m_keyFrameTransitionCompletionHandler, nullptr); > finish(error); >@@ -196,33 +196,33 @@ void SimulatedInputDispatcher::transitionBetweenKeyFrames(const SimulatedInputKe > transitionToNextInputSourceState(); > } > >-void SimulatedInputDispatcher::resolveLocation(const WebCore::IntPoint& currentLocation, std::optional<WebCore::IntPoint> location, MouseMoveOrigin origin, std::optional<String> nodeHandle, Function<void (std::optional<WebCore::IntPoint>, std::optional<AutomationCommandError>)>&& completionHandler) >+void SimulatedInputDispatcher::resolveLocation(const WebCore::IntPoint& currentLocation, WTF::Optional<WebCore::IntPoint> location, MouseMoveOrigin origin, WTF::Optional<String> nodeHandle, Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<AutomationCommandError>)>&& completionHandler) > { > if (!location) { >- completionHandler(currentLocation, std::nullopt); >+ completionHandler(currentLocation, WTF::nullopt); > return; > } > > switch (origin) { > case MouseMoveOrigin::Viewport: >- completionHandler(location.value(), std::nullopt); >+ completionHandler(location.value(), WTF::nullopt); > break; > case MouseMoveOrigin::Pointer: { > WebCore::IntPoint destination(currentLocation); > destination.moveBy(location.value()); >- completionHandler(destination, std::nullopt); >+ completionHandler(destination, WTF::nullopt); > break; > } > case MouseMoveOrigin::Element: { >- m_client.viewportInViewCenterPointOfElement(m_page, m_frameID.value(), nodeHandle.value(), [destination = location.value(), completionHandler = WTFMove(completionHandler)](std::optional<WebCore::IntPoint> inViewCenterPoint, std::optional<AutomationCommandError> error) mutable { >+ m_client.viewportInViewCenterPointOfElement(m_page, m_frameID.value(), nodeHandle.value(), [destination = location.value(), completionHandler = WTFMove(completionHandler)](WTF::Optional<WebCore::IntPoint> inViewCenterPoint, WTF::Optional<AutomationCommandError> error) mutable { > if (error) { >- completionHandler(std::nullopt, error); >+ completionHandler(WTF::nullopt, error); > return; > } > > ASSERT(inViewCenterPoint); > destination.moveBy(inViewCenterPoint.value()); >- completionHandler(destination, std::nullopt); >+ completionHandler(destination, WTF::nullopt); > }); > break; > } >@@ -237,7 +237,7 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource > > LOG(Automation, "SimulatedInputDispatcher[%p]: transition started between input source states: [%d.%d] --> %d.%d", this, m_keyframeIndex - 1, m_inputSourceStateIndex, m_keyframeIndex, m_inputSourceStateIndex); > >- AutomationCompletionHandler eventDispatchFinished = [this, &inputSource, &newState, completionHandler = WTFMove(completionHandler)](std::optional<AutomationCommandError> error) mutable { >+ AutomationCompletionHandler eventDispatchFinished = [this, &inputSource, &newState, completionHandler = WTFMove(completionHandler)](WTF::Optional<AutomationCommandError> error) mutable { > if (error) { > completionHandler(error); > return; >@@ -250,16 +250,16 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource > #endif > > inputSource.state = newState; >- completionHandler(std::nullopt); >+ completionHandler(WTF::nullopt); > }; > > switch (inputSource.type) { > case SimulatedInputSourceType::Null: > // The maximum duration is handled at the keyframe level by m_keyFrameTransitionDurationTimer. >- eventDispatchFinished(std::nullopt); >+ eventDispatchFinished(WTF::nullopt); > break; > case SimulatedInputSourceType::Mouse: { >- resolveLocation(a.location.value_or(WebCore::IntPoint()), b.location, b.origin.value_or(MouseMoveOrigin::Viewport), b.nodeHandle, [this, &a, &b, eventDispatchFinished = WTFMove(eventDispatchFinished)](std::optional<WebCore::IntPoint> location, std::optional<AutomationCommandError> error) mutable { >+ resolveLocation(a.location.value_or(WebCore::IntPoint()), b.location, b.origin.value_or(MouseMoveOrigin::Viewport), b.nodeHandle, [this, &a, &b, eventDispatchFinished = WTFMove(eventDispatchFinished)](WTF::Optional<WebCore::IntPoint> location, WTF::Optional<AutomationCommandError> error) mutable { > if (error) { > eventDispatchFinished(error); > return; >@@ -284,7 +284,7 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource > // FIXME: This does not interpolate mousemoves per the "perform a pointer move" algorithm (§17.4 Dispatching Actions). > m_client.simulateMouseInteraction(m_page, MouseInteraction::Move, b.pressedMouseButton.value_or(MouseButton::NoButton), b.location.value(), WTFMove(eventDispatchFinished)); > } else >- eventDispatchFinished(std::nullopt); >+ eventDispatchFinished(WTF::nullopt); > }); > break; > } >@@ -326,7 +326,7 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource > } > } > } else >- eventDispatchFinished(std::nullopt); >+ eventDispatchFinished(WTF::nullopt); > break; > case SimulatedInputSourceType::Touch: > // Not supported yet. >@@ -370,14 +370,14 @@ void SimulatedInputDispatcher::cancel() > finishDispatching(AUTOMATION_COMMAND_ERROR_WITH_NAME(InternalError)); > } > >-void SimulatedInputDispatcher::finishDispatching(std::optional<AutomationCommandError> error) >+void SimulatedInputDispatcher::finishDispatching(WTF::Optional<AutomationCommandError> error) > { > m_keyFrameTransitionDurationTimer.stop(); > > LOG(Automation, "SimulatedInputDispatcher[%p]: finished all input simulation at [%u.%u]", this, m_keyframeIndex, m_inputSourceStateIndex); > > auto finish = std::exchange(m_runCompletionHandler, nullptr); >- m_frameID = std::nullopt; >+ m_frameID = WTF::nullopt; > m_keyframes.clear(); > m_inputSources.clear(); > m_keyframeIndex = 0; >diff --git a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h >index dd3d04f38d1d991044aa8f5cbe28801aff1cf18a..bdfbe8236dfbea1b9cc79c597101f7cc8ed16d3a 100644 >--- a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h >+++ b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h >@@ -46,7 +46,7 @@ enum class VirtualKey; > namespace WebKit { > > class AutomationCommandError; >-using AutomationCompletionHandler = WTF::CompletionHandler<void(std::optional<AutomationCommandError>)>; >+using AutomationCompletionHandler = WTF::CompletionHandler<void(WTF::Optional<AutomationCommandError>)>; > > class WebPageProxy; > >@@ -66,13 +66,13 @@ enum class SimulatedInputSourceType { > }; > > struct SimulatedInputSourceState { >- std::optional<CharKey> pressedCharKey; >+ WTF::Optional<CharKey> pressedCharKey; > VirtualKeySet pressedVirtualKeys; >- std::optional<MouseButton> pressedMouseButton; >- std::optional<MouseMoveOrigin> origin; >- std::optional<String> nodeHandle; >- std::optional<WebCore::IntPoint> location; >- std::optional<Seconds> duration; >+ WTF::Optional<MouseButton> pressedMouseButton; >+ WTF::Optional<MouseMoveOrigin> origin; >+ WTF::Optional<String> nodeHandle; >+ WTF::Optional<WebCore::IntPoint> location; >+ WTF::Optional<Seconds> duration; > > static SimulatedInputSourceState emptyStateForSourceType(SimulatedInputSourceType); > }; >@@ -117,7 +117,7 @@ public: > virtual ~Client() { } > virtual void simulateMouseInteraction(WebPageProxy&, MouseInteraction, WebMouseEvent::Button, const WebCore::IntPoint& locationInView, AutomationCompletionHandler&&) = 0; > virtual void simulateKeyboardInteraction(WebPageProxy&, KeyboardInteraction, WTF::Variant<VirtualKey, CharKey>&&, AutomationCompletionHandler&&) = 0; >- virtual void viewportInViewCenterPointOfElement(WebPageProxy&, uint64_t frameID, const String& nodeHandle, Function<void (std::optional<WebCore::IntPoint>, std::optional<AutomationCommandError>)>&&) = 0; >+ virtual void viewportInViewCenterPointOfElement(WebPageProxy&, uint64_t frameID, const String& nodeHandle, Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<AutomationCommandError>)>&&) = 0; > }; > > static Ref<SimulatedInputDispatcher> create(WebPageProxy& page, SimulatedInputDispatcher::Client& client) >@@ -140,17 +140,17 @@ private: > > void transitionToNextInputSourceState(); > void transitionInputSourceToState(SimulatedInputSource&, SimulatedInputSourceState& newState, AutomationCompletionHandler&&); >- void finishDispatching(std::optional<AutomationCommandError>); >+ void finishDispatching(WTF::Optional<AutomationCommandError>); > > void keyFrameTransitionDurationTimerFired(); > bool isKeyFrameTransitionComplete() const; > >- void resolveLocation(const WebCore::IntPoint& currentLocation, std::optional<WebCore::IntPoint> location, MouseMoveOrigin, std::optional<String> nodeHandle, Function<void (std::optional<WebCore::IntPoint>, std::optional<AutomationCommandError>)>&&); >+ void resolveLocation(const WebCore::IntPoint& currentLocation, WTF::Optional<WebCore::IntPoint> location, MouseMoveOrigin, WTF::Optional<String> nodeHandle, Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<AutomationCommandError>)>&&); > > WebPageProxy& m_page; > SimulatedInputDispatcher::Client& m_client; > >- std::optional<uint64_t> m_frameID; >+ WTF::Optional<uint64_t> m_frameID; > AutomationCompletionHandler m_runCompletionHandler; > AutomationCompletionHandler m_keyFrameTransitionCompletionHandler; > RunLoop::Timer<SimulatedInputDispatcher> m_keyFrameTransitionDurationTimer; >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >index dd0cb4427069e074fb580b11c2e9c39b1dbb39d7..bcd87c45258b364590f85ddfe05409c4fa16f2c4 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >@@ -187,14 +187,14 @@ String WebAutomationSession::handleForWebPageProxy(const WebPageProxy& webPagePr > return handle; > } > >-std::optional<uint64_t> WebAutomationSession::webFrameIDForHandle(const String& handle) >+WTF::Optional<uint64_t> WebAutomationSession::webFrameIDForHandle(const String& handle) > { > if (handle.isEmpty()) > return 0; > > auto iter = m_handleWebFrameMap.find(handle); > if (iter == m_handleWebFrameMap.end()) >- return std::nullopt; >+ return WTF::nullopt; > > return iter->value; > } >@@ -331,7 +331,7 @@ void WebAutomationSession::switchToBrowsingContext(const String& browsingContext > if (!page) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); > >- std::optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > >@@ -346,8 +346,8 @@ void WebAutomationSession::switchToBrowsingContext(const String& browsingContext > > void WebAutomationSession::setWindowFrameOfBrowsingContext(const String& handle, const JSON::Object* optionalOriginObject, const JSON::Object* optionalSizeObject, Ref<SetWindowFrameOfBrowsingContextCallback>&& callback) > { >- std::optional<float> x; >- std::optional<float> y; >+ WTF::Optional<float> x; >+ WTF::Optional<float> y; > if (optionalOriginObject) { > if (!(x = optionalOriginObject->getNumber<float>("x"_s))) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'x' parameter was not found or invalid."); >@@ -362,8 +362,8 @@ void WebAutomationSession::setWindowFrameOfBrowsingContext(const String& handle, > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'y' parameter had an invalid value."); > } > >- std::optional<float> width; >- std::optional<float> height; >+ WTF::Optional<float> width; >+ WTF::Optional<float> height; > if (optionalSizeObject) { > if (!(width = optionalSizeObject->getNumber<float>("width"_s))) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'width' parameter was not found or invalid."); >@@ -397,14 +397,14 @@ void WebAutomationSession::setWindowFrameOfBrowsingContext(const String& handle, > }); > } > >-static std::optional<Inspector::Protocol::Automation::PageLoadStrategy> pageLoadStrategyFromStringParameter(const String* optionalPageLoadStrategyString) >+static WTF::Optional<Inspector::Protocol::Automation::PageLoadStrategy> pageLoadStrategyFromStringParameter(const String* optionalPageLoadStrategyString) > { > if (!optionalPageLoadStrategyString) > return defaultPageLoadStrategy; > > auto parsedPageLoadStrategy = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::PageLoadStrategy>(*optionalPageLoadStrategyString); > if (!parsedPageLoadStrategy) >- return std::nullopt; >+ return WTF::nullopt; > return parsedPageLoadStrategy; > } > >@@ -428,7 +428,7 @@ void WebAutomationSession::waitForNavigationToComplete(const String& browsingCon > && page->pageLoadState().isLoading() && m_client->isShowingJavaScriptDialogOnPage(*this, *page); > > if (optionalFrameHandle && !optionalFrameHandle->isEmpty()) { >- std::optional<uint64_t> frameID = webFrameIDForHandle(*optionalFrameHandle); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(*optionalFrameHandle); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > WebFrameProxy* frame = page->process().webFrame(frameID.value()); >@@ -633,14 +633,14 @@ void WebAutomationSession::willShowJavaScriptDialog(WebPageProxy& page) > if (!m_pendingMouseEventsFlushedCallbacksPerPage.isEmpty()) { > for (auto key : copyToVector(m_pendingMouseEventsFlushedCallbacksPerPage.keys())) { > auto callback = m_pendingMouseEventsFlushedCallbacksPerPage.take(key); >- callback(std::nullopt); >+ callback(WTF::nullopt); > } > } > > if (!m_pendingKeyboardEventsFlushedCallbacksPerPage.isEmpty()) { > for (auto key : copyToVector(m_pendingKeyboardEventsFlushedCallbacksPerPage.keys())) { > auto callback = m_pendingKeyboardEventsFlushedCallbacksPerPage.take(key); >- callback(std::nullopt); >+ callback(WTF::nullopt); > } > } > }); >@@ -761,13 +761,13 @@ void WebAutomationSession::inspectorFrontendLoaded(const WebPageProxy& page) > void WebAutomationSession::mouseEventsFlushedForPage(const WebPageProxy& page) > { > if (auto callback = m_pendingMouseEventsFlushedCallbacksPerPage.take(page.pageID())) >- callback(std::nullopt); >+ callback(WTF::nullopt); > } > > void WebAutomationSession::keyboardEventsFlushedForPage(const WebPageProxy& page) > { > if (auto callback = m_pendingKeyboardEventsFlushedCallbacksPerPage.take(page.pageID())) >- callback(std::nullopt); >+ callback(WTF::nullopt); > } > > void WebAutomationSession::willClosePage(const WebPageProxy& page) >@@ -783,7 +783,7 @@ void WebAutomationSession::willClosePage(const WebPageProxy& page) > callback(AUTOMATION_COMMAND_ERROR_WITH_NAME(WindowNotFound)); > > // Then tell the input dispatcher to cancel so timers are stopped, and let it go out of scope. >- std::optional<Ref<SimulatedInputDispatcher>> inputDispatcher = m_inputDispatchersByPage.take(page.pageID()); >+ WTF::Optional<Ref<SimulatedInputDispatcher>> inputDispatcher = m_inputDispatchersByPage.take(page.pageID()); > if (inputDispatcher.has_value()) > inputDispatcher.value()->cancel(); > } >@@ -876,7 +876,7 @@ void WebAutomationSession::evaluateJavaScriptFunction(const String& browsingCont > if (!page) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); > >- std::optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > >@@ -919,7 +919,7 @@ void WebAutomationSession::resolveChildFrameHandle(const String& browsingContext > if (!page) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); > >- std::optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > >@@ -962,7 +962,7 @@ void WebAutomationSession::resolveParentFrameHandle(const String& browsingContex > if (!page) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); > >- std::optional<uint64_t> frameID = webFrameIDForHandle(frameHandle); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(frameHandle); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > >@@ -984,7 +984,7 @@ void WebAutomationSession::didResolveParentFrame(uint64_t callbackID, uint64_t f > callback->sendSuccess(handleForWebFrameID(frameID)); > } > >-static std::optional<CoordinateSystem> protocolStringToCoordinateSystem(const String& coordinateSystemString) >+static WTF::Optional<CoordinateSystem> protocolStringToCoordinateSystem(const String& coordinateSystemString) > { > if (coordinateSystemString == "Page") > return CoordinateSystem::Page; >@@ -992,7 +992,7 @@ static std::optional<CoordinateSystem> protocolStringToCoordinateSystem(const St > return CoordinateSystem::LayoutViewport; > if (coordinateSystemString == "VisualViewport") > return CoordinateSystem::VisualViewport; >- return std::nullopt; >+ return WTF::nullopt; > } > > void WebAutomationSession::computeElementLayout(const String& browsingContextHandle, const String& frameHandle, const String& nodeHandle, const bool* optionalScrollIntoViewIfNeeded, const String& coordinateSystemString, Ref<ComputeElementLayoutCallback>&& callback) >@@ -1001,11 +1001,11 @@ void WebAutomationSession::computeElementLayout(const String& browsingContextHan > if (!page) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); > >- std::optional<uint64_t> frameID = webFrameIDForHandle(frameHandle); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(frameHandle); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > >- std::optional<CoordinateSystem> coordinateSystem = protocolStringToCoordinateSystem(coordinateSystemString); >+ WTF::Optional<CoordinateSystem> coordinateSystem = protocolStringToCoordinateSystem(coordinateSystemString); > if (!coordinateSystem) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'coordinateSystem' is invalid."); > >@@ -1017,12 +1017,12 @@ void WebAutomationSession::computeElementLayout(const String& browsingContextHan > page->process().send(Messages::WebAutomationSessionProxy::ComputeElementLayout(page->pageID(), frameID.value(), nodeHandle, scrollIntoViewIfNeeded, coordinateSystem.value(), callbackID), 0); > } > >-void WebAutomationSession::didComputeElementLayout(uint64_t callbackID, WebCore::IntRect rect, std::optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured, const String& errorType) >+void WebAutomationSession::didComputeElementLayout(uint64_t callbackID, WebCore::IntRect rect, WTF::Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured, const String& errorType) > { > if (callbackID % 2 == 1) { > ASSERT(inViewCenterPoint); > if (auto callback = m_viewportInViewCenterPointOfElementCallbacks.take(callbackID)) { >- std::optional<AutomationCommandError> error; >+ WTF::Optional<AutomationCommandError> error; > if (!errorType.isEmpty()) > error = AUTOMATION_COMMAND_ERROR_WITH_MESSAGE(errorType); > callback(inViewCenterPoint, error); >@@ -1073,7 +1073,7 @@ void WebAutomationSession::selectOptionElement(const String& browsingContextHand > if (!page) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); > >- std::optional<uint64_t> frameID = webFrameIDForHandle(frameHandle); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(frameHandle); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > >@@ -1447,7 +1447,7 @@ SimulatedInputSource* WebAutomationSession::inputSourceForType(SimulatedInputSou > } > > // SimulatedInputDispatcher::Client API >-void WebAutomationSession::viewportInViewCenterPointOfElement(WebPageProxy& page, uint64_t frameID, const String& nodeHandle, Function<void (std::optional<WebCore::IntPoint>, std::optional<AutomationCommandError>)>&& completionHandler) >+void WebAutomationSession::viewportInViewCenterPointOfElement(WebPageProxy& page, uint64_t frameID, const String& nodeHandle, Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<AutomationCommandError>)>&& completionHandler) > { > // Start at 3 and use only odd numbers to not conflict with m_nextComputeElementLayoutCallbackID. > uint64_t callbackID = m_nextViewportInViewCenterPointOfElementCallbackID += 2; >@@ -1456,7 +1456,7 @@ void WebAutomationSession::viewportInViewCenterPointOfElement(WebPageProxy& page > page.process().send(Messages::WebAutomationSessionProxy::ComputeElementLayout(page.pageID(), frameID, nodeHandle, false, CoordinateSystem::LayoutViewport, callbackID), 0); > } > >-void WebAutomationSession::simulateMouseInteraction(WebPageProxy& page, MouseInteraction interaction, WebMouseEvent::Button mouseButton, const WebCore::IntPoint& locationInViewport, CompletionHandler<void(std::optional<AutomationCommandError>)>&& completionHandler) >+void WebAutomationSession::simulateMouseInteraction(WebPageProxy& page, MouseInteraction interaction, WebMouseEvent::Button mouseButton, const WebCore::IntPoint& locationInViewport, CompletionHandler<void(WTF::Optional<AutomationCommandError>)>&& completionHandler) > { > WebCore::IntPoint locationInView = WebCore::IntPoint(locationInViewport.x(), locationInViewport.y() + page.topContentInset()); > page.getWindowFrameWithCallback([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler), page = makeRef(page), interaction, mouseButton, locationInView](WebCore::FloatRect windowFrame) mutable { >@@ -1468,7 +1468,7 @@ void WebAutomationSession::simulateMouseInteraction(WebPageProxy& page, MouseInt > } > > // Bridge the flushed callback to our command's completion handler. >- auto mouseEventsFlushedCallback = [completionHandler = WTFMove(completionHandler)](std::optional<AutomationCommandError> error) mutable { >+ auto mouseEventsFlushedCallback = [completionHandler = WTFMove(completionHandler)](WTF::Optional<AutomationCommandError> error) mutable { > completionHandler(error); > }; > >@@ -1482,17 +1482,17 @@ void WebAutomationSession::simulateMouseInteraction(WebPageProxy& page, MouseInt > // If the event does not hit test anything in the window, then it may not have been delivered. > if (callbackInMap && !page->isProcessingMouseEvents()) { > auto callbackToCancel = m_pendingMouseEventsFlushedCallbacksPerPage.take(page->pageID()); >- callbackToCancel(std::nullopt); >+ callbackToCancel(WTF::nullopt); > } > > // Otherwise, wait for mouseEventsFlushedCallback to run when all events are handled. > }); > } > >-void WebAutomationSession::simulateKeyboardInteraction(WebPageProxy& page, KeyboardInteraction interaction, WTF::Variant<VirtualKey, CharKey>&& key, CompletionHandler<void(std::optional<AutomationCommandError>)>&& completionHandler) >+void WebAutomationSession::simulateKeyboardInteraction(WebPageProxy& page, KeyboardInteraction interaction, WTF::Variant<VirtualKey, CharKey>&& key, CompletionHandler<void(WTF::Optional<AutomationCommandError>)>&& completionHandler) > { > // Bridge the flushed callback to our command's completion handler. >- auto keyboardEventsFlushedCallback = [completionHandler = WTFMove(completionHandler)](std::optional<AutomationCommandError> error) mutable { >+ auto keyboardEventsFlushedCallback = [completionHandler = WTFMove(completionHandler)](WTF::Optional<AutomationCommandError> error) mutable { > completionHandler(error); > }; > >@@ -1507,7 +1507,7 @@ void WebAutomationSession::simulateKeyboardInteraction(WebPageProxy& page, Keybo > // This happens in some corner cases on macOS, such as releasing a key while Command is pressed. > if (callbackInMap && !page.isProcessingKeyboardEvents()) { > auto callbackToCancel = m_pendingKeyboardEventsFlushedCallbacksPerPage.take(page.pageID()); >- callbackToCancel(std::nullopt); >+ callbackToCancel(WTF::nullopt); > } > > // Otherwise, wait for keyboardEventsFlushedCallback to run when all events are handled. >@@ -1594,7 +1594,7 @@ void WebAutomationSession::performMouseInteraction(const String& handle, const J > if (!parsedButton) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'button' is invalid."); > >- auto mouseEventsFlushedCallback = [protectedThis = WTFMove(protectedThis), callback = WTFMove(callback), page = page.copyRef(), x, y](std::optional<AutomationCommandError> error) { >+ auto mouseEventsFlushedCallback = [protectedThis = WTFMove(protectedThis), callback = WTFMove(callback), page = page.copyRef(), x, y](WTF::Optional<AutomationCommandError> error) { > if (error) > callback->sendFailure(error.value().toProtocolString()); > else { >@@ -1617,7 +1617,7 @@ void WebAutomationSession::performMouseInteraction(const String& handle, const J > // In W3C-only code paths, we can reject any pointer actions whose coordinates are outside the viewport rect. > if (callbackInMap && !page->isProcessingMouseEvents()) { > auto callbackToCancel = m_pendingMouseEventsFlushedCallbacksPerPage.take(page->pageID()); >- callbackToCancel(std::nullopt); >+ callbackToCancel(WTF::nullopt); > } > }); > #endif // USE(APPKIT) || PLATFORM(GTK) || PLATFORM(WPE) >@@ -1654,7 +1654,7 @@ void WebAutomationSession::performKeyboardInteractions(const String& handle, con > String virtualKeyString; > bool foundVirtualKey = interactionObject->getString("key"_s, virtualKeyString); > if (foundVirtualKey) { >- std::optional<VirtualKey> virtualKey = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(virtualKeyString); >+ WTF::Optional<VirtualKey> virtualKey = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(virtualKeyString); > if (!virtualKey) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "An interaction in the 'interactions' parameter has an invalid 'key' value."); > >@@ -1688,7 +1688,7 @@ void WebAutomationSession::performKeyboardInteractions(const String& handle, con > if (!actionsToPerform.size()) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "No actions to perform."); > >- auto keyboardEventsFlushedCallback = [protectedThis = makeRef(*this), callback = WTFMove(callback), page = makeRef(*page)](std::optional<AutomationCommandError> error) { >+ auto keyboardEventsFlushedCallback = [protectedThis = makeRef(*this), callback = WTFMove(callback), page = makeRef(*page)](WTF::Optional<AutomationCommandError> error) { > if (error) > callback->sendFailure(error.value().toProtocolString()); > else >@@ -1821,7 +1821,7 @@ void WebAutomationSession::performInteractionSequence(const String& handle, cons > if (!(*it)->asString(pressedVirtualKeyString)) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "Encountered a non-string virtual key value."); > >- std::optional<VirtualKey> parsedVirtualKey = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(pressedVirtualKeyString); >+ WTF::Optional<VirtualKey> parsedVirtualKey = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(pressedVirtualKeyString); > if (!parsedVirtualKey) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "Encountered an unknown virtual key value."); > else >@@ -1872,7 +1872,7 @@ void WebAutomationSession::performInteractionSequence(const String& handle, cons > } > > // Delegate the rest of §17.4 Dispatching Actions to the dispatcher. >- inputDispatcher.run(frameID.value(), WTFMove(keyFrames), m_inputSources, [protectedThis = makeRef(*this), callback = WTFMove(callback)](std::optional<AutomationCommandError> error) { >+ inputDispatcher.run(frameID.value(), WTFMove(keyFrames), m_inputSources, [protectedThis = makeRef(*this), callback = WTFMove(callback)](WTF::Optional<AutomationCommandError> error) { > if (error) > callback->sendFailure(error.value().toProtocolString()); > else >@@ -1900,7 +1900,7 @@ void WebAutomationSession::cancelInteractionSequence(const String& handle, const > SimulatedInputDispatcher& inputDispatcher = inputDispatcherForPage(*page); > inputDispatcher.cancel(); > >- inputDispatcher.run(frameID.value(), WTFMove(keyFrames), m_inputSources, [protectedThis = makeRef(*this), callback = WTFMove(callback)](std::optional<AutomationCommandError> error) { >+ inputDispatcher.run(frameID.value(), WTFMove(keyFrames), m_inputSources, [protectedThis = makeRef(*this), callback = WTFMove(callback)](WTF::Optional<AutomationCommandError> error) { > if (error) > callback->sendFailure(error.value().toProtocolString()); > else >@@ -1915,7 +1915,7 @@ void WebAutomationSession::takeScreenshot(const String& handle, const String* op > if (!page) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); > >- std::optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); >+ WTF::Optional<uint64_t> frameID = webFrameIDForHandle(optionalFrameHandle ? *optionalFrameHandle : emptyString()); > if (!frameID) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > >@@ -1940,7 +1940,7 @@ void WebAutomationSession::didTakeScreenshot(uint64_t callbackID, const Shareabl > return; > } > >- std::optional<String> base64EncodedData = platformGetBase64EncodedPNGData(imageDataHandle); >+ WTF::Optional<String> base64EncodedData = platformGetBase64EncodedPNGData(imageDataHandle); > if (!base64EncodedData) > ASYNC_FAIL_WITH_PREDEFINED_ERROR(InternalError); > >@@ -1964,9 +1964,9 @@ void WebAutomationSession::platformSimulateKeyboardInteraction(WebPageProxy&, Ke > #endif // !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WPE) > > #if !PLATFORM(COCOA) && !USE(CAIRO) >-std::optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle&) >+WTF::Optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle&) > { >- return std::nullopt; >+ return WTF::nullopt; > } > #endif // !PLATFORM(COCOA) && !USE(CAIRO) > >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.h b/Source/WebKit/UIProcess/Automation/WebAutomationSession.h >index c70004576c9e6a919bbc234aa689661239e7fbc3..7ebd57e3f894c5fb71ca2993cd8020dc228373f1 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.h >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.h >@@ -80,7 +80,7 @@ class WebProcessPool; > class AutomationCommandError { > public: > Inspector::Protocol::Automation::ErrorMessage type; >- std::optional<String> message { std::nullopt }; >+ WTF::Optional<String> message { WTF::nullopt }; > > AutomationCommandError(Inspector::Protocol::Automation::ErrorMessage type) > : type(type) { } >@@ -92,7 +92,7 @@ public: > String toProtocolString(); > }; > >-using AutomationCompletionHandler = WTF::CompletionHandler<void(std::optional<AutomationCommandError>)>; >+using AutomationCompletionHandler = WTF::CompletionHandler<void(WTF::Optional<AutomationCommandError>)>; > > class WebAutomationSession final : public API::ObjectImpl<API::Object::Type::AutomationSession>, public IPC::MessageReceiver > #if ENABLE(REMOTE_INSPECTOR) >@@ -138,7 +138,7 @@ public: > // SimulatedInputDispatcher::Client API > void simulateMouseInteraction(WebPageProxy&, MouseInteraction, WebMouseEvent::Button, const WebCore::IntPoint& locationInView, AutomationCompletionHandler&&) final; > void simulateKeyboardInteraction(WebPageProxy&, KeyboardInteraction, WTF::Variant<VirtualKey, CharKey>&&, AutomationCompletionHandler&&) final; >- void viewportInViewCenterPointOfElement(WebPageProxy&, uint64_t frameID, const String& nodeHandle, Function<void (std::optional<WebCore::IntPoint>, std::optional<AutomationCommandError>)>&&) final; >+ void viewportInViewCenterPointOfElement(WebPageProxy&, uint64_t frameID, const String& nodeHandle, Function<void (WTF::Optional<WebCore::IntPoint>, WTF::Optional<AutomationCommandError>)>&&) final; > > // Inspector::AutomationBackendDispatcherHandler API > // NOTE: the set of declarations included in this interface depend on the "platform" property in Automation.json >@@ -202,7 +202,7 @@ private: > Ref<Inspector::Protocol::Automation::BrowsingContext> buildBrowsingContextForPage(WebPageProxy&, WebCore::FloatRect windowFrame); > void getNextContext(Ref<WebAutomationSession>&&, Vector<Ref<WebPageProxy>>&&, Ref<JSON::ArrayOf<Inspector::Protocol::Automation::BrowsingContext>>, Ref<WebAutomationSession::GetBrowsingContextsCallback>&&); > >- std::optional<uint64_t> webFrameIDForHandle(const String&); >+ WTF::Optional<uint64_t> webFrameIDForHandle(const String&); > String handleForWebFrameID(uint64_t frameID); > String handleForWebFrameProxy(const WebFrameProxy&); > >@@ -224,7 +224,7 @@ private: > void didEvaluateJavaScriptFunction(uint64_t callbackID, const String& result, const String& errorType); > void didResolveChildFrame(uint64_t callbackID, uint64_t frameID, const String& errorType); > void didResolveParentFrame(uint64_t callbackID, uint64_t frameID, const String& errorType); >- void didComputeElementLayout(uint64_t callbackID, WebCore::IntRect, std::optional<WebCore::IntPoint>, bool isObscured, const String& errorType); >+ void didComputeElementLayout(uint64_t callbackID, WebCore::IntRect, WTF::Optional<WebCore::IntPoint>, bool isObscured, const String& errorType); > void didSelectOptionElement(uint64_t callbackID, const String& errorType); > void didTakeScreenshot(uint64_t callbackID, const ShareableBitmap::Handle&, const String& errorType); > void didGetCookiesForFrame(uint64_t callbackID, Vector<WebCore::Cookie>, const String& errorType); >@@ -237,14 +237,14 @@ private: > // Simulates key presses to produce the codepoints in a string. One or more code points are delivered atomically at grapheme cluster boundaries. > void platformSimulateKeySequence(WebPageProxy&, const String&); > // Get base64 encoded PNG data from a bitmap. >- std::optional<String> platformGetBase64EncodedPNGData(const ShareableBitmap::Handle&); >+ WTF::Optional<String> platformGetBase64EncodedPNGData(const ShareableBitmap::Handle&); > > #if PLATFORM(COCOA) > // The type parameter of the NSArray argument is platform-dependent. > void sendSynthesizedEventsToPage(WebPageProxy&, NSArray *eventsToSend); > >- std::optional<unichar> charCodeForVirtualKey(Inspector::Protocol::Automation::VirtualKey) const; >- std::optional<unichar> charCodeIgnoringModifiersForVirtualKey(Inspector::Protocol::Automation::VirtualKey) const; >+ WTF::Optional<unichar> charCodeForVirtualKey(Inspector::Protocol::Automation::VirtualKey) const; >+ WTF::Optional<unichar> charCodeIgnoringModifiersForVirtualKey(Inspector::Protocol::Automation::VirtualKey) const; > #endif > > WebProcessPool* m_processPool { nullptr }; >@@ -267,8 +267,8 @@ private: > HashMap<uint64_t, RefPtr<Inspector::BackendDispatcher::CallbackBase>> m_pendingNormalNavigationInBrowsingContextCallbacksPerFrame; > HashMap<uint64_t, RefPtr<Inspector::BackendDispatcher::CallbackBase>> m_pendingEagerNavigationInBrowsingContextCallbacksPerFrame; > HashMap<uint64_t, RefPtr<Inspector::BackendDispatcher::CallbackBase>> m_pendingInspectorCallbacksPerPage; >- HashMap<uint64_t, Function<void(std::optional<AutomationCommandError>)>> m_pendingKeyboardEventsFlushedCallbacksPerPage; >- HashMap<uint64_t, Function<void(std::optional<AutomationCommandError>)>> m_pendingMouseEventsFlushedCallbacksPerPage; >+ HashMap<uint64_t, Function<void(WTF::Optional<AutomationCommandError>)>> m_pendingKeyboardEventsFlushedCallbacksPerPage; >+ HashMap<uint64_t, Function<void(WTF::Optional<AutomationCommandError>)>> m_pendingMouseEventsFlushedCallbacksPerPage; > > uint64_t m_nextEvaluateJavaScriptCallbackID { 1 }; > HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>> m_evaluateJavaScriptFunctionCallbacks; >@@ -285,7 +285,7 @@ private: > > // Start at 3 and use only odd numbers to not conflict with m_nextComputeElementLayoutCallbackID. > uint64_t m_nextViewportInViewCenterPointOfElementCallbackID { 3 }; >- HashMap<uint64_t, Function<void(std::optional<WebCore::IntPoint>, std::optional<AutomationCommandError>)>> m_viewportInViewCenterPointOfElementCallbacks; >+ HashMap<uint64_t, Function<void(WTF::Optional<WebCore::IntPoint>, WTF::Optional<AutomationCommandError>)>> m_viewportInViewCenterPointOfElementCallbacks; > > uint64_t m_nextScreenshotCallbackID { 1 }; > HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::TakeScreenshotCallback>> m_screenshotCallbacks; >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.messages.in b/Source/WebKit/UIProcess/Automation/WebAutomationSession.messages.in >index bc473b6e01e16115485be838725f1560dfbef7ef..c9a812f7ecf7299f3b1a69f72f1d0e7cc63b16f9 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.messages.in >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.messages.in >@@ -26,7 +26,7 @@ messages -> WebAutomationSession { > DidResolveChildFrame(uint64_t callbackID, uint64_t frameID, String errorType) > DidResolveParentFrame(uint64_t callbackID, uint64_t frameID, String errorType) > >- DidComputeElementLayout(uint64_t callbackID, WebCore::IntRect rect, std::optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured, String errorType) >+ DidComputeElementLayout(uint64_t callbackID, WebCore::IntRect rect, WTF::Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured, String errorType) > > DidSelectOptionElement(uint64_t callbackID, String errorType) > >diff --git a/Source/WebKit/UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp b/Source/WebKit/UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp >index f15ba68d1dfdca0056cc6cddf27cf6d72d1161d1..26e9684c50c6b845950983e3a30b3b1bca55ee5d 100644 >--- a/Source/WebKit/UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp >+++ b/Source/WebKit/UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp >@@ -33,15 +33,15 @@ > namespace WebKit { > using namespace WebCore; > >-std::optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle& handle) >+WTF::Optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle& handle) > { > RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle, SharedMemory::Protection::ReadOnly); > if (!bitmap) >- return std::nullopt; >+ return WTF::nullopt; > > auto surface = bitmap->createCairoSurface(); > if (!surface) >- return std::nullopt; >+ return WTF::nullopt; > > Vector<unsigned char> pngData; > cairo_surface_write_to_png_stream(surface.get(), [](void* userData, const unsigned char* data, unsigned length) -> cairo_status_t { >@@ -51,7 +51,7 @@ std::optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(cons > }, &pngData); > > if (pngData.isEmpty()) >- return std::nullopt; >+ return WTF::nullopt; > > return base64Encode(pngData); > } >diff --git a/Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm b/Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm >index 67f1222a746c672c687d2afbd278c1db53898bcb..94966304f1b6efda8baa7270389647fa715b120d 100644 >--- a/Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm >+++ b/Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm >@@ -37,17 +37,17 @@ > namespace WebKit { > using namespace WebCore; > >-std::optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle& imageDataHandle) >+WTF::Optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle& imageDataHandle) > { > RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(imageDataHandle, SharedMemory::Protection::ReadOnly); > if (!bitmap) >- return std::nullopt; >+ return WTF::nullopt; > > RetainPtr<CGImageRef> cgImage = bitmap->makeCGImage(); > RetainPtr<NSMutableData> imageData = adoptNS([[NSMutableData alloc] init]); > RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData((CFMutableDataRef)imageData.get(), kUTTypePNG, 1, 0)); > if (!destination) >- return std::nullopt; >+ return WTF::nullopt; > > CGImageDestinationAddImage(destination.get(), cgImage.get(), 0); > CGImageDestinationFinalize(destination.get()); >@@ -55,7 +55,7 @@ std::optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(cons > return String([imageData base64EncodedStringWithOptions:0]); > } > >-std::optional<unichar> WebAutomationSession::charCodeForVirtualKey(Inspector::Protocol::Automation::VirtualKey key) const >+WTF::Optional<unichar> WebAutomationSession::charCodeForVirtualKey(Inspector::Protocol::Automation::VirtualKey key) const > { > switch (key) { > case Inspector::Protocol::Automation::VirtualKey::Shift: >@@ -63,7 +63,7 @@ std::optional<unichar> WebAutomationSession::charCodeForVirtualKey(Inspector::Pr > case Inspector::Protocol::Automation::VirtualKey::Alternate: > case Inspector::Protocol::Automation::VirtualKey::Meta: > case Inspector::Protocol::Automation::VirtualKey::Command: >- return std::nullopt; >+ return WTF::nullopt; > case Inspector::Protocol::Automation::VirtualKey::Help: > return NSHelpFunctionKey; > case Inspector::Protocol::Automation::VirtualKey::Backspace: >@@ -167,11 +167,11 @@ std::optional<unichar> WebAutomationSession::charCodeForVirtualKey(Inspector::Pr > case Inspector::Protocol::Automation::VirtualKey::Function12: > return NSF12FunctionKey; > default: >- return std::nullopt; >+ return WTF::nullopt; > } > } > >-std::optional<unichar> WebAutomationSession::charCodeIgnoringModifiersForVirtualKey(Inspector::Protocol::Automation::VirtualKey key) const >+WTF::Optional<unichar> WebAutomationSession::charCodeIgnoringModifiersForVirtualKey(Inspector::Protocol::Automation::VirtualKey key) const > { > switch (key) { > case Inspector::Protocol::Automation::VirtualKey::NumberPadMultiply: >diff --git a/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm b/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm >index ad00c1f74531db5d8035c20750436294d933ec8a..171921cc74ec2119bda2b6ea6fba814729aa4ac2 100644 >--- a/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm >+++ b/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm >@@ -72,8 +72,8 @@ void WebAutomationSession::platformSimulateKeyboardInteraction(WebPageProxy& pag > // UIKit does not send key codes for virtual keys even for a hardware keyboard. > // Instead, it sends single unichars and WebCore maps these to "windows" key codes. > // Synthesize a single unichar such that the correct key code is inferred. >- std::optional<unichar> charCode; >- std::optional<unichar> charCodeIgnoringModifiers; >+ WTF::Optional<unichar> charCode; >+ WTF::Optional<unichar> charCodeIgnoringModifiers; > > // Figure out the effects of sticky modifiers. > WTF::switchOn(key, >diff --git a/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm b/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm >index daeaa4fdac42f7e6d3454671b35422d9b30e39f4..976931bfe03179787d0b201f90b63df5cdf31f94 100644 >--- a/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm >+++ b/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm >@@ -574,8 +574,8 @@ void WebAutomationSession::platformSimulateKeyboardInteraction(WebPageProxy& pag > bool isStickyModifier = false; > NSEventModifierFlags changedModifiers = 0; > int keyCode = 0; >- std::optional<unichar> charCode; >- std::optional<unichar> charCodeIgnoringModifiers; >+ WTF::Optional<unichar> charCode; >+ WTF::Optional<unichar> charCodeIgnoringModifiers; > > WTF::switchOn(key, > [&] (VirtualKey virtualKey) { >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >index 32e95d8b5f2d1e4f03541279b6bc4c8053c294d1..c27aac39611a35adc0fddfbb53b938d8e4ba5210 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >@@ -56,7 +56,7 @@ private: > void acceptCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy&) override; > String messageOfCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy&) override; > void setUserInputForCurrentJavaScriptPromptOnPage(WebAutomationSession&, WebPageProxy&, const String&) override; >- std::optional<API::AutomationSessionClient::JavaScriptDialogType> typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy&) override; >+ WTF::Optional<API::AutomationSessionClient::JavaScriptDialogType> typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy&) override; > > WeakObjCPtr<id <_WKAutomationSessionDelegate>> m_delegate; > >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >index efb1e6be0296e0343e84c215ea0a0527626fb08a..fdf571d286df815951aa6faddc17c59c1d11559f 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >@@ -201,11 +201,11 @@ void AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage(WebAu > [m_delegate.get() _automationSession:wrapper(session) setUserInput:value forCurrentJavaScriptDialogOnPage:toAPI(&page)]; > } > >-static std::optional<API::AutomationSessionClient::JavaScriptDialogType> toImpl(_WKAutomationSessionJavaScriptDialogType type) >+static WTF::Optional<API::AutomationSessionClient::JavaScriptDialogType> toImpl(_WKAutomationSessionJavaScriptDialogType type) > { > switch (type) { > case _WKAutomationSessionJavaScriptDialogTypeNone: >- return std::nullopt; >+ return WTF::nullopt; > case _WKAutomationSessionJavaScriptDialogTypePrompt: > return API::AutomationSessionClient::JavaScriptDialogType::Prompt; > case _WKAutomationSessionJavaScriptDialogTypeConfirm: >@@ -215,7 +215,7 @@ static std::optional<API::AutomationSessionClient::JavaScriptDialogType> toImpl( > } > } > >-std::optional<API::AutomationSessionClient::JavaScriptDialogType> AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page) >+WTF::Optional<API::AutomationSessionClient::JavaScriptDialogType> AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page) > { > if (m_delegateMethods.typeOfCurrentJavaScriptDialogForWebView) > return toImpl([m_delegate.get() _automationSession:wrapper(session) typeOfCurrentJavaScriptDialogForWebView:fromWebPageProxy(page)]); >diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >index ce84a8884789735d1a132b1eb6ea6de2803a786d..f25c6323fb1e48a1c8e4e21f09da4a97b891fa88 100644 >--- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >+++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >@@ -234,7 +234,7 @@ void UIDelegate::UIClient::createNewPage(WebPageProxy& page, Ref<API::FrameInfo> > > auto userInitiatedActivity = page.process().userInitiatedActivity(navigationActionData.userGestureTokenIdentifier); > bool shouldOpenAppLinks = !hostsAreEqual(sourceFrameInfo->request().url(), request.url()); >- auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, std::nullopt, WTFMove(request), URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity)); >+ auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, WTF::nullopt, WTFMove(request), URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity)); > > auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures); > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h >index 01a19fd358a8c45e5c0d94b73b3ed42a88c727e3..ff43fbf108611bac0a942a10b8e3b1337956ef4d 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h >@@ -277,8 +277,8 @@ public: > _WKRectEdge rubberBandingEnabled(); > void setRubberBandingEnabled(_WKRectEdge); > >- void setOverlayScrollbarStyle(std::optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle); >- std::optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() const; >+ void setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle); >+ WTF::Optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() const; > > void beginDeferringViewInWindowChanges(); > // FIXME: Merge these two? >@@ -779,7 +779,7 @@ private: > String m_promisedFilename; > String m_promisedURL; > >- std::optional<NSInteger> m_spellCheckerDocumentTag; >+ WTF::Optional<NSInteger> m_spellCheckerDocumentTag; > > CGFloat m_totalHeightOfBanners { 0 }; > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index 153650840a0036b3360d4079448ee07059a313b2..9f5606d81eb14de476daeb624d9b63df12f5ce07 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -1868,7 +1868,7 @@ void WebViewImpl::updateViewExposedRect() > exposedRect = CGRectUnion(m_contentPreparationRect, exposedRect); > > if (auto drawingArea = m_page->drawingArea()) >- drawingArea->setViewExposedRect(m_clipsToVisibleRect ? std::optional<WebCore::FloatRect>(exposedRect) : std::nullopt); >+ drawingArea->setViewExposedRect(m_clipsToVisibleRect ? WTF::Optional<WebCore::FloatRect>(exposedRect) : WTF::nullopt); > } > > void WebViewImpl::setClipsToVisibleRect(bool clipsToVisibleRect) >@@ -2324,12 +2324,12 @@ NSColor *WebViewImpl::pageExtendedBackgroundColor() const > return WebCore::nsColor(color); > } > >-void WebViewImpl::setOverlayScrollbarStyle(std::optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle) >+void WebViewImpl::setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle) > { > m_page->setOverlayScrollbarStyle(scrollbarStyle); > } > >-std::optional<WebCore::ScrollbarOverlayStyle> WebViewImpl::overlayScrollbarStyle() const >+WTF::Optional<WebCore::ScrollbarOverlayStyle> WebViewImpl::overlayScrollbarStyle() const > { > return m_page->overlayScrollbarStyle(); > } >diff --git a/Source/WebKit/UIProcess/DrawingAreaProxy.cpp b/Source/WebKit/UIProcess/DrawingAreaProxy.cpp >index 3efa1de9a92693d9077ad49aabd3ccdc0f9dff03..a71b73cb8d1c260fbaed438060eca7ce61d56593 100644 >--- a/Source/WebKit/UIProcess/DrawingAreaProxy.cpp >+++ b/Source/WebKit/UIProcess/DrawingAreaProxy.cpp >@@ -73,7 +73,7 @@ MachSendRight DrawingAreaProxy::createFence() > #endif > > #if PLATFORM(MAC) >-void DrawingAreaProxy::setViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect) >+void DrawingAreaProxy::setViewExposedRect(WTF::Optional<WebCore::FloatRect> viewExposedRect) > { > if (!m_webPageProxy.isValid()) > return; >diff --git a/Source/WebKit/UIProcess/DrawingAreaProxy.h b/Source/WebKit/UIProcess/DrawingAreaProxy.h >index a1a2daa82a4c1178de067dc2c60c0306cc122822..bbf748eb410949dd8a1378977094efc129766804 100644 >--- a/Source/WebKit/UIProcess/DrawingAreaProxy.h >+++ b/Source/WebKit/UIProcess/DrawingAreaProxy.h >@@ -77,8 +77,8 @@ public: > virtual void commitTransientZoom(double, WebCore::FloatPoint) { } > > #if PLATFORM(MAC) >- virtual void setViewExposedRect(std::optional<WebCore::FloatRect>); >- std::optional<WebCore::FloatRect> viewExposedRect() const { return m_viewExposedRect; } >+ virtual void setViewExposedRect(WTF::Optional<WebCore::FloatRect>); >+ WTF::Optional<WebCore::FloatRect> viewExposedRect() const { return m_viewExposedRect; } > void viewExposedRectChangedTimerFired(); > #endif > >@@ -136,8 +136,8 @@ private: > > #if PLATFORM(MAC) > RunLoop::Timer<DrawingAreaProxy> m_viewExposedRectChangedTimer; >- std::optional<WebCore::FloatRect> m_viewExposedRect; >- std::optional<WebCore::FloatRect> m_lastSentViewExposedRect; >+ WTF::Optional<WebCore::FloatRect> m_viewExposedRect; >+ WTF::Optional<WebCore::FloatRect> m_lastSentViewExposedRect; > #endif // PLATFORM(MAC) > #endif > }; >diff --git a/Source/WebKit/UIProcess/GenericCallback.h b/Source/WebKit/UIProcess/GenericCallback.h >index ef5f8ded1c64bf754f1b765fd314fc4411ff8b37..f52e14383c8d68f37a1b9058923848228cb2bfde 100644 >--- a/Source/WebKit/UIProcess/GenericCallback.h >+++ b/Source/WebKit/UIProcess/GenericCallback.h >@@ -105,7 +105,7 @@ public: > if (!m_callback) > return; > >- auto callback = std::exchange(m_callback, std::nullopt); >+ auto callback = std::exchange(m_callback, WTF::nullopt); > callback.value()(returnValue..., Error::None); > } > >@@ -121,7 +121,7 @@ public: > if (!m_callback) > return; > >- auto callback = std::exchange(m_callback, std::nullopt); >+ auto callback = std::exchange(m_callback, WTF::nullopt); > callback.value()(typename std::remove_reference<T>::type()..., error); > } > >@@ -139,7 +139,7 @@ private: > return &tag; > } > >- std::optional<CallbackFunction> m_callback; >+ WTF::Optional<CallbackFunction> m_callback; > > #ifndef NDEBUG > Ref<Thread> m_originThread { Thread::current() }; >diff --git a/Source/WebKit/UIProcess/LegacySessionStateCodingNone.cpp b/Source/WebKit/UIProcess/LegacySessionStateCodingNone.cpp >index c22ec6e1b6aca7aa9b7a745169788eaba3013853..caa553d7540605e5e2e9c9a9662276224f9d2f79 100644 >--- a/Source/WebKit/UIProcess/LegacySessionStateCodingNone.cpp >+++ b/Source/WebKit/UIProcess/LegacySessionStateCodingNone.cpp >@@ -48,7 +48,7 @@ RefPtr<API::Data> encodeLegacySessionState(const SessionState& sessionState) > bool decodeLegacySessionState(const uint8_t* data, size_t dataSize, SessionState& sessionState) > { > IPC::Decoder decoder(data, dataSize, nullptr, Vector<IPC::Attachment>()); >- std::optional<BackForwardListState> backForwardListState; >+ WTF::Optional<BackForwardListState> backForwardListState; > decoder >> backForwardListState; > if (!backForwardListState) > return false; >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index 9d31b59e8881f732abc532ef4c6265f3c43df22e..c5f31724d5f9c3ccc936b68d8473896654b16924 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >@@ -419,7 +419,7 @@ void NetworkProcessProxy::didUpdateBlockCookies(uint64_t callbackId) > m_updateBlockCookiesCallbackMap.take(callbackId)(); > } > >-void NetworkProcessProxy::setAgeCapForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) >+void NetworkProcessProxy::setAgeCapForClientSideCookies(PAL::SessionID sessionID, WTF::Optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) > { > if (!canSendMessage()) { > completionHandler(); >@@ -447,7 +447,7 @@ void NetworkProcessProxy::hasStorageAccessForFrame(PAL::SessionID sessionID, con > send(Messages::NetworkProcess::HasStorageAccessForFrame(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0); > } > >-void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback) >+void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback) > { > auto contextId = generateCallbackID(); > auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); >@@ -719,7 +719,7 @@ void NetworkProcessProxy::getSandboxExtensionsForBlobFiles(const Vector<String>& > #if ENABLE(SERVICE_WORKER) > void NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess(SecurityOriginData&& origin) > { >- m_processPool.establishWorkerContextConnectionToNetworkProcess(*this, WTFMove(origin), std::nullopt); >+ m_processPool.establishWorkerContextConnectionToNetworkProcess(*this, WTFMove(origin), WTF::nullopt); > } > > void NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession(SecurityOriginData&& origin, PAL::SessionID sessionID) >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >index 7e492387e85e024393ba16e9425db39e66c87ade..04a6da64b11844e8a66fb850b6e3e316ccbf31b9 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >@@ -78,10 +78,10 @@ public: > > #if ENABLE(RESOURCE_LOAD_STATISTICS) > void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<String>& domainsToBlock, CompletionHandler<void()>&&); >- void setAgeCapForClientSideCookies(PAL::SessionID, std::optional<Seconds>, CompletionHandler<void()>&&); >+ void setAgeCapForClientSideCookies(PAL::SessionID, WTF::Optional<Seconds>, CompletionHandler<void()>&&); > void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); > void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String>&& domains)>&&); >- void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); >+ void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); > void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&); > void setCacheMaxAgeCapForPrevalentResources(PAL::SessionID, Seconds, CompletionHandler<void()>&&); > void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&); >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index c5179af75eedc2a1da87c7014b48301894d104e2..015459612accb672794f29228498b9fa7294ec64 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -358,8 +358,8 @@ public: > virtual void layerTreeCommitComplete() = 0; > > virtual void couldNotRestorePageState() = 0; >- virtual void restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale) = 0; >- virtual void restorePageCenterAndScale(std::optional<WebCore::FloatPoint> center, double scale) = 0; >+ virtual void restorePageState(WTF::Optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale) = 0; >+ virtual void restorePageCenterAndScale(WTF::Optional<WebCore::FloatPoint> center, double scale) = 0; > > virtual void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) = 0; > virtual void stopAssistingNode() = 0; >@@ -448,7 +448,7 @@ public: > #if ENABLE(DATA_INTERACTION) > virtual void didHandleStartDataInteractionRequest(bool started) = 0; > virtual void didHandleAdditionalDragItemsRequest(bool added) = 0; >- virtual void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>) = 0; >+ virtual void didConcludeEditDataInteraction(WTF::Optional<WebCore::TextIndicatorData>) = 0; > virtual void didChangeDataInteractionCaretRect(const WebCore::IntRect& previousCaretRect, const WebCore::IntRect& caretRect) = 0; > #endif > >diff --git a/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp >index 5132b83bfaaaa13f476a663651cd36200664aef9..dc2733e82165bf57f3e5f37a34fd4781b6a68cff 100644 >--- a/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp >+++ b/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp >@@ -229,10 +229,10 @@ bool PluginInfoStore::isSupportedPlugin(const String& mimeType, const URL& plugi > }) != notFound; > } > >-std::optional<Vector<SupportedPluginIdentifier>> PluginInfoStore::supportedPluginIdentifiers() >+WTF::Optional<Vector<SupportedPluginIdentifier>> PluginInfoStore::supportedPluginIdentifiers() > { > if (!m_supportedPlugins) >- return std::nullopt; >+ return WTF::nullopt; > > return WTF::map(*m_supportedPlugins, [] (auto&& item) { > return SupportedPluginIdentifier { item.matchingDomain, item.identifier }; >diff --git a/Source/WebKit/UIProcess/Plugins/PluginInfoStore.h b/Source/WebKit/UIProcess/Plugins/PluginInfoStore.h >index 55597f344bf5139b9f5673c30f88c728157af99e..107d101be82b67ab77fa2fcf8b347e5779b7dffc 100644 >--- a/Source/WebKit/UIProcess/Plugins/PluginInfoStore.h >+++ b/Source/WebKit/UIProcess/Plugins/PluginInfoStore.h >@@ -60,9 +60,9 @@ public: > static PluginModuleLoadPolicy defaultLoadPolicyForPlugin(const PluginModuleInfo&); > > bool isSupportedPlugin(const String& mimeType, const URL& pluginURL, const String& frameURLString, const URL& pageURL); >- std::optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginIdentifiers(); >+ WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginIdentifiers(); > void addSupportedPlugin(String&& matchingDomain, String&& identifier, HashSet<String>&& mimeTypes, HashSet<String> extensions); >- void clearSupportedPlugins() { m_supportedPlugins = std::nullopt; } >+ void clearSupportedPlugins() { m_supportedPlugins = WTF::nullopt; } > > static bool shouldAllowPluginToRunUnsandboxed(const String& pluginBundleIdentifier); > >@@ -102,7 +102,7 @@ private: > }; > static bool isSupportedPlugin(const SupportedPlugin&, const String& mimeType, const URL& pluginURL); > >- std::optional<Vector<SupportedPlugin>> m_supportedPlugins; >+ WTF::Optional<Vector<SupportedPlugin>> m_supportedPlugins; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h >index d02a0eed0dad2134b427e4468c8591b269d57d07..05db2499a12a1ab36f8b68f1226c0a9f20c44acc 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h >@@ -70,7 +70,7 @@ private: > void dispatchAfterEnsuringDrawing(WTF::Function<void (CallbackBase::Error)>&&) override; > > #if PLATFORM(MAC) >- void setViewExposedRect(std::optional<WebCore::FloatRect>) override; >+ void setViewExposedRect(WTF::Optional<WebCore::FloatRect>) override; > #endif > > #if PLATFORM(IOS_FAMILY) >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm >index eb3e53af210269e417afae9c180004d223246802..a19ead05b38b59fab70a18a4e66e5bd5e15f5ccc 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm >@@ -275,7 +275,7 @@ void RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd(uint64_t layerI > static const float indicatorInset = 10; > > #if PLATFORM(MAC) >-void RemoteLayerTreeDrawingAreaProxy::setViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect) >+void RemoteLayerTreeDrawingAreaProxy::setViewExposedRect(WTF::Optional<WebCore::FloatRect> viewExposedRect) > { > DrawingAreaProxy::setViewExposedRect(viewExposedRect); > updateDebugIndicatorPosition(); >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp >index ea73ca2f233e8f2131a4dab809179d81c138e84f..4f53e036892b193dbfcef427e4264b541a711d48 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp >@@ -164,7 +164,7 @@ void RemoteScrollingCoordinatorProxy::currentSnapPointIndicesDidChange(WebCore:: > } > > // This comes from the scrolling tree. >-void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& newScrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) >+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& newScrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) > { > // Scroll updates for the main frame are sent via WebPageProxy::updateVisibleContentRects() > // so don't send them here. >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h >index 2ffc17ed7f5f5c2f87391677179d843c805f85a6..fe6dd5895c175536a2c0c0c2a8ddd9b088afd4a3 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h >@@ -54,7 +54,7 @@ public: > bool visualViewportEnabled() const { return m_scrollingTree && m_scrollingTree->visualViewportEnabled(); } > > // Inform the web process that the scroll position changed (called from the scrolling tree) >- void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition, const std::optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction); >+ void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition, const WTF::Optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction); > void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll); > > WebCore::TrackingType eventTrackingTypeForPoint(const AtomicString& eventName, WebCore::IntPoint) const; >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp >index ad91c920cb4e93f2f74d49ea447e3628b179637e..46eca938e1bbf068d4064c8695bf5d81516cbeae 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp >@@ -99,7 +99,7 @@ void RemoteScrollingTree::scrollingTreeNodeDidEndScroll() > > #endif > >-void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) >+void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const WTF::Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction) > { > m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(nodeID, scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction); > } >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h >index 45ecf0cc44b6682419e9e8aec953def64ff07b9f..0a03b113f493a6e8424f29cb857b58f6402b0b31 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h >@@ -45,7 +45,7 @@ public: > > const RemoteScrollingCoordinatorProxy& scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy; } > >- void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, const std::optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction = WebCore::ScrollingLayerPositionAction::Sync) override; >+ void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, const WTF::Optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction = WebCore::ScrollingLayerPositionAction::Sync) override; > void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll) override; > > void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) override; >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >index c9d22f6763fb7adc6ce912015982207568f600a7..6eec895ceab10bc07c1011f93089e44fd0811351 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >@@ -448,7 +448,7 @@ void ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener(String&& > #if !RELEASE_LOG_DISABLED > RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "[Temporary combatibility fix] Storage access was granted for %{public}s under opener page from %{public}s, with user interaction in the opened window.", primaryDomainInNeedOfStorageAccess.utf8().data(), openerPrimaryDomain.utf8().data()); > #endif >- grantStorageAccessInternal(WTFMove(primaryDomainInNeedOfStorageAccess), WTFMove(openerPrimaryDomain), std::nullopt, openerPageID, false, [](bool) { }); >+ grantStorageAccessInternal(WTFMove(primaryDomainInNeedOfStorageAccess), WTFMove(openerPrimaryDomain), WTF::nullopt, openerPageID, false, [](bool) { }); > } > > void ResourceLoadStatisticsMemoryStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler) >@@ -465,7 +465,7 @@ void ResourceLoadStatisticsMemoryStore::grantStorageAccess(String&& subFrameHost > grantStorageAccessInternal(WTFMove(subFramePrimaryDomain), WTFMove(topFramePrimaryDomain), frameID, pageID, userWasPromptedNow, WTFMove(completionHandler)); > } > >-void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, std::optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback) >+void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback) > { > ASSERT(!RunLoop::isMain()); > >@@ -587,7 +587,7 @@ void ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest > { > ASSERT(!RunLoop::isMain()); > >- m_pendingStatisticsProcessingRequestIdentifier = std::nullopt; >+ m_pendingStatisticsProcessingRequestIdentifier = WTF::nullopt; > } > > void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame) >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >index 65b3f18f20af65a2202bc455886e00883e301f02..8e85be5e91304c227db2cf968aad9d4b66115b76 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >@@ -144,7 +144,7 @@ private: > void setDebugLogggingEnabled(bool enabled) { m_debugLoggingEnabled = enabled; } > void setDataRecordsBeingRemoved(bool); > void scheduleStatisticsProcessingRequestIfNecessary(); >- void grantStorageAccessInternal(String&& subFrameHost, String&& topFrameHost, std::optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&); >+ void grantStorageAccessInternal(String&& subFrameHost, String&& topFrameHost, WTF::Optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&); > void markAsPrevalentIfHasRedirectedToPrevalent(WebCore::ResourceLoadStatistics&); > bool isPrevalentDueToDebugMode(WebCore::ResourceLoadStatistics&); > Vector<String> ensurePrevalentResourcesForDebugMode(); >@@ -164,7 +164,7 @@ private: > struct Parameters { > size_t pruneEntriesDownTo { 800 }; > size_t maxStatisticsEntries { 1000 }; >- std::optional<Seconds> timeToLiveUserInteraction; >+ WTF::Optional<Seconds> timeToLiveUserInteraction; > Seconds minimumTimeBetweenDataRecordsRemoval { 1_h }; > Seconds grandfatheringTime { 24_h * 7 }; > Seconds cacheMaxAgeCapTime { 24_h * 7 }; >@@ -197,7 +197,7 @@ private: > MonotonicTime m_lastTimeDataRecordsWereRemoved; > > uint64_t m_lastStatisticsProcessingRequestIdentifier { 0 }; >- std::optional<uint64_t> m_pendingStatisticsProcessingRequestIdentifier; >+ WTF::Optional<uint64_t> m_pendingStatisticsProcessingRequestIdentifier; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp b/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp >index 9e8fe42a8aaf0a12cf1e58a978dc6b51cf4bfbb8..51401dceee86e45159679dfe0878905fef4f9fba 100644 >--- a/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp >@@ -75,7 +75,7 @@ void ServiceWorkerProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& > launchOptions.extraInitializationData.add("security-origin"_s, securityOrigin().toString()); > } > >-void ServiceWorkerProcessProxy::start(const WebPreferencesStore& store, std::optional<PAL::SessionID> initialSessionID) >+void ServiceWorkerProcessProxy::start(const WebPreferencesStore& store, WTF::Optional<PAL::SessionID> initialSessionID) > { > send(Messages::WebProcess::EstablishWorkerContextConnectionToNetworkProcess { processPool().defaultPageGroup().pageGroupID(), m_serviceWorkerPageID, store, initialSessionID.value_or(PAL::SessionID::defaultSessionID()) }, 0); > } >diff --git a/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h b/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h >index cbdefdc38056b12dfc6b5f1c0ddd840c1ea6fe85..775e897ca1ab0acd2f9477d36b3f3c412afb20ef 100644 >--- a/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h >+++ b/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h >@@ -43,7 +43,7 @@ public: > > void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, Ref<AuthenticationChallengeProxy>&&); > >- void start(const WebPreferencesStore&, std::optional<PAL::SessionID> initialSessionID); >+ void start(const WebPreferencesStore&, WTF::Optional<PAL::SessionID> initialSessionID); > void setUserAgent(const String&); > void updatePreferencesStore(const WebPreferencesStore&); > >diff --git a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp >index 6595f9c0af33c9bac38c16e6fa3b3dbeca745f86..5f044894bd308545f86798c193f0ab14d1750925 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp >+++ b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp >@@ -46,7 +46,7 @@ const size_t maxTransportNumber = 1; > const unsigned maxTimeOutValue = 120000; > > // FIXME(188624, 188625): Support NFC and BLE authenticators. >-static AuthenticatorManager::TransportSet collectTransports(const std::optional<PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria>& authenticatorSelection) >+static AuthenticatorManager::TransportSet collectTransports(const WTF::Optional<PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria>& authenticatorSelection) > { > AuthenticatorManager::TransportSet result; > if (!authenticatorSelection || !authenticatorSelection->authenticatorAttachment) { >@@ -218,7 +218,7 @@ void AuthenticatorManager::startDiscovery(const TransportSet& transports) > } > } > >-void AuthenticatorManager::initTimeOutTimer(const std::optional<unsigned>& timeOutInMs) >+void AuthenticatorManager::initTimeOutTimer(const WTF::Optional<unsigned>& timeOutInMs) > { > using namespace AuthenticatorManagerInternal; > >diff --git a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h >index 2437ed6171839dd872d80323781429ea539a4ed5..eb992b980dbdb0493681b17b7498690f8ca4a05e 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h >+++ b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h >@@ -76,7 +76,7 @@ private: > virtual void respondReceivedInternal(Respond&&); > > void startDiscovery(const TransportSet&); >- void initTimeOutTimer(const std::optional<unsigned>& timeOutInMs); >+ void initTimeOutTimer(const WTF::Optional<unsigned>& timeOutInMs); > void timeOutTimerFired(); > > // Request: We only allow one request per time. >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp >index 4ef22e701c83424c0b739462f1b101dab3c6f12f..2a9ae468007246e8c46383e13a369fa45a9d116c 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp >+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp >@@ -174,7 +174,7 @@ void MockHidConnection::parseRequest() > } > > m_currentChannel = m_requestMessage->channelId(); >- m_requestMessage = std::nullopt; >+ m_requestMessage = WTF::nullopt; > if (m_configuration.hid->fastDataArrival) > feedReports(); > } >@@ -200,7 +200,7 @@ void MockHidConnection::feedReports() > return; > } > >- std::optional<FidoHidMessage> message; >+ WTF::Optional<FidoHidMessage> message; > if (m_stage == Mock::Stage::Info && m_subStage == Mock::SubStage::Msg) { > auto infoData = encodeAsCBOR(AuthenticatorGetInfoResponse({ ProtocolVersion::kCtap }, Vector<uint8_t>(kAaguidLength, 0u))); > infoData.insert(0, static_cast<uint8_t>(CtapDeviceResponseCode::kSuccess)); // Prepend status code. >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h >index 316477e8804d2d3972773ad807c38d3de06a0ebf..5aac380cf6fe68f6ed678ee23b9cfe4df8715cc4 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h >+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h >@@ -59,7 +59,7 @@ private: > void continueFeedReports(); > > MockWebAuthenticationConfiguration m_configuration; >- std::optional<fido::FidoHidMessage> m_requestMessage; >+ WTF::Optional<fido::FidoHidMessage> m_requestMessage; > MockWebAuthenticationConfiguration::Hid::Stage m_stage { MockWebAuthenticationConfiguration::Hid::Stage::Info }; > MockWebAuthenticationConfiguration::Hid::SubStage m_subStage { MockWebAuthenticationConfiguration::Hid::SubStage::Init }; > uint32_t m_currentChannel { fido::kHidBroadcastChannel }; >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h >index 305efd871754dbf737a68610d8dec03d7f4b234d..27c4e16d3bbf0fa4b1ca05b49c38dd318b496641 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h >+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h >@@ -71,8 +71,8 @@ struct MockWebAuthenticationConfiguration { > }; > > bool silentFailure { false }; >- std::optional<Local> local; >- std::optional<Hid> hid; >+ WTF::Optional<Local> local; >+ WTF::Optional<Hid> hid; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp b/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp >index f2155890f5c24ee45d97fa026ae71b1b6027dd65..cbab6d96e54879d701a2c3d7a3f57ccdf8475ec3 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp >+++ b/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp >@@ -72,7 +72,7 @@ void CtapHidDriver::Worker::write(HidConnection::DataSent sent) > // FIXME(192061) > LOG_ERROR("Start writing data."); > if (sent != HidConnection::DataSent::Yes) { >- returnMessage(std::nullopt); >+ returnMessage(WTF::nullopt); > return; > } > >@@ -111,7 +111,7 @@ void CtapHidDriver::Worker::read(const Vector<uint8_t>& data) > } else { > if (!m_responseMessage->addContinuationPacket(data)) { > LOG_ERROR("Couldn't parse a hid continuation packet."); >- returnMessage(std::nullopt); >+ returnMessage(WTF::nullopt); > return; > } > } >@@ -128,7 +128,7 @@ void CtapHidDriver::Worker::read(const Vector<uint8_t>& data) > } > } > >-void CtapHidDriver::Worker::returnMessage(std::optional<fido::FidoHidMessage>&& message) >+void CtapHidDriver::Worker::returnMessage(WTF::Optional<fido::FidoHidMessage>&& message) > { > // FIXME(192061) > LOG_ERROR("Start returning data."); >@@ -158,7 +158,7 @@ void CtapHidDriver::transact(Vector<uint8_t>&& data, ResponseCallback&& callback > cryptographicallyRandomValues(m_nonce.data(), m_nonce.size()); > auto initCommand = FidoHidMessage::create(m_channelId, FidoHidDeviceCommand::kInit, m_nonce); > ASSERT(initCommand); >- m_worker->transact(WTFMove(*initCommand), [weakThis = makeWeakPtr(*this)](std::optional<FidoHidMessage>&& response) mutable { >+ m_worker->transact(WTFMove(*initCommand), [weakThis = makeWeakPtr(*this)](WTF::Optional<FidoHidMessage>&& response) mutable { > ASSERT(RunLoop::isMain()); > if (!weakThis) > return; >@@ -166,7 +166,7 @@ void CtapHidDriver::transact(Vector<uint8_t>&& data, ResponseCallback&& callback > }); > } > >-void CtapHidDriver::continueAfterChannelAllocated(std::optional<FidoHidMessage>&& message) >+void CtapHidDriver::continueAfterChannelAllocated(WTF::Optional<FidoHidMessage>&& message) > { > ASSERT(m_state == State::AllocateChannel); > if (!message) { >@@ -199,7 +199,7 @@ void CtapHidDriver::continueAfterChannelAllocated(std::optional<FidoHidMessage>& > LOG_ERROR("Start sending the request."); > auto cmd = FidoHidMessage::create(m_channelId, FidoHidDeviceCommand::kCbor, m_requestData); > ASSERT(cmd); >- m_worker->transact(WTFMove(*cmd), [weakThis = makeWeakPtr(*this)](std::optional<FidoHidMessage>&& response) mutable { >+ m_worker->transact(WTFMove(*cmd), [weakThis = makeWeakPtr(*this)](WTF::Optional<FidoHidMessage>&& response) mutable { > ASSERT(RunLoop::isMain()); > if (!weakThis) > return; >@@ -207,7 +207,7 @@ void CtapHidDriver::continueAfterChannelAllocated(std::optional<FidoHidMessage>& > }); > } > >-void CtapHidDriver::continueAfterResponseReceived(std::optional<fido::FidoHidMessage>&& message) >+void CtapHidDriver::continueAfterResponseReceived(WTF::Optional<fido::FidoHidMessage>&& message) > { > ASSERT(m_state == State::Ready); > ASSERT(!message || message->channelId() == m_channelId); >diff --git a/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h b/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h >index 4923a3c18f846d41d34d64da5ba9912e0e750778..44ebed0bfd2d9bfe8236b67a63cd67a2bbcb2a3b 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h >+++ b/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h >@@ -67,7 +67,7 @@ private: > WTF_MAKE_FAST_ALLOCATED; > WTF_MAKE_NONCOPYABLE(Worker); > public: >- using MessageCallback = Function<void(std::optional<fido::FidoHidMessage>&&)>; >+ using MessageCallback = Function<void(WTF::Optional<fido::FidoHidMessage>&&)>; > > enum class State : uint8_t { > Idle, >@@ -83,17 +83,17 @@ private: > private: > void write(HidConnection::DataSent); > void read(const Vector<uint8_t>&); >- void returnMessage(std::optional<fido::FidoHidMessage>&&); >+ void returnMessage(WTF::Optional<fido::FidoHidMessage>&&); > > UniqueRef<HidConnection> m_connection; > State m_state { State::Idle }; >- std::optional<fido::FidoHidMessage> m_requestMessage; >- std::optional<fido::FidoHidMessage> m_responseMessage; >+ WTF::Optional<fido::FidoHidMessage> m_requestMessage; >+ WTF::Optional<fido::FidoHidMessage> m_responseMessage; > MessageCallback m_callback; > }; > >- void continueAfterChannelAllocated(std::optional<fido::FidoHidMessage>&&); >- void continueAfterResponseReceived(std::optional<fido::FidoHidMessage>&&); >+ void continueAfterChannelAllocated(WTF::Optional<fido::FidoHidMessage>&&); >+ void continueAfterResponseReceived(WTF::Optional<fido::FidoHidMessage>&&); > void returnResponse(Vector<uint8_t>&&); > > UniqueRef<Worker> m_worker; >diff --git a/Source/WebKit/UIProcess/WebBackForwardList.cpp b/Source/WebKit/UIProcess/WebBackForwardList.cpp >index 22ca4c3db4f6d031e6069783c1d78bcff6fe19dc..dad2c10e1c360ae736d99ca8b062ed98e40d6835 100644 >--- a/Source/WebKit/UIProcess/WebBackForwardList.cpp >+++ b/Source/WebKit/UIProcess/WebBackForwardList.cpp >@@ -82,7 +82,7 @@ void WebBackForwardList::pageClosed() > > m_page = nullptr; > m_entries.clear(); >- m_currentIndex = std::nullopt; >+ m_currentIndex = WTF::nullopt; > } > > void WebBackForwardList::addItem(Ref<WebBackForwardListItem>&& newItem) >@@ -114,7 +114,7 @@ void WebBackForwardList::addItem(Ref<WebBackForwardListItem>&& newItem) > m_entries.remove(0); > > if (m_entries.isEmpty()) >- m_currentIndex = std::nullopt; >+ m_currentIndex = WTF::nullopt; > else > --*m_currentIndex; > } >@@ -340,7 +340,7 @@ void WebBackForwardList::removeAllItems() > } > > m_entries.clear(); >- m_currentIndex = std::nullopt; >+ m_currentIndex = WTF::nullopt; > m_page->didChangeBackForwardList(nullptr, WTFMove(removedItems)); > } > >@@ -368,7 +368,7 @@ void WebBackForwardList::clear() > } > > m_entries.clear(); >- m_currentIndex = std::nullopt; >+ m_currentIndex = WTF::nullopt; > m_page->didChangeBackForwardList(nullptr, WTFMove(removedItems)); > > return; >@@ -391,7 +391,7 @@ void WebBackForwardList::clear() > if (currentItem) > m_entries.append(currentItem.releaseNonNull()); > else >- m_currentIndex = std::nullopt; >+ m_currentIndex = WTF::nullopt; > m_page->didChangeBackForwardList(nullptr, WTFMove(removedItems)); > } > >@@ -418,7 +418,7 @@ BackForwardListState WebBackForwardList::backForwardListState(WTF::Function<bool > } > > if (backForwardListState.items.isEmpty()) >- backForwardListState.currentIndex = std::nullopt; >+ backForwardListState.currentIndex = WTF::nullopt; > else if (backForwardListState.items.size() <= backForwardListState.currentIndex.value()) > backForwardListState.currentIndex = backForwardListState.items.size() - 1; > >@@ -437,7 +437,7 @@ void WebBackForwardList::restoreFromState(BackForwardListState backForwardListSt > backForwardListItemState.identifier = { Process::identifier(), generateObjectIdentifier<BackForwardItemIdentifier::ItemIdentifierType>() }; > items.uncheckedAppend(WebBackForwardListItem::create(WTFMove(backForwardListItemState), m_page->pageID())); > } >- m_currentIndex = backForwardListState.currentIndex ? std::optional<size_t>(*backForwardListState.currentIndex) : std::nullopt; >+ m_currentIndex = backForwardListState.currentIndex ? WTF::Optional<size_t>(*backForwardListState.currentIndex) : WTF::nullopt; > m_entries = WTFMove(items); > > LOG(BackForward, "(Back/Forward) WebBackForwardList %p restored from state (has %zu entries)", this, m_entries.size()); >diff --git a/Source/WebKit/UIProcess/WebBackForwardList.h b/Source/WebKit/UIProcess/WebBackForwardList.h >index e7d86d758f6d8d90c505b764366dc6f4c4c141f2..49ebb79f6650357a18490ebf395636dc47e9c87a 100644 >--- a/Source/WebKit/UIProcess/WebBackForwardList.h >+++ b/Source/WebKit/UIProcess/WebBackForwardList.h >@@ -86,7 +86,7 @@ private: > > WebPageProxy* m_page; > BackForwardListItemVector m_entries; >- std::optional<size_t> m_currentIndex; >+ WTF::Optional<size_t> m_currentIndex; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h b/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h >index 2ad99f6592d9b470021ad6e87191ed3aaa9c450f..444c0c6fa7e7828f8bfe386e2d8f0025eca8ba6a 100644 >--- a/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h >+++ b/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h >@@ -60,8 +60,8 @@ public: > private: > WebFramePolicyListenerProxy(Reply&&, ShouldExpectSafeBrowsingResult); > >- std::optional<std::pair<RefPtr<API::WebsitePolicies>, ProcessSwapRequestedByClient>> m_policyResult; >- std::optional<RefPtr<SafeBrowsingWarning>> m_safeBrowsingWarning; >+ WTF::Optional<std::pair<RefPtr<API::WebsitePolicies>, ProcessSwapRequestedByClient>> m_policyResult; >+ WTF::Optional<RefPtr<SafeBrowsingWarning>> m_safeBrowsingWarning; > Reply m_reply; > }; > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index dbdd6cd70e0586a91c1315e43240fd4f75fb10dc..65e823a888190e09980cbb040fb97bcf41386a2e 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -741,7 +741,7 @@ void WebPageProxy::reattachToWebProcess() > finishAttachingToWebProcess(); > } > >-bool WebPageProxy::suspendCurrentPageIfPossible(API::Navigation& navigation, std::optional<uint64_t> mainFrameID, ProcessSwapRequestedByClient processSwapRequestedByClient) >+bool WebPageProxy::suspendCurrentPageIfPossible(API::Navigation& navigation, WTF::Optional<uint64_t> mainFrameID, ProcessSwapRequestedByClient processSwapRequestedByClient) > { > if (!mainFrameID) > return false; >@@ -859,7 +859,7 @@ RefPtr<API::Navigation> WebPageProxy::reattachToWebProcessForReload() > auto navigation = m_navigationState->createReloadNavigation(); > > // We allow stale content when reloading a WebProcess that's been killed or crashed. >- m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), m_backForwardList->currentItem()->itemID(), FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No, std::nullopt), m_pageID); >+ m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), m_backForwardList->currentItem()->itemID(), FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No, WTF::nullopt), m_pageID); > m_process->responsivenessTimer().start(); > > return WTFMove(navigation); >@@ -878,7 +878,7 @@ RefPtr<API::Navigation> WebPageProxy::reattachToWebProcessWithItem(WebBackForwar > > auto navigation = m_navigationState->createBackForwardNavigation(item, m_backForwardList->currentItem(), FrameLoadType::IndexedBackForward); > >- m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), item.itemID(), FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No, std::nullopt), m_pageID); >+ m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), item.itemID(), FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No, WTF::nullopt), m_pageID); > m_process->responsivenessTimer().start(); > > return WTFMove(navigation); >@@ -1049,7 +1049,7 @@ RefPtr<API::Navigation> WebPageProxy::loadRequest(ResourceRequest&& request, Sho > return WTFMove(navigation); > } > >-void WebPageProxy::loadRequestWithNavigation(API::Navigation& navigation, ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&& websitePolicies) >+void WebPageProxy::loadRequestWithNavigation(API::Navigation& navigation, ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&& websitePolicies) > { > ASSERT(!m_isClosed); > >@@ -1134,7 +1134,7 @@ RefPtr<API::Navigation> WebPageProxy::loadData(const IPC::DataReference& data, c > return WTFMove(navigation); > } > >-void WebPageProxy::loadDataWithNavigation(API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&& websitePolicies) >+void WebPageProxy::loadDataWithNavigation(API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&& websitePolicies) > { > ASSERT(!m_isClosed); > >@@ -1332,7 +1332,7 @@ RefPtr<API::Navigation> WebPageProxy::goToBackForwardItem(WebBackForwardListItem > if (!m_backForwardList->currentItem()->itemIsInSameDocument(item)) > navigation = m_navigationState->createBackForwardNavigation(item, m_backForwardList->currentItem(), frameLoadType); > >- m_process->send(Messages::WebPage::GoToBackForwardItem(navigation ? navigation->navigationID() : 0, item.itemID(), frameLoadType, ShouldTreatAsContinuingLoad::No, std::nullopt), m_pageID); >+ m_process->send(Messages::WebPage::GoToBackForwardItem(navigation ? navigation->navigationID() : 0, item.itemID(), frameLoadType, ShouldTreatAsContinuingLoad::No, WTF::nullopt), m_pageID); > m_process->responsivenessTimer().start(); > > return navigation; >@@ -2595,7 +2595,7 @@ void WebPageProxy::centerSelectionInVisibleArea() > > class WebPageProxy::PolicyDecisionSender : public RefCounted<PolicyDecisionSender> { > public: >- using SendFunction = CompletionHandler<void(WebPolicyAction, uint64_t newNavigationID, DownloadID, std::optional<WebsitePoliciesData>)>; >+ using SendFunction = CompletionHandler<void(WebPolicyAction, uint64_t newNavigationID, DownloadID, WTF::Optional<WebsitePoliciesData>)>; > static Ref<PolicyDecisionSender> create(SendFunction&& sendFunction) > { > return adoptRef(*new PolicyDecisionSender(WTFMove(sendFunction))); >@@ -2615,7 +2615,7 @@ private: > > void WebPageProxy::receivedNavigationPolicyDecision(WebPolicyAction policyAction, API::Navigation* navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, WebFrameProxy& frame, API::WebsitePolicies* policies, Ref<PolicyDecisionSender>&& sender) > { >- std::optional<WebsitePoliciesData> data; >+ WTF::Optional<WebsitePoliciesData> data; > if (policies) { > data = policies->data(); > if (policies->websiteDataStore()) >@@ -2642,17 +2642,17 @@ void WebPageProxy::receivedNavigationPolicyDecision(WebPolicyAction policyAction > RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "%p - WebPageProxy::decidePolicyForNavigationAction, keep using process %i for navigation, reason: %{public}s", this, processIdentifier(), reason.utf8().data()); > > bool shouldProcessSwap = processForNavigation.ptr() != &process(); >- receivedPolicyDecision(policyAction, navigation.ptr(), shouldProcessSwap ? std::nullopt : WTFMove(data), WTFMove(sender)); >+ receivedPolicyDecision(policyAction, navigation.ptr(), shouldProcessSwap ? WTF::nullopt : WTFMove(data), WTFMove(sender)); > > if (shouldProcessSwap) > continueNavigationInNewProcess(navigation, destinationSuspendedPage ? process().processPool().takeSuspendedPage(*destinationSuspendedPage) : nullptr, WTFMove(processForNavigation), processSwapRequestedByClient, WTFMove(data)); > }); > } > >-void WebPageProxy::receivedPolicyDecision(WebPolicyAction action, API::Navigation* navigation, std::optional<WebsitePoliciesData>&& websitePolicies, Ref<PolicyDecisionSender>&& sender) >+void WebPageProxy::receivedPolicyDecision(WebPolicyAction action, API::Navigation* navigation, WTF::Optional<WebsitePoliciesData>&& websitePolicies, Ref<PolicyDecisionSender>&& sender) > { > if (!isValid()) { >- sender->send(WebPolicyAction::Ignore, 0, DownloadID(), std::nullopt); >+ sender->send(WebPolicyAction::Ignore, 0, DownloadID(), WTF::nullopt); > return; > } > >@@ -2681,12 +2681,12 @@ void WebPageProxy::receivedPolicyDecision(WebPolicyAction action, API::Navigatio > sender->send(action, navigation ? navigation->navigationID() : 0, downloadID, WTFMove(websitePolicies)); > } > >-void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, std::unique_ptr<SuspendedPageProxy>&& suspendedPageProxy, Ref<WebProcessProxy>&& process, ProcessSwapRequestedByClient processSwapRequestedByClient, std::optional<WebsitePoliciesData>&& websitePolicies) >+void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, std::unique_ptr<SuspendedPageProxy>&& suspendedPageProxy, Ref<WebProcessProxy>&& process, ProcessSwapRequestedByClient processSwapRequestedByClient, WTF::Optional<WebsitePoliciesData>&& websitePolicies) > { > LOG(Loading, "Continuing navigation %" PRIu64 " '%s' in a new web process", navigation.navigationID(), navigation.loggingString()); > > Ref<WebProcessProxy> previousProcess = m_process.copyRef(); >- std::optional<uint64_t> mainFrameIDInPreviousProcess = m_mainFrame ? std::make_optional(m_mainFrame->frameID()) : std::nullopt; >+ WTF::Optional<uint64_t> mainFrameIDInPreviousProcess = m_mainFrame ? WTF::makeOptional(m_mainFrame->frameID()) : WTF::nullopt; > auto mainFrameURL = m_mainFrame ? m_mainFrame->url() : URL(); > > ASSERT(m_process.ptr() != process.ptr()); >@@ -3074,7 +3074,7 @@ void WebPageProxy::setCustomDeviceScaleFactor(float customScaleFactor) > if (customScaleFactor) > m_customDeviceScaleFactor = customScaleFactor; > else >- m_customDeviceScaleFactor = std::nullopt; >+ m_customDeviceScaleFactor = WTF::nullopt; > > if (deviceScaleFactor() != oldScaleFactor) > m_drawingArea->deviceScaleFactorDidChange(); >@@ -3889,7 +3889,7 @@ void WebPageProxy::clearLoadDependentCallbacks() > } > } > >-void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, std::optional<HasInsecureContent> hasInsecureContent, const UserData& userData) >+void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, WTF::Optional<HasInsecureContent> hasInsecureContent, const UserData& userData) > { > LOG(Loading, "(Loading) WebPageProxy %" PRIu64 " didCommitLoadForFrame in navigation %" PRIu64, m_pageID, m_navigationID); > LOG(BackForward, "(Back/Forward) After load commit, back/forward list is now:%s", m_backForwardList->loggingString()); >@@ -4315,7 +4315,7 @@ void WebPageProxy::decidePolicyForNavigationAction(WebFrameProxy& frame, WebCore > > #if ENABLE(CONTENT_FILTERING) > if (frame.didHandleContentFilterUnblockNavigation(request)) >- return receivedPolicyDecision(WebPolicyAction::Ignore, m_navigationState->navigation(newNavigationID), std::nullopt, WTFMove(sender)); >+ return receivedPolicyDecision(WebPolicyAction::Ignore, m_navigationState->navigation(newNavigationID), WTF::nullopt, WTFMove(sender)); > #else > UNUSED_PARAM(newNavigationID); > #endif >@@ -4379,7 +4379,7 @@ void WebPageProxy::decidePolicyForNavigationAction(WebFrameProxy& frame, WebCore > auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier); > bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision && destinationFrameInfo->isMainFrame() && !hostsAreEqual(URL({ }, m_mainFrame->url()), request.url()) && navigationActionData.navigationType != WebCore::NavigationType::BackForward; > >- auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), destinationFrameInfo.ptr(), std::nullopt, WTFMove(request), originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity), mainFrameNavigation); >+ auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), destinationFrameInfo.ptr(), WTF::nullopt, WTFMove(request), originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity), mainFrameNavigation); > > m_navigationClient->decidePolicyForNavigationAction(*this, WTFMove(navigationAction), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get()); > } >@@ -4406,7 +4406,7 @@ void WebPageProxy::decidePolicyForNavigationActionSync(uint64_t frameID, bool is > decidePolicyForNavigationAction(*frame, WTFMove(frameSecurityOrigin), navigationID, WTFMove(navigationActionData), WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, sender.copyRef()); > > // If the client did not respond synchronously, proceed with the load. >- sender->send(WebPolicyAction::Use, navigationID, DownloadID(), std::nullopt); >+ sender->send(WebPolicyAction::Use, navigationID, DownloadID(), WTF::nullopt); > } > > void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, NavigationActionData&& navigationActionData, ResourceRequest&& request, const String& frameName, uint64_t listenerID, const UserData& userData) >@@ -4421,7 +4421,7 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, const Securi > // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away. > RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No); > ASSERT_UNUSED(safeBrowsingWarning, !safeBrowsingWarning); >- receivedPolicyDecision(policyAction, nullptr, std::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) { >+ receivedPolicyDecision(policyAction, nullptr, WTF::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) { > m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID); > })); > }, ShouldExpectSafeBrowsingResult::No)); >@@ -4459,7 +4459,7 @@ void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const SecurityOrigi > // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away. > RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No); > ASSERT_UNUSED(safeBrowsingWarning, !safeBrowsingWarning); >- receivedPolicyDecision(policyAction, navigation.get(), std::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) { >+ receivedPolicyDecision(policyAction, navigation.get(), WTF::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) { > m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID); > })); > }, ShouldExpectSafeBrowsingResult::No)); >@@ -5216,13 +5216,13 @@ void WebPageProxy::backForwardGoToItem(const BackForwardItemIdentifier& itemID, > m_backForwardList->goToItem(*item); > } > >-void WebPageProxy::backForwardItemAtIndex(int32_t index, std::optional<BackForwardItemIdentifier>& itemID) >+void WebPageProxy::backForwardItemAtIndex(int32_t index, WTF::Optional<BackForwardItemIdentifier>& itemID) > { > WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index); > if (item) > itemID = item->itemID(); > else >- itemID = std::nullopt; >+ itemID = WTF::nullopt; > } > > void WebPageProxy::backForwardBackListCount(uint32_t& count) >@@ -6030,7 +6030,7 @@ void WebPageProxy::editingRangeCallback(const EditingRange& range, CallbackID ca > } > > #if ENABLE(APPLICATION_MANIFEST) >-void WebPageProxy::applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>& manifestOrNull, CallbackID callbackID) >+void WebPageProxy::applicationManifestCallback(const WTF::Optional<WebCore::ApplicationManifest>& manifestOrNull, CallbackID callbackID) > { > auto callback = m_callbacks.take<ApplicationManifestCallback>(callbackID); > if (!callback) >@@ -6563,7 +6563,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() > if (m_scrollbarOverlayStyle) > parameters.scrollbarOverlayStyle = m_scrollbarOverlayStyle.value(); > else >- parameters.scrollbarOverlayStyle = std::nullopt; >+ parameters.scrollbarOverlayStyle = WTF::nullopt; > parameters.backgroundExtendsBeyondPage = m_backgroundExtendsBeyondPage; > parameters.layerHostingMode = m_layerHostingMode; > parameters.controlledByAutomation = m_controlledByAutomation; >@@ -6619,7 +6619,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() > #endif > > #if ENABLE(APPLICATION_MANIFEST) >- parameters.applicationManifest = m_configuration->applicationManifest() ? std::optional<WebCore::ApplicationManifest>(m_configuration->applicationManifest()->applicationManifest()) : std::nullopt; >+ parameters.applicationManifest = m_configuration->applicationManifest() ? WTF::Optional<WebCore::ApplicationManifest>(m_configuration->applicationManifest()->applicationManifest()) : WTF::nullopt; > #endif > > parameters.needsFontAttributes = m_needsFontAttributes; >@@ -7258,7 +7258,7 @@ void WebPageProxy::setScrollPinningBehavior(ScrollPinningBehavior pinning) > m_process->send(Messages::WebPage::SetScrollPinningBehavior(pinning), m_pageID); > } > >-void WebPageProxy::setOverlayScrollbarStyle(std::optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle) >+void WebPageProxy::setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle) > { > if (!m_scrollbarOverlayStyle && !scrollbarStyle) > return; >@@ -7268,7 +7268,7 @@ void WebPageProxy::setOverlayScrollbarStyle(std::optional<WebCore::ScrollbarOver > > m_scrollbarOverlayStyle = scrollbarStyle; > >- std::optional<uint32_t> scrollbarStyleForMessage; >+ WTF::Optional<uint32_t> scrollbarStyleForMessage; > if (scrollbarStyle) > scrollbarStyleForMessage = static_cast<ScrollbarOverlayStyle>(scrollbarStyle.value()); > >@@ -8253,10 +8253,10 @@ void WebPageProxy::writeBlobToFilePath(const URL& url, const String& path, Funct > } > > #if ENABLE(APPLICATION_MANIFEST) >-void WebPageProxy::getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&& callbackFunction) >+void WebPageProxy::getApplicationManifest(Function<void(const WTF::Optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&& callbackFunction) > { > if (!isValid()) { >- callbackFunction(std::nullopt, CallbackBase::Error::Unknown); >+ callbackFunction(WTF::nullopt, CallbackBase::Error::Unknown); > return; > } > >@@ -8305,7 +8305,7 @@ void WebPageProxy::reportPageLoadResult(const ResourceError& error) > return; > > auto pageLoadTime = MonotonicTime::now() - *m_pageLoadStart; >- m_pageLoadStart = std::nullopt; >+ m_pageLoadStart = WTF::nullopt; > > CompletionCondition condition { CompletionCondition::Success }; > if (error.isCancellation()) >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 9df6390f90fabc2172384d00ce67395bc490f5df..586fcd5799dbb6d051640e5864d430fd226b1447 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -299,7 +299,7 @@ typedef GenericCallback<const String&, bool, int32_t> ValidateCommandCallback; > typedef GenericCallback<const WebCore::IntRect&, const EditingRange&> RectForCharacterRangeCallback; > > #if ENABLE(APPLICATION_MANIFEST) >-typedef GenericCallback<const std::optional<WebCore::ApplicationManifest>&> ApplicationManifestCallback; >+typedef GenericCallback<const WTF::Optional<WebCore::ApplicationManifest>&> ApplicationManifestCallback; > #endif > > #if PLATFORM(MAC) >@@ -568,7 +568,7 @@ public: > > void setBaseWritingDirection(WebCore::WritingDirection); > >- std::optional<WebCore::FontAttributes> cachedFontAttributesAtSelectionStart() const { return m_cachedFontAttributesAtSelectionStart; } >+ WTF::Optional<WebCore::FontAttributes> cachedFontAttributesAtSelectionStart() const { return m_cachedFontAttributesAtSelectionStart; } > > #if PLATFORM(COCOA) > const TouchBarMenuData& touchBarMenuData() const { return m_touchBarMenuData; } >@@ -612,7 +612,7 @@ public: > void setMaximumUnobscuredSize(const WebCore::FloatSize&); > void setDeviceOrientation(int32_t); > int32_t deviceOrientation() const { return m_deviceOrientation; } >- void setOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>&); >+ void setOverrideViewportArguments(const WTF::Optional<WebCore::ViewportArguments>&); > void willCommitLayerTree(uint64_t transactionID); > > void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>&&); >@@ -675,7 +675,7 @@ public: > void didHandleAdditionalDragItemsRequest(bool added); > void requestStartDataInteraction(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition); > void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition); >- void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>); >+ void didConcludeEditDataInteraction(WTF::Optional<WebCore::TextIndicatorData>); > #endif > #endif > #if ENABLE(DATA_DETECTION) >@@ -962,7 +962,7 @@ public: > #endif > > class PolicyDecisionSender; >- void receivedPolicyDecision(WebPolicyAction, API::Navigation*, std::optional<WebsitePoliciesData>&&, Ref<PolicyDecisionSender>&&); >+ void receivedPolicyDecision(WebPolicyAction, API::Navigation*, WTF::Optional<WebsitePoliciesData>&&, Ref<PolicyDecisionSender>&&); > void receivedNavigationPolicyDecision(WebPolicyAction, API::Navigation*, ProcessSwapRequestedByClient, WebFrameProxy&, API::WebsitePolicies*, Ref<PolicyDecisionSender>&&); > > void backForwardRemovedItem(const WebCore::BackForwardItemIdentifier&); >@@ -1107,7 +1107,7 @@ public: > #endif > > #if ENABLE(PDFKIT_PLUGIN) >- void showPDFContextMenu(const WebKit::PDFContextMenu&, std::optional<int32_t>& selectedIndex); >+ void showPDFContextMenu(const WebKit::PDFContextMenu&, WTF::Optional<int32_t>& selectedIndex); > #endif > WebCore::IntRect visibleScrollerThumbRect() const { return m_visibleScrollerThumbRect; } > >@@ -1188,8 +1188,8 @@ public: > void setScrollPinningBehavior(WebCore::ScrollPinningBehavior); > WebCore::ScrollPinningBehavior scrollPinningBehavior() const { return m_scrollPinningBehavior; } > >- void setOverlayScrollbarStyle(std::optional<WebCore::ScrollbarOverlayStyle>); >- std::optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() const { return m_scrollbarOverlayStyle; } >+ void setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle>); >+ WTF::Optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() const { return m_scrollbarOverlayStyle; } > > // When the state of the window changes such that the WebPage needs immediate update, the UIProcess sends a new > // ActivityStateChangeID to the WebProcess through the SetActivityState message. The UIProcess will wait till it >@@ -1383,7 +1383,7 @@ public: > #endif > > #if ENABLE(APPLICATION_MANIFEST) >- void getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&&); >+ void getApplicationManifest(Function<void(const WTF::Optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&&); > #endif > > void writeBlobToFilePath(const URL& blobURL, const String& path, Function<void(bool success)>&&); >@@ -1419,7 +1419,7 @@ private: > void updateThrottleState(); > void updateHiddenPageThrottlingAutoIncreases(); > >- bool suspendCurrentPageIfPossible(API::Navigation&, std::optional<uint64_t> mainFrameID, ProcessSwapRequestedByClient); >+ bool suspendCurrentPageIfPossible(API::Navigation&, WTF::Optional<uint64_t> mainFrameID, ProcessSwapRequestedByClient); > > enum class ResetStateReason { > PageInvalidated, >@@ -1464,7 +1464,7 @@ private: > void didCancelClientRedirectForFrame(uint64_t frameID); > void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, URL&&); > void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&); >- void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, std::optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&); >+ void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, WTF::Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&); > void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&); > void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&); > void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&); >@@ -1576,8 +1576,8 @@ private: > RefPtr<API::Navigation> reattachToWebProcessForReload(); > RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&); > >- void loadDataWithNavigation(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&& = std::nullopt); >- void loadRequestWithNavigation(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&& = std::nullopt); >+ void loadDataWithNavigation(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&& = WTF::nullopt); >+ void loadRequestWithNavigation(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&& = WTF::nullopt); > > void requestNotificationPermission(uint64_t notificationID, const String& originString); > void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, WebCore::NotificationDirection, const String& originString, uint64_t notificationID); >@@ -1609,7 +1609,7 @@ private: > // Back/Forward list management > void backForwardAddItem(BackForwardListItemState&&); > void backForwardGoToItem(const WebCore::BackForwardItemIdentifier&, SandboxExtension::Handle&); >- void backForwardItemAtIndex(int32_t index, std::optional<WebCore::BackForwardItemIdentifier>&); >+ void backForwardItemAtIndex(int32_t index, WTF::Optional<WebCore::BackForwardItemIdentifier>&); > void backForwardBackListCount(uint32_t& count); > void backForwardForwardListCount(uint32_t& count); > void backForwardClear(); >@@ -1701,7 +1701,7 @@ private: > void unsignedCallback(uint64_t, CallbackID); > void editingRangeCallback(const EditingRange&, CallbackID); > #if ENABLE(APPLICATION_MANIFEST) >- void applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>&, CallbackID); >+ void applicationManifestCallback(const WTF::Optional<WebCore::ApplicationManifest>&, CallbackID); > #endif > #if PLATFORM(COCOA) > void machSendRightCallback(const WTF::MachSendRight&, CallbackID); >@@ -1768,8 +1768,8 @@ private: > float textAutosizingWidth(); > > void couldNotRestorePageState(); >- void restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale); >- void restorePageCenterAndScale(std::optional<WebCore::FloatPoint>, double scale); >+ void restorePageState(WTF::Optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale); >+ void restorePageCenterAndScale(WTF::Optional<WebCore::FloatPoint>, double scale); > > void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& geometries, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius); > >@@ -1893,7 +1893,7 @@ private: > > void reportPageLoadResult(const WebCore::ResourceError& = { }); > >- void continueNavigationInNewProcess(API::Navigation&, std::unique_ptr<SuspendedPageProxy>&&, Ref<WebProcessProxy>&&, ProcessSwapRequestedByClient, std::optional<WebsitePoliciesData>&&); >+ void continueNavigationInNewProcess(API::Navigation&, std::unique_ptr<SuspendedPageProxy>&&, Ref<WebProcessProxy>&&, ProcessSwapRequestedByClient, WTF::Optional<WebsitePoliciesData>&&); > > void setNeedsFontAttributes(bool); > void updateFontAttributesAfterEditorStateChange(); >@@ -2022,7 +2022,7 @@ private: > ProcessThrottler::ForegroundActivityToken m_activityToken; > #endif > bool m_initialCapitalizationEnabled { false }; >- std::optional<double> m_cpuLimit; >+ WTF::Optional<double> m_cpuLimit; > Ref<WebBackForwardList> m_backForwardList; > > bool m_maintainsInactiveSelection { false }; >@@ -2046,7 +2046,7 @@ private: > double m_pluginScaleFactor { 1 }; > double m_viewScaleFactor { 1 }; > float m_intrinsicDeviceScaleFactor { 1 }; >- std::optional<float> m_customDeviceScaleFactor; >+ WTF::Optional<float> m_customDeviceScaleFactor; > float m_topContentInset { 0 }; > > LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess }; >@@ -2210,7 +2210,7 @@ private: > bool m_suppressVisibilityUpdates { false }; > bool m_autoSizingShouldExpandToViewHeight { false }; > WebCore::IntSize m_viewLayoutSize; >- std::optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits; >+ WTF::Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits; > > // Visual viewports > WebCore::LayoutSize m_baseLayoutViewportSize; >@@ -2240,7 +2240,7 @@ private: > VisibleWebPageToken m_visiblePageToken; > > WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin }; >- std::optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle; >+ WTF::Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle; > > uint64_t m_navigationID { 0 }; > ActivityStateChangeID m_currentActivityStateChangeID { ActivityStateChangeAsynchronous }; >@@ -2275,7 +2275,7 @@ private: > WebCore::FloatSize m_maximumUnobscuredSize; > #endif > >- std::optional<WebCore::FontAttributes> m_cachedFontAttributesAtSelectionStart; >+ WTF::Optional<WebCore::FontAttributes> m_cachedFontAttributesAtSelectionStart; > > #if ENABLE(POINTER_LOCK) > bool m_isPointerLockPending { false }; >@@ -2298,9 +2298,9 @@ private: > std::unique_ptr<WebPageDebuggable> m_inspectorDebuggable; > #endif > >- std::optional<SpellDocumentTag> m_spellDocumentTag; >+ WTF::Optional<SpellDocumentTag> m_spellDocumentTag; > >- std::optional<MonotonicTime> m_pageLoadStart; >+ WTF::Optional<MonotonicTime> m_pageLoadStart; > HashSet<String> m_previouslyVisitedPaths; > > RunLoop::Timer<WebPageProxy> m_resetRecentCrashCountTimer; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index 128e6e95073a1119fd91f779d9f97ae82e80cffc..2f5f3c0cad92ff460a21230d4af77b01357e3112 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -107,7 +107,7 @@ messages -> WebPageProxy { > # Policy messages > DecidePolicyForResponse(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, uint64_t listenerID, WebKit::UserData userData) > DecidePolicyForNavigationActionAsync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, IPC::FormDataReference requestBody, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData, uint64_t listenerID) >- DecidePolicyForNavigationActionSync(uint64_t frameID, bool isMainFrame, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, IPC::FormDataReference requestBody, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData) -> (enum:uint8_t WebKit::WebPolicyAction policyAction, uint64_t newNavigationID, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePoliciesData> websitePolicies) Delayed >+ DecidePolicyForNavigationActionSync(uint64_t frameID, bool isMainFrame, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, IPC::FormDataReference requestBody, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData) -> (enum:uint8_t WebKit::WebPolicyAction policyAction, uint64_t newNavigationID, WebKit::DownloadID downloadID, WTF::Optional<WebKit::WebsitePoliciesData> websitePolicies) Delayed > DecidePolicyForNewWindowAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, struct WebKit::NavigationActionData navigationActionData, WebCore::ResourceRequest request, String frameName, uint64_t listenerID, WebKit::UserData userData) > UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::UserData userData) > >@@ -131,7 +131,7 @@ messages -> WebPageProxy { > DidCancelClientRedirectForFrame(uint64_t frameID) > DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, URL url) > DidFailProvisionalLoadForFrame(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, WebKit::UserData userData) >- DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool containsPluginDocument, std::optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebKit::UserData userData) >+ DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool containsPluginDocument, WTF::Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebKit::UserData userData) > DidFailLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData) > DidFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, WebKit::UserData userData) > DidFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, WebKit::UserData userData) >@@ -177,7 +177,7 @@ messages -> WebPageProxy { > UnsignedCallback(uint64_t result, WebKit::CallbackID callbackID) > RectForCharacterRangeCallback(WebCore::IntRect rect, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID) > #if ENABLE(APPLICATION_MANIFEST) >- ApplicationManifestCallback(std::optional<WebCore::ApplicationManifest> manifest, WebKit::CallbackID callbackID) >+ ApplicationManifestCallback(WTF::Optional<WebCore::ApplicationManifest> manifest, WebKit::CallbackID callbackID) > #endif > #if PLATFORM(MAC) > AttributedStringForCharacterRangeCallback(struct WebKit::AttributedString string, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID) >@@ -226,7 +226,7 @@ messages -> WebPageProxy { > # BackForward messages > BackForwardAddItem(struct WebKit::BackForwardListItemState itemState) > BackForwardGoToItem(struct WebCore::BackForwardItemIdentifier itemID) -> (WebKit::SandboxExtension::Handle sandboxExtensionHandle) LegacySync >- BackForwardItemAtIndex(int32_t itemIndex) -> (std::optional<WebCore::BackForwardItemIdentifier> itemID) LegacySync >+ BackForwardItemAtIndex(int32_t itemIndex) -> (WTF::Optional<WebCore::BackForwardItemIdentifier> itemID) LegacySync > BackForwardBackListCount() -> (uint32_t count) LegacySync > BackForwardForwardListCount() -> (uint32_t count) LegacySync > BackForwardClear() >@@ -329,7 +329,7 @@ messages -> WebPageProxy { > #if ENABLE(DATA_INTERACTION) > DidHandleStartDataInteractionRequest(bool started) > DidHandleAdditionalDragItemsRequest(bool added) >- DidConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData> textIndicator) >+ DidConcludeEditDataInteraction(WTF::Optional<WebCore::TextIndicatorData> textIndicator) > #endif > > #if PLATFORM(COCOA) >@@ -399,8 +399,8 @@ messages -> WebPageProxy { > > #if PLATFORM(IOS_FAMILY) > CouldNotRestorePageState() >- RestorePageState(std::optional<WebCore::FloatPoint> scrollPosition, WebCore::FloatPoint scrollOrigin, WebCore::RectEdges<float> obscuredInsetsOnSave, double scale) >- RestorePageCenterAndScale(std::optional<WebCore::FloatPoint> unobscuredCenter, double scale) >+ RestorePageState(WTF::Optional<WebCore::FloatPoint> scrollPosition, WebCore::FloatPoint scrollOrigin, WebCore::RectEdges<float> obscuredInsetsOnSave, double scale) >+ RestorePageCenterAndScale(WTF::Optional<WebCore::FloatPoint> unobscuredCenter, double scale) > DidGetTapHighlightGeometries(uint64_t requestID, WebCore::Color color, Vector<WebCore::FloatQuad> geometries, WebCore::IntSize topLeftRadius, WebCore::IntSize topRightRadius, WebCore::IntSize bottomLeftRadius, WebCore::IntSize bottomRightRadius) > > StartAssistingNode(struct WebKit::AssistedNodeInformation information, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, WebKit::UserData userData) >@@ -436,7 +436,7 @@ messages -> WebPageProxy { > #endif > > #if ENABLE(PDFKIT_PLUGIN) >- ShowPDFContextMenu(struct WebKit::PDFContextMenu contextMenu) -> (std::optional<int32_t> selectedItem) LegacySync >+ ShowPDFContextMenu(struct WebKit::PDFContextMenu contextMenu) -> (WTF::Optional<int32_t> selectedItem) LegacySync > #endif > > #if ENABLE(NETSCAPE_PLUGIN_API) >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index e973c98b30f01bb0ad1d04ac24ae1a00eab65894..3f748be4b90f730e654f2f1ef773aa17efed87b5 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -620,7 +620,7 @@ void WebProcessPool::getNetworkProcessConnection(WebProcessProxy& webProcessProx > } > > #if ENABLE(SERVICE_WORKER) >-void WebProcessPool::establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy& proxy, SecurityOriginData&& securityOrigin, std::optional<PAL::SessionID> sessionID) >+void WebProcessPool::establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy& proxy, SecurityOriginData&& securityOrigin, WTF::Optional<PAL::SessionID> sessionID) > { > ASSERT_UNUSED(proxy, &proxy == m_networkProcess.get()); > >diff --git a/Source/WebKit/UIProcess/WebProcessPool.h b/Source/WebKit/UIProcess/WebProcessPool.h >index 076794df0cef8c1ffe95aaa4bc083b6f53bacb07..9c1a4deabb3b4c5e727a728e84f26a496ae608bf 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.h >+++ b/Source/WebKit/UIProcess/WebProcessPool.h >@@ -345,7 +345,7 @@ public: > void getNetworkProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&&); > > #if ENABLE(SERVICE_WORKER) >- void establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy&, WebCore::SecurityOriginData&&, std::optional<PAL::SessionID>); >+ void establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy&, WebCore::SecurityOriginData&&, WTF::Optional<PAL::SessionID>); > ServiceWorkerProcessProxy* serviceWorkerProcessProxyFromPageID(uint64_t pageID) const; > const HashMap<WebCore::SecurityOriginData, ServiceWorkerProcessProxy*>& serviceWorkerProxies() const { return m_serviceWorkerProcesses; } > void setAllowsAnySSLCertificateForServiceWorker(bool allows) { m_allowsAnySSLCertificateForServiceWorker = allows; } >@@ -559,7 +559,7 @@ private: > bool m_allowsAnySSLCertificateForServiceWorker { false }; > bool m_shouldDisableServiceWorkerProcessTerminationDelay { false }; > String m_serviceWorkerUserAgent; >- std::optional<WebPreferencesStore> m_serviceWorkerPreferences; >+ WTF::Optional<WebPreferencesStore> m_serviceWorkerPreferences; > HashMap<String, bool> m_mayHaveRegisteredServiceWorkers; > #endif > >diff --git a/Source/WebKit/UIProcess/WebProcessProxy.cpp b/Source/WebKit/UIProcess/WebProcessProxy.cpp >index dd567f8b73cc064f36cac62d6d47ade3c93684c1..8c007d0498755b0748ba1a7c5ef31473db865e63 100644 >--- a/Source/WebKit/UIProcess/WebProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/WebProcessProxy.cpp >@@ -597,7 +597,7 @@ void WebProcessProxy::updateBackForwardItem(const BackForwardListItemState& item > } > > #if ENABLE(NETSCAPE_PLUGIN_API) >-void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins, Vector<PluginInfo>& applicationPlugins, std::optional<Vector<WebCore::SupportedPluginIdentifier>>& supportedPluginIdentifiers) >+void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins, Vector<PluginInfo>& applicationPlugins, WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>>& supportedPluginIdentifiers) > { > if (refresh) > m_processPool->pluginInfoStore().refresh(); >diff --git a/Source/WebKit/UIProcess/WebProcessProxy.h b/Source/WebKit/UIProcess/WebProcessProxy.h >index 2361ae773a77efecbfa5649aee762e596e7bda97..27661621571aa8ad01ac829deacaa267ce25d9f6 100644 >--- a/Source/WebKit/UIProcess/WebProcessProxy.h >+++ b/Source/WebKit/UIProcess/WebProcessProxy.h >@@ -283,7 +283,7 @@ private: > > // Plugins > #if ENABLE(NETSCAPE_PLUGIN_API) >- void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins, Vector<WebCore::PluginInfo>& applicationPlugins, std::optional<Vector<WebCore::SupportedPluginIdentifier>>&); >+ void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins, Vector<WebCore::PluginInfo>& applicationPlugins, WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>>&); > #endif // ENABLE(NETSCAPE_PLUGIN_API) > #if ENABLE(NETSCAPE_PLUGIN_API) > void getPluginProcessConnection(uint64_t pluginProcessToken, Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply&&); >diff --git a/Source/WebKit/UIProcess/WebProcessProxy.messages.in b/Source/WebKit/UIProcess/WebProcessProxy.messages.in >index 6a98f4e96047dabf164a7610a87f2a9f6860b48a..556ca09be6d77d4221101a7e5eb79ae872baf575 100644 >--- a/Source/WebKit/UIProcess/WebProcessProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebProcessProxy.messages.in >@@ -33,7 +33,7 @@ messages -> WebProcessProxy LegacyReceiver { > > # Plugin messages. > #if ENABLE(NETSCAPE_PLUGIN_API) >- GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins, Vector<WebCore::PluginInfo> applicationPlugins, struct std::optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginIdentifiers) LegacySync >+ GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins, Vector<WebCore::PluginInfo> applicationPlugins, struct WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginIdentifiers) LegacySync > GetPluginProcessConnection(uint64_t pluginProcessToken) -> (IPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed > #endif > GetNetworkProcessConnection() -> (IPC::Attachment connectionHandle) Delayed >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index 69af382347692eb3726cec04b2215262d0d6db66..fd171e2a8716ce1cc02ff447903f0c10ae21db0e 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -309,7 +309,7 @@ void WebResourceLoadStatisticsStore::grantStorageAccess(String&& subFrameHost, S > }); > } > >-void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback) >+void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback) > { > ASSERT(RunLoop::isMain()); > >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >index e92e57de60a7b738aa273d233c45dfdcf10b6c70..1cb42c3f76fd3d4ab2c67cbcd13ae62ebbf7a055 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >@@ -131,7 +131,7 @@ public: > > void setStatisticsTestingCallback(WTF::Function<void(const String&)>&& callback) { m_statisticsTestingCallback = WTFMove(callback); } > void logTestingEvent(const String&); >- void callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); >+ void callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); > void removeAllStorageAccess(CompletionHandler<void()>&&); > void callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<String>& domainsToBlock, CompletionHandler<void()>&&); > void callRemoveDomainsHandler(const Vector<String>& domains); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.h >index 61749a7b2c3bd5d2c5f9f4c0fa995a7be6d90624..7444bf0bbcd4a39f309638058b41131f6d277c7d 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.h >@@ -62,7 +62,7 @@ struct WebsiteDataRecord { > uint64_t totalSize; > HashMap<unsigned, uint64_t> typeSizes; > }; >- std::optional<Size> size; >+ WTF::Optional<Size> size; > > HashSet<WebCore::SecurityOriginData> origins; > HashSet<String> cookieHostNames; >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index 14960d3380ff93e5643f2ba93faa3f60cc2aa34a..7a4f824e34bf3cb25e4425e62c792c80466a5ec1 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -1263,7 +1263,7 @@ void WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor(const Vector<Stri > } > } > >-void WebsiteDataStore::setAgeCapForClientSideCookies(std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) >+void WebsiteDataStore::setAgeCapForClientSideCookies(WTF::Optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) > { > auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); > >@@ -1297,7 +1297,7 @@ void WebsiteDataStore::getAllStorageAccessEntries(uint64_t pageID, CompletionHan > networkProcess.getAllStorageAccessEntries(m_sessionID, WTFMove(completionHandler)); > } > >-void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&& completionHandler) >+void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&& completionHandler) > { > auto* webPage = WebProcessProxy::webPage(pageID); > if (!webPage) { >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >index 40f575aba4c290f78c531bfb5a9d047a94d79d7f..67b44795496b0601e248d745695b21182af3c292 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >@@ -117,10 +117,10 @@ public: > > #if ENABLE(RESOURCE_LOAD_STATISTICS) > void updatePrevalentDomainsToBlockCookiesFor(const Vector<String>& domainsToBlock, CompletionHandler<void()>&&); >- void setAgeCapForClientSideCookies(std::optional<Seconds>, CompletionHandler<void()>&&); >+ void setAgeCapForClientSideCookies(WTF::Optional<Seconds>, CompletionHandler<void()>&&); > void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&&); > void getAllStorageAccessEntries(uint64_t pageID, CompletionHandler<void(Vector<String>&& domains)>&&); >- void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&&); >+ void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, WTF::Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&&); > void removeAllStorageAccessHandler(CompletionHandler<void()>&&); > void removePrevalentDomains(const Vector<String>& domains); > void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); >diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp >index 09eeb55371a35446487510303b8b5858c7f4cbee..8019cf34ecf4fe4759250ebbf467fc0b53e29b5d 100644 >--- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp >+++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp >@@ -45,8 +45,8 @@ > namespace WebKit { > using namespace WebCore; > >-static std::optional<int> s_damageEventBase; >-static std::optional<int> s_damageErrorBase; >+static WTF::Optional<int> s_damageEventBase; >+static WTF::Optional<int> s_damageErrorBase; > > class XDamageNotifier { > WTF_MAKE_NONCOPYABLE(XDamageNotifier); >diff --git a/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp b/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp >index 61ce2bf3c53d546640d4a97ae5387f2c217351aa..3c59d4505b96ab986055465187a37e8d541cd6a0 100644 >--- a/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp >+++ b/Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp >@@ -61,7 +61,7 @@ HardwareAccelerationManager::HardwareAccelerationManager() > #if USE(REDIRECTED_XCOMPOSITE_WINDOW) > if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) { > auto& display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()); >- std::optional<int> damageBase, errorBase; >+ WTF::Optional<int> damageBase, errorBase; > if (!display.supportsXComposite() || !display.supportsXDamage(damageBase, errorBase)) { > m_canUseHardwareAcceleration = false; > return; >diff --git a/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp b/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp >index b518e1e36d0ae72e6ec28804287524ca91be1929..b59acb56810e6d8109bea7a260c08ba61d2c5f91 100644 >--- a/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp >+++ b/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp >@@ -66,7 +66,7 @@ void WebPopupMenuProxyGtk::selectItem(unsigned itemIndex) > m_selectedItem = itemIndex; > } > >-void WebPopupMenuProxyGtk::activateItem(std::optional<unsigned> itemIndex) >+void WebPopupMenuProxyGtk::activateItem(WTF::Optional<unsigned> itemIndex) > { > if (m_client) > m_client->valueChangedForPopupMenu(this, itemIndex.value_or(m_selectedItem.value_or(-1))); >@@ -348,7 +348,7 @@ void WebPopupMenuProxyGtk::hidePopupMenu() > m_device = nullptr; > } > >- activateItem(std::nullopt); >+ activateItem(WTF::nullopt); > > if (m_currentSearchString) { > g_string_free(m_currentSearchString, TRUE); >@@ -368,14 +368,14 @@ void WebPopupMenuProxyGtk::cancelTracking() > hidePopupMenu(); > } > >-std::optional<unsigned> WebPopupMenuProxyGtk::typeAheadFindIndex(GdkEventKey* event) >+WTF::Optional<unsigned> WebPopupMenuProxyGtk::typeAheadFindIndex(GdkEventKey* event) > { > gunichar keychar = gdk_keyval_to_unicode(event->keyval); > if (!g_unichar_isprint(keychar)) >- return std::nullopt; >+ return WTF::nullopt; > > if (event->time < m_previousKeyEventTime) >- return std::nullopt; >+ return WTF::nullopt; > > static const uint32_t typeaheadTimeoutMs = 1000; > if (event->time - m_previousKeyEventTime > typeaheadTimeoutMs) { >@@ -409,7 +409,7 @@ std::optional<unsigned> WebPopupMenuProxyGtk::typeAheadFindIndex(GdkEventKey* ev > GUniquePtr<char> normalizedPrefix(g_utf8_normalize(m_currentSearchString->str, prefixLength, G_NORMALIZE_ALL)); > GUniquePtr<char> prefix(normalizedPrefix ? g_utf8_casefold(normalizedPrefix.get(), -1) : nullptr); > if (!prefix) >- return std::nullopt; >+ return WTF::nullopt; > > model = gtk_tree_view_get_model(GTK_TREE_VIEW(m_treeView)); > for (unsigned i = 0; i < itemCount; i++, index = (index + 1) % itemCount) { >@@ -432,7 +432,7 @@ std::optional<unsigned> WebPopupMenuProxyGtk::typeAheadFindIndex(GdkEventKey* ev > return index; > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > bool WebPopupMenuProxyGtk::typeAheadFind(GdkEventKey* event) >diff --git a/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.h b/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.h >index 19645609f8b922286f8dce987ea3dad0982dc74b..2c62ca5171e67e7403c959a071b0fb096a4475ce 100644 >--- a/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.h >+++ b/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.h >@@ -54,7 +54,7 @@ public: > void cancelTracking() override; > > virtual void selectItem(unsigned itemIndex); >- virtual void activateItem(std::optional<unsigned> itemIndex); >+ virtual void activateItem(WTF::Optional<unsigned> itemIndex); > > protected: > WebPopupMenuProxyGtk(GtkWidget*, WebPopupMenuProxy::Client&); >@@ -65,7 +65,7 @@ private: > void createPopupMenu(const Vector<WebPopupItem>&, int32_t selectedIndex); > void show(); > bool activateItemAtPath(GtkTreePath*); >- std::optional<unsigned> typeAheadFindIndex(GdkEventKey*); >+ WTF::Optional<unsigned> typeAheadFindIndex(GdkEventKey*); > bool typeAheadFind(GdkEventKey*); > > static gboolean buttonPressEventCallback(GtkWidget*, GdkEventButton*, WebPopupMenuProxyGtk*); >@@ -78,7 +78,7 @@ private: > GdkDevice* m_device { nullptr }; > > Vector<GUniquePtr<GtkTreePath>> m_paths; >- std::optional<unsigned> m_selectedItem; >+ WTF::Optional<unsigned> m_selectedItem; > > // Typeahead find. > gunichar m_repeatingCharacter { '\0' }; >diff --git a/Source/WebKit/UIProcess/ios/DragDropInteractionState.h b/Source/WebKit/UIProcess/ios/DragDropInteractionState.h >index b0102177437f3f214945a7a34e58a3dfe2417488..529e37787882cd670d316ebb85dd1cef1c08801e 100644 >--- a/Source/WebKit/UIProcess/ios/DragDropInteractionState.h >+++ b/Source/WebKit/UIProcess/ios/DragDropInteractionState.h >@@ -49,8 +49,8 @@ struct DragSourceState { > CGPoint adjustedOrigin { CGPointZero }; > CGRect dragPreviewFrameInRootViewCoordinates { CGRectZero }; > RetainPtr<UIImage> image; >- std::optional<WebCore::TextIndicatorData> indicatorData; >- std::optional<WebCore::Path> visiblePath; >+ WTF::Optional<WebCore::TextIndicatorData> indicatorData; >+ WTF::Optional<WebCore::Path> visiblePath; > String linkTitle; > URL linkURL; > bool possiblyNeedsDragPreviewUpdate { true }; >@@ -94,7 +94,7 @@ public: > > private: > void updatePreviewsForActiveDragSources(); >- std::optional<DragSourceState> activeDragSourceForItem(UIDragItem *) const; >+ WTF::Optional<DragSourceState> activeDragSourceForItem(UIDragItem *) const; > > CGPoint m_lastGlobalPosition { CGPointZero }; > CGPoint m_adjustedPositionForDragEnd { CGPointZero }; >@@ -106,7 +106,7 @@ private: > BlockPtr<void()> m_dragCancelSetDownBlock; > BlockPtr<void(NSArray<UIDragItem *> *)> m_addDragItemCompletionBlock; > >- std::optional<DragSourceState> m_stagedDragSource; >+ WTF::Optional<DragSourceState> m_stagedDragSource; > Vector<DragSourceState> m_activeDragSources; > }; > >diff --git a/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm b/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm >index d0af0ac336a8af3d9afbff59e925db17dca5db86..3c282ff5617f819966d90b871a62f1e35b01a61d 100644 >--- a/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm >+++ b/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm >@@ -152,17 +152,17 @@ static bool canUpdatePreviewForActiveDragSource(const DragSourceState& source) > return false; > } > >-std::optional<DragSourceState> DragDropInteractionState::activeDragSourceForItem(UIDragItem *item) const >+WTF::Optional<DragSourceState> DragDropInteractionState::activeDragSourceForItem(UIDragItem *item) const > { > if (![item.privateLocalContext isKindOfClass:[NSNumber class]]) >- return std::nullopt; >+ return WTF::nullopt; > > auto identifier = [(NSNumber *)item.privateLocalContext integerValue]; > for (auto& source : m_activeDragSources) { > if (source.itemIdentifier == identifier) > return source; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > bool DragDropInteractionState::anyActiveDragSourceIs(WebCore::DragSourceAction action) const >@@ -261,7 +261,7 @@ void DragDropInteractionState::clearStagedDragSource(DidBecomeActive didBecomeAc > { > if (didBecomeActive == DidBecomeActive::Yes) > m_activeDragSources.append(stagedDragSource()); >- m_stagedDragSource = std::nullopt; >+ m_stagedDragSource = WTF::nullopt; > } > > void DragDropInteractionState::dragAndDropSessionsDidEnd() >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >index 6f14b4071290885498b928d1bc6df4e241bfbfa3..ce9c058e5fe387ed684d4643ac03bec46ade5e11 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >@@ -135,8 +135,8 @@ private: > void layerTreeCommitComplete() override; > > void couldNotRestorePageState() override; >- void restorePageState(std::optional<WebCore::FloatPoint>, const WebCore::FloatPoint&, const WebCore::FloatBoxExtent&, double) override; >- void restorePageCenterAndScale(std::optional<WebCore::FloatPoint>, double) override; >+ void restorePageState(WTF::Optional<WebCore::FloatPoint>, const WebCore::FloatPoint&, const WebCore::FloatBoxExtent&, double) override; >+ void restorePageCenterAndScale(WTF::Optional<WebCore::FloatPoint>, double) override; > > void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) override; > void stopAssistingNode() override; >@@ -221,7 +221,7 @@ private: > void didHandleStartDataInteractionRequest(bool started) override; > void didHandleAdditionalDragItemsRequest(bool added) override; > void startDrag(const WebCore::DragItem&, const ShareableBitmap::Handle& image) override; >- void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>) override; >+ void didConcludeEditDataInteraction(WTF::Optional<WebCore::TextIndicatorData>) override; > void didChangeDataInteractionCaretRect(const WebCore::IntRect& previousCaretRect, const WebCore::IntRect& caretRect) override; > #endif > >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index dc0cd36c00629dd51421d98596ab32da55b3f6dc..3d29a2f6fbdbc09f320755d5de2f496b22ea5ead 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -540,12 +540,12 @@ void PageClientImpl::couldNotRestorePageState() > [m_webView _couldNotRestorePageState]; > } > >-void PageClientImpl::restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale) >+void PageClientImpl::restorePageState(WTF::Optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale) > { > [m_webView _restorePageScrollPosition:scrollPosition scrollOrigin:scrollOrigin previousObscuredInset:obscuredInsetsOnSave scale:scale]; > } > >-void PageClientImpl::restorePageCenterAndScale(std::optional<WebCore::FloatPoint> center, double scale) >+void PageClientImpl::restorePageCenterAndScale(WTF::Optional<WebCore::FloatPoint> center, double scale) > { > [m_webView _restorePageStateToUnobscuredCenter:center scale:scale]; > } >@@ -829,7 +829,7 @@ void PageClientImpl::startDrag(const DragItem& item, const ShareableBitmap::Hand > [m_contentView _startDrag:ShareableBitmap::create(image)->makeCGImageCopy() item:item]; > } > >-void PageClientImpl::didConcludeEditDataInteraction(std::optional<TextIndicatorData> data) >+void PageClientImpl::didConcludeEditDataInteraction(WTF::Optional<TextIndicatorData> data) > { > [m_contentView _didConcludeEditDataInteraction:data]; > } >diff --git a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h >index 4d1f8bdf2a7f5ff42180bbf3094554f2853c5244..efa67df0a299b188a12cae7b25d3bcc0ecfdd7c1 100644 >--- a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h >+++ b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h >@@ -42,7 +42,7 @@ struct InteractionInformationAtPosition; > > @protocol WKActionSheetAssistantDelegate <NSObject> > @required >-- (std::optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant; >+- (WTF::Optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant; > - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant performAction:(WebKit::SheetAction)action; > - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant openElementAtLocation:(CGPoint)location; > - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant shareElementWithURL:(NSURL *)url rect:(CGRect)boundingRect; >diff --git a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm >index 27b359350a0b2fc43084ccb97c0be960d5d08bd0..8ab15fbcc575746222ccdd8ce6de34483fd98899 100644 >--- a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm >+++ b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm >@@ -89,7 +89,7 @@ @implementation WKActionSheetAssistant { > WeakObjCPtr<id <WKActionSheetAssistantDelegate>> _delegate; > RetainPtr<WKActionSheet> _interactionSheet; > RetainPtr<_WKActivatedElementInfo> _elementInfo; >- std::optional<WebKit::InteractionInformationAtPosition> _positionInformation; >+ WTF::Optional<WebKit::InteractionInformationAtPosition> _positionInformation; > WeakObjCPtr<UIView> _view; > BOOL _needsLinkIndicator; > BOOL _isPresentingDDUserInterface; >@@ -628,7 +628,7 @@ - (void)cleanupSheet > [_interactionSheet setSheetDelegate:nil]; > _interactionSheet = nil; > _elementInfo = nil; >- _positionInformation = std::nullopt; >+ _positionInformation = WTF::nullopt; > _needsLinkIndicator = NO; > _isPresentingDDUserInterface = NO; > _hasPendingActionSheet = NO; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index e794e3c631ddeb53a1a469b7909429b4cba3bc61..2c7e2f401e1a606aba708048965340329927636f 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -270,10 +270,10 @@ struct WKAutoCorrectionData { > > WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo; > >- std::optional<WebKit::InteractionInformationRequest> _outstandingPositionInformationRequest; >+ WTF::Optional<WebKit::InteractionInformationRequest> _outstandingPositionInformationRequest; > > uint64_t _positionInformationCallbackDepth; >- Vector<std::optional<InteractionInformationRequestAndCallback>> _pendingPositionInformationHandlers; >+ Vector<WTF::Optional<InteractionInformationRequestAndCallback>> _pendingPositionInformationHandlers; > > std::unique_ptr<WebKit::InputViewUpdateDeferrer> _inputViewUpdateDeferrer; > >@@ -431,7 +431,7 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > - (void)_didHandleStartDataInteractionRequest:(BOOL)started; > - (void)_didHandleAdditionalDragItemsRequest:(BOOL)added; > - (void)_startDrag:(RetainPtr<CGImageRef>)image item:(const WebCore::DragItem&)item; >-- (void)_didConcludeEditDataInteraction:(std::optional<WebCore::TextIndicatorData>)data; >+- (void)_didConcludeEditDataInteraction:(WTF::Optional<WebCore::TextIndicatorData>)data; > - (void)_didChangeDataInteractionCaretRect:(CGRect)previousRect currentRect:(CGRect)rect; > #endif > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 026f1f7a8762b9894a338c2c4878ffa38462d870..784a68daaccf2d2d54d62a064d9fa1aa35486dab 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -762,7 +762,7 @@ - (void)cleanupInteraction > [_formInputSession invalidate]; > _formInputSession = nil; > [_highlightView removeFromSuperview]; >- _outstandingPositionInformationRequest = std::nullopt; >+ _outstandingPositionInformationRequest = WTF::nullopt; > > _focusRequiresStrongPasswordAssistance = NO; > >@@ -1668,7 +1668,7 @@ - (void)_invokeAndRemovePendingHandlersValidForCurrentPositionInformation > if (![self _currentPositionInformationIsValidForRequest:requestAndHandler->first]) > continue; > >- _pendingPositionInformationHandlers[index] = std::nullopt; >+ _pendingPositionInformationHandlers[index] = WTF::nullopt; > > if (requestAndHandler->second) > requestAndHandler->second(updatedPositionInformation); >@@ -2133,7 +2133,7 @@ - (void)clearSelection > > - (void)_positionInformationDidChange:(const WebKit::InteractionInformationAtPosition&)info > { >- _outstandingPositionInformationRequest = std::nullopt; >+ _outstandingPositionInformationRequest = WTF::nullopt; > > WebKit::InteractionInformationAtPosition newInfo = info; > newInfo.mergeCompatibleOptionalInformation(_positionInformation); >@@ -5147,13 +5147,13 @@ - (BOOL)isAnyTouchOverActiveArea:(NSSet *)touches > > #pragma mark - Implementation of WKActionSheetAssistantDelegate. > >-- (std::optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant >+- (WTF::Optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant > { > WebKit::InteractionInformationRequest request(_positionInformation.request.point); > request.includeSnapshot = true; > request.includeLinkIndicator = assistant.needsLinkIndicator; > if (![self ensurePositionInformationIsUpToDate:request]) >- return std::nullopt; >+ return WTF::nullopt; > > return _positionInformation; > } >@@ -5453,7 +5453,7 @@ static NSArray<NSItemProvider *> *extractItemProvidersFromDropSession(id <UIDrop > return extractItemProvidersFromDragItems(session.items); > } > >-- (void)_didConcludeEditDataInteraction:(std::optional<WebCore::TextIndicatorData>)data >+- (void)_didConcludeEditDataInteraction:(WTF::Optional<WebCore::TextIndicatorData>)data > { > if (!data) > return; >diff --git a/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm b/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm >index 9930ea1527eb35b965a82c0af5bc5377654cc7ca..4da977351e66e224929db7e167e53c04f91f66fd 100644 >--- a/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm >+++ b/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm >@@ -99,7 +99,7 @@ @implementation WKKeyboardScrollingAnimator { > id <WKKeyboardScrollableInternal> _scrollable; > RetainPtr<CADisplayLink> _displayLink; > >- std::optional<WebKit::KeyboardScroll> _currentScroll; >+ WTF::Optional<WebKit::KeyboardScroll> _currentScroll; > > BOOL _hasPressedScrollingKey; > >@@ -187,16 +187,16 @@ static WebCore::PhysicalBoxSide boxSide(WebKit::ScrollingDirection direction) > } > } > >-- (std::optional<WebKit::KeyboardScroll>)keyboardScrollForEvent:(::WebEvent *)event >+- (WTF::Optional<WebKit::KeyboardScroll>)keyboardScrollForEvent:(::WebEvent *)event > { > static const unsigned kWebSpaceKey = 0x20; > > if (![_scrollable isKeyboardScrollable]) >- return std::nullopt; >+ return WTF::nullopt; > > NSString *charactersIgnoringModifiers = event.charactersIgnoringModifiers; > if (!charactersIgnoringModifiers.length) >- return std::nullopt; >+ return WTF::nullopt; > > enum class Key : uint8_t { Other, LeftArrow, RightArrow, UpArrow, DownArrow, PageUp, PageDown, Space }; > >@@ -223,7 +223,7 @@ - (std::optional<WebKit::KeyboardScroll>)keyboardScrollForEvent:(::WebEvent *)ev > }(); > > if (key == Key::Other) >- return std::nullopt; >+ return WTF::nullopt; > > BOOL shiftPressed = event.modifierFlags & WebEventFlagMaskShiftKey; > BOOL altPressed = event.modifierFlags & WebEventFlagMaskOptionKey; >@@ -375,7 +375,7 @@ - (void)stopAnimatedScroll > // out to that point. > _idealPosition = [_scrollable boundedContentOffset:farthestPointInDirection(_currentPosition + displacement, _idealPositionForMinimumTravel, _currentScroll->direction)]; > >- _currentScroll = std::nullopt; >+ _currentScroll = WTF::nullopt; > > #if !ENABLE(ANIMATED_KEYBOARD_SCROLLING) > [self stopRepeatTimer]; >diff --git a/Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm b/Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm >index aea0d6d39f62d71d967446e68227ebd7f283ad14..40c56ddb00e5b2495fb5712ca4f136a3272eacc5 100644 >--- a/Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm >+++ b/Source/WebKit/UIProcess/ios/WKLegacyPDFView.mm >@@ -752,7 +752,7 @@ - (void)annotation:(UIPDFAnnotation *)annotation isBeingPressedAtPoint:(CGPoint) > > #pragma mark WKActionSheetAssistantDelegate > >-- (std::optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant >+- (WTF::Optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant > { > return _positionInformation; > } >diff --git a/Source/WebKit/UIProcess/ios/WKPDFView.mm b/Source/WebKit/UIProcess/ios/WKPDFView.mm >index df275b2e165e2ab0b678d6c187fac0b962642811..335334fc683a3196de9ad885aafb2794f076ab39 100644 >--- a/Source/WebKit/UIProcess/ios/WKPDFView.mm >+++ b/Source/WebKit/UIProcess/ios/WKPDFView.mm >@@ -59,7 +59,7 @@ @implementation WKPDFView { > NSUInteger _findStringCount; > NSUInteger _findStringMaxCount; > RetainPtr<UIView> _fixedOverlayView; >- std::optional<NSUInteger> _focusedSearchResultIndex; >+ WTF::Optional<NSUInteger> _focusedSearchResultIndex; > NSInteger _focusedSearchResultPendingOffset; > RetainPtr<PDFHostViewController> _hostViewController; > CGSize _overlaidAccessoryViewsInset; >@@ -250,7 +250,7 @@ - (void)_resetFind > _findString = nil; > _findStringCount = 0; > _findStringMaxCount = 0; >- _focusedSearchResultIndex = std::nullopt; >+ _focusedSearchResultIndex = WTF::nullopt; > _focusedSearchResultPendingOffset = 0; > } > >@@ -493,7 +493,7 @@ - (void)pdfHostViewControllerExtensionProcessDidCrash:(PDFHostViewController *)c > > #pragma mark WKActionSheetAssistantDelegate > >-- (std::optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant >+- (WTF::Optional<WebKit::InteractionInformationAtPosition>)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant > { > return _positionInformation; > } >diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >index 7c890adfe610030fd835cd2041e90b9896b28afd..19b61311d2af067223aad51d69336342e4bc226a 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -349,7 +349,7 @@ void WebPageProxy::setDeviceOrientation(int32_t deviceOrientation) > } > } > >-void WebPageProxy::setOverrideViewportArguments(const std::optional<ViewportArguments>& viewportArguments) >+void WebPageProxy::setOverrideViewportArguments(const WTF::Optional<ViewportArguments>& viewportArguments) > { > if (isValid()) > m_process->send(Messages::WebPage::SetOverrideViewportArguments(viewportArguments), m_pageID); >@@ -878,12 +878,12 @@ void WebPageProxy::couldNotRestorePageState() > pageClient().couldNotRestorePageState(); > } > >-void WebPageProxy::restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale) >+void WebPageProxy::restorePageState(WTF::Optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale) > { > pageClient().restorePageState(scrollPosition, scrollOrigin, obscuredInsetsOnSave, scale); > } > >-void WebPageProxy::restorePageCenterAndScale(std::optional<WebCore::FloatPoint> center, double scale) >+void WebPageProxy::restorePageCenterAndScale(WTF::Optional<WebCore::FloatPoint> center, double scale) > { > pageClient().restorePageCenterAndScale(center, scale); > } >@@ -1127,7 +1127,7 @@ void WebPageProxy::requestAdditionalItemsForDragSession(const IntPoint& clientPo > m_process->send(Messages::WebPage::RequestAdditionalItemsForDragSession(clientPosition, globalPosition), m_pageID); > } > >-void WebPageProxy::didConcludeEditDataInteraction(std::optional<TextIndicatorData> data) >+void WebPageProxy::didConcludeEditDataInteraction(WTF::Optional<TextIndicatorData> data) > { > pageClient().didConcludeEditDataInteraction(data); > } >diff --git a/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlView.mm b/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlView.mm >index 26b01d49528fb7686d74a04264e85fea06dfb4cf..4ed2ec4dc099ec56a6bcb8dfa33627915cd68ccd 100644 >--- a/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlView.mm >+++ b/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlView.mm >@@ -79,7 +79,7 @@ @implementation WKFocusedFormControlView { > WeakObjCPtr<id <WKFocusedFormControlViewDelegate>> _delegate; > RetainPtr<NSString> _submitActionName; > RetainPtr<PUICCrownInputSequencer> _crownInputSequencer; >- std::optional<CGPoint> _initialScrollViewContentOffset; >+ WTF::Optional<CGPoint> _initialScrollViewContentOffset; > BOOL _hasPendingFocusRequest; > } > >@@ -127,7 +127,7 @@ - (instancetype)initWithFrame:(CGRect)frame delegate:(id <WKFocusedFormControlVi > [self addSubview:_submitButtonBackgroundView.get()]; > > _hasPendingFocusRequest = NO; >- _initialScrollViewContentOffset = std::nullopt; >+ _initialScrollViewContentOffset = WTF::nullopt; > > return self; > } >diff --git a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm >index aabe284abdf516622dd30e0a49101945dcb52279..0dffb16ce689ee29ff49062d5dab9fb9ff5d09f7 100644 >--- a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm >+++ b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm >@@ -717,7 +717,7 @@ - (void)_completedExitFullScreen > > _viewState.applyTo(webView.get()); > if (auto* page = [webView _page]) >- page->setOverrideViewportArguments(std::nullopt); >+ page->setOverrideViewportArguments(WTF::nullopt); > > [webView setNeedsLayout]; > [webView layoutIfNeeded]; >diff --git a/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp b/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp >index ef4db8e8f77ed01f377be7f614d65ea3b4f3fdd9..a8f49a73940b09d332d08d94b7de3a406e49ba74 100644 >--- a/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp >+++ b/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp >@@ -706,13 +706,13 @@ public: > #endif > > template<typename T> >- auto operator>>(std::optional<T>& value) -> typename std::enable_if<std::is_enum<T>::value, HistoryEntryDataDecoder&>::type >+ auto operator>>(WTF::Optional<T>& value) -> typename std::enable_if<std::is_enum<T>::value, HistoryEntryDataDecoder&>::type > { > uint32_t underlyingEnumValue; > *this >> underlyingEnumValue; > > if (!isValid() || !isValidEnum(static_cast<T>(underlyingEnumValue))) >- value = std::nullopt; >+ value = WTF::nullopt; > else > value = static_cast<T>(underlyingEnumValue); > >@@ -792,7 +792,7 @@ private: > > static void decodeFormDataElement(HistoryEntryDataDecoder& decoder, HTTPBody::Element& formDataElement) > { >- std::optional<FormDataElementType> elementType; >+ WTF::Optional<FormDataElementType> elementType; > decoder >> elementType; > if (!elementType) > return; >@@ -1069,7 +1069,7 @@ static bool decodeV1SessionHistory(CFDictionaryRef sessionHistoryDictionary, Bac > auto currentIndexNumber = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(sessionHistoryDictionary, sessionHistoryCurrentIndexKey)); > if (!currentIndexNumber) { > // No current index means the dictionary represents an empty session. >- backForwardListState.currentIndex = std::nullopt; >+ backForwardListState.currentIndex = WTF::nullopt; > backForwardListState.items = { }; > return true; > } >diff --git a/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm b/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm >index 20edfcf4c8ee2179cb6b356d7284c12225b2ea91..675091528deb768d1b5e442cce8536550950555d 100644 >--- a/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm >+++ b/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm >@@ -55,13 +55,13 @@ @end > > @interface WKDataListSuggestionTable : NSTableView { > RetainPtr<NSScrollView> _enclosingScrollView; >- std::optional<size_t> _activeRow; >+ WTF::Optional<size_t> _activeRow; > } > > - (id)initWithElementRect:(const WebCore::IntRect&)rect; > - (void)setVisibleRect:(NSRect)rect; > - (void)setActiveRow:(size_t)row; >-- (std::optional<size_t>)currentActiveRow; >+- (WTF::Optional<size_t>)currentActiveRow; > - (void)reload; > @end > >@@ -265,7 +265,7 @@ - (void)setVisibleRect:(NSRect)rect > [_enclosingScrollView setFrame:NSMakeRect(dropdownShadowHeight, dropdownShadowHeight, NSWidth(rect) - dropdownShadowHeight * 2, NSHeight(rect) - dropdownShadowHeight)]; > } > >-- (std::optional<size_t>)currentActiveRow >+- (WTF::Optional<size_t>)currentActiveRow > { > return _activeRow; > } >@@ -286,7 +286,7 @@ - (void)setActiveRow:(size_t)row > > - (void)reload > { >- _activeRow = std::nullopt; >+ _activeRow = WTF::nullopt; > [self reloadData]; > } > >@@ -336,7 +336,7 @@ - (id)initWithInformation:(WebCore::DataListSuggestionInformation&&)information > > - (String)currentSelectedString > { >- std::optional<size_t> selectedRow = [_table currentActiveRow]; >+ WTF::Optional<size_t> selectedRow = [_table currentActiveRow]; > if (selectedRow && selectedRow.value() < _suggestions.size()) > return _suggestions.at(selectedRow.value()); > >@@ -354,7 +354,7 @@ - (void)updateWithInformation:(WebCore::DataListSuggestionInformation&&)informat > - (void)moveSelectionByDirection:(const String&)direction > { > size_t size = _suggestions.size(); >- std::optional<size_t> oldSelection = [_table currentActiveRow]; >+ WTF::Optional<size_t> oldSelection = [_table currentActiveRow]; > > size_t newSelection; > if (oldSelection) { >@@ -426,7 +426,7 @@ - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn > > [result setText:_suggestions.at(row)]; > >- std::optional<size_t> currentActiveRow = [_table currentActiveRow]; >+ WTF::Optional<size_t> currentActiveRow = [_table currentActiveRow]; > if (currentActiveRow && static_cast<size_t>(row) == currentActiveRow.value()) > result.active = YES; > >diff --git a/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm >index ca5a27c8c79bb9a287e1b256a6819cf9a7398657..2389da9f9af3d765851588599257d8e6f063538e 100644 >--- a/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm >+++ b/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm >@@ -548,7 +548,7 @@ void WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication(const String& > } > > #if ENABLE(PDFKIT_PLUGIN) >-void WebPageProxy::showPDFContextMenu(const WebKit::PDFContextMenu& contextMenu, std::optional<int32_t>& selectedIndex) >+void WebPageProxy::showPDFContextMenu(const WebKit::PDFContextMenu& contextMenu, WTF::Optional<int32_t>& selectedIndex) > { > if (!contextMenu.m_items.size()) > return; >diff --git a/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp b/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp >index 9b8c008d16d758f8dd71f56023373ba0bd73f3e4..6ec23cb2d2b406b82393b0c7ede72b52272df98e 100644 >--- a/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp >+++ b/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp >@@ -83,12 +83,12 @@ const WebPaymentCoordinator::AvailablePaymentNetworksSet& WebPaymentCoordinator: > return *m_availablePaymentNetworks; > } > >-std::optional<String> WebPaymentCoordinator::validatedPaymentNetwork(const String& paymentNetwork) >+WTF::Optional<String> WebPaymentCoordinator::validatedPaymentNetwork(const String& paymentNetwork) > { > auto& paymentNetworks = availablePaymentNetworks(); > auto result = paymentNetworks.find(paymentNetwork); > if (result == paymentNetworks.end()) >- return std::nullopt; >+ return WTF::nullopt; > return *result; > } > >@@ -149,22 +149,22 @@ void WebPaymentCoordinator::completeMerchantValidation(const WebCore::PaymentMer > m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession)); > } > >-void WebPaymentCoordinator::completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&& update) >+void WebPaymentCoordinator::completeShippingMethodSelection(WTF::Optional<WebCore::ShippingMethodUpdate>&& update) > { > m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(update)); > } > >-void WebPaymentCoordinator::completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&& update) >+void WebPaymentCoordinator::completeShippingContactSelection(WTF::Optional<WebCore::ShippingContactUpdate>&& update) > { > m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(update)); > } > >-void WebPaymentCoordinator::completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&& update) >+void WebPaymentCoordinator::completePaymentMethodSelection(WTF::Optional<WebCore::PaymentMethodUpdate>&& update) > { > m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(update)); > } > >-void WebPaymentCoordinator::completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&& result) >+void WebPaymentCoordinator::completePaymentSession(WTF::Optional<WebCore::PaymentAuthorizationResult>&& result) > { > m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(result)); > } >diff --git a/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h b/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h >index fb74d30ff95f3f72a554aa1d0a1e351797f2e844..f32827c68ba1af74b1bff68beab9de82bd5c8db4 100644 >--- a/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h >+++ b/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h >@@ -56,16 +56,16 @@ public: > private: > // WebCore::PaymentCoordinatorClient. > bool supportsVersion(unsigned version) override; >- std::optional<String> validatedPaymentNetwork(const String&) override; >+ WTF::Optional<String> validatedPaymentNetwork(const String&) override; > bool canMakePayments() override; > void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override; > void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override; > bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override; > void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override; >- void completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&) override; >- void completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&) override; >- void completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&&) override; >- void completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&) override; >+ void completeShippingMethodSelection(WTF::Optional<WebCore::ShippingMethodUpdate>&&) override; >+ void completeShippingContactSelection(WTF::Optional<WebCore::ShippingContactUpdate>&&) override; >+ void completePaymentMethodSelection(WTF::Optional<WebCore::PaymentMethodUpdate>&&) override; >+ void completePaymentSession(WTF::Optional<WebCore::PaymentAuthorizationResult>&&) override; > > void abortPaymentSession() override; > void cancelPaymentSession() override; >@@ -95,7 +95,7 @@ private: > HashMap<uint64_t, WTF::Function<void (bool)>> m_pendingCanMakePaymentsWithActiveCardCallbacks; > HashMap<uint64_t, WTF::Function<void (bool)>> m_pendingOpenPaymentSetupCallbacks; > >- std::optional<AvailablePaymentNetworksSet> m_availablePaymentNetworks; >+ WTF::Optional<AvailablePaymentNetworksSet> m_availablePaymentNetworks; > > #if USE(APPLE_INTERNAL_SDK) > #import <WebKitAdditions/WebPaymentCoordinatorAdditions.h> >diff --git a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp >index efa0341402a0af37bb12e3e9f434fcf2c5233fc6..bd3258ebae9c751be02fdd21068ae8bee7d3f918 100644 >--- a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp >+++ b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp >@@ -477,13 +477,13 @@ void WebAutomationSessionProxy::focusFrame(uint64_t pageID, uint64_t frameID) > coreDOMWindow->focus(true); > } > >-static std::optional<WebCore::FloatPoint> elementInViewClientCenterPoint(WebCore::Element& element, bool& isObscured) >+static WTF::Optional<WebCore::FloatPoint> elementInViewClientCenterPoint(WebCore::Element& element, bool& isObscured) > { > // §11.1 Element Interactability. > // https://www.w3.org/TR/webdriver/#dfn-in-view-center-point > auto* clientRect = element.getClientRects()->item(0); > if (!clientRect) >- return std::nullopt; >+ return WTF::nullopt; > > auto clientCenterPoint = WebCore::FloatPoint::narrowPrecision(0.5 * (clientRect->left() + clientRect->right()), 0.5 * (clientRect->top() + clientRect->bottom())); > auto elementList = element.treeScope().elementsFromPoint(clientCenterPoint.x(), clientCenterPoint.y()); >@@ -497,7 +497,7 @@ static std::optional<WebCore::FloatPoint> elementInViewClientCenterPoint(WebCore > > auto index = elementList.findMatching([&element] (auto& item) { return item.get() == &element; }); > if (index == notFound) >- return std::nullopt; >+ return WTF::nullopt; > > if (index) { > // Element is not the first one in the list. >@@ -539,7 +539,7 @@ void WebAutomationSessionProxy::computeElementLayout(uint64_t pageID, uint64_t f > WebPage* page = WebProcess::singleton().webPage(pageID); > if (!page) { > String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); >- WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, std::nullopt, false, windowNotFoundErrorType), 0); >+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, WTF::nullopt, false, windowNotFoundErrorType), 0); > return; > } > >@@ -549,13 +549,13 @@ void WebAutomationSessionProxy::computeElementLayout(uint64_t pageID, uint64_t f > > WebFrame* frame = frameID ? WebProcess::singleton().webFrame(frameID) : page->mainWebFrame(); > if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) { >- WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, std::nullopt, false, frameNotFoundErrorType), 0); >+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, WTF::nullopt, false, frameNotFoundErrorType), 0); > return; > } > > WebCore::Element* coreElement = elementForNodeHandle(*frame, nodeHandle); > if (!coreElement) { >- WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, std::nullopt, false, nodeNotFoundErrorType), 0); >+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, WTF::nullopt, false, nodeNotFoundErrorType), 0); > return; > } > >@@ -568,7 +568,7 @@ void WebAutomationSessionProxy::computeElementLayout(uint64_t pageID, uint64_t f > } > > if (coordinateSystem == CoordinateSystem::VisualViewport) { >- WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, std::nullopt, false, notImplementedErrorType), 0); >+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, WTF::nullopt, false, notImplementedErrorType), 0); > return; > } > >@@ -590,10 +590,10 @@ void WebAutomationSessionProxy::computeElementLayout(uint64_t pageID, uint64_t f > break; > } > >- std::optional<WebCore::IntPoint> resultInViewCenterPoint; >+ WTF::Optional<WebCore::IntPoint> resultInViewCenterPoint; > bool isObscured = false; > if (containerElement) { >- std::optional<WebCore::FloatPoint> frameInViewCenterPoint = elementInViewClientCenterPoint(*containerElement, isObscured); >+ WTF::Optional<WebCore::FloatPoint> frameInViewCenterPoint = elementInViewClientCenterPoint(*containerElement, isObscured); > if (frameInViewCenterPoint.has_value()) { > WebCore::IntPoint rootInViewCenterPoint = mainView->rootViewToContents(frameView->contentsToRootView(WebCore::IntPoint(frameInViewCenterPoint.value()))); > switch (coordinateSystem) { >diff --git a/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp b/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp >index 55865e45032a8a361398a22311ac2c05ba509fcf..f0b759e4ceb41d44bc8f5e88edb55ddd1beac106 100644 >--- a/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp >+++ b/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp >@@ -132,7 +132,7 @@ void WebCacheStorageConnection::clearMemoryRepresentation(const WebCore::ClientO > connection().send(Messages::CacheStorageEngineConnection::ClearMemoryRepresentation(m_sessionID, requestIdentifier, origin), 0); > } > >-void WebCacheStorageConnection::clearMemoryRepresentationCompleted(uint64_t requestIdentifier, std::optional<Error>&& result) >+void WebCacheStorageConnection::clearMemoryRepresentationCompleted(uint64_t requestIdentifier, WTF::Optional<Error>&& result) > { > if (auto callback = m_clearRepresentationCallbacks.take(requestIdentifier)) > callback(WTFMove(result)); >diff --git a/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h b/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h >index d2e0df2d860922a3b1e356be921e7801986dc756..3f1ec1ce8f18179dbf4a2e9b2b9b6d5db21f7bd2 100644 >--- a/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h >+++ b/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h >@@ -75,7 +75,7 @@ private: > void putRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCacheEngine::RecordIdentifiersOrError&&); > > void engineRepresentationCompleted(uint64_t requestIdentifier, const String& representation); >- void clearMemoryRepresentationCompleted(uint64_t requestIdentifier, std::optional<WebCore::DOMCacheEngine::Error>&&); >+ void clearMemoryRepresentationCompleted(uint64_t requestIdentifier, WTF::Optional<WebCore::DOMCacheEngine::Error>&&); > > WebCacheStorageProvider& m_provider; > PAL::SessionID m_sessionID; >diff --git a/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in b/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in >index 5c0963c14b453334bfd1af6bfda7682d38c95a1c..eb9ad2225b8dbcbfd116cd9703892b7e5bff8084 100644 >--- a/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in >+++ b/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in >@@ -30,5 +30,5 @@ messages -> WebCacheStorageConnection { > PutRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCacheEngine::RecordIdentifiersOrError result); > > EngineRepresentationCompleted(uint64_t requestIdentifier, String representation); >- ClearMemoryRepresentationCompleted(uint64_t requestIdentifier, std::optional<WebCore::DOMCacheEngine::Error> error); >+ ClearMemoryRepresentationCompleted(uint64_t requestIdentifier, WTF::Optional<WebCore::DOMCacheEngine::Error> error); > } >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm >index a57e57733e39bcaea398a5fb18b118465eb37465..22246e73accf47ecc2bfe1d41ed5f360f1c0723b 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm >@@ -64,7 +64,7 @@ - (UIImage *)renderedImageWithOptions:(WKSnapshotOptions)options > > - (UIImage *)renderedImageWithOptions:(WKSnapshotOptions)options width:(NSNumber *)width > { >- std::optional<float> optionalWidth; >+ WTF::Optional<float> optionalWidth; > if (width) > optionalWidth = width.floatValue; > >@@ -84,7 +84,7 @@ - (NSImage *)renderedImageWithOptions:(WKSnapshotOptions)options > > - (NSImage *)renderedImageWithOptions:(WKSnapshotOptions)options width:(NSNumber *)width > { >- std::optional<float> optionalWidth; >+ WTF::Optional<float> optionalWidth; > if (width) > optionalWidth = width.floatValue; > >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp >index bbe3cc9bfd0711ed7e755ee43e27fffc752aa969..1d333c4692c99e088271231f30e6ee2c759d24b4 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp >@@ -773,7 +773,7 @@ WKArrayRef WKBundlePageCopyOriginsWithApplicationCache(WKBundlePageRef page) > > void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef page, WKEventThrottlingBehavior* behavior) > { >- std::optional<WebCore::EventThrottlingBehavior> behaviorValue; >+ WTF::Optional<WebCore::EventThrottlingBehavior> behaviorValue; > if (behavior) { > switch (*behavior) { > case kWKEventThrottlingBehaviorResponsive: >@@ -790,7 +790,7 @@ void WKBundlePageSetEventThrottlingBehaviorOverride(WKBundlePageRef page, WKEven > > void WKBundlePageSetCompositingPolicyOverride(WKBundlePageRef page, WKCompositingPolicy* policy) > { >- std::optional<WebCore::CompositingPolicy> policyValue; >+ WTF::Optional<WebCore::CompositingPolicy> policyValue; > if (policy) { > switch (*policy) { > case kWKCompositingPolicyNormal: >diff --git a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp >index 94316a106bb8b896c38589c1f72c49dc4c2daaae..cfe1be357439f74d63126efc23b45ad2111ac8ab 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp >@@ -134,7 +134,7 @@ IntRect InjectedBundleNodeHandle::renderRect(bool* isReplaced) > return m_node->pixelSnappedRenderRect(isReplaced); > } > >-static RefPtr<WebImage> imageForRect(FrameView* frameView, const IntRect& paintingRect, const std::optional<float>& bitmapWidth, SnapshotOptions options) >+static RefPtr<WebImage> imageForRect(FrameView* frameView, const IntRect& paintingRect, const WTF::Optional<float>& bitmapWidth, SnapshotOptions options) > { > if (paintingRect.isEmpty()) > return nullptr; >@@ -183,7 +183,7 @@ static RefPtr<WebImage> imageForRect(FrameView* frameView, const IntRect& painti > return snapshot; > } > >-RefPtr<WebImage> InjectedBundleNodeHandle::renderedImage(SnapshotOptions options, bool shouldExcludeOverflow, const std::optional<float>& bitmapWidth) >+RefPtr<WebImage> InjectedBundleNodeHandle::renderedImage(SnapshotOptions options, bool shouldExcludeOverflow, const WTF::Optional<float>& bitmapWidth) > { > Frame* frame = m_node->document().frame(); > if (!frame) >diff --git a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h >index bbab83f5861d883c1768ddd896a644174024db8e..12cfa7e3547f16282b73649107449e733a1ef2df 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h >+++ b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h >@@ -62,7 +62,7 @@ public: > // Note: These should only be operations that are not exposed to JavaScript. > WebCore::IntRect elementBounds(); > WebCore::IntRect renderRect(bool*); >- RefPtr<WebImage> renderedImage(SnapshotOptions, bool shouldExcludeOverflow, const std::optional<float>& bitmapWidth = std::nullopt); >+ RefPtr<WebImage> renderedImage(SnapshotOptions, bool shouldExcludeOverflow, const WTF::Optional<float>& bitmapWidth = WTF::nullopt); > RefPtr<InjectedBundleRangeHandle> visibleRange(); > void setHTMLInputElementValueForUser(const String&); > void setHTMLInputElementSpellcheckEnabled(bool); >diff --git a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp >index 980eb60e5595b6d9090dd2407d47ed4c95b8ca17..9200cc113cbfb5e250d2dc1f3f6d15cc9cbec723 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp >@@ -37,21 +37,21 @@ > namespace WebKit { > using namespace WebCore; > >-static WebMouseEvent::Button mouseButtonForMouseEventData(const std::optional<NavigationAction::MouseEventData>& mouseEventData) >+static WebMouseEvent::Button mouseButtonForMouseEventData(const WTF::Optional<NavigationAction::MouseEventData>& mouseEventData) > { > if (mouseEventData && mouseEventData->buttonDown && mouseEventData->isTrusted) > return static_cast<WebMouseEvent::Button>(mouseEventData->button); > return WebMouseEvent::NoButton; > } > >-static WebMouseEvent::SyntheticClickType syntheticClickTypeForMouseEventData(const std::optional<NavigationAction::MouseEventData>& mouseEventData) >+static WebMouseEvent::SyntheticClickType syntheticClickTypeForMouseEventData(const WTF::Optional<NavigationAction::MouseEventData>& mouseEventData) > { > if (mouseEventData && mouseEventData->buttonDown && mouseEventData->isTrusted) > return static_cast<WebMouseEvent::SyntheticClickType>(mouseEventData->syntheticClickType); > return WebMouseEvent::NoTap; > } > >-static FloatPoint clickLocationInRootViewCoordinatesForMouseEventData(const std::optional<NavigationAction::MouseEventData>& mouseEventData) >+static FloatPoint clickLocationInRootViewCoordinatesForMouseEventData(const WTF::Optional<NavigationAction::MouseEventData>& mouseEventData) > { > if (mouseEventData && mouseEventData->buttonDown && mouseEventData->isTrusted) > return mouseEventData->locationInRootViewCoordinates; >diff --git a/Source/WebKit/WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp b/Source/WebKit/WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp >index bb90de11fa7e0a6ef516ced25f63abfbc1a4c0e8..2bd3b2a5773c81d60f764460de251f842e7a1c7d 100644 >--- a/Source/WebKit/WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp >+++ b/Source/WebKit/WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp >@@ -50,7 +50,7 @@ bool MediaDeviceSandboxExtensions::decode(IPC::Decoder& decoder, MediaDeviceSand > if (!decoder.decode(result.m_ids)) > return false; > >- std::optional<SandboxExtension::HandleArray> handles; >+ WTF::Optional<SandboxExtension::HandleArray> handles; > decoder >> handles; > if (!handles) > return false; >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >index c75a6a58c85cde370e201506d5102ccb1d0256ef..e70be14cf31992a206863245a38d371a51beb8b0 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp >@@ -474,17 +474,17 @@ static bool shouldClearReferrerOnHTTPSToHTTPRedirect(Frame* frame) > return true; > } > >-std::optional<WebLoaderStrategy::SyncLoadResult> WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler(FrameLoader& frameLoader, ResourceLoadIdentifier identifier, const ResourceRequest& request) >+WTF::Optional<WebLoaderStrategy::SyncLoadResult> WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler(FrameLoader& frameLoader, ResourceLoadIdentifier identifier, const ResourceRequest& request) > { > auto* webFrameLoaderClient = toWebFrameLoaderClient(frameLoader.client()); > auto* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr; > auto* webPage = webFrame ? webFrame->page() : nullptr; > if (!webPage) >- return std::nullopt; >+ return WTF::nullopt; > > auto* handler = webPage->urlSchemeHandlerForScheme(request.url().protocol().toStringWithoutCopying()); > if (!handler) >- return std::nullopt; >+ return WTF::nullopt; > > LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, sync load to URL '%s' will be handled by a UIProcess URL scheme handler.", request.url().string().utf8().data()); > >diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >index e62052b0dbd0ceff73a206cfe73f895420ac632f..b0cc1bc06a2c909656c29c8f1d9e01829d60aad7 100644 >--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h >@@ -96,7 +96,7 @@ private: > WebCore::ResourceError error; > Vector<char> data; > }; >- std::optional<SyncLoadResult> tryLoadingSynchronouslyUsingURLSchemeHandler(WebCore::FrameLoader&, ResourceLoadIdentifier, const WebCore::ResourceRequest&); >+ WTF::Optional<SyncLoadResult> tryLoadingSynchronouslyUsingURLSchemeHandler(WebCore::FrameLoader&, ResourceLoadIdentifier, const WebCore::ResourceRequest&); > > WebCore::ResourceResponse responseFromResourceLoadIdentifier(uint64_t resourceLoadIdentifier) final; > Vector<WebCore::NetworkTransactionInformation> intermediateLoadInformationFromResourceLoadIdentifier(uint64_t resourceLoadIdentifier) final; >diff --git a/Source/WebKit/WebProcess/Network/WebSocketStream.cpp b/Source/WebKit/WebProcess/Network/WebSocketStream.cpp >index 1d5e229ac23da3087e46d935565aaa4d67b5a026..bcc2572f14d59f7d3889f8147296c8ba3f99723e 100644 >--- a/Source/WebKit/WebProcess/Network/WebSocketStream.cpp >+++ b/Source/WebKit/WebProcess/Network/WebSocketStream.cpp >@@ -105,7 +105,7 @@ void WebSocketStream::platformSend(const uint8_t* data, size_t length, Function< > m_sendDataCallbacks.add(dataIdentifier, WTFMove(completionHandler)); > } > >-void WebSocketStream::platformSendHandshake(const uint8_t* data, size_t length, const std::optional<CookieRequestHeaderFieldProxy>& headerFieldProxy, Function<void(bool, bool)>&& completionHandler) >+void WebSocketStream::platformSendHandshake(const uint8_t* data, size_t length, const WTF::Optional<CookieRequestHeaderFieldProxy>& headerFieldProxy, Function<void(bool, bool)>&& completionHandler) > { > static uint64_t nextDataIdentifier = 1; > uint64_t dataIdentifier = nextDataIdentifier++; >diff --git a/Source/WebKit/WebProcess/Network/WebSocketStream.h b/Source/WebKit/WebProcess/Network/WebSocketStream.h >index 389a0b98b7598cc668be8db45f1711b8fe8f770e..00511739d1bb49b3bbd49a631f770376c93b4989 100644 >--- a/Source/WebKit/WebProcess/Network/WebSocketStream.h >+++ b/Source/WebKit/WebProcess/Network/WebSocketStream.h >@@ -53,7 +53,7 @@ public: > > // SocketStreamHandle > void platformSend(const uint8_t*, size_t, Function<void(bool)>&&) final; >- void platformSendHandshake(const uint8_t*, size_t, const std::optional<WebCore::CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&); >+ void platformSendHandshake(const uint8_t*, size_t, const WTF::Optional<WebCore::CookieRequestHeaderFieldProxy>&, Function<void(bool, bool)>&&); > void platformClose() final; > size_t bufferedAmount() final; > >diff --git a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h >index ce705b60f1d8bc837ba145f65368ae88a1c4957c..91645bc9fcf0d457648aa95957f4d64f158a7107 100644 >--- a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h >+++ b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h >@@ -95,7 +95,7 @@ private: > State m_state { STATE_BINDING }; > > static const unsigned MAX_SOCKET_OPTION { rtc::Socket::OPT_RTP_SENDTIME_EXTN_ID + 1 }; >- std::optional<int> m_options[MAX_SOCKET_OPTION]; >+ WTF::Optional<int> m_options[MAX_SOCKET_OPTION]; > > Deque<size_t> m_beingSentPacketSizes; > size_t m_availableSendingBytes { 65536 }; >diff --git a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >index c2cba090fbbdb2d9a190b1aff8fe355cd6fc3264..0641d121ab162bddc92878813546763de062b81d 100644 >--- a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >+++ b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >@@ -1620,7 +1620,7 @@ bool PDFPlugin::handleContextMenuEvent(const WebMouseEvent& event) > } > PDFContextMenu contextMenu { point, WTFMove(items) }; > >- std::optional<int> selectedIndex = -1; >+ WTF::Optional<int> selectedIndex = -1; > webPage->sendSync(Messages::WebPageProxy::ShowPDFContextMenu(contextMenu), Messages::WebPageProxy::ShowPDFContextMenu::Reply(selectedIndex)); > > if (selectedIndex && *selectedIndex >= 0 && *selectedIndex < itemCount) >diff --git a/Source/WebKit/WebProcess/Plugins/PluginView.cpp b/Source/WebKit/WebProcess/Plugins/PluginView.cpp >index 4495c991122d0843dab0c84da60ba5a7c97ba6c8..ed87889c4bdd56044b046bc03518493bf865560f 100644 >--- a/Source/WebKit/WebProcess/Plugins/PluginView.cpp >+++ b/Source/WebKit/WebProcess/Plugins/PluginView.cpp >@@ -1193,7 +1193,7 @@ void PluginView::performFrameLoadURLRequest(URLRequest* request) > return; > } > >- UserGestureIndicator gestureIndicator(request->allowPopups() ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt); >+ UserGestureIndicator gestureIndicator(request->allowPopups() ? WTF::Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); > > // First, try to find a target frame. > Frame* targetFrame = frame->loader().findFrameForNavigation(request->target()); >@@ -1477,7 +1477,7 @@ bool PluginView::evaluate(NPObject* npObject, const String& scriptString, NPVari > // protect the plug-in view from destruction. > NPRuntimeObjectMap::PluginProtector pluginProtector(&m_npRuntimeObjectMap); > >- UserGestureIndicator gestureIndicator(allowPopups ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt); >+ UserGestureIndicator gestureIndicator(allowPopups ? WTF::Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); > return m_npRuntimeObjectMap.evaluate(npObject, scriptString, result); > } > >diff --git a/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp b/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp >index 3f70b1e87b9afe8f3f065a419ccdb952ceffce64..ebef54c081be5ab762f5c2619f1a77c568e6c7f3 100644 >--- a/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp >+++ b/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp >@@ -99,7 +99,7 @@ void WebPluginInfoProvider::refreshPlugins() > #endif > } > >-Vector<PluginInfo> WebPluginInfoProvider::pluginInfo(Page& page, std::optional<Vector<SupportedPluginIdentifier>>& supportedPluginIdentifiers) >+Vector<PluginInfo> WebPluginInfoProvider::pluginInfo(Page& page, WTF::Optional<Vector<SupportedPluginIdentifier>>& supportedPluginIdentifiers) > { > #if ENABLE(NETSCAPE_PLUGIN_API) > populatePluginCache(page); >@@ -117,7 +117,7 @@ Vector<PluginInfo> WebPluginInfoProvider::pluginInfo(Page& page, std::optional<V > > Vector<WebCore::PluginInfo> WebPluginInfoProvider::webVisiblePluginInfo(Page& page, const URL& url) > { >- std::optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginIdentifiers; >+ WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginIdentifiers; > auto plugins = pluginInfo(page, supportedPluginIdentifiers); > > plugins.removeAllMatching([&] (auto& plugin) { >@@ -171,7 +171,7 @@ void WebPluginInfoProvider::populatePluginCache(const WebCore::Page& page) > #endif > > #if PLATFORM(MAC) >-std::optional<WebCore::PluginLoadClientPolicy> WebPluginInfoProvider::pluginLoadClientPolicyForHost(const String& host, const WebCore::PluginInfo& info) const >+WTF::Optional<WebCore::PluginLoadClientPolicy> WebPluginInfoProvider::pluginLoadClientPolicyForHost(const String& host, const WebCore::PluginInfo& info) const > { > String hostToLookUp = host; > String identifier = info.bundleIdentifier; >@@ -188,7 +188,7 @@ std::optional<WebCore::PluginLoadClientPolicy> WebPluginInfoProvider::pluginLoad > } > } > if (policiesByIdentifierIterator == m_hostsToPluginIdentifierData.end()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& policiesByIdentifier = policiesByIdentifierIterator->value; > >@@ -202,7 +202,7 @@ std::optional<WebCore::PluginLoadClientPolicy> WebPluginInfoProvider::pluginLoad > } > > if (identifierPolicyIterator == policiesByIdentifier.end()) >- return std::nullopt; >+ return WTF::nullopt; > > auto& versionsToPolicies = identifierPolicyIterator->value; > >@@ -216,7 +216,7 @@ std::optional<WebCore::PluginLoadClientPolicy> WebPluginInfoProvider::pluginLoad > } > > if (policyIterator == versionsToPolicies.end()) >- return std::nullopt; >+ return WTF::nullopt; > > return policyIterator->value; > } >diff --git a/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h b/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h >index 84642d7fc011f8cacf641bb1aee8f282393c07e8..a738a1a56843078f2499f0569e0a8809f128ffc7 100644 >--- a/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h >+++ b/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h >@@ -45,7 +45,7 @@ public: > private: > WebPluginInfoProvider(); > >- Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginIdentifier>>&) final; >+ Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>>&) final; > Vector<WebCore::PluginInfo> webVisiblePluginInfo(WebCore::Page&, const URL&) final; > void refreshPlugins() override; > >@@ -54,7 +54,7 @@ private: > #endif // ENABLE(NETSCAPE_PLUGIN_API) > > #if PLATFORM(MAC) >- std::optional<WebCore::PluginLoadClientPolicy> pluginLoadClientPolicyForHost(const String&, const WebCore::PluginInfo&) const; >+ WTF::Optional<WebCore::PluginLoadClientPolicy> pluginLoadClientPolicyForHost(const String&, const WebCore::PluginInfo&) const; > String longestMatchedWildcardHostForHost(const String& host) const; > bool replaceHostWithMatchedWildcardHost(String& host, const String& identifier) const; > >@@ -68,7 +68,7 @@ private: > bool m_shouldRefreshPlugins { false }; > Vector<WebCore::PluginInfo> m_cachedPlugins; > Vector<WebCore::PluginInfo> m_cachedApplicationPlugins; >- std::optional<Vector<WebCore::SupportedPluginIdentifier>> m_cachedSupportedPluginIdentifiers; >+ WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>> m_cachedSupportedPluginIdentifiers; > #endif > }; > >diff --git a/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp b/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp >index ada110232b1a09fde856b4d0959d216e7e93909a..09f132e448fbd19aa224cf4490165c032ba6af6d 100644 >--- a/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp >+++ b/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp >@@ -84,7 +84,7 @@ void ServiceWorkerClientFetch::start() > } > > // https://fetch.spec.whatwg.org/#http-fetch step 3.3 >-std::optional<ResourceError> ServiceWorkerClientFetch::validateResponse(const ResourceResponse& response) >+WTF::Optional<ResourceError> ServiceWorkerClientFetch::validateResponse(const ResourceResponse& response) > { > // FIXME: make a better error reporting. > if (response.type() == ResourceResponse::Type::Error) >@@ -101,7 +101,7 @@ std::optional<ResourceError> ServiceWorkerClientFetch::validateResponse(const Re > if ((options.redirect != FetchOptions::Redirect::Follow || options.mode == FetchOptions::Mode::Navigate) && response.isRedirected()) > return ResourceError { errorDomainWebKitInternal, 0, response.url(), "Response served by service worker has redirections"_s, ResourceError::Type::AccessControl }; > >- return std::nullopt; >+ return WTF::nullopt; > } > > void ServiceWorkerClientFetch::didReceiveResponse(ResourceResponse&& response) >diff --git a/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h b/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h >index aec641e97b8a7cd79fea60c421b717ea565e67fc..a4bde4bd97c66cf0593848a9dcf992089af2cc00 100644 >--- a/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h >+++ b/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h >@@ -59,7 +59,7 @@ public: > private: > ServiceWorkerClientFetch(WebServiceWorkerProvider&, Ref<WebCore::ResourceLoader>&&, WebCore::FetchIdentifier, Ref<WebSWClientConnection>&&, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Callback&&); > >- std::optional<WebCore::ResourceError> validateResponse(const WebCore::ResourceResponse&); >+ WTF::Optional<WebCore::ResourceError> validateResponse(const WebCore::ResourceResponse&); > > void didReceiveResponse(WebCore::ResourceResponse&&); > void didReceiveData(const IPC::DataReference&, int64_t encodedDataLength); >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >index 9861591c06589fb611ed2236a7fe40037e79c5da..10702c5593cd777cd7836edba678f0e900457c50 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >@@ -93,7 +93,7 @@ void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier d > WebProcess::singleton().send(Messages::WebProcessPool::PostMessageToServiceWorker(destinationIdentifier, WTFMove(message), sourceIdentifier, serverConnectionIdentifier()), 0); > } > >-void WebSWClientConnection::registerServiceWorkerClient(const SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData& data, const std::optional<WebCore::ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier) >+void WebSWClientConnection::registerServiceWorkerClient(const SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData& data, const WTF::Optional<WebCore::ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier) > { > send(Messages::WebSWServerConnection::RegisterServiceWorkerClient { topOrigin.data(), data, controllingServiceWorkerRegistrationIdentifier }); > } >@@ -128,7 +128,7 @@ void WebSWClientConnection::setSWOriginTableIsImported() > m_tasksPendingOriginImport.takeFirst()(); > } > >-void WebSWClientConnection::didMatchRegistration(uint64_t matchingRequest, std::optional<ServiceWorkerRegistrationData>&& result) >+void WebSWClientConnection::didMatchRegistration(uint64_t matchingRequest, WTF::Optional<ServiceWorkerRegistrationData>&& result) > { > ASSERT(isMainThread()); > >@@ -149,7 +149,7 @@ void WebSWClientConnection::matchRegistration(SecurityOriginData&& topOrigin, co > ASSERT(isMainThread()); > > if (!mayHaveServiceWorkerRegisteredForOrigin(topOrigin)) { >- callback(std::nullopt); >+ callback(WTF::nullopt); > return; > } > >@@ -217,7 +217,7 @@ void WebSWClientConnection::connectionToServerLost() > { > auto registrationTasks = WTFMove(m_ongoingMatchRegistrationTasks); > for (auto& callback : registrationTasks.values()) >- callback(std::nullopt); >+ callback(WTF::nullopt); > > auto getRegistrationTasks = WTFMove(m_ongoingGetRegistrationsTasks); > for (auto& callback : getRegistrationTasks.values()) >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >index dcd6da5806bb332c24ffec8518ee5096cbae7f83..2c1eceba96270a655c82d896645098c6d4c790eb 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >@@ -76,11 +76,11 @@ private: > void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final; > void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final; > void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source) final; >- void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData&, const std::optional<WebCore::ServiceWorkerRegistrationIdentifier>&) final; >+ void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData&, const WTF::Optional<WebCore::ServiceWorkerRegistrationIdentifier>&) final; > void unregisterServiceWorkerClient(WebCore::DocumentIdentifier) final; > > void matchRegistration(WebCore::SecurityOriginData&& topOrigin, const URL& clientURL, RegistrationCallback&&) final; >- void didMatchRegistration(uint64_t matchRequestIdentifier, std::optional<WebCore::ServiceWorkerRegistrationData>&&); >+ void didMatchRegistration(uint64_t matchRequestIdentifier, WTF::Optional<WebCore::ServiceWorkerRegistrationData>&&); > void didGetRegistrations(uint64_t matchRequestIdentifier, Vector<WebCore::ServiceWorkerRegistrationData>&&); > void whenRegistrationReady(const WebCore::SecurityOrigin& topOrigin, const URL& clientURL, WhenRegistrationReadyCallback&&) final; > void registrationReady(uint64_t callbackID, WebCore::ServiceWorkerRegistrationData&&); >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in >index b9c66368efec4254583ae2e6b5549d81dc73752a..6d5340e6c2ad838159d546181824c0e6f50b4965 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in >@@ -28,7 +28,7 @@ messages -> WebSWClientConnection { > RegistrationJobResolvedInServer(WebCore::ServiceWorkerJobIdentifier jobDataIdentifier, struct WebCore::ServiceWorkerRegistrationData registration, enum:bool WebCore::ShouldNotifyWhenResolved shouldNotifyWhenResolved) > UnregistrationJobResolvedInServer(WebCore::ServiceWorkerJobIdentifier jobDataIdentifier, bool unregistrationResult) > StartScriptFetchForServer(WebCore::ServiceWorkerJobIdentifier jobDataIdentifier, WebCore::ServiceWorkerRegistrationKey registrationKey, WebCore::FetchOptions::Cache cachePolicy) >- UpdateRegistrationState(WebCore::ServiceWorkerRegistrationIdentifier identifier, enum:uint8_t WebCore::ServiceWorkerRegistrationState state, std::optional<WebCore::ServiceWorkerData> serviceWorkerIdentifier) >+ UpdateRegistrationState(WebCore::ServiceWorkerRegistrationIdentifier identifier, enum:uint8_t WebCore::ServiceWorkerRegistrationState state, WTF::Optional<WebCore::ServiceWorkerData> serviceWorkerIdentifier) > UpdateWorkerState(WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, enum:uint8_t WebCore::ServiceWorkerState state) > FireUpdateFoundEvent(WebCore::ServiceWorkerRegistrationIdentifier identifier) > SetRegistrationLastUpdateTime(WebCore::ServiceWorkerRegistrationIdentifier identifier, WallTime lastUpdateTime) >@@ -39,7 +39,7 @@ messages -> WebSWClientConnection { > SetSWOriginTableSharedMemory(WebKit::SharedMemory::Handle handle) > PostMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, struct WebCore::MessageWithMessagePorts message, struct WebCore::ServiceWorkerData source, String sourceOrigin) > >- DidMatchRegistration(uint64_t matchRequestIdentifier, std::optional<WebCore::ServiceWorkerRegistrationData> data) >+ DidMatchRegistration(uint64_t matchRequestIdentifier, WTF::Optional<WebCore::ServiceWorkerRegistrationData> data) > DidGetRegistrations(uint64_t matchRequestIdentifier, Vector<WebCore::ServiceWorkerRegistrationData> registrations) > RegistrationReady(uint64_t registrationReadyRequestIdentifier, struct WebCore::ServiceWorkerRegistrationData data) > } >diff --git a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp >index 04e9aa7d9977a6f076aef6ccd0bce16a411fb358..1f324c93cb9089576ebfcbea557b223ff604ba36 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp >+++ b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp >@@ -94,8 +94,8 @@ private: > bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) final { return true; } > > PAL::SessionID sessionID() const final { return m_sessionID; } >- std::optional<uint64_t> pageID() const final { return m_pageID; } >- std::optional<uint64_t> frameID() const final { return m_frameID; } >+ WTF::Optional<uint64_t> pageID() const final { return m_pageID; } >+ WTF::Optional<uint64_t> frameID() const final { return m_frameID; } > String userAgent(const URL&) final { return m_userAgent; } > > WebSWContextManagerConnection& m_connection; >@@ -168,7 +168,7 @@ void WebSWContextManagerConnection::removeFrameLoaderClient(ServiceWorkerFrameLo > ASSERT_UNUSED(result, result); > } > >-void WebSWContextManagerConnection::serviceWorkerStartedWithMessage(std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage) >+void WebSWContextManagerConnection::serviceWorkerStartedWithMessage(WTF::Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage) > { > if (exceptionMessage.isEmpty()) > m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::ScriptContextStarted(jobDataIdentifier, serviceWorkerIdentifier), 0); >@@ -225,7 +225,7 @@ void WebSWContextManagerConnection::startFetch(SWServerConnectionIdentifier serv > } > > auto client = WebServiceWorkerFetchTaskClient::create(m_connectionToNetworkProcess.copyRef(), serviceWorkerIdentifier, serverConnectionIdentifier, fetchIdentifier); >- std::optional<ServiceWorkerClientIdentifier> clientId; >+ WTF::Optional<ServiceWorkerClientIdentifier> clientId; > if (options.clientIdentifier) > clientId = ServiceWorkerClientIdentifier { serverConnectionIdentifier, options.clientIdentifier.value() }; > >@@ -265,7 +265,7 @@ void WebSWContextManagerConnection::postMessageToServiceWorkerClient(const Servi > WebProcess::singleton().send(Messages::WebProcessPool::PostMessageToServiceWorkerClient(destinationIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin), 0); > } > >-void WebSWContextManagerConnection::didFinishInstall(std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful) >+void WebSWContextManagerConnection::didFinishInstall(WTF::Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful) > { > m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::DidFinishInstall(jobDataIdentifier, serviceWorkerIdentifier, wasSuccessful), 0); > } >@@ -304,7 +304,7 @@ void WebSWContextManagerConnection::findClientByIdentifier(WebCore::ServiceWorke > m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::FindClientByIdentifier { requestIdentifier, serviceWorkerIdentifier, clientIdentifier }, 0); > } > >-void WebSWContextManagerConnection::findClientByIdentifierCompleted(uint64_t requestIdentifier, std::optional<ServiceWorkerClientData>&& clientData, bool hasSecurityError) >+void WebSWContextManagerConnection::findClientByIdentifierCompleted(uint64_t requestIdentifier, WTF::Optional<ServiceWorkerClientData>&& clientData, bool hasSecurityError) > { > if (auto callback = m_findClientByIdentifierRequests.take(requestIdentifier)) { > if (hasSecurityError) { >diff --git a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h >index d9794699c91dc5d756dc33bdb2545c5f5dc0414d..2fdad409cf5b87ed194f4d197a5bcf688d7fe4d9 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h >+++ b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h >@@ -64,7 +64,7 @@ private: > > // WebCore::SWContextManager::Connection. > void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final; >- void didFinishInstall(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, bool wasSuccessful) final; >+ void didFinishInstall(WTF::Optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, bool wasSuccessful) final; > void didFinishActivation(WebCore::ServiceWorkerIdentifier) final; > void setServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier, bool) final; > void workerTerminated(WebCore::ServiceWorkerIdentifier) final; >@@ -75,7 +75,7 @@ private: > void setScriptResource(WebCore::ServiceWorkerIdentifier, const URL&, const WebCore::ServiceWorkerContextData::ImportedScript&) final; > > // IPC messages. >- void serviceWorkerStartedWithMessage(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final; >+ void serviceWorkerStartedWithMessage(WTF::Optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final; > void installServiceWorker(const WebCore::ServiceWorkerContextData&, PAL::SessionID); > void startFetch(WebCore::SWServerConnectionIdentifier, WebCore::ServiceWorkerIdentifier, WebCore::FetchIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&, String&& referrer); > void cancelFetch(WebCore::SWServerConnectionIdentifier, WebCore::ServiceWorkerIdentifier, WebCore::FetchIdentifier); >@@ -84,7 +84,7 @@ private: > void fireActivateEvent(WebCore::ServiceWorkerIdentifier); > void terminateWorker(WebCore::ServiceWorkerIdentifier); > void syncTerminateWorker(WebCore::ServiceWorkerIdentifier, Messages::WebSWContextManagerConnection::SyncTerminateWorker::DelayedReply&&); >- void findClientByIdentifierCompleted(uint64_t requestIdentifier, std::optional<WebCore::ServiceWorkerClientData>&&, bool hasSecurityError); >+ void findClientByIdentifierCompleted(uint64_t requestIdentifier, WTF::Optional<WebCore::ServiceWorkerClientData>&&, bool hasSecurityError); > void matchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientData>&&); > void claimCompleted(uint64_t claimRequestIdentifier); > void didFinishSkipWaiting(uint64_t callbackID); >diff --git a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in >index be0d593a68a791f14586f6f950c2d679ebe5e01b..2c5a36c4857b240e1ed64f1863467ef55efe1b24 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in >+++ b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in >@@ -31,7 +31,7 @@ messages -> WebSWContextManagerConnection { > FireActivateEvent(WebCore::ServiceWorkerIdentifier identifier) > TerminateWorker(WebCore::ServiceWorkerIdentifier identifier) > SyncTerminateWorker(WebCore::ServiceWorkerIdentifier identifier) -> () Delayed >- FindClientByIdentifierCompleted(uint64_t clientIdRequestIdentifier, std::optional<WebCore::ServiceWorkerClientData> data, bool hasSecurityError) >+ FindClientByIdentifierCompleted(uint64_t clientIdRequestIdentifier, WTF::Optional<WebCore::ServiceWorkerClientData> data, bool hasSecurityError) > MatchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientData> clientsData) > ClaimCompleted(uint64_t claimRequestIdentifier) > DidFinishSkipWaiting(uint64_t callbackID) >diff --git a/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp b/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp >index 2d3705493914fa179a4ef54e50ff69354d6809a4..6f4300678105eb34c456dd48e4c50ce1ce00449a 100644 >--- a/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp >+++ b/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp >@@ -93,7 +93,7 @@ void WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish(Ref<FormData>& > m_blobLoader.emplace(*this); > auto loader = serviceWorkerThreadProxy->createBlobLoader(*m_blobLoader, blobURL); > if (!loader) { >- m_blobLoader = std::nullopt; >+ m_blobLoader = WTF::nullopt; > didFail(internalError(blobURL)); > return; > } >@@ -114,7 +114,7 @@ void WebServiceWorkerFetchTaskClient::didFinishBlobLoading() > { > didFinish(); > >- std::exchange(m_blobLoader, std::nullopt); >+ std::exchange(m_blobLoader, WTF::nullopt); > } > > void WebServiceWorkerFetchTaskClient::didFail(const ResourceError& error) >diff --git a/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h b/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h >index 36e05ac97b10241757acd7c4ea2555a13d8f5951..cd2e9edd70de3eef345d3e3835b05e5f14432b93 100644 >--- a/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h >+++ b/Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h >@@ -78,7 +78,7 @@ private: > WebCore::SWServerConnectionIdentifier m_serverConnectionIdentifier; > WebCore::ServiceWorkerIdentifier m_serviceWorkerIdentifier; > WebCore::FetchIdentifier m_fetchIdentifier; >- std::optional<BlobLoader> m_blobLoader; >+ WTF::Optional<BlobLoader> m_blobLoader; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index b31b117f0edab398b25124064e16227faf786255..b7164baefa009abc9aa8180ef529bc1845598c63 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -1061,7 +1061,7 @@ void WebChromeClient::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle > m_page.send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(static_cast<int32_t>(newStyle))); > } > >-std::optional<ScrollbarOverlayStyle> WebChromeClient::preferredScrollbarOverlayStyle() >+WTF::Optional<ScrollbarOverlayStyle> WebChromeClient::preferredScrollbarOverlayStyle() > { > return m_page.scrollbarOverlayStyle(); > } >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 4315126b0648e3447fc0b9cfbc88023c001bfca9..1e78539c2cc338abf07075612eb4689268d96fbc 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -298,7 +298,7 @@ private: > void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&) final; > void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle newStyle) final; > >- std::optional<WebCore::ScrollbarOverlayStyle> preferredScrollbarOverlayStyle() final; >+ WTF::Optional<WebCore::ScrollbarOverlayStyle> preferredScrollbarOverlayStyle() final; > > WebCore::Color underlayColor() const final; > >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >index d05fc996c1d4ed9f756fc885e93cd65b2c45d02c..fad36996a06d91f442ccc869bb101ee10c7d256e 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -112,20 +112,20 @@ WebFrameLoaderClient::~WebFrameLoaderClient() > { > } > >-std::optional<uint64_t> WebFrameLoaderClient::pageID() const >+WTF::Optional<uint64_t> WebFrameLoaderClient::pageID() const > { > if (m_frame && m_frame->page()) > return m_frame->page()->pageID(); > >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<uint64_t> WebFrameLoaderClient::frameID() const >+WTF::Optional<uint64_t> WebFrameLoaderClient::frameID() const > { > if (m_frame) > return m_frame->frameID(); > >- return std::nullopt; >+ return WTF::nullopt; > } > > PAL::SessionID WebFrameLoaderClient::sessionID() const >@@ -503,7 +503,7 @@ void WebFrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& ti > webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), truncatedTitle.string, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()))); > } > >-void WebFrameLoaderClient::dispatchDidCommitLoad(std::optional<HasInsecureContent> hasInsecureContent) >+void WebFrameLoaderClient::dispatchDidCommitLoad(WTF::Optional<HasInsecureContent> hasInsecureContent) > { > WebPage* webPage = m_frame->page(); > if (!webPage) >@@ -893,7 +893,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat > uint64_t newNavigationID; > WebPolicyAction policyAction; > DownloadID downloadID; >- std::optional<WebsitePoliciesData> websitePolicies; >+ WTF::Optional<WebsitePoliciesData> websitePolicies; > > if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationActionSync(m_frame->frameID(), m_frame->isMainFrame(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingPageID, navigationAction.resourceRequest(), request, IPC::FormDataReference { request.httpBody() }, redirectResponse, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForNavigationActionSync::Reply(policyAction, newNavigationID, downloadID, websitePolicies))) { > m_frame->didReceivePolicyDecision(listenerID, WebPolicyAction::Ignore, 0, { }, { }); >@@ -1861,7 +1861,7 @@ void WebFrameLoaderClient::didCreateWindow(DOMWindow& window) > } > > #if ENABLE(APPLICATION_MANIFEST) >-void WebFrameLoaderClient::finishedLoadingApplicationManifest(uint64_t callbackIdentifier, const std::optional<WebCore::ApplicationManifest>& manifest) >+void WebFrameLoaderClient::finishedLoadingApplicationManifest(uint64_t callbackIdentifier, const WTF::Optional<WebCore::ApplicationManifest>& manifest) > { > WebPage* webPage = m_frame->page(); > if (!webPage) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h >index 7fb514770128e73f4c2eef4301bbcae9a6985e01..158e3eb2505284b2cbe31f074572807166a64c76 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h >@@ -51,8 +51,8 @@ public: > > void applyToDocumentLoader(WebsitePoliciesData&&); > >- std::optional<uint64_t> pageID() const final; >- std::optional<uint64_t> frameID() const final; >+ WTF::Optional<uint64_t> pageID() const final; >+ WTF::Optional<uint64_t> frameID() const final; > PAL::SessionID sessionID() const final; > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >@@ -111,7 +111,7 @@ private: > void dispatchWillClose() final; > void dispatchDidStartProvisionalLoad(CompletionHandler<void()>&&) final; > void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) final; >- void dispatchDidCommitLoad(std::optional<WebCore::HasInsecureContent>) final; >+ void dispatchDidCommitLoad(WTF::Optional<WebCore::HasInsecureContent>) final; > void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) final; > void dispatchDidFailLoad(const WebCore::ResourceError&) final; > void dispatchDidFinishDocumentLoad() final; >@@ -273,7 +273,7 @@ private: > void didCreateWindow(WebCore::DOMWindow&) final; > > #if ENABLE(APPLICATION_MANIFEST) >- void finishedLoadingApplicationManifest(uint64_t, const std::optional<WebCore::ApplicationManifest>&) final; >+ void finishedLoadingApplicationManifest(uint64_t, const WTF::Optional<WebCore::ApplicationManifest>&) final; > #endif > > WebFrame* m_frame; >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp >index bf4820a0a1de0ad0a21b7467ee27416e6c32a056..7f2e77f6e88383df53598f23b5c3458472201899 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp >@@ -63,10 +63,10 @@ void WebGeolocationClient::setEnableHighAccuracy(bool enabled) > WebProcess::singleton().supplement<WebGeolocationManager>()->setEnableHighAccuracyForPage(m_page, enabled); > } > >-std::optional<GeolocationPosition> WebGeolocationClient::lastPosition() >+WTF::Optional<GeolocationPosition> WebGeolocationClient::lastPosition() > { > // FIXME: Implement this. >- return std::nullopt; >+ return WTF::nullopt; > } > > void WebGeolocationClient::requestPermission(Geolocation& geolocation) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.h >index cfe8d424859d8f1170fa89e7694060b7820d3905..6a85102caf18479ef9fca7a6ffa49382f6db1d34 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.h >@@ -47,7 +47,7 @@ private: > void stopUpdating() override; > void setEnableHighAccuracy(bool) override; > >- std::optional<WebCore::GeolocationPosition> lastPosition() override; >+ WTF::Optional<WebCore::GeolocationPosition> lastPosition() override; > > void requestPermission(WebCore::Geolocation&) override; > void cancelPermissionRequest(WebCore::Geolocation&) override; >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp >index f9b0ceef9cf0bfaf34f64da8b31607847142a0a3..c9439c519952c77f1d43a3809a0b19044eb6a659 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp >@@ -107,7 +107,7 @@ BlobRegistry* WebPlatformStrategies::createBlobRegistry() > > // CookiesStrategy > >-std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > String cookieString; > bool secureCookiesAccessed = false; >@@ -117,7 +117,7 @@ std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorag > return { cookieString, secureCookiesAccessed }; > } > >-void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& cookieString) >+void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& cookieString) > { > WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(session.sessionID(), firstParty, sameSiteInfo, url, frameID, pageID, cookieString), 0); > } >@@ -130,12 +130,12 @@ bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session) > return result; > } > >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > return cookieRequestHeaderFieldValue(session.sessionID(), firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > String cookieString; > bool secureCookiesAccessed = false; >@@ -144,7 +144,7 @@ std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL > return { cookieString, secureCookiesAccessed }; > } > >-bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) >+bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) > { > if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(session.sessionID(), firstParty, sameSiteInfo, url, frameID, pageID), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0)) > return false; >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h >index d69337b7a7804bf15333603ace74083c48ae071d..f4da773b3b4ebbf2c62982561e0211b74dba72f4 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h >@@ -47,12 +47,12 @@ private: > WebCore::BlobRegistry* createBlobRegistry() override; > > // WebCore::CookiesStrategy >- std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String&) override; >+ std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String&) override; > bool cookiesEnabled(const WebCore::NetworkStorageSession&) override; >- std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override; >+ std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override; > void deleteCookie(const WebCore::NetworkStorageSession&, const URL&, const String&) override; > > // WebCore::PasteboardStrategy >diff --git a/Source/WebKit/WebProcess/WebPage/DrawingArea.h b/Source/WebKit/WebProcess/WebPage/DrawingArea.h >index af555caf6ec7a9450d9389f8ca30f760ac04d382..38a385e8f3b6bf9fa6f4fe18ab5045cbfb2f2cc8 100644 >--- a/Source/WebKit/WebProcess/WebPage/DrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/DrawingArea.h >@@ -92,8 +92,8 @@ public: > virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) { } > > #if PLATFORM(COCOA) >- virtual void setViewExposedRect(std::optional<WebCore::FloatRect>) = 0; >- virtual std::optional<WebCore::FloatRect> viewExposedRect() const = 0; >+ virtual void setViewExposedRect(WTF::Optional<WebCore::FloatRect>) = 0; >+ virtual WTF::Optional<WebCore::FloatRect> viewExposedRect() const = 0; > > virtual void acceleratedAnimationDidStart(uint64_t /*layerID*/, const String& /*key*/, MonotonicTime /*startTime*/) { } > virtual void acceleratedAnimationDidEnd(uint64_t /*layerID*/, const String& /*key*/) { } >diff --git a/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in >index 3fd9862e4cab0ca3aa8376c69f3106cc6c5a51bc..e7327066d29daf17f164654ccfde741c919905da 100644 >--- a/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in >@@ -29,7 +29,7 @@ messages -> DrawingArea { > UpdateGeometry(WebCore::IntSize viewSize, bool flushSynchronously, MachSendRight fencePort) > SetDeviceScaleFactor(float deviceScaleFactor) > SetColorSpace(struct WebKit::ColorSpaceData colorSpace) >- SetViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect) >+ SetViewExposedRect(WTF::Optional<WebCore::FloatRect> viewExposedRect) > > AdjustTransientZoom(double scale, WebCore::FloatPoint origin) > CommitTransientZoom(double scale, WebCore::FloatPoint origin) >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h >index a3ba308e7521383a40220d85f3fa172b170cea65..ec55c560b14a851b2ed4596cfa627f62199d31a4 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h >@@ -230,7 +230,7 @@ public: > } > > void encode(IPC::Encoder&) const; >- static std::optional<KeyframeValue> decode(IPC::Decoder&); >+ static WTF::Optional<KeyframeValue> decode(IPC::Decoder&); > > private: > KeyframeType keyType; >@@ -262,7 +262,7 @@ public: > } > > void encode(IPC::Encoder&) const; >- static std::optional<Properties> decode(IPC::Decoder&); >+ static WTF::Optional<Properties> decode(IPC::Decoder&); > > String keyPath; > PlatformCAAnimation::AnimationType animationType; >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm >index d4b3d17c8e1b37dd011ad8809f41bb31e125e895..550dcb7f200149d3c8cbaba4c48872916e027821 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm >@@ -120,32 +120,32 @@ void PlatformCAAnimationRemote::KeyframeValue::encode(IPC::Encoder& encoder) con > } > } > >-std::optional<PlatformCAAnimationRemote::KeyframeValue> PlatformCAAnimationRemote::KeyframeValue::decode(IPC::Decoder& decoder) >+WTF::Optional<PlatformCAAnimationRemote::KeyframeValue> PlatformCAAnimationRemote::KeyframeValue::decode(IPC::Decoder& decoder) > { > PlatformCAAnimationRemote::KeyframeValue value; > if (!decoder.decodeEnum(value.keyType)) >- return std::nullopt; >+ return WTF::nullopt; > > switch (value.keyType) { > case NumberKeyType: > if (!decoder.decode(value.number)) >- return std::nullopt; >+ return WTF::nullopt; > break; > case ColorKeyType: > if (!decoder.decode(value.color)) >- return std::nullopt; >+ return WTF::nullopt; > break; > case PointKeyType: > if (!decoder.decode(value.point)) >- return std::nullopt; >+ return WTF::nullopt; > break; > case TransformKeyType: > if (!decoder.decode(value.transform)) >- return std::nullopt; >+ return WTF::nullopt; > break; > case FilterKeyType: > if (!decodeFilterOperation(decoder, value.filter)) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > >@@ -197,60 +197,60 @@ void PlatformCAAnimationRemote::Properties::encode(IPC::Encoder& encoder) const > } > } > >-std::optional<PlatformCAAnimationRemote::Properties> PlatformCAAnimationRemote::Properties::decode(IPC::Decoder& decoder) >+WTF::Optional<PlatformCAAnimationRemote::Properties> PlatformCAAnimationRemote::Properties::decode(IPC::Decoder& decoder) > { > PlatformCAAnimationRemote::Properties properties; > if (!decoder.decode(properties.keyPath)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(properties.animationType)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.beginTime)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.duration)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.timeOffset)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.repeatCount)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.speed)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(properties.fillMode)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decodeEnum(properties.valueFunction)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.autoReverses)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.removedOnCompletion)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.additive)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.reverseTimingFunctions)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.hasExplicitBeginTime)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.keyValues)) >- return std::nullopt; >+ return WTF::nullopt; > > if (!decoder.decode(properties.keyTimes)) >- return std::nullopt; >+ return WTF::nullopt; > > uint64_t numTimingFunctions; > if (!decoder.decode(numTimingFunctions)) >- return std::nullopt; >+ return WTF::nullopt; > > if (numTimingFunctions) { > properties.timingFunctions.reserveInitialCapacity(numTimingFunctions); >@@ -259,32 +259,32 @@ std::optional<PlatformCAAnimationRemote::Properties> PlatformCAAnimationRemote:: > > TimingFunction::TimingFunctionType type; > if (!decoder.decodeEnum(type)) >- return std::nullopt; >+ return WTF::nullopt; > > RefPtr<TimingFunction> timingFunction; > switch (type) { > case TimingFunction::LinearFunction: > timingFunction = LinearTimingFunction::create(); > if (!decoder.decode(*static_cast<LinearTimingFunction*>(timingFunction.get()))) >- return std::nullopt; >+ return WTF::nullopt; > break; > > case TimingFunction::CubicBezierFunction: > timingFunction = CubicBezierTimingFunction::create(); > if (!decoder.decode(*static_cast<CubicBezierTimingFunction*>(timingFunction.get()))) >- return std::nullopt; >+ return WTF::nullopt; > break; > > case TimingFunction::StepsFunction: > timingFunction = StepsTimingFunction::create(); > if (!decoder.decode(*static_cast<StepsTimingFunction*>(timingFunction.get()))) >- return std::nullopt; >+ return WTF::nullopt; > break; > > case TimingFunction::SpringFunction: > timingFunction = SpringTimingFunction::create(); > if (!decoder.decode(*static_cast<SpringTimingFunction*>(timingFunction.get()))) >- return std::nullopt; >+ return WTF::nullopt; > break; > } > >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h >index a86346e5e1e55ede0dd8a82e1a7045dbf2e9c0fc..156e1b84116e6bbaef670a9cd54e9fbaf207e1e9 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h >@@ -86,8 +86,8 @@ private: > void forceRepaint() override; > bool forceRepaintAsync(CallbackID) override { return false; } > >- void setViewExposedRect(std::optional<WebCore::FloatRect>) override; >- std::optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; } >+ void setViewExposedRect(WTF::Optional<WebCore::FloatRect>) override; >+ WTF::Optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; } > > void acceleratedAnimationDidStart(uint64_t layerID, const String& key, MonotonicTime startTime) override; > void acceleratedAnimationDidEnd(uint64_t layerID, const String& key) override; >@@ -145,8 +145,8 @@ private: > > WebCore::IntSize m_viewSize; > >- std::optional<WebCore::FloatRect> m_viewExposedRect; >- std::optional<WebCore::FloatRect> m_scrolledViewExposedRect; >+ WTF::Optional<WebCore::FloatRect> m_viewExposedRect; >+ WTF::Optional<WebCore::FloatRect> m_scrolledViewExposedRect; > > WebCore::Timer m_layerFlushTimer; > bool m_isFlushingSuspended { false }; >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm >index 80bd2139587b315df176d620b4589dc36599a2f6..05711abd8e490a2c8269163ff8d4558fbb45198c 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm >@@ -215,7 +215,7 @@ void RemoteLayerTreeDrawingArea::acceleratedAnimationDidEnd(uint64_t layerID, co > m_remoteLayerTreeContext->animationDidEnd(layerID, key); > } > >-void RemoteLayerTreeDrawingArea::setViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect) >+void RemoteLayerTreeDrawingArea::setViewExposedRect(WTF::Optional<WebCore::FloatRect> viewExposedRect) > { > m_viewExposedRect = viewExposedRect; > updateScrolledExposedRect(); >diff --git a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm >index 18ef16481b45644a6d06f1a3b0e87dd06e031d43..9bc51caba9a4007ce74dda0e1cdba4a53543db6d 100644 >--- a/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm >+++ b/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm >@@ -96,7 +96,7 @@ void RemoteScrollingCoordinator::buildTransaction(RemoteScrollingCoordinatorTran > // Notification from the UI process that we scrolled. > void RemoteScrollingCoordinator::scrollPositionChangedForNode(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, bool syncLayerPosition) > { >- scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, std::nullopt, false /* FIXME */, syncLayerPosition ? ScrollingLayerPositionAction::Sync : ScrollingLayerPositionAction::Set); >+ scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, WTF::nullopt, false /* FIXME */, syncLayerPosition ? ScrollingLayerPositionAction::Sync : ScrollingLayerPositionAction::Set); > } > > void RemoteScrollingCoordinator::currentSnapPointIndicesChangedForNode(ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical) >diff --git a/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp b/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp >index 1f0d81ad94bea8b068379f1b0f1f6a1148cbf772..720a877dbb36bf5484f30ffd2d928bd2597a537c 100644 >--- a/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp >+++ b/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp >@@ -138,7 +138,7 @@ struct FontSizeAndCount { > unsigned count; > }; > >-std::optional<std::pair<double, double>> ViewGestureGeometryCollector::computeTextLegibilityScales(double& viewportMinimumScale, double& viewportMaximumScale) >+WTF::Optional<std::pair<double, double>> ViewGestureGeometryCollector::computeTextLegibilityScales(double& viewportMinimumScale, double& viewportMaximumScale) > { > static const unsigned fontSizeBinningInterval = 2; > static const double maximumNumberOfTextRunsToConsider = 200; >@@ -153,7 +153,7 @@ std::optional<std::pair<double, double>> ViewGestureGeometryCollector::computeTe > > auto document = makeRefPtr(m_webPage.mainFrame()->document()); > if (!document) >- return std::nullopt; >+ return WTF::nullopt; > > document->updateLayoutIgnorePendingStylesheets(); > >diff --git a/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h b/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h >index 42b6d1c31a4321118a2df9436fcbbc81527f3e16..01c7dc93f8e6580a6149148555cfdc863d8f2e7c 100644 >--- a/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h >+++ b/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h >@@ -65,7 +65,7 @@ private: > void computeMinimumAndMaximumViewportScales(double& viewportMinimumScale, double& viewportMaximumScale) const; > > #if PLATFORM(IOS_FAMILY) >- std::optional<std::pair<double, double>> computeTextLegibilityScales(double& viewportMinimumScale, double& viewportMaximumScale); >+ WTF::Optional<std::pair<double, double>> computeTextLegibilityScales(double& viewportMinimumScale, double& viewportMaximumScale); > #endif > > WebPage& m_webPage; >@@ -74,7 +74,7 @@ private: > uint64_t m_renderTreeSizeNotificationThreshold; > #endif > #if PLATFORM(IOS_FAMILY) >- std::optional<std::pair<double, double>> m_cachedTextLegibilityScales; >+ WTF::Optional<std::pair<double, double>> m_cachedTextLegibilityScales; > #endif > }; > >diff --git a/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp b/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp >index 417624d219f10de8058376b2adeca9de2256a8bf..9650d4864f07a113b05965cb91cfdbdd0ac0dcf6 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp >@@ -115,7 +115,7 @@ RefPtr<HistoryItem> WebBackForwardListProxy::itemAtIndex(int itemIndex) > if (!m_page) > return nullptr; > >- std::optional<BackForwardItemIdentifier> itemID; >+ WTF::Optional<BackForwardItemIdentifier> itemID; > if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::BackForwardItemAtIndex(itemIndex), Messages::WebPageProxy::BackForwardItemAtIndex::Reply(itemID), m_page->pageID())) > return nullptr; > >diff --git a/Source/WebKit/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit/WebProcess/WebPage/WebFrame.cpp >index 189d1a188b24b6446d0527df8650f0a1a386810b..9f0d379787e573b02d1b82ce62d3f5103facd1a5 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebFrame.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebFrame.cpp >@@ -270,7 +270,7 @@ static WebCore::PolicyAction toPolicyAction(WebPolicyAction policyAction) > return WebCore::PolicyAction::Ignore; > } > >-void WebFrame::didReceivePolicyDecision(uint64_t listenerID, WebPolicyAction action, uint64_t navigationID, DownloadID downloadID, std::optional<WebsitePoliciesData>&& websitePolicies) >+void WebFrame::didReceivePolicyDecision(uint64_t listenerID, WebPolicyAction action, uint64_t navigationID, DownloadID downloadID, WTF::Optional<WebsitePoliciesData>&& websitePolicies) > { > if (!m_coreFrame || !m_policyListenerID || listenerID != m_policyListenerID || !m_policyFunction) { > if (action == WebPolicyAction::Suspend) >diff --git a/Source/WebKit/WebProcess/WebPage/WebFrame.h b/Source/WebKit/WebProcess/WebPage/WebFrame.h >index 82bcb6d879dd24e9faa52fa3566b7d5b66a2fff1..f54b29c7211b873728309fe7a51b5305f57f4fd4 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebFrame.h >+++ b/Source/WebKit/WebProcess/WebPage/WebFrame.h >@@ -87,7 +87,7 @@ public: > enum class ForNavigationAction { No, Yes }; > uint64_t setUpPolicyListener(WebCore::FramePolicyFunction&&, ForNavigationAction); > void invalidatePolicyListener(); >- void didReceivePolicyDecision(uint64_t listenerID, WebPolicyAction, uint64_t navigationID, DownloadID, std::optional<WebsitePoliciesData>&&); >+ void didReceivePolicyDecision(uint64_t listenerID, WebPolicyAction, uint64_t navigationID, DownloadID, WTF::Optional<WebsitePoliciesData>&&); > > uint64_t setUpWillSubmitFormListener(CompletionHandler<void()>&&); > void continueWillSubmitForm(uint64_t); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 838825253cdbae907dabd962ff11202a344040b1..a9a73fd34c8b7d5275a025ab4335aaf20b49df3d 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -538,7 +538,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > if (parameters.scrollbarOverlayStyle) > m_scrollbarOverlayStyle = static_cast<ScrollbarOverlayStyle>(parameters.scrollbarOverlayStyle.value()); > else >- m_scrollbarOverlayStyle = std::optional<ScrollbarOverlayStyle>(); >+ m_scrollbarOverlayStyle = WTF::Optional<ScrollbarOverlayStyle>(); > > setTopContentInset(parameters.topContentInset); > >@@ -1379,7 +1379,7 @@ void WebPage::loadRequest(LoadParameters&& loadParameters) > ASSERT(!m_pendingWebsitePolicies); > } > >-void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&& websitePolicies, Ref<SharedBuffer>&& sharedBuffer, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& unreachableURL, const UserData& userData) >+void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&& websitePolicies, Ref<SharedBuffer>&& sharedBuffer, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& unreachableURL, const UserData& userData) > { > SendStopResponsivenessTimer stopper; > >@@ -1481,7 +1481,7 @@ void WebPage::reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExten > } > } > >-void WebPage::goToBackForwardItem(uint64_t navigationID, const BackForwardItemIdentifier& backForwardItemID, FrameLoadType backForwardType, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&& websitePolicies) >+void WebPage::goToBackForwardItem(uint64_t navigationID, const BackForwardItemIdentifier& backForwardItemID, FrameLoadType backForwardType, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&& websitePolicies) > { > SendStopResponsivenessTimer stopper; > >@@ -3029,7 +3029,7 @@ void WebPage::setSessionID(PAL::SessionID sessionID) > m_page->setSessionID(sessionID); > } > >-void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebPolicyAction policyAction, uint64_t navigationID, const DownloadID& downloadID, std::optional<WebsitePoliciesData>&& websitePolicies) >+void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebPolicyAction policyAction, uint64_t navigationID, const DownloadID& downloadID, WTF::Optional<WebsitePoliciesData>&& websitePolicies) > { > WebFrame* frame = WebProcess::singleton().webFrame(frameID); > if (!frame) >@@ -3174,7 +3174,7 @@ KeyboardUIMode WebPage::keyboardUIMode() > return static_cast<KeyboardUIMode>((fullKeyboardAccessEnabled ? KeyboardAccessFull : KeyboardAccessDefault) | (m_tabToLinks ? KeyboardAccessTabsToLinks : 0)); > } > >-void WebPage::runJavaScript(const String& script, bool forceUserGesture, std::optional<String> worldName, CallbackID callbackID) >+void WebPage::runJavaScript(const String& script, bool forceUserGesture, WTF::Optional<String> worldName, CallbackID callbackID) > { > // NOTE: We need to be careful when running scripts that the objects we depend on don't > // disappear during script execution. >@@ -3200,7 +3200,7 @@ void WebPage::runJavaScript(const String& script, bool forceUserGesture, std::op > > void WebPage::runJavaScriptInMainFrame(const String& script, bool forceUserGesture, CallbackID callbackID) > { >- runJavaScript(script, forceUserGesture, std::nullopt, callbackID); >+ runJavaScript(script, forceUserGesture, WTF::nullopt, callbackID); > } > > void WebPage::runJavaScriptInMainFrameScriptWorld(const String& script, bool forceUserGesture, const String& worldName, CallbackID callbackID) >@@ -3498,7 +3498,7 @@ void WebPage::willCommitLayerTree(RemoteLayerTreeTransaction& layerTransaction) > layerTransaction.setAllowsUserScaling(allowsUserScaling()); > if (m_pendingDynamicViewportSizeUpdateID) { > layerTransaction.setDynamicViewportSizeUpdateID(*m_pendingDynamicViewportSizeUpdateID); >- m_pendingDynamicViewportSizeUpdateID = std::nullopt; >+ m_pendingDynamicViewportSizeUpdateID = WTF::nullopt; > } > if (m_lastTransactionPageScaleFactor != layerTransaction.pageScaleFactor()) { > m_lastTransactionPageScaleFactor = layerTransaction.pageScaleFactor(); >@@ -5410,7 +5410,7 @@ void WebPage::setAutoSizingShouldExpandToViewHeight(bool shouldExpand) > corePage()->mainFrame().view()->setAutoSizeFixedMinimumHeight(shouldExpand ? m_viewSize.height() : 0); > } > >-void WebPage::setViewportSizeForCSSViewportUnits(std::optional<WebCore::IntSize> viewportSize) >+void WebPage::setViewportSizeForCSSViewportUnits(WTF::Optional<WebCore::IntSize> viewportSize) > { > if (m_viewportSizeForCSSViewportUnits == viewportSize) > return; >@@ -5968,12 +5968,12 @@ void WebPage::setScrollPinningBehavior(uint32_t pinning) > m_page->mainFrame().view()->setScrollPinningBehavior(m_scrollPinningBehavior); > } > >-void WebPage::setScrollbarOverlayStyle(std::optional<uint32_t> scrollbarStyle) >+void WebPage::setScrollbarOverlayStyle(WTF::Optional<uint32_t> scrollbarStyle) > { > if (scrollbarStyle) > m_scrollbarOverlayStyle = static_cast<ScrollbarOverlayStyle>(scrollbarStyle.value()); > else >- m_scrollbarOverlayStyle = std::optional<ScrollbarOverlayStyle>(); >+ m_scrollbarOverlayStyle = WTF::Optional<ScrollbarOverlayStyle>(); > m_page->mainFrame().view()->recalculateScrollbarOverlayStyle(); > } > >@@ -5989,7 +5989,7 @@ Ref<DocumentLoader> WebPage::createDocumentLoader(Frame& frame, const ResourceRe > > if (m_pendingWebsitePolicies) { > WebsitePoliciesData::applyToDocumentLoader(WTFMove(*m_pendingWebsitePolicies), documentLoader); >- m_pendingWebsitePolicies = std::nullopt; >+ m_pendingWebsitePolicies = WTF::nullopt; > } > } > >@@ -6376,14 +6376,14 @@ void WebPage::didCompleteShareSheet(bool wasGranted, ShareSheetCallbackID callba > > #if ENABLE(ATTACHMENT_ELEMENT) > >-void WebPage::insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID callbackID) >+void WebPage::insertAttachment(const String& identifier, WTF::Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID callbackID) > { > auto& frame = m_page->focusController().focusedOrMainFrame(); > frame.editor().insertAttachment(identifier, WTFMove(fileSize), fileName, contentType); > send(Messages::WebPageProxy::VoidCallback(callbackID)); > } > >-void WebPage::updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID callbackID) >+void WebPage::updateAttachmentAttributes(const String& identifier, WTF::Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID callbackID) > { > if (auto attachment = attachmentElementWithIdentifier(identifier)) { > attachment->document().updateLayout(); >@@ -6413,20 +6413,20 @@ void WebPage::getApplicationManifest(CallbackID callbackID) > DocumentLoader* loader = mainFrameDocument ? mainFrameDocument->loader() : nullptr; > > if (!loader) { >- send(Messages::WebPageProxy::ApplicationManifestCallback(std::nullopt, callbackID)); >+ send(Messages::WebPageProxy::ApplicationManifestCallback(WTF::nullopt, callbackID)); > return; > } > > auto coreCallbackID = loader->loadApplicationManifest(); > if (!coreCallbackID) { >- send(Messages::WebPageProxy::ApplicationManifestCallback(std::nullopt, callbackID)); >+ send(Messages::WebPageProxy::ApplicationManifestCallback(WTF::nullopt, callbackID)); > return; > } > > m_applicationManifestFetchCallbackMap.add(coreCallbackID, callbackID.toInteger()); > } > >-void WebPage::didFinishLoadingApplicationManifest(uint64_t coreCallbackID, const std::optional<WebCore::ApplicationManifest>& manifest) >+void WebPage::didFinishLoadingApplicationManifest(uint64_t coreCallbackID, const WTF::Optional<WebCore::ApplicationManifest>& manifest) > { > auto callbackID = CallbackID::fromInteger(m_applicationManifestFetchCallbackMap.take(coreCallbackID)); > send(Messages::WebPageProxy::ApplicationManifestCallback(manifest, callbackID)); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 4770868074548087b73c36c658b0edfb4e0a6b24..efacf6e3927da66baa65bb87ce93fb7789e90088 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -921,9 +921,9 @@ public: > void setViewportConfigurationViewLayoutSize(const WebCore::FloatSize&, double scaleFactor, double minimumEffectiveDeviceWidth); > void setMaximumUnobscuredSize(const WebCore::FloatSize&); > void setDeviceOrientation(int32_t); >- void setOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>&); >+ void setOverrideViewportArguments(const WTF::Optional<WebCore::ViewportArguments>&); > void dynamicViewportSizeUpdate(const WebCore::FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, DynamicViewportSizeUpdateID); >- std::optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const; >+ WTF::Optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const; > void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, MonotonicTime oldestTimestamp); > bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; } > void willStartUserTriggeredZooming(); >@@ -990,8 +990,8 @@ public: > void setAutoSizingShouldExpandToViewHeight(bool shouldExpand); > bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; } > >- void setViewportSizeForCSSViewportUnits(std::optional<WebCore::IntSize>); >- std::optional<WebCore::IntSize> viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits; } >+ void setViewportSizeForCSSViewportUnits(WTF::Optional<WebCore::IntSize>); >+ WTF::Optional<WebCore::IntSize> viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits; } > > bool canShowMIMEType(const String& MIMEType) const; > bool canShowResponse(const WebCore::ResourceResponse&) const; >@@ -1022,8 +1022,8 @@ public: > WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; } > void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning); > >- std::optional<WebCore::ScrollbarOverlayStyle> scrollbarOverlayStyle() { return m_scrollbarOverlayStyle; } >- void setScrollbarOverlayStyle(std::optional<uint32_t /* WebCore::ScrollbarOverlayStyle */> scrollbarStyle); >+ WTF::Optional<WebCore::ScrollbarOverlayStyle> scrollbarOverlayStyle() { return m_scrollbarOverlayStyle; } >+ void setScrollbarOverlayStyle(WTF::Optional<uint32_t /* WebCore::ScrollbarOverlayStyle */> scrollbarStyle); > > Ref<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&); > void updateCachedDocumentLoader(WebDocumentLoader&, WebCore::Frame&); >@@ -1096,7 +1096,7 @@ public: > WebURLSchemeHandlerProxy* urlSchemeHandlerForScheme(const String&); > void stopAllURLSchemeTasks(); > >- std::optional<double> cpuLimit() const { return m_cpuLimit; } >+ WTF::Optional<double> cpuLimit() const { return m_cpuLimit; } > > static PluginView* pluginViewForFrame(WebCore::Frame*); > >@@ -1113,13 +1113,13 @@ public: > void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId); > > #if ENABLE(ATTACHMENT_ELEMENT) >- void insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID); >- void updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID); >+ void insertAttachment(const String& identifier, WTF::Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID); >+ void updateAttachmentAttributes(const String& identifier, WTF::Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID); > #endif > > #if ENABLE(APPLICATION_MANIFEST) > void getApplicationManifest(CallbackID); >- void didFinishLoadingApplicationManifest(uint64_t, const std::optional<WebCore::ApplicationManifest>&); >+ void didFinishLoadingApplicationManifest(uint64_t, const WTF::Optional<WebCore::ApplicationManifest>&); > #endif > > void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers); >@@ -1196,7 +1196,7 @@ private: > > String sourceForFrame(WebFrame*); > >- void loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&&, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&); >+ void loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&&, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&); > > // Actions > void tryClose(); >@@ -1206,7 +1206,7 @@ private: > void loadAlternateHTML(LoadParameters&&); > void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint); > void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&); >- void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, std::optional<WebsitePoliciesData>&&); >+ void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, WTF::Optional<WebsitePoliciesData>&&); > void tryRestoreScrollPosition(); > void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID); > void updateIsInWindow(bool isInitialState = false); >@@ -1278,7 +1278,7 @@ private: > void getSelectionAsWebArchiveData(CallbackID); > void getSourceForFrame(uint64_t frameID, CallbackID); > void getWebArchiveOfFrame(uint64_t frameID, CallbackID); >- void runJavaScript(const String&, bool forceUserGesture, std::optional<String> worldName, CallbackID); >+ void runJavaScript(const String&, bool forceUserGesture, WTF::Optional<String> worldName, CallbackID); > void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID); > void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID); > void forceRepaint(CallbackID); >@@ -1294,7 +1294,7 @@ private: > bool parentProcessHasServiceWorkerEntitlement() const { return true; } > #endif > >- void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebPolicyAction, uint64_t navigationID, const DownloadID&, std::optional<WebsitePoliciesData>&&); >+ void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebPolicyAction, uint64_t navigationID, const DownloadID&, WTF::Optional<WebsitePoliciesData>&&); > void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID); > void setUserAgent(const String&); > void setCustomTextEncodingName(const String&); >@@ -1667,7 +1667,7 @@ private: > > WebCore::IntSize m_viewLayoutSize; > bool m_autoSizingShouldExpandToViewHeight { false }; >- std::optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits; >+ WTF::Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits; > > bool m_userIsInteracting { false }; > bool m_isAssistingNodeDueToUserInteraction { false }; >@@ -1723,7 +1723,7 @@ private: > WebCore::FloatPoint m_pendingSyntheticClickLocation; > WebCore::FloatRect m_previousExposedContentRect; > uint64_t m_currentAssistedNodeIdentifier { 0 }; >- std::optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID; >+ WTF::Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID; > double m_lastTransactionPageScaleFactor { 0 }; > uint64_t m_lastTransactionIDWithScaleChange { 0 }; > #endif >@@ -1739,7 +1739,7 @@ private: > unsigned m_maximumRenderingSuppressionToken { 0 }; > > WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin }; >- std::optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle; >+ WTF::Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle; > > bool m_useAsyncScrolling { false }; > >@@ -1750,7 +1750,7 @@ private: > PAL::HysteresisActivity m_userActivityHysteresis; > > uint64_t m_pendingNavigationID { 0 }; >- std::optional<WebsitePoliciesData> m_pendingWebsitePolicies; >+ WTF::Optional<WebsitePoliciesData> m_pendingWebsitePolicies; > > bool m_mainFrameProgressCompleted { false }; > bool m_shouldDispatchFakeMouseMoveEvents { true }; >@@ -1775,7 +1775,7 @@ private: > WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR }; > > const String m_overrideContentSecurityPolicy; >- const std::optional<double> m_cpuLimit; >+ const WTF::Optional<double> m_cpuLimit; > > HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap; > HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 529aa78280b92fb8b61f59710b4761d8253933af..04f8956dfe25360c2e2a295968c9a3562151f0e1 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -48,7 +48,7 @@ messages -> WebPage LegacyReceiver { > SetViewportConfigurationViewLayoutSize(WebCore::FloatSize size, double scaleFactor, double minimumEffectiveDeviceWidth) > SetMaximumUnobscuredSize(WebCore::FloatSize size) > SetDeviceOrientation(int32_t deviceOrientation) >- SetOverrideViewportArguments(std::optional<WebCore::ViewportArguments> arguments) >+ SetOverrideViewportArguments(WTF::Optional<WebCore::ViewportArguments> arguments) > DynamicViewportSizeUpdate(WebCore::FloatSize viewLayoutSize, WebCore::FloatSize maximumUnobscuredSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, WebCore::FloatRect targetUnobscuredRectInScrollViewCoordinates, WebCore::RectEdges<float> targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, uint64_t dynamicViewportSizeUpdateID) > > HandleTap(WebCore::IntPoint point, uint64_t lastLayerTreeTransactionId) >@@ -145,7 +145,7 @@ messages -> WebPage LegacyReceiver { > ScrollBy(uint32_t scrollDirection, uint32_t scrollGranularity) > CenterSelectionInVisibleArea() > >- GoToBackForwardItem(uint64_t navigationID, struct WebCore::BackForwardItemIdentifier backForwardItemID, enum:uint8_t WebCore::FrameLoadType backForwardType, enum:bool WebCore::ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, std::optional<WebKit::WebsitePoliciesData> websitePolicies) >+ GoToBackForwardItem(uint64_t navigationID, struct WebCore::BackForwardItemIdentifier backForwardItemID, enum:uint8_t WebCore::FrameLoadType backForwardType, enum:bool WebCore::ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, WTF::Optional<WebKit::WebsitePoliciesData> websitePolicies) > TryRestoreScrollPosition() > > LoadURLInFrame(URL url, uint64_t frameID) >@@ -167,7 +167,7 @@ messages -> WebPage LegacyReceiver { > DidRemoveBackForwardItem(struct WebCore::BackForwardItemIdentifier backForwardItemID) > > UpdateWebsitePolicies(struct WebKit::WebsitePoliciesData websitePolicies) >- DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, enum:uint8_t WebKit::WebPolicyAction policyAction, uint64_t navigationID, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePoliciesData> websitePolicies) >+ DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, enum:uint8_t WebKit::WebPolicyAction policyAction, uint64_t navigationID, WebKit::DownloadID downloadID, WTF::Optional<WebKit::WebsitePoliciesData> websitePolicies) > ContinueWillSubmitForm(uint64_t frameID, uint64_t listenerID) > > ClearSelection() >@@ -439,7 +439,7 @@ messages -> WebPage LegacyReceiver { > SetViewLayoutSize(WebCore::IntSize viewLayoutSize) > SetAutoSizingShouldExpandToViewHeight(bool shouldExpand) > >- SetViewportSizeForCSSViewportUnits(std::optional<WebCore::IntSize> viewportSize) >+ SetViewportSizeForCSSViewportUnits(WTF::Optional<WebCore::IntSize> viewportSize) > > #if PLATFORM(COCOA) > HandleAlternativeTextUIResult(String result) >@@ -450,7 +450,7 @@ messages -> WebPage LegacyReceiver { > #endif > > SetScrollPinningBehavior(uint32_t pinning) >- SetScrollbarOverlayStyle(std::optional<uint32_t> scrollbarStyle) >+ SetScrollbarOverlayStyle(WTF::Optional<uint32_t> scrollbarStyle) > > GetBytecodeProfile(WebKit::CallbackID callbackID) > >@@ -532,8 +532,8 @@ messages -> WebPage LegacyReceiver { > #endif > > #if ENABLE(ATTACHMENT_ELEMENT) >- InsertAttachment(String identifier, std::optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID) >- UpdateAttachmentAttributes(String identifier, std::optional<uint64_t> fileSize, String contentType, String fileName, IPC::SharedBufferDataReference enclosingImageData, WebKit::CallbackID callbackID) >+ InsertAttachment(String identifier, WTF::Optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID) >+ UpdateAttachmentAttributes(String identifier, WTF::Optional<uint64_t> fileSize, String contentType, String fileName, IPC::SharedBufferDataReference enclosingImageData, WebKit::CallbackID callbackID) > #endif > > #if ENABLE(APPLICATION_MANIFEST) >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 9df618a4d9ad8e9b1d63206c60051dafb76db235..45e9211a7f28d9622e347eedd224d931b3c72145 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -341,7 +341,7 @@ void WebPage::restorePageState(const HistoryItem& historyItem) > float boundedScale = std::min<float>(m_viewportConfiguration.maximumScale(), std::max<float>(m_viewportConfiguration.minimumScale(), historyItem.pageScaleFactor())); > scalePage(boundedScale, IntPoint()); > >- std::optional<FloatPoint> scrollPosition; >+ WTF::Optional<FloatPoint> scrollPosition; > if (historyItem.shouldRestoreScrollPosition()) { > m_drawingArea->setExposedContentRect(historyItem.exposedContentRect()); > scrollPosition = FloatPoint(historyItem.scrollPosition()); >@@ -354,7 +354,7 @@ void WebPage::restorePageState(const HistoryItem& historyItem) > > double newScale = scaleAfterViewportWidthChange(historyItem.pageScaleFactor(), !historyItem.scaleIsInitial(), m_viewportConfiguration, currentMinimumLayoutSizeInScrollViewCoordinates.width(), newContentSize, oldContentSize, visibleHorizontalFraction); > >- std::optional<FloatPoint> newCenter; >+ WTF::Optional<FloatPoint> newCenter; > if (historyItem.shouldRestoreScrollPosition()) { > if (!oldContentSize.isEmpty() && !newContentSize.isEmpty() && newContentSize != oldContentSize) > newCenter = relativeCenterAfterContentSizeChange(historyItem.unobscuredContentRect(), oldContentSize, newContentSize); >@@ -674,7 +674,7 @@ void WebPage::requestAdditionalItemsForDragSession(const IntPoint& clientPositio > > void WebPage::didConcludeEditDataInteraction() > { >- std::optional<TextIndicatorData> textIndicatorData; >+ WTF::Optional<TextIndicatorData> textIndicatorData; > > static auto defaultEditDataInteractionTextIndicatorOptions = TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection | TextIndicatorOptionExpandClipBeyondVisibleRect | TextIndicatorOptionPaintAllContent | TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | TextIndicatorOptionPaintBackgrounds | TextIndicatorOptionComputeEstimatedBackgroundColor| TextIndicatorOptionUseSelectionRectForSizing | TextIndicatorOptionIncludeSnapshotWithSelectionHighlight; > auto& frame = m_page->focusController().focusedOrMainFrame(); >@@ -2590,7 +2590,7 @@ void WebPage::setDeviceOrientation(int32_t deviceOrientation) > m_page->mainFrame().orientationChanged(); > } > >-void WebPage::setOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>& arguments) >+void WebPage::setOverrideViewportArguments(const WTF::Optional<WebCore::ViewportArguments>& arguments) > { > if (auto* document = m_page->mainFrame().document()) > document->setOverrideViewportArguments(arguments); >@@ -2925,11 +2925,11 @@ static inline void adjustVelocityDataForBoundedScale(double& horizontalVelocity, > scaleChangeRate = 0; > } > >-std::optional<float> WebPage::scaleFromUIProcess(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo) const >+WTF::Optional<float> WebPage::scaleFromUIProcess(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo) const > { > auto transactionIDForLastScaleFromUIProcess = visibleContentRectUpdateInfo.lastLayerTreeTransactionID(); > if (m_lastTransactionIDWithScaleChange > transactionIDForLastScaleFromUIProcess) >- return std::nullopt; >+ return WTF::nullopt; > > float scaleFromUIProcess = visibleContentRectUpdateInfo.scale(); > float currentScale = m_page->pageScaleFactor(); >@@ -2943,7 +2943,7 @@ std::optional<float> WebPage::scaleFromUIProcess(const VisibleContentRectUpdateI > > scaleFromUIProcess = std::min<float>(m_viewportConfiguration.maximumScale(), std::max<float>(m_viewportConfiguration.minimumScale(), scaleFromUIProcess)); > if (areEssentiallyEqualAsFloat(currentScale, scaleFromUIProcess)) >- return std::nullopt; >+ return WTF::nullopt; > > return scaleFromUIProcess; > } >@@ -3041,7 +3041,7 @@ void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visi > if (visibleContentRectUpdateInfo.unobscuredContentRect() != visibleContentRectUpdateInfo.unobscuredContentRectRespectingInputViewBounds()) > frameView.setVisualViewportOverrideRect(LayoutRect(visibleContentRectUpdateInfo.unobscuredContentRectRespectingInputViewBounds())); > else >- frameView.setVisualViewportOverrideRect(std::nullopt); >+ frameView.setVisualViewportOverrideRect(WTF::nullopt); > > LOG_WITH_STREAM(VisibleRects, stream << "WebPage::updateVisibleContentRects - setLayoutViewportOverrideRect " << visibleContentRectUpdateInfo.customFixedPositionRect()); > frameView.setLayoutViewportOverrideRect(LayoutRect(visibleContentRectUpdateInfo.customFixedPositionRect())); >diff --git a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h >index b1ed5c1fc81d333814bb003dae62692f2c64a51f..31a88e896d0ea2242cb55de5d747bb8d14497e6f 100644 >--- a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h >@@ -72,8 +72,8 @@ private: > void updatePreferences(const WebPreferencesStore&) override; > void mainFrameContentSizeChanged(const WebCore::IntSize&) override; > >- void setViewExposedRect(std::optional<WebCore::FloatRect>) override; >- std::optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; } >+ void setViewExposedRect(WTF::Optional<WebCore::FloatRect>) override; >+ WTF::Optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; } > > bool supportsAsyncScrolling() override { return true; } > >@@ -148,8 +148,8 @@ private: > > bool m_isPaintingSuspended; > >- std::optional<WebCore::FloatRect> m_viewExposedRect; >- std::optional<WebCore::FloatRect> m_scrolledViewExposedRect; >+ WTF::Optional<WebCore::FloatRect> m_viewExposedRect; >+ WTF::Optional<WebCore::FloatRect> m_scrolledViewExposedRect; > > WebCore::IntSize m_lastSentIntrinsicContentSize; > bool m_inUpdateGeometry; >diff --git a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >index 358f96781ed70bdd67c0935f3892d70c286ead15..bab46b286003d218334c8c117bb88091109febf8 100644 >--- a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >+++ b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >@@ -558,7 +558,7 @@ void TiledCoreAnimationDrawingArea::resumePainting() > [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidResumeNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:m_hostingLayer.get() forKey:@"layer"]]; > } > >-void TiledCoreAnimationDrawingArea::setViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect) >+void TiledCoreAnimationDrawingArea::setViewExposedRect(WTF::Optional<WebCore::FloatRect> viewExposedRect) > { > m_viewExposedRect = viewExposedRect; > updateScrolledExposedRect(); >diff --git a/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.cpp b/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.cpp >index 510be22da312fb4c52206e6aad30d32fa9de87ec..9fb0104dee70616545846a2f21ae167cf682e5ba 100644 >--- a/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.cpp >+++ b/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.cpp >@@ -48,7 +48,7 @@ void CompositingManager::establishConnection(WebPage& webPage) > int CompositingManager::releaseConnectionFd() > { > int fd = m_connectionFd.value_or(-1); >- m_connectionFd = std::nullopt; >+ m_connectionFd = WTF::nullopt; > return fd; > } > >diff --git a/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.h b/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.h >index bd2f2f614392e981b7abae139ed260efaca9835c..d97eb418326ae835740fd95ed5403c7edadc76c3 100644 >--- a/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.h >+++ b/Source/WebKit/WebProcess/WebPage/wpe/CompositingManager.h >@@ -42,7 +42,7 @@ public: > int releaseConnectionFd(); > > private: >- std::optional<int> m_connectionFd; >+ WTF::Optional<int> m_connectionFd; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/WebProcess.h b/Source/WebKit/WebProcess/WebProcess.h >index 9172ee1c7a631127e392102a9b523cc7f3e692ae..46d3fdf65c787d8e6f4a4da82b47dbced93cb94e 100644 >--- a/Source/WebKit/WebProcess/WebProcess.h >+++ b/Source/WebKit/WebProcess/WebProcess.h >@@ -465,7 +465,7 @@ private: > bool m_suppressMemoryPressureHandler { false }; > #if PLATFORM(MAC) > std::unique_ptr<WebCore::CPUMonitor> m_cpuMonitor; >- std::optional<double> m_cpuLimit; >+ WTF::Optional<double> m_cpuLimit; > > enum class ProcessType { Inspector, ServiceWorker, PrewarmedWebContent, WebContent }; > ProcessType m_processType { ProcessType::WebContent }; >diff --git a/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp b/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >index 5e5e159fd43ea9a779239d8bd98b407f12bf2c97..1311cc3aee41138a3d55af961ab5501c2a528578 100644 >--- a/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >+++ b/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >@@ -190,7 +190,7 @@ private: > > uint64_t m_id; > UserMediaCaptureManager& m_manager; >- mutable std::optional<RealtimeMediaSourceCapabilities> m_capabilities; >+ mutable WTF::Optional<RealtimeMediaSourceCapabilities> m_capabilities; > RealtimeMediaSourceSettings m_settings; > > CAAudioStreamDescription m_description; >diff --git a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >index 2f2496bf4ab188ce0f8033a27ae8fbfce279f380..a40b8cfb896078e7b18831e9572738cd9aae27f9 100644 >--- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >+++ b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >@@ -521,13 +521,13 @@ void WebProcess::getActivePagesOriginsForTesting(CompletionHandler<void(Vector<S > void WebProcess::updateCPULimit() > { > #if PLATFORM(MAC) >- std::optional<double> cpuLimit; >+ WTF::Optional<double> cpuLimit; > > // Use the largest limit among all pages in this process. > for (auto& page : m_pageMap.values()) { > auto pageCPULimit = page->cpuLimit(); > if (!pageCPULimit) { >- cpuLimit = std::nullopt; >+ cpuLimit = WTF::nullopt; > break; > } > if (!cpuLimit || pageCPULimit > cpuLimit.value()) >@@ -547,7 +547,7 @@ void WebProcess::updateCPUMonitorState(CPUMonitorUpdateReason reason) > #if PLATFORM(MAC) > if (!m_cpuLimit) { > if (m_cpuMonitor) >- m_cpuMonitor->setCPULimit(std::nullopt); >+ m_cpuMonitor->setCPULimit(WTF::nullopt); > return; > } > >@@ -559,7 +559,7 @@ void WebProcess::updateCPUMonitorState(CPUMonitorUpdateReason reason) > } else if (reason == CPUMonitorUpdateReason::VisibilityHasChanged) { > // If the visibility has changed, stop the CPU monitor before setting its limit. This is needed because the CPU usage can vary wildly based on visibility and we would > // not want to report that a process has exceeded its background CPU limit even though most of the CPU time was used while the process was visible. >- m_cpuMonitor->setCPULimit(std::nullopt); >+ m_cpuMonitor->setCPULimit(WTF::nullopt); > } > m_cpuMonitor->setCPULimit(m_cpuLimit.value()); > #else >diff --git a/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm b/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm >index 3912101561f5ffdf8941e9a71bfbe4b828f84b15..cce8f3c1235c5d330756c1b36c4cbebf46bef46d 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm >@@ -90,7 +90,7 @@ - (void)add:(DOMHTMLOptionElement *)option index:(unsigned)index > WebCore::JSMainThreadNullState state; > if (!option) > raiseTypeErrorException(); >- raiseOnDOMError(IMPL->add(core(option), std::optional<WebCore::HTMLOptionsCollection::HTMLElementOrInt> { static_cast<int>(index) })); >+ raiseOnDOMError(IMPL->add(core(option), WTF::Optional<WebCore::HTMLOptionsCollection::HTMLElementOrInt> { static_cast<int>(index) })); > } > > - (void)remove:(unsigned)index >diff --git a/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm >index 883b9207207e248dd47a30bc0c7621e7068b7c32..319f9ec6735e8da99033a1ea7ec6a926cae34cd2 100644 >--- a/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm >+++ b/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm >@@ -886,7 +886,7 @@ bool NetscapePluginInstanceProxy::evaluate(uint32_t objectID, const String& scri > Strong<JSGlobalObject> globalObject(vm, frame->script().globalObject(pluginWorld())); > ExecState* exec = globalObject->globalExec(); > >- UserGestureIndicator gestureIndicator(allowPopups ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt); >+ UserGestureIndicator gestureIndicator(allowPopups ? WTF::Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); > > JSValue result = JSC::evaluate(exec, JSC::makeSource(script, { })); > >diff --git a/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm b/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm >index 9a745d9383f7447f542df5045e2445b3853e0880..ba074cfb45c9017f2a9fdc9b7dc0ea13614ad105 100644 >--- a/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm >+++ b/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm >@@ -669,7 +669,7 @@ - (BOOL)sendEvent:(void*)event isDrawRect:(BOOL)eventIsDrawRect > ASSERT(_eventHandler); > { > JSC::JSLock::DropAllLocks dropAllLocks(commonVM()); >- UserGestureIndicator gestureIndicator(_eventHandler->currentEventIsUserGesture() ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt); >+ UserGestureIndicator gestureIndicator(_eventHandler->currentEventIsUserGesture() ? WTF::Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); > acceptedEvent = [_pluginPackage.get() pluginFuncs]->event(plugin, event); > } > [self didCallPlugInFunction]; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h >index 99910382b4fea44bb8584fafab9fbeccedf6d712..fd9ff99a5b24b400308ec371cae4336df8343244 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h >@@ -63,8 +63,8 @@ private: > void frameLoaderDestroyed() final; > bool hasWebView() const final; // mainly for assertions > >- std::optional<uint64_t> pageID() const final; >- std::optional<uint64_t> frameID() const final; >+ WTF::Optional<uint64_t> pageID() const final; >+ WTF::Optional<uint64_t> frameID() const final; > PAL::SessionID sessionID() const final; > > void makeRepresentation(WebCore::DocumentLoader*) final; >@@ -116,7 +116,7 @@ private: > void dispatchWillClose() final; > void dispatchDidStartProvisionalLoad(CompletionHandler<void()>&&) final; > void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) final; >- void dispatchDidCommitLoad(std::optional<WebCore::HasInsecureContent>) final; >+ void dispatchDidCommitLoad(WTF::Optional<WebCore::HasInsecureContent>) final; > void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) final; > void dispatchDidFailLoad(const WebCore::ResourceError&) final; > void dispatchDidFinishDocumentLoad() final; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm >index ec8e58cf207bbcb04822ed2b15dead06762a567d..131d885e5aed246c9b65a0d73e3523c0aabc27c9 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm >@@ -204,14 +204,14 @@ WebFrameLoaderClient::WebFrameLoaderClient(WebFrame *webFrame) > { > } > >-std::optional<uint64_t> WebFrameLoaderClient::pageID() const >+WTF::Optional<uint64_t> WebFrameLoaderClient::pageID() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<uint64_t> WebFrameLoaderClient::frameID() const >+WTF::Optional<uint64_t> WebFrameLoaderClient::frameID() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > > PAL::SessionID WebFrameLoaderClient::sessionID() const >@@ -700,7 +700,7 @@ void WebFrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& ti > } > } > >-void WebFrameLoaderClient::dispatchDidCommitLoad(std::optional<HasInsecureContent>) >+void WebFrameLoaderClient::dispatchDidCommitLoad(WTF::Optional<HasInsecureContent>) > { > // Tell the client we've committed this URL. > ASSERT([m_webFrame->_private->webFrameView documentView] != nil); >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.h >index 72a350e93288a16e308295beaf7c2bcea7060d58..f703df139416e7ade82bbf1865f10132db9b3609 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.h >@@ -47,7 +47,7 @@ public: > void setEnableHighAccuracy(bool) override { } > #endif > >- std::optional<WebCore::GeolocationPosition> lastPosition() override; >+ WTF::Optional<WebCore::GeolocationPosition> lastPosition() override; > > void requestPermission(WebCore::Geolocation&) override; > void cancelPermissionRequest(WebCore::Geolocation&) override { }; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm >index d1051f2d4d18762e675129c030c3d5ec92baecf6..5f7a7ccb1094346904781fe057fd54826822559f 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm >@@ -132,7 +132,7 @@ void WebGeolocationClient::requestPermission(Geolocation& geolocation) > END_BLOCK_OBJC_EXCEPTIONS; > } > >-std::optional<GeolocationPosition> WebGeolocationClient::lastPosition() >+WTF::Optional<GeolocationPosition> WebGeolocationClient::lastPosition() > { > return core([[m_webView _geolocationProvider] lastPosition]); > } >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h >index 077d014d3e535c7a8abb3468e1d654e9fe9be275..0c88e3d740afa140abb47c09a48589fa52e745e1 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h >@@ -37,16 +37,16 @@ private: > ~WebPaymentCoordinatorClient(); > > bool supportsVersion(unsigned) override; >- std::optional<String> validatedPaymentNetwork(const String&) override; >+ WTF::Optional<String> validatedPaymentNetwork(const String&) override; > bool canMakePayments() override; > void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void (bool)>&& completionHandler) override; > void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override; > bool showPaymentUI(const URL&, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override; > void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override; >- void completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&) override; >- void completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&) override; >- void completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&&) override; >- void completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&) override; >+ void completeShippingMethodSelection(WTF::Optional<WebCore::ShippingMethodUpdate>&&) override; >+ void completeShippingContactSelection(WTF::Optional<WebCore::ShippingContactUpdate>&&) override; >+ void completePaymentMethodSelection(WTF::Optional<WebCore::PaymentMethodUpdate>&&) override; >+ void completePaymentSession(WTF::Optional<WebCore::PaymentAuthorizationResult>&&) override; > void abortPaymentSession() override; > void cancelPaymentSession() override; > void paymentCoordinatorDestroyed() override; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm >index 30e06caf931ae066c369b735113d9c48a7bdc0d4..403d0a1486fbfca1b3eb0e41e5fcf2e629eb5b30 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm >@@ -43,9 +43,9 @@ bool WebPaymentCoordinatorClient::supportsVersion(unsigned) > return false; > } > >-std::optional<String> WebPaymentCoordinatorClient::validatedPaymentNetwork(const String&) >+WTF::Optional<String> WebPaymentCoordinatorClient::validatedPaymentNetwork(const String&) > { >- return std::nullopt; >+ return WTF::nullopt; > } > > bool WebPaymentCoordinatorClient::canMakePayments() >@@ -76,19 +76,19 @@ void WebPaymentCoordinatorClient::completeMerchantValidation(const WebCore::Paym > { > } > >-void WebPaymentCoordinatorClient::completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&) >+void WebPaymentCoordinatorClient::completeShippingMethodSelection(WTF::Optional<WebCore::ShippingMethodUpdate>&&) > { > } > >-void WebPaymentCoordinatorClient::completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&) >+void WebPaymentCoordinatorClient::completeShippingContactSelection(WTF::Optional<WebCore::ShippingContactUpdate>&&) > { > } > >-void WebPaymentCoordinatorClient::completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&&) >+void WebPaymentCoordinatorClient::completePaymentMethodSelection(WTF::Optional<WebCore::PaymentMethodUpdate>&&) > { > } > >-void WebPaymentCoordinatorClient::completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&) >+void WebPaymentCoordinatorClient::completePaymentSession(WTF::Optional<WebCore::PaymentAuthorizationResult>&&) > { > } > >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h >index 37e714389d704647b91ee0d6607bd78470df5e03..c73d719ceb1bcf97484b00820bd29b2b5250e407 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h >@@ -48,12 +48,12 @@ private: > WebCore::BlobRegistry* createBlobRegistry() override; > > // WebCore::CookiesStrategy >- std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String&) override; >+ std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String&) override; > bool cookiesEnabled(const WebCore::NetworkStorageSession&) override; >- std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override; >+ std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override; > void deleteCookie(const WebCore::NetworkStorageSession&, const URL&, const String&) override; > > // WebCore::PasteboardStrategy >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm >index 01925eee82ce4100fd42374937868fc1564bd448..ff38a4b9d7b0f0c790d9892c4eaf6edb6a782347 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm >@@ -72,12 +72,12 @@ BlobRegistry* WebPlatformStrategies::createBlobRegistry() > return new WebCore::BlobRegistryImpl; > } > >-std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > return session.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& cookieString) >+void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& cookieString) > { > session.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString); > } >@@ -87,18 +87,18 @@ bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session) > return session.cookiesEnabled(); > } > >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); > return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) >+bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) > { > return session.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, rawCookies); > } >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h >index 525ee2fcdeea16c5c6f9dfe8135ed7d1c5ebbd0f..4d3beb76271016e2e8d64bf2ed85e8a2526ac0c1 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h >@@ -34,7 +34,7 @@ public: > > private: > void refreshPlugins() override; >- Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginIdentifier>>&) final; >+ Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>>&) final; > Vector<WebCore::PluginInfo> webVisiblePluginInfo(WebCore::Page&, const URL&) final; > > WebPluginInfoProvider(); >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm >index b06da6f0f0c357b00ba87491cb17bfd2fa94e362..19b0c6d47381b2b6b85a05996950c63d2ba32f3a 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm >@@ -55,7 +55,7 @@ void WebPluginInfoProvider::refreshPlugins() > [[WebPluginDatabase sharedDatabaseIfExists] refresh]; > } > >-Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& page, std::optional<Vector<SupportedPluginIdentifier>>&) >+Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& page, WTF::Optional<Vector<SupportedPluginIdentifier>>&) > { > Vector<WebCore::PluginInfo> plugins; > >@@ -76,6 +76,6 @@ Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& pag > > Vector<WebCore::PluginInfo> WebPluginInfoProvider::webVisiblePluginInfo(WebCore::Page& page, const URL&) > { >- std::optional<Vector<SupportedPluginIdentifier>> supportedPluginIdentifiers; >+ WTF::Optional<Vector<SupportedPluginIdentifier>> supportedPluginIdentifiers; > return pluginInfo(page, supportedPluginIdentifiers); > } >diff --git a/Source/WebKitLegacy/mac/WebView/WebDeviceOrientation.mm b/Source/WebKitLegacy/mac/WebView/WebDeviceOrientation.mm >index 170c3523c7c15536c28e7b5f98a33a3699480f92..4dde8fd01620231a9896867eb95a2d5ba3cd3991 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebDeviceOrientation.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebDeviceOrientation.mm >@@ -60,10 +60,10 @@ DeviceOrientationData* core(WebDeviceOrientation* orientation) > return orientation ? orientation->m_internal->m_orientation.get() : 0; > } > >-static std::optional<double> convert(bool canProvide, double value) >+static WTF::Optional<double> convert(bool canProvide, double value) > { > if (!canProvide) >- return std::nullopt; >+ return WTF::nullopt; > return value; > } > >@@ -75,9 +75,9 @@ - (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvi > #if PLATFORM(IOS_FAMILY) > // We don't use this API, but make sure that it compiles with the new > // compass parameters. >- m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), std::nullopt, std::nullopt)]; >+ m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), WTF::nullopt, WTF::nullopt)]; > #else >- m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), std::nullopt)]; >+ m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(convert(canProvideAlpha, alpha), convert(canProvideBeta, beta), convert(canProvideGamma, gamma), WTF::nullopt)]; > #endif > return self; > } >diff --git a/Source/WebKitLegacy/mac/WebView/WebGeolocationPosition.mm b/Source/WebKitLegacy/mac/WebView/WebGeolocationPosition.mm >index 37459c6b85847c6135aa861b514a10d64a86a1b0..b43399b2d1f52c0e8b595237a424e31388dd97a2 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebGeolocationPosition.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebGeolocationPosition.mm >@@ -56,10 +56,10 @@ @end > > @implementation WebGeolocationPosition > >-std::optional<GeolocationPosition> core(WebGeolocationPosition *position) >+WTF::Optional<GeolocationPosition> core(WebGeolocationPosition *position) > { > if (!position) >- return std::nullopt; >+ return WTF::nullopt; > return position->_internal->_position; > } > >diff --git a/Source/WebKitLegacy/mac/WebView/WebGeolocationPositionInternal.h b/Source/WebKitLegacy/mac/WebView/WebGeolocationPositionInternal.h >index 26c32b126df24325fdce99b7b86a8c75982cd7f5..528cdb060f5cbec8c379ed17b1fff8c32183bfbb 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebGeolocationPositionInternal.h >+++ b/Source/WebKitLegacy/mac/WebView/WebGeolocationPositionInternal.h >@@ -30,5 +30,5 @@ namespace WebCore { > class GeolocationPosition; > } > >-std::optional<WebCore::GeolocationPosition> core(WebGeolocationPosition *); >+WTF::Optional<WebCore::GeolocationPosition> core(WebGeolocationPosition *); > >diff --git a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm b/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm >index 9c3c2bb99cc0c6cd3053798ddb6644c9e7db8142..c8d9d93f89f511eba46a4ffa5af6a8595cba6495 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm >@@ -231,7 +231,7 @@ - (void)setMenuController:(WebCore::ContextMenuController*)menuController; > - (void)forwardContextMenuAction:(id)sender; > @end > >-static std::optional<ContextMenuAction> toAction(NSInteger tag) >+static WTF::Optional<ContextMenuAction> toAction(NSInteger tag) > { > if (tag >= ContextMenuItemBaseCustomTag && tag <= ContextMenuItemLastCustomTag) { > // Just pass these through. >@@ -406,14 +406,14 @@ static std::optional<ContextMenuAction> toAction(NSInteger tag) > case WebMenuItemTagDictationAlternative: > return ContextMenuItemTagDictationAlternative; > } >- return std::nullopt; >+ return WTF::nullopt; > } > >-static std::optional<NSInteger> toTag(ContextMenuAction action) >+static WTF::Optional<NSInteger> toTag(ContextMenuAction action) > { > switch (action) { > case ContextMenuItemTagNoAction: >- return std::nullopt; >+ return WTF::nullopt; > > case ContextMenuItemTagOpenLinkInNewWindow: > return WebMenuItemTagOpenLinkInNewWindow; >@@ -596,7 +596,7 @@ static std::optional<NSInteger> toTag(ContextMenuAction action) > ASSERT_NOT_REACHED(); > } > >- return std::nullopt; >+ return WTF::nullopt; > } > > @implementation WebMenuTarget >diff --git a/Source/WebKitLegacy/win/CFDictionaryPropertyBag.cpp b/Source/WebKitLegacy/win/CFDictionaryPropertyBag.cpp >index 4502b86285d20c85f8d75056e2f9332243e7218b..4fbc2e00f55dfe3125b335f83b10a9952c242392 100644 >--- a/Source/WebKitLegacy/win/CFDictionaryPropertyBag.cpp >+++ b/Source/WebKitLegacy/win/CFDictionaryPropertyBag.cpp >@@ -190,4 +190,4 @@ HRESULT CFDictionaryPropertyBag::Write(_In_ LPCOLESTR pszPropName, _In_ VARIANT* > return S_OK; > } > return E_FAIL; >-} >\ No newline at end of file >+} >diff --git a/Source/WebKitLegacy/win/Plugins/PluginView.cpp b/Source/WebKitLegacy/win/Plugins/PluginView.cpp >index f855dd263f79cdfd41b646595022a8c44cca2f45..4e0b97c6ccaf5e4804d84ce28e0f8ca0e2f21ca3 100644 >--- a/Source/WebKitLegacy/win/Plugins/PluginView.cpp >+++ b/Source/WebKitLegacy/win/Plugins/PluginView.cpp >@@ -404,7 +404,7 @@ void PluginView::performRequest(PluginRequest* request) > URL requestURL = request->frameLoadRequest().resourceRequest().url(); > String jsString = scriptStringIfJavaScriptURL(requestURL); > >- UserGestureIndicator gestureIndicator(request->shouldAllowPopups() ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt); >+ UserGestureIndicator gestureIndicator(request->shouldAllowPopups() ? WTF::Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt); > > if (jsString.isNull()) { > // if this is not a targeted request, create a stream for it. otherwise, >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp >index 193e02b05018ef58fe416fcbfb675ede3fc5896c..3d70428be3635e3b33debf0975e4af5e9d43069d 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -121,14 +121,14 @@ void WebFrameLoaderClient::frameLoaderDestroyed() > { > } > >-std::optional<uint64_t> WebFrameLoaderClient::pageID() const >+WTF::Optional<uint64_t> WebFrameLoaderClient::pageID() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > >-std::optional<uint64_t> WebFrameLoaderClient::frameID() const >+WTF::Optional<uint64_t> WebFrameLoaderClient::frameID() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > > PAL::SessionID WebFrameLoaderClient::sessionID() const >@@ -437,7 +437,7 @@ void WebFrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& ti > frameLoadDelegate->didReceiveTitle(webView, BString(title.string), m_webFrame); > } > >-void WebFrameLoaderClient::dispatchDidCommitLoad(std::optional<HasInsecureContent>) >+void WebFrameLoaderClient::dispatchDidCommitLoad(WTF::Optional<HasInsecureContent>) > { > WebView* webView = m_webFrame->webView(); > COMPtr<IWebFrameLoadDelegate> frameLoadDelegate; >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h >index f8d74885f06c54a43387693338c0e06324d98acb..9b42ff5546599585e200caa1e7a83f482eceabe9 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h >@@ -51,8 +51,8 @@ public: > > void dispatchDidFailToStartPlugin(const WebCore::PluginView*) const; > >- std::optional<uint64_t> pageID() const final; >- std::optional<uint64_t> frameID() const final; >+ WTF::Optional<uint64_t> pageID() const final; >+ WTF::Optional<uint64_t> frameID() const final; > PAL::SessionID sessionID() const final; > > bool hasWebView() const override; >@@ -93,7 +93,7 @@ public: > void dispatchWillClose() override; > void dispatchDidStartProvisionalLoad(CompletionHandler<void()>&&) override; > void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) override; >- void dispatchDidCommitLoad(std::optional<WebCore::HasInsecureContent>) override; >+ void dispatchDidCommitLoad(WTF::Optional<WebCore::HasInsecureContent>) override; > void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) override; > void dispatchDidFailLoad(const WebCore::ResourceError&) override; > void dispatchDidFinishDocumentLoad() override; >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.cpp >index ba3f341ed1ed71fe9a50f3fa45af4591f394375f..4359015754505a7efb54ca7400f0fbeeeca69d7a 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.cpp >@@ -64,14 +64,14 @@ void WebGeolocationClient::stopUpdating() > provider->unregisterWebView(m_webView.get()); > } > >-std::optional<GeolocationPosition> WebGeolocationClient::lastPosition() >+WTF::Optional<GeolocationPosition> WebGeolocationClient::lastPosition() > { > COMPtr<IWebGeolocationProvider> provider; > if (FAILED(m_webView->geolocationProvider(&provider))) >- return std::nullopt; >+ return WTF::nullopt; > COMPtr<IWebGeolocationPosition> position; > if (FAILED(provider->lastPosition(&position))) >- return std::nullopt; >+ return WTF::nullopt; > return core(position.get()); > } > >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.h b/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.h >index f62f5c0de13af833e6cb867f732ef5595fb98655..23e39c66627351bbc86bb8df4ed70c8709a02216 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.h >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.h >@@ -43,7 +43,7 @@ public: > void startUpdating() final; > void stopUpdating() final; > void setEnableHighAccuracy(bool) final { } >- std::optional<WebCore::GeolocationPosition> lastPosition() final; >+ WTF::Optional<WebCore::GeolocationPosition> lastPosition() final; > > void requestPermission(WebCore::Geolocation&) final; > void cancelPermissionRequest(WebCore::Geolocation&) final { } >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp >index 7eb6c5641816720130387129c116371f78cef0cf..7195aa2f66ed19f13fdbde896086f5c1b647e5af 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp >@@ -69,12 +69,12 @@ BlobRegistry* WebPlatformStrategies::createBlobRegistry() > return new BlobRegistryImpl; > } > >-std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > return session.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String& cookieString) >+void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String& cookieString) > { > session.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString); > } >@@ -84,18 +84,18 @@ bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session) > return session.cookiesEnabled(); > } > >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >+std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(PAL::SessionID sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) > { > auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); > return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > } > >-bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<Cookie>& rawCookies) >+bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) > { > return session.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, rawCookies); > } >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h >index be24cb8a56859cd43ce19f0a17bbf81da7c99f1a..8b1b73e7854b74d82c94343c4dc202f92d80b9af 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h >@@ -45,11 +45,11 @@ private: > virtual WebCore::BlobRegistry* createBlobRegistry(); > > // WebCore::CookiesStrategy >- std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, const String&); >+ std::pair<String, bool> cookiesForDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, const String&); > virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&); >- std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, Vector<WebCore::Cookie>&); >+ std::pair<String, bool> cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ std::pair<String, bool> cookieRequestHeaderFieldValue(PAL::SessionID, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, WTF::Optional<uint64_t> frameID, WTF::Optional<uint64_t> pageID, Vector<WebCore::Cookie>&); > virtual void deleteCookie(const WebCore::NetworkStorageSession&, const URL&, const String&); > }; >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp >index d310d2910087009e89bafef5f0e01276194dde42..38f67ece65d1615a112dac585d264997a01df835 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp >@@ -49,7 +49,7 @@ void WebPluginInfoProvider::refreshPlugins() > PluginDatabase::installedPlugins()->refresh(); > } > >-Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& page, std::optional<Vector<WebCore::SupportedPluginIdentifier>>&) >+Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& page, WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>>&) > { > Vector<WebCore::PluginInfo> outPlugins; > const Vector<PluginPackage*>& plugins = PluginDatabase::installedPlugins()->plugins(); >@@ -86,6 +86,6 @@ Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& pag > > Vector<WebCore::PluginInfo> WebPluginInfoProvider::webVisiblePluginInfo(WebCore::Page& page, const URL&) > { >- std::optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginNames; >+ WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>> supportedPluginNames; > return pluginInfo(page, supportedPluginNames); > } >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h b/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h >index 10f766e06044d159b0a1cd9394921e7612d57924..649334d56e195dbe1ae5d06b552752a8ef510b52 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h >@@ -36,7 +36,7 @@ public: > > private: > void refreshPlugins() final; >- Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginIdentifier>>&) final; >+ Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, WTF::Optional<Vector<WebCore::SupportedPluginIdentifier>>&) final; > Vector<WebCore::PluginInfo> webVisiblePluginInfo(WebCore::Page&i, const URL&) final; > #if PLATFORM(MAC) > void setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) final; >diff --git a/Source/WebKitLegacy/win/WebGeolocationPosition.cpp b/Source/WebKitLegacy/win/WebGeolocationPosition.cpp >index 0d6b784e07503108c03867058e16b395cbf8fed8..626a03a53a5c2c9f3939708d9a8e4c145de911b5 100644 >--- a/Source/WebKitLegacy/win/WebGeolocationPosition.cpp >+++ b/Source/WebKitLegacy/win/WebGeolocationPosition.cpp >@@ -85,14 +85,14 @@ HRESULT WebGeolocationPosition::initWithTimestamp(double timestamp, double latit > return S_OK; > } > >-std::optional<GeolocationPosition> core(IWebGeolocationPosition* position) >+WTF::Optional<GeolocationPosition> core(IWebGeolocationPosition* position) > { > if (!position) >- return std::nullopt; >+ return WTF::nullopt; > > COMPtr<WebGeolocationPosition> webGeolocationPosition(Query, position); > if (!webGeolocationPosition) >- return std::nullopt; >+ return WTF::nullopt; > > return webGeolocationPosition->impl(); > } >diff --git a/Source/WebKitLegacy/win/WebGeolocationPosition.h b/Source/WebKitLegacy/win/WebGeolocationPosition.h >index 0e4468e62b2b04300bab357a33d69548346d23fe..c0ceefb048de66f4a39b04d8dfc213bd1fb1c8dc 100644 >--- a/Source/WebKitLegacy/win/WebGeolocationPosition.h >+++ b/Source/WebKitLegacy/win/WebGeolocationPosition.h >@@ -45,13 +45,13 @@ public: > // IWebGeolocationPosition > virtual HRESULT STDMETHODCALLTYPE initWithTimestamp(double timestamp, double latitude, double longitude, double accuracy); > >- const std::optional<WebCore::GeolocationPosition>& impl() const { return m_position; } >+ const WTF::Optional<WebCore::GeolocationPosition>& impl() const { return m_position; } > > private: > ULONG m_refCount { 0 }; >- std::optional<WebCore::GeolocationPosition> m_position; >+ WTF::Optional<WebCore::GeolocationPosition> m_position; > }; > >-std::optional<WebCore::GeolocationPosition> core(IWebGeolocationPosition*); >+WTF::Optional<WebCore::GeolocationPosition> core(IWebGeolocationPosition*); > > #endif // WebGeolocationPosition_h >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index c8d640223aeb1894b3c36710f7c95c09a5d4e087..4ea3f8f7b9f292c6e50a98d730e17898340e407d 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,20 @@ >+2018-12-15 Chris Dumez <cdumez@apple.com> >+ >+ wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from >+ https://bugs.webkit.org/show_bug.cgi?id=192728 >+ <rdar://problem/46746779> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ wtf_optional >+ >+ * DumpRenderTree/*: >+ * MiniBrowser/*: >+ * TestRunnerShared/*: >+ * TestWebKitAPI/*: >+ * WebGPUAPIStructure/*: >+ * WebKitTestRunner/*: >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >index 90b42ebfa460885b2b4b2a8643fa31ba2481ddde..753517ff781dd366d8909c21836d808dd57af920 100644 >--- a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >+++ b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >@@ -253,12 +253,12 @@ double UIScriptController::maximumZoomScale() const > return gWebScrollView.maximumZoomScale; > } > >-std::optional<bool> UIScriptController::stableStateOverride() const >+WTF::Optional<bool> UIScriptController::stableStateOverride() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > >-void UIScriptController::setStableStateOverride(std::optional<bool>) >+void UIScriptController::setStableStateOverride(WTF::Optional<bool>) > { > } > >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index 5de612c59f367c4d094c8fb3178286ed3bdcbff0..6aaacbf4de89fc0977d54fc75893e7cf2a92285b 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -184,7 +184,7 @@ volatile bool done; > NavigationController* gNavigationController = nullptr; > RefPtr<TestRunner> gTestRunner; > >-std::optional<TestOptions> mainFrameTestOptions; >+WTF::Optional<TestOptions> mainFrameTestOptions; > WebFrame *mainFrame = nil; > // This is the topmost frame that is loading, during a given load, or nil when no load is > // in progress. Usually this is the same as the main frame, but not always. In the case >diff --git a/Tools/DumpRenderTree/mac/EventSendingController.h b/Tools/DumpRenderTree/mac/EventSendingController.h >index 6f18f5b12b5c869465a8cf6205d75e75177f3118..2f8934f5df153fe433fad36192d81c4e063269a6 100644 >--- a/Tools/DumpRenderTree/mac/EventSendingController.h >+++ b/Tools/DumpRenderTree/mac/EventSendingController.h >@@ -57,4 +57,4 @@ @interface EventSendingController : NSObject <DOMEventListener> > @end > > extern NSPoint lastMousePosition; >-extern NSPoint lastClickPosition; >\ No newline at end of file >+extern NSPoint lastClickPosition; >diff --git a/Tools/MiniBrowser/win/Common.cpp b/Tools/MiniBrowser/win/Common.cpp >index 4d1617380afbf2d6ab1b6894e4d6a0212a2e5291..a9de375fa881a9d050e8a2c3c85d7125125aadf3 100644 >--- a/Tools/MiniBrowser/win/Common.cpp >+++ b/Tools/MiniBrowser/win/Common.cpp >@@ -204,7 +204,7 @@ bool askProxySettings(HWND hwnd, ProxySettings& settings) > return dialog.run(hInst, hwnd, IDD_PROXY); > } > >-std::optional<Credential> askCredential(HWND hwnd, const std::wstring& realm) >+WTF::Optional<Credential> askCredential(HWND hwnd, const std::wstring& realm) > { > struct AuthDialog : public Dialog { > std::wstring realm; >@@ -228,7 +228,7 @@ std::optional<Credential> askCredential(HWND hwnd, const std::wstring& realm) > > if (dialog.run(hInst, hwnd, IDD_AUTH)) > return dialog.credential; >- return std::nullopt; >+ return WTF::nullopt; > } > > CommandLineOptions parseCommandLine() >diff --git a/Tools/MiniBrowser/win/Common.h b/Tools/MiniBrowser/win/Common.h >index 15bc4ddcf2c4dc25980fc2b97d19f89a8af8b0ae..f6e74db242291e34e91f725e1390e322a60e9728 100644 >--- a/Tools/MiniBrowser/win/Common.h >+++ b/Tools/MiniBrowser/win/Common.h >@@ -62,7 +62,7 @@ void computeFullDesktopFrame(); > bool getAppDataFolder(_bstr_t& directory); > CommandLineOptions parseCommandLine(); > void createCrashReport(EXCEPTION_POINTERS*); >-std::optional<Credential> askCredential(HWND, const std::wstring& realm); >+WTF::Optional<Credential> askCredential(HWND, const std::wstring& realm); > bool askProxySettings(HWND, ProxySettings&); > > extern HINSTANCE hInst; >diff --git a/Tools/TestRunnerShared/Bindings/JSWrappable.h b/Tools/TestRunnerShared/Bindings/JSWrappable.h >index e79208caee3ba5fec65b728b3613a016a5a208af..f44a5009a1d6ddf9545b30d5cf068933a9c2461e 100644 >--- a/Tools/TestRunnerShared/Bindings/JSWrappable.h >+++ b/Tools/TestRunnerShared/Bindings/JSWrappable.h >@@ -37,14 +37,14 @@ public: > virtual JSClassRef wrapperClass() = 0; > }; > >-inline JSValueRef JSValueMakeBooleanOrNull(JSContextRef context, std::optional<bool> value) >+inline JSValueRef JSValueMakeBooleanOrNull(JSContextRef context, WTF::Optional<bool> value) > { > return value ? JSValueMakeBoolean(context, value.value()) : JSValueMakeNull(context); > } > >-inline std::optional<bool> JSValueToNullableBoolean(JSContextRef context, JSValueRef value) >+inline WTF::Optional<bool> JSValueToNullableBoolean(JSContextRef context, JSValueRef value) > { >- return JSValueIsUndefined(context, value) || JSValueIsNull(context, value) ? std::nullopt : std::optional<bool>(JSValueToBoolean(context, value)); >+ return JSValueIsUndefined(context, value) || JSValueIsNull(context, value) ? WTF::nullopt : WTF::Optional<bool>(JSValueToBoolean(context, value)); > } > > inline JSValueRef JSValueMakeStringOrNull(JSContextRef context, JSStringRef stringOrNull) >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index f877dcedc53a9f65d51d568af57b14cb4569ed4d..e913ca858302a50ee41dce4869407d816107da87 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -380,12 +380,12 @@ double UIScriptController::maximumZoomScale() const > return 1; > } > >-std::optional<bool> UIScriptController::stableStateOverride() const >+WTF::Optional<bool> UIScriptController::stableStateOverride() const > { >- return std::nullopt; >+ return WTF::nullopt; > } > >-void UIScriptController::setStableStateOverride(std::optional<bool>) >+void UIScriptController::setStableStateOverride(WTF::Optional<bool>) > { > } > >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >index 7621470f7fd6a12ed755496927a8c9ae4a24dfdf..eb32d9f06397569e2a7698e5a9f8cf39a71d9088 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >@@ -156,8 +156,8 @@ public: > double minimumZoomScale() const; > double maximumZoomScale() const; > >- std::optional<bool> stableStateOverride() const; >- void setStableStateOverride(std::optional<bool>); >+ WTF::Optional<bool> stableStateOverride() const; >+ void setStableStateOverride(WTF::Optional<bool>); > > JSObjectRef contentVisibleRect() const; > >diff --git a/Tools/TestWebKitAPI/Tests/WTF/Function.cpp b/Tools/TestWebKitAPI/Tests/WTF/Function.cpp >index 79357c53b8921dfbb8fdd52d8bf20f2ffe14e40d..89210d60bd4393385578e5b9e6955ed689f7ff60 100644 >--- a/Tools/TestWebKitAPI/Tests/WTF/Function.cpp >+++ b/Tools/TestWebKitAPI/Tests/WTF/Function.cpp >@@ -190,12 +190,12 @@ struct FunctionDestructionChecker { > } > > Function<unsigned()>& function; >- static std::optional<bool> functionAsBool; >- static std::optional<unsigned> functionResult; >+ static WTF::Optional<bool> functionAsBool; >+ static WTF::Optional<unsigned> functionResult; > }; > >-std::optional<bool> FunctionDestructionChecker::functionAsBool; >-std::optional<unsigned> FunctionDestructionChecker::functionResult; >+WTF::Optional<bool> FunctionDestructionChecker::functionAsBool; >+WTF::Optional<unsigned> FunctionDestructionChecker::functionResult; > > TEST(WTF_Function, AssignBeforeDestroy) > { >@@ -209,8 +209,8 @@ TEST(WTF_Function, AssignBeforeDestroy) > EXPECT_TRUE(static_cast<bool>(FunctionDestructionChecker::functionResult)); > EXPECT_TRUE(FunctionDestructionChecker::functionAsBool.value()); > EXPECT_EQ(1U, FunctionDestructionChecker::functionResult.value()); >- FunctionDestructionChecker::functionAsBool = std::nullopt; >- FunctionDestructionChecker::functionResult = std::nullopt; >+ FunctionDestructionChecker::functionAsBool = WTF::nullopt; >+ FunctionDestructionChecker::functionResult = WTF::nullopt; > > a = FunctionDestructionChecker(a); > a = MoveOnly { 2 }; >@@ -218,8 +218,8 @@ TEST(WTF_Function, AssignBeforeDestroy) > EXPECT_TRUE(static_cast<bool>(FunctionDestructionChecker::functionResult)); > EXPECT_TRUE(FunctionDestructionChecker::functionAsBool.value()); > EXPECT_EQ(2U, FunctionDestructionChecker::functionResult.value()); >- FunctionDestructionChecker::functionAsBool = std::nullopt; >- FunctionDestructionChecker::functionResult = std::nullopt; >+ FunctionDestructionChecker::functionAsBool = WTF::nullopt; >+ FunctionDestructionChecker::functionResult = WTF::nullopt; > } > > static int returnThree() >diff --git a/Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp b/Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp >index f5e9f3487f8d98db96934b853cfb0767ca81847a..69b550203ff4a517b294e188a29277925eb59b58 100644 >--- a/Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp >+++ b/Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp >@@ -168,7 +168,7 @@ TEST(WTF, Hasher_multiple) > EXPECT_EQ(zero32BitHash, computeHash(std::array<int, 1> { { 0 } })); > EXPECT_EQ(zero32BitHash, computeHash(Vector<int> { 0 })); > EXPECT_EQ(zero32BitHash, computeHash(Vector<int, 1> { 0 })); >- EXPECT_EQ(zero32BitHash, computeHash(std::optional<int> { std::nullopt })); >+ EXPECT_EQ(zero32BitHash, computeHash(WTF::Optional<int> { WTF::nullopt })); > EXPECT_EQ(zero32BitHash, computeHash(std::make_tuple(0))); > > EXPECT_EQ(one64BitHash, computeHash(1, 0)); >@@ -176,7 +176,7 @@ TEST(WTF, Hasher_multiple) > EXPECT_EQ(one64BitHash, computeHash(std::make_pair(1, 0))); > EXPECT_EQ(one64BitHash, computeHash(std::array<int, 2> { { 1, 0 } })); > EXPECT_EQ(one64BitHash, computeHash({ 1, 0 })); >- EXPECT_EQ(one64BitHash, computeHash(std::optional<int> { 0 })); >+ EXPECT_EQ(one64BitHash, computeHash(WTF::Optional<int> { 0 })); > EXPECT_EQ(one64BitHash, computeHash(Vector<int> { { 1, 0 } })); > EXPECT_EQ(one64BitHash, computeHash(Vector<int, 1> { { 1, 0 } })); > >diff --git a/Tools/TestWebKitAPI/Tests/WTF/Markable.cpp b/Tools/TestWebKitAPI/Tests/WTF/Markable.cpp >index ee4384882e31e22f78000ca22f2232d0146f819b..8c1a2d46a2c37ef1f6f6e9128e16343bdaa02c14 100644 >--- a/Tools/TestWebKitAPI/Tests/WTF/Markable.cpp >+++ b/Tools/TestWebKitAPI/Tests/WTF/Markable.cpp >@@ -39,7 +39,7 @@ TEST(WTF_Markable, Disengaged) > } > > { >- Markable<int, IntegralMarkableTraits<int, 42>> optional { std::nullopt }; >+ Markable<int, IntegralMarkableTraits<int, 42>> optional { WTF::nullopt }; > > EXPECT_FALSE(static_cast<bool>(optional)); > } >@@ -57,7 +57,7 @@ TEST(WTF_Markable, Engaged) > EXPECT_TRUE(static_cast<bool>(optional)); > EXPECT_EQ(41, optional.value()); > >- optional = std::nullopt; >+ optional = WTF::nullopt; > EXPECT_FALSE(static_cast<bool>(optional)); > > optional = 42; >@@ -121,40 +121,40 @@ TEST(WTF_Markable, Destructor) > TEST(WTF_Markable, FromOptional) > { > { >- std::optional<int> from; >+ WTF::Optional<int> from; > EXPECT_FALSE(static_cast<bool>(from)); > Markable<int, IntegralMarkableTraits<int, 42>> optional = from; > EXPECT_FALSE(static_cast<bool>(optional)); > } > { >- std::optional<int> from { 42 }; >+ WTF::Optional<int> from { 42 }; > EXPECT_TRUE(static_cast<bool>(from)); > Markable<int, IntegralMarkableTraits<int, 42>> optional = from; > // We convert this to nullopt. > EXPECT_FALSE(static_cast<bool>(optional)); > } > { >- std::optional<int> from { 43 }; >+ WTF::Optional<int> from { 43 }; > EXPECT_TRUE(static_cast<bool>(from)); > Markable<int, IntegralMarkableTraits<int, 42>> optional = from; > EXPECT_TRUE(static_cast<bool>(optional)); > EXPECT_EQ(optional.value(), 43); > } > { >- std::optional<int> from; >+ WTF::Optional<int> from; > EXPECT_FALSE(static_cast<bool>(from)); > Markable<int, IntegralMarkableTraits<int, 42>> optional { WTFMove(from) }; > EXPECT_FALSE(static_cast<bool>(optional)); > } > { >- std::optional<int> from { 42 }; >+ WTF::Optional<int> from { 42 }; > EXPECT_TRUE(static_cast<bool>(from)); > Markable<int, IntegralMarkableTraits<int, 42>> optional { WTFMove(from) }; > // We convert this to nullopt. > EXPECT_FALSE(static_cast<bool>(optional)); > } > { >- std::optional<int> from { 43 }; >+ WTF::Optional<int> from { 43 }; > EXPECT_TRUE(static_cast<bool>(from)); > Markable<int, IntegralMarkableTraits<int, 42>> optional { WTFMove(from) }; > EXPECT_TRUE(static_cast<bool>(optional)); >@@ -167,40 +167,40 @@ TEST(WTF_Markable, ToOptional) > { > Markable<int, IntegralMarkableTraits<int, 42>> optional; > EXPECT_FALSE(static_cast<bool>(optional)); >- std::optional<int> to = optional; >+ WTF::Optional<int> to = optional; > EXPECT_FALSE(static_cast<bool>(to)); > } > { > Markable<int, IntegralMarkableTraits<int, 42>> optional { 42 }; > EXPECT_FALSE(static_cast<bool>(optional)); > // We convert this to nullopt. >- std::optional<int> to = optional; >+ WTF::Optional<int> to = optional; > EXPECT_FALSE(static_cast<bool>(to)); > } > { > Markable<int, IntegralMarkableTraits<int, 42>> optional { 43 }; > EXPECT_TRUE(static_cast<bool>(optional)); >- std::optional<int> to = optional; >+ WTF::Optional<int> to = optional; > EXPECT_TRUE(static_cast<bool>(to)); > EXPECT_EQ(to.value(), 43); > } > { > Markable<int, IntegralMarkableTraits<int, 42>> optional; > EXPECT_FALSE(static_cast<bool>(optional)); >- std::optional<int> to { WTFMove(optional) }; >+ WTF::Optional<int> to { WTFMove(optional) }; > EXPECT_FALSE(static_cast<bool>(to)); > } > { > Markable<int, IntegralMarkableTraits<int, 42>> optional { 42 }; > EXPECT_FALSE(static_cast<bool>(optional)); > // We convert this to nullopt. >- std::optional<int> to { WTFMove(optional) }; >+ WTF::Optional<int> to { WTFMove(optional) }; > EXPECT_FALSE(static_cast<bool>(to)); > } > { > Markable<int, IntegralMarkableTraits<int, 42>> optional { 43 }; > EXPECT_TRUE(static_cast<bool>(optional)); >- std::optional<int> to { WTFMove(optional) }; >+ WTF::Optional<int> to { WTFMove(optional) }; > EXPECT_TRUE(static_cast<bool>(to)); > EXPECT_EQ(to.value(), 43); > } >@@ -247,13 +247,13 @@ TEST(WTF_Markable, MoveOptional) > int m_value; > }; > { >- std::optional<OnlyMovable> from { std::in_place, 20 }; >+ WTF::Optional<OnlyMovable> from { std::in_place, 20 }; > EXPECT_TRUE(static_cast<bool>(from)); > EXPECT_EQ(from.value().value(), 20); > Markable<OnlyMovable, OnlyMovable> compact = WTFMove(from); > EXPECT_TRUE(static_cast<bool>(compact)); > EXPECT_EQ(compact.value().value(), 20); >- std::optional<OnlyMovable> to = WTFMove(compact); >+ WTF::Optional<OnlyMovable> to = WTFMove(compact); > EXPECT_TRUE(static_cast<bool>(to)); > EXPECT_EQ(to.value().value(), 20); > } >diff --git a/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp b/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp >index a70881f35c982707d8736d691cdaa2f7709e20ed..49a5d95bbb8f71f996426f43b218f7ddab35bac0 100644 >--- a/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp >+++ b/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp >@@ -32,13 +32,13 @@ namespace TestWebKitAPI { > TEST(WTF_Optional, Disengaged) > { > { >- std::optional<int> optional; >+ WTF::Optional<int> optional; > > EXPECT_FALSE(static_cast<bool>(optional)); > } > > { >- std::optional<int> optional { std::nullopt }; >+ WTF::Optional<int> optional { WTF::nullopt }; > > EXPECT_FALSE(static_cast<bool>(optional)); > } >@@ -46,7 +46,7 @@ TEST(WTF_Optional, Disengaged) > > TEST(WTF_Optional, Engaged) > { >- std::optional<int> optional { 10 }; >+ WTF::Optional<int> optional { 10 }; > > EXPECT_TRUE(static_cast<bool>(optional)); > EXPECT_EQ(10, optional.value()); >@@ -64,7 +64,7 @@ TEST(WTF_Optional, Destructor) > }; > > { >- std::optional<A> optional { std::in_place }; >+ WTF::Optional<A> optional { std::in_place }; > > EXPECT_TRUE(static_cast<bool>(optional)); > } >@@ -75,7 +75,7 @@ TEST(WTF_Optional, Destructor) > TEST(WTF_Optional, Callback) > { > bool called = false; >- std::optional<int> a; >+ WTF::Optional<int> a; > int result = valueOrCompute(a, [&] { > called = true; > return 300; >@@ -95,22 +95,22 @@ TEST(WTF_Optional, Callback) > > TEST(WTF_Optional, Equality) > { >- std::optional<int> unengaged1; >- std::optional<int> unengaged2; >+ WTF::Optional<int> unengaged1; >+ WTF::Optional<int> unengaged2; > >- std::optional<int> engaged1 { 1 }; >- std::optional<int> engaged2 { 2 }; >- std::optional<int> engagedx2 { 2 }; >+ WTF::Optional<int> engaged1 { 1 }; >+ WTF::Optional<int> engaged2 { 2 }; >+ WTF::Optional<int> engagedx2 { 2 }; > > EXPECT_TRUE(unengaged1 == unengaged2); > EXPECT_FALSE(engaged1 == engaged2); > EXPECT_FALSE(engaged1 == unengaged1); > EXPECT_TRUE(engaged2 == engagedx2); > >- EXPECT_TRUE(unengaged1 == std::nullopt); >- EXPECT_FALSE(engaged1 == std::nullopt); >- EXPECT_TRUE(std::nullopt == unengaged1); >- EXPECT_FALSE(std::nullopt == engaged1); >+ EXPECT_TRUE(unengaged1 == WTF::nullopt); >+ EXPECT_FALSE(engaged1 == WTF::nullopt); >+ EXPECT_TRUE(WTF::nullopt == unengaged1); >+ EXPECT_FALSE(WTF::nullopt == engaged1); > > EXPECT_TRUE(engaged1 == 1); > EXPECT_TRUE(1 == engaged1); >@@ -120,22 +120,22 @@ TEST(WTF_Optional, Equality) > > TEST(WTF_Optional, Inequality) > { >- std::optional<int> unengaged1; >- std::optional<int> unengaged2; >+ WTF::Optional<int> unengaged1; >+ WTF::Optional<int> unengaged2; > >- std::optional<int> engaged1 { 1 }; >- std::optional<int> engaged2 { 2 }; >- std::optional<int> engagedx2 { 2 }; >+ WTF::Optional<int> engaged1 { 1 }; >+ WTF::Optional<int> engaged2 { 2 }; >+ WTF::Optional<int> engagedx2 { 2 }; > > EXPECT_FALSE(unengaged1 != unengaged2); > EXPECT_TRUE(engaged1 != engaged2); > EXPECT_TRUE(engaged1 != unengaged1); > EXPECT_FALSE(engaged2 != engagedx2); > >- EXPECT_FALSE(unengaged1 != std::nullopt); >- EXPECT_TRUE(engaged1 != std::nullopt); >- EXPECT_FALSE(std::nullopt != unengaged1); >- EXPECT_TRUE(std::nullopt != engaged1); >+ EXPECT_FALSE(unengaged1 != WTF::nullopt); >+ EXPECT_TRUE(engaged1 != WTF::nullopt); >+ EXPECT_FALSE(WTF::nullopt != unengaged1); >+ EXPECT_TRUE(WTF::nullopt != engaged1); > > EXPECT_FALSE(engaged1 != 1); > EXPECT_TRUE(engaged1 != 2); >@@ -146,5 +146,93 @@ TEST(WTF_Optional, Inequality) > EXPECT_TRUE(1 != unengaged1); > } > >+TEST(WTF_Optional, MoveSemanticsConstructor) >+{ >+ { >+ WTF::Optional<int> unengaged1 { }; >+ EXPECT_FALSE(!!unengaged1); >+ >+ WTF::Optional<int> unengaged2(std::move(unengaged1)); >+ EXPECT_FALSE(!!unengaged1); >+ EXPECT_FALSE(!!unengaged2); >+ } >+ >+ { >+ WTF::Optional<int> engagedToUnengaged { 2 }; >+ EXPECT_TRUE(!!engagedToUnengaged); >+ EXPECT_EQ(2, engagedToUnengaged.value()); >+ >+ WTF::Optional<int> engaged(std::move(engagedToUnengaged)); >+ EXPECT_FALSE(!!engagedToUnengaged); >+ EXPECT_TRUE(!!engaged); >+ EXPECT_EQ(2, engaged.value()); >+ } >+} >+ >+TEST(WTF_Optional, MoveSemanticsAssignment) >+{ >+ { >+ WTF::Optional<int> unengaged1 { }; >+ EXPECT_FALSE(!!unengaged1); >+ >+ WTF::Optional<int> unengaged2; >+ EXPECT_FALSE(!!unengaged2); >+ >+ unengaged2 = std::move(unengaged1); >+ EXPECT_FALSE(!!unengaged1); >+ EXPECT_FALSE(!!unengaged2); >+ } >+ >+ { >+ WTF::Optional<int> engagedToUnengaged { 3 }; >+ EXPECT_TRUE(!!engagedToUnengaged); >+ EXPECT_EQ(3, engagedToUnengaged.value()); >+ >+ engagedToUnengaged = std::move(WTF::nullopt); >+ EXPECT_FALSE(!!engagedToUnengaged); >+ } >+ >+ { >+ WTF::Optional<int> engagedToUnengaged { 4 }; >+ EXPECT_TRUE(!!engagedToUnengaged); >+ EXPECT_EQ(4, engagedToUnengaged.value()); >+ >+ WTF::Optional<int> unengagedToEngaged; >+ EXPECT_FALSE(!!unengagedToEngaged); >+ >+ unengagedToEngaged = std::move(engagedToUnengaged); >+ EXPECT_FALSE(!!engagedToUnengaged); >+ EXPECT_TRUE(!!unengagedToEngaged); >+ EXPECT_EQ(4, unengagedToEngaged.value()); >+ } >+ >+ { >+ WTF::Optional<int> engagedToUnengaged { 5 }; >+ EXPECT_TRUE(!!engagedToUnengaged); >+ EXPECT_EQ(5, engagedToUnengaged.value()); >+ >+ WTF::Optional<int> unengaged; >+ EXPECT_FALSE(!!unengaged); >+ >+ engagedToUnengaged = std::move(unengaged); >+ EXPECT_FALSE(!!engagedToUnengaged); >+ EXPECT_FALSE(!!unengaged); >+ } >+ >+ { >+ WTF::Optional<int> engagedToUnengaged { 6 }; >+ EXPECT_TRUE(!!engagedToUnengaged); >+ EXPECT_EQ(6, engagedToUnengaged.value()); >+ >+ WTF::Optional<int> engagedToEngaged { 7 }; >+ EXPECT_TRUE(!!engagedToEngaged); >+ EXPECT_EQ(7, engagedToEngaged.value()); >+ >+ engagedToEngaged = std::move(engagedToUnengaged); >+ EXPECT_FALSE(!!engagedToUnengaged); >+ EXPECT_TRUE(!!engagedToEngaged); >+ EXPECT_EQ(6, engagedToEngaged.value()); >+ } >+} > > } // namespace TestWebKitAPI >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/AbortableTaskQueue.cpp b/Tools/TestWebKitAPI/Tests/WebCore/AbortableTaskQueue.cpp >index 5fee1f7cbebdecc2a3b64b36ca92f56b145a9a2b..465de7b9866251c3e60f5b3917ad4f23498a8f7a 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/AbortableTaskQueue.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/AbortableTaskQueue.cpp >@@ -105,7 +105,7 @@ TEST(AbortableTaskQueue, SyncTasks) > > auto backgroundThreadFunction = [&]() { > EXPECT_FALSE(isMainThread()); >- std::optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([&]() -> FancyResponse { >+ WTF::Optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([&]() -> FancyResponse { > EXPECT_TRUE(isMainThread()); > currentStep++; > EXPECT_EQ(1, currentStep); >@@ -117,7 +117,7 @@ TEST(AbortableTaskQueue, SyncTasks) > EXPECT_TRUE(response); > EXPECT_FALSE(destructedResponseFlag); > EXPECT_EQ(100, response->fancyInt); >- response = std::nullopt; >+ response = WTF::nullopt; > EXPECT_TRUE(destructedResponseFlag); > RunLoop::main().dispatch([&]() { > testFinished = true; >@@ -203,7 +203,7 @@ TEST(AbortableTaskQueue, Abort) > EXPECT_TRUE(false); > }); > // This call must return immediately because we are aborting. >- std::optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([]() -> FancyResponse { >+ WTF::Optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([]() -> FancyResponse { > // This task should not have been able to run under the scheduling of this test. > EXPECT_TRUE(false); > return FancyResponse(100); >@@ -245,7 +245,7 @@ TEST(AbortableTaskQueue, AbortBeforeSyncTaskRun) > auto backgroundThreadFunction = [&]() { > EXPECT_FALSE(isMainThread()); > >- std::optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([]() -> FancyResponse { >+ WTF::Optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([]() -> FancyResponse { > // This task should not have been able to run under the scheduling of this test. > EXPECT_TRUE(false); > return FancyResponse(100); >@@ -284,7 +284,7 @@ TEST(AbortableTaskQueue, AbortedBySyncTaskHandler) > currentStep++; > EXPECT_EQ(1, currentStep); > >- std::optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([&]() -> FancyResponse { >+ WTF::Optional<FancyResponse> response = taskQueue.enqueueTaskAndWait<FancyResponse>([&]() -> FancyResponse { > currentStep++; > EXPECT_EQ(2, currentStep); > taskQueue.startAborting(); >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp b/Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp >index 0a929a0f6a4465c1a3f2593175e97a32eb4b3669..d8ae30e6c4cbf7579d45e4e17536a7268fced411 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp >@@ -63,7 +63,7 @@ TEST(CBORReaderTest, TestReadUint) > }; > > for (const UintTestCase& testCase : kUintTestCases) { >- std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(testCase.cborData); > ASSERT_TRUE(cbor.has_value()); > ASSERT_TRUE(cbor.value().type() == CBORValue::Type::Unsigned); > EXPECT_EQ(cbor.value().getInteger(), testCase.value); >@@ -108,7 +108,7 @@ TEST(CBORReaderTest, TestUintEncodedWithNonMinimumByteLength) > > CBORReader::DecoderError errorCode; > for (const auto& nonMinimalUint : nonMinimalUintEncodings) { >- std::optional<CBORValue> cbor = CBORReader::read(nonMinimalUint, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(nonMinimalUint, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::NonMinimalCBOREncoding); > } >@@ -134,7 +134,7 @@ TEST(CBORReaderTest, TestReadNegativeInt) > }; > > for (const NegativeIntTestCase& testCase : kNegativeIntTestCases) { >- std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(testCase.cborData); > ASSERT_TRUE(cbor.has_value()); > ASSERT_TRUE(cbor.value().type() == CBORValue::Type::Negative); > EXPECT_EQ(cbor.value().getInteger(), testCase.negativeInt); >@@ -154,7 +154,7 @@ TEST(CBORReaderTest, TestReadBytes) > }; > > for (const ByteTestCase& testCase : kByteStringTestCases) { >- std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(testCase.cborData); > ASSERT_TRUE(cbor.has_value()); > ASSERT_TRUE(cbor.value().type() == CBORValue::Type::ByteString); > EXPECT_TRUE(cbor.value().getByteString() == testCase.value); >@@ -179,7 +179,7 @@ TEST(CBORReaderTest, TestReadString) > }; > > for (const StringTestCase& testCase : kStringTestCases) { >- std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(testCase.cborData); > ASSERT_TRUE(cbor.has_value()); > ASSERT_TRUE(cbor.value().type() == CBORValue::Type::String); > EXPECT_TRUE(cbor.value().getString() == testCase.value); >@@ -207,7 +207,7 @@ TEST(CBORReaderTest, TestReadStringWithNUL) > }; > > for (const auto& testCase : kStringTestCases) { >- std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(testCase.cborData); > ASSERT_TRUE(cbor.has_value()); > ASSERT_TRUE(cbor.value().type() == CBORValue::Type::String); > EXPECT_TRUE(cbor.value().getString() == testCase.value); >@@ -224,7 +224,7 @@ TEST(CBORReaderTest, TestReadStringWithInvalidByteSequenceAfterNUL) > 0x63, 0x00, 0x00, 0xA6 > }; > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(stringWithInvalidContinuationByte, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(stringWithInvalidContinuationByte, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::InvalidUTF8); > } >@@ -238,7 +238,7 @@ TEST(CBORReaderTest, TestReadArray) > 0x18, 0x18, 0x19, > }; > >- std::optional<CBORValue> cbor = CBORReader::read(kArrayTestCaseCBOR); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(kArrayTestCaseCBOR); > ASSERT_TRUE(cbor.has_value()); > const CBORValue cborArray = WTFMove(cbor.value()); > ASSERT_TRUE(cborArray.type() == CBORValue::Type::Array); >@@ -268,7 +268,7 @@ TEST(CBORReaderTest, TestReadMapWithMapValue) > 0x62, 0x41, 0x41, // "AA" > }; > >- std::optional<CBORValue> cbor = CBORReader::read(kMapTestCaseCBOR); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(kMapTestCaseCBOR); > ASSERT_TRUE(cbor.has_value()); > const CBORValue cborVal = WTFMove(cbor.value()); > ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); >@@ -312,7 +312,7 @@ TEST(CBORReaderTest, TestReadMapWithIntegerKeys) > 0x61, 0x64, // value : "d" > }; > >- std::optional<CBORValue> cbor = CBORReader::read(kMapWithIntegerKeyCBOR); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(kMapWithIntegerKeyCBOR); > ASSERT_TRUE(cbor.has_value()); > const CBORValue cborVal = WTFMove(cbor.value()); > ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); >@@ -352,7 +352,7 @@ TEST(CBORReaderTest, TestReadMapWithArray) > 0x03, > }; > >- std::optional<CBORValue> cbor = CBORReader::read(kMapArrayTestCaseCBOR); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(kMapArrayTestCaseCBOR); > ASSERT_TRUE(cbor.has_value()); > const CBORValue cborVal = WTFMove(cbor.value()); > ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); >@@ -391,7 +391,7 @@ TEST(CBORReaderTest, TestReadNestedMap) > 0x03, > }; > >- std::optional<CBORValue> cbor = CBORReader::read(kNestedMapTestCase); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(kNestedMapTestCase); > ASSERT_TRUE(cbor.has_value()); > const CBORValue cborVal = WTFMove(cbor.value()); > ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); >@@ -428,11 +428,11 @@ TEST(CBORReaderTest, TestIntegerRange) > 0x3b, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF > }; > >- std::optional<CBORValue> maxPositiveInt = CBORReader::read(kMaxPositiveInt); >+ WTF::Optional<CBORValue> maxPositiveInt = CBORReader::read(kMaxPositiveInt); > ASSERT_TRUE(maxPositiveInt.has_value()); > EXPECT_EQ(maxPositiveInt.value().getInteger(), INT64_MAX); > >- std::optional<CBORValue> minNegativeInt = CBORReader::read(kMinNegativeInt); >+ WTF::Optional<CBORValue> minNegativeInt = CBORReader::read(kMinNegativeInt); > ASSERT_TRUE(minNegativeInt.has_value()); > EXPECT_EQ(minNegativeInt.value().getInteger(), INT64_MIN); > } >@@ -448,11 +448,11 @@ TEST(CBORReaderTest, TestIntegerOutOfRangeError) > }; > > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> positiveIntOutOfRangeCBOR = CBORReader::read(kOutOfRangePositiveInt, &errorCode); >+ WTF::Optional<CBORValue> positiveIntOutOfRangeCBOR = CBORReader::read(kOutOfRangePositiveInt, &errorCode); > EXPECT_FALSE(positiveIntOutOfRangeCBOR); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::OutOfRangeIntegerValue); > >- std::optional<CBORValue> negativeIntOutOfRangeCBOR = CBORReader::read(kOutOfRangeNegativeInt, &errorCode); >+ WTF::Optional<CBORValue> negativeIntOutOfRangeCBOR = CBORReader::read(kOutOfRangeNegativeInt, &errorCode); > EXPECT_FALSE(negativeIntOutOfRangeCBOR); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::OutOfRangeIntegerValue); > } >@@ -470,7 +470,7 @@ TEST(CBORReaderTest, TestReadSimpleValue) > }; > > for (const auto& testCase : kSimpleValueTestCases) { >- std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(testCase.cborData); > ASSERT_TRUE(cbor.has_value()); > ASSERT_TRUE(cbor.value().type() == CBORValue::Type::SimpleValue); > ASSERT_TRUE(cbor.value().getSimpleValue() == testCase.value); >@@ -490,7 +490,7 @@ TEST(CBORReaderTest, TestReadUnsupportedFloatingPointNumbers) > > for (const auto& unsupported_floating_point : floatingPointCbors) { > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(unsupported_floating_point, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(unsupported_floating_point, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::UnsupportedFloatingPointValue); > } >@@ -516,7 +516,7 @@ TEST(CBORReaderTest, TestIncompleteCBORDataError) > > for (const auto& incomplete_data : incompleteCborList) { > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(incomplete_data, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(incomplete_data, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::IncompleteCBORData); > } >@@ -537,7 +537,7 @@ TEST(CBORReaderTest, TestUnsupportedMapKeyFormatError) > }; > > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(kMapWithUintKey, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(kMapWithUintKey, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::IncorrectMapKeyType); > } >@@ -566,7 +566,7 @@ TEST(CBORReaderTest, TestUnknownAdditionalInfoError) > > for (const auto& incorrect_cbor : kUnknownAdditionalInfoList) { > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(incorrect_cbor, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(incorrect_cbor, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::UnknownAdditionalInfo); > } >@@ -589,7 +589,7 @@ TEST(CBORReaderTest, TestTooMuchNestingError) > > for (const auto& zeroDepthData : kZeroDepthCBORList) { > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(zeroDepthData, &errorCode, 0); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(zeroDepthData, &errorCode, 0); > EXPECT_TRUE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::CBORNoError); > } >@@ -609,11 +609,11 @@ TEST(CBORReaderTest, TestTooMuchNestingError) > }; > > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cborSingleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 1); >+ WTF::Optional<CBORValue> cborSingleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 1); > EXPECT_FALSE(cborSingleLayerMax.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::TooMuchNesting); > >- std::optional<CBORValue> cborDoubleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 2); >+ WTF::Optional<CBORValue> cborDoubleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 2); > EXPECT_TRUE(cborDoubleLayerMax.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::CBORNoError); > } >@@ -646,7 +646,7 @@ TEST(CBORReaderTest, TestOutOfOrderKeyError) > > CBORReader::DecoderError errorCode; > for (const auto& unsortedMap : kMapsWithUnsortedKeys) { >- std::optional<CBORValue> cbor = >+ WTF::Optional<CBORValue> cbor = > CBORReader::read(unsortedMap, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::OutOfOrderKey); >@@ -678,7 +678,7 @@ TEST(CBORReaderTest, TestDuplicateKeyError) > > CBORReader::DecoderError errorCode; > >- std::optional<CBORValue> cbor = CBORReader::read(kMapWithDuplicateKey, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(kMapWithDuplicateKey, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::DuplicateKey); > } >@@ -698,14 +698,14 @@ TEST(CBORReaderTest, TestIncorrectStringEncodingError) > > CBORReader::DecoderError errorCode; > for (const auto& cbor_byte : utf8CharacterEncodings) { >- std::optional<CBORValue> correctlyEncodedCbor = CBORReader::read(cbor_byte, &errorCode); >+ WTF::Optional<CBORValue> correctlyEncodedCbor = CBORReader::read(cbor_byte, &errorCode); > EXPECT_TRUE(correctlyEncodedCbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::CBORNoError); > } > > // Incorrect UTF8 encoding referenced by section 3.5.3 of the stress test. > Vector<uint8_t> impossible_utf_byte { 0x64, 0xfe, 0xfe, 0xff, 0xff }; >- std::optional<CBORValue> incorrectlyEncodedCbor = CBORReader::read(impossible_utf_byte, &errorCode); >+ WTF::Optional<CBORValue> incorrectlyEncodedCbor = CBORReader::read(impossible_utf_byte, &errorCode); > EXPECT_FALSE(incorrectlyEncodedCbor); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::InvalidUTF8); > } >@@ -727,7 +727,7 @@ TEST(CBORReaderTest, TestExtraneousCBORDataError) > > for (const auto& extraneous_cborData : zeroPaddedCborList) { > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(extraneous_cborData, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(extraneous_cborData, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::ExtraneousData); > } >@@ -758,7 +758,7 @@ TEST(CBORReaderTest, TestUnsupportedSimplevalue) > > for (const auto& unsupportedSimpleVal : unsupportedSimpleValues) { > CBORReader::DecoderError errorCode; >- std::optional<CBORValue> cbor = CBORReader::read(unsupportedSimpleVal, &errorCode); >+ WTF::Optional<CBORValue> cbor = CBORReader::read(unsupportedSimpleVal, &errorCode); > EXPECT_FALSE(cbor.has_value()); > EXPECT_TRUE(errorCode == CBORReader::DecoderError::UnsupportedSimpleValue); > } >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp b/Tools/TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp >index f439dad4ec1a908007417cd2a7e6c61dd135fa64..8cb4427a6d27af0cc0aa08e234e680c9f6bc005c 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp >@@ -59,7 +59,7 @@ TEST(CTAPRequestTest, TestConstructMakeCredentialRequestParam) > Vector<PublicKeyCredentialCreationOptions::Parameters> params { { PublicKeyCredentialType::PublicKey, 7 }, { PublicKeyCredentialType::PublicKey, 257 } }; > PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria selection { PublicKeyCredentialCreationOptions::AuthenticatorAttachment::Platform, true, UserVerificationRequirement::Preferred }; > >- PublicKeyCredentialCreationOptions options { rp, user, { }, params, std::nullopt, { }, selection }; >+ PublicKeyCredentialCreationOptions options { rp, user, { }, params, WTF::nullopt, { }, selection }; > Vector<uint8_t> hash; > hash.append(TestData::kClientDataHash, sizeof(TestData::kClientDataHash)); > auto serializedData = encodeMakeCredenitalRequestAsCBOR(hash, options, AuthenticatorSupportedOptions::UserVerificationAvailability::kSupportedButNotConfigured); >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp b/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp >index aad16b8604179ca43a9773795854b575773afc9a..54206cb9f5a2d4c9d39d0a9ac4bd1a6df3264209 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp >@@ -77,8 +77,8 @@ private: > > TEST_F(SecurityOriginTest, SecurityOriginConstructors) > { >- Ref<SecurityOrigin> o1 = SecurityOrigin::create("http", "example.com", std::optional<uint16_t>(80)); >- Ref<SecurityOrigin> o2 = SecurityOrigin::create("http", "example.com", std::optional<uint16_t>()); >+ Ref<SecurityOrigin> o1 = SecurityOrigin::create("http", "example.com", WTF::Optional<uint16_t>(80)); >+ Ref<SecurityOrigin> o2 = SecurityOrigin::create("http", "example.com", WTF::Optional<uint16_t>()); > Ref<SecurityOrigin> o3 = SecurityOrigin::createFromString("http://example.com"); > Ref<SecurityOrigin> o4 = SecurityOrigin::createFromString("http://example.com:80"); > Ref<SecurityOrigin> o5 = SecurityOrigin::create(URL(URL(), "http://example.com")); >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm >index 2e89e3608bd59273dd138f34d9529e2e2ab0be49..5be8466385f8adcb10997246f7bb99b005499e64 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm >@@ -59,8 +59,8 @@ static bool receivedAlert; > static bool finishedNavigation; > > #if PLATFORM(MAC) >-static std::optional<_WKAutoplayEvent> receivedAutoplayEvent; >-static std::optional<_WKAutoplayEventFlags> receivedAutoplayEventFlags; >+static WTF::Optional<_WKAutoplayEvent> receivedAutoplayEvent; >+static WTF::Optional<_WKAutoplayEventFlags> receivedAutoplayEventFlags; > #endif > > static size_t alertCount; >@@ -354,7 +354,7 @@ TEST(WebKit, WebsitePoliciesPlayAfterPreventedAutoplay) > > NSPoint playButtonClickPoint = NSMakePoint(20, 256); > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > NSURLRequest *jsPlayRequest = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"js-play-with-controls" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; > [webView loadRequest:jsPlayRequest]; > [webView waitForMessage:@"loaded"]; >@@ -365,7 +365,7 @@ TEST(WebKit, WebsitePoliciesPlayAfterPreventedAutoplay) > runUntilReceivesAutoplayEvent(kWKAutoplayEventDidPlayMediaPreventedFromAutoplaying); > ASSERT_TRUE(*receivedAutoplayEventFlags & kWKAutoplayEventFlagsHasAudio); > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadHTMLString:@"" baseURL:nil]; > > NSURLRequest *autoplayRequest = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"autoplay-with-controls" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >@@ -379,7 +379,7 @@ TEST(WebKit, WebsitePoliciesPlayAfterPreventedAutoplay) > runUntilReceivesAutoplayEvent(kWKAutoplayEventDidPlayMediaPreventedFromAutoplaying); > ASSERT_TRUE(*receivedAutoplayEventFlags & kWKAutoplayEventFlagsHasAudio); > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadHTMLString:@"" baseURL:nil]; > > NSURLRequest *noAutoplayRequest = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"no-autoplay-with-controls" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >@@ -388,9 +388,9 @@ TEST(WebKit, WebsitePoliciesPlayAfterPreventedAutoplay) > [webView mouseDownAtPoint:playButtonClickPoint simulatePressure:NO]; > [webView mouseUpAtPoint:playButtonClickPoint]; > [webView waitForMessage:@"played"]; >- ASSERT_TRUE(receivedAutoplayEvent == std::nullopt); >+ ASSERT_TRUE(receivedAutoplayEvent == WTF::nullopt); > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadHTMLString:@"" baseURL:nil]; > > [delegate setAutoplayPolicyForURL:^(NSURL *) { >@@ -420,7 +420,7 @@ TEST(WebKit, WebsitePoliciesPlayingWithoutInterference) > [webView setNavigationDelegate:delegate.get()]; > [webView setUIDelegate:delegate.get()]; > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > NSURLRequest *jsPlayRequest = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"js-autoplay-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; > [webView loadRequest:jsPlayRequest]; > runUntilReceivesAutoplayEvent(kWKAutoplayEventDidAutoplayMediaPastThresholdWithoutUserInterference); >@@ -439,20 +439,20 @@ TEST(WebKit, WebsitePoliciesUserInterferenceWithPlaying) > [webView setNavigationDelegate:delegate.get()]; > [webView setUIDelegate:delegate.get()]; > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > NSURLRequest *jsPlayRequest = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"js-play-with-controls" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; > [webView loadRequest:jsPlayRequest]; > [webView waitForMessage:@"playing"]; >- ASSERT_TRUE(receivedAutoplayEvent == std::nullopt); >+ ASSERT_TRUE(receivedAutoplayEvent == WTF::nullopt); > > WKPageSetMuted([webView _pageForTesting], kWKMediaAudioMuted); > runUntilReceivesAutoplayEvent(kWKAutoplayEventUserDidInterfereWithPlayback); > ASSERT_TRUE(*receivedAutoplayEventFlags & kWKAutoplayEventFlagsHasAudio); > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadRequest:jsPlayRequest]; > [webView waitForMessage:@"playing"]; >- ASSERT_TRUE(receivedAutoplayEvent == std::nullopt); >+ ASSERT_TRUE(receivedAutoplayEvent == WTF::nullopt); > > const NSPoint muteButtonClickPoint = NSMakePoint(80, 256); > [webView mouseDownAtPoint:muteButtonClickPoint simulatePressure:NO]; >@@ -460,10 +460,10 @@ TEST(WebKit, WebsitePoliciesUserInterferenceWithPlaying) > runUntilReceivesAutoplayEvent(kWKAutoplayEventUserDidInterfereWithPlayback); > ASSERT_TRUE(*receivedAutoplayEventFlags & kWKAutoplayEventFlagsHasAudio); > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadRequest:jsPlayRequest]; > [webView waitForMessage:@"playing"]; >- ASSERT_TRUE(receivedAutoplayEvent == std::nullopt); >+ ASSERT_TRUE(receivedAutoplayEvent == WTF::nullopt); > > const NSPoint playButtonClickPoint = NSMakePoint(20, 256); > [webView mouseDownAtPoint:playButtonClickPoint simulatePressure:NO]; >@@ -498,7 +498,7 @@ struct ParsedRange { > if (min <= max) > range = std::make_pair(min, max); > } >- std::optional<std::pair<size_t, size_t>> range; >+ WTF::Optional<std::pair<size_t, size_t>> range; > }; > > @interface TestSchemeHandler : NSObject <WKURLSchemeHandler> >@@ -602,7 +602,7 @@ TEST(WebKit, WebsitePoliciesUpdates) > [webView _updateWebsitePolicies:policies]; > > // A script should no longer be able to autoplay media. >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView stringByEvaluatingJavaScript:@"playVideo()"]; > runUntilReceivesAutoplayEvent(kWKAutoplayEventDidPreventFromAutoplaying); > } >@@ -664,7 +664,7 @@ TEST(WebKit, WebsitePoliciesAutoplayQuirks) > [webView waitForMessage:@"did-not-play"]; > [webView waitForMessage:@"on-pause"]; > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadHTMLString:@"" baseURL:nil]; > > NSURLRequest *requestWithAudioInFrame = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"autoplay-check-in-iframe" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >@@ -682,7 +682,7 @@ TEST(WebKit, WebsitePoliciesAutoplayQuirks) > [webView waitForMessage:@"did-not-play"]; > [webView waitForMessage:@"on-pause"]; > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadHTMLString:@"" baseURL:nil]; > > NSURLRequest *requestThatInheritsGesture = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"autoplay-inherits-gesture-from-document" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >@@ -722,7 +722,7 @@ TEST(WebKit, WebsitePoliciesAutoplayQuirksAsyncPolicyDelegate) > [webView waitForMessage:@"did-not-play"]; > [webView waitForMessage:@"on-pause"]; > >- receivedAutoplayEvent = std::nullopt; >+ receivedAutoplayEvent = WTF::nullopt; > [webView loadHTMLString:@"" baseURL:nil]; > > NSURLRequest *requestWithAudioInFrame = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"autoplay-check-in-iframe" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.cpp b/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.cpp >index ed3a2e0579ffd526a05a84ef390e2fed32ccb62f..e6960ebe608cb6c92d776a7800a6d2f4b2dc7b34 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.cpp >@@ -64,4 +64,4 @@ namespace WebGPU { > SamplerHolder::SamplerHolder(SamplerHolder&& other) : device(device), sampler(sampler) { > other.sampler = nullptr; > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.h b/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.h >index ba59d1dab00e3861e09a3da87d3c81b961d3d9e1..8fd69455b008e9d957ebe2307a1d2cc8c941e3f9 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.h >+++ b/Tools/WebGPUAPIStructure/WebGPU-Common/WebGPU.h >@@ -368,4 +368,4 @@ namespace WebGPU { > virtual void returnTexture(Texture&) = 0; > virtual void returnSampler(Sampler&) = 0; > }; >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.cpp >index 9fcfde4786750582f69c578cef8216a6ef7fc1eb..58590b0fef3ecc24ee9947685ea028fa4b45a7fd 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.cpp >@@ -53,4 +53,4 @@ namespace WebGPU { > insertTexture(src); > insertTexture(dst); > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.h b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.h >index e58221aadf7619b11065aa11844090efb0430cab..76b779b7b40f760cc95a6bd4bb0acf5514458765 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.h >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/BlitPassImpl.h >@@ -43,4 +43,4 @@ namespace WebGPU { > private: > void copyTexture(Texture& source, Texture& destination, unsigned int sourceX, unsigned int sourceY, unsigned int destinationX, unsigned int destinationY, unsigned int width, unsigned int height) override; > }; >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.cpp >index 35c44a9683ec22fd132a62c9a36e4c68d088082e..b0ff237555b04521b17aa5651275da533d4fb659 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.cpp >@@ -45,4 +45,4 @@ namespace WebGPU { > void ComputePassImpl::dispatch(unsigned int width, unsigned int height, unsigned int depth) { > commandBuffer->dispatch(width, height, depth); > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.h b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.h >index d1408d9303d752ac017930dc097c7699489010e1..0838a14eabf2f11db360ac51ae88f52066616ce9 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.h >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputePassImpl.h >@@ -45,4 +45,4 @@ namespace WebGPU { > void setResources(unsigned int index, const std::vector<WebGPU::ResourceReference>&) override; > void dispatch(unsigned int width, unsigned int height, unsigned int depth) override; > }; >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputeStateImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputeStateImpl.cpp >index d6b2bb401c56c948f452d5fffed00c0b8221d911..dcc0db868023262bb81480be9b7ac4f75d3ae80f 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputeStateImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/ComputeStateImpl.cpp >@@ -28,4 +28,4 @@ > namespace WebGPU { > ComputeStateImpl::ComputeStateImpl(vk::UniquePipeline&& pipeline, std::vector<vk::UniqueDescriptorSetLayout>&& descriptorSetLayouts, vk::UniquePipelineLayout&& pipelineLayout) : pipeline(std::move(pipeline)), descriptorSetLayouts(std::move(descriptorSetLayouts)), pipelineLayout(std::move(pipelineLayout)) { > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.cpp >index 1263972b26ce5f3207f4ec5d130cc86c5d71f352..700df1288d9a6f4767f2cb0c5337d9b5ce111d6c 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.cpp >@@ -83,4 +83,4 @@ namespace WebGPU { > readPromises[i].set_value(data); > } > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.h b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.h >index 292ef57e3980318d728745fa0d28e325d5fbcd81..8a9358c0dbf4fd0c1a0ecbe274f0cef7b6d99d6b 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.h >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/HostAccessPassImpl.h >@@ -55,4 +55,4 @@ namespace WebGPU { > std::vector<std::reference_wrapper<BufferImpl>> buffersToRead; > std::vector<boost::promise<std::vector<uint8_t>>> readPromises; > }; >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.cpp >index 8345abdb363d4a40d15cdd4ca6a09ed030954b4c..b176f7a8bb1484cdeb29929be345c4bf24e6beae 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.cpp >@@ -179,4 +179,4 @@ namespace WebGPU { > if (samplers.find(reference) == samplers.end()) > samplers.insert(std::move(reference)); > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.h b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.h >index 38c4f84c0213fd45f950bb3d95e7155d5f9d372d..7f174a08867243fc03e986208649b46d4f7b4bb9 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.h >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/PassImpl.h >@@ -118,4 +118,4 @@ namespace WebGPU { > std::unordered_set<ResourceReference<TextureImpl>, ResourceReferenceHash<TextureImpl>> textures; > std::unordered_set<ResourceReference<SamplerImpl>, ResourceReferenceHash<SamplerImpl>> samplers; > }; >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/RenderStateImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/RenderStateImpl.cpp >index bd7cf606ab8ea4bf2bb1ad2c279bee343b541ec6..2a7f127df9d69cb7068b0214824c60834f95339c 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/RenderStateImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/RenderStateImpl.cpp >@@ -28,4 +28,4 @@ > namespace WebGPU { > RenderStateImpl::RenderStateImpl(vk::UniquePipeline&& pipeline, std::vector<vk::UniqueDescriptorSetLayout>&& descriptorSetLayouts, vk::UniquePipelineLayout&& pipelineLayout, vk::UniqueRenderPass&& compatibleRenderPass) : pipeline(std::move(pipeline)), descriptorSetLayouts(std::move(descriptorSetLayouts)), pipelineLayout(std::move(pipelineLayout)), compatibleRenderPass(std::move(compatibleRenderPass)) { > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/SamplerImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/SamplerImpl.cpp >index c615e8926edb509909151bf9ef103f8ca9e23fe5..62887244df7694280868be431dadc90c5373d6a2 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/SamplerImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/SamplerImpl.cpp >@@ -33,4 +33,4 @@ namespace WebGPU { > if (--referenceCount == 0) > returnToDevice(*this); > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/TextureImpl.cpp b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/TextureImpl.cpp >index b46d86ae0d03dc9722b2fb2fbb8bfd7e66a5cbb7..10b360593956d104f6932872653759dab3b35915 100644 >--- a/Tools/WebGPUAPIStructure/WebGPU-Vulkan/TextureImpl.cpp >+++ b/Tools/WebGPUAPIStructure/WebGPU-Vulkan/TextureImpl.cpp >@@ -33,4 +33,4 @@ namespace WebGPU { > if (--referenceCount == 0) > returnToDevice(*this); > } >-} >\ No newline at end of file >+} >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index 8822f15d0a5e7f91a3bba47fdbed0eadf0282a2c..10b734402f2f4c00314eb35ebd26ce1319b33804 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >@@ -301,7 +301,7 @@ void TestRunner::execCommand(JSStringRef name, JSStringRef showUI, JSStringRef v > WKBundlePageExecuteEditingCommand(InjectedBundle::singleton().page()->page(), toWK(name).get(), toWK(value).get()); > } > >-static std::optional<WKFindOptions> findOptionsFromArray(JSValueRef optionsArrayAsValue) >+static WTF::Optional<WKFindOptions> findOptionsFromArray(JSValueRef optionsArrayAsValue) > { > auto& injectedBundle = InjectedBundle::singleton(); > WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page()); >@@ -310,7 +310,7 @@ static std::optional<WKFindOptions> findOptionsFromArray(JSValueRef optionsArray > JSObjectRef optionsArray = JSValueToObject(context, optionsArrayAsValue, 0); > JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0); > if (!JSValueIsNumber(context, lengthValue)) >- return std::nullopt; >+ return WTF::nullopt; > > WKFindOptions options = 0; > size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0)); >diff --git a/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm b/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm >index 50e7aebddee7d2a3da2f8c0aaaa4d46fb98340e8..829261bef5da6cc2da6179c9890af35c78a8c9c4 100644 >--- a/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm >+++ b/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm >@@ -823,7 +823,7 @@ static inline bool shouldWrapWithShiftKeyEventForCharacter(NSString *key) > return false; > } > >-static std::optional<uint32_t> keyCodeForDOMFunctionKey(NSString *key) >+static WTF::Optional<uint32_t> keyCodeForDOMFunctionKey(NSString *key) > { > // Compare the input string with the function-key names defined by the DOM spec (i.e. "F1",...,"F24"). > // If the input string is a function-key name, set its key code. On iOS the key codes for the first 12 >@@ -836,7 +836,7 @@ static std::optional<uint32_t> keyCodeForDOMFunctionKey(NSString *key) > if ([key isEqualToString:[NSString stringWithFormat:@"F%d", i]]) > return kHIDUsage_KeyboardF13 + i - 1; > } >- return std::nullopt; >+ return WTF::nullopt; > } > > static inline uint32_t hidUsageCodeForCharacter(NSString *key) >diff --git a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >index a9d54ad6d2540064da32867690462d0026a642ac..fdf1decf521a6799f8d3b769b6a2c841784a2dbd 100644 >--- a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >@@ -549,16 +549,16 @@ double UIScriptController::maximumZoomScale() const > return webView.scrollView.maximumZoomScale; > } > >-std::optional<bool> UIScriptController::stableStateOverride() const >+WTF::Optional<bool> UIScriptController::stableStateOverride() const > { > TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); > if (webView._stableStateOverride) > return webView._stableStateOverride.boolValue; > >- return std::nullopt; >+ return WTF::nullopt; > } > >-void UIScriptController::setStableStateOverride(std::optional<bool> overrideValue) >+void UIScriptController::setStableStateOverride(WTF::Optional<bool> overrideValue) > { > TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); > if (overrideValue)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192728
:
357360
|
357374
|
357376
|
357377
|
357379
|
357407
|
357409
|
357411
|
357413
|
357414
|
357415
|
357416
|
357417
|
357444
|
357445
|
357492
|
357514
|
357519
|
357521
|
357534
|
357769
|
357772