From a05c07fdcddd40529d4877f3cc5004326de7a0db Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 7 Feb 2022 02:09:17 +0100 Subject: [PATCH] LibWeb: Use NonnullRefPtrVector for focus chains Let's just use reference-counting pointers for this, even if it seems safe not to. --- Userland/Libraries/LibWeb/HTML/HTMLElement.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 351828ef4c..a652d6acf5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -182,15 +182,15 @@ void HTMLElement::parse_attribute(const FlyString& name, const String& value) } // https://html.spec.whatwg.org/multipage/interaction.html#focus-update-steps -static void run_focus_update_steps(Vector old_chain, Vector new_chain, DOM::Node& new_focus_target) +static void run_focus_update_steps(NonnullRefPtrVector old_chain, NonnullRefPtrVector new_chain, DOM::Node& new_focus_target) { // 1. If the last entry in old chain and the last entry in new chain are the same, // pop the last entry from old chain and the last entry from new chain and redo this step. while (!old_chain.is_empty() && !new_chain.is_empty() && &old_chain.last() == &new_chain.last()) { - old_chain.take_last(); - new_chain.take_last(); + (void)old_chain.take_last(); + (void)new_chain.take_last(); } // 2. For each entry entry in old chain, in order, run these substeps: @@ -277,14 +277,14 @@ static void run_focus_update_steps(Vector old_chain, Vector focus_chain(DOM::Node* subject) +static NonnullRefPtrVector focus_chain(DOM::Node* subject) { // FIXME: Move this somewhere more spec-friendly. if (!subject) return {}; // 1. Let output be an empty list. - Vector output; + NonnullRefPtrVector output; // 2. Let currentObject be subject. auto* current_object = subject;