diff --git a/Userland/Libraries/LibWeb/HTML/NavigationType.h b/Userland/Libraries/LibWeb/HTML/NavigationType.h new file mode 100644 index 0000000000..388d0576c0 --- /dev/null +++ b/Userland/Libraries/LibWeb/HTML/NavigationType.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023, Andrew Kaster + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +// FIXME: Generate this from the IDL file that just has an enum in it +namespace Web::Bindings { +enum class NavigationType { + Push, + Replace, + Reload, + Traverse, +}; + +inline String idl_enum_to_string(NavigationType value) +{ + switch (value) { + case NavigationType::Push: + return "Push"_string; + case NavigationType::Replace: + return "Replace"_string; + case NavigationType::Reload: + return "Reload"_string; + case NavigationType::Traverse: + return "Traverse"_string; + default: + return ""_string; + } +} + +} diff --git a/Userland/Libraries/LibWeb/HTML/NavigationType.idl b/Userland/Libraries/LibWeb/HTML/NavigationType.idl new file mode 100644 index 0000000000..8d6f6f321d --- /dev/null +++ b/Userland/Libraries/LibWeb/HTML/NavigationType.idl @@ -0,0 +1,7 @@ +// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationtype +enum NavigationType { + "push", + "replace", + "reload", + "traverse" +};