mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 22:37:36 +00:00
LibWeb: Implement Document named properties with light caching
We now cache potentially named elements on the Document when elements are inserted and removed. This allows us to do lookup of what names are supported much faster than if we had to iterate the tree every time. This first cut doesn't implement the rules for 'exposed' object and embed elements.
This commit is contained in:
parent
faaf5b9652
commit
94149db073
6 changed files with 285 additions and 8 deletions
|
@ -555,8 +555,12 @@ public:
|
|||
JS::GCPtr<HTML::SessionHistoryEntry> latest_entry() const { return m_latest_entry; }
|
||||
void set_latest_entry(JS::GCPtr<HTML::SessionHistoryEntry> e) { m_latest_entry = e; }
|
||||
|
||||
void element_id_changed(Badge<DOM::Element>);
|
||||
void element_with_id_was_added_or_removed(Badge<DOM::Element>);
|
||||
void element_id_changed(Badge<DOM::Element>, JS::NonnullGCPtr<DOM::Element> element);
|
||||
void element_with_id_was_added(Badge<DOM::Element>, JS::NonnullGCPtr<DOM::Element> element);
|
||||
void element_with_id_was_removed(Badge<DOM::Element>, JS::NonnullGCPtr<DOM::Element> element);
|
||||
void element_name_changed(Badge<DOM::Element>, JS::NonnullGCPtr<DOM::Element> element);
|
||||
void element_with_name_was_added(Badge<DOM::Element>, JS::NonnullGCPtr<DOM::Element> element);
|
||||
void element_with_name_was_removed(Badge<DOM::Element>, JS::NonnullGCPtr<DOM::Element> element);
|
||||
|
||||
void add_form_associated_element_with_form_attribute(HTML::FormAssociatedElement&);
|
||||
void remove_form_associated_element_with_form_attribute(HTML::FormAssociatedElement&);
|
||||
|
@ -572,6 +576,10 @@ public:
|
|||
|
||||
void set_needs_to_resolve_paint_only_properties() { m_needs_to_resolve_paint_only_properties = true; }
|
||||
|
||||
virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const override;
|
||||
virtual Vector<FlyString> supported_property_names() const override;
|
||||
Vector<JS::NonnullGCPtr<DOM::Element>> const& potentially_named_elements() const { return m_potentially_named_elements; }
|
||||
|
||||
protected:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -796,6 +804,8 @@ private:
|
|||
|
||||
Vector<HTML::FormAssociatedElement*> m_form_associated_elements_with_form_attribute;
|
||||
|
||||
Vector<JS::NonnullGCPtr<DOM::Element>> m_potentially_named_elements;
|
||||
|
||||
bool m_design_mode_enabled { false };
|
||||
|
||||
bool m_needs_to_resolve_paint_only_properties { true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue