LibWeb: Delete LegacyPlatformObject and move behavior to PlatformObject

We have two known PlatformObjects that need to implement some of the
behavior of LegacyPlatformObjects to date: Window, and HTMLFormElement.

To make this not require double (or virtual) inheritance of
PlatformObject, move the behavior of LegacyPlatformObject into
PlatformObject. The selection of LegacyPlatformObject behavior is done
with a new bitfield of feature flags instead of a dozen virtual
functions that return bool. This change simplifies every class involved
in the diff with the notable exception of Window, which now needs some
ugly const casts to implement named property access.
This commit is contained in:
Andrew Kaster 2024-01-09 16:05:03 -07:00 committed by Andreas Kling
parent 6047f1adcb
commit 521ed0e911
Notes: sideshowbarker 2024-07-17 01:28:15 +09:00
41 changed files with 684 additions and 801 deletions

View file

@ -15,8 +15,13 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(PluginArray);
PluginArray::PluginArray(JS::Realm& realm)
: Bindings::LegacyPlatformObject(realm)
: Bindings::PlatformObject(realm)
{
m_legacy_platform_object_flags = LegacyPlatformObjectFlags {
.supports_indexed_properties = true,
.supports_named_properties = true,
.has_legacy_unenumerable_named_properties_interface_extended_attribute = true,
};
}
PluginArray::~PluginArray() = default;