mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:07:36 +00:00
LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
This commit is contained in:
parent
bb547ce1c4
commit
6f433c8656
445 changed files with 4797 additions and 4268 deletions
|
@ -13,13 +13,12 @@
|
|||
namespace Web::DOM {
|
||||
|
||||
class Text : public CharacterData {
|
||||
public:
|
||||
using WrapperType = Bindings::TextWrapper;
|
||||
WEB_PLATFORM_OBJECT(Text, CharacterData);
|
||||
|
||||
explicit Text(Document&, String const&);
|
||||
public:
|
||||
virtual ~Text() override = default;
|
||||
|
||||
static NonnullRefPtr<Text> create_with_global_object(Bindings::WindowObject& window, String const& data);
|
||||
static JS::NonnullGCPtr<Text> create_with_global_object(HTML::Window& window, String const& data);
|
||||
|
||||
// ^Node
|
||||
virtual FlyString node_name() const override { return "#text"; }
|
||||
|
@ -28,15 +27,18 @@ public:
|
|||
void set_always_editable(bool b) { m_always_editable = b; }
|
||||
|
||||
void set_owner_input_element(Badge<HTML::HTMLInputElement>, HTML::HTMLInputElement&);
|
||||
HTML::HTMLInputElement* owner_input_element() { return m_owner_input_element; }
|
||||
HTML::HTMLInputElement* owner_input_element() { return m_owner_input_element.ptr(); }
|
||||
|
||||
ExceptionOr<NonnullRefPtr<Text>> split_text(size_t offset);
|
||||
ExceptionOr<JS::NonnullGCPtr<Text>> split_text(size_t offset);
|
||||
|
||||
protected:
|
||||
explicit Text(Document&, String const&);
|
||||
Text(Document&, NodeType, String const&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
WeakPtr<HTML::HTMLInputElement> m_owner_input_element;
|
||||
JS::GCPtr<HTML::HTMLInputElement> m_owner_input_element;
|
||||
|
||||
bool m_always_editable { false };
|
||||
};
|
||||
|
@ -45,3 +47,5 @@ template<>
|
|||
inline bool Node::fast_is<Text>() const { return is_text(); }
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(Text, Web::DOM)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue