mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-07 00:29:47 +00:00
LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16
This has quite a lot of fall out. But the majority of it is just type or UDL substitution, where the changes just fall through to other function calls. By changing property key storage to UTF-16, the main affected areas are: * NativeFunction names must now be UTF-16 * Bytecode identifiers must now be UTF-16 * Module/binding names must now be UTF-16
This commit is contained in:
parent
cd276235d7
commit
0efa98a57a
Notes:
github-actions[bot]
2025-08-05 11:08:30 +00:00
Author: https://github.com/trflynn89
Commit: 0efa98a57a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5698
131 changed files with 766 additions and 726 deletions
|
@ -1090,7 +1090,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
|
|||
commit_pending_changes();
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, FlyString {}, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto mouseup_callback = realm().heap().allocate<WebIDL::CallbackType>(*mouseup_callback_function, realm());
|
||||
DOM::AddEventListenerOptions mouseup_listener_options;
|
||||
mouseup_listener_options.once = true;
|
||||
|
@ -1103,7 +1103,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
|
|||
}
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, FlyString {}, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto step_up_callback = realm().heap().allocate<WebIDL::CallbackType>(*up_callback_function, realm());
|
||||
up_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), step_up_callback));
|
||||
up_button->add_event_listener_without_options(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback));
|
||||
|
@ -1125,7 +1125,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
|
|||
}
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, FlyString {}, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto step_down_callback = realm().heap().allocate<WebIDL::CallbackType>(*down_callback_function, realm());
|
||||
down_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), step_down_callback));
|
||||
down_button->add_event_listener_without_options(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback));
|
||||
|
@ -1186,7 +1186,7 @@ void HTMLInputElement::create_file_input_shadow_tree()
|
|||
return JS::js_undefined();
|
||||
};
|
||||
|
||||
auto on_button_click_function = JS::NativeFunction::create(realm, move(on_button_click), 0, FlyString {}, &realm);
|
||||
auto on_button_click_function = JS::NativeFunction::create(realm, move(on_button_click), 0, Utf16FlyString {}, &realm);
|
||||
auto on_button_click_callback = realm.heap().allocate<WebIDL::CallbackType>(on_button_click_function, realm);
|
||||
m_file_button->add_event_listener_without_options(UIEvents::EventNames::click, DOM::IDLEventListener::create(realm, on_button_click_callback));
|
||||
|
||||
|
@ -1237,7 +1237,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
|
|||
|
||||
auto keydown_callback_function = JS::NativeFunction::create(
|
||||
realm(), [this](JS::VM& vm) {
|
||||
auto key = MUST(vm.argument(0).get(vm, "key"_fly_string)).as_string().utf8_string();
|
||||
auto key = MUST(vm.argument(0).get(vm, "key"_utf16_fly_string)).as_string().utf8_string();
|
||||
|
||||
if (key == "ArrowLeft" || key == "ArrowDown")
|
||||
MUST(step_down());
|
||||
|
@ -1252,13 +1252,13 @@ void HTMLInputElement::create_range_input_shadow_tree()
|
|||
user_interaction_did_change_input_value();
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, ""_fly_string, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto keydown_callback = realm().heap().allocate<WebIDL::CallbackType>(*keydown_callback_function, realm());
|
||||
add_event_listener_without_options(UIEvents::EventNames::keydown, DOM::IDLEventListener::create(realm(), keydown_callback));
|
||||
|
||||
auto wheel_callback_function = JS::NativeFunction::create(
|
||||
realm(), [this](JS::VM& vm) {
|
||||
auto delta_y = MUST(vm.argument(0).get(vm, "deltaY"_fly_string)).as_i32();
|
||||
auto delta_y = MUST(vm.argument(0).get(vm, "deltaY"_utf16_fly_string)).as_i32();
|
||||
if (delta_y > 0) {
|
||||
MUST(step_down());
|
||||
} else {
|
||||
|
@ -1267,12 +1267,12 @@ void HTMLInputElement::create_range_input_shadow_tree()
|
|||
user_interaction_did_change_input_value();
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, ""_fly_string, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto wheel_callback = realm().heap().allocate<WebIDL::CallbackType>(*wheel_callback_function, realm());
|
||||
add_event_listener_without_options(UIEvents::EventNames::wheel, DOM::IDLEventListener::create(realm(), wheel_callback));
|
||||
|
||||
auto update_slider_by_mouse = [this](JS::VM& vm) {
|
||||
auto client_x = MUST(vm.argument(0).get(vm, "clientX"_fly_string)).as_double();
|
||||
auto client_x = MUST(vm.argument(0).get(vm, "clientX"_utf16_fly_string)).as_double();
|
||||
auto rect = get_bounding_client_rect();
|
||||
double minimum = *min();
|
||||
double maximum = *max();
|
||||
|
@ -1290,7 +1290,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
|
|||
update_slider_by_mouse(vm);
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, ""_fly_string, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto mousemove_callback = realm().heap().allocate<WebIDL::CallbackType>(*mousemove_callback_function, realm());
|
||||
auto mousemove_listener = DOM::IDLEventListener::create(realm(), mousemove_callback);
|
||||
auto& window = static_cast<HTML::Window&>(relevant_global_object(*this));
|
||||
|
@ -1302,7 +1302,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
|
|||
window.remove_event_listener_without_options(UIEvents::EventNames::mousemove, mousemove_listener);
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, ""_fly_string, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto mouseup_callback = realm().heap().allocate<WebIDL::CallbackType>(*mouseup_callback_function, realm());
|
||||
DOM::AddEventListenerOptions mouseup_listener_options;
|
||||
mouseup_listener_options.once = true;
|
||||
|
@ -1310,7 +1310,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
|
|||
|
||||
return JS::js_undefined();
|
||||
},
|
||||
0, ""_fly_string, &realm());
|
||||
0, Utf16FlyString {}, &realm());
|
||||
auto mousedown_callback = realm().heap().allocate<WebIDL::CallbackType>(*mousedown_callback_function, realm());
|
||||
add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), mousedown_callback));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue