mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
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:
parent
6047f1adcb
commit
521ed0e911
41 changed files with 684 additions and 801 deletions
|
@ -6,13 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/LegacyPlatformObject.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-plugin
|
||||
class Plugin : public Bindings::LegacyPlatformObject {
|
||||
WEB_PLATFORM_OBJECT(Plugin, Bindings::LegacyPlatformObject);
|
||||
class Plugin : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(Plugin, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(Plugin);
|
||||
|
||||
public:
|
||||
|
@ -33,23 +33,11 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
// ^Bindings::LegacyPlatformObject
|
||||
// ^Bindings::PlatformObject
|
||||
virtual Vector<FlyString> supported_property_names() const override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const override;
|
||||
virtual bool is_supported_property_index(u32) const override;
|
||||
|
||||
virtual bool supports_indexed_properties() const override { return true; }
|
||||
virtual bool supports_named_properties() const override { return true; }
|
||||
virtual bool has_indexed_property_setter() const override { return false; }
|
||||
virtual bool has_named_property_setter() const override { return false; }
|
||||
virtual bool has_named_property_deleter() const override { return false; }
|
||||
virtual bool has_legacy_override_built_ins_interface_extended_attribute() const override { return false; }
|
||||
virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const override { return true; }
|
||||
virtual bool has_global_interface_extended_attribute() const override { return false; }
|
||||
virtual bool indexed_property_setter_has_identifier() const override { return false; }
|
||||
virtual bool named_property_setter_has_identifier() const override { return false; }
|
||||
virtual bool named_property_deleter_has_identifier() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue