1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibWeb: Implement named and indexed property access for HTMLFormElement

This commit is contained in:
Andrew Kaster 2024-01-10 10:45:28 -07:00 committed by Andreas Kling
parent 521ed0e911
commit b5ec520f84
7 changed files with 446 additions and 11 deletions

View file

@ -8,6 +8,7 @@
#pragma once
#include <AK/Time.h>
#include <LibWeb/ARIA/Roles.h>
#include <LibWeb/HTML/AbstractBrowsingContext.h>
#include <LibWeb/HTML/HTMLElement.h>
@ -95,6 +96,12 @@ private:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
// ^PlatformObject
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 Vector<FlyString> supported_property_names() const override;
virtual bool is_supported_property_index(u32) const override;
ErrorOr<void> populate_vector_with_submittable_elements_in_tree_order(JS::NonnullGCPtr<DOM::Element> element, Vector<JS::NonnullGCPtr<DOM::Element>>& elements);
ErrorOr<String> pick_an_encoding() const;
@ -113,6 +120,13 @@ private:
Vector<JS::GCPtr<HTMLElement>> m_associated_elements;
// https://html.spec.whatwg.org/multipage/forms.html#past-names-map
struct PastNameEntry {
JS::GCPtr<DOM::Node const> node;
MonotonicTime insertion_time;
};
HashMap<FlyString, PastNameEntry> mutable m_past_names_map;
JS::GCPtr<DOM::HTMLFormControlsCollection> mutable m_elements;
bool m_constructing_entry_list { false };