LibJS+LibWeb: Use GC::Weak instead of AK::WeakPtr for GC-allocated types

This makes some common types like JS::Object smaller (by 8 bytes) and
yields a minor speed improvement on many benchmarks.
This commit is contained in:
Andreas Kling 2025-10-16 11:13:54 +02:00 committed by Andreas Kling
parent 25a5ed94d6
commit dfa796a4e4
Notes: github-actions[bot] 2025-10-17 15:25:08 +00:00
36 changed files with 111 additions and 115 deletions

View file

@ -380,7 +380,7 @@ static void show_the_picker_if_applicable(HTMLInputElement& element)
// 2. Wait for the user to have made their selection.
auto accepted_file_types = element.parse_accept_attribute();
auto allow_multiple_files = element.has_attribute(HTML::AttributeNames::multiple) ? AllowMultipleFiles::Yes : AllowMultipleFiles::No;
auto weak_element = element.make_weak_ptr<HTMLInputElement>();
auto weak_element = GC::Weak<HTMLInputElement> { element };
element.set_is_open(true);
element.document().browsing_context()->top_level_browsing_context()->page().did_request_file_picker(weak_element, accepted_file_types, allow_multiple_files);
@ -404,7 +404,7 @@ static void show_the_picker_if_applicable(HTMLInputElement& element)
// events, or a cancel event.)
else {
if (element.type_state() == HTMLInputElement::TypeAttributeState::Color) {
auto weak_element = element.make_weak_ptr<HTMLInputElement>();
auto weak_element = GC::Weak<HTMLInputElement> { element };
element.set_is_open(true);
element.document().browsing_context()->top_level_browsing_context()->page().did_request_color_picker(weak_element, Color::from_utf16_string(element.value()).value_or(Color(0, 0, 0)));
}