Truly independent web browser
LibWeb: Ask for an element's attributes ahead when publishing it
Andreas Kling7e54e03d6dfb
diff --git a/Libraries/LibWeb/CSS/StyleEngineInput.cpp b/Libraries/LibWeb/CSS/StyleEngineInput.cppindex 6a26f6bf6e7..2c628bb1b3e 100644--- a/Libraries/LibWeb/CSS/StyleEngineInput.cpp+++ b/Libraries/LibWeb/CSS/StyleEngineInput.cpp@@ -347,8 +347,10 @@ static void prefetch_publication_ahead(size_t index, size_t count, NodeAt const&prefetch_node(*ahead);}if (index + nodes_ahead < count) {- if (auto const* ahead = as_if<DOM::Element>(node_at(index + nodes_ahead)))+ if (auto const* ahead = as_if<DOM::Element>(node_at(index + nodes_ahead))) {__builtin_prefetch(ahead->inline_style_declarations());+ __builtin_prefetch(ahead->attribute_list_memory());+ }}if (index + nodes_ahead / 2 < count) {if (auto const* ahead = as_if<DOM::Element>(node_at(index + nodes_ahead / 2)); ahead && ahead->inline_style_declarations())diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.hindex cd85ac51c45..6851f42a138 100644--- a/Libraries/LibWeb/DOM/Element.h+++ b/Libraries/LibWeb/DOM/Element.h@@ -268,6 +268,7 @@ public:// The element's attributes in order, borrowed until they next change.ReadonlySpan<Attribute> attribute_list() const;+ void const* attribute_list_memory() const { return m_attributes.ptr(); }// A filter over the local names of the attributes and the classes of this element and its descendants: a name whose// bit is clear is on none of them. Bits are only ever added, so a name may keep its bit after it is last removed.