WebKit Bugzilla
Attachment 357409 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-20181215164625.patch (text/plain), 3.01 MB, created by
Chris Dumez
on 2018-12-15 16:46:29 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-12-15 16:46:29 PST
Size:
3.01 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..445cfdd407d82c3c9a6a105e75e711d750fc8e26 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. >+ Move optional 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..4eaaab4ebfb819303a591c9616d6c8ad42bef818 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..e2506c3946f7f1fdded40256459e7699153d7e11 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..cb1fab9f5fb08c0b120f1b7f41e6bc9c3965312f 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..198338e32ab7fb99afe893e96b93121d23d1b03b 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..23e8b6ee43dae0d602f867f9db0e49d322866398 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..a6032bb60a71cde95dd419f7f45fcf7ecd427386 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..4e6c603b7c8864bfe92a36bcf30f26839c07d3e3 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..31a95c29cd821bf71f493ac5a6d0cde956251ddc 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..cb7de0b5545111ebbf3eeb59ea30e55efbfca51b 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..debfb3222fb0d835dfd09cbee429fb47670e3f33 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..5c513995a0cf16c413cee7052232d5673330739e 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..3cd4ddfa73561bc1275b3b8df16f9def93bac50f 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..f48f775ad68d4d7ecc725b8cd67cbaa44b8d0a2d 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..b79ba400d3472797f2af5189fa503a3db10b99ab 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..d66f6fa5fd73213a9e299bde63bed012d7aec470 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..56527471a63411bbf6c54c9809b79b1c1ececc85 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..6a90d97465d0f8b92b2f710eda54c6e8243ecc5b 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..285969f08e981cd66c5dd4a008beb32a4fb14485 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..878284f971bd8b9d3578d711ffe14375e29fd8b6 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..6b0a2afa1ea3c4bb020e953f4c720f697db8a9e3 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..d8590f428aa2036ec8f05306c2ee7f8129f30a47 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..df59c6d3f4ff225fb2dbd925b506018b50570f96 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..429b5a4f1300c0d6991d78f8ee0785557bf95d63 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..1007c1089d0433553c33fba7f9aa9e4f546c7b78 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..50910d01c2486201b62156871784e6f8db648df9 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..26f379d5680915fe40ed11e88d79fba3a3c3bed8 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..fd0c53b9289dba67c7a0e40dc09528a011ef162e 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..7fef0203198d2028577507f554f48adbb80eef90 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..96f967eb36d0c3dd1ca82e5f8ed1a1f31244c873 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..2509a7ef5656f47261223c938ebe40995b0492ec 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..1703a25ca78d77808d5cf21092d54c7f93e8d8e7 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..f698ec01af939185f655700c9275591710183edc 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..4c435cb0a8e106f24851a37d260ca54a731f2924 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..265dcac8285c19c448fe1c958c528c41a786082c 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..420600dcd0f068263b5bc8887400ad64df9a6113 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..82960257c104b67844f2914ee324b2059b07ed4c 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..90a55f6b1042868cd29640a1dc40e1d2eecb9e80 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..7a1a308d144299d44277dd45f1c558bb79a9715c 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..47088348cba5dfcf241f2308e0c6f0093b22cc76 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..b7a60eb229771be82b6ab814bc5aa1ef8a3c8ef2 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..0037f6ec0f60b9640627eb95d14faaf69c395eb5 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..faf450c4ff6e154b8c9d31fab86a83cdd74a91d2 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..842d0b452af4169c855f4bfcee7a64e24ddd2415 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..6504c19aeaa5000b01fdecbeafd8e3e4caf9221a 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..e75757ef42594642423304e46e8c73f141759bf5 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..344fced7d7e4fd5544fad732658b3669ff8719b8 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..206e29572d06028cf408d437df8a09a79c25657c 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..58ac20094e53f5f14c20a6dcb383cc88e11fc2c6 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..79d417ebfe96a2e4df77fde5483552c7dd43a22a 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..5d0e017ede5d0040f5f245f114c0afb75cf7700a 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..d02f13c9f228c16e7adb2d63bbd20b02816ea6a4 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..602b6b75152eb2a88614b30958370155c6324951 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..d63cf301166cfcefa5ce7466e805a93dd2edc2a1 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..a542c7be568e9e47fec16302513ef28379859235 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..bc0c0f88dd4bb1a587961e0e6dd29d6a56067b4a 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..74869711f152583c3e687aafa679a7afe4544643 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..1688bea2cfb465de98ff7980a8bee2ff04496edd 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..854ec40a9143e485f268070d942545db9404fb7f 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..02e6546ee18f3fac9518d59ecf8de5705ae246f1 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..ac44090d4c6857f83cdad33c5050c6ae7297b83f 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..9c461ff7f28280202f6f2e311bcf33da985e8377 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..2e8f6a51faa3733416547da6eaf299207971e476 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..bf5e5eaa1cc8f361961a6781cdf3928bec487653 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..6352815ba632d3936f89e021197e62ad620a59be 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..3c4c8a267d64cfc4ce822bf0b82fc83326cdde52 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..fafff349ec2419326c118ba27e4e4f19e6f6e596 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..5c9be076a10d0e51c9d2a0169fda5d2797f33505 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..220d2e396ea45c3d373aa117e512e8c5da9b6f35 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..24a08ccaca595351d1e5fa6b019af104a026d7f9 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..e9e38fbeacaa0b68c7aa0bce7a87cf1fca7b95cc 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); > >@@ -276,7 +276,7 @@ void BackendDispatcher::reportProtocolError(WTF::DeprecatedOptional<long> relate > if (relatedRequestId) > reportProtocolError(relatedRequestId.value(), errorCode, errorMessage); > else >- reportProtocolError(std::nullopt, errorCode, errorMessage); >+ reportProtocolError(WTF::nullopt, errorCode, errorMessage); > } > #endif > >diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h >index a34d1cef40bcf51d43be34e267eb6050a72b833f..5548d5edc10371440d8931354ba59ebfd30248c3 100644 >--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h >+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h >@@ -93,7 +93,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 >@@ -125,7 +125,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..44fe969f184b0518362cef44804bcda6b2863a70 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..77f0a1939ba0f498e85b284a9ad7f58991f411c2 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..b36674e95f6c15b3561a8b769a2d87d61bfe8b4f 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..58ee53d87ba51986ee75614e295c72e3fbb307d0 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..d210db9bc4bb9fdebab785d8a74ac7c29e0e5fe4 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..088fe3ef7fd16bcd3dc0b9d2b88305b189e95dc7 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..ff5ffdc5d90c7feeb587cdcebc55077b00196f91 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..b8f1d218eef93046d460f809375fddf9885103a2 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..b7ea1328a1a6960924b2ca04cfbc5a1f9004cfb4 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..974e76165ee6136a408d2b89b81aace084fa5035 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..37fc3a61862c9009198c1742c3ef8ccb98ab8013 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..18c355492e79a8d9e31fefb2b117a23666ba02df 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..6c1a02414699fb48e196fb11f1e46c56decd0652 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..17044718a374d0b2aa7051205890662481c5d190 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..3a0e262c6d9aca790dfc69f2ca057f1298ed2d4a 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..3ff9f3fb0e01c5e1f6bafd3ba78b30c484308daf 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..08f9c844828e9e190cbdf4c07ee2c58fae206294 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..8996020f529039b820ef5a76115e889a503e9b79 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..9647b8f0dceda5608f78aad95b821aa87e8b050c 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..866389e4dfc6362815cc7a39812e2968afd01dbb 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..c19ec94ed11a4eba9e8e4770999d60986fbee448 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..be9ac114e66f740fec6e4347d9458422f569cc4b 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..f3f2cd697256870c134c618679f83358237135af 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..85c681c5bfed3bbf993ae5d3493fe5dec836b729 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..c8a03d9c794a74308be0616c4757b3c59987349e 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..06a637a7c9ab122349498559764fdf4c797f4466 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..13ff1e78ba22317b48b9fab80bb3fd8cc3e581a2 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..6c442b2c2d20e881d0f48b1a807243a43248a114 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..522a3b50d706cb097b3d9c78cb03d019620e0eb2 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..eb12be4b2f74f300ae4b32d9ccacfe07e2ad7c4d 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..de4cdea3f599e143272e6dc20086aa1a23e9262d 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..e5ed53519f04afdf28cf38d6770b2340f187dccb 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..2ef238f2814ba7745da7fc516c850538af5e4f7b 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..aa5e08893a39787e121202c18e855f252b920d23 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..82a29e9a8d228ca1c1b966229e27f348079a0ff4 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..be9ac114e66f740fec6e4347d9458422f569cc4b 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..9647b8f0dceda5608f78aad95b821aa87e8b050c 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..9ca81838c7c5e9966f06d9347e68f2c855b483d9 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..3a9de2d9d128ed65b95f93571b61c4cd68a88713 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..fa3f3c95bd5cdf6fd3373eeaf9bfaf0c8ff50f98 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..0fe71f53970aaf3f15db43c482c1302861640ee5 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..6d650b0e9bd487d415a9613bbbfa9f17fd29dce4 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..f68a1258a349fff01bfd581820165bfe5ac550f1 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..8a94b223c1978018b1967fa6ef5416cf922372e2 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..594aa282c054b4b1183da66763d7e52d059314cf 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..00a3bcb62e3c09334fe8dd829fba56fdb62659a5 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..7d43991eaf3fd2338b0c46a69552d96483ecf712 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..a21cb58da2828028179bad4d8a97367bf85205da 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..34973dc76268ebff29bc8dcccbd56dd8508025e6 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..1fd7e8291f91f23ab270efab2930c3abd2ef41cd 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..ead8bc3f5ff8aa834e283af870e6b31d16878fb7 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..a1c80dfec29c05ee47f643fd5923a88cb72b0673 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..c6e7917def1b71c545018382b887af0a54e7a337 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..021de9a5e2d509032fd386c55372682d9e925104 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..b6dee254e950af96077d7f945698e6d1a6ddf178 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..49b14e74e42c7b3662b1517917fa4bb8426a4e59 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..cf525ac3884babe0aeca00f3a326dd111c665227 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..6239973b6f9e1331c3c2a0b25532baae2d026419 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..9fb957672a37dde30f08397461719653f83bd899 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..13407b9313e66ab46299a4a6586984d730e90ef7 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..eab6c77bd6199eff5d29b3e9ad3b6357f1f81c6d 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..57a04443449622cfb7f004ef65e4fe4e9e64ad10 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..c9260afc52de2197e8ed28be0128d37eee3a2fb7 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..ba4c370af1aee46620f67e7d6b68fa4aaa7e8d56 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..88af3d0b5c2a11330776678e4fae4da79d259a23 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..7735e4ac09f5105b27f6772a53dc4319acd30819 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..6df8ead7d179c6e4c8199be05ff2c5e530434bc8 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..1e9e3234b13c2f6c013bfea87545ae820ff3fe36 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..da1c60423dde1958e903b7aaf223130e959f8307 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..ecf0d521da9bc07e2eca0a6cb08dfc750c27c778 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..31432595c3e3a08bc0cded2bf610672db9ab36fd 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..67d139d260bc02c28c406c976df2cfdcb64eb01b 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..38c78f7d2ab1a7f734a9bb001d4eb1670cace93d 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..ea0b8dcb41328a789ef754277726d3b523878f6c 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..c4ecb88ef4670fd5807dc0f898bf4d6003657eba 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..860e344f06bd2566b7daa4828e35f42514b32b00 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..0d0c1f37782806c0cb76f72d8a60532239719f55 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..159877aa78744b3c0805ef741dd2636415db62dc 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..53c3f429bc1b20a85234e4ce6d81ce10b8e805e9 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..6643e434d4958ef90c72aa48e9b218d343cc6f02 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..b703948fc19321cdfaa8604b33d49536ae777a58 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..c4f8207758368e4357039fc19a654d8629938ab3 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..a6cfd429f3555a6dfa5f66b33d60a231dbc21edf 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..9054d9d9e0f8a01fdb646a2db6a6c357a63ff8b1 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..97b633c9a01ece53b9132677d3978fe3938da0e3 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..e824ba793651393524b6f1f06c1ea719adb0f3aa 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..3182ac9011b6f7b76cc9caa125770a7069554291 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..846f7eccd524a30789412d4855e8e56d615505c1 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..174180edbcb7cfb4dfe3e31003982721a85b3d58 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..1f898cc4655fdde3191085ab991e01e8b6da6acc 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..3f03c1f37a1acfe9b9f7a40950b6be664f534fbc 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..c0dfb81e0b88124f6529252c192e2e332facb457 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..56a39b155c2607ee68008404b3f4f522b0876eae 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..484c90cdfc6eb8a8fe3ec3589a212b8e3acc5632 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..c7dfcf96d2eeb8e61699bfb50b9bf3a64eb46395 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..c0c4c70e48dd28a1aa97deec68301fa4088a65cd 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..9e5d4f8ad80b832efe76858287f2c150eb0b057c 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..16eb079d73d51704b0f9cf0c024887aeaeff07ae 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..9ec28eb6ab3143a9a5eb44e96fc2d85c1d6b51b8 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..bd72f16b09cec7dc7b0588e397b46bbbf0b4b725 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..b4afafb1255c8624147cc141977f9be543510284 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..38467838ddfde4dffd48c1f9ea64c48686046e85 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..587a1b5a8d46c7871e94524eb778afd72ffcd368 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..3efc9bbf0bdb3dd498f4b0775f747df83fa2beac 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..da0f0f028caefd9aabc8bf3f8ae6babec6049f75 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..8cf2f18aebd43ad1ccd1b136db4effa33527c5c9 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..0244bd6c05021f6e40be853321a4518630014e16 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..e5817c43206cab0a4a3fd77e53ae87f9a826dccf 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..a4bca60d8ac49dc2b9313414187bb9436a1a133b 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..928624380b5a99b4dd61c635c8ad1c13c97ef028 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..a150f327343ea37d7f18e07f98f14c6fb5f2a555 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..d0514d61e242bb81c0ca42ad094c9f047aa4a24c 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..63b52e479db789a6c33b6ab1ad6497c6061320bb 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..d9ff3aa13f3fc5fb9ea2f19b9ee3ae6549c61ecd 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..5b22353e0d17650981faacb776747673179ecba5 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..196756efdd7bc0dc5daa2718db7cc2d555c83a33 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..e5c734470f2b9a8f90c688f980ca06de800437ba 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..2b9063f0f32b0c38ea78b1fef2171de05b991076 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..04d7f147268774c69b4ac9c8baa927118bd23e21 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..d34d0188da21f81b4726c15a5c9df0d3054b4ecb 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..e8a3f5cd2d44b5cff700d3c81c371e15d89e3b3b 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/WTF/wtf/CPUTime.h b/Source/WTF/wtf/CPUTime.h >index 6ac3fe7d5db1ea35d31a5d1f3eb8c4a495a850df..213f612be4658165121ac7359b8d3b9b1398226d 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..6086afa6c16f35d1f37c91d4b73d1842a8ebdbff 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..bc5c4402021102c06938c8b560282f9f7a777d31 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..070ed8e24e8f952765fe56c4703916d84c289d92 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 >index f5966e3d7931b4bdeec95e42ca4f47faccdfb479..837637d0a2e102b3ddb1ffa46999bd43dc2e3c5c 100644 >--- a/Source/WTF/wtf/DeprecatedOptional.h >+++ b/Source/WTF/wtf/DeprecatedOptional.h >@@ -25,7 +25,7 @@ > > // 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. >+// New code should use WTF::optional. > > #pragma once > >diff --git a/Source/WTF/wtf/HashTraits.h b/Source/WTF/wtf/HashTraits.h >index 3b7f30e1c588ed5300488c35bc7e8f65c4028085..cfc079878bccd2564809efa06465762bfb79fa8d 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..47156ff1bfb7ca326c64a64b887bbdb8057bb459 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..fcdf891250bd9742146b89b0e8ee906dd5eddee6 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..3ef2d87a23d286eee5e5c2f52291778228b77fc8 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..a424ee1bf0cd6d771a3d2dd89e39118e05925969 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..6f17e34d08fb8d41cd68d732019108fc58cbbced 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..2369fdc43ca911ec8e19f9b35619c5ad645b356e 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..fe64f5ace15084f5a25dda5ca98a169412885e1d 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..7af578fcb24582acba44c13350e1c99b26980fe0 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..3c18e40317b5fe199236e878bca22aab2475fe64 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. >@@ -319,11 +319,11 @@ struct optional_base > > 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(); } >@@ -342,11 +342,11 @@ struct constexpr_optional_base > > 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; >@@ -365,7 +365,7 @@ template <class 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_; } >@@ -424,6 +424,7 @@ public: > if (rhs.initialized()) { > ::new (static_cast<void*>(dataptr())) T(std::move(*rhs)); > OptionalBase<T>::init_ = true; >+ rhs.clear(); > } > } > >@@ -432,12 +433,12 @@ public: > 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; >@@ -461,8 +462,8 @@ public: > __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; > } > >@@ -580,7 +581,7 @@ template <class 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: >@@ -596,9 +597,9 @@ public: > > 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; > >@@ -993,15 +994,15 @@ constexpr optional<X&> make_optional(std::reference_wrapper<X> v) > 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{}; >diff --git a/Source/WTF/wtf/PrintStream.h b/Source/WTF/wtf/PrintStream.h >index 7a32efeaaf4cb27ade4ab6a4a3686d9c163f59b5..cbf87d7d256f831bdb25cd8d93652658e472ce52 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..1f36584e04ecbf54ee1d3815615010878b3117b9 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..b38dd59631bf22fb27487ab62101ad59abdd327c 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..cd5b3c1b245a93172285962bb938d0187f1a3f90 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..9612c1e239e1ac55e32b3abdcc0d2b786fe6b251 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..6436d22c78df108f1e078de59dadb441b054f9ff 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..cd535a3e5597520183927f9005785917265d42cd 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..04a2015c29f1d5352fdce7d432beb1cdef81e55e 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..c29b3fe76cb5b16715a8670c687d8caa2c77c0da 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..285d11400fa409e1d32575364cfe3beb91f3f2e0 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..d68f6916ec543cf2b091f7e8f2e6caf49f02c381 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..f6d4a4c6d514e10aef8726bee9e6a711c7076de8 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..3ca0a152fa32f08a5c614af0d3b41d2118a316e2 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..b09f368111069bcec000010cfa0d263263605901 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..4a97533e9e4f8509e8160cd2a647f1efe887513a 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..351b52032839d33496680d8a3f727b46f6ef196d 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..33dd61124f47336362b7314abbffca8b2caf7ea9 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..ad02839500b4446fb8acfad961fa9ada3a00df37 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::make_optional(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..f9a8612272b44cfb58017b2b38e082499e44ee33 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..e342f89b003b2e44353659776d22f8d28cdc3c77 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..e34e46add2f556b0756581c665424e8a83c31a03 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..085b8e6817b73b6c00c58c9388c7709f19b0ee37 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..8ff65699be585c722249ba59c9385629781a7f93 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..16184bf12a02463d3e672dcd938e506fd7b79bf0 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..5b54a53478bdf59cb6eff1304c0adaf10c90f984 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..78e7d58a6f973d7c548e685f03a1f5e81d44b888 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..8f3a1031f2825f0e284e8976bf7b324778e315ea 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..ef19dc8b8400735722d8a76b0fb998e1dc6db667 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..fad74083469076518c62fe4c9bc09195a871a45f 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..789cfb9f25e770bce0cb636704dd0702638f55ef 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..c5ee2a1e1063ddfbc40801853fb9ad3cf9ee75ec 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..135794fe118193c46440a3cbb4ce999461f89bae 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..6f0b887f4535c517a0193b34100581043a2afe07 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..17cc938cea474a83103fb872f91b9f52e96a5264 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..e5411b8bf2b8bb9ef2d29f4e3e1610b170bb74c7 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..5ce28e088e89f2611c775b1f6c46649940864e3c 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..d169f9008795506c5b0dba1b525a0ac8cd0be294 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..e4498043734085af8fc080b94f901c01fb1f8ff1 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..65fc5792aa40768b94ab356d4baa0045c3d906fe 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..2db4456556757953c1b37ecf54c94d9989e4b8c2 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..526f0aa4dcf6c1629d7c7d90eba2eda946601757 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..c9e02d4d64d4365d0271bbae2d53144575dc8f50 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..dab45a9537351b3d485fb431ca6e0da9deb21ee8 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..9c1726306ca1f6806d42fe4c5ca35c7a3634d97b 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..3fd5dee63a07f1783b405c7a72d263c037c6f8b2 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..879be55630250b4902f1cd1c47edd8e2ec0ce1d9 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..1819ddd946412bb97842a77c0a80815bd18ea92d 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..ca3a25a10dd1d581c77ab6a073e1c5a787b07f97 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..0be6f8867997877562992017e980c036304da598 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..b0ae47a01066105d1333f60cb5fa4a8a5a1dc9c9 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..03eca3c726848f1c5da6c49439cd9313b84feae3 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..fc50472c8d221d3f98e0d99cc56664e6f9cf92dc 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..63600d34b26863fe140207236e2a6f063483e598 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..833c1a30dc50ef21eaaf275549b82369b9325ed7 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..b7fc059ad838297256c6b9917991eedd31e3965d 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..3862dd009fec4fc01a260b9c65b89fabfe743573 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..e88d873d9b5ae81c9662c840245c960640b20935 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..9dddd97de8e02e5474dc96872c331a5bc3064d15 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..8e204a7b71b836c5cefa18f800d7775bf0c2aef9 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..ba6ddcc194c2a7f48da90dc995660bf80fe0e309 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..dda7c93a66f082c7d7f40af542196c0b06fefa75 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..61bd7f04f11806c1521cd7e4715816dab01474c3 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..26e0ea05118d4c91eafa23405b07360a5a731f08 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..c2533262b4f6b24859d33cf7d9ed849b83b49a3c 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..400fd1caeb77f0290d71ceeeb7e4eb023f9a2f91 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..11c1fb70065ad523c414612ba8fd2fe0d846ef06 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..301924440c93d846fc332f210318bca55bbd5e6c 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..b114032d22865ac5125789bff5e927b4247a38e0 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..79c3fc1084f44207b24b7ca9333afa1833c47b86 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..4954d643782e73d844cca1ce5468f489b724511a 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..a35de5e31255abb047d9622f2df99c211c8584fb 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..3a138c7c1f29b3e7c54e082867ba831c65f46cc4 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..59ca980c4086c53f11d3df4f83b83a87866f2388 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..aed87e788ea11c32ac37a048dcfe576aea131391 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..ddf9bc972d573e2a5cab220ddbc9d2f0ed775b59 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..761ae4712e4593bfd5bf9d04cf8126e3c984c8b2 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..e615eedb8a18fbfb01e841b6f32e77087362f971 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..9d45b49ef45ed9185c9cb4ce9db5e90a98875bce 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..89dbfb60ce5c06358c07045d5242c59cbec4e5e5 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..5f604c870706829aaaa87df53230d55accf0a71c 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..bc63df4337e2fa58e09bb4b5ac42192dfd006713 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..879ececb3e65362c776e3d677f880118c0d49b2d 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..0903fe59c2388fb3130856e6cdf9404da06fadbd 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..a7ac7ce4f4728178a4b536c5e618a04e1287777f 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..a387f957ceaeecd5fac7445383ff7d07d2696d99 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..35908ffe000acdd2f4ff42e8746cc78a08fba6e8 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..4ddaddd10521b488f29a6925e72bad1e9b982b0f 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..3fe62ff74fdfcdb74f192bb58018798100e7e193 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..c3a1f8a839d38afd99b8314aa05c1a50f71c5bfd 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..7d1c5badd9f7a70ad7857750780541b63e9b72dd 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..f5f55fc6344d96a651eec9b599e667bcc049e8a5 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..53f048189f571ace4cb9a21cb26e123be42fc8ff 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..874687bb77b68e129ae2cc58cee3dd43be728fa9 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..adde6b9281a932c1eebb755a78b7bd5f315b23b6 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..4f2fc51d9bf6c0dbe669fefa11146924cb37ea5c 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..3d53d734d8f6fdf0447325fa849e9b836bf7110d 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..b77e33573efd4278348a764eddd9ae1ff8b21462 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..5110916904599fe02e190543e6429eac5d218725 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..f7402544972c9cfbd24d5b84a2ef05f19bbf708d 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..b0217c1e437dce1d83cd48163b602b303e46f98e 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..1b84af36b4039fad6eddf4471dbdda53972f0516 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..ecd27494af94a7a23a63825bd805022551b00660 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..e6704d75f5d20a42eb54705b49618b36dbbbb066 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..0e10509b27c213ecdf02b8321237675bae0bd8ee 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..ab983f8b698c5d7cf33fd64a3489b90d9b6b3610 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..cedb1314fddf331c82e568ce75788338af49ff35 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..14004c6f6ac57cdde69782513607742b3406367a 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..38d05faacce8a5af81f60060ffb3152faeaccf2f 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..963618b88b24defe6c84c4a037bb450b52d6f166 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..1d6612518ef9f057d5db9f76c8093857a10ffd11 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..f874b3039cfdd142f9e4a3f7108543a74960ce06 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..e3eb5ad75c56723530e023278c81176bb785e453 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..14537f815f211517779e8b04e6c15ce65fecef33 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..84491e4f7dd8111d4e5454df9cc191dda5294ae0 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..534a1cdf4d283848fd7e9a8fc275eb793a26eb82 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..27065edd0d54e492ac0d9b7ede3e2b760bce9ad4 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..f9b432e398a084d4c71c42ccaac4f8bcb8a47a1f 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..ef37c95be629e34e973326a975f768a4ea389f84 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..d46363dece95afc9c2da6d9b661605597339a7e0 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..6ba70f84ad9db36e6ee2eb41c2ae8b61493cb772 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..7e6dbd3461f012db826eba978bc0291419801349 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..b8d1982a46069d54b217a7ec362d3c9a2b357204 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..d2dfe2c83b94a9ee81b61a295c32676d68675a6d 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..9cc433635e926461d378ca72e515492f14f55d79 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..72d19b74a3e7fbf6fcf04b3139c7d1520a755388 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..423f826476aaa22e0cbe7d2404ccbd9d1b1d904c 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..9e22f10d4d61bf39bd2dd3d11101ecf72d81238a 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..9f0926348f28fc629e77e412d517558b7d3f2fc7 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..be799539eb56260ebdde2633adb38f5dae84672b 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..2e4f0a47933cced412de7703e0bf20a14f8beb68 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..6a38dd7aa83380a6c58d5e2304b6e0142d2255b1 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..dbd5bfe0c190c2522678fea42963467cbdfe6c31 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..40809a4feecd76931d208e8d155247da465253cb 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..6fb7ed9320252c75f4425c15ff9995b0e6beea80 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..78b2f18cf2d46f6b1a0e8c94538cf18c611f274f 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..c1838b5aab655efc06a6ae899932996eef077938 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..1357170b225f5178a35d827c6f75110750a9aa61 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..31efc24f3f3daecc8a5b25d0cfc68fb6643282eb 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..7172d5afb00e00b32fc5ae138e163aa844821749 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..6fa20dc313b60a5d56bdf6659291306856ccc646 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..547f38ef60fa329cb1e2c90abd632481a050d479 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..17852543961509589c3eae76a327c17535891f43 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..435246649eb6c9bee6750b1d9bebe8d068c34b8d 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..8e705c8e290930a1e918d74424fd578e8882fa6b 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..4dc000dc64295053e7b3a3673557e12a2625cfa4 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..bfc54abcb8aab7cb02271afa128d566da119961b 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..eff91024cd9ced981c1af10c08521a177bc6e46c 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..697b9ef284ca1b6ca6272bed80aeeb868839c9e5 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..7435524555fa376e045c977b05e8954d66a258dc 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..cb1495710271c70334e651c9763fb0171c9c8cef 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..94d91562c9b117228e8b3467e6334d7669ba118a 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..ca9b70768de1e5e13889afb722b9b697da0aea96 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..fa9078365b527d32cf80908f3824d13fe3ad39ec 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..d16f3cc4eb8e28f190a1dd44bbf95d4421dc9dde 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..45c9c8210e5ca3fe33284c51c00c1518220dc9b5 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..7e8cf89b13c74b99651616a962c7e81aa903a745 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..ec2e08bed3b664da12ba3c90605ea51f2da0382a 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..17728d6d84f06ca4789b76b516b4910551249af4 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..3ef1105191490c7f9db8ae82cf3baa0a2a5d4082 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..abda3563d1142c608bb82ef2734cc01443461e96 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..b2ab8f1b65eb77d4d22388002281a876418640e8 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..eff47e0859d6fa44e11ab1ee15628b5dd7b719e7 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..4b6bf549af52f1b559a869892fb0e29350c51d7d 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..58352d509d8a1b2a1b76dbda28b8a5f07418ba72 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..a38bed53f003f0ae7daa067619108ab5a7d57fac 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..805c7d13c30d89d60007b2c8054e1dbeedeae5fd 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..d81a87f5a49144c1c4de1ff4853ea7e41f9ae048 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..e92ca3f6b03f78a35d1221ab9d71911b93543400 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..5e6d9b96f3b7045ecea624c00db758d2434988f7 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..9090c7d8ae1211a7105dcc949181459a7bbf0da0 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..b73c648b16728ddf2214d0643d603949f96744dc 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..3c4dfe0763b611e11f1d220e3ffeaa456b59b743 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..2216ff12effdf6172d5574d481bc0be0eb7ea224 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..56dbc4cccfbd382cfee742fefc49655c8db332e8 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..656c1443162d4343567592bc978455e28a612a52 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..a2d9983217781db64b0b78616066c6ee54cf130c 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..d767491d696e9154ae78fc4d854305ae7e38e6ff 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..fcc85f07a4a07d4d6171696320c344961e3d294e 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..d3b48f1fdbd883d620782aafe9551e8184e1be03 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..5866bcf998c679f39d074101a49880c4d62b1809 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..d378c6a34668f9a94f764a4fe7c7ae084379323b 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..8593f97084d91e03d1d0eeafa5560008f8c3b58d 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..2f9b4f68f58f708d9cde11c2e9f4b86f9b8e0d77 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..9f7a98ece64bde5422eb210900f6e7f5f5fe002b 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..432235136ed0f25a55336ce39c1878d09faeca5e 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..2945f8f7842e2fbfb5a8ca92be2b1e956a5602ad 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..cb26cc6ab21cf499f36b430c80b3c62f249119cd 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..f630f748242f1d7c00e40646c4077481009febb8 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..ad924fdefd5d0a52f9c3328f888c5fd772d0709a 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..46033682ac8fa8ba692e051ccedb86608ec967b4 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..8e43525843ee73ce86b17a190a27561ec1d6f3fd 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..d458be19fe31448ad73e89bb3de97a7ece193ad5 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..65f3dcedd5c1d87798e4b0e30f1c6d13087ae104 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..251606068de03eab83c23b3d41cd4016f330412c 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..b037f84777e16503014671ce57fb15d748a73b19 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..2f1d47602cf66e545c97eac743f4f512d937b4e0 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..be3dd86b53f82de518a52aa1f030a85f04dd638a 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..336919040f4d0bc9ffebdd400abccff234d34e7e 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..eb7e2404d919b6a10b3bdecd714bd029434a1854 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..5a5e437aa8ea673c50f59e74931f8d7d75628a7d 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..a9efd0cf8c619e614a2db0914297544b81976739 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..8b7768ef5dea1c7f5aa3338a7733b22fab80b16a 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..9e9ef1c2754c566510586de1ed335d7c8b5817aa 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..ad589ff25421ec7130e1a9ca7c27adb365c967bf 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..1f073ca7782939e5b37f3e93bd601fafa4110362 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..e3f99ab5174295629d21885e6e24d1f6ed7785f0 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..d82cbbfc00e1b3114eca656335c2f22fef1fd4ed 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..cabeea87d332a24a61890bdf1fbe9c22f75b941e 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..56fda39252371b9194735be3273d92b0388385f4 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..9b3519b48669b6ba5c7df03a2fd1a7071659f64d 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..08b8eb68af42947b3091141786f571e451603970 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..3faf96de97b5b05bb9ec456d7ee8f47dd99f4abc 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..a6d74f30040f2938a8b4cb9c2703f631449d92ab 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..7e1971d9c3f32abe19006f7931e41886a96b07cd 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..7c940b9e32dd4dfce98c71065c41b1fd9c9ea0e1 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..892ad81904c2400e92969b68e610ab8f36c6d793 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..22bb65ffc6b48b65168572d48f5e67761bf84301 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..f97d235993294ca66d8db4a4a30c651be18b5621 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..3aaf7481963aef197f4e64dacefbdc2e972d578f 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..ff009d4068fd2de0dfa5963a505c6ae6689b8ef3 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..1c8a6b522197c7932d43b10345ff0f5e180b428e 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..c9858549ded4f3179c2e379e5fb6a990322a99f0 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..a0bb7ec55ea43115243019a049912216ea30576a 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..680ed1b3f1e1fe2bfd663169988aebc639370a21 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..4aa20828a9cf0c63178f7288648ee8f5457ec272 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..de5c00c64934e320ca72cc26933236f05ca2695a 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..e63af55b3609f002c35394fa1b571fa903bc0d8f 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..928ef42021f90cedbca143ceb3991b0434f35f0f 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..1fcc1bbe8a11e3dceabefc7e7502966b7fa3fd8d 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..1f9c77ef160b587948c6b1185de5c834b205644b 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..c3d15ba2f77bc927cddaa18e65698fa1fd559d4c 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..0b07c847a36c1cc85eae0cc85b1fa1154e4cf425 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..f1591237ebc0cb27360b8dd833f8f7f76dbd4078 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..9a16d20a40a56dddd6e09eb69fdea1f0cbee8565 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..42f16b3339a50c70f29ab06ad7a79b621c3c6697 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..5968344e32a2e77876efab890305e0c2b8bd9576 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..32fa8e06b69574ddec6a1036065cd88c87c2b24a 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..15cc3f1809f81f1f9126e2c2e46b5caaefa3893a 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..16d29fa668a3f8d96d19f956c7324165c9e26ed9 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..60a8de3fdf0ddf357bc05767e169ffdb1d75777a 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..40eb8f252624f97f25995cc12cb17f23b920827c 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..ee9e496704e04f8a7b6a41fefdca6502785d8e27 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..6825979cdad33690be3cfd9eb27e2e7f6caa6e95 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..4f754852e9204b434709381d60a5de6dc2a880fb 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..dd2a575139308c650ccb3db9425d3a9ef86a11ca 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..d7619e220cef2104e1da879c6c74bdf5ef8c648b 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..f710ed11c52631b9c99c56f10721d76c518fb0f0 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..199a5e839b6e585c16a758a339c282d019851f07 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..59999233927058372dcccc70fda9d1a233e39896 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..cb6a37feabf7ae2579a3f540e24a1d8574796a69 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..9c513ac9dd3a0e93ba54db973991faafb26eab07 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..61969e7ce051311d3ac50bc7e30d90849186b60c 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..8ad7b7ebb865d35f820748e3a3c61b9ea380b89f 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..63e1d6d07fa8c482ee3f091a22fa06d26f593ccc 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..9b761e225db7bb1863bd80d54922c951b72c9d0b 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..42cec88ddab03e02c95e1e36274952c89ccc589d 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..65c55b0b4bfe5cfd00c66a93c54d65ced318bc32 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..ae67485c663ab4bbf60dee8416211a7611bcf255 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..410a7d6f2136a83f6bf8275de41e3f12118c2b37 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..675e5d0414eb7b60718e81608e73c48de63eddd4 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..3d99b6d7b2ce0ecce3b6810b932a6b9586954fa4 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..474a0356a2259322f755eb379f2ee1ed33dcb74b 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..cb643d2c3fec5553ea251419ff4b4d0a09130a05 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..0b200312e2ce947adc150090586972c377024e2c 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..c39cef5c47261167ee48fd5313da9b1360ef93dd 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..7a170c18d2cd26ffae4bbca91ba88ede6d8506f5 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..54db5378045454954215ae877b712ea3a6cce738 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..3a1a56195cf5eb543ab3738eeb0ffae0b4290c00 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..d42e8ee417ef161c9d65349f2cc3729dbdf127ab 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..719463263ffc7426a7ac93055a7e90576b78b803 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..e7be24b97f705ab7e6381b206034ff095c6261fe 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..13139ab9b0eea89f638a3bb0c087abec65a216fb 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..eb545216157209a56565635c50c336836e4f8b35 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..07712882225f64c112c1de00949db100b353a6f9 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..360067d5e57e50efde0aefcc314ad4307e3d6668 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..e8ddf93c28617a051895c8cce83005f27cf524e2 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..e825e898d5dba7579c52df1e1b49f4dfa9be8a8f 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..ab075513fef081fb6b427347f1eda99f9f4e041c 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..a2b10f7190234fff615f9526ecc14ca02ad78dd0 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..07a466a4dfc7fd4b0dd4f0411330c3ee4476bfa9 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..d0cb840fb25b02b116a6945148ba381e4f5bf23b 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..24dfaec34280023bfde8577cac174f4dd5b19606 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..3e44b4c2a45b443a5c172d02552e5a7864e96fbc 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..a051678755bfb7143a093a219f3627c495920fa3 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..efc07036b554a89b4182833e6d2cce14c233893b 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..1ef5a04b9dd6665f72fa371a92504cdc8b884abb 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..7fcdaaa8b204cab1bc62331aed4de186fb8bb151 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..8109f5c25a98dfdaf51ba6f8edd1ed824d940139 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..0f917ff0b63df6becbe58037dae163164fad30ef 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..cc2b2fa14bfab95c926ad600cf285b1960a350fb 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..f9dbd22adbfe9b0b9c07758e8582a94b70baaf71 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..0939474135736d171a12141d6d55af429598da61 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..1ef20177ba72045f13e5af3b9e93a37d6bea6fb9 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..d22588139a3c449d92977c00d1bf54150e0a31d7 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..ef9da4c02e7714972789f9c97d13f434bba56d74 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..67ae9e21088e7602ba80bae53968834431f5779f 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..3234fada35dbb1ed05154b1d375dfaf53f38947f 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..6f644a4a805eb0b3b29923fb7f31804f42704f72 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..0d504c5aed8cde8fc5b17656e0e3087b0019a71c 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..c12cd3f6851469b42198bed62a863621e20a7681 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..6ed5f8558e9187c090ea2e9af0350b5bb2f52c18 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..a5f659cd9b6b1f5f611ca541d80a0c826d947bc0 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..fb81c57792acfdcf24b9b2625c7fa63ecf905f59 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..6cd7687f92e28bcac78a60b7c1358652bdd5a4aa 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..fe7d20d0f167b8828a83bd35832c8d3ba0ccf69b 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..c7c2438afeb4e39029c06b4fa0cb7c66f9ec41d5 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..ac0d3b2d1cc9965de3f13538e6c4ca4d68f312a3 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..6e0611dfe07405deb1f23d3f8ea8c2487a81007f 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..1094adf1587c602c6e42b3fbc3a137692fdbf321 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..4fcd5064b79a4a09ed33dd7f0ef4f2a9b8188d74 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..c2f2dc329c92dac616559628240c5bd7b0d8bd1e 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..6ef64333f7b77ea51ca27d602f0bf26a1bab872c 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..7cb662e8ca34eb8c2b9c691557b9cdeae538d236 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..da987507df32cc9dfc2c7316a200e37e6a59d371 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..f33e993ca4c295800ce76276dca0c48a1e1e9e0f 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..1b6c3d40e16d5e1636f013ebf6c3e52e22ea05fa 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..714bc46e2f89d9253518f589523fc6107cf5da55 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..eba41a9e05e51038c988f129aa1906937756c228 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..3082e65c55d5606e7b6ce83bc3255735a0560d7b 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..b2589deab6d1d240cf13bc4d0f281cf177dc9d2c 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..400f06b851e5db95aa350463d0037242649f4cc1 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..895e3804fca2fab4763470e46aee638643371410 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..c617ec552f58ec19bd6b334907298f24f2524f05 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..cedb5388413c418f59662306f7127f0cef005511 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..04c5d39e871d17506f01776b70362b44f61d453f 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..67da3e6e6b85c5ec2254cd38aa28a7152e8c9f88 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..7a56c2d60468a78445b6bb69843fa382d8f1134e 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..29b355993a2614308708a21251dfc60e51a703fc 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..94b9a9622237f9751af06e2e852f70978414ccea 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..98db2d029edf4a36afed759b1d3cde4d028287f1 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..d79880bdf10bee4785cd7b2a3fb324a013facc84 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..8c565dca6e0c292c4a67ebfafdee098999fa0cc8 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..d1ac41b74fca66d2edf036c8ac4733f420f7750f 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..ffaa3d12b5c0b00abf27e56b6738daf777be41a6 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..a98081cfb6f58205cdb6ed7fe23bd86e14591aa7 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..d0d098896450f02d810c3b99d3d8433cbea482de 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..95e051a8bc4ea83eb53044bda3482abe8af8b145 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..59e81780b91ca703699c9450f4470d386088af0e 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..52a75ecad4d3a38381b83d20435be3215bbf8164 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..04afc402da69407bfaa9d37e2c59ef3da527a1e1 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..89bd9c920f0f30c2969a565c8ca23e4d8e294279 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..37918f987cf07c97dfef30d5d9e9ae5821521beb 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::make_optional<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..0928ecf4e996ae501ea8c82dd0f35677ddce5a92 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..a81edbd8479a52e3314f1bb08c9ded5917126bae 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..c52bafd50164eafc651d64de1ab1530db915f913 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..52fb4f7e6c4074b7da5d202070760ea74cd02618 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..94d5f16e8104dca0a603f7ce1e6a4ee0e60fce92 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..ae981c0f147c16ffe4a144676507ce364203ee53 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..94fdd6e5598ea0dbaec6668612b9c638273d7217 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..d3fc9f3a4d46c781d5cd18905f1beaa96b9d796d 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..31688f34b8e2e050a2d71e024b139f5084351102 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..a2774c2d96bdb02a5e7a76de16eb0f22e28315c3 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..f6306c3e2c619a9f05cdfb592e89d68e46ce0014 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..fd92162a9544752e100770a08f1493b91f98e307 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..af48ce0348a77a6404a61b6f0de89e8c5654a658 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..3752ada64688e0a9ae966993c577180302d67c32 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..a7de140db5fe175e210b394cc35af009e5ccf898 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..50accd02a66f3a2517e940f140d706a25cfe0881 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..4b3076c3ce35384269ff5712351125e9b43c3cff 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..cd6d09989c05e8bb8bea81a1370b8b1ca6c1ee6c 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..886e437c74b12ac2e944e667d645268ee69e8a09 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..6cb775316763ad4b54be1232802e65625673d58d 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..03309a4c3770ee3c17edf864e109c25f41dd78ef 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..79a1f620b4dca4412d26ddb42f5a93fa4608428d 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..315adccf4b10da8ef040a59707b4862f63af6491 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..4f64a11e87a4e8f5dc67492226df845d709bbd4b 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..62f37d4f07b26691702ca9e8a5be1eac898c673b 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..9ae09b6991f516592430c8133e8280679e943b8b 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..b3452f7dcfdaa9d4747235af0c7a3b8828ebce05 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..654beb8ce7cca4d270402921bce1f7bbe8c2f9f0 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..162330f705e1f91a6b94ca831392ef239613eec4 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..931ff825bc9b615e0362b6986899c01373fe7f9e 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..4ca7d013400d54f0db9b4f0385f3b31c1b49bb82 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..3f700175f73c7b4f89697b7c947969ecee9c2022 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..3c972a14b6d7ee065536c894687cdf4879406ec3 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..3fdeee6ddd65ed3121e15e4d2595edd35a06d61f 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..7ee89a92af9a6cc6e1f507f1c3946dd1981284d0 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..6c8d77b889af1986f96a6e4eb59eaa8dc937a3bc 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..37497cdcd635381bc4f5da314658fa7d1e9516bf 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..c587f4fed8bfdad838e3c1b91d74edbbf9fdd40a 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..83f91e102a67987899c9f81dbceecd82dccc7d93 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..f9a83a15b897c8f509dbec6e4fa2b2e5fe1b3004 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..f271e3cf4b9b77077f92249b87e7cdafc9f41214 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..19b35d735a7ffb0cb60fbde31ee7ee6758c1f594 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..72582b49f61af8a8df11c0731709b942b97ad1f6 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..3e57aa68e00dc38b710db4bda3e942ff3e8a1ba0 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..71980eaef6cb7648f9b45f677a496adb32723f94 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..a8220446037f3a3eea1fd9b550f7f598ba039e48 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..e13dd2c002d0f6d35aab5272beac17478bfb22f8 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..0d3c6209755580e2b40afeaea990011d9e8c9314 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..a4159ba0188f84b126b5e47d249778b7c494e063 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..26fe7352fcfb785fec853bb06cdf1fa6235e9dc4 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..8e7c190954cedb7ac313b62c4e988f9b2daf3df5 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..eb5cb432f10732351c6757928b8732d8afdb14d1 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..ebc91de86898053c489260725fa2f014802cd32e 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..ae996633b52253326d8349f20849894ea6b2412b 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..b3ca4c9a709b1b0b5f54f4de2925d0e7e891878e 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..19ef48f63326e893ffa4ec0c0a0a1c902200aaa6 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..55e7f521fceb564acfd01796230f0fa06d5b91bf 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..14fb644c1a3277164b7ebe11ad7e0cb624e1ab56 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..365191fb1fc7fefa91c6238c9926ac762bf9643c 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..2ef87a97144225fa2bb74e93fae5630366c90d49 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..91ee484ea6f3e01d30a53092367b1e7e01128d0f 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..2e64daf932f0f84bf9198cf0885c0a07ce45d7d2 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..ad4881e14d8ea6d2440c0e243a9c0a0e46a7def0 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..aa4a7c7974c973f9086f9a228ffb615fd423ae76 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..93cd44957d85dec85a4169994a86c8f60fc9ca01 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..e539b508eed08c85cb154aa62732c292e65536be 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..797c33c084a942d6dbf049261f45b79413106037 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..55b10200f034c499206b4967cbc64da0e2a979eb 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..9f7f6c833b2fe9fe940df9eb9175d1941dc80425 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..6d10e9b471ae4cb2214b234a36e11dca5cc481ca 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..93b4237643889637d91b113e3c9f27673d6ac435 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..2adaab8986da7ead71b3972ba8d20a16384f65a5 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..3dab40047dd8f1860f3d0ccc2a71673637213d2a 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..c0bdccea704c22997816389033a83f01f67fd2bb 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..131918fd7956579511a058507901fb7662e8c9e8 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..517b35203f6f8ef7491794e3696318f8c0dcc840 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..4db94dea5e450972c3f0e35406fc300fc2b7bacb 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..2384f6298c5c5020efb9bdd5351d3d9f6dc2a782 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..6cbbd6217e401e13f8f45b600d16a0a8864dbf4f 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..d549505ec548a887295ec554bb2985e3ae7dfd8d 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..762efcca348050a72aa49fe44ffa88111e0f1244 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..f5e8909a4b2c22c63980517ed0f4e127c1e9f66b 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..ca5d03ef0a2b0fc1b5a5f4698e0908e175e5a249 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..8e53b527617772a3b40606fa3b2592837e427db9 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..75ecfbe68ce50de533b46b824dc06939731072d1 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..ee83e21832136da2ca15c129ba84f2a4511af11b 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..901f90e348f3b89a81bbf691ddbd1dc75e868e90 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..5b39faa86d99e0022c56248b0dfd8109035bf66e 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..be95f28662a273c7327f664b96eb4f5937cc5b19 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..131fa9a2404f240a4b9000e590fcfedb822f6515 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..6778cf334aaf56baa9909be34bec98c455847de4 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..fefadf2c1104c3395d39c94dfcebbcacfd522721 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..6a30b6ca9128957be86491d871c0308919672861 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..4a0a16d232f3086274a7a3cb9ca08634b23faf9d 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..7b1087b188c78a21653ec3a3c9d57d0f09e2cac1 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..daa77efcfb3e2ea68b97c95fd546f0317a0d0209 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..3b6635215369bcd07801034b687ddd5b2ca3ef7f 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::make_optional(m_tickMarkValues[middle - 1]) : WTF::nullopt; >+ WTF::optional<Decimal> closestRight = middle != m_tickMarkValues.size() ? WTF::make_optional(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..0723a4c9b9d31aaf7abf0e1e861c49712caf51da 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..f12488703568a690ab06244939705e7fdf0bf06b 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..7920614b0dce3d4c813f5b8d5795d95f0d474204 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..234056f74922b7e64b9da0a7af620dfb9d031789 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..829cb41afe168f22ae930403bcf1fabaa19fedf6 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..154c927d5041dfb8cd0d48f165ebee3f3a8e53f2 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..0cafef54fbfa39b129307531135e1151363d0036 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..5145d91c2ccf4e6e2ad668bd99e3b77d6644205c 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..1daedc9a56b5f7733ea75efc61a37a4a944a4c9b 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..585e768fb72446d98fc73b16f6c56d49bc089463 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..bff33789481088f7a140be0c4938abf979461cd1 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..a4cb9a82beaf4ca7d1e320a325b843d68f4f290b 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..e2210f3e78a3ba506fb02cc0e58503fdd5485ed4 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..7a40968424a6247eeccd17fe1b05e14ce936b056 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..d0fa7b2c642af469b65175031cdec6ffd7cb8939 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..d6bc3523f05bbd5309250602e1d0c0ed587d72a3 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..490a112f292d0591aade6008430d0599f4e61661 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..5447b6dace8261855a6a08857f041d558ffd3b12 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..a8f8e9b26ed35d394c21401900ed6b3f404d5cbb 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..923ffaf4402057c220f003e125c2fe8e7b001e10 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..55983f94275a0c530c96ad83905c22bc2a3af33c 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..c2924c8414a5c7d2dff37a70751b826e08dbe9fe 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..4f5a7e5a96db25403b81466c65d847104529a4d4 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..b54644b73c5fe5bb4e11e73dc1f1fe8e34c068e4 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..dbdc690d8f677b9ceed4fa81f60981958ed35afe 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..d58999d33b8deba721535da2f355fffc4ed1c438 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..63115b23e878fcf7606de09443fef13c0de5dc7a 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..373384bff5923b51e468ca85d23b6e484b81b686 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..a12fe6bfbca06fece0abbf40537036a55cd2debe 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..adf8c0d8a1141a03fa1e0abf103baeee162ad03c 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..5521efed183ce6ddde41c6931842e4d8e0c52fd9 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..c4a679f5b13aa841e6314ab02a170a0f7281ff21 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..ae70d762b25a65b46dab78f93fd04f9f34174bf9 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..53946f0adbd7cf9ecec681d12d47d7b76cd4a88d 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..6582b1b0d86f9b22914b4a7889ba24a2714fc4b0 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..5d85c3d4a19a8a7cc1fb973902ae9b600104f079 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..e28652ec19c51699c701f571298fbb24bf5772fd 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..9381d30c370d7f9e94756f80e57db14171b872c6 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..d3221a82ee252411a62578564fbd0961502b6cd0 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..3fd829b8c56e1ac9b078500e08abd2bad44c06af 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..9c340dcf6886d37d11c6f861178fd289d2bc0b4d 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..775892b2c9eb43a6916ca08d34465e5057c6e0ca 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..75c2669df7e13692c17e0def253bb0ee7a12dd0a 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..8a2d4924ed9367951919565a177bc12eb20e2259 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..bff7327d9ce390294953a3c01d0f831cfe78de41 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..d5b343994a2c928a1179d90b27b22dda305f8f86 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..4c0ea10d0d9c0b84f34aabbe17fc1aae6867e42b 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..2e6486c2c74e38a30c0f6845a9a540409a209e56 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..95665566f6ab34121df10f8037acb7a35515cc86 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..96083f49cf55711d086bb8afa177c1f948f45fa0 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..99c4bf613b9d50ad978fb8d42dea8a8cf7ffd420 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..84adf584f2714c72772375eed041b8856b1e12e2 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..cb79eba34207e04a0109ef1139968fbcaa3f0926 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..efdb9eda852b45287bb3da3e7a1beb943182b0d6 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..3b08ea2e9f716b22510997b4f6bc3179a13ce1b7 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..4cc5355d855d8daadce749bf9dec7cea07ae8eb7 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..b7bb7e3d79b6e6d11bac1b9009b6186391067b7a 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..8b819656b46ab2b72353ace45a61264b63754242 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..42c231f87c3d0815818d2ff2d0b6b0b5532cd8b2 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..83abb111041c874046955aea86705e29a77a7b9c 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..03f1bbbcd022707cdc7ba8dc595df42a82714e0c 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..84b9d71622ef40795eebdcad3c30c9334846d6f8 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..2b9a3f442ed8bf075a1e19c314ab231453c3a2c1 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..6426fe363f968f4a84eaf1f8f779d939a88b2e57 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..c6b4096bc0780f1b1b1286e419254c12a3175c39 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..4c89dcd20732ac29bb7524eb9741a6a1ac0b83a2 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..47e20a5610710881d4be09502b8a68c2ccc92c74 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..024a901ca63f153f747bde3c6a47a255414df6df 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..8545c720b430b7e2c934457024d017024bdf5c62 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..556e0e80647ff75c3cac32da94e85d2624822865 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..aa99982a6ef22b9181bf0c096a4465d428f0b6d3 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..2b7d41a031325f97aa6ebc247500cbef44eaac6b 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..342654a0dd3c195f4c6a600317dff61d901e75f8 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..4395282fa91f7a12725ebac2ff648e1c4affffa2 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..9ac83b0735dbb6768e5a90e06b8199dcadac418c 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..7d3fce008cb94b1e70e8630ff1a4ed3bb140cf98 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..0f47622c5c1fab4b609207efa35a27d0575b8ec5 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..0869401b674553486dd9484da2f442afcbb2d07b 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..5b2a070e3469eeae8f4581b4661e3e9d799cf148 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..0f2d36b7779ad75b4d0022d7e5e6b3c12754b217 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..fd79f3e72460803cf86545ac6ca6787e84a6bf2c 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..06b8ad827fc79ecbe95c4551fea7459add3719f2 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..b157db1e2e5c6f3472e0ed6b93ba702b8bd142bc 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..04d427e851b05ce7a8062fc87e47d02bffec139d 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..fc590af1dae2f2873fce8d31a706ea484c0c1467 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..ba7029812a8230f23f7c51e80afa99b0e5988590 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..27012f45a7d456b3886f3fc8b63858bff87a06d5 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..71b52dd7d74dec55297294c49925d1c24b55f09a 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..58073550139a6eb266d229b0f4364d3d749444d4 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..6f985eda5016a376b4f12986f92fe1363a12ee8c 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..85b9219781f9117a6385be1a2dd8e6c38fa79087 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..eff74fb4e2909dd768a60e5cf422be2974a980fe 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..62ea285e232be46acf6dae3bc4e1de4464b132ec 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..a993cc3f3c3e76dd463a4b76b27015c77d7e5914 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..0fecf7bc46ffe79e37aa787ec7ed22425c5d29d3 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..4268ae8c3158b1e6d2c07a0c15aa90515d8c0792 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..a491f81d778af67c30b0457d4a3456bf6a0fe83a 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..96530aff7da2b1b38317b98418aaadf567067950 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..d66cfd91cbaaa3b9e36c1fb1d6998446d6934ece 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..6478e9d2a7eddb1b7a929f0b090d31a223c5b106 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..c9ba271063dae6d61d0490caccea14092ce56b79 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..b75d9007a6707cfd8a87685860077bdb4ae98c0c 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..c7caff62a55779efe90d250cb9a335133ef500ee 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..8f4ec1629465038a40c4e09e58add00f20cb31c6 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..c7fe771d412969ad76ef16ef6f1a632973eed902 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..457c599eca9be70d8712c8dcc192ba490256cfda 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..9f27c2090d5960f5d29b1e89782d4410529543a3 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..81f1723e8a61c56efcd14e21bacb865bab9d7bfa 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..b93cd024d325070f7f811e106b0af1bbfa2ca438 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..9501a471e3cc09c00fec56f432ae365b82066e23 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..a75f1f3a9e3d53eaffdada2b8cbd63e8f32d1bdf 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::make_optional(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..6f88cae664907120c7d967f1a75f0374c295ba10 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..0a0b6b44677521b9cbdb664d1636c3e5b4db9a80 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..f50429d3c27448bbc486733fa8c46dc5ae954b95 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..888679f50fc050a906f930df1cb0e9f29f29ad33 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..bbff2fc61bd43692bd63565b97a522f5307aa0eb 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..010d1ae7118ed6d18e7d761f89ca292322c8863a 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..33de62330e82ab4ba4f6733dbd4647bb8c3a8b8b 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..4a4c83c9c33d21b4e2cc39f45cda7e591568bd1b 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..d288368866205fff7d7e04b95855a27d76260c5b 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..7ed5331f93e31c85a10ce95e89a64e195b054fde 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..5d242895ea2a620913bf8be846eeb5f52e88c7a6 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..aa024bc7fe3b889b59d3d1a189ee95403f27ff64 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..0ca3c988ad36b6b1eb5508b8d366beca1bed0d41 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..19cfb6cdc957eb0af9fa555e072da51480712874 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..075c71c88de425819188a92ac35510be238c69a6 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..755c88dc10840322108666a48478fa94e738dd79 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..43bfad3140f310fbfe651dff1d4f105800efc628 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..3450b666484e493592c5660d62eeb7f0c3251567 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..5d431206cdd83c268d6316997afe7de725335755 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..8edd2b8ee108326a76c72b7e7cac7b6b705681fc 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..703a2acc06fa01ff37cdb48a3bb8c5a7806bd49e 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..6bebba1d91e199395d90d309a2f5903ee3e7e0c2 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..1050bd398de436e8badd2955893468b23ce58e67 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..f68a88cde0d00eb5ae2bc2f2b0f4da355f5b3e58 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..ebd610b8a31a9abd354e99037600e0da94034837 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..75101c9f63957653b441f623f56a89396b1fabd9 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..84dad2dfc19770080b1614c279f169edca070187 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..094d240dffe076bf4ec4ff064b71fc835a7196e5 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::make_optional(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..31e9f183a9e72b543fc74c255ecaf832a848aa7c 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..bd9e7169d1ea5411d223fab9ed7986773758e8b2 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..a92087afbec08ee16e28cf10d4e2aa3a245e7361 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..8bb2f86c9dfc41202e800dd79d097e240bfe2ef1 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..07f532ec9d6ace4c98042ea705765312c2cefcd9 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..c0f7e406e162c316d6da9a88468b75aa7f45273f 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..9cddbf46be62ec88b19dc87c132311470f8530bb 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..fb815d96ccd020536efc540a10b2c6916f9a25f8 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..10d77d81a31e271c1cb8f1e5d9c4ef46165db4c4 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..3997d613aedc522db736a06f50926e2fd15063da 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..86f0b25d3eafa2fc142b081fc6a607dd1751eb42 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..aefcd95a6fe57b503866e0c98edd2b42c022912a 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..d75e57a6907efc5a51b8781f8a30be0af3b89764 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..e5c79019f101ba5e7728a66a1c1e13bf2da4566e 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..b4e0830eca2bdc25472e8b22203e4d8d41b46bd9 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..f737b621d0361d19c5769701db25785fc532a331 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..07b6ac1cd99866b743ca830d2a8793f2da5724f3 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..12590681aac502d07938a45caed42161b3a9f5a0 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..54a391cb8820a2c4d1371f9db7cad7d320200038 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..7b15e6fb7759b0f8e75efc4b5ef05e7738e3ecec 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..b145e9660fde7b076c7d3d35ab1b2ba1c280e3e9 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..db8c586c40e64f823f3c2c5f6476d036f75d2d77 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..d132877ce0d3b6a27caaa5d6a0c3c5ded4c80047 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..98cefad49d8e4843ee7a3a0fb56231d888c82255 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..933587799a475e76fc75c378ac754966c7e84ad2 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..f80b9905273b47352a1931844c0fe87edbc2eed7 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..316d62eae7b909879f191c9a0cece4896c3179aa 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..931f5a01dcb6bb0b03080a261db0cb92d697e612 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..407b65fe2a97f9bd32bc2625d09884c310693d22 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..69e75c0e9624f849689a069d2b38bd1724832d0c 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..7723dc70f520e7222d91acdcdc3292a23e350436 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..868d8e29571cc908ee5ca6b9be3499f844297a9b 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..363c408a5f8b52b4a68bda1f21aec1b8114bad13 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..a382c4ca64c2075c54ec67b6d660770c440d3c05 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..ca2115fff471c03660fe4f01854dfd42007e62df 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..b25a388285da0d0d61f1ef4a5f87908028c89383 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..b3c856615603cf142c61ffb6b4f06a2ef247dddf 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..55b8838772f5425f50aa83888e873bc6431319ed 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..198398a44d22e0038374477be43442983570916d 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..eb4b8da8308c265fde8e3641bbc809f62ba86e49 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..931b6a2b5c58250d3793c6aac5d0472137c0419b 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..201ddee7fe79d08e21549704981d40d48622c68e 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..0ec0d23b0bd73ac46e4c7917ac35790a135213f1 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..459409e295fb641a6e68f93c41df261b96002f3e 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..7f6d80cd40673da49a67a9eb708a8e6788b71f01 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..3ab2cc871312a7aec1e823b5b9444c30e4afede8 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..1743b8cb589ddc0bec8f647d15bfe03445847af6 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..cf837f03c5f679984c33f65e8c0bbc3f0203add0 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..565511c938f2345d6686e0a69884322b41f4627a 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..a24315233b85f5742b278b2ef5f981e79d36688e 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..c18e7604445f3a6401144e9f32eeea487e0cf551 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..a50c19f50e59bf79b723db40ddf0a2f6b2c2bafc 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..db786acc2676a71d91d8a17108982f8d030bc541 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..c621ffe9958611cb42f27c91479057da31297669 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..60b61178b2b5e9d14f0f3d2b8cfa70a6d18b086e 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..0e3c0b1bf107f26d4fbf5d6c3824bd3710b83432 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..077f6d57af070c4559ba2dc8f9eeafed99689847 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..c126cc5d506afc20aaa8a8faaba33d46ae4496a0 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..6b80e193d037731511d5b8aed0805361ac7de8a8 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..9dbcc4f7612d0f8254667622ad865617c2474f7d 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..7bb27ab132d93c828bef6ccc6b4a3a6d1c6d778d 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..890cd284da15620416f708dde3d13d98472e1aaf 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..636baf1973c2ddb43a30a77a2619329ead88c72e 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..b91e590e72ae3257dd4821b3fdbacf7a9818f198 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..94e8455240790a16c038f0d9826b364f91fc70ba 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..4726f8fd4743fa574e0e4ccadce7e9bd0e1c15f9 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..c024945be8ba0e7197eefb3d2370b191cfcc4825 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..d9135f32f0a22b0f2c29d45e9f6659702c9b6793 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..2aee991adcd4c7d3d7394b0bca9fa3bbc0aeb1b4 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..728bda7c482f39de3e360844bfa41e61164861a1 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..d1ab5ad12fc542490f4b428bfb0d4495095f3f7b 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..51beada0bfab28af71217caf1079eaeebc692884 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..36675939c8a7560f864092f8914638ec618f53a2 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..9398f214a18f04b22364e198a4550d61852a4336 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..6eba44055d6cf22e094c06f897aadd216a4f2282 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..4fd194be826dcaa5dc81888e4f3b7bf6743b51da 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..81f964fe4ac7ba5d2205607abe2077dd4abaa00d 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..757cff4111190b454b225e69047521d97e655249 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..1e5f392507aa4bceed6c2e941f93f08b7685e408 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..967dc1f795614d57f7603bd1438be75b03c82b1f 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..83d0aa3d49428f3cab642ed473ff51cec33b2dcb 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..0858553f8c142bec7d4683d12d92ecc49f0427eb 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..ea886908d1656069f4b1e1edc526c0a1392fde10 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..b99deaaa5b9fb60040a56c8b12abbacb376f2bf5 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..6597ee807c428c474c6a208a87e5b74aa65b7b40 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..627e1b67f5fdec48ae620fc4dd96c71824b5cbb7 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..e480d1881e661f772f979f2bbe57113c4933990c 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..a3c3e35fb8a83a358c1b8cd2932aa5b98591cb9d 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..1ff8af546f1605ae6e8120eb12d871e5bea28c09 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..f47377fe0cfc529f4a4c805520a7bb590132f3ec 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..0705896b402e295ec7206df49d48fcb5f0460c78 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..d3d52c0a141f8a93f377bbe1bbce67e23f4396c8 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..7f65d8281ca47a00b07d8018e45341fac69865a4 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..2951ba93947f230b963e56b1183d681e9cb77d72 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..dfb339b7196509fb33db1dc9c52ab70f8b743b38 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::make_optional(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..18c617ef4cfc6005bdb5e634a3b6394623a82068 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..95c93b81ccf9807a6f4242b222b4a488fe12d9aa 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..18969c95e2ab7a1df780f308b27c78a448ae01f6 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..4b571254204ce137143fd107e0a8b7b197f6808e 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..3df111b2c2531b93c0820a4adb5b92ff92a4e0ef 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..86bb65045bb9643d092395e40edf91422f24dbe4 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..23c29edb20c89de88d561e3938514e88a5d9d404 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..c9b05ee8aa2009b57a9d2b64bae1d0bf80a441d6 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..eaa07d1dc4ed6dd315c7961f8cfe4f6ab367a1d7 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..c906028c9929ab1ac19c0af60c8515ca174bc018 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..e8063fb9322afc604e24d5992f329998097059b6 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..99c8a1932de3d36e53f8319b5a402c255b4defe7 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..02507f7306d0447024cfa9559210e87235aea9d3 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..2ee7a0cc5c1e9ff2e6b9c289abb855c186f57339 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..0c230e3ce266254f8dc7f0cda3ba1cbd94e42baa 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..5e1699b4bde1150b78979ed4f0fc39945bb8da4f 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..80ab8d31323d66bbaa92a9eea2e2aef685552079 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..60cee37ffd260d2d6609f10930394a177d156285 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..ac79f50572f7046d29e367dc7a979614a77f207f 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..e09a0d26db9e76352db862c833a65e8084cd5404 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..1476b712734afb84ea814a484ab375acdeee9386 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..4701aca4d6c84c9f3752b1f5088ae8e19ab971cc 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..6f36f12e87d1f97b3a7d1ebd077c039af5731a2a 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..89ee085b7e808221251a869c233ec3899f9bd427 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..6ed9499fec07d438edd22a8b73c2473784742a99 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..99c7992e444e3e8c27c76cfdb8a6479d6e547f28 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..68d14e76049ca34bca066f099f30fd13e0585b02 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..c5c450f556b6825ae95a9472c582869249fd981d 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..0b2539fc0f19e068e3160bb520ea0ebb7b608f09 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..1440d18705d2648417c8eac87077d66c97d7ab2c 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..032f609f1a44a90ccb5a5a44f5b92e84918e5a2a 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..ca34e08140dd046f26318f8798a34b817e8cb088 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..db210a15210e1f20f05e2e7bf16a0d20eee8882f 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..9d93ef485abb29973ec26ea73f0d094038834e21 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..61fe3e3c40b2720ae450c105b35194fe8475406c 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..9e5d5b83db06839bb6ca58d079c2b099fd1ec613 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..4a202a9504b5f658ebe6bbc9b71eefcce8e615f4 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..094e85a16e437bf618a4977c9a081ef7bae98591 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..d58042ee07e788277185017927241e11ed74e3ea 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..d708eafe0a39a6a86134d6e532bd0e70a34eba5f 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..65d5170b6d1d1fad6058b3112b2700fb1d7b1cc4 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..dc001b84898f130294f21e57fa4e13d918f7bcfe 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..467f345ede9086e3f1aa18a0f7d28f4c7a4b6660 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..6aa23bb39ec7131b38cc5c148ddd8bac2573cb4b 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..7e436b4c1f675f127221c2e41334f5dc9c0ad455 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..d91a0275eebadd89f51c3f312c5885928b437663 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..b4e1a7f39fa255decb3e54f04c73cd1d503ef531 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::make_optional(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::make_optional(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..249ad997b65f9707b1fbf82d38ddd8cd3e417d9b 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..ec99de8794461a9c954878d19330fb60171d361f 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..5ef7f6215061ceb7d221468bf271f334d3673bf7 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..66650b7b3b83a9123d7e109016649332ed0a4645 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..85f2271ea3fa268a8d9a9212a77f40e4676070cb 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..9f5f241bbde1e81145573cf9246fd607da61e231 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..69e57a8bae2d190d9f974ca48845de658241ffe2 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..98caac4ee632e30a4b0d788884ebf6c93df52495 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..bf79f3f00fbca6e0452e7899556d247c2dca3654 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..e8be395b2e840260f820c6af72d845aa74480083 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..5bc5c377e6c71d024b938b003d19d6d6878c49e2 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..d83b46d767fe52cc19108d939e00507176e2e8f4 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..2d3761929cd62b1a977dec73b830030ceae407f3 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..0b02113853fa585b0fcfe54bf09d2e787862b2be 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..629bcbd8929c1090bc861ddf018e753f2512a15d 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..ca11d1cfb21bb38c5f1d351211c72bcfdf0303d7 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..8aeee9fb0623620aba99eba4a45a3f4819439531 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..97274a6e75b12a53ea67528e73176cc780544e5a 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..115809adefb90feadb6db8a839e82e3999e21744 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..737220949d969a8c2b6f9e244ddcd96c753991c6 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..f428b0fed6967fb2e53f2d27f42be69d2fee0616 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..4f116c93875efdd776b7de23322421c5d5334e2e 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::make_optional(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..4412a4bf1d3196abab18ba19822105568e6349eb 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..0c37c32ba1ca5a137691bfb587d858219300e11d 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..c84515e2b86bf2c2dc69792d73b9e43cb786d343 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..6627769c5d816cd7081f33a4c1a4973758a92684 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..049bd398e1e2b0bd059b160610ba2829a2b416cd 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..e878a5e80e1a247e2481af75d99934a58b60b3d4 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..8a840747a9f495c44278af17b9febec6aae3586f 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..ed340a1557f19099f2a1a8a280be226747dc626e 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..31146b63d96968f3ff9cf68f3807a4c2ae8b8187 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..c0807392f628a48419deb9b4056491dae68cecfb 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..2b2d536ec5b01c39add816239f40e3bb6388fbe7 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..436d8c562435035a20ab385dc9aa630a68e602cc 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..86d35e7cf2490299d8568cab2cf4728996830561 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..171b00d29d92043d53f214cbd8dbc0447c8d1947 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..bdfa696c1595ec65f7b002ec5c8073bc9f3fcaaa 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..df27501c1e94850a944e58827f203317a7c8c694 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..01a65201f5fd7e29f5c66a12238e01b7e664f640 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..c29b4f25c763f0505a5cc4a059ca135d25b3c0a5 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..4fa0be792a598b1255111304c2785e786e088ea2 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..e6c33f9b62bdc6f6be827b882c443434aeda8c73 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..57cdae46c62218fcb8e16ab2dd6f964c2042e2b8 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..9c16190657b460e0e4288596874312372220ff4d 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..9fa156aa0a94728bebc71a37c66545023fc3182f 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..b4dd48632e49fea60cd467bd6d123f7a1f8616e7 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..b23fed81946f0c7cb8a935b1376976b30313a540 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..c93c21446f7cf78b90b9186a59c64cf6b6869b40 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..b2ba316073d5b63d2cac9dea150b0ca621d28995 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..d1c67d93db0969f5ab6444893b1558c490ff7393 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..363fb56d674f14a1f9e4e2d2b3ed4099c5a448d2 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..db85810e12f230f68738c7b942fd01fda9be82dd 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..24783e4d1a1feb6d6eb55223a2d03c4a882e9eb6 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..3f2f6dc764b0b8ab193aee95c430d031d06c409c 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..89ab78c718de450f8aad8342337988f061304a31 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..ecb39228a0051c99327aa377e1320105c772687b 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..56485d1e8da2e9a4fff085364702889b97f856a5 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..8d656a538eb66bcddc2f2fdbe5abdd46b65e7004 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..70634550b7756e6e11be930b65f266a8de636514 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..272f8613c081cf9b958c02014d0c33d9ecdb17a5 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..d897d2bc113fe4341ff52d3de07c056e6572581c 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..73dd8c15382a4aa086c3682124e69387b1bd7dd5 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..e50cbe53051a94f113f34a429f62dc465a200b96 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..4e9e085631cfd4f7030ebc53816d6b5757412706 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..fbad5f4ecc1f017a74aafac9b0fa3cd450eb3c0c 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..b106ebb484ea3bf117011ae1eed95efe008805b6 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..fd47e138a1489743270894286d55fba0a73e6ce9 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..dc46a0dca49a521b3acd96de65a80906d6528928 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..3af79f9cddd4895deae37fcd86e5a52c21433b88 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..1031432da34fefee6f4a05cfccdc5058a4f44bf2 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..1a41ec49c7e8d6617c6e3b5e241b0d1e597cba39 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..93cb5c4021a344e87650fdb4f365714bb5240014 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..aea8171acbaf9a353696ea15c5aa0fd4a27d2b16 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..31d81f27639053ce6edb5659184be994bca28186 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..152cf77c15ec9ed75584fa194123cda4e787882e 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..d528ff940a0666ad21f1a3371ad76bb53744a14a 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..f9a18cfb1dddff77621d28e40637c337f2d633e5 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..62e3b05eb756eab21c28bfa3d8745c6c5e7f062f 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..483dc5a1a184079bf45d6e0a929c147bbd6b0b34 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..3411fbeca1f79cbd5d4375f7ce458178b2a0454d 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..acf63cccf459ad5b13b129399728d0f8547d114c 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..550c5708cae14b30bc1b3414c1bc047a9a91cc53 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..a7eea97706797cdfb35b1cd2acd36728142010b8 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..457496d6011d369fe6525ef7e492f2a260d2c54b 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..b35a02d126a7e019513d14b7513d0ecd7a6a7c6c 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..2a0eddc411f235c9078edd3ac4b6e59843447c60 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..3a9696730ef1773260d4a13efd609bb74ab418ed 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..420937e49d703dbfd9e135f772d90310904acab4 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..b7930bc84091a87e20263addd243227e30686827 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..a0f4539bbb439ea2353bb32b90774cb9ffae5b0a 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..4fdced9e06e1b0cd2623a95900bba865586e6ddc 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..c06fe211ee68e922b5e2b650df7155e006828a7b 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..47640c42f0f875932f2859e7e7e17abfc5e04248 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..dc9bf0d65f79f2d05444bd2edfd78f830deb7e7d 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..8a299fbbb4c81bfb328f967fdc1347ff956e4788 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..0cc5f1a6405be1e602567a596032115b79bc4a33 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..8916c8da44320102e5ccf5764eb480014fc08685 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..3fe085976825153a5398c1e9949801a2ceb5adb0 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..129a48e53b28767cee430b3e1f897a7193c78982 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..0b04b051d5d83ac38ac629437df9de6d204b2c75 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..8f87f3da6b303a5364bf16ec74c8cc3d4b5c9c0f 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..72e9653d43c19e0b78b352eb7b555282979dcd10 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..39e4c8d25f53ca611977d6658265d039ba509ec7 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..463b73bd6b7c8f780f084f37ce3e708c606774e7 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..dba90fdf46fdcbc7341b973a80f08859e4923416 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..18bf5aba1a89d38c262a7bb42ab78b0ca6f0d9ac 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..b654f958b7bca4a05d264ec9808a7387cfad11dd 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..d31cf81d121e8eaa61faeda57dc5a640534c66c1 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..bab60c7030cf69e6242c727b019fab5ff833b709 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..e30588c0baa8b55bf566a11dc3c5b3e12c71cfa9 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..3d83941cfa5cbace6fb9affa068a165679c35a2a 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..d5798392d9d0896b8dc83762f250ec0c9840dc38 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..1c7fa8e5a51b8a853ea51c2cfa56ea8524c52e90 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..61dc49f8102b345b08906fb3d903559ef5e18fe3 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..3c97a000ea637a990224cf43cf5011c3f6756f9a 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..5c3a033393a1fa9d9c4eed890c632c93818b4358 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..6212375728b1bfba17e918f3f3ec2ba302d4c3db 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..24b3d181751b05b5e198cf6b289ac3a8d50872d7 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..193494c116d702873aecc294d0f46db304283372 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..ef34dd5e5269295a1696e50ffdd2a0a0ad925d23 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..961873cf57ca8022d4ffe02fe01931d4bcaa3cf6 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..0cb33415e0383c6bae61dcbd68f1f80e9faf3faf 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..4ac77e130d91103bfc565a9950aa488c03ac8ca4 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..0749c62046b3d12aca025503548472a031265625 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..78f9f6d5244e35add2c8e4b81b66b1590e8803cf 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..c31cdaad84511e07326f1a40c42259cf73ccce0d 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..1bf52ab7326a59617393c6782598cdcd4fc5cde8 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..7027356235ba7dcff5aa1599c6875f6d83a6f29c 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..d241efe74a1876679adc53bb420998fc2ea6bbd7 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..42150b93f67d1be3c7fdda27933880bf6a74db7f 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..6215def29a2a9c596515ebd77e0770f040e75585 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..4346593e3311a24482dedd9cbaa14495677e8228 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..5704d0b543e3f5f23a78000d5fd9537fd09e2af4 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..3cb5b8cf568d05a628586b094df323356118a60f 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..f9aa2e5cd2d28b4c4b6225742f02848c6dbe9a7f 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..442833fd9973c93baaf225e3ba3791572845e4bd 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..3c2b0d5a8982e941a2b1c55213de0cbea4e1fe5d 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..47085c26b88cc12628afdeda49789a0ae4e04b59 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..5bcd85f99c9b20bd6be07c00f4ade33ac83b5527 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..a8d41d669fdd893c77795944c09e47f1929033f6 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..81e60b5e3869bf7f542d2d8df75d3ecd90578078 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..f011a0e3c2d186f12e73b37710b8ed02c21953ca 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..18656f6ab9de27f8937bb4d6a07c29881d2a4105 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..9fdd56056c2b0e399f9434ffefde73124f6f1ff1 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..611e0284abf927eced8e49e9d36208e26dd0afe5 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..af0a0240a87aa2924b0da96af310e0c46517bbf7 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..09f71d819d6272e78510e4e457517eb5ac53aa41 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..fd9b5eb956ee561e2687a27d8b6ca1f9cb52e7a2 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..262b20ab6ef0e369d92dfbeb14ae544132710c3c 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..5d7f559f134964ca228c0b65bb9dd6fd464d2e7b 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..cd07b0168ef6631e682b1751cf5f20aa5b8a1eee 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..16cbb40d45c3fb93811e99b58dffd9ffdca72923 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..395f10e06f274747ad7139bd0499e382f4953aca 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..170f2224cc047786f1ad009bcaa7b06833be1805 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..e535d6d6b88c02d7ead210cac6b1c95ac2f776c7 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..ceb9613096a5092e0e2e51e866140533b8ed8ae4 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..6b4d92a586a642898f17a84cd9a960138e80209d 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..805c412f4401170a1ccfdb0fb3e33eb30a33ce32 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..dc4b5acaa7351ab2997586d330000f342cf829ea 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..8ed29386fc1bca772374d1d71b07943179d9937b 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..fd462ccea004d010ad872507cc984ae8f3a19b6b 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..425a1430457537886ebd200d7a07ac075a47481c 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..bbe20dc02edcc729cbbc23892e1c436ce584f909 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..d5620329b7ecb6530a3d456507697889fc6329ac 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..80b84a122df4a9ebffa4bffb5b24f509c392040c 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..1d5dafbde23581490b060a7033139d0b02918f23 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..4b3f0203e18aa30912c3f90dea07664ecf1e0165 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..baa6eb4e9dbebaafac50e7924fb932dcc165b945 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..e4979accc56dc26d003997596bd52fd30c2f2173 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..7b724baa202c219815463b476452bcd65e09018a 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..9c4968017d2e19231cb416a1385cf9f945f5e0e5 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..f396d7a0b007e9236ad44bc1bb005dd9811903b5 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..b0da03b0ea30c5b7d314a2f52dee29d98d9a1345 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..b289d3b4dfc4ad827fd7838c9491de138566c588 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..34bb40c2244740b5dc0a91646ee36237e1c0efd9 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..2abce68bb9226c7ca6f5e8c0e7278a67e31e433d 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..c06d320b0b8969385619f40867eba7b09ebddde4 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..a7d65ad047cc48c2549dedb512a292c1b9b81011 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..29d45d267cbc353f572163f610cf0c4c2d0a14cf 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..649a970b14c927a68933fa70b4c7f5e6f8571e54 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..da3eb6b5be36109cfdf428cb5f03a1da80637a13 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..27de5506aac26e12d90dabc28419a0eadf3b122d 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..f5cb0bbeea54d2744e2a1e24c8a17fd987936d52 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..bd49839215de4b68bf3c49b99611c287e8eb3ffc 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..8a7d99ca4b64de07eec6f9bc551fc1c6301a4229 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..5a3b70bcaf0c76f7e172ebbae236d07b5a582d6b 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..0f8bb649928eb558a3ec680e1b241ab83ebc1637 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..00987506b4240bbf42b9e4ff98fdf4c9d0a17566 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..a5389a07ded2e955742691e74d94ce1102172bda 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..dbd0ce74b0ca158662ca4e4b64da1d7d00c7495d 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..62a320da9604798b0605dcfcdf061f0e6d36f3b7 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..32aa68d854cc590fb5fecdb24027a21eb4eb7833 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..177103afc4384725fcd55092631f559a06228483 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..1254ad407458fa09d0c1e6ea6f801e76d17f9ad5 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..4549c8e6347d6a08f6368a7114200baa5507a8af 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..44466220c08914a5c53a11b948cd99b04ff844f6 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..d62ea3ac10130eea803284d0b21f1674c854bdcb 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..2df17841dbe3f750ed2fdf879ce2ad2a1b57a3ea 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..6cbc2183c8a1aeb9221b2c8535b56bc931c55231 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..029389c5d25c31067ac41c2e0c5d9cd2adbcc119 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..2f4f50652e113cd1e68143b36660009208474691 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..643d744dcfd9ad31b9059faa5acee15d5c28bd59 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..2594115c2986fb71d01992bdc72c0f690974a851 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..4c419532d9669dabc08090b8b65cbbdc89608473 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..53fd36ac3107a3470bdc9372e6954a4dbb26f3e2 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..fdd1aff5ae8aa79d58ff86fa61b4d6e26ec4887e 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..5d49b8c6d79952c40fccfec910689ceef449df7c 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..fba05a33ec08670506f0c2ba92f7c974877cdb10 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..f4629e6c33b10ef4c611cd8f26d865bf5cf95e9a 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..9baa72aff5c1318a6b71ad884d078ab32665e7e4 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..e23c6b0dd4d82c542fdae52dbb8c702f94c9958c 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..d74929ad5f16257fa8586824305bae143cf437de 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..b8f8d60e45d632e47b16f608157fbe8725865863 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..a478fd80c199bbf616e1e5f2ee3143c892a6b896 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..69aef1d08ee4e8eba21e73cf90f69626f3eb21e0 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..4af7d222c80c31935cb1c2d2b91e509f08069705 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..b0438aa00585a911417aae0ad6db3af63c26481a 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..0976f8e0663973f078a506ec923cbb39d5795e7a 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..172c29d9ddfc3a0a9c26a5b9a2fa6b760ea8373e 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..8e463389074bc0800fbf55b41f76b7165234194a 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..d36538930f69d0a230744369dc3a73519d9a361b 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..a321f5542e6828722d13be2ad5dba96378c84a5b 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..b29ff6740d1b025a5e28af03b7a4a5d8db1bb6fe 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..a29fdd721645bb55b82ce394dfff2bc31a5d6e72 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..ad78d66818ee80cfbf172e65c81c12511d6e0a1f 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..f2b2d941cfeed7b0aaecb1739c58cd595845694f 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..b11e51a2c6dbde885b1e34ea13e66c3ce8be0fc2 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..1b8ae5e7a6bece8f72046ed9471aacd44c1356b9 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..19339797b52c41a388a13c0e54b874a2c4459e72 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..891e4d847c0219300a3a81858aeb75375cdb3a6c 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..86a127c54e178a5f8d9f01b74279accc6ad841da 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..a5855922c41ea50290c3c55ece74b660f5b19791 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..89d12b8fa45f921cf6195e5f960becf0846ca214 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..e55b7083c724f857fa54b77c6c9f47a750761b62 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..10e8a180a9747236613c57c29ac97e56ea65aa60 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..c398577da5c2965563c768bdfc25f5ac04e322e8 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..8ac945541151dde988b7a6f322ce84a5e9a175bf 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..fd5d67da7eebfe7a6ac99523f38e04f28a8e378f 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..effe85310b75ef3a65d03b36386752f1a85ad5db 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..cbb32e6a8ea66361261f9a8bb622f796850fa030 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..e5d5493e5629a62f0fb36bd6a8a8d43e36c15d74 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..f1365dda2a928f993e648a7ce25d399dde178386 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..859174a04372d8b2066f3041ebfcf4e41232e62a 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..c4ae2f4cd498845d5084d8dc3ec73a366f22c388 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..419b8f8d925ff45fe274c446a25111933d689f7c 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..e478c46de674dc56a25ab92412a6ac4439d16a51 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..c50deec0d31d8bad53cd053a76087b3a217b2e57 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..579526413c13d55319a65f5fa0cd7ee80b8dc102 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..e6bf1c461e3fc64ee2646df9297757d25414ee25 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..c3e7e66207edffb974e3942629a8684d8fcb9bd8 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..a18d1d7e53cdb52f0726c92981b77d4571c4b93e 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..e9a71a31593aca3410bdb96747008ec9f314686b 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..3fbea24f9c8e3ac948718ab5b93ec54e48a2ce8b 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..4c0a41caedb554628f9053113c60d5952381d4cb 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..6cb1d47a341f5e5bfba8da6fdb71275e0b6c2ad0 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..2864ca1b9e3f4e2b5c531301cad3c710a957fa10 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..235e265fd76a80d87ef48aea2a60d8713a2b3f40 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..92f7b552efdab0a1fc945c2f6ff3999e33250480 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..acea125df25584585482158dcc85cbd053c902a5 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..ea9cd22bb8e3806c8dad8ca302480ec4320be2c9 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..e1ab0a7f9736c74fce57e617872190c2e08cd7ba 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..635c0aaaff64faa6f9801bb3c2ff9a20a7b9bed9 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..d1e94c16b03f5eade23ca41cf397d914a0ab0076 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..88d2df123163ba6eb6b49e6856a2f3789d0a5669 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..3e748a7fadc830b7bce15f4d2eaa0bb5c8f04392 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..e080d124dcd24218c55d684c901cb2a5cfc6cec2 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..c1df54aa42981fe062bdc0e7b58242122dc4e4be 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..431eb0e23d05840a1ce270afe70305080877ea2e 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..c4d35ba1cffb0eb6728a558fa68de024429dc024 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..1076733db0713c9c26d0cc3a7d06a0385569649a 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..2da2ab7810c766550275631f345886c63e3e3b6a 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..cdc5a3308a2e0ac963eba5be6c3a6445e6d06c63 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..bca9db935881dfcc4e6e81399733a49cf6e85986 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..bf88d1fa53cbca5c1f5f1056add28bceca291196 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..3b954518289bfb3e9a6a45d55d0064f0d258b731 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..a069a0209faedc8d4b0a35275f64dc76e9830213 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..9ac6dd559aaa0f6d40b37706709972690109a808 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..d275baa9c5ae938b0051cc9ba5a44bd5efcd48d0 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..46b59fff01b0f271a8adf5f9528c44553717ff00 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..2ba6b6a04ce318249aa7a396f267fddf09aef2ed 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..2dec9078707962337283a815823e9678f59d0e36 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..5e764f5967ca15fdb145043917116e39ca9d6317 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..83fc0d60e5b015dd2b1c559eee77db60c59acc1a 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..44324af30adc04526bf42b613ed8cda751c65ee0 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::make_optional(RenderTreePosition(*element.renderer())) : WTF::nullopt) > { > } > >diff --git a/Source/WebCore/rendering/updating/RenderTreeUpdater.h b/Source/WebCore/rendering/updating/RenderTreeUpdater.h >index 45b729ced32803aeac3ef9a36d3391b9e25bc7ff..5663ba6d3bfb3cc88c24769d6b10686acf96bc20 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..ef417137dec38db8e72a265657aab82bb8f1cd52 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..a78665410d154bc79c10f2fb3907404481d6041c 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..096f07d7bb89c4869da888e44ea75c354808584a 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..d49c4e717f6d09db48fae2cb47a94ea643bd79ec 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..ae4d58bfbea5583d1b1f13c1b531be95f5086e0a 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..44bf8527b8f91f590ca6a5f1c59fd776857df727 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..ccd70cbdcf91b8273c2cbe7c142405a839551a76 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..a28a3d35fed796068ee6c01a252475de55f31f6d 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..d7c79736e363e7b36c9d73fcf5b61f2708179718 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..ee116ec75bcc7be2d6b630f8c97f955c6c46c9ca 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..8a5a40706e9080612d6bb0adbcccc3e565889614 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..65e9c8a42a99e89b63c3ae2ca8303cf40aaf59e9 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..469f5f77fb31775bd91f83b8525f2eccc0c44675 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..5e9b3904a6c152e5787be0846b0a3666f7f55079 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..1a228b43d9e62189a307611bdf4bc4427e584e08 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..ade5b5b3e8038bc02bc7c6c6637cdb40b403d0d6 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..29e0eb55d46f228194c1f0c87e49841939b2b11c 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..c51a2eee607632a9811ba57c784e21831ed781d2 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..241ed42b94b222412f65c75fc15a4d98be84b96a 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..1c770f65e4332204093a7b51c2172abc6919db92 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..261d14da4e187eccedf4c056e071ad25c6f21754 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..dbbbf8ed52e5286ebb26a14a46a1a695201df81d 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..82795ccdfb0057fe4faa3a53b4f30fec819a7a2f 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..1be43861b4af6ce54e50d3aacb055ee4d9e0b948 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..8f13494579c90d432168844021b3afc89299f0cf 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..eeba8460359ef46eb218ac0b69558fd48276fb37 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..44c2dc3a8986cb8e90579308f2f709af9d553340 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..f30867a6a64e60cdeb7af5a53e795779c314b4cd 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..c61072d8785d1fa26892f7e046eccf04c84de878 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..0b1e6b20b5d992afb861a3d47192e6ecf14bd0f5 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..4139f5bde11540f00d68eb176a61a7807b3a3412 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..9fa0f605cfd4d98974d0e8ee79e4f90f6c3eba53 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..362b99ff8106adde596e0df5000ad1f9c43b1e58 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::make_optional(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..f7693eea45b93be25921b856acd0c849f3415216 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..4d8bad344b35dbae2622ccf8081e614cab5be7e4 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..f71b3f7b4fbb4f7809fbbf21a26c3acc0b3b8efe 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..7518014878cf8d9dccc76c4c3601c3e05c93590b 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..0bc46061f1d8c2791b951e5b9e01c9e0cc5b7785 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..0d49a70b82b9db7f8ba924d08a5a8cc7973a5e6a 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..40559ef463437ee01723fd09dffc19b3e7575be8 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..581562d71ddb006f00f72b26496aa35c5a05f71d 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..0eb4dd7677f535fd848ab26f7130c4f93ec1df65 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..f0b79e160ef2b24aa67beea544677ef7a3368876 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..f6913b92eee879c8f4c24b587034c19eff013ec8 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..9e90f285f97d11433d71259ca6431cf95841d1a6 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..8772d7e3f8b911be89e1a7ff91cac6b9cdf13634 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..bd1324b8bcbc841f612ba45fdb14b02f1910b9ab 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..4fc3634ff214d07a49d2279de5f735a334caa3c2 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..6b9c7ed90e7505c24edc124b7416449c09eb199d 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..3d8f5340162622e4bf23b9c805bc9daf3151eba7 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..aea2c332229efca6257d92cec17ed35de82bd793 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..c8a58ef90934a2ea7dedffe4a2eb269630caec18 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..6a11a332b21af7dc0aa02c895001490a44dd80be 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..2d3e77fef56e9d2deaf7e11c9dfc87cfee407f92 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..87f28ccf6699aab6bae5d904f0e61832856946ac 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..bc2a9ba5d3876dc8c14b7ae917e16a0e43663019 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..048903eacc1aff018436a6b9500265c28ec4aae7 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..299fd31b01ab1d50b1f58b092bacaf8d7474ead5 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..67b1bbb66da5ccb9c1fca0afee6f9ebbb0de4fa8 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..f34c2266ad92d3a935df6f6b247a6dd7ba35f3db 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..fc917e6f520debdaf1598bcfa93855372b9b84e3 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..107f1934897711fe7a314218d175bd426ce20bf2 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..478ae7f3fe0a1d7db8183ae38822956c0fa848c1 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..6c8693b060aabb637af042aa1c8c70c97b9feee1 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..1db36853f46d59748c081f213c606e62d82dd70f 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..5c5a489442f18f415b243295f04e356e83a2a325 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..7806d4c920ae9be35599e8ee36aef23f0e9c35ba 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..e1eaa8e7e193452a40b2358fe951184019847399 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..d5d1fea3878b7c02240c3b7977b959c78ca489f6 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..1ac874438a944b43edd5f28b19a88a3ca0e46046 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..faf1d961b15bff2f2f8a245421460cddd5e46d92 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..ed66f3cbc37ae03fbfde80bc1663cb031982b851 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..70c729518eade06a3396396bc441f43afe011eeb 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..719a6c7bc2aef1aa253a72e6830e01667ee74b7f 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..c4914744bf2fd0d6dd321655cf478e90f341d34c 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..90b7c5e2269e70e6b683dc7147ffe27f210d466d 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..1ccf49a5aa098dd241a8283e0a428c82bddb5254 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..36cd11540fe21169b164967fb496428d671bf358 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..661f75a9f9d3c5073a43a870c873300b80278204 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..00bee84e1f5ae207dce116fee085caa93ff8a7ea 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..64f896259ac6aaa5a82ab66b2fea2576f3d379de 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..188af616fb01c67bfdb2c9ebc2b60c044e99f081 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..4b84c098f60c35663ed43ec0a662d7ef2d4711d6 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..e5049dda7236e425ed57ed2f1e3ec7f65059e66d 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..c4dc60271a731b27b5f97b5ff9f431716b9ba4e0 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..7a3777aa20fe64d0ba1238d2210cf927c4aab1c3 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..a51dd04c7e3725e547e33dfbbca576253e082e4b 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..5f2fedf8215a5efa887319c3aa827536618a7ced 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..293fbe4391823aa66b8cf0b2cee4d84ddcddd5e3 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..f3da361298425b47e8aad6ab019127a6c74eea19 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..a9a3c3c840c8c0757424a79e6ccb4522dc085988 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..0f61a2ec18b7a89e7ba2871c0885890a80318e02 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..5f052e6df6458b8335476854da573e913f572d90 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..7ae7dc93e93deb565ac1e047ed59d1fd69f00e33 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..ff3050d56b4e8842091aa5d6eccb35ef200a641e 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..aaa9268887b62f0efdb56fec8029d25b46a8e526 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..0bec7d17d5e7b7f8309d22f65ebd08afe369cfac 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..e4d96920e10904f1948406bbe6cbdf853a035b8e 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..0a8c9248297ea8267fe5291c4b129f527d8e2981 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..61f06fba382a41caac305eb5848bc15df5abf597 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..16cfe0787863794aae25133f25abbcb068c288e9 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..462814ea691e061928e4ba694dc414397522e516 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..7b127cb6338ffdd08288e549209161fa46d61434 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..1c519e3eb626b2c59f71f23c0e550800843c091a 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..e1bb8cf8415620453fcf5b1bb48a9975062f806f 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..0d96d18c7290bf8fe6995fb109125921ea06fa04 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..104a92ad10c6b87f5dfca636c28c6c4a9d6d201d 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::make_optional(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..f9f14c356a7d3efeaad8cda2c3c0f08edcb7d941 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..8438b272418413f2088e3b20ab7d5ca398ca9067 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..27db48070f077f117a0f76ac031bd5b787d12131 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..6ed01a76153a9a2b3a7abc9abbd3543cb5f048b1 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..2d26a9cc908ac9ae959bc350b3f7cd93f2cc8054 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..fed2113b37679dac56b89f3a0583c74d143cbc8d 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..6f9882aa56d08374124836cbfb86fd443e5dbfb6 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..c93b3dcab76d6f9bc7f16a99720b5650648d5dc4 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..f66a9ccdb92087296cd6855070c13776e329d44a 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..019c354e59744c2daac610a5e3da799155ec8dbb 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..f43d1f49bafd18294addb0ce961882e56a485dd2 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..6733d28daaf08e73d0fc9242e3712a62d8c01fa6 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..2aed07b6d29384cbea7c51d297cbcab36c4ac162 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..8a8341e67552b0a94defd93527fc2ecc7605f152 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..e579144ca3b2883dd8252bfa56eec3d4a8ab33ba 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..e11736fd867a46138ef2fa149cf4f9d8773d3792 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..31230afa71eff17e7888659bb6194cb720739c2b 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..d88aed090740a23e79c28b0bb0bca4da46301bb3 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..89436af5e1f674c9d854631b8dcceca68cb3204b 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..839f7e287b9805680463265f7c6d28965b2a21f4 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..dcfce671b67e5da654c495154637f4f908337eea 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..c92bcd92aa05af236ef45d3f82aa21978f4559a0 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..3375d6e5b2aa9e5e544f5cc569201d25a8bbe358 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..1c83376cb51329db5fc00dee38edd79550b558db 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..526d160b01a7662ce061f598a46d1099b3bafef5 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..ace360397abe3453d213b8e93a44abc52f7df41a 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..5e5193aed23f9edcb8475f81504de6290f7703bd 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..1bfe4d6b576850b0b85a25b96bea0ac5ff78a477 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..b03f96c933a31e1627668b4d93e5266c290481c8 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..132f7798895410162b076a34680479c834d1ba9d 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..a86e66ac88958ed6381e8c675b297fe26e2ade2c 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..ceb47eb805b5537366fac15560b48034694ce12c 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..7c087b4f96053915e85c64d9518fef0e619487ae 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..89e6ee158f30349cd18b68875f981a4b3477389e 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..62fa1a75b74d18e32f6895020cefcf2cdbcf7262 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..b8322c820709c7759822db368ef82835056ddc2f 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..89c8b37bc489b0a069cc6d6e83f0a5f2b38d40a5 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..66c2c53ae4c767c0690a7550e78e280b4b452707 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..11c764c49f4c157ac6bf8897ba57b4335fc37bc4 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..9fcdf93266f29e8e7f7e8da2713a537782dabfa3 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..6d64bfada2af6068cf9316ea8e9e9a0cbb7c1cbf 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..930867e4b6cdb38b750b4a3e2cf84f660ba0e47f 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..10742aada8b1b3f90da22af2c2675078ac1e3fb9 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..13ea62a71d6b8b661e2426ad0e58fedf5ab8634e 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..826cd6a3c96fc2c5266c3bde89badf5c50da1350 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..0c2b8d6e870467c5bb2bd483fa10b4b98647e097 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..515522b98103d3048468ed959e417f82026d7bd7 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..1e18454e8dd520c6e1c6cf0a29aaa0319a40969e 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..069c9c785d3c7ed959a2f2f448110a1a077015e9 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..113545fd6ea6caf7c03ba392f592cc5da9006f35 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..2974451bbb3d466db58fa815ca5c487da172abbd 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..56661f69f22e05d4328dc227edf33bb947ee0dfa 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..6427262674733d0be055ffafb341732fc2c3aec6 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..abb710bedb8d25c8331606c9f0a69ce2832b6cdf 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..139ab57c362caecfd3190a6ffeda58e1fde98c90 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..0331bf38e808f9f6e2f447a4f0805df3fc6b063c 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..4ef5ab6c1bf064c8aa22fe0e48c41012007ffc19 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..aec2b10057686e5e42bba985af3c425b765db552 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..14bc57251f91f8872cf6b3d311e06400aceec8e5 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..212d9300f94a125dfe6f3b5c7567695c83e39e07 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..c154025b141246758ac4b86a7e3b09aa4616f42c 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..27cf0fa2b4d053552148bf7d913cb9d145fbf972 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..f1048008f024e43685e000cd838f683f2666c491 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..01fa196743200f2957111963b5d8ad82f75807bb 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..c576e10119f0e5db58e63fb86afc843f9455a607 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..4c46c07a67df3a11a814f78977993c0f58cae686 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..815ae6e572e8a438142b797b911d85200be6c924 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..6c384e09263cd702cb30fe878f0741cde4f1f736 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..afef34e0aa2a1bce6936f7b17726fb2ef89afff9 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..3bab46021089b6bad5beebfad8ea8f97d8c2c0f0 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..2c3f029a8165c45d4eb00cda257b62f22edf4cd0 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..b7f8aab68a92a6795aa3a58351b8a5cf2f812328 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..0c699f2befba6ababd3d02bf634edf113fc17e4a 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..15130ac3137d33afd30bc2615f0929621b46f9f5 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..820b580b56976f6e0bbd6ee70dca61ea500d94af 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..36814bbec239988ea09841e945082778b73a1d2f 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::make_optional(WTFMove(result)); > } > > } >diff --git a/Source/WebKit/Shared/TouchBarMenuItemData.h b/Source/WebKit/Shared/TouchBarMenuItemData.h >index 238e6363774e7b53af86e0ac1376ff1b205c3a0c..fee71b11efff105f00c51f4ccb3bc16186d8df3d 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..ff35321b9813c7d1dfa5fd78b7e374fb7e3ac531 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..b05f26853b4ba9626908b4060aedfd9a313c43de 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..069ba832d3bbd7a928fe8bc056039447d3ffe601 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..26e1a56fd79c7f96510643815e184ef5e38f2f87 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..04c73acea3aa4b24a24981a62667655ac3e29b2d 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..ab4425c8a70965ef30333f939f6666505bd7a2e4 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..aa4b1dca508caee3ba0dfcfb17463d4bad54785b 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..32df906cb20b733b11841631951a762b9edde024 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..73c84a295c97230b0aa8234ce4fd351224c23548 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..305e7b6aede98e81b01138a5fd00ec6f4cde52ab 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..394f5d18b0186273e7b84fb06775025405452804 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..43b69534152623ccdb28a5d8ef34dbc61a534377 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..6078a0e393cce8f569c0a3fcafba7039d89ec4d3 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..57c22ef2f174fec9f9ead1d09ff8c71d4d7ec438 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..aef603ef54690543d6fdb399e4f764cf5316feb4 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..dbfae2b93588d28492b6517a16af9cf24cb69a8e 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..16ea3003262247154131a1b5d3824e1df926b02f 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..4455f5d46a876d98af839a6fe06e28790e09b533 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..8e6fa4dc94c97231c70ecdb2d3d5abb7bea1db85 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..2cee87a05fe8e53b75b38ce12661a260c9a9239f 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..2837ca63f0c4fa3963d500c137d7161dc7be0ad4 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..16376901ac5c89342fa7b4737db376e6bd5e907a 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..c59b8125f8c8e023812b72b0bfb4ebb85f36390d 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..dcbd84b4fce7f6a190d35cb4ebd4fa026fbb47d8 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..3a4c07cb9d4f40378b557a6e8a6bb9664460b737 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..eecbebb33eb3b78eb48b79fde0f579db2c48d955 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..b3d2d79e4b23c5fbe476d56dfcfcaca755dfa4c4 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..c69e307953f5a4bd74c28b825a1ef7bb12fefd18 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..c7492c769bd724f3f0bb86b70c6db6f94b8809c9 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..c3af92809ad907b9f2218b0495cbe7c349d626c6 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..bd5b66f8a8fb42cabb240628c008f36c8e2d3ee9 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..8b7c484efed6d90e986625238094276c5933931a 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..d494f3cde54bb94b84ac86dfbae2c89c30436504 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..5756035649cb05bd803ff35bb11f68eab48a787f 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..216a25fd7ccfdb1a5205cc5a362de751c5662694 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..6de6d87d963d374ebfc6da375178d896800a4649 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..d82a00d910b7771e4dc10f76b81586c32a7cacf9 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..c227443ccbb58f2fe406d264fdb9a3297eb375e9 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..d11bb1b043ef32bb8893da8eb5ee838428f4b2bc 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..a2feac7b9eba8711bde95d87a181b42346bff91b 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..d5ea567b1a3d4b54798164c7739ab4cd890b9376 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..e770cb6f0bd5312bbe256cfc543f32555c8f2b70 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..d13bb57916f1683815f43bf8a546cd760952833c 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..fcf6824448da78786da2a08fdfdc23e149e5d59e 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..5b0e0b6765a00d33fbe3f0832e4553f189741a4d 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..34ca65fa7f12352ca7f322bfe50747836a948186 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..3f8168e9376f2ca4454d4ecf73f629ca56758ec0 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..7b53775433b70c7f1d00bce74912574517ee8787 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..bd5485677fec648e538dfd1b73865b0ce2c38d66 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..c1c8fc43866fe74193133aa23503666871d1e6ad 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..33e8cf0df858ab5ffb216f71a7d5de024d0c3e1d 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..62bd6acbdc64d422a0cccedd41b329f31262f94d 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..ac84d9cad376a94dddc44b0a71823ccdf34516b4 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..b09365cf848bdbe85db9ec937ec7d546d79c2d2d 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..8d08d6aac288e46c4b3dc5577f65cc21f57a10b1 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..fe17deddfc6e664166f348ce98d76efe193918ed 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..5160b10401f9248b850eb926e762c01efb4a821b 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..ed296258c57b81710675c27f19fd8dddf57dd718 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..75b8d1bc1a47a502b8606f5e512d2c3f9824ca6e 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..7c83957a95d94746e7959fbe9f567f13dd8c3ddd 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..41717a62a065d41728893431c86466e9322ac23e 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..8963ab3a85620da599299d44800bf177d7f801e5 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..4ea0329a75523531199e8eeb823110957ad31393 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..25594c9a14643cd72f63ec9b8cb141c1df25a506 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..612915da7e80420a2912d2a9e71d92dd223ef7db 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..f8d66a263b0c026893c655762c190dfc60584cad 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..3ab988d66356364b542591f23c49d8e57c2b8654 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..e4a27ff930d4efc0735f3e04fa9826fa97fcad0b 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..59d924d2f22f0ff561466a9b005b39626db9300a 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..75bd4e3b2667cdb3a62a1ae5bcdcad3364f9c05c 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..8f2a967cce88154e18c3a786ecfbe71816d4efb3 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..1dd057553e86d882f29e9b79d073910701f09852 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..789f70eaba8581c28f78addaadee9077dd80bdd8 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..3a14de302ee3cbed594715344b2ec11f1fc25a3d 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..38f83265cbac8d5d6f3df1aab4689827e40465b6 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..57f6f0d819e11e604400def3c6e2afaf85562302 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..72bb78bb84d145420d459fa2c4f9cbe420d7a212 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..cf94783d468ae9800f8bbe8426103defcdea31c6 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..352677f6f37344c305d30213e4d6b2f94eee3a37 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..3f34ef388f2a276324bc515b6055baa5a5daf1c4 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..409682a8f563c0247d51dc14f9a9f0d0e8a98f90 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..f2073b232df89195e8543b095723284b7bd36023 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..538652dcc888cab8512d48ea40f93be80844090b 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..4bbc5b6b9bdae532f354567ec3c695d859c6c771 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..314fc437bc93b1e8e43ad35eafc7ffe45d81bc23 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..557872d3c58e71b7ba7f589443e68bddb5dd498b 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..e66610326ceaddd6af93fa316fcf2d3814be1ebd 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..f72cff7dbdfb64a84f277ca70f1b83abbdb61c8b 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..0b863fa9027ac6d1ee96e0362a26be416ad2c900 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..25bf83c5ada49441b0f81bd12a1ac966f616c9eb 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..86b3e192c925e634284d06eb240121e9b9107b0a 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..9576df3d27c84c5c785fcd156a33ac6ac021944b 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..011aeed7df104f84438daf924785716e0d385cbd 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..fa71e05c8f556e0e74c37ef7c8b9824a3948c772 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..feea5c8c1dda60e1df70bde2eb2cf35c8dc0058c 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..fb35fd83728717d37f68d8a9114a7cd3d2d656b8 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..fb88de435fa508303a9aac7e91b4039bdfc7c0ab 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..ae45576b7f28bd41354ee52404a7ba131b64b11f 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..9f82094f11422333bc17b84613992cf9a51ce1b7 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..376e283bb70faf0c6e8ca771a455f1d7f5fda5d3 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..51d9059f8d6ba5bdecf4107afe7878fba64b439a 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..fc656458d7629f55eb6b8cc7b00551422144ac0b 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..9e72f2276d3068fc27ea364fe7a509a8c23c9383 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..2fc95906bf1e03b8b77e239c2f4ee71bc674263e 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..c8da74eae06eeee9a4974517283db78310430d8d 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..dde7abd0c515d8be87b3b999dd7b91b89b052592 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::make_optional(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..b67ad279dadf2e62fbed592e5c802a226b66868f 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..cd27c55cfc1072e137968100f3830bd80620edc5 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..1bd6896e688d76c709577b5da9138246447b34eb 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..151d92cd85aa72bad2fdf1e05996f19a3b1fbc35 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..8bd8f72fc89421ae73dcb3a7e6be71e95b8550b9 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..33cdd94683a5342477f3d0aee6a9dd5d63349078 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..8fe404bdec13f87ea450e633b3350677b07d8753 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..7639e184f291752635b104caf4fea8f7677677cf 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..615c71a24c53a0ac9a1b8e4b11685f00c906f98b 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..d7e148adc31ed8131a802177ebec092155e37a37 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..3797a6ca785e9d6d1ce3f27c7807cc8bcd2cb3e8 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..839b46f992dc779a611db9579e5bf641679b54fe 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..bf952c11a9780278a6928f8fb5b0a23f59c54745 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..cb733adcc1df93edd71190b57110836c654e0058 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..93ebb2341e5d1154c6c6a47458ce47add56e2d2c 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..fe85d92b352a2a81f43f36f027024d82a4f4c4a4 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..2eed476ccb33268ada6e7df198680cf063debdd0 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..c7835a21a7ec95b2ed75e1e16694f1ce26745cf5 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..3c82060959e1a4c6df5081106121ccfc361483ce 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..08f4f46d1998b807ba34d9953d753415db7836fa 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..6e07c9403e04bfe4f612013001cf30b9c863f6df 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..ece38ec0ae5d97086b2ce8849a7a62e2372af935 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..86520b9041210ed9dcec4da627f8df3e5f6049a6 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..059f7b53f167d485073c1368bc6479196b3a2f08 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..de93a4bf58689210967a24b46a2588a7087bdf76 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..fcee52d748d529b6059a892eae95bb1e87a7debd 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..95c119224f7d0f985d15ae63d4cce15e1220c61d 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..5731989dd43ed446350a1f282ff6417232524b3d 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..b020a2a210b5e029ef3414aca38e166645ec8519 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..d5acd9fb913806d62f036c632f10cc297e69e3b6 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..2a57b9649a5f2a0991a480c1778f88fde00446dd 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..0bf0465b151f512cf8c4bfe5969bd2b782a71e82 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..dedbd8034ae280a3eda703c8502f98b3c2736fac 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..8c7e1d3eec78e7348603a94abbe9724ffa988370 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..45028bde5147ac25398780f38f4490816065cbbd 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..384cf700369a738b6a9b5a904945e91aa3c7debb 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..47650eee0a4e1b6de640549c71222112ae1658a1 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..3e74a7b8979f33bddff39ed08232f43f94d8aa03 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..aabd669cfbed339bca70df5ed666d77efc7799f9 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..31c847378d7e509904126542db6daa84223b0e55 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..28c1a859dea1dd8b61eb79e86cf61b9a42604639 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..a92c8ee4cde88dde6b99024a1e9d8c952cfb708b 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..615490b932cce2c4a7c5e7d725776489fbfbbaff 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..e0a5d360ea4c452392e0b62f37d345d312d0725b 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..c339c26aac56cdb5da9a9931e7ecafcc604c94d9 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..86672a017ff5fac46b3da7f1d1efcdac4c63bbc9 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..5fd82cddb9f6a04b81861e38603ad165c9c4b412 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..b7ec808a42a63b58af590caec3c6887d23dce34d 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..f5bc989e2ad4282f6316f8f0cbdab25f13eced3f 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..726d38514980b4450d62ca43dcabeaf9a781b32f 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..b1f90c216e5d87568f118e7aff71a68966dd59ee 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..230bf5f3e9db3fb3dea67a2c95d0e67998b043c0 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..b68d6f0f212a4a8095d41774bb8f806a96c43ede 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..8c8437b8675b0df21a03e6ba8f3b92a831918df9 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..6f3931704464ca1862af4ba276db2ca1544540c3 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..30ee89b9bf59a3d9d704196399feca6fa0864fee 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..add2838bb03ab5bcfded867d164128362f40f56f 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..93cc47dbc2f3fd695d59a92b86072317ac640f6a 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..0288b8e7fa95c390e44d5f310860063f34c438d7 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..d517492eb83874b2ca188976f75f1bb8600dbcf1 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..d62f9adf07996e34498c27182c7d5ea32eef6bfe 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..3b23446d42172ded9ace62b42ee61ca7656bde39 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..5444445676c70c712809f860cfbbb3376a1f5ad2 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..34257d51d0f853b783d0b578f915dad76a9e70d8 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..cd04827774046eeb3f5bf0dd390724ec6668d576 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..c1f13c45851e94871bf6394aac855f360faef1ca 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..fe8122209e87f076c7d3a98bda7537b7ac10d25e 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..58ee71ec454c91467ade56e7b47becffdb8fec72 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..f509b620a3f678c655a072220ad50e21695cf595 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..832e57096c7f8a4527e34535cb0bfca008349ddd 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..4a643326cefca88312ccb8aa38d236c3e7846488 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..3172acdef0468b32f1e7ea284fd7ea98d30e99bc 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..dd936cf3c9a7ead10aa0ec5de9da839487128731 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..d809145b33ffa02c1693dbbb970830841f44e307 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..b9de751d601f899c755a8746a54d31dc5f6f57f6 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..833001eccc229af3102b90b98dc872aad8fe4185 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..0f2a481f63029c20cb493648ed479ea7554727e3 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..c45c77c55eca90b1a3bc8107bd81233034ea528b 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..2117ead985a03e79915fe94465b72d309b3f3c62 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..809a45cfccd819af7c40ad6ee1fc5d67f589b0c7 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..ed11f9ad30fc3f85114300c8b6cccb4a4276a224 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..3ed8eacec77c4acd88c385824a24da126a71566d 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..322a3302dd1828dcf3ecac5a716ef1dc84fdf06d 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..e7ba33beced5385675bf748e3690dd57291a7b1d 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..8317a3805c72a74c7f1eb3e994e548a7462d18a4 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..9c1d2c2864ac88e257fc5ac75346a811d11f023f 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..87fd394559dc349d4a385519d220adc11a413f9b 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..fa835491606632beb7d8484df40e72b72ca8f262 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..aab23a4188eac546cc8566e629ae0d540c9fffed 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..e34d3e4bc7945834e04651fda5e05ed69b779830 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..f0c1f4673cc2622e834c1e42c569fa2e3565b3ba 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..65a2fcb67ea46198052b6d1d454e69700e29efad 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..a5841b6839176eb33040300ca0de7deacf2aafc3 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..c8fa1a0d4d86c6c1eae55b23c78bdea452888dfc 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..573eda87f0c4fcb842dc93ce60adaffde74bf679 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..65b06aad7cc550f0235b9342550e300d51e22142 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..88c1d2cd951e09470e79bbcf427ab1b754a60d1b 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..05212083a813765ae1ac99dc23509ced766c52a8 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..ba2725414dec80a83b5de3f63da58491a19a2288 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..de26ad9ac1ea83a6220d435a8c9f2f133c79bb30 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..f382dfd05d1eaed4c34f0bb9f7238cdfcbc3c7b4 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..92629b31ce724edc08c7dd691f2bc2cb132342d9 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..a4c6e2cfba410a79a7b913d8a937b5b38296c996 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..ae508abb65b7329b06823025d40f0557126c49aa 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..3595f59522e8d4ba6fd510d2ca821eb5f0070aaf 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..cd7b8b5448b55d5f8f27decc8ea0570ecfe50447 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..7b23728012b0b0171fbd3b8539955bc841dc936b 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..93b35ca46201a89f3a27173e39c9c14acb98944a 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/Plugins/PluginView.cpp b/Source/WebKitLegacy/win/Plugins/PluginView.cpp >index f855dd263f79cdfd41b646595022a8c44cca2f45..53c43ea4bddc1f31293e011b9c52ff7ac15abdfa 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..f46b0650d365a8e6f2e8544c359af207267682e9 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..88f1b676bf5347af22af9f30dbd5c65d5e8452ec 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..a0928d84c59af90d42c1015504d804ed1d7d5be6 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..ff9d7c491d126fb55ad681763796f73fd0936a09 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..09c4f77ec1e3c8e860b0319741a5d578ccfcf420 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..07abd53f3ce9bce04e1afb4c5f2ab7285e406e4f 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..2ca1277ca0fe1c65c88b6351e097fe0979a883b0 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..b614d75e347ae6debcea5b692ff8b1656f957e92 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..58bb98fbe692819b9d34bee8c7b492d2cf138f20 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..e445bc92b0f491182a69bbcae89bbe4482871986 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..897a4dd71845293ecf5a72c77665e4c350272fde 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..b9d3f12b6c7b506111acf69d1e15716c8ddf9c73 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/MiniBrowser/win/Common.cpp b/Tools/MiniBrowser/win/Common.cpp >index 4d1617380afbf2d6ab1b6894e4d6a0212a2e5291..5f0da73131a42746d1afbed12d5b613de4280110 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..5ab51ca80cb87e1fb249173cd56a51448bec9215 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..efe04251a18ad2a3162b2f242adeab68c43aa9fb 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..ba5a1b27f7a199f40b9ae232c356b4a65c0b9619 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..c971438c6b0ed745c2f61cd66e50c92471e217db 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..1d274b4b1519320f7f86647f7233c2ef6eb1acd5 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..e79fb17d163b10a9ce8026c491ac13f959154f43 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..68097d02a9727bc0527d20ee3a81ab67ef2c6ec3 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..3e701b51202fb6ad40e3ed10b80c5213fa9328e4 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..c4c6969a048885608d7f14a72c615d1121c578a5 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..6f2278f6a8b78faa69c1807721bea2dbdbe45a17 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..e185b327413a4fad233677c59a4f5d84a2ef1510 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..fa77c209aac2b78114e8e26c657a5992d9217460 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/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index 8822f15d0a5e7f91a3bba47fdbed0eadf0282a2c..a11c03d4f01168840f74b482ae47cb0aaf384fb1 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..e74947edd3c70b6a621b9868d4e66b668536282b 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..7e9f4a1f70f00284bb4d92d5eb26d1cfd51cac1d 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