mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 15:55:06 +00:00
LibWeb: Convert SandboxingFlagSet into a enum class
Instead of having a nested enum within a struct, use the macro AK_ENUM_BITWISE_OPERATORS to add all the convienent has_flag free functions and such for ease of use.
This commit is contained in:
parent
967cb86c5b
commit
d97b09693e
9 changed files with 39 additions and 41 deletions
|
@ -6,35 +6,33 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/EnumBits.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/origin.html#sandboxing-flag-set
|
||||
struct SandboxingFlagSet {
|
||||
enum Flag {
|
||||
SandboxedNavigation = 1u << 0u,
|
||||
SandboxedAuxiliaryNavigation = 1u << 1u,
|
||||
SandboxedTopLevelNavigationWithoutUserActivation = 1u << 2u,
|
||||
SandboxedTopLevelNavigationWithUserActivation = 1u << 3u,
|
||||
SandboxedPlugins = 1u << 4u,
|
||||
SandboxedOrigin = 1u << 5u,
|
||||
SandboxedForms = 1u << 6u,
|
||||
SandboxedPointerLock = 1u << 7u,
|
||||
SandboxedScripts = 1u << 8u,
|
||||
SandboxedAutomaticFeatures = 1u << 9u,
|
||||
SandboxedDocumentDomain = 1u << 10u,
|
||||
SandboxPropagatesToAuxiliaryBrowsingContexts = 1u << 11u,
|
||||
SandboxedModals = 1u << 12u,
|
||||
SandboxedOrientationLock = 1u << 13u,
|
||||
SandboxedPresentation = 1u << 14u,
|
||||
SandboxedDownloads = 1u << 15u,
|
||||
SandboxedCustomProtocols = 1u << 16u,
|
||||
};
|
||||
|
||||
bool is_empty() const { return flags == 0; }
|
||||
|
||||
u32 flags { 0 };
|
||||
enum class SandboxingFlagSet {
|
||||
SandboxedNavigation = 1u << 0u,
|
||||
SandboxedAuxiliaryNavigation = 1u << 1u,
|
||||
SandboxedTopLevelNavigationWithoutUserActivation = 1u << 2u,
|
||||
SandboxedTopLevelNavigationWithUserActivation = 1u << 3u,
|
||||
SandboxedPlugins = 1u << 4u,
|
||||
SandboxedOrigin = 1u << 5u,
|
||||
SandboxedForms = 1u << 6u,
|
||||
SandboxedPointerLock = 1u << 7u,
|
||||
SandboxedScripts = 1u << 8u,
|
||||
SandboxedAutomaticFeatures = 1u << 9u,
|
||||
SandboxedDocumentDomain = 1u << 10u,
|
||||
SandboxPropagatesToAuxiliaryBrowsingContexts = 1u << 11u,
|
||||
SandboxedModals = 1u << 12u,
|
||||
SandboxedOrientationLock = 1u << 13u,
|
||||
SandboxedPresentation = 1u << 14u,
|
||||
SandboxedDownloads = 1u << 15u,
|
||||
SandboxedCustomProtocols = 1u << 16u,
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(SandboxingFlagSet);
|
||||
inline bool is_empty(SandboxingFlagSet s) { return (to_underlying(s) & 0x1FFU) == 0; }
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue