mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Replace cached navigable with Navigable-maintained back-pointer
Now that Navigable directly owns its active document (m_active_document) we can have Navigable maintain a back-pointer on Document instead of using the old cache-with-validation pattern that fell back to a linear scan of all navigables via navigable_with_active_document().
This commit is contained in:
committed by
Alexander Kalenik
parent
2645695fdd
commit
4985dabf3d
Notes:
github-actions[bot]
2026-04-01 09:52:45 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/4985dabf3dd Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8726
@@ -398,17 +398,9 @@ WebIDL::ExceptionOr<void> Node::set_node_value(Optional<String> const& maybe_val
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#node-navigable
|
||||
GC::Ptr<HTML::Navigable> Node::navigable() const
|
||||
{
|
||||
auto& document = const_cast<Document&>(this->document());
|
||||
if (auto cached_navigable = document.cached_navigable()) {
|
||||
if (cached_navigable->active_document() == &document)
|
||||
return cached_navigable;
|
||||
}
|
||||
|
||||
// To get the node navigable of a node node, return the navigable whose active document is node's node document,
|
||||
// or null if there is no such navigable.
|
||||
auto navigable = HTML::Navigable::navigable_with_active_document(document);
|
||||
document.set_cached_navigable(navigable);
|
||||
return navigable;
|
||||
return document().navigable();
|
||||
}
|
||||
|
||||
[[maybe_unused]] static StringView to_string(StyleInvalidationReason reason)
|
||||
|
||||
Reference in New Issue
Block a user