mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Cache name->element mappings in HTMLCollection
This makes https://wpt.fyi/ load today instead of tomorrow, although there's a lot of room for improvement still.
This commit is contained in:
parent
132ab775d8
commit
4d78c66b3d
Notes:
github-actions[bot]
2024-07-25 11:12:56 +00:00
Author: https://github.com/awesomekling
Commit: 4d78c66b3d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/823
Reviewed-by: https://github.com/shannonbooth
4 changed files with 48 additions and 31 deletions
|
@ -43,6 +43,7 @@ public:
|
|||
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_name(FlyString const&) const override;
|
||||
virtual bool is_supported_property_index(u32) const override;
|
||||
|
||||
protected:
|
||||
|
@ -57,9 +58,11 @@ private:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
void update_cache_if_needed() const;
|
||||
void update_name_to_element_mappings_if_needed() const;
|
||||
|
||||
mutable u64 m_cached_dom_tree_version { 0 };
|
||||
mutable Vector<JS::NonnullGCPtr<Element>> m_cached_elements;
|
||||
mutable OwnPtr<HashMap<FlyString, JS::NonnullGCPtr<Element>>> m_cached_name_to_element_mappings;
|
||||
|
||||
JS::NonnullGCPtr<ParentNode> m_root;
|
||||
Function<bool(Element const&)> m_filter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue