mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 01:53:20 +00:00
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:
parent
25a5ed94d6
commit
dfa796a4e4
Notes:
github-actions[bot]
2025-10-17 15:25:08 +00:00
Author: https://github.com/awesomekling
Commit: dfa796a4e4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6496
36 changed files with 111 additions and 115 deletions
|
|
@ -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)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue